From owner-freebsd-hackers@FreeBSD.ORG Mon Jun 9 23:52:36 2014 Return-Path: Delivered-To: hackers@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 B3989AA for ; Mon, 9 Jun 2014 23:52:36 +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 9614E2034 for ; Mon, 9 Jun 2014 23:52:36 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.8/8.14.8) with ESMTP id s59Nqarw047097 for ; Mon, 9 Jun 2014 23:52:36 GMT (envelope-from bdrewery@freefall.freebsd.org) Received: (from bdrewery@localhost) by freefall.freebsd.org (8.14.9/8.14.9/Submit) id s59Nqaim047095 for hackers@freebsd.org; Mon, 9 Jun 2014 23:52:36 GMT (envelope-from bdrewery) Received: (qmail 79594 invoked from network); 9 Jun 2014 18:52:34 -0500 Received: from unknown (HELO ?10.10.1.156?) (freebsd@shatow.net@10.10.1.156) by sweb.xzibition.com with ESMTPA; 9 Jun 2014 18:52:34 -0500 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (1.0) Subject: Re: [RFC] Fixed installworld with noexec /tmp From: Bryan Drewery X-Mailer: iPhone Mail (11D201) In-Reply-To: Date: Mon, 9 Jun 2014 18:52:35 -0500 Content-Transfer-Encoding: quoted-printable Message-Id: <5F09C06B-7334-4501-8BF0-B99E6C74B8FA@FreeBSD.org> References: <25659df71b49c7b72b6f2d9a786c5ac9@shatow.net> To: Adrian Chadd Cc: "freebsd-hackers@freebsd.org" X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jun 2014 23:52:36 -0000 I am not familiar with that problem. I don't think my fix would help that is= sue as it was already using mktemp(1) to get a random directory in /tmp. Sent from my iPhone > On Jun 9, 2014, at 18:28, Adrian Chadd wrote: >=20 > Would this fix instances of people building world on a shared box? >=20 > (ie, multiple different srcdir/objdir/destdir, but same /tmp?) >=20 >=20 > -a >=20 >=20 >> On 9 June 2014 19:01, Bryan Drewery wrote: >> I've always had my /tmp mounted as noexec. Despite how useless this >> is, I and many others have had trouble with installworld due to it. >>=20 >> You can see how frequent it occurs here: >> https://www.google.com/#q=3Dfreebsd+installworld+noexec >>=20 >> A simple workaround, which I only just discovered from PR 58117, is to se= t >> TMPDIR >> to somewhere that can exec. >>=20 >> This patch fixes it by using the OBJDIR rather than the assumed /tmp or >> TMPDIR. >>=20 >> The purpose of the installworld code using INSTALLTMP is to use the >> pre-install >> binaries to do the install, rather than the newly built binaries. This is= to >> ensure >> the binaries will run while system is in an inconsistent state with >> libraries and >> in case the kernel is not yet upgraded. My change adds continues to respe= ct >> that by >> ensuring it uses the already-installed mkdir(1) and env(1) with full path= s. >>=20 >> http://people.freebsd.org/~bdrewery/patches/installworld-noexec.txt >>=20 >> --- Makefile.inc1 >> +++ Makefile.inc1 >> @@ -191,7 +191,9 @@ TMPPATH=3D ${STRICTTMPPATH}:${PATH} >> # when in the middle of installing over this system. >> # >> .if make(distributeworld) || make(installworld) >> -INSTALLTMP!=3D /usr/bin/mktemp -d -u -t install >> +INSTALLTMPDIR=3D ${OBJTREE}${.CURDIR}/itmp >> +INSTALLTMP!=3D /bin/mkdir -p ${INSTALLTMPDIR} && /usr/bin/env \ >> + TMPDIR=3D${INSTALLTMPDIR} /usr/bin/mktemp -d -u -t instal= l >> .endif >>=20 >> # >> @@ -833,7 +835,7 @@ distributeworld installworld: _installcheck_world >> LOCAL_MTREE=3D${LOCAL_MTREE:Q} distrib-dirs >> .endif >> ${_+_}cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}; \ >> - ${IMAKEENV} rm -rf ${INSTALLTMP} >> + ${IMAKEENV} rm -rf ${INSTALLTMPDIR} >> .if make(distributeworld) >> .for dist in ${EXTRA_DISTRIBUTIONS} >> find ${DESTDIR}/${DISTDIR}/${dist} -mindepth 1 -empty -delete >>=20 >> The only downside I see is that failures can leave the stale tmpdir in >> the OBJDIR, which is why I remove the entire "itmp" dir once installworld= >> finally does succeed. >>=20 >> -- >> Regards, >> Bryan Drewery >> _______________________________________________ >> freebsd-hackers@freebsd.org mailing list >> http://lists.freebsd.org/mailman/listinfo/freebsd-hackers >> To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org= "