box64 icon indicating copy to clipboard operation
box64 copied to clipboard

Didn't detect 48bits of address space, considering it's 39bits

Open ForeverFirstDay opened this issue 1 year ago • 2 comments

I use the latest box64 and wine64-stable-9.0.0.0. I meet with the following errs whenever a 64bit app installing. And the installer stuck anyway.

Dynarec for ARM64, with extension: ASIMD AES CRC32 PMULL ATOMICS SHA1 SHA2 PageSize:4096 Running on Unknown CPU with 8 Cores
Will use Hardware counter measured at 62.5 MHz emulating 500 MHz
Params database has 61 entries
Box64 with Dynarec v0.2.7 cd8bda7a built on Mar 15 2024 17:19:32
BOX64: Wine64 detected, WINEPRELOADRESERVE="000400000-0004b9000"
BOX64: Detected running wine with "dbeaver-ce-23.1.3-x86_64-setup.exe"
BOX64: Didn't detect 48bits of address space, considering it's 39bits
Counted 49 Env var
BOX64 LIB PATH: ./:lib/:lib64/:x86_64/:bin64/:libs64/:/lib/x86_64-linux-gnu/:/usr/lib/x86_64-linux-gnu/
BOX64 BIN PATH: ./:bin/:/usr/local/sbin/:/usr/local/bin/:/usr/sbin/:/usr/bin/:/sbin/:/bin/:/usr/games/:/usr/local/games/
Looking for /home/gyy/wine/bin/wine64
Apply RC params for wine64
Applying BOX64_MAXCPU=64
argv[1]="Z:\home\gyy\dbeaver-ce-23.1.3-x86_64-setup.exe"
Rename process to "wine64"
Using native(wrapped) libdl.so.2
Using native(wrapped) libpthread.so.0
Using native(wrapped) libc.so.6
Using native(wrapped) ld-linux-x86-64.so.2
Using native(wrapped) libutil.so.1
Using native(wrapped) librt.so.1
Using native(wrapped) libbsd.so.0
Using emulated /home/gyy/wine/bin/../lib64/wine/x86_64-unix/ntdll.so
Using emulated /lib/x86_64-linux-gnu/libgcc_s.so.1
0100:err:environ:init_peb starting L"Z:\\home\\gyy\\dbeaver-ce-23.1.3-x86_64-setup.exe" in experimental wow64 mode
0100:err:virtual:map_fixed_area out of memory for 0x6fffffc20000-0x6ffffffec000
0100:err:virtual:try_map_free_area mmap() error, can not malloc memory, range 0x7fffffc20000-0x7ffffffec000, unix_prot 0x7.
wine: failed to load L"\\??\\C:\\windows\\syswow64\\ntdll.dll" error c000013
Unable to start the program, or there is no application associated with the specified file.
ShellExecuteEx error

However, wine64 notepad work well with the similar errs.

Dynarec for ARM64, with extension: ASIMD AES CRC32 PMULL ATOMICS SHA1 SHA2 PageSize:4096 Running on Unknown CPU with 8 Cores
Will use Hardware counter measured at 62.5 MHz emulating 500 MHz
Params database has 61 entries
Box64 with Dynarec v0.2.7 cd8bda7a built on Mar 15 2024 17:19:32
BOX64: Didn't detect 48bits of address space, considering it's 39bits
Counted 37 Env var
BOX64 LIB PATH: ./:lib/:lib64/:x86_64/:bin64/:libs64/:/lib/x86_64-linux-gnu/:/usr/lib/x86_64-linux-gnu/
BOX64 BIN PATH: ./:bin/:/usr/local/sbin/:/usr/local/bin/:/usr/sbin/:/usr/bin/:/sbin/:/bin/:/usr/games/:/usr/local/games/
Looking for /home/gyy/wine/bin/wineserver
Rename process to "wineserver"
Using native(wrapped) libdl.so.2
Using native(wrapped) libc.so.6
Using native(wrapped) ld-linux-x86-64.so.2
Using native(wrapped) libpthread.so.0
Using native(wrapped) libutil.so.1
Using native(wrapped) librt.so.1
Using native(wrapped) libbsd.so.0
Using emulated /home/gyy/wine/bin/../lib64/wine/x86_64-unix/ntdll.so
Using emulated /lib/x86_64-linux-gnu/libgcc_s.so.1
002c:err:virtual:map_fixed_area out of memory for 0x6fffffc20000-0x6ffffffec000
002c:err:virtual:try_map_free_area mmap() error, can not malloc memory, range 0x7fffffc20000-0x7ffffffec000, unix_prot 0x7.
...
...
0050:err:ole:start_rpcss Failed to start Rpc5s service
00cc:err:virtual:map_fixed_area out of memory for 0x6fffffc20000-0x6ffffffec000
00cc:err:virtual:try_map_free_area mmap() error, can not malloc memory, range 0x7fffffc20000-0x7ffffffec000, unix_prot 0x7.
...
Using emulated /home/gyy/wine/lib64/wine/x86_64-unix/win32u.so
Using native(wrapped) libm.so.6
Using native(wrapped) libfreetype.so.6
Using native(wrapped) libfontconfig.so.1
Using native(wrapped) libexpat.so.1
Using emulated /home/gyy/wine/lib64/wine/x86_64-unix/winex11.so
Using native(wrapped) libXext.so.6
Using native(wrapped) libX11.so.6
Using native(wrapped) libxcb.so.1
Using native(wrapped) libXau.so.6
Using native(wrapped) libXdmcp.so.6
Using emulated /home/gyy/wine/lib64/wine/x86_64-unix/winex11.so
Using emulated /home/gyy/wine/lib64/wine/x86_64-unix/winspool.so
Using native(wrapped) libcups.so.2

