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 for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20240515104754889HqrahFPePOIE1UlANHVAh@zte.com.cn>
Date: Wed, 15 May 2024 10:47:54 +0800 (CST)
From: <xu.xin16@....com.cn>
To: <akpm@...ux-foundation.org>, <david@...hat.com>,
        <linux-kernel@...r.kernel.org>, <linux-mm@...ck.org>,
        <willy@...radead.org>, <ziy@...dia.com>, <shy828301@...il.com>
Cc: <yang.yang29@....com.cn>, <ran.xiaokai@....com.cn>,
        <lu.zhongjun@....com.cn>, <xu.xin16@....com.cn>
Subject:  [PATCH v2] mm/huge_memory: mark racy access on huge_anon_orders_always

From: Ran Xiaokai <ran.xiaokai@....com.cn>

huge_anon_orders_always is accessed lockless, it is better
to use the READ_ONCE() wrapper. This is not fixing any visible
bug, hopefully this can cease some KCSAN complains in the future.
Also do that for huge_anon_orders_madvise.

Signed-off-by: Ran Xiaokai <ran.xiaokai@....com.cn>
Acked-by: David Hildenbrand <david@...hat.com>
Reviewed-by: Lu Zhongjun <lu.zhongjun@....com.cn>
Reviewed-by: xu xin <xu.xin16@....com.cn>
Cc: Yang Yang <yang.yang29@....com.cn>
---
 include/linux/huge_mm.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h
index de0c89105076..cf7f671aa634 100644
--- a/include/linux/huge_mm.h
+++ b/include/linux/huge_mm.h
@@ -122,8 +122,8 @@ static inline bool hugepage_flags_enabled(void)
 	 * So we don't need to look at huge_anon_orders_inherit.
 	 */
 	return hugepage_global_enabled() ||
-	       huge_anon_orders_always ||
-	       huge_anon_orders_madvise;
+	       READ_ONCE(huge_anon_orders_always) ||
+	       READ_ONCE(huge_anon_orders_madvise);
 }

 static inline int highest_order(unsigned long orders)
-- 
2.15.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