From acdb7e6732b068cb105aaf7f7b383d6055a002b6 Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Thu, 11 May 2023 18:29:00 +0200 Subject: [PATCH] test patch Signed-off-by: CrazyMax --- Dockerfile | 2 +- docker-bake.hcl | 2 +- ...1-linux-user-pass-SUBREAPER-to-prctl.patch | 35 +++++++++++++++++++ 3 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 patches/subreaper-prctl/0001-linux-user-pass-SUBREAPER-to-prctl.patch diff --git a/Dockerfile b/Dockerfile index 87eecca5..59a3abfc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,7 +18,7 @@ ARG QEMU_REPO RUN git clone $QEMU_REPO && cd qemu && git checkout $QEMU_VERSION COPY patches patches # QEMU_PATCHES defines additional patches to apply before compilation -ARG QEMU_PATCHES=cpu-max +ARG QEMU_PATCHES=cpu-max,subreaper-prctl # QEMU_PATCHES_ALL defines all patches to apply before compilation ARG QEMU_PATCHES_ALL=${QEMU_PATCHES},alpine-patches ARG QEMU_PRESERVE_ARGV0 diff --git a/docker-bake.hcl b/docker-bake.hcl index 5ebe07f8..e142657b 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -8,7 +8,7 @@ variable "QEMU_VERSION" { default = "v7.1.0" } variable "QEMU_PATCHES" { - default = "cpu-max" + default = "cpu-max,subreaper-prctl" } // Special target: https://github.com/docker/metadata-action#bake-definition diff --git a/patches/subreaper-prctl/0001-linux-user-pass-SUBREAPER-to-prctl.patch b/patches/subreaper-prctl/0001-linux-user-pass-SUBREAPER-to-prctl.patch new file mode 100644 index 00000000..8bdd56f0 --- /dev/null +++ b/patches/subreaper-prctl/0001-linux-user-pass-SUBREAPER-to-prctl.patch @@ -0,0 +1,35 @@ +From fb2d9448acae73a193aede5b6c966e2e578987e6 Mon Sep 17 00:00:00 2001 +From: CrazyMax +Date: Thu, 11 May 2023 18:23:03 +0200 +Subject: [PATCH] linux-user: pass SUBREAPER to prctl + +Reaper status can be aquired by using prctl() with +PR_*_CHILD_SUBREAPER on linux. Signal will be delivered +to every descendant process. + +Signed-off-by: CrazyMax +--- + linux-user/syscall.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/linux-user/syscall.c b/linux-user/syscall.c +index b8a75f35d2..4c66d9fe37 100644 +--- a/linux-user/syscall.c ++++ b/linux-user/syscall.c +@@ -6548,11 +6548,11 @@ static abi_long do_prctl(CPUArchState *env, abi_long option, abi_long arg2, + case PR_SET_NO_NEW_PRIVS: + case PR_GET_IO_FLUSHER: + case PR_SET_IO_FLUSHER: ++ case PR_GET_CHILD_SUBREAPER: ++ case PR_SET_CHILD_SUBREAPER: + /* Some prctl options have no pointer arguments and we can pass on. */ + return get_errno(prctl(option, arg2, arg3, arg4, arg5)); + +- case PR_GET_CHILD_SUBREAPER: +- case PR_SET_CHILD_SUBREAPER: + case PR_GET_SPECULATION_CTRL: + case PR_SET_SPECULATION_CTRL: + case PR_GET_TID_ADDRESS: +-- +2.34.0 +