[PATCH] Split Mprotect into MmapNoAccess and MprotectNoAccess to be more portable
Timur Iskhodzhanov
timurrrr at google.com
Mon Apr 13 05:19:36 PDT 2015
================
Comment at: lib/sanitizer_common/sanitizer_linux.cc:113
@@ -112,3 +112,3 @@
// --------------- sanitizer_libc.h
uptr internal_mmap(void *addr, uptr length, int prot, int flags, int fd,
u64 offset) {
----------------
I suggest we put a comment here describing that we must cast any pointer argument to `uptr` to be compatible with X32.
================
Comment at: lib/sanitizer_common/sanitizer_linux.cc:132
@@ +131,3 @@
+ return internal_syscall(SYSCALL(mprotect), addr, length, prot);
+}
+
----------------
hjl.tools wrote:
> This is incorrect on Linux/x86-64. Pointers passed to
> internal_syscall should be casted to uptr first. Otherwise,
> they won't be properly extended to 64-bit for x32. Need
> something like
>
> return internal_syscall(SYSCALL(mprotect), (uptr)addr, length, prot);
>
Thanks, done as r234748.
http://reviews.llvm.org/D8970
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
More information about the llvm-commits
mailing list