Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 801259
Collapse All | Expand All

(-)a/libsandbox/wrapper-funcs/fork.c (-8 lines)
Lines 5-24 Link Here
5
 * Licensed under the GPL-2
5
 * Licensed under the GPL-2
6
 */
6
 */
7
7
8
/* We're only wrapping fork() as a poor man's pthread_atfork().  That would
9
 * require dedicated linkage against libpthread.  So here we force the locks
10
 * to a consistent state before forking. #263657
11
 */
12
13
#define WRAPPER_ARGS_PROTO
8
#define WRAPPER_ARGS_PROTO
14
#define WRAPPER_ARGS
9
#define WRAPPER_ARGS
15
#define WRAPPER_SAFE() 0
10
#define WRAPPER_SAFE() 0
16
#define WRAPPER_PRE_CHECKS() \
11
#define WRAPPER_PRE_CHECKS() \
17
({ \
12
({ \
18
	/* pthread_atfork(sb_lock, sb_unlock, sb_unlock); */ \
19
	sb_lock(); \
20
	result = SB_HIDDEN_FUNC(WRAPPER_NAME)(WRAPPER_ARGS_FULL); \
13
	result = SB_HIDDEN_FUNC(WRAPPER_NAME)(WRAPPER_ARGS_FULL); \
21
	sb_unlock(); \
22
	false; \
14
	false; \
23
})
15
})
24
#include "__wrapper_simple.c"
16
#include "__wrapper_simple.c"
(-)a/libsandbox/wrapper-funcs/vfork.c (-10 / +5 lines)
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
- 

Return to bug 801259