Commit c81bc16
committed
fix: avoid longjmp crash on ARM64/macOS when connection is aborted
php_handle_aborted_connection() calls zend_bailout() which does a
longjmp(). On ARM64/macOS with Pointer Authentication (PAC), the
jmp_buf signature check fails because the buffer was signed in a
different stack frame, causing a SIGBUS crash.
Inline the effect of php_handle_aborted_connection() without calling
zend_bailout(): set PG(connection_status) = PHP_CONNECTION_ABORTED and
php_output_set_status(PHP_OUTPUT_DISABLED). PHP detects the abort at
safe points (between opcodes via zend_interrupt checks) instead of
longjmping out of the SAPI write handler.
This matches the approach used by Nginx Unit's PHP SAPI:
https://github.com/nginx/unit/blob/master/src/nxt_php_sapi.c#L271
Affects both frankenphp_ub_write and frankenphp_sapi_flush.1 parent c12841b commit c81bc16
1 file changed
Lines changed: 14 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
743 | 743 | | |
744 | 744 | | |
745 | 745 | | |
746 | | - | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
747 | 758 | | |
748 | 759 | | |
749 | 760 | | |
| |||
777 | 788 | | |
778 | 789 | | |
779 | 790 | | |
780 | | - | |
| 791 | + | |
| 792 | + | |
781 | 793 | | |
782 | 794 | | |
783 | 795 | | |
| |||
0 commit comments