]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_vfork_x86_64.inc.S
Fix a memory leak in if_delgroups() introduced in r334118.
[FreeBSD/FreeBSD.git] / contrib / compiler-rt / lib / sanitizer_common / sanitizer_common_interceptors_vfork_x86_64.inc.S
1 #if defined(__x86_64__) && defined(__linux__)
2
3 #include "sanitizer_common/sanitizer_asm.h"
4
5 .comm _ZN14__interception10real_vforkE,8,8
6 .globl ASM_WRAPPER_NAME(vfork)
7 ASM_TYPE_FUNCTION(ASM_WRAPPER_NAME(vfork))
8 ASM_WRAPPER_NAME(vfork):
9         // Store return address in the spill area and tear down the stack frame.
10         push    %rcx
11         call    COMMON_INTERCEPTOR_SPILL_AREA
12         pop     %rcx
13         pop     %rdi
14         mov     %rdi, (%rax)
15
16         call    *_ZN14__interception10real_vforkE(%rip)
17
18         // Restore return address from the spill area.
19         push    %rcx
20         push    %rax
21         call    COMMON_INTERCEPTOR_SPILL_AREA
22         mov     (%rax), %rdx
23         mov     %rdx, 8(%rsp)
24         mov     (%rsp), %rax
25
26         // Call handle_vfork in the parent process (%rax != 0).
27         test    %rax, %rax
28         je      .L_exit
29
30         lea     16(%rsp), %rdi
31         call    COMMON_INTERCEPTOR_HANDLE_VFORK@PLT
32
33 .L_exit:
34         pop     %rax
35         ret
36 ASM_SIZE(vfork)
37
38 .weak vfork
39 .set vfork, ASM_WRAPPER_NAME(vfork)
40
41 #endif