In linux kernel riscv select CLONE_BACKWARDS in
linux/arch/riscv/Kconfig, and in linux/kernel/fork.c:
ifdef CONFIG_CLONE_BACKWARDS
SYSCALL_DEFINE5(clone, unsigned long, clone_flags, unsigned long, newsp,
int __user *, parent_tidptr,
unsigned long, tls,
int __user *, child_tidptr)
elif ...
So we must make the riscv clone-arguments' sequence to be:
define ARG_FLAGS 0
define ARG_STACK 1
define ARG_PTID 2
define ARG_TLS 3
define ARG_CTID 4
Signed-off-by: Guo Ren <ren_guo@c-sky.com>
Reviewed-By: Dmitry V. Levin <ldv@altlinux.org>
* clone.c [RISCV]: Use default definitions for ARG_* macros.
* NEWS: Mention this fix.
Noteworthy changes in release ?.? (????-??-??)
==============================================
+* Bug fixes
+ * Fixed decoding of last two arguments of clone syscall on riscv.
+
Noteworthy changes in release 5.0 (2019-03-19)
==============================================
# define ARG_PTID 2
# define ARG_CTID ((current_personality != 1) ? 3 : 4)
# define ARG_TLS ((current_personality != 1) ? 4 : 3)
-#elif defined ALPHA || defined TILE || defined OR1K || defined RISCV
+#elif defined ALPHA || defined TILE || defined OR1K
# define ARG_FLAGS 0
# define ARG_STACK 1
# define ARG_PTID 2