From b741218e919bfd386772322c1dcb286446bc4c90 Mon Sep 17 00:00:00 2001 From: Josselin Poiret Date: Fri, 2 Jun 2023 21:59:48 +0200 Subject: gnu: proot: Update to 5.4.0 and fix clone3 behavior. * gnu/packages/patches/proot-add-clone3.patch: New patch. * gnu/packages/linux.scm (proot): Update to 5.4.0, and add pending upstream patch to fix buggy pthread support. * gnu/local.mk (dist_patch_DATA): Register it. --- gnu/local.mk | 1 + gnu/packages/linux.scm | 7 +- gnu/packages/patches/proot-add-clone3.patch | 114 ++++++++++++++++++++++++++++ 3 files changed, 120 insertions(+), 2 deletions(-) create mode 100644 gnu/packages/patches/proot-add-clone3.patch diff --git a/gnu/local.mk b/gnu/local.mk index 7aa4f72d32..7be3cc5464 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1750,6 +1750,7 @@ dist_patch_DATA = \ %D%/packages/patches/procmail-ambiguous-getline-debian.patch \ %D%/packages/patches/procmail-CVE-2014-3618.patch \ %D%/packages/patches/procmail-CVE-2017-16844.patch \ + %D%/packages/patches/proot-add-clone3.patch \ %D%/packages/patches/protobuf-fix-build-on-32bit.patch \ %D%/packages/patches/psm-arch.patch \ %D%/packages/patches/psm-disable-memory-stats.patch \ diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm index fc6f3cbda5..501ac9d19c 100644 --- a/gnu/packages/linux.scm +++ b/gnu/packages/linux.scm @@ -8159,7 +8159,7 @@ Text-based output formats: CSV, XML, Netfilter's LOG, Netfilter's conntrack (define-public proot (package (name "proot") - (version "5.3.0") + (version "5.4.0") (source (origin (method git-fetch) @@ -8168,7 +8168,10 @@ Text-based output formats: CSV, XML, Netfilter's LOG, Netfilter's conntrack (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 - (base32 "1r1ga3xbwq5kx4i8ihj1p6nmgaa14lfkwxzpsbdcmfh1jimpbmzk")))) + (base32 "186qsg4yvisqjgf8w5jxhnlig7x341vpqwcgp8as3r59qmqkpmk7")) + ;; Waiting for upstream inclusion at + ;; https://github.com/proot-me/proot/pull/355 + (patches (search-patches "proot-add-clone3.patch")))) (build-system gnu-build-system) ;; Many architectures are not supported (see: ;; https://github.com/proot-me/proot/blob/master/src/arch.h#L51). diff --git a/gnu/packages/patches/proot-add-clone3.patch b/gnu/packages/patches/proot-add-clone3.patch new file mode 100644 index 0000000000..c09d99a743 --- /dev/null +++ b/gnu/packages/patches/proot-add-clone3.patch @@ -0,0 +1,114 @@ +From 4699a580ca1aeecd35742494eb0259ee962e89a8 Mon Sep 17 00:00:00 2001 +Message-Id: <4699a580ca1aeecd35742494eb0259ee962e89a8.1685735399.git.dev@jpoiret.xyz> +From: Josselin Poiret +Date: Fri, 2 Jun 2023 21:42:31 +0200 +Subject: [PATCH] Add clone3. + +From: Josselin Poiret + +--- + src/syscall/sysnums-arm.h | 1 + + src/syscall/sysnums-arm64.h | 1 + + src/syscall/sysnums-i386.h | 1 + + src/syscall/sysnums-sh4.h | 1 + + src/syscall/sysnums-x32.h | 1 + + src/syscall/sysnums-x86_64.h | 1 + + src/syscall/sysnums.list | 1 + + src/tracee/tracee.c | 4 ++++ + 8 files changed, 11 insertions(+) + +diff --git a/src/syscall/sysnums-arm.h b/src/syscall/sysnums-arm.h +index dfd512f..306e2b1 100644 +--- a/src/syscall/sysnums-arm.h ++++ b/src/syscall/sysnums-arm.h +@@ -341,4 +341,5 @@ static const Sysnum sysnums_arm[] = { + [ 382 ] = PR_renameat2, + [ 397 ] = PR_statx, + [ 412 ] = PR_utimensat_time64, ++ [ 435 ] = PR_clone3, + }; +diff --git a/src/syscall/sysnums-arm64.h b/src/syscall/sysnums-arm64.h +index dfb9889..65ccc4e 100644 +--- a/src/syscall/sysnums-arm64.h ++++ b/src/syscall/sysnums-arm64.h +@@ -264,4 +264,5 @@ static const Sysnum sysnums_arm64[] = { + [ 275 ] = PR_sched_getattr, + [ 276 ] = PR_renameat2, + [ 291 ] = PR_statx, ++ [ 435 ] = PR_clone3, + }; +diff --git a/src/syscall/sysnums-i386.h b/src/syscall/sysnums-i386.h +index 3bbb70e..0f3daf2 100644 +--- a/src/syscall/sysnums-i386.h ++++ b/src/syscall/sysnums-i386.h +@@ -353,4 +353,5 @@ static const Sysnum sysnums_i386[] = { + [ 353 ] = PR_renameat2, + [ 383 ] = PR_statx, + [ 412 ] = PR_utimensat_time64, ++ [ 435 ] = PR_clone3, + }; +diff --git a/src/syscall/sysnums-sh4.h b/src/syscall/sysnums-sh4.h +index 1d3758c..09acca6 100644 +--- a/src/syscall/sysnums-sh4.h ++++ b/src/syscall/sysnums-sh4.h +@@ -344,4 +344,5 @@ static const Sysnum sysnums_sh4[] = { + [ 369 ] = PR_sched_setattr, + [ 370 ] = PR_sched_getattr, + [ 371 ] = PR_renameat2, ++ [ 435 ] = PR_clone3, + }; +diff --git a/src/syscall/sysnums-x32.h b/src/syscall/sysnums-x32.h +index 448c699..a9fdb48 100644 +--- a/src/syscall/sysnums-x32.h ++++ b/src/syscall/sysnums-x32.h +@@ -277,6 +277,7 @@ static const Sysnum sysnums_x32[] = { + [ 315 ] = PR_sched_getattr, + [ 316 ] = PR_renameat2, + [ 332 ] = PR_statx, ++ [ 435 ] = PR_clone3, + [ 439 ] = PR_faccessat2, + [ 512 ] = PR_rt_sigaction, + [ 513 ] = PR_rt_sigreturn, +diff --git a/src/syscall/sysnums-x86_64.h b/src/syscall/sysnums-x86_64.h +index 92229f8..9840b4a 100644 +--- a/src/syscall/sysnums-x86_64.h ++++ b/src/syscall/sysnums-x86_64.h +@@ -319,5 +319,6 @@ static const Sysnum sysnums_x86_64[] = { + [ 315 ] = PR_sched_getattr, + [ 316 ] = PR_renameat2, + [ 332 ] = PR_statx, ++ [ 435 ] = PR_clone3, + [ 439 ] = PR_faccessat2, + }; +diff --git a/src/syscall/sysnums.list b/src/syscall/sysnums.list +index 1d6e666..2b6c9b2 100644 +--- a/src/syscall/sysnums.list ++++ b/src/syscall/sysnums.list +@@ -38,6 +38,7 @@ SYSNUM(clock_gettime) + SYSNUM(clock_nanosleep) + SYSNUM(clock_settime) + SYSNUM(clone) ++SYSNUM(clone3) + SYSNUM(close) + SYSNUM(connect) + SYSNUM(creat) +diff --git a/src/tracee/tracee.c b/src/tracee/tracee.c +index 58ab7df..9b16f6a 100644 +--- a/src/tracee/tracee.c ++++ b/src/tracee/tracee.c +@@ -403,6 +403,10 @@ int new_child(Tracee *parent, word_t clone_flags) + status = fetch_regs(parent); + if (status >= 0 && get_sysnum(parent, CURRENT) == PR_clone) + clone_flags = peek_reg(parent, CURRENT, SYSARG_1); ++ else if (status >= 0 && get_sysnum(parent, CURRENT) == PR_clone3) ++ // Look at the first word of the clone_args structure, which ++ // contains the usual clone flags. ++ clone_flags = peek_word(parent, peek_reg(parent, CURRENT, SYSARG_1)); + + /* Get the pid of the parent's new child. */ + status = ptrace(PTRACE_GETEVENTMSG, parent->pid, NULL, &pid); + +base-commit: bd5a5f63d72f8210d8cee76195eb9f0749e5bd70 +-- +2.40.1 + -- cgit v1.2.3