From: Christian Brauner <brauner@kernel.org>
To: "Michael Weiß" <michael.weiss@aisec.fraunhofer.de>
Cc: Alexander Mikhalitsyn <alexander@mihalicyn.com>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>,
Martin KaFai Lau <martin.lau@linux.dev>,
Song Liu <song@kernel.org>, Yonghong Song <yhs@fb.com>,
John Fastabend <john.fastabend@gmail.com>,
KP Singh <kpsingh@kernel.org>,
Stanislav Fomichev <sdf@google.com>, Hao Luo <haoluo@google.com>,
Jiri Olsa <jolsa@kernel.org>,
Quentin Monnet <quentin@isovalent.com>,
Alexander Viro <viro@zeniv.linux.org.uk>,
bpf@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-fsdevel@vger.kernel.org, gyroidos@aisec.fraunhofer.de
Subject: Re: [PATCH RFC 1/4] bpf: add cgroup device guard to flag a cgroup device prog
Date: Tue, 15 Aug 2023 10:59:22 +0200 [thread overview]
Message-ID: <20230815-feigling-kopfsache-56c2d31275bd@brauner> (raw)
In-Reply-To: <20230814-devcg_guard-v1-1-654971ab88b1@aisec.fraunhofer.de>
On Mon, Aug 14, 2023 at 04:26:09PM +0200, Michael Weiß wrote:
> Introduce the BPF_F_CGROUP_DEVICE_GUARD flag for BPF_PROG_LOAD
> which allows to set a cgroup device program to be a device guard.
Currently we block access to devices unconditionally in may_open_dev().
Anything that's mounted by an unprivileged containers will get
SB_I_NODEV set in s_i_flags.
Then we currently mediate device access in:
* inode_permission()
-> devcgroup_inode_permission()
* vfs_mknod()
-> devcgroup_inode_mknod()
* blkdev_get_by_dev() // sget()/sget_fc(), other ways to open block devices and friends
-> devcgroup_check_permission()
* drivers/gpu/drm/amd/amdkfd // weird restrictions on showing gpu info afaict
-> devcgroup_check_permission()
All your new flag does is to bypass that SB_I_NODEV check afaict and let
it proceed to the devcgroup_*() checks for the vfs layer.
But I don't get the semantics yet.
Is that a flag which is set on BPF_PROG_TYPE_CGROUP_DEVICE programs or
is that a flag on random bpf programs? It looks like it would be the
latter but design-wise I would expect this to be a property of the
device program itself.
next prev parent reply other threads:[~2023-08-15 9:01 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-14 14:26 [PATCH RFC 0/4] bpf: cgroup device guard for non-initial user namespace Michael Weiß
2023-08-14 14:26 ` [PATCH RFC 1/4] bpf: add cgroup device guard to flag a cgroup device prog Michael Weiß
2023-08-14 15:54 ` Alexander Mikhalitsyn
2023-08-17 15:50 ` Michael Weiß
2023-08-15 8:59 ` Christian Brauner [this message]
2023-08-17 15:47 ` Michael Weiß
2023-08-17 22:11 ` Alexei Starovoitov
2023-08-29 13:35 ` Alexander Mikhalitsyn
2023-09-04 11:44 ` Christian Brauner
2023-09-11 10:38 ` Michael Weiß
2023-09-11 12:35 ` Christian Brauner
2023-09-11 19:20 ` Paul Moore
2023-08-14 14:26 ` [PATCH RFC 2/4] bpf: provide cgroup_device_guard in bpf_prog_info to user space Michael Weiß
2023-08-14 14:26 ` [PATCH RFC 3/4] device_cgroup: wrapper for bpf cgroup device guard Michael Weiß
2023-08-14 14:26 ` [PATCH RFC 4/4] fs: allow mknod in non-initial userns using " Michael Weiß
2023-08-14 15:24 ` Alexander Mikhalitsyn
2023-08-15 7:18 ` kernel test robot
2023-08-15 7:49 ` Alexander Mikhalitsyn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230815-feigling-kopfsache-56c2d31275bd@brauner \
--to=brauner@kernel.org \
--cc=alexander@mihalicyn.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=gyroidos@aisec.fraunhofer.de \
--cc=haoluo@google.com \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kpsingh@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=martin.lau@linux.dev \
--cc=michael.weiss@aisec.fraunhofer.de \
--cc=quentin@isovalent.com \
--cc=sdf@google.com \
--cc=song@kernel.org \
--cc=viro@zeniv.linux.org.uk \
--cc=yhs@fb.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).