RFR: 8345782: Refining the cases that libjsig deprecation warning is issued
Joakim Nordström
jnordstrom at openjdk.org
Wed Dec 18 09:19:50 UTC 2024
Could I get a review of this fix to refine the warnings printed by `libjsig` when using the deprecated `signal()`/`sigset()` functions?
Currently the libjsig library supports chaining `signal()` and `sigset()`. With these functions being deprecated, `libjsig` warns when a program calls either function when the it's LD_PRELOADed. The warning is supposed to warn that when the support for `signal()` and `sigset()` is removed, the application might stop working as expected.
> VM warning: the use of signal() and sigset() for signal chaining was deprecated in version 16.0 and will be removed in a future release. Use sigaction() instead.
The warning is however printed in a few cases when its unnecessary, and also fails to catch some usages where it should be printed. With this fix the warning is printed (in order as they appear in jsig.c):
1. when `signal()` or `sigset()` is called for a JVM-used signal, after the JVM has installed its signals
2. when the JVM installs its signals (using `sigaction()`), and libjsig sees that `signal()` or `sigset()` has been used for a JVM-used signal
### Changes
* The printing is removed from `call_os_signal()`. This warning was only correct if `signal()` or `sigset()` was called for a JVM-used signal before the JVM was installed. This is now instead covered by step 1 above.
* If the JVM was installed first, the `signal()`/`sigset()` calls were effectively translated to `sigaction()`, and the warning was _not_ printed. When the `signal()`/`sigset()` support is dropped, this behaviour will change and the warning should be printed. This is now covered by step 2.
## Testing
- [x] Test `open/test/hotspot/jtreg/runtime/signal` has added checks for the deprecation warning, and passes with the fix
- [x] Tier1-3 in progress
-------------
Commit messages:
- Merge branch 'master' into JDK-8345782-refining-the-cases-that-libjsig-deprecation
- Updates
- Merge pull request #1 from openjdk/master
Changes: https://git.openjdk.org/jdk/pull/22806/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=22806&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8345782
Stats: 81 lines in 2 files changed: 66 ins; 6 del; 9 mod
Patch: https://git.openjdk.org/jdk/pull/22806.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/22806/head:pull/22806
PR: https://git.openjdk.org/jdk/pull/22806
More information about the core-libs-dev
mailing list