RFR: 8283337: Posix signal handler modification warning triggering incorrectly

Kevin Walls kevinw at openjdk.java.net
Fri Mar 18 20:16:33 UTC 2022


On Thu, 17 Mar 2022 19:23:10 GMT, Kevin Walls <kevinw at openjdk.org> wrote:

> PosixSignals::print_signal_handler() is incorrectly detecting a changed signal handler.  The signal handler for SIGBREAK/SIGQUIT is now set in src/hotspot/os/posix/signals_posix.cpp with the bool parameter do_check set to false.
> 
> set_signal_handler should only store a handler in vm_handlers when do_check is true.
> 
> However I don't see a simple way of getting a valid warning for the SIGQUIT handler, if it is added later when os::initialize_jdk_signal_support() calls os::signal().
> 
> If only signals added directly by src/hotspot/os/posix/signals_posix.cpp have the warning for a handler changing, then we never had a warning for SIGQUIT, so just this simple change is needed to remove the bogus warning.

Yes, it looks OK if check_signal_handler calls:

  PosixSignals::print_signal_handler(tty, sig, buf, O_BUFLEN);

It would give output like:

$ build/linux-x86_64-server-release/images/jdk/bin/java  -Xcheck:jni ...testapp...
...
Warning: SIGILL handler modified!
    SIGILL: SIG_DFL, mask=11100100010111111101111111111110, flags=SA_RESTART|SA_SIGINFO
  *** Handler was modified!
  *** Expected: javaSignalHandler in libjvm.so, mask=11100100110111111111111111111110, flags=SA_RESTART|SA_SIGINFO
Consider using jsig library.
...

This shows the duplication, and it's not bad, even desirable as it means the message starts with "Warning:" which tries to separate it from other output.

I'd like to integrate this PR as is, to fix the regression in the warning quickly, unless any other thoughts.  Can separately do a change to print only the handler that has changed as that looks like a mistake.

-------------

PR: https://git.openjdk.java.net/jdk/pull/7858


More information about the hotspot-runtime-dev mailing list