Commit Graph

39 Commits

Author SHA1 Message Date
Sam Kerner e5ce95c660 [dfsan] Fix a bug in strcasecmp() and strncasecmp(): Compare the lowercase versions of the characters when choosing a return value.
Summary:
Resolves this bug:

  https://bugs.llvm.org/show_bug.cgi?id=38369

Reviewers: morehouse, pcc

Reviewed By: morehouse

Subscribers: #sanitizers

Tags: #sanitizers

Differential Revision: https://reviews.llvm.org/D78490
2020-04-20 17:13:40 -07:00
Sam Kerner 10070e31a5 Fix DataFlowSanitizer implementation of strchr() so that strchr(..., '\0') returns a pointer to '\0'.
Summary:

Fixes https://bugs.llvm.org/show_bug.cgi?id=22392

Reviewers: pcc, morehouse

Reviewed By: morehouse

Subscribers: morehouse, #sanitizers

Tags: #sanitizers

Differential Revision: https://reviews.llvm.org/D77996
2020-04-15 13:08:47 -07:00
Matt Morehouse 30bb737a75 [DFSan] Add __dfsan_cmp_callback.
Summary:
When -dfsan-event-callbacks is specified, insert a call to
__dfsan_cmp_callback on every CMP instruction.

Reviewers: vitalybuka, pcc, kcc

Reviewed By: kcc

Subscribers: hiraditya, #sanitizers, eugenis, llvm-commits

Tags: #sanitizers, #llvm

Differential Revision: https://reviews.llvm.org/D75389
2020-02-28 15:49:44 -08:00
Matt Morehouse f668baa459 [DFSan] Add __dfsan_mem_transfer_callback.
Summary:
When -dfsan-event-callbacks is specified, insert a call to
__dfsan_mem_transfer_callback on every memcpy and memmove.

Reviewers: vitalybuka, kcc, pcc

Reviewed By: kcc

Subscribers: eugenis, hiraditya, #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

Differential Revision: https://reviews.llvm.org/D75386
2020-02-28 15:48:25 -08:00
Matt Morehouse 52f889abec [DFSan] Add __dfsan_load_callback.
Summary:
When -dfsan-event-callbacks is specified, insert a call to
__dfsan_load_callback() on every load.

Reviewers: vitalybuka, pcc, kcc

Reviewed By: vitalybuka, kcc

Subscribers: hiraditya, #sanitizers, llvm-commits, eugenis, kcc

Tags: #sanitizers, #llvm

Differential Revision: https://reviews.llvm.org/D75363
2020-02-28 14:26:09 -08:00
Matt Morehouse 470db54cbd [DFSan] Add flag to insert event callbacks.
Summary:
For now just insert the callback for stores, similar to how MSan tracks
origins.  In the future we may want to add callbacks for loads, memcpy,
function calls, CMPs, etc.

Reviewers: pcc, vitalybuka, kcc, eugenis

Reviewed By: vitalybuka, kcc, eugenis

Subscribers: eugenis, hiraditya, #sanitizers, llvm-commits, kcc

Tags: #sanitizers, #llvm

Differential Revision: https://reviews.llvm.org/D75312
2020-02-27 17:14:19 -08:00
Nico Weber c4310f921d compiler-rt: Rename .cc file in test/dfsan to cpp
See r367849 et al.

llvm-svn: 367854
2019-08-05 13:19:28 +00:00
Reid Kleckner 8007ff1ab1 [compiler-rt] Rename lit.*.cfg.* -> lit.*.cfg.py.*
These lit configuration files are really Python source code. Using the
.py file extension helps editors and tools use the correct language
mode. LLVM and Clang already use this convention for lit configuration,
this change simply applies it to all of compiler-rt.

Reviewers: vitalybuka, dberris

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

llvm-svn: 364591
2019-06-27 20:56:04 +00:00
Kostya Serebryany 6b936d88a4 [dfsan] Introduce dfsan_flush().
Summary:
dfsan_flush() allows to restart tain tracking from scratch in the same process.
The primary purpose right now is to allow more efficient data flow tracing
for DFT fuzzing: https://github.com/google/oss-fuzz/issues/1632

Reviewers: pcc

Reviewed By: pcc

Subscribers: delcypher, #sanitizers, llvm-commits

Tags: #llvm, #sanitizers

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

llvm-svn: 363321
2019-06-13 20:11:06 +00:00
Kostya Serebryany 300c0c79de Experimantal dfsan mode "fast16labels=1"
Summary:
dfsan mode "fast16labels=1".
In this mode the labels are treated as 16-bit bit masks.

