Mercurial > hg > graal-compiler
comparison src/os/bsd/vm/os_bsd.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 | 9ce110b1d14a |
comparison
equal
deleted
inserted
replaced
10156:c53e49efe6a8 | 10157:f32b6c267d2e |
---|---|
2078 if (fixed) { | 2078 if (fixed) { |
2079 assert((uintptr_t)requested_addr % os::Bsd::page_size() == 0, "unaligned address"); | 2079 assert((uintptr_t)requested_addr % os::Bsd::page_size() == 0, "unaligned address"); |
2080 flags |= MAP_FIXED; | 2080 flags |= MAP_FIXED; |
2081 } | 2081 } |
2082 | 2082 |
2083 // Map uncommitted pages PROT_READ and PROT_WRITE, change access | 2083 // Map reserved/uncommitted pages PROT_NONE so we fail early if we |
2084 // to PROT_EXEC if executable when we commit the page. | 2084 // touch an uncommitted page. Otherwise, the read/write might |
2085 addr = (char*)::mmap(requested_addr, bytes, PROT_READ|PROT_WRITE, | 2085 // succeed if we have enough swap space to back the physical page. |
2086 addr = (char*)::mmap(requested_addr, bytes, PROT_NONE, | |
2086 flags, -1, 0); | 2087 flags, -1, 0); |
2087 | 2088 |
2088 if (addr != MAP_FAILED) { | 2089 if (addr != MAP_FAILED) { |
2089 // anon_mmap() should only get called during VM initialization, | 2090 // anon_mmap() should only get called during VM initialization, |
2090 // don't need lock (actually we can skip locking even it can be called | 2091 // don't need lock (actually we can skip locking even it can be called |