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
|
.\" 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_GET_SPECULATION_CTRL 2const 2024-06-01 "Linux man-pages (unreleased)"
.SH NAME
PR_GET_SPECULATION_CTRL
\-
get 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_GET_SPECULATION_CTRL, long " misfeature ", 0L, 0L, 0L);"
.fi
.SH DESCRIPTION
Return
the state of the speculation misfeature specified in
.IR misfeature .
.P
Currently,
.I misfeature
must be one of:
.TP
.B PR_SPEC_STORE_BYPASS
Get the state of the speculative store bypass misfeature.
.\" commit 9137bb27e60e554dab694eafa4cca241fa3a694f
.TP
.BR PR_SPEC_INDIRECT_BRANCH " (since Linux 4.20)"
Get the state of the indirect branch speculation misfeature.
.P
The return value uses bits 0-4 with the following meaning:
.TP
.B PR_SPEC_PRCTL
Mitigation can be controlled per thread by
.BR PR_SET_SPECULATION_CTRL (2const).
.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
.B PR_SPEC_DISABLE
but cannot be undone.
.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).
.P
If all bits are 0,
then the CPU is not affected by the speculation misfeature.
.P
If
.B PR_SPEC_PRCTL
is set, then per-thread control of the mitigation is available.
If not set,
.BR PR_SET_SPECULATION_CTRL (2const)
for the speculation misfeature will fail.
.SH RETURN VALUE
On success,
.B PR_GET_SPECULATION_CTRL
returns the nonnegative value described above.
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 .
.SH STANDARDS
Linux.
.SH HISTORY
Linux 4.17.
.SH SEE ALSO
.BR prctl (2),
.BR PR_SET_SPECULATION_CTRL (2const)
|