Lines 5-17
Link Here
|
5 |
* Licensed under the GPL-2 |
5 |
* Licensed under the GPL-2 |
6 |
*/ |
6 |
*/ |
7 |
|
7 |
|
8 |
/* We're only wrapping vfork() as a poor man's pthread_atfork(). That would |
8 |
/* We implement vfork() as fork() because sandbox does not meet vfork() |
9 |
* require dedicated linkage against libpthread. So here we force the locks |
9 |
* requirements between vfork()/exec("some-static-bianary") because we launch |
10 |
* to a consistent state before forking. |
|
|
11 |
* |
12 |
* We also implement vfork() as fork() because sandbox does not meet vfork() |
13 |
* requirements bet ween vfork()/exec("some-static-bianary") because we launch |
14 |
* ptrace in the middle. |
10 |
* ptrace in the middle. |
|
|
11 |
* |
12 |
* vfork() can also cause races in multithreaded apps in sandbox code. |
13 |
* fork() does not as it unstares address space. |
15 |
*/ |
14 |
*/ |
16 |
|
15 |
|
17 |
#define WRAPPER_ARGS_PROTO |
16 |
#define WRAPPER_ARGS_PROTO |
Lines 19-28
Link Here
|
19 |
#define WRAPPER_SAFE() 0 |
18 |
#define WRAPPER_SAFE() 0 |
20 |
#define WRAPPER_PRE_CHECKS() \ |
19 |
#define WRAPPER_PRE_CHECKS() \ |
21 |
({ \ |
20 |
({ \ |
22 |
/* pthread_atfork(sb_lock, sb_unlock, sb_unlock); */ \ |
|
|
23 |
sb_lock(); \ |
24 |
result = sb_unwrapped_fork_DEFAULT(WRAPPER_ARGS_FULL); \ |
21 |
result = sb_unwrapped_fork_DEFAULT(WRAPPER_ARGS_FULL); \ |
25 |
sb_unlock(); \ |
|
|
26 |
false; \ |
22 |
false; \ |
27 |
}) |
23 |
}) |
28 |
#include "__wrapper_simple.c" |
24 |
#include "__wrapper_simple.c" |
29 |
- |
|
|