All of lore.kernel.org
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>, X86 ML <x86@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Tom Lendacky <thomas.lendacky@amd.com>
Subject: Re: [RFC PATCH] x86: Make sure verify_cpu has a good stack
Date: Thu, 3 Mar 2016 12:22:06 -0800	[thread overview]
Message-ID: <56D89CEE.9070406@zytor.com> (raw)
In-Reply-To: <20160303162952.GE24621@pd.tnic>

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

  reply	other threads:[~2016-03-03 20:22 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-02 11:20 [RFC PATCH] x86: Make sure verify_cpu has a good stack Borislav Petkov
2016-03-02 15:55 ` Mika Penttilä
2016-03-02 16:15   ` Borislav Petkov
2016-03-02 16:38     ` Mika Penttilä
2016-03-02 16:55       ` Borislav Petkov
2016-03-02 17:44         ` Mika Penttilä
2016-03-02 16:22 ` Brian Gerst
2016-03-02 16:25   ` Borislav Petkov
2016-03-02 17:53     ` H. Peter Anvin
2016-03-02 18:15       ` Borislav Petkov
2016-03-02 18:25         ` H. Peter Anvin
2016-03-02 18:39         ` H. Peter Anvin
2016-03-02 19:50           ` Borislav Petkov
2016-03-02 20:46             ` Borislav Petkov
2016-03-02 21:35             ` H. Peter Anvin
2016-03-02 21:46               ` Borislav Petkov
2016-03-02 21:54                 ` H. Peter Anvin
2016-03-02 22:09                   ` Borislav Petkov
2016-03-02 22:11                     ` H. Peter Anvin
2016-03-02 22:28                       ` Borislav Petkov
2016-03-02 22:32                         ` H. Peter Anvin
2016-03-02 22:40                           ` Borislav Petkov
2016-03-03  0:13                           ` Yinghai Lu
2016-03-03  1:00                             ` Yinghai Lu
2016-03-03  2:50                               ` Yinghai Lu
2016-03-03 12:28                           ` Borislav Petkov
2016-03-03 15:26                             ` H. Peter Anvin
2016-03-03 16:29                               ` Borislav Petkov
2016-03-03 20:22                                 ` H. Peter Anvin [this message]
2016-03-03 20:54                                   ` Borislav Petkov
2016-03-03 21:22                                     ` H. Peter Anvin
2016-03-03 21:38                                       ` Borislav Petkov
2016-03-04  1:18                             ` Yinghai Lu
2016-03-04  2:25                             ` Yinghai Lu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56D89CEE.9070406@zytor.com \
    --to=hpa@zytor.com \
    --cc=bp@alien8.de \
    --cc=brgerst@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=thomas.lendacky@amd.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.