Re: [PATCH bpf-next v3 4/5] selftests/bpf: Add selftest support for bpf_xdp_metadata_rx_checksum
From: bot+bpf-ci@kernel.org
Date: 2026-02-17 09:17:48
Also in:
bpf, intel-wired-lan, linux-kselftest
quoted hunk ↗ jump to hunk
diff --git a/tools/testing/selftests/bpf/xdp_metadata.h b/tools/testing/selftests/bpf/xdp_metadata.h --- a/tools/testing/selftests/bpf/xdp_metadata.h +++ b/tools/testing/selftests/bpf/xdp_metadata.h
[ ... ]
+ struct {
+ __u8 ip_summed;
+ __u32 cksum_meta;
+ };The ip_summed field is __u8 (1 byte), but bpf_xdp_metadata_rx_checksum() takes an enum xdp_checksum * argument, which is 4 bytes. In the BPF program:
quoted hunk ↗ jump to hunk
diff --git a/tools/testing/selftests/bpf/progs/xdp_metadata.c b/tools/testing/selftests/bpf/progs/xdp_metadata.c --- a/tools/testing/selftests/bpf/progs/xdp_metadata.c +++ b/tools/testing/selftests/bpf/progs/xdp_metadata.c
[ ... ]
+ bpf_xdp_metadata_rx_checksum(ctx, + (enum xdp_checksum *)&meta->ip_summed, + &meta->cksum_meta);
The cast here passes a pointer to a 1-byte field where the kfunc will perform a 4-byte store. On little-endian this happens to work because the value lands in the low byte and the remaining 3 bytes go into struct padding. On big-endian, the value would be stored in the high byte, so reading back ip_summed as __u8 would yield 0 for any checksum result. For comparison, the other metadata fields match their kfunc argument sizes: rx_hash is __u32 matching u32 *, and rx_hash_type is __u32 matching enum xdp_rss_hash_type *. Should ip_summed be __u32 (or enum xdp_checksum) to match the kfunc signature and avoid the cast? --- 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/22091902298 AI-authorship-score: low AI-authorship-explanation: Code and commit message follow established kernel selftest patterns consistent with a known contributor, and the type choice reflects human engineering judgment. issues-found: 1 issue-severity-score: low issue-severity-explanation: Type size mismatch in selftest code where a __u8 field is cast to enum xdp_checksum * (4 bytes) for a kfunc call, causing incorrect behavior on big-endian architectures.