All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dominik Brodowski <linux@dominikbrodowski.net>
To: mingo@kernel.org, hpa@zytor.com, tim.c.chen@linux.intel.com,
	dwmw@amazon.co.uk, linux-kernel@vger.kernel.org,
	tglx@linutronix.de
Cc: jpoimboe@redhat.com
Subject: Re: [tip:x86/pti] x86/speculation: Use Indirect Branch Prediction Barrier in context switch
Date: Wed, 31 Jan 2018 08:03:00 +0100	[thread overview]
Message-ID: <20180131070300.GA28206@light.dominikbrodowski.net> (raw)
In-Reply-To: <tip-18bf3c3ea8ece8f03b6fc58508f2dfd23c7711c7@git.kernel.org>

On Tue, Jan 30, 2018 at 02:39:45PM -0800, tip-bot for Tim Chen wrote:
> Commit-ID:  18bf3c3ea8ece8f03b6fc58508f2dfd23c7711c7
> Gitweb:     https://git.kernel.org/tip/18bf3c3ea8ece8f03b6fc58508f2dfd23c7711c7
> Author:     Tim Chen <tim.c.chen@linux.intel.com>
> AuthorDate: Mon, 29 Jan 2018 22:04:47 +0000
> Committer:  Thomas Gleixner <tglx@linutronix.de>
> CommitDate: Tue, 30 Jan 2018 23:09:21 +0100
> 
> x86/speculation: Use Indirect Branch Prediction Barrier in context switch
> 
> Flush indirect branches when switching into a process that marked itself
> non dumpable. This protects high value processes like gpg better,
> without having too high performance overhead.

For the record, I am still opposed to limit this to non-dumpable processes.
Whether a process needs protection by IBPB on context switches is a
different question to whether a process should be allowed to be dumped,
though the former may be a superset of the latter. In my opinion, IBPB
should be enabled on all context switches to userspace processes, until we
have a clear mitigation strategy for userspace against Spectre-v2 designed
and implemented.

Thanks,
	Dominik

--------------------------
From: Dominik Brodowski <linux@dominikbrodowski.net>
Date: Wed, 31 Jan 2018 07:43:12 +0100
Subject: [PATCH] x86/speculation: Do not limit Indirect Branch Prediction Barrier to non-dumpable processes

Whether a process needs protection by IBPB on context switches is a
different question to whether a process should be allowed to be dumped,
though the former may be a superset of the latter. Enable IBPB on all
context switches to a different userspace process, until we have a clear
mitigation strategy for userspace against Spectre-v2 designed and
implemented.

Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>

diff --git a/arch/x86/mm/tlb.c b/arch/x86/mm/tlb.c
index 012d02624848..f54897b68b16 100644
--- a/arch/x86/mm/tlb.c
+++ b/arch/x86/mm/tlb.c
@@ -255,19 +255,13 @@ void switch_mm_irqs_off(struct mm_struct *prev, struct mm_struct *next,
 		 * predictor when switching between processes. This stops
 		 * one process from doing Spectre-v2 attacks on another.
 		 *
-		 * As an optimization, flush indirect branches only when
-		 * switching into processes that disable dumping. This
-		 * protects high value processes like gpg, without having
-		 * too high performance overhead. IBPB is *expensive*!
-		 *
 		 * This will not flush branches when switching into kernel
 		 * threads. It will also not flush if we switch to idle
 		 * thread and back to the same process. It will flush if we
-		 * switch to a different non-dumpable process.
+		 * switch to a different user process.
 		 */
 		if (tsk && tsk->mm &&
-		    tsk->mm->context.ctx_id != last_ctx_id &&
-		    get_dumpable(tsk->mm) != SUID_DUMP_USER)
+		    tsk->mm->context.ctx_id != last_ctx_id)
 			indirect_branch_prediction_barrier();
 
 		if (IS_ENABLED(CONFIG_VMAP_STACK)) {

  reply	other threads:[~2018-01-31  7:05 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-29 22:04 [PATCH] x86/speculation: Use Indirect Branch Prediction Barrier in context switch David Woodhouse
2018-01-30 17:48 ` Josh Poimboeuf
2018-01-30 21:23   ` Tim Chen
2018-01-30 22:00     ` Borislav Petkov
2018-01-30 22:21       ` Thomas Gleixner
2018-01-30 22:55         ` Borislav Petkov
2018-01-31  3:59     ` Josh Poimboeuf
2018-01-31 23:25       ` Tim Chen
2018-01-30 20:38 ` Borislav Petkov
2018-01-30 21:03   ` Tim Chen
2018-01-30 21:57     ` Borislav Petkov
2018-01-30 22:26       ` Tim Chen
2018-01-30 22:43         ` Borislav Petkov
2018-01-31  0:25           ` Tim Chen
2018-01-31  0:41             ` Borislav Petkov
2018-01-30 22:39 ` [tip:x86/pti] " tip-bot for Tim Chen
2018-01-31  7:03   ` Dominik Brodowski [this message]
2018-01-31 13:24     ` Josh Poimboeuf
2018-02-01  8:25     ` Christian Brauner
2018-02-01  8:31     ` David Woodhouse
2018-02-01 15:40       ` Josh Poimboeuf
2018-02-04 19:39       ` Dominik Brodowski
2018-02-05 14:18   ` David Woodhouse
2018-02-05 19:35     ` Tim Chen
2018-02-05 19:35       ` Tim Chen

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=20180131070300.GA28206@light.dominikbrodowski.net \
    --to=linux@dominikbrodowski.net \
    --cc=dwmw@amazon.co.uk \
    --cc=hpa@zytor.com \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=tim.c.chen@linux.intel.com \
    /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.