From: "Alexei Starovoitov" <alexei.starovoitov@gmail.com>
To: "Daniel Borkmann" <daniel@iogearbox.net>, <ast@kernel.org>
Cc: <memxor@gmail.com>, <eddyz87@gmail.com>, <info@starlabs.sg>,
<bpf@vger.kernel.org>
Subject: Re: [PATCH bpf 3/4] bpf: Require CAP_PERFMON for untrusted read-only memory reads
Date: Thu, 10 Sep 2026 08:42:52 -0700 [thread overview]
Message-ID: <DLBR23ZSPNHT.49259869EXRH@gmail.com> (raw)
In-Reply-To: <20260910142107.40582-3-daniel@iogearbox.net>
On Thu Sep 10, 2026 at 7:21 AM PDT, Daniel Borkmann wrote:
> Marking bpf_rdonly_cast() KF_PERFMON CAP-limits one producer of PTR_TO_MEM |
> MEM_RDONLY | PTR_UNTRUSTED, but not the type itself. A global subprogram
> argument tagged __arg_untrusted results in the same register with no kfunc
> call.
>
> Fixes: c4aa454c64ae ("bpf: support for void/primitive __arg_untrusted global func params")
> Reported-by: STAR Labs SG <info@starlabs.sg>
> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
> ---
> kernel/bpf/verifier.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
> index 5d61e74865a8..3f99b20e04fc 100644
> --- a/kernel/bpf/verifier.c
> +++ b/kernel/bpf/verifier.c
> @@ -6453,6 +6453,16 @@ static int check_mem_access(struct bpf_verifier_env *env, int insn_idx, struct b
> return -EACCES;
> }
>
> + if (rdonly_untrusted && !env->allow_ptr_leaks) {
> + verbose(env, "%s access is allowed only to CAP_PERFMON and CAP_SYS_ADMIN\n",
> + reg_type_str(env, reg->type));
> + bpf_diag_policy(
> + env, insn_idx, "read from untrusted read-only memory",
> + "the access requires CAP_PERFMON",
> + "Load the program with CAP_PERFMON, or avoid dereferencing untrusted pointers.");
That's an odd formatting.
bpf_diag_policy(env, insn_idx, "read from untrusted read-only memory",
"the access requires CAP_PERFMON",
would look more normal.
pw-bot: cr
next prev parent reply other threads:[~2026-09-10 15:42 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-10 14:21 [PATCH bpf 1/4] bpf: Add KF_PERFMON kfunc flag Daniel Borkmann
2026-09-10 14:21 ` [PATCH bpf 2/4] bpf: Require CAP_PERFMON for kfuncs reading memory Daniel Borkmann
2026-09-10 15:10 ` bot+bpf-ci
2026-09-10 15:41 ` Alexei Starovoitov
2026-09-10 15:53 ` Daniel Borkmann
2026-09-10 14:21 ` [PATCH bpf 3/4] bpf: Require CAP_PERFMON for untrusted read-only memory reads Daniel Borkmann
2026-09-10 15:42 ` Alexei Starovoitov [this message]
2026-09-10 14:21 ` [PATCH bpf 4/4] selftests/bpf: Add tests for the KF_PERFMON gates Daniel Borkmann
2026-09-10 15:03 ` [PATCH bpf 1/4] bpf: Add KF_PERFMON kfunc flag Mykyta Yatsenko
2026-09-10 15:14 ` Kumar Kartikeya Dwivedi
2026-09-10 15:21 ` Mykyta Yatsenko
2026-09-10 15:10 ` bot+bpf-ci
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=DLBR23ZSPNHT.49259869EXRH@gmail.com \
--to=alexei.starovoitov@gmail.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=info@starlabs.sg \
--cc=memxor@gmail.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