Re: [RFC v3 21/22] bpf,landlock: Add optional skb pointer in the Landlock context

From: MickaÃl SalaÃn
Date: Wed Sep 14 2016 - 18:47:50 EST



On 14/09/2016 23:20, Alexei Starovoitov wrote:
> 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 <mic@xxxxxxxxxxx>
> ...
>> /* 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] ?
>
>

I don't use this code, it's only purpose is to show how to deal with
fine-grained privileges of Landlock programs (to allow Sargun to add his
custom helpers from Checmate). However, this optional field may be part
of args[6].

Attachment: signature.asc
Description: OpenPGP digital signature