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

From: Andy Lutomirski
Date: Fri Oct 30 2015 - 15:00:11 EST


On Fri, Oct 30, 2015 at 10:28 AM, Borislav Petkov <bp@xxxxxxxxx> wrote:
> From: Borislav Petkov <bp@xxxxxxx>
>
> 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@xxxxxxxxxx>
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/