Re: [PATCH 3/8] x86/mce: Provide method to find out the type of exception handle

Borislav Petkov
2020-09-15T09:11:45Z

On Tue, Sep 08, 2020 at 10:55:14AM -0700, Tony Luck wrote:
> Avoid a proliferation of ex_has_*_handler() functions by having just
> one function that returns the type of the handler (if any).
>
> Signed-off-by: Tony Luck <tony.luck@intel.com>
> ---
> arch/x86/include/asm/extable.h | 9 ++++++++-
> arch/x86/kernel/cpu/mce/severity.c | 5 ++++-
> arch/x86/mm/extable.c | 12 ++++++++----
> 3 files changed, 20 insertions(+), 6 deletions(-)
>
> diff --git a/arch/x86/include/asm/extable.h b/arch/x86/include/asm/extable.h
> index d8c2198d543b..56ec02e024ad 100644
> --- a/arch/x86/include/asm/extable.h
> +++ b/arch/x86/include/asm/extable.h
> @@ -29,10 +29,17 @@ struct pt_regs;
> (b)->handler = (tmp).handler - (delta); \
> } while (0)
>
> +enum handler_type {
> + HANDLER_NONE,
> + HANDLER_FAULT,
> + HANDLER_UACCESS,
> + HANDLER_OTHER

EX_HANDLER_* I guess - HANDLER is too generic.

> @@ -125,17 +125,21 @@ __visible bool ex_handler_clear_fs(const struct exception_table_entry *fixup,
> }
> EXPORT_SYMBOL(ex_handler_clear_fs);
>
> -__visible bool ex_has_fault_handler(unsigned long ip)
> +__visible enum handler_type ex_fault_handler_type(unsigned long ip)

Why __visible?

--
Regards/Gruss,
Boris.