Messages in this thread | | | From | Andy Lutomirski <> | Date | Sat, 28 Oct 2017 01:10:39 -0700 | 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@intel.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.
| |