[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAO3-PboVUb=ZPVVsELrhEh_Z_0PNbwcTdMxfKhoRtbagPy2ovQ@mail.gmail.com>
Date: Fri, 31 Jan 2025 18:55:08 -0600
From: Yan Zhai <yan@...udflare.com>
To: Kuniyuki Iwashima <kuniyu@...zon.com>
Cc: bpf@...r.kernel.org, kernel-team@...udflare.com,
linux-kernel@...r.kernel.org, netdev@...r.kernel.org
Subject: Re: Unchecked sock pointer causes panic in RAW_TP
On Fri, Jan 31, 2025 at 6:25 PM Kuniyuki Iwashima <kuniyu@...zon.com> wrote:
>
> From: Kuniyuki Iwashima <kuniyu@...zon.com>
> Date: Fri, 31 Jan 2025 15:28:51 -0800
> > From: Kuniyuki Iwashima <kuniyu@...zon.com>
> > Date: Fri, 31 Jan 2025 14:38:38 -0800
> > > From: Yan Zhai <yan@...udflare.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
This fix in the other thread is working as expected, thanks for the quick patch!
Yan
Powered by blists - more mailing lists