]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
selftests: drv-net: xdp: Fix register spill error with clang 20
authorDimitri Daskalakis <dimitri.daskalakis1@gmail.com>
Thu, 13 Nov 2025 04:31:02 +0000 (20:31 -0800)
committerJakub Kicinski <kuba@kernel.org>
Sat, 15 Nov 2025 01:45:07 +0000 (17:45 -0800)
On clang 20.1.8 the XDP program fails to load with a register spill error.
Since hdr_len is a __u32, the compiler decided it only needed the lower
32-bits of ctx->data, which later triggers the register spill verifier
error.

Suggested-by: Martin KaFai Lau <martin.lau@kernel.org>
Signed-off-by: Dimitri Daskalakis <dimitri.daskalakis1@gmail.com>
Link: https://patch.msgid.link/20251113043102.4062150-1-dimitri.daskalakis1@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
tools/testing/selftests/net/lib/xdp_native.bpf.c

index c368fc045f4b4dce466271eadf511ca11ee156d9..64f05229ab243781a9016dc9ce4b5b50890b12dc 100644 (file)
@@ -332,7 +332,7 @@ static __u16 csum_fold_helper(__u32 csum)
 }
 
 static int xdp_adjst_tail_shrnk_data(struct xdp_md *ctx, __u16 offset,
-                                    __u32 hdr_len)
+                                    unsigned long hdr_len)
 {
        char tmp_buff[MAX_ADJST_OFFSET];
        __u32 buff_pos, udp_csum = 0;
@@ -422,8 +422,9 @@ static int xdp_adjst_tail(struct xdp_md *ctx, __u16 port)
 {
        struct udphdr *udph = NULL;
        __s32 *adjust_offset, *val;
-       __u32 key, hdr_len;
+       unsigned long hdr_len;
        void *offset_ptr;
+       __u32 key;
        __u8 tag;
        int ret;