Commit Graph

138 Commits

Author SHA1 Message Date
Francis Ricci 0d920c4418 Only scan global sections containing data in LSan on darwin
Summary:
__DATA segments on Darwin contain a large number of separate sections,
many of which cannot actually contain pointers, and contain const values or
objc metadata. Not scanning sections which cannot contain pointers significantly
improves performance.

On a medium-sized (~4000 files) internal project, I saw a speedup of about 30%
in standalone LSan's execution time (30% improvement in the time spent running
LSan, not the total program time).

Reviewers: kcc, kubamracek, alekseyshl

Subscribers: llvm-commits

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

llvm-svn: 308999
2017-07-25 18:16:58 +00:00
Vitaly Buka d4abe9e7d3 [sanitizer_common] Move filesystem-related code out of sanitizer_common.cc
Summary:
This is a pure refactoring change.  It just moves code that is
related to filesystem operations from sanitizer_common.{cc,h} to
sanitizer_file.{cc,h}.  This makes it cleaner to disable the
filesystem-related code for a new port that doesn't want it.

Submitted on behalf of Roland McGrath.

Reviewers: kcc, eugenis, alekseyshl

Reviewed By: alekseyshl

Subscribers: vitalybuka, llvm-commits, kubamracek, mgorny, phosek

Tags: #sanitizers

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

llvm-svn: 308819
2017-07-22 01:46:40 +00:00
Vitaly Buka 094684c155 Revert "[sanitizer_common] Move filesystem-related code out of sanitizer_common.cc"
Breaks Windows build.

This reverts commit r308640.

llvm-svn: 308648
2017-07-20 18:24:45 +00:00
Alex Shlyapnikov 89e85d1717 [sanitizer_common] Move filesystem-related code out of sanitizer_common.cc
This is a pure refactoring change. It just moves code that is
related to filesystem operations from sanitizer_common.{cc,h} to
sanitizer_file.{cc,h}. This makes it cleaner to disable the
filesystem-related code for a new port that doesn't want it.

Commiting for mcgrathr.

Reviewers: alekseyshl

Subscribers: llvm-commits

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

llvm-svn: 308640
2017-07-20 17:48:42 +00:00
Francis Ricci 1b5f773859 Revert "Only scan global sections containing data in LSan on darwin"
This reverts commit 7e46d78d47832f03ce42adcf56417fbfd47cbaad.

llvm-svn: 308394
2017-07-18 23:51:44 +00:00
Francis Ricci 7096b08cd7 Only scan global sections containing data in LSan on darwin
Summary:
__DATA segments on Darwin contain a large number of separate sections,
most of which cannot actually contain pointers, and contain const values or
objc metadata. Only scanning sections which can contain pointers greatly improves
performance.

On a medium-sized (~4000 files) internal project, I saw a speedup of about 50%
in standalone LSan's execution time (50% improvement in the time spent running
LSan, not the total program time).

Reviewers: kcc, kubamracek, alekseyshl

Subscribers: llvm-commits

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

llvm-svn: 308231
2017-07-17 23:03:03 +00:00
Francis Ricci dd592ff467 Use write instead of read permissions to check for global sections on mac
Summary:
The LINKEDIT section is very large and is read-only. Scanning this
section caused LSan on darwin to be very slow. When only writable sections
are scanned for global pointers, performance improved by a factor of about 25x.

Reviewers: alekseyshl, kubamracek

Subscribers: llvm-commits

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

llvm-svn: 303422
2017-05-19 13:34:02 +00:00
Francis Ricci 7c6bf1cc9f Don't read non-readable address ranges during lsan pointer scanning
Summary: This specifically addresses the Mach-O zero page, which we cannot read from.

Reviewers: kubamracek, samsonov, alekseyshl

Subscribers: llvm-commits

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

llvm-svn: 300456
2017-04-17 16:34:38 +00:00
Vedant Kumar 2b1eae0aa5 [ubsan] Use the correct tool name in diagnostics
When using ASan and UBSan together, the common sanitizer tool name is
set to "AddressSanitizer". That means that when a UBSan diagnostic is
printed out, it looks like this:

  SUMMARY: AddressSanitizer: ...

