Skip to content

[gwp-asan] handle error of mprotect properly. #60815

@hanfei1991

Description

@hanfei1991

When we allocate memory with gwp-asan, we call mprotect in

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#L94

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions