From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755986AbcHYLT0 (ORCPT ); Thu, 25 Aug 2016 07:19:26 -0400 Received: from mail-ua0-f173.google.com ([209.85.217.173]:34677 "EHLO mail-ua0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752978AbcHYLTZ (ORCPT ); Thu, 25 Aug 2016 07:19:25 -0400 MIME-Version: 1.0 In-Reply-To: <1472121165-29071-9-git-send-email-mic@digikod.net> References: <1472121165-29071-1-git-send-email-mic@digikod.net> <1472121165-29071-9-git-send-email-mic@digikod.net> From: Andy Lutomirski Date: Thu, 25 Aug 2016 04:12:02 -0700 Message-ID: Subject: Re: [RFC v2 08/10] landlock: Handle file system comparisons To: =?UTF-8?B?TWlja2HDq2wgU2FsYcO8bg==?= , "Eric W. Biederman" Cc: "linux-kernel@vger.kernel.org" , Alexei Starovoitov , Arnd Bergmann , Casey Schaufler , Daniel Borkmann , Daniel Mack , David Drysdale , "David S . Miller" , Elena Reshetova , James Morris , Kees Cook , Paul Moore , Sargun Dhillon , "Serge E . Hallyn" , Will Drewry , "kernel-hardening@lists.openwall.com" , Linux API , LSM List , Network Development Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by mail.home.local id u7PBJUcj004040 On Thu, Aug 25, 2016 at 3:32 AM, Mickaël Salaün 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? --Andy