path: root/sys/sys
diff options
authorConrad Meyer <cem@FreeBSD.org>2020-11-17 21:20:11 +0000
committerConrad Meyer <cem@FreeBSD.org>2020-11-17 21:20:11 +0000
commitf8f74aaa84cf33d05b40c83385fe8fbbd0e6ab49 (patch)
treeb666c7ee2cbe33f3eb298fb3823341d7d24c51ee /sys/sys
parent85078b8573332c2c83a79adea8a61b519fb3b6af (diff)
linux(4) clone(2): Correctly handle CLONE_FS and CLONE_FILES
The two flags are distinct and it is impossible to correctly handle clone(2) without the assistance of fork1(). This change depends on the pwddesc split introduced in r367777. I've added a fork_req flag, FR2_SHARE_PATHS, which indicates that p_pd should be treated the opposite way p_fd is (based on RFFDG flag). This is a little ugly, but the benefit is that existing RFFDG API is preserved. Holding FR2_SHARE_PATHS disabled, RFFDG indicates both p_fd and p_pd are copied, while !RFFDG indicates both should be cloned. In Chrome, clone(2) is used with CLONE_FS, without CLONE_FILES, and expects independent fd tables. The previous conflation of CLONE_FS and CLONE_FILES was introduced in r163371 (2006). Discussed with: markj, trasz (earlier version) Differential Revision: https://reviews.freebsd.org/D27016
Notes: svn path=/head/; revision=367778
Diffstat (limited to 'sys/sys')
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/sys/proc.h b/sys/sys/proc.h
index 0b41b84c08ab..c593b500599c 100644
--- a/sys/sys/proc.h
+++ b/sys/sys/proc.h
@@ -1017,7 +1017,8 @@ struct fork_req {
int fr_pd_flags;
struct filecaps *fr_pd_fcaps;
int fr_flags2;
-#define FR2_DROPSIG_CAUGHT 0x00001 /* Drop caught non-DFL signals */
+#define FR2_DROPSIG_CAUGHT 0x00000001 /* Drop caught non-DFL signals */
+#define FR2_SHARE_PATHS 0x00000002 /* Invert sense of RFFDG for paths */