Skip to content

Commit e6bfd7e

Browse files
dunglasdevnexen
authored andcommitted
Set SA_ONSTACK too when zend signals are disabled and in pcntl
Closes GH-9758.
1 parent d368abb commit e6bfd7e

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

NEWS

+4
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ PHP NEWS
1111
error message). (ilutov)
1212
. SA_ONSTACK is now set for signal handlers to be friendlier to other
1313
in-process code such as Go's cgo. (Kévin Dunglas)
14+
. SA_ONSTACK is now set when signals are disabled. (Kévin Dunglas)
1415

1516
- Fileinfo:
1617
. Upgrade bundled libmagic to 5.43. (Anatol)
@@ -27,6 +28,9 @@ PHP NEWS
2728
. Made opcache.preload_user always optional in the cli and phpdbg SAPIs.
2829
(Arnaud)
2930

31+
- PCNTL:
32+
. SA_ONSTACK is now set for pcntl_signal. (Kévin Dunglas)
33+
3034
- Posix:
3135
. Added posix_sysconf. (David Carlier)
3236

Zend/zend_execute_API.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1483,7 +1483,7 @@ static void zend_set_timeout_ex(zend_long seconds, bool reset_signals) /* {{{ */
14831483

14841484
act.sa_handler = zend_timeout_handler;
14851485
sigemptyset(&act.sa_mask);
1486-
act.sa_flags = SA_RESETHAND | SA_NODEFER;
1486+
act.sa_flags = SA_ONSTACK | SA_RESETHAND | SA_NODEFER;
14871487
sigaction(signo, &act, NULL);
14881488
# else
14891489
signal(signo, zend_timeout_handler);

ext/pcntl/php_signal.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Sigfunc *php_signal4(int signo, Sigfunc *func, int restart, int mask_all)
3535
} else {
3636
sigemptyset(&act.sa_mask);
3737
}
38-
act.sa_flags = 0;
38+
act.sa_flags = SA_ONSTACK;
3939
#ifdef HAVE_STRUCT_SIGINFO_T
4040
act.sa_flags |= SA_SIGINFO;
4141
#endif

0 commit comments

Comments
 (0)