mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-23 06:46:02 +00:00
feat: Flatpak apps and a Flathub store (#77)
* feat: run Flatpak apps through a proot bwrap stand-in and add a Flathub store * feat: give Flatpak apps the KGSL GPU, the controllers and a CPU LLVM can target * feat: Flatpak games on the desktop, Store apps on the Desktop page, safer remove * test: cover the sandbox planner and store helpers; docs: explain Flatpak on DroidDeck * fix: keep controller focus through Store tabs and app pages; show progress per Flatpak step * fix: let Chromium, Electron and Firefox Flatpaks start without their own sandboxes * fix: fetch Flatpak's supporting libraries when the runtime lacks them * fix: add Flathub without a download, log store commands, keep Electron apps on X11 under gamescope * feat: import ARM64 AppImages from storage and run them from the Desktop page * fix: report failed Flatpak installs as failures and deploy runtimes that ship a resolv.conf link * fix: let Flatpak create its repo where Android denies hard links * fix: point store commands at the current network's DNS * fix: keep failed Flatpak extensions non-fatal, give Electron AppImages a bus, X11 and time to relaunch * docs: AppImage import and what x86 apps would take * feat: put the Flathub Store and AppImage import behind beta toggles in Setup --------- Co-authored-by: MaxsTechReview <maxjividen@gmail.com>
This commit is contained in:
1 parent
b4b31d5a08
commit
9ed25d8ae5
38 files changed
+3293
-20
No files matched your search
@@ -45,6 +45,16 @@ Ported from WinNative (`main`, 53836ca9, "Fix/performance and vac"):
|
||||
with no children or ptracees no longer walks every tracee; the per-stop memory collector is
|
||||
emptied instead of freed and reallocated.
|
||||
|
||||
Added for Flatpak:
|
||||
|
||||
- `0010-new-mount-api-enosys.patch` - `open_tree`, `move_mount`, `fspick` and `mount_setattr`
|
||||
answer `ENOSYS`. They take paths proot never translated, so libglnx's `open_tree(AT_FDCWD, "/")`
|
||||
handed Flatpak a descriptor for the host's root and it tried to create directories there
|
||||
(`mkdirat(root): Operation not permitted`); unsupported, libglnx falls back to `openat`.
|
||||
- `0012-android-hardlink-denial.patch` - Android's SELinux policy denies apps hard links, so
|
||||
`linkat` fails with `EACCES` and Flatpak could not create its repo (`Creating repo: linkat:
|
||||
Permission denied`). `O_TMPFILE` answers `EOPNOTSUPP`, so libglnx writes a named temporary file
|
||||
and renames it, and a denied link answers `EPERM`, on which ostree's checkout copies instead.
|
||||
Added by DroidDeck:
|
||||
|
||||
- `0011-kompat-utsname-only.patch` - `--kernel-release` (the guest's `DroidDeck` hostname) loads
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: DroidDeck <noreply@droiddeck.invalid>
|
||||
Date: Tue, 29 Sep 2026 08:00:00 -0400
|
||||
Subject: [PATCH] syscall: answer the new mount API with ENOSYS
|
||||
|
||||
open_tree(AT_FDCWD, "/") and its relatives take paths proot never
|
||||
translates, so libglnx (Flatpak) got a descriptor for the host root and
|
||||
created directories there. Unsupported, callers fall back to openat.
|
||||
---
|
||||
diff --git a/src/syscall/enter.c b/src/syscall/enter.c
|
||||
index 1d3b3fd..32d2503 100644
|
||||
--- a/src/syscall/enter.c
|
||||
+++ b/src/syscall/enter.c
|
||||
@@ -465,6 +465,15 @@ int translate_syscall_enter(Tracee *tracee)
|
||||
status = -ENOSYS;
|
||||
break;
|
||||
|
||||
+ /* The new mount API opens and moves paths proot never sees: open_tree(AT_FDCWD, "/")
|
||||
+ * hands back the host's root. Callers (libglnx, systemd) fall back to openat. */
|
||||
+ case PR_open_tree:
|
||||
+ case PR_move_mount:
|
||||
+ case PR_fspick:
|
||||
+ case PR_mount_setattr:
|
||||
+ status = -ENOSYS;
|
||||
+ break;
|
||||
+
|
||||
case PR_inotify_add_watch:
|
||||
flags = peek_reg(tracee, CURRENT, SYSARG_3);
|
||||
|
||||
diff --git a/src/syscall/seccomp.c b/src/syscall/seccomp.c
|
||||
index 0b381bb..6ba7b67 100644
|
||||
--- a/src/syscall/seccomp.c
|
||||
+++ b/src/syscall/seccomp.c
|
||||
@@ -457,6 +457,10 @@ static FilteredSysnum proot_sysnums[] = {
|
||||
{ PR_open, 0 },
|
||||
{ PR_openat, 0 },
|
||||
{ PR_openat2, 0 },
|
||||
+ { PR_open_tree, 0 },
|
||||
+ { PR_move_mount, 0 },
|
||||
+ { PR_fspick, 0 },
|
||||
+ { PR_mount_setattr, 0 },
|
||||
{ PR_pivot_root, 0 },
|
||||
{ PR_prctl, 0 },
|
||||
{ PR_prlimit64, FILTER_SYSEXIT },
|
||||
diff --git a/src/syscall/sysnums-arm.h b/src/syscall/sysnums-arm.h
|
||||
index e3f6f6b..ebf0afc 100644
|
||||
--- a/src/syscall/sysnums-arm.h
|
||||
+++ b/src/syscall/sysnums-arm.h
|
||||
@@ -358,6 +358,10 @@ static const Sysnum sysnums_arm[] = {
|
||||
[ 397 ] = PR_statx,
|
||||
[ 439 ] = PR_faccessat2,
|
||||
[ 435 ] = PR_clone3,
|
||||
+ [ 428 ] = PR_open_tree,
|
||||
+ [ 429 ] = PR_move_mount,
|
||||
+ [ 433 ] = PR_fspick,
|
||||
[ 437 ] = PR_openat2,
|
||||
+ [ 442 ] = PR_mount_setattr,
|
||||
[ 452 ] = PR_fchmodat2,
|
||||
};
|
||||
diff --git a/src/syscall/sysnums-arm64.h b/src/syscall/sysnums-arm64.h
|
||||
index b257339..c68a1f8 100644
|
||||
--- a/src/syscall/sysnums-arm64.h
|
||||
+++ b/src/syscall/sysnums-arm64.h
|
||||
@@ -278,8 +278,12 @@ static const Sysnum sysnums_arm64[] = {
|
||||
[ 289 ] = PR_pkey_alloc,
|
||||
[ 290 ] = PR_pkey_free,
|
||||
[ 291 ] = PR_statx,
|
||||
+ [ 428 ] = PR_open_tree,
|
||||
+ [ 429 ] = PR_move_mount,
|
||||
+ [ 433 ] = PR_fspick,
|
||||
[ 435 ] = PR_clone3,
|
||||
[ 437 ] = PR_openat2,
|
||||
+ [ 442 ] = PR_mount_setattr,
|
||||
[ 439 ] = PR_faccessat2,
|
||||
[ 452 ] = PR_fchmodat2,
|
||||
};
|
||||
diff --git a/src/syscall/sysnums.list b/src/syscall/sysnums.list
|
||||
index c221ddd..93ea2e2 100644
|
||||
--- a/src/syscall/sysnums.list
|
||||
+++ b/src/syscall/sysnums.list
|
||||
@@ -86,6 +86,7 @@ SYSNUM(flock)
|
||||
SYSNUM(fork)
|
||||
SYSNUM(fremovexattr)
|
||||
SYSNUM(fsetxattr)
|
||||
+SYSNUM(fspick)
|
||||
SYSNUM(fstat)
|
||||
SYSNUM(fstat64)
|
||||
SYSNUM(fstatat64)
|
||||
@@ -191,6 +192,8 @@ SYSNUM(mmap)
|
||||
SYSNUM(mmap2)
|
||||
SYSNUM(modify_ldt)
|
||||
SYSNUM(mount)
|
||||
+SYSNUM(mount_setattr)
|
||||
+SYSNUM(move_mount)
|
||||
SYSNUM(move_pages)
|
||||
SYSNUM(mprotect)
|
||||
SYSNUM(mpx)
|
||||
@@ -221,6 +224,7 @@ SYSNUM(oldstat)
|
||||
SYSNUM(olduname)
|
||||
SYSNUM(open)
|
||||
SYSNUM(open_by_handle_at)
|
||||
+SYSNUM(open_tree)
|
||||
SYSNUM(openat)
|
||||
SYSNUM(openat2)
|
||||
SYSNUM(pause)
|
||||
@@ -0,0 +1,82 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: DroidDeck <noreply@droiddeck.invalid>
|
||||
Date: Tue, 29 Sep 2026 15:00:00 -0400
|
||||
Subject: [PATCH] syscall: work around Android's denial of hard links
|
||||
|
||||
SELinux denies apps the file link permission, so linkat fails with
|
||||
EACCES. libostree names its O_TMPFILE files with linkat and failed to
|
||||
create the Flathub repo ("Creating repo: linkat: Permission denied").
|
||||
O_TMPFILE now answers EOPNOTSUPP, so libglnx falls back to a named
|
||||
temporary file and a rename, and a denied link answers EPERM, which
|
||||
ostree's checkout takes as a filesystem without hard links and copies.
|
||||
---
|
||||
diff --git a/src/syscall/enter.c b/src/syscall/enter.c
|
||||
index 8c3eb2e..4c28e10 100644
|
||||
--- a/src/syscall/enter.c
|
||||
+++ b/src/syscall/enter.c
|
||||
@@ -400,6 +400,13 @@ int translate_syscall_enter(Tracee *tracee)
|
||||
|
||||
case PR_open:
|
||||
flags = peek_reg(tracee, CURRENT, SYSARG_2);
|
||||
+#ifdef __ANDROID__
|
||||
+ /* An O_TMPFILE file can only be named by linkat, which Android denies apps. */
|
||||
+ if ((flags & __O_TMPFILE) != 0) {
|
||||
+ status = -EOPNOTSUPP;
|
||||
+ break;
|
||||
+ }
|
||||
+#endif
|
||||
|
||||
if ( ((flags & O_NOFOLLOW) != 0)
|
||||
|| ((flags & O_EXCL) != 0 && (flags & O_CREAT) != 0))
|
||||
@@ -518,6 +525,12 @@ int translate_syscall_enter(Tracee *tracee)
|
||||
case PR_openat:
|
||||
dirfd = peek_reg(tracee, CURRENT, SYSARG_1);
|
||||
flags = peek_reg(tracee, CURRENT, SYSARG_3);
|
||||
+#ifdef __ANDROID__
|
||||
+ if ((flags & __O_TMPFILE) != 0) {
|
||||
+ status = -EOPNOTSUPP;
|
||||
+ break;
|
||||
+ }
|
||||
+#endif
|
||||
|
||||
status = get_sysarg_path(tracee, path, SYSARG_2);
|
||||
if (status < 0)
|
||||
diff --git a/src/syscall/exit.c b/src/syscall/exit.c
|
||||
index df41084..5d981db 100644
|
||||
--- a/src/syscall/exit.c
|
||||
+++ b/src/syscall/exit.c
|
||||
@@ -544,6 +544,16 @@ void translate_syscall_exit(Tracee *tracee)
|
||||
status = handle_statx_syscall(tracee, false);
|
||||
break;
|
||||
|
||||
+#ifdef __ANDROID__
|
||||
+ /* Android denies apps hard links with EACCES; EPERM is what callers such as
|
||||
+ * libostree take as "no hard links here" and copy instead. */
|
||||
+ case PR_link:
|
||||
+ case PR_linkat:
|
||||
+ if ((int) syscall_result == -EACCES)
|
||||
+ poke_reg(tracee, SYSARG_RESULT, -EPERM);
|
||||
+ goto end;
|
||||
+#endif
|
||||
+
|
||||
case PR_ioctl:
|
||||
if (peek_reg(tracee, ORIGINAL, SYSARG_2) == _IOW(0x94, 9, int) /* FICLONE */ &&
|
||||
(int) peek_reg(tracee, CURRENT, SYSARG_RESULT) == -EACCES) {
|
||||
diff --git a/src/syscall/seccomp.c b/src/syscall/seccomp.c
|
||||
index 6d1ba47..8db9f45 100644
|
||||
--- a/src/syscall/seccomp.c
|
||||
+++ b/src/syscall/seccomp.c
|
||||
@@ -362,8 +362,13 @@ static FilteredSysnum proot_sysnums[] = {
|
||||
{ PR_lchown, 0 },
|
||||
{ PR_lchown32, 0 },
|
||||
{ PR_lgetxattr, 0 },
|
||||
+#ifdef __ANDROID__
|
||||
+ { PR_link, FILTER_SYSEXIT },
|
||||
+ { PR_linkat, FILTER_SYSEXIT },
|
||||
+#else
|
||||
{ PR_link, 0 },
|
||||
{ PR_linkat, 0 },
|
||||
+#endif
|
||||
{ PR_listxattr, 0 },
|
||||
{ PR_llistxattr, 0 },
|
||||
{ PR_lremovexattr, 0 },
|
||||
Reference in new issue
Block a user