lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <A7C75238-E17D-4288-8A2B-5BC62CBB5FD8@nvidia.com>
Date: Tue, 23 Dec 2025 01:24:21 +0000
From: Joel Fernandes <joelagnelf@...dia.com>
To: "paulmck@...nel.org" <paulmck@...nel.org>
CC: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>, Davidlohr
 Bueso <dave@...olabs.net>, Josh Triplett <josh@...htriplett.org>, Frederic
 Weisbecker <frederic@...nel.org>, Neeraj Upadhyay
	<neeraj.upadhyay@...nel.org>, Boqun Feng <boqun.feng@...il.com>, Uladzislau
 Rezki <urezki@...il.com>, Steven Rostedt <rostedt@...dmis.org>, Mathieu
 Desnoyers <mathieu.desnoyers@...icios.com>, Lai Jiangshan
	<jiangshanlai@...il.com>, Zqiang <qiang.zhang@...ux.dev>,
	"rcu@...r.kernel.org" <rcu@...r.kernel.org>
Subject: Re: [PATCH] rcutorture: Fix operator precedence bug in exp_current()
 invocation



> On Dec 22, 2025, at 8:12 PM, Paul E. McKenney <paulmck@...nel.org> wrote:
> 
> On Mon, Dec 22, 2025 at 07:44:07PM -0500, Joel Fernandes wrote:
>> Fix incorrect operator precedence in the conditional that determines
>> when to call exp_current() during torture testing. The modulo
>> by 0xff appears to do nothing.
>> 
>> Fix by adding parentheses:
>> 
>>    !(torture_random(&rand) % 0xff)
>> 
>> Signed-off-by: Joel Fernandes <joelagnelf@...dia.com>
> 
> Good eyes, thank you!
> 
> Unfortunately, Chris Mason beat you to it:
> 
> 50d8a5d2a94c ("rcutorture: Correctly compute probability to invoke ->exp_current()")
> 
> I will add your Reported-by to that commit on my next rebase.

Ah, nice thanks.

 - Joel

> 
>                            Thanx, Paul
> 
>> ---
>> kernel/rcu/rcutorture.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>> 
>> diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c
>> index 82588ceed9da..9873a1d54c46 100644
>> --- a/kernel/rcu/rcutorture.c
>> +++ b/kernel/rcu/rcutorture.c
>> @@ -1749,7 +1749,7 @@ rcu_torture_writer(void *arg)
>>                    ulo[i] = cur_ops->get_comp_state();
>>                gp_snap = cur_ops->start_gp_poll();
>>                rcu_torture_writer_state = RTWS_POLL_WAIT;
>> -                if (cur_ops->exp_current && !torture_random(&rand) % 0xff)
>> +                if (cur_ops->exp_current && !(torture_random(&rand) % 0xff))
>>                    cur_ops->exp_current();
>>                while (!cur_ops->poll_gp_state(gp_snap)) {
>>                    gp_snap1 = cur_ops->get_gp_state();
>> @@ -1771,7 +1771,7 @@ rcu_torture_writer(void *arg)
>>                    cur_ops->get_comp_state_full(&rgo[i]);
>>                cur_ops->start_gp_poll_full(&gp_snap_full);
>>                rcu_torture_writer_state = RTWS_POLL_WAIT_FULL;
>> -                if (cur_ops->exp_current && !torture_random(&rand) % 0xff)
>> +                if (cur_ops->exp_current && !(torture_random(&rand) % 0xff))
>>                    cur_ops->exp_current();
>>                while (!cur_ops->poll_gp_state_full(&gp_snap_full)) {
>>                    cur_ops->get_gp_state_full(&gp_snap1_full);
>> --
>> 2.34.1
>> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