All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] net: refine debug info in skb_checksum_help()
@ 2023-10-06 17:33 Eric Dumazet
  2023-10-07  8:53 ` Willem de Bruijn
  2023-10-10  2:50 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Eric Dumazet @ 2023-10-06 17:33 UTC (permalink / raw)
  To: David S . Miller, Jakub Kicinski, Paolo Abeni
  Cc: netdev, eric.dumazet, Eric Dumazet, Willem de Bruijn

syzbot uses panic_on_warn.

This means that the skb_dump() I added in the blamed commit are
not even called.

Rewrite this so that we get the needed skb dump before syzbot crashes.

Fixes: eeee4b77dc52 ("net: add more debug info in skb_checksum_help()")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: Willem de Bruijn <willemb@google.com>
---
 net/core/dev.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index 85df22f05c38b663f050410b9f7bcd32dd781951..5aaf5753d4e46c7c4b67b00daadeda9784708dfe 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3292,15 +3292,19 @@ int skb_checksum_help(struct sk_buff *skb)
 
 	offset = skb_checksum_start_offset(skb);
 	ret = -EINVAL;
-	if (WARN_ON_ONCE(offset >= skb_headlen(skb))) {
+	if (unlikely(offset >= skb_headlen(skb))) {
 		DO_ONCE_LITE(skb_dump, KERN_ERR, skb, false);
+		WARN_ONCE(true, "offset (%d) >= skb_headlen() (%u)\n",
+			  offset, skb_headlen(skb));
 		goto out;
 	}
 	csum = skb_checksum(skb, offset, skb->len - offset, 0);
 
 	offset += skb->csum_offset;
-	if (WARN_ON_ONCE(offset + sizeof(__sum16) > skb_headlen(skb))) {
+	if (unlikely(offset + sizeof(__sum16) > skb_headlen(skb))) {
 		DO_ONCE_LITE(skb_dump, KERN_ERR, skb, false);
+		WARN_ONCE(true, "offset+2 (%zu) > skb_headlen() (%u)\n",
+			  offset + sizeof(__sum16), skb_headlen(skb));
 		goto out;
 	}
 	ret = skb_ensure_writable(skb, offset + sizeof(__sum16));
-- 
2.42.0.609.gbb76f46606-goog


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

* Re: [PATCH net] net: refine debug info in skb_checksum_help()
  2023-10-06 17:33 [PATCH net] net: refine debug info in skb_checksum_help() Eric Dumazet
@ 2023-10-07  8:53 ` Willem de Bruijn
  2023-10-10  2:50 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Willem de Bruijn @ 2023-10-07  8:53 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: David S . Miller, Jakub Kicinski, Paolo Abeni, netdev,
	eric.dumazet, Willem de Bruijn

On Fri, Oct 6, 2023 at 12:34 PM Eric Dumazet <edumazet@google.com> wrote:
>
> syzbot uses panic_on_warn.
>
> This means that the skb_dump() I added in the blamed commit are
> not even called.
>
> Rewrite this so that we get the needed skb dump before syzbot crashes.
>
> Fixes: eeee4b77dc52 ("net: add more debug info in skb_checksum_help()")
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Reported-by: Willem de Bruijn <willemb@google.com>

Reviewed-by: Willem de Bruijn <willemb@google.com>

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

* Re: [PATCH net] net: refine debug info in skb_checksum_help()
  2023-10-06 17:33 [PATCH net] net: refine debug info in skb_checksum_help() Eric Dumazet
  2023-10-07  8:53 ` Willem de Bruijn
@ 2023-10-10  2:50 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-10-10  2:50 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: davem, kuba, pabeni, netdev, eric.dumazet, willemb

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Fri,  6 Oct 2023 17:33:54 +0000 you wrote:
> syzbot uses panic_on_warn.
> 
> This means that the skb_dump() I added in the blamed commit are
> not even called.
> 
> Rewrite this so that we get the needed skb dump before syzbot crashes.
> 
> [...]

Here is the summary with links:
  - [net] net: refine debug info in skb_checksum_help()
    https://git.kernel.org/netdev/net/c/26c29961b142

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2023-10-10  2:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-06 17:33 [PATCH net] net: refine debug info in skb_checksum_help() Eric Dumazet
2023-10-07  8:53 ` Willem de Bruijn
2023-10-10  2:50 ` patchwork-bot+netdevbpf

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.