Skip to content

Commit a5a9e00

Browse files
committed
Merge tag 'seccomp-v5.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux
Pull seccomp updates from Kees Cook: "These are x86-specific, but I carried these since they're also seccomp-specific. This flips the defaults for spec_store_bypass_disable and spectre_v2_user from "seccomp" to "prctl", as enough time has passed to allow system owners to have updated the defensive stances of their various workloads, and it's long overdue to unpessimize seccomp threads. Extensive rationale and details are in Andrea's main patch. Summary: - set spec_store_bypass_disable & spectre_v2_user to prctl (Andrea Arcangeli)" * tag 'seccomp-v5.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux: x86: deduplicate the spectre_v2_user documentation x86: change default to spec_store_bypass_disable=prctl spectre_v2_user=prctl
2 parents 2dc26d9 + d9bbdbf commit a5a9e00

File tree

3 files changed

+10
-60
lines changed

3 files changed

+10
-60
lines changed

Documentation/admin-guide/hw-vuln/spectre.rst

Lines changed: 6 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -490,9 +490,8 @@ Spectre variant 2
490490

491491
Restricting indirect branch speculation on a user program will
492492
also prevent the program from launching a variant 2 attack
493-
on x86. All sand-boxed SECCOMP programs have indirect branch
494-
speculation restricted by default. Administrators can change
495-
that behavior via the kernel command line and sysfs control files.
493+
on x86. Administrators can change that behavior via the kernel
494+
command line and sysfs control files.
496495
See :ref:`spectre_mitigation_control_command_line`.
497496

498497
Programs that disable their indirect branch speculation will have
@@ -594,61 +593,14 @@ kernel command line.
594593
Not specifying this option is equivalent to
595594
spectre_v2=auto.
596595

597-
For user space mitigation:
598-
599-
spectre_v2_user=
600-
601-
[X86] Control mitigation of Spectre variant 2
602-
(indirect branch speculation) vulnerability between
603-
user space tasks
604-
605-
on
606-
Unconditionally enable mitigations. Is
607-
enforced by spectre_v2=on
608-
609-
off
610-
Unconditionally disable mitigations. Is
611-
enforced by spectre_v2=off
612-
613-
prctl
614-
Indirect branch speculation is enabled,
615-
but mitigation can be enabled via prctl
616-
per thread. The mitigation control state
617-
is inherited on fork.
618-
619-
prctl,ibpb
620-
Like "prctl" above, but only STIBP is
621-
controlled per thread. IBPB is issued
622-
always when switching between different user
623-
space processes.
624-
625-
seccomp
626-
Same as "prctl" above, but all seccomp
627-
threads will enable the mitigation unless
628-
they explicitly opt out.
629-
630-
seccomp,ibpb
631-
Like "seccomp" above, but only STIBP is
632-
controlled per thread. IBPB is issued
633-
always when switching between different
634-
user space processes.
635-
636-
auto
637-
Kernel selects the mitigation depending on
638-
the available CPU features and vulnerability.
639-
640-
Default mitigation:
641-
If CONFIG_SECCOMP=y then "seccomp", otherwise "prctl"
642-
643-
Not specifying this option is equivalent to
644-
spectre_v2_user=auto.
645-
646596
In general the kernel by default selects
647597
reasonable mitigations for the current CPU. To
648598
disable Spectre variant 2 mitigations, boot with
649599
spectre_v2=off. Spectre variant 1 mitigations
650600
cannot be disabled.
651601

602+
For spectre_v2_user see :doc:`/admin-guide/kernel-parameters`.
603+
652604
Mitigation selection guide
653605
--------------------------
654606

@@ -674,9 +626,8 @@ Mitigation selection guide
674626
off by disabling their indirect branch speculation when they are run
675627
(See :ref:`Documentation/userspace-api/spec_ctrl.rst <set_spec_ctrl>`).
676628
This prevents untrusted programs from polluting the branch target
677-
buffer. All programs running in SECCOMP sandboxes have indirect
678-
branch speculation restricted by default. This behavior can be
679-
changed via the kernel command line and sysfs control files. See
629+
buffer. This behavior can be changed via the kernel command line
630+
and sysfs control files. See
680631
:ref:`spectre_mitigation_control_command_line`.
681632

682633
3. High security mode

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5303,8 +5303,7 @@
53035303
auto - Kernel selects the mitigation depending on
53045304
the available CPU features and vulnerability.
53055305

5306-
Default mitigation:
5307-
If CONFIG_SECCOMP=y then "seccomp", otherwise "prctl"
5306+
Default mitigation: "prctl"
53085307

53095308
Not specifying this option is equivalent to
53105309
spectre_v2_user=auto.
@@ -5348,7 +5347,7 @@
53485347
will disable SSB unless they explicitly opt out.
53495348

53505349
Default mitigations:
5351-
X86: If CONFIG_SECCOMP=y "seccomp", otherwise "prctl"
5350+
X86: "prctl"
53525351

53535352
On powerpc the options are:
53545353

arch/x86/kernel/cpu/bugs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -758,11 +758,11 @@ spectre_v2_user_select_mitigation(enum spectre_v2_mitigation_cmd v2_cmd)
758758
case SPECTRE_V2_USER_CMD_FORCE:
759759
mode = SPECTRE_V2_USER_STRICT;
760760
break;
761+
case SPECTRE_V2_USER_CMD_AUTO:
761762
case SPECTRE_V2_USER_CMD_PRCTL:
762763
case SPECTRE_V2_USER_CMD_PRCTL_IBPB:
763764
mode = SPECTRE_V2_USER_PRCTL;
764765
break;
765-
case SPECTRE_V2_USER_CMD_AUTO:
766766
case SPECTRE_V2_USER_CMD_SECCOMP:
767767
case SPECTRE_V2_USER_CMD_SECCOMP_IBPB:
768768
if (IS_ENABLED(CONFIG_SECCOMP))
@@ -1162,7 +1162,6 @@ static enum ssb_mitigation __init __ssb_select_mitigation(void)
11621162
return mode;
11631163

11641164
switch (cmd) {
1165-
case SPEC_STORE_BYPASS_CMD_AUTO:
11661165
case SPEC_STORE_BYPASS_CMD_SECCOMP:
11671166
/*
11681167
* Choose prctl+seccomp as the default mode if seccomp is
@@ -1176,6 +1175,7 @@ static enum ssb_mitigation __init __ssb_select_mitigation(void)
11761175
case SPEC_STORE_BYPASS_CMD_ON:
11771176
mode = SPEC_STORE_BYPASS_DISABLE;
11781177
break;
1178+
case SPEC_STORE_BYPASS_CMD_AUTO:
11791179
case SPEC_STORE_BYPASS_CMD_PRCTL:
11801180
mode = SPEC_STORE_BYPASS_PRCTL;
11811181
break;

0 commit comments

Comments
 (0)