lkml.org 
[lkml]   [2017]   [Oct]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 14/18] x86/boot/64: Stop initializing TSS.sp0 at boot
From
Date
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?

\
 
 \ /
  Last update: 2017-10-28 20:19    [W:0.593 / U:0.020 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site