Commit 6ea5c4f8 authored by Andreas Haas's avatar Andreas Haas Committed by Commit Bot

[base] Create an OOM crash for errors in SetSystemPagesAccess.

With https://crrev.com/c/1336130 we can see more clearly why crashes
happen in `SetSystemPagesAccess`. This CL adds special handling for
crashes we now know are OOM crashes.

R=haraken@chromium.org

Bug: v8:8238
Change-Id: Ia050ee5887834ab8d4c4a80ba6ecf4cc2a5e8e50
Reviewed-on: https://chromium-review.googlesource.com/c/1348051Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#610408}
parent 7cbbce32
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#ifndef BASE_ALLOCATOR_PARTITION_ALLOCATOR_PAGE_ALLOCATOR_INTERNALS_WIN_H_ #ifndef BASE_ALLOCATOR_PARTITION_ALLOCATOR_PAGE_ALLOCATOR_INTERNALS_WIN_H_
#define BASE_ALLOCATOR_PARTITION_ALLOCATOR_PAGE_ALLOCATOR_INTERNALS_WIN_H_ #define BASE_ALLOCATOR_PARTITION_ALLOCATOR_PAGE_ALLOCATOR_INTERNALS_WIN_H_
#include "base/allocator/partition_allocator/oom.h"
#include "base/allocator/partition_allocator/page_allocator_internal.h" #include "base/allocator/partition_allocator/page_allocator_internal.h"
#include "base/logging.h" #include "base/logging.h"
...@@ -88,9 +89,12 @@ void SetSystemPagesAccessInternal( ...@@ -88,9 +89,12 @@ void SetSystemPagesAccessInternal(
} else { } else {
if (!VirtualAlloc(address, length, MEM_COMMIT, if (!VirtualAlloc(address, length, MEM_COMMIT,
GetAccessFlags(accessibility))) { GetAccessFlags(accessibility))) {
int32_t error = GetLastError();
if (error == ERROR_COMMITMENT_LIMIT)
OOM_CRASH();
// We check `GetLastError` for `ERROR_SUCCESS` here so that in a crash // We check `GetLastError` for `ERROR_SUCCESS` here so that in a crash
// report we get the error number. // report we get the error number.
CHECK_EQ(static_cast<uint32_t>(ERROR_SUCCESS), GetLastError()); CHECK_EQ(ERROR_SUCCESS, error);
} }
} }
} }
......
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