Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5d0f1dc5-5a99-bd6a-4acc-0cdcd062a0c9@iogearbox.net>
Date: Fri, 8 Nov 2019 15:34:58 +0100
From: Daniel Borkmann <daniel@...earbox.net>
To: Mickaël Salaün <mic@...ikod.net>,
 KP Singh <kpsingh@...omium.org>
Cc: Alexei Starovoitov <alexei.starovoitov@...il.com>,
 linux-kernel@...r.kernel.org, Alexei Starovoitov <ast@...nel.org>,
 Andy Lutomirski <luto@...capital.net>,
 Casey Schaufler <casey@...aufler-ca.com>,
 David Drysdale <drysdale@...gle.com>, Florent Revest <revest@...omium.org>,
 James Morris <jmorris@...ei.org>, Jann Horn <jann@...jh.net>,
 John Johansen <john.johansen@...onical.com>, Jonathan Corbet
 <corbet@....net>, Kees Cook <keescook@...omium.org>,
 Michael Kerrisk <mtk.manpages@...il.com>,
 Mickaël Salaün <mickael.salaun@....gouv.fr>,
 Paul Moore <paul@...l-moore.com>, Sargun Dhillon <sargun@...gun.me>,
 "Serge E . Hallyn" <serge@...lyn.com>, Shuah Khan <shuah@...nel.org>,
 Stephen Smalley <sds@...ho.nsa.gov>, Tejun Heo <tj@...nel.org>,
 Tetsuo Handa <penguin-kernel@...ove.SAKURA.ne.jp>,
 Tycho Andersen <tycho@...ho.ws>, Will Drewry <wad@...omium.org>,
 bpf@...r.kernel.org, kernel-hardening@...ts.openwall.com,
 linux-api@...r.kernel.org, linux-security-module@...r.kernel.org,
 netdev@...r.kernel.org
Subject: Re: [PATCH bpf-next v13 4/7] landlock: Add ptrace LSM hooks

On 11/8/19 3:08 PM, Mickaël Salaün wrote:
> On 06/11/2019 22:45, KP Singh wrote:
>> On 06-Nov 17:55, Mickaël Salaün wrote:
>>> On 06/11/2019 11:06, KP Singh wrote:
>>>> On 05-Nov 11:34, Alexei Starovoitov wrote:
>>>>> On Tue, Nov 05, 2019 at 07:01:41PM +0100, Mickaël Salaün wrote:
>>>>>> On 05/11/2019 18:18, Alexei Starovoitov wrote:
[...]
>> * Use a single BPF program type; this is necessary for a key requirement
>>    of KRSI, i.e. runtime instrumentation. The upcoming prototype should
>>    illustrate how this works for KRSI - note that it’s possible to vary
>>    the context types exposed by different hooks.
> 
> Why a single BPF program type? Do you mean *attach* types? Landlock only
> use one program type, but will use multiple attach types.
> 
> Why do you think it is necessary for KRSI or for runtime instrumentation?
> 
> If it is justified, it could be a dedicated program attach type (e.g.
> BPF_LANDLOCK_INTROSPECTION).
> 
> What is the advantage to have the possibility to vary the context types
> over dedicated *typed* contexts? I don't see any advantages, but at
> least one main drawback: to require runtime checks (when helpers use
> this generic context) instead of load time checks (thanks to static type
> checking of the context).

Lets take security_sock_rcv_skb(struct sock *sk, struct sk_buff *skb)
as one specific example here: the running kernel has its own internal
btf_vmlinux and therefore a complete description of itself. From verifier
side we can retrieve & introspect the security_sock_rcv_skb signatue and
thus know that the given BPF attachment point has struct sock and struct
sk_buff as input arguments which can then be accessed generically by the
prog in order to allow sk_filter_trim_cap() to pass or to drop the skb.
The same generic approach can be done for many of the other lsm hooks, so
single program type would be enough there and context is derived automatically,
no dedicated extra context per attach type would be needed and no runtime
checks as you mentioned above since its still all asserted at verification
time.

Thanks,
Daniel

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.