All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Borkmann <daniel@iogearbox.net>
To: Javier Honduvilla Coto <javierhonduco@fb.com>, netdev@vger.kernel.org
Cc: yhs@fb.com, kernel-team@fb.com, jonhaslam@fb.com
Subject: Re: [PATCH v6 bpf-next 0/3] bpf: add bpf_descendant_of helper
Date: Fri, 12 Jul 2019 14:41:42 +0200	[thread overview]
Message-ID: <a3784df6-851e-e829-57f4-740af000a58f@iogearbox.net> (raw)
In-Reply-To: <20190710180025.94726-1-javierhonduco@fb.com>

On 07/10/2019 08:00 PM, Javier Honduvilla Coto wrote:
> Hi all,
> 
> This patch adds the bpf_descendant_of helper which accepts a PID and
> returns 1 if the PID of the process currently being executed is a
> descendant of it or if it's itself. Returns 0 otherwise. The passed
> PID should be the one as seen from the "global" pid namespace as the
> processes' PIDs in the hierarchy are resolved using the context of said
> initial namespace.
> 
> This is very useful in tracing programs when we want to filter by a
> given PID and all the children it might spawn. The current workarounds
> most people implement for this purpose have issues:
> 
> - Attaching to process spawning syscalls and dynamically add those PIDs
> to some bpf map that would be used to filter is cumbersome and
> potentially racy.
> - Unrolling some loop to perform what this helper is doing consumes lots
> of instructions. That and the impossibility to jump backwards makes it
> really hard to be correct in really large process chains.
> 
> 
> Let me know what do you think!
> 
> Thanks,
> 
> ---
> Changes in V6:
>         - Small style fix
>         - Clarify in the docs that we are resolving PIDs using the global,
> initial PID namespace, and the provided *pid* argument should be global, too
>         - Changed the way we assert on the helper return value
> 
> Changes in V5:
>         - Addressed code review feedback
>         - Renamed from progenyof => descendant_of as suggested by Jon Haslam
> and Brendan Gregg
> 
> Changes in V4:
>         - Rebased on latest bpf-next after merge window
> 
> Changes in V3:
>         - Removed RCU read (un)locking as BPF programs alredy run in RCU locked
>                 context
>         - progenyof(0) now returns 1, which, semantically makes more sense
>         - Added new test case for PID 0 and changed sentinel value for errors
>         - Rebase on latest bpf-next/master
>         - Used my work email as somehow I accidentally used my personal one in v2
> 
> Changes in V2:
>         - Adding missing docs in include/uapi/linux/bpf.h
> 

bpf-next is currently closed due to merge window, please resubmit once it reopens.

Thanks,
Daniel

  parent reply	other threads:[~2019-07-12 12:41 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-26 22:36 [PATCH bpf-next 0/3] bpf: add progenyof helper Javier Honduvilla Coto
2019-02-26 22:36 ` [PATCH bpf-next 1/3] bpf: add bpf_progenyof helper Javier Honduvilla Coto
2019-02-27  6:26   ` Martin Lau
2019-03-01 17:28     ` Javier Honduvilla Coto
2019-03-02  0:01       ` Martin Lau
2019-03-02  1:08         ` Javier Honduvilla Coto
2019-03-01 17:43     ` Javier Honduvilla Coto
2019-03-01 18:06   ` [PATCH v2 bpf-next 0/3] " Javier Honduvilla Coto
2019-03-01 18:06     ` [PATCH v2 bpf-next 1/3] " Javier Honduvilla Coto
2019-03-02  0:12       ` Martin Lau
2019-03-02  1:10         ` Javier Honduvilla Coto
2019-03-05 22:47       ` [PATCH v3 bpf-next 0/3] " Javier Honduvilla Coto
2019-03-05 22:47         ` [PATCH v3 bpf-next 1/3] " Javier Honduvilla Coto
2019-03-05 22:47         ` [PATCH v3 bpf-next 2/3] bpf: sync kernel uapi headers Javier Honduvilla Coto
2019-03-05 22:47         ` [PATCH v3 bpf-next 3/3] bpf: add tests for bpf_progenyof Javier Honduvilla Coto
2019-03-07  9:26         ` [PATCH v3 bpf-next 0/3] bpf: add bpf_progenyof helper Daniel Borkmann
2019-03-22 22:42           ` Javier Honduvilla Coto
2019-03-22 22:38         ` [PATCH v4 " Javier Honduvilla Coto
2019-03-22 22:38           ` [PATCH v4 bpf-next 1/3] " Javier Honduvilla Coto
2019-03-25 14:17             ` Daniel Borkmann
2019-03-27 15:57               ` Javier Honduvilla Coto
2019-03-27 20:44                 ` Brendan Gregg
2019-03-27 16:02               ` Javier Honduvilla Coto
2019-03-22 22:38           ` [PATCH v4 bpf-next 2/3] bpf: sync kernel uapi headers Javier Honduvilla Coto
2019-03-22 22:38           ` [PATCH v4 bpf-next 3/3] bpf: add tests for bpf_progenyof Javier Honduvilla Coto
2019-04-10 20:36           ` [PATCH v5 bpf-next 0/3] bpf: add bpf_descendant_of helper Javier Honduvilla Coto
2019-04-10 20:36             ` [PATCH v5 bpf-next 1/3] " Javier Honduvilla Coto
2019-04-11 21:55               ` Daniel Borkmann
2019-04-12  0:20                 ` Javier Honduvilla Coto
2019-04-10 20:36             ` [PATCH v5 bpf-next 2/3] bpf: sync kernel uapi headers Javier Honduvilla Coto
2019-04-10 20:36             ` [PATCH v5 bpf-next 3/3] bpf: add tests for bpf_descendant_of Javier Honduvilla Coto
2019-04-11 17:59             ` [PATCH v5 bpf-next 0/3] bpf: add bpf_descendant_of helper Song Liu
2019-07-10 18:00             ` [PATCH v6 " Javier Honduvilla Coto
2019-07-10 18:00               ` [PATCH v6 bpf-next 1/3] " Javier Honduvilla Coto
2019-07-10 18:00               ` [PATCH v6 bpf-next 2/3] bpf: sync kernel uapi headers Javier Honduvilla Coto
2019-07-10 18:00               ` [PATCH v6 bpf-next 3/3] bpf: add tests for bpf_descendant_of Javier Honduvilla Coto
2019-07-10 19:25                 ` Andrii Nakryiko
2019-07-12 12:41               ` Daniel Borkmann [this message]
2019-03-01 18:06     ` [PATCH v2 bpf-next 2/3] bpf: sync kernel uapi headers Javier Honduvilla Coto
2019-03-01 18:06     ` [PATCH v2 bpf-next 3/3] bpf: add tests for bpf_progenyof Javier Honduvilla Coto
2019-02-26 22:36 ` [PATCH bpf-next 2/3] bpf: sync kernel uapi headers Javier Honduvilla Coto
2019-02-26 22:36 ` [PATCH bpf-next 3/3] bpf: add tests for bpf_progenyof Javier Honduvilla Coto

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a3784df6-851e-e829-57f4-740af000a58f@iogearbox.net \
    --to=daniel@iogearbox.net \
    --cc=javierhonduco@fb.com \
    --cc=jonhaslam@fb.com \
    --cc=kernel-team@fb.com \
    --cc=netdev@vger.kernel.org \
    --cc=yhs@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.