From: Tycho Andersen <tycho@docker.com>
To: Kees Cook <keescook@chromium.org>
Cc: "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: Tue, 4 Apr 2017 21:45:36 -0600 [thread overview]
Message-ID: <20170405034536.oulhc3ylhlrfgqeg@docker> (raw)
In-Reply-To: <CAGXu5jLAXDk1+kYTC60-sJ_SOa5s4+HZ26A0bj67335yAXYhvg@mail.gmail.com>
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.
Tycho
next prev parent reply other threads:[~2017-04-05 3:45 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 [this message]
2017-04-06 12:55 ` Alexei Starovoitov
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=20170405034536.oulhc3ylhlrfgqeg@docker \
--to=tycho@docker.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 \
/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).