Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes #1242 #1246

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

fixes #1242 #1246

wants to merge 3 commits into from

Conversation

astrelsky
Copy link
Contributor

@astrelsky astrelsky commented Nov 27, 2024

I don't know what to say other then, no this was not a security issue and no this doesn't introduce one.

fixes #1242

Copy link

codecov bot commented Nov 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.17%. Comparing base (29cce31) to head (28ca1c5).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1246      +/-   ##
==========================================
- Coverage   87.19%   87.17%   -0.02%     
==========================================
  Files         113      113              
  Lines       10296    10296              
  Branches     4051     4051              
==========================================
- Hits         8978     8976       -2     
- Misses        726      727       +1     
- Partials      592      593       +1     
Files with missing lines Coverage Δ
native/common/jp_platform.cpp 66.66% <ø> (ø)

... and 1 file with indirect coverage changes

@astrelsky
Copy link
Contributor Author

astrelsky commented Nov 27, 2024

@Thrameos I need a nap cause I can't think but I did confirm this was the problem. There could be "security" arguments about this but I think they're all 💩 .

@astrelsky
Copy link
Contributor Author

astrelsky commented Nov 27, 2024

ValueError: Unable to get JVM bin path from C:\hostedtoolcache\windows\Java_Temurin-Hotspot_jdk\11.0.25-9\x64\bin\client\jvm.dll

Stupid me forgot about std::wstring, that'll make this easier.

Should be good now I think.

@Thrameos
Copy link
Contributor

I am having a hard time fathoming how we could ever be in a situation where the JVM loaded itself using another versions dll. This seems extraordinarily broken. Is there any chance of this on the linux version?

@ryanmkurtz
Copy link
Contributor

Is anything new calling just "java" vs using JAVA_HOME?

@Thrameos Thrameos mentioned this pull request Nov 28, 2024
@astrelsky
Copy link
Contributor Author

astrelsky commented Nov 28, 2024

I am having a hard time fathoming how we could ever be in a situation where the JVM loaded itself using another versions dll. This seems extraordinarily broken. Is there any chance of this on the linux version?

I watched it happen in the debugger and can show you the logs if necessary.

I have no idea if this can happen on linux or Mac. Windows has stupid dll path search rules.

The issue is this specificaly, it just now results in a different error message.
py5coding/py5generator#563 (comment)

logs

The log below is from running the following. Note that C:\Users\astre\Desktop\jdk-23.0.1\bin is not in PATH.

image

