Commit Graph

104 Commits

Author SHA1 Message Date
Julian Lettner 4d2b9426b9 [TSan] Support fiber API on macOS
Committing on behalf of Yuri Per (yuri).

Reviewers: dvyukov, kubamracek, yln

Reviewed By: kubamracek

Authored By: yuri

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

llvm-svn: 358802
2019-04-20 00:18:44 +00:00
Michal Gorny 2c2d65efab [test] Detect glibc-2.27+ and XFAIL appropriate tests
XFAIL the tests known to fail with glibc-2.27+.  This takes away
the burden of handling known failures from users, and ensures that
we will be verbosely informed when they actually start working again.

Bug report: https://bugs.llvm.org/show_bug.cgi?id=37804

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

llvm-svn: 350717
2019-01-09 13:27:29 +00:00
Vitaly Buka dd4c14e4dd [lsan] Check that leak sanitizer works in the forked process
Regression test for PR38698

llvm-svn: 340769
2018-08-27 19:15:05 +00:00
Vitaly Buka d833acdb5f Revert "[lsan] Do not check for leaks in the forked process"
Users need leak reports in forks.

This reverts commit r334036.

llvm-svn: 340758
2018-08-27 17:26:28 +00:00
Alex Shlyapnikov 406385505d [Sanitizers] Move allocator_returns_null.cc test to common.
Summary:
Add allocator_returns_null.cc test to sanitizer_common and
remove all sanitizer-specific ones except:
- HWASan is not covered by sanitizer_common
- TSan allocator does not have comprehensive error reporting yet

Reviewers: vitalybuka

Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits

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

llvm-svn: 334433
2018-06-11 19:45:59 +00:00
Alex Shlyapnikov dcf0097962 [Sanitizers] Check alignment != 0 for aligned_alloc and posix_memalign
Summary:
Move the corresponding tests to the common folder (as all of the
sanitizer allocators will support this feature soon) and add the checks
specific to aligned_alloc to ASan and LSan allocators.

Reviewers: vitalybuka

Subscribers: srhines, kubamracek, delcypher, #sanitizers, llvm-commits

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

llvm-svn: 334316
2018-06-08 20:40:35 +00:00
Vitaly Buka b89704fa6f [lsan] Do not check for leaks in the forked process
Summary:
If calling process had threads then forked process will fail to detect
references from them.

Fixes https://github.com/google/sanitizers/issues/836

Reviewers: alekseyshl

Subscribers: llvm-commits

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

llvm-svn: 334036
2018-06-05 18:15:57 +00:00
Alex Shlyapnikov 236c3f9c4a [LSan] Report proper error on allocator failures instead of CHECK(0)-ing
Summary:
Following up on and complementing D44404.

Currently many allocator specific errors (OOM, for example) are reported as
a text message and CHECK(0) termination, not stack, no details, not too
helpful nor informative. To improve the situation, detailed and
structured errors were defined and reported under the appropriate conditions.

Reviewers: eugenis

Subscribers: srhines, mgorny, delcypher, llvm-commits, #sanitizers

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

llvm-svn: 334034
2018-06-05 18:02:09 +00:00
Alex Shlyapnikov 10f50a44c1 [ASan] Report proper ASan error on allocator failures instead of CHECK(0)-ing
Summary:
Currently many allocator specific errors (OOM, for example) are reported as
a text message and CHECK(0) termination, not stack, no details, not too
helpful nor informative. To improve the situation, ASan detailed errors were
defined and reported under the appropriate conditions.

Issue: https://github.com/google/sanitizers/issues/887

Reviewers: eugenis

Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits

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

llvm-svn: 328722
2018-03-28 18:22:40 +00:00
Nemanja Ivanovic 212227ed10 [PowerPC] Disable failing dynamic tls test cases
Due to recent kernel upgrades, these test case fail on PowerPC buildbots.
This is a known problem on affected kernels.

llvm-svn: 328091
2018-03-21 11:58:37 +00:00
Maxim Ostapenko b0d49a604b [lsan] Respect log_path option in standalone LSan
Differential Revision: https://reviews.llvm.org/D42303

