[compiler-rt] r355624 - Delete x86_64 ShadowCallStack support

Vlad Tsyrklevich via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 7 10:56:36 PST 2019


Author: vlad.tsyrklevich
Date: Thu Mar  7 10:56:36 2019
New Revision: 355624

URL: http://llvm.org/viewvc/llvm-project?rev=355624&view=rev
Log:
Delete x86_64 ShadowCallStack support

Summary:
ShadowCallStack on x86_64 suffered from the same racy security issues as
Return Flow Guard and had performance overhead as high as 13% depending
on the benchmark. x86_64 ShadowCallStack was always an experimental
feature and never shipped a runtime required to support it, as such
there are no expected downstream users.

Reviewers: pcc

Reviewed By: pcc

Subscribers: mgorny, javed.absar, hiraditya, jdoerfert, cfe-commits, #sanitizers, llvm-commits

Tags: #clang, #sanitizers, #llvm

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

Removed:
    compiler-rt/trunk/test/shadowcallstack/overflow-aarch64.c
    compiler-rt/trunk/test/shadowcallstack/overflow-x86_64.c
Modified:
    compiler-rt/trunk/cmake/config-ix.cmake
    compiler-rt/trunk/test/shadowcallstack/libc_support.h
    compiler-rt/trunk/test/shadowcallstack/lit.cfg
    compiler-rt/trunk/test/shadowcallstack/minimal_runtime.h
    compiler-rt/trunk/test/shadowcallstack/overflow.c

Modified: compiler-rt/trunk/cmake/config-ix.cmake
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/cmake/config-ix.cmake?rev=355624&r1=355623&r2=355624&view=diff
==============================================================================
--- compiler-rt/trunk/cmake/config-ix.cmake (original)
+++ compiler-rt/trunk/cmake/config-ix.cmake Thu Mar  7 10:56:36 2019
@@ -254,7 +254,7 @@ set(ALL_XRAY_SUPPORTED_ARCH ${X86_64})
 else()
 set(ALL_XRAY_SUPPORTED_ARCH ${X86_64} ${ARM32} ${ARM64} ${MIPS32} ${MIPS64} powerpc64le)
 endif()
-set(ALL_SHADOWCALLSTACK_SUPPORTED_ARCH ${X86_64} ${ARM64})
+set(ALL_SHADOWCALLSTACK_SUPPORTED_ARCH ${ARM64})
 
 if(APPLE)
   include(CompilerRTDarwinUtils)

Modified: compiler-rt/trunk/test/shadowcallstack/libc_support.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/shadowcallstack/libc_support.h?rev=355624&r1=355623&r2=355624&view=diff
==============================================================================
--- compiler-rt/trunk/test/shadowcallstack/libc_support.h (original)
+++ compiler-rt/trunk/test/shadowcallstack/libc_support.h Thu Mar  7 10:56:36 2019
@@ -33,9 +33,5 @@ __attribute__((noinline)) void scs_fputs
 }
 
 #else
-
-__attribute__((noinline)) void scs_fputs_stdout(const char *p) {
-  fputs(p, stdout);
-}
-
+#error Unsupported platform
 #endif

Modified: compiler-rt/trunk/test/shadowcallstack/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/shadowcallstack/lit.cfg?rev=355624&r1=355623&r2=355624&view=diff
==============================================================================
--- compiler-rt/trunk/test/shadowcallstack/lit.cfg (original)
+++ compiler-rt/trunk/test/shadowcallstack/lit.cfg Thu Mar  7 10:56:36 2019
@@ -19,5 +19,5 @@ if config.target_arch == 'aarch64':
   scs_arch_cflags += ' -ffixed-x18 '
 config.substitutions.append( ("%clang_scs ", config.clang + ' -O0 -fsanitize=shadow-call-stack ' + scs_arch_cflags + ' ') )
 
