All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/15] x86: Add support for Clang CFI
@ 2021-04-16 20:38 Sami Tolvanen
  2021-04-16 20:38 ` [PATCH 01/15] objtool: Find a destination for jumps beyond the section end Sami Tolvanen
                   ` (14 more replies)
  0 siblings, 15 replies; 59+ messages in thread
From: Sami Tolvanen @ 2021-04-16 20:38 UTC (permalink / raw)
  To: x86
  Cc: Kees Cook, Josh Poimboeuf, Peter Zijlstra, Nathan Chancellor,
	Nick Desaulniers, Sedat Dilek, linux-hardening, linux-kernel,
	clang-built-linux, Sami Tolvanen

This series adds support for Clang's Control-Flow Integrity (CFI)
checking for x86_64. With CFI, the compiler injects a runtime check
before each indirect function call to ensure the target is a valid
function with the correct static type. This restricts possible call
targets and makes it more difficult for an attacker to exploit bugs
that allow the modification of stored function pointers. For more
details, see:

  https://clang.llvm.org/docs/ControlFlowIntegrity.html

The first two patches contain objtool support for CFI, and the
remaining patches disable CFI where it shouldn't be used and fix
other smaller issues, such as type conflicts that confuse the
compiler.

Note that the patches are based on next-20210416. You can also pull
the series from

  https://github.com/samitolvanen/linux.git x86-cfi-v1


Kees Cook (3):
  x86/extable: Do not mark exception callback as CFI
  x86/alternatives: Use C int3 selftest but disable KASAN
  x86, relocs: Ignore __typeid__ relocations

Sami Tolvanen (12):
  objtool: Find a destination for jumps beyond the section end
  objtool: Add CONFIG_CFI_CLANG support
  objtool: Add ASM_STACK_FRAME_NON_STANDARD
  static_call: Use global functions for the self-test
  x86: Implement function_nocfi
  x86: Avoid CFI jump tables in IDT and entry points
  x86/ftrace: Use function_nocfi in MCOUNT_ADDR
  x86/purgatory: Disable CFI
  x86, module: Ignore __typeid__ relocations
  x86, cpu: Use LTO for cpu.c with CFI
  x86, kprobes: Fix optprobe_template_func type mismatch
  x86, build: Allow CONFIG_CFI_CLANG to be selected

 arch/x86/Kconfig                    |  1 +
 arch/x86/include/asm/desc.h         |  8 ++++-
 arch/x86/include/asm/ftrace.h       |  2 +-
 arch/x86/include/asm/page.h         | 14 +++++++++
 arch/x86/kernel/Makefile            |  3 ++
 arch/x86/kernel/alternative.c       | 21 +++----------
 arch/x86/kernel/cpu/common.c        |  8 ++---
 arch/x86/kernel/idt.c               |  2 +-
 arch/x86/kernel/kprobes/opt.c       |  4 +--
 arch/x86/kernel/module.c            |  4 +++
 arch/x86/kernel/traps.c             |  2 +-
 arch/x86/mm/extable.c               |  1 +
 arch/x86/power/Makefile             |  2 ++
 arch/x86/purgatory/Makefile         |  2 +-
 arch/x86/tools/relocs.c             |  7 +++++
 arch/x86/xen/Makefile               |  2 ++
 include/linux/objtool.h             |  5 +++
 kernel/static_call.c                |  4 +--
 tools/include/linux/objtool.h       |  5 +++
 tools/objtool/check.c               |  4 +++
 tools/objtool/elf.c                 | 48 +++++++++++++++++++++++++++++
 tools/objtool/include/objtool/elf.h |  2 +-
 22 files changed, 119 insertions(+), 32 deletions(-)


base-commit: 18250b538735142307082e4e99e3ae5c12d44013
-- 
2.31.1.368.gbe11c130af-goog


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

end of thread, other threads:[~2021-04-20 22:58 UTC | newest]

