]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man2/personality.2
df50806358eba76deed566b93a570d961d881135
[thirdparty/man-pages.git] / man2 / personality.2
1 .\" Copyright (C) 1995, Thomas K. Dyas <tdyas@eden.rutgers.edu>
2 .\" and Copyright (C) 2016, Michael Kerrisk <mtk.manpages@gmail.com>
3 .\"
4 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
5 .\"
6 .\" Created Sat Aug 21 1995 Thomas K. Dyas <tdyas@eden.rutgers.edu>
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 <joey@infodrom.org>
12 .\"
13 .TH PERSONALITY 2 2021-03-22 "Linux" "Linux Programmer's Manual"
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 .PP
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 .PP
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 .IR persona
43 as 0xffffffff provides a way of retrieving
44 the current persona without changing it.
45 .PP
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 .TP
71 .BR FDPIC_FUNCPTRS " (since Linux 2.6.11)"
72 User-space function pointers to signal handlers point
73 (on certain architectures) to descriptors.
74 .TP
75 .BR MMAP_PAGE_ZERO " (since Linux 2.4.0)"
76 Map page 0 as read-only
77 (to support binaries that depend on this SVr4 behavior).
78 .TP
79 .BR READ_IMPLIES_EXEC " (since Linux 2.6.8)"
80 With this flag set,
81 .BR PROT_READ
82 implies
83 .BR PROT_EXEC
84 for
85 .BR mmap (2).
86 .TP
87 .BR SHORT_INODE " (since Linux 2.4.0)"
88 No effects(?).
89 .TP
90 .BR STICKY_TIMEOUTS " (since Linux 1.2.0)"
91 With this flag set,
92 .BR select (2),
93 .BR pselect (2),
94 and
95 .BR ppoll (2)
96 do not modify the returned timeout argument when
97 interrupted by a signal handler.
98 .TP
99 .BR UNAME26 " (since Linux 3.1)"
100 Have
101 .BR uname (2)
102 report a 2.6.40+ version number rather than a 3.x version number.
103 Added as a stopgap measure to support broken applications that
104 could not handle the kernel version-numbering switch from 2.6.x to 3.x.
105 .TP
106 .BR WHOLE_SECONDS " (since Linux 1.2.0)"
107 No effect.
108 .PP
109 The available execution domains are:
110 .TP
111 .BR PER_BSD " (since Linux 1.2.0)"
112 BSD. (No effects.)
113 .TP
114 .BR PER_HPUX " (since Linux 2.4)"
115 Support for 32-bit HP/UX.
116 This support was never complete, and was dropped so that since Linux 4.0,
117 this value has no effect.
118 .TP
119 .BR PER_IRIX32 " (since Linux 2.2)"
120 IRIX 5 32-bit.
121 Never fully functional; support dropped in Linux 2.6.27.
122 Implies
123 .BR STICKY_TIMEOUTS .
124 .TP
125 .BR PER_IRIX64 " (since Linux 2.2)"
126 IRIX 6 64-bit.
127 Implies
128 .BR STICKY_TIMEOUTS ;
129 otherwise no effects.
130 .TP
131 .BR PER_IRIXN32 " (since Linux 2.2)"
132 IRIX 6 new 32-bit.
133 Implies
134 .BR STICKY_TIMEOUTS ;
135 otherwise no effects.
136 .TP
137 .BR PER_ISCR4 " (since Linux 1.2.0)"
138 Implies
139 .BR STICKY_TIMEOUTS ;
140 otherwise no effects.
141 .TP
142 .BR PER_LINUX " (since Linux 1.2.0)"
143 Linux.
144 .TP
145 .BR PER_LINUX32 " (since Linux 2.2)"
146 [To be documented.]
147 .TP
148 .BR PER_LINUX32_3GB " (since Linux 2.4)"
149 Implies
150 .BR ADDR_LIMIT_3GB .
151 .TP
152 .BR PER_LINUX_32BIT " (since Linux 2.0)"
153 Implies
154 .BR ADDR_LIMIT_32BIT .
155 .TP
156 .BR PER_LINUX_FDPIC " (since Linux 2.6.11)"
157 Implies
158 .BR FDPIC_FUNCPTRS .
159 .TP
160 .BR PER_OSF4 " (since Linux 2.4)"
161 OSF/1 v4.
162 On alpha,
163 .\" Following is from a comment in arch/alpha/kernel/osf_sys.c
164 clear top 32 bits of iov_len in the user's buffer for
165 compatibility with old versions of OSF/1 where iov_len
166 was defined as.
167 .IR int .
168 .TP
169 .BR PER_OSR5 " (since Linux 2.4)"
170 Implies
171 .BR STICKY_TIMEOUTS
172 and
173 .BR WHOLE_SECONDS ;
174 otherwise no effects.
175 .TP
176 .BR PER_RISCOS " (since Linux 2.2)"
177 [To be documented.]
178 .TP
179 .BR PER_SCOSVR3 " (since Linux 1.2.0)"
180 Implies
181 .BR STICKY_TIMEOUTS ,
182 .BR WHOLE_SECONDS ,
183 and
184 .BR SHORT_INODE ;
185 otherwise no effects.
186 .TP
187 .BR PER_SOLARIS " (since Linux 2.4)"
188 Implies
189 .BR STICKY_TIMEOUTS ;
190 otherwise no effects.
191 .TP
192 .BR PER_SUNOS " (since Linux 2.4.0)"
193 Implies
194 .BR STICKY_TIMEOUTS .
195 Divert library and dynamic linker searches to
196 .IR /usr/gnemul .
197 Buggy, largely unmaintained, and almost entirely unused;
198 support was removed in Linux 2.6.26.
199 .TP
200 .BR PER_SVR3 " (since Linux 1.2.0)"
201 Implies
202 .BR STICKY_TIMEOUTS
203 and
204 .BR SHORT_INODE ;
205 otherwise no effects.
206 .TP
207 .BR PER_SVR4 " (since Linux 1.2.0)"
208 Implies
209 .BR STICKY_TIMEOUTS
210 and
211 .BR MMAP_PAGE_ZERO ;
212 otherwise no effects.
213 .TP
214 .BR PER_UW7 " (since Linux 2.4)"
215 Implies
216 .BR STICKY_TIMEOUTS
217 and
218 .BR MMAP_PAGE_ZERO ;
219 otherwise no effects.
220 .TP
221 .BR PER_WYSEV386 " (since Linux 1.2.0)"
222 Implies
223 .BR STICKY_TIMEOUTS
224 and
225 .BR SHORT_INODE ;
226 otherwise no effects.
227 .TP
228 .BR PER_XENIX " (since Linux 1.2.0)"
229 Implies
230 .BR STICKY_TIMEOUTS
231 and
232 .BR SHORT_INODE ;
233 otherwise no effects.
234 .SH RETURN VALUE
235 On success, the previous
236 .I persona
237 is returned.
238 On error, \-1 is returned, and
239 .I errno
240 is set to indicate the error.
241 .SH ERRORS
242 .TP
243 .B EINVAL
244 The kernel was unable to change the personality.
245 .SH VERSIONS
246 This system call first appeared in Linux 1.1.20
247 (and thus first in a stable kernel release with Linux 1.2.0);
248 library support was added in glibc 2.3.
249 .\" personality wrapper first appeared in glibc 1.90,
250 .\" <sys/personality.h> was added later in 2.2.91.
251 .SH CONFORMING TO
252 .BR personality ()
253 is Linux-specific and should not be used in programs intended to
254 be portable.
255 .SH SEE ALSO
256 .BR setarch (8)