RFR: 8279124: VirtualMachineImpl should check signal handler has installed before sending SIGQUIT [v2]
David Holmes
dholmes at openjdk.java.net
Wed Jan 19 07:18:24 UTC 2022
On Tue, 18 Jan 2022 19:44:12 GMT, Xin Liu <xliu at openjdk.org> wrote:
>> src/jdk.attach/linux/native/libattach/VirtualMachineImpl.c line 164:
>>
>>> 162: {
>>> 163: // Only give up sending SIGQUIT if we see that SigCgt is not set.
>>> 164: if (check_sigquit_caught(pid) == 0) return;
>>
>> Suggestion (assumes bool function):
>>
>> // Only send the SIGQUIT if we can see that the target JVM is ready to catch it.
>> if (check_sigquit_caught(pid) && kill((pid_t)pid, SIGQUIT) != 0) {
>> JNU_ThrowIOExceptionWithLastError(env, "kill");
>> }
>
> The reason I would leave retval -1 because I guess someone may disable procfs entirely with kernel configure. As a result, we never know that answer of `check_sigquit_caught` for sure.
But if you never check for -1 you will never know that. The code only checks for zero or not zero and that is a boolean result.
-------------
PR: https://git.openjdk.java.net/jdk/pull/7003
More information about the serviceability-dev
mailing list