Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1465657 > unrolled thread

[PATCH 5/8] x86/head: remove useless zeroed word

Started byJosh Poimboeuf <jpoimboe@redhat.com>
First post2016-08-18 21:40 +0200
Last post2016-08-23 01:10 +0200
Articles 6 — 5 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 5/8] x86/head: remove useless zeroed word Josh Poimboeuf <jpoimboe@redhat.com> - 2016-08-18 21:40 +0200
    Re: [PATCH 5/8] x86/head: remove useless zeroed word Andi Kleen <andi@firstfloor.org> - 2016-08-22 23:50 +0200
      Re: [PATCH 5/8] x86/head: remove useless zeroed word "H. Peter Anvin" <hpa@zytor.com> - 2016-08-23 00:30 +0200
        Re: [PATCH 5/8] x86/head: remove useless zeroed word Brian Gerst <brgerst@gmail.com> - 2016-08-23 01:00 +0200
          Re: [PATCH 5/8] x86/head: remove useless zeroed word "H. Peter Anvin" <hpa@zytor.com> - 2016-08-23 01:20 +0200
      Re: [PATCH 5/8] x86/head: remove useless zeroed word Linus Torvalds <torvalds@linux-foundation.org> - 2016-08-23 01:10 +0200

#1465657 — [PATCH 5/8] x86/head: remove useless zeroed word

FromJosh Poimboeuf <jpoimboe@redhat.com>
Date2016-08-18 21:40 +0200
Subject[PATCH 5/8] x86/head: remove useless zeroed word
Message-ID<s7Bkt-3Yh-7@gated-at.bofh.it>
This zeroed word has no apparent purpose, so remove it.

Brian Gerst says:

  "FYI the word used to be the SS segment selector for the LSS
  instruction, which isn't needed in 64-bit mode."

Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
---
 arch/x86/kernel/head_64.S | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S
index e048142..c98a559 100644
--- a/arch/x86/kernel/head_64.S
+++ b/arch/x86/kernel/head_64.S
@@ -328,7 +328,6 @@ ENDPROC(start_cpu0)
 	.quad	INIT_PER_CPU_VAR(irq_stack_union)
 	GLOBAL(initial_stack)
 	.quad  init_thread_union+THREAD_SIZE-8
-	.word  0
 	__FINITDATA
 
 bad_address:
-- 
2.7.4

[toc] | [next] | [standalone]


#1468081

FromAndi Kleen <andi@firstfloor.org>
Date2016-08-22 23:50 +0200
Message-ID<s95gt-3lP-11@gated-at.bofh.it>
In reply to#1465657
Josh Poimboeuf <jpoimboe@redhat.com> writes:

> This zeroed word has no apparent purpose, so remove it.
>
> Brian Gerst says:
>
>   "FYI the word used to be the SS segment selector for the LSS
>   instruction, which isn't needed in 64-bit mode."
>

Seems dangerous. It wouldn't surprise me if some CPUs or x86 emulations
load it anyways and trigger page faults if there is really nothing
there.

-Andi

[toc] | [prev] | [next] | [standalone]


#1468107

From"H. Peter Anvin" <hpa@zytor.com>
Date2016-08-23 00:30 +0200
Message-ID<s95Tb-3OC-13@gated-at.bofh.it>
In reply to#1468081
On August 22, 2016 2:48:46 PM PDT, Andi Kleen <andi@firstfloor.org> wrote:
>Josh Poimboeuf <jpoimboe@redhat.com> writes:
>
>> This zeroed word has no apparent purpose, so remove it.
>>
>> Brian Gerst says:
>>
>>   "FYI the word used to be the SS segment selector for the LSS
>>   instruction, which isn't needed in 64-bit mode."
>>
>
>Seems dangerous. It wouldn't surprise me if some CPUs or x86 emulations
>load it anyways and trigger page faults if there is really nothing
>there.
>
>-Andi

Yes, seems pointlessly risky.
-- 
Sent from my Android device with K-9 Mail. Please excuse brevity and formatting.

[toc] | [prev] | [next] | [standalone]


#1468119

