Move the Linux runtime to Ubuntu 26.04 LTS with a separate Kubuntu desktop (#1733)

This commit is contained in:
MaxsTechReview authored and GitHub committed 2026-10-29 09:05:20 -04:00
1 parent 5de690ef39
commit 29c83976d0
305 files changed
+9383 -462

No files matched your search

+16 -2
View File
@@ -39,8 +39,8 @@ Ported from WinNative (`main`, 53836ca9, "Fix/performance and vac"):
- `0007-proc-self-thread-group.patch` - tracees track their thread group, `/proc/self` names it
instead of the calling thread, and `/proc/thread-self` resolves to `/proc/<tgid>/task/<tid>`.
- `0008-fchmodat2-openat2.patch` - `fchmodat2` paths are translated (honouring
`AT_SYMLINK_NOFOLLOW`), `openat2` answers `ENOSYS` so callers fall back to the translated
`openat`, and syscall numbers past the end of a table are rejected instead of read.
`AT_SYMLINK_NOFOLLOW`), and syscall numbers past the end of a table are rejected instead of read.
Its `openat2` answer is replaced by `0019`.
- `0009-tracee-relatives-sweep.patch` - tracees count their children, so a terminating thread
with no children or ptracees no longer walks every tracee; the per-stop memory collector is
emptied instead of freed and reallocated.
@@ -114,6 +114,20 @@ Prototype (inert unless `PROOT_FASTPATH` is set; see `docs/development/proot-per
SM8850 (adb shell): `stat` 25.3 -> 0.6 us, `open+close` 25.3 -> 0.9 us, ENOENT 22.9 -> 1.6 us,
8 threads `stat`ing 89k -> 3.6M/s; equivalence suite (`bench/equiv.py`) byte-identical to proot.
- `0019-openat2-emulation.patch` - `openat2` without `resolve` flags runs as a translated `openat`
with the same flag and mode checks as the kernel. Any `resolve` flag still answers `ENOSYS`,
because PRoot cannot confine symlinks or mounts, so callers keep their own confined fallback.
- `0022-fake-root-statx-owners.patch` - with `0013` dropping the `statx` exit stop, fake root never
rewrote the owner `statx` returns, so files read as owned by the app's uid while the process was
root. Rust's `metadata` and GNU `stat` use `statx`, so uutils' `test -w` (Ubuntu's `/usr/bin/test`)
said root could not write to its own directories and apt's AppStream hook never built Discover's
catalog. fake_id0 keeps that exit stop when it fakes ids; identity-only mode is unchanged.
- `0023-reused-pid-new-child.patch` - when a thread that is not its process's leader calls `execve`,
the kernel retires that thread's ID without reporting an exit, so PRoot keeps its entry. Once the
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.
Old kernel fixes:
- `0015-lost-fork-events.patch` - works around a problem reported on Xiaomi's msm 4.14 kernel:
@@ -0,0 +1,72 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: maxjivi05 <maxjividen@gmail.com>
Date: Wed, 28 Oct 2026 14:12:04 -0400
Subject: [PATCH] syscall: emulate openat2 through a translated openat
---
src/syscall/enter.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 49 insertions(+), 2 deletions(-)
diff --git a/src/syscall/enter.c b/src/syscall/enter.c
index 121c742..66b9e6b 100644
--- a/src/syscall/enter.c
+++ b/src/syscall/enter.c
@@ -491,9 +491,56 @@ int translate_syscall_enter(Tracee *tracee)
status = translate_path2(tracee, dirfd, path, SYSARG_2, REGULAR);
break;
- case PR_openat2:
- status = -ENOSYS;
+ case PR_openat2: {
+ struct { uint64_t flags; uint64_t mode; uint64_t resolve; } how;
+ word_t size = peek_reg(tracee, CURRENT, SYSARG_4);
+
+ if (size < sizeof(how) || size > 4096) {
+ status = size < sizeof(how) ? -EINVAL : -E2BIG;
+ break;
+ }
+ status = read_data(tracee, &how, peek_reg(tracee, CURRENT, SYSARG_3), sizeof(how));
+ if (status < 0)
+ break;
+ if ((how.resolve & ~(uint64_t) 0x3f) != 0
+ || ((how.resolve & 0x08) != 0 && (how.resolve & 0x10) != 0)
+ || (how.mode != 0 && (how.flags & (O_CREAT | __O_TMPFILE)) == 0)
+ || (how.flags >> 32) != 0) {
+ status = -EINVAL;
+ break;
+ }
+ if ((how.resolve & 0x20) != 0) {
+ status = -EAGAIN;
+ break;
+ }
+ if ((how.resolve & 0x1f) != 0) {
+ status = -ENOSYS;
+ break;
+ }
+#ifdef __ANDROID__
+ if ((how.flags & __O_TMPFILE) != 0) {
+ status = -EOPNOTSUPP;
+ break;
+ }
+#endif
+ dirfd = peek_reg(tracee, CURRENT, SYSARG_1);
+ status = get_sysarg_path(tracee, path, SYSARG_2);
+ if (status < 0)
+ break;
+
+ if ( ((how.flags & O_NOFOLLOW) != 0)
+ || ((how.flags & O_EXCL) != 0 && (how.flags & O_CREAT) != 0))
+ status = translate_path2(tracee, dirfd, path, SYSARG_2, SYMLINK);
+ else
+ status = translate_path2(tracee, dirfd, path, SYSARG_2, REGULAR);
+ if (status < 0)
+ break;
+
+ set_sysnum(tracee, PR_openat);
+ poke_reg(tracee, SYSARG_3, how.flags);
+ poke_reg(tracee, SYSARG_4, how.mode);
break;
+ }
@@ -0,0 +1,123 @@
From 771667d739c8501729b4037a7377793fd16e908e Mon Sep 17 00:00:00 2001
From: maxjivi05 <maxjividen@gmail.com>
Date: Wed, 28 Oct 2026 14:12:37 -0400
Subject: [PATCH] execve: show the linked name as /proc/self/exe for
link2symlink files
---
src/execve/enter.c | 92 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 92 insertions(+)
diff --git a/src/execve/enter.c b/src/execve/enter.c
index c562d14..f185e9a 100644
--- a/src/execve/enter.c
+++ b/src/execve/enter.c
@@ -592,6 +592,96 @@ static inline const char *get_loader_path(const Tracee *tracee)
* translate_load_*(). This function returns -errno if an error
* occured, otherwise 0.
*/
+static bool is_l2s_name(const char *path)
+{
+ const char *name = strrchr(path, '/');
+
+ name = name != NULL ? name + 1 : path;
+ return strncmp(name, ".l2s.", 5) == 0 || strncmp(name, ".proot.l2s.", 11) == 0;
+}
+
+static void lexical_path(char path[PATH_MAX])
+{
+ char result[PATH_MAX];
+ char *component;
+ char *next;
+ size_t length = 0;
+
+ for (component = path; *component != '\0'; component = next) {
+ size_t size;
+
+ while (*component == '/')
+ component++;
+ next = strchrnul(component, '/');
+ size = next - component;
+ if (size == 0 || (size == 1 && component[0] == '.'))
+ continue;
+ if (size == 2 && component[0] == '.' && component[1] == '.') {
+ while (length > 0 && result[length - 1] != '/')
+ length--;
+ if (length > 0)
+ length--;
+ continue;
+ }
+ result[length++] = '/';
+ memcpy(result + length, component, size);
+ length += size;
+ }
+ if (length == 0)
+ result[length++] = '/';
+ result[length] = '\0';
+ strcpy(path, result);
+}
+
+static void visible_exe(Tracee *tracee, const char *user_path, char exe[PATH_MAX])
+{
+ char path[PATH_MAX];
+ char host[PATH_MAX];
+ char target[PATH_MAX];
+ char *slash;
+ ssize_t length;
+ int i;
+
+ if (user_path[0] == '/') {
+ if (strlen(user_path) >= PATH_MAX)
+ return;
+ strcpy(path, user_path);
+ }
+ else if (join_paths(2, path, tracee->fs->cwd, user_path) < 0)
+ return;
+ lexical_path(path);
+
+ for (i = 0; i < 40; i++) {
+ if (translate_path(tracee, host, AT_FDCWD, path, false) < 0)
+ return;
+ if (is_l2s_name(host))
+ break;
+ length = readlink(host, target, PATH_MAX - 1);
+ if (length < 0)
+ return;
+ target[length] = '\0';
+ if (is_l2s_name(target))
+ break;
+ if (target[0] == '/')
+ strcpy(path, target);
+ else {
+ slash = strrchr(path, '/');
+ *slash = '\0';
+ if (translate_path(tracee, host, AT_FDCWD, path[0] != '\0' ? path : "/", true) < 0)
+ return;
+ if (detranslate_path(tracee, host, NULL) < 0)
+ return;
+ if (join_paths(2, path, host, target) < 0)
+ return;
+ }
+ lexical_path(path);
+ }
+ if (i == 40)
+ return;
+
+ strcpy(exe, path);
+}
+
int translate_execve_enter(Tracee *tracee)
{
char user_path[PATH_MAX];
@@ -642,6 +732,8 @@ int translate_execve_enter(Tracee *tracee)
strcpy(new_exe, host_path);
status = detranslate_path(tracee, new_exe, NULL);
if (status >= 0) {
+ if (is_l2s_name(new_exe))
+ visible_exe(tracee, user_path, new_exe);
talloc_unlink(tracee, tracee->new_exe);
tracee->new_exe = talloc_strdup(tracee, new_exe);
}
--
2.43.0
@@ -0,0 +1,30 @@
From 4486efde6200dc8a8df4097a868b65e449d20e82 Mon Sep 17 00:00:00 2001
From: maxjivi05 <maxjividen@gmail.com>
Date: Wed, 28 Oct 2026 14:12:47 -0400
Subject: [PATCH] fake_id0: report real errors for FIFO and socket mknod
---
src/extension/fake_id0/fake_id0.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/extension/fake_id0/fake_id0.c b/src/extension/fake_id0/fake_id0.c
index 5c8a8cd..dc28529 100644
--- a/src/extension/fake_id0/fake_id0.c
+++ b/src/extension/fake_id0/fake_id0.c
@@ -940,7 +940,12 @@ static int handle_sysexit_end(Tracee *tracee, Config *config)
case PR_setgroups32:
#endif
case PR_mknod:
- case PR_mknodat:
+ case PR_mknodat: {
+ mode_t mode = peek_reg(tracee, ORIGINAL, sysnum == PR_mknod ? SYSARG_2 : SYSARG_3);
+ if (S_ISFIFO(mode) || S_ISSOCK(mode) || S_ISREG(mode) || (mode & S_IFMT) == 0)
+ return 0;
+ return handle_perm_err_exit_end(tracee, config, false);
+ }
case PR_capset:
case PR_chmod:
case PR_chown:
--
2.43.0
@@ -0,0 +1,24 @@
From facb0f6476b374cb9bdb07e388936f4ca0a829ce Mon Sep 17 00:00:00 2001
From: maxjivi05 <maxjividen@gmail.com>
Date: Wed, 28 Oct 2026 15:17:52 -0400
Subject: [PATCH] fake_id0: keep the statx exit stop so owners stay faked
---
src/extension/fake_id0/fake_id0.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/extension/fake_id0/fake_id0.c b/src/extension/fake_id0/fake_id0.c
index dc28529..a5ee018 100644
--- a/src/extension/fake_id0/fake_id0.c
+++ b/src/extension/fake_id0/fake_id0.c
@@ -349,6 +349,7 @@ static FilteredSysnum filtered_sysnums[] = {
{ PR_stat64, FILTER_SYSEXIT },
{ PR_statfs, FILTER_SYSEXIT },
{ PR_statfs64, FILTER_SYSEXIT },
+ { PR_statx, FILTER_SYSEXIT },
FILTERED_SYSNUM_END,
};
--
2.43.0
@@ -0,0 +1,51 @@
From 3e47c091e500b274b255d9b8d326236744aa4347 Mon Sep 17 00:00:00 2001
From: maxjivi05 <maxjividen@gmail.com>
Date: Wed, 28 Oct 2026 16:27:14 -0400
Subject: [PATCH] tracee: replace a stale tracee when the kernel reuses its pid
for a new child
---
src/tracee/tracee.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/src/tracee/tracee.c b/src/tracee/tracee.c
index 5029bbc..cbadaec 100644
--- a/src/tracee/tracee.c
+++ b/src/tracee/tracee.c
@@ -57,6 +57,8 @@ static Tracees buckets[TRACEE_BUCKETS];
static bool terminations_pending = false;
+static Tracees reused_pid_tracees;
+
static Tracees *bucket_of(pid_t pid)
{
return &buckets[(unsigned int) pid % TRACEE_BUCKETS];
@@ -599,6 +601,24 @@ static int new_child_setup(Tracee *parent, unsigned long pid, word_t clone_flags
Tracee *child;
child = get_tracee(parent, (pid_t) pid, true);
+ if (child != NULL
+ && (child->exe != NULL
+ || child->fs->cwd != NULL
+ || child->qemu != NULL
+ || child->glue != NULL
+ || child->parent != NULL
+ || child->as_ptracee.ptracer != NULL)) {
+ note(parent, WARNING, USER,
+ "pid %lu was reused before its previous task was released",
+ pid);
+ LIST_REMOVE(child, bucket_link);
+ LIST_INSERT_HEAD(&reused_pid_tracees, child, bucket_link);
+ if (child->as_ptracee.ptracer != NULL)
+ detach_from_ptracer(child);
+ child->terminated = true;
+ terminations_pending = true;
+ child = new_tracee((pid_t) pid);
+ }
if (child == NULL) {
note(parent, WARNING, SYSTEM, "running out of memory");
return -ENOMEM;
--
2.43.0