git: 15acd92e8f45 - stable/13 - linux: implement rt_sigsuspend(2) on arm64

From: Edward Tomasz Napierala <trasz_at_FreeBSD.org>
Date: Fri, 18 Feb 2022 14:52:28 UTC
The branch stable/13 has been updated by trasz:

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

commit 15acd92e8f45bd470dec641659b11ccb2c32f078
Author:     Edward Tomasz Napierala <trasz@FreeBSD.org>
AuthorDate: 2021-07-23 20:11:06 +0000
Commit:     Edward Tomasz Napierala <trasz@FreeBSD.org>
CommitDate: 2022-02-14 18:45:24 +0000

    linux: implement rt_sigsuspend(2) on arm64
    
    ... by making it architecture-independent.
    
    Reviewed By:    dchagin
    Sponsored By:   EPSRC
    Differential Revision:  https://reviews.freebsd.org/D31259
    
    (cherry picked from commit 72f7ddb587a79dbea353e40b182ea93bb1dfea21)
---
 sys/amd64/linux/linux_machdep.c     | 21 ---------------------
 sys/amd64/linux32/linux32_machdep.c | 18 ------------------
 sys/arm64/linux/linux_machdep.c     | 10 ----------
 sys/compat/linux/linux_signal.c     | 18 ++++++++++++++++++
 sys/i386/linux/linux_machdep.c      | 18 ------------------
 5 files changed, 18 insertions(+), 67 deletions(-)

diff --git a/sys/amd64/linux/linux_machdep.c b/sys/amd64/linux/linux_machdep.c
index 4736fd3d1682..6c9f63b3a21c 100644
--- a/sys/amd64/linux/linux_machdep.c
+++ b/sys/amd64/linux/linux_machdep.c
@@ -173,27 +173,6 @@ linux_iopl(struct thread *td, struct linux_iopl_args *args)
 	return (0);
 }
 
-int
-linux_rt_sigsuspend(struct thread *td, struct linux_rt_sigsuspend_args *uap)
-{
-	l_sigset_t lmask;
-	sigset_t sigmask;
-	int error;
-
-	LINUX_CTR2(rt_sigsuspend, "%p, %ld",
-	    uap->newset, uap->sigsetsize);
-
-	if (uap->sigsetsize != sizeof(l_sigset_t))
-		return (EINVAL);
-
-	error = copyin(uap->newset, &lmask, sizeof(l_sigset_t));
-	if (error)
-		return (error);
-
-	linux_to_bsd_sigset(&lmask, &sigmask);
-	return (kern_sigsuspend(td, sigmask));
-}
-
 int
 linux_pause(struct thread *td, struct linux_pause_args *args)
 {
diff --git a/sys/amd64/linux32/linux32_machdep.c b/sys/amd64/linux32/linux32_machdep.c
index 8ae82f3df8ca..ffb04daa852e 100644
--- a/sys/amd64/linux32/linux32_machdep.c
+++ b/sys/amd64/linux32/linux32_machdep.c
@@ -536,24 +536,6 @@ linux_sigsuspend(struct thread *td, struct linux_sigsuspend_args *args)
 	return (kern_sigsuspend(td, sigmask));
 }
 
-int
-linux_rt_sigsuspend(struct thread *td, struct linux_rt_sigsuspend_args *uap)
-{
-	l_sigset_t lmask;
-	sigset_t sigmask;
-	int error;
-
-	if (uap->sigsetsize != sizeof(l_sigset_t))
-		return (EINVAL);
-
-	error = copyin(uap->newset, &lmask, sizeof(l_sigset_t));
-	if (error)
-		return (error);
-
-	linux_to_bsd_sigset(&lmask, &sigmask);
-	return (kern_sigsuspend(td, sigmask));
-}
-
 int
 linux_pause(struct thread *td, struct linux_pause_args *args)
 {
diff --git a/sys/arm64/linux/linux_machdep.c b/sys/arm64/linux/linux_machdep.c
index 8e10fc9d26a1..c67c4aa6479a 100644
--- a/sys/arm64/linux/linux_machdep.c
+++ b/sys/arm64/linux/linux_machdep.c
@@ -53,7 +53,6 @@ LIN_SDT_PROVIDER_DECLARE(LINUX_DTRACE);
 
 /* DTrace probes */
 LIN_SDT_PROBE_DEFINE0(machdep, linux_mmap2, todo);
-LIN_SDT_PROBE_DEFINE0(machdep, linux_rt_sigsuspend, todo);
 LIN_SDT_PROBE_DEFINE0(machdep, linux_sigaltstack, todo);
 
 /*
@@ -122,15 +121,6 @@ linux_madvise(struct thread *td, struct linux_madvise_args *uap)
 	return (linux_madvise_common(td, PTROUT(uap->addr), uap->len, uap->behav));
 }
 
-/* LINUXTODO: implement arm64 linux_rt_sigsuspend */
-int
-linux_rt_sigsuspend(struct thread *td, struct linux_rt_sigsuspend_args *uap)
-{
-
-	LIN_SDT_PROBE0(machdep, linux_rt_sigsuspend, todo);
-	return (EDOOFUS);
-}
-
 /* LINUXTODO: implement arm64 linux_sigaltstack */
 int
 linux_sigaltstack(struct thread *td, struct linux_sigaltstack_args *uap)
diff --git a/sys/compat/linux/linux_signal.c b/sys/compat/linux/linux_signal.c
index 0e2fbd31b398..f2c458a1c42c 100644
--- a/sys/compat/linux/linux_signal.c
+++ b/sys/compat/linux/linux_signal.c
@@ -747,3 +747,21 @@ linux_rt_tgsigqueueinfo(struct thread *td, struct linux_rt_tgsigqueueinfo_args *
 	lsiginfo_to_ksiginfo(&linfo, &ksi, sig);
 	return (linux_do_tkill(td, tds, &ksi));
 }
+
+int
+linux_rt_sigsuspend(struct thread *td, struct linux_rt_sigsuspend_args *uap)
+{
+	l_sigset_t lmask;
+	sigset_t sigmask;
+	int error;
+
+	if (uap->sigsetsize != sizeof(l_sigset_t))
+		return (EINVAL);
+
+	error = copyin(uap->newset, &lmask, sizeof(l_sigset_t));
+	if (error != 0)
+		return (error);
+
+	linux_to_bsd_sigset(&lmask, &sigmask);
+	return (kern_sigsuspend(td, sigmask));
+}
diff --git a/sys/i386/linux/linux_machdep.c b/sys/i386/linux/linux_machdep.c
index d2d713d4776d..4d2db1269dc9 100644
--- a/sys/i386/linux/linux_machdep.c
+++ b/sys/i386/linux/linux_machdep.c
@@ -507,24 +507,6 @@ linux_sigsuspend(struct thread *td, struct linux_sigsuspend_args *args)
 	return (kern_sigsuspend(td, sigmask));
 }
 
-int
-linux_rt_sigsuspend(struct thread *td, struct linux_rt_sigsuspend_args *uap)
-{
-	l_sigset_t lmask;
-	sigset_t sigmask;
-	int error;
-
-	if (uap->sigsetsize != sizeof(l_sigset_t))
-		return (EINVAL);
-
-	error = copyin(uap->newset, &lmask, sizeof(l_sigset_t));
-	if (error)
-		return (error);
-
-	linux_to_bsd_sigset(&lmask, &sigmask);
-	return (kern_sigsuspend(td, sigmask));
-}
-
 int
 linux_pause(struct thread *td, struct linux_pause_args *args)
 {