Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/mmap_stack_restore_guard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,19 @@ impl StackRestoreGuard {
size_with_guard,
old_stack_limit: get_stack_limit(),
};
// We leave a guard page without read/write access in our allocation.
// We leave two guard pages without read/write access in our allocation.
// There is one guard page below the stack and another above it.
let above_guard_page = new_stack.add(page_size);
#[cfg(not(target_os = "openbsd"))]
let result = libc::mprotect(
above_guard_page,
size_with_guard - page_size,
size_with_guard - 2 * page_size,
libc::PROT_READ | libc::PROT_WRITE,
);
#[cfg(target_os = "openbsd")]
let result = if libc::mmap(
above_guard_page,
size_with_guard - page_size,
size_with_guard - 2 * page_size,
libc::PROT_READ | libc::PROT_WRITE,
libc::MAP_FIXED | libc::MAP_PRIVATE | libc::MAP_ANON | libc::MAP_STACK,
-1,
Expand Down
Loading