Commit Graph

54 Commits

Author SHA1 Message Date
Daniel Micay
8d2df1deb8 use CC as CXX to make sure LTO is compatible 2019-08-18 01:28:59 -04:00
Daniel Micay
1bc201c4c1 use -Wcast-align if -Wcast-align=strict is missing 2019-08-18 01:15:54 -04:00
Daniel Micay
cc8c4459e1 make safe_flag treat unknown warnings as missing 2019-08-18 01:15:54 -04:00
Patrick Schleizer
75e86914aa respect existing CFLAGS, CPPFLAGS and LDFLAGS 2019-07-29 13:52:55 -04:00
Daniel Micay
90d12fb340 override local default to -fstack-protector-strong
This is a no-op on a toolchain compiled with the basic mitigations
enabled by default, so this is generally a no-op anywhere this project
is likely to be deployed. SSP has a very low performance cost so there's
little reason to avoid it, even though it also has zero value for this
code in practice. It would be great if one of the more modern approaches
was widely adopted, but unfortunately SSP is as good as it gets for
portable options. It doesn't provide any protection against external
writes to the stack data which is all that's really needed here.

ShadowCallStack is a great option for arm64, but it's substantially more
difficult to protect return addresses well on x86_64 due to the design of
the ISA and ABI.
2019-07-19 11:53:55 -04:00
Daniel Micay
77743e5a36 use -fstack-clash-protection for completeness
This is a no-op for the current code and will likely remain that way so
there's no benefit but also no performance cost.
2019-07-19 11:18:49 -04:00
Daniel Micay
bb65d088dc drop default class region size to 32GiB 2019-06-19 01:00:22 -04:00
Daniel Micay
5449f4a94e use safe_flag for -fno-plt
This isn't supported by the ancient Clang release in Debian Stable.
2019-06-06 07:33:39 -04:00
Daniel Micay
6c31f6710a support extended range of small size classes 2019-04-10 08:31:51 -04:00
Daniel Micay
1b34fd4a69 enable 4 arenas by default 2019-04-10 08:12:59 -04:00
Daniel Micay
cef7368b3c disable unusable readability-magic-numbers lint
This wouldn't be worth using even if it had a whole bunch of heuristics
like ignoring expressions in static_assert, ignoring repeated patterns
like assigning different things to sequential array indexes, etc.
2019-04-09 00:58:06 -04:00
Daniel Micay
295bfbde94 disable bugprone-too-small-loop-variable lint
This has too many false positives since it doesn't permit comparisons
against constants where the compiler can verify it doesn't overflow.
2019-04-09 00:55:16 -04:00
Daniel Micay
ef90f404a6 add sanity check for stats option 2019-04-07 09:06:03 -04:00
Daniel Micay
e0891c8cfc implement the option of large size classes
This extends the size class scheme used for slab allocations to large
allocations. This drastically improves performance for many real world
programs using incremental realloc growth instead of using proper growth
factors. There are 4 size classes for every doubling in size, resulting
in a worst case of ~20% extra virtual memory being reserved and a huge
increase in performance for pathological cases. For example, growing
from 4MiB to 8MiB by calling realloc in increments of 32 bytes will only
need to do work beyond looking up the size 4 times instead of 1024 times
with 4096 byte granularity.
2019-04-07 08:52:17 -04:00
Daniel Micay
350d0e5fd2 add real mallinfo implementation for Android
Android Q uses the mallinfo implementation in the ART GC:

c220f98180
1575267302
2019-04-06 20:54:26 -04:00
Daniel Micay
c5e911419d add initial implementation of arenas 2019-03-25 14:59:50 -04:00
Daniel Micay
c8b948e202 enable C++17 support when available 2019-03-23 19:46:54 -04:00
Daniel Micay
8a474b647c enable both forms of slab quarantines by default 2019-01-02 14:59:19 -05:00
Daniel Micay
ccc2a86501 rename quarantine size -> length for clarity 2019-01-02 14:17:02 -05:00
Daniel Micay
2d88b90282 reorder Makefile CONFIG variables 2018-12-09 11:03:12 -05:00
Daniel Micay
830a7d338d make class_region_size configurable 2018-12-05 09:38:13 -05:00
Daniel Micay
79cf5cbeb4 disambiguate malloc.h 2018-12-05 07:59:35 -05:00
Daniel Micay
9fd0670aac add lib prefix to the shared object name 2018-12-05 02:05:37 -05:00
Daniel Micay
f3623e1f2b finish migration away from config.h 2018-11-16 15:40:45 -05:00
Daniel Micay
06149aa156 enable readability-else-after-return tidy check 2018-11-16 15:12:10 -05:00
Daniel Micay
a8112fc5c3 use -O3 instead of -O2 primarily for more inlining 2018-11-04 19:45:04 -05:00
Daniel Micay
505b9d2e76 add missing -Wl,--as-needed (removed by mistake) 2018-11-04 14:32:03 -05:00
Daniel Micay
1da51ddde1 migrate bool configuration options out of config.h 2018-11-02 21:35:09 -04:00
Daniel Micay
5bee717134 use -march=native by default with a disable toggle 2018-10-28 22:49:15 -04:00
Daniel Micay
9d1567ce16 make safe_flag check compatible with POSIX sh 2018-10-23 15:55:45 -04:00
Daniel Micay
05ac717cf2 work around -Wcast-align=strict error with old GCC 2018-10-23 07:23:07 -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
173ed53539 use consistent code style in chacha.c 2018-10-19 17:09:41 -04:00
Daniel Micay
d728afae8e add configuration option for testing with UBSan 2018-10-14 18:58:54 -04:00
Daniel Micay
3c0a448c3e enable more tidy checks 2018-10-14 18:33:40 -04:00
Daniel Micay
118549451b add tidy target to the Makefile for clang-tidy 2018-10-14 18:05:08 -04:00
Daniel Micay
fa2796a941 Makefile: add missing dependencies 2018-10-07 11:31:07 -04:00
Daniel Micay
3a936295f8 Makefile: split out shared compiler flags 2018-10-05 02:45:40 -04:00
Daniel Micay
e6e9ac1fc9 support replacing C++ new/delete implementation
This adds support for sanity checks based on sized deallocation and will
reduce the overhead of calls through the C++ allocator.
2018-10-05 02:11:29 -04:00
Daniel Micay
ef32a4b7ea add -pipe to CFLAGS 2018-10-04 04:03:48 -04:00
Daniel Micay
49af83a817 wrap mutex type to enable future optimization 2018-09-07 01:13:08 -04:00
Daniel Micay
d398384b90 add header for configuration 2018-09-07 00:17:31 -04:00
Daniel Micay
7e088dc870 add stubs for Android extensions 2018-09-02 05:08:45 -04:00
Daniel Micay
2dd2471b4a enable more linker sanity checks 2018-09-02 02:30:24 -04:00
Daniel Micay
39e81bd486 using -lpthread for linking isn't necessary 2018-09-02 02:13:23 -04:00
Daniel Micay
e4648192c0 split out code for managing page spans 2018-09-02 02:03:39 -04:00
Daniel Micay
99fcddc223 use much faster get_random_{type}_uniform approach 2018-08-30 02:08:05 -04:00
Daniel Micay
1c181557c7 add -fno-plt as an optimization 2018-08-29 15:20:56 -04:00
Daniel Micay
58d929c0f0 split out low-level memory mapping wrappers 2018-08-29 00:53:38 -04:00