File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -137,15 +137,15 @@ psm_stack_manipulation! {
137
137
fn _grow<F : FnOnce ( ) >( stack_size: usize , callback: F ) {
138
138
// Calculate a number of pages we want to allocate for the new stack.
139
139
// For maximum portability we want to produce a stack that is aligned to a page and has
140
- // a size that’s a multiple of page size. Furthermore we want to allocate an extra page
140
+ // a size that’s a multiple of page size. Furthermore we want to allocate two extras pages
141
141
// for the stack guard. To achieve that we do our calculations in number of pages and
142
142
// convert to bytes last.
143
143
// FIXME: consider caching the page size.
144
144
let page_size = unsafe { libc:: sysconf( libc:: _SC_PAGE_SIZE) } as usize ;
145
145
let requested_pages = stack_size
146
146
. checked_add( page_size - 1 )
147
147
. expect( "unreasonably large stack requested" ) / page_size;
148
- let stack_pages = std:: cmp:: max( 1 , requested_pages) + 1 ;
148
+ let stack_pages = std:: cmp:: max( 1 , requested_pages) + 2 ;
149
149
let stack_bytes = stack_pages. checked_mul( page_size)
150
150
. expect( "unreasonably large stack requesteed" ) ;
151
151
You can’t perform that action at this time.
0 commit comments