[PATCH] D62741: [PowerPC] Set PROT_READ flag for MF_EXEC to prevent segfaults on PPC machines
Nemanja Ivanovic via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 3 09:18:44 PDT 2019
This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rL362412: [PowerPC] Set PROT_READ flag for MF_EXEC to prevent segfaults on PPC machines (authored by nemanjai, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D62741?vs=202454&id=202735#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D62741/new/
https://reviews.llvm.org/D62741
Files:
llvm/trunk/lib/Support/Unix/Memory.inc
Index: llvm/trunk/lib/Support/Unix/Memory.inc
===================================================================
--- llvm/trunk/lib/Support/Unix/Memory.inc
+++ llvm/trunk/lib/Support/Unix/Memory.inc
@@ -58,14 +58,13 @@
llvm::sys::Memory::MF_EXEC:
return PROT_READ | PROT_WRITE | PROT_EXEC;
case llvm::sys::Memory::MF_EXEC:
-#if defined(__FreeBSD__)
+#if (defined(__FreeBSD__) || defined(__POWERPC__) || defined (__ppc__) || \
+ defined(_POWER) || defined(_ARCH_PPC))
// On PowerPC, having an executable page that has no read permission
// can have unintended consequences. The function InvalidateInstruction-
// Cache uses instructions dcbf and icbi, both of which are treated by
// the processor as loads. If the page has no read permissions,
// executing these instructions will result in a segmentation fault.
- // Somehow, this problem is not present on Linux, but it does happen
- // on FreeBSD.
return PROT_READ | PROT_EXEC;
#else
return PROT_EXEC;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62741.202735.patch
Type: text/x-patch
Size: 1019 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190603/bcbc2eca/attachment.bin>
More information about the llvm-commits
mailing list