Repository navigation
Stop the DNS shim and LSFG layer from loading libandroid.so - #2228
Conversation
libandroid.so pulls in ~200 system libraries that look up their own dependencies through the guest's LD_LIBRARY_PATH, so they bind to imagefs libraries of the same name and fail to link on Samsung (libsqlite needs BoringSSL's libcrypto) and Xiaomi HyperOS (libjpeg-hyper needs the system libjpeg). DNS shim: res_query() returned ENOSYS for every query when that dlopen failed, and Wine's Android dnsapi, which dlsyms android_res_nquery from its own failed libandroid handle, called a NULL pointer. Call resNetworkQuery and resNetworkResult from libnetd_client.so (what libandroid's wrappers do) and export android_res_nquery/android_res_nresult with libandroid's behaviour so dnsapi finds them through RTLD_DEFAULT. android_getaddrinfofornetwork(0, ...) is the same call as getaddrinfo(), so use that. LSFG layer: drop its unused DT_NEEDED on libandroid.so (it only imports __android_log_print from liblog) and bump the runtime version so containers reinstall it.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
Built from GameNative/lsfg-vk-android#9 (release + link nativewindow instead of android) instead of patching the old binary.
The gamescope_system_libs symlinks to /system/lib64/libcrypto.so and libjpeg.so only existed because libgndrm_shim.so linked libandroid.so, whose OEM deps resolved against imagefs's same-named libs. The shim no longer links libandroid (gamenative-drm#9, app #2228), so nothing in a gamescope session loads those system libs. The gamescope LD_LIBRARY_PATH now starts at gamescope/lib.
The gamescope_system_libs symlinks to /system/lib64/libcrypto.so and libjpeg.so only existed because libgndrm_shim.so linked libandroid.so, whose OEM deps resolved against imagefs's same-named libs. The shim no longer links libandroid (gamenative-drm#9, app utkarshdalal#2228), so nothing in a gamescope session loads those system libs. The gamescope LD_LIBRARY_PATH now starts at gamescope/lib.
…es (payload 20261023.3) (#2230) * gamescope: hide the boot splash on the first mapped window, as X11 does Under the X11 display server the app hides the "Launching game" splash on the first mapped window and the user sees black until the game's first frame, because the renderers never draw explorer. Under gamescope the splash instead waited for a game-window note from the shim's present path or from gamescope's commit-rate scan, because hiding it earlier showed Wine's blue desktop wallpaper and taskbar, which gamescope composites. That gate kept the splash up for tens of seconds after there was something to show (L.A. Noire loads for 25 s behind it). Both modes now use the same rule. Game sessions get a black desktop background with no wallpaper and explorer's shell (taskbar, start menu, standalone systray) turned off for the "shell" desktop (WineThemeManager.gameSessionTheme and the enableShell flag of apply, applied in setupWineSystemFiles for launches that are not bootToContainer). That is a no-op under X11 and removes the blue and the taskbar under gamescope; "Open container" keeps the user's theme and shell. Payload 20261023.3 ships gamescope A43 reworked to send the game-window note on the first top-level X map, like the X11 rule, with a once-a-second resend (GameNative/gamescope#6), and the shim without its own game-window report (gamenative-drm#12) on top of the device-gated proc lookup (gamenative-drm#11). The bundled libgamenative_drm.so is the daemon from gamenative-drm#12: it clears the splash as soon as the note arrives instead of on the next published frame. * gamescope: drop the system libcrypto/libjpeg links The gamescope_system_libs symlinks to /system/lib64/libcrypto.so and libjpeg.so only existed because libgndrm_shim.so linked libandroid.so, whose OEM deps resolved against imagefs's same-named libs. The shim no longer links libandroid (gamenative-drm#9, app #2228), so nothing in a gamescope session loads those system libs. The gamescope LD_LIBRARY_PATH now starts at gamescope/lib. * Default new containers to gamescope only on Adreno Gamescope is verified on Adreno 735, 750, 830 and 840. Mali-G710 works, but Mali-G68 cannot create gamescope's compute pipelines, and Xclipse and PowerVR are untested, so every non-Adreno GPU now defaults to X11. setContainerDefaults resolves the default from the cached GL renderer string at startup and stores it in DefaultVersion.DISPLAY_SERVER, which the unset display server preference and new ContainerData use. The per-container setting, known and community configs, and an explicitly set global preference still win; existing containers keep their value. --------- Co-authored-by: Utkarsh Dalal <utkarsh.dalal@toptal.com>
Description
libandroid.sopulls in ~200 system libraries, and inside a game they look up their own dependencies through ourLD_LIBRARY_PATH, so they bind to imagefs libraries with the same name. On Samsung (libsqlite needs BoringSSL's libcrypto) and Xiaomi HyperOS (libjpeg-hyper needs the system libjpeg) loadinglibandroid.sofails. Gamescope is covered by #2227. This PR fixes the two other libraries we ship that load it into game processes.DNS shim (
app/src/main/cpp/gamenative_dns_v4mapped.c, preloaded into every game)dlopen("libandroid.so")failed,res_query()returned ENOSYS for every query. EA App's DirtySDK networking and the Rockstar launcher go through this path, which may explain the EA/Rockstar reports from these phones.dnsapi(Proton 9 and 11) also dlopenslibandroid.so. It then callsandroid_res_nquerywithout a NULL check, so on these phones the firstDnsQueryjumps to address 0.resNetworkQuery/resNetworkResultfromlibnetd_client.sodirectly. That is all libandroid's wrappers do (checked in the disassembly), and libnetd_client's dependencies share no names with imagefs. The shim also exportsandroid_res_nquery/android_res_nresultwith libandroid's exact behaviour. Bionic'sdlsym(NULL, ...)isRTLD_DEFAULT, so Proton's dnsapi finds ours when its own dlopen fails, with no Proton rebuild.android_getaddrinfofornetwork(0, ...)is the same call bionic'sgetaddrinfomakes, so that now goes straight togetaddrinfo.LSFG layer (
liblsfg-vk-layer.so)NEEDEDonlibandroid.sobut imports nothing from it (its only non-libc import is__android_log_print, from liblog). On these phones the Vulkan loader could not load the layer, so LSFG silently did nothing.nativewindowinstead ofandroid(releaseneeds neither;android-gen8-fixesneedsAHardwareBuffer_*, which libnativewindow exports). Same dynamic exports as the old binary, 16 KB alignment.RUNTIME_VERSIONis bumped so existing containers reinstall the layer.Testing
On a POCO F6 (HyperOS 1, Android 14), with a test binary and the Samsung failure forced by putting a stub
libsqlite.sofirst onLD_LIBRARY_PATH:res_queryAdlsym(NULL, "android_res_nquery")res_queryAdlopendlopenNot yet tested in a real game session.
Recording
N/A, no UI change.
Type of Change
Checklist
#code-changes, I have discussed this change there and it has been green-lighted. If I do not have access, I have still provided clear context in this PR. If I skip both, I accept that this change may face delays in review, may not be reviewed at all, or may be closed.CONTRIBUTING.md.