It seems that we have lots of redundant MaybeMountProcFS, in particular
each mapped sanitized shared library calls it from AsanInitializer constructor.
Remove redudant MaybeMountProcFS calls from AsanInitializer and __asan_init.
Also, it seems that under qemu-aarch64 opening /proc/self/maps for reading
might be very expensive, so replace OpenFile("/proc/self/maps", RdOnly) with
FileExists("/proc/self/maps") in MaybeMountProcFS to avoid expensive calls.
Change-Id: I8ba28dbbc102be519fa2b284520509f601ec5cf7
Signed-off-by: Maxim Ostapenko <m.ostapenko@samsung.com>
}
bool MaybeMountProcFS() {
- uptr tmp = OpenFile("/proc/self/maps", RdOnly);
- if(!internal_iserror(tmp)) {
- internal_close(tmp);
- return true;
- }
+ if (FileExists("/proc/self/maps")) return true;
+
if(0 != mount("proc", "/proc", "proc", 0, 0)) {
Report("Failed to mount /proc, Asan is likely to fail\n");
return false;
class AsanInitializer {
public: // NOLINT
AsanInitializer() {
- MaybeMountProcFS();
AsanInitFromRtl();
}
};
// Initialize as requested from instrumented application code.
// We use this call as a trigger to wake up ASan from deactivated state.
void __asan_init() {
- MaybeMountProcFS();
AsanActivate();
AsanInitInternal();
}