This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] x86: Stop relying on magic jmp behavior for early_idt_handlers
- From: "H. Peter Anvin" <hpa at zytor dot com>
- To: Andy Lutomirski <luto at kernel dot org>, x86 at kernel dot org, "H.J. Lu" <hjl dot tools at gmail dot com>
- Cc: Borislav Petkov <bp at alien8 dot de>, Jan Beulich <JBeulich at suse dot com>, Binutils <binutils at sourceware dot org>, "linux-kernel at vger dot kernel dot org" <linux-kernel at vger dot kernel dot org>
- Date: Thu, 21 May 2015 17:32:29 -0700
- Subject: Re: [PATCH] x86: Stop relying on magic jmp behavior for early_idt_handlers
- Authentication-results: sourceware.org; auth=none
- References: <5bf75d3abce25ec615048075705f120b331aaf0b dot 1432253793 dot git dot luto at kernel dot 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>