This can confuse users. Fix it so that we always use the correct tool
name when printing out UBSan diagnostics.

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

llvm-svn: 300358
2017-04-14 18:24:35 +00:00
Kostya Serebryany 82a41dd6c4 [asan] add one more argument to __sanitizer_print_memory_profile, remove a redundant weak definition.
llvm-svn: 297914
2017-03-15 23:27:14 +00:00
Marcos Pividori e9e0769764 [sanitizer] Define as weak, functions that are declared as weak.
Differential Revision: https://reviews.llvm.org/D29228

llvm-svn: 293681
2017-01-31 20:23:14 +00:00
Marcos Pividori 8650f5d1a1 General definition for weak functions
In this diff, I define a general macro for defining weak functions
with a default implementation: "SANITIZER_INTERFACE_WEAK_DEF()".
This way, we simplify the implementation for different platforms.

For example, we cannot define weak functions on Windows, but we can
use linker pragmas to create an alias to a default implementation.
All of these implementation details are hidden in the new macro.

Also, as I modify the name for exported weak symbols on Windows, I
needed to temporarily disable "dll_host" test for asan, which checks
the list of functions included in asan_win_dll_thunk.

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

llvm-svn: 293419
2017-01-29 05:44:59 +00:00
Kuba Mracek b6c6eaf226 [sanitizer] Add a 'print_module_map' flag which prints modules with UUIDs on Darwin
This patch add a new sanitizer flag, print_module_map, which enables printing a module map when the process exits, or after each report (for TSan). The output format is very similar to what Crash Reporter produces on Darwin (e.g. the format of module UUIDs). This enables users to use the existing symbol servers to offline symbolicate and aggregate reports.

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

llvm-svn: 291277
2017-01-06 20:57:47 +00:00
Kuba Mracek 43d287e04e [sanitizer] Track which modules are instrumented in LoadedModule objects
This patch adds tracking which modules are instrumented and which are not. On macOS, instrumented modules link against the ASan/TSan/... dylib, so we can just check if such a load command exists or not.

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

llvm-svn: 291268
2017-01-06 19:34:54 +00:00
Kuba Mracek 3eb98a1318 [sanitizer] Track architecture and UUID of modules in LoadedModule
When we enumerate loaded modules, we only track the module name and base address, which then has several problems on macOS. Dylibs and executables often have several architecture slices and not storing which architecture/UUID is actually loaded creates problems with symbolication: A file path + offset isn't enough to correctly symbolicate, since the offset can be valid in multiple slices. This is especially common for Haswell+ X86_64 machines, where x86_64h slices are preferred, but if one is not available, a regular x86_64 is loaded instead. But the same issue exists for i386 vs. x86_64 as well.

This patch adds tracking of arch and UUID for each LoadedModule. At this point, this information isn't used in reports, but this is the first step. The goal is to correctly identify which slice is loaded in symbolication, and also to output this information in reports so that we can tell which exact slices were loaded in post-mortem analysis.

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

llvm-svn: 288537
2016-12-02 21:27:14 +00:00
Dmitry Vyukov 5dc443619e tsan: always define SANITIZER_GO
Currently we either define SANITIZER_GO for Go or don't define it at all for C++.
This works fine with preprocessor (ifdef/ifndef/defined), but does not work
for C++ if statements (e.g. if (SANITIZER_GO) {...}). Also this is different
from majority of SANITIZER_FOO macros which are always defined to either 0 or 1.

Always define SANITIZER_GO to either 0 or 1.
This allows to use SANITIZER_GO in expressions and in flag default values.

Also remove kGoMode and kCppMode, which were meant to be used in expressions,
but they are not defined in sanitizer_common code, so SANITIZER_GO become prevalent.

Also convert some preprocessor checks to C++ if's or ternary expressions.

Majority of this change is done mechanically with:
sed "s#ifdef SANITIZER_GO#if SANITIZER_GO#g"
sed "s#ifndef SANITIZER_GO#if \!SANITIZER_GO#g"
sed "s#defined(SANITIZER_GO)#SANITIZER_GO#g"

llvm-svn: 285443
2016-10-28 20:14:18 +00:00
Dmitry Vyukov 7e6f8db7aa tsan: fix windows build
Currently fails with:

