Is there a function to detect whether a given virtual address mapped by mmap
is protected by mprotect
? Accessing such an address will result in segmentation fault if PROT_NONE
is set. So I'd like to first detect whether they're protected or not.
It's better if I don't need to introduce signal handlers. If there isn't any such function, any other lightweight solution is also fine. Thanks.