personality(2) System Calls Manual personality(2)

personality - set the process execution domain

Standard C library (libc, -lc)

#include <sys/personality.h>
int personality(unsigned long persona);

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.

If persona is not 0xffffffff, then personality() sets the caller's execution domain to the value specified by persona. Specifying persona as 0xffffffff provides a way of retrieving the current persona without changing it.

A list of the available execution domains can be found in <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:

With this flag set, provide legacy virtual address space layout.
With this flag set, disable address-space-layout randomization.
Limit the address space to 32 bits.
With this flag set, use 0xc0000000 as the offset at which to search a virtual memory chunk on mmap(2); otherwise use 0xffffe000. Applies to 32-bit x86 processes only.
User-space function pointers to signal handlers point to descriptors. Applies only to ARM if BINFMT_ELF_FDPIC and SuperH.
Map page 0 as read-only (to support binaries that depend on this SVr4 behavior).
With this flag set, PROT_READ implies PROT_EXEC for mmap(2).
No effect.
With this flag set, select(2), pselect(2), and ppoll(2) do not modify the returned timeout argument when interrupted by a signal handler.
Have 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.
No effect.

The available execution domains are:

BSD. (No effects.)
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.
IRIX 5 32-bit. Never fully functional; support dropped in Linux 2.6.27. Implies STICKY_TIMEOUTS.
IRIX 6 64-bit. Implies STICKY_TIMEOUTS; otherwise no effect.
IRIX 6 new 32-bit. Implies STICKY_TIMEOUTS; otherwise no effect.
Implies STICKY_TIMEOUTS; otherwise no effect.
uname(2) returns the name of the 32-bit architecture in the machine field ("i686" instead of "x86_64", &c.).
Under ia64 (Itanium), processes with this personality don't have the O_LARGEFILE open(2) flag forced.
Under 64-bit ARM, setting this personality is forbidden if execve(2)ing a 32-bit process would also be forbidden (cf. the allow_mismatched_32bit_el0 kernel parameter and Documentation/arm64/asymmetric-32bit.rst).
Same as PER_LINUX32, but implies ADDR_LIMIT_3GB.
Same as PER_LINUX, but implies ADDR_LIMIT_32BIT.
Same as PER_LINUX, but implies FDPIC_FUNCPTRS.
OSF/1 v4. No effect since Linux 6.1, which removed a.out binary support. Before, on alpha, 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. int.
SCO OpenServer 5. Implies STICKY_TIMEOUTS and WHOLE_SECONDS; otherwise no effect.
Acorn RISC OS/Arthur (MIPS). No effect. Up to Linux v4.0, would set the emulation altroot to /usr/gnemul/riscos (cf. PER_SUNOS, below). Before then, up to Linux 2.6.3, just Arthur emulation.
SCO UNIX System V Release 3. Same as PER_OSR5, but also implies SHORT_INODE.
Solaris. Implies STICKY_TIMEOUTS; otherwise no effect.
Sun OS. Same as PER_BSD, but implies STICKY_TIMEOUTS. Prior to Linux 2.6.26, diverted library and dynamic linker searches to /usr/gnemul. Buggy, largely unmaintained, and almost entirely unused.
AT&T UNIX System V Release 3. Implies STICKY_TIMEOUTS and SHORT_INODE; otherwise no effect.
AT&T UNIX System V Release 4. Implies STICKY_TIMEOUTS and MMAP_PAGE_ZERO; otherwise no effect.
UnixWare 7. Implies STICKY_TIMEOUTS and MMAP_PAGE_ZERO; otherwise no effect.
WYSE UNIX System V/386. Implies STICKY_TIMEOUTS and SHORT_INODE; otherwise no effect.
XENIX. Implies STICKY_TIMEOUTS and SHORT_INODE; otherwise no effect.

On success, the previous persona is returned. On error, -1 is returned, and errno is set to indicate the error.

The kernel was unable to change the personality.


Linux 1.1.20, glibc 2.3.


2023-04-29 Linux man-pages 6.05.01