llvm-project/clang/test
Nick Desaulniers b7926ce6d7 [IR] add fn attr for no_stack_protector; prevent inlining on mismatch
It's currently ambiguous in IR whether the source language explicitly
did not want a stack a stack protector (in C, via function attribute
no_stack_protector) or doesn't care for any given function.

It's common for code that manipulates the stack via inline assembly or
that has to set up its own stack canary (such as the Linux kernel) would
like to avoid stack protectors in certain functions. In this case, we've
been bitten by numerous bugs where a callee with a stack protector is
inlined into an __attribute__((__no_stack_protector__)) caller, which
generally breaks the caller's assumptions about not having a stack
protector. LTO exacerbates the issue.

While developers can avoid this by putting all no_stack_protector
functions in one translation unit together and compiling those with
-fno-stack-protector, it's generally not very ergonomic or as
ergonomic as a function attribute, and still doesn't work for LTO. See also:
https://lore.kernel.org/linux-pm/20200915172658.1432732-1-rkir@google.com/
https://lore.kernel.org/lkml/20200918201436.2932360-30-samitolvanen@google.com/T/#u

Typically, when inlining a callee into a caller, the caller will be
upgraded in its level of stack protection (see adjustCallerSSPLevel()).
By adding an explicit attribute in the IR when the function attribute is
used in the source language, we can now identify such cases and prevent
inlining.  Block inlining when the callee and caller differ in the case that one
contains `nossp` when the other has `ssp`, `sspstrong`, or `sspreq`.

Fixes pr/47479.

Reviewed By: void

Differential Revision: https://reviews.llvm.org/D87956
2020-10-23 11:55:39 -07:00
..
APINotes/Inputs/Frameworks/SomeKit.framework/Headers docs: add documentation describing API Notes 2020-10-05 18:29:13 +00:00
ARCMT
AST [AST][RecoveryExpr] Don't perform early typo correction in C. 2020-10-12 11:24:45 +02:00
ASTMerge [clang] Improve Serialization/Imporing/Dumping of APValues 2020-10-21 19:03:13 +02:00
Analysis Revert "[SYCL] Implement __builtin_unique_stable_name." 2020-10-12 01:10:09 -04:00
CXX [c++20] For P0732R2: permit class template argument deduction for non-type template parameters. 2020-10-21 15:03:22 -07:00
ClangScanDeps
CodeCompletion [clang] Make signature help work with dependent args 2020-08-17 10:06:36 +02:00
CodeGen [IR] add fn attr for no_stack_protector; prevent inlining on mismatch 2020-10-23 11:55:39 -07:00
CodeGenCUDA Revert "[HIP] Change default --gpu-max-threads-per-block value to 1024" 2020-10-15 17:25:55 -04:00
CodeGenCXX Add a C++ test case for https://reviews.llvm.org/D86854 2020-10-20 07:34:38 -07:00
CodeGenCoroutines Reapply "OpaquePtr: Add type to sret attribute" 2020-10-16 11:05:02 -04:00
CodeGenHIP
CodeGenObjC Reapply "OpaquePtr: Add type to sret attribute" 2020-10-16 11:05:02 -04:00
CodeGenObjCXX Reapply "OpaquePtr: Add type to sret attribute" 2020-10-16 11:05:02 -04:00
CodeGenOpenCL Don't permit array bound constant folding in OpenCL. 2020-10-20 16:52:28 -07:00
CodeGenOpenCLCXX Reapply "OpaquePtr: Add type to sret attribute" 2020-10-16 11:05:02 -04:00
CodeGenSYCL Revert "[SYCL] Implement __builtin_unique_stable_name." 2020-10-12 01:10:09 -04:00
Coverage
CoverageMapping [Coverage] Add empty line regions to SkippedRegions 2020-09-21 12:42:53 -07:00
Driver [CUDA] Extract CUDA version from cuda.h if version.txt is not found 2020-10-23 10:03:30 -07:00
FixIt
Format [clang-format] Add a test showing the current config file list parsing 2020-09-04 16:57:46 +01:00
Frontend [IR] add fn attr for no_stack_protector; prevent inlining on mismatch 2020-10-23 11:55:39 -07:00
Headers [ARM] Add missing target for Arm neon test case. 2020-10-01 00:32:33 +01:00
Import
Index Fix hidden-redecls.m test for some environments 2020-10-16 09:51:13 +02:00
Integration
InterfaceStubs
Layout [AIX] Support two itanium alignment LIT testcases for AIX using regex 2020-10-13 16:47:01 -04:00
Lexer [clang][feature] Add cxx_abi_relative_vtable feature 2020-10-08 10:30:54 -07:00
Misc [OpenCL] Remove unused extensions 2020-10-22 17:01:31 +01:00
Modules Reapply "OpaquePtr: Add type to sret attribute" 2020-10-16 11:05:02 -04:00
OpenMP [OpenMP] Fixing OpenMP/driver.c failing on 32-bit hosts 2020-10-21 17:01:36 -04:00
PCH Add more test coverage for APValue serialization / deserialization and 2020-10-21 13:21:41 -07:00
Parser [PowerPC][AIX] Make `__vector [un]signed long` an error 2020-10-18 12:39:16 -04:00
Preprocessor [AIX] Let alloca return 16 bytes alignment 2020-10-23 14:41:32 -04:00
Profile PR44406: Follow behavior of array bound constant folding in more recent versions of GCC. 2020-10-16 14:34:35 -07:00
Refactor
Rewriter
Sema Ensure that checkInitIsICE is called exactly once for every variable 2020-10-19 19:04:04 -07:00
SemaCUDA Recommit "[CUDA][HIP] Defer overloading resolution diagnostics for host device functions" 2020-10-19 17:48:04 -04:00
SemaCXX Fix constant evaluation of zero-initialization of a union whose first 2020-10-22 17:03:59 -07:00
SemaObjC PR44406: Follow behavior of array bound constant folding in more recent versions of GCC. 2020-10-16 14:34:35 -07:00
SemaObjCXX [SemaObjC] Fix composite pointer type calculation for `void*` and pointer to lifetime qualified ObjC pointer type 2020-10-15 15:21:01 -04:00
SemaOpenCL [OpenCL] Remove unused extensions 2020-10-22 17:01:31 +01:00
SemaOpenCLCXX
SemaSYCL
SemaTemplate Fix test failure on Windows. 2020-10-21 20:02:37 -07:00
TableGen Recommit "[CUDA][HIP] Defer overloading resolution diagnostics for host device functions" 2020-10-19 17:48:04 -04:00
Templight
Tooling
Unit
VFS
clang-rename [clang-rename] Fix rename on variable templates. 2020-10-19 09:44:59 +02:00
utils/update_cc_test_checks [UpdateCCTestChecks] Include generated functions if asked 2020-09-18 06:34:59 -05:00
.clang-format
CMakeLists.txt Revert "Re-Re-land: [CodeView] Add full repro to LF_BUILDINFO record" 2020-08-17 15:49:18 -04:00
TestRunner.sh
cxx-sections.data
lit.cfg.py [OpenMP] Fixing OpenMP/driver.c failing on 32-bit hosts 2020-10-21 17:01:36 -04:00
lit.site.cfg.py.in [CMake] Simplify CMake handling for zlib 2020-08-11 20:22:11 -07:00
make_test_dirs.pl