[PATCH] D147442: [JITLink][ELF] Only make sections with SHF_WRITE writable

Job Noorman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 3 11:19:17 PDT 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rGe9b394b08eb6: [JITLink][ELF] Only make sections with SHF_WRITE writable (authored by jobnoorman).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D147442/new/

https://reviews.llvm.org/D147442

Files:
  llvm/lib/ExecutionEngine/JITLink/ELFLinkGraphBuilder.h


Index: llvm/lib/ExecutionEngine/JITLink/ELFLinkGraphBuilder.h
===================================================================
--- llvm/lib/ExecutionEngine/JITLink/ELFLinkGraphBuilder.h
+++ llvm/lib/ExecutionEngine/JITLink/ELFLinkGraphBuilder.h
@@ -360,11 +360,11 @@
     });
 
     // Get the section's memory protection flags.
-    orc::MemProt Prot;
+    orc::MemProt Prot = orc::MemProt::Read;
     if (Sec.sh_flags & ELF::SHF_EXECINSTR)
-      Prot = orc::MemProt::Read | orc::MemProt::Exec;
-    else
-      Prot = orc::MemProt::Read | orc::MemProt::Write;
+      Prot |= orc::MemProt::Exec;
+    if (Sec.sh_flags & ELF::SHF_WRITE)
+      Prot |= orc::MemProt::Write;
 
     // Look for existing sections first.
     auto *GraphSec = G->findSectionByName(*Name);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D147442.510567.patch
Type: text/x-patch
Size: 772 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230403/cd793f16/attachment.bin>


More information about the llvm-commits mailing list