mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alexei Starovoitov <alexei.starovoitov@gmail.com>
To: Sargun Dhillon <sargun@sargun.me>
Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: Relax kern_version constraints on bpf kprobes?
Date: Sat, 23 Jul 2016 21:36:33 -0700	[thread overview]
Message-ID: <20160724043630.GA36109@ast-mbp.thefacebook.com> (raw)
In-Reply-To: <20160724040139.GA2025@ircssh.c.rugged-nimbus-611.internal>

On Sat, Jul 23, 2016 at 09:01:39PM -0700, Sargun Dhillon wrote:
> In kernel/bpf/syscall.c we restrict programs loading bpf kprobe programs so 
> attr.kern_version must be exactly equal to what the user is running at the 
> moment. This makes a lot of sense because kprobes can touch lots of
> unstable bits of the kernel ABI. 
> 
> Unfortunately, this makes it really difficult to ship binary bpf programs
> for debugging, and most customers don't want to go through all the steps
> of preparing for compilation and installation of bpf programs for their 
> specific kernel that was shipped by their vendor. 
> 
> This is especially problematic when the probe is touching only stable ABIs
> (syscalls), or alternatively is just logging performance events. I realize
> that we can change this section pretty easily by reading the version at
> load time and modifying it, but it's kind of a pain.
> 
> For programs that we know are safe, is there a mechanism by which we can
> bypass this check, and tell the loader that we know what we're doing
> since these programs are only accessible to CAP_SYS_ADMIN?

The proper alternative is to always compile programs on the fly
for the given kernel like iovisor/bcc does. Integrated clang/llvm
has other advantages, like being able to search/replace in bpf C program
before installing it in the kernel. So different command line flags
come with zero overhead when not in use.

      reply	other threads:[~2016-07-24  4:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-24  4:01 Sargun Dhillon
2016-07-24  4:36 ` 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=20160724043630.GA36109@ast-mbp.thefacebook.com \
    --to=alexei.starovoitov@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=sargun@sargun.me \
    /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

all inboxes | Powered by JetHome®