llvm-svn: 323083
2018-01-22 09:30:27 +00:00
Alex Shlyapnikov f280eff080 [LSan] Disable a couple of failing tests on PPC64 (pending investigation).
llvm-svn: 316720
2017-10-27 00:29:40 +00:00
Alex Shlyapnikov e4b9ae666e [LSan] Enable LSan tests on PPC64 Linux.
Summary:
LSan is functional on PPC64 Linux now, let's enable all tests.

One test required ppc specific changes: use_registers.cc.

Reviewers: eugenis

Subscribers: mgorny, llvm-commits

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

llvm-svn: 316698
2017-10-26 20:59:04 +00:00
Vitaly Buka 1b73bde182 [lsan] Add __lsan_default_options
For consistency with asan, msan, tsan and ubsan.

llvm-svn: 314048
2017-09-22 23:49:49 +00:00
Francis Ricci f36d34a4d4 Revert "Prevent DCE on __lsan_is_turned_off and re-enable test case"
This doesn't fix the failing test. Leave in the comment and the
attribute, since the used attribute is still required.

This partially reverts commit r312824

llvm-svn: 312827
2017-09-08 21:09:43 +00:00
Francis Ricci 4a327e1c5c Prevent DCE on __lsan_is_turned_off and re-enable test case
Summary:
-dead_strip in ld64 strips weak interface symbols, which I believe
is most likely the cause of this test failure. Re-enable after marking the interface
function as used.

Reviewers: alekseyshl, kubamracek, kcc

Subscribers: llvm-commits

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

llvm-svn: 312824
2017-09-08 19:43:53 +00:00
Michal Gorny 0e52de05db Reland r311842 - [cmake] Remove i686 target that is duplicate to i386
Remove the explicit i686 target that is completely duplicate to
the i386 target, with the latter being used more commonly.

1. The runtime built for i686 will be identical to the one built for
i386.

2. Supporting both -i386 and -i686 suffixes causes unnecessary confusion
on the clang end which has to expect either of them.

3. The checks are based on wrong assumption that __i686__ is defined for
all newer x86 CPUs. In fact, it is only declared when -march=i686 is
explicitly used. It is not available when a more specific (or newer)
-march is used.

Curious enough, if CFLAGS contain -march=i686, the runtime will be built
both for i386 and i686. For any other value, only i386 variant will be
built.

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

llvm-svn: 311924
2017-08-28 20:30:12 +00:00
Michal Gorny 7298595a2c Revert r311842 - [cmake] Remove i686 target that is duplicate to i386
The required change in clang is being reverted because of the Android
build bot failure.

llvm-svn: 311859
2017-08-27 20:37:06 +00:00
Michal Gorny 34ca7168ae [cmake] Remove i686 target that is duplicate to i386
Remove the explicit i686 target that is completely duplicate to
the i386 target, with the latter being used more commonly.

1. The runtime built for i686 will be identical to the one built for
i386.

2. Supporting both -i386 and -i686 suffixes causes unnecessary confusion
on the clang end which has to expect either of them.

3. The checks are based on wrong assumption that __i686__ is defined for
all newer x86 CPUs. In fact, it is only declared when -march=i686 is
explicitly used. It is not available when a more specific (or newer)
-march is used.

Curious enough, if CFLAGS contain -march=i686, the runtime will be built
both for i386 and i686. For any other value, only i386 variant will be
built.

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

llvm-svn: 311842
2017-08-27 07:44:41 +00:00
Alex Shlyapnikov d08c32b2f4 [Sanitizers] LSan allocator set errno on failure.
Set proper errno code on alloction failures and change valloc and
memalign implementations to satisfy their man-specified requirements.

llvm-svn: 308063
2017-07-14 22:23:46 +00:00
Alex Shlyapnikov d3213c792e [LSan] Make LSan allocator allocator_may_return_null compliant
Summary:
An attempt to reland D34786 (which caused bot failres on Mac), now with
properly intercepted operators new() and delete().

