[PATCH] Support for .openbsd.randomdata and PT_OPENBSD_RANDOMIZE

Matthew Dempsky mdempsky@google.com
Wed Aug 22 00:59:00 GMT 2012


I've added support to OpenBSD for a new OS-specific segment type
PT_OPENBSD_RANDOMIZE.  This segment indicates that the system is
responsible for initializing the specified memory range with random
data after loading the object into memory and before relocation
processing is applied.

Additionally, I modified OpenBSD's version of binutils to understand
the PT_OPENBSD_RANDOMIZE segment type and to emit a
PT_OPENBSD_RANDOMIZE segment when linking an ELF output that contains
a .openbsd.randomdata section.  (This allows code like "long
__stack_chk_guard __attribute__((section(".openbsd.randomdata")));" to
initialize a variable with random data without requiring any
constructor methods.)

Mark Kettenis thought that the binutils project might at least be
interested in the bits to make readelf understand PT_OPENBSD_RANDOMIZE
segments, so I ported the diff to latest GNU binutils.  See attached.

Cheers!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: openbsd-randomize.diff
Type: application/octet-stream
Size: 4159 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20120822/002ad990/attachment.obj>


More information about the Binutils mailing list