wine-1.1.8 regression -- wine: could not load L"...": Invalid address

Alex Kozlov spam at rm-rf.kiev.ua
Tue Nov 25 15:59:30 PST 2008


On Tue, Nov 25, 2008 at 10:39:25PM +0100, Gerald Pfeifer wrote:
>> Patch helps me. Thank you.
>> Now no more "Invalid address" messages.
> Cool.  Thanks a lot for addressing this Alex, and Vladimir for your
> testing!
Problem was surprisingly easy to diagnose.

> Alex, would you mind submitting this patch upstream as well, to 
> wine-patches at winehq.org Cc:ing me on that?  (If you prefer, I can
> also do this, but since it's your patch...)
I'm already contact to julliard at winehq.org. If You think it is necessary,
You can submit patch to wine-patches.
 


p.s. Preliminary analysis:

After this commit http://source.winehq.org/git/wine.git/?a=commitdiff;h=222e406deb878a6312b3c4bf3bcd0e185fa2ff2c
wine on freebsd 6/7 almost completely broken.

I believe this is because wine reserves only dos area on freebsd.
So wine_mmap_enum_reserved_areas fail:
   if (!wine_mmap_enum_reserved_areas( alloc_virtual_heap, &heap_base, 0 ))
        heap_base = wine_anon_mmap( NULL, VIRTUAL_HEAP_SIZE, PROT_READ|PROT_WRITE, 0 );

Then wine_anon_mmap with NULL as base (this changes to 0x110000 - another
freebsd kludge) map first available address. After this map_image can't map
PE to 0x400000 and in most cases fail with:
warn:module:map_image Need to relocate module from 0x400000 to 0x660000,
but there are no relocation records

Quick and dirty workaround:
Index: dlls/ntdll/virtual.c
@@ -1250,8 +1254,13 @@
     }
 
     /* try to find space in a reserved area for the virtual heap */
-    if (!wine_mmap_enum_reserved_areas( alloc_virtual_heap, &heap_base, 1 ))
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+        heap_base = wine_anon_mmap( address_space_limit -  10 * VIRTUAL_HEAP_SIZE,
+				VIRTUAL_HEAP_SIZE, PROT_READ|PROT_WRITE, 0 );
+#else
+    if (!wine_mmap_enum_reserved_areas( alloc_virtual_heap, &heap_base, 0 ))
         heap_base = wine_anon_mmap( NULL, VIRTUAL_HEAP_SIZE, PROT_READ|PROT_WRITE, 0 );
+#endif
 
     assert( heap_base != (void *)-1 );
     virtual_heap = RtlCreateHeap( HEAP_NO_SERIALIZE, heap_base, VIRTUAL_HEAP_SIZE,


Logs.

WINEDEBUG=all wine 1.1.7:
0009:trace:module:load_native_dll Trying native dll L"C:\\Arcanum\\Arcanum.exe"
0009: create_mapping( access=000f0005, attributes=00000000, size=000000000, protect=192,
file_handle=0x18, objattr={rootdir=0x0,sd={},name=L""} )
0009: create_mapping() = 0 { handle=0x1c }
0009:trace:virtual:NtMapViewOfSection handle=0x1c process=0xffffffff addr=0x0 off=000000000 size=0 access=2
0009: get_mapping_info( handle=0x1c )
0009: get_mapping_info() = 0 { size=000356000, protect=128, header_size=4096, base=0x400000,
mapping=0x20, shared_file=0x0 }
0009: get_handle_fd( handle=0x1c )
0009: *fd* 0x1c -> 68
0009: get_handle_fd() = 0 { type=1, removable=0, access=000f0005, options=00000000 }
0009:trace:virtual:VIRTUAL_DumpView View: 0x400000 - 0x755fff (anonymous)
0009:trace:virtual:VIRTUAL_DumpView       0x400000 - 0x755fff c-rWx
>0009:trace:module:map_image mapped PE file at 0x400000-0x756000
0009:trace:module:map_image mapping section .text at 0x401000 off 1000 size 195000 virt 195000 flags 60000020
0009:trace:module:map_image mapping section .rdata at 0x596000 off 196000 size 4000 virt 3cc0 flags 40000040
0009:trace:module:map_image mapping section .data at 0x59a000 off 19a000 size 36000 virt 1a1318 flags c0000040
0009:trace:module:map_image mapping section .idata at 0x73c000 off 1d0000 size 2000 virt 10c0 flags c0000040
0009:trace:module:map_image mapping section .rsrc at 0x73e000 off 1d2000 size 3000 virt 27a0 flags 40000040
0009:trace:module:map_image mapping section .reloc at 0x741000 off 1d5000 size 15000 virt 14a90 flags 42000040

WINEDEBUG=all wine 1.1.9:
001b:trace:module:load_native_dll Trying native dll L"C:\\Arcanum\\Arcanum.exe"
001b: create_mapping( access=000f0005, attributes=00000000, size=000000000, protect=00000140,
file_handle=0x18, objattr={rootdir=0x0,sd={},name=L""} )
001b: create_mapping() = 0 { handle=0x1c }
001b:trace:virtual:NtMapViewOfSection handle=0x1c process=0xffffffff addr=0x0 off=000000000 size=0 a
ccess=2
001b: get_mapping_info( handle=0x1c, access=00000005 )
001b: get_mapping_info() = 0 { size=000356000, protect=256, header_size=4096, base=0x400000, mapping
=0x20, shared_file=0x0 }
001b: get_handle_fd( handle=0x1c )
001b: *fd* 0x1c -> 21
001b: get_handle_fd() = 0 { type=1, removable=0, access=000f0005, options=00000000 }
001b:trace:virtual:map_view got mem with anon mmap 0x660000-0x9b6000
001b:trace:heap:RtlAllocateHeap (0x110000,00000001,00000371): returning 0x110998
001b:trace:virtual:VIRTUAL_DumpView View: 0x660000 - 0x9b5fff (anonymous)
001b:trace:virtual:VIRTUAL_DumpView       0x660000 - 0x9b5fff c-rWx
>001b:trace:module:map_image mapped PE file at 0x660000-0x9b6000
001b:trace:module:map_image mapping section .text at 0x661000 off 1000 size 195000 virt 195000 flags 60000020
001b:trace:module:map_image mapping section .rdata at 0x7f6000 off 196000 size 4000 virt 3cc0 flags 40000040
001b:trace:module:map_image mapping section .data at 0x7fa000 off 19a000 size 36000 virt 1a1318 flags c0000040
001b:trace:module:map_image mapping section .idata at 0x99c000 off 1d0000 size 2000 virt 10c0 flags c0000040
001b:trace:module:map_image mapping section .rsrc at 0x99e000 off 1d2000 size 3000 virt 27a0 flags 40000040
001b:trace:module:map_image mapping section .reloc at 0x9a1000 off 1d5000 size 15000 virt 14a90 flags 42000040
001b:warn:module:map_image Need to relocate module from 0x400000 to 0x660000, but there are no relocation records

wine_anon_map log on 1.1.9:
base=0x1000 size=0x10f000 prot=0 flags=1042 ptr=0x1000
base=0x0 size=0x1000 prot=0 flags=1052 ptr=0x0
>base=0x110000 size=0x400000 prot=3 flags=1002 ptr=0x110000 # VIRTUAL_HEAP
base=0x7ffe0000 size=0x10000 prot=3 flags=1002 ptr=0x7ffe0000
base=0x110000 size=0x2000 prot=3 flags=1002 ptr=0x510000
base=0x110000 size=0x8000 prot=3 flags=1002 ptr=0x511000
base=0x110000 size=0x120000 prot=0 flags=1002 ptr=0x518000
base=0x7e180000 size=0x1000 prot=3 flags=1012 ptr=0x7e180000
base=0x7e240000 size=0x1000 prot=3 flags=1012 ptr=0x7e240000
base=0x110000 size=0x11000 prot=3 flags=1002 ptr=0x630000
base=0x110000 size=0x11000 prot=3 flags=1002 ptr=0x631000
>base=0x400000 size=0x356000 prot=7 flags=1002 ptr=0x631000 # PE image
base=0x110000 size=0x366000 prot=7 flags=1002 ptr=0x631000
base=0x110000 size=0x11000 prot=3 flags=1002 ptr=0x631000
base=0x1000 size=0x10f000 prot=0 flags=1042 ptr=0x1000
base=0x0 size=0x1000 prot=0 flags=1052 ptr=0x0
base=0x110000 size=0x400000 prot=3 flags=1002 ptr=0x110000
base=0x7ffe0000 size=0x10000 prot=3 flags=1002 ptr=0x7ffe0000
base=0x110000 size=0x2000 prot=3 flags=1002 ptr=0x510000
base=0x110000 size=0x8000 prot=3 flags=1002 ptr=0x511000
base=0x110000 size=0x120000 prot=0 flags=1002 ptr=0x518000
base=0x110000 size=0x12000 prot=3 flags=1002 ptr=0x630000
base=0x110000 size=0x11000 prot=3 flags=1002 ptr=0x632000
base=0x7e180000 size=0x1000 prot=3 flags=1012 ptr=0x7e180000
base=0x7e240000 size=0x1000 prot=3 flags=1012 ptr=0x7e240000
base=0x400000 size=0x356000 prot=7 flags=1002 ptr=0x641000
base=0x110000 size=0x366000 prot=7 flags=1002 ptr=0x641000


--
Adios


More information about the freebsd-emulation mailing list