From: John Fastabend <john.fastabend@gmail.com>
To: Andrii Nakryiko <andrii@kernel.org>,
bpf@vger.kernel.org, ast@kernel.org, daniel@iogearbox.net,
martin.lau@kernel.org
Cc: andrii@kernel.org, kernel-team@meta.com
Subject: RE: [PATCH bpf-next 1/2] bpf: support symbolic BPF FS delegation mount options
Date: Wed, 13 Dec 2023 17:05:15 -0800 [thread overview]
Message-ID: <657a54cb684b1_44156208fe@john.notmuch> (raw)
In-Reply-To: <20231213222327.934981-2-andrii@kernel.org>
Andrii Nakryiko wrote:
> Besides already supported special "any" value and hex bit mask, support
> string-based parsing of delegation masks based on exact enumerator
> names. Utilize BTF information of `enum bpf_cmd`, `enum bpf_map_type`,
> `enum bpf_prog_type`, and `enum bpf_attach_type` types to find supported
> symbolic names (ignoring __MAX_xxx guard values). So "BPF_PROG_LOAD" and
> "BPF_MAP_CREATE" are valid values to specify for delegate_cmds options,
> "BPF_MAP_TYPE_ARRAY" is among supported for map types, etc.
>
> Besides supporting string values, we also support multiple values
> specified at the same time, using colon (':') separator.
>
> There are corresponding changes on bpf_show_options side to use known
> values to print them in human-readable format, falling back to hex mask
> printing, if there are any unrecognized bits. This shouldn't be
> necessary when enum BTF information is present, but in general we should
> always be able to fall back to this even if kernel was built without BTF.
>
> Example below shows various ways to specify delegate_cmds options
> through mount command and how mount options are printed back:
>
> $ sudo mkdir -p /sys/fs/bpf/token
> $ sudo mount -t bpf bpffs /sys/fs/bpf/token \
> -o delegate_cmds=BPF_PROG_LOAD \
> -o delegate_cmds=BPF_MAP_CREATE \
> -o delegate_cmds=BPF_TOKEN_CREATE:BPF_BTF_LOAD:BPF_LINK_CREATE
> $ mount | grep token
> bpffs on /sys/fs/bpf/token type bpf (rw,relatime,delegate_cmds=BPF_MAP_CREATE:BPF_PROG_LOAD:BPF_BTF_LOAD:BPF_LINK_CREATE:BPF_TOKEN_CREATE)
>
> Same approach works across delegate_maps, delegate_progs, and
> delegate_attachs masks as well.
>
> Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
> ---
Acked-by: John Fastabend <john.fastabend@gmail.com>
next prev parent reply other threads:[~2023-12-14 1:05 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-13 22:23 [PATCH bpf-next 0/2] BPF FS mount options parsing follow ups Andrii Nakryiko
2023-12-13 22:23 ` [PATCH bpf-next 1/2] bpf: support symbolic BPF FS delegation mount options Andrii Nakryiko
2023-12-14 1:05 ` John Fastabend [this message]
2023-12-14 15:49 ` Daniel Borkmann
2023-12-14 15:58 ` Alexei Starovoitov
2023-12-14 19:38 ` Andrii Nakryiko
2023-12-13 22:23 ` [PATCH bpf-next 2/2] selftests/bpf: utilize string values for delegate_xxx " Andrii Nakryiko
2023-12-14 1:06 ` John Fastabend
2023-12-14 6:56 ` [PATCH bpf-next 0/2] BPF FS mount options parsing follow ups John Fastabend
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=657a54cb684b1_44156208fe@john.notmuch \
--to=john.fastabend@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=kernel-team@meta.com \
--cc=martin.lau@kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.