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: <20240226170011.22798-2-d.dulov@aladdin.ru>
Date: Mon, 26 Feb 2024 20:00:11 +0300
From: Daniil Dulov <d.dulov@...ddin.ru>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>, <stable@...r.kernel.org>
CC: Daniil Dulov <d.dulov@...ddin.ru>, Davidlohr Bueso <dave@...olabs.net>,
	"Paul E. McKenney" <paulmck@...nel.org>, Josh Triplett
	<josh@...htriplett.org>, Steven Rostedt <rostedt@...dmis.org>, Mathieu
 Desnoyers <mathieu.desnoyers@...icios.com>, Lai Jiangshan
	<jiangshanlai@...il.com>, Joel Fernandes <joel@...lfernandes.org>,
	<linux-kernel@...r.kernel.org>, <rcu@...r.kernel.org>,
	<lvc-project@...uxtesting.org>, David Vernet <void@...ifault.com>
Subject: [PATCH 5.10 1/1] rcutorture: Add missing return and use __func__ in warning

From: David Vernet <void@...ifault.com>

commit 80dcee695143255261f30c7cc2a041ba413717a4 upstream.

The rcutorture module has an rcu_torture_writer task that repeatedly
performs writes, synchronizations, and deletes. There is a corner-case
check in rcu_torture_writer() wherein if nsynctypes is 0, a warning is
issued and the task waits to be stopped via a call to
torture_kthread_stopping() rather than performing any work.

There should be a return statement following this call to
torture_kthread_stopping(), as the intention with issuing the call to
torture_kthread_stopping() in the first place is to avoid the
rcu_torture_writer task from performing any work. Some of the work may even
be dangerous to perform, such as potentially causing a #DE due to
nsynctypes being used in a modulo operator when querying for sync updates
to issue.

This patch adds the missing return call.  As a bonus, it also fixes a
checkpatch warning that was emitted due to the WARN_ONCE() call using the
name of the function rather than __func__.

Signed-off-by: David Vernet <void@...ifault.com>
Signed-off-by: Paul E. McKenney <paulmck@...nel.org>
Signed-off-by: Daniil Dulov <d.dulov@...ddin.ru>
---
 kernel/rcu/rcutorture.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c
index 6c1aea48a79a..69856904838c 100644
--- a/kernel/rcu/rcutorture.c
+++ b/kernel/rcu/rcutorture.c
@@ -1063,7 +1063,7 @@ rcu_torture_writer(void *arg)
 		pr_alert("%s: gp_sync without primitives.\n", __func__);
 	}
 	if (WARN_ONCE(nsynctypes == 0,
-		      "rcu_torture_writer: No update-side primitives.\n")) {
+		      "%s: No update-side primitives.\n", __func__)) {
 		/*
 		 * No updates primitives, so don't try updating.
 		 * The resulting test won't be testing much, hence the
@@ -1071,6 +1071,7 @@ rcu_torture_writer(void *arg)
 		 */
 		rcu_torture_writer_state = RTWS_STOPPING;
 		torture_kthread_stopping("rcu_torture_writer");
+		return 0;
 	}
 
 	do {
-- 
2.25.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