Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1356515

[PATCH v4 5/5] x86/msr: Set the return value to zero when native_rdmsr_safe fails

From Andy Lutomirski <luto@kernel.org>
Newsgroups linux.kernel
Subject [PATCH v4 5/5] x86/msr: Set the return value to zero when native_rdmsr_safe fails
Date 2016-03-12 19:20 +0100
Message-ID <rbWiS-1L9-13@gated-at.bofh.it> (permalink)
References <rbW9c-1Em-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


This will cause unchecked native_rdmsr_safe failures to return
deterministic results.

Signed-off-by: Andy Lutomirski <luto@kernel.org>
---
 arch/x86/include/asm/msr.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/arch/x86/include/asm/msr.h b/arch/x86/include/asm/msr.h
index 13da359881d7..e97e79f8a22b 100644
--- a/arch/x86/include/asm/msr.h
+++ b/arch/x86/include/asm/msr.h
@@ -109,7 +109,10 @@ static inline unsigned long long native_read_msr_safe(unsigned int msr,
 	asm volatile("2: rdmsr ; xor %[err],%[err]\n"
 		     "1:\n\t"
 		     ".section .fixup,\"ax\"\n\t"
-		     "3:  mov %[fault],%[err] ; jmp 1b\n\t"
+		     "3: mov %[fault],%[err]\n\t"
+		     "xorl %%eax, %%eax\n\t"
+		     "xorl %%edx, %%edx\n\t"
+		     "jmp 1b\n\t"
 		     ".previous\n\t"
 		     _ASM_EXTABLE(2b, 3b)
 		     : [err] "=r" (*err), EAX_EDX_RET(val, low, high)
-- 
2.5.0

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v4 0/5] [PATCH v3 0/5] Improve non-"safe" MSR access failure handling Andy Lutomirski <luto@kernel.org> - 2016-03-12 19:10 +0100
  [PATCH v4 1/5] x86/paravirt: Add _safe to the read_msr and write_msr PV hooks Andy Lutomirski <luto@kernel.org> - 2016-03-12 19:20 +0100
    Re: [PATCH v4 1/5] x86/paravirt: Add _safe to the read_msr and  write_msr PV hooks Borislav Petkov <bp@alien8.de> - 2016-03-14 13:00 +0100
      Re: [PATCH v4 1/5] x86/paravirt: Add _safe to the read_msr and  write_msr PV hooks Andy Lutomirski <luto@amacapital.net> - 2016-03-14 18:10 +0100
  [PATCH v4 5/5] x86/msr: Set the return value to zero when native_rdmsr_safe fails Andy Lutomirski <luto@kernel.org> - 2016-03-12 19:20 +0100
  Re: [Xen-devel] [PATCH v4 0/5] [PATCH v3 0/5] Improve non-"safe" MSR  access failure handling Boris Ostrovsky <boris.ostrovsky@oracle.com> - 2016-03-14 15:40 +0100

csiph-web