Skip to content

Commit 35c9b71

Browse files
committed
Increase SHSTK stack size
The shadow stack may need as much space as the fiber stack in the worse case, so allocate a shadow stack the same size as the fiber stack. This matches what the kernel does for the main stack.
1 parent 3c00dd3 commit 35c9b71

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

Zend/zend_fibers.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -272,11 +272,7 @@ static zend_fiber_stack *zend_fiber_stack_allocate(size_t size)
272272
stack->size = stack_size;
273273

274274
#if !defined(ZEND_FIBER_UCONTEXT) && BOOST_CONTEXT_SHADOW_STACK
275-
/* shadow stack saves ret address only, need less space */
276-
stack->ss_size= stack_size >> 5;
277-
278-
/* align shadow stack to 8 bytes. */
279-
stack->ss_size = (stack->ss_size + 7) & ~7;
275+
stack->ss_size = stack_size;
280276

281277
/* issue syscall to create shadow stack for the new fcontext */
282278
/* SHADOW_STACK_SET_TOKEN option will put "restore token" on the new shadow stack */

0 commit comments

Comments
 (0)