File: PR_MPX_ENABLE_MANAGEMENT.2const

package info (click to toggle)
manpages 6.15-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 20,184 kB
  • sloc: sh: 575; python: 222; perl: 190; makefile: 29; lisp: 22
file content (119 lines) | stat: -rw-r--r-- 3,577 bytes parent folder | download | duplicates (3)
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
.\" Copyright, the authors of the Linux man-pages project
.\"
.\" SPDX-License-Identifier: Linux-man-pages-copyleft
.\"
.TH PR_MPX_ENABLE_MANAGEMENT 2const 2025-06-02 "Linux man-pages (unreleased)"
.SH NAME
PR_MPX_ENABLE_MANAGEMENT,
PR_MPX_DISABLE_MANAGEMENT
\-
enable or disable kernel management of Memory Protection eXtensions (MPX)
.SH LIBRARY
Standard C library
.RI ( libc ,\~ \-lc )
.SH SYNOPSIS
.nf
.BR "#include <linux/prctl.h>" "  /* Definition of " PR_* " constants */"
.B #include <sys/prctl.h>
.P
.B [[deprecated]] int prctl(PR_MPX_ENABLE_MANAGEMENT, 0L, 0L, 0L, 0L);
.B [[deprecated]] int prctl(PR_MPX_DISABLE_MANAGEMENT, 0L, 0L, 0L, 0L);
.fi
.SH DESCRIPTION
Enable or disable kernel management of Memory Protection eXtensions (MPX)
bounds tables.
.P
MPX is a hardware-assisted mechanism for
performing bounds checking on pointers.
It consists of a set of registers storing bounds information
and a set of special instruction prefixes that tell the CPU
on which instructions it should do bounds enforcement.
There is a limited number of these registers and
when there are more pointers than registers,
their contents must be "spilled" into a set of tables.
These tables are called "bounds tables" and the MPX
.BR prctl ()
operations control
whether the kernel manages their allocation and freeing.
.P
When management is enabled,
the kernel will take over
allocation and freeing of the bounds tables.
It does this by trapping the #BR exceptions that result
at first use of missing bounds tables and
instead of delivering the exception to user space,
it allocates the table and populates the bounds directory
with the location of the new table.
For freeing,
the kernel checks to see if bounds tables are
present for memory which is not allocated,
and frees them if so.
.P
Before enabling MPX management using
.BR PR_MPX_ENABLE_MANAGEMENT ,
the application must first have allocated
a user-space buffer for the bounds directory and
placed the location of that directory in the
.I bndcfgu
register.
.P
These calls fail if the CPU or kernel does not support MPX.
Kernel support for MPX is enabled via the
.B CONFIG_X86_INTEL_MPX
configuration option.
You can check whether the CPU supports MPX by looking for the
.I mpx
CPUID bit, like with the following command:
.P
.in +4n
.EX
cat /proc/cpuinfo | grep \[aq] mpx \[aq]
.EE
.in
.P
A thread may not switch in or out of long (64-bit) mode
while MPX is enabled.
.P
All threads in a process are affected by these calls.
.P
The child of a
.BR fork (2)
inherits the state of MPX management.
During
.BR execve (2),
MPX management is reset to a state as if
.B PR_MPX_DISABLE_MANAGEMENT
had been called.
.SH RETURN VALUE
On success,
0 is returned.
On error, \-1 is returned, and
.I errno
is set to indicate the error.
.SH ERRORS
.TP
.B ENXIO
The kernel or the CPU does not support MPX management.
Check that the kernel and processor have MPX support.
.SH STANDARDS
None.
.SH HISTORY
Linux 3.19.
Removed in Linux 5.4.
Only on x86.
.\" commit fe3d197f84319d3bce379a9c0dc17b1f48ad358c
.\" See also http://lwn.net/Articles/582712/
.\" See also https://gcc.gnu.org/wiki/Intel%20MPX%20support%20in%20the%20GCC%20compiler
.P
.\" commit f240652b6032b48ad7fa35c5e701cc4c8d697c0b
.\" See also https://lkml.kernel.org/r/20190705175321.DB42F0AD@viggo.jf.intel.com
Due to a lack of toolchain support,
.B PR_MPX_ENABLE_MANAGEMENT
and
.B PR_MPX_DISABLE_MANAGEMENT
are not supported in Linux 5.4 and later.
.SH SEE ALSO
.BR prctl (2)
.P
For further information on Intel MPX, see the kernel source file
.IR Documentation/\:x86/\:intel_mpx.txt .