linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexei Starovoitov <alexei.starovoitov@gmail.com>
To: Daniel Borkmann <daniel@iogearbox.net>
Cc: ast@kernel.org, rick.p.edgecombe@intel.com,
	eric.dumazet@gmail.com, jannh@google.com, keescook@chromium.org,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH bpf] bpf: add bpf_jit_limit knob to restrict unpriv allocations
Date: Thu, 25 Oct 2018 17:17:13 -0700	[thread overview]
Message-ID: <20181026001711.w55n5au2vx3sepmb@ast-mbp> (raw)
In-Reply-To: <20181022231104.3443-1-daniel@iogearbox.net>

On Tue, Oct 23, 2018 at 01:11:04AM +0200, Daniel Borkmann wrote:
> Rick reported that the BPF JIT could potentially fill the entire module
> space with BPF programs from unprivileged users which would prevent later
> attempts to load normal kernel modules or privileged BPF programs, for
> example. If JIT was enabled but unsuccessful to generate the image, then
> before commit 290af86629b2 ("bpf: introduce BPF_JIT_ALWAYS_ON config")
> we would always fall back to the BPF interpreter. Nowadays in the case
> where the CONFIG_BPF_JIT_ALWAYS_ON could be set, then the load will abort
> with a failure since the BPF interpreter was compiled out.
> 
> Add a global limit and enforce it for unprivileged users such that in case
> of BPF interpreter compiled out we fail once the limit has been reached
> or we fall back to BPF interpreter earlier w/o using module mem if latter
> was compiled in. In a next step, fair share among unprivileged users can
> be resolved in particular for the case where we would fail hard once limit
> is reached.
> 
> Fixes: 290af86629b2 ("bpf: introduce BPF_JIT_ALWAYS_ON config")
> Fixes: 0a14842f5a3c ("net: filter: Just In Time compiler for x86-64")
> Co-Developed-by: Rick Edgecombe <rick.p.edgecombe@intel.com>
> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
> Acked-by: Alexei Starovoitov <ast@kernel.org>
> Cc: Eric Dumazet <eric.dumazet@gmail.com>
> Cc: Jann Horn <jannh@google.com>
> Cc: Kees Cook <keescook@chromium.org>
> Cc: LKML <linux-kernel@vger.kernel.org>
> ---
>  Hi Rick, I've reworked the original patch into something much simpler
>  which is only focussing on the actual main issue we want to resolve right
>  now as a first step to make some forward progress, that is, limiting usage
>  on the JIT for unprivileged users. Tested the below on x86 and arm64.
>  (Trimmed down massive Cc list as well a bit and Cc'ed people related to
>  commits referenced and netdev where BPF patches are usually discussed.)
>  Thanks a lot!

Applied to bpf tree. Thanks Daniel.


      reply	other threads:[~2018-10-26  0:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-22 23:11 [PATCH bpf] bpf: add bpf_jit_limit knob to restrict unpriv allocations Daniel Borkmann
2018-10-26  0:17 ` Alexei Starovoitov [this message]

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=20181026001711.w55n5au2vx3sepmb@ast-mbp \
    --to=alexei.starovoitov@gmail.com \
    --cc=ast@kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eric.dumazet@gmail.com \
    --cc=jannh@google.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=rick.p.edgecombe@intel.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).