>     selftests/bpf: don't modify the skb in the strparser parser prog
>
>     sockmap_parse_prog.c is attached as an SK_SKB stream parser and modifies
>     the skb. It calls bpf_skb_pull_data() and writes a byte into the packet.
>     A stream parser runs on strparser's message head and must not modify it.
>     A resize frees the frag_list segments strparser still tracks, leading to
>     a use-after-free.
>
>     Make the parser read-only. It only needs to return the message length,
>     which keeps it attaching once packet-modifying parsers are rejected.
>
>     Signed-off-by: Sechang Lim <[email protected]>
>     Reviewed-by: Jiayuan Chen <[email protected]>

This removes a use-after-free where bpf_skb_pull_data(skb, 10) resizes and
frees the frag_list segments that strparser still tracks for the message
head.  The buggy bpf_skb_pull_data(skb, 10) call and the packet write being
removed here were added by commit 82a8616889d5 ("bpf: add map tests for
BPF_PROG_TYPE_SK_MSG").

Should this carry a Fixes: tag?

  Fixes: 82a8616889d5 ("bpf: add map tests for BPF_PROG_TYPE_SK_MSG")


---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md

CI run summary: https://github.com/kernel-patches/bpf/actions/runs/27809861429

Reply via email to