[PATCH] Implement decoding of NS_* ioctl commands
Dmitry V. Levin
ldv at altlinux.org
Tue Mar 28 02:41:24 UTC 2017
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20170328/ea9f1189/attachment.bin>
More information about the Strace-devel
mailing list