Issue 125227
Summary Crash when building dreadful Linux kernel code
Labels
Assignees
Reporter bjackman
    While experimenting with Linux kernel code I have managed to write code so bad that it crashes the toolchain.

This wonderful code is here: https://github.com/bjackman/linux/tree/clang-crash-demo

To reproduce it you should just need the normal linux kernel development dependencies (e.g. ctrl-f "dev dependencies [here](https://github.com/bjackman/limmat-kernel)).

```
$ tools/testing/kunit/kunit.py run --arch=x86_64 --kernel_args="nokaslr movablecore=16G page_owner=on earlyprintk=serial" --qemu_args="-m 32G -bios qboot.rom" --raw_output=all --timeout=10  --make_options "LLVM=1" --make_options "CC=ccache clang"
[14:02:08] Configuring KUnit Kernel ...
[14:02:08] Building KUnit Kernel ...
Populating config with:
$ make ARCH=x86_64 O=.kunit olddefconfig LLVM=1 CC=ccache clang
Building with:
$ make all compile_commands.json scripts_gdb ARCH=x86_64 O=.kunit --jobs=96 LLVM=1 CC=ccache clang
ERROR:root:vmlinux.o: warning: objtool: .discard.annotate_insn: dodgy linker, sh_entsize != 8
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
 #0 0x00007f44547c58fa llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/lib/llvm-16/bin/../lib/libLLVM-16.so.1+0xfc58fa)
 #1 0x00007f44547c3b34 llvm::sys::RunSignalHandlers() (/usr/lib/llvm-16/bin/../lib/libLLVM-16.so.1+0xfc3b34)
 #2 0x00007f44547c60cb (/usr/lib/llvm-16/bin/../lib/libLLVM-16.so.1+0xfc60cb)
 #3 0x00007f4453256590 (/lib/x86_64-linux-gnu/libc.so.6+0x3f590)
 #4 0x00007f445337ffc3 __memcpy_evex_unaligned_erms ./string/../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:765:0
 #5 0x000055740f3f308b void lld::elf::InputSection::writeTo<llvm::object::ELFType<(llvm::support::endianness)1, true>>(unsigned char*) (/usr/lib/llvm-16/bin/lld+0x1e708b)
 #6 0x000055740f422f53 (/usr/lib/llvm-16/bin/lld+0x216f53)
 #7 0x00007f4454745429 (/usr/lib/llvm-16/bin/../lib/libLLVM-16.so.1+0xf45429)
 #8 0x00007f44547447a4 (/usr/lib/llvm-16/bin/../lib/libLLVM-16.so.1+0xf447a4)
 #9 0x00007f44534e0f24 (/lib/x86_64-linux-gnu/libstdc++.so.6+0xe0f24)
#10 0x00007f44532a36c2 start_thread ./nptl/pthread_create.c:447:8
#11 0x00007f445331e128 clone3 ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:80:0
../scripts/link-vmlinux.sh: line 49: 37159 Bus error               ${ld} ${ldflags} -o ${output} ${wl}--whole-archive ${objs} ${wl}--no-whole-archive ${wl}--start-group ${libs} ${wl}--end-group ${kallsymso} ${btf_vmlinux_bin_o} ${arch_vmlinux_o} ${ldlibs}
make[3]: *** [../scripts/Makefile.vmlinux:77: vmlinux] Error 135
make[2]: *** [/usr/local/google/home/jackmanb/src/linux/linux/Makefile:1226: vmlinux] Error 2
make[1]: *** [/usr/local/google/home/jackmanb/src/linux/linux/Makefile:251: __sub-make] Error 2
make: *** [Makefile:251: __sub-make] Error 2
```

```
$  clang --version
Debian clang version 16.0.6 (27+build1)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
```

_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to