Daniel Micay
59def67979
add inlined check for -1 with pkey_set
2018-10-23 08:00:34 -04:00
Daniel Micay
0b963078d5
guard metadata with Memory Protection Keys (MPK)
2018-10-23 01:11:31 -04:00
Daniel Micay
ac8c68de53
enable pointer cast warnings
2018-10-21 15:50:26 -04:00
Daniel Micay
9a43302868
add enforce_init call to other realloc code path
2018-10-20 02:27:06 -04:00
Daniel Micay
6a408ad017
add init calls to malloc_enable/malloc_disable
2018-10-19 21:46:36 -04:00
Daniel Micay
f0a6f551eb
tweak code style
2018-10-18 19:35:21 -04:00
Daniel Micay
1e03b004f5
move slab_info to main metadata region
2018-10-18 16:01:04 -04:00
Daniel Micay
3f1962dd2b
use min macro for realloc copy size
2018-10-18 15:25:14 -04:00
Daniel Micay
fe30f6c2ea
delay allocating slab metadata from reservation
2018-10-18 15:20:42 -04:00
Daniel Micay
64e9f6797a
use offsetof for allocator_state memory protection
2018-10-16 15:52:41 -04:00
Daniel Micay
67ada4d309
document padding for allocator state
2018-10-15 19:10:36 -04:00
Daniel Micay
1c9e0d88a5
use the initial region table slots again
2018-10-15 15:18:45 -04:00
Daniel Micay
da0df69d22
move region hash tables into main state region
2018-10-15 15:07:59 -04:00
Daniel Micay
1e5dec97e0
move slab allocator state into main state region
2018-10-15 14:58:22 -04:00
Daniel Micay
fde9fc2ece
protect region allocator state with random guards
2018-10-14 22:41:17 -04:00
Daniel Micay
da6fd5b5ef
move slab allocator state to a dedicated mapping
2018-10-14 22:06:38 -04:00
Daniel Micay
1190966846
rename region_info to region_metadata
2018-10-14 22:06:38 -04:00
Daniel Micay
a083ff79e1
move region allocator state to a dedicated mapping
2018-10-14 22:06:33 -04:00
Daniel Micay
535466fdfd
avoid undefined shifts with multi-word bitmaps
2018-10-14 18:58:17 -04:00
Daniel Micay
7798b2693e
fix loop exit condition boundary for get_free_slot
2018-10-14 18:49:48 -04:00
Daniel Micay
9ea2fd6667
write_after_free_check only reads data
2018-10-14 18:30:20 -04:00
Daniel Micay
d35674c67e
expected_size is not an output parameter
2018-10-14 18:28:01 -04:00
Daniel Micay
4fbfe4d3ec
fix canary space reservation for pvalloc
2018-10-14 17:49:36 -04:00
Daniel Micay
f11c448a0d
slightly reorganize slab metadata
2018-10-14 15:13:06 -04:00
Daniel Micay
3db3e167ed
remove usage of ATOMIC_VAR_INIT
...
This was never truly required in practice and has been officially
obsoleted in C17.
2018-10-13 16:50:49 -04:00
Daniel Micay
65a7014b48
randomize free slabs reuse
2018-10-13 13:57:00 -04:00
Daniel Micay
83df37436d
fix usage of pthread_atfork for glibc < 2.28
2018-10-12 16:03:15 -04:00
Daniel Micay
6669166fe9
move memory_unmap outside of lock scope
2018-10-12 15:06:51 -04:00
Daniel Micay
b2007ad3d9
implement randomization for the region quarantine
2018-10-12 15:03:59 -04:00
Daniel Micay
ac2b940f0f
fix compatibility with older GCC versions
...
Avoid relying on compiler extensions supporting more flexible usage of
constants closer to how it works in C++.
2018-10-11 18:12:49 -04:00
Daniel Micay
ddcdd9423c
make the memory mapping quarantine more efficient
2018-10-09 14:13:59 -04:00
Daniel Micay
5fa6e01929
clearer name for MREMAP_MAYMOVE threshold
2018-10-08 17:18:13 -04:00
Daniel Micay
1a10c17e8b
add quarantine for large allocations
2018-10-08 16:14:07 -04:00
Daniel Micay
cc9699f1b4
use multi-word bitmap to support up to 256 slots
2018-10-07 18:50:06 -04:00
Daniel Micay
5e2f03296e
remove old debugging code
2018-10-07 16:18:17 -04:00
Daniel Micay
348f9fa557
add configuration for frequency of guard slabs
2018-10-06 15:36:03 -04:00
Daniel Micay
4ee12e64e0
configuration for guard region sizes
2018-10-06 15:17:55 -04:00
Daniel Micay
d18b05eaf4
avoid redundant checks for large realloc
2018-10-06 13:31:16 -04:00
Daniel Micay
eb7ced7781
implement in-place growth of large allocations
2018-10-06 13:24:22 -04:00
Daniel Micay
3dc49f8f73
slightly improve sized deallocation error messages
2018-10-05 01:06:12 -04:00
Daniel Micay
dcd969ae04
use a consistent style for fixed-size int types
...
The stdint.h types don't cover 128-bit integers and the underscore makes
them ill suited to usage in function suffixes. Instead, use the common
naming style in the Linux kernel and elsewhere including the ChaCha8
implementation included here.
2018-10-04 15:17:11 -04:00
Daniel Micay
642eed81c0
allow using larger guards on large allocations
2018-10-04 02:58:24 -04:00
Daniel Micay
5811bd184c
avoid unnecessary preprocessor use for canary mask
2018-10-03 17:17:20 -04:00
Daniel Micay
b24569b6ca
zero leading byte of canaries
2018-10-03 17:09:57 -04:00
Daniel Micay
cf449b3df4
add sized deallocation support
2018-09-19 13:05:12 -04:00
Daniel Micay
82314f4471
make get_size_info straightforward for zero size
2018-09-11 14:51:36 -04:00
Daniel Micay
7a404ddbf2
optimize size calculation for 16 byte spaced sizes
2018-09-11 14:46:44 -04:00
Daniel Micay
2d6ad18aa4
make function naming a bit more consistent
2018-09-11 14:18:13 -04:00
Daniel Micay
684291bf6a
avoid overhead of init check for slab deallocation
2018-09-11 14:13:43 -04:00
Daniel Micay
ef098fea06
simplify init function
2018-09-11 14:12:27 -04:00