ForeverFirstDay avatar Mar 16 '24 09:03 ForeverFirstDay

Well, the error you have are wine error. It bascically complains because you have 39 bits of address space only, like box64 warns you. I'm unclear if those error are fatal or if wine tries again in anouther area. If you want the error to go away, you need to patch Wine at the source level, tere is nothing box64 can do here.

The setup freezing might be because it needs to be run with BOX64_DYNAREC_SAFEFLAGS=2 and/or BOX64_DYNAREC_STRONGMEM=1

ptitSeb avatar Mar 16 '24 14:03 ptitSeb

I'm unclear if those error are fatal or if wine tries again in anouther area. If you want the error to go away, you need to patch Wine at the source level, tere is nothing box64 can do here.

as I mentioned before, its a result of this change https://gitlab.winehq.org/wine/wine/-/commit/30c8da1c9dd8dcc1aee2d328a5fdf7edbf6c7978

I don't really know what the change was addressing or why it was changed since the commit message provides no meaningful information to me and there is no linked issue.

theofficialgman avatar Mar 16 '24 21:03 theofficialgman

Thank you very much for your replies. I will publish this issue on winehq.org later.

ForeverFirstDay avatar Mar 20 '24 03:03 ForeverFirstDay

upstream configuration issue (for raspberry piOS, contact your distro maintainer for other hardware and systems) https://github.com/raspberrypi/linux/issues/6261

theofficialgman avatar Jul 08 '24 22:07 theofficialgman

I have gone ahead and asked for some explanation here from wine https://gitlab.winehq.org/wine/wine/-/merge_requests/3598#note_75871

theofficialgman avatar Jul 11 '24 03:07 theofficialgman

Resolved with pi-apps wine build https://github.com/Pi-Apps-Coders/files/commit/d4e9180610689f09e65a8fa88121a339bce1745a

Consider adding the same patch if you build wine from source

theofficialgman avatar Jul 22 '24 18:07 theofficialgman

This is now resolved in upstream wine master

theofficialgman avatar Aug 30 '24 22:08 theofficialgman

Oh, that's sa good news! So it's fixed with wine9.16+?

ptitSeb avatar Aug 31 '24 05:08 ptitSeb

Not yet. Next unreleased version will include it

theofficialgman avatar Aug 31 '24 13:08 theofficialgman

Not yet. Next unreleased version will include it

Thanks for the info :)

ptitSeb avatar Aug 31 '24 14:08 ptitSeb

@theofficialgman @ptitSeb Still seeing virtual memory allocation errors using Wine 9.17. I was hoping the fix would have made that release. This is on a Pi5 with kernel8.img:

002c:err:virtual:try_map_free_area mmap() error Cannot allocate memory, range 0x7fffb30000-0x7fffcbd000, unix_prot 0x7. 002c:err:virtual:try_map_free_area mmap() error Cannot allocate memory, range 0x7fff750000-0x7fffcb5000, unix_prot 0x7.

RandyR99 avatar Sep 14 '24 19:09 RandyR99

@theofficialgman @ptitSeb Still seeing virtual memory allocation errors using Wine 9.17. I was hoping the fix would have made that release. This is on a Pi5 with kernel8.img:

002c:err:virtual:try_map_free_area mmap() error Cannot allocate memory, range 0x7fffb30000-0x7fffcbd000, unix_prot 0x7. 002c:err:virtual:try_map_free_area mmap() error Cannot allocate memory, range 0x7fff750000-0x7fffcb5000, unix_prot 0x7.

@RandyR99 please provide a full log as well as the binary executable you are running. the issue is resolved and included in Wine 9.17 and I am unable to reproduce it occurring anymore in my test programs.

If you run WINEDBG=+virtual wine programname you will see (similar to) the following output which shows it detected the max address space available for the system

trace:virtual:virtual_init host addr space limit: 0x7fffff0000

theofficialgman avatar Sep 14 '24 19:09 theofficialgman

002c:err:virtual:try_map_free_area mmap() error Cannot allocate memory, range 0x7fffb30000-0x7fffcbd000, unix_prot 0x7. 002c:err:virtual:try_map_free_area mmap() error Cannot allocate memory, range 0x7fff750000-0x7fffcb5000, unix_prot 0x7.

these are values below 39bits I think and likely indicate wine tried to allocate memory in an area of ram that does exist but is not available (eg: due to a carveout by another process). that is unrelated and the issue where wine tried to allocate memory in an area above the address space maximum is fixed.

theofficialgman avatar Sep 14 '24 20:09 theofficialgman

Ahh, I didn't look closely at the address. I should point out that when using a custom kernel with 48-bit virtual addressing I don't see any memory allocation errors. However it is not as up-to-date (it was built on 29 Apr 2024) as the latest kernel. I tried to attach the file but it is too big. Here is a link to the archive containing the file. It is the chess engine stockfish 16 (30 June 2023) run from the command line. Let me know if you still want logs.

RandyR99 avatar Sep 14 '24 21:09 RandyR99

I moved the SD card to a Pi4-8Gb to test and did not see the errors. When I moved it back to the Pi5-8Gb, the errors no longer appeared. Happy but baffled. Sorry for wasting anyone's time. Thanks for everyone's work on Box and Wine.

RandyR99 avatar Sep 14 '24 23:09 RandyR99