9912f3 __clone(): properly handle four-argument (vfork mode) invocations.

Authored and Committed by midipix 5 years ago
    __clone(): properly handle four-argument (vfork mode) invocations.
    
        
file modified
+14 -0
src/thread/nt32/clone.c CHANGED
@@ -1,4 +1,7 @@
1
+ #define _GNU_SOURCE
2
+
1
3
#include <syscall.h>
4
+ #include <sched.h>
2
5
3
6
/* take advantage of i686 vararg abi */
4
7
#define __clone ____clone
@@ -56,6 +59,17 @@ int __clone(
56
59
57
60
pfn_clone = (__sys_clone *)(__syscall_vtbl[SYS_clone]);
58
61
62
+ if (flags == CLONE_VM|CLONE_VFORK|SIGCHLD) {
63
+ regs.sbase = 0;
64
+ regs.slimit = 0;
65
+ regs.sbottom = 0;
66
+
67
+ return (int)pfn_clone(
68
+ flags,
69
+ child_stack,
70
+ 0,0,&regs);
71
+ }
72
+
59
73
pthread = (pthread_t)pthread_self_addr;
60
74
regs.sbase = (unsigned long)pthread->stack;
61
75
regs.slimit = regs.sbase - pthread->stack_size;
file modified
+14 -0
src/thread/nt64/clone.c CHANGED
@@ -1,4 +1,7 @@
1
+ #define _GNU_SOURCE
2
+
1
3
#include <syscall.h>
4
+ #include <sched.h>
2
5
3
6
/* take advantage of winnt's x64 vararg abi */
4
7
#define __clone ____clone
@@ -60,6 +63,17 @@ hidden int __clone(
60
63
61
64
pfn_clone = (__sys_clone *)(__syscall_vtbl[SYS_clone]);
62
65
66
+ if (flags == CLONE_VM|CLONE_VFORK|SIGCHLD) {
67
+ regs.sbase = 0;
68
+ regs.slimit = 0;
69
+ regs.sbottom = 0;
70
+
71
+ return (int)pfn_clone(
72
+ flags,
73
+ child_stack,
74
+ 0,0,&regs);
75
+ }
76
+
63
77
pthread = (pthread_t)pthread_self_addr;
64
78
regs.sbase = (unsigned long)pthread->stack;
65
79
regs.slimit = regs.sbase - pthread->stack_size;