Re: [PATCH v4 10/11] seccomp: Switch addfd to Extensible Argument ioctl

2020-06-16 Thread Tycho Andersen
On Tue, Jun 16, 2020 at 09:05:29AM -0700, Kees Cook wrote: > On Tue, Jun 16, 2020 at 08:55:46AM -0600, Tycho Andersen wrote: > > On Mon, Jun 15, 2020 at 08:25:23PM -0700, Kees Cook wrote: > > > This patch is based on discussions[1] with Sargun Dhillon, Christian > > >

Re: [PATCH v4 08/11] selftests/seccomp: Make kcmp() less required

2020-06-16 Thread Tycho Andersen
On Mon, Jun 15, 2020 at 08:25:21PM -0700, Kees Cook wrote: > The seccomp tests are a bit noisy without CONFIG_CHECKPOINT_RESTORE (due > to missing the kcmp() syscall). The seccomp tests are more accurate with > kcmp(), but it's not strictly required. Refactor the tests to use > alternatives (compar

Re: [PATCH v4 09/11] selftests/seccomp: Rename user_trap_syscall() to user_notif_syscall()

2020-06-16 Thread Tycho Andersen
er XFAIL. > > Signed-off-by: Kees Cook Reviewed-by: Tycho Andersen

Re: [PATCH v4 10/11] seccomp: Switch addfd to Extensible Argument ioctl

