Re: [PATCH 17/18] x86/asm/64: Remove thread_struct::sp0

From: Borislav Petkov
Date: Wed Nov 01 2017 - 06:23:56 EST


On Thu, Oct 26, 2017 at 01:26:49AM -0700, Andy Lutomirski wrote:
> On x86_64, we can easily calculate sp0 when needed instead of
> storing it in thread_struct.
>
> On x86_32, a similar cleanup would be possible, but it would require
> cleaning up the vm86 code first, and that can wait for a later
> cleanup series.
>
> Signed-off-by: Andy Lutomirski <luto@xxxxxxxxxx>

...

> @@ -816,23 +825,6 @@ static inline void spin_lock_prefetch(const void *x)
> .addr_limit = KERNEL_DS, \
> }
>
> -/*
> - * TOP_OF_KERNEL_STACK_PADDING reserves 8 bytes on top of the ring0 stack.
> - * This is necessary to guarantee that the entire "struct pt_regs"
> - * is accessible even if the CPU haven't stored the SS/ESP registers
> - * on the stack (interrupt gate does not save these registers
> - * when switching to the same priv ring).
> - * Therefore beware: accessing the ss/esp fields of the
> - * "struct pt_regs" is possible, but they may contain the
> - * completely wrong values.
> - */

Why are we removing the explaination of TOP_OF_KERNEL_STACK_PADDING? Is
that going to change later?

--
Regards/Gruss,
Boris.

SUSE Linux GmbH, GF: Felix ImendÃrffer, Jane Smithard, Graham Norton, HRB 21284 (AG NÃrnberg)
--