Bug 1364533 - Allow madvise huge page hints. r?gcp draft
authorJed Davis <jld@mozilla.com>
Fri, 12 May 2017 20:04:07 -0600
changeset 582693 0dd4d8454d449f1356ca1d0b436aa4fc2693c2e0
parent 579879 2c783a7b6d05b4b2b417bc5f21b7e40cbf3df077
child 629824 54f09cf5c5a5c78084696b23388546ec822fa95d
push id60142
push userbmo:jld@mozilla.com
push dateMon, 22 May 2017 22:50:19 +0000
reviewersgcp
bugs1364533
milestone55.0a1
Bug 1364533 - Allow madvise huge page hints. r?gcp MozReview-Commit-ID: 7sNWS2sFJCx
security/sandbox/linux/SandboxFilter.cpp
--- a/security/sandbox/linux/SandboxFilter.cpp
+++ b/security/sandbox/linux/SandboxFilter.cpp
@@ -32,16 +32,19 @@
 #include "sandbox/linux/system_headers/linux_seccomp.h"
 #include "sandbox/linux/system_headers/linux_syscalls.h"
 
 using namespace sandbox::bpf_dsl;
 #define CASES SANDBOX_BPF_DSL_CASES
 
 // Fill in defines in case of old headers.
 // (Warning: these are wrong on PA-RISC.)
+#ifndef MADV_HUGEPAGE
+#define MADV_HUGEPAGE 14
+#endif
 #ifndef MADV_NOHUGEPAGE
 #define MADV_NOHUGEPAGE 15
 #endif
 #ifndef MADV_DONTDUMP
 #define MADV_DONTDUMP 16
 #endif
 
 // Added in Linux 4.5; see bug 1303813.
@@ -947,18 +950,19 @@ public:
 
       // ipc::Shmem
     case __NR_mprotect:
       return Allow();
     case __NR_madvise: {
       Arg<int> advice(2);
       return If(advice == MADV_DONTNEED, Allow())
         .ElseIf(advice == MADV_FREE, Allow())
+        .ElseIf(advice == MADV_HUGEPAGE, Allow())
+        .ElseIf(advice == MADV_NOHUGEPAGE, Allow())
 #ifdef MOZ_ASAN
-        .ElseIf(advice == MADV_NOHUGEPAGE, Allow())
         .ElseIf(advice == MADV_DONTDUMP, Allow())
 #endif
         .Else(InvalidSyscall());
     }
     case __NR_brk:
     CASES_FOR_geteuid:
       return Allow();
     case __NR_sched_getparam: