Linux Trace Kernel
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Leon Hwang" <leon.hwang@linux.dev>, bpf@vger.kernel.org
Cc: linux-trace-kernel@vger.kernel.org
Subject: Re: [PATCH bpf-next v3 1/9] bpf: Add log support for tracing link_create
Date: Mon, 23 Nov 2026 15:38:47 +0000	[thread overview]
Message-ID: <sashiko-outbox-229589@kernel.org> (raw)
In-Reply-To: <20261123152743.19629-2-leon.hwang@linux.dev>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] bpf: non-UAPI field name tgt_fd logged in
  bpf_tracing_prog_attach()
--

commit 476f541041ef9d87251f0598129c4def280d1320
Author: Leon Hwang <leon.hwang@linux.dev>

bpf: Add log support for tracing link_create

This commit adds verifier log reporting to tracing BPF_LINK_CREATE for
attach parameter validation, reattachment checks, and target compatibility
checks in bpf_check_attach_target().

> diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
> index ec8e787929112..80504011403f6 100644
> --- a/kernel/bpf/syscall.c
> +++ b/kernel/bpf/syscall.c
> @@ -3677,7 +3677,8 @@ static int bpf_tracing_prog_attach(struct bpf_prog *prog,
>  				   int tgt_prog_fd,
>  				   u32 btf_id,
>  				   u64 bpf_cookie,
> -				   enum bpf_attach_type attach_type)
> +				   enum bpf_attach_type attach_type,
> +				   struct bpf_verifier_log *log)
>  {
>  	struct bpf_link_primer link_primer;
>  	struct bpf_prog *tgt_prog = NULL;
> @@ -3714,6 +3715,7 @@ static int bpf_tracing_prog_attach(struct bpf_prog *prog,
>  	}
>  
>  	if (!!tgt_prog_fd != !!btf_id) {
> +		bpf_log(log, "target_fd and target_btf_id must be both set or both unset.\n");
>  		err = -EINVAL;
>  		goto out_put_prog;
>  	}
> @@ -3726,12 +3728,14 @@ static int bpf_tracing_prog_attach(struct bpf_prog *prog,
>  		 * attach_tracing_prog flag is set.
>  		 */
>  		if (prog->type != BPF_PROG_TYPE_EXT) {
> +			bpf_log(log, "target_fd is only allowed for freplace prog.\n");
>  			err = -EINVAL;
>  			goto out_put_prog;
>  		}
>  
>  		tgt_prog = bpf_prog_get(tgt_prog_fd);
>  		if (IS_ERR(tgt_prog)) {
> +			bpf_log(log, "Invalid tgt_fd.\n");

[Severity: Low]
As reported by Alexei Starovoitov on v2 [1], should this log "Invalid
target_fd.\n" to match the link_create.target_fd UAPI field name used by
the other log messages in bpf_tracing_prog_attach()?

[1] https://lore.kernel.org/r/DMX8G01GB597.2KEEFI12YK9V0@gmail.com

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261123152743.19629-1-leon.hwang@linux.dev?part=1

  reply	other threads:[~2026-11-23 15:38 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-23 15:27 [PATCH bpf-next v3 0/9] bpf: Add log support for tracing link_create Leon Hwang
2026-11-23 15:27 ` [PATCH bpf-next v3 1/9] " Leon Hwang
2026-11-23 15:38   ` sashiko-bot [this message]
2026-11-23 15:27 ` [PATCH bpf-next v3 2/9] bpf: Add log support for tracing_multi link_create Leon Hwang
2026-11-23 15:27 ` [PATCH bpf-next v3 3/9] bpf: Add log support for iter link_create Leon Hwang
2026-11-23 15:27 ` [PATCH bpf-next v3 4/9] bpf: Add log support for cgroup prog link_create Leon Hwang
2026-11-23 15:27 ` [PATCH bpf-next v3 5/9] libbpf: Add log_opts support for BPF_TRACE_ITER Leon Hwang
2026-11-23 15:27 ` [PATCH bpf-next v3 6/9] selftests/bpf: Test tracing link_create logs Leon Hwang
2026-11-23 15:27 ` [PATCH bpf-next v3 7/9] selftests/bpf: Test tracing_multi " Leon Hwang
2026-11-23 15:27 ` [PATCH bpf-next v3 8/9] selftests/bpf: Verify iter " Leon Hwang
2026-11-23 15:27 ` [PATCH bpf-next v3 9/9] selftests/bpf: Verify cgroup prog " Leon Hwang

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=sashiko-outbox-229589@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=leon.hwang@linux.dev \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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