You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
FPM: inner prev_execute_data walk in fpm_php_trace_dump() is not depth-bounded #26068
In fpm_php_trace_dump() (sapi/fpm/fpm/fpm_php_trace.c), the outer frame loop is bounded by callers_limit = request_slowlog_trace_depth (default 20; decremented at sapi/fpm/fpm/fpm_php_trace.c:181).
The inner loop that searches for the nearest user-code frame has no iteration cap:
sapi/fpm/fpm/fpm_php_trace.c:126
while (prev) {
...
if (0>fpm_trace_get_long(prev+ offsetof(zend_execute_data, prev_execute_data), &l)) {
return-1;
}
prev=l;
}
It stops only on a user frame, an invalid pointer, or a ptrace read error. The walk reads the stopped (ptraced) child's memory from the master. A corrupted or cyclic prev_execute_data chain in a worker could spin the inner loop, keeping the master busy reading child memory.
The trigger is narrow — it needs slowlog + request_slowlog_timeout configured and the ability to corrupt VM stack memory in a worker — so this is a robustness nit rather than a security issue. Confirmed by source on PHP-8.6 and PHP-8.3.
Suggested fix
Bound the inner while (prev) loop with a counter (e.g. mirroring the outer callers_limit, or a hard cap), so a cyclic chain cannot hang the master.
PHP Version
PHP-8.6 and PHP-8.3 branch heads (confirmed by source).
Activity