Linux Container Development
 help / color / mirror / Atom feed
From: "Serge E. Hallyn" <serge-A9i7LUbDfNHQT0dZR+AlfA@public.gmane.org>
To: Nathan Lynch <ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org>
Cc: containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org
Subject: Re: [PATCH user-cr 2/2] add nsexeccwp to test clone-with-pids
Date: Mon, 16 Nov 2009 22:05:26 -0600	[thread overview]
Message-ID: <20091117040526.GA11241@hallyn.com> (raw)
In-Reply-To: <1258413522.4031.1036.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>

Quoting Nathan Lynch (ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org):
> Okay, here's the violence I've committed against your code to get eclone
> working on powerpc (tested 32-bit userspace against 64-bit kernel).
> 
> ./nsexeccwp -z 300 /bin/bash -c 'echo $$'
> [debugging cruft elided]
> 300
> 
> This is meant not for inclusion but for discussion at this point.  I
> made some changes that will certainly break the builds for other
> architectures.
> 
> Note that I have generic code initializing clone_args with the true
> stack base and size and passing that to the architecture code.  The
> architecture code (e.g. clone_ppc.c) is responsible for calculating the
> stack pointer to pass to the kernel.  The architecture code is also
> responsible for clearing clone_args.child_stack_size and updating
> clone_args.child_stack, adjusting for alignment and arguments if
> appropriate.  In this way, we can accommodate ia64 and parisc and keep
> platform details in platform-specific code.

...

> diff --git a/clone_ppc.c b/clone_ppc.c
> index 49797fd..9e19fae 100644
> --- a/clone_ppc.c
> +++ b/clone_ppc.c
> @@ -10,14 +10,25 @@
>  
>  #define _GNU_SOURCE
>  
> +#include <stdint.h>
> +#include <stdio.h>
> +#include <string.h>
>  #include <unistd.h>
>  #include <errno.h>
>  #include <sys/types.h>
>  #include <sys/syscall.h>
>  #include <asm/unistd.h>
>  
> +#include "eclone.h"
> +
>  struct target_pid_set;
>  
> +struct pid_set {
> +	size_t nr_pids;
> +	pid_t *pids;
> +};

You shouldn't need the pid_set any more right?

...

> @@ -305,12 +294,17 @@ int main(int argc, char *argv[])
>  			return -1;
>  		}
>  
> +		memset(&clone_args, 0, sizeof(clone_args));
> +		clone_args.child_stack = (unsigned long)stack;
> +		clone_args.child_stack_size = stacksize;
> +		clone_args.nr_pids = nr_pids;
> +
>  		printf("about to clone with %lx\n", flags);
>  		if (chosen_pid)
>  			printf("Will choose pid %d\n", chosen_pid);
> +		printf("argv = %p\n", argv);
>  		flags |= SIGCHLD;
> -		pid = clone_with_pids(do_child, stack, flags, &pid_set,
> -					(void *)argv);
> +		pid = eclone(do_child, argv, flags, &clone_args, &chosen_pid);
>  		if (pid == -1) {
>  			perror("clone");
>  			return -1;

Yup, of course I agree with switching to a clean eclone passing
the clone_args and no struct pid_set, i was just trying to
minimize (to 0 :) the changes required for now in restart.c.

If you don't mind sending the patch to update restart.c as
well as this (minus some debugging) when you're ready, I'll
port clone_s390x.c to your precise api.

thanks,
-serge

  parent reply	other threads:[~2009-11-17  4:05 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-13  5:24 [PATCH linux-cr] implement s390 eclone syscall serue-r/Jw6+rmf7HQT0dZR+AlfA
     [not found] ` <1258089886-10034-1-git-send-email-serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-11-13  5:24   ` [PATCH user-cr 1/2] use v13 of eclone in clone_s390x.c serue-r/Jw6+rmf7HQT0dZR+AlfA
2009-11-13  5:24   ` [PATCH user-cr 2/2] add nsexeccwp to test clone-with-pids serue-r/Jw6+rmf7HQT0dZR+AlfA
     [not found]     ` <1258089886-10034-3-git-send-email-serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-11-13 21:08       ` Serge E. Hallyn
2009-11-15 22:45       ` Nathan Lynch
     [not found]         ` <1258325156.4031.3.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2009-11-16 11:12           ` Serge E. Hallyn
     [not found]             ` <20091116111249.GA32340-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-11-15 23:49               ` Nathan Lynch
     [not found]                 ` <1258328984.4031.21.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2009-11-16 18:26                   ` Serge E. Hallyn
     [not found]                     ` <20091116182655.GA3777-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-11-16 23:18                       ` Nathan Lynch
     [not found]                         ` <1258413522.4031.1036.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2009-11-17  4:05                           ` Serge E. Hallyn [this message]
2009-11-16 14:45       ` Serge E. Hallyn
2009-11-16 23:36   ` [PATCH linux-cr] implement s390 eclone syscall Nathan Lynch
     [not found]     ` <1258414596.4031.1058.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2009-11-17  4:03       ` Serge E. Hallyn
     [not found]         ` <20091117040321.GA32461-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-11-17 21:33           ` [PATCH linux-cr] fix warnings in i386 sys_eclone Nathan Lynch
  -- strict thread matches above, loose matches on Subject: below --
2009-11-10 16:58 [PATCH user-cr 1/2] use Suka's v11 api Serge E. Hallyn
     [not found] ` <20091110165839.GA19222-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-11-10 16:59   ` [PATCH user-cr 2/2] add nsexeccwp to test clone-with-pids Serge E. Hallyn
     [not found]     ` <20091110165922.GA19263-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-11-25 18:46       ` Oren Laadan
     [not found]         ` <4B0D7B87.5020504-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
2009-11-25 19:24           ` Serge E. Hallyn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20091117040526.GA11241@hallyn.com \
    --to=serge-a9i7lubdfnhqt0dzr+alfa@public.gmane.org \
    --cc=containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org \
    --cc=ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox