Fix mallinfo result interpretation

We assumed that mallinfo.hblkhd represents the amount of memory
in large blocks allocated directly with mmap. That appears to be
the intended interpretation for glibc, but not jemalloc.

In the jemalloc case, remove the attempt to sanity check and repair
the uordblks field based on this information. The bug requiring it
there was fixed long ago. Based on old notes, the check may still be
required for glibc. Out of an abundance of caution, leave it there for
now.

Add a conditional sanity check of the argument for
RegisterNativeAllocation().

This was externally reported through unofficial channels.

Test: Build and boot AOSP.
Change-Id: I5d10f239057ed3efeb39f28e8c7d87849ee60ff0
1 file changed