All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: gregkh@linuxfoundation.org
Cc: asteinhauser@google.com, tglx@linutronix.de, stable@vger.kernel.org
Subject: Re: FAILED: patch "[PATCH] x86/speculation: Avoid force-disabling IBPB based on STIBP" failed to apply to 4.19-stable tree
Date: Mon, 15 Jun 2020 14:03:18 -0400	[thread overview]
Message-ID: <20200615180318.GG5492@sasha-vm> (raw)
In-Reply-To: <159222800515682@kroah.com>

On Mon, Jun 15, 2020 at 03:33:25PM +0200, gregkh@linuxfoundation.org wrote:
>
>The patch below does not apply to the 4.19-stable tree.
>If someone wants it applied there, or to any other stable or longterm
>tree, then please email the backport, including the original git commit
>id to <stable@vger.kernel.org>.
>
>thanks,
>
>greg k-h
>
>------------------ original commit in Linus's tree ------------------
>
>From 21998a351512eba4ed5969006f0c55882d995ada Mon Sep 17 00:00:00 2001
>From: Anthony Steinhauser <asteinhauser@google.com>
>Date: Tue, 19 May 2020 06:40:42 -0700
>Subject: [PATCH] x86/speculation: Avoid force-disabling IBPB based on STIBP
> and enhanced IBRS.
>
>When STIBP is unavailable or enhanced IBRS is available, Linux
>force-disables the IBPB mitigation of Spectre-BTB even when simultaneous
>multithreading is disabled. While attempts to enable IBPB using
>prctl(PR_SET_SPECULATION_CTRL, PR_SPEC_INDIRECT_BRANCH, ...) fail with
>EPERM, the seccomp syscall (or its prctl(PR_SET_SECCOMP, ...) equivalent)
>which are used e.g. by Chromium or OpenSSH succeed with no errors but the
>application remains silently vulnerable to cross-process Spectre v2 attacks
>(classical BTB poisoning). At the same time the SYSFS reporting
>(/sys/devices/system/cpu/vulnerabilities/spectre_v2) displays that IBPB is
>conditionally enabled when in fact it is unconditionally disabled.
>
>STIBP is useful only when SMT is enabled. When SMT is disabled and STIBP is
>unavailable, it makes no sense to force-disable also IBPB, because IBPB
>protects against cross-process Spectre-BTB attacks regardless of the SMT
>state. At the same time since missing STIBP was only observed on AMD CPUs,
>AMD does not recommend using STIBP, but recommends using IBPB, so disabling
>IBPB because of missing STIBP goes directly against AMD's advice:
>https://developer.amd.com/wp-content/resources/Architecture_Guidelines_Update_Indirect_Branch_Control.pdf
>
>Similarly, enhanced IBRS is designed to protect cross-core BTB poisoning
>and BTB-poisoning attacks from user space against kernel (and
>BTB-poisoning attacks from guest against hypervisor), it is not designed
>to prevent cross-process (or cross-VM) BTB poisoning between processes (or
>VMs) running on the same core. Therefore, even with enhanced IBRS it is
>necessary to flush the BTB during context-switches, so there is no reason
>to force disable IBPB when enhanced IBRS is available.
>
>Enable the prctl control of IBPB even when STIBP is unavailable or enhanced
>IBRS is available.
>
>Fixes: 7cc765a67d8e ("x86/speculation: Enable prctl mode for spectre_v2_user")
>Signed-off-by: Anthony Steinhauser <asteinhauser@google.com>
>Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
>Cc: stable@vger.kernel.org

I took these two additional patches for 4.19-4.4:

aa77bfb354c4 ("x86/speculation: Change misspelled STIPB to STIBP")
20c3a2c33e9f ("x86/speculation: Add support for STIBP always-on preferred mode")

With tiny massaging on 4.9 and 4.4.

-- 
Thanks,
Sasha

  reply	other threads:[~2020-06-15 18:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-15 13:33 FAILED: patch "[PATCH] x86/speculation: Avoid force-disabling IBPB based on STIBP" failed to apply to 4.19-stable tree gregkh
2020-06-15 18:03 ` Sasha Levin [this message]
2020-06-16 10:49   ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200615180318.GG5492@sasha-vm \
    --to=sashal@kernel.org \
    --cc=asteinhauser@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=stable@vger.kernel.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.