diff options
| author | Alexis Lothoré (eBPF Foundation) <alexis.lothore@bootlin.com> | 2026-09-03 15:51:35 +0200 |
|---|---|---|
| committer | Alexei Starovoitov <ast@kernel.org> | 2026-09-04 09:54:19 -0700 |
| commit | 040ef1f8b02e57b78081581d490ceec04ef5f7c0 (patch) | |
| tree | 8118e994ba3e7d3b809718448c51ccac92ba1980 /tools/testing/selftests/bpf/testing_helpers.c | |
| parent | cfc821c029fd66237b9a1f66362d93d4a5cab48e (diff) | |
| download | linux-next-040ef1f8b02e57b78081581d490ceec04ef5f7c0.tar.gz linux-next-040ef1f8b02e57b78081581d490ceec04ef5f7c0.zip | |
selftests/bpf: make cmdline_contains stricter
cmdline_contains is used by BPF selftests to check the presence of
specific kernel commandline parameters, but it currently suffers from
two issues:
- the read commandline isn't NULL terminated right after the read data
but only at the end of the buffer, leaving uninitialized bytes that
are then possibly tokenized
- the comparison of found tokens is done based on the size of found
token. This could lead to too-short-but-matching tokens to wrongly
match the search pattern.
Enforce stricter checks in cmdline_contains to avoid accidental matches.
Fixes: 399f6185a1c0 ("selftests/bpf: Fix selftests broken by mitigations=off")
Signed-off-by: Alexis Lothoré (eBPF Foundation) <alexis.lothore@bootlin.com>
Link: https://lore.kernel.org/r/20260903-kasan-v9-6-2407fe99255a@bootlin.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/testing/selftests/bpf/testing_helpers.c')
0 files changed, 0 insertions, 0 deletions
