RFR: 8282306: os::is_first_C_frame(frame*) crashes on invalid link access [v13]
Johannes Bechberger
duke at openjdk.java.net
Tue Mar 15 07:54:26 UTC 2022
On Tue, 15 Mar 2022 06:00:13 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:
>> Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Add check for Thread to CanUseSafefetch
>
> src/hotspot/share/runtime/safefetch.inline.hpp line 61:
>
>> 59: return false;
>> 60: }
>> 61: #endif // __APPLE__ && AARCH64
>
> Totally valid way to work around JDK-8282475, but note that `os::is_readable_pointer()` defaults to true for `CanSafeFetch=false` (see https://github.com/openjdk/jdk/blob/6013d09e82693a1c07cf0bf6daffd95114b3cbfa/src/hotspot/share/runtime/os.cpp#L1042-L1046)
>
> The story behind that is that there are more use cases of `is_readable_memory()` where - if one cannot use SafeFetch - it makes sense to optimistically assume the location is readable. E.g. in error handling, where secondary crashes are annoying but not deadly. The contract is that if you really care about this, use CanUseSafeFetch beforehand (usually it was fine to ignore it since CanUseSafeFetch only affected a small time window during VM initialization).
>
> With your patch, it means that now os::is_readable_memory always returns true if Thread::current is NULL. So in that case, we bypass your protection. I think that is acceptable for now. Once JDK-8282475 is solved we can remove this again.
>
> I wondered whether this affects your gtest test case, but in that test case Thread::current is not NULL because its a TEST_VM case, so we are in the VM.
I could add a non VM test case? Or is it to difficult?
-------------
PR: https://git.openjdk.java.net/jdk/pull/7591
More information about the hotspot-dev
mailing list