• Andreas Haas's avatar
    [base] Check the mprotect return code directly in SetSystemPagesAccess · 5ed9a469
    Andreas Haas authored
    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: default avatarJeremy Roman <jbroman@chromium.org>
    Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
    Commit-Queue: Andreas Haas <ahaas@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#608310}
    5ed9a469
v8_platform.cc 14.1 KB