All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH nf] netfilter: nf_tables: avoid false-postive lockdep splat
@ 2020-11-19 15:34 Florian Westphal
  2020-11-20 12:54 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 2+ messages in thread
From: Florian Westphal @ 2020-11-19 15:34 UTC (permalink / raw)
  To: netfilter-devel; +Cc: Florian Westphal, Naresh Kamboju

There are reports wrt lockdep splat in nftables, e.g.:
------------[ cut here ]------------
WARNING: CPU: 2 PID: 31416 at net/netfilter/nf_tables_api.c:622
lockdep_nfnl_nft_mutex_not_held+0x28/0x38 [nf_tables]
...

These are caused by an earlier, unrelated bug such as a n ABBA deadlock
in a different subsystem.
In such an event, lockdep is disabled and lockdep_is_held returns true
unconditionally.  This then causes the WARN() in nf_tables.

Make the WARN conditional on lockdep still active to avoid this.

Fixes: f102d66b335a417 ("netfilter: nf_tables: use dedicated mutex to guard transactions")
Reported-by: Naresh Kamboju <naresh.kamboju@linaro.org>
Link: https://lore.kernel.org/linux-kselftest/CA+G9fYvFUpODs+NkSYcnwKnXm62tmP=ksLeBPmB+KFrB2rvCtQ@mail.gmail.com/
Signed-off-by: Florian Westphal <fw@strlen.de>
---
 net/netfilter/nf_tables_api.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index 0f58e98542be..23abf1578594 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -619,7 +619,8 @@ static int nft_request_module(struct net *net, const char *fmt, ...)
 static void lockdep_nfnl_nft_mutex_not_held(void)
 {
 #ifdef CONFIG_PROVE_LOCKING
-	WARN_ON_ONCE(lockdep_nfnl_is_held(NFNL_SUBSYS_NFTABLES));
+	if (debug_locks)
+		WARN_ON_ONCE(lockdep_nfnl_is_held(NFNL_SUBSYS_NFTABLES));
 #endif
 }
 
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH nf] netfilter: nf_tables: avoid false-postive lockdep splat
  2020-11-19 15:34 [PATCH nf] netfilter: nf_tables: avoid false-postive lockdep splat Florian Westphal
@ 2020-11-20 12:54 ` Pablo Neira Ayuso
  0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2020-11-20 12:54 UTC (permalink / raw)
  To: Florian Westphal; +Cc: netfilter-devel, Naresh Kamboju

On Thu, Nov 19, 2020 at 04:34:54PM +0100, Florian Westphal wrote:
> There are reports wrt lockdep splat in nftables, e.g.:
> ------------[ cut here ]------------
> WARNING: CPU: 2 PID: 31416 at net/netfilter/nf_tables_api.c:622
> lockdep_nfnl_nft_mutex_not_held+0x28/0x38 [nf_tables]
> ...
> 
> These are caused by an earlier, unrelated bug such as a n ABBA deadlock
> in a different subsystem.
> In such an event, lockdep is disabled and lockdep_is_held returns true
> unconditionally.  This then causes the WARN() in nf_tables.
> 
> Make the WARN conditional on lockdep still active to avoid this.

Applied, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-11-20 12:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-19 15:34 [PATCH nf] netfilter: nf_tables: avoid false-postive lockdep splat Florian Westphal
2020-11-20 12:54 ` Pablo Neira Ayuso

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.