relinker: x86 decoder ignores the address of MOV moffs (A0-A3), desynchronising the scanner #1167
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by oguzhanozfe on 2026-10-07T16:01:43Z.
X64InstructionDecoder::Decodehas no case for one-byte opcodesA0-A3(MOV AL/eAX/rAX, moffsandMOV moffs, AL/eAX/rAX). These have no ModRM byte. In 64-bit mode they carry an 8-byte absolute address, or a 4-byte address with a 0x67 prefix (Intel SDM Vol. 2A §2.2.1.4, "Direct Memory-Offset MOVs"; the MOV table listsREX.W + A1 MOV RAX, moffs64). The decoder adds nothing for the address and returns only the prefix and opcode length. The 0x67 prefix is accepted but not recorded.DecodeA1+ 8-byte address48 A1+ 8-byte address48 A3+ 8-byte address64 48 A1+ 8-byte address67 A1+ 4-byte addressInstructionScannersweeps linearly, so it then decodes the address bytes as instructions. For48 A1 66 0F 78 C0 08 00 00 00 C3(movabs rax, [0x8C0780F66]; ret), it returns[0,+2] [2,+6] [8,+2] [10,+1]. The[2,+6]entry is an EXTRQ located inside the address. With--to-intel, that EXTRQ would be rewritten, which corrupts the address.Reproduced by compiling
X64InstructionDecoder.cppandInstructionScanner.cppfrom main (def81199) with MSVC 14.50.