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

From: Luck, Tony
Date: Tue Sep 15 2020 - 14:59:06 EST


On Tue, Sep 15, 2020 at 11:11:32AM +0200, Borislav Petkov wrote:
> 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@xxxxxxxxx>
> > ---
> > 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.

Yup. Will change.

> > @@ -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?

I didn't look that hard at this. Just kept the same because the
function I was replacing was also __visible.

But it looks like this commit:

80a3e3949b8f ("x86/extable: Mark exception handler functions visible")

shouldn't have touched this function. This one is only called from C code,
not from assembler like the others.

Will drop the __visible (and note in commit comment)

Thanks

-Tony