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-next>] [day] [month] [year] [list]
Message-ID: <tencent_3B1BE2B20183906E56D9E58C4AE4EBC62806@qq.com>
Date:   Fri, 20 Oct 2023 22:43:34 +0800
From:   Rong Tao <rtoax@...mail.com>
To:     mark.rutland@....com, elver@...gle.com,
        linux-kernel@...r.kernel.org, peterz@...radead.org,
        rongtao@...tc.cn, rtoax@...mail.com, tglx@...utronix.de
Subject: [PATCH 2/2] stop_machine: Apply smp_store_release() to multi_stop_data::state

From: Rong Tao <rongtao@...tc.cn>

Replace smp_wmb()+WRITE_ONCE() with smp_store_release() and add comment.

Signed-off-by: Rong Tao <rongtao@...tc.cn>
---
 kernel/stop_machine.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/kernel/stop_machine.c b/kernel/stop_machine.c
index 268c2e581698..cdf4a3fe0348 100644
--- a/kernel/stop_machine.c
+++ b/kernel/stop_machine.c
@@ -183,8 +183,10 @@ static void set_state(struct multi_stop_data *msdata,
 {
 	/* Reset ack counter. */
 	atomic_set(&msdata->thread_ack, msdata->num_threads);
-	smp_wmb();
-	WRITE_ONCE(msdata->state, newstate);
+	/* This smp_store_release() pair with READ_ONCE() in multi_cpu_stop().
+	 * Avoid potential access multi_stop_data::state race behaviour.
+	 */
+	smp_store_release(&msdata->state, newstate);
 }
 
 /* Last one to ack a state moves to the next state. */
-- 
2.41.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