LSan allocator used to always return nullptr on too big allocation requests
(the definition of "too big" depends on platform and bitness), now it
follows policy configured by allocator_may_return_null flag

Reviewers: eugenis

Subscribers: llvm-commits

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

llvm-svn: 306845
2017-06-30 17:21:34 +00:00
Michael Zolotukhin 1576571112 Revert "[LSan] Make LSan allocator allocator_may_return_null compliant"
This reverts commit r306624.

The committed test failed on various bots (e.g. on green dragon).

llvm-svn: 306644
2017-06-29 04:39:17 +00:00
Alex Shlyapnikov 17277f13f0 [LSan] Make LSan allocator allocator_may_return_null compliant
Summary:
LSan allocator used to always return nullptr on too big allocation requests
(the definition of "too big" depends on platform and bitness), now it
follows policy configured by allocator_may_return_null flag.

Reviewers: eugenis

Subscribers: llvm-commits

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

llvm-svn: 306624
2017-06-29 01:02:40 +00:00
Francis Ricci 42175cb0d7 Add lsan interceptors for libdispatch functions on darwin
Summary:
This is required for standalone LSan to work with libdispatch worker threads,
and is a slimmed down version of the functionality provided for ASan
in asan_mac.cc.

Re-commit of r305695 with use_stacks=0 to get around a racy lingering pointer.

Reviewers: alekseyshl, kubamracek, glider, kcc

Subscribers: mgorny, llvm-commits

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

llvm-svn: 305732
2017-06-19 19:21:31 +00:00
Francis Ricci 214b354f2e Revert "Add lsan interceptors for libdispatch functions on darwin"
This reverts r305695

llvm-svn: 305712
2017-06-19 17:08:55 +00:00
Francis Ricci 4f1e047a6d Add lsan interceptors for libdispatch functions on darwin
Summary:
This is required for standalone LSan to work with libdispatch worker threads,
and is a slimmed down version of the functionality provided for ASan
in asan_mac.cc.

Reviewers: alekseyshl, kubamracek, glider, kcc

Subscribers: mgorny, llvm-commits

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

llvm-svn: 305695
2017-06-19 14:09:10 +00:00
Renato Golin 5ade1f1c86 [LSAN-ARM] Marking new test unsupported on ARMHF due to bot failures
The test was meant for Darwin anyway, so I'm not even sure it's supposed
to run on Linux. If it was, then we need time to investigate, but since
the test is new, there's no point in reverting the whole patch because
of it.

llvm-svn: 304010
2017-05-26 17:31:33 +00:00
Francis Ricci 86e070f7e9 Implement tls scanning for darwin LSan
Summary:
This required for any users who call exit() after creating
thread-specific data, as tls destructors are only called when
pthread_exit() or pthread_cancel() are used. This should also
match tls behavior on linux.

Getting the base address of the tls section is straightforward,
as it's stored as a section offset in %gs. The size is a bit trickier
to work out, as there doesn't appear to be any official documentation
or source code referring to it. The size used in this patch was determined
by taking the difference between the base address and the address of the
subsequent memory region returned by vm_region_recurse_64, which was
1024 * sizeof(uptr) on all threads except the main thread, where it was
larger. Since the section must be the same size on all of the threads,
1024 * sizeof(uptr) seemed to be a reasonable size to use, barring
a more programtic way to get the size.

1024 seems like a reasonable number, given that PTHREAD_KEYS_MAX
is 512 on darwin, so pthread keys will fit inside the region while
leaving space for other tls data. A larger size would overflow the
memory region returned by vm_region_recurse_64, and a smaller size
wouldn't leave room for all the pthread keys. In addition, the
stress test added here passes, which means that we are scanning at
least the full set of possible pthread keys, and probably
the full tls section.

Reviewers: alekseyshl, kubamracek

Subscribers: krytarowski, llvm-commits

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

llvm-svn: 303887
2017-05-25 17:41:13 +00:00
Francis Ricci 3b57da0c73 Revert "Implement tls scanning for darwin LSan"
This reverts r303262, due to TSan buildbot breakages.

