Commit Graph

15173 Commits

Author SHA1 Message Date
Brian Cain ab28cb1c5c Revert "[xray] add support for hexagon"
This reverts commit 543a9ad7c4.
2021-12-09 07:30:40 -08:00
Brian Cain 543a9ad7c4 [xray] add support for hexagon
Adds x-ray support for hexagon to llvm codegen, clang driver,
compiler-rt libs.

Differential Revision: https://reviews.llvm.org/D113638
2021-12-09 05:47:53 -08:00
Dmitry Vyukov 5a33e41281 tsan: new runtime (v3)
This change switches tsan to the new runtime which features:
 - 2x smaller shadow memory (2x of app memory)
 - faster fully vectorized race detection
 - small fixed-size vector clocks (512b)
 - fast vectorized vector clock operations
 - unlimited number of alive threads/goroutimes

Depends on D112602.

Reviewed By: melver

Differential Revision: https://reviews.llvm.org/D112603
2021-12-09 09:09:52 +01:00
Dmitry Vyukov 8e93d4c996 tsan: fork runtime
Fork the current version of tsan runtime before commiting
rewrite of the runtime (D112603). The old runtime can be
enabled with TSAN_USE_OLD_RUNTIME option.
This is a temporal measure for emergencies and is required
for Chromium rollout (for context see http://crbug.com/1275581).
The old runtime is supposed to be deleted soon.

Reviewed By: thakis

Differential Revision: https://reviews.llvm.org/D115223
2021-12-09 07:28:26 +01:00
Andrew Browne 02997febe6 Revert "[asan] Run background thread for asan only on THUMB"
This reverts commit 5c27740238.

Reverting due to Windows build issue:

sanitizer_stackdepot.cpp.obj : error LNK2005: "void __cdecl __sanitizer::StackDepotStopBackgroundThread(void)" (?StackDepotStopBackgroundThread@__sanitizer@@YAXXZ) already defined in sanitizer_common_libcdep.cpp.obj
LINK : fatal error LNK1181: cannot open input file 'projects\compiler-rt\lib\asan\CMakeFiles\RTAsan_dynamic.x86_64.dir\asan_rtl_x86_64.S.obj'
2021-12-08 16:41:36 -08:00
Kirill Stoimenov f75cce0be8 Revert "[ASan] Shared optimized callbacks implementation."
This reverts commit f71c553a30.

Reviewed By: kstoimenov

Differential Revision: https://reviews.llvm.org/D115407
2021-12-09 00:18:29 +00:00
Kirill Stoimenov f71c553a30 [ASan] Shared optimized callbacks implementation.
This change moves optimized callbacks from each .o file to compiler-rt. Instead of using code generation it uses direct assembly implementation. Please note that the 'or' version is not implemented and it will produce unresolved external if somehow 'or' version is requested.

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D114558
2021-12-09 00:00:08 +00:00
Kirill Stoimenov 00616123f8 [ASan] Added __cplusplus guard around the C++ code so it is safe to include asan_mapping.h in assembly files.
This will avoid addind asan_shadow_defines.h in D114558.

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D115348
2021-12-08 21:02:40 +00:00
Vitaly Buka e5c2a46c5e [sanitizer] Run Stack compression in background thread
Depends on D114495.

Reviewed By: dvyukov

Differential Revision: https://reviews.llvm.org/D114498
2021-12-08 13:00:09 -08:00
Petr Hosek 458ead66dc [compiler-rt] Use the runtimes build for custom libc++
Some of the compiler-rt runtimes use custom instrumented libc++ build.
Use the runtimes build for building this custom libc++.

Differential Revision: https://reviews.llvm.org/D114922
2021-12-08 12:52:48 -08:00
Vitaly Buka 5c27740238 [asan] Run background thread for asan only on THUMB
As in D114934, or lsan crashes on the same bot.
2021-12-08 12:43:56 -08:00
Vitaly Buka 9b9ee34d0e [NFC][sanitizer] Move/rename macro into sanitizer_platform.h
Folloup for D114934
2021-12-08 12:43:56 -08:00
Vitaly Buka 8de23903e3 [compiler-rt] Disabled tests and benchmarks for libc++
We don't run tests or benchmarks from this build anyway.
Benchmarks in custom libc++ break my local build.

Reviewed By: ldionne

Differential Revision: https://reviews.llvm.org/D115375
2021-12-08 12:43:55 -08:00
Kirill Stoimenov 277f86d610 [ASan] Ran clang-format on asan_mapping.h.
Reviewed By: kstoimenov

Differential Revision: https://reviews.llvm.org/D115371
2021-12-08 20:15:32 +00:00
Petr Hosek 824ddeb994 Revert "[compiler-rt] Use the runtimes build for custom libc++"
This reverts commit bda3f2dd76 since
it broke MSan tests.
2021-12-08 09:14:26 -08:00
Petr Hosek 40028eaf70 [CMake] Specify byproducts for custom libcxx builds
These were removed in bda3f2dd76 but
are needed as it turned out for the MSan tests.
2021-12-07 23:14:58 -08:00
Vitaly Buka b1c369e01f [lsan] Replace atomic_store/atomic_load with atomic_fetch_add 2021-12-07 22:39:12 -08:00
Vitaly Buka 9601085bc5 [NFC][asan] Remove -std=c++20 from test
Fails after D110215
with errors like
/usr/include/x86_64-linux-gnu/sys/types.h:33:9: error: unknown type name '__u_char'
typedef __u_char u_char;
2021-12-07 22:36:54 -08:00
Vitaly Buka dd1abb1102 [NFC][lsan] Move method implementation up 2021-12-07 21:45:26 -08:00
Vitaly Buka b79ea567cf [NFC][lsan] Clang-format lsan_common.cpp 2021-12-07 21:45:26 -08:00
Vitaly Buka 8ed4d2819d [NFC][lsan] Use kIgnored in MarkInvalidPCCb
kIgnored didn't exist when the code was added, but it should be
equivalent to kReachable.
The goal is to refactor MarkInvalidPCCb to avoid StackDepotGet
in StopTheWorld.
2021-12-07 19:53:08 -08:00
Vitaly Buka 5ff52be5d9 [sanitizer] Restore __thumb__ workaround
It was removed in D114934 and failed clang-thumbv7-full-2stage.
2021-12-07 18:04:06 -08:00
Kirill Stoimenov 572d1ecccc [ASan] Missed some SHADOW_XYZ uses on non-Linux platforms.
Reviewed By: kstoimenov

Differential Revision: https://reviews.llvm.org/D115307
2021-12-08 00:39:26 +00:00
Kirill Stoimenov ad56941a57 [ASan] Renamed SHADOW_XYZ to ASAN_SHADOW_XYZ.
Follow up from D115271.

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D115293
2021-12-08 00:22:56 +00:00
Petr Hosek bda3f2dd76 [compiler-rt] Use the runtimes build for custom libc++
Some of the compiler-rt runtimes use custom instrumented libc++ build.
Use the runtimes build for building this custom libc++.

Differential Revision: https://reviews.llvm.org/D114922
2021-12-07 16:08:16 -08:00
Kirill Stoimenov 8421fa5d53 [ASan] Removed ASAN_SHADOW_SCALE.
This is additional cleanup as follow-up of D104279.

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D115271
2021-12-07 22:55:48 +00:00
Kirill Stoimenov 36529a28c7 Revert "[ASan] Removed ASAN_SHADOW_SCALE."
This reverts commit e4800fc099.

Reviewed By: kstoimenov

Differential Revision: https://reviews.llvm.org/D115286
2021-12-07 22:19:50 +00:00
Kirill Stoimenov e4800fc099 [ASan] Removed ASAN_SHADOW_SCALE.
This is additional cleanup as follow-up of D104279.

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D115271
2021-12-07 22:11:40 +00:00
Kirill Stoimenov 84dbfe1642 [ASan] Replaced constants for SHADOW_OFFSET with defines.
Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D115214
2021-12-07 19:34:17 +00:00
Vitaly Buka 81f9dc8eee [sanitizer] Lock/Unlock stack store on fork
Reviewed By: dvyukov

Differential Revision: https://reviews.llvm.org/D115210
2021-12-07 11:17:16 -08:00
Clemens Wasser d9aa5f6158 Format lsan.h
Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D115262
2021-12-07 10:52:35 -08:00
Clemens Wasser 33e3554ea3 Change __lsan::kMaxAllowedMallocSize literal types to unsigned long long
It is required for the [Leak Sanitizer port to Windows](https://reviews.llvm.org/D115103).
The currently used `unsigned long` type is 64 bits wide on UNIX like systems but only 32 bits wide on Windows.
Because of that, the literal `8UL << 30` causes an integer overflow on Windows.
By changing the type of the literals to `unsigned long long`, we have consistent behavior and no overflows on all Platforms.

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D115186
2021-12-07 10:38:13 -08:00
Kirill Stoimenov 591eb2bdb6 [ASan] Refactored SHADOW_OFFSET implementation to use SHADOW_OFFSET_CONST.
Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D115213
2021-12-07 17:53:38 +00:00
David Spickett 6bfbb89e96 [compiler-rt][libFuzzer] Disable counters test on arm
This test is either very slow or loops forever on 32 bit Arm.

One of a few tests causing timeouts on our buildbots:
https://lab.llvm.org/buildbot/#/builders/190/builds/513
2021-12-07 11:55:11 +00:00
Vitaly Buka fc3a260a0f [sanitizer] Don't lock for StackStore::Allocated() 2021-12-07 01:00:01 -08:00
Vitaly Buka 7151c71481 [sanitizer] Fix CompressStackStore VPrint message 2021-12-07 01:00:01 -08:00
Vitaly Buka faf694b662 [NFC][sanitizer] Non-copyable ScopedBlockSignals 2021-12-06 22:37:28 -08:00
Vitaly Buka 061f22dda9 [NFC][lsan] Refactor LockThreadRegistry/LockAllocator calls 2021-12-06 22:27:11 -08:00
Vitaly Buka aa407c102d [NFC][sanitizer] Fix typo in comment 2021-12-06 22:27:11 -08:00
Nico Weber 63d518f31a [tsan] Move tsan/rtl build rules into tsan/rtl/CMakeLists.txt
That way, the build rules are closer to the source files they describe.

No intended behavior change.

Differential Revision: https://reviews.llvm.org/D115155
2021-12-06 19:58:30 -05:00
Kirill Stoimenov f4606d2b70 Revert "[ASan] Added asan_shadow_defines.h, which contatins shadow offset for various platforms."
This reverts commit 2f3bb59f51.

Reviewed By: kstoimenov

Differential Revision: https://reviews.llvm.org/D115193
2021-12-06 23:13:31 +00:00
Kirill Stoimenov 2f3bb59f51 [ASan] Added asan_shadow_defines.h, which contatins shadow offset for various platforms.
Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D115075
2021-12-06 21:45:46 +00:00
Dmitry Vyukov 954582cdfc tsan: disable dlopen_static_tls.cpp test on powerpc64
Reviewed By: melver

Differential Revision: https://reviews.llvm.org/D115142
2021-12-06 13:13:43 +01:00
Dimitry Andric bbba9d8c1b [XRay] fix more -Wformat warnings
Building xray with recent clang on a 64-bit system results in a number
of -Wformat warnings:

    compiler-rt/lib/xray/xray_allocator.h:70:11: warning: format specifies type 'int' but the argument has type '__sanitizer::uptr' (aka 'unsigned long') [-Wformat]
              RoundedSize, B);
              ^~~~~~~~~~~
    compiler-rt/lib/xray/xray_allocator.h:119:11: warning: format specifies type 'int' but the argument has type '__sanitizer::uptr' (aka 'unsigned long') [-Wformat]
              RoundedSize, B);
              ^~~~~~~~~~~

