ext/pcntl: Bump num_signals to uint16_t#21347
Open
NattyNarwhal wants to merge 1 commit intophp:PHP-8.5from
Open
ext/pcntl: Bump num_signals to uint16_t#21347NattyNarwhal wants to merge 1 commit intophp:PHP-8.5from
NattyNarwhal wants to merge 1 commit intophp:PHP-8.5from
Conversation
On AIX, NSIG is def'd as SIGMAX64+1, and SIGMAX64 itself is def'd as
255:
```
$ grep -Rw SIGMAX64 /QOpenSys/usr/include/
/QOpenSys/usr/include/sys/signal.h:#define SIGMAX64 255
/QOpenSys/usr/include/sys/signal.h:#define SIGMAX SIGMAX64
/QOpenSys/usr/include/sys/signal.h:#define NSIG64 (SIGMAX64+1)
```
...this causes an overflow when we set num_signals from the value of
NSIG, per GCC:
```
/rpmbuild/BUILD/php-8.5.3/ext/pcntl/pcntl.c:216:25: warning: large integer implicitly truncated to unsigned type [-Woverflow]
PCNTL_G(num_signals) = NSIG;
^~~~
```
...when we try to use pcntl to i.e. install a signal handler, we get an
error from pcntl:
```
Fatal error: Uncaught ValueError: pcntl_signal(): Argument #1 ($signal) must be less than 0 in phar:///QOpenSys/pkgs/bin/composer/vendor/seld/signal-handler/src/SignalHandler.php:491
```
The easiest way to deal with this silly AIX behaviour is to just promote
the storage size.
Member
|
looks safe change, did you have a quick look with pahole or similar ? |
Member
Author
|
I haven't used pahole, no. I'm guessing this does slightly blow up the size of the structure, as the bools and previous uint8 would have been packed into 32 bits. |
devnexen
approved these changes
Mar 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On AIX, NSIG is def'd as SIGMAX64+1, and SIGMAX64 itself is def'd as 255:
...this causes an overflow when we set num_signals from the value of NSIG, per GCC:
...when we try to use pcntl to i.e. install a signal handler, we get an error from pcntl:
The easiest way to deal with this silly AIX behaviour is to just promote the storage size.