All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andi Kleen <ak@linux.intel.com>
To: speck@linutronix.de
Subject: [MODERATED] Re: Generic eBPF hardening
Date: Thu, 17 May 2018 15:54:48 -0700	[thread overview]
Message-ID: <20180517225448.GC4486@tassilo.jf.intel.com> (raw)
In-Reply-To: <20180517222233.xk3favfebt4wiiid@ast-mbp>

On Thu, May 17, 2018 at 03:22:35PM -0700, speck for Alexei Starovoitov wrote:
> On Thu, May 17, 2018 at 01:55:38PM -0700, speck for Dave Hansen wrote:
> > I'm hoping Alexei is on the list now.
> > 
> > Andi Kleen and I were talking about ways to generally harden eBPF.  We
> > were a bit concerned that eBPF could leave around attacker-controlled
> > values on the stack that might allow later, speculatively-executed
> > kernel code to be exploited.
> > 
> > One thing I wanted to clarify: The eBPF stack (BPF_REG_FP) *is* the
> > kernel stack, correct?
> 
> yes. bpf program stack is kernel stack,
> but I don't see how this is useful.
> There are plenty of ways to populate kernel stack with user controlled
> bytes. Ex: set_task_comm.

EBPF has quite a bit more control over the exact layout than other 
buffers. 

Over time we should probably migrate most people who do copy_to_user
to stack buffers to do so onto the heap. But that's a longer term
project.

Luckily stack buffers are usually quite limited in size 
so attacks are likely harder.

But with EBPF controlling the exact layout it should be easier.

Would be better to fix it, especially since the fixes should be cheap.

-Andi

  reply	other threads:[~2018-05-17 22:54 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-17 20:55 [MODERATED] Generic eBPF hardening Dave Hansen
2018-05-17 22:22 ` [MODERATED] " Alexei Starovoitov
2018-05-17 22:54   ` Andi Kleen [this message]
2018-05-17 23:21     ` Alexei Starovoitov
2018-05-17 23:39       ` Andi Kleen
2018-05-18 18:18       ` Dave Hansen
2018-05-18 22:26         ` Alexei Starovoitov
2018-05-17 23:13   ` Dave Hansen
2018-05-17 23:24     ` 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=20180517225448.GC4486@tassilo.jf.intel.com \
    --to=ak@linux.intel.com \
    --cc=speck@linutronix.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.