llvm-project/compiler-rt/lib/scudo
Kostya Kortchinsky 65fdf677f2 [scudo] Check for pvalloc overflow
Summary:
Previously we were rounding up the size passed to `pvalloc` to the next
multiple of page size no matter what. There is an overflow possibility that
wasn't accounted for. So now, return null in the event of an overflow. The man
page doesn't seem to indicate the errno to set in this particular situation,
but the glibc unit tests go for ENOMEM (https://code.woboq.org/userspace/glibc/malloc/tst-pvalloc.c.html#54)
so we'll do the same.
Update the aligned allocation funtions tests to check for properly aligned
returned pointers, and the `pvalloc` corner cases.

@alekseyshl: do you want me to do the same in the other Sanitizers?

Reviewers: alekseyshl

Reviewed By: alekseyshl

Subscribers: kubamracek, alekseyshl, llvm-commits

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

llvm-svn: 309033
2017-07-25 21:18:02 +00:00
..
CMakeLists.txt [scudo] Add Android support 2017-05-05 21:38:22 +00:00
scudo_allocator.cpp [scudo] Check for pvalloc overflow 2017-07-25 21:18:02 +00:00
scudo_allocator.h [scudo] Change aligned alloc functions to be more compliant & perf changes 2017-06-29 16:45:20 +00:00
scudo_allocator_combined.h [scudo] Do not grab a cache for secondary allocation & per related changes 2017-07-13 21:01:19 +00:00
scudo_allocator_secondary.h [Sanitizers] Move cached allocator_may_return_null flag to sanitizer_allocator 2017-06-20 21:23:02 +00:00
scudo_crc32.cpp [scudo] CRC32 optimizations 2017-05-09 15:12:38 +00:00
scudo_crc32.h [scudo] CRC32 optimizations 2017-05-09 15:12:38 +00:00
scudo_flags.cpp [scudo] Quarantine overhaul 2017-07-24 15:29:38 +00:00
scudo_flags.h [scudo] 32-bit and hardware agnostic support 2016-11-30 17:32:20 +00:00
scudo_flags.inc [scudo] Quarantine overhaul 2017-07-24 15:29:38 +00:00
scudo_interceptors.cpp [scudo] 32-bit and hardware agnostic support 2016-11-30 17:32:20 +00:00
scudo_new_delete.cpp [Sanitizers] Operator new() interceptors always die on allocation error 2017-06-28 21:58:57 +00:00
scudo_termination.cpp [scudo] 32-bit and hardware agnostic support 2016-11-30 17:32:20 +00:00
scudo_tls.h [scudo] PRNG makeover 2017-07-12 15:29:08 +00:00
scudo_tls_android.cpp [scudo] Change aligned alloc functions to be more compliant & perf changes 2017-06-29 16:45:20 +00:00
scudo_tls_android.inc [scudo] Add Android support 2017-05-05 21:38:22 +00:00
scudo_tls_context_android.inc [scudo] Add Android support 2017-05-05 21:38:22 +00:00
scudo_tls_context_linux.inc [scudo] Add Android support 2017-05-05 21:38:22 +00:00
scudo_tls_linux.cpp [scudo] Check the return values of the pthread_* functions 2017-05-26 15:39:22 +00:00
scudo_tls_linux.inc [scudo] Add Android support 2017-05-05 21:38:22 +00:00
scudo_utils.cpp [scudo] PRNG makeover 2017-07-12 15:29:08 +00:00
scudo_utils.h [scudo] PRNG makeover 2017-07-12 15:29:08 +00:00