File: sanitizer_common_interceptors_vfork_arm.inc.S

package info (click to toggle)
llvm-toolchain-20 1%3A20.1.6-1~exp1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 2,111,304 kB
  • sloc: cpp: 7,438,677; ansic: 1,393,822; asm: 1,012,926; python: 241,650; f90: 86,635; objc: 75,479; lisp: 42,144; pascal: 17,286; sh: 10,027; ml: 5,082; perl: 4,730; awk: 3,523; makefile: 3,349; javascript: 2,251; xml: 892; fortran: 672
file content (49 lines) | stat: -rw-r--r-- 1,289 bytes parent folder | download | duplicates (16)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#if defined(__arm__) && defined(__linux__)

#include "sanitizer_common/sanitizer_asm.h"

ASM_HIDDEN(COMMON_INTERCEPTOR_SPILL_AREA)

.comm _ZN14__interception10real_vforkE,4,4
.globl ASM_WRAPPER_NAME(vfork)
ASM_TYPE_FUNCTION(ASM_WRAPPER_NAME(vfork))
ASM_WRAPPER_NAME(vfork):
        // Save LR in the off-stack spill area.
        push    {r4, lr}
        bl      COMMON_INTERCEPTOR_SPILL_AREA
        pop     {r4, lr}
        str     lr, [r0]

        // Call real vfork. This may return twice. User code that runs between the first and the second return
        // may clobber the stack frame of the interceptor; that's why it does not have a frame.
        ldr     r0, .LCPI0_0
.LPC0_0:
        ldr     r0, [pc, r0]
        mov     lr, pc
        bx      r0

        push    {r0, r4}
        cmp     r0, #0
        beq     .L_exit

        // r0 != 0 => parent process. Clear stack shadow.
        add     r0, sp, #8
        bl      COMMON_INTERCEPTOR_HANDLE_VFORK

.L_exit:
        // Restore LR.
        bl      COMMON_INTERCEPTOR_SPILL_AREA
        ldr     lr, [r0]
        pop     {r0, r4}

        mov     pc, lr

.LCPI0_0:
        .long   _ZN14__interception10real_vforkE - (.LPC0_0+8)

ASM_SIZE(vfork)

ASM_INTERCEPTOR_TRAMPOLINE(vfork)
ASM_TRAMPOLINE_ALIAS(vfork, vfork)

#endif