All of lore.kernel.org
 help / color / mirror / Atom feed
From: syzbot <syzbot+de4025c006ec68ac56fc@syzkaller.appspotmail.com>
To: linux-kernel@vger.kernel.org
Subject: Re: [syzbot] [PATCH] Test for 6465e260f487
Date: Sat, 04 Nov 2023 22:00:21 -0700	[thread overview]
Message-ID: <00000000000052081e0609609d8e@google.com> (raw)
In-Reply-To: <000000000000635bfa0607ed5cdc@google.com>

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;
 	}
 

  reply	other threads:[~2023-11-05  5:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-17 18:04 [syzbot] [netfilter?] WARNING in __nf_unregister_net_hook (6) syzbot
2023-11-05  5:00 ` syzbot [this message]
2023-11-19  5:15 ` [syzbot] [PATCH] Test for 6465e260f487 syzbot
2023-11-19 10:32 ` syzbot
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=00000000000052081e0609609d8e@google.com \
    --to=syzbot+de4025c006ec68ac56fc@syzkaller.appspotmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.