Skip to content

Commit

Permalink
[base] Create an OOM crash for errors in SetSystemPagesAccess.
Browse files Browse the repository at this point in the history
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.

[email protected]

Bug: v8:8238
Change-Id: Ia050ee5887834ab8d4c4a80ba6ecf4cc2a5e8e50
Reviewed-on: https://chromium-review.googlesource.com/c/1348051
Reviewed-by: Kentaro Hara <[email protected]>
Commit-Queue: Andreas Haas <[email protected]>
Cr-Commit-Position: refs/heads/master@{#610408}
  • Loading branch information
gahaas authored and Commit Bot committed Nov 22, 2018
1 parent 7cbbce3 commit 6ea5c4f
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#ifndef 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/logging.h"

Expand Down Expand Up @@ -88,9 +89,12 @@ void SetSystemPagesAccessInternal(
} else {
if (!VirtualAlloc(address, length, MEM_COMMIT,
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
// report we get the error number.
CHECK_EQ(static_cast<uint32_t>(ERROR_SUCCESS), GetLastError());
CHECK_EQ(ERROR_SUCCESS, error);
}
}
}
Expand Down

0 comments on commit 6ea5c4f

Please sign in to comment.