[all-commits] [llvm/llvm-project] 39f50d: Support -fstack-clash-protection for x86

serge-sans-paille via All-commits all-commits at lists.llvm.org
Fri Feb 7 01:56:27 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 39f50da2a357a8f685b3540246c5d762734e035f
      https://github.com/llvm/llvm-project/commit/39f50da2a357a8f685b3540246c5d762734e035f
  Author: serge_sans_paille <sguelton at redhat.com>
  Date:   2020-02-07 (Fri, 07 Feb 2020)

  Changed paths:
    M clang/docs/ClangCommandLineReference.rst
    M clang/docs/ReleaseNotes.rst
    M clang/include/clang/Basic/CodeGenOptions.def
    M clang/include/clang/Basic/DiagnosticCommonKinds.td
    M clang/include/clang/Basic/TargetInfo.h
    M clang/include/clang/Driver/CC1Options.td
    M clang/include/clang/Driver/Options.td
    M clang/lib/Basic/Targets/X86.h
    M clang/lib/CodeGen/CGStmt.cpp
    M clang/lib/CodeGen/CodeGenModule.cpp
    M clang/lib/Driver/ToolChains/Clang.cpp
    M clang/lib/Frontend/CompilerInvocation.cpp
    A clang/test/CodeGen/stack-clash-protection.c
    A clang/test/Driver/stack-clash-protection.c
    M llvm/docs/ReleaseNotes.rst
    M llvm/include/llvm/CodeGen/TargetLowering.h
    M llvm/lib/Target/X86/X86CallFrameOptimization.cpp
    M llvm/lib/Target/X86/X86FrameLowering.cpp
    M llvm/lib/Target/X86/X86FrameLowering.h
    M llvm/lib/Target/X86/X86ISelLowering.cpp
    M llvm/lib/Target/X86/X86ISelLowering.h
    M llvm/lib/Target/X86/X86InstrCompiler.td
    M llvm/lib/Target/X86/X86InstrInfo.td
    A llvm/test/CodeGen/X86/stack-clash-dynamic-alloca.ll
    A llvm/test/CodeGen/X86/stack-clash-large.ll
    A llvm/test/CodeGen/X86/stack-clash-medium-natural-probes-mutliple-objects.ll
    A llvm/test/CodeGen/X86/stack-clash-medium-natural-probes.ll
    A llvm/test/CodeGen/X86/stack-clash-medium.ll
    A llvm/test/CodeGen/X86/stack-clash-no-free-probe.ll
    A llvm/test/CodeGen/X86/stack-clash-small.ll
    A llvm/test/CodeGen/X86/stack-clash-unknown-call.ll

  Log Message:
  -----------
  Support -fstack-clash-protection for x86

Implement protection against the stack clash attack [0] through inline stack
probing.

Probe stack allocation every PAGE_SIZE during frame lowering or dynamic
allocation to make sure the page guard, if any, is touched when touching the
stack, in a similar manner to GCC[1].

This extends the existing `probe-stack' mechanism with a special value `inline-asm'.
Technically the former uses function call before stack allocation while this
patch provides inlined stack probes and chunk allocation.

Only implemented for x86.

[0] https://www.qualys.com/2017/06/19/stack-clash/stack-clash.txt
[1] https://gcc.gnu.org/ml/gcc-patches/2017-07/msg00556.html

Differential Revision: https://reviews.llvm.org/D68720




More information about the All-commits mailing list