From owner-freebsd-current@freebsd.org Mon Jan 23 22:11:00 2017 Return-Path: Delivered-To: freebsd-current@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 10A18CBE227 for ; Mon, 23 Jan 2017 22:11:00 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mailout.stack.nl (mailout05.stack.nl [131.155.140.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mailout.stack.nl", Issuer "CA Cert Signing Authority" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id D19B0257; Mon, 23 Jan 2017 22:10:59 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from snail.stack.nl (snail.stack.nl [IPv6:2001:610:1108:5010::131]) by mailout.stack.nl (Postfix) with ESMTP id 2EAC53D; Mon, 23 Jan 2017 23:10:51 +0100 (CET) Received: by snail.stack.nl (Postfix, from userid 1677) id 1FCF428494; Mon, 23 Jan 2017 23:10:51 +0100 (CET) Date: Mon, 23 Jan 2017 23:10:51 +0100 From: Jilles Tjoelker To: "Simon J. Gerraty" Cc: Lu Tung-Pin , freebsd-current@freebsd.org, des@freebsd.org Subject: Re: Fix /etc/rc.d/random umask handling (/entropy permissions) Message-ID: <20170123221050.GA77550@stack.nl> References: <14f5a2fdf191c33e4ed1dc882b288e81@openmailbox.org> <20170121220136.GA59654@stack.nl> <43886.1485197541@kaos.jnpr.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <43886.1485197541@kaos.jnpr.net> User-Agent: Mutt/1.5.21 (2010-09-15) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.23 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: Mon, 23 Jan 2017 22:11:00 -0000 On Mon, Jan 23, 2017 at 10:52:21AM -0800, Simon J. Gerraty wrote: > Jilles Tjoelker wrote: > > Index: etc/rc.d/random > > =================================================================== > > --- etc/rc.d/random (revision 311446) > > +++ etc/rc.d/random (working copy) > > @@ -20,12 +20,14 @@ > > > > save_dev_random() > > { > > + oumask=`umask` > why not simply use a sub-shell to tighten umask > (umask 077; what-ever) With our /bin/sh, the save-restore method saves a fork. A command substitution with a single umask command does not fork, while a subshell containing umask and something else does. The effect is fairly minor, but good performance is often the product of many small optimizations. -- Jilles Tjoelker