From owner-svn-src-all@FreeBSD.ORG Mon Mar 31 02:44:44 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 131CFDCF; Mon, 31 Mar 2014 02:44:44 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 F39FCA1A; Mon, 31 Mar 2014 02:44:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s2V2ihFF031350; Mon, 31 Mar 2014 02:44:43 GMT (envelope-from mjg@svn.freebsd.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s2V2ihak031349; Mon, 31 Mar 2014 02:44:43 GMT (envelope-from mjg@svn.freebsd.org) Message-Id: <201403310244.s2V2ihak031349@svn.freebsd.org> From: Mateusz Guzik Date: Mon, 31 Mar 2014 02:44:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r263962 - stable/10/sys/kern X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Mar 2014 02:44:44 -0000 Author: mjg Date: Mon Mar 31 02:44:43 2014 New Revision: 263962 URL: http://svnweb.freebsd.org/changeset/base/263962 Log: MFC r263755: Document a known problem with handling the process intended to receive SIGIO in /dev/devctl. Modified: stable/10/sys/kern/subr_bus.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/subr_bus.c ============================================================================== --- stable/10/sys/kern/subr_bus.c Mon Mar 31 02:30:55 2014 (r263961) +++ stable/10/sys/kern/subr_bus.c Mon Mar 31 02:44:43 2014 (r263962) @@ -497,6 +497,21 @@ devioctl(struct cdev *dev, u_long cmd, c devsoftc.nonblock = 0; return (0); case FIOASYNC: + /* + * FIXME: + * Since this is a simple assignment there is no guarantee that + * devsoftc.async_proc consumers will get a valid pointer. + * + * Example scenario where things break (processes A and B): + * 1. A opens devctl + * 2. A sends fd to B + * 3. B sets itself as async_proc + * 4. B exits + * + * However, normally this requires root privileges and the only + * in-tree consumer does not behave in a dangerous way so the + * issue is not critical. + */ if (*(int*)data) devsoftc.async_proc = td->td_proc; else @@ -582,6 +597,7 @@ devctl_queue_data_f(char *data, int flag cv_broadcast(&devsoftc.cv); mtx_unlock(&devsoftc.mtx); selwakeup(&devsoftc.sel); + /* XXX see a comment in devioctl */ p = devsoftc.async_proc; if (p != NULL) { PROC_LOCK(p);