Skip to content

Commit b0a87ec

Browse files
committed
Apply suggestions from code review
1 parent 5128a0e commit b0a87ec

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ psm_stack_manipulation! {
154154
// `StackRestoreGuard` allocates a memory area with suitable size and alignment.
155155
// It also sets up stack guards if supported on target.
156156
let guard = StackRestoreGuard::new(requested_stack_size);
157-
let (stack_base,allocated_stack_size) = guard.stack_area();
157+
let (stack_base, allocated_stack_size) = guard.stack_area();
158158
debug_assert!(allocated_stack_size >= requested_stack_size);
159159
set_stack_limit(Some(stack_base as usize));
160160
// TODO should we not pass `allocated_stack_size` here?

src/mmap_stack_restore_guard.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ impl StackRestoreGuard {
2323
.checked_mul(page_size)
2424
.expect("unreasonably large stack requested");
2525

26-
// Next, there are a couple of approaches to how we allocate the new stack. If it is
27-
// available, we take the most obvious path and use `mmap`.
2826
unsafe {
2927
let new_stack = libc::mmap(
3028
std::ptr::null_mut(),
@@ -47,7 +45,7 @@ impl StackRestoreGuard {
4745
old_stack_limit: get_stack_limit(),
4846
};
4947
// We leave a guard page without read/write access in our allocation.
50-
// TODO we allocated two extra pages for guard pages, but here we only use one?
48+
// There is one guard page below the stack and another above it.
5149
let above_guard_page = new_stack.add(page_size);
5250
#[cfg(not(target_os = "openbsd"))]
5351
let result = libc::mprotect(

0 commit comments

Comments
 (0)