* Re: [syzbot] [PATCH] Test for 6465e260f487
2023-10-17 18:04 [syzbot] [netfilter?] WARNING in __nf_unregister_net_hook (6) syzbot
@ 2023-11-05 5:00 ` syzbot
2023-11-19 5:15 ` syzbot
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: syzbot @ 2023-11-05 5:00 UTC (permalink / raw)
To: linux-kernel
For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.
***
Subject: [PATCH] Test for 6465e260f487
Author: eadavis@sina.com
please test warn in __nf_unregister_net_hook
#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 6465e260f487
diff --git a/net/netfilter/core.c b/net/netfilter/core.c
index 3126911f5042..fc1b337aec8f 100644
--- a/net/netfilter/core.c
+++ b/net/netfilter/core.c
@@ -117,7 +117,8 @@ nf_hook_entries_grow(const struct nf_hook_entries *old,
orig_ops = nf_hook_entries_get_hook_ops(old);
for (i = 0; i < old_entries; i++) {
- if (orig_ops[i] != &dummy_ops)
+ if (!__kernel_text_address(orig_ops[i]) &&
+ orig_ops[i] != &dummy_ops)
alloc_entries++;
/* Restrict BPF hook type to force a unique priority, not
@@ -146,7 +147,8 @@ nf_hook_entries_grow(const struct nf_hook_entries *old,
i = 0;
nhooks = 0;
while (i < old_entries) {
- if (orig_ops[i] == &dummy_ops) {
+ if (__kernel_text_address(orig_ops[i]) ||
+ orig_ops[i] == &dummy_ops) {
++i;
continue;
}
@@ -263,10 +265,12 @@ static void *__nf_hook_entries_try_shrink(struct nf_hook_entries *old,
new_ops = nf_hook_entries_get_hook_ops(new);
for (i = 0, j = 0; i < old->num_hook_entries; i++) {
- if (orig_ops[i] == &dummy_ops)
+ if (IS_ERR_OR_NULL(orig_ops[i]) || orig_ops[i] == &dummy_ops)
continue;
new->hooks[j] = old->hooks[i];
new_ops[j] = (void *)orig_ops[i];
+ printk("new ents: %p, new uo h: %p, new ops: %p, %s\n",
+ new, new->hooks[j], new_ops[j], __func__);
j++;
}
hooks_validate(new);
@@ -479,6 +483,7 @@ static bool nf_remove_net_hook(struct nf_hook_entries *old,
continue;
WRITE_ONCE(old->hooks[i].hook, accept_all);
WRITE_ONCE(orig_ops[i], (void *)&dummy_ops);
+ printk("ents: %p, deled ops: %p, i: %d, %s\n", old, orig_ops[i], i, __func__);
return true;
}
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [syzbot] [PATCH] Test for 6465e260f487
2023-10-17 18:04 [syzbot] [netfilter?] WARNING in __nf_unregister_net_hook (6) syzbot
2023-11-05 5:00 ` [syzbot] [PATCH] Test for 6465e260f487 syzbot
@ 2023-11-19 5:15 ` syzbot
2023-11-19 10:32 ` syzbot
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: syzbot @ 2023-11-19 5:15 UTC (permalink / raw)
To: linux-kernel
For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.
***
Subject: [PATCH] Test for 6465e260f487
Author: eadavis@sina.com
please test warn in __nf_unregister_net_hook
#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 6465e260f487
diff --git a/net/netfilter/core.c b/net/netfilter/core.c
index 3126911f5042..58f2a5294453 100644
--- a/net/netfilter/core.c
+++ b/net/netfilter/core.c
@@ -113,6 +113,7 @@ nf_hook_entries_grow(const struct nf_hook_entries *old,
alloc_entries = 1;
old_entries = old ? old->num_hook_entries : 0;
+ mutex_lock(&nf_hook_mutex);
if (old) {
orig_ops = nf_hook_entries_get_hook_ops(old);
@@ -129,17 +130,23 @@ nf_hook_entries_grow(const struct nf_hook_entries *old,
* prevent defrag, conntrack, iptables etc from attaching).
*/
if (reg->priority == orig_ops[i]->priority &&
- reg->hook_ops_type == NF_HOOK_OP_BPF)
- return ERR_PTR(-EBUSY);
+ reg->hook_ops_type == NF_HOOK_OP_BPF) {
+ new = ERR_PTR(-EBUSY);
+ goto unlock;
+ }
}
}
- if (alloc_entries > MAX_HOOK_COUNT)
- return ERR_PTR(-E2BIG);
+ if (alloc_entries > MAX_HOOK_COUNT) {
+ new = ERR_PTR(-E2BIG);
+ goto unlock;
+ }
new = allocate_hook_entries_size(alloc_entries);
- if (!new)
- return ERR_PTR(-ENOMEM);
+ if (!new) {
+ new = ERR_PTR(-ENOMEM);
+ goto unlock;
+ }
new_ops = nf_hook_entries_get_hook_ops(new);
@@ -170,6 +177,8 @@ nf_hook_entries_grow(const struct nf_hook_entries *old,
new->hooks[nhooks].priv = reg->priv;
}
+unlock:
+ mutex_unlock(&nf_hook_mutex);
return new;
}
@@ -546,11 +555,13 @@ void nf_hook_entries_delete_raw(struct nf_hook_entries __rcu **pp,
{
struct nf_hook_entries *p;
+ mutex_lock(&nf_hook_mutex);
p = rcu_dereference_raw(*pp);
if (nf_remove_net_hook(p, reg)) {
p = __nf_hook_entries_try_shrink(p, pp);
nf_hook_entries_free(p);
}
+ mutex_unlock(&nf_hook_mutex);
}
EXPORT_SYMBOL_GPL(nf_hook_entries_delete_raw);
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [syzbot] [PATCH] Test for 6465e260f487
2023-10-17 18:04 [syzbot] [netfilter?] WARNING in __nf_unregister_net_hook (6) syzbot
2023-11-05 5:00 ` [syzbot] [PATCH] Test for 6465e260f487 syzbot
2023-11-19 5:15 ` syzbot
@ 2023-11-19 10:32 ` syzbot
2023-11-20 3:07 ` syzbot
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: syzbot @ 2023-11-19 10:32 UTC (permalink / raw)
To: linux-kernel
For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.
***
Subject: [PATCH] Test for 6465e260f487
Author: eadavis@sina.com
please test warn in __nf_unregister_net_hook
#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 6465e260f487
diff --git a/net/netfilter/core.c b/net/netfilter/core.c
index 3126911f5042..58f2a5294453 100644
--- a/net/netfilter/core.c
+++ b/net/netfilter/core.c
@@ -546,11 +555,13 @@ void nf_hook_entries_delete_raw(struct nf_hook_entries __rcu **pp,
{
struct nf_hook_entries *p;
+ mutex_lock(&nf_hook_mutex);
p = rcu_dereference_raw(*pp);
if (nf_remove_net_hook(p, reg)) {
p = __nf_hook_entries_try_shrink(p, pp);
nf_hook_entries_free(p);
}
+ mutex_unlock(&nf_hook_mutex);
}
EXPORT_SYMBOL_GPL(nf_hook_entries_delete_raw);
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [syzbot] [PATCH] Test for 6465e260f487
2023-10-17 18:04 [syzbot] [netfilter?] WARNING in __nf_unregister_net_hook (6) syzbot
` (2 preceding siblings ...)
2023-11-19 10:32 ` syzbot
@ 2023-11-20 3:07 ` syzbot
2023-11-20 10:56 ` syzbot
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: syzbot @ 2023-11-20 3:07 UTC (permalink / raw)
To: linux-kernel
For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.
***
Subject: [PATCH] Test for 6465e260f487
Author: eadavis@sina.com
please test warn in __nf_unregister_net_hook
#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 6465e260f487
diff --git a/net/netfilter/core.c b/net/netfilter/core.c
index 3126911f5042..bec4aeef6a82 100644
--- a/net/netfilter/core.c
+++ b/net/netfilter/core.c
@@ -200,8 +200,10 @@ int nf_hook_entries_insert_raw(struct nf_hook_entries __rcu **pp,
struct nf_hook_entries *new_hooks;
struct nf_hook_entries *p;
+ mutex_lock(&nf_hook_mutex);
p = rcu_dereference_raw(*pp);
new_hooks = nf_hook_entries_grow(p, reg);
+ mutex_unlock(&nf_hook_mutex);
if (IS_ERR(new_hooks))
return PTR_ERR(new_hooks);
@@ -546,11 +548,13 @@ void nf_hook_entries_delete_raw(struct nf_hook_entries __rcu **pp,
{
struct nf_hook_entries *p;
+ mutex_lock(&nf_hook_mutex);
p = rcu_dereference_raw(*pp);
if (nf_remove_net_hook(p, reg)) {
p = __nf_hook_entries_try_shrink(p, pp);
nf_hook_entries_free(p);
}
+ mutex_unlock(&nf_hook_mutex);
}
EXPORT_SYMBOL_GPL(nf_hook_entries_delete_raw);
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [syzbot] [PATCH] Test for 6465e260f487
2023-10-17 18:04 [syzbot] [netfilter?] WARNING in __nf_unregister_net_hook (6) syzbot
` (3 preceding siblings ...)
2023-11-20 3:07 ` syzbot
@ 2023-11-20 10:56 ` syzbot
2024-02-17 12:38 ` [syzbot] WARNING in __nf_unregister_net_hook syzbot
2024-02-19 14:04 ` syzbot
6 siblings, 0 replies; 8+ messages in thread
From: syzbot @ 2023-11-20 10:56 UTC (permalink / raw)
To: linux-kernel
For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.
***
Subject: [PATCH] Test for 6465e260f487
Author: eadavis@sina.com
please test warn in __nf_unregister_net_hook
#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 6465e260f487
diff --git a/net/netfilter/nft_chain_filter.c b/net/netfilter/nft_chain_filter.c
index 680fe557686e..246f381a8970 100644
--- a/net/netfilter/nft_chain_filter.c
+++ b/net/netfilter/nft_chain_filter.c
@@ -368,6 +368,9 @@ static int nf_tables_netdev_event(struct notifier_block *this,
event != NETDEV_CHANGENAME)
return NOTIFY_DONE;
+ if (!check_net(ctx.net))
+ return NOTIFY_DONE;
+
nft_net = nft_pernet(ctx.net);
mutex_lock(&nft_net->commit_mutex);
list_for_each_entry(table, &nft_net->tables, list) {
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [syzbot] WARNING in __nf_unregister_net_hook
2023-10-17 18:04 [syzbot] [netfilter?] WARNING in __nf_unregister_net_hook (6) syzbot
` (4 preceding siblings ...)
2023-11-20 10:56 ` syzbot
@ 2024-02-17 12:38 ` syzbot
2024-02-19 14:04 ` syzbot
6 siblings, 0 replies; 8+ messages in thread
From: syzbot @ 2024-02-17 12:38 UTC (permalink / raw)
To: linux-kernel, syzkaller-bugs
For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com.
***
Subject: WARNING in __nf_unregister_net_hook
Author: fw@strlen.de
#syz test: https://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf.git main
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [syzbot] WARNING in __nf_unregister_net_hook
2023-10-17 18:04 [syzbot] [netfilter?] WARNING in __nf_unregister_net_hook (6) syzbot
` (5 preceding siblings ...)
2024-02-17 12:38 ` [syzbot] WARNING in __nf_unregister_net_hook syzbot
@ 2024-02-19 14:04 ` syzbot
6 siblings, 0 replies; 8+ messages in thread
From: syzbot @ 2024-02-19 14:04 UTC (permalink / raw)
To: linux-kernel, syzkaller-bugs
For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com.
***
Subject: WARNING in __nf_unregister_net_hook
Author: fw@strlen.de
#syz test: https://git.kernel.org/pub/scm/linux/kernel/git/fwestphal/nf.git dormant-reset
^ permalink raw reply [flat|nested] 8+ messages in thread