.\" Copyright (C) 1995, Thomas K. Dyas <tdyas@eden.rutgers.edu>
+.\" and Copyright (C) 2016, Michael Kerrisk <mtk.manpages@gmail.com>
.\"
+.\" %%%LICENSE_START(VERBATIM)
.\" Permission is granted to make and distribute verbatim copies of this
.\" manual provided the copyright notice and this permission notice are
.\" preserved on all copies.
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
+.\" %%%LICENSE_END
.\"
.\" Created Sat Aug 21 1995 Thomas K. Dyas <tdyas@eden.rutgers.edu>
.\"
.\" changed prototype, documented 0xffffffff, aeb, 030101
.\" Modified 2004-11-03 patch from Martin Schulze <joey@infodrom.org>
.\"
-.TH PERSONALITY 2 2003-01-01 "Linux" "Linux Programmer's Manual"
+.TH PERSONALITY 2 2017-09-15 "Linux" "Linux Programmer's Manual"
.SH NAME
personality \- set the process execution domain
.SH SYNOPSIS
.B #include <sys/personality.h>
-.sp
+.PP
.BI "int personality(unsigned long " persona );
.SH DESCRIPTION
Linux supports different execution domains, or personalities, for each
The execution domain system allows
Linux to provide limited support for binaries compiled under other
UNIX-like operating systems.
-
-This function will return the current
-.BR personality ()
-when
-.I persona
-equals 0xffffffff.
-Otherwise, it will make the execution domain
-referenced by
+.PP
+If
.I persona
-the new execution domain of the calling process.
-.SH "RETURN VALUE"
+is not
+0xffffffff, then
+.BR personality ()
+sets the caller's execution domain to the value specified by
+.IR persona .
+Specifying
+.IR persona
+as 0xffffffff provides a way of retrieving
+the current persona without changing it.
+.PP
+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 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.
+.TP
+.BR FDPIC_FUNCPTRS " (since Linux 2.6.11)"
+User-space function pointers to signal handlers point
+(on certain architectures) to descriptors.
+.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,
+.BR PROT_READ
+implies
+.BR PROT_EXEC
+for
+.BR mmap (2).
+.TP
+.BR SHORT_INODE " (since Linux 2.4.0)"
+No effects(?).
+.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+ version number rather than a 3.x version number.
+Added as a stopgap measure to support broken applications that
+could not handle the kernel version-numbering switch from 2.6.x to 3.x.
+.TP
+.BR WHOLE_SECONDS " (since Linux 1.2.0)"
+No effects(?).
+.PP
+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 effects.
+.TP
+.BR PER_IRIXN32 " (since Linux 2.2)"
+IRIX 6 new 32-bit.
+Implies
+.BR STICKY_TIMEOUTS ;
+otherwise no effects.
+.TP
+.BR PER_ISCR4 " (since Linux 1.2.0)"
+Implies
+.BR STICKY_TIMEOUTS ;
+otherwise no effects.
+.TP
+.BR PER_LINUX " (since Linux 1.2.0)"
+Linux.
+.TP
+.BR PER_LINUX32 " (since Linux 2.2)"
+[To be documented.]
+.TP
+.BR PER_LINUX32_3GB " (since Linux 2.4)"
+Implies
+.BR ADDR_LIMIT_3GB .
+.TP
+.BR PER_LINUX_32BIT " (since Linux 2.0)"
+Implies
+.BR ADDR_LIMIT_32BIT .
+.TP
+.BR PER_LINUX_FDPIC " (since Linux 2.6.11)"
+Implies
+.BR FDPIC_FUNCPTRS .
+.TP
+.BR PER_OSF4 " (since Linux 2.4)"
+OSF/1 v4.
+On alpha,
+.\" Following is from a comment in arch/alpha/kernel/osf_sys.c
+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)"
+Implies
+.BR STICKY_TIMEOUTS
+and
+.BR WHOLE_SECONDS ;
+otherwise no effects.
+.TP
+.BR PER_RISCOS " (since Linux 2.2)"
+[To be documented.]
+.TP
+.BR PER_SCOSVR3 " (since Linux 1.2.0)"
+Implies
+.BR STICKY_TIMEOUTS ,
+.BR WHOLE_SECONDS ,
+and
+.BR SHORT_INODE ;
+otherwise no effects.
+.TP
+.BR PER_SOLARIS " (since Linux 2.4)"
+Implies
+.BR STICKY_TIMEOUTS ;
+otherwise no effects.
+.TP
+.BR PER_SUNOS " (since Linux 2.4.0)"
+Implies
+.BR STICKY_TIMEOUTS .
+Divert library and dynamic linker searches to
+.IR /usr/gnemul .
+Buggy, largely unmaintained, and almost entirely unused;
+support was removed in Linux 2.6.26.
+.TP
+.BR PER_SVR3 " (since Linux 1.2.0)"
+Implies
+.BR STICKY_TIMEOUTS
+and
+.BR SHORT_INODE ;
+otherwise no effects.
+.TP
+.BR PER_SVR4 " (since Linux 1.2.0)"
+Implies
+.BR STICKY_TIMEOUTS
+and
+.BR MMAP_PAGE_ZERO ;
+otherwise no effects.
+.TP
+.BR PER_UW7 " (since Linux 2.4)"
+Implies
+.BR STICKY_TIMEOUTS
+and
+.BR MMAP_PAGE_ZERO ;
+otherwise no effects.
+.TP
+.BR PER_WYSEV386 " (since Linux 1.2.0)"
+Implies
+.BR STICKY_TIMEOUTS
+and
+.BR SHORT_INODE ;
+otherwise no effects.
+.TP
+.BR PER_XENIX " (since Linux 1.2.0)"
+Implies
+.BR STICKY_TIMEOUTS
+and
+.BR SHORT_INODE ;
+otherwise no effects.
+.SH RETURN VALUE
On success, the previous
.I persona
is returned.
.TP
.B EINVAL
The kernel was unable to change the personality.
-.SH "CONFORMING TO"
+.SH VERSIONS
+This system call first appeared in Linux 1.1.20
+(and thus first in a stable kernel release with Linux 1.2.0);
+library support was added in glibc 2.3.
+.\" personality wrapper first appeared in glibc 1.90,
+.\" <sys/personality.h> was added later in 2.2.91.
+.SH CONFORMING TO
.BR personality ()
is Linux-specific and should not be used in programs intended to
be portable.
+.SH SEE ALSO
+.BR setarch (8)