linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/2] bpf: unprivileged
@ 2015-10-05 20:48 Alexei Starovoitov
  2015-10-05 20:48 ` [PATCH net-next 1/2] bpf: enable non-root eBPF programs Alexei Starovoitov
  2015-10-05 20:48 ` [PATCH net-next 2/2] bpf: charge user for creation of BPF maps and programs Alexei Starovoitov
  0 siblings, 2 replies; 30+ messages in thread
From: Alexei Starovoitov @ 2015-10-05 20:48 UTC (permalink / raw)
  To: David S. Miller
  Cc: Andy Lutomirski, Ingo Molnar, Hannes Frederic Sowa, Eric Dumazet,
	Daniel Borkmann, Kees Cook, linux-api, netdev, linux-kernel

I think it is time to liberate eBPF from CAP_SYS_ADMIN.
As was discussed when eBPF was first introduced two years ago
the only piece missing in eBPF verifier is 'pointer leak detection'
to make it available to non-root users.
Patch 1 adds this pointer analysis.
The eBPF programs, obviously, need to see and operate on kernel addresses,
but with these extra checks they won't be able to pass these addresses
to user space.
Patch 2 adds accounting of kernel memory used by programs and maps.
It changes behavoir for existing root users, but I think it needs
to be done consistently for both root and non-root, since today
programs and maps are only limited by number of open FDs (RLIMIT_NOFILE).
Patch 2 accounts program's and map's kernel memory as RLIMIT_MEMLOCK.

Unprivileged eBPF is only meaningful for 'socket filter'-like programs.
eBPF programs for tracing and TC classifiers/actions will stay root only.

In parallel the bpf fuzzing effort is ongoing and so far
we've found only one verifier bug and that was already fixed.
The 'constant blinding' pass also being worked on.
It will obfuscate constant-like values that are part of eBPF ISA
to make jit spraying attacks even harder.

Alexei Starovoitov (2):
  bpf: enable non-root eBPF programs
  bpf: charge user for creation of BPF maps and programs

 include/linux/bpf.h         |    6 ++
 include/linux/sched.h       |    2 +-
 kernel/bpf/arraymap.c       |    2 +-
 kernel/bpf/hashtab.c        |    4 +
 kernel/bpf/syscall.c        |   74 +++++++++++++-
 kernel/bpf/verifier.c       |  114 +++++++++++++++++++--
 kernel/sysctl.c             |   10 ++
 kernel/trace/bpf_trace.c    |    3 +
 samples/bpf/libbpf.h        |    8 ++
 samples/bpf/test_verifier.c |  239 ++++++++++++++++++++++++++++++++++++++++++-
 10 files changed, 443 insertions(+), 19 deletions(-)

-- 
1.7.9.5


^ permalink raw reply	[flat|nested] 30+ messages in thread

end of thread, other threads:[~2015-10-08 17:42 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-05 20:48 [PATCH net-next 0/2] bpf: unprivileged Alexei Starovoitov
2015-10-05 20:48 ` [PATCH net-next 1/2] bpf: enable non-root eBPF programs Alexei Starovoitov
2015-10-05 21:00   ` Kees Cook
2015-10-05 21:12     ` Alexei Starovoitov
2015-10-05 21:16       ` Andy Lutomirski
2015-10-05 21:32         ` Alexei Starovoitov
2015-10-05 22:02       ` Kees Cook
2015-10-06  0:28         ` Alexei Starovoitov
2015-10-05 22:14   ` Daniel Borkmann
2015-10-06  0:51     ` Alexei Starovoitov
2015-10-06  7:13       ` Ingo Molnar
2015-10-06  8:05         ` Daniel Borkmann
2015-10-06  8:20           ` Ingo Molnar
2015-10-06  8:39             ` Daniel Borkmann
2015-10-06 17:50               ` Alexei Starovoitov
2015-10-06 17:56                 ` Eric Dumazet
2015-10-06 18:05                   ` Andy Lutomirski
2015-10-07  6:05                     ` Ingo Molnar
2015-10-06 19:26                   ` Alexei Starovoitov
2015-10-06 18:03                 ` Daniel Borkmann
2015-10-06 12:45       ` Daniel Borkmann
2015-10-07 21:20         ` Alexei Starovoitov
2015-10-07 22:07           ` Daniel Borkmann
2015-10-07 22:22             ` Kees Cook
2015-10-07 23:49               ` Alexei Starovoitov
2015-10-08  6:21                 ` Ingo Molnar
2015-10-08  6:30                   ` Alexei Starovoitov
2015-10-08 17:42                 ` Kees Cook
2015-10-08  2:29   ` Alexei Starovoitov
2015-10-05 20:48 ` [PATCH net-next 2/2] bpf: charge user for creation of BPF maps and programs Alexei Starovoitov

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).