-if config.host_os not in ['Linux'] or config.target_arch not in ['x86_64', 'aarch64']:
+if config.host_os not in ['Linux'] or config.target_arch not in ['aarch64']:
    config.unsupported = True

Modified: compiler-rt/trunk/test/shadowcallstack/minimal_runtime.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/shadowcallstack/minimal_runtime.h?rev=355624&r1=355623&r2=355624&view=diff
==============================================================================
--- compiler-rt/trunk/test/shadowcallstack/minimal_runtime.h (original)
+++ compiler-rt/trunk/test/shadowcallstack/minimal_runtime.h Thu Mar  7 10:56:36 2019
@@ -4,10 +4,6 @@
 
 #pragma once
 
-#ifdef __x86_64__
-#include <asm/prctl.h>
-int arch_prctl(int code, void *addr);
-#endif
 #include <stdlib.h>
 #include <sys/mman.h>
 #include <sys/prctl.h>
@@ -21,10 +17,7 @@ static void __shadowcallstack_init() {
   if (stack == MAP_FAILED)
     abort();
 
-#if defined(__x86_64__)
-  if (arch_prctl(ARCH_SET_GS, stack))
-    abort();
-#elif defined(__aarch64__)
+#if defined(__aarch64__)
   __asm__ __volatile__("mov x18, %0" ::"r"(stack));
 #else
 #error Unsupported platform

Removed: compiler-rt/trunk/test/shadowcallstack/overflow-aarch64.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/shadowcallstack/overflow-aarch64.c?rev=355623&view=auto
==============================================================================
--- compiler-rt/trunk/test/shadowcallstack/overflow-aarch64.c (original)
+++ compiler-rt/trunk/test/shadowcallstack/overflow-aarch64.c (removed)
@@ -1,5 +0,0 @@
-// See overflow.c for a description.
-
-// REQUIRES: aarch64-target-arch
-// RUN: %clang_scs %S/overflow.c -o %t -DITERATIONS=12
-// RUN: %run %t | FileCheck %S/overflow.c

Removed: compiler-rt/trunk/test/shadowcallstack/overflow-x86_64.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/shadowcallstack/overflow-x86_64.c?rev=355623&view=auto
==============================================================================
--- compiler-rt/trunk/test/shadowcallstack/overflow-x86_64.c (original)
+++ compiler-rt/trunk/test/shadowcallstack/overflow-x86_64.c (removed)
@@ -1,5 +0,0 @@
-// See overflow.c for a description.
-
-// REQUIRES: x86_64-target-arch
-// RUN: %clang_scs %S/overflow.c -o %t -DITERATIONS=12
-// RUN: not --crash %run %t

Modified: compiler-rt/trunk/test/shadowcallstack/overflow.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/shadowcallstack/overflow.c?rev=355624&r1=355623&r2=355624&view=diff
==============================================================================
--- compiler-rt/trunk/test/shadowcallstack/overflow.c (original)
+++ compiler-rt/trunk/test/shadowcallstack/overflow.c Thu Mar  7 10:56:36 2019
@@ -8,12 +8,10 @@
 // RUN: %clang_scs %s -o %t -DITERATIONS=3
 // RUN: %run %t | FileCheck %s
 
-// The behavioral check for SCS + overflow lives in the tests overflow-x86_64.c
-// and overflow-aarch64.c. This is because the expected behavior is different
-// between the two platforms. On x86_64 we crash because the comparison between
-// the shadow call stack and the regular stack fails. On aarch64 there is no
-// comparison, we just load the return address from the shadow call stack. So we
-// just expect not to see the output from print_and_exit.
+// On aarch64 we just load the return address from the shadow call stack so we
+// do not expect to see the output from print_and_exit.
+// RUN: %clang_scs %s -o %t -DITERATIONS=12
+// RUN: %run %t | FileCheck %S/overflow.c
 
 #include <stdio.h>
 #include <stdlib.h>




More information about the llvm-commits mailing list