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>] [day] [month] [year] [list]
Message-ID: <173880236261.10177.14147520520179813519.tip-bot2@tip-bot2>
Date: Thu, 06 Feb 2025 00:39:22 -0000
From: "tip-bot2 for Maciej Wieczor-Retman" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: "Maciej Wieczor-Retman" <maciej.wieczor-retman@...el.com>,
 Dave Hansen <dave.hansen@...ux.intel.com>, x86@...nel.org,
 linux-kernel@...r.kernel.org
Subject: [tip: x86/mm] x86: Compare physical instead of virtual PGD addresses

The following commit has been merged into the x86/mm branch of tip:

Commit-ID:     63887c9f02030afd042c125052ad60680f7c21b2
Gitweb:        https://git.kernel.org/tip/63887c9f02030afd042c125052ad60680f7c21b2
Author:        Maciej Wieczor-Retman <maciej.wieczor-retman@...el.com>
AuthorDate:    Tue, 04 Feb 2025 18:33:50 +01:00
Committer:     Dave Hansen <dave.hansen@...ux.intel.com>
CommitterDate: Wed, 05 Feb 2025 16:23:17 -08:00

x86: Compare physical instead of virtual PGD addresses

This is a preparatory patch for when pointers have tags in their
upper address bits. But it's a harmless change on its own.

The mm->pgd virtual address may be tagged because it came out of
the allocator at some point. The __va(read_cr3_pa()) address will
never be tagged (the tag bits are all 1's). A direct pointer value
comparison would fail if one is tagged and the other is not.

To fix this, just compare the physical addresses which are never
affected by tagging.

[ dhansen: subject and changelog munging ]

Signed-off-by: Maciej Wieczor-Retman <maciej.wieczor-retman@...el.com>
Signed-off-by: Dave Hansen <dave.hansen@...ux.intel.com>
Link: https://lore.kernel.org/all/fde443d0e67f76a51e7ab4e96647705840f53ddb.1738686764.git.maciej.wieczor-retman%40intel.com
---
 arch/x86/mm/tlb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/mm/tlb.c b/arch/x86/mm/tlb.c
index 6cf881a..ffc25b3 100644
--- a/arch/x86/mm/tlb.c
+++ b/arch/x86/mm/tlb.c
@@ -1325,7 +1325,7 @@ bool nmi_uaccess_okay(void)
 	if (loaded_mm != current_mm)
 		return false;
 
-	VM_WARN_ON_ONCE(current_mm->pgd != __va(read_cr3_pa()));
+	VM_WARN_ON_ONCE(__pa(current_mm->pgd) != read_cr3_pa());
 
 	return true;
 }

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