Skip to content

Commit 1fac139

Browse files
author
Peter Zijlstra
committed
x86/ibt: Fix hibernate
Todd reported, and Len confirmed, that commit 582077c ("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: 582077c ("x86/cfi: Clean up linkage") Reported-by: Todd Brandt <todd.e.brandt@intel.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Tested-by: Todd Brandt <todd.e.brandt@intel.com> Tested-by: Len Brown <len.brown@intel.com> Link: https://bugzilla.kernel.org/show_bug.cgi?id=219998 Closes: https://bugzilla.kernel.org/show_bug.cgi?id=219998
1 parent f0df00e commit 1fac139

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

arch/x86/power/hibernate_asm_64.S

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
/* code below belongs to the image kernel */
2727
.align PAGE_SIZE
2828
SYM_FUNC_START(restore_registers)
29-
ANNOTATE_NOENDBR
29+
ENDBR
3030
/* go back to the original page tables */
3131
movq %r9, %cr3
3232

@@ -120,7 +120,7 @@ SYM_FUNC_END(restore_image)
120120

121121
/* code below has been relocated to a safe page */
122122
SYM_FUNC_START(core_restore_code)
123-
ANNOTATE_NOENDBR
123+
ENDBR
124124
/* switch to temporary page tables */
125125
movq %rax, %cr3
126126
/* flush TLB */

0 commit comments

Comments
 (0)