Conversation

twitter.com/yabbadabbadrew It's nice to see this feature get implemented. I'll need to change the naming of my existing __dynamic_object_size function once I reimplement that for Android Oreo based on the new hardened malloc implementation to disambiguate. github.com/AndroidHardeni
Quote Tweet
Clang's new __builtin_dynamic_object_size can help detect more buffer overflows at runtime automatically. clang.llvm.org/docs/LanguageE
Show this thread
1
The __dynamic_object_size that I implemented for Bionic was something much different. It queries the hardened malloc implementation for sizes and uses fast paths for objects on the stack or in the executable. That was built with the old hardened malloc forked from OpenBSD malloc.
1
It fits into a far different performance profile and was only used for system calls, obviously not the C mem* and str* functions or even fread/fwrite. It's one of a dozen extensions that was implemented on top of OpenBSD malloc in the fork. The new malloc will also include this.
1
The new implemented is going to be split into a function matching the old implementation (able to eventually provide fully accurate results taking into account offsets into objects and whether they're free) and a fast variant based on address checks leveraging size class regions.