Skip to contentSkip to conversation

netfilter: nf_tables: avoid false-postive lockdep splat

PATCH Applied Florian Westphal 2 participants 2 messages Nov 19, 2020 – Nov 20, 2020

Subsystems (2)
lore
Share & tools
lore

Florian Westphal

author maintainer
#0 lore raw

PATCH 1/1 netfilter: nf_tables: avoid false-postive lockdep splat

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.

---
 net/netfilter/nf_tables_api.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
net/netfilter/nf_tables_api.c +2 -1
index 0f58e98542be..23abf1578594 100644
@@ -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
 }
 
Signature · 1 line
2.26.2
maintainer Applied
#1 lore raw
Quoted 4 lines · Florian Westphal

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]
Quoted 8 lines

...

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.