Commit Graph

7953 Commits

Author SHA1 Message Date
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
Dean Michael Berris 406200eae6 [XRay][compiler-rt] Only add unit tests if we're building XRay.
As constructed before this patch, in case we run into case where we
don't actually build the XRay library, we really ought to not be adding
the unit test runs. This should fix the bootstrap build failures.

This is a follow-up further to D26232.

llvm-svn: 288788
2016-12-06 09:43:44 +00:00
Dean Michael Berris dcd2748a34 [XRay][compiler-rt] CMake fixes for XRay -- take 2.
The bootstrap buildbot complains about not being able to find the
unittests for XRay, when the conditionals to include or not include
tests and unit tests don't match.

This is a follow-up to D26232.

llvm-svn: 288786
2016-12-06 08:40:16 +00:00
Dean Michael Berris d94c0bf4be [XRay][compiler-rt] Fix unit test adding logic.
Before this change we would add the unit tests potentially even if we
don't actually include the unit tests.

This is a follow-up on D26232.

llvm-svn: 288785
2016-12-06 08:22:31 +00:00
Weiming Zhao 05fec0907d builtins: Add ARM Thumb1 implementation for uidiv and uidivmod
This is a resubmit of r288710 due to breakage of Darwin armv7em.

llvm-svn: 288777
2016-12-06 07:13:15 +00:00
Dean Michael Berris 21e877c6d9 [XRay][compiler-rt] Explicitly initialise members.
Before this, the change committed in D26232 might have an uninitialised
std::atomic<bool> that may or may not have a valid state. On aarch64
this breaks consistently, while it doesn't manifest as a problem in
x86_64.

This is an attempt to un-break this in aarch64.

llvm-svn: 288776
2016-12-06 06:58:15 +00:00
Dean Michael Berris abe04e3295 [XRay][compiler-rt] XRay Buffer Queue
This implements a simple buffer queue to manage a pre-allocated queue of
fixed-sized buffers to hold XRay records. We need this to support
Flight Data Recorder (FDR) mode. We also implement this as a sub-library
first to allow for development before actually using it in an
implementation.

Some important properties of the buffer queue:

- Thread-safe enqueueing/dequeueing of fixed-size buffers.
- Pre-allocation of buffers at construction.

This is a re-roll of the previous attempt to submit, because it caused
failures in arm and aarch64.

Reviewers: majnemer, echristo, rSerge

Subscribers: tberghammer, danalbert, srhines, modocache, mehdi_amini, mgorny, llvm-commits

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

llvm-svn: 288775
2016-12-06 06:24:08 +00:00
Chris Bieneman 31150cbdc9 Revert "builtins: Add ARM Thumb1 implementation for uidiv and uidivmod"
This reverts commit r288710.

r288710 breaks building the builtin libraries on Darwin for armv7em.

Build logs may still be avaialable here:
http://lab.llvm.org:8080/green/job/clang-stage2-configure-Rlto_build/12035/console

llvm-svn: 288773
2016-12-06 05:41:32 +00:00
Serge Rogatch 882fc5d0a3 [XRay][AArch64] Attempt to fix unstable test XRay-aarch64-linux::patching-unpatching.cc
Summary: Currently test XRay-aarch64-linux::patching-unpatching.cc sometimes passes, sometimes fails. This is an attempt to fix it by handling better the situations when both `__arm__` and `__aarch64__` are defined.

Reviewers: dberris, rengolin

Subscribers: llvm-commits, iid_iunknown, aemerson, rengolin, dberris

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

llvm-svn: 288729
2016-12-05 23:29:56 +00:00
Mike Aizatsky 48ee418f88 [sanitizers] mac prints null differently
llvm-svn: 288726
2016-12-05 23:06:07 +00:00
Mike Aizatsky 0d98da7c1f [sanitizers] __sanitizer_get_module_and_offset_for_pc interface function
Summary: The function computes full module name and coverts pc into offset.

Reviewers: kcc

Subscribers: kubabrecka

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

llvm-svn: 288711
2016-12-05 21:45:14 +00:00
Weiming Zhao adf4258f50 builtins: Add ARM Thumb1 implementation for uidiv and uidivmod
Summary:
The current uidiv supports archs without clz. However, the asm is for thumb2/arm.
For uidivmod, the existing code calls the C version of uidivmodsi4, which then calls uidiv. The extra push/pop/bl makes it less efficient.

Reviewers: jmolloy, jroelofs, joerg, compnerd, rengolin

Subscribers: llvm-commits, aemerson

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

llvm-svn: 288710
2016-12-05 21:40:36 +00:00
Kuba Mracek c14916dae7 [compiler-rt] Remove duplicates from COMPILER_RT_SUPPORTED_ARCH
Since we’re adding an entry into COMPILER_RT_SUPPORTED_ARCH for all architectures of all Darwin platforms, COMPILER_RT_SUPPORTED_ARCH often ends up having duplicate items. Let’s remove them.

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

llvm-svn: 288681
2016-12-05 17:52:45 +00:00
Daniel Jasper 724df6e8b7 Remove a couple of memset usages from TSan, introduced in r288624.
TSan runtime shouldn't contain memset, so internal_memset is used
instead and syntax that emits memset is avoided.

This doesn't fail in-tree due to TSan being build with -03, but it fails
when TSan is built with -O0, and is (I think) a true positive.

Patch by Sam McCall, review: https://reviews.llvm.org/D27407

llvm-svn: 288672
2016-12-05 14:37:42 +00:00
Kuba Mracek 8f34233318 [sanitizer] Make atos stdin a non-tty pipe to make sure it's not stuck waiting for user input
On macOS, we often symbolicate using atos (when llvm-symbolizer is not found). The current way we invoke atos involves creating a pseudo-terminal to make sure atos doesn't buffer its output. This however also makes atos think that it's stdin is interactive and in some error situations it will ask the user to enter some input instead of just printing out an error message. For example, when Developer Mode isn't enabled on a machine, atos cannot examine processes, and it will ask the user to enter an administrator's password, which will make the sanitized process get stuck. This patch only connects the pseudo-terminal to the stdout of atos, and uses a regular pipe as its stdin.

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

llvm-svn: 288624
2016-12-04 21:52:21 +00:00