summaryrefslogtreecommitdiff
path: root/src/lib/libc/string/explicit_bzero.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Protect explicit_bzero() from link-time optimizationmatthew2014-06-211-7/+10
| | | | | | | | | | | | | | | | | | | | Modern compiler toolchains are capable of optimizing even across translation unit boundaries, so simply moving the memory clearing into a separate function is not guaranteed to clear memory. To avoid this, we take advantage of ELF weak symbol semantics, and insert a call to an empty, weakly named function. The semantics of calling this function aren't determinable until load time, so the compiler and linker need to keep the memset() call. There are still ways a toolchain might defeat this trick (e.g., optimistically expecting the weak symbol to not be overloaded, and only calling memset() if it is; promoting weak symbols to strong symbols at link-time when emitting a static binary because they won't be interposed; implementing load-time optimizations). But at least for the foreseeable future, these seem unlikely. ok deraadt
* mop up ifndef KERNEL goo; ok miodderaadt2014-06-101-5/+1
|
* add explicit_bzero to libc. implementation subject to change, but starttedu2014-01-221-0/+20
the ball rolling. ok deraadt.