Commit Graph

6 Commits

Author SHA1 Message Date
Cory Benfield
955927eceb Update scudo runtime library name
The scudo runtime was renamed to indicate that it now must run
standalone from other sanitizers. This patch updates the driver to
search for the appropriate filename.

LLVM rename: https://reviews.llvm.org/D138157
2023-08-23 15:36:24 -07:00
Doug Gregor
3e385a83a4 [Driver] Update a test for the simulator inference. 2020-04-20 08:50:35 -07:00
Saleem Abdulrasool
fbbf61f297 Revert "[Darwin] Further restrict inference of the simulator environment" 2020-04-19 16:43:22 -07:00
Doug Gregor
856855dd74 [Driver] Update a test for the simulator inference. 2020-04-16 14:01:20 -07:00
Saleem Abdulrasool
fbd51e2cb8 test: attempt to fix #28538 2020-01-26 22:39:47 -08:00
Cory Benfield
565298620b [Sanitizers] Add Scudo support (#28538)
LLVM ships a hardened memory allocator called Scudo:
https://llvm.org/docs/ScudoHardenedAllocator.html. This allocator
provides additional mitigations against heap-based vulnerabilities, but
retains sufficient performance to be safely run in production
applications.

While ideal Swift applications are obviously written in pure Swift, in
practice most applications contain some amount of code written in
less-safe languages. Additionally, plenty of Swift programs themselves
contain unsafe code, particularly when attempting to implement
high-performance data structures. These sources of unsafety introduce
the risk of memory issues, and having the option to use the Scudo
allocator is a useful defense-in-depth tool.

This patch enables `-sanitize=scudo` as an extra `swiftc` flag. This
sanitizer is only supported on Linux, so no further work is required to
enable it on Windows or Apple platforms. As this "sanitizer" is only a
runtime component, we do not require any wider changes to instrument
code. This is similar to clang's `-fsanitize=scudo` flag.

The Swift driver rejects platforms that don't support Scudo using an
existing mechanism in the Driver that is not part of this patch. This
mechanism is in swift::parseSanitizerArgValues(...)
(lib/Option/SanitizerOptions.cpp). The mechanism determines if a
sanitizer is supported by checking for the existence of the
corresponding sanitizer runtime library in the compiler's resource
directory. The Scudo runtime library currently only exists in the
Linux compiler resource directory. This results in the driver only
allowing Scudo when targeting Linux.
2020-01-26 17:27:14 -08:00