[llvm] [llvm][Support][Memory] Add memfd based fallback for strict W^X Linux systems (PR #98538)

via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 25 13:24:47 PDT 2024


================
@@ -177,6 +181,78 @@ std::error_code Memory::protectMappedMemory(const MemoryBlock &M,
       alignAddr((const uint8_t *)M.Address + M.AllocatedSize, PageSize);
 
   bool InvalidateCache = (Flags & MF_EXEC);
+  bool SkipMprotect = false;
+
+#if defined(__linux__)
----------------
minipli-oss wrote:

It's much less code in the current version and moving it to a helper function would require passing quite some arguments. So, maybe, it's okay now?

I could move the memfd part to a helper class to squeeze out a few more lines, but that feels like overengineering just for the cause.

https://github.com/llvm/llvm-project/pull/98538


More information about the llvm-commits mailing list