Reviewers: pcc

Reviewed By: pcc

Subscribers: delcypher, #sanitizers, llvm-commits

Tags: #llvm, #sanitizers

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

llvm-svn: 362859
2019-06-08 00:22:23 +00:00
Kostya Serebryany d74d04a6c5 Add weak definitions of trace-cmp hooks to dfsan
Summary:
This allows to build and link the code with e.g.
-fsanitize=dataflow -fsanitize-coverage=trace-pc-guard,pc-table,func,trace-cmp
w/o providing (all) the definitions of trace-cmp hooks.

This is similar to dummy hooks provided by asan/ubsan/msan for the same purpose,
except that some of the hooks need to have the __dfsw_ prefix
since we need dfsan to replace them.

Reviewers: pcc

Reviewed By: pcc

Subscribers: delcypher, #sanitizers, llvm-commits

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

llvm-svn: 333796
2018-06-01 21:59:25 +00:00
Simon Dardis a1b7447dfd [compiler-rt][dfsan][mips] UnXPASS a consistently passing test
llvm-svn: 329422
2018-04-06 17:03:36 +00:00
Simon Dardis f570c76c5c [mips] XFAIL dfsan's custom.cc test on mips64.
Test was already marked as failing for mips64el. Now that it's being
tested on mips64, it has to be XFAILed there as well.

llvm-svn: 302570
2017-05-09 19:17:16 +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
Kuba Mracek ff1bd20ded [sanitizer] Add macOS minimum deployment target to all compiler invocations in lit tests
The Clang driver on macOS decides the deployment target based on various things, like your host OS version, the SDK version and some environment variables, which makes lit tests pass or fail based on your environment. Let's make sure we run all lit tests with `-mmacosx-version-min=${SANITIZER_MIN_OSX_VERSION}` (10.9 unless overriden).

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

llvm-svn: 288186
2016-11-29 19:25:53 +00:00
Daniel Sanders 6a540c1f38 [mips] XFAIL the new mips64el compiler-rt tests that fail on clang-cmake-mipsel.
The mips64el compiler-rt build has recently been enabled. XFAIL the failing
tests to make the buildbot green again.

The two asan tests require the integrated assembler. This will be fixed soon
for Debian mips64el but not for any other mips64el targets since doing so
requires triple-related issues to be fixed..
The msan tests are largely failing because caused by a kernel update (a patch
has already been posted for this).
I'm not sure why the dfsan test fails yet.

llvm-svn: 278504
2016-08-12 11:56:36 +00:00
Etienne Bergeron ab42f4ddba [compiler-rt] Fix VisualStudio virtual folders layout
Summary:
This patch is a refactoring of the way cmake 'targets' are grouped.
It won't affect non-UI cmake-generators.

Clang/LLVM are using a structured way to group targets which ease
navigation through Visual Studio UI. The Compiler-RT projects
differ from the way Clang/LLVM are grouping targets.

This patch doesn't contain behavior changes.

Reviewers: kubabrecka, rnk

Subscribers: wang0109, llvm-commits, kubabrecka, chrisha

Differential Revision: http://reviews.llvm.org/D21952

llvm-svn: 275111
2016-07-11 21:51:56 +00:00
Alex Denisov a3f5c4c047 Replace hardcoded comment at 'lit.site.cfg.in'
At the moment almost every lit.site.cfg.in contains two lines comment:

  ## Autogenerated by LLVM/Clang configuration.
  # Do not edit!

The patch adds variable LIT_SITE_CFG_IN_HEADER, that is replaced from
configure_lit_site_cfg with the note and some useful information.

llvm-svn: 266520
2016-04-16 07:03:45 +00:00
Mohit K. Bhakkad 78e3b0e2a9 [DFSan] Fix test_inet_pton for big endian archs
Reviewers: samsonov

Subscribers: ed, jaydeep, sagar, llvm-commits

Differential Revision: http://reviews.llvm.org/D17751

llvm-svn: 263001
2016-03-09 08:00:37 +00:00
Alexey Samsonov e26c87d10e [tests] Always specify correct config.target_arch when configuring test suite.
llvm-svn: 261601
2016-02-23 01:34:17 +00:00
Daniel Sanders 922f95ce4b [dfsan] Run the tests for each supported arch and suffix each one to distinguish them.
Summary:
Previously, the tests only ran for the 64-bit equivalent of the default target
(see -m64).
Given the supported architecture list only contains 64-bit targets, this happens
to work out the same as the supported targets in most cases but may matter for
X86_64/X86_64h on Darwin.

