1personality(2) System Calls Manual personality(2)
2
3
4
6 personality - set the process execution domain
7
9 Standard C library (libc, -lc)
10
12 #include <sys/personality.h>
13
14 int personality(unsigned long persona);
15
17 Linux supports different execution domains, or personalities, for each
18 process. Among other things, execution domains tell Linux how to map
19 signal numbers into signal actions. The execution domain system allows
20 Linux to provide limited support for binaries compiled under other
21 UNIX-like operating systems.
22
23 If persona is not 0xffffffff, then personality() sets the caller's exe‐
24 cution domain to the value specified by persona. Specifying persona as
25 0xffffffff provides a way of retrieving the current persona without
26 changing it.
27
28 A list of the available execution domains can be found in <sys/person‐
29 ality.h>. The execution domain is a 32-bit value in which the top
30 three bytes are set aside for flags that cause the kernel to modify the
31 behavior of certain system calls so as to emulate historical or archi‐
32 tectural quirks. The least significant byte is a value defining the
33 personality the kernel should assume. The flag values are as follows:
34
35 ADDR_COMPAT_LAYOUT (since Linux 2.6.9)
36 With this flag set, provide legacy virtual address space layout.
37
38 ADDR_NO_RANDOMIZE (since Linux 2.6.12)
39 With this flag set, disable address-space-layout randomization.
40
41 ADDR_LIMIT_32BIT (since Linux 2.2)
42 Limit the address space to 32 bits.
43
44 ADDR_LIMIT_3GB (since Linux 2.4.0)
45 With this flag set, use 0xc0000000 as the offset at which to
46 search a virtual memory chunk on mmap(2); otherwise use
47 0xffffe000. Applies to 32-bit x86 processes only.
48
49 FDPIC_FUNCPTRS (since Linux 2.6.11)
50 User-space function pointers to signal handlers point to de‐
51 scriptors. Applies only to ARM if BINFMT_ELF_FDPIC and SuperH.
52
53 MMAP_PAGE_ZERO (since Linux 2.4.0)
54 Map page 0 as read-only (to support binaries that depend on this
55 SVr4 behavior).
56
57 READ_IMPLIES_EXEC (since Linux 2.6.8)
58 With this flag set, PROT_READ implies PROT_EXEC for mmap(2).
59
60 SHORT_INODE (since Linux 2.4.0)
61 No effect.
62
63 STICKY_TIMEOUTS (since Linux 1.2.0)
64 With this flag set, select(2), pselect(2), and ppoll(2) do not
65 modify the returned timeout argument when interrupted by a sig‐
66 nal handler.
67
68 UNAME26 (since Linux 3.1)
69 Have uname(2) report a 2.6.(40+x) version number rather than a
70 MAJOR.x version number. Added as a stopgap measure to support
71 broken applications that could not handle the kernel version-
72 numbering switch from Linux 2.6.x to Linux 3.x.
73
74 WHOLE_SECONDS (since Linux 1.2.0)
75 No effect.
76
77 The available execution domains are:
78
79 PER_BSD (since Linux 1.2.0)
80 BSD. (No effects.)
81
82 PER_HPUX (since Linux 2.4)
83 Support for 32-bit HP/UX. This support was never complete, and
84 was dropped so that since Linux 4.0, this value has no effect.
85
86 PER_IRIX32 (since Linux 2.2)
87 IRIX 5 32-bit. Never fully functional; support dropped in Linux
88 2.6.27. Implies STICKY_TIMEOUTS.
89
90 PER_IRIX64 (since Linux 2.2)
91 IRIX 6 64-bit. Implies STICKY_TIMEOUTS; otherwise no effect.
92
93 PER_IRIXN32 (since Linux 2.2)
94 IRIX 6 new 32-bit. Implies STICKY_TIMEOUTS; otherwise no ef‐
95 fect.
96
97 PER_ISCR4 (since Linux 1.2.0)
98 Implies STICKY_TIMEOUTS; otherwise no effect.
99
100 PER_LINUX (since Linux 1.2.0)
101 Linux.
102
103 PER_LINUX32 (since Linux 2.2)
104 uname(2) returns the name of the 32-bit architecture in the ma‐
105 chine field ("i686" instead of "x86_64", &c.).
106
107 Under ia64 (Itanium), processes with this personality don't have
108 the O_LARGEFILE open(2) flag forced.
109
110 Under 64-bit ARM, setting this personality is forbidden if ex‐
111 ecve(2)ing a 32-bit process would also be forbidden (cf. the al‐
112 low_mismatched_32bit_el0 kernel parameter and Documenta‐
113 tion/arm64/asymmetric-32bit.rst).
114
115 PER_LINUX32_3GB (since Linux 2.4)
116 Same as PER_LINUX32, but implies ADDR_LIMIT_3GB.
117
118 PER_LINUX_32BIT (since Linux 2.0)
119 Same as PER_LINUX, but implies ADDR_LIMIT_32BIT.
120
121 PER_LINUX_FDPIC (since Linux 2.6.11)
122 Same as PER_LINUX, but implies FDPIC_FUNCPTRS.
123
124 PER_OSF4 (since Linux 2.4)
125 OSF/1 v4. No effect since Linux 6.1, which removed a.out binary
126 support. Before, on alpha, would clear top 32 bits of iov_len
127 in the user's buffer for compatibility with old versions of
128 OSF/1 where iov_len was defined as. int.
129
130 PER_OSR5 (since Linux 2.4)
131 SCO OpenServer 5. Implies STICKY_TIMEOUTS and WHOLE_SECONDS;
132 otherwise no effect.
133
134 PER_RISCOS (since Linux 2.3.7; macro since Linux 2.3.13)
135 Acorn RISC OS/Arthur (MIPS). No effect. Up to Linux v4.0,
136 would set the emulation altroot to /usr/gnemul/riscos (cf.
137 PER_SUNOS, below). Before then, up to Linux 2.6.3, just Arthur
138 emulation.
139
140 PER_SCOSVR3 (since Linux 1.2.0)
141 SCO UNIX System V Release 3. Same as PER_OSR5, but also implies
142 SHORT_INODE.
143
144 PER_SOLARIS (since Linux 2.4)
145 Solaris. Implies STICKY_TIMEOUTS; otherwise no effect.
146
147 PER_SUNOS (since Linux 2.4.0)
148 Sun OS. Same as PER_BSD, but implies STICKY_TIMEOUTS. Prior to
149 Linux 2.6.26, diverted library and dynamic linker searches to
150 /usr/gnemul. Buggy, largely unmaintained, and almost entirely
151 unused.
152
153 PER_SVR3 (since Linux 1.2.0)
154 AT&T UNIX System V Release 3. Implies STICKY_TIMEOUTS and
155 SHORT_INODE; otherwise no effect.
156
157 PER_SVR4 (since Linux 1.2.0)
158 AT&T UNIX System V Release 4. Implies STICKY_TIMEOUTS and
159 MMAP_PAGE_ZERO; otherwise no effect.
160
161 PER_UW7 (since Linux 2.4)
162 UnixWare 7. Implies STICKY_TIMEOUTS and MMAP_PAGE_ZERO; other‐
163 wise no effect.
164
165 PER_WYSEV386 (since Linux 1.2.0)
166 WYSE UNIX System V/386. Implies STICKY_TIMEOUTS and SHORT_IN‐
167 ODE; otherwise no effect.
168
169 PER_XENIX (since Linux 1.2.0)
170 XENIX. Implies STICKY_TIMEOUTS and SHORT_INODE; otherwise no
171 effect.
172
174 On success, the previous persona is returned. On error, -1 is re‐
175 turned, and errno is set to indicate the error.
176
178 EINVAL The kernel was unable to change the personality.
179
181 Linux.
182
184 Linux 1.1.20, glibc 2.3.
185
187 setarch(8)
188
189
190
191Linux man-pages 6.05 2023-04-29 personality(2)