From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1764284AbcINVVF (ORCPT ); Wed, 14 Sep 2016 17:21:05 -0400 Received: from mail-pa0-f66.google.com ([209.85.220.66]:36425 "EHLO mail-pa0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759948AbcINVVB (ORCPT ); Wed, 14 Sep 2016 17:21:01 -0400 Date: Wed, 14 Sep 2016 14:20:55 -0700 From: Alexei Starovoitov To: =?iso-8859-1?Q?Micka=EBl_Sala=FCn?= Cc: linux-kernel@vger.kernel.org, Alexei Starovoitov , Andy Lutomirski , Arnd Bergmann , Casey Schaufler , Daniel Borkmann , Daniel Mack , David Drysdale , "David S . Miller" , Elena Reshetova , "Eric W . Biederman" , James Morris , Kees Cook , Paul Moore , Sargun Dhillon , "Serge E . Hallyn" , Tejun Heo , Will Drewry , kernel-hardening@lists.openwall.com, linux-api@vger.kernel.org, linux-security-module@vger.kernel.org, netdev@vger.kernel.org, cgroups@vger.kernel.org Subject: Re: [RFC v3 21/22] bpf,landlock: Add optional skb pointer in the Landlock context Message-ID: <20160914212054.GC57174@ast-mbp.thefacebook.com> References: <20160914072415.26021-1-mic@digikod.net> <20160914072415.26021-22-mic@digikod.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20160914072415.26021-22-mic@digikod.net> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 14, 2016 at 09:24:14AM +0200, Mickaël Salaün wrote: > This is a proof of concept to expose optional values that could depend > of the process access rights. > > There is two dedicated flags: LANDLOCK_FLAG_ACCESS_SKB_READ and > LANDLOCK_FLAG_ACCESS_SKB_WRITE. Each of them can be activated to access > eBPF functions manipulating a skb in a read or write way. > > Signed-off-by: Mickaël Salaün ... > /* Handle check flags */ > #define LANDLOCK_FLAG_FS_DENTRY (1 << 0) > @@ -619,12 +621,15 @@ struct landlock_handle { > * @args: LSM hook arguments, see include/linux/lsm_hooks.h for there > * description and the LANDLOCK_HOOK* definitions from > * security/landlock/lsm.c for their types. > + * @opt_skb: optional skb pointer, accessible with the > + * LANDLOCK_FLAG_ACCESS_SKB_* flags for network-related hooks. > */ > struct landlock_data { > __u32 hook; /* enum landlock_hook_id */ > __u16 origin; /* LANDLOCK_FLAG_ORIGIN_* */ > __u16 cookie; /* seccomp RET_LANDLOCK */ > __u64 args[6]; > + __u64 opt_skb; > }; missing something here. This patch doesn't make use of it. That's something for the future? How that field will be populated? Why make it different vs the rest or args[6] ? From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexei Starovoitov Subject: Re: [RFC v3 21/22] bpf,landlock: Add optional skb pointer in the Landlock context Date: Wed, 14 Sep 2016 14:20:55 -0700 Message-ID: <20160914212054.GC57174@ast-mbp.thefacebook.com> References: <20160914072415.26021-1-mic@digikod.net> <20160914072415.26021-22-mic@digikod.net> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Cc: linux-kernel@vger.kernel.org, Alexei Starovoitov , Andy Lutomirski , Arnd Bergmann , Casey Schaufler , Daniel Borkmann , Daniel Mack , David Drysdale , "David S . Miller" , Elena Reshetova , "Eric W . Biederman" , James Morris , Kees Cook , Paul Moore , Sargun Dhillon , "Serge E . Hallyn" , Tejun Heo , Will Drewry , kernel-hardening@lists.openwall.com, linux-api@vger.kernel.org, linux-security-module@vger.kern To: =?iso-8859-1?Q?Micka=EBl_Sala=FCn?= Return-path: Content-Disposition: inline In-Reply-To: <20160914072415.26021-22-mic@digikod.net> Sender: linux-kernel-owner@vger.kernel.org List-Id: netdev.vger.kernel.org On Wed, Sep 14, 2016 at 09:24:14AM +0200, Mickaël Salaün wrote: > This is a proof of concept to expose optional values that could depend > of the process access rights. > > There is two dedicated flags: LANDLOCK_FLAG_ACCESS_SKB_READ and > LANDLOCK_FLAG_ACCESS_SKB_WRITE. Each of them can be activated to access > eBPF functions manipulating a skb in a read or write way. > > Signed-off-by: Mickaël Salaün ... > /* Handle check flags */ > #define LANDLOCK_FLAG_FS_DENTRY (1 << 0) > @@ -619,12 +621,15 @@ struct landlock_handle { > * @args: LSM hook arguments, see include/linux/lsm_hooks.h for there > * description and the LANDLOCK_HOOK* definitions from > * security/landlock/lsm.c for their types. > + * @opt_skb: optional skb pointer, accessible with the > + * LANDLOCK_FLAG_ACCESS_SKB_* flags for network-related hooks. > */ > struct landlock_data { > __u32 hook; /* enum landlock_hook_id */ > __u16 origin; /* LANDLOCK_FLAG_ORIGIN_* */ > __u16 cookie; /* seccomp RET_LANDLOCK */ > __u64 args[6]; > + __u64 opt_skb; > }; missing something here. This patch doesn't make use of it. That's something for the future? How that field will be populated? Why make it different vs the rest or args[6] ? From mboxrd@z Thu Jan 1 00:00:00 1970 Reply-To: kernel-hardening@lists.openwall.com Date: Wed, 14 Sep 2016 14:20:55 -0700 From: Alexei Starovoitov Message-ID: <20160914212054.GC57174@ast-mbp.thefacebook.com> References: <20160914072415.26021-1-mic@digikod.net> <20160914072415.26021-22-mic@digikod.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20160914072415.26021-22-mic@digikod.net> Subject: [kernel-hardening] Re: [RFC v3 21/22] bpf,landlock: Add optional skb pointer in the Landlock context To: =?iso-8859-1?Q?Micka=EBl_Sala=FCn?= Cc: linux-kernel@vger.kernel.org, Alexei Starovoitov , Andy Lutomirski , Arnd Bergmann , Casey Schaufler , Daniel Borkmann , Daniel Mack , David Drysdale , "David S . Miller" , Elena Reshetova , "Eric W . Biederman" , James Morris , Kees Cook , Paul Moore , Sargun Dhillon , "Serge E . Hallyn" , Tejun Heo , Will Drewry , kernel-hardening@lists.openwall.com, linux-api@vger.kernel.org, linux-security-module@vger.kernel.org, netdev@vger.kernel.org, cgroups@vger.kernel.org List-ID: On Wed, Sep 14, 2016 at 09:24:14AM +0200, Mickaël Salaün wrote: > This is a proof of concept to expose optional values that could depend > of the process access rights. > > There is two dedicated flags: LANDLOCK_FLAG_ACCESS_SKB_READ and > LANDLOCK_FLAG_ACCESS_SKB_WRITE. Each of them can be activated to access > eBPF functions manipulating a skb in a read or write way. > > Signed-off-by: Mickaël Salaün ... > /* Handle check flags */ > #define LANDLOCK_FLAG_FS_DENTRY (1 << 0) > @@ -619,12 +621,15 @@ struct landlock_handle { > * @args: LSM hook arguments, see include/linux/lsm_hooks.h for there > * description and the LANDLOCK_HOOK* definitions from > * security/landlock/lsm.c for their types. > + * @opt_skb: optional skb pointer, accessible with the > + * LANDLOCK_FLAG_ACCESS_SKB_* flags for network-related hooks. > */ > struct landlock_data { > __u32 hook; /* enum landlock_hook_id */ > __u16 origin; /* LANDLOCK_FLAG_ORIGIN_* */ > __u16 cookie; /* seccomp RET_LANDLOCK */ > __u64 args[6]; > + __u64 opt_skb; > }; missing something here. This patch doesn't make use of it. That's something for the future? How that field will be populated? Why make it different vs the rest or args[6] ?