We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 772c9aa commit 93325b4Copy full SHA for 93325b4
src/lib.rs
@@ -177,11 +177,24 @@ psm_stack_manipulation! {
177
old_stack_limit: get_stack_limit(),
178
};
179
let above_guard_page = new_stack.add(page_size);
180
+ #[cfg(not(target_os = "openbsd"))]
181
let result = libc::mprotect(
182
above_guard_page,
183
stack_bytes - page_size,
184
libc::PROT_READ | libc::PROT_WRITE
185
);
186
+ #[cfg(target_os = "openbsd")]
187
+ let result = if libc::mmap(
188
+ above_guard_page,
189
+ stack_bytes - page_size,
190
+ libc::PROT_READ | libc::PROT_WRITE,
191
+ libc::MAP_FIXED | libc::MAP_PRIVATE | libc::MAP_ANON | libc::MAP_STACK,
192
+ -1,
193
+ 0) == above_guard_page {
194
+ 0
195
+ } else {
196
+ -1
197
+ };
198
if result == -1 {
199
drop(guard);
200
panic!("unable to set stack permissions")
0 commit comments