Since `__sanitizer::uptr` has the same size as `size_t`, these can be
fixed by using the printf specifier `%zu`.

    compiler-rt/lib/xray/xray_basic_logging.cpp:348:46: warning: format specifies type 'int' but the argument has type '__sanitizer::tid_t' (aka 'unsigned long long') [-Wformat]
          Report("Cleaned up log for TID: %d\n", GetTid());
                                          ~~     ^~~~~~~~
                                          %llu
    compiler-rt/lib/xray/xray_basic_logging.cpp:353:62: warning: format specifies type 'int' but the argument has type '__sanitizer::tid_t' (aka 'unsigned long long') [-Wformat]
          Report("Skipping buffer for TID: %d; Offset = %llu\n", GetTid(),
                                           ~~                    ^~~~~~~~
                                           %llu

Since `__sanitizer::tid_t` is effectively declared as `unsigned long
long`, these can be fixed by using the printf specifier `%llu`.

    compiler-rt/lib/xray/xray_basic_logging.cpp:354:14: warning: format specifies type 'unsigned long long' but the argument has type 'size_t' (aka 'unsigned long') [-Wformat]
                 TLD.BufferOffset);
                 ^~~~~~~~~~~~~~~~

Since `BufferOffset` is declared as `size_t`, this one can be fixed by
using `%zu` as a printf specifier.

    compiler-rt/lib/xray/xray_interface.cpp:172:50: warning: format specifies type 'int' but the argument has type 'uint64_t' (aka 'unsigned long') [-Wformat]
        Report("Unsupported sled kind '%d' @%04x\n", Sled.Address, int(Sled.Kind));
                                       ~~            ^~~~~~~~~~~~
                                       %lu

