Re: [PATCH v4 06/10] x86/traps: Decode LOCK Jcc.d8 #UD
From: Kees Cook
Date: Tue Feb 25 2025 - 13:36:07 EST
On Mon, Feb 24, 2025 at 09:46:12PM +0000, David Laight wrote:
> On Mon, 24 Feb 2025 13:37:09 +0100
> Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
>
> > Because overlapping code sequences are all the rage.
> >
> > Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
> > Reviewed-by: Kees Cook <kees@xxxxxxxxxx>
> > ---
> > arch/x86/include/asm/bug.h | 2 ++
> > arch/x86/kernel/traps.c | 26 +++++++++++++++++++++++---
> > 2 files changed, 25 insertions(+), 3 deletions(-)
> >
> > --- a/arch/x86/include/asm/bug.h
> > +++ b/arch/x86/include/asm/bug.h
> > @@ -17,6 +17,7 @@
> > * In clang we have UD1s reporting UBSAN failures on X86, 64 and 32bit.
> > */
> > #define INSN_ASOP 0x67
> > +#define INSN_LOCK 0xf0
> > #define OPCODE_ESCAPE 0x0f
> > #define SECOND_BYTE_OPCODE_UD1 0xb9
> > #define SECOND_BYTE_OPCODE_UD2 0x0b
> > @@ -26,6 +27,7 @@
> > #define BUG_UD1 0xfffd
> > #define BUG_UD1_UBSAN 0xfffc
> > #define BUG_EA 0xffea
> > +#define BUG_LOCK 0xfff0
> >
> > #ifdef CONFIG_GENERIC_BUG
> >
> > --- a/arch/x86/kernel/traps.c
> > +++ b/arch/x86/kernel/traps.c
> > @@ -97,6 +97,7 @@ __always_inline int is_valid_bugaddr(uns
> > * If it's a UD1, further decode to determine its use:
> > *
> > * FineIBT: ea (bad)
> > + * FineIBT: 0f 75 f9 lock jne . - 6
> ^^ nibble swapped
Oh, good catch!
--
Kees Cook