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_705C16DF25978ACAEBD1E83E228881901006@qq.com>
Date:   Tue, 17 Oct 2023 16:50:52 +0800
From:   Rong Tao <rtoax@...mail.com>
To:     mark.rutland@....com, elver@...gle.com, tglx@...utronix.de,
        peterz@...radead.org, Rong Tao <rongtao@...tc.cn>,
        linux-kernel@...r.kernel.org (open list)
Subject: [PATCH] stop_machine: Avoid potential race behaviour of multi_stop_data::state

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

In commit b1fc58333575 ("stop_machine: Avoid potential race behaviour")
fix both multi_cpu_stop() and set_state() access multi_stop_data::state,
We should ensure that multi_stop_data::state is accessed using the rwonce
method.

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

diff --git a/kernel/stop_machine.c b/kernel/stop_machine.c
index cedb17ba158a..73de9ab77132 100644
--- a/kernel/stop_machine.c
+++ b/kernel/stop_machine.c
@@ -191,7 +191,7 @@ static void set_state(struct multi_stop_data *msdata,
 static void ack_state(struct multi_stop_data *msdata)
 {
 	if (atomic_dec_and_test(&msdata->thread_ack))
-		set_state(msdata, msdata->state + 1);
+		set_state(msdata, READ_ONCE(msdata->state) + 1);
 }
 
 notrace void __weak stop_machine_yield(const struct cpumask *cpumask)
-- 
2.42.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