mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-26 00:06:02 +00:00
fix(native): programs started through the rootfs loader show their own command line (#3055)
* fix(native): programs started through the rootfs loader show their own command line Without proot every dynamic guest program runs as "ld.so --preload <hook> --library-path <dirs> --argv0 <name> <program> <args>", and the kernel's /proc/<pid>/cmdline kept all of it. Launchers and the session match programs by their command line, and Wine only moves its Windows command line over its loader's name when its arguments follow each other, so the Battle.net launcher never saw Battle.net.exe, gave up after five minutes and ended the session with the game still running. The hook now moves the program's own arguments to the front of that area at start, as an exec of the program would have laid them out. * fix(native): programs the app starts natively keep their path for /proc/<pid>/exe * fix(native): the rewritten command line keeps AT_EXECFN naming the program --------- Co-authored-by: Kurt Himebauch <136133082+xXJSONDeruloXx@users.noreply.github.com>
This commit is contained in:
1 parent
3c4ac03656
commit
1772291da7
8 files changed
+335
-31
No files matched your search
@@ -45,7 +45,7 @@ class NativeGuestTest {
|
||||
val command = NativeGuest.command(root, "/usr/bin/env", listOf("-i", "A=1"))
|
||||
assertEquals(File(root, "usr/lib/ld-linux-aarch64.so.1").path, command[0])
|
||||
assertEquals(listOf("--library-path", NativeGuest.libraryPath(root), "--argv0", "env", File(root, "usr/bin/env").path, "-i", "A=1"), command.drop(1))
|
||||
assertTrue("LD_LIBRARY_PATH" !in NativeGuest.environment(root))
|
||||
assertTrue("LD_LIBRARY_PATH" !in NativeGuest.environment(root, "/usr/bin/env"))
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -79,13 +79,22 @@ class NativeGuestTest {
|
||||
@Test
|
||||
fun mountsWithoutADestinationMapToThemselves() {
|
||||
val root = rootWithLoader()
|
||||
val env = NativeGuest.sessionEnvironment(root, listOf("/dev", "/a:/b"))
|
||||
val env = NativeGuest.sessionEnvironment(root, listOf("/dev", "/a:/b"), "/usr/bin/env")
|
||||
assertEquals("/dev:/dev|/a:/b", env["DDNATV_BINDS"])
|
||||
assertEquals(root.path, env["DDNATV_ROOT"])
|
||||
assertTrue("LD_LIBRARY_PATH" !in env)
|
||||
assertTrue(env.getValue("LD_PRELOAD").replace(File.separatorChar, '/').endsWith("usr/lib/libddnatv-hook.so"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun theProgramTheLoaderRunsIsNamedInItsEnvironment() {
|
||||
val root = rootWithLoader()
|
||||
val program = NativeGuest.command(root, "/usr/bin/env", listOf("-i"))[5]
|
||||
assertEquals(program, NativeGuest.sessionEnvironment(root, listOf("/dev"), "/usr/bin/env")["DDNATV_REAL_EXE"])
|
||||
assertEquals(program, NativeGuest.environment(root, "/usr/bin/env")["DDNATV_REAL_EXE"])
|
||||
assertEquals(program, NativeGuest.builder(root, "/", listOf("/usr/bin/env", "-i"), emptyMap()).environment()["DDNATV_REAL_EXE"])
|
||||
}
|
||||
|
||||
private val linkRoot = "/data/user/0/app/files/linuxfs"
|
||||
private val sdBinds = listOf(
|
||||
"/mnt/media_rw/CARD/files/steam:/mnt/droiddeck-sd",
|
||||
|
||||
Reference in new issue
Block a user