Run x86_64 Flatpak apps through FEX (#1875)

* Run x86_64 Flatpak apps through FEX

* proot: run an execveat with an absolute path like execve

* Find x86_64 Flatpak installs and resolve sandbox paths like the sandbox does
This commit is contained in:
MaxsTechReview authored and GitHub committed 2026-10-30 21:21:22 -04:00
1 parent 8088e47d14
commit 28067b3bbe
45 files changed
+494 -61

No files matched your search

+5
View File
@@ -127,6 +127,11 @@ Prototype (inert unless `PROOT_FASTPATH` is set; see `docs/development/proot-per
IDs wrap (32768 on many Android kernels) a new child can get that ID, and PRoot aborted on the
assertion that a new child has no state, ending the whole session. Chromium-based programs such as
Steam's client do this. PRoot now retires the stale entry and sets the new child up from scratch.
- `0024-execveat-absolute-path.patch` - `execveat` with an absolute path and neither `AT_EMPTY_PATH`
nor `AT_SYMLINK_NOFOLLOW` runs as `execve`. The kernel ignores the directory descriptor for such a
path, and PRoot refused the call unless the descriptor was `AT_FDCWD`. FEX starts every child of an
emulated program with `execveat(fd, "/proc/self/exe")`, so x86 programs in a Flatpak sandbox, which
does not carry the session's preloads, could not start other programs.
Old kernel fixes:
@@ -0,0 +1,44 @@
From 968f450754f97907d72a756add5010f6be746b6a Mon Sep 17 00:00:00 2001
From: maxjivi05 <maxjividen@gmail.com>
Date: Fri, 30 Oct 2026 20:21:28 -0400
Subject: [PATCH] syscall: run an execveat with an absolute path like execve
The kernel ignores the directory descriptor of execveat when the path is
absolute, so such a call is an execve with flags. FEX runs every child
of an emulated program through execveat(fd, "/proc/self/exe"), which
proot refused unless the descriptor was AT_FDCWD.
---
src/syscall/enter.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/syscall/enter.c b/src/syscall/enter.c
index f8ce2e7..98241bd 100644
--- a/src/syscall/enter.c
+++ b/src/syscall/enter.c
@@ -129,8 +129,13 @@ int translate_syscall_enter(Tracee *tracee)
status = translate_execve_enter(tracee);
break;
- case PR_execveat:
- if ((int) peek_reg(tracee, CURRENT, SYSARG_1) == AT_FDCWD) {
+ case PR_execveat: {
+ word_t flags = peek_reg(tracee, CURRENT, SYSARG_5);
+ char first = '\0';
+ bool absolute = (flags & (AT_EMPTY_PATH | AT_SYMLINK_NOFOLLOW)) == 0
+ && read_data(tracee, &first, peek_reg(tracee, CURRENT, SYSARG_2), 1) == 0
+ && first == '/';
+ if ((int) peek_reg(tracee, CURRENT, SYSARG_1) == AT_FDCWD || absolute) {
set_sysnum(tracee, PR_execve);
poke_reg(tracee, SYSARG_1, peek_reg(tracee, CURRENT, SYSARG_2));
poke_reg(tracee, SYSARG_2, peek_reg(tracee, CURRENT, SYSARG_3));
@@ -142,6 +147,7 @@ int translate_syscall_enter(Tracee *tracee)
}
status = translate_execve_enter(tracee);
break;
+ }
case PR_ptrace:
status = translate_ptrace_enter(tracee);
--
2.43.0