Add the PR_SPEC_INDIRECT_BRANCH option for the PR_GET_SPECULATION_CTRL and PR_SET_SPECULATION_CTRL prctls to allow fine grained per task control of indirect branch speculation via STIBP and IBPB. Invocations: Check indirect branch speculation status with - prctl(PR_GET_SPECULATION_CTRL, PR_SPEC_INDIRECT_BRANCH, 0, 0, 0); Enable indirect branch speculation with - prctl(PR_SET_SPECULATION_CTRL, PR_SPEC_INDIRECT_BRANCH, PR_SPEC_ENABLE, 0, 0); Disable indirect branch speculation with - prctl(PR_SET_SPECULATION_CTRL, PR_SPEC_INDIRECT_BRANCH, PR_SPEC_DISABLE, 0, 0); Force disable indirect branch speculation with - prctl(PR_SET_SPECULATION_CTRL, PR_SPEC_INDIRECT_BRANCH, PR_SPEC_FORCE_DISABLE, 0, 0); See Documentation/userspace-api/spec_ctrl.rst.
Showing the changes to include/uapi/linux (1 of 7 files). Show all
Unified · Split
| @@ -212,6 +212,7 @@ struct prctl_mm_map { · 211 unmodified lines | |||
| 212 | #define PR_SET_SPECULATION_CTRL 53 | 212 | #define PR_SET_SPECULATION_CTRL 53 |
| 213 | /* Speculation control variants */ | 213 | /* Speculation control variants */ |
| 214 | # define PR_SPEC_STORE_BYPASS 0 | 214 | # define PR_SPEC_STORE_BYPASS 0 |
| 215 | # define PR_SPEC_INDIRECT_BRANCH 1 | ||
| 215 | /* Return and control values for PR_SET/GET_SPECULATION_CTRL */ | 216 | /* Return and control values for PR_SET/GET_SPECULATION_CTRL */ |
| 216 | # define PR_SPEC_NOT_AFFECTED 0 | 217 | # define PR_SPEC_NOT_AFFECTED 0 |
| 217 | # define PR_SPEC_PRCTL (1UL << 0) | 218 | # define PR_SPEC_PRCTL (1UL << 0) |