Debian Codegraph @

upstream/debian-unstable/man2/PR_GET_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_GET_SPECULATION_CTRL 2const 2026-02-08 "Linux man-pages 6.18"
8 .SH NAME
9 PR_GET_SPECULATION_CTRL
10 \-
11 get 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_GET_SPECULATION_CTRL, long " misfeature ", 0L, 0L, 0L);"
21 .fi
22 .SH DESCRIPTION
23 Return
24 the state of the speculation misfeature specified in
25 .IR misfeature .
26 .P
27 Currently,
28 .I misfeature
29 must be one of:
30 .TP
31 .B PR_SPEC_STORE_BYPASS
32 Get the state of the speculative store bypass misfeature.
33 .\" commit 9137bb27e60e554dab694eafa4cca241fa3a694f
34 .TP
35 .BR PR_SPEC_INDIRECT_BRANCH " (since Linux 4.20)"
36 Get the state of the indirect branch speculation misfeature.
37 .P
38 The return value uses bits 0-4 with the following meaning:
39 .TP
40 .B PR_SPEC_PRCTL
41 Mitigation can be controlled per thread by
42 .BR PR_SET_SPECULATION_CTRL (2const).
43 .TP
44 .B PR_SPEC_ENABLE
45 The speculation feature is enabled, mitigation is disabled.
46 .TP
47 .B PR_SPEC_DISABLE
48 The speculation feature is disabled, mitigation is enabled.
49 .TP
50 .B PR_SPEC_FORCE_DISABLE
51 Same as
52 .B PR_SPEC_DISABLE
53 but cannot be undone.
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 .P
61 If all bits are 0,
62 then the CPU is not affected by the speculation misfeature.
63 .P
64 If
65 .B PR_SPEC_PRCTL
66 is set, then per-thread control of the mitigation is available.
67 If not set,
68 .BR PR_SET_SPECULATION_CTRL (2const)
69 for the speculation misfeature will fail.
70 .SH RETURN VALUE
71 On success,
72 .B PR_GET_SPECULATION_CTRL
73 returns the nonnegative value described above.
74 On error, \-1 is returned, and
75 .I errno
76 is set to indicate the error.
77 .SH ERRORS
78 .TP
79 .B ENODEV
80 The kernel or CPU does not support the requested speculation
81 .IR misfeature .
82 .SH STANDARDS
83 Linux.
84 .SH HISTORY
85 Linux 4.17.
86 .SH SEE ALSO
87 .BR prctl (2),
88 .BR PR_SET_SPECULATION_CTRL (2const)