linux-api.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH v9 00/27] Control-flow Enforcement: Shadow Stack
@ 2020-02-05 18:19 Yu-cheng Yu
  2020-02-05 18:19 ` [RFC PATCH v9 01/27] Documentation/x86: Add CET description Yu-cheng Yu
                   ` (22 more replies)
  0 siblings, 23 replies; 107+ messages in thread
From: Yu-cheng Yu @ 2020-02-05 18:19 UTC (permalink / raw)
  To: x86, H. Peter Anvin, Thomas Gleixner, Ingo Molnar, linux-kernel,
	linux-doc, linux-mm, linux-arch, linux-api, Arnd Bergmann,
	Andy Lutomirski, Balbir Singh, Borislav Petkov, Cyrill Gorcunov,
	Dave Hansen, Eugene Syromiatnikov, Florian Weimer, H.J. Lu,
	Jann Horn, Jonathan Corbet, Kees Cook, Mike Kravetz, Nadav Amit
  Cc: Yu-cheng Yu

Control-flow Enforcement (CET) is a new Intel processor feature that blocks
return/jump-oriented programming attacks.  Details can be found in "Intel
64 and IA-32 Architectures Software Developer's Manual" [1].

This series depends on the XSAVES supervisor state series that was split
out and submitted earlier [2].

Changes from v8:

- Simplify signal handling code.
- Add guard pages around a Shadow Stack.
- Replace ELF parser with Dave Martin's patch [3].

The goal of this posting is to seek additional comments.

[1] Intel 64 and IA-32 Architectures Software Developer's Manual:

    https://software.intel.com/en-us/download/intel-64-and-ia-32-
    architectures-sdm-combined-volumes-1-2a-2b-2c-2d-3a-3b-3c-3d-and-4

[2] XSAVES supervisor states patches:
    https://lkml.kernel.org/r/20200121201843.12047-1-yu-cheng.yu@intel.com/

[3] Dave Martin's ELF program property parsing patch:
    https://lkml.kernel.org/r/20200122212144.6409-3-broonie@kernel.org/

[4] CET patches v8:

    https://lkml.kernel.org/r/20190813205225.12032-1-yu-cheng.yu@intel.com/
    https://lkml.kernel.org/r/20190813205359.12196-1-yu-cheng.yu@intel.com/

Dave Martin (1):
  ELF: Add ELF program property parsing support

