(I'm so sorry!) Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git

selftests/bpf: Cover test_run csum validation after bpf_skb_change_tail()

Add BPF_F_TEST_SKB_CHECKSUM_COMPLETE tests for tc programs that move the skb out of CHECKSUM_COMPLETE with bpf_skb_change_tail(): - change_tail_trim trims the last 4 bytes of pkt_v4. They hold the non-zero tcp.urg_ptr, so the stale skb->csum no longer matches the packet. - change_tail_grow_write appends 4 zero bytes, which on their own do not change the sum, and then writes a byte with BPF_F_RECOMPUTE_CSUM. That write can no longer update skb->csum. Both return -EBADMSG without the preceding test_run fix and pass with it. Also add store_no_recompute as a negative test. It writes a byte without BPF_F_RECOMPUTE_CSUM, so the skb stays CHECKSUM_COMPLETE with a stale skb->csum, and test_run must keep returning -EBADMSG. This checks that the validation still runs for CHECKSUM_COMPLETE skbs. The passing case, a CHECKSUM_COMPLETE skb whose checksum is updated correctly, is already covered by test_skb_pkt_end. Signed-off-by: Maxim Skokov <skokovmaksimevg@gmail.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://patch.msgid.link/20261009174755.22026-3-skokovmaksimevg@gmail.com


Author Maxim Skokov Committer Alexei Starovoitov Date Commit Parent 36edb1c7
+85
2 changed files
+85
2 changed files