From owner-svn-src-head@freebsd.org Mon Jun 12 21:11:12 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D9A7AC78662; Mon, 12 Jun 2017 21:11:12 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9FCBA7F7C7; Mon, 12 Jun 2017 21:11:12 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v5CLBBQA092607; Mon, 12 Jun 2017 21:11:11 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v5CLBBUT092606; Mon, 12 Jun 2017 21:11:11 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201706122111.v5CLBBUT092606@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 12 Jun 2017 21:11:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r319874 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jun 2017 21:11:13 -0000 Author: kib Date: Mon Jun 12 21:11:11 2017 New Revision: 319874 URL: https://svnweb.freebsd.org/changeset/base/319874 Log: Print unimplemented syscall number to the ctty on SIGSYS, if enabled by the knob kern.lognosys. Discussed with: imp Reviewed by: jhb Sponsored by: The FreeBSD Foundation MFC after: 3 weeks X-Differential revision: https://reviews.freebsd.org/D11080 Modified: head/sys/kern/kern_sig.c Modified: head/sys/kern/kern_sig.c ============================================================================== --- head/sys/kern/kern_sig.c Mon Jun 12 21:03:23 2017 (r319873) +++ head/sys/kern/kern_sig.c Mon Jun 12 21:11:11 2017 (r319874) @@ -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); /* @@ -3568,11 +3572,16 @@ struct nosys_args { int nosys(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); }