Git Product home page Git Product logo

Comments (6)

ramosian-glider avatar ramosian-glider commented on May 7, 2024

I've built the kernel using your config and LLVM r370631 (aka 5c6b82a7567cd16072a0424fb564c9d3ede11716 - see https://llvm.org/docs/GettingStarted.html for LLVM Git monorepo instructions; I don't think it makes sense to support the SVN workflow)
It boots and hangs after printing "Starting KernelMemorySanitizer". Taking a look.

from kmsan.

ramosian-glider avatar ramosian-glider commented on May 7, 2024

This could've been caused by CONFIG_LOCKDEP.
I'm seeing KMSAN re-entering the runtime at boot:

#0  0xffffffff819b9a9b in kmsan_get_shadow_origin_ptr (address=0xffffffff839371e0 <debug_locks>, 
    size=4, store=false) at mm/kmsan/kmsan.c:664
#1  0xffffffff819b9ed0 in __msan_metadata_ptr_for_load_4 (addr=0xffffffff839371e0 <debug_locks>)
    at mm/kmsan/kmsan_instr.c:54
#2  0xffffffff813c04b0 in lockdep_hardirqs_off (ip=18446744071589045830)
    at kernel/locking/lockdep.c:3371
#3  0xffffffff8164e328 in trace_hardirqs_off () at kernel/trace/trace_preemptirq.c:45
#4  0xffffffff819ba646 in __msan_poison_alloca (address=0xffffffff8380fd68, size=<optimized out>, 
    descr=0xffffffff8386a4f0 "----flags.i.i.i@debug_check_no_locks_freed")
    at mm/kmsan/kmsan_instr.c:266
#5  0xffffffff813cd368 in native_save_fl () at kernel/locking/lockdep.c:5206
#6  arch_local_save_flags ()
    at /usr/local/google/src/clang-kernel-build/kmsan-devel/./arch/x86/include/asm/irqflags.h:79
#7  arch_local_irq_save ()
    at /usr/local/google/src/clang-kernel-build/kmsan-devel/./arch/x86/include/asm/irqflags.h:120
#8  debug_check_no_locks_freed (mem_from=0xffffffff8387ea28 <global_trace+152>, mem_len=56)
    at kernel/locking/lockdep.c:5209
#9  0xffffffff813fabc3 in __raw_spin_lock_init (lock=0xffffffff8387ea28 <global_trace+152>, 
    name=0xffffffff837489ce "&global_trace.start_lock", 
    key=0xffffffff84686400 <tracer_alloc_buffers..key>) at kernel/locking/spinlock_debug.c:23
#10 0xffffffff83abe56f in tracer_alloc_buffers () at kernel/trace/trace.c:9073
#11 0xffffffff83abe3c9 in early_trace_init () at kernel/trace/trace.c:9176
#12 0xffffffff83a2c510 in start_kernel () at init/main.c:635
#13 0xffffffff83a2b4f2 in x86_64_start_reservations (real_mode_data=<optimized out>)
    at arch/x86/kernel/head64.c:472
#14 0xffffffff83a2b428 in x86_64_start_kernel (
    real_mode_data=0x140f0 <cpu_tss_rw+8432> <error: Cannot access memory at address 0x140f0>)
    at arch/x86/kernel/head64.c:453
#15 0xffffffff810000d4 in secondary_startup_64 () at arch/x86/kernel/head_64.S:241
#16 0x0000000000000000 in ?? ()

from kmsan.

ramosian-glider avatar ramosian-glider commented on May 7, 2024

Yeah, we're hitting a recursion here:

#0  task_kmsan_context_state () at mm/kmsan/kmsan.c:91
#1  0xffffffff819baa39 in __msan_get_context_state () at mm/kmsan/kmsan_instr.c:305
#2  0xffffffff8164e0b6 in trace_hardirqs_off () at kernel/trace/trace_preemptirq.c:38
#3  0xffffffff819ba646 in __msan_poison_alloca (address=0xffffffff8380f948, size=<optimized out>, 
    descr=0xffffffff8386a130 "----flags.i.i@lockdep_hardirqs_off") at mm/kmsan/kmsan_instr.c:266
