lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20200908192719.GA1300@bpf-dev>
Date:   Tue, 8 Sep 2020 16:27:20 -0300
From:   Carlos Antonio Neira Bustos <cneirabustos@...il.com>
To:     Andrii Nakryiko <andrii.nakryiko@...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 10:25:55PM -0700, Andrii Nakryiko wrote:
> 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
> >
> 
> [...]
Thanks Andrii,
I'll use bpf_probe_read_kernel_str(dst, 16, task->real_parent->comm),
I was not aware of that.

Bests!. 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