2024-01-11 07:29:39

by Oliver Sang

[permalink] [raw]
Subject: [linus:master] [kasan] a414d4286f: INFO:trying_to_register_non-static_key



Hello,

kernel test robot noticed "INFO:trying_to_register_non-static_key" on:

commit: a414d4286f3400aa05631c4931eb3feba83e29e8 ("kasan: handle concurrent kasan_record_aux_stack calls")
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git master

[test failed on linux-next/master 8cb47d7cd090a690c1785385b2f3d407d4a53ad0]

in testcase: boot

compiler: gcc-12
test machine: qemu-system-x86_64 -enable-kvm -cpu SandyBridge -smp 2 -m 16G

(please refer to attached dmesg/kmsg for entire log/backtrace)


+----------------------------------------------------+------------+------------+
| | a914d8d6cf | a414d4286f |
+----------------------------------------------------+------------+------------+
| INFO:trying_to_register_non-static_key | 0 | 22 |
+----------------------------------------------------+------------+------------+


If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-lkp/[email protected]


[ 1.582812][ T0] INFO: trying to register non-static key.
[ 1.583305][ T0] The code is fine but needs lockdep annotation, or maybe
[ 1.583887][ T0] you didn't initialize this object before use?
[ 1.584409][ T0] turning off the locking correctness validator.
[ 1.584930][ T0] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 6.7.0-rc4-00331-ga414d4286f34 #1
[ 1.585652][ T0] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
[ 1.586518][ T0] Call Trace:
[ 1.586782][ T0] <TASK>
[ 1.587071][ T0] dump_stack_lvl (lib/dump_stack.c:107)
[ 1.587449][ T0] register_lock_class (kernel/locking/lockdep.c:977 kernel/locking/lockdep.c:1289)
[ 1.587885][ T0] ? is_dynamic_key (kernel/locking/lockdep.c:1276)
[ 1.588290][ T0] __lock_acquire (kernel/locking/lockdep.c:5015)
[ 1.588671][ T0] ? x86_64_start_reservations (arch/x86/kernel/head64.c:543)
[ 1.589135][ T0] ? x86_64_start_kernel (arch/x86/kernel/head64.c:485 (discriminator 17))
[ 1.589562][ T0] ? secondary_startup_64_no_verify (arch/x86/kernel/head_64.S:432)
[ 1.590077][ T0] lock_acquire (kernel/locking/lockdep.c:467 kernel/locking/lockdep.c:5756)
[ 1.590449][ T0] ? __kasan_record_aux_stack (mm/kasan/generic.c:539)
[ 1.590907][ T0] ? lock_sync (kernel/locking/lockdep.c:5722)
[ 1.591269][ T0] _raw_spin_lock_irqsave (include/linux/spinlock_api_smp.h:111 kernel/locking/spinlock.c:162)
[ 1.591698][ T0] ? __kasan_record_aux_stack (mm/kasan/generic.c:539)
[ 1.592158][ T0] __kasan_record_aux_stack (mm/kasan/generic.c:539)
[ 1.592598][ T0] ? mem_pool_free (mm/kmemleak.c:508)
[ 1.592988][ T0] __call_rcu_common+0x6b/0x710
[ 1.593475][ T0] slab_free_freelist_hook (mm/slub.c:1783 mm/slub.c:1837)
[ 1.593923][ T0] ? apply_wqattrs_cleanup (kernel/workqueue.c:4329)
[ 1.594370][ T0] __kmem_cache_free (mm/slub.c:3820 mm/slub.c:3833)
[ 1.594770][ T0] ? do_raw_spin_unlock (arch/x86/include/asm/atomic.h:23 include/linux/atomic/atomic-arch-fallback.h:457 include/linux/atomic/atomic-instrumented.h:33 include/asm-generic/qspinlock.h:57 kernel/locking/spinlock_debug.c:100 kernel/locking/spinlock_debug.c:140)
[ 1.595193][ T0] apply_wqattrs_cleanup (kernel/workqueue.c:4329)
[ 1.595627][ T0] apply_workqueue_attrs_locked (kernel/workqueue.c:4452)
[ 1.596103][ T0] alloc_and_link_pwqs (kernel/workqueue.c:4481 kernel/workqueue.c:4599)
[ 1.596523][ T0] alloc_workqueue (kernel/workqueue.c:4724)
[ 1.596910][ T0] ? workqueue_sysfs_register (kernel/workqueue.c:4675)
[ 1.597380][ T0] workqueue_init_early (kernel/workqueue.c:6605 (discriminator 2))
[ 1.597809][ T0] ? workqueue_init_topology (kernel/workqueue.c:6531)
[ 1.598273][ T0] ? kmem_cache_create_usercopy (mm/slab_common.c:363)
[ 1.598752][ T0] start_kernel (init/main.c:965 (discriminator 3))
[ 1.599116][ T0] x86_64_start_reservations (arch/x86/kernel/head64.c:543)
[ 1.599564][ T0] x86_64_start_kernel (arch/x86/kernel/head64.c:485 (discriminator 17))
[ 1.599981][ T0] secondary_startup_64_no_verify (arch/x86/kernel/head_64.S:432)
[ 1.600482][ T0] </TASK>



The kernel config and materials to reproduce are available at:
https://download.01.org/0day-ci/archive/20240111/[email protected]



--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki



2024-01-11 15:52:31

by Tetsuo Handa

[permalink] [raw]
Subject: Re: [linus:master] [kasan] a414d4286f: INFO:trying_to_register_non-static_key

Commit a414d4286f34 ("kasan: handle concurrent kasan_record_aux_stack calls")
calls raw_spin_lock_init(&alloc_meta->aux_lock) after __memset() in
kasan_init_object_meta(), but does not call raw_spin_lock_init() after __memset()
in release_alloc_meta(), resulting in lock map information being zeroed out?

We should not zero out the whole sizeof(struct kasan_alloc_meta) bytes from
release_alloc_meta() in order not to undo raw_spin_lock_init() from
kasan_init_object_meta() ?

On 2024/01/11 16:29, kernel test robot wrote:
> [ 1.582812][ T0] INFO: trying to register non-static key.
> [ 1.583305][ T0] The code is fine but needs lockdep annotation, or maybe
> [ 1.583887][ T0] you didn't initialize this object before use?
> [ 1.584409][ T0] turning off the locking correctness validator.