Commit Graph

527 Commits

Author SHA1 Message Date
Daniel Micay
29ffcdf810 portable error reporting for memory API 2021-03-22 13:59:16 -04:00
Daniel Micay
f773a96b59 remove unnecessary sys/mman.h include 2021-03-22 12:25:22 -04:00
Daniel Micay
b84af9b499 add wrapper for madvise 2021-03-22 12:24:26 -04:00
Daniel Micay
73b78a8adb document madvise for malloc_trim of quarantines 2021-03-22 11:17:00 -04:00
Daniel Micay
e77ffa76d9 add initial malloc_trim slab quarantine purging
This currently only purges the quarantines for extended size classes.
2021-03-22 11:16:57 -04:00
Daniel Micay
86b0b3e452 fix !CONFIG_EXTENDED_SIZE_CLASSES configuration 2021-03-21 18:09:02 -04:00
Daniel Micay
7b03b5c629 update README for region quarantine change 2021-03-18 07:35:38 -04:00
Daniel Micay
db21ecd529 use longer default region quarantine random array 2021-03-18 06:27:46 -04:00
Daniel Micay
ee55acf116 update libdivide to 4.0.0 2021-03-09 02:38:16 -05:00
Daniel Micay
a3b4c163eb drop unused header 2021-03-05 00:35:10 -05:00
Daniel Micay
325b82f1bd update to Android qpr2 branch as minimum 2021-03-01 16:52:30 -05:00
Daniel Micay
ddd14bc421 avoid type comparison warning on some platforms 2021-02-16 17:18:35 -05:00
Daniel Micay
29b09648d6 avoid undefined clz and shift in edge cases
This is triggered when get_large_size_class is called with a size in the
range [1,4]. This can occur with aligned_alloc(8192, size). In practice,
it doesn't appear to cause any harm, but we shouldn't have any undefined
behavior for well-defined usage of the API. It also occurs if the caller
passes a pointer outside the slab region to free_sized but the expected
size is in the range [1,4]. That usage of free_sized is already going to
be considered undefined, but we should avoid undefined behavior in the
caller from triggering more undefined behavior when it's avoidable.
2021-02-16 08:31:17 -05:00
Thibaut Sautereau
1984cb3b3d malloc_object_size: avoid fault for invalid region
It's the region pointer that can be NULL here, and p was checked at the
beginning of the function.
2021-02-10 17:43:36 -05:00
Thibaut Sautereau
76860c72e1 malloc_usable_size: clean abort on invalid region
It's the region pointer that can be NULL here, and p was checked at the
beginning of the function. Also fix the test accordingly.
2021-02-10 17:41:17 -05:00
Daniel Micay
5c8b686370 update copyright notice 2021-01-06 20:38:55 -05:00
Daniel Micay
5275563252 fix C++ sized deallocation check false positive
This is a compatibility issue triggered when both slab canaries and the
C++ allocator overloads providing sized deallocation checks are enabled.

The boundary where slab allocations are turned into large allocations
due to not having room for the canary in the largest slab allocation
size class triggers a false positive in the sized deallocation check.
2021-01-06 00:18:59 -05:00
Daniel Micay
e9d9f70ad4 update supported Android 11 branch 2020-12-07 18:14:25 -05:00
Daniel Micay
10c5d61187 work around glibc bug in mallinfo test 2020-11-10 14:14:08 -05:00
Daniel Micay
b90f650153 fix sized deallocation check with large sizes
The CONFIG_CXX_ALLOCATOR feature enables sanity checks for sized
deallocation and this wasn't updated to handle the introduction of
performing size class rounding for large sizes.
2020-11-10 13:53:32 -05:00
Daniel Micay
8d0314295e support Android's logging system for fatal_error 2020-10-19 07:51:00 -04:00
Daniel Micay
b072022022 perform init sanity checks before MPK unsealing 2020-10-06 17:34:35 -04:00
Daniel Micay
2bb1c39d31 add MPK support for stats retrieval functions 2020-10-06 17:32:25 -04:00
Daniel Micay
0bf18b7c26 optimize malloc_usable_size enforce_init 2020-10-03 15:10:49 -04:00
Daniel Micay
178d4f320f harden checks for uninitialized usage 2020-10-02 15:06:29 -04:00
Daniel Micay
b9ebf47c7c explicitly use python3 to run tests 2020-09-19 09:40:56 -04:00
Daniel Micay
8906c0941a improve mallinfo test 2020-09-18 11:38:06 -04:00
Daniel Micay
59e174eee0 update stats documentation 2020-09-17 17:44:01 -04:00
Daniel Micay
483b1d7b8b empty malloc_info output when stats are disabled 2020-09-17 17:42:18 -04:00
Daniel Micay
96eca21ac5 remove thread_local macro workaround glibc < 2.28 2020-09-17 17:38:40 -04:00
Daniel Micay
022b64791e whitespace fixes 2020-09-17 17:23:13 -04:00
Daniel Micay
b4bbd09f07 change label for quarantined large allocations 2020-09-17 16:56:01 -04:00
Daniel Micay
a88305c01b support disabling region quarantine 2020-09-17 16:53:34 -04:00
Daniel Micay
85c5c3736c add stats tracking to special large realloc paths 2020-09-17 16:29:13 -04:00
Daniel Micay
96a9bcf3a1 move deprecated glibc extensions to the bottom 2020-09-17 16:20:05 -04:00
Daniel Micay
41fb89517a simplify malloc_info code 2020-09-17 16:10:02 -04:00
Daniel Micay
50e0f1334c add is_init check to malloc_info 2020-09-17 16:07:10 -04:00
Daniel Micay
9fb2791af2 add is_init check to h_mallinfo_arena_info 2020-09-17 16:00:03 -04:00
anupritaisno1
8974af86d1 hardened malloc: iterate -> malloc_iterate
Signed-off-by: anupritaisno1 <www.anuprita804@gmail.com>
2020-09-15 00:37:23 -04:00
anupritaisno1
d203d6c445 Android.bp: export hardened malloc headers
Signed-off-by: anupritaisno1 <www.anuprita804@gmail.com>
2020-09-14 07:21:57 -04:00
Daniel Micay
9f5e1f6eb9 master is only going to support Android 11 2020-09-14 05:57:39 -04:00
Daniel Micay
1cba254452 move external API to include directory 2020-09-14 05:52:53 -04:00
anupritaisno1
730f148647 Android.bp: make hardened malloc ramdisk available
Signed-off-by: anupritaisno1 <www.anuprita804@gmail.com>
2020-09-13 05:14:25 -04:00
Daniel Micay
dd7291ebfe better wording for page size mismatch error 2020-08-05 18:10:53 -04:00
Daniel Micay
bcb93cab63 avoid an ifdef 2020-08-04 17:22:03 -04:00
rwarr627
f214bd541a added check for if small allocations are free 2020-06-17 23:29:30 -04:00
rwarr627
7804e263e9 added tests for if malloc_object_size small allocations are free 2020-06-17 23:29:30 -04:00
Daniel Micay
de3fb50dcc tests: make no-optimize attribute Clang compatible 2020-06-17 20:08:46 -04:00
Daniel Micay
b404d6da6e fix out-of-memory check in offset test 2020-06-17 16:27:59 -04:00
Daniel Micay
c9c7dca498 use size_t in offset test to fix warning 2020-06-17 16:26:08 -04:00