x86: Drop RDPID macro to discourage use of RDPID in the kernel
PATCH 1/1 x86: Drop RDPID macro to discourage use of RDPID in the kernel
Drop the GAS-compatible RDPID macro as RDPID shouldn't be used in the kernel, excepting the vDSO, which handcodes RDPID in inline asm. RDPID is unsafe in the kernel because KVM loads guest's TSC_AUX on VM-entry and may not restore the host's value until the CPU returns to userspace.
See commit 6a3ea3e68b8a ("x86/entry/64: Do not use RDPID in paranoid entry to accomodate KVM") for details.
--- arch/x86/include/asm/inst.h | 15 --------------- 1 file changed, 15 deletions(-)
arch/x86/include/asm/inst.h +0 -15
@@ -143,21 +143,6 @@ .macro MODRM mod opd1 opd2 .byte \mod | (\opd1 & 7) | ((\opd2 & 7) << 3) .endm - -.macro RDPID opd - REG_TYPE rdpid_opd_type \opd - .if rdpid_opd_type == REG_TYPE_R64 - R64_NUM rdpid_opd \opd - .else - R32_NUM rdpid_opd \opd - .endif - .byte 0xf3 - .if rdpid_opd > 7 - PFX_REX rdpid_opd 0 - .endif - .byte 0x0f, 0xc7 - MODRM 0xc0 rdpid_opd 0x7 -.endm#endif #endif
Signature · 1 line
2.28.0
Quoted 7 lines · Sean Christopherson
Drop the GAS-compatible RDPID macro as RDPID shouldn't be used in the kernel, excepting the vDSO, which handcodes RDPID in inline asm. RDPID is unsafe in the kernel because KVM loads guest's
TSC_AUXon VM-entry and may not restore the host's value until the CPU returns to userspace.See commit
6a3ea3e68b8a("x86/entry/64: Do not use RDPID in paranoid entry to accomodate KVM") for details.
Well, remove it because there is no (current) user, OK. But if there's a compelling kernel side use for it, KVM can go suck rocks.
[tip: x86/cleanups] x86/asm: Drop unused RDPID macro
In reply to Sean ChristophersonThe following commit has been merged into the x86/cleanups branch of tip:
The following commit has been merged into the x86/cleanups branch of tip:
Commit-ID: 8539d3f06710a9e91b9968fa736549d7c6b44206 Gitweb: https://git.kernel.org/tip/8539d3f06710a9e91b9968fa736549d7c6b44206 Author: Sean Christopherson <[email protected]> AuthorDate: Tue, 27 Oct 2020 14:45:32 -07:00 Committer: Borislav Petkov <[email protected]> CommitterDate: Thu, 26 Nov 2020 12:58:56 +01:00
x86/asm: Drop unused RDPID macro
Drop the GAS-compatible RDPID macro. RDPID is unsafe in the kernel because KVM loads guest's TSC_AUX on VM-entry and may not restore the host's value until the CPU returns to userspace.
See
6a3ea3e68b8a ("x86/entry/64: Do not use RDPID in paranoid entry to accomodate KVM")
for details.
It can always be resurrected from git history, if needed.
[ bp: Massage commit message. ]
--- arch/x86/include/asm/inst.h | 15 --------------- 1 file changed, 15 deletions(-)
arch/x86/include/asm/inst.h +0 -15
@@ -143,21 +143,6 @@ .macro MODRM mod opd1 opd2 .byte \mod | (\opd1 & 7) | ((\opd2 & 7) << 3) .endm - -.macro RDPID opd - REG_TYPE rdpid_opd_type \opd - .if rdpid_opd_type == REG_TYPE_R64 - R64_NUM rdpid_opd \opd - .else - R32_NUM rdpid_opd \opd - .endif - .byte 0xf3 - .if rdpid_opd > 7 - PFX_REX rdpid_opd 0 - .endif - .byte 0x0f, 0xc7 - MODRM 0xc0 rdpid_opd 0x7 -.endm#endif #endif