diff options
| author | Alexei Starovoitov <ast@kernel.org> | 2026-10-17 23:09:35 +0000 |
|---|---|---|
| committer | Alexei Starovoitov <ast@kernel.org> | 2026-10-18 00:36:43 +0000 |
| commit | b83bacf2161d0f8583e3f1e9c90402638992ad82 (patch) | |
| tree | dc2dffbaa88f34843d1378ab4a75ccdbe9cc0e75 /tools/perf/scripts/python/task-analyzer.py | |
| parent | c058636f788f8751e419b407206516280226e568 (diff) | |
bpf: Don't take a program with a target program for an iterator
bpf_iter_prog_supported() goes by the name of the attach function. Commit
7cc639dc45c5 ("bpf: Don't take an extension for an iterator program")
keeps out extensions, for which that is the name of a function of another
program. A tracing program with BPF_TRACE_ITER that is loaded with
attach_prog_fd gets there as well: unlike for BPF_TRACE_RAW_TP,
bpf_check_attach_target() does not mind the target program.
If the function is called like that of an iterator target, bpf_iter_bpf_map
for example, its id in the BTF of the program is cached as the id of the
target, even if the load fails later. Programs of that target which are
loaded already cannot be attached any more. And the program itself can be
attached as an iterator of that target, with a context that the verifier
has taken from the prototype of that function:
BUG: KASAN: stack-out-of-bounds in bpf_prog_66d4234e2e50f5b6_ts26_forged+0x12a/0x20b
Read of size 8 at addr ffffc90000d9fc48 by task ts26/104
Refuse every program that has a target program. That covers extensions.
Fixes: 15d83c4d7cef ("bpf: Allow loading of a bpf_iter program")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261017230950.802052-2-alexei.starovoitov@gmail.com
Diffstat (limited to 'tools/perf/scripts/python/task-analyzer.py')
0 files changed, 0 insertions, 0 deletions
