From owner-svn-src-all@FreeBSD.ORG Thu Mar 27 08:46:15 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D784B770; Thu, 27 Mar 2014 08:46:15 +0000 (UTC) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) (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 C1D45B6; Thu, 27 Mar 2014 08:46:15 +0000 (UTC) Received: from xyf.my.dom (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.8/8.14.8) with ESMTP id s2R8kD8j000523; Thu, 27 Mar 2014 08:46:14 GMT (envelope-from davidxu@freebsd.org) Message-ID: <5333E581.1000100@freebsd.org> Date: Thu, 27 Mar 2014 16:46:57 +0800 From: David Xu User-Agent: Mozilla/5.0 (X11; FreeBSD i386; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 MIME-Version: 1.0 To: Mateusz Guzik Subject: Re: svn commit: r263755 - head/sys/kern References: <201403252330.s2PNUaei052956@svn.freebsd.org> <5333D70D.7050306@freebsd.org> <20140327083730.GA22942@dft-labs.eu> In-Reply-To: <20140327083730.GA22942@dft-labs.eu> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Mateusz Guzik 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: Thu, 27 Mar 2014 08:46:15 -0000 On 2014/03/27 16:37, Mateusz Guzik wrote: > On Thu, Mar 27, 2014 at 03:45:17PM +0800, David Xu wrote: >> I think the async process pointer can be cleared when a process exits >> by registering an event handler. please see attached patch. >> > > Sure, but I'm not very fond of this solution. > > This is a rather obscure bug you wont hit unless you explicitly try, > and even then you need root privs by default. > OK, but I don't like the bug exists in kernel. It is not obscure for me, I can run "shutdown now" command, and insert a device, and then the kernel will write garbage data into freed memory space. > As such writing a callback function which will be executed for all exiting > processes seems unjustified for me. > > Ideally we would get some mechanism which would allow to register > callbacks for events related to given entity. Then it could be used to > provide a "call this function when process p exits", amongst other things. > Yes, but the callback itself is cheap enough and is not worth to be per-entity entry.