BPF List
 help / color / mirror / Atom feed
From: Yonghong Song <yonghong.song@linux.dev>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>, bpf@vger.kernel.org
Cc: daniel@iogearbox.net, andrii@kernel.org, memxor@gmail.com,
	eddyz87@gmail.com
Subject: Re: [PATCH bpf-next] bpf: Emit verbose message when prog-specific btf_struct_access rejects a write
Date: Sun, 21 Jun 2026 08:38:30 -0700	[thread overview]
Message-ID: <3d2c5cd7-1159-4e0d-b294-6106decc04a7@linux.dev> (raw)
In-Reply-To: <20260615232146.5491-1-alexei.starovoitov@gmail.com>



On 6/15/26 4:21 PM, Alexei Starovoitov wrote:
> From: Alexei Starovoitov <ast@kernel.org>
>
> When BPF_WRITE goes through a PTR_TO_BTF_ID register, check_ptr_to_btf_access()
> delegates to env->ops->btf_struct_access(). Most implementations
> (bpf_scx_btf_struct_access, tc_cls_act_btf_struct_access, etc.) return
> -EACCES for disallowed fields without logging anything, so the verifier
> rejects the program with an empty message. For example a scx program doing
>
>    1: R1=trusted_ptr_task_struct()
>    ...
>    4: (7b) *(u64 *)(r1 +0) = r2
>    verification time 83 usec
>    the program is rejected
>
> leaves the user guessing which field is off-limits.
> Emit verbose message.
>
> Signed-off-by: Alexei Starovoitov <ast@kernel.org>

Indeed, e.g. bpf_scx_btf_struct_access() does not emit any verifier log
for failure. So it makes sense to have a generic verifier log after
env->ops->btf_struct_access().

Acked-by: Yonghong Song <yonghong.song@linux.dev>


      parent reply	other threads:[~2026-06-21 15:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-15 23:21 [PATCH bpf-next] bpf: Emit verbose message when prog-specific btf_struct_access rejects a write Alexei Starovoitov
2026-06-16  1:23 ` Emil Tsalapatis
2026-06-21 15:38 ` Yonghong Song [this message]

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=3d2c5cd7-1159-4e0d-b294-6106decc04a7@linux.dev \
    --to=yonghong.song@linux.dev \
    --cc=alexei.starovoitov@gmail.com \
    --cc=andrii@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --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