• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#include <sys/linux-syscalls.h>
2
3#ifndef __NR_vfork
4#define __NR_vfork  190
5#endif
6
7
8    .text
9    .type vfork, @function
10    .globl vfork
11    .align 4
12
13/* Get rid of the stack modifications (popl/ret) after vfork() success.
14 * vfork is VERY sneaky. One has to be very careful about what can be done
15 * between a successful vfork and a a subsequent execve()
16 */
17
18vfork:
19    /* grab the return address */
20    popl    %ecx
21    movl    $__NR_vfork, %eax
22    int     $0x80
23    cmpl    $-129, %eax
24    jb      1f
25    negl    %eax
26    pushl   %eax
27    call    __set_errno
28    orl     $-1, %eax
291:
30    jmp     *%ecx
31