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