RFR: 8254824: SignalHandlerMark have no purpose

Thomas Stüfe thomas.stuefe at gmail.com
Fri Oct 30 07:58:00 UTC 2020


On Fri, Oct 16, 2020 at 9:01 AM Robbin Ehn <rehn at openjdk.java.net> wrote:

> On Thu, 15 Oct 2020 22:54:15 GMT, David Holmes <dholmes at openjdk.org>
> wrote:
>
> >> // If crash protection is installed we may longjmp away and no
> destructors
> >>   // for objects in this scope will be run.
> >>   // So don't use any RAII utilities before crash protection is checked.
> >>
> >> Since even if crash protection is installed it's not certain we will
> longjmp and you can trust destructors after we
> >> checked crash protection. ?
> >
> > I'm not sure if only the call to `check_crash_protection` can trigger
> the long jump? If so then your version of the
> > comment is better.
>
> Yes only check_crash_protection() do the longjmp and only if it's the
> protected thread and on SIGSEGV/SIGBUS.
>
>
I am cleaning up signal handling a bit, and started thinking about this
restriction ("do not use RAII objects before check_crash_protection"). I
wanted to use an RAII object in javaSignalHandler (so, one frame above).

But the point is not RAII, no? The point is that we skip any epilogue code
in the handler and in all frames above us up
to os::ThreadCrashProtection::call(). Just avoiding RAII and writing out
the epilogue code manually at the end does not help.

IIUC it should not say "don't use RAII" but "in anything you do in all
frames between os::ThreadCrashProtection::call() and
os::ThreadCrashProtection::check_crash_protection(), don't rely on any
epilogue code".

Thanks, Thomas


> -------------
>
> PR: https://git.openjdk.java.net/jdk/pull/677
>


More information about the hotspot-runtime-dev mailing list