Date: Thu, 23 Oct 2014 18:30:56 -0500 From: Bryan Drewery <bdrewery@FreeBSD.org> To: Mateusz Guzik <mjguzik@gmail.com>, d@delphij.net Cc: svn-src-head@freebsd.org, =?UTF-8?B?RGFnLUVybGluZyBTbcO4cmdyYXY=?= <des@des.no>, svn-src-all@freebsd.org, src-committers@freebsd.org, Xin LI <delphij@FreeBSD.org> Subject: Re: svn commit: r273552 - head/sys/kern Message-ID: <54498FB0.5000703@FreeBSD.org> In-Reply-To: <20141023232133.GA11222@dft-labs.eu> References: <201410231823.s9NINpXD082633@svn.freebsd.org> <86egtyz9mz.fsf@nine.des.no> <54498CE9.1090000@delphij.net> <20141023232133.GA11222@dft-labs.eu>
next in thread | previous in thread | raw e-mail | index | archive | help
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 <delphij@FreeBSD.org> 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--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?54498FB0.5000703>