Date: Fri, 31 Mar 2017 19:11:58 +0000 From: Brooks Davis <brooks@freebsd.org> To: John Baldwin <jhb@freebsd.org> Cc: Peter Grehan <grehan@freebsd.org>, Ian Lepore <ian@freebsd.org>, Allan Jude <allanjude@freebsd.org>, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r316311 - in head: lib/libstand sys/boot/geli sys/boot/i386/gptboot sys/boot/i386/loader sys/boot/i386/zfsboot Message-ID: <20170331191158.GA76402@spindle.one-eyed-alien.net> In-Reply-To: <11865010.raXmoPpVZB@ralph.baldwin.cx> References: <201703310004.v2V04W3A043449@repo.freebsd.org> <1490973411.64669.121.camel@freebsd.org> <e2072da8-44db-cb12-c13c-65f68fc20617@freebsd.org> <11865010.raXmoPpVZB@ralph.baldwin.cx>
next in thread | previous in thread | raw e-mail | index | archive | help
--FCuugMFkClbJLl1L Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Mar 31, 2017 at 11:29:20AM -0700, John Baldwin wrote: > On Friday, March 31, 2017 09:04:51 AM Peter Grehan wrote: > > > So... can anyone provide a clue what's "explicit" (or different in any > > > way) between explicit_bzero() and normal bzero()? > >=20 > > =20 > > https://www.freebsd.org/cgi/man.cgi?query=3Dexplicit_bzero&sektion=3D3&= manpath=3DFreeBSD+12-current >=20 > It should be called 'bzero_now_I_mean_it()' >=20 > (but then we would need some other function called anybody_want_a_peanut(= )) It's sole purpose is to prevent the compiler from observing a pattern like: char a_secret_key[len]; ... bzero(a_secret_key, len); return; or char *a_secret_key =3D malloc(len); ... bzero(a_secret_key, len); free(a_secret_key); And optimizing away bzero() because it knows what bzero() does and that nothing will ever access it as far as the C language is concerned.. The moment you enable LTO all bets are off because it can pattern match the code for explicit_bzero(), realize that it is that same as bzero() and combine them. Declaring a_secret_key volatile likely makes things work, but the C language is deficient in not providing a way to express something like explicit_bzero() sanely and reliable. -- Brooks --FCuugMFkClbJLl1L Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEcBAEBAgAGBQJY3qn9AAoJEKzQXbSebgfAyGgH/ikmplOVu4qvBRFWua0KdtWp ksMZZAASA3Yo3DK/rNmkU3jwGqHpthX9TmRfMmN4TgvNlUskgCZ4Co1oaMgMIZET hVVYbLEapiLjAOAwqGyWwsQ789Zy3R48BvmF+7NLoGGcoU6XqJ8qwQ24yNxSH4fh JpmNPqd0+Kr4FKSKmLDdJXY836vF2RuTgb/rLV8xDdOn7qpP40kuoIjCv5GnsJpI YtF3COIkWO5KyoiDxD6724MzlyQ5fG8IfftNgjBClcq+v4xKu6j84FvcYjU0tmNW 5eVOeARRwYd6LaZ5DPdBwpM6dcleW3MQs4psC3HNjieGrVJjEbiRZUGJVNCvnfA= =D/9W -----END PGP SIGNATURE----- --FCuugMFkClbJLl1L--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20170331191158.GA76402>