Thread overview: 59+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-16 20:38 [PATCH 00/15] x86: Add support for Clang CFI Sami Tolvanen
2021-04-16 20:38 ` [PATCH 01/15] objtool: Find a destination for jumps beyond the section end Sami Tolvanen
2021-04-20 18:14   ` Josh Poimboeuf
2021-04-20 20:25     ` Sami Tolvanen
2021-04-20 22:55       ` Josh Poimboeuf
2021-04-20 22:58         ` Nick Desaulniers
2021-04-16 20:38 ` [PATCH 02/15] objtool: Add CONFIG_CFI_CLANG support Sami Tolvanen
2021-04-20 19:47   ` Josh Poimboeuf
2021-04-20 20:45     ` Sami Tolvanen
2021-04-16 20:38 ` [PATCH 03/15] objtool: Add ASM_STACK_FRAME_NON_STANDARD Sami Tolvanen
2021-04-16 20:38 ` [PATCH 04/15] static_call: Use global functions for the self-test Sami Tolvanen
2021-04-16 21:37   ` Thomas Gleixner
2021-04-17  0:16     ` Thomas Gleixner
2021-04-16 20:38 ` [PATCH 05/15] x86: Implement function_nocfi Sami Tolvanen
2021-04-16 21:18   ` Borislav Petkov
2021-04-16 21:49     ` Sami Tolvanen
2021-04-16 22:02       ` Borislav Petkov
2021-04-16 22:06         ` Andy Lutomirski
2021-04-16 22:14           ` Borislav Petkov
2021-04-16 22:20             ` Andy Lutomirski
2021-04-16 22:37               ` Kees Cook
2021-04-16 23:02                 ` Thomas Gleixner
2021-04-17 10:16                   ` Thomas Gleixner
2021-04-19 15:13                     ` Sami Tolvanen
2021-04-16 22:28           ` Kees Cook
2021-04-16 22:52             ` Andy Lutomirski
2021-04-16 22:58               ` Kees Cook
2021-04-16 23:40               ` Kees Cook
2021-04-17 23:19                 ` Andy Lutomirski
2021-04-17 23:53                   ` Thomas Gleixner
2021-04-18  0:11                     ` Andy Lutomirski
2021-04-18 16:17                       ` Thomas Gleixner
2021-04-18 22:57                         ` Andy Lutomirski
2021-04-19 15:20                           ` Sami Tolvanen
2021-04-19 15:26                       ` David Laight
2021-04-19 17:46                         ` Andy Lutomirski
2021-04-17 14:20             ` David Laight
2021-04-17 15:48               ` Andy Lutomirski
2021-04-19  8:40             ` Rasmus Villemoes
2021-04-19 16:45               ` Joao Moreira
2021-04-19 21:52               ` David Laight
2021-04-16 22:16         ` Kees Cook
2021-04-16 22:13       ` Thomas Gleixner
2021-04-16 20:38 ` [PATCH 06/15] x86: Avoid CFI jump tables in IDT and entry points Sami Tolvanen
2021-04-16 22:26   ` Thomas Gleixner
2021-04-16 23:56     ` Kees Cook
2021-04-17  0:02       ` Thomas Gleixner
2021-04-16 20:38 ` [PATCH 07/15] x86/ftrace: Use function_nocfi in MCOUNT_ADDR Sami Tolvanen
2021-04-16 20:38 ` [PATCH 08/15] x86/extable: Do not mark exception callback as CFI Sami Tolvanen
2021-04-16 20:38 ` [PATCH 09/15] x86/alternatives: Use C int3 selftest but disable KASAN Sami Tolvanen
2021-04-17 11:37   ` Peter Zijlstra
2021-04-19 15:26     ` Sami Tolvanen
2021-04-20  7:19       ` Peter Zijlstra
2021-04-16 20:38 ` [PATCH 10/15] x86/purgatory: Disable CFI Sami Tolvanen
2021-04-16 20:38 ` [PATCH 11/15] x86, relocs: Ignore __typeid__ relocations Sami Tolvanen
2021-04-16 20:38 ` [PATCH 12/15] x86, module: " Sami Tolvanen
2021-04-16 20:38 ` [PATCH 13/15] x86, cpu: Use LTO for cpu.c with CFI Sami Tolvanen
2021-04-16 20:38 ` [PATCH 14/15] x86, kprobes: Fix optprobe_template_func type mismatch Sami Tolvanen
2021-04-16 20:38 ` [PATCH 15/15] x86, build: Allow CONFIG_CFI_CLANG to be selected Sami Tolvanen

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.