[compiler-rt] [win/asan] GetInstructionSize: Add some more instructions. (PR #219038)

Bernhard Übelacker via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 27 04:21:56 PDT 2026


================
@@ -869,8 +870,14 @@ const struct InstructionSizeData {
     { 3, {0x8D, 0x45, 0x72}, 0, "8D 45 XX : lea eax, [ebp + XX]"},
     { 3, {0xc2, 0x71, 0x72}, 0, "C2 XX XX : ret XX (needed for registering weak functions)"},
     { 4, {0x66, 0x0f, 0xef, 0xc0}, 0, "66 0f ef c0 : pxor xmm0, xmm0"},
+    { 4, {0x66, 0x83, 0x3A, 0x73}, 0, "66 83 3A XX : cmp word ptr [rdx], XX"},
+    { 4, {0x8D, 0x44, 0x24, 0x73}, 0, "8D 44 24 XX : lea eax, [esp + XX]"},
     { 4, {0x8D, 0x4C, 0x24, 0x73}, 0, "8D 4C 24 XX : lea ecx, [esp + XX]"},
+    { 4, {0xF3, 0x0F, 0x1E, 0xFA}, 0, "F3 0F 1E FA : endbr64"},
+    { 4, {0xF3, 0x0F, 0x1E, 0xFB}, 0, "F3 0F 1E FB : endbr32"},
     { 4, {0xFF, 0x74, 0x24, 0x73}, 0, "FF 74 24 XX : push qword ptr [rsp + XX]"},
+    { 5, {0x0F, 0xB6, 0x44, 0x24, 0x74}, 0, "0F B6 44 24 XX : movzx eax, byte ptr [esp + XX]"},
+    { 5, {0x0F, 0xB6, 0x4C, 0x24, 0x74}, 0, "0F B6 4C 24 XX : movzx ecx, byte ptr [esp + XX]"},
----------------
bernhardu wrote:

Hello @hartwork, thanks for taking a look. The last byte in this instruction is a variable value therefore the `XX` in `0F B6 44 24 XX`. In the implementation only four bytes are matched, while the instruction has fife bytes.

See below examples, they give the same instruction, but the offset is different.

```bash
$ I="0F B6 44 24 08"
$ echo "$I" | sed 's/ /\n/g' | awk '{ printf "0x%s, ", $1 }' | llvm-mc-19 --disassemble --show-encoding --output-asm-variant=1 --arch=x86-64 | grep -v ".text"
        movzx   eax, byte ptr [rsp + 8]         # encoding: [0x0f,0xb6,0x44,0x24,0x08]
$ I="0F B6 44 24 74"
$ echo "$I" | sed 's/ /\n/g' | awk '{ printf "0x%s, ", $1 }' | llvm-mc-19 --disassemble --show-encoding --output-asm-variant=1 --arch=x86-64 | grep -v ".text"
        movzx   eax, byte ptr [rsp + 116]       # encoding: [0x0f,0xb6,0x44,0x24,0x74]
```

In the test I needed to use some value, therefore I used for such variable bytes a value of 0x70 plus the position, therefore 0x74.


https://github.com/llvm/llvm-project/pull/219038


More information about the llvm-commits mailing list