-
Notifications
You must be signed in to change notification settings - Fork 16.7k
[gwp-asan] handle error of mprotect properly. #60815
Copy link
Copy link
Open
Labels
Description
When we allocate memory with gwp-asan, we call mprotect in
llvm-project/compiler-rt/lib/gwp_asan/platform_specific/guarded_pool_allocator_posix.cpp
Line 78 in 2d6713b
| Check(mprotect(Ptr, Size, PROT_READ | PROT_WRITE) == 0, |
This api will return -1 when reaching system vm map limit, and then crash. I think we can handle this error silently, free the allocated address and return
nullptr, just like what tcmalloc does in https://github.com/google/tcmalloc/blob/5034f8cecdbe559bf24e0ae7f7eb7c10b873ac9e/tcmalloc/guarded_page_allocator.cc#L94Reactions are currently unavailable