RFR(s): 8074860: Structured Exception Catcher missing around CreateJavaVM on Windows

Thomas Stüfe thomas.stuefe at gmail.com
Fri Apr 3 10:35:45 UTC 2015


thanks!

On Fri, Apr 3, 2015 at 12:07 PM, David Holmes <david.holmes at oracle.com>
wrote:

> Pushing this now.
>
> David
>
>
> On 1/04/2015 4:41 PM, Thomas Stüfe wrote:
>
>> Hi Daniel,
>>
>> thanks a lot for the review!
>>
>> On Wed, Apr 1, 2015 at 3:18 AM, Daniel D. Daugherty <
>> daniel.daugherty at oracle.com> wrote:
>>
>>  On 3/11/15 9:40 AM, Thomas Stüfe wrote:
>>>
>>>  Hi all,
>>>>
>>>> please review this smallish change:
>>>>
>>>> webrev:
>>>> http://cr.openjdk.java.net/~stuefe/webrevs/8074860/webrev.01/webrev/
>>>>
>>>>
>>> nit general comment - please update copyright year to 2015 as needed
>>>
>>>
>>>  I can't, I am not working for Oracle.
>>
>>
>>
>>  src/cpu/x86/vm/vm_version_x86.cpp
>>> src/os/windows/vm/os_windows.inline.hpp
>>>      kvn added this use of CALL_TEST_FUNC_WITH_WRAPPER_IF_NEEDED().
>>>      Looks like a clean removal to me.
>>>
>>> src/os/windows/vm/os_windows.cpp
>>> src/os/windows/vm/os_windows.hpp
>>>      I added call_test_func_with_wrapper() back in 2013.
>>>      Looks like a clean removal to me.
>>>
>>> src/share/vm/prims/jni.cpp
>>>      nit line 4047 - delete extra blank line
>>>
>>>      The new JNI_CreateJavaVM() wrapper does the same thing as
>>>      call_test_func_with_wrapper() that I added back in 2013.
>>>
>>> Thumbs up!
>>>
>>> Dan
>>>
>>>
>>>  @David: when you find time, you could push this now. Also, I am now jdk9
>> author :-) so you can just use "stuefe". Thank you!
>>
>> Kind Regards, Thomas
>>
>>
>>
>>
>>>   bug:  https://bugs.openjdk.java.net/browse/JDK-8074860
>>>
>>>>
>>>> This change adds SEH guards around JNI_CreateJavaVM(). Without the
>>>> change,
>>>> on Windows, the VM initialization runs without crash protection: crashes
>>>> will terminate VM immediately without writing an error log; also, any
>>>> techniques relying on signals will not work, e.g. SafeFetch().
>>>>
>>>> This was partly solved before on a case-by-case base by wrapping code
>>>> sections which may crash in their own __try/__except wrappers - e.g. CPU
>>>> feature probing.
>>>>
>>>> The change guards the whole of JNI_CreateJavaVM invocation in
>>>> __try/__except. Unfortunately, for that to compile, I needed to
>>>> introduce
>>>> a
>>>> wrapper around JNI_CreateJavaVM and move the whole of JNI_CreateJavaVM
>>>> to
>>>> a
>>>> new function "JNI_CreateJavaVM_inner".
>>>>
>>>> This fix also gets rid of various workarounds which were used before to
>>>> guard code sections.
>>>>
>>>> Thanks for reviewing!
>>>>
>>>> Oh, on a side note: I tried to figure out if threads which are attached
>>>> from the outside via JNI AttachCurrentThread() are in any way guarded
>>>> with
>>>> SEH protection. Newly created threads are guarded because they run thru
>>>> java_start() in os_windows.cpp, which adds SEH guards to all frames
>>>> below.
>>>> But for attached threads, I did not find any SEH guards - or maybe I am
>>>> blind? What does that mean for java code running inside attached
>>>> threads?
>>>>
>>>> Regards,
>>>>
>>>> Thomas Stuefe
>>>>
>>>>
>>>>
>>>


More information about the hotspot-runtime-dev mailing list