Re: [PATCH] clone.2: Fix the erroneous statement about CLONE_NEWPID

John Watts
2023-08-12T19:11:37Z

On Sat, Aug 12, 2023 at 07:51:43PM +0200, Alejandro Colomar wrote:
> Does this depend on any recent kernel version? In my system,
> the assertion fails.
>
>
> $ cat clone.c
> ...
>
> $ cc -Wall -Wextra clone.c
> $ ./a.out
> main program: pid: 18783, and ppid: 18703
> a.out: clone.c:24: main: Assertion `ret != -1' failed.
> Aborted

On my systerm I get the same result. strace says this:

clone3({flags=CLONE_PARENT|CLONE_NEWPID, exit_signal=0, stack=NULL, stack_size=0}, 88) = -1 EPERM (Operation not permitted)

However when running as root it works.

John.