[PATCH] D20884: This patch attempts to primitive support for Win64 asan
Etienne Bergeron via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 2 05:06:43 PDT 2016
etienneb added inline comments.
================
Comment at: lib/interception/interception_win.cc:48
@@ +47,3 @@
+ // Jump to any address with 14 instruction bytes on x64.
+ // Ref: https://blogs.oracle.com/nike/entry/long_absolute_jumps_on_amd64
+ //
----------------
I'm used to look instructions encoding on this site: [[http://ref.x86asm.net/ | http://ref.x86asm.net/]]
```
0x68: PUSH imm16/32
0xC7: MOV r/m16/32/64 imm16/32
0x44: MOD: [sib]+disp8
0x24: SIB: ESP (no scale index)
0x04: offset (+4)
0xC3: RETN
```
It seems right to me.
================
Comment at: lib/interception/interception_win.cc:68
@@ +67,3 @@
+ *(unsigned int*)(jmp_from + 1) = to_addr_lower;
+ *(jmp_from + 5) = '\xc7';
+ *(jmp_from + 6) = '\x44';
----------------
*(jmp_from + 5) -> jmp_from[5]
and below
================
Comment at: lib/interception/interception_win.cc:80
@@ +79,3 @@
+ // FF 25 F8 FF FF FF = jmp [rip - 8]
+ *(jmp_from + 0) = 0xFF;
+ *(jmp_from + 1) = 0x25;
----------------
0xFF: JMP (opcode 4, encoded in 0x25)
0x25: [RIP/EIP]+disp32
... : offset -8
================
Comment at: lib/interception/interception_win.cc:82
@@ +81,3 @@
+ *(jmp_from + 1) = 0x25;
+ *(jmp_from + 2) = 0xF8;
+ *(jmp_from + 3) = 0xFF;
----------------
*jmp_from + x -> jmp_from[x]
================
Comment at: lib/interception/interception_win.cc:303
@@ +302,3 @@
+ // Need to mark extra 8 bytes because jmp [rip -8]
+ if (!VirtualProtect((void *)(old_bytes - 8), head + 8, PAGE_EXECUTE_READWRITE,
+ &old_prot))
----------------
indent is strange here.
================
Comment at: lib/sanitizer_common/sanitizer_platform_interceptors.h:88
@@ +87,3 @@
+// The function memchr() contains a jump in the first 6 bytes
+// that is problamatic to intercept correctly on Win64.
+// Disable memchr() interception for Win64 temporarily.
----------------
problamatic -> problematic
http://reviews.llvm.org/D20884
More information about the llvm-commits
mailing list