Debian Codegraph @

upstream/debian-trixie/man2/personality.2

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