[compiler-rt] r355125 - [sanitizer] Fix vfork interceptor on i386 w/ dynamic runtime.
Evgeniy Stepanov via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 28 11:21:26 PST 2019
Author: eugenis
Date: Thu Feb 28 11:21:25 2019
New Revision: 355125
URL: http://llvm.org/viewvc/llvm-project?rev=355125&view=rev
Log:
[sanitizer] Fix vfork interceptor on i386 w/ dynamic runtime.
PLT calls on i386 expect GOT base address in %ebx.
This call does not need to go through PLT strictly speaking, but I'd
rather avoid future surprises and implement the most general case.
Modified:
compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors_vfork_i386.inc.S
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors_vfork_i386.inc.S
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors_vfork_i386.inc.S?rev=355125&r1=355124&r2=355125&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors_vfork_i386.inc.S (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors_vfork_i386.inc.S Thu Feb 28 11:21:25 2019
@@ -20,15 +20,28 @@ ASM_WRAPPER_NAME(vfork):
add $_GLOBAL_OFFSET_TABLE_+(.Ltmp0-.L0$pb), %eax
call *_ZN14__interception10real_vforkE at GOTOFF(%eax)
- // Restore return address from the spill area.
+ // Restore the stack frame.
+ // 12(%esp) return address
+ // 8(%esp) spill %ebx
+ // 4(%esp) spill REAL(vfork) return value
+ // (%esp) call frame (arg0) for __*_handle_vfork
sub $16, %esp
+ mov %ebx, 8(%esp)
mov %eax, 4(%esp)
+
+ // Form GOT address in %ebx.
+ call .L1$pb
+.L1$pb:
+ pop %ebx
+.Ltmp1:
+ add $_GLOBAL_OFFSET_TABLE_+(.Ltmp1-.L1$pb), %ebx
+
+ // Restore original return address.
call COMMON_INTERCEPTOR_SPILL_AREA
mov (%eax), %ecx
mov %ecx, 12(%esp)
mov 4(%esp), %eax
-
// Call handle_vfork in the parent process (%rax != 0).
test %eax, %eax
je .L_exit
@@ -39,6 +52,7 @@ ASM_WRAPPER_NAME(vfork):
.L_exit:
mov 4(%esp), %eax
+ mov 8(%esp), %ebx
add $12, %esp
ret
ASM_SIZE(vfork)
More information about the llvm-commits
mailing list