Hi all, I'm recently learning Address Sanitizer code and learned that the runtime library is designed to replace the glibc malloc/free with our customized ones so that we can insert red zone before and after the allocated region.
>From the code, I've learned that such a replacement is implemented by changing the runtime library load priority. By writing our malloc/free with exactly the same function signature as the library ones, and letting our runtime library being loaded before glibc, our malloc/free function will be invoked by the user program. However, we are not able to invoke printf library functions anymore, cause printf depends on malloc, therefore, each time when printf is invoked when implementing asan runtime library, it will call our malloc instead of library malloc. Why not just implement our malloc and free to another name, say asan_malloc and asan_free? In that case, we can replace the malloc invocation with asan_malloc invocation during compilation, and no need to write a totally new printf. Is there any reason to have the same name? -- You received this message because you are subscribed to the Google Groups "address-sanitizer" group. To unsubscribe from this group and stop receiving emails from it, send an email to address-sanitizer+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/address-sanitizer/57a42ca0-4f03-4c15-9a94-fb7b87549c7an%40googlegroups.com.