https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96773
Bug ID: 96773 Summary: ASan: please provide __asan_address_is_shadow() for complex programs Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: sanitizer Assignee: unassigned at gcc dot gnu.org Reporter: diane2332 at gmail dot com CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org, jakub at gcc dot gnu.org, kcc at gcc dot gnu.org, marxin at gcc dot gnu.org Target Milestone: --- I am using ASan on a huge application, and it does things like dumping various memory areas when there is an error. It has a function that indicates whether a particular address is safe to dereference. If this function says that an address in ASan's shadow or shadow gap is ok to reference, and the caller is instrumented for ASan, a SEGV can occur. For this reason I would like ASan to provide a function to indicate whether an address is in ASan's shadow or shadow gap, and therefore, shouldn't be dereferenced. My suggested interface for this is: int __asan_address_is_shadow (void *address); // returns 1 if address is in high shadow, low shadow, or shadow gap I know that the addresses of these areas on various targets are published in AddressSanitizerAlgorithm, but they are subject to change under various flags, so it's best not to rely on these addresses. Please see also the GitHub I filed: https://github.com/google/sanitizers/issues/1299