| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Now that memory intrinsics are instrumented, it's more likely that
CheckAddressSized will be called with size 0. (It was possible before
with IR like:
%val = load [0 x i8], [0 x i8]* %ptr
but I don't think clang will generate IR like that and the optimizer
would normally remove it by the time it got anywhere near our pass
anyway). The right thing to do in both cases is to disable the
addressing checks (since the underlying memory intrinsic is a no-op),
so that's what we do.
Differential Revision: https://reviews.llvm.org/D56465
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@350683 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
|
|
|
| |
The dynamic loader on Android O appears to have a bug where it crashes
when dlopening DF_1_GLOBAL libraries.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@350444 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
interceptor mode.
The Android dynamic loader has a non-standard feature that allows
libraries such as the hwasan runtime to interpose symbols even after
the symbol already has a value. The new value of the symbol is used to
relocate libraries loaded after the interposing library, but existing
libraries keep the old value. This behaviour is activated by the
DF_1_GLOBAL flag in DT_FLAGS_1, which is set by passing -z global to
the linker, which is what we already do to link the hwasan runtime.
What this means in practice is that if we have .so files that depend
on interceptor-mode hwasan without the main executable depending on
it, some of the libraries in the process will be using the hwasan
allocator and some will be using the system allocator, and these
allocators need to interact somehow. For example, if an instrumented
library calls a function such as strdup that allocates memory on
behalf of the caller, the instrumented library can reasonably expect
to be able to call free to deallocate the memory.
We can handle that relatively easily with hwasan by using tag 0 to
represent allocations from the system allocator. If hwasan's realloc
or free functions are passed a pointer with tag 0, the system allocator
is called.
One limitation is that this scheme doesn't work in reverse: if an
instrumented library allocates memory, it must free the memory itself
and cannot pass ownership to a system library. In a future change,
we may want to expose an API for calling the system allocator so
that instrumented libraries can safely transfer ownership of memory
to system libraries.
Differential Revision: https://reviews.llvm.org/D55986
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@350427 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
Replace the 32-bit allocator with a 64-bit one with a non-constant
base address, and reduce both the number of size classes and the maximum
size of per-thread caches.
As measured on [1], this reduces average weighted memory overhead
(MaxRSS) from 26% to 12% over stock android allocator. These numbers
include overhead from code instrumentation and hwasan shadow (i.e. not a
pure allocator benchmark).
This switch also enables release-to-OS functionality, which is not
implemented in the 32-bit allocator. I have not seen any effect from
that on the benchmark.
[1] https://android.googlesource.com/platform/system/extras/+/master/memory_replay/
Reviewers: vitalybuka, kcc
Subscribers: kubamracek, cryptoad, llvm-commits
Differential Revision: https://reviews.llvm.org/D56239
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@350370 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
|
|
|
|
|
|
| |
This is patch complements D55117 implementing __hwasan_mem*
functions in runtime
Differential revision: https://reviews.llvm.org/D55554
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@349730 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
| |
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@349255 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary: This is needed for C++-specific ubsan and cfi error reporting to work.
Reviewers: kcc, vitalybuka
Subscribers: srhines, kubamracek, mgorny, llvm-commits
Differential Revision: https://reviews.llvm.org/D55589
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@348986 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
|
|
| |
With malloc_align_right the relative offsets of heap chunks are less predictable to simply don't test for them.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@347118 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
With free_checks_tail_magic=1 (default) HWASAN
writes magic bytes to the tail of every heap allocation
(last bytes of the last granule, if the last granule is not fully used)
and checks these bytes on free().
This feature will detect buffer overwires within the last granule
at the time of free().
This is an alternative to malloc_align_right=[1289] that should have
fewer compatibility issues. It is also weaker since it doesn't
detect read overflows and reports bugs at free() instead of at access.
Reviewers: eugenis
Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits
Differential Revision: https://reviews.llvm.org/D54656
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@347116 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
| |
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@347107 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
| |
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@347091 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
... so that we can find intra-granule buffer overflows.
The default is still to always align left.
It remains to be seen wether we can enable this mode at scale.
Reviewers: eugenis
Reviewed By: eugenis
Subscribers: jfb, dvyukov, kubamracek, delcypher, #sanitizers, llvm-commits
Differential Revision: https://reviews.llvm.org/D53789
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@347082 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
When reporting a fatal error, collect and add the entire report text to
android_set_abort_message so that it can be found in the tombstone.
Reviewers: kcc, vitalybuka
Subscribers: srhines, kubamracek, llvm-commits
Differential Revision: https://reviews.llvm.org/D54284
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@346557 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
|
|
| |
Set -fno-discard-value-names so that the frame description string contains the variable name.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@346120 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
|
|
| |
descriptions provided by the compiler
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@345110 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
| |
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@344289 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
| |
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@344213 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
| |
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@344203 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
|
|
| |
heap chunk (in addition to the more detailed info that we may fail to show)
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@344193 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
| |
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@344174 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
Display a list of recent stack frames (not a stack trace!) when
tag-mismatch is detected on a stack address.
The implementation uses alignment tricks to get both the address of
the history buffer, and the base address of the shadow with a single
8-byte load. See the comment in hwasan_thread_list.h for more
details.
Developed in collaboration with Kostya Serebryany.
Reviewers: kcc
Subscribers: srhines, kubamracek, mgorny, hiraditya, jfb, llvm-commits
Differential Revision: https://reviews.llvm.org/D52249
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@342923 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
|
|
| |
This reverts commit r342921: test failures on clang-cmake-arm* bots.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@342922 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
Display a list of recent stack frames (not a stack trace!) when
tag-mismatch is detected on a stack address.
The implementation uses alignment tricks to get both the address of
the history buffer, and the base address of the shadow with a single
8-byte load. See the comment in hwasan_thread_list.h for more
details.
Developed in collaboration with Kostya Serebryany.
Reviewers: kcc
Subscribers: srhines, kubamracek, mgorny, hiraditya, jfb, llvm-commits
Differential Revision: https://reviews.llvm.org/D52249
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@342921 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
|
|
| |
heap object in the thread's deallocation ring buffer. Mostly useful to hwasan developers, will hopefully let us know the good size of the deallocation ring buffer
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@342014 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
| |
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@342011 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
|
|
|
| |
The problem was not in a non-rooted device, but in tagged local
variable address passed to a system call, see comments in the code.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@341875 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
| |
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@341739 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
|
|
| |
Requires a rooted device => fails on sanitizer-x86_64-linux-android bot.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@341738 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
|
|
|
| |
Adds a line to /proc/$PID/maps with more or less up-to-date memory
stats of the process.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@341735 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
| |
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@341625 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
|
|
| |
malloc can't happen before main
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@341615 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
|
|
|
|
|
| |
Check size limit before rounding up, otherwise malloc((size_t)-1)
would happily allocate 0 bytes.
Steal a nice test case from scudo.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@341612 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
| |
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@341594 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
| |
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@341592 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
| |
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@341480 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
|
|
| |
pthread_create on Linux)
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@341438 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
|
|
| |
creation/destruction
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@341428 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
|
|
|
| |
Fixes "allocator is out of memory trying to allocate 0x0 bytes" by
always allocating at least one byte.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@341229 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
| |
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@341162 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
| |
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@341159 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
|
|
| |
stack addresses
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@341156 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
|
|
| |
threaded tests
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@341143 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
| |
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@341133 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
| |
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@341129 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
|
|
| |
heavy) simply maintain a linked list of Threads
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@341111 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
|
|
| |
disable tagging in malloc with inside pthread_create)
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@341007 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
|
|
| |
realloc. This may slowdown some realloc-heavy code, but at least at this point a want simpler code. Also added a test
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@340973 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
| |
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@340593 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
| |
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@340591 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
|
|
|
| |
around the buggy access, simplify one test
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@340470 91177308-0d34-0410-b5e6-96231b3b80d8
|