File: PR_SET_SPECULATION_CTRL.2const

package info (click to toggle)
manpages 6.9.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 19,808 kB
  • sloc: sh: 503; python: 222; perl: 165; makefile: 27; lisp: 22
file content (106 lines) | stat: -rw-r--r-- 2,809 bytes parent folder | download
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
.\" Copyright 2018, Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
.\" Copyright 2018, Michael Kerrisk <mtk.manpages@gmail.com>
.\" Copyright 2024, Alejandro Colomar <alx@kernel.org>
.\"
.\" SPDX-License-Identifier: Linux-man-pages-copyleft
.\"
.TH PR_SET_SPECULATION_CTRL 2const 2024-06-01 "Linux man-pages (unreleased)"
.SH NAME
PR_SET_SPECULATION_CTRL
\-
set the state of a speculation misfeature for the calling thread
.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
.BI "int prctl(PR_SET_SPECULATION_CTRL, long " misfeature ", long " val ", 0L, 0L);"
.fi
.SH DESCRIPTION
Sets the state of the speculation misfeature specified in
.IR misfeature .
The speculation-misfeature settings are per-thread attributes.
.P
Currently,
.I misfeature
must be one of:
.TP
.B PR_SPEC_STORE_BYPASS
Set the state of the speculative store bypass misfeature.
.\" commit 9137bb27e60e554dab694eafa4cca241fa3a694f
.TP
.BR PR_SPEC_INDIRECT_BRANCH " (since Linux 4.20)"
Set the state of the indirect branch speculation misfeature.
.P
The
.I val
argument is used to hand in the control value,
which is one of the following:
.TP
.B PR_SPEC_ENABLE
The speculation feature is enabled, mitigation is disabled.
.TP
.B PR_SPEC_DISABLE
The speculation feature is disabled, mitigation is enabled.
.TP
.B PR_SPEC_FORCE_DISABLE
Same as
.BR PR_SPEC_DISABLE ,
but cannot be undone.
.\" commit 71368af9027f18fe5d1c6f372cfdff7e4bde8b48
.TP
.BR PR_SPEC_DISABLE_NOEXEC " (since Linux 5.1)"
Same as
.BR PR_SPEC_DISABLE ,
but the state will be cleared on
.BR execve (2).
Currently only supported for
.BR PR_SPEC_STORE_BYPASS .
.P
The speculation feature can also be controlled by the
.B spec_store_bypass_disable
boot parameter.
This parameter may enforce a read-only policy which will result in the
.BR prctl ()
call failing with the error
.BR ENXIO .
For further details, see the kernel source file
.IR Documentation/\:admin\-guide/\:kernel\-parameters.txt .
.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 ENODEV
The kernel or CPU does not support the requested speculation
.IR misfeature .
.TP
.B ENXIO
The control of the selected speculation misfeature is not possible.
See
.B PR_GET_SPECULATION_CTRL
for the bit fields to determine which option is available.
.TP
.B EPERM
The speculation was disabled with
.B PR_SPEC_FORCE_DISABLE
and caller tried to enable it again.
.TP
.B ERANGE
.I misfeature
is not a valid value.
.SH STANDARDS
Linux.
.SH HISTORY
Linux 4.17.
.\" commit b617cfc858161140d69cc0b5cc211996b557a1c7
.\" commit 356e4bfff2c5489e016fdb925adbf12a1e3950ee
.SH SEE ALSO
.BR prctl (2),
.BR PR_GET_SPECULATION_CTRL (2const)