From: Greg KH <greg@kroah.com>
To: Ning Ding <dingning04@gmail.com>
Cc: bpf@vger.kernel.org, ast@kernel.org, daniel@iogearbox.net,
andrii@kernel.org, eddyz87@gmail.com, memxor@gmail.com,
martin.lau@linux.dev, davem@davemloft.net
Subject: Re: [PATCH bpf v2 1/2] bpf: Keep refcount_acquire nullable for borrowed RCU kptrs
Date: Mon, 27 Jul 2026 06:50:04 +0200 [thread overview]
Message-ID: <2026072749-refueling-bonelike-522f@gregkh> (raw)
In-Reply-To: <20260726235030.1152542-2-dingning04@gmail.com>
On Sun, Jul 26, 2026 at 04:50:29PM -0700, Ning Ding wrote:
> bpf_refcount_acquire() returns NULL if the object's refcount has
> reached zero. For an RCU-loaded map kptr, another thread can replace
> the map entry and drop the last owning reference before the acquire,
> which makes the ref count drop to 0.
>
> However, the verifier incorrectly marks the input as owning solely because it
> lacks NON_OWN_REF, and therefore treats the return value as non-NULL.
> This allows an unchecked NULL return to be passed to bpf_obj_drop(),
> which can crash the kernel.
>
> Only treat the input as owning when it is present in the verifier's
> acquired-reference state. Add tests for owning input, checked borrowed
> RCU input, and unchecked borrowed RCU input.
>
> Fixes: 7793fc3babe9 ("bpf: Make bpf_refcount_acquire fallible for non-owning refs")
> Assisted-by: Codex:gpt-5.5
> Assisted-by: ChatGPT:GPT-5.6-Thinking
> Signed-off-by: Ning Ding <dingning04@gmail.com>
> ---
> kernel/bpf/verifier.c | 2 +-
> .../selftests/bpf/progs/refcounted_kptr.c | 61 +++++++++++++++++++
> .../bpf/progs/refcounted_kptr_fail.c | 47 ++++++++++++++
> 3 files changed, 109 insertions(+), 1 deletion(-)
>
Hi,
This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him
a patch that has triggered this response. He used to manually respond
to these common problems, but in order to save his sanity (he kept
writing the same thing over and over, yet to different people), I was
created. Hopefully you will not take offence and will fix the problem
in your patch and resubmit it so that it can be accepted into the Linux
kernel tree.
You are receiving this message because of the following common error(s)
as indicated below:
- You have marked a patch with a "Fixes:" tag for a commit that is in an
older released kernel, yet you do not have a cc: stable line in the
signed-off-by area at all, which means that the patch will not be
applied to any older kernel releases. To properly fix this, please
follow the documented rules in the
Documentation/process/stable-kernel-rules.rst file for how to resolve
this.
If you wish to discuss this problem further, or you have questions about
how to resolve this issue, please feel free to respond to this email and
Greg will reply once he has dug out from the pending patches received
from other developers.
thanks,
greg k-h's patch email bot
next prev parent reply other threads:[~2026-07-27 4:51 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-26 23:50 [PATCH bpf v2 0/2] bpf: Fix refcount_acquire handling for borrowed kptrs Ning Ding
2026-07-26 23:50 ` [PATCH bpf v2 1/2] bpf: Keep refcount_acquire nullable for borrowed RCU kptrs Ning Ding
2026-07-27 4:50 ` Greg KH [this message]
2026-07-26 23:50 ` [PATCH bpf v2 2/2] bpf: Reject untrusted pointers in refcount_acquire Ning Ding
2026-07-27 0:13 ` sashiko-bot
2026-07-27 0:40 ` Ning Ding
2026-07-27 4:50 ` Greg KH
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=2026072749-refueling-bonelike-522f@gregkh \
--to=greg@kroah.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=dingning04@gmail.com \
--cc=eddyz87@gmail.com \
--cc=martin.lau@linux.dev \
--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