Re: [PATCH v3 08/16] x86/extable: Add support for immediate form MSR instructions
From: Andrew Cooper
Date: Wed Feb 18 2026 - 10:49:06 EST
Ideally please CC xen-devel on all patches if you've CC'd some, or at
least CC me on all patches that you partially send to xen-devel. Having
only 4 patches of the series is very awkward to reply to.
> + /* + * To maintain consistency with existing RDMSR and WRMSR(NS)
> instructions, + * the register operand for immediate form MSR
> instructions is ALWAYS + * encoded as RAX in <asm/msr.h> for reading
> or writing the MSR value. + */ + u64 msr_val = regs->ax;
This is unsafe. It assumes that the only source of MSR $IMM
instructions anywhere are the wrappers.
While this might be the wish of the developers, that doesn't make it true.
You've already decoded the instruction and got the ModRM byte, so either
check that it really is encoding %rax, or select the proper GPR based on
ModRM.
~Andrew