Yu-cheng Yu (26):
  Documentation/x86: Add CET description
  x86/cpufeatures: Add CET CPU feature flags for Control-flow
    Enforcement Technology (CET)
  x86/fpu/xstate: Introduce CET MSR XSAVES supervisor states
  x86/cet: Add control-protection fault handler
  x86/cet/shstk: Add Kconfig option for user-mode Shadow Stack
    protection
  mm: Introduce VM_SHSTK for Shadow Stack memory
  Add guard pages around a Shadow Stack.
  x86/mm: Change _PAGE_DIRTY to _PAGE_DIRTY_HW
  x86/mm: Introduce _PAGE_DIRTY_SW
  x86/mm: Update pte_modify, pmd_modify, and _PAGE_CHG_MASK for
    _PAGE_DIRTY_SW
  drm/i915/gvt: Change _PAGE_DIRTY to _PAGE_DIRTY_BITS
  x86/mm: Modify ptep_set_wrprotect and pmdp_set_wrprotect for
    _PAGE_DIRTY_SW
  x86/mm: Shadow Stack page fault error checking
  mm: Handle Shadow Stack page fault
  mm: Handle THP/HugeTLB Shadow Stack page fault
  mm: Update can_follow_write_pte() for Shadow Stack
  x86/cet/shstk: User-mode Shadow Stack support
  x86/cet/shstk: Introduce WRUSS instruction
  x86/cet/shstk: Handle signals for Shadow Stack
  ELF: UAPI and Kconfig additions for ELF program properties
  binfmt_elf: Define GNU_PROPERTY_X86_FEATURE_1_AND
  ELF: Introduce arch_setup_elf_property()
  x86/cet/shstk: ELF header parsing for Shadow Stack
  x86/cet/shstk: Handle thread Shadow Stack
  mm/mmap: Add Shadow Stack pages to memory accounting
  x86/cet/shstk: Add arch_prctl functions for Shadow Stack

 .../admin-guide/kernel-parameters.txt         |   6 +
 Documentation/x86/index.rst                   |   1 +
 Documentation/x86/intel_cet.rst               | 294 +++++++++++++++
 arch/x86/Kconfig                              |  24 ++
 arch/x86/Makefile                             |   7 +
 arch/x86/entry/entry_64.S                     |   2 +-
 arch/x86/ia32/ia32_signal.c                   |  17 +
 arch/x86/include/asm/cet.h                    |  44 +++
 arch/x86/include/asm/cpufeatures.h            |   2 +
 arch/x86/include/asm/disabled-features.h      |   8 +-
 arch/x86/include/asm/elf.h                    |  13 +
 arch/x86/include/asm/fpu/internal.h           |   2 +
 arch/x86/include/asm/fpu/types.h              |  22 ++
 arch/x86/include/asm/fpu/xstate.h             |   5 +-
 arch/x86/include/asm/mmu_context.h            |   3 +
 arch/x86/include/asm/msr-index.h              |  18 +
 arch/x86/include/asm/pgtable.h                | 197 +++++++++-
 arch/x86/include/asm/pgtable_types.h          |  50 ++-
 arch/x86/include/asm/processor.h              |   5 +
 arch/x86/include/asm/special_insns.h          |  32 ++
 arch/x86/include/asm/traps.h                  |   5 +
 arch/x86/include/uapi/asm/prctl.h             |   5 +
 arch/x86/include/uapi/asm/processor-flags.h   |   2 +
 arch/x86/include/uapi/asm/sigcontext.h        |   9 +
 arch/x86/kernel/Makefile                      |   2 +
 arch/x86/kernel/cet.c                         | 344 ++++++++++++++++++
 arch/x86/kernel/cet_prctl.c                   |  84 +++++
 arch/x86/kernel/cpu/common.c                  |  25 ++
 arch/x86/kernel/cpu/cpuid-deps.c              |   2 +
 arch/x86/kernel/fpu/signal.c                  |  89 +++++
 arch/x86/kernel/fpu/xstate.c                  |  25 +-
 arch/x86/kernel/idt.c                         |   4 +
 arch/x86/kernel/process.c                     |  12 +-
 arch/x86/kernel/process_64.c                  |  31 ++
 arch/x86/kernel/relocate_kernel_64.S          |   2 +-
 arch/x86/kernel/signal.c                      |  10 +
 arch/x86/kernel/signal_compat.c               |   2 +-
 arch/x86/kernel/traps.c                       |  59 +++
 arch/x86/kvm/vmx/vmx.c                        |   2 +-
 arch/x86/mm/fault.c                           |  18 +
 arch/x86/mm/mmap.c                            |   2 +
 arch/x86/mm/pgtable.c                         |  41 +++
 drivers/gpu/drm/i915/gvt/gtt.c                |   2 +-
 fs/Kconfig.binfmt                             |   3 +
 fs/binfmt_elf.c                               | 131 +++++++
 fs/compat_binfmt_elf.c                        |   4 +
 fs/proc/task_mmu.c                            |   3 +
 include/asm-generic/pgtable.h                 |  40 ++
 include/linux/elf.h                           |  33 ++
 include/linux/mm.h                            |  28 +-
 include/uapi/asm-generic/siginfo.h            |   3 +-
 include/uapi/linux/elf.h                      |  12 +
 mm/gup.c                                      |   8 +-
 mm/huge_memory.c                              |  12 +-
 mm/memory.c                                   |   7 +-
 mm/mmap.c                                     |   5 +
 .../arch/x86/include/asm/disabled-features.h  |   8 +-
 57 files changed, 1779 insertions(+), 47 deletions(-)
 create mode 100644 Documentation/x86/intel_cet.rst
 create mode 100644 arch/x86/include/asm/cet.h
 create mode 100644 arch/x86/kernel/cet.c
 create mode 100644 arch/x86/kernel/cet_prctl.c

-- 
2.21.0

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

end of thread, other threads:[~2020-04-08 18:18 UTC | newest]

Thread overview: 107+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-05 18:19 [RFC PATCH v9 00/27] Control-flow Enforcement: Shadow Stack Yu-cheng Yu
2020-02-05 18:19 ` [RFC PATCH v9 01/27] Documentation/x86: Add CET description Yu-cheng Yu
2020-02-06  0:16   ` Randy Dunlap
     [not found]     ` <af5ee976-3b57-4afe-6304-fcab8de45c77-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2020-02-06 20:17       ` Yu-cheng Yu
