linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Denys Vlasenko <dvlasenk@redhat.com>
To: Borislav Petkov <bp@alien8.de>, Ingo Molnar <mingo@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Andy Lutomirski <luto@amacapital.net>,
	Alexei Starovoitov <ast@plumgrid.com>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Kees Cook <keescook@chromium.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Oleg Nesterov <oleg@redhat.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Will Drewry <wad@chromium.org>
Subject: Re: [PATCH] x86/asm/entry/64: Fix MSR_IA32_SYSENTER_CS MSR value
Date: Fri, 03 Apr 2015 13:52:00 +0200	[thread overview]
Message-ID: <551E7EE0.5010901@redhat.com> (raw)
In-Reply-To: <20150403112027.GA3418@pd.tnic>

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@suse.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@suse.de>
>> Cc: Denys Vlasenko <dvlasenk@redhat.com>
>> Cc: Andy Lutomirski <luto@amacapital.net>
>> Cc: Alexei Starovoitov <ast@plumgrid.com>
>> Cc: Frederic Weisbecker <fweisbec@gmail.com>
>> Cc: H. Peter Anvin <hpa@zytor.com>
>> Cc: Kees Cook <keescook@chromium.org>
>> Cc: Linus Torvalds <torvalds@linux-foundation.org>
>> Cc: Oleg Nesterov <oleg@redhat.com>
>> Cc: Steven Rostedt <rostedt@goodmis.org>
>> Cc: Will Drewry <wad@chromium.org>
>> Cc: Ingo Molnar <mingo@kernel.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...



  reply	other threads:[~2015-04-03 11:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-03  9:42 [PATCH] x86/asm/entry/64: Fix MSR_IA32_SYSENTER_CS MSR value Borislav Petkov
2015-04-03 11:20 ` Borislav Petkov
2015-04-03 11:52   ` Denys Vlasenko [this message]
2015-04-03 12:05     ` Borislav Petkov
2015-04-03 12:25       ` [PATCH] x86/asm/entry/64: Use a define for an invalid segment Borislav Petkov
2015-04-03 14:07 ` [tip:x86/asm] x86/asm/entry/64: Fix MSR_IA32_SYSENTER_CS MSR value tip-bot for Borislav Petkov
2015-04-03 14:07 ` [tip:x86/asm] x86/asm/entry/64: Use a define for an invalid segment selector tip-bot for Borislav Petkov

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=551E7EE0.5010901@redhat.com \
    --to=dvlasenk@redhat.com \
    --cc=ast@plumgrid.com \
    --cc=bp@alien8.de \
    --cc=fweisbec@gmail.com \
    --cc=hpa@zytor.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=mingo@kernel.org \
    --cc=oleg@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=torvalds@linux-foundation.org \
    --cc=wad@chromium.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).