From: Kuniyuki Iwashima <kuniyu@amazon.com>
To: <kuniyu@amazon.com>
Cc: <bpf@vger.kernel.org>, <kernel-team@cloudflare.com>,
<linux-kernel@vger.kernel.org>, <netdev@vger.kernel.org>,
<yan@cloudflare.com>
Subject: Re: Unchecked sock pointer causes panic in RAW_TP
Date: Fri, 31 Jan 2025 16:24:48 -0800 [thread overview]
Message-ID: <20250201002448.43472-1-kuniyu@amazon.com> (raw)
In-Reply-To: <20250131232851.36345-1-kuniyu@amazon.com>
From: Kuniyuki Iwashima <kuniyu@amazon.com>
Date: Fri, 31 Jan 2025 15:28:51 -0800
> From: Kuniyuki Iwashima <kuniyu@amazon.com>
> Date: Fri, 31 Jan 2025 14:38:38 -0800
> > From: Yan Zhai <yan@cloudflare.com>
> > Date: Fri, 31 Jan 2025 12:32:57 -0800
> > > Hello,
> > >
> > > We encountered a panic when tracing kfree_skb with RAW_TP. The problematic
> > > argument was introduced in commit ba8de796baf4 ("net: introduce
> > > sk_skb_reason_drop function"). It turns out that the verifier still accepted
> > > the program despite it didn't test sk == NULL. And this caused kernel panic. I
> > > attached a small reproducer and panic trace at the end. It's stably
> > > reproducible when packets are dropped without a receiver (e.g. run iperf2 UDP
> > > test toward localhost), in both 6.12.11 release and a recent bpf-next master
> > > snapshot (I was using commit c03320a6768c).
> > >
> > > As a contrast, for another tracepoint like tcp_send_reset, if sk is not checked
> > > before dereferencing, the verifier will complain and reject the program as
> > > expected. So this feels like some annotation is missing? Appreciate if someone
> > > could help me figure out.
> >
> > Maybe __nullable is missing given we annotated skb for tcp_send_reset ?
> > https://lore.kernel.org/netdev/20240911033719.91468-4-lulie@linux.alibaba.com/
Just for the record, I posted the fix:
https://lore.kernel.org/bpf/20250201001425.42377-1-kuniyu@amazon.com/T/#u
next prev parent reply other threads:[~2025-02-01 0:25 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-31 20:32 Unchecked sock pointer causes panic in RAW_TP Yan Zhai
2025-01-31 22:38 ` Kuniyuki Iwashima
2025-01-31 23:28 ` Kuniyuki Iwashima
2025-02-01 0:24 ` Kuniyuki Iwashima [this message]
2025-02-01 0:55 ` Yan Zhai
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=20250201002448.43472-1-kuniyu@amazon.com \
--to=kuniyu@amazon.com \
--cc=bpf@vger.kernel.org \
--cc=kernel-team@cloudflare.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=yan@cloudflare.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox