Commit Graph

7967 Commits

Author SHA1 Message Date
Dean Michael Berris 2cc7fc2cc6 [XRay][compiler-rt] Fix missing include of <cerrno>
Futher attempt to un-break ARM and AArch64 build.

Follow-up on D25360.

llvm-svn: 290083
2016-12-19 05:26:14 +00:00
Dean Michael Berris 6f16e2c456 [XRay][compiler-rt] Post-commit review fixup of XRay refactoring.
Missed a couple of files:

- Using #pragma once
- Missing top-matter for headers
- Missing an include for <cstdint>

Follow-up on D25360.

llvm-svn: 290079
2016-12-19 03:59:20 +00:00
Dean Michael Berris 4527ebecb6 [XRay][compiler-rt] Explicitly include <cstdint> for types
This is an attempt to un-break the ARM7, AArch64 builds.

Follow-up on D25360.

llvm-svn: 290078
2016-12-19 03:47:35 +00:00
Dean Michael Berris 094173ba2c [XRay] [compiler-rt] Move machine-dependent code into machine-dependent files.
Summary: Include the necessary headers while there.

Reviewers: dberris

Subscribers: llvm-commits

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

llvm-svn: 290077
2016-12-19 03:21:26 +00:00
Dean Michael Berris a53217d185 [XRay] [compiler-rt] Fix format string; sanitizers' internal printf() doesn't support %ld.
Summary:
Getting rid of the distance number altogether because:
- a person knowledgeable enough to know what the message means will also
  know how to do hexadecimal math (with the help of a calculator)
- numbers outside INT_MIN - INT_MAX are hard to comprehend anyway

This unbreaks the case when you dynamically link a library with XRay and
it exits pre-main() with a not very informative static string.

Author: pelikan

Reviewers: dberris

Subscribers: llvm-commits, mehdi_amini

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

llvm-svn: 290074
2016-12-19 00:47:40 +00:00
Kuba Mracek 79b4f0ad9c Follow-up for r289831: Lower the unjoined thread count to 100 in the libcxx-future.mm testcase.
Turns out 1000 unjoined threads are a bit too rough in certain environments.

llvm-svn: 289971
2016-12-16 18:44:01 +00:00
Kuba Mracek 0bd0fe4e7d Ifdef out utmp.h on Darwin to un-break the build after r289878 ([msan] Intercept getutent and friends).
llvm-svn: 289881
2016-12-15 22:40:24 +00:00
Evgeniy Stepanov 40f05dcec9 [msan] Intercept getutent and friends.
Differential Revision: https://reviews.llvm.org/D27791

llvm-svn: 289878
2016-12-15 22:00:14 +00:00
Hans Wennborg 603679849d Revert r289690 "[sanitizer] intercept bstring functions, patch by Kuang-che Wu (https://reviews.llvm.org/D27659)"
It breaks programs on Mac. See comments on the code review for details.

llvm-svn: 289864
2016-12-15 20:11:12 +00:00
Saleem Abdulrasool c9dcfc5182 xray: fix assembly macro definition
projects/compiler-rt/lib/xray/xray_trampoline_x86_64.S:33:7: error: unexpected token in '.endm' directive
  .endm SAVE_REGISTERS
	^
  projects/compiler-rt/lib/xray/xray_trampoline_x86_64.S:52:7: error: unexpected token in '.endm' directive
  .endm RESTORE_REGISTERS
	^

Remove the trailing name on the `.endm` which does not take the name of the
macro.  This should bring the compiler-rt build bot back into working state.

llvm-svn: 289852
2016-12-15 18:54:27 +00:00
Saleem Abdulrasool 561117caba sanitizers: silence -pedantic warning
projects/compiler-rt/lib/sanitizer_common/sanitizer_coverage_libcdep_new.cc:142:2: warning: extra ';' [-Wpedantic]
   };  // namespace
    ^

Identified by gcc 6.

llvm-svn: 289851
2016-12-15 18:54:25 +00:00
Kostya Kortchinsky 47be0edfa3 [scudo] Use DefaultSizeClassMap for 32-bit
Summary:
With the recent changes to the Secondary, we use less bits for UnusedBytes,
which allows us in return to increase the bits used for Offset. That means
that we can use a Primary SizeClassMap allowing for a larger maximum size.

Reviewers: kcc, alekseyshl

Subscribers: llvm-commits

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

llvm-svn: 289838
2016-12-15 18:06:55 +00:00
Mike Aizatsky 94752697ee [sanitizers] dont dump coverage if not asked to
llvm-svn: 289835
2016-12-15 17:30:58 +00:00
Kuba Mracek 659949cb03 [tsan] Add interceptor for libcxx __shared_count::__release_shared()
We already have an interceptor for __shared_weak_count::__release_shared, this patch handles __shared_count::__release_shared in the same way. This should get rid of TSan false positives when using std::future.

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

