On 2025-09-09 at 11:03:57 +0200, Peter Zijlstra wrote: >On Tue, Sep 09, 2025 at 10:49:53AM +0200, Maciej Wieczor-Retman wrote: > >> >Specifically, look at arch/x86/kernel/traps.h:decode_bug(), UBSan uses >> >UD1 /0, I would suggest KASAN to use UD1 /1. >> >> Okay, that sounds great, I'll change it in this patchset and write the LLVM >> patch later. > >Thanks! Also note how UBSAN encodes an immediate in the UD1 instruction. >You can use that same to pass through your meta-data thing. > >MOD=1 gives you a single byte immediate, and MOD=2 gives you 4 bytes, >eg: > > 0f b9 49 xx -- ud1 xx(%rcx), %rcx > >When poking at LLVM, try and convince the thing to not emit that >'operand address size prefix' byte like UBSAN does, that's just a waste >of bytes. Thanks, that's good tip :) -- Kind regards Maciej Wieczór-Retman