FromBrian Gerst <brgerst@gmail.com>
Date2016-08-23 01:00 +0200
Message-ID<s96md-40p-3@gated-at.bofh.it>
In reply to#1468107
On Mon, Aug 22, 2016 at 6:23 PM, H. Peter Anvin <hpa@zytor.com> wrote:
> On August 22, 2016 2:48:46 PM PDT, Andi Kleen <andi@firstfloor.org> wrote:
>>Josh Poimboeuf <jpoimboe@redhat.com> writes:
>>
>>> This zeroed word has no apparent purpose, so remove it.
>>>
>>> Brian Gerst says:
>>>
>>>   "FYI the word used to be the SS segment selector for the LSS
>>>   instruction, which isn't needed in 64-bit mode."
>>>
>>
>>Seems dangerous. It wouldn't surprise me if some CPUs or x86 emulations
>>load it anyways and trigger page faults if there is really nothing
>>there.
>>
>>-Andi
>
> Yes, seems pointlessly risky.

It was added in commit 9cf4f298e29abba25c16679fe7be70898223167e,
copied from 32-bit but never used.  It doesn't look like we ever used
LSS on 64-bit.

--
Brian Gerst

[toc] | [prev] | [next] | [standalone]


#1468143

From"H. Peter Anvin" <hpa@zytor.com>
Date2016-08-23 01:20 +0200
Message-ID<s96Fz-4mL-5@gated-at.bofh.it>
In reply to#1468119
On August 22, 2016 3:47:48 PM PDT, Brian Gerst <brgerst@gmail.com> wrote:
>On Mon, Aug 22, 2016 at 6:23 PM, H. Peter Anvin <hpa@zytor.com> wrote:
>> On August 22, 2016 2:48:46 PM PDT, Andi Kleen <andi@firstfloor.org>
>wrote:
>>>Josh Poimboeuf <jpoimboe@redhat.com> writes:
>>>
>>>> This zeroed word has no apparent purpose, so remove it.
>>>>
>>>> Brian Gerst says:
>>>>
>>>>   "FYI the word used to be the SS segment selector for the LSS
>>>>   instruction, which isn't needed in 64-bit mode."
>>>>
>>>
>>>Seems dangerous. It wouldn't surprise me if some CPUs or x86
>emulations
>>>load it anyways and trigger page faults if there is really nothing
>>>there.
>>>
>>>-Andi
>>
>> Yes, seems pointlessly risky.
>
>It was added in commit 9cf4f298e29abba25c16679fe7be70898223167e,
>copied from 32-bit but never used.  It doesn't look like we ever used
>LSS on 64-bit.
>
>--
>Brian Gerst

Ah, ok.  Wasn't in front of a computer.
-- 
Sent from my Android device with K-9 Mail. Please excuse brevity and formatting.

[toc] | [prev] | [next] | [standalone]


#1468140

FromLinus Torvalds <torvalds@linux-foundation.org>
Date2016-08-23 01:10 +0200
Message-ID<s96vU-4jp-15@gated-at.bofh.it>
In reply to#1468081
On Mon, Aug 22, 2016 at 2:48 PM, Andi Kleen <andi@firstfloor.org> wrote:
>
> Seems dangerous. It wouldn't surprise me if some CPUs or x86 emulations
> load it anyways and trigger page faults if there is really nothing
> there.

Don't be silly, Andi and Peter.

We don't actually *use* lss any more. Not even on 32-bit. The zero is
never accessed. And on x86-64 we never did, obviously.

On 32-bit that zero doesn't even exist any more. On x86-64, it was
never even used at all. On x86-32, it was removed in commit
11d4c3f9b671 ("x86-32: Make sure the stack is set up before we use
it"), when the code stopped doing lss.

On x86-64, it has never made sense. It was added in commit
9cf4f298e29a ("x86: use stack_start in x86_64") to match x86-32 at the
time, but it didn't actually make sense even then, because x86-64
didn't use lss. 32-bit did, but 64-but just did a simple

    movq stack_start(%rip),%rsp

like a good user should.

             Linus

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web