Commit Graph

72 Commits (66284acfbb774c6f84bcf07944b0d5778a13df82)

Author SHA1 Message Date
Christian Göttsche 903cba5a84 test: add regression test for missing init() in realloc() 2023-09-27 19:19:19 -04:00
Daniel Micay 64dad0a69f drop legacy glibc support 2023-06-10 14:04:46 -04:00
jvoisin b511696c55 clean up includes and remove non-portable includes
This marginally increases the portability of hardened_malloc,
eg. on OSX.
2022-02-07 07:14:51 -05:00
jvoisin 943704de7c Remove __pycache__ as well in `make clean` 2022-02-06 18:56:56 -05:00
Daniel Micay ae2524bf88 ignore environment for test Makefile variables 2022-01-21 16:24:49 -05:00
Daniel Micay e28addda19 add back gitignore entries 2022-01-21 15:07:13 -05:00
Daniel Micay 9d89712386 remove extra newline 2022-01-21 15:06:29 -05:00
jvoisin 84eadd8568 Move memory corruption tests up a directory 2022-01-21 15:00:18 -05:00
jvoisin 3fa30842ed Use $(MAKE) instead of make in Makefiles
This will pass the correct flags to the make
invocations.
2022-01-17 16:21:00 -05:00
Daniel Micay 189d3362d5 enable sized deallocation ABI for consistency 2022-01-16 11:49:51 -05:00
Daniel Micay a2bdb4da27 update gitignore for renamed / added tests 2022-01-12 08:41:21 -05:00
Daniel Micay b3372e1576 add configuration template system 2022-01-10 04:47:01 -05:00
jvoisin 052b756840 Fix two warnings 2022-01-09 08:50:46 -05:00
jvoisin 001eb0687b Fix an unused parameter warning 2022-01-04 12:16:53 -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 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
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
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 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 06192ae499 `make clean` is now thorough 2021-12-26 16:28:03 -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
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 801e8d959f disable mallinfo2 test for old glibc 2021-09-30 01:16:10 -04:00
Daniel Micay 93a87ce30b add new mallinfo2 test to gitignore too 2021-05-12 21:13:06 -04:00
Daniel Micay a45dacc57b add support for glibc mallinfo2 2021-05-12 20:07:15 -04: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 10c5d61187 work around glibc bug in mallinfo test 2020-11-10 14:14:08 -05:00
Daniel Micay 8906c0941a improve mallinfo test 2020-09-18 11:38:06 -04:00
Daniel Micay 022b64791e whitespace fixes 2020-09-17 17:23:13 -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
rwarr627 195bc8c92a added tests for malloc_object_size
LDFLAGS is on single line
2020-06-13 01:27:32 -04:00
rwarr627 0a3a726c93 added tests for malloc_usable_size 2020-04-29 18:06:15 -04:00
Daniel Micay c75dcb9d9c compare with negative integers to check signals 2020-04-11 15:26:24 -04:00
Daniel Micay d757835d90 increase size for eight_byte_overflow_large test
This was not working as expected due to CONFIG_EXTENDED_SIZE_CLASSES
resulting in 128k being a slab allocation size class. The addition of
padding for the canary pushes it into the next size class, resulting in
this writing over size class rounding padding rather than this actually
being an overflow as intended.
2020-04-11 15:25:34 -04:00
rwarr627 b160f723e0 ignores __pycache__ 2020-04-11 15:08:30 -04:00
rwarr627 ec6854c71b added test rule 2020-04-11 15:08:30 -04:00
rwarr627 6b987e644b verifies the results of the simple-memory-corruption tests 2020-04-11 15:08:30 -04:00
Daniel Micay 539d4f0d37 add extended size classes to offset test 2019-06-18 15:51:28 -04:00