rcu.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Boqun Feng" <boqun.feng@gmail.com>
To: "Joel Fernandes" <joelagnelf@nvidia.com>,
	"Uladzislau Rezki (Sony)" <urezki@gmail.com>,
	"Paul E. McKenney" <paulmck@kernel.org>,
	"Joel Fernandes" <joel@joelfernandes.org>,
	"Neeraj Upadhyay" <Neeraj.Upadhyay@amd.com>
Cc: RCU <rcu@vger.kernel.org>, LKML <linux-kernel@vger.kernel.org>,
	"Frederic Weisbecker" <frederic@kernel.org>,
	"Oleksiy Avramchenko" <oleksiy.avramchenko@sony.com>
Subject: Re: [PATCH 1/3] rcu: Return early if callback is not specified
Date: Thu, 12 Jun 2025 10:33:22 -0700	[thread overview]
Message-ID: <e40a03bd-e817-4f4f-a5a4-d8be00cf6cc1@app.fastmail.com> (raw)
In-Reply-To: <0caf7054-140e-4b6c-abd4-2ec2ebe79b2c@app.fastmail.com>



On Thu, Jun 12, 2025, at 10:30 AM, Boqun Feng wrote:
> On Tue, Jun 10, 2025, at 12:33 PM, Joel Fernandes wrote:
>> On 6/10/2025 1:34 PM, Uladzislau Rezki (Sony) wrote:
>>> Currently the call_rcu() API does not check whether a callback
>>> pointer is NULL. If NULL is passed, rcu_core() will try to invoke
>>> it, resulting in NULL pointer dereference and a kernel crash.
>>> 
>>> To prevent this and improve debuggability, this patch adds a check
>>> for NULL and emits a kernel stack trace to help identify a faulty
>>> caller.
>>> 
>>> Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
>>
>> Reviewed-by: Joel Fernandes <joelagnelf@nvidia.com>
>>
>
> Reviewed-by: Boqun Feng <boqun.feng@gmail.com>
>

(Accidentally sent from another email account, FWIW,
this is Boqun Feng and I approve this message, sorry
couldn’t resist :))

Regards,
Boqun

>> I will add this first one (only this one since we're discussing the others) to a
>> new rcu/fixes-for-6.16 branch, but let me know if any objections.
>>
>
> Not sure it’s urgent enough given the current evidence.
>
> Regards,
> Boqun
>
>> Will push that branch out during -rc2 or -rc3 after sufficient testing.
>>
>> thanks,
>>
>>  - Joel
>>
>>> ---
>>>  kernel/rcu/tree.c | 4 ++++
>>>  1 file changed, 4 insertions(+)
>>> 
>>> diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
>>> index e8a4b720d7d2..14d4499c6fc3 100644
>>> --- a/kernel/rcu/tree.c
>>> +++ b/kernel/rcu/tree.c
>>> @@ -3072,6 +3072,10 @@ __call_rcu_common(struct rcu_head *head, rcu_callback_t func, bool lazy_in)
>>>  	/* Misaligned rcu_head! */
>>>  	WARN_ON_ONCE((unsigned long)head & (sizeof(void *) - 1));
>>>  
>>> +	/* Avoid NULL dereference if callback is NULL. */
>>> +	if (WARN_ON_ONCE(!func))
>>> +		return;
>>> +
>>>  	if (debug_rcu_head_queue(head)) {
>>>  		/*
>>>  		 * Probable double call_rcu(), so leak the callback.

  reply	other threads:[~2025-06-12 17:33 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-10 17:34 [PATCH 1/3] rcu: Return early if callback is not specified Uladzislau Rezki (Sony)
2025-06-10 17:34 ` [PATCH 2/3] rcu: Enable rcu_normal_wake_from_gp on small systems Uladzislau Rezki (Sony)
2025-06-10 18:34   ` Joel Fernandes
2025-06-11  9:25     ` Uladzislau Rezki
2025-06-10 17:34 ` [PATCH 3/3] Documentation/kernel-parameters: Update rcu_normal_wake_from_gp doc Uladzislau Rezki (Sony)
2025-06-10 19:33 ` [PATCH 1/3] rcu: Return early if callback is not specified Joel Fernandes
2025-06-11  9:24   ` Uladzislau Rezki
2025-06-12 17:30   ` Boqun Feng
2025-06-12 17:33     ` Boqun Feng [this message]
2025-06-12 17:46     ` Uladzislau Rezki
2025-06-12 21:03       ` Boqun Feng
2025-06-17  2:25         ` Joel Fernandes

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=e40a03bd-e817-4f4f-a5a4-d8be00cf6cc1@app.fastmail.com \
    --to=boqun.feng@gmail.com \
    --cc=Neeraj.Upadhyay@amd.com \
    --cc=frederic@kernel.org \
    --cc=joel@joelfernandes.org \
    --cc=joelagnelf@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleksiy.avramchenko@sony.com \
    --cc=paulmck@kernel.org \
    --cc=rcu@vger.kernel.org \
    --cc=urezki@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;
as well as URLs for NNTP newsgroup(s).