<div dir="ltr">Hello everyone,<div><br></div><div>out of curiosity, I was tracking down why a piece of code in julia [1] threw an assertion when running under wine, but</div><div>not on windows proper. The problem in this piece of code turned out to be that VirtualQuery is claiming a region of</div><div>memory is free, when it is actually occupied by part of one of the builtin dlls.</div><div><br></div><div>If I understand correctly what's happening here is that builtin dlls are regular shared objects on the host system, and</div><div>get loaded as such, but contain the respective windows dll inside of them (modulo header, which gets created in</div><div>`map_dll` by mapping over a couple of pages in the middle). Later, after going through the load callback,</div><div>`virtual_create_builtin_view` records the appropriate information in the view map. However, it only records what<br></div><div>it knows about the inner dll, not the shared object wrapper around it.</div><div><br></div><div>I was thinking of preparing a patch, but I am not sure how to go about it. Options I could see:</div><div><br></div><div>- Expand the mapping in `virtual_create_builtin_view`. This seems most straightforward, but I don't quite</div><div> know what the proper way to pass this information through to here is. Or maybe we can parse the wrapper's</div><div>header right in the function, if we assume that it's base will always be 64K before the PE header base?</div><div><br></div><div>- Unmap the parts of the shared library that do not constitute the inner dll. I would imagine that at some</div><div>point wine stops relying on the native dynamic linker, at which point it would probably be safe to just unmap</div><div>the extra pages such that view agrees with what is actually mapped.</div><div><br></div><div>I'd be happy to put together a patch, but I'll need some guidance on how best to do this, since I haven't looked</div><div>at the Wine codebase before today.</div><div><br></div><div>[1] <a href="https://github.com/JuliaLang/julia/blob/01dd5ec0b25fc5fa8cf1fbae6bb00ef5874700d3/ui/repl.c#L598">https://github.com/JuliaLang/julia/blob/01dd5ec0b25fc5fa8cf1fbae6bb00ef5874700d3/ui/repl.c#L598</a></div></div>