Mercurial > hg > graal-jvmci-8
comparison src/os/linux/vm/os_linux.cpp @ 10157:f32b6c267d2e
8012015: Use PROT_NONE when reserving memory
Summary: Reserved memory had PROT_READ+PROT_WRITE access on Linux/bsd, now changed to PROT_NONE.
Reviewed-by: dholmes, ctornqvi
author | mikael |
---|---|
date | Mon, 29 Apr 2013 11:03:49 -0700 |
parents | 8be1318fbe77 |
children | b4081e9714ec |
comparison
equal
deleted
inserted
replaced
10156:c53e49efe6a8 | 10157:f32b6c267d2e |
---|---|
2904 if (fixed) { | 2904 if (fixed) { |
2905 assert((uintptr_t)requested_addr % os::Linux::page_size() == 0, "unaligned address"); | 2905 assert((uintptr_t)requested_addr % os::Linux::page_size() == 0, "unaligned address"); |
2906 flags |= MAP_FIXED; | 2906 flags |= MAP_FIXED; |
2907 } | 2907 } |
2908 | 2908 |
2909 // Map uncommitted pages PROT_READ and PROT_WRITE, change access | 2909 // Map reserved/uncommitted pages PROT_NONE so we fail early if we |
2910 // to PROT_EXEC if executable when we commit the page. | 2910 // touch an uncommitted page. Otherwise, the read/write might |
2911 addr = (char*)::mmap(requested_addr, bytes, PROT_READ|PROT_WRITE, | 2911 // succeed if we have enough swap space to back the physical page. |
2912 addr = (char*)::mmap(requested_addr, bytes, PROT_NONE, | |
2912 flags, -1, 0); | 2913 flags, -1, 0); |
2913 | 2914 |
2914 if (addr != MAP_FAILED) { | 2915 if (addr != MAP_FAILED) { |
2915 // anon_mmap() should only get called during VM initialization, | 2916 // anon_mmap() should only get called during VM initialization, |
2916 // don't need lock (actually we can skip locking even it can be called | 2917 // don't need lock (actually we can skip locking even it can be called |