diff options
author | Tony Luck <tony.luck@intel.com> | 2020-10-06 14:09:06 -0700 |
---|---|---|
committer | Borislav Petkov <bp@suse.de> | 2020-10-07 11:08:59 +0200 |
commit | a05d54c41ecfa1a322b229b4e5ce50c157284f74 (patch) | |
tree | c5c0852daccf221f05a801f167e3850f4efb7754 /arch/x86/mm | |
parent | 41ce0564bfe2e129d56730418d8c0a9f9f2d31b5 (diff) | |
download | lwn-a05d54c41ecfa1a322b229b4e5ce50c157284f74.tar.gz lwn-a05d54c41ecfa1a322b229b4e5ce50c157284f74.zip |
x86/mce: Provide method to find out the type of an exception handler
Avoid a proliferation of ex_has_*_handler() functions by having just
one function that returns the type of the handler (if any).
Drop the __visible attribute for this function. It is not called
from assembler so the attribute is not necessary.
Signed-off-by: Tony Luck <tony.luck@intel.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: https://lkml.kernel.org/r/20201006210910.21062-3-tony.luck@intel.com
Diffstat (limited to 'arch/x86/mm')
-rw-r--r-- | arch/x86/mm/extable.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/arch/x86/mm/extable.c b/arch/x86/mm/extable.c index 1d6cb07f4f86..de43525df69b 100644 --- a/arch/x86/mm/extable.c +++ b/arch/x86/mm/extable.c @@ -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) +enum handler_type ex_get_fault_handler_type(unsigned long ip) { const struct exception_table_entry *e; ex_handler_t handler; e = search_exception_tables(ip); if (!e) - return false; + return EX_HANDLER_NONE; handler = ex_fixup_handler(e); - - return handler == ex_handler_fault; + if (handler == ex_handler_fault) + return EX_HANDLER_FAULT; + else if (handler == ex_handler_uaccess) + return EX_HANDLER_UACCESS; + else + return EX_HANDLER_OTHER; } int fixup_exception(struct pt_regs *regs, int trapnr, unsigned long error_code, |