[linux-user-chroot] Import S390/CRIS raw_clone syscall ordering fix
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [linux-user-chroot] Import S390/CRIS raw_clone syscall ordering fix
- Date: Fri, 28 Aug 2015 17:05:24 +0000 (UTC)
commit 99a02e4114b06edf6c03fcc01e09c137f1fc67dd
Author: Colin Walters <walters verbum org>
Date: Tue Aug 25 18:32:58 2015 -0400
Import S390/CRIS raw_clone syscall ordering fix
I took this from xdg-app.
src/linux-user-chroot.c | 14 +++++++++++++-
1 files changed, 13 insertions(+), 1 deletions(-)
---
diff --git a/src/linux-user-chroot.c b/src/linux-user-chroot.c
index 42bbae2..ccab6f4 100644
--- a/src/linux-user-chroot.c
+++ b/src/linux-user-chroot.c
@@ -137,6 +137,18 @@ fsuid_chdir (uid_t uid,
return ret;
}
+static inline int
+raw_clone (unsigned long flags, void *child_stack)
+{
+#if defined(__s390__) || defined(__CRIS__)
+ /* On s390 and cris the order of the first and second arguments
+ * of the raw clone() system call is reversed. */
+ return (int) syscall(__NR_clone, child_stack, flags);
+#else
+ return (int) syscall(__NR_clone, flags, child_stack);
+#endif
+}
+
int
main (int argc,
char **argv)
@@ -301,7 +313,7 @@ main (int argc,
if (unshare_net)
clone_flags |= CLONE_NEWNET;
- if ((child = syscall (__NR_clone, clone_flags, NULL)) < 0)
+ if ((child = raw_clone (clone_flags, NULL)) < 0)
fatal_errno ("clone");
if (child == 0)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]