C:\workdir\compiler-rt\lib\tsan\go>gcc -c -o race_windows_amd64.syso gotsan.cc -I..\rtl -I..\.. -I..\..\sanitizer_common -I..\..\..\include -m64 -Wall -fno-exceptions -fno-rtti -DSANITIZER_GO -Wno-error=at
tributes -Wno-attributes -Wno-format -Wno-maybe-uninitialized -DSANITIZER_DEBUG=0 -O3 -fomit-frame-pointer -std=c++11 
gotsan.cc:9229:0: warning: ignoring #pragma comment  [-Wunknown-pragmas]
 #pragma comment(linker, "/alternatename:__sanitizer_print_memory_profile=__sanitizer_default_print_memory_profile") // NOLINT
 ^
gotsan.cc: In function 'void __sanitizer_print_memory_profile(int)':
gotsan.cc:9226:17: error: redefinition of 'void __sanitizer_print_memory_profile(int)'
 extern "C" void __sanitizer_print_memory_profile(int top_percent) {}
                 ^
gotsan.cc:6898:6: note: 'void __sanitizer_print_memory_profile(int)' previously defined here
 void __sanitizer_print_memory_profile(int top_percent) {


Remove __sanitizer_print_memory_profile from Go build, it is not needed.

llvm-svn: 285400
2016-10-28 14:16:13 +00:00
Ahmed Bougacha 546d2a3820 [sanitizer] Fix darwin Go tsan build by unifying r281567 and r281553.
Avoid redefining the weak stub when building gotsan.cc

llvm-svn: 281576
2016-09-15 04:28:20 +00:00
Kostya Serebryany b72479b84a [asan] first attempt at releasing free-d memory back to the system using madvise. Requires quite some tuning.
llvm-svn: 279887
2016-08-26 23:58:42 +00:00
Kuba Brecka 02478f4166 [sanitizer] Stop unwinding the stack when a close-to-zero PC is found
On OS X, we often get stack trace in a report that ends with a 0x0 frame.  To get rid of it, let's trim the stack trace when we find a close-to-zero value, which is obviously not a valid PC.

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

llvm-svn: 273886
2016-06-27 15:32:18 +00:00
Kostya Serebryany bf6a04fde8 [sanitizers] introduce yet another API function: __sanitizer_install_malloc_and_free_hooks
llvm-svn: 272943
2016-06-16 20:06:06 +00:00
Kostya Serebryany d9a451ab0d [sanitizer] Move termination functions in their own file
Summary:
As suggested by kcc@ in http://reviews.llvm.org/D20084#441418, move the CheckFailed and Die functions, and their associated callback functionalities in their own separate file.
I expended the build rules to include a new rule that would not include those termination functions, so that another project can define their own.
The tests check-{a,t,m,ub,l,e,df}san are all passing.

Reviewers: llvm-commits, kcc

Subscribers: kubabrecka

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

llvm-svn: 271055
2016-05-27 21:57:17 +00:00
Kostya Serebryany 54b7162692 [sanitizers] trying to fix Windows build
llvm-svn: 271050
2016-05-27 21:35:58 +00:00
Kostya Serebryany 1508f591b3 [sanitizers] introduce __sanitizer_set_report_fd so that we can re-route the sanitizer logging to another fd from inside the process
llvm-svn: 271046
2016-05-27 21:23:05 +00:00
Kuba Brecka e0c8256781 [sanitizer] Break infinite recursion in case of recursive failed CHECKs
While debugging ASan and TSan, I sometimes get a recursion during a failed CHECK processing.  CheckFailed can call a lot of code (printing, unwinding a stack trace, symbolicating, ...) and this can fail another CHECK. This means I sometimes see a crash due to a infinite recursion stack overflow. Let's stop after 10 failed CHECKs and just kill the process immediately. I also added a Sleep(2) call before the trap, so that other threads still get a chance to print their failed CHECKs.

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

llvm-svn: 269288
2016-05-12 12:49:53 +00:00
Reid Kleckner ad04914a53 [Windows] Fix UnmapOrDie and MmapAlignedOrDie
Now ASan can return virtual memory to the underlying OS. Portable
sanitizer runtime code needs to be aware that UnmapOrDie cannot unmap
part of previous mapping.

In particular, this required changing how we implement MmapAlignedOrDie
on Windows, which is what Allocator32 uses.

The new code first attempts to allocate memory of the given size, and if
it is appropriately aligned, returns early. If not, it frees the memory
and attempts to reserve size + alignment bytes. In this region there
must be an aligned address. We then free the oversized mapping and
request a new mapping at the aligned address immediately after. However,
a thread could allocate that virtual address in between our free and
allocation, so we have to retry if that allocation fails. The existing
thread creation stress test managed to trigger this condition, so the
code isn't totally untested.

Reviewers: samsonov

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

llvm-svn: 263160
2016-03-10 20:47:26 +00:00
Mike Aizatsky 4a93316c8c [sanitizers] extracted process management functions
Differential Revision: http://reviews.llvm.org/D16546

llvm-svn: 258849
2016-01-26 20:10:01 +00:00
Mike Aizatsky 92f0f7c2f3 Revert "[sanitizers] extracted process management functions"
This reverts commit e5b34d5a2bf4c882bc647dd26a8cea2adc76f63c.

llvm-svn: 258713
2016-01-25 19:52:25 +00:00
Mike Aizatsky 53849fee26 [sanitizers] extracted process management functions
Differential Revision: http://reviews.llvm.org/D16542

llvm-svn: 258710
2016-01-25 19:43:52 +00:00
Maxim Ostapenko 1965cc6258 [asan] Optionally print reproducer cmdline in ASan reports.
Differential Revision: http://reviews.llvm.org/D16070

llvm-svn: 258037
2016-01-18 07:55:12 +00:00
Peter Collingbourne b825bf32b7 sanitizer_common: C++ify the IntrusiveList iterator interface.
llvm-svn: 257858
2016-01-15 02:19:20 +00:00
Anna Zaks 8d225205e3 [asan] Fix the deadlocks introduced by "On OS X, log reports to syslog and os_trace" commit
[asan] On OS X, log reports to syslog and os_trace, has been reverted in r252076 due to deadlocks on earlier versions of OS X. Alexey has also noticed deadlocks in some corner cases on Linux. This patch, if applied on top of the logging patch (http://reviews.llvm.org/D13452), addresses the known deadlock issues.

(This also proactively removes the color escape sequences from the error report buffer since we have to copy the buffer anyway.)

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

llvm-svn: 253689
2015-11-20 18:42:01 +00:00
Anna Zaks 2ce9f9447c Reapply: [asan] On OS X, log reports to syslog and os_trace
When ASan currently detects a bug, by default it will only print out the text
of the report to stderr. This patch changes this behavior and writes the full
text of the report to syslog before we terminate the process. It also calls
os_trace (Activity Tracing available on OS X and iOS) with a message saying
that the report is available in syslog. This is useful, because this message
will be shown in the crash log.

For this to work, the patch makes sure we store the full report into
error_message_buffer unconditionally, and it also strips out ANSI escape
sequences from the report (they are used when producing colored reports).

I've initially tried to log to syslog during printing, which is done on Android
right now. The advantage is that if we crash during error reporting or the
produced error does not go through ScopedInErrorReport, we would still get a
(partial) message in the syslog. However, that solution is very problematic on
OS X. One issue is that the logging routine uses GCD, which may spawn a new
thread on its behalf. In many cases, the reporting logic locks threadRegistry,
which leads to deadlocks.

Reviewed at http://reviews.llvm.org/D13452

(In addition, add sanitizer_common_libcdep.cc to buildgo.sh to avoid
build failures on Linux.)

llvm-svn: 253688
2015-11-20 18:41:44 +00:00
Dmitry Vyukov b8da794ca1 tsan: fix windows Go build
Go build does not link in whatever library provides these symbols:

# runtime/race
race_windows_amd64.syso:gotsan.cc:(.text+0x578f): undefined reference to `__sanitizer::DumpProcessMap()'
race_windows_amd64.syso:gotsan.cc:(.text+0xee33): undefined reference to `EnumProcessModules'
race_windows_amd64.syso:gotsan.cc:(.text+0xeeb9): undefined reference to `GetModuleInformation'

llvm-svn: 252922
2015-11-12 18:50:19 +00:00
Alexey Samsonov 96c6ecc842 [Sanitizer] Use ReportMmapFailureAndDie() in all applicable mmap variants on Posix.
llvm-svn: 252121
2015-11-05 01:16:48 +00:00
Juergen Ributzka d7dcffaea4 Revert "Reapply: [asan] On OS X, log reports to syslog and os_trace"
Looks like this commit is deadlocking the ASAN tests on the green dragon bot
(http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA/).

llvm-svn: 252076
2015-11-04 21:03:12 +00:00
Anna Zaks 7920eb0b1f Reapply: [asan] On OS X, log reports to syslog and os_trace
When ASan currently detects a bug, by default it will only print out the text
        of the report to stderr. This patch changes this behavior and writes the full
        text of the report to syslog before we terminate the process. It also calls
        os_trace (Activity Tracing available on OS X and iOS) with a message saying
        that the report is available in syslog. This is useful, because this message
        will be shown in the crash log.

        For this to work, the patch makes sure we store the full report into
        error_message_buffer unconditionally, and it also strips out ANSI escape
        sequences from the report (they are used when producing colored reports).

        I've initially tried to log to syslog during printing, which is done on Android
        right now. The advantage is that if we crash during error reporting or the
        produced error does not go through ScopedInErrorReport, we would still get a
        (partial) message in the syslog. However, that solution is very problematic on
        OS X. One issue is that the logging routine uses GCD, which may spawn a new
        thread on its behalf. In many cases, the reporting logic locks threadRegistry,
        which leads to deadlocks.

        Reviewed at http://reviews.llvm.org/D13452

        (In addition, add sanitizer_common_libcdep.cc to buildgo.sh to avoid
         build failures on Linux.)

llvm-svn: 251577
2015-10-28 23:18:44 +00:00
Anna Zaks 55fbb6d7f5 Revert "[asan] On OS X, log reports to syslog and os_trace"
This reverts commit 251447.

(Which caused failures on a Linux bot.)

llvm-svn: 251467
2015-10-27 23:15:05 +00:00
Anna Zaks 9a95c9a633 [asan] On OS X, log reports to syslog and os_trace
When ASan currently detects a bug, by default it will only print out the text
of the report to stderr. This patch changes this behavior and writes the full
text of the report to syslog before we terminate the process. It also calls
os_trace (Activity Tracing available on OS X and iOS) with a message saying
that the report is available in syslog. This is useful, because this message
will be shown in the crash log.

For this to work, the patch makes sure we store the full report into
error_message_buffer unconditionally, and it also strips out ANSI escape
sequences from the report (they are used when producing colored reports).

I've initially tried to log to syslog during printing, which is done on Android
right now. The advantage is that if we crash during error reporting or the
produced error does not go through ScopedInErrorReport, we would still get a
(partial) message in the syslog. However, that solution is very problematic on
OS X. One issue is that the logging routine uses GCD, which may spawn a new
thread on its behalf. In many cases, the reporting logic locks threadRegistry,
which leads to deadlocks.

Reviewed at http://reviews.llvm.org/D13452

llvm-svn: 251447
2015-10-27 20:13:01 +00:00
Vedant Kumar 552c0111f1 [sanitizer_common] Apply modernize-use-nullptr, other minor fixes
- Trim spaces.
- Use nullptr in place of 0 for pointer variables.
- Use '!p' in place of 'p == 0' for null pointer checks.

Patch by Eugene Zelenko!

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

llvm-svn: 248964
2015-09-30 23:52:54 +00:00
Alexey Samsonov 53b8750e7d [Sanitizers] Make abort_on_error common flag.
Summary:
Teach all sanitizers to call abort() instead of _exit() after printing
an error report, if requested. This behavior is the default on Mac OS.

Reviewers: kcc, kubabrecka

Subscribers: llvm-commits

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

llvm-svn: 246205
2015-08-27 20:40:24 +00:00
Alexey Samsonov 34620a8e4f [Sanitizer] Use internal_memmove instead of the one implicitly generated by compiler.
llvm-svn: 246198
2015-08-27 20:07:28 +00:00
Alexey Samsonov b92aa0fc3f [Sanitizers] Allow to install several internal Die callbacks.
This is required to properly re-apply r245770:
1) We should be able to dump coverage in __sanitizer::Die() if coverage
   collection is turned on.
2) We don't want to explicitly do this in every single
   sanitizer that supports it.
3) We don't want to link in coverage (and therefore symbolization) bits
   into small sanitizers that don't support it (safestack).

The solution is to make InitializeCoverage() register its own Die()
callback that would call __sanitizer_cov_dump(). This callback should be
executed in addition to another tool-specific die callbacks (if there
are any).

llvm-svn: 245889
2015-08-24 22:21:44 +00:00
Alexey Samsonov 4369a3f4ad Revert r245770 and r245777.
These changes break both autoconf Mac OS X buildbot (linker errors
due to wrong Makefiles) and CMake buildbot (safestack test failures).

llvm-svn: 245784
2015-08-22 05:15:55 +00:00
Alexey Samsonov 8e38c71cb7 [Sanitizer] Dump coverage if we're killing the program with __sanitizer::Die().
Previously we had to call __sanitizer_cov_dump() from tool-specific
callbacks - instead, let sanitizer_common library handle this in a single place.

llvm-svn: 245770
2015-08-22 00:28:12 +00:00
Alexey Samsonov bb79b06f4e [Sanitizers] Unify the semantics and usage of "exitcode" runtime flag across all sanitizers.
Summary:
Merge "exitcode" flag from ASan, LSan, TSan and "exit_code" from MSan
into one entity. Additionally, make sure sanitizer_common now uses the
value of common_flags()->exitcode when dying on error, so that this
flag will automatically work for other sanitizers (UBSan and DFSan) as
well.

User-visible changes:
* "exit_code" MSan runtime flag is now deprecated. If explicitly
  specified, this flag will take precedence over "exitcode".
  The users are encouraged to migrate to the new version.
* __asan_set_error_exit_code() and __msan_set_exit_code() functions
  are removed. With few exceptions, we don't support changing runtime
  flags during program execution - we can't make them thread-safe.
  The users should use __sanitizer_set_death_callback()
  that would call _exit() with proper exit code instead.
* Plugin tools (LSan and UBSan) now inherit the exit code of the parent
  tool. In particular, this means that ASan would now crash the program
  with exit code "1" instead of "23" if it detects leaks.

Reviewers: kcc, eugenis

Subscribers: llvm-commits

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

llvm-svn: 245734
2015-08-21 20:49:37 +00:00
Reid Kleckner 7d0f22e558 [windows] Fix deadlock on mmap failure due to CHECK recursion
Summary:
Printing a stacktrace acquires a spinlock, and the sanitizer spinlocks
aren't re-entrant. Avoid the problem by reusing the logic we already
have on Posix.

This failure mode is already exercised by the existing mmap_limit_mb.cc
test case. It will be enabled in a forthcoming change, so I didn't add
standalone tests for this change.

Reviewers: samsonov

Subscribers: llvm-commits

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

llvm-svn: 244840
2015-08-12 23:55:38 +00:00
Reid Kleckner e96833e648 [Windows] Implement FileExists, ReadFromFile, and FindPathToBinary
Summary: These are needed to talk to llvm-symbolizer on Windows.

Reviewers: samsonov

Subscribers: llvm-commits

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

llvm-svn: 244533
2015-08-10 23:40:27 +00:00
Evgeniy Stepanov 30257173b3 [sanitizer] Fix Mac build.
llvm-svn: 243480
2015-07-28 21:01:42 +00:00
Evgeniy Stepanov 7eeb02bd09 [asan] Read process name from /proc/self/cmdline on Linux.
Rename getBinaryBasename() to getProcessName() and, on Linux,
read it from /proc/self/cmdline instead of /proc/self/exe. The former
can be modified by the process. The main motivation is Android, where
application processes re-write cmdline to a package name. This lets
us setup per-application ASAN_OPTIONS through include=/some/path/%b.

llvm-svn: 243473
2015-07-28 20:27:51 +00:00