diff options
| author | Tatsuyuki Ishi <ishitatsuyuki@gmail.com> | 2018-03-28 18:47:16 +0900 |
|---|---|---|
| committer | Tatsuyuki Ishi <ishitatsuyuki@gmail.com> | 2018-03-28 18:47:16 +0900 |
| commit | 8ecbec1dba048bf55461dbff772f18a72311ecc2 (patch) | |
| tree | 5eabc36ca9da31720d10feaef9eaf57855de59e0 /src/libstd/sys/unix/thread.rs | |
| parent | d39b02c2c9e8aa472ab47ccfb5de63bc616daf62 (diff) | |
| download | rust-8ecbec1dba048bf55461dbff772f18a72311ecc2.tar.gz rust-8ecbec1dba048bf55461dbff772f18a72311ecc2.zip | |
Use mprotect instead of mmap
Diffstat (limited to 'src/libstd/sys/unix/thread.rs')
| -rw-r--r-- | src/libstd/sys/unix/thread.rs | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/libstd/sys/unix/thread.rs b/src/libstd/sys/unix/thread.rs index 6064b55489e..775289f393b 100644 --- a/src/libstd/sys/unix/thread.rs +++ b/src/libstd/sys/unix/thread.rs @@ -355,10 +355,9 @@ pub mod guard { // macOS. Instead, just restore the page to a writable state. // This ain't Linux, so we probably don't need to care about // execstack. - let result = mmap(stackaddr, PAGE_SIZE, PROT_READ | PROT_WRITE, - MAP_PRIVATE | MAP_ANON | MAP_FIXED, -1, 0); + let result = mprotect(stackaddr, PAGE_SIZE, PROT_READ | PROT_WRITE); - if result != stackaddr || result == MAP_FAILED { + if result != 0 { panic!("unable to reset the guard page"); } } |
