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


Groups > linux.kernel > #1228979

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

From Andy Lutomirski <luto@kernel.org>
Newsgroups linux.kernel
Subject [PATCH v2 2/2] x86/msr: Set the return value to zero when native_rdmsr_safe fails
Date 2015-09-21 02:10 +0200
Message-ID <qaWQ9-6YN-15@gated-at.bofh.it> (permalink)
References <qaWQ9-6YN-3@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 77d8b284e4a7..9eda52205d42 100644
--- a/arch/x86/include/asm/msr.h
+++ b/arch/x86/include/asm/msr.h
@@ -73,7 +73,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.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

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


Thread

[PATCH v2 0/2] x86/msr: MSR access failure changes Andy Lutomirski <luto@kernel.org> - 2015-09-21 02:10 +0200
  [PATCH v2 1/2] x86/msr: Carry on after a non-"safe" MSR access fails without !panic_on_oops Andy Lutomirski <luto@kernel.org> - 2015-09-21 02:10 +0200
    Re: [PATCH v2 1/2] x86/msr: Carry on after a non-"safe" MSR access  fails without !panic_on_oops Linus Torvalds <torvalds@linux-foundation.org> - 2015-09-21 02:20 +0200
      Re: [PATCH v2 1/2] x86/msr: Carry on after a non-"safe" MSR access  fails without !panic_on_oops Andy Lutomirski <luto@amacapital.net> - 2015-09-21 03:20 +0200
        Re: [PATCH v2 1/2] x86/msr: Carry on after a non-"safe" MSR access  fails without !panic_on_oops Ingo Molnar <mingo@kernel.org> - 2015-09-21 10:50 +0200
          Re: [PATCH v2 1/2] x86/msr: Carry on after a non-"safe" MSR access  fails without !panic_on_oops Paolo Bonzini <pbonzini@redhat.com> - 2015-09-21 14:30 +0200
          Re: [PATCH v2 1/2] x86/msr: Carry on after a non-"safe" MSR access  fails without !panic_on_oops Linus Torvalds <torvalds@linux-foundation.org> - 2015-09-21 18:40 +0200
            Re: [PATCH v2 1/2] x86/msr: Carry on after a non-"safe" MSR access  fails without !panic_on_oops Arjan van de Ven <arjan@linux.intel.com> - 2015-09-21 19:10 +0200
              Re: [PATCH v2 1/2] x86/msr: Carry on after a non-"safe" MSR access  fails without !panic_on_oops Linus Torvalds <torvalds@linux-foundation.org> - 2015-09-21 19:30 +0200
              Re: [PATCH v2 1/2] x86/msr: Carry on after a non-"safe" MSR access  fails without !panic_on_oops Andy Lutomirski <luto@amacapital.net> - 2015-09-21 19:50 +0200
                Re: [PATCH v2 1/2] x86/msr: Carry on after a non-"safe" MSR access  fails without !panic_on_oops Paolo Bonzini <pbonzini@redhat.com> - 2015-09-22 10:20 +0200
            Re: [PATCH v2 1/2] x86/msr: Carry on after a non-"safe" MSR access  fails without !panic_on_oops Andy Lutomirski <luto@amacapital.net> - 2015-09-21 20:20 +0200
              Re: [PATCH v2 1/2] x86/msr: Carry on after a non-"safe" MSR access  fails without !panic_on_oops Borislav Petkov <bp@alien8.de> - 2015-09-21 20:40 +0200
              Re: [PATCH v2 1/2] x86/msr: Carry on after a non-"safe" MSR access  fails without !panic_on_oops Linus Torvalds <torvalds@linux-foundation.org> - 2015-09-21 20:50 +0200
            Re: [PATCH v2 1/2] x86/msr: Carry on after a non-"safe" MSR access  fails without !panic_on_oops Ingo Molnar <mingo@kernel.org> - 2015-09-22 09:20 +0200
  [PATCH v2 2/2] x86/msr: Set the return value to zero when native_rdmsr_safe fails Andy Lutomirski <luto@kernel.org> - 2015-09-21 02:10 +0200

csiph-web