[base] Check the mprotect return code directly in SetSystemPagesAccess
SetSystemPagesAccess is more or less a wrapper around mprotect on posix systems, and VirtualFree and VirtualAlloc on Windows. We see crashes, e.g. in the referenced issue, where the return value of mprotect is not equal to 0. However, because we do not CHECK the return value of mprotect directly, we cannot see the reason why mprotect failed. With this CL I move the CHECK of the return value of mprotect to the mprotect, so if the CHECK fails, we also see the error reason. Some caller of SetSystemPagesAccess do not CHECK the result of SetSystemPagesAccess but deal with it or forward it. For these callers I introduced a new function, TrySetSystemPagesAccess, which does exactly the same as SetSystemPagesAccess did until now. Bug: chromium:839036 Change-Id: I774e648cc6968202805a495fc0b3c3b7d9974b02 Reviewed-on: https://chromium-review.googlesource.com/c/1336130Reviewed-by:Jeremy Roman <jbroman@chromium.org> Reviewed-by:
Kentaro Hara <haraken@chromium.org> Commit-Queue: Andreas Haas <ahaas@chromium.org> Cr-Commit-Position: refs/heads/master@{#608310}
Showing
Please register or sign in to comment