git: ff4e7f52471d - stable/13 - nosys(): add kern.signosys tunable/sysctl to control SIGSYS

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Mon, 09 Oct 2023 03:43:07 UTC
The branch stable/13 has been updated by kib:

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

commit ff4e7f52471d7ce6d3ca8fe563f64bda6a88bb28
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2023-09-25 16:36:04 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2023-10-09 03:42:17 +0000

    nosys(): add kern.signosys tunable/sysctl to control SIGSYS
    
    (cherry picked from commit 5804a1623054d865618d77cfac86978f03b8111a)
---
 sys/kern/kern_sig.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c
index 5dd56e0ec851..f25ff1ed55a6 100644
--- a/sys/kern/kern_sig.c
+++ b/sys/kern/kern_sig.c
@@ -159,6 +159,10 @@ static int	kern_lognosys = 0;
 SYSCTL_INT(_kern, OID_AUTO, lognosys, CTLFLAG_RWTUN, &kern_lognosys, 0,
     "Log invalid syscalls");
 
+static int	kern_signosys = 1;
+SYSCTL_INT(_kern, OID_AUTO, signosys, CTLFLAG_RWTUN, &kern_signosys, 0,
+    "Send SIGSYS on return from invalid syscall");
+
 __read_frequently bool sigfastblock_fetch_always = false;
 SYSCTL_BOOL(_kern, OID_AUTO, sigfastblock_fetch_always, CTLFLAG_RWTUN,
     &sigfastblock_fetch_always, 0,
@@ -4128,7 +4132,7 @@ nosys(struct thread *td, struct nosys_args *args)
 
 	p = td->td_proc;
 
-	if (SV_PROC_FLAG(p, SV_SIGSYS) != 0) {
+	if (SV_PROC_FLAG(p, SV_SIGSYS) != 0 && kern_signosys) {
 		PROC_LOCK(p);
 		tdsignal(td, SIGSYS);
 		PROC_UNLOCK(p);