[LTP] [PATCH 2/2] lib/cloner.c: Use __clone instead of clone for s390

Alexander Gordeev agordeev@linux.ibm.com
Fri May 8 15:09:03 CEST 2020


The kernel sys_clone and s390 glibc entry __clone assume
the flags parameter type as unsigned long. However, the
glibc clone wrapper used by ltp_clone helper defines flags
as signed int. That leads to gcc extending CLONE_IO flag of
0x80000000 value to 0xffffffff80000000.

A quick solution for s390 is to skip clone weak alias and
use __clone entry point directly.

Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
---
 lib/cloner.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lib/cloner.c b/lib/cloner.c
index 11401f2..1192e4b 100644
--- a/lib/cloner.c
+++ b/lib/cloner.c
@@ -49,6 +49,11 @@ extern int __clone2(int (*fn) (void *arg), void *child_stack_base,
                     size_t child_stack_size, int flags, void *arg,
                     pid_t *parent_tid, void *tls, pid_t *child_tid);
 #endif
+#if defined(__s390__)
+# define clone __clone
+extern int __clone(int (*fn)(void *arg), void *child_stack, unsigned long flags,
+		   void *arg, pid_t *parent_tid, void *tls, pid_t *child_tid);
+#endif
 
 #ifndef CLONE_SUPPORTS_7_ARGS
 # define clone(fn, stack, flags, arg, ptid, tls, ctid) \
-- 
1.8.3.1



More information about the ltp mailing list