Messages in this thread | | | From | Andrii Nakryiko <> | Date | Mon, 1 Nov 2021 16:47:15 -0700 | Subject | Re: [PATCH v7 09/11] tools/testing/selftests/bpf: make it adopt to task comm size change |
| |
On Sun, Oct 31, 2021 at 11:04 PM Yafang Shao <laoar.shao@gmail.com> wrote: > > The hard-coded 16 is used in various bpf progs. These progs get task > comm either via bpf_get_current_comm() or prctl() or > bpf_core_read_str(), all of which can work well even if the task comm size > is changed. > > In these BPF programs, one thing to be improved is the > sched:sched_switch tracepoint args. As the tracepoint args are derived > from the kernel, we'd better make it same with the kernel. So the macro > TASK_COMM_LEN is converted to type enum, then all the BPF programs can > get it through BTF. > > The BPF program which wants to use TASK_COMM_LEN should include the header > vmlinux.h. Regarding the test_stacktrace_map and test_tracepoint, as the > type defined in linux/bpf.h are also defined in vmlinux.h, so we don't > need to include linux/bpf.h again. > > Signed-off-by: Yafang Shao <laoar.shao@gmail.com> > Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> > Cc: Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com> > Cc: Andrii Nakryiko <andrii.nakryiko@gmail.com> > Cc: Peter Zijlstra <peterz@infradead.org> > Cc: Steven Rostedt <rostedt@goodmis.org> > Cc: Al Viro <viro@zeniv.linux.org.uk> > Cc: Kees Cook <keescook@chromium.org> > Cc: Petr Mladek <pmladek@suse.com> > ---
LGTM, thanks.
Acked-by: Andrii Nakryiko <andrii@kernel.org>
> include/linux/sched.h | 9 +++++++-- > tools/testing/selftests/bpf/progs/test_stacktrace_map.c | 6 +++--- > tools/testing/selftests/bpf/progs/test_tracepoint.c | 6 +++--- > 3 files changed, 13 insertions(+), 8 deletions(-) >
[...]
| |