From c58a2b2c01d63b4cee24a15af80a367061881abc 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 +++++++++++++++++++ srcpkgs/proot/template | 2 +- 2 files changed, 38 insertions(+), 1 deletion(-) 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 }, diff --git a/srcpkgs/proot/template b/srcpkgs/proot/template index 5ee9809c01e..f2d7baf8839 100644 --- a/srcpkgs/proot/template +++ b/srcpkgs/proot/template @@ -1,7 +1,7 @@ # Template file for 'proot' pkgname=proot version=5.1.0 -revision=6 +revision=7 build_wrksrc=src build_style=gnu-makefile make_use_env=yes