[llvm-bugs] [Bug 42589] New: Crash when building the Linux kernel for MIPS

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jul 11 11:29:46 PDT 2019


https://bugs.llvm.org/show_bug.cgi?id=42589

            Bug ID: 42589
           Summary: Crash when building the Linux kernel for MIPS
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: MIPS
          Assignee: unassignedbugs at nondot.org
          Reporter: natechancellor at gmail.com
                CC: llvm-bugs at lists.llvm.org

Original issue: https://github.com/ClangBuiltLinux/linux/issues/571

When building the file fs/ext4/ioctl.c in the Linux kernel
(https://github.com/torvalds/linux/blob/v5.2/fs/ext4/ioctl.c), we see the
following crash:

0.      Program arguments: /usr/lib/llvm-9/bin/clang -cc1 -triple
mipsel-unknown-linux-gnu -S -disable-free -disable-llvm-verifier
-discard-value-names -main-file-name ioctl.c -mrelocation-model static
-mthread-model posix -fno-delete-null-pointer-checks -mllvm
-warn-stack-size=1024 -relaxed-aliasing -fmath-errno -masm-verbose
-no-integrated-as -mconstructor-aliases -ffreestanding -fuse-init-array
-target-cpu mips32r2 -target-feature +noabicalls -target-feature +soft-float
-target-abi o32 -msoft-float -mfloat-abi soft -mllvm -mno-check-zero-division
-mllvm -mips-ssection-threshold=0 -mllvm -mgpopt -dwarf-column-info
-debugger-tuning=gdb -momit-leaf-frame-pointer -coverage-notes-file
/continuous-integration/linux/fs/ext4/ioctl.gcno -nostdsysteminc -nobuiltininc
-resource-dir /usr/lib/llvm-9/lib/clang/9.0.0 -isystem
/usr/lib/llvm-9/lib/clang/9.0.0/include -include ./include/linux/kconfig.h
-include ./include/linux/compiler_types.h -I ./arch/mips/include -I
./arch/mips/include/generated -I ./include -I ./arch/mips/include/uapi -I
./arch/mips/include/generated/uapi -I ./include/uapi -I
./include/generated/uapi -D __KERNEL__ -D
VMLINUX_LOAD_ADDRESS=0xffffffff80100000 -D DATAOFFSET=0 -D
GAS_HAS_SET_HARDFLOAT -D TOOLCHAIN_SUPPORTS_VIRT -D TOOLCHAIN_SUPPORTS_CRC -D
TOOLCHAIN_SUPPORTS_DSP -D TOOLCHAIN_SUPPORTS_GINV -I
./arch/mips/include/asm/mach-malta -I ./arch/mips/include/asm/mach-generic -D
KBUILD_BASENAME="ioctl" -D KBUILD_MODNAME="ext4" -O2 -Wall -Wundef
-Werror=strict-prototypes -Wno-trigraphs -Werror=implicit-function-declaration
-Werror=implicit-int -Wno-format-security -Wno-address-of-packed-member
-Wno-format-invalid-specifier -Wno-gnu -Wno-tautological-compare
-Wno-unused-const-variable -Wdeclaration-after-statement -Wvla
-Wno-pointer-sign -Werror=date-time -Werror=incompatible-pointer-types
-Wno-initializer-overrides -Wno-unused-value -Wno-format -Wno-sign-compare
-Wno-format-zero-length -Wno-uninitialized -std=gnu89 -fno-dwarf-directory-asm
-fdebug-compilation-dir /continuous-integration/linux -ferror-limit 19
-fmessage-length 0 -fwrapv -stack-protector 2 -fwchar-type=short
-fno-signed-wchar -fobjc-runtime=gcc -fno-common -fdiagnostics-show-option
-fcolor-diagnostics -vectorize-loops -vectorize-slp -o /tmp/ioctl-501db4.s -x c
fs/ext4/ioctl.c 
1.      <eof> parser at end of file
2.      Code generation
3.      Running pass 'Function Pass Manager' on module 'fs/ext4/ioctl.c'.
4.      Running pass 'MIPS DAG->DAG Pattern Instruction Selection' on function
'@ext4_ioctl'
 #0 0x00007f7b606524ff llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/lib/x86_64-linux-gnu/libLLVM-9.so.1+0xb394ff)
 #1 0x00007f7b60650940 llvm::sys::RunSignalHandlers()
(/usr/lib/x86_64-linux-gnu/libLLVM-9.so.1+0xb37940)
 #2 0x00007f7b60652901 (/usr/lib/x86_64-linux-gnu/libLLVM-9.so.1+0xb39901)
 #3 0x00007f7b63c8f730 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x12730)
 #4 0x00007f7b61ec2753
llvm::MipsSEDAGToDAGISel::SelectInlineAsmMemoryOperand(llvm::SDValue const&,
unsigned int, std::vector<llvm::SDValue, std::allocator<llvm::SDValue> >&)
(/usr/lib/x86_64-linux-gnu/libLLVM-9.so.1+0x23a9753)
 #5 0x00007f7b60c060b7
llvm::SelectionDAGISel::SelectInlineAsmMemoryOperands(std::vector<llvm::SDValue,
std::allocator<llvm::SDValue> >&, llvm::SDLoc const&)
(/usr/lib/x86_64-linux-gnu/libLLVM-9.so.1+0x10ed0b7)
 #6 0x00007f7b60c06a14 llvm::SelectionDAGISel::Select_INLINEASM(llvm::SDNode*,
bool) (/usr/lib/x86_64-linux-gnu/libLLVM-9.so.1+0x10eda14)
 #7 0x00007f7b60c03ac7 llvm::SelectionDAGISel::DoInstructionSelection()
