Skip to contentSkip to conversation

Against SSB v15

PATCH New [email protected] 1 participant 1 message May 11, 2018

lore
Share & tools
lore
#0 lore raw

cover Against SSB v15

It is darn hard to read manpages in their raw format so I am including a diff here off the end result of the patch.

new renamed from old +56 -4
@@ -381,6 +381,47 @@
        PR_GET_SECUREBITS (since Linux 2.6.26)
               Return (as the function result) the "securebits" flags of the calling thread.  See capabilities(7).
 
+       PR_GET_SPECULATION_CTRL
+              Returns  the state of the speculation misfeature which is selected with the value of arg2, which must be PR_SPEC_STORE_BYPASS.  Otherwise the
+              call fails with the error ENODEV.  The return value uses bit 0-3 with the following meaning:
+
+              PR_SPEC_PRCTL
+                     Mitigation can be controlled per task by PR_SET_SPECULATION_CTRL
+
+              PR_SPEC_ENABLE
+                     The speculation feature is enabled, mitigation is disabled.
+
+              PR_SPEC_DISABLE
+                     The speculation feature is disabled, mitigation is enabled
+
+              PR_SPEC_FORCE_DISABLE
+                     Same as PR_SPEC_DISABLE but cannot be undone.
+
+              If all bits are 0 then the CPU is not affected by the speculation misfeature.
+
+              If PR_SPEC_PRCTL is set, then the per task control of the mitigation is available. If not set, prctl() for the  speculation  misfeature  will
+              fail.  In the above operation arg3 , arg4, and arg5 must be specified as 0, otherwise the call fails with the error EINVAL.
+
+       PR_SET_SPECULATION_CTRL
+              Sets  the  state  of  the speculation misfeature which is selected with the value of arg2, which must be PR_SPEC_STORE_BYPASS.  Otherwise the
+              call fails with the error ENODEV.  This control is per task. The arg3 is used to hand in the control value, which can be either:
+
+              PR_SPEC_ENABLE
+                     The speculation feature is enabled, mitigation is disabled.
+
+              PR_SPEC_DISABLE
+                     The speculation feature is disabled, mitigation is enabled
+
+              PR_SPEC_FORCE_DISABLE
+                     Same as PR_SPEC_DISABLE but cannot be undone. A subsequent prctl(..., PR_SPEC_ENABLE) will fail with EPERM.
+
+              Any other value in arg3 will result in the call failure with the error ERANGE.  Also arg4, and arg5 must be specified  as  0,  otherwise  the
+              call fails with ethe rror EINVAL.
+
+              Furtheremore  this  speculation feature can also be controlled by the boot-time parameter of spec_store_bypass_disable= Which could enforce a
+              read-only policy which will result in the call failure with the error ENXIO.  Consult the PR_GET_SPECULATION_CTRL for details on the possible
+              enumerations.
+
        PR_SET_THP_DISABLE (since Linux 3.15)
               Set the state of the "THP disable" flag for the calling thread.  If arg2 has a nonzero value, the flag is set, otherwise it is cleared.  Set
               ting this flag provides a method for disabling transparent huge pages for jobs where the code cannot be modified, and  using  a  malloc  hook
@@ -521,34 +562,45 @@
        EINVAL option  is  PR_CAP_AMBIENT  and an unused argument (arg4, arg5, or, in the case of PR_CAP_AMBIENT_CLEAR_ALL, arg3) is nonzero; or arg2 has an
               invalid value; or arg2 is PR_CAP_AMBIENT_LOWER, PR_CAP_AMBIENT_RAISE, or PR_CAP_AMBIENT_IS_SET and arg3 does not specify a valid capability.
 
+       ENODEV option was PR_SET_SPECULATION_CTRL the kernel or CPU does not support the requested speculation misfeature.
+
        ENXIO  option was PR_MPX_ENABLE_MANAGEMENT or PR_MPX_DISABLE_MANAGEMENT and the kernel or the CPU does not support MPX management.  Check  that  the
               kernel and processor have MPX support.
 
+       ENXIO  option  was  PR_SET_SPECULATION_CTRL  implies  that  the control of the selected speculation misfeature is not possible.  See PR_GET_SPECULA
+              TION_CTRL for the bit fields to determine which option is available.
+
        EOPNOTSUPP
               option is PR_SET_FP_MODE and arg2 has an invalid or unsupported value.
 
-       EPERM  option  is  PR_SET_SECUREBITS,  and the caller does not have the CAP_SETPCAP capability, or tried to unset a "locked" flag, or tried to set a
+       EPERM  option is PR_SET_SECUREBITS, and the caller does not have the CAP_SETPCAP capability, or tried to unset a "locked" flag, or tried  to  set  a
               flag whose corresponding locked flag was set (see capabilities(7)).
 
+       EPERM  option is PR_SET_SPECULATION_CTRL wherein the speculation was disabled with PR_SPEC_FORCE_DISABLE and caller tried to enable it again.
+
        EPERM  option is PR_SET_KEEPCAPS, and the caller's SECBIT_KEEP_CAPS_LOCKED flag is set (see capabilities(7)).
 
        EPERM  option is PR_CAPBSET_DROP, and the caller does not have the CAP_SETPCAP capability.
 
        EPERM  option is PR_SET_MM, and the caller does not have the CAP_SYS_RESOURCE capability.
 
-       EPERM  option is PR_CAP_AMBIENT and arg2 is PR_CAP_AMBIENT_RAISE, but either the capability specified in arg3 is not present in the  process's per
+       EPERM  option  is  PR_CAP_AMBIENT and arg2 is PR_CAP_AMBIENT_RAISE, but either the capability specified in arg3 is not present in the process's per
               mitted and inheritable capability sets, or the PR_CAP_AMBIENT_LOWER securebit has been set.
 
+       ERANGE option was PR_SET_SPECULATION_CTRL and arg3 is incorrect - neither PR_SPEC_ENABLE nor PR_SPEC_DISABLE nor PR_SPEC_FORCE_DISABLE was choosen
+
+       EINVAL option was PR_GET_SPECULATION_CTRL or PR_SET_SPECULATION_CTRL and unused arguments to prctl() are not 0.
+
 VERSIONS
        The prctl() system call was introduced in Linux 2.1.57.
 
 CONFORMING TO
-       This  call  is Linux-specific.  IRIX has a prctl() system call (also introduced in Linux 2.1.44 as irix_prctl on the MIPS architecture), with proto
+       This call is Linux-specific.  IRIX has a prctl() system call (also introduced in Linux 2.1.44 as irix_prctl on the MIPS architecture),  with  proto
        type
 
            ptrdiff_t prctl(int option, int arg2, int arg3);
 
-       and options to get the maximum number of processes per user, get the maximum number of processors the calling process can use, find  out  whether  a
+       and  options  to  get the maximum number of processes per user, get the maximum number of processors the calling process can use, find out whether a
        specified process is currently blocked, get or set the maximum stack size, and so on.
 
 SEE ALSO