2020-06-16 Thread Tycho Andersen
On Mon, Jun 15, 2020 at 08:25:23PM -0700, Kees Cook wrote: > This patch is based on discussions[1] with Sargun Dhillon, Christian > Brauner, and David Laight. Instead of building size into the addfd > structure, make it a function of the ioctl command (which is how sizes are > normally passed to io

Re: [PATCH 1/2] vmalloc: New flag for flush before releasing pages

2018-12-06 Thread Tycho Andersen
On Thu, Dec 06, 2018 at 10:53:50AM -0800, Andy Lutomirski wrote: > > On Dec 5, 2018, at 11:29 PM, Ard Biesheuvel > > wrote: > > > >> On Thu, 6 Dec 2018 at 00:16, Andy Lutomirski wrote: > >> > >>> On Wed, Dec 5, 2018 at 3:41 AM Will Deacon wrote: > >>> > On Tue, Dec 04, 2018 at 12:09:49PM -

Re: [PATCH bpf-next v8 00/11] Landlock LSM: Toward unprivileged sandboxing

2018-04-01 Thread Tycho Andersen
Hi Mickaël, On Mon, Apr 02, 2018 at 12:04:36AM +0200, Mickaël Salaün wrote: > >> vDSO is a code mapped for all processes. As you said, these processes > >> may use it or not. What I was thinking about is to use the same concept, > >> i.e. map a "shim" code into each processes pertaining to a parti

Re: [PATCH bpf-next v8 00/11] Landlock LSM: Toward unprivileged sandboxing

2018-03-06 Thread Tycho Andersen
On Tue, Mar 06, 2018 at 10:33:17PM +, Andy Lutomirski wrote: > >> Suppose I'm writing a container manager. I want to run "mount" in the > >> container, but I don't want to allow moun() in general and I want to > >> emulate certain mount() actions. I can write a filter that catches > >> mount

Re: [net-next v3 1/2] bpf, seccomp: Add eBPF filter capabilities

2018-03-05 Thread Tycho Andersen
Hi Andy, On Thu, Mar 01, 2018 at 10:05:47PM +, Andy Lutomirski wrote: > But Tycho: would hooking user notifiers in right here work for you? > As I see it, this would be the best justification for seccomp eBPF. Sorry for the delay; Sargun had declared on irc that he was going to implement it,

Re: [net-next v3 0/2] eBPF seccomp filters

2018-02-26 Thread Tycho Andersen
On Mon, Feb 26, 2018 at 07:46:19PM -0800, Sargun Dhillon wrote: > On Mon, Feb 26, 2018 at 5:01 PM, Tycho Andersen wrote: > > On Mon, Feb 26, 2018 at 03:20:15PM -0800, Kees Cook wrote: > >> On Mon, Feb 26, 2018 at 3:04 PM, Alexei Starovoitov > >> wrote: > >>

Re: [net-next v3 1/2] bpf, seccomp: Add eBPF filter capabilities

2018-02-26 Thread Tycho Andersen
On Mon, Feb 26, 2018 at 07:49:48PM -0800, Sargun Dhillon wrote: > On Mon, Feb 26, 2018 at 4:54 PM, Tycho Andersen wrote: > > On Mon, Feb 26, 2018 at 07:27:05AM +, Sargun Dhillon wrote: > >> +config SECCOMP_FILTER_EXTENDED > >> + bool "Extended BPF seccom

Re: [net-next v3 0/2] eBPF seccomp filters

2018-02-26 Thread Tycho Andersen
On Mon, Feb 26, 2018 at 03:20:15PM -0800, Kees Cook wrote: > On Mon, Feb 26, 2018 at 3:04 PM, Alexei Starovoitov > wrote: > > On Mon, Feb 26, 2018 at 07:26:54AM +, Sargun Dhillon wrote: > >> This patchset enables seccomp filters to be written in eBPF. Although, this > >> [...] > > The main sta

Re: [net-next v3 1/2] bpf, seccomp: Add eBPF filter capabilities

2018-02-26 Thread Tycho Andersen
On Mon, Feb 26, 2018 at 07:27:05AM +, Sargun Dhillon wrote: > +config SECCOMP_FILTER_EXTENDED > + bool "Extended BPF seccomp filters" > + depends on SECCOMP_FILTER && BPF_SYSCALL > + depends on !CHECKPOINT_RESTORE Why not just give -EINVAL or something in case one of these is reque

Re: [PATCH net-next 0/3] eBPF Seccomp filters

2018-02-14 Thread Tycho Andersen
On Wed, Feb 14, 2018 at 05:25:00PM +, Andy Lutomirski wrote: > On Tue, Feb 13, 2018 at 3:47 PM, Kees Cook wrote: > > On Tue, Feb 13, 2018 at 7:42 AM, Sargun Dhillon wrote: > >> This patchset enables seccomp filters to be written in eBPF. Although, > >> this patchset doesn't introduce much of

Re: [PATCH net-next 0/3] eBPF Seccomp filters

2018-02-13 Thread Tycho Andersen
On Tue, Feb 13, 2018 at 12:16:42PM -0800, Kees Cook wrote: > If the needs Tycho outlined[1] could be addressed fully with eBPF, and > we can very narrowly scope the use of the "extra" eBPF features, I > might be more inclined to merge something like this, but I want to > take it very carefully. Bes

Re: [PATCH] ebpf: verify the output of the JIT

2017-04-04 Thread Tycho Andersen
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 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 &

[PATCH] ebpf: verify the output of the JIT

2017-04-04 Thread Tycho Andersen
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 CC: Daniel Borkmann CC: Alexei Starovoitov CC: Kees Cook CC: Mickaël Salaün --- arch/x86/Kconfig| 11

[PATCH v3] openvswitch: allow management from inside user namespaces

2016-02-05 Thread Tycho Andersen
parate ifs for UNS_ADMIN_PERM and ADMIN_PERM, instead of one massive one Reported-by: James Page Signed-off-by: Tycho Andersen CC: Eric Biederman CC: Pravin Shelar CC: Justin Pettit CC: "David S. Miller" --- include/uapi/linux/genetlink.h | 1 + net/netlink/genetlink.c

[PATCH v2] openvswitch: allow management from inside user namespaces

2016-02-01 Thread Tycho Andersen
-by: James Page Signed-off-by: Tycho Andersen CC: Eric Biederman CC: Pravin Shelar CC: Justin Pettit CC: "David S. Miller" --- include/uapi/linux/genetlink.h | 1 + net/netlink/genetlink.c| 6 -- net/openvswitch/datapath.c | 20 ++-- 3 files changed,

Re: [PATCH] openvswitch: allow management from inside user namespaces

2016-01-29 Thread Tycho Andersen
Hi Eric, Thanks for the review. On Fri, Jan 29, 2016 at 08:29:55AM -0600, Eric W. Biederman wrote: > Tycho Andersen writes: > > > Operations with the GENL_ADMIN_PERM flag fail permissions checks because > > this flag means we call netlink_capable, which uses the init user n

[PATCH] openvswitch: allow management from inside user namespaces

2016-01-29 Thread Tycho Andersen
-by: James Page Signed-off-by: Tycho Andersen CC: Eric Biederman CC: Pravin Shelar CC: Justin Pettit CC: "David S. Miller" --- net/openvswitch/datapath.c | 63 ++ 1 file changed, 53 insertions(+), 10 deletions(-) diff --git a/net/ope

[PATCH net-next] seccomp, ptrace: add support for dumping seccomp filters

2015-10-26 Thread Tycho Andersen
userspace while holding spinlocks v5: * add another condition to WARN_ON v6: * rebase on net-next Signed-off-by: Tycho Andersen Acked-by: Kees Cook CC: Will Drewry Reviewed-by: Oleg Nesterov CC: Andy Lutomirski CC: Pavel Emelyanov CC: Serge E. Hallyn CC: Alexei Starovoitov CC: Daniel Bo

seccomp c/r patch

2015-10-26 Thread Tycho Andersen
Hi all, Here is a patch that we'd like to go via net-next, as it depends on previous changes in that tree. Thanks, Tycho -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majo

Re: [PATCH v8] seccomp, ptrace: add support for dumping seccomp filters

2015-10-26 Thread Tycho Andersen
s on changes in net, could this get pulled > in from that direction? > > Acked-by: Kees Cook Can we get the attached patch into net-next? Thanks, Tycho >From 5d9be66e4f48e0882a5546376380147f2f711bec Mon Sep 17 00:00:00 2001 From: Tycho Andersen Date: Fri, 2 Oct 2015 18:49:43 -0600

Re: v5 of seccomp filter c/r patches

2015-10-02 Thread Tycho Andersen
On Sat, Oct 03, 2015 at 12:57:49AM +0200, Daniel Borkmann wrote: > On 10/03/2015 12:44 AM, Tycho Andersen wrote: > >On Fri, Oct 02, 2015 at 02:10:24PM -0700, Kees Cook wrote: > ... > >Ok, how about, > > > >struct sock_filter insns[BPF_MAXINSNS]; > >insn_cnt = p

Re: v5 of seccomp filter c/r patches

2015-10-02 Thread Tycho Andersen
On Fri, Oct 02, 2015 at 03:52:03PM -0700, Andy Lutomirski wrote: > On Fri, Oct 2, 2015 at 3:44 PM, Tycho Andersen > wrote: > > On Fri, Oct 02, 2015 at 02:10:24PM -0700, Kees Cook wrote: > >> On Fri, Oct 2, 2015 at 9:27 AM, Tycho Andersen > >> wrote: > >> &

Re: v5 of seccomp filter c/r patches

2015-10-02 Thread Tycho Andersen
On Fri, Oct 02, 2015 at 02:10:24PM -0700, Kees Cook wrote: > On Fri, Oct 2, 2015 at 9:27 AM, Tycho Andersen > wrote: > > Hi all, > > > > Here's v5 of the seccomp filter c/r set. The individual patch notes have > > changes, but two highlights are: > &g

[PATCH v5 2/3] seccomp: add a ptrace command to get seccomp filter fds

2015-10-02 Thread Tycho Andersen
TER implies that there is at least one filter. If there is a more appropriate errno (ESRCH collides as well with ptrace) to give here that may be better. v2: use new bpf interface save_orig to save the original filter when necessary Signed-off-by: Tycho Andersen CC: Kees Cook CC: Will Drewr

[PATCH v5 1/3] seccomp: add the concept of a seccomp filter FD

2015-10-02 Thread Tycho Andersen
erhaps insecure. Signed-off-by: Tycho Andersen CC: Kees Cook CC: Will Drewry CC: Oleg Nesterov CC: Andy Lutomirski CC: Pavel Emelyanov CC: Serge E. Hallyn CC: Alexei Starovoitov CC: Daniel Borkmann --- include/linux/seccomp.h | 5 ++ include/uapi/linux/seccomp.h | 27 ++ k

v5 of seccomp filter c/r patches

2015-10-02 Thread Tycho Andersen
Hi all, Here's v5 of the seccomp filter c/r set. The individual patch notes have changes, but two highlights are: * This series is now based on http://patchwork.ozlabs.org/patch/525492/ and will need to be built with that patch applied. This gets rid of two incorrect patches in the previous s

[PATCH v5 3/3] kcmp: add KCMP_SECCOMP_FD

2015-10-02 Thread Tycho Andersen
Signed-off-by: Tycho Andersen CC: Kees Cook CC: Will Drewry CC: Oleg Nesterov CC: Andy Lutomirski CC: Pavel Emelyanov CC: Serge E. Hallyn CC: Alexei Starovoitov CC: Daniel Borkmann --- include/uapi/linux/kcmp.h | 1 + kernel/kcmp.c | 27 +++ 2 files

Re: [PATCH net-next] bpf, seccomp: prepare for upcoming criu support

2015-10-02 Thread Tycho Andersen
that in future for > things like diag. While fanout filters already use bpf_prog_destroy(), > move seccomp over to them as well to handle original programs when > present. > > Signed-off-by: Daniel Borkmann > Cc: Tycho Andersen Thanks for this patch. When I rebase my tree

Re: [PATCH v3 4/5] kcmp: add KCMP_FILE_PRIVATE_DATA

2015-10-01 Thread Tycho Andersen
On Wed, Sep 30, 2015 at 02:48:47PM -0700, Andy Lutomirski wrote: > On Wed, Sep 30, 2015 at 2:39 PM, Tycho Andersen > wrote: > > On Wed, Sep 30, 2015 at 11:56:25AM -0700, Andy Lutomirski wrote: > >> On Wed, Sep 30, 2015 at 11:55 AM, Tycho Andersen > >> wrote: > &

Re: [PATCH v3 4/5] kcmp: add KCMP_FILE_PRIVATE_DATA

2015-09-30 Thread Tycho Andersen
On Wed, Sep 30, 2015 at 02:48:47PM -0700, Andy Lutomirski wrote: > On Wed, Sep 30, 2015 at 2:39 PM, Tycho Andersen > wrote: > > On Wed, Sep 30, 2015 at 11:56:25AM -0700, Andy Lutomirski wrote: > >> On Wed, Sep 30, 2015 at 11:55 AM, Tycho Andersen > >> wrote: > &

Re: [PATCH v3 4/5] kcmp: add KCMP_FILE_PRIVATE_DATA

2015-09-30 Thread Tycho Andersen
On Wed, Sep 30, 2015 at 11:56:25AM -0700, Andy Lutomirski wrote: > On Wed, Sep 30, 2015 at 11:55 AM, Tycho Andersen > wrote: > > On Wed, Sep 30, 2015 at 11:47:05AM -0700, Andy Lutomirski wrote: > >> On Wed, Sep 30, 2015 at 11:41 AM, Tycho Andersen > >> wrote: > &

Re: [PATCH v3 4/5] kcmp: add KCMP_FILE_PRIVATE_DATA

2015-09-30 Thread Tycho Andersen
On Wed, Sep 30, 2015 at 11:47:05AM -0700, Andy Lutomirski wrote: > On Wed, Sep 30, 2015 at 11:41 AM, Tycho Andersen > wrote: > > On Wed, Sep 30, 2015 at 11:25:41AM -0700, Andy Lutomirski wrote: > >> On Wed, Sep 30, 2015 at 11:13 AM, Tycho Andersen > >> wrote: > &

Re: [PATCH v3 4/5] kcmp: add KCMP_FILE_PRIVATE_DATA

2015-09-30 Thread Tycho Andersen
On Wed, Sep 30, 2015 at 11:25:41AM -0700, Andy Lutomirski wrote: > On Wed, Sep 30, 2015 at 11:13 AM, Tycho Andersen > wrote: > > This command allows comparing the underling private data of two fds. This > > is useful e.g. to find out if a seccomp filter is inher

Re: [PATCH v3 2/5] seccomp: add the concept of a seccomp filter FD

2015-09-30 Thread Tycho Andersen
On Wed, Sep 30, 2015 at 11:27:34AM -0700, Andy Lutomirski wrote: > On Wed, Sep 30, 2015 at 11:13 AM, Tycho Andersen > wrote: > > This patch introduces the concept of a seccomp fd, with a similar interface > > and usage to ebpf fds. Initially, one is allowed to create, install,

[PATCH v3 1/5] seccomp: save the original filter

2015-09-30 Thread Tycho Andersen
In order to implement checkpoint of seccomp filters, we need to keep track of the original filter as the user gave it to us. Since we're doing this, we need to also use bpf_prog_destroy to free the struct bpf_brogs so we don't leak this memory. Signed-off-by: Tycho Andersen CC: Kee

[PATCH v3 2/5] seccomp: add the concept of a seccomp filter FD

2015-09-30 Thread Tycho Andersen
sk re-parents a filter that another task has installed. One option to work around this is to keep a bit on struct seccomp_filter to allow each filter to have its parent set exactly once. (This would still allow you to install a filter multiple times, as long as the parent was the same in each case.)

[PATCH v3 4/5] kcmp: add KCMP_FILE_PRIVATE_DATA

2015-09-30 Thread Tycho Andersen
This command allows comparing the underling private data of two fds. This is useful e.g. to find out if a seccomp filter is inherited, since struct seccomp_filter are unique across tasks and are the private_data seccomp fds. Signed-off-by: Tycho Andersen CC: Kees Cook CC: Will Drewry CC: Oleg

[PATCH v3 3/5] seccomp: add a ptrace command to get seccomp filter fds

2015-09-30 Thread Tycho Andersen
TER implies that there is at least one filter. If there is a more appropriate errno (ESRCH collides as well with ptrace) to give here that may be better. Signed-off-by: Tycho Andersen CC: Kees Cook CC: Will Drewry CC: Oleg Nesterov CC: Andy Lutomirski CC: Pavel Emelyanov CC: Serge E. Hallyn

[PATCH v3 5/5] bpf: save the program the user actually supplied

2015-09-30 Thread Tycho Andersen
e not allowed by bpf_check_classic. Signed-off-by: Tycho Andersen CC: Kees Cook CC: Will Drewry CC: Oleg Nesterov CC: Andy Lutomirski CC: Pavel Emelyanov CC: Serge E. Hallyn CC: Alexei Starovoitov CC: Daniel Borkmann --- net/core/filter.c | 3 +-- 1 file changed, 1 insertion(+), 2 dele

checkpoint/restore of seccomp filters v3

2015-09-30 Thread Tycho Andersen
Hi all, Here's a re-worked set for c/r of seccomp filters which keeps around the original bpf program passed to the kernel instead of trying to dump the ebpf version. There are various comments/questions in the individual patch notes. I'm not sure this needs to go via net-next any more, as the im

Re: v2 of seccomp filter c/r patches

2015-09-15 Thread Tycho Andersen
Hi Andy, On Tue, Sep 15, 2015 at 01:01:23PM -0700, Andy Lutomirski wrote: > On Tue, Sep 15, 2015 at 11:26 AM, Tycho Andersen > wrote: > > Hi Andy, > > > > On Tue, Sep 15, 2015 at 11:13:51AM -0700, Andy Lutomirski wrote: > >> On Tue, Sep 15, 2015 at 9:07 AM, Tych

Re: v2 of seccomp filter c/r patches

2015-09-15 Thread Tycho Andersen
Hi Andy, On Tue, Sep 15, 2015 at 11:13:51AM -0700, Andy Lutomirski wrote: > On Tue, Sep 15, 2015 at 9:07 AM, Tycho Andersen > wrote: > > Hi Andy, > > > > On Mon, Sep 14, 2015 at 10:52:46AM -0700, Andy Lutomirski wrote: > >> > >> I'm not sure I enti

Re: v2 of seccomp filter c/r patches

2015-09-15 Thread Tycho Andersen
Hi Andy, On Mon, Sep 14, 2015 at 10:52:46AM -0700, Andy Lutomirski wrote: > > I'm not sure I entirely like this solution... Ok. Since we also aren't going to do all the eBPF stuff now, how about something that looks like this: struct seccomp_layer { unsigned int size; unsigned int type; /* S

Re: [PATCH v2 2/5] seccomp: make underlying bpf ref counted as well

2015-09-14 Thread Tycho Andersen
On Mon, Sep 14, 2015 at 06:48:43PM +0200, Daniel Borkmann wrote: > On 09/14/2015 06:00 PM, Tycho Andersen wrote: > >On Fri, Sep 11, 2015 at 08:28:19PM +0200, Daniel Borkmann wrote: > >>I think due to the given insns restrictions on classic seccomp, this > >>could work

Re: [PATCH v2 2/5] seccomp: make underlying bpf ref counted as well

2015-09-14 Thread Tycho Andersen
Hi Daniel, On Fri, Sep 11, 2015 at 08:28:19PM +0200, Daniel Borkmann wrote: > I think due to the given insns restrictions on classic seccomp, this > could work for "most cases" (see below) for the time being until pointer > sanitation is resolved and that seccomp-only restriction from the dump > c

Re: [PATCH v2 2/5] seccomp: make underlying bpf ref counted as well

2015-09-11 Thread Tycho Andersen
On Fri, Sep 11, 2015 at 06:03:59PM +0200, Daniel Borkmann wrote: > On 09/11/2015 04:44 PM, Tycho Andersen wrote: > >On Fri, Sep 11, 2015 at 03:02:36PM +0200, Daniel Borkmann wrote: > >>On 09/11/2015 02:20 AM, Tycho Andersen wrote: > >>>In the next patch, we'

Re: v2 of seccomp filter c/r patches

2015-09-11 Thread Tycho Andersen
On Fri, Sep 11, 2015 at 10:00:22AM -0700, Andy Lutomirski wrote: > On Fri, Sep 11, 2015 at 9:30 AM, Andy Lutomirski wrote: > > On Sep 10, 2015 5:22 PM, "Tycho Andersen" > > wrote: > >> > >> Hi all, > >> > >> Here is v2 of the seccomp

Re: [PATCH v2 4/5] seccomp: add a way to access filters via bpf fds

2015-09-11 Thread Tycho Andersen
On Fri, Sep 11, 2015 at 09:20:55AM -0700, Andy Lutomirski wrote: > On Sep 10, 2015 5:22 PM, "Tycho Andersen" > wrote: > > > > This patch adds a way for a process that is "real root" to access the > > seccomp filters of another process. The process firs

Re: [PATCH] ebpf: emit correct src_reg for conditional jumps

2015-09-11 Thread Tycho Andersen
On Fri, Sep 11, 2015 at 08:40:43AM -0700, Alexei Starovoitov wrote: > On Fri, Sep 11, 2015 at 11:28:24AM +0200, Daniel Borkmann wrote: > > [off topic for this patch] > > > > ... this requirement also breaks down for cases where you have a single > > classic BPF instruction that maps into 2 or more

Re: [PATCH v2 3/5] ebpf: add a way to dump an eBPF program

2015-09-11 Thread Tycho Andersen
On Thu, Sep 10, 2015 at 07:29:42PM -0700, Alexei Starovoitov wrote: > On Thu, Sep 10, 2015 at 06:21:00PM -0600, Tycho Andersen wrote: > > +static int bpf_prog_dump(union bpf_attr *attr, union bpf_attr __user > > *uattr) > > +{ > > + int ufd = attr->prog_fd; &

Re: [PATCH v2 3/5] ebpf: add a way to dump an eBPF program

2015-09-11 Thread Tycho Andersen
On Fri, Sep 11, 2015 at 03:39:14PM +0200, Daniel Borkmann wrote: > On 09/11/2015 02:21 AM, Tycho Andersen wrote: > >This commit adds a way to dump eBPF programs. The initial implementation > >doesn't support maps, and therefore only allows dumping seccomp ebpf > >progr

Re: [PATCH v2 2/5] seccomp: make underlying bpf ref counted as well

2015-09-11 Thread Tycho Andersen
On Fri, Sep 11, 2015 at 03:02:36PM +0200, Daniel Borkmann wrote: > On 09/11/2015 02:20 AM, Tycho Andersen wrote: > >In the next patch, we're going to add a way to access the underlying > >filters via bpf fds. This means that we need to ref-count both the > >struct secc

Re: [PATCH v2 5/5] seccomp: add a way to attach a filter via eBPF fd

2015-09-11 Thread Tycho Andersen
On Fri, Sep 11, 2015 at 02:37:59PM +0200, Daniel Borkmann wrote: > On 09/11/2015 02:21 AM, Tycho Andersen wrote: > >This is the final bit needed to support seccomp filters created via the bpf > >syscall. The patch adds a new seccomp operation SECCOMP_MODE_FILTER_EBPF, > >wh

Re: [PATCH v2 4/5] seccomp: add a way to access filters via bpf fds

2015-09-11 Thread Tycho Andersen
On Fri, Sep 11, 2015 at 01:47:38PM +0200, Daniel Borkmann wrote: > On 09/11/2015 02:21 AM, Tycho Andersen wrote: > >This patch adds a way for a process that is "real root" to access the > >seccomp filters of another process. The process first does a > >PTRACE_SEC

Re: [PATCH v2 4/5] seccomp: add a way to access filters via bpf fds

2015-09-11 Thread Tycho Andersen
Hi Michael, On Fri, Sep 11, 2015 at 02:08:50PM +0200, Michael Kerrisk (man-pages) wrote: > HI Tycho > > On 11 September 2015 at 02:21, Tycho Andersen > wrote: > > This patch adds a way for a process that is "real root" to access the > > seccomp filters of anoth

[PATCH] ebpf: emit correct src_reg for conditional jumps

2015-09-10 Thread Tycho Andersen
oblem when BPF_PROG_DUMP lands, and we can potentially dump and re-import programs generated by the converter. Signed-off-by: Tycho Andersen CC: Alexei Starovoitov CC: Daniel Borkmann --- net/core/filter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/core/filter.c b/net

[PATCH v2 1/5] ebpf: add a seccomp program type

2015-09-10 Thread Tycho Andersen
get rid of superfluous seccomp_convert_ctx_access Signed-off-by: Tycho Andersen CC: Kees Cook CC: Will Drewry CC: Oleg Nesterov CC: Andy Lutomirski CC: Pavel Emelyanov CC: Serge E. Hallyn CC: Alexei Starovoitov CC: Daniel Borkmann --- include/uapi/linux/bpf.h | 1 + net/core/filter.c

v2 of seccomp filter c/r patches

2015-09-10 Thread Tycho Andersen
Hi all, Here is v2 of the seccomp filter c/r set. The patch notes have individual changes from the last series, but there are two points not noted: * The series still does not allow us to correctly restore state for programs that will use SECCOMP_FILTER_FLAG_TSYNC in the future. Given that we w

[PATCH v2 2/5] seccomp: make underlying bpf ref counted as well

2015-09-10 Thread Tycho Andersen
ocess. Additionally, we mark classic converted seccomp filters as seccomp eBPF programs, since they are a subset of what is supported in seccomp eBPF. Signed-off-by: Tycho Andersen CC: Kees Cook CC: Will Drewry CC: Oleg Nesterov CC: Andy Lutomirski CC: Pavel Emelyanov CC: Serge E. Hallyn CC: A

[PATCH v2 5/5] seccomp: add a way to attach a filter via eBPF fd

2015-09-10 Thread Tycho Andersen
similar to that of bpf(), although the size is explicit in the struct to avoid changing the signature of seccomp(). v2: Don't abuse seccomp's third argument; use a separate command and a pointer to a structure instead. Signed-off-by: Tycho Andersen CC: Kees Cook CC: Will Drewry

[PATCH v2 4/5] seccomp: add a way to access filters via bpf fds

2015-09-10 Thread Tycho Andersen
f(BPF_PROG_DUMP) to dump the actual program at each step. Signed-off-by: Tycho Andersen CC: Kees Cook CC: Will Drewry CC: Oleg Nesterov CC: Andy Lutomirski CC: Pavel Emelyanov CC: Serge E. Hallyn CC: Alexei Starovoitov CC: Daniel Borkmann --- include/linux/bpf.h | 12 ++

[PATCH v2 3/5] ebpf: add a way to dump an eBPF program

2015-09-10 Thread Tycho Andersen
This commit adds a way to dump eBPF programs. The initial implementation doesn't support maps, and therefore only allows dumping seccomp ebpf programs which themselves don't currently support maps. v2: don't export a prog_id for the filter Signed-off-by: Tycho Andersen CC: Kees

Re: [PATCH 3/6] ebpf: add a way to dump an eBPF program

2015-09-09 Thread Tycho Andersen
On Wed, Sep 09, 2015 at 05:44:06PM -0700, Andy Lutomirski wrote: > On Wed, Sep 9, 2015 at 5:13 PM, Tycho Andersen > wrote: > > On Wed, Sep 09, 2015 at 04:44:24PM -0700, Andy Lutomirski wrote: > >> On Wed, Sep 9, 2015 at 3:34 PM, Tycho Andersen > >> wrote:

Re: [PATCH 3/6] ebpf: add a way to dump an eBPF program

2015-09-09 Thread Tycho Andersen
On Wed, Sep 09, 2015 at 04:44:24PM -0700, Andy Lutomirski wrote: > On Wed, Sep 9, 2015 at 3:34 PM, Tycho Andersen > wrote: > > > > Here's a thought, > > > > The set I'm currently proposing effectively separates the ref-counting > > of the stru

Re: [PATCH 3/6] ebpf: add a way to dump an eBPF program

2015-09-09 Thread Tycho Andersen
On Fri, Sep 04, 2015 at 06:27:27PM -0600, Tycho Andersen wrote: > On Fri, Sep 04, 2015 at 04:08:53PM -0700, Andy Lutomirski wrote: > > On Fri, Sep 4, 2015 at 3:28 PM, Tycho Andersen > > wrote: > > > On Fri, Sep 04, 2015 at 02:48:03PM -0700, Andy Lutomirski wrote: > &g

Re: [PATCH 1/6] ebpf: add a seccomp program type

2015-09-09 Thread Tycho Andersen
t;> > On 09/09/2015 06:07 PM, Alexei Starovoitov wrote: > >> >> > >> >> On Wed, Sep 09, 2015 at 09:50:35AM -0600, Tycho Andersen wrote: > >> > > >> > [...] > >> >>> > >> >>> Thoughts? > >> >> &

Re: [PATCH 5/6] seccomp: add a way to attach a filter via eBPF fd

2015-09-09 Thread Tycho Andersen
On Wed, Sep 09, 2015 at 08:14:04AM -0700, Alexei Starovoitov wrote: > On Wed, Sep 09, 2015 at 08:47:24AM -0600, Tycho Andersen wrote: > > On Tue, Sep 08, 2015 at 05:07:03PM -0700, Kees Cook wrote: > > > > > > Yeah, bpf's union looks good. Let's add a "c

Re: [PATCH 1/6] ebpf: add a seccomp program type

2015-09-09 Thread Tycho Andersen
On Fri, Sep 04, 2015 at 02:08:37PM -0700, Kees Cook wrote: > On Fri, Sep 4, 2015 at 2:06 PM, Tycho Andersen > wrote: > > On Fri, Sep 04, 2015 at 01:34:12PM -0700, Kees Cook wrote: > >> On Fri, Sep 4, 2015 at 9:04 AM, Tycho Andersen > >> wrote: > >>

Re: [PATCH 5/6] seccomp: add a way to attach a filter via eBPF fd

2015-09-09 Thread Tycho Andersen
On Tue, Sep 08, 2015 at 05:07:03PM -0700, Kees Cook wrote: > > Yeah, bpf's union looks good. Let's add a "command" flag, though: > > seccomp(SECCOMP_MODE_FILTER_EBPF, int cmd, union, size); > > And this cmd could be ADD_FD or something? > > How's that look? I think we can drop the size (using t

Re: [PATCH 5/6] seccomp: add a way to attach a filter via eBPF fd

2015-09-08 Thread Tycho Andersen
On Sat, Sep 05, 2015 at 09:13:02AM +0200, Michael Kerrisk (man-pages) wrote: > On 09/04/2015 10:41 PM, Kees Cook wrote: > > On Fri, Sep 4, 2015 at 9:04 AM, Tycho Andersen > > wrote: > >> This is the final bit needed to support seccomp filters created via the bpf > &

Re: [PATCH 3/6] ebpf: add a way to dump an eBPF program

2015-09-04 Thread Tycho Andersen
On Fri, Sep 04, 2015 at 04:08:53PM -0700, Andy Lutomirski wrote: > On Fri, Sep 4, 2015 at 3:28 PM, Tycho Andersen > wrote: > > On Fri, Sep 04, 2015 at 02:48:03PM -0700, Andy Lutomirski wrote: > >> On Fri, Sep 4, 2015 at 1:45 PM, Tycho Andersen > >> wrote: > &

Re: [PATCH 6/6] ebpf: allow BPF_REG_X in src_reg conditional jumps

2015-09-04 Thread Tycho Andersen
Hi Alexei, On Fri, Sep 04, 2015 at 02:06:19PM -0700, Alexei Starovoitov wrote: > On Fri, Sep 04, 2015 at 10:04:24AM -0600, Tycho Andersen wrote: > > The classic converter generates conditional jumps with: > > > > if (BPF_SRC(fp->code) == BPF_K && (int) fp->

Re: [PATCH 3/6] ebpf: add a way to dump an eBPF program

2015-09-04 Thread Tycho Andersen
On Fri, Sep 04, 2015 at 02:48:03PM -0700, Andy Lutomirski wrote: > On Fri, Sep 4, 2015 at 1:45 PM, Tycho Andersen > wrote: > > On Fri, Sep 04, 2015 at 01:17:30PM -0700, Kees Cook wrote: > >> On Fri, Sep 4, 2015 at 9:04 AM, Tycho Andersen > >> wrote: > >>

Re: [PATCH 1/6] ebpf: add a seccomp program type

2015-09-04 Thread Tycho Andersen
On Fri, Sep 04, 2015 at 01:17:47PM -0700, Alexei Starovoitov wrote: > On Fri, Sep 04, 2015 at 10:04:19AM -0600, Tycho Andersen wrote: > > seccomp uses eBPF as its underlying storage and execution format, and eBPF > > has features that seccomp would like to make use of in the future.

Re: [PATCH 1/6] ebpf: add a seccomp program type

2015-09-04 Thread Tycho Andersen
On Fri, Sep 04, 2015 at 01:34:12PM -0700, Kees Cook wrote: > On Fri, Sep 4, 2015 at 9:04 AM, Tycho Andersen > wrote: > > +static const struct bpf_func_proto * > > +seccomp_func_proto(enum bpf_func_id func_id) > > +{ > > + /* Right now seccomp eBPF loading

Re: [PATCH 3/6] ebpf: add a way to dump an eBPF program

2015-09-04 Thread Tycho Andersen
On Fri, Sep 04, 2015 at 01:58:25PM -0700, Alexei Starovoitov wrote: > On Fri, Sep 04, 2015 at 01:50:55PM -0700, Kees Cook wrote: > > On Fri, Sep 4, 2015 at 1:45 PM, Tycho Andersen > > wrote: > > > On Fri, Sep 04, 2015 at 01:17:30PM -0700, Kees Cook wrote: > > >

Re: [PATCH 4/6] seccomp: add a way to access filters via bpf fds

2015-09-04 Thread Tycho Andersen
On Fri, Sep 04, 2015 at 01:29:49PM -0700, Alexei Starovoitov wrote: > On Fri, Sep 04, 2015 at 01:26:42PM -0700, Kees Cook wrote: > > On Fri, Sep 4, 2015 at 9:04 AM, Tycho Andersen > > wrote: > > > This patch adds a way for a process that is "real root" to a

Re: [PATCH 3/6] ebpf: add a way to dump an eBPF program

2015-09-04 Thread Tycho Andersen
On Fri, Sep 04, 2015 at 01:17:30PM -0700, Kees Cook wrote: > On Fri, Sep 4, 2015 at 9:04 AM, Tycho Andersen > wrote: > > This commit adds a way to dump eBPF programs. The initial implementation > > doesn't support maps, and therefore only allows dumping seccomp ebpf > &

Re: [PATCH 3/6] ebpf: add a way to dump an eBPF program

2015-09-04 Thread Tycho Andersen
Hi Alexei, On Fri, Sep 04, 2015 at 01:27:05PM -0700, Alexei Starovoitov wrote: > On Fri, Sep 04, 2015 at 10:04:21AM -0600, Tycho Andersen wrote: > > This commit adds a way to dump eBPF programs. The initial implementation > > doesn't support maps, and therefore only allows

c/r of seccomp filters via underlying eBPF

2015-09-04 Thread Tycho Andersen
Hi all, Here is a set that enables checkpoint restore of the underlying eBPF programs that power seccomp filters via the API we discussed several months ago. A few notes: * We expose prog_id in the ebpf dump as the pointer to the ebpf program in kernel memory, since this is unique. I'm not sure

[PATCH 1/6] ebpf: add a seccomp program type

2015-09-04 Thread Tycho Andersen
some interesting features (notably, maps) of eBPF. However, the primary motivation for this patchset is to enable checkpoint/restore for seccomp filters later in the series, to this limited feature set is ok for now. Signed-off-by: Tycho Andersen CC: Kees Cook CC: Will Drewry CC: Oleg Nestero

[PATCH 4/6] seccomp: add a way to access filters via bpf fds

2015-09-04 Thread Tycho Andersen
f(BPF_PROG_DUMP) to dump the actual program at each step. Signed-off-by: Tycho Andersen CC: Kees Cook CC: Will Drewry CC: Oleg Nesterov CC: Andy Lutomirski CC: Pavel Emelyanov CC: Serge E. Hallyn CC: Alexei Starovoitov CC: Daniel Borkmann --- include/linux/bpf.h | 12 ++

[PATCH 2/6] seccomp: make underlying bpf ref counted as well

2015-09-04 Thread Tycho Andersen
ocess. Additionally, we mark classic converted seccomp filters as seccomp eBPF programs, since they are a subset of what is supported in seccomp eBPF. Signed-off-by: Tycho Andersen CC: Kees Cook CC: Will Drewry CC: Oleg Nesterov CC: Andy Lutomirski CC: Pavel Emelyanov CC: Serge E. Hallyn CC: A

[PATCH 3/6] ebpf: add a way to dump an eBPF program

2015-09-04 Thread Tycho Andersen
t when two seccomp filters were inherited from each other and clone the filter tree accordingly. Signed-off-by: Tycho Andersen CC: Kees Cook CC: Will Drewry CC: Oleg Nesterov CC: Andy Lutomirski CC: Pavel Emelyanov CC: Serge E. Hallyn CC: Alexei Starovoitov CC: Daniel Borkmann --- include/

[PATCH 5/6] seccomp: add a way to attach a filter via eBPF fd

2015-09-04 Thread Tycho Andersen
te to it which seems impolite. Right now we cast the pointer (and force the user to cast it), which generates ugly warnings. I'm not sure what the right answer is here. Signed-off-by: Tycho Andersen CC: Kees Cook CC: Will Drewry CC: Oleg Nesterov CC: Andy Lutomirski CC: Pavel Emelyanov C

[PATCH 6/6] ebpf: allow BPF_REG_X in src_reg conditional jumps

2015-09-04 Thread Tycho Andersen
} but here, we enforce that the src_reg == BPF_REG_0. We should also allow BPF_REG_X since that's what the converter generates; this enables us to load eBPF programs that were generated by the converter. Signed-off-by: Tycho Andersen CC: Kees Cook CC: Will Drewry CC: Oleg Nesterov CC: And

Re: eBPF / seccomp globals?

2015-09-04 Thread Tycho Andersen
Hi all, On Thu, Sep 03, 2015 at 08:17:05PM -0700, Alexei Starovoitov wrote: > On Fri, Sep 04, 2015 at 01:01:20AM +, Michael Tirado wrote: > > Hiyall, > > > > I have created a seccomp white list filter for a program that launches > > other less trustworthy programs. It's working great so far,