#4  0xffffffff813c0535 in native_save_fl () at kernel/locking/lockdep.c:3378
#5  arch_local_save_flags () at /usr/local/google/src/clang-kernel-build/kmsan-devel/./arch/x86/include/asm/irqflags.h:79
#6  lockdep_hardirqs_off (ip=18446744071589045830) at kernel/locking/lockdep.c:3378
#7  0xffffffff8164e328 in trace_hardirqs_off () at kernel/trace/trace_preemptirq.c:45
#8  0xffffffff819ba646 in __msan_poison_alloca (address=0xffffffff8380fa88, size=<optimized out>, 
    descr=0xffffffff8386a130 "----flags.i.i@lockdep_hardirqs_off") at mm/kmsan/kmsan_instr.c:266
#9  0xffffffff813c0535 in native_save_fl () at kernel/locking/lockdep.c:3378
#10 arch_local_save_flags () at /usr/local/google/src/clang-kernel-build/kmsan-devel/./arch/x86/include/asm/irqflags.h:79
#11 lockdep_hardirqs_off (ip=18446744071589045830) at kernel/locking/lockdep.c:3378
#12 0xffffffff8164e328 in trace_hardirqs_off () at kernel/trace/trace_preemptirq.c:45
#13 0xffffffff819ba646 in __msan_poison_alloca (address=0xffffffff8380fbc8, size=<optimized out>, 
    descr=0xffffffff8386a130 "----flags.i.i@lockdep_hardirqs_off") at mm/kmsan/kmsan_instr.c:266
#14 0xffffffff813c0535 in native_save_fl () at kernel/locking/lockdep.c:3378
#15 arch_local_save_flags () at /usr/local/google/src/clang-kernel-build/kmsan-devel/./arch/x86/include/asm/irqflags.h:79
#16 lockdep_hardirqs_off (ip=18446744071589045830) at kernel/locking/lockdep.c:3378
#17 0xffffffff8164e328 in trace_hardirqs_off () at kernel/trace/trace_preemptirq.c:45
#18 0xffffffff819ba646 in __msan_poison_alloca (address=0xffffffff8380fd68, size=<optimized out>, 
    descr=0xffffffff8386a4f0 "----flags.i.i.i@debug_check_no_locks_freed") at mm/kmsan/kmsan_instr.c:266
#19 0xffffffff813cd368 in native_save_fl () at kernel/locking/lockdep.c:5206
#20 arch_local_save_flags () at /usr/local/google/src/clang-kernel-build/kmsan-devel/./arch/x86/include/asm/irqflags.h:79
#21 arch_local_irq_save () at /usr/local/google/src/clang-kernel-build/kmsan-devel/./arch/x86/include/asm/irqflags.h:120
#22 debug_check_no_locks_freed (mem_from=0xffffffff8387ea28 <global_trace+152>, mem_len=56) at kernel/locking/lockdep.c:5209
#23 0xffffffff813fabc3 in __raw_spin_lock_init (lock=0xffffffff8387ea28 <global_trace+152>, 
    name=0xffffffff837489ce "&global_trace.start_lock", key=0xffffffff84686400 <tracer_alloc_buffers..key>)
    at kernel/locking/spinlock_debug.c:23
#24 0xffffffff83abe56f in tracer_alloc_buffers () at kernel/trace/trace.c:9073
#25 0xffffffff83abe3c9 in early_trace_init () at kernel/trace/trace.c:9176
#26 0xffffffff83a2c510 in start_kernel () at init/main.c:635
#27 0xffffffff83a2b4f2 in x86_64_start_reservations (real_mode_data=<optimized out>) at arch/x86/kernel/head64.c:472
#28 0xffffffff83a2b428 in x86_64_start_kernel (
    real_mode_data=0x140f0 <cpu_tss_rw+8432> <error: Cannot access memory at address 0x140f0>)
    at arch/x86/kernel/head64.c:453

from kmsan.

ramosian-glider avatar ramosian-glider commented on May 7, 2024

Guess the easiest thing to do is to disable lockdep under KMSAN for now: 3c46b34

from kmsan.

ramosian-glider avatar ramosian-glider commented on May 7, 2024

Not sure why this got closed.

from kmsan.

ramosian-glider avatar ramosian-glider commented on May 7, 2024

Turns out this can be fixed by simply not instrumenting kernel/locking/lockdep.c.

from kmsan.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.