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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230614163859.924309-2-lee@kernel.org>
Date:   Wed, 14 Jun 2023 17:38:54 +0100
From:   Lee Jones <lee@...nel.org>
To:     lee@...nel.org, dave.hansen@...ux.intel.com, luto@...nel.org,
        peterz@...radead.org, tglx@...utronix.de, mingo@...hat.com,
        bp@...en8.de, x86@...nel.org, hpa@...or.com, linux-mm@...ck.org
Cc:     linux-kernel@...r.kernel.org
Subject: [PATCH v2 1/1] x86/mm/KASLR: Store pud_page_tramp into entry rather than page

set_pgd() expects to be passed whole pages to operate on, whereas
trampoline_pgd_entry is, as the name suggests, an entry.  The
ramifications for using set_pgd() here are that the following thread of
execution will not only place the suggested value into the
trampoline_pgd_entry (8-Byte globally stored [.bss]) variable, PTI will
also attempt to replicate that value into the non-existent neighboring
user page (located +4k away), leading to the corruption of other global
[.bss] stored variables.

Suggested-by: Dave Hansen <dave.hansen@...ux.intel.com>
Signed-off-by: Lee Jones <lee@...nel.org>
---
 arch/x86/mm/kaslr.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/x86/mm/kaslr.c b/arch/x86/mm/kaslr.c
index 557f0fe25dff4..37db264866b64 100644
--- a/arch/x86/mm/kaslr.c
+++ b/arch/x86/mm/kaslr.c
@@ -172,10 +172,10 @@ void __meminit init_trampoline_kaslr(void)
 		set_p4d(p4d_tramp,
 			__p4d(_KERNPG_TABLE | __pa(pud_page_tramp)));
 
-		set_pgd(&trampoline_pgd_entry,
-			__pgd(_KERNPG_TABLE | __pa(p4d_page_tramp)));
+		trampoline_pgd_entry =
+			__pgd(_KERNPG_TABLE | __pa(p4d_page_tramp));
 	} else {
-		set_pgd(&trampoline_pgd_entry,
-			__pgd(_KERNPG_TABLE | __pa(pud_page_tramp)));
+		trampoline_pgd_entry =
+			__pgd(_KERNPG_TABLE | __pa(pud_page_tramp));
 	}
 }
-- 
2.41.0.162.gfafddb0af9-goog

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