[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALCETrXtX5DL7aV8eEWQhQgWBHaS2CYay6DFR82XULSqXDYrxQ@mail.gmail.com>
Date: Sat, 28 Oct 2017 01:10:39 -0700
From: Andy Lutomirski <luto@...nel.org>
To: Dave Hansen <dave.hansen@...el.com>
Cc: Andy Lutomirski <luto@...nel.org>, X86 ML <x86@...nel.org>,
Borislav Petkov <bpetkov@...e.de>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Brian Gerst <brgerst@...il.com>,
Linus Torvalds <torvalds@...ux-foundation.org>
Subject: Re: [PATCH 14/18] x86/boot/64: Stop initializing TSS.sp0 at boot
On Fri, Oct 27, 2017 at 11:21 AM, Dave Hansen <dave.hansen@...el.com> wrote:
> On 10/26/2017 01:26 AM, Andy Lutomirski wrote:
>> --- a/arch/x86/kernel/process.c
>> +++ b/arch/x86/kernel/process.c
>> @@ -48,7 +48,8 @@
>> */
>> __visible DEFINE_PER_CPU_SHARED_ALIGNED(struct tss_struct, cpu_tss) = {
>> .x86_tss = {
>> - .sp0 = TOP_OF_INIT_STACK,
>> + /* Initialize sp0 to a value that is definitely invalid. */
>> + .sp0 = (1UL << (BITS_PER_LONG-1)) + 1,
>
> This confused me at first: How does this not poison the init task's stack?
>
> Should the comment maybe say something like:
>
> The hardware only uses .sp0 (or sp1 or sp2 for that matter) when
> doing ring transitions. Since the init task never runs anything
> other than ring 0, it has no need for a valid value here.
> Poison it.
>
> to clarify what's going on?
Done.
Powered by blists - more mailing lists