linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Patch v2 0/4] Provide options to enable spectre_v2 userspace-userspace protection
@ 2018-09-26  0:43 Tim Chen
  2018-09-26  0:43 ` [Patch v2 1/4] x86/speculation: Option to select app to app mitigation for spectre_v2 Tim Chen
                   ` (3 more replies)
  0 siblings, 4 replies; 20+ messages in thread
From: Tim Chen @ 2018-09-26  0:43 UTC (permalink / raw)
  To: Jiri Kosina, Thomas Gleixner
  Cc: Tim Chen, Tom Lendacky, Ingo Molnar, Peter Zijlstra,
	Josh Poimboeuf, Andrea Arcangeli, David Woodhouse, Andi Kleen,
	Dave Hansen, Casey Schaufler, Asit Mallick, Arjan van de Ven,
	Jon Masters, linux-kernel, x86

I have merged Tom's changes to extend the patchset for AMD cpus, and
also added a prctl option to control per process indirect branch
speculation per Peter's comments.

Tim

Changes:
v2:
1. Extend per process STIBP to AMD cpus
2. Add prctl option to control per process indirect branch speculation
3. Bug fixes and cleanups 

This patchset provides an option to apply IBPB and STIBP mitigation
to only non-dumpable processes.

Jiri's patch to harden spectre_v2 makes IBPB and STIBP available for
general spectre v2 app to app mitigation.  IBPB will be issued for
switching to an app that's not ptraceable by the previous
app and STIBP will be always turned on.

However, leaving STIBP on all the time is expensive for certain
applications that have frequent indirect branches. One such application
is perlbench in the SpecInt Rate 2006 test suite which shows a
21% reduction in throughput.  Other application like bzip2 in
the same test suite with  minimal indirct branches have
only a 0.7% reduction in throughput. IBPB will also impose
overhead during context switches.

App to app exploit is in general difficult
due to address space layout randomization in apps and
the need to know an app's address space layout ahead of time.
Users may not wish to incur app to app performance
overhead from IBPB and STIBP for general non security sensitive apps
and use these mitigations only for non-dumpable apps.

The first patch provides a lite option for spectre_v2 app to app
mitigation where IBPB is only issued for security sensitive
non-dumpable app.  The second patch extends this option
where STIBP is only issued for non-dumpable app.
The third patch extends per process STIBP update for AMD cpus.
The fourth patch adds a prctl option to control per process
indirect branch speculation.

Thomas Lendacky (1):
  x86/speculation: Extend per process STIBP to AMD cpus.

Tim Chen (3):
  x86/speculation: Option to select app to app mitigation for spectre_v2
  x86/speculation: Provide application property based STIBP protection
  x86/speculation: Add prctl to control indirect branch speculation per
    process

 Documentation/admin-guide/kernel-parameters.txt |  13 ++
 Documentation/userspace-api/spec_ctrl.rst       |   8 +
 arch/x86/include/asm/msr-index.h                |   3 +-
 arch/x86/include/asm/nospec-branch.h            |   9 ++
 arch/x86/include/asm/spec-ctrl.h                |  12 ++
 arch/x86/include/asm/thread_info.h              |   4 +-
 arch/x86/kernel/cpu/bugs.c                      | 185 +++++++++++++++++++++++-
 arch/x86/kernel/process.c                       |  58 ++++++--
 arch/x86/mm/tlb.c                               |  21 ++-
 fs/exec.c                                       |  13 +-
 include/linux/sched.h                           |   5 +
 include/linux/sched/coredump.h                  |   2 +-
 include/uapi/linux/prctl.h                      |   1 +
 kernel/cred.c                                   |   2 +-
 kernel/sys.c                                    |   2 +-
 tools/include/uapi/linux/prctl.h                |   1 +
 16 files changed, 310 insertions(+), 29 deletions(-)

-- 
2.9.4


^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2018-10-05 18:46 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-26  0:43 [Patch v2 0/4] Provide options to enable spectre_v2 userspace-userspace protection Tim Chen
2018-09-26  0:43 ` [Patch v2 1/4] x86/speculation: Option to select app to app mitigation for spectre_v2 Tim Chen
2018-10-02  9:23   ` Ingo Molnar
2018-10-02 16:24     ` Tim Chen
2018-10-02 20:04   ` Thomas Gleixner
2018-09-26  0:43 ` [Patch v2 2/4] x86/speculation: Provide application property based STIBP protection Tim Chen
2018-10-02 19:10   ` Thomas Gleixner
2018-10-04 19:19     ` Tim Chen
2018-09-26  0:43 ` [Patch v2 3/4] x86/speculation: Extend per process STIBP to AMD cpus Tim Chen
2018-09-26 17:24   ` Tim Chen
2018-09-26 19:11     ` Lendacky, Thomas
2018-10-02  9:27   ` Ingo Molnar
2018-10-02 19:02   ` Thomas Gleixner
2018-09-26  0:43 ` [Patch v2 4/4] x86/speculation: Add prctl to control indirect branch speculation per process Tim Chen
2018-10-02  9:35   ` Ingo Molnar
2018-10-02 16:12     ` Tim Chen
2018-10-03  7:25       ` Ingo Molnar
2018-10-02 17:58   ` Thomas Gleixner
2018-10-05 18:12     ` Tim Chen
2018-10-05 18:46       ` Thomas Gleixner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).