1$OpenBSD: SPECS.randomdata,v 1.3 2018/06/01 03:27:59 mortimer Exp $
2
3This document describes the OpenBSD operating system supplement for
4adding "random data" sections to the ELF ABI.  These sections can be
5useful for holding values like GCC's stack-smashing protector cookies
6and offer additional benefits like ensuring the data is initialized
7before any constructor methods are called and allowing the dynamic
8linker to mark the memory as read-only after initialization.
9
10
11Program Header
12
13OpenBSD defines the following operating system-specific segment type:
14
15  Name                  Value
16  PT_OPENBSD_RANDOMIZE  0x65a3dbe6
17
18
19  PT_OPENBSD_RANDOMIZE
20
21    The array element specifies the location and size of a random data
22    section.  The system will initialize the specified memory range
23    with random data.  The memory range must be separately mapped
24    (e.g., by use of a PT_LOAD segment).
25
26
27Special Sections
28
29OpenBSD defines the following operating system-specific special
30sections:
31
32  Name                 Type          Attributes
33  .openbsd.randomdata  SHT_PROGBITS  SHF_ALLOC
34
35
36  .openbsd.randomdata
37
38    This section holds the random data section.
39
40
41Implementation Notes
42
43On OpenBSD, PT_OPENBSD_RANDOMIZE segments are handled alongside
44PT_LOAD segments: the kernel handles initializing random data segments
45in executables and program interpreters (i.e., ld.so), while ld.so
46handles initializing them in shared libraries.  Additionally, the
47kernel limits the total number of PT_OPENBSD_RANDOMIZE segment bytes
48in an executable or interpreter to 1048576 bytes.
49