lkml.org 
[lkml]   [2023]   [Nov]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
SubjectRe: [syzbot] [PATCH] Test for 6465e260f487
From
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;
}

\
 
 \ /
  Last update: 2023-11-20 13:48    [W:0.104 / U:0.140 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site