linux/net/xdp
Zhiling Zou 70504de0bb xsk: Use a 32-bit compare in xsk_map_gen_lookup
xsk_map_gen_lookup() loads a u32 key and compares it with max_entries
using BPF_JMP_IMM. BPF immediates are sign-extended to 64 bits, so a
max_entries value of 0x80000000 or higher becomes a threshold larger
than every zero-extended 32-bit key. An out-of-range index then skips
the bounds check and the generated lookup reads past xsk_map[].

Compare with BPF_JMP32_IMM so the check stays in 32-bit unsigned range.

Fixes: e65650f291 ("bpf: Implement map_gen_lookup() callback for XSKMAP")
Reported-by: Vega <vega@nebusec.ai>
Signed-off-by: Zhiling Zou <zhilinz@nebusec.ai>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Reviewed-by: Emil Tsalapatis <emil@etsalapatis.com>
Link: https://patch.msgid.link/7d2cb8e8dfaa9eb8fdff85156987a60960787dc3.1789056660.git.zhilinz@nebusec.ai
Signed-off-by: Eduard Zingerman <eddyz87@gmail.com>
2026-09-17 10:56:16 -07:00
..
Kconfig treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
Makefile xsk: Introduce AF_XDP buffer allocation API 2020-05-21 17:31:26 -07:00
xdp_umem.c xsk: require at least 16 bytes of TX metadata 2026-08-03 16:43:53 -07:00
xdp_umem.h xsk: Fix umem cleanup bug at socket destruct 2020-11-20 15:52:39 +01:00
xsk_buff_pool.c xsk: honor XDP_TX_METADATA in zero-copy path 2026-08-24 11:12:00 -07:00
xsk_diag.c net: change sock.sk_ino and sock_i_ino() to u64 2026-03-06 14:31:26 +01:00
xsk_queue.c xsk: account ring allocations to memcg 2026-08-05 19:32:39 -07:00
xsk_queue.h xsk: reclaim invalid Tx descriptors in ZC batch path 2026-07-24 15:12:14 -07:00
xsk.c xsk: fix NULL pointer dereference in __xsk_rcv() 2026-08-20 11:31:35 -07:00
xsk.h xsk: remove repeated defines 2026-03-16 19:28:21 -07:00
xskmap.c xsk: Use a 32-bit compare in xsk_map_gen_lookup 2026-09-17 10:56:16 -07:00