x86/extable: Extend extable functionality
authorPeter Zijlstra <peterz@infradead.org>
Wed, 10 Nov 2021 10:01:09 +0000 (11:01 +0100)
committerPeter Zijlstra <peterz@infradead.org>
Sat, 11 Dec 2021 08:09:46 +0000 (09:09 +0100)
commit4b5305decc8436bfe363d1c1773e8fa1c828b14d
tree44e15c683e80d0043af001e0dec2425575cc09b9
parentaa93e2ad7464ffb90155a5ffdde963816f86d5dc
x86/extable: Extend extable functionality

In order to remove further .fixup usage, extend the extable
infrastructure to take additional information from the extable entry
sites.

Specifically add _ASM_EXTABLE_TYPE_REG() and EX_TYPE_IMM_REG that
extend the existing _ASM_EXTABLE_TYPE() by taking an additional
register argument and encoding that and an s16 immediate into the
existing s32 type field. This limits the actual types to the first
byte, 255 seem plenty.

Also add a few flags into the type word, specifically CLEAR_AX and
CLEAR_DX which clear the return and extended return register.

Notes:
 - due to the % in our register names it's hard to make it more
   generally usable as arm64 did.
 - the s16 is far larger than used in these patches, future extentions
   can easily shrink this to get more bits.
 - without the bitfield fix this will not compile, because: 0xFF > -1
   and we can't even extract the TYPE field.

[nathanchance: Build fix for clang-lto builds:
 https://lkml.kernel.org/r/20211210234953.3420108-1-nathan@kernel.org
]

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Josh Poimboeuf <jpoimboe@redhat.com>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Tested-by: Nick Desaulniers <ndesaulniers@google.com>
Link: https://lore.kernel.org/r/20211110101325.303890153@infradead.org
arch/x86/include/asm/asm.h
arch/x86/include/asm/extable.h
arch/x86/include/asm/extable_fixup_types.h
arch/x86/include/asm/insn-eval.h
arch/x86/lib/insn-eval.c
arch/x86/mm/extable.c
arch/x86/net/bpf_jit_comp.c