History log of /openbsd-src/sys/lib/libkern/explicit_bzero.c (Results 1 – 3 of 3)
Revision Date Author Comments
# bdc0d3c9 21-Jun-2014 matthew <matthew@openbsd.org>

Protect explicit_bzero() from link-time optimization

Modern compiler toolchains are capable of optimizing even across
translation unit boundaries, so simply moving the memory clearing into
a separat

Protect explicit_bzero() from link-time optimization

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

show more ...


# b5be37d2 10-Jun-2014 deraadt <deraadt@openbsd.org>

mop up #ifdef _KERNEL goo; ok miod


# f5d2eefe 10-Jan-2011 tedu <tedu@openbsd.org>

add a new function, explicit_bzero, to be used for erasing "secret" stuff.
unlike normal bzero, we guarantee that the compiler will not optimize out
calls to this function for otherwise dead variable

add a new function, explicit_bzero, to be used for erasing "secret" stuff.
unlike normal bzero, we guarantee that the compiler will not optimize out
calls to this function for otherwise dead variables.
to be adjusted as needed when compilers and linkers get smarter.
ok deraadt miod

show more ...