[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <551E7EE0.5010901@redhat.com>
Date: Fri, 03 Apr 2015 13:52:00 +0200
From: Denys Vlasenko <dvlasenk@...hat.com>
To: Borislav Petkov <bp@...en8.de>, Ingo Molnar <mingo@...nel.org>
CC: LKML <linux-kernel@...r.kernel.org>,
Andy Lutomirski <luto@...capital.net>,
Alexei Starovoitov <ast@...mgrid.com>,
Frederic Weisbecker <fweisbec@...il.com>,
"H. Peter Anvin" <hpa@...or.com>,
Kees Cook <keescook@...omium.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Oleg Nesterov <oleg@...hat.com>,
Steven Rostedt <rostedt@...dmis.org>,
Will Drewry <wad@...omium.org>
Subject: Re: [PATCH] x86/asm/entry/64: Fix MSR_IA32_SYSENTER_CS MSR value
On 04/03/2015 01:20 PM, Borislav Petkov wrote:
> On Fri, Apr 03, 2015 at 11:42:10AM +0200, Borislav Petkov wrote:
>> From: Borislav Petkov <bp@...e.de>
>>
>> Commit
>>
>> d56fe4bf5f3c ("x86/asm/entry/64: Always set up SYSENTER MSRs")
>>
>> missed to add "ULL" to the 0 and wrmsrl_safe() complains:
>>
>> arch/x86/kernel/cpu/common.c: In function ‘syscall_init’:
>> arch/x86/kernel/cpu/common.c:1226:2: warning: right shift count >= width of type
>> wrmsrl_safe(MSR_IA32_SYSENTER_CS, 0);
>>
>> Fix it.
>>
>> Signed-off-by: Borislav Petkov <bp@...e.de>
>> Cc: Denys Vlasenko <dvlasenk@...hat.com>
>> Cc: Andy Lutomirski <luto@...capital.net>
>> Cc: Alexei Starovoitov <ast@...mgrid.com>
>> Cc: Frederic Weisbecker <fweisbec@...il.com>
>> Cc: H. Peter Anvin <hpa@...or.com>
>> Cc: Kees Cook <keescook@...omium.org>
>> Cc: Linus Torvalds <torvalds@...ux-foundation.org>
>> Cc: Oleg Nesterov <oleg@...hat.com>
>> Cc: Steven Rostedt <rostedt@...dmis.org>
>> Cc: Will Drewry <wad@...omium.org>
>> Cc: Ingo Molnar <mingo@...nel.org>
>> ---
>> arch/x86/kernel/cpu/common.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
>> index bb6633a87a19..2c249b57e4b5 100644
>> --- a/arch/x86/kernel/cpu/common.c
>> +++ b/arch/x86/kernel/cpu/common.c
>> @@ -1223,7 +1223,7 @@ void syscall_init(void)
>> wrmsrl_safe(MSR_IA32_SYSENTER_EIP, (u64)ia32_sysenter_target);
>> #else
>> wrmsrl(MSR_CSTAR, ignore_sysret);
>> - wrmsrl_safe(MSR_IA32_SYSENTER_CS, 0);
>> + wrmsrl_safe(MSR_IA32_SYSENTER_CS, 0ULL);
>
> Btw, we probably should define an invalid segment
>
> #define GDT_ENTRY_INVALID_SEGMENT 0ULL
>
> and use that value instead of the naked 0.
Why? Segment selectors aren't "long long", they are in fact "short"
(16-bit ints).
The "ULL" is used here in wrmsrl not because it's a segment,
but because wrmsrl expects a u64 parameter.
We can probably add a cast in its definition...
--
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