From: Jim Mattson Date: Sun, 13 May 2018 21:33:57 +0000 (-0400) Subject: x86/cpu: Make alternative_msr_write work for 32-bit code X-Git-Tag: Ubuntu-4.13.0-45.50~25 X-Git-Url: https://git.proxmox.com/?p=mirror_ubuntu-artful-kernel.git;a=commitdiff_plain;h=9fb38c68eefba014374acdc9fb3f171b69559cfa x86/cpu: Make alternative_msr_write work for 32-bit code Cast val and (val >> 32) to (u32), so that they fit in a general-purpose register in both 32-bit and 64-bit code. [ tglx: Made it u32 instead of uintptr_t ] Fixes: c65732e4f721 ("x86/cpu: Restore CPUID_8000_0008_EBX reload") Signed-off-by: Jim Mattson Signed-off-by: Konrad Rzeszutek Wilk Signed-off-by: Thomas Gleixner Acked-by: Linus Torvalds CVE-2018-3639 (x86) (cherry-picked from commit 5f2b745f5e1304f438f9b2cd03ebc8120b6e0d3b) Signed-off-by: Stefan Bader --- diff --git a/arch/x86/include/asm/nospec-branch.h b/arch/x86/include/asm/nospec-branch.h index 5ce68e3e5bc9..ef7d5bf5d079 100644 --- a/arch/x86/include/asm/nospec-branch.h +++ b/arch/x86/include/asm/nospec-branch.h @@ -189,8 +189,8 @@ void alternative_msr_write(unsigned int msr, u64 val, unsigned int feature) { asm volatile(ALTERNATIVE("", "wrmsr", %c[feature]) : : "c" (msr), - "a" (val), - "d" (val >> 32), + "a" ((u32)val), + "d" ((u32)(val >> 32)), [feature] "i" (feature) : "memory"); }