git: b2c247a0dba4 - stable/13 - linux(4): Change clone syscall definition to match Linux actual one.

From: Dmitry Chagin <dchagin_at_FreeBSD.org>
Date: Fri, 17 Jun 2022 19:37:58 UTC
The branch stable/13 has been updated by dchagin:

URL: https://cgit.FreeBSD.org/src/commit/?id=b2c247a0dba4370943322f89334bda9e3835a0d1

commit b2c247a0dba4370943322f89334bda9e3835a0d1
Author:     Dmitry Chagin <dchagin@FreeBSD.org>
AuthorDate: 2021-08-12 08:46:36 +0000
Commit:     Dmitry Chagin <dchagin@FreeBSD.org>
CommitDate: 2022-06-17 19:33:29 +0000

    linux(4): Change clone syscall definition to match Linux actual one.
    
    Differential revision:  https://reviews.freebsd.org/D31473
    MFC after:              2 weeks
    
    (cherry picked from commit f1c450492f81cda4bddd46dc71ea4c92907567ac)
---
 sys/amd64/linux/syscalls.master   |  8 ++++----
 sys/amd64/linux32/syscalls.master | 10 +++++-----
 sys/arm/linux/syscalls.master     | 10 +++++-----
 sys/arm64/linux/syscalls.master   |  8 ++++----
 sys/compat/linux/linux_fork.c     | 10 +++++-----
 sys/i386/linux/syscalls.master    | 10 +++++-----
 6 files changed, 28 insertions(+), 28 deletions(-)

diff --git a/sys/amd64/linux/syscalls.master b/sys/amd64/linux/syscalls.master
index b9b88a036e61..cdf663ce2e06 100644
--- a/sys/amd64/linux/syscalls.master
+++ b/sys/amd64/linux/syscalls.master
@@ -422,10 +422,10 @@
 56	AUE_RFORK	STD {
 		int linux_clone(
 		    l_ulong flags,
-		    void *stack,
-		    void *parent_tidptr,
-		    void *child_tidptr,
-		    void *tls
+		    l_ulong stack,
+		    l_int *parent_tidptr,
+		    l_int *child_tidptr,
+		    l_ulong tls
 		);
 	}
 57	AUE_FORK	STD {
diff --git a/sys/amd64/linux32/syscalls.master b/sys/amd64/linux32/syscalls.master
index 60f227142f01..ff7ab7f98ca8 100644
--- a/sys/amd64/linux32/syscalls.master
+++ b/sys/amd64/linux32/syscalls.master
@@ -642,11 +642,11 @@
 	}
 120	AUE_RFORK	STD {
 		int linux_clone(
-		    l_int flags,
-		    void *stack,
-		    void *parent_tidptr,
-		    void *tls,
-		    void *child_tidptr
+		    l_ulong flags,
+		    l_ulong stack,
+		    l_int *parent_tidptr,
+		    l_ulong tls,
+		    l_int *child_tidptr
 		);
 	}
 121	AUE_SYSCTL	STD {
diff --git a/sys/arm/linux/syscalls.master b/sys/arm/linux/syscalls.master
index 46cf988c3dfe..3221aaa6bd6d 100644
--- a/sys/arm/linux/syscalls.master
+++ b/sys/arm/linux/syscalls.master
@@ -508,11 +508,11 @@
 	}
 120	AUE_RFORK	STD	{
 		int linux_clone(
-		    l_int flags,
-		    void *stack,
-		    void *parent_tidptr,
-		    void *tls,
-		    void * child_tidptr
+		    l_ulong flags,
+		    l_ulong stack,
+		    l_int *parent_tidptr,
+		    l_ulong tls,
+		    l_int *child_tidptr
 		);
 	}
 121	AUE_SYSCTL	STD	{
diff --git a/sys/arm64/linux/syscalls.master b/sys/arm64/linux/syscalls.master
index 7b4ebbb2c2e9..6e163cc3360d 100644
--- a/sys/arm64/linux/syscalls.master
+++ b/sys/arm64/linux/syscalls.master
@@ -1316,10 +1316,10 @@
 220	AUE_RFORK	STD	{
 		int linux_clone(
 		    l_ulong flags,
-		    void *stack,
-		    void *parent_tidptr,
-		    void *tls,
-		    void *child_tidptr
+		    l_ulong stack,
+		    l_int *parent_tidptr,
+		    l_ulong tls,
+		    l_int *child_tidptr
 		);
 	}
 221	AUE_EXECVE	STD	{
diff --git a/sys/compat/linux/linux_fork.c b/sys/compat/linux/linux_fork.c
index bc7704795127..955e9e512bd1 100644
--- a/sys/compat/linux/linux_fork.c
+++ b/sys/compat/linux/linux_fork.c
@@ -205,10 +205,10 @@ linux_clone_proc(struct thread *td, struct linux_clone_args *args)
 	 * stack. This is what normal fork() does, so we just keep tf_rsp arg
 	 * intact.
 	 */
-	linux_set_upcall(td2, PTROUT(args->stack));
+	linux_set_upcall(td2, args->stack);
 
 	if (args->flags & LINUX_CLONE_SETTLS)
-		linux_set_cloned_tls(td2, args->tls);
+		linux_set_cloned_tls(td2, PTRIN(args->tls));
 
 	/*
 	 * If CLONE_PARENT is set, then the parent of the new process will be
@@ -253,7 +253,7 @@ linux_clone_thread(struct thread *td, struct linux_clone_args *args)
 			return (EINVAL);
 
 	/* Threads should be created with own stack */
-	if (args->stack == NULL)
+	if (PTRIN(args->stack) == NULL)
 		return (EINVAL);
 
 	p = td->td_proc;
@@ -290,7 +290,7 @@ linux_clone_thread(struct thread *td, struct linux_clone_args *args)
 	KASSERT(em != NULL, ("clone_thread: emuldata not found.\n"));
 
 	if (args->flags & LINUX_CLONE_SETTLS)
-		linux_set_cloned_tls(newtd, args->tls);
+		linux_set_cloned_tls(newtd, PTRIN(args->tls));
 
 	if (args->flags & LINUX_CLONE_CHILD_SETTID)
 		em->child_set_tid = args->child_tidptr;
@@ -304,7 +304,7 @@ linux_clone_thread(struct thread *td, struct linux_clone_args *args)
 
 	cpu_thread_clean(newtd);
 
-	linux_set_upcall(newtd, PTROUT(args->stack));
+	linux_set_upcall(newtd, args->stack);
 
 	PROC_LOCK(p);
 	p->p_flag |= P_HADTHREADS;
diff --git a/sys/i386/linux/syscalls.master b/sys/i386/linux/syscalls.master
index 3a70c1352b44..aecb852e21c7 100644
--- a/sys/i386/linux/syscalls.master
+++ b/sys/i386/linux/syscalls.master
@@ -659,11 +659,11 @@
 	}
 120	AUE_RFORK	STD {
 		int linux_clone(
-		    l_int flags,
-		    void *stack,
-		    void *parent_tidptr,
-		    void *tls,
-		    void *child_tidptr
+		    l_ulong flags,
+		    l_ulong stack,
+		    l_int *parent_tidptr,
+		    l_ulong tls,
+		    l_int *child_tidptr
 		);
 	}
 121	AUE_SYSCTL	STD {