llvm-svn: 289831
2016-12-15 16:45:28 +00:00
Dean Michael Berris 76e56c6777 [XRay][compiler-rt][NFC] Deduplicate code in x86-64 trampolines.
Summary:
The layout of all registers saved on stack shouldn't deviate and will be reused in future trampolines as well.

While there, fix whitespace and clarify comments.

Author: mpel

Reviewers: dberris

Subscribers: llvm-commits

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

llvm-svn: 289789
2016-12-15 09:04:05 +00:00
Marcos Pividori 4b9853ffa8 Fix simple cmake error when COMPILER_RT_SUPPORTED_ARCH is empty.
Differential Revision: https://reviews.llvm.org/D27719

llvm-svn: 289749
2016-12-15 01:21:04 +00:00
Kostya Serebryany 6bca8423c9 [sanitizer] intercept bstring functions, patch by Kuang-che Wu (https://reviews.llvm.org/D27659)
llvm-svn: 289690
2016-12-14 19:10:17 +00:00
Dmitry Vyukov 963f5490e2 tsan: allow Java VM iterate over allocated objects
Objects may move during the garbage collection, and JVM needs
to notify ThreadAnalyzer about that. The new function
__tsan_java_find eliminates the need to maintain these
objects both in ThreadAnalyzer and JVM.

Author: Alexander Smundak (asmundak)
Reviewed in https://reviews.llvm.org/D27720

llvm-svn: 289682
2016-12-14 18:20:18 +00:00
Kostya Kortchinsky a37860acee [scudo] Relax the memalign test
Summary:
Now that we are not rounding up the sizes passed to the secondary allocator,
the memalign test could run out of aligned addresses to return for larger
alignments. We now reduce the size of the quarantine for that test, and
allocate less chunks for the larger alignments.

Subscribers: llvm-commits

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

llvm-svn: 289665
2016-12-14 16:38:11 +00:00
Mike Aizatsky f775dbb5f4 [sanitizers] -DAG is order-independent check
llvm-svn: 289606
2016-12-13 22:26:04 +00:00
Reid Kleckner 76e881903d Add DLL thunks for new sancov APIs to fix Windows tests
llvm-svn: 289587
2016-12-13 20:54:45 +00:00
Kostya Kortchinsky c74da7ce58 Corrected D27428: Do not use the alignment-rounded-up size with secondary
Summary:
I atually had an integer overflow on 32-bit with D27428 that didn't reproduce
locally, as the test servers would manage allocate addresses in the 0xffffxxxx
range, which led to some issues when rounding addresses.

At this point, I feel that Scudo could benefit from having its own combined
allocator, as we don't get any benefit from the current one, but have to work
around some hurdles (alignment checks, rounding up that is no longer needed,
extraneous code).

Reviewers: kcc, alekseyshl

Subscribers: llvm-commits, kubabrecka

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

llvm-svn: 289572
2016-12-13 19:31:54 +00:00
Reid Kleckner 125b15e6c9 Fix warning for noreturn function
llvm-svn: 289568
2016-12-13 19:01:41 +00:00
Ulrich Weigand 50d4ec66d4 [sancov] Disable failing test on SystemZ as well
This doesn't work at all on big-endian systems, even just reading in the
magic bytes in the binary .sancov file header gets byte order wrong.

llvm-svn: 289539
2016-12-13 14:44:25 +00:00
Renato Golin 08c2563cb1 [sancov] Mark as unstable on ARM, not XFAIL, since it does pass on some config
llvm-svn: 289526
2016-12-13 10:22:49 +00:00
Mike Aizatsky f723811972 [sanitizers] dso order is random, test shouldnt depend on it
llvm-svn: 289516
2016-12-13 05:24:57 +00:00
Mike Aizatsky b67efec03b [sanitizers] powerpc4 is also unsupported platform
llvm-svn: 289515
2016-12-13 05:21:19 +00:00
Mike Aizatsky df80572d1f [sanitizers] disabling dso test as well where appropriate
llvm-svn: 289508
2016-12-13 01:11:46 +00:00
Mike Aizatsky e20a4c8859 [sanitizers] trace-pc-guard doesn't work on mac as well
fatal error: error in backend: Global variable '__sancov_gen_' has an
invalid section specifier '__sancov_guards': mach-o section specifier
requires a segment and section separated by a comma.

llvm-svn: 289507
2016-12-13 01:10:21 +00:00
Mike Aizatsky 1e2f30e957 [sanitizers] sancov really works on x86 only
llvm-svn: 289505
2016-12-13 00:34:33 +00:00
Dean Michael Berris 481294e3c7 [XRay][compiler-rt] Use explicit comparisons in unit tests.
Summary:
This should improve the error messages generated providing a bit more
information when the failures are printed out. One example of a
contrived error looks like:

```
Expected: (Buffers.getBuffer(Buf)) != (std::error_code()), actual:
system:0 vs system:0
```

Because we're using error codes, the default printing gets us more
useful information in case of failure.

This is a follow-up on D26232.

Reviewers: rSerge

Subscribers: llvm-commits

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

llvm-svn: 289501
2016-12-13 00:17:31 +00:00
Mike Aizatsky aaa637001a [sancov] __sanitizer_dump_coverage api
Subscribers: kubabrecka, mgorny

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

llvm-svn: 289498
2016-12-12 23:45:38 +00:00
Petr Hosek f332d190cc [compiler-rt] Support building builtins for a single target
This is used when building builtins for multiple targets as part
of LLVM runtimes.

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

llvm-svn: 289489
2016-12-12 23:14:02 +00:00
Peter Collingbourne 9d763b22af symbolizer: Add lseek64 to global symbol list.
llvm-svn: 289449
2016-12-12 17:55:40 +00:00
Petr Hosek 627f686ffc [XRay][CMake] Check target for XRay Flight Data Recorder
This target doesn't currently do anything, but it is required by
the runtimes build.

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

llvm-svn: 289420
2016-12-12 05:18:36 +00:00
Kuba Mracek 1c002267fb [sanitizer] Make sure libmalloc doesn't remove the sanitizer zone from malloc_zones[0]
In certain OS versions, it was possible that libmalloc replaced the sanitizer zone from being the default zone (i.e. being in malloc_zones[0]). This patch introduces a failsafe that makes sure we always stay the default zone. No testcase for this, because this doesn't reproduce under normal circumstances.

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

llvm-svn: 289376
2016-12-11 08:45:36 +00:00
Kuba Mracek b93f78128f [sanitizer] Handle malloc_destroy_zone() on Darwin
We currently have a interceptor for malloc_create_zone, which returns a new zone that redirects all the zone requests to our sanitizer zone. However, calling malloc_destroy_zone on that zone will cause libmalloc to print out some warning messages, because the zone is not registered in the list of zones. This patch handles this and adds a testcase for that.

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

llvm-svn: 289375
2016-12-11 08:42:42 +00:00
Renato Golin 3bdc0f165b [DFSAN] Another unstable test in AArch64 breaking bots unnecessarily
llvm-svn: 289253
2016-12-09 19:02:04 +00:00
Kostya Kortchinsky bfeb7990b2 Reverting rL289088 while investigating some test issue on the build servers
Subscribers: kubabrecka

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

llvm-svn: 289180
2016-12-09 03:28:12 +00:00
Vitaly Buka 5d16b9b8dd [sanitizer] Add workaround for empty strings
Summary: I see crashes on this check when some reports are being generated.

Reviewers: eugenis

Subscribers: kubabrecka, llvm-commits

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

llvm-svn: 289145
2016-12-08 22:26:03 +00:00
Vitaly Buka 6eead19ce4 [asan] Add test which detects bugs undetectable before r288563
Reviewers: kcc, eugenis

Subscribers: llvm-commits, kubabrecka

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

llvm-svn: 289090
2016-12-08 19:13:13 +00:00
Kostya Kortchinsky 2defe4d9a1 [sanitizer] Do not use the alignment-rounded-up size when using the secondary
Summary:
The combined allocator rounds up the requested size with regard to the
alignment, which makes sense when being serviced by the primary as it comes
with alignment guarantees, but not with the secondary. For the rare case of
large alignments, it wastes memory, and entices unnecessarily large fields for
the Scudo header. With this patch, we pass the non-alignement-rounded-up size
to the secondary, and adapt the Scudo code for this change.

Reviewers: alekseyshl, kcc

Subscribers: llvm-commits, kubabrecka

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

llvm-svn: 289088
2016-12-08 19:05:46 +00:00
Etienne Bergeron 58ee3b786d [compiler-rt][asan] Fix overlaping parameters for memmove/memcpy on windows.
Summary:
On windows, memmove and memcpy may be the same functions (on 64-bits).

```
-- f:\dd\vctools\crt\vcruntime\src\string\amd64\memcpy.asm --------------------

        OPTION PROLOGUE:NONE, EPILOGUE:NONE

        memmove = memcpy
        mov     r11, rcx                ; save destination address
```


This is causing ASAN to report overlaping parameters when instrumenting chromium.

```
D:\src\chromium\src>out\asan64\chrome.exe --no-sandbox
[8956:6208:1121/162511:ERROR:entry.cc(167)] Entry::Deserialize: dictionary has no interface_provider_specs key
[8956:11560:1121/162511:ERROR:external_registry_loader_win.cc(130)] Missing value path for key Software\Google\Chrome\Ex
tensions\doeiiacdhfmpdeckdaifnjaemmkkdlkf.
=================================================================
==5132==ERROR: AddressSanitizer: memcpy-param-overlap: memory ranges [0x000000237ee8,0x000000237eea) and [0x000000237ee9
, 0x000000237eeb) overlap
```

The error triggered on chromium:
```
Child-SP          RetAddr           Call Site
00000000`00166520 00000001`400a4886 chrome!__asan::ReportStringFunctionMemoryRangesOverlap+0x23 [d:\src\llvm\llvm\projects\compiler-rt\lib\asan\asan_report.cc @ 305]
*** WARNING: Unable to verify checksum for D:\src\chromium\src\out\asan64dynamic\libglesv2.dll
00000000`001672a0 000007fe`e1859607 chrome!__asan_wrap_memcpy+0xf6 [d:\src\llvm\llvm\projects\compiler-rt\lib\asan\asan_interceptors.cc @ 458]
00000000`00167b30 000007fe`e184bcbc libglesv2!__acrt_fp_strflt_to_string+0xb7 [d:\th\minkernel\crts\ucrt\src\appcrt\convert\_fptostr.cpp @ 86]
(Inline Function) --------`-------- libglesv2!fp_format_f+0x57 [d:\th\minkernel\crts\ucrt\src\appcrt\convert\cvt.cpp @ 578]
00000000`00167b60 000007fe`e182e2a2 libglesv2!__acrt_fp_format+0x180 [d:\th\minkernel\crts\ucrt\src\appcrt\convert\cvt.cpp @ 722]
00000000`00167bf0 000007fe`e182ce80 libglesv2!__crt_stdio_output::output_processor<char,__crt_stdio_output::stream_output_adapter<char>,__crt_stdio_output::format_validation_
```


This bug is similar to: https://llvm.org/bugs/show_bug.cgi?id=16362

Reviewers: rnk, zaks.anna, filcab

Subscribers: filcab, kubabrecka, chrisha, llvm-commits, dberris

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

llvm-svn: 289063
2016-12-08 15:53:33 +00:00
Sagar Thakur 76a878b8f8 [MSAN][MIPS] Fix fork.cc test on MIPS
Summary: For platforms which support slow unwinder only, we restrict the store context size to 1, basically only storing the current pc. We do this because the slow unwinder which is based on libunwind is not async signal safe and causes random freezes in forking applications as well as in signal handlers.

Reviewed by eugenis.
Differential: D23107

llvm-svn: 289027
2016-12-08 06:30:58 +00:00
Serge Rogatch 3c265b55fc [XRay][AArch64] Disable the unstable test XRay-aarch64-linux::patching-unpatching.cc
Summary:
The test `XRay-aarch64-linux::patching-unpatching.cc` sometimes passes, sometimes fails on buildbots.
This patch disables test `patching-unpatching.cc` for AArch64 targets.

Reviewers: rengolin, dberris

Subscribers: llvm-commits, iid_iunknown, aemerson

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

llvm-svn: 288988
2016-12-07 22:00:02 +00:00
Weiming Zhao 0a274c5954 [builtin] Add Thumb1 implementation for idivsi3 and aeabi_idivmod
Summary:
For idivsi3, convert the Thumb2 only instruction to thumb1.
For aeabi_idivmod, using __divsi3.

Reviewers: rengolin, compnerd

Subscribers: llvm-commits

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

llvm-svn: 288960
2016-12-07 19:14:29 +00:00
Weiming Zhao a913f7ddbe [builtin] for the condition for check __ARM_FEATURE_CLZ
Summary: Since CLZ is not available for Thumb1, we use __ARM_ARCH_ISA_THUMB != 1 as one of the conditions.

Reviewers: rnk, compnerd, rengolin

Subscribers: aemerson, rengolin, llvm-commits

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

llvm-svn: 288954
2016-12-07 18:41:07 +00:00
Renato Golin cb2443e80c [asan] Disable yet another unstable test under AArch64
llvm-svn: 288953
2016-12-07 18:37:49 +00:00
Dean Michael Berris d0b3c6c8e6 [XRay][compiler-rt] Explicitly add dependency to pthread
This should fix the sanitizer bootstrap builds.

Follow-up to D26232.

llvm-svn: 288860
2016-12-06 23:08:45 +00:00
Evgeniy Stepanov 74cf034805 Replace "|&" with "2>&1 |" to support bash pre-4
Summary: Old bash release (3.2) on SLES11 chokes on new redirection shortcut.

Patch by Brian Cain.

Reviewers: eugenis

Subscribers: llvm-commits, kubabrecka

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

llvm-svn: 288854
2016-12-06 22:02:21 +00:00