Thread (4 messages) 4 messages, 3 authors, 2025-04-19

clone(2) man page CLONE_NEWPID and CLONE_PARENT can be specified at the same time, also CLONE_NEWUSER and CLONE_PARENT

From: hoodit dev <hidden>
Date: 2025-04-15 11:34:26

Hi

In clone(2) man page ERRORS section said EINVAL occur when set
CLONE_NEWPID and one (or both) of CLONE_THREAD or CLONE_PARENT were
specified in the flags mask
but in my test code, it can be specified CLONE_NEWPID and CLONE_PARENT
at the same time and works well (not in CLONE_THREAD)
In DESCRIPTION > the flags mask > CLONE_NEWPID, it says that it can't
be used with CLONE_THREAD only
So, I search linux github to find really CLONE_PARENT can't be used
with CLONE_NEWPID but there is no logic like that
(but I found CLONE_THREAD can't be used with CLONE_NEWUSER,
https://github.com/torvalds/linux/blob/219d54332a09e8d8741c1e1982f5eae56099de85/kernel/fork.c#L1815)

Similarly, in CLONE_NEWUSER, it says that "This flag can't be
specified in conjunction with CLONE_THREAD or CLONE_PARENT." but it
works on my test code with CLONE_PARENT
Also, in ERROR section only mentioned when CLONE_NEWUSER used with CLONE_THREAD

I think CLONE_NEWPID and CLONE_NEWUSER can't be used with CLONE_THREAD only.
If you think my opinion is reasonable, please let me know. I'll make a patch
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help