Commit 2c508701 authored by Samuel Groß's avatar Samuel Groß Committed by V8 LUCI CQ

[base] Also handle ERROR_COMMITMENT_LIMIT in OS::SetPermissions

Bug: chromium:1320784
Change-Id: I7057e294913d3305784af6fc610be250d6431082
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3616509
Commit-Queue: Samuel Groß <saelo@chromium.org>
Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80277}
parent a81bcd87
......@@ -927,6 +927,13 @@ void* AllocateInternal(void* hint, size_t size, size_t alignment,
return reinterpret_cast<void*>(base);
}
void CheckIsOOMError(int error) {
// We expect one of ERROR_NOT_ENOUGH_MEMORY or ERROR_COMMITMENT_LIMIT. We'd
// still like to get the actual error code when its not one of the expected
// errors, so use the construct below to achieve that.
if (error != ERROR_NOT_ENOUGH_MEMORY) CHECK_EQ(ERROR_COMMITMENT_LIMIT, error);
}
} // namespace
// static
......@@ -1002,7 +1009,7 @@ bool OS::SetPermissions(void* address, size_t size, MemoryPermission access) {
// Any failure that's not OOM likely indicates a bug in the caller (e.g.
// using an invalid mapping) so attempt to catch that here to facilitate
// debugging of these failures.
if (!result) CHECK_EQ(ERROR_NOT_ENOUGH_MEMORY, GetLastError());
if (!result) CheckIsOOMError(GetLastError());
return result != nullptr;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment