https://bugs.winehq.org/show_bug.cgi?id=54432
Bug ID: 54432 Summary: Missing ntdll.RtlAddressInSectionTable() implementation causes all GraalVM Native Image exes to crash on load Product: Wine Version: 8.0 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: ntdll Assignee: wine-bugs@winehq.org Reporter: axel@axelfontaine.com Distribution: ---
All exes produced by GraalVM Native Image attempt to locate a copy of their initial heap within the exe file. To do so they use the ntdll.RtlAddressInSectionTable() call as can be seen here: https://github.com/oracle/graal/blob/master/substratevm/src/com.oracle.svm.c...
As wine always returns 0, all these exes fail the following check on startup: https://github.com/oracle/graal/blob/master/substratevm/src/com.oracle.svm.c...
And terminate immediately with exit code 127.
https://bugs.winehq.org/show_bug.cgi?id=54432
--- Comment #1 from Austin English austinenglish@gmail.com --- Can you point to an example executable that is publicly available? Ideally one with source code available.
https://bugs.winehq.org/show_bug.cgi?id=54432
Eric Pouech eric.pouech@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |eric.pouech@gmail.com
--- Comment #2 from Eric Pouech eric.pouech@gmail.com --- Created attachment 73989 --> https://bugs.winehq.org/attachment.cgi?id=73989 Quickie for RtlAddressInSectionTable
this path could allow to go one step further
BUT, since making copies of heap likely makes lots of assumption about the details of the implementation, it may not work at all. Unfortunately the detail of the markers (eg. heap relocatable begin / end) don't seem to be available on public repository.
It also depends if the image has been created on Windows or one Wine. I'd start with wine to reduce the odds.
https://bugs.winehq.org/show_bug.cgi?id=54432
--- Comment #3 from Axel Fontaine axel@axelfontaine.com --- Created attachment 73998 --> https://bugs.winehq.org/attachment.cgi?id=73998 Reproducer exe
I put together the smallest possible reproducer.
.exe is attached.
Repo is available here: https://github.com/axelfontaine/graalvm-native-image-wine
Artifact was created in this workflow run: https://github.com/axelfontaine/graalvm-native-image-wine/actions/runs/40912...
https://bugs.winehq.org/show_bug.cgi?id=54432
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |download, patch, source, | |testcase
https://bugs.winehq.org/show_bug.cgi?id=54432
--- Comment #4 from Eric Pouech eric.pouech@gmail.com --- thanks Axel for providing a minimal reproducer with the .exe in #3
------------------ with patch from #3 applied I get: [eric]$ ../../wine64/wine ./wine-54432.exe Hello Wine!
which is was is expected I think (looking at Java source code).
------------------ [eric]$ winedump -x ./wine-54432.exe
contains in the sections' list: ... .svm_hea VirtSize: 0x006eb000 VirtAddr: 0x0044a000 raw data offs: 0x00449000 raw data size: 0x006eb000 relocation offs: 0x00000000 relocations: 0x00000000 line # offs: 0 line #'s: 0 characteristics: 0x40000040 INITIALIZED_DATA MEM_READ ... which really looks like (from its name) like a dedicated section containing a heap copy.
Axel, can you try with patch in #2 applied if it works for more sophisticated use cases?
I'm still surprised of not getting errors in the first test above. There's no relocation info (from PE format) to the .svm_hea section. So either Native uses an ad hoc allocator, with serialization. But unserializing will likely change the address of allocated objects. So either there's also relocation information in the .svm_heap or there's an additional indirection in place.
https://bugs.winehq.org/show_bug.cgi?id=54432
--- Comment #5 from Axel Fontaine axel@axelfontaine.com --- That's awesome Eric! Thanks for taking care of this so quickly!
Could you commit your work already then I can try it tomorrow with the newest latest tag of https://hub.docker.com/r/scottyhardy/docker-wine/tags and let you know if we have reached the bottom of the rabbit hole or if more work is needed?
https://bugs.winehq.org/show_bug.cgi?id=54432
--- Comment #6 from Axel Fontaine axel@axelfontaine.com --- Eric, Austin, is there anything blocking this initial patch from being applied?
It already provides a clear improvement for the attached reproducer and it would allow me to easily test more complex cases in the near future.
https://bugs.winehq.org/show_bug.cgi?id=54432
--- Comment #7 from Eric Pouech eric.pouech@gmail.com --- (In reply to Axel Fontaine from comment #6)
Eric, Austin, is there anything blocking this initial patch from being applied?
It already provides a clear improvement for the attached reproducer and it would allow me to easily test more complex cases in the near future.
time on maintainer side ;-) for example, another (yet larger) patch I submitted took more than 2 weeks between submission and approval... so nothing to worry (too much) about for now
https://bugs.winehq.org/show_bug.cgi?id=54432
--- Comment #8 from Eric Pouech eric.pouech@gmail.com --- proposed patch committed as 89d42d64d768d27e44408533d8fee9218dfa087d and has landed for wine 8.2 would you mind testing from 8.2 and report the result? TIA
https://bugs.winehq.org/show_bug.cgi?id=54432
--- Comment #9 from Axel Fontaine axel@axelfontaine.com --- I am happy to report that this now also works for more complex binaries! Thanks for the quick fix!!
https://bugs.winehq.org/show_bug.cgi?id=54432
Gijs Vermeulen gijsvrm@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |FIXED Fixed by SHA1| |89d42d64d768d27e44408533d8f | |ee9218dfa087d
--- Comment #10 from Gijs Vermeulen gijsvrm@gmail.com --- Thanks for retesting, marking FIXED.
https://bugs.winehq.org/show_bug.cgi?id=54432
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #11 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 8.3.
https://bugs.winehq.org/show_bug.cgi?id=54432
Michael Stefaniuc mstefani@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |8.0.x
https://bugs.winehq.org/show_bug.cgi?id=54432
Michael Stefaniuc mstefani@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|8.0.x |---
--- Comment #12 from Michael Stefaniuc mstefani@winehq.org --- Removing the 8.0.x milestone from bug fixes included in 8.0.1.