[PATCH] D44777: Mmap interceptor providing mprotect support
Vitaly Buka via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 22 14:11:14 PDT 2018
vitalybuka requested changes to this revision.
vitalybuka added inline comments.
This revision now requires changes to proceed.
================
Comment at: lib/sanitizer_common/sanitizer_common_interceptors.inc:280
+#define COMMON_INTERCEPTOR_MPROTECT_IMPL(ctx, mprotect, addr, sz, prot) \
+ { return REAL(mprotect)(addr, sz, prot); }
+#endif
----------------
Just put this into INTERCEPTOR
No need to have COMMON_INTERCEPTOR_MPROTECT_IMPL before we have overrides
================
Comment at: lib/sanitizer_common/sanitizer_common_interceptors.inc:6925
if (common_flags()->detect_write_exec)
- ReportMmapWriteExec();
+ ReportMmapWriteExec(prot);
if (COMMON_INTERCEPTOR_NOTHING_IS_INITIALIZED)
----------------
Oh, it didn't actually worked.
================
Comment at: test/sanitizer_common/TestCases/Linux/mmap_write_exec.cpp:15
// CHECK: WARNING: {{.*}}Sanitizer: writable-executable page usage
+ char *q = (char *)mmap(p, 64, PROT_READ | PROT_WRITE,
+ MAP_ANONYMOUS | MAP_PRIVATE | MAP_FIXED, -1, 0);
----------------
Please extend tests with:
1. env_tool_opts=detect_write_exec=0 and // CHECK-DISABLED-NOT: writable-executable
2. correct call to mprotect without warning.
3. add //CHECK for [[@LINE
4. Move all correct mprotec and mpap to the end and CHECK-NOT: writable-executable to make sure there is no 3rd report
https://reviews.llvm.org/D44777
More information about the llvm-commits
mailing list