summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Baptiste Queru2010-10-14 16:29:00 -0500
committerJean-Baptiste Queru2010-10-14 16:29:00 -0500
commit8e0e372a388434a0553810e2b958e59a26a6bd96 (patch)
tree94b3cf8d91ffcc3db0f027212f244cdcada402c5 /libpixelflinger
parent9cd8057b6e8f5fc1254a4ed19e8127b5091b5dce (diff)
downloadplatform-system-core-8e0e372a388434a0553810e2b958e59a26a6bd96.tar.gz
platform-system-core-8e0e372a388434a0553810e2b958e59a26a6bd96.tar.xz
platform-system-core-8e0e372a388434a0553810e2b958e59a26a6bd96.zip
Set PROT_EXEC on the whole pixelflinger code cache.
The pointer difference between word pointers is a number of words, and it needs to be multiplied by the size of a word to get a proper byte size. Without this, we tend to see crashes when the code crosses a page boundary. Bug: 3026204 Bug: 3097482 Change-Id: I37776d26d5afcdb1da71680de02fbb95e6548371
Diffstat (limited to 'libpixelflinger')
-rw-r--r--libpixelflinger/codeflinger/CodeCache.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/libpixelflinger/codeflinger/CodeCache.cpp b/libpixelflinger/codeflinger/CodeCache.cpp
index 5877ff4a5..125c3ce05 100644
--- a/libpixelflinger/codeflinger/CodeCache.cpp
+++ b/libpixelflinger/codeflinger/CodeCache.cpp
@@ -94,7 +94,7 @@ void Assembly::ensureMbaseExecutable()
94 long pagemask = ~(pagesize - 1); // assumes pagesize is a power of 2 94 long pagemask = ~(pagesize - 1); // assumes pagesize is a power of 2
95 95
96 uint32_t* pageStart = (uint32_t*) (((uintptr_t) mBase) & pagemask); 96 uint32_t* pageStart = (uint32_t*) (((uintptr_t) mBase) & pagemask);
97 size_t adjustedLength = mBase - pageStart + mSize; 97 size_t adjustedLength = (mBase - pageStart) * sizeof(uint32_t) + mSize;
98 98
99 if (mBase && mprotect(pageStart, adjustedLength, PROT_READ | PROT_WRITE | PROT_EXEC) != 0) { 99 if (mBase && mprotect(pageStart, adjustedLength, PROT_READ | PROT_WRITE | PROT_EXEC) != 0) {
100 mspace_free(getMspace(), mBase); 100 mspace_free(getMspace(), mBase);