[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <87lfs4f7d6.fsf@dja-thinkpad.axtens.net>
Date: Mon, 25 Nov 2019 23:49:57 +1100
From: Daniel Axtens <dja@...ens.net>
To: Michael Ellerman <michael@...erman.id.au>,
Michael Ellerman <mpe@...erman.id.au>,
Bart Van Assche <bvanassche@....org>, Qian Cai <cai@....pw>
Cc: Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...nel.org>, linuxppc-dev@...ts.ozlabs.org,
linux-kernel@...r.kernel.org
Subject: Re: lockdep warning while booting POWER9 PowerNV
powerpc: define arch_is_kernel_initmem_freed() for lockdep
Under certain circumstances, we hit a warning in lockdep_register_key:
if (WARN_ON_ONCE(static_obj(key)))
return;
This occurs when the key falls into initmem that has since been freed
and can now be reused. This has been observed on boot, and under memory
pressure.
Define arch_is_kernel_initmem_freed(), which allows lockdep to correctly
identify this memory as dynamic.
This fixes a bug picked up by the powerpc64 syzkaller instance where we
hit the WARN via alloc_netdev_mqs.
Link: https://github.com/linuxppc/issues/issues/284
Link: https://lore.kernel.org/linuxppc-dev/87ef0vpfbc.fsf@mpe.ellerman.id.au/
Reported-by: Qian Cai <cai@....pw>
Reported-by: ppc syzbot c/o Andrew Donnellan <ajd@...ux.ibm.com>
Commit-message-by: Daniel Axtens <dja@...ens.net>
<mpe signoff here>
---
The ppc64 syzkaller link is probably not stable enough to go into
the git history forever, but fwiw:
https://syzkaller-ppc64.appspot.com/bug?id=cfdf75cd985012d0124cd41e6fa095d33e7d0f6b
---
arch/powerpc/include/asm/sections.h | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/arch/powerpc/include/asm/sections.h b/arch/powerpc/include/asm/sections.h
index 5a9b6eb651b6..d19871763ed4 100644
--- a/arch/powerpc/include/asm/sections.h
+++ b/arch/powerpc/include/asm/sections.h
@@ -5,8 +5,22 @@
#include <linux/elf.h>
#include <linux/uaccess.h>
+
+#define arch_is_kernel_initmem_freed arch_is_kernel_initmem_freed
+
#include <asm-generic/sections.h>
+extern bool init_mem_is_free;
+
+static inline int arch_is_kernel_initmem_freed(unsigned long addr)
+{
+ if (!init_mem_is_free)
+ return 0;
+
+ return addr >= (unsigned long)__init_begin &&
+ addr < (unsigned long)__init_end;
+}
+
extern char __head_end[];
#ifdef __powerpc64__
Powered by blists - more mailing lists