For other targets, the practical effect is that the test names contain the
architecture. This resolves some confusion when msan tests fail since their
name no longer implies that they are trying to test the default target.

Reviewers: samsonov

Subscribers: tberghammer, danalbert, llvm-commits, srhines

Differential Revision: http://reviews.llvm.org/D16856

llvm-svn: 260231
2016-02-09 16:20:37 +00:00
Renato Golin 341d42c270 [AArch64|DFSAN] XPASS custom.cc, as it got fixed by r243686
llvm-svn: 243743
2015-07-31 10:50:29 +00:00
Adhemerval Zanella 4e3b4ac241 [dfsan] Enable dfsan for aarch64
This patch enable DFSan for AArch64 (39-bit VMA).  All tests are passing
but:

 * test/dfsan/custom.cc

Due an invalid access in dl_iterate_phdr instrumentation (commenting out
this function make the testcase to pass).  The test is XFAIL for aarch64
for now.

llvm-svn: 243688
2015-07-30 21:13:21 +00:00
Lorenzo Martignoni 4879003022 Extend s{,n}printf custom wrappers to support '*' in the format specifiers
Differential Revision: http://reviews.llvm.org/D8966

llvm-svn: 234633
2015-04-10 20:58:28 +00:00
Peter Collingbourne 8f9a3f2d7e Revert r234477, "Differential Revision: http://reviews.llvm.org/D7249"
Should unbreak fuzzer buildbot.

llvm-svn: 234542
2015-04-09 22:42:01 +00:00
Lorenzo Martignoni 59886f3c1a Differential Revision: http://reviews.llvm.org/D7249
llvm-svn: 234477
2015-04-09 11:42:33 +00:00
Alexey Samsonov 3e40703ab5 [DFSan] Remove explicit -m64 from RUN lines.
Target-specific flags should usually be configured by CMake/lit.

llvm-svn: 230997
2015-03-02 19:34:06 +00:00
Lorenzo Martignoni 101f1d82ff [DFSan] Add flag to dump the labels when the program terminates.
Differential Revision: http://reviews.llvm.org/D6306

llvm-svn: 222425
2014-11-20 10:01:08 +00:00
Peter Collingbourne f20091118c [dfsan] Add runtime function for aborting on indirect calls to
uninstrumented vararg functions.

llvm-svn: 221364
2014-11-05 17:21:11 +00:00
Peter Collingbourne b190e1b74b Update __dfsw_s{,n}printf custom functions for new calling convention.
Differential Revision: http://reviews.llvm.org/D6029

llvm-svn: 220907
2014-10-30 13:23:01 +00:00
Lorenzo Martignoni 60ebffc12f Custom wrappers for DFSanitizing sprintf & snprintf.
Differential Revision: http://reviews.llvm.org/D5561

llvm-svn: 219293
2014-10-08 10:01:42 +00:00
Peter Collingbourne 8501e39a85 [dfsan] Fix the declaration of dfsan_add_label.
llvm-svn: 210202
2014-06-04 17:54:51 +00:00
Greg Fitzgerald b8aae5405b Add %run to all lit tests
llvm-svn: 207709
2014-04-30 21:34:17 +00:00
Peter Collingbourne 16f2f18105 Add user-defined callback on write() calls.
Add dfsan_set_write_callback(), which sets a callback to be invoked when
a write() call is invoked within DFSan instrumented code.

Patch by Sam Kerner!

Differential Revision: http://reviews.llvm.org/D3268

llvm-svn: 207131
2014-04-24 17:42:16 +00:00
Peter Collingbourne 5d167dae7d Add function to get the number of DFSan labels allocated.
Expose the number of DFSan labels allocated by adding function dfsan_get_label_count().

Patch by Sam Kerner!

Differential Revision: http://llvm-reviews.chandlerc.com/D3109

llvm-svn: 204854
2014-03-26 21:09:53 +00:00
Alexey Samsonov 5e6d83258e [CMake] lit tests shouldn't depend on runtimes in standalone build
llvm-svn: 201771
2014-02-20 09:47:18 +00:00
Alexey Samsonov 31043152d3 Add rudimentary support for running compiler-rt lit tests with GCC
llvm-svn: 201680
2014-02-19 15:13:14 +00:00
Alexey Samsonov 1c9b9bcb5c Simplify defining Clang compile flags in lit configs
llvm-svn: 201513
2014-02-17 13:08:10 +00:00
Alexey Samsonov f6cf6ab53b Move DFSan test suite under test/
llvm-svn: 201403
2014-02-14 12:05:41 +00:00