JDK-8293466: libjsig should ignore non-modifying sigaction calls#10236
JDK-8293466: libjsig should ignore non-modifying sigaction calls#10236tstuefe wants to merge 2 commits intoopenjdk:masterfrom
Conversation
|
👋 Welcome back stuefe! A progress list of the required criteria for merging this PR into |
0ba708b to
68b9c74
Compare
caoman
left a comment
There was a problem hiding this comment.
LGTM. Not an official OpenJDK Reviewer though.
|
/label add hotspot-runtime |
|
@AlanBateman |
|
@AlanBateman |
|
Friendly ping. |
dholmes-ora
left a comment
There was a problem hiding this comment.
This seems quite reasonable.
Thanks.
|
@tstuefe This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be: You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 70 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
Thank you David! |
|
/integrate |
|
Going to push as commit b1ed40a.
Your commit was automatically rebased without conflicts. |
Found during code review of JDK-8292695.
We have two bugs in libjsig when we install hotspot signal handlers. Relevant code in libjsig:
Bug 1: we change state even if the sigaction call failed
Bug 2: we change state even if the sigaction call was a non-modifying one (act == NULL)
The latter is usually no problem since hotspot always calls
sigaction()in pairs when installing a signal: first with NULL to get the old handler, then with the real handler. But this is not always true. IfAllowUserSignalHandlersis set, and we find a custom handler is present, we will not override it:That means:
The result is that any further attempts to change the signal handler, whether by hotspot or by user code, will be prevented by libjsig. Any further non-modifying sigaction calls will return the original - still installed - custom handler.
Admittedly, the error is very exotic. Users would have to set AllowUserSignalHandlers and preload libjsig, and then attempt to modify signal handlers after JVM initialization. But it is confusing, and a potential source for other errors. In hotspot, nobody counts on a non-modifying sigaction query changing program state somewhere.
This seems to be an old bug, I see it in at least JDK 8. Did not look further into the past
Tests: Ran the runtime/jsig and the runtime/Thread tests manually.
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/10236/head:pull/10236$ git checkout pull/10236Update a local copy of the PR:
$ git checkout pull/10236$ git pull https://git.openjdk.org/jdk pull/10236/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 10236View PR using the GUI difftool:
$ git pr show -t 10236Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/10236.diff