On Mon, Mar 27, 2017 at 08:57:42PM +0700, Nikolay Marchuk wrote:
[...]
> +static int
> +child(void *arg)
> +{
> +     int *pipefd = (int *)arg;
> +     close(pipefd[0]);

here you've closed the read end

> +     return read(pipefd[1], &pipefd[0], 1);

here you've tried to read from the write end

> +}
> +
> +#define STACK_SIZE (1024 * 1024)
> +
> +static void
> +test_user_namespace(void)
> +{
> +     char stack[STACK_SIZE];
> +     pid_t pid;
> +     int pipefd[2];
> +     int rc;
> +
> +     rc = pipe(pipefd);
> +     if (rc == -1)
> +             perror_msg_and_skip("pipe");
> +
> +     pid = clone(child, stack + STACK_SIZE, CLONE_NEWUSER | CLONE_UNTRACED,
> +                 pipefd);
> +     close(pipefd[1]);

here you've closed the write end

> +     if (pid == -1)
> +             perror_msg_and_skip("clone");
> +     test_clone(pid);
> +     close(pipefd[0]);

here you've closed the read end

> +     pid = wait(&rc);
> +}

No, this is not a pipe synchronisation I was talking about. :)


-- 
ldv

Attachment: signature.asc
Description: PGP signature

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel

Reply via email to