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: <174422759734.31282.1269344857115522289.tip-bot2@tip-bot2>
Date: Wed, 09 Apr 2025 19:39:57 -0000
From: "tip-bot2 for Peter Zijlstra" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Todd Brandt <todd.e.brandt@...el.com>,
 "Peter Zijlstra (Intel)" <peterz@...radead.org>,
 Len Brown <len.brown@...el.com>, x86@...nel.org, linux-kernel@...r.kernel.org
Subject: [tip: x86/urgent] x86/ibt: Fix hibernate

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

Commit-ID:     1fac13956e9877483ece9d090a62239cdfe9deb7
Gitweb:        https://git.kernel.org/tip/1fac13956e9877483ece9d090a62239cdfe9deb7
Author:        Peter Zijlstra <peterz@...radead.org>
AuthorDate:    Wed, 09 Apr 2025 21:16:01 +02:00
Committer:     Peter Zijlstra <peterz@...radead.org>
CommitterDate: Wed, 09 Apr 2025 21:29:11 +02:00

x86/ibt: Fix hibernate

Todd reported, and Len confirmed, that commit 582077c94052 ("x86/cfi:
Clean up linkage") broke S4 hiberate on a fair number of machines.

Turns out these machines trip #CP when trying to restore the image.

As it happens, the commit in question removes two ENDBR instructions
in the hibernate code, and clearly got it wrong.

Notably restore_image() does an indirect jump to
relocated_restore_code(), which is a relocated copy of
core_restore_code().

In turn, core_restore_code(), will at the end do an indirect jump to
restore_jump_address (r8), which is pointing at a relocated
restore_registers().

So both sites do indeed need to be ENDBR.

Fixes: 582077c94052 ("x86/cfi: Clean up linkage")
Reported-by: Todd Brandt <todd.e.brandt@...el.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
Tested-by: Todd Brandt <todd.e.brandt@...el.com>
Tested-by: Len Brown <len.brown@...el.com>
Link: https://bugzilla.kernel.org/show_bug.cgi?id=219998
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=219998
---
 arch/x86/power/hibernate_asm_64.S | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/power/hibernate_asm_64.S b/arch/x86/power/hibernate_asm_64.S
index 8c534c3..66f066b 100644
--- a/arch/x86/power/hibernate_asm_64.S
+++ b/arch/x86/power/hibernate_asm_64.S
@@ -26,7 +26,7 @@
 	 /* code below belongs to the image kernel */
 	.align PAGE_SIZE
 SYM_FUNC_START(restore_registers)
-	ANNOTATE_NOENDBR
+	ENDBR
 	/* go back to the original page tables */
 	movq    %r9, %cr3
 
@@ -120,7 +120,7 @@ SYM_FUNC_END(restore_image)
 
 	/* code below has been relocated to a safe page */
 SYM_FUNC_START(core_restore_code)
-	ANNOTATE_NOENDBR
+	ENDBR
 	/* switch to temporary page tables */
 	movq	%rax, %cr3
 	/* flush TLB */

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