From 85c45852f3929906e26fbf54e6a0473a58f71d41 Mon Sep 17 00:00:00 2001 From: Emilio Cabrera Date: Tue, 24 Dec 2019 16:32:42 -0600 Subject: [PATCH] proot: fix undumpable tracees --- ...ent-tracees-from-becoming-undumpable.patch | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 srcpkgs/proot/patches/prevent-tracees-from-becoming-undumpable.patch diff --git a/srcpkgs/proot/patches/prevent-tracees-from-becoming-undumpable.patch b/srcpkgs/proot/patches/prevent-tracees-from-becoming-undumpable.patch new file mode 100644 index 00000000000..2b8fcce9234 --- /dev/null +++ b/srcpkgs/proot/patches/prevent-tracees-from-becoming-undumpable.patch @@ -0,0 +1,37 @@ +diff --git src/syscall/enter.c src/syscall/enter.c +--- src/syscall/enter.c ++++ src/syscall/enter.c +@@ -26,6 +26,7 @@ + #include /* SYS_*, */ + #include /* AT_FDCWD, */ + #include /* PATH_MAX, */ ++#include /* PR_SET_DUMPABLE */ + + #include "syscall/syscall.h" + #include "syscall/sysnum.h" +@@ -563,6 +564,14 @@ int translate_syscall_enter(Tracee *tracee) + + status = translate_path2(tracee, newdirfd, newpath, SYSARG_3, SYMLINK); + break; ++ case PR_prctl: ++ /* Prevent tracees from setting dumpable flag. ++ * (Otherwise it could break tracee memory access) */ ++ if (peek_reg(tracee, CURRENT, SYSARG_1) == PR_SET_DUMPABLE) { ++ set_sysnum(tracee, PR_void); ++ status = 0; ++ } ++ break; + } + + end: +diff --git src/syscall/seccomp.c src/syscall/seccomp.c +--- src/syscall/seccomp.c ++++ src/syscall/seccomp.c +@@ -377,6 +377,7 @@ static FilteredSysnum proot_sysnums[] = { + { PR_open, 0 }, + { PR_openat, 0 }, + { PR_pivot_root, 0 }, ++ { PR_prctl, 0 }, + { PR_ptrace, FILTER_SYSEXIT }, + { PR_readlink, FILTER_SYSEXIT }, + { PR_readlinkat, FILTER_SYSEXIT },