[llvm-dev] [PATCH] Do not make data memory executable.

via llvm-dev llvm-dev at lists.llvm.org
Wed Jul 26 08:04:43 PDT 2017

From: Michal Srb <msrb at suse.com>

There doesn't seem to be a reason why would RODataMem need to be executable.
It looks like the flags were accidentally coppied from few line above.
Multiple people found the EXEC suspicious and nobody knew why would it be
there, so here is patch that removes it.

The one user of this I know of is llvmpipe (Mesa software rasterize), so I
tried rendering my desktop with it and everything worked as usual.

 lib/ExecutionEngine/SectionMemoryManager.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/ExecutionEngine/SectionMemoryManager.cpp b/lib/ExecutionEngine/SectionMemoryManager.cpp
index 8904475f084..41056d0393e 100644
--- a/lib/ExecutionEngine/SectionMemoryManager.cpp
+++ b/lib/ExecutionEngine/SectionMemoryManager.cpp
@@ -139,7 +139,7 @@ bool SectionMemoryManager::finalizeMemory(std::string *ErrMsg)
   // Make read-only data memory read-only.
   ec = applyMemoryGroupPermissions(RODataMem,
-                                   sys::Memory::MF_READ | sys::Memory::MF_EXEC);
+                                   sys::Memory::MF_READ);
   if (ec) {
     if (ErrMsg) {
       *ErrMsg = ec.message();

More information about the llvm-dev mailing list