1#if defined(__x86_64__) && defined(__linux__)
2
3#include "sanitizer_common/sanitizer_asm.h"
4
5.att_syntax
6
7.comm _ZN14__interception10real_vforkE,8,8
8.globl ASM_WRAPPER_NAME(vfork)
9ASM_TYPE_FUNCTION(ASM_WRAPPER_NAME(vfork))
10ASM_WRAPPER_NAME(vfork):
11 _CET_ENDBR
12 // Store return address in the spill area and tear down the stack frame.
13 push %rcx
14 call COMMON_INTERCEPTOR_SPILL_AREA
15 pop %rcx
16 pop %rdi
17 mov %rdi, (%rax)
18
19 call *_ZN14__interception10real_vforkE(%rip)
20
21 // Restore return address from the spill area.
22 push %rcx
23 push %rax
24 call COMMON_INTERCEPTOR_SPILL_AREA
25 mov (%rax), %rdx
26 mov %rdx, 8(%rsp)
27 mov (%rsp), %rax
28
29 // Call handle_vfork in the parent process (%rax != 0).
30 test %rax, %rax
31 je .L_exit
32
33 lea 16(%rsp), %rdi
34 call COMMON_INTERCEPTOR_HANDLE_VFORK@PLT
35
36.L_exit:
37 pop %rax
38 ret
39ASM_SIZE(ASM_WRAPPER_NAME(vfork))
40
41ASM_INTERCEPTOR_TRAMPOLINE(vfork)
42ASM_TRAMPOLINE_ALIAS(vfork, vfork)
43
44#endif
45