2020-02-25 20:02   ` Kees Cook
2020-02-28 15:55     ` Yu-cheng Yu
2020-02-26 17:57   ` Dave Hansen
2020-03-09 17:00     ` Yu-cheng Yu
2020-03-09 17:21       ` Dave Hansen
2020-03-09 19:27         ` Yu-cheng Yu
2020-03-09 19:35           ` Dave Hansen
2020-03-09 19:50             ` H.J. Lu
2020-03-09 20:16               ` Andy Lutomirski
2020-03-09 20:54                 ` H.J. Lu
2020-03-09 20:59                   ` Dave Hansen
2020-03-09 21:12                     ` H.J. Lu
2020-03-09 22:02                       ` Andy Lutomirski
2020-03-09 22:19                       ` Dave Hansen
2020-03-09 23:11                         ` H.J. Lu
2020-03-09 23:20                           ` Dave Hansen
2020-03-09 23:51                             ` H.J. Lu
2020-03-09 23:59                               ` Andy Lutomirski
2020-03-10  0:08                                 ` H.J. Lu
2020-03-10  1:21                                   ` Andy Lutomirski
2020-03-10  2:13                                     ` H.J. Lu
2020-02-05 18:19 ` [RFC PATCH v9 03/27] x86/fpu/xstate: Introduce CET MSR XSAVES supervisor states Yu-cheng Yu
2020-02-25 20:04   ` Kees Cook
2020-02-05 18:19 ` [RFC PATCH v9 04/27] x86/cet: Add control-protection fault handler Yu-cheng Yu
2020-02-25 20:06   ` Kees Cook
2020-02-26 17:10   ` Dave Hansen
2020-03-05 20:44     ` Yu-cheng Yu
2020-02-05 18:19 ` [RFC PATCH v9 06/27] mm: Introduce VM_SHSTK for Shadow Stack memory Yu-cheng Yu
2020-02-25 20:07   ` Kees Cook
2020-02-26 18:07   ` Dave Hansen
2020-02-05 18:19 ` [RFC PATCH v9 07/27] Add guard pages around a Shadow Stack Yu-cheng Yu
2020-02-25 20:11   ` Kees Cook
2020-02-26 18:17   ` Dave Hansen
2020-02-05 18:19 ` [RFC PATCH v9 08/27] x86/mm: Change _PAGE_DIRTY to _PAGE_DIRTY_HW Yu-cheng Yu
2020-02-25 20:12   ` Kees Cook
2020-02-26 18:20   ` Dave Hansen
2020-02-05 18:19 ` [RFC PATCH v9 10/27] x86/mm: Update pte_modify, pmd_modify, and _PAGE_CHG_MASK for _PAGE_DIRTY_SW Yu-cheng Yu
2020-02-26 22:02   ` Dave Hansen
2020-02-05 18:19 ` [RFC PATCH v9 11/27] drm/i915/gvt: Change _PAGE_DIRTY to _PAGE_DIRTY_BITS Yu-cheng Yu
2020-02-25 20:13   ` Kees Cook
2020-02-26 22:04   ` Dave Hansen
2020-04-03 15:42     ` Yu-cheng Yu
2020-02-05 18:19 ` [RFC PATCH v9 13/27] x86/mm: Shadow Stack page fault error checking Yu-cheng Yu
2020-02-25 20:16   ` Kees Cook
2020-02-26 22:47   ` Dave Hansen
2020-02-05 18:19 ` [RFC PATCH v9 14/27] mm: Handle Shadow Stack page fault Yu-cheng Yu
2020-02-25 20:20   ` Kees Cook
2020-03-05 18:30     ` Yu-cheng Yu
2020-02-27  0:08   ` Dave Hansen
2020-04-07 18:14     ` Yu-cheng Yu
2020-04-07 22:21       ` Dave Hansen
2020-04-08 18:18         ` Yu-cheng Yu
2020-02-05 18:19 ` [RFC PATCH v9 15/27] mm: Handle THP/HugeTLB " Yu-cheng Yu
2020-02-25 20:59   ` Kees Cook
2020-03-13 22:00     ` Yu-cheng Yu
2020-02-05 18:19 ` [RFC PATCH v9 16/27] mm: Update can_follow_write_pte() for Shadow Stack Yu-cheng Yu
2020-02-27  0:34   ` Dave Hansen
2020-02-05 18:19 ` [RFC PATCH v9 17/27] x86/cet/shstk: User-mode Shadow Stack support Yu-cheng Yu
2020-02-25 21:07   ` Kees Cook
2020-02-27  0:55   ` Dave Hansen
2020-02-05 18:19 ` [RFC PATCH v9 18/27] x86/cet/shstk: Introduce WRUSS instruction Yu-cheng Yu
2020-02-25 21:10   ` Kees Cook
2020-03-05 18:39     ` Yu-cheng Yu
2020-02-05 18:19 ` [RFC PATCH v9 19/27] x86/cet/shstk: Handle signals for Shadow Stack Yu-cheng Yu
2020-02-25 21:17   ` Kees Cook
2020-02-05 18:19 ` [RFC PATCH v9 20/27] ELF: UAPI and Kconfig additions for ELF program properties Yu-cheng Yu
2020-02-05 18:19 ` [RFC PATCH v9 22/27] ELF: Add ELF program property parsing support Yu-cheng Yu
2020-02-25 21:20   ` Kees Cook
2020-02-05 18:19 ` [RFC PATCH v9 23/27] ELF: Introduce arch_setup_elf_property() Yu-cheng Yu
2020-02-05 18:19 ` [RFC PATCH v9 24/27] x86/cet/shstk: ELF header parsing for Shadow Stack Yu-cheng Yu
2020-02-25 21:22   ` Kees Cook
2020-02-05 18:19 ` [RFC PATCH v9 25/27] x86/cet/shstk: Handle thread " Yu-cheng Yu
2020-02-25 21:29   ` Kees Cook
2020-03-25 21:51     ` Yu-cheng Yu
2020-02-05 18:19 ` [RFC PATCH v9 26/27] mm/mmap: Add Shadow Stack pages to memory accounting Yu-cheng Yu
     [not found] ` <20200205181935.3712-1-yu-cheng.yu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2020-02-05 18:19   ` [RFC PATCH v9 02/27] x86/cpufeatures: Add CET CPU feature flags for Control-flow Enforcement Technology (CET) Yu-cheng Yu
2020-02-25 20:02     ` Kees Cook
2020-02-05 18:19   ` [RFC PATCH v9 05/27] x86/cet/shstk: Add Kconfig option for user-mode Shadow Stack protection Yu-cheng Yu
2020-02-25 20:07     ` Kees Cook
2020-02-26 17:03     ` Dave Hansen
2020-02-26 19:57       ` Pavel Machek
2020-03-05 20:38       ` Yu-cheng Yu
2020-02-26 18:05     ` Dave Hansen
2020-02-27  1:02       ` H.J. Lu
2020-02-27  1:16         ` Dave Hansen
2020-02-27  2:11           ` H.J. Lu
2020-02-27  3:57             ` Andy Lutomirski
2020-02-27 18:03               ` Dave Hansen
2020-03-06 18:37       ` Yu-cheng Yu
2020-03-06 19:02         ` Dave Hansen
2020-03-06 21:16           ` Yu-cheng Yu
2020-02-05 18:19   ` [RFC PATCH v9 09/27] x86/mm: Introduce _PAGE_DIRTY_SW Yu-cheng Yu
2020-02-25 20:12     ` Kees Cook
2020-02-26 21:35     ` Dave Hansen
2020-04-01 19:08       ` Yu-cheng Yu
2020-04-01 19:22         ` Dave Hansen
2020-02-05 18:19   ` [RFC PATCH v9 12/27] x86/mm: Modify ptep_set_wrprotect and pmdp_set_wrprotect for _PAGE_DIRTY_SW Yu-cheng Yu
2020-02-25 20:14     ` Kees Cook
2020-02-26 22:20     ` Dave Hansen
2020-02-05 18:19   ` [RFC PATCH v9 21/27] binfmt_elf: Define GNU_PROPERTY_X86_FEATURE_1_AND Yu-cheng Yu
2020-02-25 21:18     ` Kees Cook
2020-02-05 18:19   ` [RFC PATCH v9 27/27] x86/cet/shstk: Add arch_prctl functions for Shadow Stack Yu-cheng Yu
2020-02-25 21:31 ` [RFC PATCH v9 00/27] Control-flow Enforcement: " Kees Cook

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).