Subject: [PATCH 1/1] nsexeccwp bugfixes

1. As Nathan pointed out, I was passing in stack bottom, not
stack top.  Our clone_with_pids() helper in user-cr/clone_${ARCH}.c
just accepts stack top.

2. The clone_with_pids() helper returns -errno on error, it
doesn't set errno.  Hande that right.

Signed-off-by: Serge E. Hallyn <se...@us.ibm.com>
---
 nsexeccwp.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/nsexeccwp.c b/nsexeccwp.c
index 453fb8c..d4bf00c 100644
--- a/nsexeccwp.c
+++ b/nsexeccwp.c
@@ -304,6 +304,7 @@ int main(int argc, char *argv[])
                        perror("malloc");
                        return -1;
                }
+               stack += stacksize - 1;
 
                printf("about to clone with %lx\n", flags);
                if (chosen_pid)
@@ -311,7 +312,8 @@ int main(int argc, char *argv[])
                flags |= SIGCHLD;
                pid = clone_with_pids(do_child, stack, flags, &pid_set,
                                        (void *)argv);
-               if (pid == -1) {
+               if (pid < 0) {
+                       errno = -pid;
                        perror("clone");
                        return -1;
                }
-- 
1.6.1.1

_______________________________________________
Containers mailing list
contain...@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers

_______________________________________________
Devel mailing list
Devel@openvz.org
https://openvz.org/mailman/listinfo/devel

Reply via email to