```
sudo cowbuilder --login --basepath /var/cache/pbuilder/base.cow_amd64
```
…
```
root@work:/hardened_malloc# make
cc -std=c11 -O3 -flto -fPIC -fvisibility=hidden -fno-plt -fstack-clash-protection -fstack-protector-strong -pipe -Wall -Wextra -Wcast-align=strict -Wcast-qual -Wwrite-strings -Werror -march=native -Wmissing-prototypes -D_GNU_SOURCE -I include -DCONFIG_SEAL_METADATA=false -DZERO_ON_FREE=true -DWRITE_AFTER_FREE_CHECK=true -DSLOT_RANDOMIZE=true -DSLAB_CANARY=true -DSLAB_QUARANTINE_RANDOM_LENGTH=1 -DSLAB_QUARANTINE_QUEUE_LENGTH=1 -DCONFIG_EXTENDED_SIZE_CLASSES=true -DCONFIG_LARGE_SIZE_CLASSES=true -DGUARD_SLABS_INTERVAL=1 -DGUARD_SIZE_DIVISOR=2 -DREGION_QUARANTINE_RANDOM_LENGTH=128 -DREGION_QUARANTINE_QUEUE_LENGTH=1024 -DREGION_QUARANTINE_SKIP_THRESHOLD=33554432 -DFREE_SLABS_QUARANTINE_RANDOM_LENGTH=32 -DCONFIG_CLASS_REGION_SIZE=34359738368 -DN_ARENA=4 -DCONFIG_STATS=false -c -o chacha.o chacha.c
cc -std=c11 -O3 -flto -fPIC -fvisibility=hidden -fno-plt -fstack-clash-protection -fstack-protector-strong -pipe -Wall -Wextra -Wcast-align=strict -Wcast-qual -Wwrite-strings -Werror -march=native -Wmissing-prototypes -D_GNU_SOURCE -I include -DCONFIG_SEAL_METADATA=false -DZERO_ON_FREE=true -DWRITE_AFTER_FREE_CHECK=true -DSLOT_RANDOMIZE=true -DSLAB_CANARY=true -DSLAB_QUARANTINE_RANDOM_LENGTH=1 -DSLAB_QUARANTINE_QUEUE_LENGTH=1 -DCONFIG_EXTENDED_SIZE_CLASSES=true -DCONFIG_LARGE_SIZE_CLASSES=true -DGUARD_SLABS_INTERVAL=1 -DGUARD_SIZE_DIVISOR=2 -DREGION_QUARANTINE_RANDOM_LENGTH=128 -DREGION_QUARANTINE_QUEUE_LENGTH=1024 -DREGION_QUARANTINE_SKIP_THRESHOLD=33554432 -DFREE_SLABS_QUARANTINE_RANDOM_LENGTH=32 -DCONFIG_CLASS_REGION_SIZE=34359738368 -DN_ARENA=4 -DCONFIG_STATS=false -c -o h_malloc.o h_malloc.c
cc -std=c11 -O3 -flto -fPIC -fvisibility=hidden -fno-plt -fstack-clash-protection -fstack-protector-strong -pipe -Wall -Wextra -Wcast-align=strict -Wcast-qual -Wwrite-strings -Werror -march=native -Wmissing-prototypes -D_GNU_SOURCE -I include -DCONFIG_SEAL_METADATA=false -DZERO_ON_FREE=true -DWRITE_AFTER_FREE_CHECK=true -DSLOT_RANDOMIZE=true -DSLAB_CANARY=true -DSLAB_QUARANTINE_RANDOM_LENGTH=1 -DSLAB_QUARANTINE_QUEUE_LENGTH=1 -DCONFIG_EXTENDED_SIZE_CLASSES=true -DCONFIG_LARGE_SIZE_CLASSES=true -DGUARD_SLABS_INTERVAL=1 -DGUARD_SIZE_DIVISOR=2 -DREGION_QUARANTINE_RANDOM_LENGTH=128 -DREGION_QUARANTINE_QUEUE_LENGTH=1024 -DREGION_QUARANTINE_SKIP_THRESHOLD=33554432 -DFREE_SLABS_QUARANTINE_RANDOM_LENGTH=32 -DCONFIG_CLASS_REGION_SIZE=34359738368 -DN_ARENA=4 -DCONFIG_STATS=false -c -o pages.o pages.c
cc -std=c11 -O3 -flto -fPIC -fvisibility=hidden -fno-plt -fstack-clash-protection -fstack-protector-strong -pipe -Wall -Wextra -Wcast-align=strict -Wcast-qual -Wwrite-strings -Werror -march=native -Wmissing-prototypes -D_GNU_SOURCE -I include -DCONFIG_SEAL_METADATA=false -DZERO_ON_FREE=true -DWRITE_AFTER_FREE_CHECK=true -DSLOT_RANDOMIZE=true -DSLAB_CANARY=true -DSLAB_QUARANTINE_RANDOM_LENGTH=1 -DSLAB_QUARANTINE_QUEUE_LENGTH=1 -DCONFIG_EXTENDED_SIZE_CLASSES=true -DCONFIG_LARGE_SIZE_CLASSES=true -DGUARD_SLABS_INTERVAL=1 -DGUARD_SIZE_DIVISOR=2 -DREGION_QUARANTINE_RANDOM_LENGTH=128 -DREGION_QUARANTINE_QUEUE_LENGTH=1024 -DREGION_QUARANTINE_SKIP_THRESHOLD=33554432 -DFREE_SLABS_QUARANTINE_RANDOM_LENGTH=32 -DCONFIG_CLASS_REGION_SIZE=34359738368 -DN_ARENA=4 -DCONFIG_STATS=false -c -o random.o random.c
cc -std=c11 -O3 -flto -fPIC -fvisibility=hidden -fno-plt -fstack-clash-protection -fstack-protector-strong -pipe -Wall -Wextra -Wcast-align=strict -Wcast-qual -Wwrite-strings -Werror -march=native -Wmissing-prototypes -D_GNU_SOURCE -I include -DCONFIG_SEAL_METADATA=false -DZERO_ON_FREE=true -DWRITE_AFTER_FREE_CHECK=true -DSLOT_RANDOMIZE=true -DSLAB_CANARY=true -DSLAB_QUARANTINE_RANDOM_LENGTH=1 -DSLAB_QUARANTINE_QUEUE_LENGTH=1 -DCONFIG_EXTENDED_SIZE_CLASSES=true -DCONFIG_LARGE_SIZE_CLASSES=true -DGUARD_SLABS_INTERVAL=1 -DGUARD_SIZE_DIVISOR=2 -DREGION_QUARANTINE_RANDOM_LENGTH=128 -DREGION_QUARANTINE_QUEUE_LENGTH=1024 -DREGION_QUARANTINE_SKIP_THRESHOLD=33554432 -DFREE_SLABS_QUARANTINE_RANDOM_LENGTH=32 -DCONFIG_CLASS_REGION_SIZE=34359738368 -DN_ARENA=4 -DCONFIG_STATS=false -c -o util.o util.c
cc -std=c++17 -O3 -flto -fPIC -fvisibility=hidden -fno-plt -fstack-clash-protection -fstack-protector-strong -pipe -Wall -Wextra -Wcast-align=strict -Wcast-qual -Wwrite-strings -Werror -march=native -D_GNU_SOURCE -I include -DCONFIG_SEAL_METADATA=false -DZERO_ON_FREE=true -DWRITE_AFTER_FREE_CHECK=true -DSLOT_RANDOMIZE=true -DSLAB_CANARY=true -DSLAB_QUARANTINE_RANDOM_LENGTH=1 -DSLAB_QUARANTINE_QUEUE_LENGTH=1 -DCONFIG_EXTENDED_SIZE_CLASSES=true -DCONFIG_LARGE_SIZE_CLASSES=true -DGUARD_SLABS_INTERVAL=1 -DGUARD_SIZE_DIVISOR=2 -DREGION_QUARANTINE_RANDOM_LENGTH=128 -DREGION_QUARANTINE_QUEUE_LENGTH=1024 -DREGION_QUARANTINE_SKIP_THRESHOLD=33554432 -DFREE_SLABS_QUARANTINE_RANDOM_LENGTH=32 -DCONFIG_CLASS_REGION_SIZE=34359738368 -DN_ARENA=4 -DCONFIG_STATS=false -c -o new.o new.cc
cc -std=c11 -O3 -flto -fPIC -fvisibility=hidden -fno-plt -fstack-clash-protection -fstack-protector-strong -pipe -Wall -Wextra -Wcast-align=strict -Wcast-qual -Wwrite-strings -Werror -march=native -Wmissing-prototypes -Wl,--as-needed,-z,defs,-z,relro,-z,now,-z,nodlopen,-z,text -shared chacha.o h_malloc.o memory.o pages.o random.o util.o new.o -lstdc++ -lgcc_s -o libhardened_malloc.so
root@work:/hardened_malloc# make test
make -C test/
make[1]: Entering directory '/hardened_malloc/test'
make -C simple-memory-corruption
make[2]: Entering directory '/hardened_malloc/test/simple-memory-corruption'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory '/hardened_malloc/test/simple-memory-corruption'
make[1]: Leaving directory '/hardened_malloc/test'
python -m unittest discover --start-directory test/
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
======================================================================
FAIL: test_delete_type_size_mismatch (simple-memory-corruption.test_smc.TestSimpleMemoryCorruption)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/hardened_malloc/test/simple-memory-corruption/test_smc.py", line 21, in test_delete_type_size_mismatch
self.assertEqual(returncode, -6)
AssertionError: 127 != -6
======================================================================
FAIL: test_double_free_large (simple-memory-corruption.test_smc.TestSimpleMemoryCorruption)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/hardened_malloc/test/simple-memory-corruption/test_smc.py", line 34, in test_double_free_large
self.assertEqual(returncode, -6)
AssertionError: 127 != -6
======================================================================
FAIL: test_double_free_large_delayed (simple-memory-corruption.test_smc.TestSimpleMemoryCorruption)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/hardened_malloc/test/simple-memory-corruption/test_smc.py", line 28, in test_double_free_large_delayed
self.assertEqual(returncode, -6)
AssertionError: 127 != -6
======================================================================
FAIL: test_double_free_small (simple-memory-corruption.test_smc.TestSimpleMemoryCorruption)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/hardened_malloc/test/simple-memory-corruption/test_smc.py", line 47, in test_double_free_small
self.assertEqual(returncode, -6)
AssertionError: 127 != -6
======================================================================
FAIL: test_double_free_small_delayed (simple-memory-corruption.test_smc.TestSimpleMemoryCorruption)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/hardened_malloc/test/simple-memory-corruption/test_smc.py", line 41, in test_double_free_small_delayed
self.assertEqual(returncode, -6)
AssertionError: 127 != -6
======================================================================
FAIL: test_eight_byte_overflow_large (simple-memory-corruption.test_smc.TestSimpleMemoryCorruption)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/hardened_malloc/test/simple-memory-corruption/test_smc.py", line 54, in test_eight_byte_overflow_large
self.assertEqual(returncode, -11)
AssertionError: 127 != -11
======================================================================
FAIL: test_eight_byte_overflow_small (simple-memory-corruption.test_smc.TestSimpleMemoryCorruption)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/hardened_malloc/test/simple-memory-corruption/test_smc.py", line 59, in test_eight_byte_overflow_small
self.assertEqual(returncode, -6)
AssertionError: 127 != -6
======================================================================
FAIL: test_invalid_free_protected (simple-memory-corruption.test_smc.TestSimpleMemoryCorruption)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/hardened_malloc/test/simple-memory-corruption/test_smc.py", line 65, in test_invalid_free_protected
self.assertEqual(returncode, -6)
AssertionError: 127 != -6
======================================================================
FAIL: test_invalid_free_small_region (simple-memory-corruption.test_smc.TestSimpleMemoryCorruption)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/hardened_malloc/test/simple-memory-corruption/test_smc.py", line 79, in test_invalid_free_small_region
self.assertEqual(returncode, -6)
AssertionError: 127 != -6
======================================================================
FAIL: test_invalid_free_small_region_far (simple-memory-corruption.test_smc.TestSimpleMemoryCorruption)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/hardened_malloc/test/simple-memory-corruption/test_smc.py", line 72, in test_invalid_free_small_region_far
self.assertEqual(returncode, -6)
AssertionError: 127 != -6
======================================================================
FAIL: test_invalid_free_unprotected (simple-memory-corruption.test_smc.TestSimpleMemoryCorruption)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/hardened_malloc/test/simple-memory-corruption/test_smc.py", line 85, in test_invalid_free_unprotected
self.assertEqual(returncode, -6)
AssertionError: 127 != -6
======================================================================
FAIL: test_invalid_malloc_object_size_small (simple-memory-corruption.test_smc.TestSimpleMemoryCorruption)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/hardened_malloc/test/simple-memory-corruption/test_smc.py", line 196, in test_invalid_malloc_object_size_small
self.assertEqual(returncode, -6)
AssertionError: 127 != -6
======================================================================
FAIL: test_invalid_malloc_object_size_small_quarantine (simple-memory-corruption.test_smc.TestSimpleMemoryCorruption)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/hardened_malloc/test/simple-memory-corruption/test_smc.py", line 203, in test_invalid_malloc_object_size_small_quarantine
self.assertEqual(returncode, -6)
AssertionError: 127 != -6
======================================================================
FAIL: test_invalid_malloc_usable_size_small (simple-memory-corruption.test_smc.TestSimpleMemoryCorruption)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/hardened_malloc/test/simple-memory-corruption/test_smc.py", line 99, in test_invalid_malloc_usable_size_small
self.assertEqual(returncode, -6)
AssertionError: 127 != -6
======================================================================
FAIL: test_invalid_malloc_usable_size_small_quarantene (simple-memory-corruption.test_smc.TestSimpleMemoryCorruption)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/hardened_malloc/test/simple-memory-corruption/test_smc.py", line 92, in test_invalid_malloc_usable_size_small_quarantene
self.assertEqual(returncode, -6)
AssertionError: 127 != -6
======================================================================
FAIL: test_malloc_object_size (simple-memory-corruption.test_smc.TestSimpleMemoryCorruption)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/hardened_malloc/test/simple-memory-corruption/test_smc.py", line 186, in test_malloc_object_size
self.assertEqual(returncode, 0)
AssertionError: 127 != 0
======================================================================
FAIL: test_malloc_object_size_offset (simple-memory-corruption.test_smc.TestSimpleMemoryCorruption)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/hardened_malloc/test/simple-memory-corruption/test_smc.py", line 191, in test_malloc_object_size_offset
self.assertEqual(returncode, 0)
AssertionError: 127 != 0
======================================================================
FAIL: test_read_after_free_large (simple-memory-corruption.test_smc.TestSimpleMemoryCorruption)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/hardened_malloc/test/simple-memory-corruption/test_smc.py", line 105, in test_read_after_free_large
self.assertEqual(returncode, -11)
AssertionError: 127 != -11
======================================================================
FAIL: test_read_after_free_small (simple-memory-corruption.test_smc.TestSimpleMemoryCorruption)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/hardened_malloc/test/simple-memory-corruption/test_smc.py", line 109, in test_read_after_free_small
self.assertEqual(returncode, 0)
AssertionError: 127 != 0
======================================================================
FAIL: test_read_zero_size (simple-memory-corruption.test_smc.TestSimpleMemoryCorruption)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/hardened_malloc/test/simple-memory-corruption/test_smc.py", line 115, in test_read_zero_size
self.assertEqual(returncode, -11)
AssertionError: 127 != -11
======================================================================
FAIL: test_string_overflow (simple-memory-corruption.test_smc.TestSimpleMemoryCorruption)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/hardened_malloc/test/simple-memory-corruption/test_smc.py", line 119, in test_string_overflow
self.assertEqual(returncode, 0)
AssertionError: 127 != 0
======================================================================
FAIL: test_unaligned_free_large (simple-memory-corruption.test_smc.TestSimpleMemoryCorruption)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/hardened_malloc/test/simple-memory-corruption/test_smc.py", line 124, in test_unaligned_free_large
self.assertEqual(returncode, -6)
AssertionError: 127 != -6
======================================================================
FAIL: test_unaligned_free_small (simple-memory-corruption.test_smc.TestSimpleMemoryCorruption)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/hardened_malloc/test/simple-memory-corruption/test_smc.py", line 130, in test_unaligned_free_small
self.assertEqual(returncode, -6)
AssertionError: 127 != -6
======================================================================
FAIL: test_unaligned_malloc_usable_size_small (simple-memory-corruption.test_smc.TestSimpleMemoryCorruption)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/hardened_malloc/test/simple-memory-corruption/test_smc.py", line 137, in test_unaligned_malloc_usable_size_small
self.assertEqual(returncode, -6)
AssertionError: 127 != -6
======================================================================
FAIL: test_uninitialized_free (simple-memory-corruption.test_smc.TestSimpleMemoryCorruption)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/hardened_malloc/test/simple-memory-corruption/test_smc.py", line 143, in test_uninitialized_free
self.assertEqual(returncode, -6)
AssertionError: 127 != -6
======================================================================
FAIL: test_uninitialized_malloc_usable_size (simple-memory-corruption.test_smc.TestSimpleMemoryCorruption)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/hardened_malloc/test/simple-memory-corruption/test_smc.py", line 150, in test_uninitialized_malloc_usable_size
self.assertEqual(returncode, -11)
AssertionError: 127 != -11
======================================================================
FAIL: test_uninitialized_realloc (simple-memory-corruption.test_smc.TestSimpleMemoryCorruption)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/hardened_malloc/test/simple-memory-corruption/test_smc.py", line 154, in test_uninitialized_realloc
self.assertEqual(returncode, -6)
AssertionError: 127 != -6
======================================================================
FAIL: test_write_after_free_large (simple-memory-corruption.test_smc.TestSimpleMemoryCorruption)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/hardened_malloc/test/simple-memory-corruption/test_smc.py", line 165, in test_write_after_free_large
self.assertEqual(returncode, -11)
AssertionError: 127 != -11
======================================================================
FAIL: test_write_after_free_large_reuse (simple-memory-corruption.test_smc.TestSimpleMemoryCorruption)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/hardened_malloc/test/simple-memory-corruption/test_smc.py", line 161, in test_write_after_free_large_reuse
self.assertEqual(returncode, -11)
AssertionError: 127 != -11
======================================================================
FAIL: test_write_after_free_small (simple-memory-corruption.test_smc.TestSimpleMemoryCorruption)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/hardened_malloc/test/simple-memory-corruption/test_smc.py", line 176, in test_write_after_free_small
self.assertEqual(returncode, -6)
AssertionError: 127 != -6
======================================================================
FAIL: test_write_after_free_small_reuse (simple-memory-corruption.test_smc.TestSimpleMemoryCorruption)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/hardened_malloc/test/simple-memory-corruption/test_smc.py", line 170, in test_write_after_free_small_reuse
self.assertEqual(returncode, -6)
AssertionError: 127 != -6
======================================================================
FAIL: test_write_zero_size (simple-memory-corruption.test_smc.TestSimpleMemoryCorruption)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/hardened_malloc/test/simple-memory-corruption/test_smc.py", line 182, in test_write_zero_size
self.assertEqual(returncode, -11)
AssertionError: 127 != -11
----------------------------------------------------------------------
Ran 32 tests in 0.036s
FAILED (failures=32)
make: [Makefile:139: test] Error 1 (ignored)
root@work:/hardened_malloc#
```
Any idea why this is happening? Fixable at chroot side or in hardened malloc source side?