fix(desktop): Go programs see the session's identity and paths (#3154)

* fix(desktop): Go programs see the session's identity and paths

Static Go programs now get the session's root identity from getuid and its
relatives, and set*id calls succeed, as C and x86 programs already do. The
added code also takes over Go's second raw system call function (and its
golang.org/x/sys copy), which getuid goes through.

Go programs that link the C library (snapd, gocryptfs, ipp-usb) get the same
code: their Go note is found past the other notes, and the code fits before
a data segment that does not start on a page boundary. snap now reaches the
session's snapd and installs snaps.

* fix(desktop): read every Go note and retry Go programs after a failed scan
This commit is contained in:
MaxsTechReview authored and GitHub committed 2026-11-24 14:07:01 -05:00
1 parent 5f8655b13e
commit e709e1c454
6 files changed
+250 -54

No files matched your search

+2 -2
View File
@@ -407,7 +407,7 @@ static int ddnatv_execve(const char *filename, char *const argv[], char *const e
if (probe.is_elf && !probe.is_dynamic) static_elf = elf_target;
// A Go program built for Android asks for Android's linker, so it is started like the dynamic
// ones, but it makes its own system calls: it gets the code of the static Go programs (#42)
if (probe.is_dynamic && probe.android_interp) prepare_static_program_ex(elf_target, 1);
if (probe.is_dynamic) prepare_static_program_ex(elf_target, 1);
// 1. Transparently route dynamically linked glibc ELF binaries through ld.so
// Note: Statically linked binaries (PT_INTERP absent, e.g. Meta Muse Code) must execute directly!
@@ -959,7 +959,7 @@ static int ddnatv_posix_spawn(pid_t *pid, const char *path,
int ret = -1;
if (via_ld_so) {
ensure_exec_bit(elf_target, probe.mode);
if (probe.android_interp) prepare_static_program_ex(elf_target, 1); // a Go program built for Android (#42)
prepare_static_program_ex(elf_target, 1); // a Go program built for Android (#42)
char hook_buf[PATH_MAX];
const char *hook_so = ddnatv_hook_library(hook_buf, sizeof(hook_buf));