linux-stable/tools/lib
Toke Høiland-Jørgensen 682ddd62ab libbpf: Use OPTS_SET() macro in bpf_xdp_query()
[ Upstream commit 92a871ab9f ]

When the feature_flags and xdp_zc_max_segs fields were added to the libbpf
bpf_xdp_query_opts, the code writing them did not use the OPTS_SET() macro.
This causes libbpf to write to those fields unconditionally, which means
that programs compiled against an older version of libbpf (with a smaller
size of the bpf_xdp_query_opts struct) will have its stack corrupted by
libbpf writing out of bounds.

The patch adding the feature_flags field has an early bail out if the
feature_flags field is not part of the opts struct (via the OPTS_HAS)
macro, but the patch adding xdp_zc_max_segs does not. For consistency, this
fix just changes the assignments to both fields to use the OPTS_SET()
macro.

Fixes: 13ce2daa25 ("xsk: add new netlink attribute dedicated for ZC max frags")
Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20240206125922.1992815-1-toke@redhat.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-03-26 18:18:10 -04:00
..
api libapi: Add missing linux/types.h header to get the __u64 type on io.h 2024-01-25 15:45:20 -08:00
bpf libbpf: Use OPTS_SET() macro in bpf_xdp_query() 2024-03-26 18:18:10 -04:00
perf libperf rc_check: Add RC_CHK_EQUAL 2023-10-25 13:37:22 -07:00
subcmd libsubcmd: Fix memory leak in uniq() 2024-02-05 20:17:05 +00:00
symbol tools lib symbol: Add dependency test to install_headers 2022-12-14 11:16:12 -03:00
thermal tools/lib/thermal: Fix include path for libnl3 in pkg-config file. 2023-02-15 17:29:40 +01:00
argv_split.c
bitmap.c Bitmap patches for v6.0-rc1 2022-08-07 17:52:35 -07:00
ctype.c
find_bit.c tools: sync find_bit() implementation 2022-09-21 12:21:44 -07:00
hweight.c
list_sort.c tools lib: Adopt list_sort() from the kernel sources 2021-10-20 10:30:59 -03:00
rbtree.c
slab.c tools: Move gfp.h and slab.h from radix-tree to lib 2022-02-20 08:44:37 +02:00
str_error_r.c
string.c tools lib: Adopt memchr_inv() from kernel 2020-11-27 08:34:52 -03:00
vsprintf.c
zalloc.c