qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Fix a data race with goflag in rcutorture test


From: Vitalii Mordan
Subject: [PATCH] Fix a data race with goflag in rcutorture test
Date: Thu, 9 Jan 2025 13:54:02 +0300

This patch addresses a potential data race involving the global variable
goflag in the rcutorture test. The issue is resolved by adding the atomic
qualifier to ensure proper synchronization.

Fixes: 8fda74a52b ("rcu: add rcutorture")
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2750
Signed-off-by: Vitalii Mordan <mordan@ispras.ru>
---
 tests/unit/rcutorture.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/unit/rcutorture.c b/tests/unit/rcutorture.c
index 7662081683..c4971632f8 100644
--- a/tests/unit/rcutorture.c
+++ b/tests/unit/rcutorture.c
@@ -70,7 +70,7 @@ int nthreadsrunning;
 #define GOFLAG_RUN  1
 #define GOFLAG_STOP 2
 
-static volatile int goflag = GOFLAG_INIT;
+static _Atomic int goflag = GOFLAG_INIT;
 
 #define RCU_READ_RUN 1000
 
-- 
2.34.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]