Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1300774

Re: [PATCH v6 2/4] x86: Cleanup and add a new exception class

From Borislav Petkov <bp@alien8.de>
Newsgroups linux.kernel
Subject Re: [PATCH v6 2/4] x86: Cleanup and add a new exception class
Date 2016-01-04 15:30 +0100
Message-ID <qNej0-4AS-15@gated-at.bofh.it> (permalink)
References <qN289-4OO-3@gated-at.bofh.it> <qN289-4OO-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, Dec 30, 2015 at 10:56:41AM -0800, Tony Luck wrote:
> Make per-class functions for exception table fixup. Add #defines
> and general prettiness to make it clear how all the parts tie
> together.
> 
> Add a new class that fills %rax with the fault number of the exception.
> 
> Signed-off-by: Tony Luck <tony.luck@intel.com>
> ---
>  arch/x86/include/asm/asm.h     | 24 ++++++++++-----
>  arch/x86/include/asm/uaccess.h | 17 ++++++++---
>  arch/x86/kernel/kprobes/core.c |  2 +-
>  arch/x86/kernel/traps.c        |  6 ++--
>  arch/x86/mm/extable.c          | 67 +++++++++++++++++++++++++++---------------
>  arch/x86/mm/fault.c            |  2 +-
>  6 files changed, 79 insertions(+), 39 deletions(-)
> 
> diff --git a/arch/x86/include/asm/asm.h b/arch/x86/include/asm/asm.h
> index b64121ffb2da..1888278d0559 100644
> --- a/arch/x86/include/asm/asm.h
> +++ b/arch/x86/include/asm/asm.h
> @@ -44,6 +44,7 @@
>  
>  /* Exception table entry */
>  
> +#define	_EXTABLE_BIAS	0x20000000
>  /*
>   * An exception table entry is 64 bits.  The first 32 bits are the offset
>   * from that entry to the potentially faulting instruction.  sortextable
> @@ -54,26 +55,35 @@
>   * address.  All of these are generated by relocations, so we can only
>   * rely on addition.  We therefore emit:
>   *
> - * (target - here) + (class) + 0x20000000
> + * (target - here) + (class) + _EXTABLE_BIAS
>   *
>   * This has the property that the two high bits are the class and the
>   * rest is easy to decode.
>   */
>  
> -/* There are two bits of extable entry class, added to a signed offset. */
> -#define _EXTABLE_CLASS_DEFAULT	0		/* standard uaccess fixup */
> -#define _EXTABLE_CLASS_EX	0x80000000	/* uaccess + set uaccess_err */
> +/*
> + * There are two bits of extable entry class giving four classes
> + */
> +#define EXTABLE_CLASS_DEFAULT	0	/* standard uaccess fixup */
> +#define EXTABLE_CLASS_FAULT	1	/* provide fault number as well as fixup */
> +#define EXTABLE_CLASS_EX	2	/* uaccess + set uaccess_err */
> +#define EXTABLE_CLASS_UNUSED	3	/* available for something else */
>  
>  /*
> - * The biases are the class constants + 0x20000000, as signed integers.
> + * The biases are the class constants + _EXTABLE_BIAS, as signed integers.
>   * This can't use ordinary arithmetic -- the assembler isn't that smart.
>   */
> -#define _EXTABLE_BIAS_DEFAULT	0x20000000
> -#define _EXTABLE_BIAS_EX	0x20000000 - 0x80000000
> +#define _EXTABLE_BIAS_DEFAULT	_EXTABLE_BIAS
> +#define _EXTABLE_BIAS_FAULT	_EXTABLE_BIAS + 0x40000000
> +#define _EXTABLE_BIAS_EX	_EXTABLE_BIAS - 0x80000000
> +#define _EXTABLE_BIAS_UNUSED	_EXTABLE_BIAS - 0x40000000
>  
>  #define _ASM_EXTABLE(from,to)						\
>  	_ASM_EXTABLE_CLASS(from, to, _EXTABLE_BIAS_DEFAULT)
>  
> +#define _ASM_EXTABLE_FAULT(from,to)					\
> +	_ASM_EXTABLE_CLASS(from, to, _EXTABLE_BIAS_FAULT)
> +
>  #define _ASM_EXTABLE_EX(from,to)					\
>  	_ASM_EXTABLE_CLASS(from, to, _EXTABLE_BIAS_EX)

So you're touching those again in patch 2. Why not add those defines to
patch 1 directly and diminish the churn?

-- 
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v6 2/4] x86: Cleanup and add a new exception class Tony Luck <tony.luck@intel.com> - 2016-01-04 02:30 +0100
  Re: [PATCH v6 2/4] x86: Cleanup and add a new exception class Borislav Petkov <bp@alien8.de> - 2016-01-04 15:30 +0100
    RE: [PATCH v6 2/4] x86: Cleanup and add a new exception class "Luck, Tony" <tony.luck@intel.com> - 2016-01-04 18:10 +0100
      Re: [PATCH v6 2/4] x86: Cleanup and add a new exception class Borislav Petkov <bp@alien8.de> - 2016-01-04 21:40 +0100
        Re: [PATCH v6 2/4] x86: Cleanup and add a new exception class Andy Lutomirski <luto@amacapital.net> - 2016-01-04 23:30 +0100

csiph-web