• T
    x86/extable: Rework the exception table mechanics · 46d28947
    Thomas Gleixner 提交于
    The exception table entries contain the instruction address, the fixup
    address and the handler address. All addresses are relative. Storing the
    handler address has a few downsides:
    
     1) Most handlers need to be exported
    
     2) Handlers can be defined everywhere and there is no overview about the
        handler types
    
     3) MCE needs to check the handler type to decide whether an in kernel #MC
        can be recovered. The functionality of the handler itself is not in any
        way special, but for these checks there need to be separate functions
        which in the worst case have to be exported.
    
        Some of these 'recoverable' exception fixups are pretty obscure and
        just reuse some other handler to spare code. That obfuscates e.g. the
        #MC safe copy functions. Cleaning that up would require more handlers
        and exports
    
    Rework the exception fixup mechanics by storing a fixup type number instead
    of the handler address and invoke the proper handler for each fixup
    type. Also teach the extable sort to leave the type field alone.
    
    This makes most handlers static except for special cases like the MCE
    MSR fixup and the BPF fixup. This allows to add more types for cleaning up
    the obscure places without adding more handler code and exports.
    
    There is a marginal code size reduction for a production config and it
    removes _eight_ exported symbols.
    Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
    Signed-off-by: NBorislav Petkov <bp@suse.de>
    Acked-by: NAlexei Starovoitov <ast@kernel.org>
    Link: https://lkml.kernel.org/r/20210908132525.211958725@linutronix.de
    46d28947
internal.h 14.5 KB