Commit 91525d85 by David 'Digit' Turner Committed by David Turner

LLVM: Do not map read-only data sections as executable.

As described in full details in the associated bug, LLVM will map read-only data sections with READ+EXECUTE permissions by default. Unfortunately, this makes certain tests fail on Fuchsia, because this platform is very strict regarding the EXECUTE mapping flag. This CL fixes the issue by ensuring that non-code sections are only mapped with the READ permission instead. An upstream LLVM bug has been sent to https://reviews.llvm.org/D78574 Bug: b/154586551 Change-Id: I0b5bb871f1a305bbfe8a244f7fbcb664b70c209b Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/44128 Kokoro-Result: kokoro <noreply+kokoro@google.com> Tested-by: 's avatarDavid Turner <digit@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com>
parent 6e44504c
...@@ -152,8 +152,7 @@ bool SectionMemoryManager::finalizeMemory(std::string *ErrMsg) { ...@@ -152,8 +152,7 @@ bool SectionMemoryManager::finalizeMemory(std::string *ErrMsg) {
} }
// Make read-only data memory read-only. // Make read-only data memory read-only.
ec = applyMemoryGroupPermissions(RODataMem, ec = applyMemoryGroupPermissions(RODataMem, sys::Memory::MF_READ);
sys::Memory::MF_READ | sys::Memory::MF_EXEC);
if (ec) { if (ec) {
if (ErrMsg) { if (ErrMsg) {
*ErrMsg = ec.message(); *ErrMsg = ec.message();
......
...@@ -153,8 +153,7 @@ bool SectionMemoryManager::finalizeMemory(std::string *ErrMsg) { ...@@ -153,8 +153,7 @@ bool SectionMemoryManager::finalizeMemory(std::string *ErrMsg) {
} }
// Make read-only data memory read-only. // Make read-only data memory read-only.
ec = applyMemoryGroupPermissions(RODataMem, ec = applyMemoryGroupPermissions(RODataMem, sys::Memory::MF_READ);
sys::Memory::MF_READ | sys::Memory::MF_EXEC);
if (ec) { if (ec) {
if (ErrMsg) { if (ErrMsg) {
*ErrMsg = ec.message(); *ErrMsg = ec.message();
......
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