]> git.saurik.com Git - apple/xnu.git/blobdiff - osfmk/mach/vm_prot.h
xnu-4570.51.1.tar.gz
[apple/xnu.git] / osfmk / mach / vm_prot.h
index 039390c26e8a1f5673b16445fe3146ab8910d049..6998a31f0ad11cca1babaeb3b52195081edf4039 100644 (file)
@@ -145,10 +145,16 @@ typedef int               vm_prot_t;
  */
 #define VM_PROT_IS_MASK                ((vm_prot_t) 0x40)
 
-
-#define VM_PROT_MEMORY_TAG_MASK                0xFF000000
-#define VM_PROT_MEMORY_TAG_SHIFT       24
-#define VM_PROT_MEMORY_TAG(x)          (((x) >> VM_PROT_MEMORY_TAG_SHIFT) & 0xFF)
-#define VM_PROT_MEMORY_TAG_MAKE(x)     (((x) & 0xFF) << VM_PROT_MEMORY_TAG_SHIFT)
+/*
+ * Another invalid protection value to support execute-only protection.
+ * VM_PROT_STRIP_READ is a special marker that tells mprotect to not
+ * set VM_PROT_READ. We have to do it this way because existing code
+ * expects the system to set VM_PROT_READ if VM_PROT_EXECUTE is set.
+ * VM_PROT_EXECUTE_ONLY is just a convenience value to indicate that
+ * the memory should be executable and explicitly not readable. It will
+ * be ignored on platforms that do not support this type of protection.
+ */
+#define VM_PROT_STRIP_READ             ((vm_prot_t) 0x80)
+#define VM_PROT_EXECUTE_ONLY   (VM_PROT_EXECUTE|VM_PROT_STRIP_READ)
 
 #endif /* _MACH_VM_PROT_H_ */