lkml.org 
[lkml]   [2016]   [Mar]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [RFC PATCH] x86: Make sure verify_cpu has a good stack
From
Date
On 03/03/16 08:29, Borislav Petkov wrote:
> On Thu, Mar 03, 2016 at 07:26:06AM -0800, H. Peter Anvin wrote:
>> Why -8?
>
> GLOBAL(stack_start)
> .quad init_thread_union+THREAD_SIZE-8
> ^^^
>
> But I don't see why it needed the -8 then. It came with a conglomerate
> dump in 2002:
>
> commit af53c7a2c81399b805b6d4eff887401a5e50feef
> Author: Andi Kleen <ak@muc.de>
> Date: Fri Apr 19 20:23:17 2002 -0700
>
> [PATCH] x86-64 architecture specific sync for 2.5.8
>
>
> - /* Setup the first kernel stack (this instruction is modified by smpboot) */
> - .byte 0x48, 0xb8 /* movq *init_rsp,%rax */
> -init_rsp:
> - .quad init_thread_union+THREAD_SIZE
> - movq %rax, %rsp
>
> ...
>
> -
> - /* SMP bootup changes this */
> + /* SMP bootup changes these two */
> .globl initial_code
> initial_code:
> .quad x86_64_start_kernel
> + .globl init_rsp
> +init_rsp:
> + .quad init_thread_union+THREAD_SIZE-8
> +
> ---
>
> But since we decrement first and then copy to stack ptr when we push, I
> don't see why we need the -8.
>
> Do you have a better clue?
>

The only thing I can think of is that the -8 creates a null pointer that
terminates a stack trace.

-hpa

\
 
 \ /
  Last update: 2016-03-03 22:01    [W:0.916 / U:0.060 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site