diff options
author | Stefano Brivio <sbrivio@redhat.com> | 2022-11-13 02:21:47 +0100 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2022-11-16 17:28:53 +0100 |
commit | ab6f825889efedf275ba4018ebb9e5c21435199c (patch) | |
tree | 11f422e4bbbb0af89cda252345ef46f9f2dcb227 /pasta.c | |
parent | 7d8c2fb9168713ebadd6c7e0bada60a85235b64b (diff) | |
download | passt-ab6f825889efedf275ba4018ebb9e5c21435199c.tar passt-ab6f825889efedf275ba4018ebb9e5c21435199c.tar.gz passt-ab6f825889efedf275ba4018ebb9e5c21435199c.tar.bz2 passt-ab6f825889efedf275ba4018ebb9e5c21435199c.tar.lz passt-ab6f825889efedf275ba4018ebb9e5c21435199c.tar.xz passt-ab6f825889efedf275ba4018ebb9e5c21435199c.tar.zst passt-ab6f825889efedf275ba4018ebb9e5c21435199c.zip |
util, pasta: Add do_clone() wrapper around __clone2() and clone()
Spotted in Debian's buildd logs: on ia64, clone(2) is not available:
the glibc wrapper is named __clone2() and it takes, additionally,
the size of the stack area passed by the caller.
Add a do_clone() wrapper handling the different cases, and also
taking care of pointing the child's stack in the middle of the
allocated area: on PA-RISC (hppa), handled by clone(), the stack
grows up, and on ia64 the stack grows down, but the register backing
store grows up -- and I think it might be actually used here.
Suggested-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'pasta.c')
-rw-r--r-- | pasta.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -226,11 +226,11 @@ void pasta_start_ns(struct ctx *c, uid_t uid, gid_t gid, arg.argv = sh_argv; } - pasta_child_pid = clone(pasta_spawn_cmd, - ns_fn_stack + sizeof(ns_fn_stack) / 2, - CLONE_NEWIPC | CLONE_NEWPID | CLONE_NEWNET | - CLONE_NEWUTS, - (void *)&arg); + pasta_child_pid = do_clone(pasta_spawn_cmd, ns_fn_stack, + sizeof(ns_fn_stack), + CLONE_NEWIPC | CLONE_NEWPID | CLONE_NEWNET | + CLONE_NEWUTS, + (void *)&arg); if (pasta_child_pid == -1) { perror("clone"); |