lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-cf991de2f614f454b3cb2a300c06ecdf69f3a70d@git.kernel.org>
Date:	Fri, 5 Jun 2015 01:42:56 -0700
From:	tip-bot for Andy Lutomirski <tipbot@...or.com>
To:	linux-tip-commits@...r.kernel.org
Cc:	peterz@...radead.org, torvalds@...ux-foundation.org,
	luto@...nel.org, linux-kernel@...r.kernel.org, hpa@...or.com,
	tglx@...utronix.de, mingo@...nel.org, akpm@...ux-foundation.org
Subject: [tip:x86/asm] x86/asm/msr: Make wrmsrl_safe() a function

Commit-ID:  cf991de2f614f454b3cb2a300c06ecdf69f3a70d
Gitweb:     http://git.kernel.org/tip/cf991de2f614f454b3cb2a300c06ecdf69f3a70d
Author:     Andy Lutomirski <luto@...nel.org>
AuthorDate: Thu, 4 Jun 2015 17:13:44 -0700
Committer:  Ingo Molnar <mingo@...nel.org>
CommitDate: Fri, 5 Jun 2015 09:41:22 +0200

x86/asm/msr: Make wrmsrl_safe() a function

The wrmsrl_safe macro performs invalid shifts if the value
argument is 32 bits.  This makes it unnecessarily awkward to
write code that puts an unsigned long into an MSR.

Convert it to a real inline function.

For inspiration, see:

  7c74d5b7b7b6 ("x86/asm/entry/64: Fix MSR_IA32_SYSENTER_CS MSR value").

Signed-off-by: Andy Lutomirski <luto@...nel.org>
Cc: <linux-kernel@...r.kernel.org>
Cc: Andrew Morton <akpm@...ux-foundation.org>
Cc: H. Peter Anvin <hpa@...or.com>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Thomas Gleixner <tglx@...utronix.de>
[ Applied small improvements. ]
Signed-off-by: Ingo Molnar <mingo@...nel.org>
---
 arch/x86/include/asm/msr.h | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/arch/x86/include/asm/msr.h b/arch/x86/include/asm/msr.h
index de36f22..13bf576 100644
--- a/arch/x86/include/asm/msr.h
+++ b/arch/x86/include/asm/msr.h
@@ -205,8 +205,13 @@ do {                                                            \
 
 #endif	/* !CONFIG_PARAVIRT */
 
-#define wrmsrl_safe(msr, val) wrmsr_safe((msr), (u32)(val),		\
-					     (u32)((val) >> 32))
+/*
+ * 64-bit version of wrmsr_safe():
+ */
+static inline int wrmsrl_safe(u32 msr, u64 val)
+{
+	return wrmsr_safe(msr, (u32)val,  (u32)(val >> 32));
+}
 
 #define write_tsc(low, high) wrmsr(MSR_IA32_TSC, (low), (high))
 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