how to start kmsan kernel with qemu

6 views
Skip to first unread message

Xin Long

unread,
Jun 21, 2019, 12:15:03 PM6/21/19
to kasa...@googlegroups.com, Dmitry Vyukov, Alexander Potapenko
this is my command:

/usr/libexec/qemu-kvm -smp 2 -m 4G -enable-kvm -cpu host \
-net nic -net user,hostfwd=tcp::10022-:22 \
-kernel /home/kmsan/arch/x86/boot/bzImage -nographic \
-device virtio-scsi-pci,id=scsi \
-device scsi-hd,bus=scsi.0,drive=d0 \
-drive file=/root/test/wheezy.img,format=raw,if=none,id=d0 \
-append "root=/dev/sda console=ttyS0 earlyprintk=serial rodata=n \
oops=panic panic_on_warn=1 panic=86400 kvm-intel.nested=1 \
security=apparmor ima_policy=tcb workqueue.watchdog_thresh=140 \
nf-conntrack-ftp.ports=20000 nf-conntrack-tftp.ports=20000 \
nf-conntrack-sip.ports=20000 nf-conntrack-irc.ports=20000 \
nf-conntrack-sane.ports=20000 vivid.n_devs=16 \
vivid.multiplanar=1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2 \
spec_store_bypass_disable=prctl nopcid"

the commit is on:
commit f75e4cfea97f67b7530b8b991b3005f991f04778 (HEAD)
Author: Alexander Potapenko <gli...@google.com>
Date: Wed May 22 12:30:13 2019 +0200

kmsan: use kmsan_handle_urb() in urb.c

and when starting, it shows:
[ 0.561925][ T0] Kernel command line: root=/dev/sda
console=ttyS0 earlyprintk=serial rodata=n oops=panic
panic_on_warn=1 panic=86400 kvm-intel.nested=1 security=ad
[ 0.707792][ T0] Memory: 3087328K/4193776K available (219164K
kernel code, 7059K rwdata, 11712K rodata, 5064K init, 11904K bss,
1106448K reserved, 0K cma-reserved)
[ 0.710935][ T0] SLUB: HWalign=64, Order=0-3, MinObjects=0,
CPUs=2, Nodes=1
[ 0.711953][ T0] Starting KernelMemorySanitizer
[ 0.712563][ T0]
==================================================================
[ 0.713657][ T0] BUG: KMSAN: uninit-value in mutex_lock+0xd1/0xe0
[ 0.714570][ T0] CPU: 0 PID: 0 Comm: swapper Not tainted 5.1.0 #5
[ 0.715417][ T0] Hardware name: Red Hat KVM, BIOS
1.11.1-3.module+el8.1.0+2983+b2ae9c0a 04/01/2014
[ 0.716659][ T0] Call Trace:
[ 0.717127][ T0] dump_stack+0x134/0x190
[ 0.717727][ T0] kmsan_report+0x131/0x2a0
[ 0.718347][ T0] __msan_warning+0x7a/0xf0
[ 0.718952][ T0] mutex_lock+0xd1/0xe0
[ 0.719478][ T0] __cpuhp_setup_state_cpuslocked+0x149/0xd20
[ 0.720260][ T0] ? vprintk_func+0x6b5/0x8a0
[ 0.720926][ T0] ? rb_get_reader_page+0x1140/0x1140
[ 0.721632][ T0] __cpuhp_setup_state+0x181/0x2e0
[ 0.722374][ T0] ? rb_get_reader_page+0x1140/0x1140
[ 0.723115][ T0] tracer_alloc_buffers+0x16b/0xb96
[ 0.723846][ T0] early_trace_init+0x193/0x28f
[ 0.724501][ T0] start_kernel+0x497/0xb38
[ 0.725134][ T0] x86_64_start_reservations+0x19/0x2f
[ 0.725871][ T0] x86_64_start_kernel+0x84/0x87
[ 0.726538][ T0] secondary_startup_64+0xa4/0xb0
[ 0.727173][ T0]
[ 0.727454][ T0] Local variable description:
----success.i.i.i.i@mutex_lock
[ 0.728379][ T0] Variable was created at:
[ 0.728977][ T0] mutex_lock+0x48/0xe0
[ 0.729536][ T0] __cpuhp_setup_state_cpuslocked+0x149/0xd20
[ 0.730323][ T0]
==================================================================
[ 0.731364][ T0] Disabling lock debugging due to kernel taint
[ 0.732169][ T0] Kernel panic - not syncing: panic_on_warn set ...
[ 0.733047][ T0] CPU: 0 PID: 0 Comm: swapper Tainted: G B
5.1.0 #5
[ 0.734080][ T0] Hardware name: Red Hat KVM, BIOS
1.11.1-3.module+el8.1.0+2983+b2ae9c0a 04/01/2014
[ 0.735319][ T0] Call Trace:
[ 0.735735][ T0] dump_stack+0x134/0x190
[ 0.736308][ T0] panic+0x3ec/0xb3b
[ 0.736826][ T0] kmsan_report+0x29a/0x2a0
[ 0.737417][ T0] __msan_warning+0x7a/0xf0
[ 0.737973][ T0] mutex_lock+0xd1/0xe0
[ 0.738527][ T0] __cpuhp_setup_state_cpuslocked+0x149/0xd20
[ 0.739342][ T0] ? vprintk_func+0x6b5/0x8a0
[ 0.739972][ T0] ? rb_get_reader_page+0x1140/0x1140
[ 0.740695][ T0] __cpuhp_setup_state+0x181/0x2e0
[ 0.741412][ T0] ? rb_get_reader_page+0x1140/0x1140
[ 0.742160][ T0] tracer_alloc_buffers+0x16b/0xb96
[ 0.742866][ T0] early_trace_init+0x193/0x28f
[ 0.743512][ T0] start_kernel+0x497/0xb38
[ 0.744128][ T0] x86_64_start_reservations+0x19/0x2f
[ 0.744863][ T0] x86_64_start_kernel+0x84/0x87
[ 0.745534][ T0] secondary_startup_64+0xa4/0xb0
[ 0.746290][ T0] Rebooting in 86400 seconds..

