Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1470791

Re: [RFC v2 08/10] landlock: Handle file system comparisons

From Andy Lutomirski <luto@amacapital.net>
Newsgroups linux.kernel
Subject Re: [RFC v2 08/10] landlock: Handle file system comparisons
Date 2016-08-26 17:00 +0200
Message-ID <saqLU-8tm-33@gated-at.bofh.it> (permalink)
References <sa0op-8hT-3@gated-at.bofh.it> <sa0oq-8hT-29@gated-at.bofh.it> <sa0Rs-fC-35@gated-at.bofh.it> <sa3FD-204-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, Aug 25, 2016 at 7:10 AM, Mickaël Salaün <mic@digikod.net> wrote:
>
> On 25/08/2016 13:12, Andy Lutomirski wrote:
>> On Thu, Aug 25, 2016 at 3:32 AM, Mickaël Salaün <mic@digikod.net> wrote:
>>> Add eBPF functions to compare file system access with a Landlock file
>>> system handle:
>>> * bpf_landlock_cmp_fs_prop_with_struct_file(prop, map, map_op, file)
>>>   This function allows to compare the dentry, inode, device or mount
>>>   point of the currently accessed file, with a reference handle.
>>> * bpf_landlock_cmp_fs_beneath_with_struct_file(opt, map, map_op, file)
>>>   This function allows an eBPF program to check if the current accessed
>>>   file is the same or in the hierarchy of a reference handle.
>>>
>>> The goal of file system handle is to abstract kernel objects such as a
>>> struct file or a struct inode. Userland can create this kind of handle
>>> thanks to the BPF_MAP_UPDATE_ELEM command. The element is a struct
>>> landlock_handle containing the handle type (e.g.
>>> BPF_MAP_HANDLE_TYPE_LANDLOCK_FS_FD) and a file descriptor. This could
>>> also be any descriptions able to match a struct file or a struct inode
>>> (e.g. path or glob string).
>>
>> This needs Eric's opinion.
>>
>> Also, where do all the struct file *'s get stashed?  Are they
>> preserved in the arraymap?  What prevents reference cycles or absurdly
>> large numbers of struct files getting pinned?
>
> Yes, the struct file are kept in the arraymap and dropped when there is
> no more reference on them. Currently, the limitations are the maximum
> number of open file descriptors referring to an arraymap and the maximum
> number of eBPF Landlock programs loaded in a process
> (LANDLOCK_PROG_LIST_MAX_PAGES in kernel/seccomp.c).
>
> What kind of reference cycles have you in mind?

Shoving evil things into the arraymaps, e.g. unix sockets with
SCM_RIGHTS messages pending, eBPF program references, the arraymap fd
itself, another arraymap fd, etc.

>
> It probably needs another limit for kernel object references as well.
> What is the best option here? Add another static limitation or use an
> existing one?

Dunno.  If RLIMIT_FILE could be made to work, that would be nice.

--Andy

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC v2 00/10] Landlock LSM: Unprivileged sandboxing Mickaël Salaün <mic@digikod.net> - 2016-08-25 12:50 +0200
  [RFC v2 10/10] samples/landlock: Add sandbox example Mickaël Salaün <mic@digikod.net> - 2016-08-25 12:50 +0200
  [RFC v2 05/10] seccomp: Handle Landlock Mickaël Salaün <mic@digikod.net> - 2016-08-25 12:50 +0200
  [RFC v2 02/10] bpf: Move u64_to_ptr() to BPF headers and inline it Mickaël Salaün <mic@digikod.net> - 2016-08-25 12:50 +0200
  [RFC v2 08/10] landlock: Handle file system comparisons Mickaël Salaün <mic@digikod.net> - 2016-08-25 12:50 +0200
    Re: [RFC v2 08/10] landlock: Handle file system comparisons Andy Lutomirski <luto@amacapital.net> - 2016-08-25 13:20 +0200
      Re: [RFC v2 08/10] landlock: Handle file system comparisons Mickaël Salaün <mic@digikod.net> - 2016-08-25 16:20 +0200
        Re: [RFC v2 08/10] landlock: Handle file system comparisons Andy Lutomirski <luto@amacapital.net> - 2016-08-26 17:00 +0200
          Re: [RFC v2 08/10] landlock: Handle file system comparisons Mickaël Salaün <mic@digikod.net> - 2016-08-27 15:50 +0200
  [RFC v2 01/10] landlock: Add Kconfig Mickaël Salaün <mic@digikod.net> - 2016-08-25 12:50 +0200
  [RFC v2 07/10] landlock: Add errno check Mickaël Salaün <mic@digikod.net> - 2016-08-25 12:50 +0200
    Re: [RFC v2 07/10] landlock: Add errno check Andy Lutomirski <luto@amacapital.net> - 2016-08-25 13:20 +0200
  [RFC v2 06/10] landlock: Add LSM hooks Mickaël Salaün <mic@digikod.net> - 2016-08-25 12:50 +0200
    Re: [RFC v2 06/10] landlock: Add LSM hooks Andy Lutomirski <luto@amacapital.net> - 2016-08-30 21:00 +0200
      Re: [RFC v2 06/10] landlock: Add LSM hooks Mickaël Salaün <mic@digikod.net> - 2016-08-30 22:20 +0200
        Re: [RFC v2 06/10] landlock: Add LSM hooks Andy Lutomirski <luto@amacapital.net> - 2016-08-30 22:20 +0200
          Re: [RFC v2 06/10] landlock: Add LSM hooks Mickaël Salaün <mic@digikod.net> - 2016-08-30 22:30 +0200
  Re: [RFC v2 00/10] Landlock LSM: Unprivileged sandboxing Andy Lutomirski <luto@amacapital.net> - 2016-08-25 13:30 +0200
    Re: [RFC v2 00/10] Landlock LSM: Unprivileged sandboxing Mickaël Salaün <mic@digikod.net> - 2016-08-25 16:00 +0200
  Re: [RFC v2 00/10] Landlock LSM: Unprivileged sandboxing Andy Lutomirski <luto@amacapital.net> - 2016-08-27 09:50 +0200
    Re: [RFC v2 00/10] Landlock LSM: Unprivileged sandboxing Mickaël Salaün <mic@digikod.net> - 2016-08-27 17:20 +0200
      Re: [RFC v2 00/10] Landlock LSM: Unprivileged sandboxing (cgroup  delegation) Mickaël Salaün <mic@digikod.net> - 2016-08-27 17:30 +0200
  Re: [RFC v2 00/10] Landlock LSM: Unprivileged sandboxing Andy Lutomirski <luto@amacapital.net> - 2016-08-30 18:10 +0200
    Re: [RFC v2 00/10] Landlock LSM: Unprivileged sandboxing Andy Lutomirski <luto@amacapital.net> - 2016-08-30 22:00 +0200
    Re: [RFC v2 00/10] Landlock LSM: Unprivileged sandboxing Mickaël Salaün <mic@digikod.net> - 2016-08-30 22:00 +0200

csiph-web