------------------------------------------------------------------------------
You may only use the C/C++ Extension for Visual Studio Code with Visual Studio
Code, Visual Studio or Visual Studio for Mac software to help you develop and
test your applications.
------------------------------------------------------------------------------
Loaded 'C:\Program Files\Python313\python3.13t.exe'. Symbols loaded.
Loaded 'C:\Windows\System32\ntdll.dll'.
Loaded 'C:\Windows\System32\kernel32.dll'.
Loaded 'C:\Windows\System32\KernelBase.dll'.
Loaded 'C:\Windows\System32\ucrtbase.dll'.
Loaded 'C:\Program Files\Python313\python313t.dll'. Symbols loaded.
Loaded 'C:\Program Files\Python313\vcruntime140.dll'.
Loaded 'C:\Windows\System32\ws2_32.dll'.
Loaded 'C:\Windows\System32\rpcrt4.dll'.
Loaded 'C:\Windows\System32\version.dll'.
Loaded 'C:\Windows\System32\bcrypt.dll'.
Loaded 'C:\Windows\System32\msvcrt.dll'.
Loaded 'C:\Windows\System32\advapi32.dll'.
Loaded 'C:\Windows\System32\sechost.dll'.
Loaded 'C:\Windows\System32\bcryptprimitives.dll'.
Loaded 'C:\Program Files\Python313\python3t.dll'.
Loaded 'C:\Program Files\Python313\DLLs\unicodedata.cp313t-win_amd64.pyd'. Symbols loaded.
Loaded 'C:\Program Files\Python313\DLLs\select.cp313t-win_amd64.pyd'. Symbols loaded.
Loaded 'C:\Program Files\Python313\DLLs\_ctypes.cp313t-win_amd64.pyd'. Symbols loaded.
Loaded 'C:\Windows\System32\ole32.dll'.
Loaded 'C:\Windows\System32\msvcp_win.dll'.
Loaded 'C:\Program Files\Python313\DLLs\libffi-8.dll'. Module was built without symbols.
Loaded 'C:\Windows\System32\gdi32.dll'.
Loaded 'C:\Windows\System32\win32u.dll'.
Loaded 'C:\Windows\System32\gdi32full.dll'.
Loaded 'C:\Windows\System32\user32.dll'.
Loaded 'C:\Windows\System32\combase.dll'.
Loaded 'C:\Windows\System32\oleaut32.dll'.
Loaded 'C:\Windows\System32\imm32.dll'.
Loaded 'C:\Users\astre\Documents\jpype\_jpype.cp313t-win_amd64.pyd'. Symbols loaded.
Loaded 'C:\Program Files\Python313\vcruntime140_1.dll'.
Loaded 'C:\Windows\System32\msvcp140.dll'.
Loaded 'C:\Program Files\Python313\DLLs\_hashlib.cp313t-win_amd64.pyd'. Symbols loaded.
Loaded 'C:\Program Files\Python313\DLLs\libcrypto-3.dll'. Symbols loaded.
Loaded 'C:\Program Files\Python313\DLLs\_wmi.cp313t-win_amd64.pyd'. Symbols loaded.
Loaded 'C:\Windows\System32\propsys.dll'.
Loaded 'C:\Program Files\Python313\DLLs\_bz2.cp313t-win_amd64.pyd'. Symbols loaded.
Loaded 'C:\Program Files\Python313\DLLs\_lzma.cp313t-win_amd64.pyd'. Symbols loaded.
Loaded 'C:\Program Files\Python313\DLLs\_socket.cp313t-win_amd64.pyd'. Symbols loaded.
Loaded 'C:\Windows\System32\IPHLPAPI.DLL'.
Loaded 'C:\Windows\System32\kernel.appcore.dll'.
Loaded 'C:\Windows\System32\uxtheme.dll'.
Loaded 'C:\Windows\System32\clbcatq.dll'.
Loaded 'C:\Windows\System32\amsi.dll'.
Loaded 'C:\Windows\System32\userenv.dll'.
Loaded 'C:\Windows\System32\profapi.dll'.
Loaded 'C:\Windows\System32\wintrust.dll'.
Loaded 'C:\Windows\System32\crypt32.dll'.
Loaded 'C:\Windows\System32\shlwapi.dll'.
Loaded 'C:\Windows\System32\shell32.dll'.
Loaded 'C:\Windows\System32\msasn1.dll'.
Loaded 'C:\Program Files\Python313\DLLs\_queue.cp313t-win_amd64.pyd'. Symbols loaded.
Loaded 'C:\Program Files\Python313\DLLs\_decimal.cp313t-win_amd64.pyd'. Symbols loaded.
Loaded 'C:\Users\astre\Desktop\jdk-23.0.1\bin\server\jvm.dll'.
Loaded 'C:\Windows\System32\powrprof.dll'.
Loaded 'C:\Windows\System32\winmm.dll'.
Loaded 'C:\Windows\System32\umpdc.dll'.
Loaded 'C:\Users\astre\Desktop\jdk-23.0.1\bin\jimage.dll'.
Loaded 'C:\Windows\System32\dbghelp.dll'.
Loaded 'C:\Windows\System32\dbgcore.dll'.
Loaded 'C:\Users\astre\Desktop\jdk-23.0.1\bin\instrument.dll'.
Loaded 'C:\Program Files\Amazon Corretto\jdk21.0.5_11\bin\jli.dll'.
Loaded 'C:\Program Files\Amazon Corretto\jdk21.0.5_11\bin\java.dll'.
Exception thrown at 0x00007FFBB715FB0D (ntdll.dll) in python3.13t.exe: 0xC0000139: Entry Point Not Found.
Loaded 'C:\Windows\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.22621.4391_none_2715d37f73803e96\comctl32.dll'.
Unloaded 'C:\Program Files\Amazon Corretto\jdk21.0.5_11\bin\java.dll'.
Unloaded 'C:\Windows\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.22621.4391_none_2715d37f73803e96\comctl32.dll'.
Unloaded 'C:\Program Files\Amazon Corretto\jdk21.0.5_11\bin\jli.dll'.
Unloaded 'C:\Users\astre\Desktop\jdk-23.0.1\bin\instrument.dll'.
Loaded 'C:\Program Files\Amazon Corretto\jdk21.0.5_11\bin\instrument.dll'.
Loaded 'C:\Program Files\Amazon Corretto\jdk21.0.5_11\bin\java.dll'.
Exception thrown at 0x00007FFBB715FB0D (ntdll.dll) in python3.13t.exe: 0xC0000139: Entry Point Not Found.
Loaded 'C:\Program Files\Amazon Corretto\jdk21.0.5_11\bin\jli.dll'.
Unloaded 'C:\Program Files\Amazon Corretto\jdk21.0.5_11\bin\java.dll'.
Unloaded 'C:\Program Files\Amazon Corretto\jdk21.0.5_11\bin\jli.dll'.
Unloaded 'C:\Program Files\Amazon Corretto\jdk21.0.5_11\bin\instrument.dll'.
The program '[6040] python3.13t.exe' has exited with code 1 (0x1).

@astrelsky
Copy link
Contributor Author

Is anything new calling just "java" vs using JAVA_HOME?

No.

@Thrameos Thrameos requested a review from marscher November 29, 2024 18:07
@astrelsky
Copy link
Contributor Author

I am having a hard time fathoming how we could ever be in a situation where the JVM loaded itself using another versions dll. This seems extraordinarily broken. Is there any chance of this on the linux version?

The easiest way to check if it occurs on Linux would be to get the zip file of the jdk, extract it somewhere and then without adding it to PATH, specify the absolute path to the jvm.so in startJVM and then check the paths of all the currently loaded libraries. I don't know how you would get the paths of the currently loaded libraries on Linux though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Failure to start JVM with jpype 1.5.1 on Windows
3 participants