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. -- Alexander Potapenko Software Engineer Google Germany GmbH Erika-Mann-Straße, 33 80636 München Geschäftsführer: Paul Manicle, Liana Sebastian Registergericht und -nummer: Hamburg, HRB 86891 Sitz der Gesellschaft: Hamburg