Debian Codegraph @

upstream/debian-unstable/man2/PR_SET_SPECULATION_CTRL.2const

raw
1 .\" Copyright 2018, Konrad Rzeszutek Wilk <[email protected]>
2 .\" Copyright 2018, Michael Kerrisk <[email protected]>
3 .\" Copyright, the authors of the Linux man-pages project
4 .\"
5 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
6 .\"
7 .TH PR_SET_SPECULATION_CTRL 2const 2026-02-08 "Linux man-pages 6.18"
8 .SH NAME
9 PR_SET_SPECULATION_CTRL
10 \-
11 set the state of a speculation misfeature for the calling thread
12 .SH LIBRARY
13 Standard C library
14 .RI ( libc ,\~ \-lc )
15 .SH SYNOPSIS
16 .nf
17 .BR "#include <linux/prctl.h>" " /* Definition of " PR_* " constants */"
18 .B #include <sys/prctl.h>
19 .P
20 .BI "int prctl(PR_SET_SPECULATION_CTRL, long " misfeature ", long " val ", 0L, 0L);"
21 .fi
22 .SH DESCRIPTION
23 Sets the state of the speculation misfeature specified in
24 .IR misfeature .
25 The speculation-misfeature settings are per-thread attributes.
26 .P
27 Currently,
28 .I misfeature
29 must be one of:
30 .TP
31 .B PR_SPEC_STORE_BYPASS
32 Set the state of the speculative store bypass misfeature.
33 .\" commit 9137bb27e60e554dab694eafa4cca241fa3a694f
34 .TP
35 .BR PR_SPEC_INDIRECT_BRANCH " (since Linux 4.20)"
36 Set the state of the indirect branch speculation misfeature.
37 .P
38 The
39 .I val
40 argument is used to hand in the control value,
41 which is one of the following:
42 .TP
43 .B PR_SPEC_ENABLE
44 The speculation feature is enabled, mitigation is disabled.
45 .TP
46 .B PR_SPEC_DISABLE
47 The speculation feature is disabled, mitigation is enabled.
48 .TP
49 .B PR_SPEC_FORCE_DISABLE
50 Same as
51 .BR PR_SPEC_DISABLE ,
52 but cannot be undone.
53 .\" commit 71368af9027f18fe5d1c6f372cfdff7e4bde8b48
54 .TP
55 .BR PR_SPEC_DISABLE_NOEXEC " (since Linux 5.1)"
56 Same as
57 .BR PR_SPEC_DISABLE ,
58 but the state will be cleared on
59 .BR execve (2).
60 Currently only supported for
61 .BR PR_SPEC_STORE_BYPASS .
62 .P
63 The speculation feature can also be controlled by the
64 .B spec_store_bypass_disable
65 boot parameter.
66 This parameter may enforce a read-only policy which will result in the
67 .BR prctl ()
68 call failing with the error
69 .BR ENXIO .
70 For further details, see the kernel source file
71 .IR Documentation/\:admin\-guide/\:kernel\-parameters.rst .
72 .SH RETURN VALUE
73 On success,
74 0 is returned.
75 On error, \-1 is returned, and
76 .I errno
77 is set to indicate the error.
78 .SH ERRORS
79 .TP
80 .B ENODEV
81 The kernel or CPU does not support the requested speculation
82 .IR misfeature .
83 .TP
84 .B ENXIO
85 The control of the selected speculation misfeature is not possible.
86 See
87 .B PR_GET_SPECULATION_CTRL
88 for the bit fields to determine which option is available.
89 .TP
90 .B EPERM
91 The speculation was disabled with
92 .B PR_SPEC_FORCE_DISABLE
93 and caller tried to enable it again.
94 .TP
95 .B ERANGE
96 .I misfeature
97 is not a valid value.
98 .SH STANDARDS
99 Linux.
100 .SH HISTORY
101 Linux 4.17.
102 .\" commit b617cfc858161140d69cc0b5cc211996b557a1c7
103 .\" commit 356e4bfff2c5489e016fdb925adbf12a1e3950ee
104 .SH SEE ALSO
105 .BR prctl (2),
106 .BR PR_GET_SPECULATION_CTRL (2const)