Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a40730b

Browse filesBrowse files
targosMyles Borins
authored andcommitted
deps: backport IsValid changes from 4e8736d in V8
V8 erroneously did null pointer checks on `this`. It can lead to a SIGSEGV crash if node is compiled with GCC 6. Backport relevant changes from [1] that fix this issue. [1]: https://codereview.chromium.org/1900423002 Fixes: #6272 PR-URL: #6669 Reviewed-By: Myles Borins <myles.borins@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 855604c commit a40730b
Copy full SHA for a40730b

File tree

Expand file treeCollapse file tree

5 files changed

+9
-9
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

5 files changed

+9
-9
lines changed
Open diff view settings
Collapse file

‎deps/v8/src/heap/incremental-marking.cc‎

Copy file name to clipboardExpand all lines: deps/v8/src/heap/incremental-marking.cc
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ void IncrementalMarking::DeactivateIncrementalWriteBarrier() {
364364
DeactivateIncrementalWriteBarrierForSpace(heap_->new_space());
365365

366366
LargePage* lop = heap_->lo_space()->first_page();
367-
while (lop->is_valid()) {
367+
while (LargePage::IsValid(lop)) {
368368
SetOldSpacePageFlags(lop, false, false);
369369
lop = lop->next_page();
370370
}
@@ -396,7 +396,7 @@ void IncrementalMarking::ActivateIncrementalWriteBarrier() {
396396
ActivateIncrementalWriteBarrier(heap_->new_space());
397397

398398
LargePage* lop = heap_->lo_space()->first_page();
399-
while (lop->is_valid()) {
399+
while (LargePage::IsValid(lop)) {
400400
SetOldSpacePageFlags(lop, true, is_compacting_);
401401
lop = lop->next_page();
402402
}
Collapse file

‎deps/v8/src/heap/spaces-inl.h‎

Copy file name to clipboardExpand all lines: deps/v8/src/heap/spaces-inl.h
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ Page* Page::Initialize(Heap* heap, MemoryChunk* chunk, Executability executable,
155155

156156
bool PagedSpace::Contains(Address addr) {
157157
Page* p = Page::FromAddress(addr);
158-
if (!p->is_valid()) return false;
158+
if (!Page::IsValid(p)) return false;
159159
return p->owner() == this;
160160
}
161161

Collapse file

‎deps/v8/src/heap/spaces.cc‎

Copy file name to clipboardExpand all lines: deps/v8/src/heap/spaces.cc
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2953,7 +2953,7 @@ LargePage* LargeObjectSpace::FindPage(Address a) {
29532953
if (e != NULL) {
29542954
DCHECK(e->value != NULL);
29552955
LargePage* page = reinterpret_cast<LargePage*>(e->value);
2956-
DCHECK(page->is_valid());
2956+
DCHECK(LargePage::IsValid(page));
29572957
if (page->Contains(a)) {
29582958
return page;
29592959
}
Collapse file

‎deps/v8/src/heap/spaces.h‎

Copy file name to clipboardExpand all lines: deps/v8/src/heap/spaces.h
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,9 +278,9 @@ class MemoryChunk {
278278
// Only works for addresses in pointer spaces, not data or code spaces.
279279
static inline MemoryChunk* FromAnyPointerAddress(Heap* heap, Address addr);
280280

281-
Address address() { return reinterpret_cast<Address>(this); }
281+
static bool IsValid(MemoryChunk* chunk) { return chunk != nullptr; }
282282

283-
bool is_valid() { return address() != NULL; }
283+
Address address() { return reinterpret_cast<Address>(this); }
284284

285285
MemoryChunk* next_chunk() const {
286286
return reinterpret_cast<MemoryChunk*>(base::Acquire_Load(&next_chunk_));
Collapse file

‎deps/v8/test/cctest/test-spaces.cc‎

Copy file name to clipboardExpand all lines: deps/v8/test/cctest/test-spaces.cc
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ TEST(MemoryAllocator) {
314314
faked_space.AreaSize(), &faked_space, NOT_EXECUTABLE);
315315

316316
first_page->InsertAfter(faked_space.anchor()->prev_page());
317-
CHECK(first_page->is_valid());
317+
CHECK(Page::IsValid(first_page));
318318
CHECK(first_page->next_page() == faked_space.anchor());
319319
total_pages++;
320320

@@ -325,7 +325,7 @@ TEST(MemoryAllocator) {
325325
// Again, we should get n or n - 1 pages.
326326
Page* other = memory_allocator->AllocatePage(
327327
faked_space.AreaSize(), &faked_space, NOT_EXECUTABLE);
328-
CHECK(other->is_valid());
328+
CHECK(Page::IsValid(other));
329329
total_pages++;
330330
other->InsertAfter(first_page);
331331
int page_count = 0;
@@ -336,7 +336,7 @@ TEST(MemoryAllocator) {
336336
CHECK(total_pages == page_count);
337337

338338
Page* second_page = first_page->next_page();
339-
CHECK(second_page->is_valid());
339+
CHECK(Page::IsValid(second_page));
340340
memory_allocator->Free(first_page);
341341
memory_allocator->Free(second_page);
342342
memory_allocator->TearDown();

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.