(/usr/lib/x86_64-linux-gnu/libLLVM-9.so.1+0x10eaac7)
 #8 0x00007f7b60c03170 llvm::SelectionDAGISel::CodeGenAndEmitDAG()
(/usr/lib/x86_64-linux-gnu/libLLVM-9.so.1+0x10ea170)
 #9 0x00007f7b60c02837
llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&)
(/usr/lib/x86_64-linux-gnu/libLLVM-9.so.1+0x10e9837)
#10 0x00007f7b60c00226
llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&)
(/usr/lib/x86_64-linux-gnu/libLLVM-9.so.1+0x10e7226)
#11 0x00007f7b61e900da
llvm::MipsDAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&)
(/usr/lib/x86_64-linux-gnu/libLLVM-9.so.1+0x23770da)
#12 0x00007f7b608d6428
llvm::MachineFunctionPass::runOnFunction(llvm::Function&)
(/usr/lib/x86_64-linux-gnu/libLLVM-9.so.1+0xdbd428)
#13 0x00007f7b6074ecf6 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/usr/lib/x86_64-linux-gnu/libLLVM-9.so.1+0xc35cf6)
#14 0x00007f7b6074efa3 llvm::FPPassManager::runOnModule(llvm::Module&)
(/usr/lib/x86_64-linux-gnu/libLLVM-9.so.1+0xc35fa3)
#15 0x00007f7b6074f44a llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/usr/lib/x86_64-linux-gnu/libLLVM-9.so.1+0xc3644a)
#16 0x00000000007253a6 clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::HeaderSearchOptions const&, clang::CodeGenOptions const&,
clang::TargetOptions const&, clang::LangOptions const&, llvm::DataLayout
const&, llvm::Module*, clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >)
(/usr/lib/llvm-9/bin/clang+0x7253a6)
#17 0x0000000000de35fd (/usr/lib/llvm-9/bin/clang+0xde35fd)
#18 0x0000000001296133 clang::ParseAST(clang::Sema&, bool, bool)
(/usr/lib/llvm-9/bin/clang+0x1296133)
#19 0x0000000000b5b28f clang::FrontendAction::Execute()
(/usr/lib/llvm-9/bin/clang+0xb5b28f)
#20 0x0000000000b181b1
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/lib/llvm-9/bin/clang+0xb181b1)
#21 0x0000000000be4d60
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/lib/llvm-9/bin/clang+0xbe4d60)
#22 0x00000000006eda30 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/lib/llvm-9/bin/clang+0x6eda30)
#23 0x00000000006ebe40 main (/usr/lib/llvm-9/bin/clang+0x6ebe40)
#24 0x00007f7b5f65b09b __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x2409b)
#25 0x00000000006e917a _start (/usr/lib/llvm-9/bin/clang+0x6e917a)
clang: error: unable to execute command: Segmentation fault (core dumped)
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 9.0.0-svn364127-1~exp1+0~20190622095755.118~1.gbp9b9451 (trunk)
Target: mipsel-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
clang: note: diagnostic msg: PLEASE submit a bug report to
https://bugs.llvm.org/ and include the crash backtrace, preprocessed source,
and associated run script.
clang: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /tmp/ioctl-8c74cc.c
clang: note: diagnostic msg: /tmp/ioctl-8c74cc.sh
clang: note: diagnostic msg: 

********************

I creduce'd it down to:

a() { __asm__("" : "=ro"(*(int *)0)); }

with the following interestingness test:

#!/bin/bash

mipsel-linux-gnu-gcc -O2 -c -o /dev/null ioctl.i || exit 1

clang-9 -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -std=gnu89
--target=mipsel-linux-gnu --prefix=/usr/bin/ --gcc-toolchain=/usr
-no-integrated-as -mno-check-zero-division -mabi=32 -G 0 -mno-abicalls -fno-pic
-pipe -msoft-float -Wa,-msoft-float -ffreestanding -EL -fno-stack-check
-march=mips32r2 -Wa,--trap -fno-asynchronous-unwind-tables
-fno-delete-null-pointer-checks -O2 -fstack-protector-strong -mno-global-merge
-fomit-frame-pointer -g -fno-var-tracking -fno-strict-overflow
-fno-merge-all-constants -fno-stack-check -c -o /dev/null ioctl.i |& grep
"llvm::MipsSEDAGToDAGISel::SelectInlineAsmMemoryOperand"

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190711/d35bf81d/attachment-0001.html>


More information about the llvm-bugs mailing list