Skip to contentSkip to conversation

x86/retpoline: Remove the esp/rsp thunk

PATCH In review Waiman Long 3 participants 3 messages Jan 22, 2018 – Jan 24, 2018 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/retpoline: Remove the esp/rsp thunk

It doesn't make sense to have an indirect call thunk with esp/rsp as retpoline code won't work correctly with the stack pointer register. Removing it will help compiler writers to catch error in case such a thunk call is emitted incorrectly.

Fixes 76b043848fd2 ("x86/retpoline: Add initial retpoline support")
---
 arch/x86/include/asm/asm-prototypes.h | 1 -
 arch/x86/lib/retpoline.S              | 1 -
 2 files changed, 2 deletions(-)
arch/x86/include/asm/asm-prototypes.h +0 -1
index 0927cdc..1908214 100644
@@ -38,5 +38,4 @@
 INDIRECT_THUNK(si)
 INDIRECT_THUNK(di)
 INDIRECT_THUNK(bp)
-INDIRECT_THUNK(sp)
 #endif /* CONFIG_RETPOLINE */
arch/x86/lib/retpoline.S +0 -1
index dfb2ba9..c909961 100644
@@ -36,7 +36,6 @@ GENERATE_THUNK(_ASM_DX)
 GENERATE_THUNK(_ASM_SI)
 GENERATE_THUNK(_ASM_DI)
 GENERATE_THUNK(_ASM_BP)
-GENERATE_THUNK(_ASM_SP)
 #ifdef CONFIG_64BIT
 GENERATE_THUNK(r8)
 GENERATE_THUNK(r9)
Signature · 1 line
1.8.3.1
Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · Waiman Long

It doesn't make sense to have an indirect call thunk with esp/rsp as retpoline code won't work correctly with the stack pointer register. Removing it will help compiler writers to catch error in case such a thunk call is emitted incorrectly.

Fixes 76b043848fd2 ("x86/retpoline: Add initial retpoline support")

I spotted that and *almost* removed it a couple of times in other refactoring, but after abandoning those I forgot to come back and do just this. Thanks.

#2 lore raw
In reply to Waiman Long
x86/retpoline: Remove the esp/rsp thunk
Commit-ID:  1df37383a8aeabb9b418698f0bcdffea01f4b1b2
Gitweb:     https://git.kernel.org/tip/1df37383a8aeabb9b418698f0bcdffea01f4b1b2
Author:     Waiman Long <[email protected]>
AuthorDate: Mon, 22 Jan 2018 17:09:34 -0500
Committer:  Thomas Gleixner <[email protected]>
CommitDate: Wed, 24 Jan 2018 12:31:55 +0100

x86/retpoline: Remove the esp/rsp thunk

It doesn't make sense to have an indirect call thunk with esp/rsp as retpoline code won't work correctly with the stack pointer register. Removing it will help compiler writers to catch error in case such a thunk call is emitted incorrectly.

Fixes 76b043848fd2 ("x86/retpoline: Add initial retpoline support")
Cc Tom Lendacky <[email protected]>
Cc Kees Cook <[email protected]>
Cc Andi Kleen <[email protected]>
Cc Tim Chen <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Linus Torvalds <[email protected]>
Cc Jiri Kosina <[email protected]>
Cc Andy Lutomirski <[email protected]>
Cc Dave Hansen <[email protected]>
Cc Josh Poimboeuf <[email protected]>
Cc Arjan van de Ven <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Cc Paul Turner <[email protected]>
---
 arch/x86/include/asm/asm-prototypes.h | 1 -
 arch/x86/lib/retpoline.S              | 1 -
 2 files changed, 2 deletions(-)
arch/x86/include/asm/asm-prototypes.h +0 -1
index 0927cdc..1908214 100644
@@ -38,5 +38,4 @@ INDIRECT_THUNK(dx)
 INDIRECT_THUNK(si)
 INDIRECT_THUNK(di)
 INDIRECT_THUNK(bp)
-INDIRECT_THUNK(sp)
 #endif /* CONFIG_RETPOLINE */
arch/x86/lib/retpoline.S +0 -1
index dfb2ba9..c909961 100644
@@ -36,7 +36,6 @@ GENERATE_THUNK(_ASM_DX)
 GENERATE_THUNK(_ASM_SI)
 GENERATE_THUNK(_ASM_DI)
 GENERATE_THUNK(_ASM_BP)
-GENERATE_THUNK(_ASM_SP)
 #ifdef CONFIG_64BIT
 GENERATE_THUNK(r8)
 GENERATE_THUNK(r9)