llvm-svn: 303266
2017-05-17 15:25:41 +00:00
Francis Ricci eab89eb850 Implement tls scanning for darwin LSan
Summary:
This required for any users who call exit() after creating
thread-specific data, as tls destructors are only called when
pthread_exit() or pthread_cancel() are used. This should also
match tls behavior on linux.

Getting the base address of the tls section is straightforward,
as it's stored as a section offset in %gs. The size is a bit trickier
to work out, as there doesn't appear to be any official documentation
or source code referring to it. The size used in this patch was determined
by taking the difference between the base address and the address of the
subsequent memory region returned by vm_region_recurse_64, which was
1024 * sizeof(uptr) on all threads except the main thread, where it was
larger. Since the section must be the same size on all of the threads,
1024 * sizeof(uptr) seemed to be a reasonable size to use, barring
a more programtic way to get the size.

1024 seems like a reasonable number, given that PTHREAD_KEYS_MAX
is 512 on darwin, so pthread keys will fit inside the region while
leaving space for other tls data. A larger size would overflow the
memory region returned by vm_region_recurse_64, and a smaller size
wouldn't leave room for all the pthread keys. In addition, the
stress test added here passes, which means that we are scanning at
least the full set of possible pthread keys, and probably
the full tls section.

Reviewers: alekseyshl, kubamracek

Subscribers: krytarowski, llvm-commits

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

llvm-svn: 303262
2017-05-17 14:35:17 +00:00
Francis Ricci fb3d1ea063 Disable two failing darwin lsan tests
These tests don't fail consistently in all cases, but they
fail most of the time on the buildbots. Mark as UNSUPPORTED for now to
avoid buildbots failing due to XPASS.

llvm-svn: 302920
2017-05-12 16:52:19 +00:00
Francis Ricci b680e9742a Disable two failing darwin lsan tests
These are causing buildbot failures, disable for now.

llvm-svn: 302912
2017-05-12 16:01:15 +00:00
Francis Ricci fdcab2cbf2 Enable lsan test suite on Darwin x86_64 builds
Reviewers: kubamracek, alekseyshl

Subscribers: mgorny, llvm-commits

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

llvm-svn: 302904
2017-05-12 15:10:05 +00:00
Alex Shlyapnikov 342586d728 [lsan] Enable LSan on PowerPC64.
Summary: Re-landing reverted D31995 with suppressions defined in D32303 and D32377.

Reviewers: eugenis

Subscribers: nemanjai, llvm-commits

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

llvm-svn: 301048
2017-04-21 21:59:53 +00:00
Alex Shlyapnikov c426666b4d Disable LSan on ppc64, some tests are failing.
llvm-svn: 300933
2017-04-21 00:36:29 +00:00
Ahmed Bougacha c6422fed85 Revert "Enable lsan test suite on Darwin x86_64 builds"
This reverts commit r300897.

Most LSan/ASan tests are failing on darwin bots.

llvm-svn: 300929
2017-04-21 00:00:59 +00:00
Alex Shlyapnikov 906ffb7b8f Enable LSan on PowerPC64.
Summary: Re-landing reverted D31995 with suppressions defined in D32303.

Reviewers: eugenis

Subscribers: nemanjai, llvm-commits

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

llvm-svn: 300903
2017-04-20 21:56:36 +00:00
Francis Ricci dcaf4e2139 Enable lsan test suite on Darwin x86_64 builds
Reviewers: kubamracek, alekseyshl

Subscribers: mgorny, llvm-commits

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

llvm-svn: 300897
2017-04-20 21:27:25 +00:00
Francis Ricci 6b494d9edc make detect_leaks=1 the default for the lsan test suite
Summary:
This already appears to be the case in all .cc test files,
it was probably left out of the .c test files accidentally. Make it a global
default, instead of manually adding it to each individual test.

This is needed to force leak detection for Darwin tests, where leak detection
is disabled by default.

