From owner-freebsd-bugs@FreeBSD.ORG Fri Jan 2 03:40:03 2009 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 318FF1065675 for ; Fri, 2 Jan 2009 03:40:03 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 09FBF8FC14 for ; Fri, 2 Jan 2009 03:40:03 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id n023e2m2085142 for ; Fri, 2 Jan 2009 03:40:02 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id n023e2f5085141; Fri, 2 Jan 2009 03:40:02 GMT (envelope-from gnats) Resent-Date: Fri, 2 Jan 2009 03:40:02 GMT Resent-Message-Id: <200901020340.n023e2f5085141@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Mateusz Guzik Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F37A11065670 for ; Fri, 2 Jan 2009 03:35:18 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id E226A8FC1A for ; Fri, 2 Jan 2009 03:35:18 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.3/8.14.3) with ESMTP id n023ZIBI076609 for ; Fri, 2 Jan 2009 03:35:18 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.3/8.14.3/Submit) id n023ZIb9076608; Fri, 2 Jan 2009 03:35:18 GMT (envelope-from nobody) Message-Id: <200901020335.n023ZIb9076608@www.freebsd.org> Date: Fri, 2 Jan 2009 03:35:18 GMT From: Mateusz Guzik To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: kern/130107: [devctl][patch] in devctl_queue_data(): possible use of bogus pointer to proc to send SIGIO X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Jan 2009 03:40:03 -0000 >Number: 130107 >Category: kern >Synopsis: [devctl][patch] in devctl_queue_data(): possible use of bogus pointer to proc to send SIGIO >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Jan 02 03:40:02 UTC 2009 >Closed-Date: >Last-Modified: >Originator: Mateusz Guzik >Release: 8.0-CURRENT >Organization: >Environment: FreeBSD eternal 8.0-CURRENT FreeBSD 8.0-CURRENT #13: Fri Jan 2 04:49:43 CET 2009 root@:/usr/obj/usr/src/sys/ETERNAL i386 >Description: If devsoftc.async_proc is not NULL, devctl_queue_data() sends SIGIO to the process pointed by it. devctl's reader can use ioctl FIOASYNC to make this happen. But devsoftc.async_proc is not NULLed on close, so if the reader dies, devctl_queue_data() still sends SIGIO (but using bogus pointer). >How-To-Repeat: >Fix: "devsoftc.async_proc = NULL;" at the beginning of devclose() fixes the problem. (perhaps similar line from devopen() can go away?) Patch attached with submission follows: --- sys/kern/subr_bus.c.orig 2008-11-18 22:01:54.000000000 +0100 +++ sys/kern/subr_bus.c 2009-01-02 04:34:09.000000000 +0100 @@ -416,6 +416,7 @@ devclose(struct cdev *dev, int fflag, int devtype, d_thread_t *td) { devsoftc.inuse = 0; + devsoftc.async_proc = NULL; mtx_lock(&devsoftc.mtx); cv_broadcast(&devsoftc.cv); mtx_unlock(&devsoftc.mtx); >Release-Note: >Audit-Trail: >Unformatted: