svn commit: r321344 - stable/11/sys/kern

Konstantin Belousov kib at FreeBSD.org
Fri Jul 21 18:10:47 UTC 2017


Author: kib
Date: Fri Jul 21 18:10:46 2017
New Revision: 321344
URL: https://svnweb.freebsd.org/changeset/base/321344

Log:
  MFC r319874:
  Print unimplemented syscall number to the ctty on SIGSYS, if enabled
  by the knob kern.lognosys.

Modified:
  stable/11/sys/kern/kern_sig.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/kern/kern_sig.c
==============================================================================
--- stable/11/sys/kern/kern_sig.c	Fri Jul 21 18:06:57 2017	(r321343)
+++ stable/11/sys/kern/kern_sig.c	Fri Jul 21 18:10:46 2017	(r321344)
@@ -150,6 +150,10 @@ static int	signal_alloc_fail = 0;
 SYSCTL_INT(_kern_sigqueue, OID_AUTO, alloc_fail, CTLFLAG_RD,
     &signal_alloc_fail, 0, "signals failed to be allocated");
 
+static int	kern_lognosys = 0;
+SYSCTL_INT(_kern, OID_AUTO, lognosys, CTLFLAG_RWTUN, &kern_lognosys, 0,
+    "Log invalid syscalls");
+
 SYSINIT(signal, SI_SUB_P1003_1B, SI_ORDER_FIRST+3, sigqueue_start, NULL);
 
 /*
@@ -3584,11 +3588,16 @@ nosys(td, args)
 	struct thread *td;
 	struct nosys_args *args;
 {
-	struct proc *p = td->td_proc;
+	struct proc *p;
 
+	p = td->td_proc;
+
 	PROC_LOCK(p);
 	tdsignal(td, SIGSYS);
 	PROC_UNLOCK(p);
+	if (kern_lognosys)
+		uprintf("pid %d comm %s: nosys %d\n", p->p_pid, p->p_comm,
+		    td->td_sa.code);
 	return (ENOSYS);
 }
 


More information about the svn-src-stable-11 mailing list