RFR: 8256594: Unexpected warning: SIGSEGV handler flags expected:SA_RESTART|SA_SIGINFO found:SA_RESTART|SA_SIGINFO

David Holmes david.holmes at oracle.com
Thu Nov 19 11:11:42 UTC 2020


On 19/11/2020 8:36 pm, Thomas Stuefe wrote:
> On Thu, 19 Nov 2020 07:45:03 GMT, David Holmes <dholmes at openjdk.org> wrote:
> 
>> In the recent POSIX signal code cleanup (JDK-8253742) I misunderstood the role of the SIGNIFICANT_SIGNAL_MASK and removing its application causes -Xcheck:jni to report errors with the signal handler due to an unexpected bit in the sigaction.sa_flags field.
>>
>> This fix restores the masking of that flag, for Linux only, and more clearly indicating what it is. I also augmented the flag printing code to show when an unexpected flag is present (and so avoid the mysterious "expected X found X" message).
>>
>> See bug report for more details.
>>
>> Thanks.
> 
> LGTM.
> 
> Note that a maybe more elegant approach - avoiding the double definition of known flags - would have been, in the print loop, to store the checked flags in a mask. And then test for ~mask at the final step.
> 
> The numeric comparison of flags in check_jni - which requires this SA_RESTORER_FLAG_MASK workaround - is a bit grating. Would have been better to compare just known flags. But this is old coding.
> 
> All idle nitpicking :) Patch is fine.

Thanks for the review Thomas. I tried to think of more clever schemes to 
do this but in the end ...

Cheers,
David
-----

> ..Thomas
> 
> src/hotspot/os/posix/signals_posix.cpp line 668:
> 
>> 666:   strncpy(buffer, "none", size);
>> 667:
>> 668:   const unsigned int unknown_flag = ~(SA_NOCLDSTOP |
> 
> Maybe name this "unknown_flag_mask" ?
> 
> -------------
> 
> Marked as reviewed by stuefe (Reviewer).
> 
> PR: https://git.openjdk.java.net/jdk/pull/1309
> 


More information about the hotspot-runtime-dev mailing list