commit:     ec933bb0dda9b1771bf3f53d2bfb835040dfa07a
Author:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
AuthorDate: Thu May 24 20:32:44 2018 +0000
Commit:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
CommitDate: Thu May 24 20:33:03 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ec933bb0

sys-apps/systemd: fix raw_clone() on sparc

Closes: https://bugs.gentoo.org/656368
Package-Manager: Portage-2.3.37, Repoman-2.3.9_p219

 sys-apps/systemd/files/238-sparc-raw-clone.patch   | 42 ++++++++++++++++++++++
 ...systemd-238-r6.ebuild => systemd-238-r7.ebuild} |  1 +
 2 files changed, 43 insertions(+)

diff --git a/sys-apps/systemd/files/238-sparc-raw-clone.patch 
b/sys-apps/systemd/files/238-sparc-raw-clone.patch
new file mode 100644
index 00000000000..736a498e918
--- /dev/null
+++ b/sys-apps/systemd/files/238-sparc-raw-clone.patch
@@ -0,0 +1,42 @@
+From e4aa2c34d526c108dd8fa37448b19bdb38de52c9 Mon Sep 17 00:00:00 2001
+From: Mike Gilbert <[email protected]>
+Date: Thu, 24 May 2018 10:48:55 -0400
+Subject: [PATCH] basic: fix raw_clone() on 32-bit sparc
+
+The clone syscall uses the same semantics as on 64-bit. The trap number
+for syscall entry is different.
+
+Bug: https://bugs.gentoo.org/656368
+---
+ src/basic/raw-clone.h | 8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/src/basic/raw-clone.h b/src/basic/raw-clone.h
+index d8a68663180..d35540903ab 100644
+--- a/src/basic/raw-clone.h
++++ b/src/basic/raw-clone.h
+@@ -39,10 +39,10 @@ static inline pid_t raw_clone(unsigned long flags) {
+         /* On s390/s390x and cris the order of the first and second arguments
+          * of the raw clone() system call is reversed. */
+         ret = (pid_t) syscall(__NR_clone, NULL, flags);
+-#elif defined(__sparc__) && defined(__arch64__)
++#elif defined(__sparc__)
+         {
+                 /**
+-                 * sparc64 always returns the other process id in %o0, and
++                 * sparc always returns the other process id in %o0, and
+                  * a boolean flag whether this is the child or the parent in
+                  * %o1. Inline assembly is needed to get the flag returned
+                  * in %o1.
+@@ -52,7 +52,11 @@ static inline pid_t raw_clone(unsigned long flags) {
+                 asm volatile("mov %2, %%g1\n\t"
+                              "mov %3, %%o0\n\t"
+                              "mov 0 , %%o1\n\t"
++#if defined(__arch64__)
+                              "t 0x6d\n\t"
++#else
++                             "t 0x10\n\t"
++#endif
+                              "mov %%o1, %0\n\t"
+                              "mov %%o0, %1" :
+                              "=r"(in_child), "=r"(child_pid) :

diff --git a/sys-apps/systemd/systemd-238-r6.ebuild 
b/sys-apps/systemd/systemd-238-r7.ebuild
similarity index 99%
rename from sys-apps/systemd/systemd-238-r6.ebuild
rename to sys-apps/systemd/systemd-238-r7.ebuild
index b015f21cb90..e65ddd901dd 100644
--- a/sys-apps/systemd/systemd-238-r6.ebuild
+++ b/sys-apps/systemd/systemd-238-r7.ebuild
@@ -154,6 +154,7 @@ src_prepare() {
                "${FILESDIR}/238-initctl.patch"
                "${FILESDIR}/238-nspawn-wait.patch"
                "${FILESDIR}/238-timesync-connection.patch"
+               "${FILESDIR}/238-sparc-raw-clone.patch"
        )
 
        if ! use vanilla; then

Reply via email to