On Thu, Nov 17, 2022 at 02:46:29PM +0100, Alexander Potapenko wrote: > On Wed, Nov 16, 2022 at 9:12 PM Eric Biggers <ebiggers@xxxxxxxxxx> wrote: > > > > Hi, > > > > I'm trying v6.1-rc5 with CONFIG_KMSAN, but the kernel continuously spams > > "BUG: KMSAN: uninit-value in __init_waitqueue_head". > > > > I tracked it down to lockdep (CONFIG_PROVE_LOCKING=y). The problem goes away if > > I disable that. > > > > I don't see any obvious use of uninitialized memory in __init_waitqueue_head(). > > > > The compiler I'm using is tip-of-tree clang (LLVM commit 4155be339ba80fef). > > > > Is this a known issue? > > > > - Eric > > Thanks for flagging this! > > The reason behind that is that under lockdep we're accessing the > contents of wq_head->lock->dep_map, which KMSAN considers > uninitialized. > The initialization of dep_map happens inside kernel/locking/lockdep.c, > for which KMSAN is deliberately disabled, because lockep used to > deadlock in the past. > > As far as I can tell, removing `KMSAN_SANITIZE_lockdep.o := n` does > not actually break anything now (although the kernel becomes quite > slow with both lockdep and KMSAN). Let me experiment a bit and send a > patch. > If this won't work out, we'll need an explicit call to > kmsan_unpoison_memory() somewhere in lockdep_init_map_type() to > suppress these reports. Thanks. I tried just disabling CONFIG_PROVE_LOCKING, but now KMSAN warnings are being spammed from check_stack_object() in mm/usercopy.c. Commenting out the call to arch_within_stack_frames() makes it go away. - Eric