On Mon, 9 Nov 2020 03:29:05 GMT, David Holmes <dhol...@openjdk.org> wrote:

>> Maurizio Cimadamore has updated the pull request with a new target base due 
>> to a merge or a rebase. The pull request now contains 64 commits:
>> 
>>  - Merge branch '8254162' into 8254231_linker
>>  - Fix post-merge issues caused by 8219014
>>  - Merge branch 'master' into 8254162
>>  - Addess remaining feedback from @AlanBateman and @mrserb
>>  - Address comments from @AlanBateman
>>  - Fix typo in upcall helper for aarch64
>>  - Merge branch '8254162' into 8254231_linker
>>  - Merge branch 'master' into 8254162
>>  - Fix issues with derived buffers and IO operations
>>  - More 32-bit fixes for TestLayouts
>>  - ... and 54 more: 
>> https://git.openjdk.java.net/jdk/compare/a50fdd54...b38afb3f
>
> src/hotspot/cpu/aarch64/universalUpcallHandler_aarch64.cpp line 99:
> 
>> 97:   if (thread == NULL) {
>> 98:     JavaVM_ *vm = (JavaVM *)(&main_vm);
>> 99:     vm -> functions -> AttachCurrentThreadAsDaemon(vm, &p_env, NULL);
> 
> Style nit: don't put spaces around `->` operator.
> 
> What is the context for this being called? It looks highly suspicious to just 
> attach the current thread to the VM this way.

The context is a thread that is spawned by native code doing an upcall. We need 
to attach the thread to the VM first in that case. Normally this would be 
handled by the calling code, but in our case the calling code doesn't know it's 
calling into Java.

> src/java.base/share/classes/jdk/internal/invoke/NativeEntryPoint.java line 63:
> 
>> 61:     }
>> 62: 
>> 63:     public static NativeEntryPoint make(long addr, String name, 
>> ABIDescriptorProxy abi, VMStorageProxy[] argMoves, VMStorageProxy[] 
>> returnMoves,
> 
> Where is name validation performed, to ensure the named native method is in 
> fact legal and not trying to provide backdoor access to native code that 
> should be encapsulated and protected?

The name is just used as debugging information (in e.g. 
CallNativeNode::dump_spec), we are not looking it up. The address that is 
passed there is the actual function target.

-------------

PR: https://git.openjdk.java.net/jdk/pull/634

Reply via email to