platform_bionic/libc/malloc_debug/tests
Christopher Ferris 1fc5ccfe76 Add a platform API for setting an allocation limit.
Introduce an M_SET_ALLOCATION_LIMIT enumerator for android_mallopt(),
which can be used to set an upper bound on the total size of all
allocations made using the memory allocation APIs.

This is useful for programs such as audioextractor and mediaserver
which need to set such a limit as a security mitigation. Currently
these programs are using setrlimit(RLIMIT_AS) which isn't exactly
what these programs want to control. RLIMIT_AS is also problematic
under sanitizers which allocate large amounts of address space as
shadow memory, and is especially problematic under shadow call stack,
which requires 16MB of address space per thread.

Add new unit tests for bionic.

Add new unit tests for malloc debug that verify that when the limit
is enabled, malloc debug still functions for nearly every allocation
function.

Bug: 118642754
Test: Ran bionic-unit-tests/bionic-unit-tests-static.
Test: Ran malloc debug tests and perfetto integration tests.
Change-Id: I735403c4d2c87f00fb2cdef81d00af0af446b2bb
2019-03-15 10:54:55 -07:00
..
backtrace_fake.cpp Add support for using the new unwinder. 2018-05-24 08:44:53 -07:00
backtrace_fake.h Add support for using the new unwinder. 2018-05-24 08:44:53 -07:00
libc_fake.cpp Malloc debug rewrite. 2016-01-25 10:54:21 -08:00
log_fake.cpp Add support for using the new unwinder. 2018-05-24 08:44:53 -07:00
log_fake.h Malloc debug rewrite. 2016-01-25 10:54:21 -08:00
malloc_debug_config_tests.cpp Bionic malloc debug: add a new option "abort_on_error" 2019-01-22 15:54:36 -08:00
malloc_debug_system_tests.cpp Add a platform API for setting an allocation limit. 2019-03-15 10:54:55 -07:00
malloc_debug_unit_tests.cpp Refactor the malloc_info code. 2019-03-07 08:39:55 -08:00