From owner-freebsd-current@FreeBSD.ORG Wed Sep 17 09:45:48 2008 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 191881065670; Wed, 17 Sep 2008 09:45:48 +0000 (UTC) (envelope-from ache@nagual.pp.ru) Received: from nagual.pp.ru (nagual.pp.ru [194.87.13.69]) by mx1.freebsd.org (Postfix) with ESMTP id 7CDFE8FC12; Wed, 17 Sep 2008 09:45:47 +0000 (UTC) (envelope-from ache@nagual.pp.ru) Received: from nagual.pp.ru (ache@localhost [127.0.0.1]) by nagual.pp.ru (8.14.3/8.14.3) with ESMTP id m8H9jjYv060026; Wed, 17 Sep 2008 13:45:45 +0400 (MSD) (envelope-from ache@nagual.pp.ru) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nagual.pp.ru; s=default; t=1221644746; bh=0rzdvm4UtQ5JXIAa+lzBvY4IzTz/css7It/1/5l b0uw=; l=1115; h=Date:From:To:Cc:Subject:Message-ID:References: MIME-Version:Content-Type:In-Reply-To; b=e3aI2hh+wlgsz7Z1qQN1At4gK q2ak6iPoLA9B2uYZC+sS+2K3CpEXPogAj9CrGyzUZvpN1N1qhrFTkk4yE3C5jCiNcsB pLks9kzb0V53uF/SFYl09/VfWkAKzPTJAgjkMe0ILEqGDl9MjboifNk9VKFF+lE6cmb w20Xes0qgNZ0= Received: (from ache@localhost) by nagual.pp.ru (8.14.3/8.14.3/Submit) id m8H9jjqx060024; Wed, 17 Sep 2008 13:45:45 +0400 (MSD) (envelope-from ache) Date: Wed, 17 Sep 2008 13:45:43 +0400 From: Andrey Chernov To: Poul-Henning Kamp Message-ID: <20080917094542.GA59756@nagual.pp.ru> Mail-Followup-To: Andrey Chernov , Poul-Henning Kamp , Daniel Eischen , Max Laier , freebsd-current@freebsd.org References: <20080917093238.GA59500@nagual.pp.ru> <89831.1221644052@critter.freebsd.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <89831.1221644052@critter.freebsd.dk> User-Agent: Mutt/1.5.18 (2008-05-17) Cc: Daniel Eischen , Max Laier , freebsd-current@freebsd.org Subject: Re: Is fork() hook ever possible? X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Sep 2008 09:45:48 -0000 On Wed, Sep 17, 2008 at 09:34:12AM +0000, Poul-Henning Kamp wrote: > In message <20080917093238.GA59500@nagual.pp.ru>, Andrey Chernov writes: > >On Wed, Sep 17, 2008 at 09:24:01AM +0000, Poul-Henning Kamp wrote: > > >> Just have the FreeBSD library calls, call the wrapper function that > >> does a pid check and be done with it. > > > >I understand your idea and it was first idea that comes to me too, but > >since API is not ours, it does not work that way. > > Well, in that case, you should leave the "slow" check in place and > live with it. Not so doomed. As already discussed in this thread we can ether: a) Add *fork() hook to clear arc4random's flag which inidicates it is stired (to re-stir it on the next call). This slightly increases diffs with OpenBSD arc4random code. b) Speed up getpid() itself by caching its value (adding *fork() and getpid() hooks). This produces no diffs with OpenBSD arc4random code. That way give more benefits for other program that calls getpid() often to check they are in the child, but I don't have examples. -- http://ache.pp.ru/