Debian Codegraph @

upstream/debian-unstable/man2/personality.2

raw
1 .\" Copyright 1995, Thomas K. Dyas <[email protected]>
2 .\" Copyright 2016, Michael Kerrisk <[email protected]>
3 .\" Copyright, the authors of the Linux man-pages project
4 .\"
5 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
6 .\"
7 .TH personality 2 2026-02-08 "Linux man-pages 6.18"
8 .SH NAME
9 personality \- set the process execution domain
10 .SH LIBRARY
11 Standard C library
12 .RI ( libc ,\~ \-lc )
13 .SH SYNOPSIS
14 .nf
15 .B #include <sys/personality.h>
16 .P
17 .BI "int personality(unsigned long " persona );
18 .fi
19 .SH DESCRIPTION
20 Linux supports different execution domains, or personalities, for each
21 process.
22 Among other things, execution domains tell Linux how to map
23 signal numbers into signal actions.
24 The execution domain system allows
25 Linux to provide limited support for binaries compiled under other
26 UNIX-like operating systems.
27 .P
28 If
29 .I persona
30 is not
31 0xffffffff, then
32 .BR personality ()
33 sets the caller's execution domain to the value specified by
34 .IR persona .
35 Specifying
36 .I persona
37 as 0xffffffff provides a way of retrieving
38 the current persona without changing it.
39 .P
40 A list of the available execution domains can be found in
41 .IR <sys/personality.h> .
42 The execution domain is a 32-bit value in which the top three
43 bytes are set aside for flags that cause the kernel to modify the
44 behavior of certain system calls so as to emulate historical or
45 architectural quirks.
46 The least significant byte is a value defining the personality
47 the kernel should assume.
48 The flag values are as follows:
49 .TP
50 .BR ADDR_COMPAT_LAYOUT " (since Linux 2.6.9)"
51 With this flag set, provide legacy virtual address space layout.
52 .TP
53 .BR ADDR_NO_RANDOMIZE " (since Linux 2.6.12)"
54 With this flag set, disable address-space-layout randomization.
55 .TP
56 .BR ADDR_LIMIT_32BIT " (since Linux 2.2)"
57 Limit the address space to 32 bits.
58 .TP
59 .BR ADDR_LIMIT_3GB " (since Linux 2.4.0)"
60 With this flag set, use 0xc0000000 as the offset at which to search
61 a virtual memory chunk on
62 .BR mmap (2);
63 otherwise use 0xffffe000.
64 Applies to 32-bit x86 processes only.
65 .TP
66 .BR FDPIC_FUNCPTRS " (since Linux 2.6.11)"
67 User-space function pointers to signal handlers point
68 to descriptors.
69 Applies only to ARM if BINFMT_ELF_FDPIC and SuperH.
70 .TP
71 .BR MMAP_PAGE_ZERO " (since Linux 2.4.0)"
72 Map page 0 as read-only
73 (to support binaries that depend on this SVr4 behavior).
74 .TP
75 .BR READ_IMPLIES_EXEC " (since Linux 2.6.8)"
76 With this flag set,
77 .B PROT_READ
78 implies
79 .B PROT_EXEC
80 for
81 .BR mmap (2).
82 .TP
83 .BR SHORT_INODE " (since Linux 2.4.0)"
84 No effect.
85 .TP
86 .BR STICKY_TIMEOUTS " (since Linux 1.2.0)"
87 With this flag set,
88 .BR select (2),
89 .BR pselect (2),
90 and
91 .BR ppoll (2)
92 do not modify the returned timeout argument when
93 interrupted by a signal handler.
94 .TP
95 .BR UNAME26 " (since Linux 3.1)"
96 Have
97 .BR uname (2)
98 report a 2.6.(40+x) version number rather than a MAJOR.x version number.
99 Added as a stopgap measure to support broken applications that
100 could not handle the
101 kernel version-numbering switch from Linux 2.6.x to Linux 3.x.
102 .TP
103 .BR WHOLE_SECONDS " (since Linux 1.2.0)"
104 No effect.
105 .P
106 The available execution domains are:
107 .TP
108 .BR PER_BSD " (since Linux 1.2.0)"
109 BSD.
110 (No effects.)
111 .TP
112 .BR PER_HPUX " (since Linux 2.4)"
113 Support for 32-bit HP/UX.
114 This support was never complete, and was dropped so that since Linux 4.0,
115 this value has no effect.
116 .TP
117 .BR PER_IRIX32 " (since Linux 2.2)"
118 IRIX 5 32-bit.
119 Never fully functional;
120 support dropped in Linux 2.6.27.
121 Implies
122 .BR STICKY_TIMEOUTS .
123 .TP
124 .BR PER_IRIX64 " (since Linux 2.2)"
125 IRIX 6 64-bit.
126 Implies
127 .BR STICKY_TIMEOUTS ;
128 otherwise no effect.
129 .TP
130 .BR PER_IRIXN32 " (since Linux 2.2)"
131 IRIX 6 new 32-bit.
132 Implies
133 .BR STICKY_TIMEOUTS ;
134 otherwise no effect.
135 .TP
136 .BR PER_ISCR4 " (since Linux 1.2.0)"
137 Implies
138 .BR STICKY_TIMEOUTS ;
139 otherwise no effect.
140 .TP
141 .BR PER_LINUX " (since Linux 1.2.0)"
142 Linux.
143 .TP
144 .BR PER_LINUX32 " (since Linux 2.2)"
145 .BR uname (2)
146 returns the name of the 32-bit architecture in the
147 .I machine
148 field ("i686" instead of "x86_64", &c.).
149 .IP
150 Under ia64 (Itanium), processes with this personality don't have the
151 O_LARGEFILE
152 .BR open (2)
153 flag forced.
154 .IP
155 Under 64-bit ARM, setting this personality is forbidden if
156 .BR execve (2)ing
157 a 32-bit process would also be forbidden
158 (cf.\& the allow_mismatched_32bit_el0 kernel parameter and
159 .IR Documentation/arm64/asymmetric-32bit.rst ).
160 .TP
161 .BR PER_LINUX32_3GB " (since Linux 2.4)"
162 Same as
163 .BR PER_LINUX32 ,
164 but implies
165 .BR ADDR_LIMIT_3GB .
166 .TP
167 .BR PER_LINUX_32BIT " (since Linux 2.0)"
168 Same as
169 .BR PER_LINUX ,
170 but implies
171 .BR ADDR_LIMIT_32BIT .
172 .TP
173 .BR PER_LINUX_FDPIC " (since Linux 2.6.11)"
174 Same as
175 .BR PER_LINUX ,
176 but implies
177 .BR FDPIC_FUNCPTRS .
178 .TP
179 .BR PER_OSF4 " (since Linux 2.4)"
180 OSF/1 v4.
181 .\" commit 987f20a9dcce3989e48d87cff3952c095c994445
182 No effect since Linux 6.1, which removed a.out binary support.
183 Before, on alpha,
184 .\" Following is from a comment in arch/alpha/kernel/osf_sys.c
185 would clear top 32 bits of iov_len in the user's buffer for
186 compatibility with old versions of OSF/1 where iov_len
187 was defined as.
188 .IR int .
189 .TP
190 .BR PER_OSR5 " (since Linux 2.4)"
191 SCO OpenServer 5.
192 Implies
193 .B STICKY_TIMEOUTS
194 and
195 .BR WHOLE_SECONDS ;
196 otherwise no effect.
197 .TP
198 .BR PER_RISCOS " (since Linux 2.3.7; macro since Linux 2.3.13)"
199 Acorn RISC OS/Arthur (MIPS).
200 No effect.
201 .\" commit 125ec7b4e90cbae4eed5a7ff1ee479cc331dcf3c
202 Up to Linux 4.0, would set the emulation altroot to
203 .I /usr/gnemul/riscos
204 (cf.\&
205 .BR PER_SUNOS ,
206 below).
207 Before then, up to Linux 2.6.3, just Arthur emulation.
208 .TP
209 .BR PER_SCOSVR3 " (since Linux 1.2.0)"
210 SCO UNIX System V Release 3.
211 Same as
212 .BR PER_OSR5 ,
213 but also implies
214 .BR SHORT_INODE .
215 .TP
216 .BR PER_SOLARIS " (since Linux 2.4)"
217 Solaris.
218 Implies
219 .BR STICKY_TIMEOUTS ;
220 otherwise no effect.
221 .TP
222 .BR PER_SUNOS " (since Linux 2.4.0)"
223 Sun OS.
224 Same as
225 .BR PER_BSD ,
226 but implies
227 .BR STICKY_TIMEOUTS .
228 Prior to Linux 2.6.26,
229 diverted library and dynamic linker searches to
230 .IR /usr/gnemul .
231 Buggy, largely unmaintained, and almost entirely unused.
232 .TP
233 .BR PER_SVR3 " (since Linux 1.2.0)"
234 AT&T UNIX System V Release 3.
235 Implies
236 .B STICKY_TIMEOUTS
237 and
238 .BR SHORT_INODE ;
239 otherwise no effect.
240 .TP
241 .BR PER_SVR4 " (since Linux 1.2.0)"
242 AT&T UNIX System V Release 4.
243 Implies
244 .B STICKY_TIMEOUTS
245 and
246 .BR MMAP_PAGE_ZERO ;
247 otherwise no effect.
248 .TP
249 .BR PER_UW7 " (since Linux 2.4)"
250 UnixWare 7.
251 Implies
252 .B STICKY_TIMEOUTS
253 and
254 .BR MMAP_PAGE_ZERO ;
255 otherwise no effect.
256 .TP
257 .BR PER_WYSEV386 " (since Linux 1.2.0)"
258 WYSE UNIX System V/386.
259 Implies
260 .B STICKY_TIMEOUTS
261 and
262 .BR SHORT_INODE ;
263 otherwise no effect.
264 .TP
265 .BR PER_XENIX " (since Linux 1.2.0)"
266 XENIX.
267 Implies
268 .B STICKY_TIMEOUTS
269 and
270 .BR SHORT_INODE ;
271 otherwise no effect.
272 .SH RETURN VALUE
273 On success, the previous
274 .I persona
275 is returned.
276 On error, \-1 is returned, and
277 .I errno
278 is set to indicate the error.
279 .SH ERRORS
280 .TP
281 .B EINVAL
282 The kernel was unable to change the personality.
283 .SH STANDARDS
284 Linux.
285 .SH HISTORY
286 Linux 1.1.20,
287 .\" (and thus first in a stable kernel release with Linux 1.2.0)
288 glibc 2.3.
289 .\" personality wrapper first appeared in glibc 1.90,
290 .\" <sys/personality.h> was added later in glibc 2.2.91.
291 .SH SEE ALSO
292 .BR setarch (8)