From: Alexei Starovoitov <alexei.starovoitov@gmail.com>
To: Tycho Andersen <tycho@docker.com>
Cc: "Kees Cook" <keescook@chromium.org>,
"Daniel Borkmann" <daniel@iogearbox.net>,
"Alexei Starovoitov" <ast@kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
"Network Development" <netdev@vger.kernel.org>,
"kernel-hardening@lists.openwall.com"
<kernel-hardening@lists.openwall.com>,
"Mickaël Salaün" <mic@digikod.net>
Subject: Re: [PATCH] ebpf: verify the output of the JIT
Date: Thu, 6 Apr 2017 08:55:14 -0400 [thread overview]
Message-ID: <20170406125513.GA56553@ast-mbp.thefacebook.com> (raw)
In-Reply-To: <20170405034536.oulhc3ylhlrfgqeg@docker>
On Tue, Apr 04, 2017 at 09:45:36PM -0600, Tycho Andersen wrote:
> Hi Kees,
>
> On Tue, Apr 04, 2017 at 03:17:57PM -0700, Kees Cook wrote:
> > On Tue, Apr 4, 2017 at 3:08 PM, Tycho Andersen <tycho@docker.com> wrote:
> > > The goal of this patch is to protect the JIT against an attacker with a
> > > write-in-memory primitive. The JIT allocates a buffer which will eventually
> > > be marked +x, so we need to make sure that what was written to this buffer
> > > is what was intended.
> > >
> > > We acheive this by building a hash of the instruction buffer as
> > > instructions are emittted and then comparing that to a hash at the end of
> > > the JIT compile after the buffer has been marked read-only.
> > >
> > > Signed-off-by: Tycho Andersen <tycho@docker.com>
> > > CC: Daniel Borkmann <daniel@iogearbox.net>
> > > CC: Alexei Starovoitov <ast@kernel.org>
> > > CC: Kees Cook <keescook@chromium.org>
> > > CC: Mickaël Salaün <mic@digikod.net>
> >
> > Cool! This closes the race condition on producing the JIT vs going
> > read-only. I wonder if it might be possible to make this a more
> > generic interface to the BPF which would be allocate the hash, provide
> > the update callback during emit, and then do the hash check itself at
> > the end of bpf_jit_binary_lock_ro()?
>
> Yes, probably so. I can look into that for the next version.
Nack.
Please stop wasting yours and our time with buggy code that pretends
to fix a problem that doesn't exist.
This security paranoia around JIT must stop.
Make sure that CONFIG_BPF_JIT is off in your system.
next prev parent reply other threads:[~2017-04-06 12:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-04 22:08 [PATCH] ebpf: verify the output of the JIT Tycho Andersen
2017-04-04 22:17 ` Kees Cook
2017-04-05 3:45 ` Tycho Andersen
2017-04-06 12:55 ` Alexei Starovoitov [this message]
2017-04-05 17:52 ` kbuild test robot
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=20170406125513.GA56553@ast-mbp.thefacebook.com \
--to=alexei.starovoitov@gmail.com \
--cc=ast@kernel.org \
--cc=daniel@iogearbox.net \
--cc=keescook@chromium.org \
--cc=kernel-hardening@lists.openwall.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mic@digikod.net \
--cc=netdev@vger.kernel.org \
--cc=tycho@docker.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).