[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEf4BzYt3Wt5ABivJKifoW3XLL-U0B_KgXim0pUtqJUapo7raw@mail.gmail.com>
Date: Wed, 26 Aug 2020 22:25:55 -0700
From: Andrii Nakryiko <andrii.nakryiko@...il.com>
To: Carlos Neira <cneirabustos@...il.com>
Cc: Networking <netdev@...r.kernel.org>, Yonghong Song <yhs@...com>,
"Eric W. Biederman" <ebiederm@...ssion.com>,
Jesper Dangaard Brouer <brouer@...hat.com>,
bpf <bpf@...r.kernel.org>, Andrii Nakryiko <andriin@...com>
Subject: Re: [PATCH v1 bpf-next] bpf: new helper bpf_get_current_pcomm
On Wed, Aug 26, 2020 at 9:06 AM Carlos Neira <cneirabustos@...il.com> wrote:
>
> In multi-threaded applications bpf_get_current_comm is returning per-thread
> names, this helper will return comm from real_parent.
> This makes a difference for some Java applications, where get_current_comm is
> returning per-thread names, but get_current_pcomm will return "java".
>
Why not bpf_probe_read_kernel_str(dst, 16, task->real_parent->comm)
for fentry/fexit/tp_btf/etc BTF-aware BPF programs or
BPF_CORE_READ_STR_INTO(dst, task, real_parent, comm) for any BPF
program that has bpf_probe_read_kernel[_str]() (which is pretty much
every BPF program nowadays, I think)?
Yes, CONFIG_DEBUG_INFO_BTF=y Kconfig is a requirement, but it's a good
idea to have that if you are using BPF anyways.
> Signed-off-by: Carlos Neira <cneirabustos@...il.com>
> ---
> include/linux/bpf.h | 1 +
> include/uapi/linux/bpf.h | 15 ++++-
> kernel/bpf/core.c | 1 +
> kernel/bpf/helpers.c | 28 +++++++++
> kernel/trace/bpf_trace.c | 2 +
> tools/include/uapi/linux/bpf.h | 15 ++++-
> .../selftests/bpf/prog_tests/current_pcomm.c | 57 +++++++++++++++++++
> .../selftests/bpf/progs/test_current_pcomm.c | 17 ++++++
> 8 files changed, 134 insertions(+), 2 deletions(-)
> create mode 100644 tools/testing/selftests/bpf/prog_tests/current_pcomm.c
> create mode 100644 tools/testing/selftests/bpf/progs/test_current_pcomm.c
>
[...]
Powered by blists - more mailing lists