Skip to content

Fix ZTS zend signal crashes due to NULL globals #10861

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions Zend/zend_signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,10 @@ void zend_signal_handler_defer(int signo, siginfo_t *siginfo, void *context)
zend_signal_queue_t *queue, *qtmp;

#ifdef ZTS
/* A signal could hit after TSRM shutdown, in this case globals are already freed. */
if (tsrm_is_shutdown()) {
/* A signal could hit after TSRM shutdown, in this case globals are already freed.
* Or it could be delivered to a thread that didn't execute PHP yet.
* In the latter case we act as if SIGG(active) is false. */
if (tsrm_is_shutdown() || !tsrm_get_ls_cache()) {
/* Forward to default handler handler */
zend_signal_handler(signo, siginfo, context);
return;
Expand Down Expand Up @@ -178,7 +180,7 @@ static void zend_signal_handler(int signo, siginfo_t *siginfo, void *context)
sigset_t sigset;
zend_signal_entry_t p_sig;
#ifdef ZTS
if (tsrm_is_shutdown()) {
if (tsrm_is_shutdown() || !tsrm_get_ls_cache()) {
p_sig.flags = 0;
p_sig.handler = SIG_DFL;
} else
Expand Down