public inbox for bpf@vger.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Kuniyuki Iwashima" <kuniyu@google.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH v1 bpf] bpf: Free reuseport cBPF prog after RCU grace period.
Date: Sat, 25 Apr 2026 23:54:03 +0000	[thread overview]
Message-ID: <20260425235403.9E327C2BCB0@smtp.kernel.org> (raw)
In-Reply-To: <20260424235247.1990272-1-kuniyu@google.com>

Sashiko AI review found 1 potential issue(s):
- [Low] Function signature mismatch causing a build failure and an unused parameter.
--

commit 6107cbce59856b0c337016870577c881817dea05
Author: Kuniyuki Iwashima <kuniyu@google.com>

bpf: Free reuseport cBPF prog after RCU grace period.

This commit defers freeing of reuseport cBPF programs until after an RCU
grace period to avoid use-after-free bugs when they are detached while
packets are being sent. It uses call_rcu to handle the deferred cleanup.

> diff --git a/net/core/filter.c b/net/core/filter.c
> index 5fa9189eb772b2..5b6bd26bb80a92 100644
> --- a/net/core/filter.c
> +++ b/net/core/filter.c

[ ... ]

> -void sk_reuseport_prog_free(struct bpf_prog *prog)
> +void sk_reuseport_prog_free(struct bpf_prog *prog, bool wait_rcu)
>  {

Does this change the function signature without updating the declaration in
include/linux/filter.h or the callers in net/core/sock_reuseport.c? This
appears to cause a build failure due to conflicting types and too few
arguments passed by existing callers.

>  	if (!prog)
>  		return;
>  
> -	if (prog->type == BPF_PROG_TYPE_SK_REUSEPORT)
> -		bpf_prog_put(prog);
> +	if (bpf_prog_was_classic(prog))
> +		call_rcu(&prog->aux->rcu, sk_reuseport_prog_free_rcu);

Is the new wait_rcu parameter used? It looks like call_rcu is executed
unconditionally for classic BPF programs, and wait_rcu is ignored
throughout the function body.

>  	else
> -		bpf_prog_destroy(prog);
> +		bpf_prog_put(prog);
>  }

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260424235247.1990272-1-kuniyu@google.com?part=1

      parent reply	other threads:[~2026-04-25 23:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-24 23:52 [PATCH v1 bpf] bpf: Free reuseport cBPF prog after RCU grace period Kuniyuki Iwashima
2026-04-25  0:26 ` bot+bpf-ci
2026-04-25  0:30   ` Kuniyuki Iwashima
2026-04-25 23:54 ` sashiko-bot [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=20260425235403.9E327C2BCB0@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=kuniyu@google.com \
    --cc=sashiko@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