platform_bionic/libc
Christopher Ferris ff88fb0d3a Fix allocations escaping malloc debug.
When using a FILE object for some malloc debug functions, calling
fprintf will trigger an allocation to be put in the object. The problem
is that these allocations were not allocated by the malloc debug
wrapper and they get freed during the fclose as if they are malloc
debug allocation. In most cases, the code will detect the bad pointer
and leak the memory, but it might also cause a crash.

The fix is to avoid using fprintf so that no allocations are made
in the object that survive and need to be freed in the fclose call.

Change the MallocXmlElem.h to use a file decsriptor not a FILE object.

Add new unit and system tests to detect this case.

Bug: 143742907

Test: Ran unit and system tests.
Test: Ran bionic unit tests.
Change-Id: I524392de822a29483aa5be8f14c680e70033eba2
2019-11-06 10:42:42 -08:00
..
arch-arm Add arm64 string.h function implementations for use with hardware supporting MTE. 2019-10-29 16:18:31 -07:00
arch-arm64 Add arm64 string.h function implementations for use with hardware supporting MTE. 2019-10-29 16:18:31 -07:00
arch-common/bionic crtbegin: replace TPREL with R_*_NONE relocs 2019-09-04 20:31:06 +00:00
arch-mips Generate assembler system call stubs via genrule. 2019-04-16 12:31:00 -07:00
arch-mips64/bionic Generate assembler system call stubs via genrule. 2019-04-16 12:31:00 -07:00
arch-x86 Make tls related header files platform accessible. 2019-09-27 12:14:24 -07:00
arch-x86_64 Make tls related header files platform accessible. 2019-09-27 12:14:24 -07:00
async_safe Enable native_bridge_support 2019-05-06 17:13:51 +02:00
bionic Fix allocations escaping malloc debug. 2019-11-06 10:42:42 -08:00
dns Test for ns_parserr() and got a heap-buffer-overflow 2019-08-29 22:18:37 +08:00
include Adopt GNU calling convention for ifunc resolvers. 2019-10-28 20:20:29 -07:00
kernel Update to kernel headers v5.3.2. 2019-10-03 10:59:32 -07:00
malloc_debug Fix allocations escaping malloc debug. 2019-11-06 10:42:42 -08:00
malloc_hooks libc_malloc_[debug|hooks] are not available for platform 2019-10-07 15:52:21 +09:00
platform/bionic Add arm64 string.h function implementations for use with hardware supporting MTE. 2019-10-29 16:18:31 -07:00
private Fix allocations escaping malloc debug. 2019-11-06 10:42:42 -08:00
seccomp Remove global seccomp list. 2019-09-17 16:37:05 -07:00
stdio Remove the ___ hack. 2019-06-19 15:38:42 -07:00
stdlib Revert fwalk/sfp locking to fix concurrent reads 2019-05-04 00:28:00 -07:00
system_properties Enable native_bridge_support 2019-05-06 17:13:51 +02:00
tools Fix gensyscalls.py to actually use the input argument provided in 2019-09-26 15:02:04 -04:00
tzcode Remove bionic refs to runtime module tz files 2019-06-10 15:09:15 +01:00
upstream-freebsd qsort.c: take an upstream FreeBSD change. 2019-10-30 12:02:44 -07:00
upstream-netbsd Clean up some obsolete NetBSD portability cruft. 2019-10-29 19:58:17 -07:00
upstream-openbsd Merge "Clean up some obsolete OpenBSD portability cruft." 2019-10-30 17:20:58 +00:00
versioner-dependencies Fix clang header dependency for versioner 2019-07-29 15:44:46 -07:00
Android.bp Define ANDROID_EXPERIMENTAL_MTE if the product variable experimental_mte is enabled. 2019-11-01 15:37:00 -07:00
fs_config_generator.py Revert "Revert "move android_ids into bionic"" 2016-12-13 23:47:25 +00:00
libc.map.txt libc: remove now-unused FORTIFY functions 2019-10-07 19:09:38 -07:00
libstdc++.map.txt Mark new/delete as weak in the NDK stubs. 2017-07-28 11:01:33 -07:00
MODULE_LICENSE_BSD
NOTICE Update notice 2019-07-17 10:56:16 -07:00
SECCOMP_BLACKLIST_APP.TXT Blacklist setregid(32) for apps. 2019-01-22 17:22:54 +01:00
SECCOMP_BLACKLIST_COMMON.TXT Split zygote's seccomp filter into two 2018-01-04 12:28:40 -08:00
SECCOMP_WHITELIST_APP.TXT Move pipe, open, and getdents from the APP to COMMON seccomp whitelist. 2018-09-11 19:20:34 -04:00
SECCOMP_WHITELIST_COMMON.TXT Add memfd_create(2) and mlock2(2). 2019-08-05 16:31:08 -07:00
SECCOMP_WHITELIST_SYSTEM.TXT Add bpf syscall to seccomp whitelist 2018-01-18 12:08:34 -08:00
SYSCALLS.TXT Add memfd_create(2) and mlock2(2). 2019-08-05 16:31:08 -07:00
version_script.txt