1PERSONALITY(2) Linux Programmer's Manual PERSONALITY(2)
2
3
4
6 personality - set the process execution domain
7
9 #include <sys/personality.h>
10
11 int personality(unsigned long persona);
12
14 Linux supports different execution domains, or personalities, for each
15 process. Among other things, execution domains tell Linux how to map
16 signal numbers into signal actions. The execution domain system allows
17 Linux to provide limited support for binaries compiled under other
18 UNIX-like operating systems.
19
20 If persona is not 0xffffffff, then personality() sets the caller's exe‐
21 cution domain to the value specified by persona. Specifying persona as
22 0xffffffff provides a way of retrieving the current persona without
23 changing it.
24
25 A list of the available execution domains can be found in <sys/person‐
26 ality.h>. The execution domain is a 32-bit value in which the top
27 three bytes are set aside for flags that cause the kernel to modify the
28 behavior of certain system calls so as to emulate historical or archi‐
29 tectural quirks. The least significant byte is a value defining the
30 personality the kernel should assume. The flag values are as follows:
31
32 ADDR_COMPAT_LAYOUT (since Linux 2.6.9)
33 With this flag set, provide legacy virtual address space layout.
34
35 ADDR_NO_RANDOMIZE (since Linux 2.6.12)
36 With this flag set, disable address-space-layout randomization.
37
38 ADDR_LIMIT_32BIT (since Linux 2.2)
39 Limit the address space to 32 bits.
40
41 ADDR_LIMIT_3GB (since Linux 2.4.0)
42 With this flag set, use 0xc0000000 as the offset at which to
43 search a virtual memory chunk on mmap(2); otherwise use
44 0xffffe000.
45
46 FDPIC_FUNCPTRS (since Linux 2.6.11)
47 User-space function pointers to signal handlers point (on cer‐
48 tain architectures) to descriptors.
49
50 MMAP_PAGE_ZERO (since Linux 2.4.0)
51 Map page 0 as read-only (to support binaries that depend on this
52 SVr4 behavior).
53
54 READ_IMPLIES_EXEC (since Linux 2.6.8)
55 With this flag set, PROT_READ implies PROT_EXEC for mmap(2).
56
57 SHORT_INODE (since Linux 2.4.0)
58 No effects(?).
59
60 STICKY_TIMEOUTS (since Linux 1.2.0)
61 With this flag set, select(2), pselect(2), and ppoll(2) do not
62 modify the returned timeout argument when interrupted by a sig‐
63 nal handler.
64
65 UNAME26 (since Linux 3.1)
66 Have uname(2) report a 2.6.40+ version number rather than a 3.x
67 version number. Added as a stopgap measure to support broken
68 applications that could not handle the kernel version-numbering
69 switch from 2.6.x to 3.x.
70
71 WHOLE_SECONDS (since Linux 1.2.0)
72 No effects(?).
73
74 The available execution domains are:
75
76 PER_BSD (since Linux 1.2.0)
77 BSD. (No effects.)
78
79 PER_HPUX (since Linux 2.4)
80 Support for 32-bit HP/UX. This support was never complete, and
81 was dropped so that since Linux 4.0, this value has no effect.
82
83 PER_IRIX32 (since Linux 2.2)
84 IRIX 5 32-bit. Never fully functional; support dropped in Linux
85 2.6.27. Implies STICKY_TIMEOUTS.
86
87 PER_IRIX64 (since Linux 2.2)
88 IRIX 6 64-bit. Implies STICKY_TIMEOUTS; otherwise no effects.
89
90 PER_IRIXN32 (since Linux 2.2)
91 IRIX 6 new 32-bit. Implies STICKY_TIMEOUTS; otherwise no ef‐
92 fects.
93
94 PER_ISCR4 (since Linux 1.2.0)
95 Implies STICKY_TIMEOUTS; otherwise no effects.
96
97 PER_LINUX (since Linux 1.2.0)
98 Linux.
99
100 PER_LINUX32 (since Linux 2.2)
101 [To be documented.]
102
103 PER_LINUX32_3GB (since Linux 2.4)
104 Implies ADDR_LIMIT_3GB.
105
106 PER_LINUX_32BIT (since Linux 2.0)
107 Implies ADDR_LIMIT_32BIT.
108
109 PER_LINUX_FDPIC (since Linux 2.6.11)
110 Implies FDPIC_FUNCPTRS.
111
112 PER_OSF4 (since Linux 2.4)
113 OSF/1 v4. On alpha, clear top 32 bits of iov_len in the user's
114 buffer for compatibility with old versions of OSF/1 where
115 iov_len was defined as. int.
116
117 PER_OSR5 (since Linux 2.4)
118 Implies STICKY_TIMEOUTS and WHOLE_SECONDS; otherwise no effects.
119
120 PER_RISCOS (since Linux 2.2)
121 [To be documented.]
122
123 PER_SCOSVR3 (since Linux 1.2.0)
124 Implies STICKY_TIMEOUTS, WHOLE_SECONDS, and SHORT_INODE; other‐
125 wise no effects.
126
127 PER_SOLARIS (since Linux 2.4)
128 Implies STICKY_TIMEOUTS; otherwise no effects.
129
130 PER_SUNOS (since Linux 2.4.0)
131 Implies STICKY_TIMEOUTS. Divert library and dynamic linker
132 searches to /usr/gnemul. Buggy, largely unmaintained, and al‐
133 most entirely unused; support was removed in Linux 2.6.26.
134
135 PER_SVR3 (since Linux 1.2.0)
136 Implies STICKY_TIMEOUTS and SHORT_INODE; otherwise no effects.
137
138 PER_SVR4 (since Linux 1.2.0)
139 Implies STICKY_TIMEOUTS and MMAP_PAGE_ZERO; otherwise no ef‐
140 fects.
141
142 PER_UW7 (since Linux 2.4)
143 Implies STICKY_TIMEOUTS and MMAP_PAGE_ZERO; otherwise no ef‐
144 fects.
145
146 PER_WYSEV386 (since Linux 1.2.0)
147 Implies STICKY_TIMEOUTS and SHORT_INODE; otherwise no effects.
148
149 PER_XENIX (since Linux 1.2.0)
150 Implies STICKY_TIMEOUTS and SHORT_INODE; otherwise no effects.
151
153 On success, the previous persona is returned. On error, -1 is re‐
154 turned, and errno is set to indicate the error.
155
157 EINVAL The kernel was unable to change the personality.
158
160 This system call first appeared in Linux 1.1.20 (and thus first in a
161 stable kernel release with Linux 1.2.0); library support was added in
162 glibc 2.3.
163
165 personality() is Linux-specific and should not be used in programs in‐
166 tended to be portable.
167
169 setarch(8)
170
172 This page is part of release 5.13 of the Linux man-pages project. A
173 description of the project, information about reporting bugs, and the
174 latest version of this page, can be found at
175 https://www.kernel.org/doc/man-pages/.
176
177
178
179Linux 2021-03-22 PERSONALITY(2)