From: Borislav Petkov <bp@alien8.de>
To: Andy Lutomirski <luto@amacapital.net>
Cc: LKML <linux-kernel@vger.kernel.org>,
Andy Lutomirski <luto@kernel.org>,
"H. Peter Anvin" <hpa@zytor.com>, Ingo Molnar <mingo@kernel.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
Peter Zijlstra <peterz@infradead.org>,
Thomas Gleixner <tglx@linutronix.de>
Subject: [PATCH] x86/MSR: Chop off lower 32-bit value
Date: Sat, 31 Oct 2015 12:46:28 +0100 [thread overview]
Message-ID: <20151031114628.GA8763@pd.tnic> (raw)
In-Reply-To: <20151030193253.GK20952@pd.tnic>
On Fri, Oct 30, 2015 at 08:32:53PM +0100, Borislav Petkov wrote:
> On Fri, Oct 30, 2015 at 12:26:42PM -0700, Andy Lutomirski wrote:
> > Want to add that to the patch or make it another patch?
>
> Yeah, I'll make another one as it is going to document why we're
> explicitly ANDing with 0xffffffffull.
---
>From 89bfdb82447fd5c9f5bd9753040a639364b0c9d2 Mon Sep 17 00:00:00 2001
From: Borislav Petkov <bp@suse.de>
Date: Sat, 31 Oct 2015 12:40:48 +0100
Subject: [PATCH] x86/MSR: Chop off lower 32-bit value
sparse complains that the cast truncates the high bits. But here we
really do know what we're doing and we need the lower 32 bits only as
the @low argument. So make that explicit.
Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
---
arch/x86/include/asm/msr.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/include/asm/msr.h b/arch/x86/include/asm/msr.h
index 77d8b284e4a7..86133827c75c 100644
--- a/arch/x86/include/asm/msr.h
+++ b/arch/x86/include/asm/msr.h
@@ -190,7 +190,7 @@ static inline void wrmsr(unsigned msr, unsigned low, unsigned high)
static inline void wrmsrl(unsigned msr, u64 val)
{
- native_write_msr(msr, (u32)val, (u32)(val >> 32));
+ native_write_msr(msr, (u32)(val & 0xffffffffULL), (u32)(val >> 32));
}
/* wrmsr with exception handling */
--
2.3.5
--
Regards/Gruss,
Boris.
ECO tip #101: Trim your mails when you reply.
next prev parent reply other threads:[~2015-10-31 11:46 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-30 17:28 [RFC PATCH] x86/cpu: Fix MSR value truncation issue Borislav Petkov
2015-10-30 18:59 ` Andy Lutomirski
2015-10-30 19:23 ` Borislav Petkov
2015-10-30 19:26 ` Andy Lutomirski
2015-10-30 19:32 ` Borislav Petkov
2015-10-30 19:34 ` Andy Lutomirski
2015-10-31 11:46 ` Borislav Petkov [this message]
2015-11-11 12:31 ` Borislav Petkov
2015-11-11 15:50 ` Andy Lutomirski
2015-11-11 16:05 ` Borislav Petkov
2015-11-11 18:07 ` Brian Gerst
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20151031114628.GA8763@pd.tnic \
--to=bp@alien8.de \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=luto@kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.