bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Dumazet <edumazet@google.com>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: Alexei Starovoitov <ast@fb.com>,
	Daniel Borkmann <daniel@iogearbox.net>,
	netdev <netdev@vger.kernel.org>, bpf <bpf@vger.kernel.org>,
	Kees Cook <keescook@google.com>,
	Andy Lutomirski <luto@amacapital.net>,
	Jann Horn <jannh@google.com>
Subject: Re: Question about seccomp / bpf
Date: Thu, 9 May 2019 03:52:07 -0700	[thread overview]
Message-ID: <CANn89i+v52ktezz5J_0of_EvTUozf86rP1Uh36HpbHf33uzDJg@mail.gmail.com> (raw)
In-Reply-To: <20190509044720.fxlcldi74atev5id@ast-mbp>

On Wed, May 8, 2019 at 9:47 PM Alexei Starovoitov
<alexei.starovoitov@gmail.com> wrote:
>
> On Wed, May 08, 2019 at 04:17:29PM -0700, Eric Dumazet wrote:
> > On Wed, May 8, 2019 at 4:09 PM Alexei Starovoitov
> > <alexei.starovoitov@gmail.com> wrote:
> > >
> > > On Wed, May 08, 2019 at 02:21:52PM -0700, Eric Dumazet wrote:
> > > > Hi Alexei and Daniel
> > > >
> > > > I have a question about seccomp.
> > > >
> > > > It seems that after this patch, seccomp no longer needs a helper
> > > > (seccomp_bpf_load())
> > > >
> > > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=bd4cf0ed331a275e9bf5a49e6d0fd55dffc551b8
> > > >
> > > > Are we detecting that a particular JIT code needs to call at least one
> > > > function from the kernel at all ?
> > >
> > > Currently we don't track such things and trying very hard to avoid
> > > any special cases for classic vs extended.
> > >
> > > > If the filter contains self-contained code (no call, just inline
> > > > code), then we could use any room in whole vmalloc space,
> > > > not only from the modules (which is something like 2GB total on x86_64)
> > >
> > > I believe there was an effort to make bpf progs and other executable things
> > > to be everywhere too, but I lost the track of it.
> > > It's not that hard to tweak x64 jit to emit 64-bit calls to helpers
> > > when delta between call insn and a helper is more than 32-bit that fits
> > > into call insn. iirc there was even such patch floating around.
> > >
> > > but what motivated you question? do you see 2GB space being full?!
> >
> >
> > A customer seems to hit the limit, with about 75,000 threads,
> > each one having a seccomp filter with 6 pages (plus one guard page
> > given by vmalloc)
>
> Since cbpf doesn't have "fd as a program" concept I suspect
> the same program was loaded 75k times. What a waste of kernel memory.
> And, no, we're not going to extend or fix cbpf for this.
> cbpf is frozen. seccomp needs to start using ebpf.
> It can have one program to secure all threads.
> If necessary single program can be customized via bpf maps
> for each thread.

Yes,  docker seems to have a very generic implementation and  should
probably be fixed
( https://github.com/moby/moby/blob/v17.03.2-ce/profiles/seccomp/seccomp.go )

  reply	other threads:[~2019-05-09 10:52 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CANn89iL_XLb5C-+DY5PRhneZDJv585xfbLtiEVc3-ejzNNXaVg@mail.gmail.com>
2019-05-08 23:09 ` Question about seccomp / bpf Alexei Starovoitov
2019-05-08 23:17   ` Eric Dumazet
2019-05-09  4:47     ` Alexei Starovoitov
2019-05-09 10:52       ` Eric Dumazet [this message]
2019-05-09 10:58         ` Eric Dumazet
2019-05-09 11:49           ` Daniel Borkmann
2019-05-09 23:30             ` Alexei Starovoitov
2019-05-09 23:49               ` Kees Cook
2019-05-09 23:50               ` Eric Dumazet
2019-05-09 23:51                 ` Alexei Starovoitov

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=CANn89i+v52ktezz5J_0of_EvTUozf86rP1Uh36HpbHf33uzDJg@mail.gmail.com \
    --to=edumazet@google.com \
    --cc=alexei.starovoitov@gmail.com \
    --cc=ast@fb.com \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=jannh@google.com \
    --cc=keescook@google.com \
    --cc=luto@amacapital.net \
    --cc=netdev@vger.kernel.org \
    /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).