From owner-svn-src-all@FreeBSD.ORG Thu Oct 23 23:31:07 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.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0B18BC59 for ; Thu, 23 Oct 2014 23:31:07 +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 DEB4620B for ; Thu, 23 Oct 2014 23:31:06 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.9/8.14.9) with ESMTP id s9NNV5vx043333 for ; Thu, 23 Oct 2014 23:31:05 GMT (envelope-from bdrewery@freefall.freebsd.org) Received: (from bdrewery@localhost) by freefall.freebsd.org (8.14.9/8.14.9/Submit) id s9NNV57D043332 for svn-src-all@freebsd.org; Thu, 23 Oct 2014 23:31:05 GMT (envelope-from bdrewery) Received: (qmail 81128 invoked from network); 23 Oct 2014 18:31:03 -0500 Received: from unknown (HELO ?10.10.0.24?) (freebsd@shatow.net@10.10.0.24) by sweb.xzibition.com with ESMTPA; 23 Oct 2014 18:31:03 -0500 Message-ID: <54498FB0.5000703@FreeBSD.org> Date: Thu, 23 Oct 2014 18:30:56 -0500 From: Bryan Drewery Organization: FreeBSD User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: Mateusz Guzik , d@delphij.net Subject: Re: svn commit: r273552 - head/sys/kern References: <201410231823.s9NINpXD082633@svn.freebsd.org> <86egtyz9mz.fsf@nine.des.no> <54498CE9.1090000@delphij.net> <20141023232133.GA11222@dft-labs.eu> In-Reply-To: <20141023232133.GA11222@dft-labs.eu> OpenPGP: id=6E4697CF; url=http://www.shatow.net/bryan/bryan2.asc Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="BpuAxd8XErTmXqHgr9QiaQ1DTUtlGhPul" Cc: svn-src-head@freebsd.org, =?UTF-8?B?RGFnLUVybGluZyBTbcO4cmdyYXY=?= , svn-src-all@freebsd.org, src-committers@freebsd.org, Xin LI X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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, 23 Oct 2014 23:31:07 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --BpuAxd8XErTmXqHgr9QiaQ1DTUtlGhPul Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 10/23/2014 6:21 PM, Mateusz Guzik wrote: > On Thu, Oct 23, 2014 at 04:19:05PM -0700, Xin Li wrote: >> -----BEGIN PGP SIGNED MESSAGE----- >> Hash: SHA512 >> >> On 10/23/14 15:47, Dag-Erling Sm=C3=B8rgrav wrote: >>> Xin LI writes: >>>> Log: Test if 'env' is NULL before doing memset() and strlen(),=20 >>>> the caller may pass NULL to freeenv(). >>> >>> If this is in response to a panic in early boot, the real bug is=20 >>> elsewhere (see r273564). Adding a NULL check here only hides it. >> >> Yes that would fix it. Does this look good to you? >> >> Index: sys/kern/kern_environment.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> - --- sys/kern/kern_environment.c (revision 273564) >> +++ sys/kern/kern_environment.c (working copy) >> @@ -262,7 +262,8 @@ void >> freeenv(char *env) >> { >> >> - - if (dynamic_kenv && env !=3D NULL) { >> + MPASS(env !=3D NULL); >> + if (dynamic_kenv) { >> memset(env, 0, strlen(env)); >> free(env, M_KENV); >> } >> >=20 > There are at least 80 consumers of this function. Unless someone is up > to reviewing them all, can we go with a warning + backtrace for the tim= e > being? >=20 My DEBUG_WARN could be used for that. I had not committed yet, but it is ready. --=20 Regards, Bryan Drewery --BpuAxd8XErTmXqHgr9QiaQ1DTUtlGhPul Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (MingW32) iQEcBAEBAgAGBQJUSY+wAAoJEDXXcbtuRpfPJHAH/jKdxCxKy6ZT1o6RmOewNVvK DUmzobU4xHIdcQTBsH0cYNukedKKtxFPzVR7dos2G1r8+u8Evwb4MSi8nhq2a6Mz iH8MAsLIxUYzUEC+kRDkcerzZPvymyx9yE2mELJ07V6Qmkyb9/AKgVu0eGud3kfn XK+sBlIJiNJwzUjK0B0H5Cjud6gVzsm8bZf2BnTfi+BKJV1TQhL6eCDctWcyklFC TPr8a19j78MzO+j4RTN/dVRejJBLy+5RuXUVMdTx+o6cIHKGzbNVvdgDWcPl/Ny5 bx5jXvc02FNEVwwVx/AcATItqtOkxRfLEJuzuV2es2FL3ceH5/yj9Z4jcG2aGGo= =yP/f -----END PGP SIGNATURE----- --BpuAxd8XErTmXqHgr9QiaQ1DTUtlGhPul--