-
-
Save gengor/a3f6d7aa9f6aec15e8ea to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- a/mm/mmap.c | |
+++ b/mm/mmap.c | |
@@ -1048,19 +1048,8 @@ unsigned long do_mmap_pgoff(struct file | |
#ifdef CONFIG_PAX_MPROTECT | |
if (mm->pax_flags & MF_PAX_MPROTECT) { | |
- if ((vm_flags & (VM_WRITE | VM_EXEC)) == (VM_WRITE | VM_EXEC)) { | |
- gr_log_rwxmmap(file); | |
- | |
-#ifdef CONFIG_PAX_EMUPLT | |
- vm_flags &= ~VM_EXEC; | |
-#else | |
- return -EPERM; | |
-#endif | |
- | |
- } | |
- | |
- if (!(vm_flags & VM_EXEC)) | |
- vm_flags &= ~VM_MAYEXEC; | |
+ if ((vm_flags & (VM_WRITE | VM_EXEC)) != VM_EXEC) | |
+ vm_flags &= ~(VM_EXEC | VM_MAYEXEC); | |
else | |
vm_flags &= ~VM_MAYWRITE; | |
} | |
@@ -2748,10 +2737,8 @@ int install_special_mapping(struct mm_st | |
#ifdef CONFIG_PAX_MPROTECT | |
if (mm->pax_flags & MF_PAX_MPROTECT) { | |
- if ((vm_flags & (VM_WRITE | VM_EXEC)) == (VM_WRITE | VM_EXEC)) | |
- return -EPERM; | |
- if (!(vm_flags & VM_EXEC)) | |
- vm_flags &= ~VM_MAYEXEC; | |
+ if ((vm_flags & (VM_WRITE | VM_EXEC)) != VM_EXEC) | |
+ vm_flags &= ~(VM_EXEC | VM_MAYEXEC); | |
else | |
vm_flags &= ~VM_MAYWRITE; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment