Commit 214137a8 authored by wibling@chromium.org's avatar wibling@chromium.org

[oilpan]: Explicitly unpoison the header when marking or checking if marked in ASAN.

Now that we are using atomics to read/write the mark bit we cannot rely on NO_SANITIZE_ADDRESS
since it doesn't propagate to called methods (in this case acquireLoad/releaseStore). We don't
want to add NO_SANITIZE_ADDRESS to acquireLoad/releaseStore so instead we explicitly
unpoison/poison the header.

R=ager@chromium.org, haraken@chromium.org, oilpan-reviews@chromium.org, zerny@chromium.org
BUG=

Review URL: https://codereview.chromium.org/544043003

git-svn-id: svn://svn.chromium.org/blink/trunk@181470 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 60742be4
...@@ -412,11 +412,14 @@ private: ...@@ -412,11 +412,14 @@ private:
bool m_parkedAllThreads; // False if we fail to park all threads bool m_parkedAllThreads; // False if we fail to park all threads
}; };
NO_SANITIZE_ADDRESS
bool HeapObjectHeader::isMarked() const bool HeapObjectHeader::isMarked() const
{ {
checkHeader(); checkHeader();
// We need to unpoison/poison the header on ASAN since
// acquireLoad doesn't have the NO_SANITIZE_ADDRESS flag.
ASAN_UNPOISON_MEMORY_REGION(this, sizeof(this));
unsigned size = acquireLoad(&m_size); unsigned size = acquireLoad(&m_size);
ASAN_POISON_MEMORY_REGION(this, sizeof(this));
return size & markBitMask; return size & markBitMask;
} }
......
...@@ -1497,7 +1497,6 @@ Address HeapObjectHeader::payloadEnd() ...@@ -1497,7 +1497,6 @@ Address HeapObjectHeader::payloadEnd()
return reinterpret_cast<Address>(this) + size(); return reinterpret_cast<Address>(this) + size();
} }
NO_SANITIZE_ADDRESS
void HeapObjectHeader::mark() void HeapObjectHeader::mark()
{ {
checkHeader(); checkHeader();
...@@ -1506,8 +1505,12 @@ void HeapObjectHeader::mark() ...@@ -1506,8 +1505,12 @@ void HeapObjectHeader::mark()
// Multiple threads can still read the old value and all store the // Multiple threads can still read the old value and all store the
// new value. However, the new value will be the same for all of // new value. However, the new value will be the same for all of
// the threads and the end result is therefore consistent. // the threads and the end result is therefore consistent.
// We need to unpoison/poison the header on ASAN since
// acquireLoad/releaseStore don't have the NO_SANITIZE_ADDRESS flag.
ASAN_UNPOISON_MEMORY_REGION(this, sizeof(this));
unsigned size = acquireLoad(&m_size); unsigned size = acquireLoad(&m_size);
releaseStore(&m_size, size | markBitMask); releaseStore(&m_size, size | markBitMask);
ASAN_POISON_MEMORY_REGION(this, sizeof(this));
} }
Address FinalizedHeapObjectHeader::payload() Address FinalizedHeapObjectHeader::payload()
......
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