public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: Andy Lutomirski <luto@kernel.org>,
	x86@kernel.org, "H.J. Lu" <hjl.tools@gmail.com>
Cc: Borislav Petkov <bp@alien8.de>, Jan Beulich <JBeulich@suse.com>,
	Binutils <binutils@sourceware.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] x86: Stop relying on magic jmp behavior for early_idt_handlers
Date: Thu, 21 May 2015 17:32:29 -0700	[thread overview]
Message-ID: <555E791D.1000700@zytor.com> (raw)
In-Reply-To: <5bf75d3abce25ec615048075705f120b331aaf0b.1432253793.git.luto@kernel.org>

On 05/21/2015 05:17 PM, Andy Lutomirski wrote:
> 
> diff --git a/arch/x86/include/asm/segment.h b/arch/x86/include/asm/segment.h
> index 5a9856eb12ba..4bbe0eb24d7e 100644
> --- a/arch/x86/include/asm/segment.h
> +++ b/arch/x86/include/asm/segment.h
> @@ -231,12 +231,21 @@
>  #define TLS_SIZE			(GDT_ENTRY_TLS_ENTRIES* 8)
>  
>  #ifdef __KERNEL__
> -#ifndef __ASSEMBLY__
>  
> -extern const char early_idt_handlers[NUM_EXCEPTION_VECTORS][2+2+5];
> +/*
> + * early_idt_handlers is an array of entry points.  For simplicity, it's
> + * a real array.  We allocate nine bytes for each entry: two one-byte
> + * push instructions and a five-byte jump in the worst case.
> + */
> +#define EARLY_IDT_HANDLER_STRIDE 9
> +#ifndef __ASSEMBLY__
> +extern const char early_idt_handlers[NUM_EXCEPTION_VECTORS][EARLY_IDT_HANDLER_STRIDE];
>  #ifdef CONFIG_TRACING
>  # define trace_early_idt_handlers early_idt_handlers
>  #endif
> +#endif
> +
> +#ifndef __ASSEMBLY__
>  

Please get rid of the unnecessary #ifndef/#endif pair.

> +/* Build the early_idt_handlers array */
>  	__INIT
>  	.globl early_idt_handlers

Let's use ENTRY(early_idt_handlers) for consistency.

Otherwise it looks good.  I like the use of .fill better than moving .,
it seems more robust to me.

Conditionally-Acked-by: H. Peter Anvin <hpa@linux.intel.com>


  reply	other threads:[~2015-05-22  0:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-22  0:17 [PATCH] x86: Stop relying on magic jmp behavior for early_idt_handlers Andy Lutomirski
2015-05-22  0:32 ` H. Peter Anvin [this message]
2015-05-22  0:38   ` Andy Lutomirski
2015-05-22  0:50     ` H. Peter Anvin

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=555E791D.1000700@zytor.com \
    --to=hpa@zytor.com \
    --cc=JBeulich@suse.com \
    --cc=binutils@sourceware.org \
    --cc=bp@alien8.de \
    --cc=hjl.tools@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox