Commit Graph

706 Commits

Author SHA1 Message Date
Daniel Micay
d1c39edc9b use const for malloc_object_size API 2022-01-04 10:14:41 -05:00
Daniel Micay
aa1746a90d alloc_size attribute for legacy valloc function 2022-01-04 10:04:26 -05:00
Daniel Micay
f3efc26638 add malloc attribute where appropriate 2022-01-04 09:56:29 -05:00
jvoisin
78cbb964d4 Add alloc_size and alloc_align attributes
This should help a bit the compiler to emit better diagnostics and to improve
the correctness of `__builtin_object_size`.

See https://clang.llvm.org/docs/AttributeReference.html#alloc-size
and https://clang.llvm.org/docs/AttributeReference.html#alloc-align
2022-01-04 09:45:20 -05:00
jvoisin
36dfed3354 Add aarch64 to the CI 2022-01-04 09:45:00 -05:00
Daniel Micay
8a500088c6 add missing include for overflow tests 2022-01-03 21:24:31 -05:00
Daniel Micay
c50d06bc6a comment explaining XOR for 8 byte overflow test 2022-01-03 21:23:14 -05:00
Daniel Micay
645414cc9f add 1 byte overflow tests 2022-01-03 21:20:15 -05:00
Daniel Micay
13a1f578cb use calculated size for overflow tests
This greatly reduces how much these tests depend on hard-wired knowledge
about the size classes.
2022-01-03 21:11:31 -05:00
Daniel Micay
acda766e2c fix small allocation canary overwrite test
Overwriting one byte of a canary with 0 has a 1/256 chance of not
triggering the expected failure.
2022-01-03 21:08:14 -05:00
Daniel Micay
5f32942263 get rid of canary_value when canaries are disabled 2022-01-03 20:39:30 -05:00
Daniel Micay
346529574d check whole allocation for uninit read large test 2022-01-03 17:55:05 -05:00
Daniel Micay
16c991b8f7 use 256k for large allocation tests 2022-01-03 16:11:16 -05:00
jvoisin
5f59ee3935 Add two tests to check that uninitialized read are zeroed 2022-01-03 16:10:01 -05:00
Daniel Micay
3696f071a4 use SLAB_CANARY for conditional checks 2022-01-03 02:17:04 -05:00
Daniel Micay
7d6663ed80 update copyright notice 2022-01-03 01:41:27 -05:00
Daniel Micay
c6af50d088 use unsigned for ffzl definition
This makes more sense and avoids clang tidy conversion warnings.
2022-01-03 01:29:12 -05:00
Daniel Micay
8ae78237ae avoid unnecessarily mixing 32-bit and 64-bit ints
It's ever so slightly faster to stick to stick to 64-bit arithmetic and
it avoids clang tidy being unhappy about the implicit widening.
2022-01-03 00:54:43 -05:00
Daniel Micay
3f8e9d3184 make MREMAP_MOVE_THRESHOLD into size_t constant
This avoids a clang-tidy warning and is a bit cleaner.
2022-01-03 00:32:06 -05:00
Daniel Micay
1e526fc36b disable incredibly impractical clang-tidy check
bugprone-easily-swappable-parameters is completely impractical for real
world usage. It's a reasonable thing to consider as part of API design
but it mostly applies to having APIs taking a lot of parameters. It's
unreasonable to disallow APIs simply taking 2 integer parameters even as
a loose guideline.
2022-01-03 00:27:49 -05:00
jvoisin
c5be4b1888 Fix two mundane clang warnings in the testsuite 2022-01-02 08:27:46 -05:00
jvoisin
ffdf7b1ee1 Make the testsuite work for read-after-free
This commit makes the testsuite fail if
the read-after-free tests are failing, instead
of simply printing some info.
2022-01-02 08:25:08 -05:00
jvoisin
2d56c1de01 Fix a couple of mundane typo in the readme 2022-01-02 08:20:13 -05:00
jvoisin
3878f4a5f4 Don't ignore the return value of the testsuite 2022-01-02 00:55:21 -05:00
Daniel Micay
de7a3b6e5a enable sized deallocation for sized deletion test
Clang doesn't currently enable sized deallocation by default like GCC.
2022-01-01 23:18:52 -05:00
jvoisin
9142a9376b Add a bunch of const qualifiers 2021-12-30 21:25:16 -05:00
Daniel Micay
75e26afdb6 remove legacy safe_flag check for -fno-plt
This is supported by the minimum versions of the dependencies.
2021-12-30 19:17:33 -05:00
jvoisin
cff1d6d4b5 Add a test to prove that hardened_malloc handles too-large-to-be-true allocations
This pattern, used by https://github.com/kaist-hacking/HardsHeap,
uncovered bugs in other memory allocators.
2021-12-28 19:47:05 -05:00
jvoisin
75952581ee Silence a GCC warning
As suggested in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66425#c34
2021-12-27 06:22:32 -05:00
jvoisin
a84d3f5310 Run the testsuite on musl as well in the CI 2021-12-27 06:22:32 -05:00
jvoisin
0655c1d024 Add a missing const 2021-12-26 18:19:59 -05:00
jvoisin
2b25c791ee Run the CI every day at 2am UTC
This should help to catch issues in newer versions
of distributions/packages.
2021-12-26 17:02:51 -05:00
jvoisin
e816c545ea Run the CI in clang 2021-12-26 16:29:18 -05:00
jvoisin
06192ae499 make clean is now thorough 2021-12-26 16:28:03 -05:00
Daniel Micay
4ccd6f16df always enable C++17
The safe_flag check doesn't work properly for C++ flags with Clang so
this wasn't getting enabled despite the conditional compilation being
removed from the code, leading to breaking Clang builds.
2021-12-26 16:26:38 -05:00
jvoisin
9966adbdad Add another ifdef for GNU extension 2021-12-23 14:45:43 -05:00
jvoisin
769e01fc4b Don't use mallinfo on non-android and non-glibc 2021-12-23 14:38:29 -05:00
Daniel Micay
460fef456d only Android 12 is supported 2021-12-13 19:42:40 -05:00
Daniel Micay
1a650b0317 update copyright notice 2021-12-13 19:42:33 -05:00
Lelmister101
fa46a7a85d small typo fix
“expanded cover” changed to “expanded to cover”
2021-12-05 09:52:50 -05:00
Daniel Micay
d8817417cc use compiler extension instead of C11 noreturn
C11 noreturn isn't available in C++.
2021-11-23 16:00:06 -05:00
Daniel Micay
7106bff27f update required dependencies 2021-11-23 15:53:03 -05:00
Lelmister101
1bdbb2d3f7 minor typo fix
“entirely independently arenas” changed to “entirely independent arenas”
2021-11-23 15:39:53 -05:00
Thibaut Sautereau
a33d2ca97d Fix CPPFLAGS in test Makefile
In particular, the _GNU_SOURCE feature test macro needs to be set in
order to correctly define mmap(2) flags such as MAP_ANONYMOUS.
Otherwise, compilation of some test files fails when CPPFLAGS is not
defined in the initial user environment, as Make then does not export it
from the root Makefile to the sub-make.
2021-11-02 16:13:09 -04:00
Daniel Micay
aa94408cc2 fix wording 2021-10-19 23:52:18 -04:00
Daniel Micay
8f9305df57 Android 12 is supported 2021-10-08 13:44:28 -04:00
anupritaisno1
cc0a1e1736 make hardened malloc vendor ramdisk avaiable
Signed-off-by: anupritaisno1 <www.anuprita804@gmail.com>
2021-10-08 13:43:11 -04:00
Daniel Micay
3b72a4f810 set C / C++ standard parameter for clang-tidy 2021-09-30 11:05:47 -04:00
Daniel Micay
e41d37c3de remove unnecessary else 2021-09-30 10:57:05 -04:00
Daniel Micay
23969727d8 disable readability-function-cognitive-complexity 2021-09-30 10:55:12 -04:00