mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-24 15:26:04 +00:00
fix(hook): /dev/fd in a forked process names that process's own descriptors (#3105)
* fix(hook): /dev/fd in a forked process names that process's own descriptors The /dev/fd and /dev/std* binds point at /proc/self/fd. Their sources were resolved with realpath when the binds were loaded, which turned /proc/self into the loading process's pid. A child that forks without exec, such as a bash subshell running cat < <(...), then opened its parent's descriptors and failed with ENOENT. Sources under /proc keep their own path. * fix(hook): keep canonical bind sources for /proc paths that name no process * fix(hook): only /proc bind sources that name a process keep their form
This commit is contained in:
1 parent
8ee80aa20f
commit
5cb8e7fdf3
2 files changed
+34
-1
No files matched your search
@@ -82,7 +82,7 @@ static void ddnatv_load_binds(const char *spec) {
|
||||
char kernel_src[PATH_MAX];
|
||||
if (strcmp(src, dst) != 0) {
|
||||
ddnatv_kernel_path(src, strlen(src), kernel_src, sizeof(kernel_src));
|
||||
src = kernel_src;
|
||||
if (strncmp(kernel_src, "/proc/", 6) != 0 || kernel_src[6] < '0' || kernel_src[6] > '9') src = kernel_src;
|
||||
}
|
||||
b->src = strdup(src);
|
||||
b->dst = strdup(dst);
|
||||
|
||||
Reference in new issue
Block a user