Since ``xray::SledEntry::Address` is declared as `uint64_t`, this one
can be fixed by using `PRIu64`, and adding `<cinttypes>`.

    compiler-rt/lib/xray/xray_interface.cpp:308:62: warning: format specifies type 'long long' but the argument has type 'size_t' (aka 'unsigned long') [-Wformat]
        Report("System page size is not a power of two: %lld\n", PageSize);
                                                        ~~~~     ^~~~~~~~
                                                        %zu
    compiler-rt/lib/xray/xray_interface.cpp:359:64: warning: format specifies type 'long long' but the argument has type 'size_t' (aka 'unsigned long') [-Wformat]
        Report("Provided page size is not a power of two: %lld\n", PageSize);
                                                          ~~~~     ^~~~~~~~
                                                          %zu

Since `PageSize` is declared as `size_t`, these can be fixed by using
`%zu` as a printf specifier.

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D114469
2021-12-04 20:01:20 +01:00
Dmitry Vyukov fd26417a74 tsan: disable dlopen_static_tls.cpp test on aarch64
Fails on bots: https://lab.llvm.org/buildbot#builders/184/builds/1580

Differential Revision: https://reviews.llvm.org/D115095
2021-12-04 13:01:47 +01:00
Vitaly Buka 9c491c873c [sanitizer] Hook up LZW into stack store
Depends on D114503.

Reviewed By: morehouse

Differential Revision: https://reviews.llvm.org/D114924
2021-12-03 23:38:41 -08:00
Kevin Athey 6c2be3015e [NFC][sanitizer] Add test for command line flag for enable-noundef-analysis.
A simple unit test to demonstrate the flags working correctly.

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D114485
2021-12-03 15:44:36 -08:00
Vitaly Buka 98bb198693 [sanitizer] Add Lempel–Ziv–Welch encoder/decoder
It's very simple, fast and efficient for the stack depot compression if used on entire pointers.

Reviewed By: morehouse, kstoimenov

Differential Revision: https://reviews.llvm.org/D114918
2021-12-03 13:11:40 -08:00
Vitaly Buka 5f1d1854eb [NFC][sanitizer] Iterator adaptors for Leb128 encoding
It's similar to back_insert_iterator

Needed for D114924

Reviewed By: morehouse, kstoimenov

Differential Revision: https://reviews.llvm.org/D114980
2021-12-03 12:51:55 -08:00
Vitaly Buka 6318001209 [sanitizer] Support IsRssLimitExceeded in all sanitizers
Reviewed By: kstoimenov

Differential Revision: https://reviews.llvm.org/D115000
2021-12-03 12:45:44 -08:00