[PATCH] x86/extable: Adjust UD1 encoding in stub_selftest()

Andrew Cooper posted 1 patch 3 days, 12 hours ago
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/20260409083938.137871-1-andrew.cooper3@citrix.com
xen/arch/x86/extable.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] x86/extable: Adjust UD1 encoding in stub_selftest()
Posted by Andrew Cooper 3 days, 12 hours ago
The 0x90 is a ModRM byte and technically needs following by an imm32.

Switch to 0xc0 which encodes two %eax operands, and is a complete instruction.

No practical change.

Reported-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <jbeulich@suse.com>
CC: Roger Pau Monné <roger.pau@citrix.com>
CC: Teddy Astie <teddy.astie@vates.tech>
---
 xen/arch/x86/extable.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/extable.c b/xen/arch/x86/extable.c
index a9b6c6b904f5..e1c8c9fab811 100644
--- a/xen/arch/x86/extable.c
+++ b/xen/arch/x86/extable.c
@@ -157,7 +157,7 @@ int __init cf_check stub_selftest(void)
         union stub_exception_token res;
     } tests[] __initconst = {
 #define endbr64 0xf3, 0x0f, 0x1e, 0xfa
-        { .opc = { endbr64, 0x0f, 0xb9, 0x90 }, /* ud1 */
+        { .opc = { endbr64, 0x0f, 0xb9, 0xc0 }, /* ud1 %eax,%eax */
           .res.fields.trapnr = X86_EXC_UD },
         { .opc = { endbr64, 0x90, 0x02, 0x00 }, /* nop; add (%rax),%al */
           .rax = 0x0123456789abcdef,
-- 
2.39.5


Re: [PATCH] x86/extable: Adjust UD1 encoding in stub_selftest()
Posted by Jan Beulich 3 days, 10 hours ago
On 09.04.2026 10:39, Andrew Cooper wrote:
> The 0x90 is a ModRM byte and technically needs following by an imm32.
> 
> Switch to 0xc0 which encodes two %eax operands, and is a complete instruction.
> 
> No practical change.
> 
> Reported-by: Jan Beulich <jbeulich@suse.com>
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>

Reviewed-by: Jan Beulich <jbeulich@suse.com>