when I set "panic_on_warn=0", it foods the console with:
...
[ 25.206759][ C0] Variable was created at:
[ 25.207302][ C0] vprintk_emit+0xf4/0x800
[ 25.207844][ C0] vprintk_deferred+0x90/0xed
[ 25.208404][ C0]
==================================================================
[ 25.209763][ C0] x86_64_start_reservations+0x19/0x2f
[ 25.209769][ C0]
==================================================================
[ 25.211408][ C0] BUG: KMSAN: uninit-value in vprintk_emit+0x443/0x800
[ 25.212237][ C0] CPU: 0 PID: 0 Comm: swapper/0 Tainted: G B
5.1.0 #5
[ 25.213206][ C0] Hardware name: Red Hat KVM, BIOS
1.11.1-3.module+el8.1.0+2983+b2ae9c0a 04/01/2014
[ 25.214326][ C0] Call Trace:
[ 25.214725][ C0] <IRQ>
[ 25.215080][ C0] dump_stack+0x134/0x190
[ 25.215624][ C0] kmsan_report+0x131/0x2a0
[ 25.216204][ C0] __msan_warning+0x7a/0xf0
[ 25.216771][ C0] vprintk_emit+0x443/0x800
[ 25.217334][ C0] ? __msan_metadata_ptr_for_store_1+0x13/0x20
[ 25.218127][ C0] vprintk_deferred+0x90/0xed
[ 25.218714][ C0] printk_deferred+0x186/0x1d3
[ 25.219353][ C0] __printk_safe_flush+0x72e/0xc00
[ 25.220006][ C0] ? printk_safe_flush+0x1e0/0x1e0
[ 25.220635][ C0] irq_work_run+0x1ad/0x5c0
[ 25.221210][ C0] ? flat_init_apic_ldr+0x170/0x170
[ 25.221851][ C0] smp_irq_work_interrupt+0x237/0x3e0
[ 25.222520][ C0] irq_work_interrupt+0x2e/0x40
[ 25.223110][ C0] </IRQ>
[ 25.223475][ C0] RIP: 0010:kmem_cache_init_late+0x0/0xb
[ 25.224164][ C0] Code: d4 e8 5d dd 2e f2 e9 74 fe ff ff 48 89 d3
8b 7d d4 e8 cd d7 2e f2 89 c0 48 89 c1 48 c1 e1 20 48 09 c1 48 89 0b
e9 81 fe ff ff <55> 48 89 e5 e8 20 de 2e1
[ 25.226526][ C0] RSP: 0000:ffffffff8f40feb8 EFLAGS: 00000246
ORIG_RAX: ffffffffffffff09
[ 25.227548][ C0] RAX: ffff88813f995785 RBX: 0000000000000000
RCX: 0000000000000000
[ 25.228511][ C0] RDX: ffff88813f2b0784 RSI: 0000160000000000
RDI: 0000000000000785
[ 25.229473][ C0] RBP: ffffffff8f40ff20 R08: 000000000fac3785
R09: 0000778000000001
[ 25.230440][ C0] R10: ffffd0ffffffffff R11: 0000100000000000
R12: 0000000000000000
[ 25.231403][ C0] R13: 0000000000000000 R14: ffffffff8fb8cfd0
R15: 0000000000000000
[ 25.232407][ C0] ? start_kernel+0x5d8/0xb38
[ 25.233003][ C0] x86_64_start_reservations+0x19/0x2f
[ 25.233670][ C0] x86_64_start_kernel+0x84/0x87
[ 25.234314][ C0] secondary_startup_64+0xa4/0xb0
[ 25.234949][ C0]
[ 25.235231][ C0] Local variable description: ----flags.i.i.i@vprintk_emit
[ 25.236101][ C0] Variable was created at:
[ 25.236643][ C0] vprintk_emit+0xf4/0x800
[ 25.237188][ C0] vprintk_deferred+0x90/0xed
[ 25.237752][ C0]
==================================================================
[ 25.239117][ C0] x86_64_start_kernel+0x84/0x87
[ 25.239123][ C0]
==================================================================
[ 25.240704][ C0] BUG: KMSAN: uninit-value in vprintk_emit+0x443/0x800
[ 25.241540][ C0] CPU: 0 PID: 0 Comm: swapper/0 Tainted: G B
5.1.0 #5
[ 25.242512][ C0] Hardware name: Red Hat KVM, BIOS
1.11.1-3.module+el8.1.0+2983+b2ae9c0a 04/01/2014
[ 25.243635][ C0] Call Trace:
[ 25.244038][ C0] <IRQ>
[ 25.244390][ C0] dump_stack+0x134/0x190
[ 25.244940][ C0] kmsan_report+0x131/0x2a0
[ 25.245515][ C0] __msan_warning+0x7a/0xf0
[ 25.246082][ C0] vprintk_emit+0x443/0x800
[ 25.246638][ C0] ? __msan_metadata_ptr_for_store_1+0x13/0x20
[ 25.247430][ C0] vprintk_deferred+0x90/0xed
[ 25.248018][ C0] printk_deferred+0x186/0x1d3
[ 25.248650][ C0] __printk_safe_flush+0x72e/0xc00
[ 25.249320][ C0] ? printk_safe_flush+0x1e0/0x1e0
[ 25.249949][ C0] irq_work_run+0x1ad/0x5c0
[ 25.250524][ C0] ? flat_init_apic_ldr+0x170/0x170
[ 25.251167][ C0] smp_irq_work_interrupt+0x237/0x3e0
[ 25.251837][ C0] irq_work_interrupt+0x2e/0x40
[ 25.252424][ C0] </IRQ>
....


