Re: [RFC PATCH] x86/cpu: Fix MSR value truncation issue

Andy Lutomirski
2015-10-30T19:00:06Z

On Fri, Oct 30, 2015 at 10:28 AM, Borislav Petkov <bp@alien8.de> wrote:
> From: Borislav Petkov <bp@suse.de>
>
> So sparse rightfully complains that the u64 MSR value we're writing into
> the STAR MSR, i.e. 0xc0000081, is being truncated:
>
> ./arch/x86/include/asm/msr.h:193:36: warning: cast truncates bits from constant value (23001000000000 becomes 0)

Is this with or without:

commit 47edb65178cb7056c2eea0b6c41a7d8c84547192
Author: Andy Lutomirski <luto@kernel.org>
Date: Thu Jul 23 12:14:40 2015 -0700

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

If that patch is applied, then I think that gcc is just being dumb and
that we should consider tweaking wrmsrl to avoid generating the
warning. Maybe change (u32)val to (u32)(val & 0xffffffffull)?

I don't see why we should uglify the caller when the problem is some
combination of gcc and the wrmsrl implementation.

--Andy