Re: Unchecked sock pointer causes panic in RAW_TP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Kuniyuki Iwashima <kuniyu@xxxxxxxxxx>
Date: Fri, 31 Jan 2025 15:28:51 -0800
> From: Kuniyuki Iwashima <kuniyu@xxxxxxxxxx>
> Date: Fri, 31 Jan 2025 14:38:38 -0800
> > From: Yan Zhai <yan@xxxxxxxxxxxxxx>
> > 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@xxxxxxxxxxxxxxxxx/

Just for the record, I posted the fix:
https://lore.kernel.org/bpf/20250201001425.42377-1-kuniyu@xxxxxxxxxx/T/#u




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux