All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH bpf v4 0/3] bpf, sockmap: reject a packet-modifying SK_SKB stream parser
@ 2026-06-19  6:29 Sechang Lim
  2026-06-19  6:29 ` [PATCH bpf v4 1/3] selftests/bpf: don't modify the skb in the strparser parser prog Sechang Lim
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Sechang Lim @ 2026-06-19  6:29 UTC (permalink / raw)
  To: Alexei Starovoitov, Andrii Nakryiko, Daniel Borkmann,
	Eduard Zingerman, Kumar Kartikeya Dwivedi, John Fastabend,
	Jakub Sitnicki, David S . Miller, Jakub Kicinski, Eric Dumazet,
	Paolo Abeni, Kuniyuki Iwashima, Willem de Bruijn, Shuah Khan
  Cc: Jiri Olsa, Martin KaFai Lau, Song Liu, Yonghong Song,
	Simon Horman, Bobby Eshleman, Jiayuan Chen, bpf, netdev,
	linux-kernel, linux-kselftest

A BPF_PROG_TYPE_SK_SKB stream parser runs on strparser's message head,
which can chain skbs through frag_list. A parser that resizes the skb
frees the frag_list segments that strparser still tracks through
skb_nextp, leading to a use-after-free.

A stream parser is only meant to measure the next message, not to modify
the packet, so reject a packet-modifying parser at attach time.

v4:
 - drop the Fixes tag (Jiayuan Chen)
 - drop the unsafe skb modification from the test prog (John Fastabend)

v3:
 - https://lore.kernel.org/all/20260618102718.2331468-1-rhkrqnwk98@gmail.com/

v2:
 - https://lore.kernel.org/all/20260612123553.2724240-1-rhkrqnwk98@gmail.com/

v1:
 - https://lore.kernel.org/all/20260609112316.3685738-1-rhkrqnwk98@gmail.com/

Sechang Lim (3):
  selftests/bpf: don't modify the skb in the strparser parser prog
  bpf, sockmap: reject a packet-modifying SK_SKB stream parser
  selftests/bpf: test rejection of a packet-modifying SK_SKB stream
    parser

 net/core/sock_map.c                           | 20 ++++++++++++
 .../selftests/bpf/prog_tests/sockmap_strp.c   | 31 +++++++++++++++++++
 .../selftests/bpf/progs/sockmap_parse_prog.c  | 22 -------------
 .../selftests/bpf/progs/test_sockmap_strp.c   |  7 +++++
 4 files changed, 58 insertions(+), 22 deletions(-)

-- 
2.43.0


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

end of thread, other threads:[~2026-06-19  7:08 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-19  6:29 [PATCH bpf v4 0/3] bpf, sockmap: reject a packet-modifying SK_SKB stream parser Sechang Lim
2026-06-19  6:29 ` [PATCH bpf v4 1/3] selftests/bpf: don't modify the skb in the strparser parser prog Sechang Lim
2026-06-19  6:35   ` Jiayuan Chen
2026-06-19  7:08   ` bot+bpf-ci
2026-06-19  6:29 ` [PATCH bpf v4 2/3] bpf, sockmap: reject a packet-modifying SK_SKB stream parser Sechang Lim
2026-06-19  6:35   ` Jiayuan Chen
2026-06-19  6:51   ` sashiko-bot
2026-06-19  6:29 ` [PATCH bpf v4 3/3] selftests/bpf: test rejection of " Sechang Lim
2026-06-19  6:35   ` Jiayuan Chen
2026-06-19  7:08   ` bot+bpf-ci

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.