I couldn't even log in.

how should I use qemu with wheezy.img to start a kmsan kernel?

Thanks.

Alexander Potapenko

unread,
Jun 21, 2019, 2:06:11 PM6/21/19
to lucien xin, kasan-dev, Dmitriy Vyukov
Hi Xin,

Could you please share the config you're using to build the kernel?
I'll take a closer look on Monday when I am back to the office.

Xin Long

unread,
Jun 21, 2019, 4:09:59 PM6/21/19
to Alexander Potapenko, kasan-dev, Dmitriy Vyukov
as attached,

It actually came from https://syzkaller.appspot.com/x/.config?x=602468164ccdc30a
after I built, clang version changed to:

CONFIG_CLANG_VERSION=80000
config

Alexander Potapenko

unread,
Jun 27, 2019, 5:20:55 AM6/27/19
to Xin Long, kasan-dev, Dmitriy Vyukov
Hi Xin,

Sorry for the late reply.
I've built the ToT KMSAN tree using your config and my almost-ToT
Clang and couldn't reproduce the problem.
I believe something is wrong with your Clang version, as
CONFIG_CLANG_VERSION should really be 90000.
You can run `make V=1` to see which Clang version is being invoked -
make sure it's a fresh one.

HTH,
Alex
--
Alexander Potapenko
Software Engineer

Google Germany GmbH
Erika-Mann-Straße, 33
80636 München

Geschäftsführer: Paul Manicle, Halimah DeLaine Prado
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg

Alexander Potapenko

unread,
Jun 27, 2019, 5:23:10 AM6/27/19
to Xin Long, kasan-dev, Dmitriy Vyukov
Actually, your config says:
"Compiler: clang version 8.0.0 (trunk 343298)"
I think you'll need at least Clang r362410 (mine is r362913)

Xin Long

unread,
Jun 27, 2019, 10:45:40 AM6/27/19
to Alexander Potapenko, kasan-dev, Dmitriy Vyukov
Now I'm using:
# Compiler: clang version 9.0.0
(https://github.com/llvm/llvm-project.git
a056684c335995214f6d3467c699d32f8e73b763)

Errors shows up when building the kernel:

CC arch/x86/kernel/process_64.o
clang-9: /home/tools/llvm-project/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp:3236:
void {anonymous}::MemorySanitizerVisitor::visitCallSite(llvm::CallSite):
Assertion `(CS.isCall() || CS.isInvoke()) && "Unknown type of
CallSite"' failed.
Stack dump:
0. Program arguments: /home/tools/llvm-project/build/bin/clang-9
-cc1 -triple x86_64-unknown-linux-gnu -S -disable-free -main-file-name
process_64.c -mrelocation-model static -mthread-model posix
-fno-delete-null-pointer-checks -mllvm -warn-stack-size=2048
-mdisable-fp-elim -relaxed-aliasing -mdisable-tail-calls -fmath-errno
-masm-verbose -no-integrated-as -mconstructor-aliases -fuse-init-array
-mcode-model kernel -target-cpu core2 -target-feature
+retpoline-indirect-calls -target-feature +retpoline-indirect-branches
-target-feature -sse -target-feature -mmx -target-feature -sse2
-target-feature -3dnow -target-feature -avx -target-feature -x87
-target-feature +retpoline-external-thunk -disable-red-zone
-dwarf-column-info -debug-info-kind=limited -dwarf-version=4
-debugger-tuning=gdb -momit-leaf-frame-pointer -coverage-notes-file
/home/kmsan/arch/x86/kernel/process_64.gcno -nostdsysteminc
-nobuiltininc -resource-dir
/home/tools/llvm-project/build/lib/clang/9.0.0 -dependency-file
arch/x86/kernel/.process_64.o.d -MT arch/x86/kernel/process_64.o
-sys-header-deps -isystem
/home/tools/llvm-project/build/lib/clang/9.0.0/include -include
./include/linux/kconfig.h -include ./include/linux/compiler_types.h -I
./arch/x86/include -I ./arch/x86/include/generated -I ./include -I
./arch/x86/include/uapi -I ./arch/x86/include/generated/uapi -I
./include/uapi -I ./include/generated/uapi -D __KERNEL__ -D
CONFIG_X86_X32_ABI -D CONFIG_AS_CFI=1 -D CONFIG_AS_CFI_SIGNAL_FRAME=1
-D CONFIG_AS_CFI_SECTIONS=1 -D CONFIG_AS_SSSE3=1 -D CONFIG_AS_AVX=1 -D
CONFIG_AS_AVX2=1 -D CONFIG_AS_AVX512=1 -D CONFIG_AS_SHA1_NI=1 -D
CONFIG_AS_SHA256_NI=1 -D KBUILD_BASENAME="process_64" -D
KBUILD_MODNAME="process_64" -O2 -Wall -Wundef
-Werror=strict-prototypes -Wno-trigraphs
-Werror=implicit-function-declaration -Werror=implicit-int
-Wno-format-security -Wno-sign-compare -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
/home/kmsan -ferror-limit 19 -fmessage-length 0
-fsanitize=kernel-memory -fwrapv -stack-protector 2
-mstack-alignment=8 -fwchar-type=short -fno-signed-wchar
-fobjc-runtime=gcc -fno-common -fdiagnostics-show-option
-fcolor-diagnostics -vectorize-loops -vectorize-slp -o
/tmp/process_64-e20ead.s -x c arch/x86/kernel/process_64.c
1. <eof> parser at end of file
2. Per-module optimization passes
3. Running pass 'Function Pass Manager' on module
'arch/x86/kernel/process_64.c'.
4. Running pass 'MemorySanitizerLegacyPass' on function '@start_thread'
#0 0x00000000024f03ba llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/home/tools/llvm-project/build/bin/clang-9+0x24f03ba)
#1 0x00000000024ee214 llvm::sys::RunSignalHandlers()
(/home/tools/llvm-project/build/bin/clang-9+0x24ee214)
#2 0x00000000024ee375 SignalHandler(int)
(/home/tools/llvm-project/build/bin/clang-9+0x24ee375)
#3 0x00007f85ed99bd80 __restore_rt (/lib64/libpthread.so.0+0x12d80)
#4 0x00007f85ec47c93f raise (/lib64/libc.so.6+0x3793f)
#5 0x00007f85ec466c95 abort (/lib64/libc.so.6+0x21c95)
#6 0x00007f85ec466b69 _nl_load_domain.cold.0 (/lib64/libc.so.6+0x21b69)
#7 0x00007f85ec474df6 (/lib64/libc.so.6+0x2fdf6)
#8 0x000000000327b864 (anonymous
namespace)::MemorySanitizerVisitor::visitCallSite(llvm::CallSite)
(/home/tools/llvm-project/build/bin/clang-9+0x327b864)
#9 0x0000000003283036 (anonymous
namespace)::MemorySanitizerVisitor::runOnFunction()
(/home/tools/llvm-project/build/bin/clang-9+0x3283036)
#10 0x000000000328605f (anonymous
namespace)::MemorySanitizer::sanitizeFunction(llvm::Function&,
llvm::TargetLibraryInfo&)
(/home/tools/llvm-project/build/bin/clang-9+0x328605f)
#11 0x0000000001f42ac8
llvm::FPPassManager::runOnFunction(llvm::Function&)
(/home/tools/llvm-project/build/bin/clang-9+0x1f42ac8)
#12 0x0000000001f42be9 llvm::FPPassManager::runOnModule(llvm::Module&)
(/home/tools/llvm-project/build/bin/clang-9+0x1f42be9)
#13 0x0000000001f41ed8
llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/home/tools/llvm-project/build/bin/clang-9+0x1f41ed8)
#14 0x00000000026fa4f8 (anonymous
namespace)::EmitAssemblyHelper::EmitAssembly(clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >)
(/home/tools/llvm-project/build/bin/clang-9+0x26fa4f8)
#15 0x00000000026fbbf8
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> >)
(/home/tools/llvm-project/build/bin/clang-9+0x26fbbf8)
#16 0x000000000310234d
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/home/tools/llvm-project/build/bin/clang-9+0x310234d)
#17 0x0000000003aaddf9 clang::ParseAST(clang::Sema&, bool, bool)
(/home/tools/llvm-project/build/bin/clang-9+0x3aaddf9)
#18 0x00000000030fe5e0 clang::CodeGenAction::ExecuteAction()
(/home/tools/llvm-project/build/bin/clang-9+0x30fe5e0)
#19 0x0000000002ba1929 clang::FrontendAction::Execute()
(/home/tools/llvm-project/build/bin/clang-9+0x2ba1929)
#20 0x0000000002b68e62
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/home/tools/llvm-project/build/bin/clang-9+0x2b68e62)
#21 0x0000000002c5738a
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/home/tools/llvm-project/build/bin/clang-9+0x2c5738a)
#22 0x00000000009cd1a6 cc1_main(llvm::ArrayRef<char const*>, char
const*, void*) (/home/tools/llvm-project/build/bin/clang-9+0x9cd1a6)
#23 0x000000000094cac1 main
(/home/tools/llvm-project/build/bin/clang-9+0x94cac1)
#24 0x00007f85ec468813 __libc_start_main (/lib64/libc.so.6+0x23813)
#25 0x00000000009c96ee _start
(/home/tools/llvm-project/build/bin/clang-9+0x9c96ee)
clang-9: error: unable to execute command: Aborted (core dumped)
clang-9: error: clang frontend command failed due to signal (use -v to
see invocation)
clang version 9.0.0 (https://github.com/llvm/llvm-project.git
a056684c335995214f6d3467c699d32f8e73b763)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/tools/llvm-project/build/bin
clang-9: 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-9: note: diagnostic msg:
********************

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

********************
make[2]: *** [scripts/Makefile.build:276:
arch/x86/kernel/process_64.o] Error 254


any idea why?

Alexander Potapenko

unread,
Jun 28, 2019, 8:40:44 AM6/28/19
to Xin Long, kasan-dev, Dmitriy Vyukov
It's interesting that you're seeing the same error as reported here:
https://github.com/google/kmsan/issues/53
I've updated my Clang to a4771e9dfdb0485c2edb416bfdc479d49de0aa14, but
the kernel compiles just fine.
May I ask you to do the following:

- run `make V=1` to capture the command line used to build
arch/x86/kernel/process_64.o
- copy and paste the command line into a shell, remove '-o
/tmp/somefile' and run again to make sure the compiler still crashes
- replace '-c' with '-E' in the command line and add '-o
process_64.i' to the end
- send me the resulting preprocessed file (process_64.i)

Thanks!

Xin Long

unread,
Jun 28, 2019, 9:10:12 AM6/28/19
to Alexander Potapenko, kasan-dev, Dmitriy Vyukov
This is what I did:
https://paste.fedoraproject.org/paste/q4~GWx9Sx~QUbJQfNDoJIw

There's no process_64.i file generated.

Btw, I couldn't find "-c" in the command line, so there was no "-E" added.

Alexander Potapenko

unread,
Jun 28, 2019, 9:24:49 AM6/28/19
to Xin Long, kasan-dev, Dmitriy Vyukov
On Fri, Jun 28, 2019 at 3:10 PM Xin Long <lucie...@gmail.com> wrote:
>
> This is what I did:
> https://paste.fedoraproject.org/paste/q4~GWx9Sx~QUbJQfNDoJIw
>
> There's no process_64.i file generated.
>
> Btw, I couldn't find "-c" in the command line, so there was no "-E" added.
Ah, right, Clang is invoked with -S. Could you replace that one with -E?

Xin Long

unread,
Jun 28, 2019, 9:35:49 AM6/28/19
to Alexander Potapenko, kasan-dev, Dmitriy Vyukov
As attached, thanks.
process_64.i

Alexander Potapenko

unread,
Jun 28, 2019, 9:48:01 AM6/28/19
to Xin Long, kasan-dev, Dmitriy Vyukov
Hm, strange, but I still can compile this file.
Does the following command line crash your compiler?
https://paste.fedoraproject.org/paste/oJwOVm5cHWyd7hxIZ4uGeA (note it
should be run from the same directory where process_64.i resides; also
make sure to invoke the right Clang)

Xin Long

unread,
Jun 28, 2019, 10:20:20 AM6/28/19
to Alexander Potapenko, kasan-dev, Dmitriy Vyukov

Alexander Potapenko

unread,
Jun 28, 2019, 12:10:00 PM6/28/19
to lucien xin, kasan-dev, Dmitriy Vyukov
Hm, now that's your Clang binary versus mine :)
Can you please ensure your git repo doesn't contain local changes and share the commands you're using to build Clang?
(Both cmake and make or ninja)
Is the bug still reproducible in a clean CMake directory?

Xin Long

unread,
Jun 28, 2019, 1:18:31 PM6/28/19
to Alexander Potapenko, kasan-dev, Dmitriy Vyukov
# cd /home/tools/
# git clone https://github.com/llvm/llvm-project.git
# cd llvm-project/
# mkdir build
# cd build/
# cmake -DLLVM_ENABLE_PROJECTS=clang -DCMAKE_BUILD_TYPE=Release
-DLLVM_ENABLE_ASSERTIONS=ON -G "Unix Makefiles" ../llvm
# make
# cd /home/kmsan
# git checkout f75e4cfea97f
(use the .config I sent you last time)
# make CC=/home/tools/llvm-project/build/bin/clang -j64 -k LOCALVERSION= 2>&1

These are the whole thing I did to build it.

On Sat, Jun 29, 2019 at 12:09 AM Alexander Potapenko <gli...@google.com> wrote:
>
> Hm, now that's your Clang binary versus mine :)
> Can you please ensure your git repo doesn't contain local changes and share the commands you're using to build Clang?
> (Both cmake and make or ninja)
No any local changes on both llvm-project and kmsan

> Is the bug still reproducible in a clean CMake directory?
A clean CMake directory? how to clean it? something like: # cmake clean

Thank you for being so patient. :-)

Alexander Potapenko

unread,
Jun 28, 2019, 1:22:57 PM6/28/19
to lucien xin, kasan-dev, Dmitriy Vyukov
Thanks! I'll try this out next week. My tree might also have local changes, if so, I'd better figure it out sooner rather than later :)

Xin Long

unread,
Jun 28, 2019, 1:24:51 PM6/28/19
to Alexander Potapenko, kasan-dev, Dmitriy Vyukov
On Sat, Jun 29, 2019 at 1:18 AM Xin Long <lucie...@gmail.com> wrote:
>
> # cd /home/tools/
> # git clone https://github.com/llvm/llvm-project.git
> # cd llvm-project/
> # mkdir build
> # cd build/
> # cmake -DLLVM_ENABLE_PROJECTS=clang -DCMAKE_BUILD_TYPE=Release
> -DLLVM_ENABLE_ASSERTIONS=ON -G "Unix Makefiles" ../llvm
the output is:
https://paste.fedoraproject.org/paste/D9-QpmZnDcXkr4AykumRnw
myabe you can have a vimdiff for the outputs of yours and mine.

> # make
sorry, it was # make -j64

Alexander Potapenko

unread,
Jul 2, 2019, 5:32:15 AM7/2/19
to Xin Long, kasan-dev, Dmitriy Vyukov
Ah, I see.
You build with assertions enabled, I for some reason did not.
There's really a bug in KMSAN instrumentation, I'll fix it.

Xin Long

unread,
Jul 2, 2019, 5:39:55 AM7/2/19
to Alexander Potapenko, kasan-dev, Dmitriy Vyukov
On Tue, Jul 2, 2019 at 5:32 PM Alexander Potapenko <gli...@google.com> wrote:
>
> Ah, I see.
> You build with assertions enabled, I for some reason did not.
> There's really a bug in KMSAN instrumentation, I'll fix it.
Thanks, great that you figured it out so quickly.
I'm waiting. :-)

Alexander Potapenko

unread,
Jul 2, 2019, 9:32:43 AM7/2/19
to Xin Long, kasan-dev, Dmitriy Vyukov
https://reviews.llvm.org/D64072 seems to fix the problem. I hope to
land this patch soon, in the meantime you can apply it to your Clang.
Thanks for your help tracking the bug down!
> --
> You received this message because you are subscribed to the Google Groups "kasan-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to kasan-dev+...@googlegroups.com.
> To post to this group, send email to kasa...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/kasan-dev/CADvbK_d8HnKu%2BoSGha4w2wWRmQW8w%2BmqxJDnqDqezZEvVd-_7A%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.

Xin Long

unread,
Jul 3, 2019, 4:36:02 AM7/3/19
to Alexander Potapenko, kasan-dev, Dmitriy Vyukov
On Tue, Jul 2, 2019 at 9:32 PM Alexander Potapenko <gli...@google.com> wrote:
>
> https://reviews.llvm.org/D64072 seems to fix the problem. I hope to
> land this patch soon, in the meantime you can apply it to your Clang.
It worked perfectly, thanks!

Alexander Potapenko

unread,
Jul 3, 2019, 11:31:28 AM7/3/19
to Xin Long, kasan-dev, Dmitriy Vyukov
Glad to hear!
I've submitted the patch to LLVM.
Reply all
Reply to author
Forward
0 new messages