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] [thread-next>] [day] [month] [year] [list]
Date: Mon, 1 Apr 2024 18:57:12 +0200
From: Javier Pello <devel@...eo.eu>
To: linux-kernel@...r.kernel.org
Cc: x86@...nel.org, Thomas Gleixner <tglx@...utronix.de>, Ingo Molnar
 <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>, Dave Hansen
 <dave.hansen@...ux.intel.com>, "H. Peter Anvin" <hpa@...or.com>
Subject: [PATCH 1/1] x86/mm/pae: Align up pteval_t, pmdval_t and pudval_t to
 avoid split locks

From: Javier Pello <devel@...eo.eu>

When PAE is enabled on x86-32, the types pte_t, pmd_t and pud_t are
defined in terms of pteval_t, pmdval_t and pudval_t, respectively,
all of which are typedefs for u64, which is an 8-byte type with
4-byte alignment. However, variables of these types are subject to
compare-and-exchange operations in their respective native_set_*
functions, which can trigger split locks if a variable spans two
cache lines, for instance on the stack. Annotate these types with
__aligned(8) to avoid this.

Signed-off-by: Javier Pello <devel@...eo.eu>
Cc: x86@...nel.org
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: Ingo Molnar <mingo@...hat.com>
Cc: Borislav Petkov <bp@...en8.de>
Cc: Dave Hansen <dave.hansen@...ux.intel.com>
Cc: "H. Peter Anvin" <hpa@...or.com>
Cc: stable@...r.kernel.org
---
 arch/x86/include/asm/pgtable-3level_types.h | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/arch/x86/include/asm/pgtable-3level_types.h b/arch/x86/include/asm/pgtable-3level_types.h
index 80911349..61f62ab4 100644
--- a/arch/x86/include/asm/pgtable-3level_types.h
+++ b/arch/x86/include/asm/pgtable-3level_types.h
@@ -5,12 +5,16 @@
 #ifndef __ASSEMBLY__
 #include <linux/types.h>
 
-typedef u64	pteval_t;
-typedef u64	pmdval_t;
-typedef u64	pudval_t;
-typedef u64	p4dval_t;
-typedef u64	pgdval_t;
-typedef u64	pgprotval_t;
+/*
+ * Variables of these types are subject to atomic compare-and-exchange
+ * operations, so they have to be properly aligned to avoid split locks.
+ */
+typedef u64	pteval_t	__aligned(8);
+typedef u64	pmdval_t	__aligned(8);
+typedef u64	pudval_t	__aligned(8);
+typedef u64	p4dval_t	__aligned(8);
+typedef u64	pgdval_t	__aligned(8);
+typedef u64	pgprotval_t	__aligned(8);
 
 typedef union {
 	struct {
-- 
2.43.3

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