bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stanislav Fomichev <sdf@fomichev.me>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: Alexei Starovoitov <alexei.starovoitov@gmail.com>,
	Stanislav Fomichev <sdf@google.com>,
	Networking <netdev@vger.kernel.org>, bpf <bpf@vger.kernel.org>,
	"David S. Miller" <davem@davemloft.net>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>, Martin Lau <kafai@fb.com>,
	Andrii Nakryiko <andriin@fb.com>
Subject: Re: [PATCH bpf-next v5 1/8] bpf: implement getsockopt and setsockopt hooks
Date: Fri, 14 Jun 2019 09:32:19 -0700	[thread overview]
Message-ID: <20190614163219.GE9636@mini-arch> (raw)
In-Reply-To: <20190613215400.GC9636@mini-arch>

On 06/13, Stanislav Fomichev wrote:
> > > My canonical example when reasoning about multiple progs was that each one
> > > of them would implement handling for a particular level+optname. So only
> > > a single one form the chain would return 2 or 0, the rest would return 1
> > > without touching the buffer. I can't come up with a good use-case where
> > > two programs in the chain can both return 2 and fill out the buffer.
> > > The majority of the sockopts would still be handled by the kernel,
> > > we'd have only a handful of bpf progs that handle a tiny subset
> > > and delegate the rest to the kernel.
> > >
> > > How about we stop further processing as soon as some program in the chain
> > > returned 2? I think that would address most of the concerns?
> > 
> > What about a case of passive "auditing" BPF programs, that are not
> > modifying anything, but want to capture every single
> > getsockopt/setsockopt call? This premature stop would render that
> > whole approach broken.
> In that case you'd attach that program to the root of a cgroup
> (sub)tree what you want to audit (and it would be always executed and
> would return 1)? And you'd have to attach it first.
On a second thought, that's not true. BPF progs are executed from the
bottom up, so attaching to the root cgroup wouldn't work for that auditing
case :-/

  reply	other threads:[~2019-06-14 16:32 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-10 21:08 [PATCH bpf-next v5 0/8] bpf: getsockopt and setsockopt hooks Stanislav Fomichev
2019-06-10 21:08 ` [PATCH bpf-next v5 1/8] bpf: implement " Stanislav Fomichev
2019-06-13 20:16   ` Alexei Starovoitov
2019-06-13 21:20     ` Stanislav Fomichev
2019-06-13 21:50       ` Andrii Nakryiko
2019-06-13 21:54         ` Stanislav Fomichev
2019-06-14 16:32           ` Stanislav Fomichev [this message]
2019-06-10 21:08 ` [PATCH bpf-next v5 2/8] bpf: sync bpf.h to tools/ Stanislav Fomichev
2019-06-10 21:08 ` [PATCH bpf-next v5 3/8] libbpf: support sockopt hooks Stanislav Fomichev
2019-06-10 21:08 ` [PATCH bpf-next v5 4/8] selftests/bpf: test sockopt section name Stanislav Fomichev
2019-06-10 21:08 ` [PATCH bpf-next v5 5/8] selftests/bpf: add sockopt test Stanislav Fomichev
2019-06-10 21:08 ` [PATCH bpf-next v5 6/8] selftests/bpf: add sockopt test that exercises sk helpers Stanislav Fomichev
2019-06-10 21:08 ` [PATCH bpf-next v5 7/8] bpf: add sockopt documentation Stanislav Fomichev
2019-06-10 21:08 ` [PATCH bpf-next v5 8/8] bpftool: support cgroup sockopt Stanislav Fomichev
2019-06-10 21:38 ` [PATCH bpf-next v5 0/8] bpf: getsockopt and setsockopt hooks Martin Lau

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=20190614163219.GE9636@mini-arch \
    --to=sdf@fomichev.me \
    --cc=alexei.starovoitov@gmail.com \
    --cc=andrii.nakryiko@gmail.com \
    --cc=andriin@fb.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=kafai@fb.com \
    --cc=netdev@vger.kernel.org \
    --cc=sdf@google.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).