Reviewers: m.ostapenko, kubamracek, alekseyshl

Subscribers: llvm-commits

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

llvm-svn: 300890
2017-04-20 21:00:02 +00:00
Francis Ricci fdf7779795 Don't use abort_on_error for lsan darwin test suite
Summary:
This option is disabled by our other test suites, and will cause
failures when unit tests abort instead of failing with an error code.
Will also prevent the test suite from being too slow.

Reviewers: kubamracek, alekseyshl

Subscribers: llvm-commits

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

llvm-svn: 300593
2017-04-18 20:56:59 +00:00
Francis Ricci cae98fc8f0 Allow for setting of global platform-specific lsan options in the test suite
Reviewers: kubamracek, alekseyshl

Subscribers: llvm-commits

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

llvm-svn: 300592
2017-04-18 20:56:56 +00:00
Francis Ricci 5bfddfefe1 Move Linux-specific lsan tests into a new directory
Summary:
These tests aren't supported on other platforms, move them
to their own directory.

Reviewers: kubamracek, alekseyshl

Subscribers: llvm-commits

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

llvm-svn: 300247
2017-04-13 20:13:53 +00:00
Alex Shlyapnikov 4765f17738 Revert "Enable LSan on PowerPC64."
This reverts commit r300204. Breaks ASAN tests on PPC.

llvm-svn: 300237
2017-04-13 18:49:29 +00:00
Alex Shlyapnikov d77394c5f2 Enable LSan on PowerPC64.
Summary:
With D31555 commited, looks like basic LSan functionality
works on PPC64. Time to enable LSan there.

Reviewers: eugenis

Subscribers: nemanjai, llvm-commits

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

llvm-svn: 300204
2017-04-13 16:17:32 +00:00
Maxim Ostapenko 661033d575 [lsan] Reenable lsan tests on ARM bots
This patch addresses pr32636. Enable lsan tests on ARM bots filtering out Thumb targets.
Tested locally on ARM Arndale board in two configurations:

1) CFLAGS="-march=armv7-a"
	Testing Time: 37.57s
	Expected Passes    : 69
	Unsupported Tests  : 7

2) CFLAGS="-march=armv7-a -mthumb"
	Testing Time: 0.16s
	Unsupported Tests  : 76

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

llvm-svn: 300194
2017-04-13 12:00:56 +00:00
Renato Golin baf04f92bc [LSAN] Disable on ARM/Thumb for good
I didn't pay enough attention to the patch I reverted, now I'm going to
hit it with a bigger hammer until we can understand what the problems
are.

llvm-svn: 300044
2017-04-12 10:12:49 +00:00
Renato Golin c6c8f09e49 Revert "[lsan] Fix typo in test/lsan/lit.common.cfg"
This reverts commit r299957. It broke the Thumb bots. We need to make
sure why and maybe stop it from being tested on Thumb environments. But
for now, let's get the bots green.

llvm-svn: 300042
2017-04-12 09:45:08 +00:00
Maxim Ostapenko 83d37dc066 [lsan] Fix typo in test/lsan/lit.common.cfg
llvm-svn: 299957
2017-04-11 16:22:19 +00:00
Maxim Ostapenko de3b9a2ecc Reapply "Enable LSan for arm Linux"
This patch reapplies r299923 with typo fixed in BLX macros.

llvm-svn: 299948
2017-04-11 14:58:26 +00:00
Nico Weber 7124b5f6f9 Revert r299923, it doesn't build in bootstrap builds.
FAILED: lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.arm.dir/sanitizer_linux.cc.o 
lib/sanitizer_common/sanitizer_linux.cc:1340:24: error: invalid instruction
                       BLX(ip)
                       ^
lib/sanitizer_common/sanitizer_linux.cc:1313:19: note: expanded from macro 'BLX'
#  define BLX(R) "mov lr, pc; bx" #R "\n"
                  ^
<inline asm>:6:13: note: instantiated into assembly here
mov lr, pc; bxip
            ^~~~

llvm-svn: 299943
2017-04-11 14:28:49 +00:00