Re: [tip: x86/asm] x86/vdso: Fix output operand size of RDPID

From: Uros Bizjak
Date: Wed Aug 27 2025 - 04:29:58 EST


On Wed, Aug 27, 2025 at 10:19 AM Borislav Petkov <bp@xxxxxxxxx> wrote:
>
> On Wed, Aug 27, 2025 at 09:53:17AM +0200, Uros Bizjak wrote:
> > The 1/2 patch is intended to be backportable
>
> Is it fixing an actual, real life bug?

No, because ".byte 0xf3,0x0f,0xc7,0xf8" encodes "RDPID %rax" on 64-bit
targets and we are only interested in the lower 32-bits anyway.

So, the change only matters on the 64-bit target when mnemonic is used
(there is no RDPID %eax" instruction), but the patch should not be
backported for the reasons outlined in my previous message. OTOH, "LSL
%eax,%eax" zero-extends to the full 64-bit register width on 64-bit
targets even when 32-bit register form is used.

Thanks,
Uros.