From 3ebad9ae306ccbec36f8185b32266987ef5e34c1 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Tue, 28 Jan 2020 15:00:03 +0000 Subject: [PATCH 001/109] - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- criu.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/criu.spec b/criu.spec index e8c6bba..c448646 100644 --- a/criu.spec +++ b/criu.spec @@ -12,7 +12,7 @@ Name: criu Version: 3.13 -Release: 5%{?dist} +Release: 6%{?dist} Provides: crtools = %{version}-%{release} Obsoletes: crtools <= 1.0-2 Summary: Tool for Checkpoint/Restore in User-space @@ -178,6 +178,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %changelog +* Tue Jan 28 2020 Fedora Release Engineering - 3.13-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + * Mon Sep 16 2019 Adrian Reber - 3.13-5 - Update to 3.13 (#1751146) - Drop upstreamed patches From 4aee6c5a232dc534611350a4922f7a29ba9a2b93 Mon Sep 17 00:00:00 2001 From: Andrei Vagin Date: Sat, 28 Mar 2020 23:39:06 -0700 Subject: [PATCH 002/109] Fix building on FC33 Signed-off-by: Andrei Vagin --- cr-service-fix.patch | 74 ++++++++++++++++++++++++++++++++++++++++++++ criu.spec | 9 +++++- 2 files changed, 82 insertions(+), 1 deletion(-) create mode 100644 cr-service-fix.patch diff --git a/cr-service-fix.patch b/cr-service-fix.patch new file mode 100644 index 0000000..020c40b --- /dev/null +++ b/cr-service-fix.patch @@ -0,0 +1,74 @@ +commit af9157ff696c4c7b45d9d4a47f8d7e71fa8c71bc +Author: Sergei Trofimovich +Date: Sun Feb 2 18:45:59 2020 +0000 + + criu: fix build failure against gcc-10 + + On gcc-10 (and gcc-9 -fno-common) build fails as: + + ``` + ld: criu/arch/x86/crtools.o:criu/include/cr_options.h:159: + multiple definition of `rpc_cfg_file'; criu/arch/x86/cpu.o:criu/include/cr_options.h:159: first defined here + make[2]: *** [scripts/nmk/scripts/build.mk:164: criu/arch/x86/crtools.built-in.o] Error 1 + ``` + + gcc-10 will change the default from -fcommon to fno-common: + https://gcc.gnu.org/PR85678. + + The error also happens if CFLAGS=-fno-common passed explicitly. + + Reported-by: Toralf Förster + Bug: https://bugs.gentoo.org/707942 + Signed-off-by: Sergei Trofimovich + +diff --git a/criu/config.c b/criu/config.c +index 6fb6bfdff..df5d85162 100644 +--- a/criu/config.c ++++ b/criu/config.c +@@ -30,6 +30,7 @@ + #include "common/xmalloc.h" + + struct cr_options opts; ++char *rpc_cfg_file; + + static int count_elements(char **to_count) + { +diff --git a/criu/include/cr_options.h b/criu/include/cr_options.h +index a7b040fbf..e02848d2d 100644 +--- a/criu/include/cr_options.h ++++ b/criu/include/cr_options.h +@@ -147,7 +147,7 @@ struct cr_options { + }; + + extern struct cr_options opts; +-char *rpc_cfg_file; ++extern char *rpc_cfg_file; + + extern int parse_options(int argc, char **argv, bool *usage_error, bool *has_exec_cmd, int state); + extern int check_options(); +diff --git a/criu/include/pstree.h b/criu/include/pstree.h +index 7303c1fed..61ab0ce0e 100644 +--- a/criu/include/pstree.h ++++ b/criu/include/pstree.h +@@ -42,7 +42,7 @@ enum { + }; + #define FDS_EVENT (1 << FDS_EVENT_BIT) + +-struct pstree_item *current; ++extern struct pstree_item *current; + + struct rst_info; + /* See alloc_pstree_item() for details */ +diff --git a/criu/include/tun.h b/criu/include/tun.h +index ce0b266a6..b82c445a7 100644 +--- a/criu/include/tun.h ++++ b/criu/include/tun.h +@@ -5,7 +5,7 @@ + #define TUN_MINOR 200 + #endif + +-struct ns_id *ns; ++extern struct ns_id *ns; + + #include + diff --git a/criu.spec b/criu.spec index c448646..869b9d5 100644 --- a/criu.spec +++ b/criu.spec @@ -12,7 +12,7 @@ Name: criu Version: 3.13 -Release: 6%{?dist} +Release: 7%{?dist} Provides: crtools = %{version}-%{release} Obsoletes: crtools <= 1.0-2 Summary: Tool for Checkpoint/Restore in User-space @@ -32,6 +32,8 @@ Source3: compel.1 Patch100: aio-fix.patch %endif +Patch101: cr-service-fix.patch + Source4: criu-tmpfiles.conf BuildRequires: gcc @@ -105,6 +107,8 @@ their content in human-readable form. %patch100 -p1 %endif +%patch101 -p1 + %build # %{?_smp_mflags} does not work # -fstack-protector breaks build @@ -178,6 +182,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %changelog +* Sun Mar 29 2020 Andrei Vagin - 3.13-7 +- Added patch for gcc-10 + * Tue Jan 28 2020 Fedora Release Engineering - 3.13-6 - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild From 439202d427098979dc57650e3a5fb2c56e48d0db Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Wed, 29 Apr 2020 17:54:25 +0200 Subject: [PATCH 003/109] Update to 3.14 (#1829399) Signed-off-by: Adrian Reber --- .gitignore | 1 + cr-service-fix.patch | 74 -------------------------------------------- criu.spec | 12 +++---- sources | 2 +- 4 files changed, 8 insertions(+), 81 deletions(-) delete mode 100644 cr-service-fix.patch diff --git a/.gitignore b/.gitignore index 2ca982a..51c5970 100644 --- a/.gitignore +++ b/.gitignore @@ -47,3 +47,4 @@ /criu-3.11.tar.bz2 /criu-3.12.tar.bz2 /criu-3.13.tar.bz2 +/criu-3.14.tar.bz2 diff --git a/cr-service-fix.patch b/cr-service-fix.patch deleted file mode 100644 index 020c40b..0000000 --- a/cr-service-fix.patch +++ /dev/null @@ -1,74 +0,0 @@ -commit af9157ff696c4c7b45d9d4a47f8d7e71fa8c71bc -Author: Sergei Trofimovich -Date: Sun Feb 2 18:45:59 2020 +0000 - - criu: fix build failure against gcc-10 - - On gcc-10 (and gcc-9 -fno-common) build fails as: - - ``` - ld: criu/arch/x86/crtools.o:criu/include/cr_options.h:159: - multiple definition of `rpc_cfg_file'; criu/arch/x86/cpu.o:criu/include/cr_options.h:159: first defined here - make[2]: *** [scripts/nmk/scripts/build.mk:164: criu/arch/x86/crtools.built-in.o] Error 1 - ``` - - gcc-10 will change the default from -fcommon to fno-common: - https://gcc.gnu.org/PR85678. - - The error also happens if CFLAGS=-fno-common passed explicitly. - - Reported-by: Toralf Förster - Bug: https://bugs.gentoo.org/707942 - Signed-off-by: Sergei Trofimovich - -diff --git a/criu/config.c b/criu/config.c -index 6fb6bfdff..df5d85162 100644 ---- a/criu/config.c -+++ b/criu/config.c -@@ -30,6 +30,7 @@ - #include "common/xmalloc.h" - - struct cr_options opts; -+char *rpc_cfg_file; - - static int count_elements(char **to_count) - { -diff --git a/criu/include/cr_options.h b/criu/include/cr_options.h -index a7b040fbf..e02848d2d 100644 ---- a/criu/include/cr_options.h -+++ b/criu/include/cr_options.h -@@ -147,7 +147,7 @@ struct cr_options { - }; - - extern struct cr_options opts; --char *rpc_cfg_file; -+extern char *rpc_cfg_file; - - extern int parse_options(int argc, char **argv, bool *usage_error, bool *has_exec_cmd, int state); - extern int check_options(); -diff --git a/criu/include/pstree.h b/criu/include/pstree.h -index 7303c1fed..61ab0ce0e 100644 ---- a/criu/include/pstree.h -+++ b/criu/include/pstree.h -@@ -42,7 +42,7 @@ enum { - }; - #define FDS_EVENT (1 << FDS_EVENT_BIT) - --struct pstree_item *current; -+extern struct pstree_item *current; - - struct rst_info; - /* See alloc_pstree_item() for details */ -diff --git a/criu/include/tun.h b/criu/include/tun.h -index ce0b266a6..b82c445a7 100644 ---- a/criu/include/tun.h -+++ b/criu/include/tun.h -@@ -5,7 +5,7 @@ - #define TUN_MINOR 200 - #endif - --struct ns_id *ns; -+extern struct ns_id *ns; - - #include - diff --git a/criu.spec b/criu.spec index 869b9d5..8782ffd 100644 --- a/criu.spec +++ b/criu.spec @@ -11,8 +11,8 @@ %undefine _annotated_build Name: criu -Version: 3.13 -Release: 7%{?dist} +Version: 3.14 +Release: 1%{?dist} Provides: crtools = %{version}-%{release} Obsoletes: crtools <= 1.0-2 Summary: Tool for Checkpoint/Restore in User-space @@ -32,8 +32,6 @@ Source3: compel.1 Patch100: aio-fix.patch %endif -Patch101: cr-service-fix.patch - Source4: criu-tmpfiles.conf BuildRequires: gcc @@ -44,6 +42,7 @@ BuildRequires: protobuf-devel protobuf-c-devel %{py_prefix}-devel libnl3-devel l BuildRequires: asciidoc xmlto BuildRequires: perl-interpreter BuildRequires: libselinux-devel +BuildRequires: gnutls-devel # Checkpointing containers with a tmpfs requires tar Recommends: tar %if 0%{?fedora} @@ -107,8 +106,6 @@ their content in human-readable form. %patch100 -p1 %endif -%patch101 -p1 - %build # %{?_smp_mflags} does not work # -fstack-protector breaks build @@ -182,6 +179,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %changelog +* Wed Apr 29 2020 Adrian Reber - 3.14-1 +- Update to 3.14 (#1829399) + * Sun Mar 29 2020 Andrei Vagin - 3.13-7 - Added patch for gcc-10 diff --git a/sources b/sources index 0d69e96..dd37549 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (criu-3.13.tar.bz2) = ef93ec9977512711fbcedd52807cc91b1ab582f1c031c4beda93dac7530ccf40bca45b3dee6b5d08a676ec28036caa55ad3746c450265429880e114fde0a071d +SHA512 (criu-3.14.tar.bz2) = 97d064c5ffc41daf6e89edd6208b30e4198f313afc6d621d0dc74dadf94c303be70ba448d4e1ced9500f1c65f1bd12206eb88883be398911cc2c995310b17cc6 From 093f8b4513016427781231995f20e1213b722370 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Wed, 29 Apr 2020 19:07:21 +0200 Subject: [PATCH 004/109] Remove selinux rules from test and fix name of tests in gating.yaml Signed-off-by: Adrian Reber --- gating.yaml | 4 ++-- tests/run-podman-checkpoint-restore.sh | 24 ------------------------ 2 files changed, 2 insertions(+), 26 deletions(-) diff --git a/gating.yaml b/gating.yaml index 4b4c460..c80192d 100644 --- a/gating.yaml +++ b/gating.yaml @@ -3,10 +3,10 @@ product_versions: - fedora-* decision_context: bodhi_update_push_testing rules: - - !PassingTestCaseRule {test_case_name: org.centos.prod.ci.pipeline.allpackages-build.package.test.functional.complete } + - !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional } --- !Policy product_versions: - fedora-* decision_context: bodhi_update_push_stable rules: - - !PassingTestCaseRule {test_case_name: org.centos.prod.ci.pipeline.allpackages-build.package.test.functional.complete } + - !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional } diff --git a/tests/run-podman-checkpoint-restore.sh b/tests/run-podman-checkpoint-restore.sh index 0e082b4..525755f 100755 --- a/tests/run-podman-checkpoint-restore.sh +++ b/tests/run-podman-checkpoint-restore.sh @@ -4,30 +4,6 @@ set -eux ls -la -echo "Load additional SELinux policy for checkpointing" - -# Add missing selinux policy -cat << EOF > criu.te - -module criu 1.0; - -require { - type container_t; - type container_var_lib_t; - type sysctl_kernel_ns_last_pid_t; - class file { append write }; -} - -allow container_t sysctl_kernel_ns_last_pid_t:file write; -allow container_t container_var_lib_t:file append; -EOF - -cat criu.te - -checkmodule -M -m criu.te -o criu.mod -semodule_package -o criu.pp -m criu.mod -#semodule -i criu.pp - echo "Start container with tomcat" podman --log-level debug run --tmpfs /tmp --tmpfs /usr/local/tomcat/logs -d docker://docker.io/yovfiatbeb/podman-criu-test From 224305f6517b680c609e548e24174149341479cb Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Thu, 30 Apr 2020 09:30:26 +0200 Subject: [PATCH 005/109] Rebuild for CI fixes --- criu.spec | 5 ++++- tests/tests.yml | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/criu.spec b/criu.spec index 8782ffd..6314b89 100644 --- a/criu.spec +++ b/criu.spec @@ -12,7 +12,7 @@ Name: criu Version: 3.14 -Release: 1%{?dist} +Release: 2%{?dist} Provides: crtools = %{version}-%{release} Obsoletes: crtools <= 1.0-2 Summary: Tool for Checkpoint/Restore in User-space @@ -179,6 +179,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %changelog +* Thu Apr 30 2020 Adrian Reber - 3.14-2 +- Rebuild for CI fixes + * Wed Apr 29 2020 Adrian Reber - 3.14-1 - Update to 3.14 (#1829399) diff --git a/tests/tests.yml b/tests/tests.yml index 8a4fa80..8571458 100644 --- a/tests/tests.yml +++ b/tests/tests.yml @@ -23,6 +23,7 @@ - libnl3-devel - libcap-devel - libaio-devel + - nftables-devel - python3-pyyaml - python3-protobuf tests: From 57532bef37d28fe2eaa8a02e6a7b25013ee3b3f8 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Thu, 30 Apr 2020 11:17:07 +0200 Subject: [PATCH 006/109] BuildRequire nftables-devel for working CI --- criu.spec | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/criu.spec b/criu.spec index 6314b89..5d670f2 100644 --- a/criu.spec +++ b/criu.spec @@ -12,7 +12,7 @@ Name: criu Version: 3.14 -Release: 2%{?dist} +Release: 3%{?dist} Provides: crtools = %{version}-%{release} Obsoletes: crtools <= 1.0-2 Summary: Tool for Checkpoint/Restore in User-space @@ -43,6 +43,7 @@ BuildRequires: asciidoc xmlto BuildRequires: perl-interpreter BuildRequires: libselinux-devel BuildRequires: gnutls-devel +BuildRequires: nftables-devel # Checkpointing containers with a tmpfs requires tar Recommends: tar %if 0%{?fedora} @@ -179,6 +180,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %changelog +* Thu Apr 30 2020 Adrian Reber - 3.14-3 +- BuildRequire nftables-devel for working CI + * Thu Apr 30 2020 Adrian Reber - 3.14-2 - Rebuild for CI fixes From 618762a76d5209b36b7c906cd7724bba34019e32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Tue, 26 May 2020 02:43:22 +0200 Subject: [PATCH 007/109] Rebuilt for Python 3.9 --- criu.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/criu.spec b/criu.spec index 5d670f2..324ec8e 100644 --- a/criu.spec +++ b/criu.spec @@ -12,7 +12,7 @@ Name: criu Version: 3.14 -Release: 3%{?dist} +Release: 4%{?dist} Provides: crtools = %{version}-%{release} Obsoletes: crtools <= 1.0-2 Summary: Tool for Checkpoint/Restore in User-space @@ -180,6 +180,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %changelog +* Tue May 26 2020 Miro Hrončok - 3.14-4 +- Rebuilt for Python 3.9 + * Thu Apr 30 2020 Adrian Reber - 3.14-3 - BuildRequire nftables-devel for working CI From 51a8f079885b857c887001a4a46cdb666be71528 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Sun, 21 Jun 2020 17:25:21 +0200 Subject: [PATCH 008/109] Rebuilt for protobuf 3.12 --- criu.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/criu.spec b/criu.spec index 324ec8e..a7768cf 100644 --- a/criu.spec +++ b/criu.spec @@ -12,7 +12,7 @@ Name: criu Version: 3.14 -Release: 4%{?dist} +Release: 5%{?dist} Provides: crtools = %{version}-%{release} Obsoletes: crtools <= 1.0-2 Summary: Tool for Checkpoint/Restore in User-space @@ -180,6 +180,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %changelog +* Sun Jun 14 2020 Adrian Reber - 3.14-5 +- Rebuilt for protobuf 3.12 + * Tue May 26 2020 Miro Hrončok - 3.14-4 - Rebuilt for Python 3.9 From 04fdd60758a8cdb0933fe4664cbc6088a80b59d7 Mon Sep 17 00:00:00 2001 From: Jeff Law Date: Tue, 14 Jul 2020 11:44:25 -0600 Subject: [PATCH 009/109] Disable LTO --- criu.spec | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/criu.spec b/criu.spec index a7768cf..ad0efe5 100644 --- a/criu.spec +++ b/criu.spec @@ -12,7 +12,7 @@ Name: criu Version: 3.14 -Release: 5%{?dist} +Release: 6%{?dist} Provides: crtools = %{version}-%{release} Obsoletes: crtools <= 1.0-2 Summary: Tool for Checkpoint/Restore in User-space @@ -108,6 +108,10 @@ their content in human-readable form. %endif %build +# This package calls LD directly without specifying the LTO plugins. Until +# that is fixed, disable LTO. +%define _lto_cflags %{nil} + # %{?_smp_mflags} does not work # -fstack-protector breaks build CFLAGS+=`echo %{optflags} | sed -e 's,-fstack-protector\S*,,g'` make V=1 WERROR=0 PREFIX=%{_prefix} RUNDIR=/run/criu PYTHON=%{py_binary} @@ -180,6 +184,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %changelog +* Tue Jul 14 2020 Jeff Law - 3.14-6 +- Disable LTO + * Sun Jun 14 2020 Adrian Reber - 3.14-5 - Rebuilt for protobuf 3.12 From b9a27e26d532057e797dff18c1ca2ebfb77a54a0 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Mon, 27 Jul 2020 14:43:42 +0000 Subject: [PATCH 010/109] - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- criu.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/criu.spec b/criu.spec index ad0efe5..baa76c2 100644 --- a/criu.spec +++ b/criu.spec @@ -12,7 +12,7 @@ Name: criu Version: 3.14 -Release: 6%{?dist} +Release: 7%{?dist} Provides: crtools = %{version}-%{release} Obsoletes: crtools <= 1.0-2 Summary: Tool for Checkpoint/Restore in User-space @@ -184,6 +184,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %changelog +* Mon Jul 27 2020 Fedora Release Engineering - 3.14-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + * Tue Jul 14 2020 Jeff Law - 3.14-6 - Disable LTO From f5835fc9be37013ad11a7e6f433cce21ca56ec97 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Wed, 23 Sep 2020 18:05:12 +0200 Subject: [PATCH 011/109] Rebuilt for protobuf 3.13 --- criu.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/criu.spec b/criu.spec index baa76c2..bd13568 100644 --- a/criu.spec +++ b/criu.spec @@ -12,7 +12,7 @@ Name: criu Version: 3.14 -Release: 7%{?dist} +Release: 8%{?dist} Provides: crtools = %{version}-%{release} Obsoletes: crtools <= 1.0-2 Summary: Tool for Checkpoint/Restore in User-space @@ -184,6 +184,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %changelog +* Wed Sep 23 2020 Adrian Reber - 3.14-8 +- Rebuilt for protobuf 3.13 + * Mon Jul 27 2020 Fedora Release Engineering - 3.14-7 - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild From 32cc39745b40f17c7ccb7a6e52b3cfbe2d67ad0a Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Mon, 9 Nov 2020 08:29:24 +0100 Subject: [PATCH 012/109] Update to 3.15 --- .gitignore | 1 + criu.spec | 7 +++++-- sources | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 51c5970..daa1199 100644 --- a/.gitignore +++ b/.gitignore @@ -48,3 +48,4 @@ /criu-3.12.tar.bz2 /criu-3.13.tar.bz2 /criu-3.14.tar.bz2 +/criu-3.15.tar.bz2 diff --git a/criu.spec b/criu.spec index bd13568..e9bd9a3 100644 --- a/criu.spec +++ b/criu.spec @@ -11,8 +11,8 @@ %undefine _annotated_build Name: criu -Version: 3.14 -Release: 8%{?dist} +Version: 3.15 +Release: 1%{?dist} Provides: crtools = %{version}-%{release} Obsoletes: crtools <= 1.0-2 Summary: Tool for Checkpoint/Restore in User-space @@ -184,6 +184,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %changelog +* Wed Nov 04 2020 Adrian Reber - 3.15-1 +- Update to 3.15 + * Wed Sep 23 2020 Adrian Reber - 3.14-8 - Rebuilt for protobuf 3.13 diff --git a/sources b/sources index dd37549..551a2a9 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (criu-3.14.tar.bz2) = 97d064c5ffc41daf6e89edd6208b30e4198f313afc6d621d0dc74dadf94c303be70ba448d4e1ced9500f1c65f1bd12206eb88883be398911cc2c995310b17cc6 +SHA512 (criu-3.15.tar.bz2) = 7bfd32053e47b95d10cdd5e99494bff6a21aa3179518179f8c72e870f0aab960dd76c9f6cb6982e5b881472cf6962eefee3cf7d8ae9128b3379bcaecc937ebbc From db745523d7dbdbfaba57f0852162e522b7763572 Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Sat, 19 Dec 2020 05:29:27 +0000 Subject: [PATCH 013/109] Add BuildRequires: make https://fedoraproject.org/wiki/Changes/Remove_make_from_BuildRoot --- criu.spec | 1 + 1 file changed, 1 insertion(+) diff --git a/criu.spec b/criu.spec index e9bd9a3..2cb0521 100644 --- a/criu.spec +++ b/criu.spec @@ -50,6 +50,7 @@ Recommends: tar BuildRequires: libbsd-devel %endif %endif +BuildRequires: make # user-space and kernel changes are only available for x86_64, arm, # ppc64le, aarch64 and s390x From f0b8274e99116140bbae8fb6fd276baf2e011dfb Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Wed, 13 Jan 2021 09:45:18 +0100 Subject: [PATCH 014/109] Rebuilt for protobuf 3.14 --- criu.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/criu.spec b/criu.spec index 2cb0521..5728a47 100644 --- a/criu.spec +++ b/criu.spec @@ -12,7 +12,7 @@ Name: criu Version: 3.15 -Release: 1%{?dist} +Release: 2%{?dist} Provides: crtools = %{version}-%{release} Obsoletes: crtools <= 1.0-2 Summary: Tool for Checkpoint/Restore in User-space @@ -185,6 +185,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %changelog +* Wed Jan 13 09:45:16 CET 2021 Adrian Reber - 3.15-2 +- Rebuilt for protobuf 3.14 + * Wed Nov 04 2020 Adrian Reber - 3.15-1 - Update to 3.15 From 2b165c960a3db0a573f9cc1554f8f7bb2dce45a8 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Tue, 26 Jan 2021 02:42:15 +0000 Subject: [PATCH 015/109] - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- criu.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/criu.spec b/criu.spec index 5728a47..445c9b2 100644 --- a/criu.spec +++ b/criu.spec @@ -12,7 +12,7 @@ Name: criu Version: 3.15 -Release: 2%{?dist} +Release: 3%{?dist} Provides: crtools = %{version}-%{release} Obsoletes: crtools <= 1.0-2 Summary: Tool for Checkpoint/Restore in User-space @@ -185,6 +185,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %changelog +* Tue Jan 26 2021 Fedora Release Engineering - 3.15-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + * Wed Jan 13 09:45:16 CET 2021 Adrian Reber - 3.15-2 - Rebuilt for protobuf 3.14 From 22fc6f3ec2b81552639ace80fd67ab020a01fb85 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Fri, 9 Apr 2021 18:05:28 +0200 Subject: [PATCH 016/109] Test for testing Signed-off-by: Adrian Reber --- criu.spec | 5 ++++- gating.yaml | 10 ++++++---- tests/run-podman-checkpoint-restore.sh | 15 +++++---------- tests/run-zdtm.sh | 13 ------------- tests/tests.yml | 4 ++++ 5 files changed, 19 insertions(+), 28 deletions(-) diff --git a/criu.spec b/criu.spec index 445c9b2..33eeef0 100644 --- a/criu.spec +++ b/criu.spec @@ -12,7 +12,7 @@ Name: criu Version: 3.15 -Release: 3%{?dist} +Release: 4%{?dist} Provides: crtools = %{version}-%{release} Obsoletes: crtools <= 1.0-2 Summary: Tool for Checkpoint/Restore in User-space @@ -185,6 +185,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %changelog +* Fri Apr 09 2021 Adrian Reber - 3.15-4 +- Test for testing + * Tue Jan 26 2021 Fedora Release Engineering - 3.15-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild diff --git a/gating.yaml b/gating.yaml index c80192d..bb1d8ee 100644 --- a/gating.yaml +++ b/gating.yaml @@ -1,12 +1,14 @@ --- !Policy product_versions: - fedora-* -decision_context: bodhi_update_push_testing +decision_contexts: [bodhi_update_push_testing] +subject_type: koji_build rules: - - !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional } + - !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional} --- !Policy product_versions: - fedora-* -decision_context: bodhi_update_push_stable +decision_contexts: [bodhi_update_push_stable] +subject_type: koji_build rules: - - !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional } + - !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional} diff --git a/tests/run-podman-checkpoint-restore.sh b/tests/run-podman-checkpoint-restore.sh index 525755f..845d0b4 100755 --- a/tests/run-podman-checkpoint-restore.sh +++ b/tests/run-podman-checkpoint-restore.sh @@ -4,18 +4,14 @@ set -eux ls -la -echo "Start container with tomcat" -podman --log-level debug run --tmpfs /tmp --tmpfs /usr/local/tomcat/logs -d docker://docker.io/yovfiatbeb/podman-criu-test +echo "Start container" +podman --log-level debug run -d quay.io/adrianreber/counter echo "See which containers are running" podman ps -# tomcat needs some time to start up -echo "Wait 15 seconds for tomcat to start" -sleep 15 - -echo "Connect to tomcat in the container" -curl `podman inspect -l | jq -r '.[0].NetworkSettings.IPAddress'`:8080/examples/servlets/servlet/HelloWorldExample -v +echo "Connect to the container" +curl `podman inspect -l | jq -r '.[0].NetworkSettings.IPAddress'`:8088 echo "Checkpoint container" podman --log-level debug container checkpoint -l @@ -26,7 +22,6 @@ podman --log-level debug container restore -l podman ps -a echo "Check if we can connect to the restored container" -curl `podman inspect -l | jq -r '.[0].NetworkSettings.IPAddress'`:8080/examples/servlets/servlet/HelloWorldExample -v +curl `podman inspect -l | jq -r '.[0].NetworkSettings.IPAddress'`:8088 ls -la -echo test diff --git a/tests/run-zdtm.sh b/tests/run-zdtm.sh index 7ad7d25..58a1143 100755 --- a/tests/run-zdtm.sh +++ b/tests/run-zdtm.sh @@ -4,19 +4,6 @@ set -x uname -a -# Two IPv6 related tests are failing in CI, not sure why. -echo "Network setup" -cat /etc/hosts -ip a -ping localhost -c 3 -4 -ping localhost -c 3 -6 -ping localhost -c 3 - -ip route save > /tmp/test -echo $? -file /tmp/test -rpm -q iproute - # These zdtm tests are skipped because they fail only in CI system EXCLUDES=" \ -x zdtm/static/socket-tcp-reseted \ diff --git a/tests/tests.yml b/tests/tests.yml index 8571458..6e498e2 100644 --- a/tests/tests.yml +++ b/tests/tests.yml @@ -26,7 +26,11 @@ - nftables-devel - python3-pyyaml - python3-protobuf + - python-unversioned-command tests: - zdtm: dir: . run: ./run-zdtm.sh + - podman: + dir: . + run: ./run-podman-checkpoint-restore.sh From fb66eb1b78f888a93dabefd5489f529d7110b3f7 Mon Sep 17 00:00:00 2001 From: Python Maint Date: Fri, 4 Jun 2021 20:02:18 +0200 Subject: [PATCH 017/109] Rebuilt for Python 3.10 --- criu.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/criu.spec b/criu.spec index 33eeef0..3a086bf 100644 --- a/criu.spec +++ b/criu.spec @@ -12,7 +12,7 @@ Name: criu Version: 3.15 -Release: 4%{?dist} +Release: 5%{?dist} Provides: crtools = %{version}-%{release} Obsoletes: crtools <= 1.0-2 Summary: Tool for Checkpoint/Restore in User-space @@ -185,6 +185,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %changelog +* Fri Jun 04 2021 Python Maint - 3.15-5 +- Rebuilt for Python 3.10 + * Fri Apr 09 2021 Adrian Reber - 3.15-4 - Test for testing From 30f22f6e8a7a8c91334795b6fe684bca343f7310 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 21 Jul 2021 20:07:04 +0000 Subject: [PATCH 018/109] - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- criu.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/criu.spec b/criu.spec index 3a086bf..5bbe8fa 100644 --- a/criu.spec +++ b/criu.spec @@ -12,7 +12,7 @@ Name: criu Version: 3.15 -Release: 5%{?dist} +Release: 6%{?dist} Provides: crtools = %{version}-%{release} Obsoletes: crtools <= 1.0-2 Summary: Tool for Checkpoint/Restore in User-space @@ -185,6 +185,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %changelog +* Wed Jul 21 2021 Fedora Release Engineering - 3.15-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild + * Fri Jun 04 2021 Python Maint - 3.15-5 - Rebuilt for Python 3.10 From 5a7d6e807e584b131443ba4677f87db38c0c1dbe Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Wed, 22 Sep 2021 23:16:50 +0200 Subject: [PATCH 019/109] Update to 3.16 --- .gitignore | 1 + criu.spec | 10 ++++++++-- sources | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index daa1199..830fe84 100644 --- a/.gitignore +++ b/.gitignore @@ -49,3 +49,4 @@ /criu-3.13.tar.bz2 /criu-3.14.tar.bz2 /criu-3.15.tar.bz2 +/criu-3.16.tar.bz2 diff --git a/criu.spec b/criu.spec index 5bbe8fa..971d431 100644 --- a/criu.spec +++ b/criu.spec @@ -11,8 +11,8 @@ %undefine _annotated_build Name: criu -Version: 3.15 -Release: 6%{?dist} +Version: 3.16 +Release: 1%{?dist} Provides: crtools = %{version}-%{release} Obsoletes: crtools <= 1.0-2 Summary: Tool for Checkpoint/Restore in User-space @@ -134,6 +134,9 @@ install -p -m 644 -D %{SOURCE2} $RPM_BUILD_ROOT%{_mandir}/man1/crit.1 install -p -m 644 -D %{SOURCE3} $RPM_BUILD_ROOT%{_mandir}/man1/compel.1 %endif +rm -f $RPM_BUILD_ROOT/%{_sbindir}/criu-ns +rm -f $RPM_BUILD_ROOT%{_mandir}/man1/criu-ns.1 + mkdir -p %{buildroot}%{_tmpfilesdir} install -m 0644 %{SOURCE4} %{buildroot}%{_tmpfilesdir}/%{name}.conf install -d -m 0755 %{buildroot}/run/%{name}/ @@ -185,6 +188,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %changelog +* Wed Sep 22 2021 Adrian Reber - 3.16-1 +- Update to 3.16 + * Wed Jul 21 2021 Fedora Release Engineering - 3.15-6 - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild diff --git a/sources b/sources index 551a2a9..66d5262 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (criu-3.15.tar.bz2) = 7bfd32053e47b95d10cdd5e99494bff6a21aa3179518179f8c72e870f0aab960dd76c9f6cb6982e5b881472cf6962eefee3cf7d8ae9128b3379bcaecc937ebbc +SHA512 (criu-3.16.tar.bz2) = 75fd0b6614e98ff953709cd01f7b95e64a41a6404cb4fc80df1a6e48e2d255e54e080e542199f785584739d2f89a0982a2ec72263393c5b0f8f98627b84980ed From 8a78dfa1c49fbd720b2f134d47d4e07a37473b34 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Thu, 23 Sep 2021 11:30:59 +0200 Subject: [PATCH 020/109] Include criu-ns sub package Use new github Source0 location --- .gitignore | 1 + criu.spec | 22 ++++++++++++++++++---- sources | 2 +- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 830fe84..0ccbb87 100644 --- a/.gitignore +++ b/.gitignore @@ -50,3 +50,4 @@ /criu-3.14.tar.bz2 /criu-3.15.tar.bz2 /criu-3.16.tar.bz2 +/criu-3.16.tar.gz diff --git a/criu.spec b/criu.spec index 971d431..b625128 100644 --- a/criu.spec +++ b/criu.spec @@ -12,13 +12,13 @@ Name: criu Version: 3.16 -Release: 1%{?dist} +Release: 2%{?dist} Provides: crtools = %{version}-%{release} Obsoletes: crtools <= 1.0-2 Summary: Tool for Checkpoint/Restore in User-space License: GPLv2 URL: http://criu.org/ -Source0: http://download.openvz.org/criu/criu-%{version}.tar.bz2 +Source0: https://github.com/checkpoint-restore/criu/archive/v%{version}/criu-%{version}.tar.gz %if 0%{?rhel} && 0%{?rhel} <= 7 BuildRequires: perl @@ -100,6 +100,14 @@ Requires: %{py_prefix}-%{name} = %{version}-%{release} crit is a tool designed to decode CRIU binary dump files and show their content in human-readable form. +%package -n criu-ns +Summary: Tool to run CRIU in different namespaces +Requires: %{name} = %{version}-%{release} + +%description -n criu-ns +The purpose of the criu-ns wrapper script is to enable restoring a process +tree that might require a specific PID that is already used on the system. +This script can help to workaround the so called "PID mismatch" problem. %prep %setup -q @@ -134,8 +142,7 @@ install -p -m 644 -D %{SOURCE2} $RPM_BUILD_ROOT%{_mandir}/man1/crit.1 install -p -m 644 -D %{SOURCE3} $RPM_BUILD_ROOT%{_mandir}/man1/compel.1 %endif -rm -f $RPM_BUILD_ROOT/%{_sbindir}/criu-ns -rm -f $RPM_BUILD_ROOT%{_mandir}/man1/criu-ns.1 +sed -e "s,/usr/bin/env python,%{_bindir}/%{py_binary},g" -i $RPM_BUILD_ROOT/%{_sbindir}/criu-ns mkdir -p %{buildroot}%{_tmpfilesdir} install -m 0644 %{SOURCE4} %{buildroot}%{_tmpfilesdir}/%{name}.conf @@ -186,8 +193,15 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %{_bindir}/crit %doc %{_mandir}/man1/crit.1* +%files -n criu-ns +%{_sbindir}/criu-ns +%doc %{_mandir}/man1/criu-ns.1* %changelog +* Thu Sep 23 2021 Adrian Reber - 3.16-2 +- Include criu-ns sub package +- Use new github Source0 location + * Wed Sep 22 2021 Adrian Reber - 3.16-1 - Update to 3.16 diff --git a/sources b/sources index 66d5262..45dfa90 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (criu-3.16.tar.bz2) = 75fd0b6614e98ff953709cd01f7b95e64a41a6404cb4fc80df1a6e48e2d255e54e080e542199f785584739d2f89a0982a2ec72263393c5b0f8f98627b84980ed +SHA512 (criu-3.16.tar.gz) = 3f057332ff7e2199b93b678ae3aba4dfd5cbaba87db333b9b4080651d4b375d708a528ef2f58e8a2c6c4a5267fc24ae722f3636ee4bfb73d6fef22ef2bcabdd1 From 5806b45daa0e876e4c3d825d135f88e9d7eb046f Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Thu, 23 Sep 2021 16:31:16 +0200 Subject: [PATCH 021/109] Remove time from changelog because RHEL 7 cannot handle it. Signed-off-by: Adrian Reber --- criu.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/criu.spec b/criu.spec index b625128..0473951 100644 --- a/criu.spec +++ b/criu.spec @@ -217,7 +217,7 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a * Tue Jan 26 2021 Fedora Release Engineering - 3.15-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild -* Wed Jan 13 09:45:16 CET 2021 Adrian Reber - 3.15-2 +* Wed Jan 13 2021 Adrian Reber - 3.15-2 - Rebuilt for protobuf 3.14 * Wed Nov 04 2020 Adrian Reber - 3.15-1 From 4000adef1828e74f2c0a7a2d6dcde22c31c7178d Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Thu, 23 Sep 2021 16:42:57 +0200 Subject: [PATCH 022/109] Manually install criu-ns.1 on RHEL 7 Signed-off-by: Adrian Reber --- criu-ns.1 | 194 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ criu.spec | 2 + 2 files changed, 196 insertions(+) create mode 100644 criu-ns.1 diff --git a/criu-ns.1 b/criu-ns.1 new file mode 100644 index 0000000..3ad79bd --- /dev/null +++ b/criu-ns.1 @@ -0,0 +1,194 @@ +'\" t +.\" Title: criu-ns +.\" Author: [see the "AUTHOR" section] +.\" Generator: DocBook XSL Stylesheets vsnapshot +.\" Date: 09/22/2021 +.\" Manual: CRIU Manual +.\" Source: criu 3.16 +.\" Language: English +.\" +.TH "CRIU\-NS" "1" "09/22/2021" "criu 3\&.16" "CRIU Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * (re)Define some macros +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" toupper - uppercase a string (locale-aware) +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.de toupper +.tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ +\\$* +.tr aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz +.. +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" SH-xref - format a cross-reference to an SH section +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.de SH-xref +.ie n \{\ +.\} +.toupper \\$* +.el \{\ +\\$* +.\} +.. +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" SH - level-one heading that works better for non-TTY output +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.de1 SH +.\" put an extra blank line of space above the head in non-TTY output +.if t \{\ +.sp 1 +.\} +.sp \\n[PD]u +.nr an-level 1 +.set-an-margin +.nr an-prevailing-indent \\n[IN] +.fi +.in \\n[an-margin]u +.ti 0 +.HTML-TAG ".NH \\n[an-level]" +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +\." make the size of the head bigger +.ps +3 +.ft B +.ne (2v + 1u) +.ie n \{\ +.\" if n (TTY output), use uppercase +.toupper \\$* +.\} +.el \{\ +.nr an-break-flag 0 +.\" if not n (not TTY), use normal case (not uppercase) +\\$1 +.in \\n[an-margin]u +.ti 0 +.\" if not n (not TTY), put a border/line under subheading +.sp -.6 +\l'\n(.lu' +.\} +.. +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" SS - level-two heading that works better for non-TTY output +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.de1 SS +.sp \\n[PD]u +.nr an-level 1 +.set-an-margin +.nr an-prevailing-indent \\n[IN] +.fi +.in \\n[IN]u +.ti \\n[SN]u +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.ps \\n[PS-SS]u +\." make the size of the head bigger +.ps +2 +.ft B +.ne (2v + 1u) +.if \\n[.$] \&\\$* +.. +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" BB/EB - put background/screen (filled box) around block of text +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.de BB +.if t \{\ +.sp -.5 +.br +.in +2n +.ll -2n +.gcolor red +.di BX +.\} +.. +.de EB +.if t \{\ +.if "\\$2"adjust-for-leading-newline" \{\ +.sp -1 +.\} +.br +.di +.in +.ll +.gcolor +.nr BW \\n(.lu-\\n(.i +.nr BH \\n(dn+.5v +.ne \\n(BHu+.5v +.ie "\\$2"adjust-for-leading-newline" \{\ +\M[\\$1]\h'1n'\v'+.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[] +.\} +.el \{\ +\M[\\$1]\h'1n'\v'-.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[] +.\} +.in 0 +.sp -.5v +.nf +.BX +.in +.sp .5v +.fi +.\} +.. +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" BM/EM - put colored marker in margin next to block of text +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.de BM +.if t \{\ +.br +.ll -2n +.gcolor red +.di BX +.\} +.. +.de EM +.if t \{\ +.br +.di +.ll +.gcolor +.nr BH \\n(dn +.ne \\n(BHu +\M[\\$1]\D'P -.75n 0 0 \\n(BHu -(\\n[.i]u - \\n(INu - .75n) 0 0 -\\n(BHu'\M[] +.in 0 +.nf +.BX +.in +.fi +.\} +.. +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "Name" +criu-ns \- run criu in different namespaces +.SH "Synopsis" +.sp +\fBcriu\-ns\fR \fIdump\fR \-t PID [] +.sp +\fBcriu\-ns\fR \fIpre\-dump\fR \-t PID [] +.sp +\fBcriu\-ns\fR \fIrestore\fR [] +.sp +\fBcriu\-ns\fR \fIcheck\fR [] +.SH "DESCRIPTION" +.sp +The \fBcriu\-ns\fR command executes \fIcriu\fR in a new PID and mount namespace\&. The purpose of this wrapper script is to enable restoring a process tree that might require a specific PID that is already used on the system; so called "PID mismatch" problem\&. +.SH "SEE ALSO" +.sp +nsenter(1) namespaces(7) criu(8) +.SH "AUTHOR" +.sp +The CRIU team diff --git a/criu.spec b/criu.spec index 0473951..82f586b 100644 --- a/criu.spec +++ b/criu.spec @@ -27,6 +27,7 @@ BuildRequires: perl Source1: criu.8 Source2: crit.1 Source3: compel.1 +Source4: criu-ns.1 # The patch aio-fix.patch is needed as RHEL7 # doesn't do "nr_events *= 2" in ioctx_alloc(). Patch100: aio-fix.patch @@ -140,6 +141,7 @@ make install-man DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} install -p -m 644 -D %{SOURCE1} $RPM_BUILD_ROOT%{_mandir}/man8/%{name}.8 install -p -m 644 -D %{SOURCE2} $RPM_BUILD_ROOT%{_mandir}/man1/crit.1 install -p -m 644 -D %{SOURCE3} $RPM_BUILD_ROOT%{_mandir}/man1/compel.1 +install -p -m 644 -D %{SOURCE4} $RPM_BUILD_ROOT%{_mandir}/man1/criu-ns.1 %endif sed -e "s,/usr/bin/env python,%{_bindir}/%{py_binary},g" -i $RPM_BUILD_ROOT/%{_sbindir}/criu-ns From 4633dfe18f04b215743e71c5fd176941850b93a9 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Thu, 23 Sep 2021 16:44:23 +0200 Subject: [PATCH 023/109] Fix Source?: numbering Signed-off-by: Adrian Reber --- criu.spec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/criu.spec b/criu.spec index 82f586b..adf95fa 100644 --- a/criu.spec +++ b/criu.spec @@ -33,7 +33,7 @@ Source4: criu-ns.1 Patch100: aio-fix.patch %endif -Source4: criu-tmpfiles.conf +Source5: criu-tmpfiles.conf BuildRequires: gcc BuildRequires: systemd @@ -147,7 +147,7 @@ install -p -m 644 -D %{SOURCE4} $RPM_BUILD_ROOT%{_mandir}/man1/criu-ns.1 sed -e "s,/usr/bin/env python,%{_bindir}/%{py_binary},g" -i $RPM_BUILD_ROOT/%{_sbindir}/criu-ns mkdir -p %{buildroot}%{_tmpfilesdir} -install -m 0644 %{SOURCE4} %{buildroot}%{_tmpfilesdir}/%{name}.conf +install -m 0644 %{SOURCE5} %{buildroot}%{_tmpfilesdir}/%{name}.conf install -d -m 0755 %{buildroot}/run/%{name}/ %if 0%{?rhel} From 2e26949efb15b761fcc681083ce2070544c5a857 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Tue, 5 Oct 2021 09:50:39 +0200 Subject: [PATCH 024/109] Fix build on RHEL 8 Signed-off-by: Adrian Reber --- criu.spec | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/criu.spec b/criu.spec index adf95fa..2a27a3b 100644 --- a/criu.spec +++ b/criu.spec @@ -12,9 +12,7 @@ Name: criu Version: 3.16 -Release: 2%{?dist} -Provides: crtools = %{version}-%{release} -Obsoletes: crtools <= 1.0-2 +Release: 3%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPLv2 URL: http://criu.org/ @@ -44,11 +42,11 @@ BuildRequires: asciidoc xmlto BuildRequires: perl-interpreter BuildRequires: libselinux-devel BuildRequires: gnutls-devel -BuildRequires: nftables-devel # Checkpointing containers with a tmpfs requires tar Recommends: tar %if 0%{?fedora} BuildRequires: libbsd-devel +BuildRequires: nftables-devel %endif %endif BuildRequires: make @@ -63,7 +61,7 @@ criu is the user-space part of Checkpoint/Restore in User-space (CRIU), a project to implement checkpoint/restore functionality for Linux in user-space. -%if 0%{?fedora} +%if 0%{?fedora} || 0%{?rhel} > 7 %package devel Summary: Header files and libraries for %{name} Requires: %{name} = %{version}-%{release} @@ -150,7 +148,7 @@ mkdir -p %{buildroot}%{_tmpfilesdir} install -m 0644 %{SOURCE5} %{buildroot}%{_tmpfilesdir}/%{name}.conf install -d -m 0755 %{buildroot}/run/%{name}/ -%if 0%{?rhel} +%if 0%{?rhel} && 0%{?rhel} <= 7 # remove devel and libs packages rm -rf $RPM_BUILD_ROOT%{_includedir}/criu rm $RPM_BUILD_ROOT%{_libdir}/*.so* @@ -165,14 +163,14 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %{_sbindir}/%{name} %doc %{_mandir}/man8/criu.8* %doc %{_mandir}/man1/compel.1* -%if 0%{?fedora} +%if 0%{?fedora} || 0%{?rhel} > 7 %{_libexecdir}/%{name} %endif %dir /run/%{name} %{_tmpfilesdir}/%{name}.conf %doc README.md COPYING -%if 0%{?fedora} +%if 0%{?fedora} || 0%{?rhel} > 7 %files devel %{_includedir}/criu %{_libdir}/*.so @@ -200,6 +198,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %doc %{_mandir}/man1/criu-ns.1* %changelog +* Tue Oct 05 2021 Adrian Reber - 3.16-3 +- Fix build on RHEL 8 + * Thu Sep 23 2021 Adrian Reber - 3.16-2 - Include criu-ns sub package - Use new github Source0 location From 6c7e00a297a0e48a5d4d8a1991510ac070c81e21 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Thu, 14 Oct 2021 14:18:01 +0100 Subject: [PATCH 025/109] criu.pc: Add libprotobuf-c as a dependency CRIU has a dependency on protobuf-c-devel. We express this dependency in pkgconfig to be auto-detected when building a package. Signed-off-by: Radostin Stoyanov --- criu.pc.patch | 27 +++++++++++++++++++++++++++ criu.spec | 8 ++++++++ 2 files changed, 35 insertions(+) create mode 100644 criu.pc.patch diff --git a/criu.pc.patch b/criu.pc.patch new file mode 100644 index 0000000..623c446 --- /dev/null +++ b/criu.pc.patch @@ -0,0 +1,27 @@ +From 341ef149ee259d9432ea4c01507eefab2ef8b83c Mon Sep 17 00:00:00 2001 +From: Radostin Stoyanov +Date: Thu, 14 Oct 2021 12:58:56 +0100 +Subject: [PATCH] criu.pc: Add libprotobuf-c as a dependency + +CRIU has a dependency on protobuf-c-devel. We express this dependency +in pkgconfig to be auto-detected when building a package. + +Signed-off-by: Radostin Stoyanov +--- + lib/c/criu.pc.in | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/lib/c/criu.pc.in b/lib/c/criu.pc.in +index 33986d10d..bcced5033 100644 +--- a/lib/c/criu.pc.in ++++ b/lib/c/criu.pc.in +@@ -4,5 +4,6 @@ includedir=@includedir@ + Name: CRIU + Description: RPC library for userspace checkpoint and restore + Version: @version@ ++Requires.private: protobuf-c + Libs: -L${libdir} -lcriu + Cflags: -I${includedir} +-- +2.31.1 + diff --git a/criu.spec b/criu.spec index 2a27a3b..8fb0c61 100644 --- a/criu.spec +++ b/criu.spec @@ -18,6 +18,11 @@ License: GPLv2 URL: http://criu.org/ Source0: https://github.com/checkpoint-restore/criu/archive/v%{version}/criu-%{version}.tar.gz +# Add protobuf-c as a dependency. +# We use this patch because the protobuf-c package name +# in RPM and DEB is different. +Patch99: criu.pc.patch + %if 0%{?rhel} && 0%{?rhel} <= 7 BuildRequires: perl # RHEL has no asciidoc; take man-page from Fedora 26 @@ -26,6 +31,7 @@ Source1: criu.8 Source2: crit.1 Source3: compel.1 Source4: criu-ns.1 + # The patch aio-fix.patch is needed as RHEL7 # doesn't do "nr_events *= 2" in ioctx_alloc(). Patch100: aio-fix.patch @@ -111,6 +117,8 @@ This script can help to workaround the so called "PID mismatch" problem. %prep %setup -q +%patch99 -p1 + %if 0%{?rhel} && 0%{?rhel} <= 7 %patch100 -p1 %endif From 4ae7ecb6cd4c7f97d363e7ebe2d4ff558a517e69 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Thu, 14 Oct 2021 17:04:14 +0100 Subject: [PATCH 026/109] Remove manual fix of the criu-ns shebang The criu-ns shebang has been updated to use Python 3 upstream. This fix is no longer necessary. Signed-off-by: Radostin Stoyanov --- criu.spec | 2 -- 1 file changed, 2 deletions(-) diff --git a/criu.spec b/criu.spec index 8fb0c61..886e1fd 100644 --- a/criu.spec +++ b/criu.spec @@ -150,8 +150,6 @@ install -p -m 644 -D %{SOURCE3} $RPM_BUILD_ROOT%{_mandir}/man1/compel.1 install -p -m 644 -D %{SOURCE4} $RPM_BUILD_ROOT%{_mandir}/man1/criu-ns.1 %endif -sed -e "s,/usr/bin/env python,%{_bindir}/%{py_binary},g" -i $RPM_BUILD_ROOT/%{_sbindir}/criu-ns - mkdir -p %{buildroot}%{_tmpfilesdir} install -m 0644 %{SOURCE5} %{buildroot}%{_tmpfilesdir}/%{name}.conf install -d -m 0755 %{buildroot}/run/%{name}/ From 364984bab99f7168d682324edb4a9d4691273399 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Thu, 14 Oct 2021 16:17:27 +0100 Subject: [PATCH 027/109] Update to 3.16.1 Signed-off-by: Radostin Stoyanov --- .gitignore | 1 + criu.spec | 8 ++++++-- sources | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 0ccbb87..4c1bda8 100644 --- a/.gitignore +++ b/.gitignore @@ -51,3 +51,4 @@ /criu-3.15.tar.bz2 /criu-3.16.tar.bz2 /criu-3.16.tar.gz +/criu-3.16.1.tar.gz diff --git a/criu.spec b/criu.spec index 886e1fd..ba7096b 100644 --- a/criu.spec +++ b/criu.spec @@ -11,8 +11,8 @@ %undefine _annotated_build Name: criu -Version: 3.16 -Release: 3%{?dist} +Version: 3.16.1 +Release: 1%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPLv2 URL: http://criu.org/ @@ -204,6 +204,10 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %doc %{_mandir}/man1/criu-ns.1* %changelog +* Thu Oct 14 2021 Radostin Stoyanov - 3.16.1-1 +- Update to 3.16.1 +- Add protobuf-c as required dependency (#2013775) + * Tue Oct 05 2021 Adrian Reber - 3.16-3 - Fix build on RHEL 8 diff --git a/sources b/sources index 45dfa90..fdcc0ac 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (criu-3.16.tar.gz) = 3f057332ff7e2199b93b678ae3aba4dfd5cbaba87db333b9b4080651d4b375d708a528ef2f58e8a2c6c4a5267fc24ae722f3636ee4bfb73d6fef22ef2bcabdd1 +SHA512 (criu-3.16.1.tar.gz) = a558af41f1927a1b1d87f8d11163a5f3d2e4f83a74aba00619b45a6d464d5477a6a0aac3c1b9d9a17e3343a4bf21a3fd6b279b51fa0c347c86c307381a4d0739 From a2df81d1de00886bea9817623ddb53e1e58c41ad Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Tue, 19 Oct 2021 11:03:57 +0100 Subject: [PATCH 028/109] Update protobuf-c to libprotobuf-c Signed-off-by: Radostin Stoyanov --- criu.pc.patch | 4 ++-- criu.spec | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/criu.pc.patch b/criu.pc.patch index 623c446..6211f2c 100644 --- a/criu.pc.patch +++ b/criu.pc.patch @@ -19,9 +19,9 @@ index 33986d10d..bcced5033 100644 Name: CRIU Description: RPC library for userspace checkpoint and restore Version: @version@ -+Requires.private: protobuf-c ++Requires.private: libprotobuf-c Libs: -L${libdir} -lcriu Cflags: -I${includedir} --- +-- 2.31.1 diff --git a/criu.spec b/criu.spec index ba7096b..50c76e9 100644 --- a/criu.spec +++ b/criu.spec @@ -12,7 +12,7 @@ Name: criu Version: 3.16.1 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPLv2 URL: http://criu.org/ @@ -204,6 +204,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %doc %{_mandir}/man1/criu-ns.1* %changelog +* Thu Oct 19 2021 Radostin Stoyanov - 3.16.1-2 +- Update protobuf-c to libprotobuf-c requirement + * Thu Oct 14 2021 Radostin Stoyanov - 3.16.1-1 - Update to 3.16.1 - Add protobuf-c as required dependency (#2013775) From a7c1d7ef212d0280272f16396be42dbe88d1630d Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Mon, 25 Oct 2021 18:32:16 +0200 Subject: [PATCH 029/109] Rebuilt for protobuf 3.18.1 --- criu.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/criu.spec b/criu.spec index 50c76e9..1be299c 100644 --- a/criu.spec +++ b/criu.spec @@ -12,7 +12,7 @@ Name: criu Version: 3.16.1 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPLv2 URL: http://criu.org/ @@ -204,6 +204,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %doc %{_mandir}/man1/criu-ns.1* %changelog +* Mon Oct 25 2021 Adrian Reber - 3.16.1-3 +- Rebuilt for protobuf 3.18.1 + * Thu Oct 19 2021 Radostin Stoyanov - 3.16.1-2 - Update protobuf-c to libprotobuf-c requirement From ff3be82a1ca538f0c65b39c1375418c4acf2cac8 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Sat, 6 Nov 2021 10:17:54 +0100 Subject: [PATCH 030/109] Rebuilt for protobuf 3.19.0 --- criu.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/criu.spec b/criu.spec index 1be299c..0dd7807 100644 --- a/criu.spec +++ b/criu.spec @@ -12,7 +12,7 @@ Name: criu Version: 3.16.1 -Release: 3%{?dist} +Release: 4%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPLv2 URL: http://criu.org/ @@ -204,6 +204,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %doc %{_mandir}/man1/criu-ns.1* %changelog +* Sat Nov 06 2021 Adrian Reber - 3.16.1-4 +- Rebuilt for protobuf 3.19.0 + * Mon Oct 25 2021 Adrian Reber - 3.16.1-3 - Rebuilt for protobuf 3.18.1 From e6d765eec2be07828e9bea0104e1e1bf4d5d3a36 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 20 Jan 2022 00:00:03 +0000 Subject: [PATCH 031/109] - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- criu.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/criu.spec b/criu.spec index 0dd7807..17436ff 100644 --- a/criu.spec +++ b/criu.spec @@ -12,7 +12,7 @@ Name: criu Version: 3.16.1 -Release: 4%{?dist} +Release: 5%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPLv2 URL: http://criu.org/ @@ -204,6 +204,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %doc %{_mandir}/man1/criu-ns.1* %changelog +* Thu Jan 20 2022 Fedora Release Engineering - 3.16.1-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild + * Sat Nov 06 2021 Adrian Reber - 3.16.1-4 - Rebuilt for protobuf 3.19.0 From 358b4d5701c425c60fbfc3241b14c47d9e7bc0c6 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Mon, 31 Jan 2022 15:20:22 +0000 Subject: [PATCH 032/109] Replace 'asciidoc xmlto' with asciidoctor Signed-off-by: Radostin Stoyanov --- criu.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/criu.spec b/criu.spec index 17436ff..45070aa 100644 --- a/criu.spec +++ b/criu.spec @@ -44,7 +44,7 @@ BuildRequires: systemd BuildRequires: libnet-devel BuildRequires: protobuf-devel protobuf-c-devel %{py_prefix}-devel libnl3-devel libcap-devel %if 0%{?fedora} || 0%{?rhel} > 7 -BuildRequires: asciidoc xmlto +BuildRequires: asciidoctor BuildRequires: perl-interpreter BuildRequires: libselinux-devel BuildRequires: gnutls-devel From 9f1d78115d4185df6a6d0d0585dedf04176ca6f1 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Mon, 31 Jan 2022 15:28:25 +0000 Subject: [PATCH 033/109] Fix date in changelog Signed-off-by: Radostin Stoyanov --- criu.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/criu.spec b/criu.spec index 45070aa..59c07c2 100644 --- a/criu.spec +++ b/criu.spec @@ -213,7 +213,7 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a * Mon Oct 25 2021 Adrian Reber - 3.16.1-3 - Rebuilt for protobuf 3.18.1 -* Thu Oct 19 2021 Radostin Stoyanov - 3.16.1-2 +* Tue Oct 19 2021 Radostin Stoyanov - 3.16.1-2 - Update protobuf-c to libprotobuf-c requirement * Thu Oct 14 2021 Radostin Stoyanov - 3.16.1-1 From 46abdd731a895d81edfb6300d1478d0fe62cc9da Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Tue, 1 Feb 2022 16:24:07 +0000 Subject: [PATCH 034/109] Enable initial rseq support Signed-off-by: Radostin Stoyanov --- 0004-criu-8-add-external-net-option.patch | 33 + ...troduce-new-device-file-plugin-hooks.patch | 269 +++ ...-Implement-dummy-amdgpu-plugin-hooks.patch | 160 ++ ...-Don-t-cache-fd-ids-for-device-files.patch | 41 + ...ng-TCP-state-when-dumping-with-tcp-c.patch | 40 + ...toring-with-tcp-close-on-TCP_CLOSE-s.patch | 110 + ...detailed-description-about-tcp-close.patch | 33 + ...support-for-python3-in-criu-coredump.patch | 311 +++ ...r-running-criu-coredump-via-python-2.patch | 71 + 0013-coredump-remove-unused-import.patch | 32 + 0014-coredump-sort-imports.patch | 31 + ...redump-convert-indentation-to-spaces.patch | 107 + ...-replace-equality-with-identity-test.patch | 117 + 0017-coredump-drop-unused-variable.patch | 26 + 0018-coredump-drop-exec-permission.patch | 20 + ...coredump-lint-fix-for-block-comments.patch | 1289 +++++++++++ ...x-missing-whitespace-around-operator.patch | 29 + 0021-coredump-fix-too-many-blank-lines.patch | 27 + 0022-coredump-fix-comparison-to-true.patch | 29 + ...dump-lint-fix-visually-indented-line.patch | 52 + ...-test-coredump-fix-shellcheck-errors.patch | 51 + 0025-make-enable-lint-for-coredump.patch | 31 + 0026-ci-enable-coredump-tests.patch | 39 + ...-remove-excess-hash-printf-specifier.patch | 39 + ...x-the-null-pointer-of-get_tty_driver.patch | 34 + 0029-util-use-nftw-in-rmrf-helper.patch | 126 ++ ...u-ns-make-pidns-init-first-do-setsid.patch | 37 + ...tore_rule-to-not-open-the-CR_FD_RULE.patch | 113 + ...ace-deprecated-codecov-bash-uploader.patch | 45 + 0033-ci-fix-userfaultfd-test-failures.patch | 36 + 0034-ci-use-Fedora-34-for-lint-CI-runs.patch | 29 + ...e-the-image-streamer-process-control.patch | 145 ++ ...-don-t-call-sk_setbufs-asyncronously.patch | 32 + ...r-set-getsockopt-SO_BUF_LOCK-availab.patch | 132 ++ 0038-sockets-c-r-bufer-size-locks.patch | 69 + ...dd-test-for-socket-buffer-size-locks.patch | 118 + ...pts02-also-check-lock-change-by-SO_-.patch | 115 + ...-format-enable-AlignTrailingComments.patch | 173 ++ ...mat-do-several-manual-comment-fixups.patch | 169 ++ ...g-format-do-automatic-comment-fixups.patch | 1889 +++++++++++++++++ ...mping-when-zombie-process-with-sid-0.patch | 35 + ...e-x86_ins_capability_mask-human-read.patch | 176 ++ ...i-disable-socket-raw-test-on-centos8.patch | 44 + ...make-tests-with-link_remap-exclusive.patch | 60 + ...e-deterministic-behavior-of-the-test.patch | 108 + ...m-fix-clang-complains-about-strange-.patch | 99 + ...estore-cgroup-freezer-to-right-state.patch | 72 + ...latest-Fedora-for-lint-ci-runs-again.patch | 30 + ...-crtools-ignore-SIGPIPE-in-swrk-mode.patch | 72 + 0053-ci-switch-to-centos-stream-8.patch | 29 + 0054-check-cleanup-child-processes.patch | 68 + ...-reg-fix-error-handling-in-open_path.patch | 156 ++ ...fix-error-handling-of-rm_parent_dirs.patch | 116 + ...cate-remounted_rw-in-shmem-to-get-in.patch | 180 ++ ...ary-remount-writable-the-mount-we-do.patch | 46 + ...unt-check-after-c-r-to-mntns_ghost01.patch | 47 + ...able-wrong-struct-pointer-declaratio.patch | 115 + ...i-Run-cross-compile-on-debian-stable.patch | 181 ++ ...un-cross-compile-with-debian-testing.patch | 197 ++ ...xplicitly-enable-FPU-on-ARMv7-builds.patch | 48 + ...-ci-disable-broken-tests-until-fixed.patch | 59 + ...use-keep-going-for-single-zdtm-tests.patch | 101 + ...mp_ghost_remap-if-link-remap-failed-.patch | 137 ++ 0067-util-make-page-server-IPv6-safe.patch | 63 + ...P_ESTABLISHED-checks-in-unix-sockets.patch | 48 + ...e-disabled-unix-socket-related-tests.patch | 34 + 0070-ci-install-procps-in-Alpine.patch | 29 + ...-to-correctly-fix-the-kernel-version.patch | 34 + ...ault-inject-bound-xsave-features-set.patch | 59 + ...-fault-inject-print-the-initial-seed.patch | 41 + ...x86-xsave-fault-injection-tests-back.patch | 32 + ...Add-documentation-for-timeout-option.patch | 48 + ...T-should-not-require-an-input-descri.patch | 32 + ...setting-lsm-mount-context-to-libcriu.patch | 67 + ...e-unstable-release-for-cross-compile.patch | 182 ++ 0079-ci-disable-glibc-rseq-support.patch | 55 + ...-libcriu-add-single-pre-dump-support.patch | 185 ++ ...ded-test-for-single-pre-dump-support.patch | 262 +++ ...-MAKEFLAGS-env-variable-before-runni.patch | 56 + ...-compilation-error-with-strict-proto.patch | 33 + ...s-deleted-dst-test-leftover-from-git.patch | 21 + ...-remove-excess-always-true-condition.patch | 29 + ...xport-current-criu-mode-to-opts.mode.patch | 309 +++ ...-use-new-opts.mode-in-image_dir_mode.patch | 48 + ...that-cpuinfo-command-has-sub-command.patch | 29 + ...port-for-SOCK_SEQPACKET-unix-sockets.patch | 53 + ...QPACKET-variants-to-unix-socket-test.patch | 574 +++++ 0091-tls-fix-typo.patch | 26 + 0092-tls-use-ssize_t-for-return-value.patch | 71 + 0093-tls-add-more-comments.patch | 111 + ...nect_from_page_server-to-shutdown-a-.patch | 30 + ...-terminate-connections-synchronously.patch | 100 + ...aiting-for-a-new-command-after-a-clo.patch | 66 + ...lazy-thp-test-in-the-lazy-remote-mod.patch | 30 + ...e.out.inprogress-if-a-test-has-faile.patch | 38 + ...ic-uffd-events-add-more-log-messages.patch | 53 + ...k_mountpoint_fd-from-__open_mountpoi.patch | 120 ++ ...mnt_fd-argument-of-__open_mountpoint.patch | 116 + ...e-add-helper-to-resolve-sdev-from-fd.patch | 101 + ...-check_mountpoint_fd-fallback-to-get.patch | 140 ++ ...t-criu-image-streamer-with-all-tests.patch | 33 + 0106-readme-add-docker-test-badge.patch | 25 + ...tributing-remove-old-badges-and-logo.patch | 28 + ...-to-latest-Vagrant-and-Fedora-images.patch | 37 + 0109-ci-added-.lgtm.yml-file.patch | 56 + ...b-introduce-feature-check-in-libcriu.patch | 144 ++ ...d-tests-for-feature-check-in-libcriu.patch | 132 ++ ...-tiny-fix-on-truncating-memory-image.patch | 64 + ...fix-zdtm-static-maps00-case-in-arm64.patch | 43 + ...pel-fix-GCC-12-failure-out-of-bounds.patch | 74 + ...nfiguration-file-scanner-with-GCC-12.patch | 36 + 0116-compel-fix-parasite-with-GCC-12.patch | 43 + ...-continue-on-error-for-cross-compile.patch | 51 + 0118-test-autofs-fix-use-after-free.patch | 67 + ...Fix-formatting-in-criu-documentation.patch | 44 + ...syscall-into-compel-std-plugin-sysca.patch | 76 + ...rndat-check-for-rseq-syscall-support.patch | 62 + ...nd_ptrace_attach-helper-from-cr-chec.patch | 163 ++ ...ck-Add-ptrace-rseq-conf-dump-feature.patch | 163 ++ 0124-rseq-initial-support.patch | 711 +++++++ 0125-zdtm-add-simple-test-for-rseq-C-R.patch | 233 ++ ...Revert-ci-disable-glibc-rseq-support.patch | 49 + ...-Fedora-Rawhide-based-test-on-Cirrus.patch | 124 ++ ...-to-disable-rseq-at-the-thread-start.patch | 96 + ...seq-test-when-linking-with-fresh-gli.patch | 145 ++ criu.spec | 258 ++- 126 files changed, 14704 insertions(+), 3 deletions(-) create mode 100644 0004-criu-8-add-external-net-option.patch create mode 100644 0005-criu-Introduce-new-device-file-plugin-hooks.patch create mode 100644 0006-criu-plugin-Implement-dummy-amdgpu-plugin-hooks.patch create mode 100644 0007-criu-files-Don-t-cache-fd-ids-for-device-files.patch create mode 100644 0008-tcp-Skip-restoring-TCP-state-when-dumping-with-tcp-c.patch create mode 100644 0009-zdtm-Dumping-restoring-with-tcp-close-on-TCP_CLOSE-s.patch create mode 100644 0010-criu-8-Add-more-detailed-description-about-tcp-close.patch create mode 100644 0011-Add-support-for-python3-in-criu-coredump.patch create mode 100644 0012-Add-new-files-for-running-criu-coredump-via-python-2.patch create mode 100644 0013-coredump-remove-unused-import.patch create mode 100644 0014-coredump-sort-imports.patch create mode 100644 0015-coredump-convert-indentation-to-spaces.patch create mode 100644 0016-python-replace-equality-with-identity-test.patch create mode 100644 0017-coredump-drop-unused-variable.patch create mode 100644 0018-coredump-drop-exec-permission.patch create mode 100644 0019-coredump-lint-fix-for-block-comments.patch create mode 100644 0020-coredump-fix-missing-whitespace-around-operator.patch create mode 100644 0021-coredump-fix-too-many-blank-lines.patch create mode 100644 0022-coredump-fix-comparison-to-true.patch create mode 100644 0023-coredump-lint-fix-visually-indented-line.patch create mode 100644 0024-test-coredump-fix-shellcheck-errors.patch create mode 100644 0025-make-enable-lint-for-coredump.patch create mode 100644 0026-ci-enable-coredump-tests.patch create mode 100644 0027-pie-restorer-remove-excess-hash-printf-specifier.patch create mode 100644 0028-tty-fix-the-null-pointer-of-get_tty_driver.patch create mode 100644 0029-util-use-nftw-in-rmrf-helper.patch create mode 100644 0030-criu-ns-make-pidns-init-first-do-setsid.patch create mode 100644 0031-net-optimize-restore_rule-to-not-open-the-CR_FD_RULE.patch create mode 100644 0032-ci-replace-deprecated-codecov-bash-uploader.patch create mode 100644 0033-ci-fix-userfaultfd-test-failures.patch create mode 100644 0034-ci-use-Fedora-34-for-lint-CI-runs.patch create mode 100644 0035-tests-improve-the-image-streamer-process-control.patch create mode 100644 0036-sockets-don-t-call-sk_setbufs-asyncronously.patch create mode 100644 0037-kerndat-check-for-set-getsockopt-SO_BUF_LOCK-availab.patch create mode 100644 0038-sockets-c-r-bufer-size-locks.patch create mode 100644 0039-zdtm-add-test-for-socket-buffer-size-locks.patch create mode 100644 0040-zdtm-make-sock_opts02-also-check-lock-change-by-SO_-.patch create mode 100644 0041-clang-format-enable-AlignTrailingComments.patch create mode 100644 0042-clang-format-do-several-manual-comment-fixups.patch create mode 100644 0043-clang-format-do-automatic-comment-fixups.patch create mode 100644 0044-cr-dump-fail-dumping-when-zombie-process-with-sid-0.patch create mode 100644 0045-clang-format-make-x86_ins_capability_mask-human-read.patch create mode 100644 0046-ci-disable-socket-raw-test-on-centos8.patch create mode 100644 0047-zdtm.py-make-tests-with-link_remap-exclusive.patch create mode 100644 0048-tests-improve-the-deterministic-behavior-of-the-test.patch create mode 100644 0049-clang-format-zdtm-fix-clang-complains-about-strange-.patch create mode 100644 0050-seize-restore-cgroup-freezer-to-right-state.patch create mode 100644 0051-ci-Use-latest-Fedora-for-lint-ci-runs-again.patch create mode 100644 0052-crtools-ignore-SIGPIPE-in-swrk-mode.patch create mode 100644 0053-ci-switch-to-centos-stream-8.patch create mode 100644 0054-check-cleanup-child-processes.patch create mode 100644 0055-files-reg-fix-error-handling-in-open_path.patch create mode 100644 0056-files-reg-fix-error-handling-of-rm_parent_dirs.patch create mode 100644 0057-ghost-mount-allocate-remounted_rw-in-shmem-to-get-in.patch create mode 100644 0058-files-reg-temporary-remount-writable-the-mount-we-do.patch create mode 100644 0059-zdtm-add-ro-mount-check-after-c-r-to-mntns_ghost01.patch create mode 100644 0060-clang-format-disable-wrong-struct-pointer-declaratio.patch create mode 100644 0061-ci-Run-cross-compile-on-debian-stable.patch create mode 100644 0062-ci-Run-cross-compile-with-debian-testing.patch create mode 100644 0063-make-Explicitly-enable-FPU-on-ARMv7-builds.patch create mode 100644 0064-ci-disable-broken-tests-until-fixed.patch create mode 100644 0065-test-do-not-use-keep-going-for-single-zdtm-tests.patch create mode 100644 0066-files-reg-try-dump_ghost_remap-if-link-remap-failed-.patch create mode 100644 0067-util-make-page-server-IPv6-safe.patch create mode 100644 0068-sk-unix-Fix-TCP_ESTABLISHED-checks-in-unix-sockets.patch create mode 100644 0069-ci-Enable-disabled-unix-socket-related-tests.patch create mode 100644 0070-ci-install-procps-in-Alpine.patch create mode 100644 0071-test-another-try-to-correctly-fix-the-kernel-version.patch create mode 100644 0072-x86-compel-fault-inject-bound-xsave-features-set.patch create mode 100644 0073-x86-compel-fault-inject-print-the-initial-seed.patch create mode 100644 0074-ci-enable-x86-xsave-fault-injection-tests-back.patch create mode 100644 0075-Add-documentation-for-timeout-option.patch create mode 100644 0076-usernsd-UNS_FDOUT-should-not-require-an-input-descri.patch create mode 100644 0077-libcriu-add-setting-lsm-mount-context-to-libcriu.patch create mode 100644 0078-ci-use-unstable-release-for-cross-compile.patch create mode 100644 0079-ci-disable-glibc-rseq-support.patch create mode 100644 0080-libcriu-add-single-pre-dump-support.patch create mode 100644 0081-tests-added-test-for-single-pre-dump-support.patch create mode 100644 0082-zdtm.py-clean-up-MAKEFLAGS-env-variable-before-runni.patch create mode 100644 0083-zdtm-zdtm_ct-fix-compilation-error-with-strict-proto.patch create mode 100644 0084-zdtm-remove-mntns-deleted-dst-test-leftover-from-git.patch create mode 100644 0085-crtools-remove-excess-always-true-condition.patch create mode 100644 0086-crtools-rpc-export-current-criu-mode-to-opts.mode.patch create mode 100644 0087-crtools-use-new-opts.mode-in-image_dir_mode.patch create mode 100644 0088-crtools-check-that-cpuinfo-command-has-sub-command.patch create mode 100644 0089-sk-unix-Add-support-for-SOCK_SEQPACKET-unix-sockets.patch create mode 100644 0090-zdtm-Add-SOCK_SEQPACKET-variants-to-unix-socket-test.patch create mode 100644 0091-tls-fix-typo.patch create mode 100644 0092-tls-use-ssize_t-for-return-value.patch create mode 100644 0093-tls-add-more-comments.patch create mode 100644 0094-uffd-call-disconnect_from_page_server-to-shutdown-a-.patch create mode 100644 0095-tls-allow-to-terminate-connections-synchronously.patch create mode 100644 0096-page-xfer-stop-waiting-for-a-new-command-after-a-clo.patch create mode 100644 0097-ci-reenable-the-lazy-thp-test-in-the-lazy-remote-mod.patch create mode 100644 0098-test-log-testname.out.inprogress-if-a-test-has-faile.patch create mode 100644 0100-zdtm-static-uffd-events-add-more-log-messages.patch create mode 100644 0101-mount-split-check_mountpoint_fd-from-__open_mountpoi.patch create mode 100644 0102-mount-remove-mnt_fd-argument-of-__open_mountpoint.patch create mode 100644 0103-proc_parse-add-helper-to-resolve-sdev-from-fd.patch create mode 100644 0104-mount-btrfs-make-check_mountpoint_fd-fallback-to-get.patch create mode 100644 0105-ci-test-criu-image-streamer-with-all-tests.patch create mode 100644 0106-readme-add-docker-test-badge.patch create mode 100644 0107-contributing-remove-old-badges-and-logo.patch create mode 100644 0108-ci-update-to-latest-Vagrant-and-Fedora-images.patch create mode 100644 0109-ci-added-.lgtm.yml-file.patch create mode 100644 0110-lib-introduce-feature-check-in-libcriu.patch create mode 100644 0111-lib-added-tests-for-feature-check-in-libcriu.patch create mode 100644 0112-pagemap-tiny-fix-on-truncating-memory-image.patch create mode 100644 0113-zdtm-fix-zdtm-static-maps00-case-in-arm64.patch create mode 100644 0114-compel-fix-GCC-12-failure-out-of-bounds.patch create mode 100644 0115-criu-fix-configuration-file-scanner-with-GCC-12.patch create mode 100644 0116-compel-fix-parasite-with-GCC-12.patch create mode 100644 0117-ci-set-continue-on-error-for-cross-compile.patch create mode 100644 0118-test-autofs-fix-use-after-free.patch create mode 100644 0119-Fix-formatting-in-criu-documentation.patch create mode 100644 0120-compel-add-rseq-syscall-into-compel-std-plugin-sysca.patch create mode 100644 0121-kerndat-check-for-rseq-syscall-support.patch create mode 100644 0122-util-move-fork_and_ptrace_attach-helper-from-cr-chec.patch create mode 100644 0123-cr-check-Add-ptrace-rseq-conf-dump-feature.patch create mode 100644 0124-rseq-initial-support.patch create mode 100644 0125-zdtm-add-simple-test-for-rseq-C-R.patch create mode 100644 0126-Revert-ci-disable-glibc-rseq-support.patch create mode 100644 0127-ci-add-Fedora-Rawhide-based-test-on-Cirrus.patch create mode 100644 0128-fixup-attempt-to-disable-rseq-at-the-thread-start.patch create mode 100644 0129-zdtm-fixup-fix-rseq-test-when-linking-with-fresh-gli.patch diff --git a/0004-criu-8-add-external-net-option.patch b/0004-criu-8-add-external-net-option.patch new file mode 100644 index 0000000..3d2dd1d --- /dev/null +++ b/0004-criu-8-add-external-net-option.patch @@ -0,0 +1,33 @@ +From 93d977ccacdc6dc01c0ef8c6a27a5c8896ceaaf9 Mon Sep 17 00:00:00 2001 +From: Radostin Stoyanov +Date: Mon, 20 Sep 2021 13:50:08 +0100 +Subject: [PATCH 004/120] criu(8): add --external net option + +Support for external net namespaces has been introduced with +commit c2b21fbf (criu: add support for external net namespaces). + +Signed-off-by: Radostin Stoyanov +--- + Documentation/criu.txt | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/Documentation/criu.txt b/Documentation/criu.txt +index 690f61e14..3c4c1eaf8 100644 +--- a/Documentation/criu.txt ++++ b/Documentation/criu.txt +@@ -242,6 +242,12 @@ In other words, do not use it unless really needed. + Tell *criu* that one end of a pair of UNIX sockets (created by + *socketpair*(2)) with the given _id_ is OK to be disconnected. + ++*--external* **net[**__inode__**]:**__name__:: ++ Mark a network namespace as external and do not include it in the ++ checkpoint. The label 'name' can be used with *--inherit-fd* during ++ restore to specify a file descriptor to a preconfigured network ++ namespace. ++ + *--external* **pid[**__inode__**]:**__name__:: + Mark a PID namespace as external. This can be later used to restore + a process into an existing PID namespace. The label 'name' can be +-- +2.34.1 + diff --git a/0005-criu-Introduce-new-device-file-plugin-hooks.patch b/0005-criu-Introduce-new-device-file-plugin-hooks.patch new file mode 100644 index 0000000..32d8346 --- /dev/null +++ b/0005-criu-Introduce-new-device-file-plugin-hooks.patch @@ -0,0 +1,269 @@ +From 32055ece2d1eeb7e5ea7e8345c728e117ae4b737 Mon Sep 17 00:00:00 2001 +From: Rajneesh Bhardwaj +Date: Thu, 15 Apr 2021 12:04:45 -0400 +Subject: [PATCH 005/120] criu: Introduce new device file plugin hooks + +Currently CRIU cannot handle Checkpoint Restore operations when a device +file is involved in a process, however, CRIU allows flexible extensions +via special plugins but still, for certain complex devices such as a GPU, +the existing hooks are not sufficient. This introduces few new hooks +that will be used to support Checkpoint Restore operation with AMD GPU +devices and potentially to other similar devices too. + + - HANDLE_DEVICE_VMA + - UPDATE_VMA_MAP + - RESUME_DEVICES_LATE + + *HANDLE_DEVICE_VMA: + Hook to detect a suitable plugin to handle device file VMA with + PF | IO mappings. + + *UPDATE_VMA_MAP: + Hook to handle VMAs during a device file restore. + + When restoring VMAs for the device files, criu runs sys_mmap in + the pie restore context but the offsets and file path within a + device file may change during restore operation so it needs to be + adjusted properly. + + *RESUME_DEVICES_LATE: + Hook to do some special handling in late restore phase. + + During criu restore phase when a device is getting restored with + the help of a plugin, some device specific operations might need + to be delayed until criu finalizes the VMA placements in address + space of the target process. But by the time criu finalizes this, + its too late since pie phase is over and control is back to criu + master process. This hook allows an external trigger to each + resuming task to check whether it has a device specific operation + pending such as issuing an ioctl call? Since this is called from + criu master process context, supply the pid of the target process + and give a chance to each plugin registered to run device + specific operation if the target pid is valid. + +A future patch will add consumers for these plugin hooks to support AMD +GPUs. + +Signed-off-by: Rajneesh Bhardwaj +--- + criu/cr-restore.c | 23 +++++++++++++++++++ + criu/files-reg.c | 17 ++++++++++++++ + criu/include/criu-plugin.h | 16 +++++++++++++ + criu/plugin.c | 3 +++ + criu/proc_parse.c | 47 +++++++++++++++++++++++++++++++++----- + 5 files changed, 100 insertions(+), 6 deletions(-) + +diff --git a/criu/cr-restore.c b/criu/cr-restore.c +index 9d2d957f8..ed62cc5a2 100644 +--- a/criu/cr-restore.c ++++ b/criu/cr-restore.c +@@ -2388,6 +2388,29 @@ skip_ns_bouncing: + pr_err("Unable to flush breakpoints\n"); + + finalize_restore(); ++ /* ++ * Some external devices such as GPUs might need a very late ++ * trigger to kick-off some events, memory notifiers and for ++ * restarting the previously restored queues during criu restore ++ * stage. This is needed since criu pie code may shuffle VMAs ++ * around so things such as registering MMU notifiers (for GPU ++ * mapped memory) could be done sanely once the pie code hands ++ * over the control to master process. ++ */ ++ for_each_pstree_item(item) { ++ pr_info("Run late stage hook from criu master for external devices\n"); ++ ret = run_plugins(RESUME_DEVICES_LATE, item->pid->real); ++ /* ++ * This may not really be an error. Only certain plugin hooks ++ * (if available) will return success such as amdgpu_plugin that ++ * validates the pid of the resuming tasks in the kernel mode. ++ * Most of the times, it'll be -ENOTSUP and in few cases, it ++ * might actually be a true error code but that would be also ++ * captured in the plugin so no need to print the error here. ++ */ ++ if (ret < 0) ++ pr_debug("restore late stage hook for external plugin failed\n"); ++ } + + ret = run_scripts(ACT_PRE_RESUME); + if (ret) +diff --git a/criu/files-reg.c b/criu/files-reg.c +index ee54d1d7d..2b0347575 100644 +--- a/criu/files-reg.c ++++ b/criu/files-reg.c +@@ -2267,6 +2267,23 @@ static int open_filemap(int pid, struct vma_area *vma) + BUG_ON((vma->vmfd == NULL) || !vma->e->has_fdflags); + flags = vma->e->fdflags; + ++ /* update the new device file page offsets and file paths set during restore */ ++ if (vma->e->status & VMA_UNSUPP) { ++ uint64_t new_pgoff; ++ char new_path[PATH_MAX]; ++ int ret; ++ ++ struct reg_file_info *rfi = container_of(vma->vmfd, struct reg_file_info, d); ++ ret = run_plugins(UPDATE_VMA_MAP, rfi->rfe->name, new_path, vma->e->start, vma->e->pgoff, &new_pgoff); ++ if (ret == 1) { ++ pr_info("New mmap %#016" PRIx64 "->%#016" PRIx64 " path %s\n", vma->e->pgoff, new_pgoff, ++ new_path); ++ vma->e->pgoff = new_pgoff; ++ rfi->path = xstrdup(new_path); ++ pr_debug("Updated rfi->path %s\n", rfi->path); ++ } ++ } ++ + if (ctx.flags != flags || ctx.desc != vma->vmfd) { + if (vma->e->status & VMA_AREA_MEMFD) + ret = memfd_open(vma->vmfd, &flags); +diff --git a/criu/include/criu-plugin.h b/criu/include/criu-plugin.h +index 897666ecd..0bc7a4255 100644 +--- a/criu/include/criu-plugin.h ++++ b/criu/include/criu-plugin.h +@@ -22,6 +22,8 @@ + + #include + #include ++#include ++#include + + #define CRIU_PLUGIN_GEN_VERSION(a, b, c) (((a) << 16) + ((b) << 8) + (c)) + #define CRIU_PLUGIN_VERSION_MAJOR 0 +@@ -48,6 +50,12 @@ enum { + + CR_PLUGIN_HOOK__DUMP_EXT_LINK = 6, + ++ CR_PLUGIN_HOOK__HANDLE_DEVICE_VMA = 7, ++ ++ CR_PLUGIN_HOOK__UPDATE_VMA_MAP = 8, ++ ++ CR_PLUGIN_HOOK__RESUME_DEVICES_LATE = 9, ++ + CR_PLUGIN_HOOK__MAX + }; + +@@ -60,6 +68,10 @@ DECLARE_PLUGIN_HOOK_ARGS(CR_PLUGIN_HOOK__RESTORE_EXT_FILE, int id); + DECLARE_PLUGIN_HOOK_ARGS(CR_PLUGIN_HOOK__DUMP_EXT_MOUNT, char *mountpoint, int id); + DECLARE_PLUGIN_HOOK_ARGS(CR_PLUGIN_HOOK__RESTORE_EXT_MOUNT, int id, char *mountpoint, char *old_root, int *is_file); + DECLARE_PLUGIN_HOOK_ARGS(CR_PLUGIN_HOOK__DUMP_EXT_LINK, int index, int type, char *kind); ++DECLARE_PLUGIN_HOOK_ARGS(CR_PLUGIN_HOOK__HANDLE_DEVICE_VMA, int fd, const struct stat *stat); ++DECLARE_PLUGIN_HOOK_ARGS(CR_PLUGIN_HOOK__UPDATE_VMA_MAP, const char *old_path, char *new_path, const uint64_t addr, ++ const uint64_t old_pgoff, uint64_t *new_pgoff); ++DECLARE_PLUGIN_HOOK_ARGS(CR_PLUGIN_HOOK__RESUME_DEVICES_LATE, int pid); + + enum { + CR_PLUGIN_STAGE__DUMP, +@@ -130,5 +142,9 @@ typedef int(cr_plugin_restore_file_t)(int id); + typedef int(cr_plugin_dump_ext_mount_t)(char *mountpoint, int id); + typedef int(cr_plugin_restore_ext_mount_t)(int id, char *mountpoint, char *old_root, int *is_file); + typedef int(cr_plugin_dump_ext_link_t)(int index, int type, char *kind); ++typedef int(cr_plugin_handle_device_vma_t)(int fd, const struct stat *stat); ++typedef int(cr_plugin_update_vma_map_t)(const char *old_path, char *new_path, const uint64_t addr, ++ const uint64_t old_pgoff, uint64_t *new_pgoff); ++typedef int(cr_plugin_resume_devices_late_t)(int pid); + + #endif /* __CRIU_PLUGIN_H__ */ +diff --git a/criu/plugin.c b/criu/plugin.c +index 3fe03c7cd..f3fea2856 100644 +--- a/criu/plugin.c ++++ b/criu/plugin.c +@@ -54,6 +54,9 @@ static cr_plugin_desc_t *cr_gen_plugin_desc(void *h, char *path) + __assign_hook(DUMP_EXT_MOUNT, "cr_plugin_dump_ext_mount"); + __assign_hook(RESTORE_EXT_MOUNT, "cr_plugin_restore_ext_mount"); + __assign_hook(DUMP_EXT_LINK, "cr_plugin_dump_ext_link"); ++ __assign_hook(HANDLE_DEVICE_VMA, "cr_plugin_handle_device_vma"); ++ __assign_hook(UPDATE_VMA_MAP, "cr_plugin_update_vma_map"); ++ __assign_hook(RESUME_DEVICES_LATE, "cr_plugin_resume_devices_late"); + + #undef __assign_hook + +diff --git a/criu/proc_parse.c b/criu/proc_parse.c +index f3491e781..8a9ce3a37 100644 +--- a/criu/proc_parse.c ++++ b/criu/proc_parse.c +@@ -45,6 +45,7 @@ + #include "protobuf.h" + #include "images/fdinfo.pb-c.h" + #include "images/mnt.pb-c.h" ++#include "plugin.h" + + #include + +@@ -103,6 +104,19 @@ bool is_vma_range_fmt(char *line) + return __is_vma_range_fmt(line); + } + ++bool handle_vma_plugin(int *fd, struct stat *stat) ++{ ++ int ret; ++ ++ ret = run_plugins(HANDLE_DEVICE_VMA, *fd, stat); ++ if (ret < 0) { ++ pr_perror("handle_device_vma plugin failed"); ++ return false; ++ } ++ ++ return true; ++} ++ + static void __parse_vmflags(char *buf, u32 *flags, u64 *madv, int *io_pf) + { + char *tok; +@@ -188,6 +202,7 @@ struct vma_file_info { + int dev_min; + unsigned long ino; + struct vma_area *vma; ++ bool has_device_plugin; + }; + + static inline int vfi_equal(struct vma_file_info *a, struct vma_file_info *b) +@@ -577,11 +592,17 @@ static int handle_vma(pid_t pid, struct vma_area *vma_area, const char *file_pat + } else if (*vm_file_fd >= 0) { + struct stat *st_buf = vma_area->vmst; + +- if (S_ISREG(st_buf->st_mode)) ++ if (S_ISREG(st_buf->st_mode)) { + /* regular file mapping -- supported */; +- else if (S_ISCHR(st_buf->st_mode) && (st_buf->st_rdev == DEVZERO)) ++ pr_debug("Found regular file mapping, OK\n"); ++ } else if (S_ISCHR(st_buf->st_mode) && (st_buf->st_rdev == DEVZERO)) { + /* devzero mapping -- also makes sense */; +- else { ++ pr_debug("Found devzero mapping, OK\n"); ++ } else if (handle_vma_plugin(vm_file_fd, st_buf)) { ++ pr_info("Found device file mapping, plugin is available\n"); ++ vfi->has_device_plugin = true; ++ } else { ++ /* non-regular mapping with no supporting plugin */ + pr_err("Can't handle non-regular mapping on %d's map %" PRIx64 "\n", pid, vma_area->e->start); + goto err; + } +@@ -646,9 +667,23 @@ static int vma_list_add(struct vma_area *vma_area, struct vm_area_list *vma_area + struct vma_file_info *vfi, struct vma_file_info *prev_vfi) + { + if (vma_area->e->status & VMA_UNSUPP) { +- pr_err("Unsupported mapping found %016" PRIx64 "-%016" PRIx64 "\n", vma_area->e->start, +- vma_area->e->end); +- return -1; ++ if (vfi->has_device_plugin) { ++ /* Unsupported VMAs that provide special plugins for ++ * backup can be treated as regular VMAs and criu ++ * should only save their metadata in the dump files. ++ * There can be several special backup plugins hooks ++ * that might run at different stages during checkpoint ++ * and restore. ++ */ ++ pr_debug("Device file mapping %016" PRIx64 "-%016" PRIx64 " " ++ "must be supported via device plugins\n", ++ vma_area->e->start, vma_area->e->end); ++ ++ } else { ++ pr_err("Unsupported mapping found %016" PRIx64 "-%016" PRIx64 "\n", vma_area->e->start, ++ vma_area->e->end); ++ return -1; ++ } + } + + /* Add a guard page only if here is enough space for it */ +-- +2.34.1 + diff --git a/0006-criu-plugin-Implement-dummy-amdgpu-plugin-hooks.patch b/0006-criu-plugin-Implement-dummy-amdgpu-plugin-hooks.patch new file mode 100644 index 0000000..6fb4d9b --- /dev/null +++ b/0006-criu-plugin-Implement-dummy-amdgpu-plugin-hooks.patch @@ -0,0 +1,160 @@ +From 3470e3d012a2706463cd77afce0a33f3581c2721 Mon Sep 17 00:00:00 2001 +From: Rajneesh Bhardwaj +Date: Thu, 15 Jul 2021 01:34:08 -0400 +Subject: [PATCH 006/120] criu/plugin: Implement dummy amdgpu plugin hooks + +This is just a placeholder dummy plugin and will be replaced by a proper +plugin that implements support for AMD GPU devices. This just +facilitates the initial pull request and CI build test trigger for early +code review of CRIU specific changes. Future PRs will bring in more +support for amdgpu_plugin to enable CRIU with AMD ROCm. + +Signed-off-by: Rajneesh Bhardwaj +--- + Makefile | 12 ++++++++++-- + Makefile.install | 8 +++++++- + plugins/amdgpu/Makefile | 13 +++++++++++++ + plugins/amdgpu/dummy_plugin.c | 36 +++++++++++++++++++++++++++++++++++ + 4 files changed, 66 insertions(+), 3 deletions(-) + create mode 100644 plugins/amdgpu/Makefile + create mode 100644 plugins/amdgpu/dummy_plugin.c + +diff --git a/Makefile b/Makefile +index a1e3977f8..e361e8a8f 100644 +--- a/Makefile ++++ b/Makefile +@@ -294,15 +294,19 @@ clean mrproper: + $(Q) $(MAKE) $(build)=crit $@ + .PHONY: clean mrproper + ++clean-dummy_amdgpu_plugin: ++ $(Q) $(MAKE) -C plugins/amdgpu clean ++.PHONY: clean dummy_amdgpu_plugin ++ + clean-top: + $(Q) $(MAKE) -C Documentation clean + $(Q) $(MAKE) $(build)=test/compel clean + $(Q) $(RM) .gitid + .PHONY: clean-top + +-clean: clean-top ++clean: clean-top clean-dummy_amdgpu_plugin + +-mrproper-top: clean-top ++mrproper-top: clean-top clean-dummy_amdgpu_plugin + $(Q) $(RM) $(CONFIG_HEADER) + $(Q) $(RM) $(VERSION_HEADER) + $(Q) $(RM) $(COMPEL_VERSION_HEADER) +@@ -330,6 +334,10 @@ test: zdtm + $(Q) $(MAKE) -C test + .PHONY: test + ++dummy_amdgpu_plugin: ++ $(Q) $(MAKE) -C plugins/amdgpu all ++.PHONY: dummy_amdgpu_plugin ++ + # + # Generating tar requires tag matched CRIU_VERSION. + # If not found then simply use GIT's describe with +diff --git a/Makefile.install b/Makefile.install +index 3987bcc6f..52e8c06da 100644 +--- a/Makefile.install ++++ b/Makefile.install +@@ -7,6 +7,7 @@ MANDIR ?= $(PREFIX)/share/man + INCLUDEDIR ?= $(PREFIX)/include + LIBEXECDIR ?= $(PREFIX)/libexec + RUNDIR ?= /run ++PLUGINDIR ?= /var/lib/criu + + # + # For recent Debian/Ubuntu with multiarch support. +@@ -26,7 +27,7 @@ endif + LIBDIR ?= $(PREFIX)/lib + + export PREFIX BINDIR SBINDIR MANDIR RUNDIR +-export LIBDIR INCLUDEDIR LIBEXECDIR ++export LIBDIR INCLUDEDIR LIBEXECDIR PLUGINDIR + + install-man: + $(Q) $(MAKE) -C Documentation install +@@ -40,6 +41,10 @@ install-criu: criu + $(Q) $(MAKE) $(build)=criu install + .PHONY: install-criu + ++install-dummy_amdgpu_plugin: dummy_amdgpu_plugin ++ $(Q) $(MAKE) -C plugins/amdgpu install ++.PHONY: install-dummy_amdgpu_plugin ++ + install-compel: $(compel-install-targets) + $(Q) $(MAKE) $(build)=compel install + $(Q) $(MAKE) $(build)=compel/plugins install +@@ -54,4 +59,5 @@ uninstall: + $(Q) $(MAKE) $(build)=criu $@ + $(Q) $(MAKE) $(build)=compel $@ + $(Q) $(MAKE) $(build)=compel/plugins $@ ++ $(Q) $(MAKE) -C plugins/amdgpu $@ + .PHONY: uninstall +diff --git a/plugins/amdgpu/Makefile b/plugins/amdgpu/Makefile +new file mode 100644 +index 000000000..45a9ec611 +--- /dev/null ++++ b/plugins/amdgpu/Makefile +@@ -0,0 +1,13 @@ ++all: dummy_plugin.so ++ ++dummy_plugin.so: dummy_plugin.c ++ gcc -g -Werror -D _GNU_SOURCE -Wall -shared -nostartfiles dummy_plugin.c -o dummy_plugin.so -iquote ../../../criu/include -iquote ../../criu/include -fPIC ++ ++clean: ++ $(Q) $(RM) dummy_plugin.so ++install: ++ $(Q) mkdir -p $(PLUGINDIR) ++ $(Q) install -m 644 dummy_plugin.so $(PLUGINDIR) ++ ++uninstall: ++ $(Q) $(RM) $(PLUGINDIR)/dummy_plugin.so +diff --git a/plugins/amdgpu/dummy_plugin.c b/plugins/amdgpu/dummy_plugin.c +new file mode 100644 +index 000000000..872276095 +--- /dev/null ++++ b/plugins/amdgpu/dummy_plugin.c +@@ -0,0 +1,36 @@ ++#include ++ ++#include "criu-log.h" ++#include "criu-plugin.h" ++ ++int dummy_plugin_handle_device_vma(int fd, const struct stat *stat) ++{ ++ pr_info("dummy_plugin: Inside %s for fd = %d\n", __func__, fd); ++ /* let criu report failure for the unsupported mapping */ ++ return -ENOTSUP; ++} ++CR_PLUGIN_REGISTER_HOOK(CR_PLUGIN_HOOK__HANDLE_DEVICE_VMA, dummy_plugin_handle_device_vma) ++ ++int dummy_plugin_resume_devices_late(int target_pid) ++{ ++ pr_info("dummy_plugin: Inside %s for target pid = %d\n", __func__, target_pid); ++ return -ENOTSUP; ++} ++CR_PLUGIN_REGISTER_HOOK(CR_PLUGIN_HOOK__RESUME_DEVICES_LATE, dummy_plugin_resume_devices_late) ++ ++/* ++ * return 0 if no match found ++ * return -1 for error or -ENOTSUP. ++ * return 1 if vmap map must be adjusted. ++ */ ++int dummy_plugin_update_vmamap(const char *old_path, char *new_path, const uint64_t addr, const uint64_t old_offset, ++ uint64_t *new_offset) ++{ ++ uint64_t temp = 100; ++ ++ *new_offset = temp; ++ pr_info("dummy_plugin: old_pgoff= 0x%lu new_pgoff = 0x%lx old_path = %s new_path = %s addr = 0x%lu\n", ++ old_offset, *new_offset, old_path, new_path, addr); ++ return -ENOTSUP; ++} ++CR_PLUGIN_REGISTER_HOOK(CR_PLUGIN_HOOK__UPDATE_VMA_MAP, dummy_plugin_update_vmamap) +-- +2.34.1 + diff --git a/0007-criu-files-Don-t-cache-fd-ids-for-device-files.patch b/0007-criu-files-Don-t-cache-fd-ids-for-device-files.patch new file mode 100644 index 0000000..5d169ed --- /dev/null +++ b/0007-criu-files-Don-t-cache-fd-ids-for-device-files.patch @@ -0,0 +1,41 @@ +From 951f8bc4db77ed71a7929c8a0a6c754a5dbb8919 Mon Sep 17 00:00:00 2001 +From: Rajneesh Bhardwaj +Date: Tue, 27 Apr 2021 19:08:57 -0400 +Subject: [PATCH 007/120] criu/files: Don't cache fd ids for device files + +Restore operation fails when we perform CR operation of multiple +independent proceses that have device files because criu caches +the ids for the device files with same mnt_ids, inode pair. This +change ensures that even in case of a cached id found for a device, a +unique subid is generated and returned which is used for dumping. + +Suggested-by: Andrei Vagin +Signed-off-by: Rajneesh Bhardwaj +--- + criu/file-ids.c | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +diff --git a/criu/file-ids.c b/criu/file-ids.c +index 1b9d68888..772bd92cf 100644 +--- a/criu/file-ids.c ++++ b/criu/file-ids.c +@@ -77,8 +77,14 @@ int fd_id_generate_special(struct fd_parms *p, u32 *id) + + fi = fd_id_cache_lookup(p); + if (fi) { +- *id = fi->id; +- return 0; ++ if (p->stat.st_mode & (S_IFCHR | S_IFBLK)) { ++ /* Don't cache the id for mapped devices */ ++ *id = fd_tree.subid++; ++ return 1; ++ } else { ++ *id = fi->id; ++ return 0; ++ } + } + } + +-- +2.34.1 + diff --git a/0008-tcp-Skip-restoring-TCP-state-when-dumping-with-tcp-c.patch b/0008-tcp-Skip-restoring-TCP-state-when-dumping-with-tcp-c.patch new file mode 100644 index 0000000..e2788fd --- /dev/null +++ b/0008-tcp-Skip-restoring-TCP-state-when-dumping-with-tcp-c.patch @@ -0,0 +1,40 @@ +From de3a7112b8e44993e077ffe03e4e4aa38bd20325 Mon Sep 17 00:00:00 2001 +From: Bui Quang Minh +Date: Thu, 12 Aug 2021 11:05:09 +0000 +Subject: [PATCH 008/120] tcp: Skip restoring TCP state when dumping with + --tcp-close + +Since commit e42f5e0 ("tcp: allow to specify --tcp-close on dump"), +--tcp-close option can be used when checkpointing. This option skips +checkpointing established socket's state (including once established +but now closed socket). However, when restoring, we still try to +restore closed socket's state. As a result, a non-existent protobuf +image is opened. + +This commit skips TCP_CLOSE socket when restoring established TCP +connection and removes the redundant check for TCP_LISTEN socket as +TCP_LISTEN socket cannot reach this function. + +Suggested-by: Andrei Vagin +Suggested-by: Radostin Stoyanov +Signed-off-by: Bui Quang Minh +--- + criu/sk-tcp.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/criu/sk-tcp.c b/criu/sk-tcp.c +index 0afecd2d6..96d5d13bf 100644 +--- a/criu/sk-tcp.c ++++ b/criu/sk-tcp.c +@@ -451,7 +451,7 @@ int restore_one_tcp(int fd, struct inet_sk_info *ii) + + pr_info("Restoring TCP connection\n"); + +- if (opts.tcp_close && ii->ie->state != TCP_LISTEN && ii->ie->state != TCP_CLOSE) { ++ if (opts.tcp_close) { + if (shutdown(fd, SHUT_RDWR) && errno != ENOTCONN) { + pr_perror("Unable to shutdown the socket id %x ino %x", ii->ie->id, ii->ie->ino); + } +-- +2.34.1 + diff --git a/0009-zdtm-Dumping-restoring-with-tcp-close-on-TCP_CLOSE-s.patch b/0009-zdtm-Dumping-restoring-with-tcp-close-on-TCP_CLOSE-s.patch new file mode 100644 index 0000000..cf09bb4 --- /dev/null +++ b/0009-zdtm-Dumping-restoring-with-tcp-close-on-TCP_CLOSE-s.patch @@ -0,0 +1,110 @@ +From 40fc4f667fb614fef765489843aa038b61c31d2e Mon Sep 17 00:00:00 2001 +From: Bui Quang Minh +Date: Mon, 20 Sep 2021 20:57:03 +0700 +Subject: [PATCH 009/120] zdtm: Dumping/restoring with --tcp-close on TCP_CLOSE + socket + +Signed-off-by: Bui Quang Minh +--- + test/zdtm/static/Makefile | 1 + + test/zdtm/static/socket-tcp-close2.c | 67 +++++++++++++++++++++++++ + test/zdtm/static/socket-tcp-close2.desc | 1 + + 3 files changed, 69 insertions(+) + create mode 100644 test/zdtm/static/socket-tcp-close2.c + create mode 100644 test/zdtm/static/socket-tcp-close2.desc + +diff --git a/test/zdtm/static/Makefile b/test/zdtm/static/Makefile +index c9e6589f0..b6aa621c7 100644 +--- a/test/zdtm/static/Makefile ++++ b/test/zdtm/static/Makefile +@@ -107,6 +107,7 @@ TST_NOFILE := \ + socket-tcp4v6-closed \ + socket-tcp-close0 \ + socket-tcp-close1 \ ++ socket-tcp-close2 \ + socket-dump-tcp-close \ + socket-tcp-unconn \ + socket-tcp6-unconn \ +diff --git a/test/zdtm/static/socket-tcp-close2.c b/test/zdtm/static/socket-tcp-close2.c +new file mode 100644 +index 000000000..697c99f39 +--- /dev/null ++++ b/test/zdtm/static/socket-tcp-close2.c +@@ -0,0 +1,67 @@ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "zdtmtst.h" ++ ++const char *test_doc = "Check both dump and restore with tcp_close on TCP_CLOSE sockets"; ++const char *test_author = "Bui Quang Minh "; ++ ++static int port = 8880; ++ ++int main(int argc, char **argv) ++{ ++ int fd_s, fd, client; ++ char c; ++ ++ test_init(argc, argv); ++ signal(SIGPIPE, SIG_IGN); ++ ++ fd_s = tcp_init_server(AF_INET, &port); ++ if (fd_s < 0) { ++ pr_err("Server initializations failed\n"); ++ return 1; ++ } ++ ++ client = tcp_init_client(AF_INET, "localhost", port); ++ if (client < 0) { ++ pr_err("Client initializations failed\n"); ++ return 1; ++ } ++ ++ fd = tcp_accept_server(fd_s); ++ if (fd < 0) { ++ pr_err("Can't accept client\n"); ++ return 1; ++ } ++ close(fd_s); ++ ++ shutdown(client, SHUT_WR); ++ shutdown(fd, SHUT_WR); ++ ++ test_daemon(); ++ test_waitsig(); ++ ++ if (read(fd, &c, 1) != 0) { ++ fail("read server"); ++ return 1; ++ } ++ if (read(client, &c, 1) != 0) { ++ fail("read client"); ++ return 1; ++ } ++ if (write(client, &c, 1) != -1) { ++ fail("write client"); ++ return 1; ++ } ++ if (write(fd, &c, 1) != -1) { ++ fail("write server"); ++ return 1; ++ } ++ ++ pass(); ++ return 0; ++} +diff --git a/test/zdtm/static/socket-tcp-close2.desc b/test/zdtm/static/socket-tcp-close2.desc +new file mode 100644 +index 000000000..c53a1f315 +--- /dev/null ++++ b/test/zdtm/static/socket-tcp-close2.desc +@@ -0,0 +1 @@ ++{'opts': '--tcp-close', 'flags': 'reqrst '} +-- +2.34.1 + diff --git a/0010-criu-8-Add-more-detailed-description-about-tcp-close.patch b/0010-criu-8-Add-more-detailed-description-about-tcp-close.patch new file mode 100644 index 0000000..562a1d4 --- /dev/null +++ b/0010-criu-8-Add-more-detailed-description-about-tcp-close.patch @@ -0,0 +1,33 @@ +From 4eb1a3da7d65ae798db324153d693adef13ef6ed Mon Sep 17 00:00:00 2001 +From: Bui Quang Minh +Date: Mon, 4 Oct 2021 20:38:34 +0700 +Subject: [PATCH 010/120] criu(8): Add more detailed description about + --tcp-close dump option + +The expected behavior of --tcp-close option when dumpping is to close +all established tcp connections including connection that is once +established but now closed. This adds an explicit description about +that behavior. + +Signed-off-by: Bui Quang Minh +--- + Documentation/criu.txt | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/Documentation/criu.txt b/Documentation/criu.txt +index 3c4c1eaf8..4c6885fc9 100644 +--- a/Documentation/criu.txt ++++ b/Documentation/criu.txt +@@ -334,7 +334,8 @@ mount -t cgroup -o devices,freezer none devices,freezer + Checkpoint established TCP connections. + + *--tcp-close*:: +- Don't dump the state of, or block, established tcp connections. ++ Don't dump the state of, or block, established tcp connections ++ (including the connection is once established but now closed). + This is useful when tcp connections are not going to be restored. + + *--skip-in-flight*:: +-- +2.34.1 + diff --git a/0011-Add-support-for-python3-in-criu-coredump.patch b/0011-Add-support-for-python3-in-criu-coredump.patch new file mode 100644 index 0000000..aee8e7f --- /dev/null +++ b/0011-Add-support-for-python3-in-criu-coredump.patch @@ -0,0 +1,311 @@ +From 96acfa9af099f17a14d985ac5e9ee9769d9ebe2c Mon Sep 17 00:00:00 2001 +From: Andrey Vyazovtsev +Date: Thu, 26 Aug 2021 22:22:33 +0300 +Subject: [PATCH 011/120] Add support for python3 in criu-coredump + +Resolve the following python3 portability issues: + +1) Python 3 needs explicit relative import path. + +2) Coredumps are binary data, not unicode strings. Use byte strings +(b"" instead of "") and open files in binary format. + +3) Some functions (for example: filter) return a list in python 2, +but an iterator in python 3. Port code to a common subset of python 2 +and python 3 using itertool. + +4) Division operator / changed meaning in Python 3. Use explicit +integer division (//) where appropriate. + +Signed-off-by: Andrey Vyazovtsev +--- + coredump/criu-coredump | 4 +- + coredump/criu_coredump/__init__.py | 4 +- + coredump/criu_coredump/coredump.py | 68 ++++++++++++++++++------------ + coredump/criu_coredump/elf.py | 2 +- + 4 files changed, 45 insertions(+), 33 deletions(-) + +diff --git a/coredump/criu-coredump b/coredump/criu-coredump +index 25c188c6b..d3113d372 100755 +--- a/coredump/criu-coredump ++++ b/coredump/criu-coredump +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python2 ++#!/usr/bin/env python + import argparse + import os + +@@ -10,7 +10,7 @@ def coredump(opts): + for pid in cores: + if opts['pid'] and pid != opts['pid']: + continue +- with open(os.path.realpath(opts['out'])+"/core."+str(pid), 'w+') as f: ++ with open(os.path.realpath(opts['out'])+"/core."+str(pid), 'wb+') as f: + cores[pid].write(f) + + +diff --git a/coredump/criu_coredump/__init__.py b/coredump/criu_coredump/__init__.py +index 213af42ec..7f947518e 100644 +--- a/coredump/criu_coredump/__init__.py ++++ b/coredump/criu_coredump/__init__.py +@@ -1,2 +1,2 @@ +-from coredump import * +-import elf ++from .coredump import * ++from . import elf +diff --git a/coredump/criu_coredump/coredump.py b/coredump/criu_coredump/coredump.py +index b37ef2291..d67c335c1 100644 +--- a/coredump/criu_coredump/coredump.py ++++ b/coredump/criu_coredump/coredump.py +@@ -29,9 +29,14 @@ + # 4) VMAs contents; + # + import io +-import elf ++import sys ++from . import elf + import ctypes + from pycriu import images ++try: ++ from itertools import ifilter as filter ++except ImportError: ++ pass + + # Some memory-related constants + PAGESIZE = 4096 +@@ -88,7 +93,7 @@ class coredump: + for note in self.notes: + buf.write(note.nhdr) + buf.write(note.owner) +- buf.write("\0" * (8 - len(note.owner))) ++ buf.write(b"\0" * (8 - len(note.owner))) + buf.write(note.data) + + offset = ctypes.sizeof(elf.Elf64_Ehdr()) +@@ -136,7 +141,7 @@ class coredump_generator: + path += "-" + str(pid) + path += ".img" + +- with open(path) as f: ++ with open(path, 'rb') as f: + img = images.load(f) + + if single: +@@ -177,7 +182,7 @@ class coredump_generator: + for p in self.coredumps: + if pid and p != pid: + continue +- with open(coredumps_dir + "/" + "core." + str(p), 'w+') as f: ++ with open(coredumps_dir + "/" + "core." + str(p), 'wb+') as f: + self.coredumps[p].write(f) + + def _gen_coredump(self, pid): +@@ -295,7 +300,7 @@ class coredump_generator: + prpsinfo.pr_state = 3 + # Don't even ask me why it is so, just borrowed from linux + # source and made pr_state match. +- prpsinfo.pr_sname = '.' if prpsinfo.pr_state > 5 else "RSDTZW" [ ++ prpsinfo.pr_sname = b'.' if prpsinfo.pr_state > 5 else b"RSDTZW" [ + prpsinfo.pr_state] + prpsinfo.pr_zomb = 1 if prpsinfo.pr_state == 4 else 0 + prpsinfo.pr_nice = core["thread_core"][ +@@ -307,8 +312,12 @@ class coredump_generator: + prpsinfo.pr_ppid = pstree["ppid"] + prpsinfo.pr_pgrp = pstree["pgid"] + prpsinfo.pr_sid = pstree["sid"] +- prpsinfo.pr_fname = core["tc"]["comm"] + prpsinfo.pr_psargs = self._gen_cmdline(pid) ++ if (sys.version_info > (3, 0)): ++ prpsinfo.pr_fname = core["tc"]["comm"].encode() ++ else: ++ prpsinfo.pr_fname = core["tc"]["comm"] ++ + + nhdr = elf.Elf64_Nhdr() + nhdr.n_namesz = 5 +@@ -317,7 +326,7 @@ class coredump_generator: + + note = elf_note() + note.data = prpsinfo +- note.owner = "CORE" ++ note.owner = b"CORE" + note.nhdr = nhdr + + return note +@@ -375,7 +384,7 @@ class coredump_generator: + + note = elf_note() + note.data = prstatus +- note.owner = "CORE" ++ note.owner = b"CORE" + note.nhdr = nhdr + + return note +@@ -411,7 +420,7 @@ class coredump_generator: + + note = elf_note() + note.data = fpregset +- note.owner = "CORE" ++ note.owner = b"CORE" + note.nhdr = nhdr + + return note +@@ -452,7 +461,7 @@ class coredump_generator: + + note = elf_note() + note.data = data +- note.owner = "LINUX" ++ note.owner = b"LINUX" + note.nhdr = nhdr + + return note +@@ -472,7 +481,7 @@ class coredump_generator: + + note = elf_note() + note.data = siginfo +- note.owner = "CORE" ++ note.owner = b"CORE" + note.nhdr = nhdr + + return note +@@ -482,7 +491,7 @@ class coredump_generator: + Generate NT_AUXV note for thread tid of process pid. + """ + mm = self.mms[pid] +- num_auxv = len(mm["mm_saved_auxv"]) / 2 ++ num_auxv = len(mm["mm_saved_auxv"]) // 2 + + class elf_auxv(ctypes.Structure): + _fields_ = [("auxv", elf.Elf64_auxv_t * num_auxv)] +@@ -499,7 +508,7 @@ class coredump_generator: + + note = elf_note() + note.data = auxv +- note.owner = "CORE" ++ note.owner = b"CORE" + note.nhdr = nhdr + + return note +@@ -523,10 +532,10 @@ class coredump_generator: + continue + + shmid = vma["shmid"] +- off = vma["pgoff"] / PAGESIZE ++ off = vma["pgoff"] // PAGESIZE + + files = self.reg_files +- fname = filter(lambda x: x["id"] == shmid, files)[0]["name"] ++ fname = next(filter(lambda x: x["id"] == shmid, files))["name"] + + info = mmaped_file_info() + info.start = vma["start"] +@@ -569,7 +578,10 @@ class coredump_generator: + setattr(data, "start" + str(i), info.start) + setattr(data, "end" + str(i), info.end) + setattr(data, "file_ofs" + str(i), info.file_ofs) +- setattr(data, "name" + str(i), info.name) ++ if (sys.version_info > (3, 0)): ++ setattr(data, "name" + str(i), info.name.encode()) ++ else: ++ setattr(data, "name" + str(i), info.name) + + nhdr = elf.Elf64_Nhdr() + +@@ -579,7 +591,7 @@ class coredump_generator: + + note = elf_note() + note.nhdr = nhdr +- note.owner = "CORE" ++ note.owner = b"CORE" + note.data = data + + return note +@@ -644,7 +656,7 @@ class coredump_generator: + ppid = self.pstree[pid]["ppid"] + return self._get_page(ppid, page_no) + else: +- with open(self._imgs_dir + "/pages-%s.img" % pages_id) as f: ++ with open(self._imgs_dir + "/pages-%s.img" % pages_id, 'rb') as f: + f.seek(off * PAGESIZE) + return f.read(PAGESIZE) + +@@ -657,16 +669,16 @@ class coredump_generator: + f = None + + if size == 0: +- return "" ++ return b"" + + if vma["status"] & status["VMA_AREA_VVAR"]: + #FIXME this is what gdb does, as vvar vma + # is not readable from userspace? +- return "\0" * size ++ return b"\0" * size + elif vma["status"] & status["VMA_AREA_VSYSCALL"]: + #FIXME need to dump it with criu or read from + # current process. +- return "\0" * size ++ return b"\0" * size + + if vma["status"] & status["VMA_FILE_SHARED"] or \ + vma["status"] & status["VMA_FILE_PRIVATE"]: +@@ -675,9 +687,9 @@ class coredump_generator: + off = vma["pgoff"] + + files = self.reg_files +- fname = filter(lambda x: x["id"] == shmid, files)[0]["name"] ++ fname = next(filter(lambda x: x["id"] == shmid, files))["name"] + +- f = open(fname) ++ f = open(fname, 'rb') + f.seek(off) + + start = vma["start"] +@@ -699,10 +711,10 @@ class coredump_generator: + # a file, and changed ones -- from pages.img. + # Finally, if no page is found neither in pages.img nor + # in file, hole in inserted -- a page filled with zeroes. +- start_page = start / PAGESIZE +- end_page = end / PAGESIZE ++ start_page = start // PAGESIZE ++ end_page = end // PAGESIZE + +- buf = "" ++ buf = b"" + for page_no in range(start_page, end_page + 1): + page = None + +@@ -720,7 +732,7 @@ class coredump_generator: + + if page is None: + # Hole +- page = PAGESIZE * "\0" ++ page = PAGESIZE * b"\0" + + # If it is a start or end page, we need to read + # only part of it. +@@ -762,7 +774,7 @@ class coredump_generator: + chunk = self._gen_mem_chunk(pid, vma, size) + + # Replace all '\0's with spaces. +- return chunk.replace('\0', ' ') ++ return chunk.replace(b'\0', b' ') + + def _get_vma_dump_size(self, vma): + """ +diff --git a/coredump/criu_coredump/elf.py b/coredump/criu_coredump/elf.py +index e65919e6b..a670ae866 100644 +--- a/coredump/criu_coredump/elf.py ++++ b/coredump/criu_coredump/elf.py +@@ -368,7 +368,7 @@ elf_fpregset_t = user_fpregs_struct + # siginfo_t related constants. + + _SI_MAX_SIZE = 128 +-_SI_PAD_SIZE = (_SI_MAX_SIZE / ctypes.sizeof(ctypes.c_int)) - 4 ++_SI_PAD_SIZE = (_SI_MAX_SIZE // ctypes.sizeof(ctypes.c_int)) - 4 + + + # /* kill(). */ +-- +2.34.1 + diff --git a/0012-Add-new-files-for-running-criu-coredump-via-python-2.patch b/0012-Add-new-files-for-running-criu-coredump-via-python-2.patch new file mode 100644 index 0000000..27d5be2 --- /dev/null +++ b/0012-Add-new-files-for-running-criu-coredump-via-python-2.patch @@ -0,0 +1,71 @@ +From db79777cf017751ec54d2534966b237927f23a15 Mon Sep 17 00:00:00 2001 +From: AndreyVV-100 +Date: Fri, 23 Jul 2021 12:48:03 +0300 +Subject: [PATCH 012/120] Add new files for running criu-coredump via python 2 + or 3 + +Previous commit added support for python3 in criu-coredump. For convenience, +add two files (coredump-python2 and coredump-python3) that start +criu-coredump with respective python version. Edit env.sh accordingly. + +Signed-off-by: Andrey Vyazovtsev +--- + coredump/coredump-python2 | 6 ++++++ + coredump/coredump-python3 | 6 ++++++ + coredump/{criu-coredump => coredump.py} | 1 - + test/others/env.sh | 2 +- + 4 files changed, 13 insertions(+), 2 deletions(-) + create mode 100755 coredump/coredump-python2 + create mode 100755 coredump/coredump-python3 + rename coredump/{criu-coredump => coredump.py} (97%) + +diff --git a/coredump/coredump-python2 b/coredump/coredump-python2 +new file mode 100755 +index 000000000..3a15c90a3 +--- /dev/null ++++ b/coredump/coredump-python2 +@@ -0,0 +1,6 @@ ++#!/usr/bin/env python2 ++ ++import coredump ++ ++if __name__ == '__main__': ++ coredump.main() +diff --git a/coredump/coredump-python3 b/coredump/coredump-python3 +new file mode 100755 +index 000000000..82ec6b855 +--- /dev/null ++++ b/coredump/coredump-python3 +@@ -0,0 +1,6 @@ ++#!/usr/bin/env python3 ++ ++import coredump ++ ++if __name__ == '__main__': ++ coredump.main() +diff --git a/coredump/criu-coredump b/coredump/coredump.py +similarity index 97% +rename from coredump/criu-coredump +rename to coredump/coredump.py +index d3113d372..56ba54083 100755 +--- a/coredump/criu-coredump ++++ b/coredump/coredump.py +@@ -1,4 +1,3 @@ +-#!/usr/bin/env python + import argparse + import os + +diff --git a/test/others/env.sh b/test/others/env.sh +index b514e87d9..e2f63eee3 100755 +--- a/test/others/env.sh ++++ b/test/others/env.sh +@@ -13,5 +13,5 @@ fi + #export PYTHON + CRIT=$(readlink -f `dirname ${BASH_SOURCE[0]}`/../../crit/crit-"${PYTHON}") + crit=$CRIT +-CRIU_COREDUMP=$(readlink -f `dirname ${BASH_SOURCE[0]}`/../../criu-coredump/criu-coredump) ++CRIU_COREDUMP=$(readlink -f `dirname ${BASH_SOURCE[0]}`/../../criu-coredump/coredump-"${PYTHON}") + criu_coredump=$CRIU_COREDUMP +-- +2.34.1 + diff --git a/0013-coredump-remove-unused-import.patch b/0013-coredump-remove-unused-import.patch new file mode 100644 index 0000000..9667259 --- /dev/null +++ b/0013-coredump-remove-unused-import.patch @@ -0,0 +1,32 @@ +From e3f910ff3e9e3326e1df5e6d8e97dbbd8dc4af94 Mon Sep 17 00:00:00 2001 +From: Radostin Stoyanov +Date: Sun, 5 Sep 2021 21:31:12 +0100 +Subject: [PATCH 013/120] coredump: remove unused import + +Signed-off-by: Radostin Stoyanov +--- + coredump/criu_coredump/__init__.py | 3 +-- + scripts/flake8.cfg | 2 ++ + 2 files changed, 3 insertions(+), 2 deletions(-) + +diff --git a/coredump/criu_coredump/__init__.py b/coredump/criu_coredump/__init__.py +index 7f947518e..c1a437cf4 100644 +--- a/coredump/criu_coredump/__init__.py ++++ b/coredump/criu_coredump/__init__.py +@@ -1,2 +1 @@ +-from .coredump import * +-from . import elf ++from .coredump import coredump_generator +diff --git a/scripts/flake8.cfg b/scripts/flake8.cfg +index b6a587729..bd4f95bb2 100644 +--- a/scripts/flake8.cfg ++++ b/scripts/flake8.cfg +@@ -2,3 +2,5 @@ + # E501 line too long + # W504 line break after binary operator + ignore = E501,W504 ++# F401: imported but unused ++per-file-ignores = __init__.py:F401 +-- +2.34.1 + diff --git a/0014-coredump-sort-imports.patch b/0014-coredump-sort-imports.patch new file mode 100644 index 0000000..f7263a8 --- /dev/null +++ b/0014-coredump-sort-imports.patch @@ -0,0 +1,31 @@ +From 8b69c69dbec5e6b2a84083e609c3de4e15661c90 Mon Sep 17 00:00:00 2001 +From: Radostin Stoyanov +Date: Sun, 5 Sep 2021 21:32:17 +0100 +Subject: [PATCH 014/120] coredump: sort imports + +Signed-off-by: Radostin Stoyanov +--- + coredump/criu_coredump/coredump.py | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/coredump/criu_coredump/coredump.py b/coredump/criu_coredump/coredump.py +index d67c335c1..9b4aad5ff 100644 +--- a/coredump/criu_coredump/coredump.py ++++ b/coredump/criu_coredump/coredump.py +@@ -30,9 +30,12 @@ + # + import io + import sys +-from . import elf + import ctypes ++ + from pycriu import images ++from . import elf ++ ++ + try: + from itertools import ifilter as filter + except ImportError: +-- +2.34.1 + diff --git a/0015-coredump-convert-indentation-to-spaces.patch b/0015-coredump-convert-indentation-to-spaces.patch new file mode 100644 index 0000000..349a141 --- /dev/null +++ b/0015-coredump-convert-indentation-to-spaces.patch @@ -0,0 +1,107 @@ +From f0f0d7fd59774e1a1a695a49e429239ba4a5a469 Mon Sep 17 00:00:00 2001 +From: Radostin Stoyanov +Date: Sun, 5 Sep 2021 21:34:00 +0100 +Subject: [PATCH 015/120] coredump: convert indentation to spaces + +Signed-off-by: Radostin Stoyanov +--- + coredump/coredump-python2 | 2 +- + coredump/coredump-python3 | 2 +- + coredump/coredump.py | 58 ++++++++++++++++++++------------------- + 3 files changed, 32 insertions(+), 30 deletions(-) + +diff --git a/coredump/coredump-python2 b/coredump/coredump-python2 +index 3a15c90a3..564c05ce9 100755 +--- a/coredump/coredump-python2 ++++ b/coredump/coredump-python2 +@@ -3,4 +3,4 @@ + import coredump + + if __name__ == '__main__': +- coredump.main() ++ coredump.main() +diff --git a/coredump/coredump-python3 b/coredump/coredump-python3 +index 82ec6b855..3032dbadf 100755 +--- a/coredump/coredump-python3 ++++ b/coredump/coredump-python3 +@@ -3,4 +3,4 @@ + import coredump + + if __name__ == '__main__': +- coredump.main() ++ coredump.main() +diff --git a/coredump/coredump.py b/coredump/coredump.py +index 56ba54083..e63abf951 100755 +--- a/coredump/coredump.py ++++ b/coredump/coredump.py +@@ -3,37 +3,39 @@ import os + + import criu_coredump + ++ + def coredump(opts): +- generator = criu_coredump.coredump_generator() +- cores = generator(os.path.realpath(opts['in'])) +- for pid in cores: +- if opts['pid'] and pid != opts['pid']: +- continue +- with open(os.path.realpath(opts['out'])+"/core."+str(pid), 'wb+') as f: +- cores[pid].write(f) ++ generator = criu_coredump.coredump_generator() ++ cores = generator(os.path.realpath(opts['in'])) ++ for pid in cores: ++ if opts['pid'] and pid != opts['pid']: ++ continue ++ with open(os.path.realpath(opts['out'])+"/core."+str(pid), 'wb+') as f: ++ cores[pid].write(f) + + + def main(): +- desc = 'CRIU core dump' +- parser = argparse.ArgumentParser(description=desc, +- formatter_class=argparse.RawTextHelpFormatter) +- +- parser.add_argument('-i', +- '--in', +- default = '.', +- help = 'directory where to get images from') +- parser.add_argument('-p', +- '--pid', +- type = int, +- help = 'generate coredump for specific pid(all pids py default)') +- parser.add_argument('-o', +- '--out', +- default = '.', +- help = 'directory to write coredumps to') +- +- opts = vars(parser.parse_args()) +- +- coredump(opts) ++ desc = 'CRIU core dump' ++ parser = argparse.ArgumentParser(description=desc, ++ formatter_class=argparse.RawTextHelpFormatter) ++ ++ parser.add_argument('-i', ++ '--in', ++ default='.', ++ help='directory where to get images from') ++ parser.add_argument('-p', ++ '--pid', ++ type=int, ++ help='generate coredump for specific pid(all pids py default)') ++ parser.add_argument('-o', ++ '--out', ++ default='.', ++ help='directory to write coredumps to') ++ ++ opts = vars(parser.parse_args()) ++ ++ coredump(opts) ++ + + if __name__ == '__main__': +- main() ++ main() +-- +2.34.1 + diff --git a/0016-python-replace-equality-with-identity-test.patch b/0016-python-replace-equality-with-identity-test.patch new file mode 100644 index 0000000..28ecb6f --- /dev/null +++ b/0016-python-replace-equality-with-identity-test.patch @@ -0,0 +1,117 @@ +From e108510070507deb370ef0c857eadc5a9e855a1c Mon Sep 17 00:00:00 2001 +From: Radostin Stoyanov +Date: Sun, 5 Sep 2021 21:36:10 +0100 +Subject: [PATCH 016/120] python: replace equality with identity test + +PEP8 recommends for comparisons to singletons like None to always be +done with 'is' or 'is not', never the equality operators. + +https://python.org/dev/peps/pep-0008/#programming-recommendations + +Signed-off-by: Radostin Stoyanov +--- + coredump/criu_coredump/coredump.py | 6 +++--- + test/exhaustive/pipe.py | 12 ++++++------ + test/exhaustive/unix.py | 2 +- + 3 files changed, 10 insertions(+), 10 deletions(-) + +diff --git a/coredump/criu_coredump/coredump.py b/coredump/criu_coredump/coredump.py +index 9b4aad5ff..a9a8bb27c 100644 +--- a/coredump/criu_coredump/coredump.py ++++ b/coredump/criu_coredump/coredump.py +@@ -725,10 +725,10 @@ class coredump_generator: + # and choose appropriate. + page_mem = self._get_page(pid, page_no) + +- if f != None: ++ if f is not None: + page = f.read(PAGESIZE) + +- if page_mem != None: ++ if page_mem is not None: + # Page from pages.img has higher priority + # than one from maped file on disk. + page = page_mem +@@ -755,7 +755,7 @@ class coredump_generator: + buf += page[n_skip:n_skip + n_read] + + # Don't forget to close file. +- if f != None: ++ if f is not None: + f.close() + + return buf +diff --git a/test/exhaustive/pipe.py b/test/exhaustive/pipe.py +index fdadc480c..7f1c53d34 100755 +--- a/test/exhaustive/pipe.py ++++ b/test/exhaustive/pipe.py +@@ -75,7 +75,7 @@ def get_pipe_rw(pid, fd): + + def check_pipe_y(pid, fd, rw, inos): + ino = get_pipe_ino(pid, fd) +- if ino == None: ++ if ino is None: + return 'missing ' + if not inos.has_key(fd): + inos[fd] = ino +@@ -89,7 +89,7 @@ def check_pipe_y(pid, fd, rw, inos): + + def check_pipe_n(pid, fd): + ino = get_pipe_ino(pid, fd) +- if ino == None: ++ if ino is None: + return None + else: + return 'present ' +@@ -102,7 +102,7 @@ def check_pipe_end(kids, fd, comb, rw, inos): + res = check_pipe_y(t_pid, fd, rw, inos) + else: + res = check_pipe_n(t_pid, fd) +- if res != None: ++ if res is not None: + return res + 'kid(%d)' % t_nr + t_nr += 1 + return None +@@ -111,7 +111,7 @@ def check_pipe_end(kids, fd, comb, rw, inos): + def check_pipe(kids, fds, comb, inos): + for e in (0, 1): # 0 == R, 1 == W, see get_pipe_rw() + res = check_pipe_end(kids, fds[e], comb[e], e, inos) +- if res != None: ++ if res is not None: + return res + 'end(%d)' % e + return None + +@@ -124,7 +124,7 @@ def check_pipes(kids, pipes, comb): + p_inos = {} + for p_fds in pipes: + res = check_pipe(kids, p_fds, comb[p_nr], p_inos) +- if res != None: ++ if res is not None: + return res + 'pipe(%d)' % p_nr + p_nr += 1 + +@@ -182,7 +182,7 @@ def make_comb(comb, opts, status_pipe): + if v == '0': + print('\tCheck pipes') + res = check_pipes(kids, pipes, comb) +- if res == None: ++ if res is None: + ex_code = 0 + else: + print('\tFAIL %s' % res) +diff --git a/test/exhaustive/unix.py b/test/exhaustive/unix.py +index 98dbbb7b0..114bf957b 100755 +--- a/test/exhaustive/unix.py ++++ b/test/exhaustive/unix.py +@@ -304,7 +304,7 @@ class sock: + for psk in st.sockets: + if psk == self: + continue +- if psk.peer != None and psk.peer != self.sk_id: ++ if psk.peer is not None and psk.peer != self.sk_id: + # Peer by someone else, can do nothing + continue + +-- +2.34.1 + diff --git a/0017-coredump-drop-unused-variable.patch b/0017-coredump-drop-unused-variable.patch new file mode 100644 index 0000000..4ea5aa4 --- /dev/null +++ b/0017-coredump-drop-unused-variable.patch @@ -0,0 +1,26 @@ +From 2f4e9c36f9686a101d6283b9c60e638175d6c817 Mon Sep 17 00:00:00 2001 +From: Radostin Stoyanov +Date: Sun, 5 Sep 2021 21:38:06 +0100 +Subject: [PATCH 017/120] coredump: drop unused variable + +Signed-off-by: Radostin Stoyanov +--- + coredump/criu_coredump/coredump.py | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/coredump/criu_coredump/coredump.py b/coredump/criu_coredump/coredump.py +index a9a8bb27c..42c2fed19 100644 +--- a/coredump/criu_coredump/coredump.py ++++ b/coredump/criu_coredump/coredump.py +@@ -834,8 +834,6 @@ class coredump_generator: + + vmas = [] + for vma in mm["vmas"]: +- size = self._get_vma_dump_size(vma) +- + v = vma_class() + v.filesz = self._get_vma_dump_size(vma) + v.data = self._gen_mem_chunk(pid, vma, v.filesz) +-- +2.34.1 + diff --git a/0018-coredump-drop-exec-permission.patch b/0018-coredump-drop-exec-permission.patch new file mode 100644 index 0000000..47d0df3 --- /dev/null +++ b/0018-coredump-drop-exec-permission.patch @@ -0,0 +1,20 @@ +From 7833c71147357c37203328da9668f384fa08bf47 Mon Sep 17 00:00:00 2001 +From: Radostin Stoyanov +Date: Sun, 5 Sep 2021 21:42:46 +0100 +Subject: [PATCH 018/120] coredump: drop exec permission + +The shebang line in this file was removed in a previous commit and the +file should be non-executable. + +Signed-off-by: Radostin Stoyanov +--- + coredump/coredump.py | 0 + 1 file changed, 0 insertions(+), 0 deletions(-) + mode change 100755 => 100644 coredump/coredump.py + +diff --git a/coredump/coredump.py b/coredump/coredump.py +old mode 100755 +new mode 100644 +-- +2.34.1 + diff --git a/0019-coredump-lint-fix-for-block-comments.patch b/0019-coredump-lint-fix-for-block-comments.patch new file mode 100644 index 0000000..f1572a3 --- /dev/null +++ b/0019-coredump-lint-fix-for-block-comments.patch @@ -0,0 +1,1289 @@ +From 71c05419e343a31d2f1de3694cc05b2e71400efd Mon Sep 17 00:00:00 2001 +From: Radostin Stoyanov +Date: Sun, 5 Sep 2021 21:53:06 +0100 +Subject: [PATCH 019/120] coredump: lint fix for block comments + +Block comment should start with '# ' +https://www.flake8rules.com/rules/E265.html + +Inline comment should start with '# ' +https://www.flake8rules.com/rules/E262.html + +Signed-off-by: Radostin Stoyanov +--- + coredump/criu_coredump/coredump.py | 11 +- + coredump/criu_coredump/elf.py | 985 +++++++++++++++++------------ + 2 files changed, 577 insertions(+), 419 deletions(-) + +diff --git a/coredump/criu_coredump/coredump.py b/coredump/criu_coredump/coredump.py +index 42c2fed19..274889800 100644 +--- a/coredump/criu_coredump/coredump.py ++++ b/coredump/criu_coredump/coredump.py +@@ -223,7 +223,7 @@ class coredump_generator: + ehdr.e_phoff = ctypes.sizeof(elf.Elf64_Ehdr()) + ehdr.e_ehsize = ctypes.sizeof(elf.Elf64_Ehdr()) + ehdr.e_phentsize = ctypes.sizeof(elf.Elf64_Phdr()) +- #FIXME Case len(phdrs) > PN_XNUM should be handled properly. ++ # FIXME Case len(phdrs) > PN_XNUM should be handled properly. + # See fs/binfmt_elf.c from linux kernel. + ehdr.e_phnum = len(phdrs) + +@@ -346,7 +346,7 @@ class coredump_generator: + + ctypes.memset(ctypes.addressof(prstatus), 0, ctypes.sizeof(prstatus)) + +- #FIXME setting only some of the fields for now. Revisit later. ++ # FIXME setting only some of the fields for now. Revisit later. + prstatus.pr_pid = tid + prstatus.pr_ppid = pstree["ppid"] + prstatus.pr_pgrp = pstree["pgid"] +@@ -414,7 +414,6 @@ class coredump_generator: + *regs["st_space"]) + fpregset.xmm_space = (ctypes.c_uint * len(regs["xmm_space"]))( + *regs["xmm_space"]) +- #fpregset.padding = regs["padding"] unused + + nhdr = elf.Elf64_Nhdr() + nhdr.n_namesz = 5 +@@ -588,7 +587,7 @@ class coredump_generator: + + nhdr = elf.Elf64_Nhdr() + +- nhdr.n_namesz = 5 #XXX strlen + 1 ++ nhdr.n_namesz = 5 # strlen + 1 + nhdr.n_descsz = ctypes.sizeof(elf_files()) + nhdr.n_type = elf.NT_FILE + +@@ -675,11 +674,11 @@ class coredump_generator: + return b"" + + if vma["status"] & status["VMA_AREA_VVAR"]: +- #FIXME this is what gdb does, as vvar vma ++ # FIXME this is what gdb does, as vvar vma + # is not readable from userspace? + return b"\0" * size + elif vma["status"] & status["VMA_AREA_VSYSCALL"]: +- #FIXME need to dump it with criu or read from ++ # FIXME need to dump it with criu or read from + # current process. + return b"\0" * size + +diff --git a/coredump/criu_coredump/elf.py b/coredump/criu_coredump/elf.py +index a670ae866..092b47857 100644 +--- a/coredump/criu_coredump/elf.py ++++ b/coredump/criu_coredump/elf.py +@@ -16,16 +16,13 @@ EI_MAG0 = 0 # #define EI_MAG0 0 /* File identification by + ELFMAG0 = 0x7f # #define ELFMAG0 0x7f /* Magic number byte 0 */ + + EI_MAG1 = 1 # #define EI_MAG1 1 /* File identification byte 1 index */ +-ELFMAG1 = ord( +- 'E') # #define ELFMAG1 'E' /* Magic number byte 1 */ ++ELFMAG1 = ord('E') # #define ELFMAG1 'E' /* Magic number byte 1 */ + + EI_MAG2 = 2 # #define EI_MAG2 2 /* File identification byte 2 index */ +-ELFMAG2 = ord( +- 'L') # #define ELFMAG2 'L' /* Magic number byte 2 */ ++ELFMAG2 = ord('L') # #define ELFMAG2 'L' /* Magic number byte 2 */ + + EI_MAG3 = 3 # #define EI_MAG3 3 /* File identification byte 3 index */ +-ELFMAG3 = ord( +- 'F') # #define ELFMAG3 'F' /* Magic number byte 3 */ ++ELFMAG3 = ord('F') # #define ELFMAG3 'F' /* Magic number byte 3 */ + + EI_CLASS = 4 # #define EI_CLASS 4 /* File class byte index */ + +@@ -48,22 +45,22 @@ EV_CURRENT = 1 # #define EV_CURRENT 1 /* Current version */ + + + class Elf64_Ehdr(ctypes.Structure): # typedef struct +- _fields_ = [ # { ++ _fields_ = [ + ("e_ident", +- ctypes.c_ubyte * EI_NIDENT), # unsigned char e_ident[EI_NIDENT]; +- ("e_type", Elf64_Half), # Elf64_Half e_type; +- ("e_machine", Elf64_Half), # Elf64_Half e_machine; +- ("e_version", Elf64_Word), # Elf64_Word e_version; +- ("e_entry", Elf64_Addr), # Elf64_Addr e_entry; +- ("e_phoff", Elf64_Off), # Elf64_Off e_phoff; +- ("e_shoff", Elf64_Off), # Elf64_Off e_shoff; +- ("e_flags", Elf64_Word), # Elf64_Word e_flags; +- ("e_ehsize", Elf64_Half), # Elf64_Half e_ehsize; +- ("e_phentsize", Elf64_Half), # Elf64_Half e_phentsize; +- ("e_phnum", Elf64_Half), # Elf64_Half e_phnum; +- ("e_shentsize", Elf64_Half), # Elf64_Half e_shentsize; +- ("e_shnum", Elf64_Half), # Elf64_Half e_shnum; +- ("e_shstrndx", Elf64_Half) # Elf64_Half e_shstrndx; ++ ctypes.c_ubyte * EI_NIDENT), # unsigned char e_ident[EI_NIDENT]; ++ ("e_type", Elf64_Half), # Elf64_Half e_type; ++ ("e_machine", Elf64_Half), # Elf64_Half e_machine; ++ ("e_version", Elf64_Word), # Elf64_Word e_version; ++ ("e_entry", Elf64_Addr), # Elf64_Addr e_entry; ++ ("e_phoff", Elf64_Off), # Elf64_Off e_phoff; ++ ("e_shoff", Elf64_Off), # Elf64_Off e_shoff; ++ ("e_flags", Elf64_Word), # Elf64_Word e_flags; ++ ("e_ehsize", Elf64_Half), # Elf64_Half e_ehsize; ++ ("e_phentsize", Elf64_Half), # Elf64_Half e_phentsize; ++ ("e_phnum", Elf64_Half), # Elf64_Half e_phnum; ++ ("e_shentsize", Elf64_Half), # Elf64_Half e_shentsize; ++ ("e_shnum", Elf64_Half), # Elf64_Half e_shnum; ++ ("e_shstrndx", Elf64_Half) # Elf64_Half e_shstrndx; + ] # } Elf64_Ehdr; + + +@@ -80,15 +77,15 @@ PF_R = 1 << 2 # #define PF_R (1 << 2) /* Segment is readable + + + class Elf64_Phdr(ctypes.Structure): # typedef struct +- _fields_ = [ # { +- ("p_type", Elf64_Word), # Elf64_Word p_type; +- ("p_flags", Elf64_Word), # Elf64_Word p_flags; +- ("p_offset", Elf64_Off), # Elf64_Off p_offset; +- ("p_vaddr", Elf64_Addr), # Elf64_Addr p_vaddr; +- ("p_paddr", Elf64_Addr), # Elf64_Addr p_paddr; +- ("p_filesz", Elf64_Xword), # Elf64_Xword p_filesz; +- ("p_memsz", Elf64_Xword), # Elf64_Xword p_memsz; +- ("p_align", Elf64_Xword), # Elf64_Xword p_align; ++ _fields_ = [ ++ ("p_type", Elf64_Word), # Elf64_Word p_type; ++ ("p_flags", Elf64_Word), # Elf64_Word p_flags; ++ ("p_offset", Elf64_Off), # Elf64_Off p_offset; ++ ("p_vaddr", Elf64_Addr), # Elf64_Addr p_vaddr; ++ ("p_paddr", Elf64_Addr), # Elf64_Addr p_paddr; ++ ("p_filesz", Elf64_Xword), # Elf64_Xword p_filesz; ++ ("p_memsz", Elf64_Xword), # Elf64_Xword p_memsz; ++ ("p_align", Elf64_Xword), # Elf64_Xword p_align; + ] # } Elf64_Phdr; + + +@@ -100,78 +97,89 @@ class _Elf64_auxv_t_U(ctypes.Union): + + + class Elf64_auxv_t(ctypes.Structure): # typedef struct +- _fields_ = [ # { ++ _fields_ = [ + ("a_type", +- ctypes.c_uint64), # uint64_t a_type; /* Entry type */ +- ("a_un", _Elf64_auxv_t_U) # union +- # { +- # uint64_t a_val; /* Integer value */ +- # /* We use to have pointer elements added here. We cannot do that, +- # though, since it does not work when using 32-bit definitions +- # on 64-bit platforms and vice versa. */ +- # } a_un; ++ ctypes.c_uint64), # uint64_t a_type; /* Entry type */ ++ ("a_un", _Elf64_auxv_t_U) # union ++ ++ # uint64_t a_val; /* Integer value */ ++ # /* We use to have pointer elements added here. We cannot do that, ++ # though, since it does not work when using 32-bit definitions ++ # on 64-bit platforms and vice versa. */ ++ # } a_un; + ] # } Elf64_auxv_t; + + + # Elf64_Nhdr related constants. + +-NT_PRSTATUS = 1 # #define NT_PRSTATUS 1 /* Contains copy of prstatus struct */ +-NT_FPREGSET = 2 # #define NT_FPREGSET 2 /* Contains copy of fpregset struct */ +-NT_PRPSINFO = 3 # #define NT_PRPSINFO 3 /* Contains copy of prpsinfo struct */ +-NT_AUXV = 6 # #define NT_AUXV 6 /* Contains copy of auxv array */ +-NT_SIGINFO = 0x53494749 # #define NT_SIGINFO 0x53494749 /* Contains copy of siginfo_t, +-# size might increase */ +-NT_FILE = 0x46494c45 # #define NT_FILE 0x46494c45 /* Contains information about mapped +-# files */ +-NT_X86_XSTATE = 0x202 # #define NT_X86_XSTATE 0x202 /* x86 extended state using xsave */ ++NT_PRSTATUS = 1 # #define NT_PRSTATUS 1 /* Contains copy of prstatus struct */ ++NT_FPREGSET = 2 # #define NT_FPREGSET 2 /* Contains copy of fpregset struct */ ++NT_PRPSINFO = 3 # #define NT_PRPSINFO 3 /* Contains copy of prpsinfo struct */ ++NT_AUXV = 6 # #define NT_AUXV 6 /* Contains copy of auxv array */ ++NT_SIGINFO = 0x53494749 # #define NT_SIGINFO 0x53494749 /* Contains copy of siginfo_t, size might increase */ ++NT_FILE = 0x46494c45 # #define NT_FILE 0x46494c45 /* Contains information about mapped files */ ++NT_X86_XSTATE = 0x202 # #define NT_X86_XSTATE 0x202 /* x86 extended state using xsave */ + + + class Elf64_Nhdr(ctypes.Structure): # typedef struct +- _fields_ = [ # { ++ _fields_ = [ + ( + "n_namesz", Elf64_Word +- ), # Elf64_Word n_namesz; /* Length of the note's name. */ ++ ), # Elf64_Word n_namesz; /* Length of the note's name. */ + ( + "n_descsz", Elf64_Word +- ), # Elf64_Word n_descsz; /* Length of the note's descriptor. */ ++ ), # Elf64_Word n_descsz; /* Length of the note's descriptor. */ + ("n_type", Elf64_Word +- ), # Elf64_Word n_type; /* Type of the note. */ ++ ), # Elf64_Word n_type; /* Type of the note. */ + ] # } Elf64_Nhdr; + + + # Elf64_Shdr related constants. + + +-class Elf64_Shdr(ctypes.Structure): # typedef struct +- _fields_ = [ # { ++class Elf64_Shdr(ctypes.Structure): ++ _fields_ = [ + ( ++ # Section name (string tbl index) + "sh_name", Elf64_Word +- ), # Elf64_Word sh_name; /* Section name (string tbl index) */ +- ("sh_type", Elf64_Word +- ), # Elf64_Word sh_type; /* Section type */ +- ("sh_flags", Elf64_Xword +- ), # Elf64_Xword sh_flags; /* Section flags */ ++ ), ++ ( ++ # Section type ++ "sh_type", Elf64_Word ++ ), ++ ( ++ # Section flags ++ "sh_flags", Elf64_Xword ++ ), + ( ++ # Section virtual addr at execution + "sh_addr", Elf64_Addr +- ), # Elf64_Addr sh_addr; /* Section virtual addr at execution */ ++ ), + ( ++ # Section file offset + "sh_offset", Elf64_Off +- ), # Elf64_Off sh_offset; /* Section file offset */ ++ ), + ( ++ # Section size in bytes + "sh_size", Elf64_Xword +- ), # Elf64_Xword sh_size; /* Section size in bytes */ ++ ), + ( ++ # Link to another section + "sh_link", Elf64_Word +- ), # Elf64_Word sh_link; /* Link to another section */ ++ ), + ( ++ # Additional section information + "sh_info", Elf64_Word +- ), # Elf64_Word sh_info; /* Additional section information */ +- ("sh_addralign", Elf64_Xword +- ), # Elf64_Xword sh_addralign; /* Section alignment */ ++ ), + ( ++ # Section alignment ++ "sh_addralign", Elf64_Xword ++ ), ++ ( ++ # Entry size if section holds table + "sh_entsize", Elf64_Xword +- ) # Elf64_Xword sh_entsize; /* Entry size if section holds table */ +- ] # } Elf64_Shdr; ++ ) ++ ] + + + # elf_prstatus related constants. +@@ -179,188 +187,264 @@ class Elf64_Shdr(ctypes.Structure): # typedef struct + + # Signal info. + class elf_siginfo(ctypes.Structure): # struct elf_siginfo +- _fields_ = [ # { +- ("si_signo", ctypes.c_int +- ), # int si_signo; /* Signal number. */ +- ("si_code", ctypes.c_int +- ), # int si_code; /* Extra code. */ +- ("si_errno", ctypes.c_int +- ) # int si_errno; /* Errno. */ +- ] # }; ++ _fields_ = [ ++ ( ++ # Signal number ++ "si_signo", ctypes.c_int ++ ), ++ ( ++ # Extra code ++ "si_code", ctypes.c_int ++ ), ++ ( ++ # Errno ++ "si_errno", ctypes.c_int ++ ) ++ ] + + + # A time value that is accurate to the nearest + # microsecond but also has a range of years. + class timeval(ctypes.Structure): # struct timeval +- _fields_ = [ # { +- ("tv_sec", +- ctypes.c_long), # __time_t tv_sec; /* Seconds. */ +- ("tv_usec", ctypes.c_long +- ) # __suseconds_t tv_usec; /* Microseconds. */ +- ] # }; ++ _fields_ = [ ++ ( ++ # __time_t tv_sec; /* Seconds. */ ++ "tv_sec", ctypes.c_long ++ ), ++ ( ++ # __suseconds_t tv_usec; /* Microseconds. */ ++ "tv_usec", ctypes.c_long ++ ) ++ ] + + + class user_regs_struct(ctypes.Structure): # struct user_regs_struct +- _fields_ = [ # { ++ _fields_ = [ + ("r15", +- ctypes.c_ulonglong), # __extension__ unsigned long long int r15; ++ ctypes.c_ulonglong), # __extension__ unsigned long long int r15; + ("r14", +- ctypes.c_ulonglong), # __extension__ unsigned long long int r14; ++ ctypes.c_ulonglong), # __extension__ unsigned long long int r14; + ("r13", +- ctypes.c_ulonglong), # __extension__ unsigned long long int r13; ++ ctypes.c_ulonglong), # __extension__ unsigned long long int r13; + ("r12", +- ctypes.c_ulonglong), # __extension__ unsigned long long int r12; ++ ctypes.c_ulonglong), # __extension__ unsigned long long int r12; + ("rbp", +- ctypes.c_ulonglong), # __extension__ unsigned long long int rbp; ++ ctypes.c_ulonglong), # __extension__ unsigned long long int rbp; + ("rbx", +- ctypes.c_ulonglong), # __extension__ unsigned long long int rbx; ++ ctypes.c_ulonglong), # __extension__ unsigned long long int rbx; + ("r11", +- ctypes.c_ulonglong), # __extension__ unsigned long long int r11; ++ ctypes.c_ulonglong), # __extension__ unsigned long long int r11; + ("r10", +- ctypes.c_ulonglong), # __extension__ unsigned long long int r10; ++ ctypes.c_ulonglong), # __extension__ unsigned long long int r10; + ("r9", +- ctypes.c_ulonglong), # __extension__ unsigned long long int r9; ++ ctypes.c_ulonglong), # __extension__ unsigned long long int r9; + ("r8", +- ctypes.c_ulonglong), # __extension__ unsigned long long int r8; ++ ctypes.c_ulonglong), # __extension__ unsigned long long int r8; + ("rax", +- ctypes.c_ulonglong), # __extension__ unsigned long long int rax; ++ ctypes.c_ulonglong), # __extension__ unsigned long long int rax; + ("rcx", +- ctypes.c_ulonglong), # __extension__ unsigned long long int rcx; ++ ctypes.c_ulonglong), # __extension__ unsigned long long int rcx; + ("rdx", +- ctypes.c_ulonglong), # __extension__ unsigned long long int rdx; ++ ctypes.c_ulonglong), # __extension__ unsigned long long int rdx; + ("rsi", +- ctypes.c_ulonglong), # __extension__ unsigned long long int rsi; ++ ctypes.c_ulonglong), # __extension__ unsigned long long int rsi; + ("rdi", +- ctypes.c_ulonglong), # __extension__ unsigned long long int rdi; ++ ctypes.c_ulonglong), # __extension__ unsigned long long int rdi; + ("orig_rax", ctypes.c_ulonglong +- ), # __extension__ unsigned long long int orig_rax; ++ ), # __extension__ unsigned long long int orig_rax; + ("rip", +- ctypes.c_ulonglong), # __extension__ unsigned long long int rip; ++ ctypes.c_ulonglong), # __extension__ unsigned long long int rip; + ("cs", +- ctypes.c_ulonglong), # __extension__ unsigned long long int cs; ++ ctypes.c_ulonglong), # __extension__ unsigned long long int cs; + ("eflags", +- ctypes.c_ulonglong), # __extension__ unsigned long long int eflags; ++ ctypes.c_ulonglong), # __extension__ unsigned long long int eflags; + ("rsp", +- ctypes.c_ulonglong), # __extension__ unsigned long long int rsp; ++ ctypes.c_ulonglong), # __extension__ unsigned long long int rsp; + ("ss", +- ctypes.c_ulonglong), # __extension__ unsigned long long int ss; ++ ctypes.c_ulonglong), # __extension__ unsigned long long int ss; + ("fs_base", ctypes.c_ulonglong +- ), # __extension__ unsigned long long int fs_base; ++ ), # __extension__ unsigned long long int fs_base; + ("gs_base", ctypes.c_ulonglong +- ), # __extension__ unsigned long long int gs_base; ++ ), # __extension__ unsigned long long int gs_base; + ("ds", +- ctypes.c_ulonglong), # __extension__ unsigned long long int ds; ++ ctypes.c_ulonglong), # __extension__ unsigned long long int ds; + ("es", +- ctypes.c_ulonglong), # __extension__ unsigned long long int es; ++ ctypes.c_ulonglong), # __extension__ unsigned long long int es; + ("fs", +- ctypes.c_ulonglong), # __extension__ unsigned long long int fs; ++ ctypes.c_ulonglong), # __extension__ unsigned long long int fs; + ("gs", ctypes.c_ulonglong +- ) # __extension__ unsigned long long int gs; +- ] # }; ++ ) # __extension__ unsigned long long int gs; ++ ] + + +-#elf_greg_t = ctypes.c_ulonglong +-#ELF_NGREG = ctypes.sizeof(user_regs_struct)/ctypes.sizeof(elf_greg_t) +-#elf_gregset_t = elf_greg_t*ELF_NGREG ++# elf_greg_t = ctypes.c_ulonglong ++# ELF_NGREG = ctypes.sizeof(user_regs_struct)/ctypes.sizeof(elf_greg_t) ++# elf_gregset_t = elf_greg_t*ELF_NGREG + elf_gregset_t = user_regs_struct + + + class elf_prstatus(ctypes.Structure): # struct elf_prstatus +- _fields_ = [ # { ++ _fields_ = [ + ( ++ # Info associated with signal ++ # struct elf_siginfo pr_info; + "pr_info", elf_siginfo +- ), # struct elf_siginfo pr_info; /* Info associated with signal. */ +- ("pr_cursig", ctypes.c_short +- ), # short int pr_cursig; /* Current signal. */ ++ ), ++ ( ++ # Current signal ++ # short int pr_cursig; ++ "pr_cursig", ctypes.c_short ++ ), + ( ++ # Set of pending signals ++ # unsigned long int pr_sigpend; + "pr_sigpend", ctypes.c_ulong +- ), # unsigned long int pr_sigpend; /* Set of pending signals. */ ++ ), + ( ++ # Set of held signals ++ # unsigned long int pr_sighold; + "pr_sighold", ctypes.c_ulong +- ), # unsigned long int pr_sighold; /* Set of held signals. */ +- ("pr_pid", ctypes.c_int), # __pid_t pr_pid; +- ("pr_ppid", ctypes.c_int), # __pid_t pr_ppid; +- ("pr_pgrp", ctypes.c_int), # __pid_t pr_pgrp; +- ("pr_sid", ctypes.c_int), # __pid_t pr_sid; +- ("pr_utime", +- timeval), # struct timeval pr_utime; /* User time. */ +- ("pr_stime", timeval +- ), # struct timeval pr_stime; /* System time. */ +- ( ++ ), ++ ( ++ # Process ID ++ # __pid_t pr_pid; ++ "pr_pid", ctypes.c_int ++ ), ++ ( ++ # Parent process ID ++ # __pid_t pr_ppid; ++ "pr_ppid", ctypes.c_int ++ ), ++ ( ++ # Parent group ID ++ # __pid_t pr_pgrp; ++ "pr_pgrp", ctypes.c_int ++ ), ++ ( ++ # Parent session ID ++ # __pid_t pr_sid; ++ "pr_sid", ctypes.c_int ++ ), ++ ( ++ # User time ++ # struct timeval pr_utime; ++ "pr_utime", timeval ++ ), ++ ( ++ # System time ++ # struct timeval pr_stime; ++ "pr_stime", timeval ++ ), ++ ( ++ # Cumulative user time ++ # struct timeval pr_cutime; + "pr_cutime", timeval +- ), # struct timeval pr_cutime; /* Cumulative user time. */ ++ ), + ( ++ # Cumulative system time ++ # struct timeval pr_cstime; + "pr_cstime", timeval +- ), # struct timeval pr_cstime; /* Cumulative system time. */ +- ("pr_reg", elf_gregset_t +- ), # elf_gregset_t pr_reg; /* GP registers. */ ++ ), + ( ++ # GP registers ++ # elf_gregset_t pr_reg; ++ "pr_reg", elf_gregset_t ++ ), ++ ( ++ # True if math copro being used ++ # int pr_fpvalid; + "pr_fpvalid", ctypes.c_int +- ) # int pr_fpvalid; /* True if math copro being used. */ +- ] # }; ++ ) ++ ] + + + # elf_prpsinfo related constants. + +-ELF_PRARGSZ = 80 # #define ELF_PRARGSZ (80) /* Number of chars for args. */ ++# Number of chars for args ++# #define ELF_PRARGSZ (80) ++ELF_PRARGSZ = 80 + + + class elf_prpsinfo(ctypes.Structure): # struct elf_prpsinfo +- _fields_ = [ # { ++ _fields_ = [ + ( ++ # Numeric process state ++ # char pr_state; + "pr_state", ctypes.c_byte +- ), # char pr_state; /* Numeric process state. */ ++ ), + ( ++ # Char for pr_state ++ # char pr_sname; + "pr_sname", ctypes.c_char +- ), # char pr_sname; /* Char for pr_state. */ +- ("pr_zomb", ctypes.c_byte +- ), # char pr_zomb; /* Zombie. */ +- ("pr_nice", ctypes.c_byte +- ), # char pr_nice; /* Nice val. */ +- ("pr_flag", ctypes.c_ulong +- ), # unsigned long int pr_flag; /* Flags. */ +- # #if __WORDSIZE == 32 +- # unsigned short int pr_uid; +- # unsigned short int pr_gid; +- # #else +- ("pr_uid", ctypes.c_uint), # unsigned int pr_uid; +- ("pr_gid", ctypes.c_uint), # unsigned int pr_gid; +- # #endif +- ("pr_pid", ctypes.c_int), # int pr_pid, pr_ppid, pr_pgrp, pr_sid; ++ ), ++ ( ++ # Zombie ++ # char pr_zomb; ++ "pr_zomb", ctypes.c_byte ++ ), ++ ( ++ # Nice value ++ # char pr_nice; ++ "pr_nice", ctypes.c_byte ++ ), ++ ( ++ # Flags ++ # unsigned long int pr_flag; ++ "pr_flag", ctypes.c_ulong ++ ), ++ ( ++ # User ID ++ # unsigned int pr_uid; ++ "pr_uid", ctypes.c_uint ++ ), ++ ( ++ # Group ID ++ # unsigned int pr_gid; ++ "pr_gid", ctypes.c_uint ++ ), ++ ("pr_pid", ctypes.c_int), + ("pr_ppid", ctypes.c_int), + ("pr_pgrp", ctypes.c_int), + ("pr_sid", ctypes.c_int), +- # /* Lots missing */ ++ # /* Lots missing */ + ( ++ # Filename of executable ++ # char pr_fname[16]; + "pr_fname", ctypes.c_char * 16 +- ), # char pr_fname[16]; /* Filename of executable. */ ++ ), + ( ++ # Initial part of arg list ++ # char pr_psargs[ELF_PRARGSZ]; + "pr_psargs", ctypes.c_char * ELF_PRARGSZ +- ) # char pr_psargs[ELF_PRARGSZ]; /* Initial part of arg list. */ +- ] # }; ++ ) ++ ] + + + class user_fpregs_struct(ctypes.Structure): # struct user_fpregs_struct +- _fields_ = [ # { +- ("cwd", ctypes.c_ushort), # unsigned short int cwd; +- ("swd", ctypes.c_ushort), # unsigned short int swd; +- ("ftw", ctypes.c_ushort), # unsigned short int ftw; +- ("fop", ctypes.c_ushort), # unsigned short int fop; +- ("rip", +- ctypes.c_ulonglong), # __extension__ unsigned long long int rip; +- ("rdp", +- ctypes.c_ulonglong), # __extension__ unsigned long long int rdp; +- ("mxcsr", ctypes.c_uint), # unsigned int mxcsr; +- ("mxcr_mask", ctypes.c_uint), # unsigned int mxcr_mask; +- ( +- "st_space", ctypes.c_uint * 32 +- ), # unsigned int st_space[32]; /* 8*16 bytes for each FP-reg = 128 bytes */ +- ( +- "xmm_space", ctypes.c_uint * 64 +- ), # unsigned int xmm_space[64]; /* 16*16 bytes for each XMM-reg = 256 bytes */ +- ("padding", +- ctypes.c_uint * 24), # unsigned int padding[24]; +- ] # }; ++ _fields_ = [ ++ # unsigned short int cwd; ++ ("cwd", ctypes.c_ushort), ++ # unsigned short int swd; ++ ("swd", ctypes.c_ushort), ++ # unsigned short int ftw; ++ ("ftw", ctypes.c_ushort), ++ # unsigned short int fop; ++ ("fop", ctypes.c_ushort), ++ # __extension__ unsigned long long int rip; ++ ("rip", ctypes.c_ulonglong), ++ # __extension__ unsigned long long int rdp; ++ ("rdp", ctypes.c_ulonglong), ++ # unsigned int mxcsr; ++ ("mxcsr", ctypes.c_uint), ++ # unsigned int mxcr_mask; ++ ("mxcr_mask", ctypes.c_uint), ++ # unsigned int st_space[32]; /* 8*16 bytes for each FP-reg = 128 bytes */ ++ ("st_space", ctypes.c_uint * 32), ++ # unsigned int xmm_space[64]; /* 16*16 bytes for each XMM-reg = 256 bytes */ ++ ("xmm_space", ctypes.c_uint * 64), ++ # unsigned int padding[24]; ++ ("padding", ctypes.c_uint * 24), ++ ] + + + elf_fpregset_t = user_fpregs_struct +@@ -371,315 +455,390 @@ _SI_MAX_SIZE = 128 + _SI_PAD_SIZE = (_SI_MAX_SIZE // ctypes.sizeof(ctypes.c_int)) - 4 + + +-# /* kill(). */ +-class _siginfo_t_U_kill(ctypes.Structure): # struct +- _fields_ = [ # { +- ("si_pid", ctypes.c_int +- ), # __pid_t si_pid; /* Sending process ID. */ ++# /* kill(). */ ++class _siginfo_t_U_kill(ctypes.Structure): # struct ++ _fields_ = [ ++ ( ++ # Sending process ID ++ # __pid_t si_pid; ++ "si_pid", ctypes.c_int ++ ), + ( ++ # Real user ID of sending process ++ # __uid_t si_uid; + "si_uid", ctypes.c_uint +- ) # __uid_t si_uid; /* Real user ID of sending process. */ +- ] # } _kill; ++ ) ++ ] # } _kill; + + + # Type for data associated with a signal. + class sigval_t(ctypes.Union): # typedef union sigval +- _fields_ = [ # { +- ("sival_int", ctypes.c_int), # int sival_int; +- ("sical_ptr", ctypes.c_void_p), # void *sival_ptr; +- ] # } sigval_t; +- +- +- # /* POSIX.1b timers. */ +-class _siginfo_t_U_timer(ctypes.Structure): # struct +- _fields_ = [ # { +- ("si_tid", +- ctypes.c_int), # int si_tid; /* Timer ID. */ +- ("si_overrun", ctypes.c_int +- ), # int si_overrun; /* Overrun count. */ +- ("si_sigval", sigval_t +- ) # sigval_t si_sigval; /* Signal value. */ +- ] # } _timer; +- +- +- # /* POSIX.1b signals. */ +-class _siginfo_t_U_rt(ctypes.Structure): # struct +- _fields_ = [ # { +- ("si_pid", ctypes.c_int +- ), # __pid_t si_pid; /* Sending process ID. */ ++ _fields_ = [ ++ ("sival_int", ctypes.c_int), # int sival_int; ++ ("sical_ptr", ctypes.c_void_p), # void *sival_ptr; ++ ] # } sigval_t; ++ ++ ++# /* POSIX.1b timers. */ ++class _siginfo_t_U_timer(ctypes.Structure): # struct ++ _fields_ = [ ++ ( ++ # Timer ID ++ # int si_tid; ++ "si_tid", ctypes.c_int ++ ), ++ ( ++ # Overrun count ++ # int si_overrun; ++ "si_overrun", ctypes.c_int ++ ), + ( ++ # Signal value ++ # sigval_t si_sigval; ++ "si_sigval", sigval_t ++ ) ++ ] # } _timer; ++ ++ ++# /* POSIX.1b signals. */ ++class _siginfo_t_U_rt(ctypes.Structure): # struct ++ _fields_ = [ ++ ( ++ # Sending process ID ++ # __pid_t si_pid; ++ "si_pid", ctypes.c_int ++ ), ++ ( ++ # Real user ID of sending process ++ # __uid_t si_uid; + "si_uid", ctypes.c_uint +- ), # __uid_t si_uid; /* Real user ID of sending process. */ +- ("si_sigval", sigval_t +- ) # sigval_t si_sigval; /* Signal value. */ +- ] # } _rt; ++ ), ++ ( ++ # Signal value ++ # sigval_t si_sigval; ++ "si_sigval", sigval_t ++ ) ++ ] # } _rt; + + +- # /* SIGCHLD. */ +-class _siginfo_t_U_sigchld(ctypes.Structure): # struct +- _fields_ = [ # { +- ("si_pid", +- ctypes.c_int), # __pid_t si_pid; /* Which child. */ ++# /* SIGCHLD. */ ++class _siginfo_t_U_sigchld(ctypes.Structure): # struct ++ _fields_ = [ ++ ( ++ # Which child ++ # __pid_t si_pid; ++ "si_pid", ctypes.c_int ++ ), + ( ++ # Real user ID of sending process ++ # __uid_t si_uid; + "si_uid", ctypes.c_uint +- ), # __uid_t si_uid; /* Real user ID of sending process. */ +- ("si_status", ctypes.c_int +- ), # int si_status; /* Exit value or signal. */ +- ("si_utime", ctypes.c_long), # __sigchld_clock_t si_utime; +- ("si_stime", ctypes.c_long) # __sigchld_clock_t si_stime; +- ] # } _sigchld; ++ ), ++ ( ++ # Exit value or signal ++ # int si_status; ++ "si_status", ctypes.c_int ++ ), ++ ( ++ # __sigchld_clock_t si_utime; ++ "si_utime", ctypes.c_long ++ ), ++ ( ++ # __sigchld_clock_t si_stime; ++ "si_stime", ctypes.c_long ++ ) ++ ] # } _sigchld; + + +- # /* SIGILL, SIGFPE, SIGSEGV, SIGBUS. */ +-class _siginfo_t_U_sigfault(ctypes.Structure): # struct +- _fields_ = [ # { +- ("si_addr", ctypes.c_void_p +- ), # void *si_addr; /* Faulting insn/memory ref. */ ++# /* SIGILL, SIGFPE, SIGSEGV, SIGBUS. */ ++class _siginfo_t_U_sigfault(ctypes.Structure): # struct ++ _fields_ = [ + ( ++ # Faulting insn/memory ref ++ # void *si_addr; ++ "si_addr", ctypes.c_void_p ++ ), ++ ( ++ # Valid LSB of the reported address ++ # short int si_addr_lsb; + "si_addr_lsb", ctypes.c_short +- ) # short int si_addr_lsb; /* Valid LSB of the reported address. */ +- ] # } _sigfault; ++ ) ++ ] # } _sigfault; + + +- # /* SIGPOLL. */ +-class _siginfo_t_U_sigpoll(ctypes.Structure): # struct +- _fields_ = [ # { +- ("si_band", ctypes.c_long +- ), # long int si_band; /* Band event for SIGPOLL. */ +- ("si_fd", ctypes.c_int) # int si_fd; +- ] # } _sigpoll; ++# /* SIGPOLL. */ ++class _siginfo_t_U_sigpoll(ctypes.Structure): # struct ++ _fields_ = [ ++ ( ++ # Band event for SIGPOLL ++ # long int si_band; ++ "si_band", ctypes.c_long ++ ), ++ ( ++ # int si_fd; ++ "si_fd", ctypes.c_int ++ ) ++ ] # } _sigpoll; + + +- # /* SIGSYS. */ +-class _siginfo_t_U_sigsys(ctypes.Structure): # struct +- _fields_ = [ # { ++# /* SIGSYS. */ ++class _siginfo_t_U_sigsys(ctypes.Structure): # struct ++ _fields_ = [ + ("_call_addr", ctypes.c_void_p +- ), # void *_call_addr; /* Calling user insn. */ ++ ), # void *_call_addr; /* Calling user insn. */ + ( + "_syscall", ctypes.c_int +- ), # int _syscall; /* Triggering system call number. */ ++ ), # int _syscall; /* Triggering system call number. */ + ("_arch", ctypes.c_uint +- ) # unsigned int _arch; /* AUDIT_ARCH_* of syscall. */ +- ] # } _sigsys; ++ ) # unsigned int _arch; /* AUDIT_ARCH_* of syscall. */ ++ ] # } _sigsys; + + +-class _siginfo_t_U(ctypes.Union): # union +- _fields_ = [ # { ++class _siginfo_t_U(ctypes.Union): # union ++ _fields_ = [ + ("_pad", +- ctypes.c_int * _SI_PAD_SIZE), # int _pad[__SI_PAD_SIZE]; +- # +- # /* kill(). */ +- ("_kill", _siginfo_t_U_kill), # struct +- # { +- # __pid_t si_pid; /* Sending process ID. */ +- # __uid_t si_uid; /* Real user ID of sending process. */ +- # } _kill; +- # +- # /* POSIX.1b timers. */ +- ("_timer", _siginfo_t_U_timer), # struct +- # { +- # int si_tid; /* Timer ID. */ +- # int si_overrun; /* Overrun count. */ +- # sigval_t si_sigval; /* Signal value. */ +- # } _timer; +- # +- # /* POSIX.1b signals. */ +- ("_rt", _siginfo_t_U_rt), # struct +- # { +- # __pid_t si_pid; /* Sending process ID. */ +- # __uid_t si_uid; /* Real user ID of sending process. */ +- # sigval_t si_sigval; /* Signal value. */ +- # } _rt; +- # +- # /* SIGCHLD. */ +- ("_sigchld", _siginfo_t_U_sigchld), # struct +- # { +- # __pid_t si_pid; /* Which child. */ +- # __uid_t si_uid; /* Real user ID of sending process. */ +- # int si_status; /* Exit value or signal. */ +- # __sigchld_clock_t si_utime; +- # __sigchld_clock_t si_stime; +- # } _sigchld; +- # +- # /* SIGILL, SIGFPE, SIGSEGV, SIGBUS. */ +- ("_sigfault", _siginfo_t_U_sigfault), # struct +- # { +- # void *si_addr; /* Faulting insn/memory ref. */ +- # short int si_addr_lsb; /* Valid LSB of the reported address. */ +- # } _sigfault; +- # +- # /* SIGPOLL. */ +- ("_sigpoll", _siginfo_t_U_sigpoll), # struct +- # { +- # long int si_band; /* Band event for SIGPOLL. */ +- # int si_fd; +- # } _sigpoll; +- # +- # /* SIGSYS. */ +- ("_sigsys", _siginfo_t_U_sigpoll) # struct +- # { +- # void *_call_addr; /* Calling user insn. */ +- # int _syscall; /* Triggering system call number. */ +- # unsigned int _arch; /* AUDIT_ARCH_* of syscall. */ +- # } _sigsys; +- ] # } _sifields; ++ ctypes.c_int * _SI_PAD_SIZE), # int _pad[__SI_PAD_SIZE]; ++ ++ # /* kill(). */ ++ ("_kill", _siginfo_t_U_kill), # struct ++ ++ # __pid_t si_pid; /* Sending process ID. */ ++ # __uid_t si_uid; /* Real user ID of sending process. */ ++ # } _kill; ++ ++ # /* POSIX.1b timers. */ ++ ("_timer", _siginfo_t_U_timer), # struct ++ ++ # int si_tid; /* Timer ID. */ ++ # int si_overrun; /* Overrun count. */ ++ # sigval_t si_sigval; /* Signal value. */ ++ # } _timer; ++ ++ # /* POSIX.1b signals. */ ++ ("_rt", _siginfo_t_U_rt), # struct ++ ++ # __pid_t si_pid; /* Sending process ID. */ ++ # __uid_t si_uid; /* Real user ID of sending process. */ ++ # sigval_t si_sigval; /* Signal value. */ ++ # } _rt; ++ ++ # /* SIGCHLD. */ ++ ("_sigchld", _siginfo_t_U_sigchld), # struct ++ ++ # __pid_t si_pid; /* Which child. */ ++ # __uid_t si_uid; /* Real user ID of sending process. */ ++ # int si_status; /* Exit value or signal. */ ++ # __sigchld_clock_t si_utime; ++ # __sigchld_clock_t si_stime; ++ # } _sigchld; ++ ++ # /* SIGILL, SIGFPE, SIGSEGV, SIGBUS. */ ++ ("_sigfault", _siginfo_t_U_sigfault), # struct ++ ++ # void *si_addr; /* Faulting insn/memory ref. */ ++ # short int si_addr_lsb; /* Valid LSB of the reported address. */ ++ # } _sigfault; ++ ++ # /* SIGPOLL. */ ++ ("_sigpoll", _siginfo_t_U_sigpoll), # struct ++ ++ # long int si_band; /* Band event for SIGPOLL. */ ++ # int si_fd; ++ # } _sigpoll; ++ ++ # /* SIGSYS. */ ++ ("_sigsys", _siginfo_t_U_sigpoll) # struct ++ ++ # void *_call_addr; /* Calling user insn. */ ++ # int _syscall; /* Triggering system call number. */ ++ # unsigned int _arch; /* AUDIT_ARCH_* of syscall. */ ++ # } _sigsys; ++ ] # } _sifields; + + + class siginfo_t(ctypes.Structure): # typedef struct +- _fields_ = [ # { +- ("si_signo", ctypes.c_int +- ), # int si_signo; /* Signal number. */ ++ _fields_ = [ ++ ( ++ # Signal number ++ # int si_signo; ++ "si_signo", ctypes.c_int ++ ), + ( ++ # If non-zero, an errno value associated with ++ # int si_errno; + "si_errno", ctypes.c_int +- ), # int si_errno; /* If non-zero, an errno value associated with +- # this signal, as defined in . */ +- ("si_code", ctypes.c_int +- ), # int si_code; /* Signal code. */ +- # +- ("_sifields", _siginfo_t_U) # union +- # { +- # int _pad[__SI_PAD_SIZE]; ++ ), ++ ( ++ # Signal code - this signal, as defined in ++ # int si_code; ++ "si_code", ctypes.c_int ++ ), ++ ( ++ # Union ++ "_sifields", _siginfo_t_U ++ ) ++ ++ # int _pad[__SI_PAD_SIZE]; + # +- # /* kill(). */ +- # struct +- # { +- # __pid_t si_pid; /* Sending process ID. */ +- # __uid_t si_uid; /* Real user ID of sending process. */ +- # } _kill; ++ # /* kill(). */ ++ # struct ++ ++ # __pid_t si_pid; /* Sending process ID. */ ++ # __uid_t si_uid; /* Real user ID of sending process. */ ++ # } _kill; + # +- # /* POSIX.1b timers. */ +- # struct +- # { +- # int si_tid; /* Timer ID. */ +- # int si_overrun; /* Overrun count. */ +- # sigval_t si_sigval; /* Signal value. */ +- # } _timer; ++ # /* POSIX.1b timers. */ ++ # struct ++ ++ # int si_tid; /* Timer ID. */ ++ # int si_overrun; /* Overrun count. */ ++ # sigval_t si_sigval; /* Signal value. */ ++ # } _timer; + # +- # /* POSIX.1b signals. */ +- # struct +- # { +- # __pid_t si_pid; /* Sending process ID. */ +- # __uid_t si_uid; /* Real user ID of sending process. */ +- # sigval_t si_sigval; /* Signal value. */ +- # } _rt; ++ # /* POSIX.1b signals. */ ++ # struct ++ ++ # __pid_t si_pid; /* Sending process ID. */ ++ # __uid_t si_uid; /* Real user ID of sending process. */ ++ # sigval_t si_sigval; /* Signal value. */ ++ # } _rt; + # +- # /* SIGCHLD. */ +- # struct +- # { +- # __pid_t si_pid; /* Which child. */ +- # __uid_t si_uid; /* Real user ID of sending process. */ +- # int si_status; /* Exit value or signal. */ +- # __sigchld_clock_t si_utime; +- # __sigchld_clock_t si_stime; +- # } _sigchld; ++ # /* SIGCHLD. */ ++ # struct ++ ++ # __pid_t si_pid; /* Which child. */ ++ # __uid_t si_uid; /* Real user ID of sending process. */ ++ # int si_status; /* Exit value or signal. */ ++ # __sigchld_clock_t si_utime; ++ # __sigchld_clock_t si_stime; ++ # } _sigchld; + # +- # /* SIGILL, SIGFPE, SIGSEGV, SIGBUS. */ +- # struct +- # { +- # void *si_addr; /* Faulting insn/memory ref. */ +- # short int si_addr_lsb; /* Valid LSB of the reported address. */ +- # } _sigfault; ++ # /* SIGILL, SIGFPE, SIGSEGV, SIGBUS. */ ++ # struct ++ ++ # void *si_addr; /* Faulting insn/memory ref. */ ++ # short int si_addr_lsb; /* Valid LSB of the reported address. */ ++ # } _sigfault; + # +- # /* SIGPOLL. */ +- # struct +- # { +- # long int si_band; /* Band event for SIGPOLL. */ +- # int si_fd; +- # } _sigpoll; ++ # /* SIGPOLL. */ ++ # struct ++ ++ # long int si_band; /* Band event for SIGPOLL. */ ++ # int si_fd; ++ # } _sigpoll; + # +- # /* SIGSYS. */ +- # struct +- # { +- # void *_call_addr; /* Calling user insn. */ +- # int _syscall; /* Triggering system call number. */ +- # unsigned int _arch; /* AUDIT_ARCH_* of syscall. */ +- # } _sigsys; +- # } _sifields; +- ] # } siginfo_t __SI_ALIGNMENT; ++ # /* SIGSYS. */ ++ # struct ++ ++ # void *_call_addr; /* Calling user insn. */ ++ # int _syscall; /* Triggering system call number. */ ++ # unsigned int _arch; /* AUDIT_ARCH_* of syscall. */ ++ # } _sigsys; ++ # } _sifields; ++ ] # } siginfo_t __SI_ALIGNMENT; + + + # xsave related. + + + class ymmh_struct(ctypes.Structure): # struct ymmh_struct { +- _fields_ = [("ymmh_space", 64 * ctypes.c_uint +- ) # u32 ymmh_space[64]; +- ] # } __packed; ++ _fields_ = [ ++ # u32 ymmh_space[64]; ++ ("ymmh_space", 64 * ctypes.c_uint) ++ ] # } __packed; + + + class xsave_hdr_struct(ctypes.Structure): # struct xsave_hdr_struct { + _fields_ = [ +- ("xstate_bv", ctypes.c_ulonglong +- ), # u64 xstate_bv; +- ("reserved1", ctypes.c_ulonglong * +- 2), # u64 reserved1[2]; +- ("reserved2", ctypes.c_ulonglong * 5 +- ) # u64 reserved2[5]; ++ # u64 xstate_bv; ++ ("xstate_bv", ctypes.c_ulonglong), ++ # u64 reserved1[2]; ++ ("reserved1", ctypes.c_ulonglong * 2), ++ # u64 reserved2[5]; ++ ("reserved2", ctypes.c_ulonglong * 5) + ] # } __packed; + + + class i387_fxsave_struct(ctypes.Structure): # struct i387_fxsave_struct { + _fields_ = [ + ( ++ # Control Word ++ # u16 cwd; + "cwd", ctypes.c_ushort +- ), # u16 cwd; /* Control Word */ ++ ), + ( ++ # Status Word ++ # u16 swd; + "swd", ctypes.c_ushort +- ), # u16 swd; /* Status Word */ ++ ), + ( ++ # Tag Word ++ # u16 twd; + "twd", ctypes.c_ushort +- ), # u16 twd; /* Tag Word */ ++ ), + ( ++ # Last Instruction Opcode ++ # u16 fop; + "fop", ctypes.c_ushort +- ), # u16 fop; /* Last Instruction Opcode */ +- # union { +- # struct { ++ ), ++ # union { ++ # struct { + ( ++ # Instruction Pointer ++ # u64 rip; + "rip", ctypes.c_ulonglong +- ), # u64 rip; /* Instruction Pointer */ ++ ), + ( ++ # Data Pointer ++ # u64 rdp; + "rdp", ctypes.c_ulonglong +- ), # u64 rdp; /* Data Pointer */ +- # }; +- # struct { +- # u32 fip; /* FPU IP Offset */ +- # u32 fcs; /* FPU IP Selector */ +- # u32 foo; /* FPU Operand Offset */ +- # u32 fos; /* FPU Operand Selector */ +- # }; +- # }; ++ ), ++ ++ # struct { ++ # u32 fip; /* FPU IP Offset */ ++ # u32 fcs; /* FPU IP Selector */ ++ # u32 foo; /* FPU Operand Offset */ ++ # u32 fos; /* FPU Operand Selector */ ++ + ( ++ # MXCSR Register State ++ # u32 mxcsr; + "mxcsr", ctypes.c_uint +- ), # u32 mxcsr; /* MXCSR Register State */ ++ ), + ( ++ # MXCSR Mask ++ # u32 mxcsr_mask; + "mxcsr_mask", ctypes.c_uint +- ), # u32 mxcsr_mask; /* MXCSR Mask */ +- # +- # /* 8*16 bytes for each FP-reg = 128 bytes */ +- ("st_space", ctypes.c_uint * 32 +- ), # u32 st_space[32]; +- # +- # /* 16*16 bytes for each XMM-reg = 256 bytes */ +- ("xmm_space", ctypes.c_uint * 64 +- ), # u32 xmm_space[64]; +- # +- ("padding", ctypes.c_uint * 12 +- ), # u32 padding[12]; +- # +- # union { +- ("padding1", ctypes.c_uint * 12 +- ) # u32 padding1[12]; +- # u32 sw_reserved[12]; +- # }; +- # ++ ), ++ # 8*16 bytes for each FP-reg = 128 bytes ++ ( ++ # u32 st_space[32]; ++ "st_space", ctypes.c_uint * 32 ++ ), ++ # 16*16 bytes for each XMM-reg = 256 bytes ++ ( ++ # u32 xmm_space[64]; ++ "xmm_space", ctypes.c_uint * 64 ++ ), ++ ( ++ # u32 padding[12]; ++ "padding", ctypes.c_uint * 12 ++ ), ++ # union { ++ ( ++ # u32 padding1[12]; ++ "padding1", ctypes.c_uint * 12 ++ ) ++ # u32 sw_reserved[12]; + ] # } __aligned(16); + + + class elf_xsave_struct(ctypes.Structure): # struct xsave_struct { + _fields_ = [ +- ("i387", +- i387_fxsave_struct), # struct i387_fxsave_struct i387; +- ("xsave_hdr", xsave_hdr_struct +- ), # struct xsave_hdr_struct xsave_hdr; +- ("ymmh", ymmh_struct) # struct ymmh_struct ymmh; ++ # struct i387_fxsave_struct i387; ++ ("i387", i387_fxsave_struct), ++ # struct xsave_hdr_struct xsave_hdr; ++ ("xsave_hdr", xsave_hdr_struct), ++ # struct ymmh_struct ymmh; ++ ("ymmh", ymmh_struct) + ] # } __aligned(FP_MIN_ALIGN_BYTES) __packed; +-- +2.34.1 + diff --git a/0020-coredump-fix-missing-whitespace-around-operator.patch b/0020-coredump-fix-missing-whitespace-around-operator.patch new file mode 100644 index 0000000..7972dac --- /dev/null +++ b/0020-coredump-fix-missing-whitespace-around-operator.patch @@ -0,0 +1,29 @@ +From 4abfd7ea70d7c1d8f1ee4b87dcff0e121823b523 Mon Sep 17 00:00:00 2001 +From: Radostin Stoyanov +Date: Sun, 5 Sep 2021 22:37:26 +0100 +Subject: [PATCH 020/120] coredump: fix missing whitespace around operator + +Missing whitespace around arithmetic operator +https://www.flake8rules.com/rules/E226.html + +Signed-off-by: Radostin Stoyanov +--- + coredump/coredump.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/coredump/coredump.py b/coredump/coredump.py +index e63abf951..5e63d2138 100644 +--- a/coredump/coredump.py ++++ b/coredump/coredump.py +@@ -10,7 +10,7 @@ def coredump(opts): + for pid in cores: + if opts['pid'] and pid != opts['pid']: + continue +- with open(os.path.realpath(opts['out'])+"/core."+str(pid), 'wb+') as f: ++ with open(os.path.realpath(opts['out']) + "/core." + str(pid), 'wb+') as f: + cores[pid].write(f) + + +-- +2.34.1 + diff --git a/0021-coredump-fix-too-many-blank-lines.patch b/0021-coredump-fix-too-many-blank-lines.patch new file mode 100644 index 0000000..2cece25 --- /dev/null +++ b/0021-coredump-fix-too-many-blank-lines.patch @@ -0,0 +1,27 @@ +From c53231fe5e81412d27ada8bdd4a0dd78f19c3b21 Mon Sep 17 00:00:00 2001 +From: Radostin Stoyanov +Date: Sun, 5 Sep 2021 22:39:50 +0100 +Subject: [PATCH 021/120] coredump: fix too many blank lines + +https://www.flake8rules.com/rules/E303.html + +Signed-off-by: Radostin Stoyanov +--- + coredump/criu_coredump/coredump.py | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/coredump/criu_coredump/coredump.py b/coredump/criu_coredump/coredump.py +index 274889800..a232132fd 100644 +--- a/coredump/criu_coredump/coredump.py ++++ b/coredump/criu_coredump/coredump.py +@@ -321,7 +321,6 @@ class coredump_generator: + else: + prpsinfo.pr_fname = core["tc"]["comm"] + +- + nhdr = elf.Elf64_Nhdr() + nhdr.n_namesz = 5 + nhdr.n_descsz = ctypes.sizeof(elf.elf_prpsinfo()) +-- +2.34.1 + diff --git a/0022-coredump-fix-comparison-to-true.patch b/0022-coredump-fix-comparison-to-true.patch new file mode 100644 index 0000000..8b37ebf --- /dev/null +++ b/0022-coredump-fix-comparison-to-true.patch @@ -0,0 +1,29 @@ +From 718d0039623a7371130cdb568b39ee9f968d31c4 Mon Sep 17 00:00:00 2001 +From: Radostin Stoyanov +Date: Sun, 5 Sep 2021 22:42:19 +0100 +Subject: [PATCH 022/120] coredump: fix comparison to true + +Comparison to true should be 'if cond is true:' or 'if cond:' +https://www.flake8rules.com/rules/E712.html + +Signed-off-by: Radostin Stoyanov +--- + coredump/criu_coredump/coredump.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/coredump/criu_coredump/coredump.py b/coredump/criu_coredump/coredump.py +index a232132fd..41d102db7 100644 +--- a/coredump/criu_coredump/coredump.py ++++ b/coredump/criu_coredump/coredump.py +@@ -653,7 +653,7 @@ class coredump_generator: + if not found: + continue + +- if "in_parent" in m and m["in_parent"] == True: ++ if "in_parent" in m and m["in_parent"]: + ppid = self.pstree[pid]["ppid"] + return self._get_page(ppid, page_no) + else: +-- +2.34.1 + diff --git a/0023-coredump-lint-fix-visually-indented-line.patch b/0023-coredump-lint-fix-visually-indented-line.patch new file mode 100644 index 0000000..dd5ab2e --- /dev/null +++ b/0023-coredump-lint-fix-visually-indented-line.patch @@ -0,0 +1,52 @@ +From bf85f98b0cbdab968d539dbc7c363b596eb0e95e Mon Sep 17 00:00:00 2001 +From: Radostin Stoyanov +Date: Sun, 5 Sep 2021 22:47:59 +0100 +Subject: [PATCH 023/120] coredump: lint fix visually indented line + +Continuation line over-indented for visual indent +https://www.flake8rules.com/rules/E127.html + +Visually indented line with same indent as next logical line +https://www.flake8rules.com/rules/E129.html + +Signed-off-by: Radostin Stoyanov +--- + coredump/criu_coredump/coredump.py | 18 +++++++++--------- + 1 file changed, 9 insertions(+), 9 deletions(-) + +diff --git a/coredump/criu_coredump/coredump.py b/coredump/criu_coredump/coredump.py +index 41d102db7..881c40b0a 100644 +--- a/coredump/criu_coredump/coredump.py ++++ b/coredump/criu_coredump/coredump.py +@@ -781,19 +781,19 @@ class coredump_generator: + """ + Calculate amount of vma to put into core dump. + """ +- if vma["status"] & status["VMA_AREA_VVAR"] or \ +- vma["status"] & status["VMA_AREA_VSYSCALL"] or \ +- vma["status"] & status["VMA_AREA_VDSO"]: ++ if (vma["status"] & status["VMA_AREA_VVAR"] or ++ vma["status"] & status["VMA_AREA_VSYSCALL"] or ++ vma["status"] & status["VMA_AREA_VDSO"]): + size = vma["end"] - vma["start"] + elif vma["prot"] == 0: + size = 0 +- elif vma["prot"] & prot["PROT_READ"] and \ +- vma["prot"] & prot["PROT_EXEC"]: ++ elif (vma["prot"] & prot["PROT_READ"] and ++ vma["prot"] & prot["PROT_EXEC"]): + size = PAGESIZE +- elif vma["status"] & status["VMA_ANON_SHARED"] or \ +- vma["status"] & status["VMA_FILE_SHARED"] or \ +- vma["status"] & status["VMA_ANON_PRIVATE"] or \ +- vma["status"] & status["VMA_FILE_PRIVATE"]: ++ elif (vma["status"] & status["VMA_ANON_SHARED"] or ++ vma["status"] & status["VMA_FILE_SHARED"] or ++ vma["status"] & status["VMA_ANON_PRIVATE"] or ++ vma["status"] & status["VMA_FILE_PRIVATE"]): + size = vma["end"] - vma["start"] + else: + size = 0 +-- +2.34.1 + diff --git a/0024-test-coredump-fix-shellcheck-errors.patch b/0024-test-coredump-fix-shellcheck-errors.patch new file mode 100644 index 0000000..d588ef9 --- /dev/null +++ b/0024-test-coredump-fix-shellcheck-errors.patch @@ -0,0 +1,51 @@ +From e56c944db74f9c3b033274271f7a82fef6fed815 Mon Sep 17 00:00:00 2001 +From: Radostin Stoyanov +Date: Mon, 6 Sep 2021 00:20:58 +0100 +Subject: [PATCH 024/120] test/coredump: fix shellcheck errors + +ShellCheck reports the following problems: + +SC2086: Double quote to prevent globbing and word splitting. +SC2035: Use ./*glob* or -- *glob* so names with dashes won't become options. +SC1091: Not following: ../env.sh was not specified as input (see shellcheck -x). + +Signed-off-by: Radostin Stoyanov +--- + test/others/criu-coredump/test.sh | 10 +++++++--- + 1 file changed, 7 insertions(+), 3 deletions(-) + +diff --git a/test/others/criu-coredump/test.sh b/test/others/criu-coredump/test.sh +index 62d9f7edc..dd774e298 100755 +--- a/test/others/criu-coredump/test.sh ++++ b/test/others/criu-coredump/test.sh +@@ -1,4 +1,8 @@ +-source ../env.sh ++#!/bin/bash ++ ++set -x ++# shellcheck disable=SC1091 ++source ../env.sh || exit 1 + + function gen_imgs { + PID=$(../loop) +@@ -9,7 +13,7 @@ function gen_imgs { + exit 1 + fi + +- images_list=$(ls -1 *.img) ++ images_list=$(ls -1 ./*.img) + if [ -z "$images_list" ]; then + echo "Failed to generate images" + exit 1 +@@ -32,7 +36,7 @@ function run_test { + for x in $cores + do + echo "=== try readelf $x" +- readelf -a $x || exit $? ++ readelf -a "$x" || exit $? + echo "=== done" + done + +-- +2.34.1 + diff --git a/0025-make-enable-lint-for-coredump.patch b/0025-make-enable-lint-for-coredump.patch new file mode 100644 index 0000000..5dd6006 --- /dev/null +++ b/0025-make-enable-lint-for-coredump.patch @@ -0,0 +1,31 @@ +From ff7eea013205a1055b6f0e2300db46f6768c6d28 Mon Sep 17 00:00:00 2001 +From: Radostin Stoyanov +Date: Sun, 5 Sep 2021 22:55:24 +0100 +Subject: [PATCH 025/120] make: enable lint for coredump + +Signed-off-by: Radostin Stoyanov +--- + Makefile | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/Makefile b/Makefile +index e361e8a8f..73b647d6d 100644 +--- a/Makefile ++++ b/Makefile +@@ -427,11 +427,13 @@ lint: + flake8 --config=scripts/flake8.cfg test/others/rpc/config_file.py + flake8 --config=scripts/flake8.cfg lib/py/images/pb2dict.py + flake8 --config=scripts/flake8.cfg scripts/criu-ns ++ flake8 --config=scripts/flake8.cfg coredump/ + shellcheck --version + shellcheck scripts/*.sh + shellcheck scripts/ci/*.sh scripts/ci/apt-install + shellcheck test/others/crit/*.sh + shellcheck test/others/libcriu/*.sh ++ shellcheck test/others/crit/*.sh test/others/criu-coredump/*.sh + shellcheck test/others/config-file/*.sh + # Do not append \n to pr_perror or fail + ! git --no-pager grep -E '^\s*\<(pr_perror|fail)\>.*\\n"' +-- +2.34.1 + diff --git a/0026-ci-enable-coredump-tests.patch b/0026-ci-enable-coredump-tests.patch new file mode 100644 index 0000000..52d0b54 --- /dev/null +++ b/0026-ci-enable-coredump-tests.patch @@ -0,0 +1,39 @@ +From 4a67277e8f67e988aa14106cb69a14d8e3e65815 Mon Sep 17 00:00:00 2001 +From: Radostin Stoyanov +Date: Sun, 5 Sep 2021 23:06:56 +0100 +Subject: [PATCH 026/120] ci: enable coredump tests + +Signed-off-by: Radostin Stoyanov +--- + scripts/ci/run-ci-tests.sh | 3 +++ + test/others/env.sh | 2 +- + 2 files changed, 4 insertions(+), 1 deletion(-) + +diff --git a/scripts/ci/run-ci-tests.sh b/scripts/ci/run-ci-tests.sh +index 7c66e6802..51aa7db9e 100755 +--- a/scripts/ci/run-ci-tests.sh ++++ b/scripts/ci/run-ci-tests.sh +@@ -259,6 +259,9 @@ ip net add test + # more crit testing + make -C test/others/crit run + ++# coredump testing ++make -C test/others/criu-coredump run ++ + # libcriu testing + make -C test/others/libcriu run + +diff --git a/test/others/env.sh b/test/others/env.sh +index e2f63eee3..45066f760 100755 +--- a/test/others/env.sh ++++ b/test/others/env.sh +@@ -13,5 +13,5 @@ fi + #export PYTHON + CRIT=$(readlink -f `dirname ${BASH_SOURCE[0]}`/../../crit/crit-"${PYTHON}") + crit=$CRIT +-CRIU_COREDUMP=$(readlink -f `dirname ${BASH_SOURCE[0]}`/../../criu-coredump/coredump-"${PYTHON}") ++CRIU_COREDUMP=$(readlink -f `dirname ${BASH_SOURCE[0]}`/../../coredump/coredump-"${PYTHON}") + criu_coredump=$CRIU_COREDUMP +-- +2.34.1 + diff --git a/0027-pie-restorer-remove-excess-hash-printf-specifier.patch b/0027-pie-restorer-remove-excess-hash-printf-specifier.patch new file mode 100644 index 0000000..af3612e --- /dev/null +++ b/0027-pie-restorer-remove-excess-hash-printf-specifier.patch @@ -0,0 +1,39 @@ +From 8ee0ce3b87d8be2a294881e47e076e8095ea834b Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Thu, 21 Oct 2021 11:47:01 +0300 +Subject: [PATCH 027/120] pie/restorer: remove excess hash printf specifier + +We use here "%#x" printf specifier in pie code, but sbuf_printf core pie +printing function knows nothing about '#' specifier. More over simple +"%x" in pie does same as "%#x" in stdio printf, see print_hex* functions +add "0x" before hex numbers. + +We've got this error on vzt-cpt runs in Virtuozzo: + +(04.750271) pie: 158: Adjust id +Error: Unknown printf format %# + +So to fix it we can just remove '#'. + +Fixes: ecd432fe2 ("timerfd: Implement c/r procedure") +Signed-off-by: Pavel Tikhomirov +--- + criu/pie/restorer.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/criu/pie/restorer.c b/criu/pie/restorer.c +index 4304691bb..0051452e4 100644 +--- a/criu/pie/restorer.c ++++ b/criu/pie/restorer.c +@@ -1013,7 +1013,7 @@ static int timerfd_arm(struct task_restore_args *args) + + t->val.it_value.tv_sec += (time_t)ts.tv_sec; + +- pr_debug("Adjust id %#x it_value(%llu, %llu) -> it_value(%llu, %llu)\n", t->id, ++ pr_debug("Adjust id %x it_value(%llu, %llu) -> it_value(%llu, %llu)\n", t->id, + (unsigned long long)ts.tv_sec, (unsigned long long)ts.tv_nsec, + (unsigned long long)t->val.it_value.tv_sec, + (unsigned long long)t->val.it_value.tv_nsec); +-- +2.34.1 + diff --git a/0028-tty-fix-the-null-pointer-of-get_tty_driver.patch b/0028-tty-fix-the-null-pointer-of-get_tty_driver.patch new file mode 100644 index 0000000..cde6613 --- /dev/null +++ b/0028-tty-fix-the-null-pointer-of-get_tty_driver.patch @@ -0,0 +1,34 @@ +From 79c194313f14a5a902764ec653a611616125c256 Mon Sep 17 00:00:00 2001 +From: "fu.lin" +Date: Fri, 17 Sep 2021 17:16:48 +0800 +Subject: [PATCH 028/120] tty: fix the null pointer of get_tty_driver + +v2: split error checking from index variable initialization +v3: use PRIx64 for printing dev_t + +Signed-off-by: fu.lin +Signed-off-by: Pavel Tikhomirov +--- + criu/tty.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/criu/tty.c b/criu/tty.c +index 1598ad956..1462193c5 100644 +--- a/criu/tty.c ++++ b/criu/tty.c +@@ -1977,6 +1977,12 @@ static int dump_one_tty(int lfd, u32 id, const struct fd_parms *p) + pr_info("Dumping tty %d with id %#x\n", lfd, id); + + driver = get_tty_driver(p->stat.st_rdev, p->stat.st_dev); ++ if (driver == NULL) { ++ pr_err("Unable to find a tty driver (rdev %#" PRIx64 " dev %#" PRIx64 ")\n", p->stat.st_rdev, ++ p->stat.st_dev); ++ return -1; ++ } ++ + if (driver->fd_get_index) + index = driver->fd_get_index(lfd, p); + else +-- +2.34.1 + diff --git a/0029-util-use-nftw-in-rmrf-helper.patch b/0029-util-use-nftw-in-rmrf-helper.patch new file mode 100644 index 0000000..ab0573b --- /dev/null +++ b/0029-util-use-nftw-in-rmrf-helper.patch @@ -0,0 +1,126 @@ +From 6dadc8bf0c996385531af6729361751b47b8926b Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Fri, 22 Oct 2021 17:56:37 +0300 +Subject: [PATCH 029/120] util: use nftw in rmrf helper + +This simplifies the code by removing excess recursion and reusing +standard function to walk over file-tree instead of opencoding it. + +This addresses problem mentioned in my review comment: +https://github.com/checkpoint-restore/criu/pull/1495#discussion_r677554523 + +Fixes: 0db135ac4 ("util: add rm -rf function") + +Signed-off-by: Pavel Tikhomirov +--- + criu/apparmor.c | 2 +- + criu/include/util.h | 4 ++-- + criu/util.c | 46 ++++++++++++++------------------------------- + 3 files changed, 17 insertions(+), 35 deletions(-) + +diff --git a/criu/apparmor.c b/criu/apparmor.c +index 328fc606b..f9ad79619 100644 +--- a/criu/apparmor.c ++++ b/criu/apparmor.c +@@ -630,7 +630,7 @@ int suspend_aa(void) + } + + ret = do_suspend(true); +- if (rm_rf(policydir) < 0) ++ if (rmrf(policydir) < 0) + pr_err("failed removing policy dir %s\n", policydir); + + return ret; +diff --git a/criu/include/util.h b/criu/include/util.h +index a2dac2233..19d378fc5 100644 +--- a/criu/include/util.h ++++ b/criu/include/util.h +@@ -284,8 +284,8 @@ int setup_tcp_server(char *type, char *addr, unsigned short *port); + int run_tcp_server(bool daemon_mode, int *ask, int cfd, int sk); + int setup_tcp_client(char *hostname); + +-/* *dir should be writable and at least PATH_MAX long */ +-int rm_rf(char *dir); ++/* path should be writable and no more than PATH_MAX long */ ++int rmrf(char *path); + + #define LAST_PID_PATH "sys/kernel/ns_last_pid" + #define PID_MAX_PATH "sys/kernel/pid_max" +diff --git a/criu/util.c b/criu/util.c +index 06124c220..414879971 100644 +--- a/criu/util.c ++++ b/criu/util.c +@@ -1,4 +1,4 @@ +-#define _XOPEN_SOURCE ++#define _XOPEN_SOURCE 500 + + #include + #include +@@ -26,6 +26,7 @@ + #include + #include + #include ++#include + + #include "linux/mount.h" + +@@ -1613,44 +1614,25 @@ ssize_t write_all(int fd, const void *buf, size_t size) + return n; + } + +-int rm_rf(char *target) ++static int remove_one(const char *fpath, const struct stat *sb, int tflag, struct FTW *ftwbuf) + { +- int offset = strlen(target); +- DIR *dir = NULL; +- struct dirent *de; +- int ret = -1; ++ int ret; + +- dir = opendir(target); +- if (!dir) { +- pr_perror("unable to open %s", target); ++ ret = remove(fpath); ++ if (ret) { ++ pr_perror("rmrf: unable to remove %s", fpath); + return -1; + } + +- while ((de = readdir(dir))) { +- int n; +- +- if (dir_dots(de)) +- continue; +- +- n = snprintf(target + offset, PATH_MAX - offset, "/%s", de->d_name); +- if (n < 0 || n >= PATH_MAX) { +- pr_err("snprintf failed\n"); +- goto out; +- } +- +- if (de->d_type == DT_DIR && rm_rf(target)) +- goto out; ++ return 0; ++} + +- if (remove(target) < 0) { +- pr_perror("unable to remove %s", target); +- goto out; +- } +- } ++#define NFTW_FD_MAX 64 + +- ret = 0; +-out: +- target[offset] = 0; +- return ret; ++int rmrf(char *path) ++{ ++ pr_debug("rmrf: removing %s\n", path); ++ return nftw(path, remove_one, NFTW_FD_MAX, FTW_DEPTH | FTW_PHYS); + } + + __attribute__((returns_twice)) static pid_t raw_legacy_clone(unsigned long flags, int *pidfd) +-- +2.34.1 + diff --git a/0030-criu-ns-make-pidns-init-first-do-setsid.patch b/0030-criu-ns-make-pidns-init-first-do-setsid.patch new file mode 100644 index 0000000..b472497 --- /dev/null +++ b/0030-criu-ns-make-pidns-init-first-do-setsid.patch @@ -0,0 +1,37 @@ +From d6d76e07bb7f4532bb49c1fce99f3fef7fcd87c6 Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Mon, 18 Oct 2021 18:43:14 +0300 +Subject: [PATCH 030/120] criu-ns: make pidns init first do setsid + +We see that on criu-ns dump/restore/dump of the process which initially +was not a session leader (with --shell-job option) we see sid == 0 for +it and fail with something like: + +Error (criu/cr-dump.c:1333): A session leader of 41585(41585) is outside of its pid namespace + +Note: We should not dump processes with sid 0 (even with --shell-job) as +on restore we can can put such processes from multiple sessions into +one, which is wrong. + +Fixes: #232 + +Signed-off-by: Pavel Tikhomirov +--- + scripts/criu-ns | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/scripts/criu-ns b/scripts/criu-ns +index d76db3606..72c0753e5 100755 +--- a/scripts/criu-ns ++++ b/scripts/criu-ns +@@ -102,6 +102,7 @@ def wrap_restore(): + + criu_pid = os.fork() + if criu_pid == 0: ++ os.setsid() + _mount_new_proc() + run_criu(restore_args) + +-- +2.34.1 + diff --git a/0031-net-optimize-restore_rule-to-not-open-the-CR_FD_RULE.patch b/0031-net-optimize-restore_rule-to-not-open-the-CR_FD_RULE.patch new file mode 100644 index 0000000..eaec151 --- /dev/null +++ b/0031-net-optimize-restore_rule-to-not-open-the-CR_FD_RULE.patch @@ -0,0 +1,113 @@ +From 62090e89b553a022bf564e76840dc67ea786ec65 Mon Sep 17 00:00:00 2001 +From: Nicolas Viennot +Date: Thu, 28 Oct 2021 21:05:57 +0000 +Subject: [PATCH 031/120] net: optimize restore_rule() to not open the + CR_FD_RULE image file twice + +Previously, `open_image(CR_FD_RULE, O_RSTR, pid)` was called twice. +Opening an image file twice is not allowed when streaming the image. +This commit optimizes the code to only open the image file once. + +Also improved the error path in restore_ip_dump(). + +Signed-off-by: Nicolas Viennot +--- + criu/net.c | 51 ++++++++++++++++++--------------------------------- + 1 file changed, 18 insertions(+), 33 deletions(-) + +diff --git a/criu/net.c b/criu/net.c +index 7b45f0633..02115c4de 100644 +--- a/criu/net.c ++++ b/criu/net.c +@@ -2250,12 +2250,12 @@ static int restore_ip_dump(int type, int pid, char *cmd) + sockfd = img_raw_fd(img); + if (sockfd < 0) { + pr_err("Getting raw FD failed\n"); +- return -1; ++ goto out_image; + } + tmp_file = tmpfile(); + if (!tmp_file) { + pr_perror("Failed to open tmpfile"); +- return -1; ++ goto out_image; + } + + while ((n = read(sockfd, buf, 1024)) > 0) { +@@ -2264,25 +2264,34 @@ static int restore_ip_dump(int type, int pid, char *cmd) + pr_perror("Failed to write to tmpfile " + "[written: %d; total: %d]", + written, n); +- goto close; ++ goto out_tmp_file; + } + } + + if (fseek(tmp_file, 0, SEEK_SET)) { + pr_perror("Failed to set file position to beginning of tmpfile"); +- goto close; ++ goto out_tmp_file; + } + +- if (img) { +- ret = run_ip_tool(cmd, "restore", NULL, NULL, fileno(tmp_file), -1, 0); +- close_image(img); ++ if (type == CR_FD_RULE) { ++ /* ++ * Delete 3 default rules to prevent duplicates. See kernel's ++ * function fib_default_rules_init() for the details. ++ */ ++ run_ip_tool("rule", "flush", NULL, NULL, -1, -1, 0); ++ run_ip_tool("rule", "delete", "table", "local", -1, -1, 0); + } + +-close: ++ ret = run_ip_tool(cmd, "restore", NULL, NULL, fileno(tmp_file), -1, 0); ++ ++out_tmp_file: + if (fclose(tmp_file)) { + pr_perror("Failed to close tmpfile"); + } + ++out_image: ++ close_image(img); ++ + return ret; + } + +@@ -2304,31 +2313,7 @@ static inline int restore_route(int pid) + + static inline int restore_rule(int pid) + { +- struct cr_img *img; +- int ret = 0; +- +- img = open_image(CR_FD_RULE, O_RSTR, pid); +- if (!img) { +- ret = -1; +- goto out; +- } +- +- if (empty_image(img)) +- goto close; +- +- /* +- * Delete 3 default rules to prevent duplicates. See kernel's +- * function fib_default_rules_init() for the details. +- */ +- run_ip_tool("rule", "flush", NULL, NULL, -1, -1, 0); +- run_ip_tool("rule", "delete", "table", "local", -1, -1, 0); +- +- if (restore_ip_dump(CR_FD_RULE, pid, "rule")) +- ret = -1; +-close: +- close_image(img); +-out: +- return ret; ++ return restore_ip_dump(CR_FD_RULE, pid, "rule"); + } + + /* +-- +2.34.1 + diff --git a/0032-ci-replace-deprecated-codecov-bash-uploader.patch b/0032-ci-replace-deprecated-codecov-bash-uploader.patch new file mode 100644 index 0000000..cbd2944 --- /dev/null +++ b/0032-ci-replace-deprecated-codecov-bash-uploader.patch @@ -0,0 +1,45 @@ +From e11c742e018aeaf60f0e3abef33c557b4799fb9a Mon Sep 17 00:00:00 2001 +From: Adrian Reber +Date: Wed, 27 Oct 2021 07:27:22 +0000 +Subject: [PATCH 032/120] ci: replace deprecated codecov bash uploader + +Replace deprecated codecov bash uploader with new version: + +https://about.codecov.io/blog/introducing-codecovs-new-uploader/ + +Signed-off-by: Adrian Reber +--- + .github/workflows/gcov-test.yml | 2 ++ + Makefile | 4 +++- + 2 files changed, 5 insertions(+), 1 deletion(-) + +diff --git a/.github/workflows/gcov-test.yml b/.github/workflows/gcov-test.yml +index f1b38e77e..f782c5b9d 100644 +--- a/.github/workflows/gcov-test.yml ++++ b/.github/workflows/gcov-test.yml +@@ -10,5 +10,7 @@ jobs: + - uses: actions/checkout@v2 + - name: Run Coverage Tests + run: sudo -E make -C scripts/ci local GCOV=1 ++ - name: Run gcov ++ run: sudo -E find . -name '*gcda' -type f -print0 | sudo -E xargs --null --max-args 128 --max-procs 4 gcov + - name: Run Coverage Analysis + run: sudo -E make codecov +diff --git a/Makefile b/Makefile +index 73b647d6d..d35012615 100644 +--- a/Makefile ++++ b/Makefile +@@ -449,7 +449,9 @@ lint: + + codecov: SHELL := $(shell which bash) + codecov: +- bash <(curl -s https://codecov.io/bash) ++ curl -Os https://uploader.codecov.io/latest/linux/codecov ++ chmod +x codecov ++ ./codecov + .PHONY: codecov + + fetch-clang-format: .FORCE +-- +2.34.1 + diff --git a/0033-ci-fix-userfaultfd-test-failures.patch b/0033-ci-fix-userfaultfd-test-failures.patch new file mode 100644 index 0000000..7b8024c --- /dev/null +++ b/0033-ci-fix-userfaultfd-test-failures.patch @@ -0,0 +1,36 @@ +From a86a66fc2cbb77cdf0df69f3589c325018261d67 Mon Sep 17 00:00:00 2001 +From: Adrian Reber +Date: Thu, 4 Nov 2021 09:10:38 +0000 +Subject: [PATCH 033/120] ci: fix userfaultfd test failures + +Newer kernels (5.11) require echo 1 > /proc/sys/vm/unprivileged_userfaultfd + +Without the 'echo 1' the kernel prints a message like this: + + uffd: Set unprivileged_userfaultfd sysctl knob to 1 if kernel faults must be handled without obtaining CAP_SYS_PTRACE capability + +Signed-off-by: Adrian Reber +--- + scripts/ci/run-ci-tests.sh | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/scripts/ci/run-ci-tests.sh b/scripts/ci/run-ci-tests.sh +index 51aa7db9e..096f907fb 100755 +--- a/scripts/ci/run-ci-tests.sh ++++ b/scripts/ci/run-ci-tests.sh +@@ -197,6 +197,12 @@ fi + # shellcheck disable=SC2086 + ./test/zdtm.py run -a -p 2 --keep-going $ZDTM_OPTS + ++# Newer kernels are blocking access to userfaultfd: ++# uffd: Set unprivileged_userfaultfd sysctl knob to 1 if kernel faults must be handled without obtaining CAP_SYS_PTRACE capability ++if [ -e /proc/sys/vm/unprivileged_userfaultfd ]; then ++ echo 1 > /proc/sys/vm/unprivileged_userfaultfd ++fi ++ + LAZY_EXCLUDE="-x maps04 -x cmdlinenv00 -x maps007" + + LAZY_TESTS='.*(maps0|uffd-events|lazy-thp|futex|fork).*' +-- +2.34.1 + diff --git a/0034-ci-use-Fedora-34-for-lint-CI-runs.patch b/0034-ci-use-Fedora-34-for-lint-CI-runs.patch new file mode 100644 index 0000000..a99a177 --- /dev/null +++ b/0034-ci-use-Fedora-34-for-lint-CI-runs.patch @@ -0,0 +1,29 @@ +From 07a2f0265d3d6eebec6b3a7538179f6b50da270b Mon Sep 17 00:00:00 2001 +From: Adrian Reber +Date: Thu, 4 Nov 2021 09:18:31 +0000 +Subject: [PATCH 034/120] ci: use Fedora 34 for lint CI runs + +Fedora 35 comes with clang 13 which provides different results for +clang-format than clang 12 in Fedora 34. + +Signed-off-by: Adrian Reber +--- + .github/workflows/lint.yml | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml +index 50b241e9f..49eb6aaac 100644 +--- a/.github/workflows/lint.yml ++++ b/.github/workflows/lint.yml +@@ -6,7 +6,7 @@ jobs: + build: + runs-on: ubuntu-latest + container: +- image: registry.fedoraproject.org/fedora:latest ++ image: registry.fedoraproject.org/fedora:34 + steps: + - name: Install tools + run: sudo dnf -y install git make python3-flake8 ShellCheck clang-tools-extra which findutils +-- +2.34.1 + diff --git a/0035-tests-improve-the-image-streamer-process-control.patch b/0035-tests-improve-the-image-streamer-process-control.patch new file mode 100644 index 0000000..677b67a --- /dev/null +++ b/0035-tests-improve-the-image-streamer-process-control.patch @@ -0,0 +1,145 @@ +From b405b1b0142bea0eeec1437a867b1c0ef7a3afe1 Mon Sep 17 00:00:00 2001 +From: Nicolas Viennot +Date: Fri, 29 Oct 2021 02:49:31 +0000 +Subject: [PATCH 035/120] tests: improve the image streamer process control + +When exceptions are raised during testing, the image streamer process +should be terminated as opposed to being left hanging. +This could lead to the whole test suite to be left hanging as it waits +for all child processes to exit. + +Signed-off-by: Nicolas Viennot +--- + test/zdtm.py | 44 ++++++++++++++++++++++++++++++++++---------- + 1 file changed, 34 insertions(+), 10 deletions(-) + +diff --git a/test/zdtm.py b/test/zdtm.py +index 0a52e1b96..fc7b8a183 100755 +--- a/test/zdtm.py ++++ b/test/zdtm.py +@@ -1039,6 +1039,7 @@ class criu: + self.__lazy_pages_p = None + self.__page_server_p = None + self.__dump_process = None ++ self.__img_streamer_process = None + self.__tls = self.__tls_options() if opts['tls'] else [] + self.__criu_bin = opts['criu_bin'] + self.__crit_bin = opts['crit_bin'] +@@ -1065,6 +1066,11 @@ class criu: + self.__dump_process = None + if ret: + raise test_fail_exc("criu dump exited with %s" % ret) ++ if self.__img_streamer_process: ++ ret = self.wait_for_criu_image_streamer() ++ if ret: ++ raise test_fail_exc("criu-image-streamer exited with %s" % ret) ++ + return + + def logs(self): +@@ -1219,8 +1225,10 @@ class criu: + stent['pages_written']) + + if self.__stream: +- p = self.spawn_criu_image_streamer("extract") +- p.wait() ++ self.spawn_criu_image_streamer("extract") ++ ret = self.wait_for_criu_image_streamer() ++ if ret: ++ raise test_fail_exc("criu-image-streamer (extract) exited with %s" % ret) + + real_written = 0 + for f in os.listdir(self.__ddir()): +@@ -1262,6 +1270,8 @@ class criu: + "--progress-fd {progress_fd}", + action] + ++ log = open(os.path.join(self.__ddir(), "img-streamer.log"), "w") ++ + # * As we are using a shell pipe command, we want to use pipefail. + # Otherwise, failures stay unnoticed. For this, we use bash as sh + # doesn't support that feature. +@@ -1270,7 +1280,9 @@ class criu: + progress_fd=progress_w, + images_dir=self.__ddir(), + img_file=os.path.join(self.__ddir(), STREAMED_IMG_FILE_NAME) +- )], close_fds=False) ++ )], stderr=log, close_fds=False) ++ ++ log.close() + + os.close(progress_w) + progress = os.fdopen(progress_r, "r") +@@ -1287,7 +1299,15 @@ class criu: + raise test_fail_exc( + "criu-image-streamer is not starting (exit_code=%d)" % p.wait()) + +- return p ++ progress.close() ++ ++ self.__img_streamer_process = p ++ ++ def wait_for_criu_image_streamer(self): ++ ret = self.__img_streamer_process.wait() ++ grep_errors(os.path.join(self.__ddir(), "img-streamer.log")) ++ self.__img_streamer_process = None ++ return ret + + def dump(self, action, opts=[]): + self.__iter += 1 +@@ -1319,7 +1339,7 @@ class criu: + a_opts += self.__test.getdopts() + + if self.__stream: +- streamer_p = self.spawn_criu_image_streamer("capture") ++ self.spawn_criu_image_streamer("capture") + a_opts += ["--stream"] + + if self.__dedup: +@@ -1347,9 +1367,9 @@ class criu: + opts=a_opts + opts, + nowait=nowait) + if self.__stream: +- ret = streamer_p.wait() ++ ret = self.wait_for_criu_image_streamer() + if ret: +- raise test_fail_exc("criu-image-streamer exited with %d" % ret) ++ raise test_fail_exc("criu-image-streamer (capture) exited with %d" % ret) + + if self.__mdedup and self.__iter > 1: + self.__criu_act("dedup", opts=[]) +@@ -1382,7 +1402,7 @@ class criu: + r_opts += ['--action-script', os.getcwd() + '/empty-netns-prep.sh'] + + if self.__stream: +- streamer_p = self.spawn_criu_image_streamer("serve") ++ self.spawn_criu_image_streamer("serve") + r_opts += ["--stream"] + + if self.__dedup: +@@ -1419,9 +1439,9 @@ class criu: + + self.__criu_act("restore", opts=r_opts + ["--restore-detached"]) + if self.__stream: +- ret = streamer_p.wait() ++ ret = self.wait_for_criu_image_streamer() + if ret: +- raise test_fail_exc("criu-image-streamer exited with %d" % ret) ++ raise test_fail_exc("criu-image-streamer (serve) exited with %d" % ret) + + self.show_stats("restore") + +@@ -1466,6 +1486,10 @@ class criu: + print("criu dump exited with %s" % self.__dump_process.wait()) + grep_errors(os.path.join(self.__ddir(), "dump.log")) + self.__dump_process = None ++ if self.__img_streamer_process: ++ self.__img_streamer_process.terminate() ++ ret = self.wait_for_criu_image_streamer() ++ print("criu-image-streamer exited with %s" % ret) + + + def try_run_hook(test, args): +-- +2.34.1 + diff --git a/0036-sockets-don-t-call-sk_setbufs-asyncronously.patch b/0036-sockets-don-t-call-sk_setbufs-asyncronously.patch new file mode 100644 index 0000000..518eec3 --- /dev/null +++ b/0036-sockets-don-t-call-sk_setbufs-asyncronously.patch @@ -0,0 +1,32 @@ +From d1e0bcf8130183cdcbd7e80dcbe18a5e7674f259 Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Thu, 29 Jul 2021 14:21:37 +0300 +Subject: [PATCH 036/120] sockets: don't call sk_setbufs asyncronously + +We want to also c/r socket buf locks (SO_BUF_LOCKS) which are also +implicitly set by setsockopt(SO_{SND,RCV}BUF*), so we need to order +these two properly. That's why we need to wait for sk_setbufs to finish. +And there is no much point in seting buffer sizes asyncronously anyway. + +Reviewed-by: Alexander Mikhalitsyn +Signed-off-by: Pavel Tikhomirov +--- + criu/sockets.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/criu/sockets.c b/criu/sockets.c +index 9426b5b94..65aa82950 100644 +--- a/criu/sockets.c ++++ b/criu/sockets.c +@@ -517,7 +517,7 @@ int restore_socket_opts(int sk, SkOptsEntry *soe) + pr_info("%d restore sndbuf %d rcv buf %d\n", sk, soe->so_sndbuf, soe->so_rcvbuf); + + /* setsockopt() multiplies the input values by 2 */ +- ret |= userns_call(sk_setbufs, UNS_ASYNC, bufs, sizeof(bufs), sk); ++ ret |= userns_call(sk_setbufs, 0, bufs, sizeof(bufs), sk); + + if (soe->has_so_priority) { + pr_debug("\trestore priority %d for socket\n", soe->so_priority); +-- +2.34.1 + diff --git a/0037-kerndat-check-for-set-getsockopt-SO_BUF_LOCK-availab.patch b/0037-kerndat-check-for-set-getsockopt-SO_BUF_LOCK-availab.patch new file mode 100644 index 0000000..d153bec --- /dev/null +++ b/0037-kerndat-check-for-set-getsockopt-SO_BUF_LOCK-availab.patch @@ -0,0 +1,132 @@ +From 5e13d03743d7d99f292858669d13d0350938106e Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Thu, 29 Jul 2021 14:57:17 +0300 +Subject: [PATCH 037/120] kerndat: check for set/getsockopt SO_BUF_LOCK + availability + +This is a new kernel feature to let criu restore sockets with kernel +auto-adjusted buffer sizes. + +Reviewed-by: Alexander Mikhalitsyn +Signed-off-by: Pavel Tikhomirov +--- + criu/cr-check.c | 10 ++++++++++ + criu/include/kerndat.h | 1 + + criu/include/sockets.h | 4 ++++ + criu/kerndat.c | 33 +++++++++++++++++++++++++++++++++ + 4 files changed, 48 insertions(+) + +diff --git a/criu/cr-check.c b/criu/cr-check.c +index 3575fb3b3..3e268c439 100644 +--- a/criu/cr-check.c ++++ b/criu/cr-check.c +@@ -1372,6 +1372,14 @@ static int check_network_lock_nftables(void) + return 0; + } + ++static int check_sockopt_buf_lock(void) ++{ ++ if (!kdat.has_sockopt_buf_lock) ++ return -1; ++ ++ return 0; ++} ++ + static int (*chk_feature)(void); + + /* +@@ -1490,6 +1498,7 @@ int cr_check(void) + ret |= check_ns_pid(); + ret |= check_apparmor_stacking(); + ret |= check_network_lock_nftables(); ++ ret |= check_sockopt_buf_lock(); + } + + /* +@@ -1602,6 +1611,7 @@ static struct feature_list feature_list[] = { + { "ns_pid", check_ns_pid }, + { "apparmor_stacking", check_apparmor_stacking }, + { "network_lock_nftables", check_network_lock_nftables }, ++ { "sockopt_buf_lock", check_sockopt_buf_lock }, + { NULL, NULL }, + }; + +diff --git a/criu/include/kerndat.h b/criu/include/kerndat.h +index 80bad7f11..2ded7d1da 100644 +--- a/criu/include/kerndat.h ++++ b/criu/include/kerndat.h +@@ -74,6 +74,7 @@ struct kerndat_s { + bool has_pidfd_getfd; + bool has_nspid; + bool has_nftables_concat; ++ bool has_sockopt_buf_lock; + }; + + extern struct kerndat_s kdat; +diff --git a/criu/include/sockets.h b/criu/include/sockets.h +index 3e8f3d601..399d38664 100644 +--- a/criu/include/sockets.h ++++ b/criu/include/sockets.h +@@ -123,4 +123,8 @@ extern const char *socket_proto_name(unsigned int proto, char *nm, size_t size); + #define ___socket_family_name(family) __socket_info_helper(socket_family_name, family) + #define ___socket_proto_name(proto) __socket_info_helper(socket_proto_name, proto) + ++#ifndef SO_BUF_LOCK ++#define SO_BUF_LOCK 72 ++#endif ++ + #endif /* __CR_SOCKETS_H__ */ +diff --git a/criu/kerndat.c b/criu/kerndat.c +index 0e88ba43e..9f6a6ec42 100644 +--- a/criu/kerndat.c ++++ b/criu/kerndat.c +@@ -816,6 +816,35 @@ static int kerndat_x86_has_ptrace_fpu_xsave_bug(void) + return 0; + } + ++int kerndat_sockopt_buf_lock(void) ++{ ++ int exit_code = -1; ++ socklen_t len; ++ u32 buf_lock; ++ int sock; ++ ++ sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); ++ if (sock < 0) { ++ pr_perror("Unable to create a socket"); ++ return -1; ++ } ++ ++ len = sizeof(buf_lock); ++ if (getsockopt(sock, SOL_SOCKET, SO_BUF_LOCK, &buf_lock, &len)) { ++ if (errno != ENOPROTOOPT) { ++ pr_perror("Unable to get SO_BUF_LOCK with getsockopt"); ++ goto err; ++ } ++ kdat.has_sockopt_buf_lock = false; ++ } else ++ kdat.has_sockopt_buf_lock = true; ++ ++ exit_code = 0; ++err: ++ close(sock); ++ return exit_code; ++} ++ + #define KERNDAT_CACHE_FILE KDAT_RUNDIR "/criu.kdat" + #define KERNDAT_CACHE_FILE_TMP KDAT_RUNDIR "/.criu.kdat" + +@@ -1359,6 +1388,10 @@ int kerndat_init(void) + pr_err("kerndat_has_nftables_concat failed when initializing kerndat.\n"); + ret = -1; + } ++ if (!ret && kerndat_sockopt_buf_lock()) { ++ pr_err("kerndat_sockopt_buf_lock failed when initializing kerndat.\n"); ++ ret = -1; ++ } + + kerndat_lsm(); + kerndat_mmap_min_addr(); +-- +2.34.1 + diff --git a/0038-sockets-c-r-bufer-size-locks.patch b/0038-sockets-c-r-bufer-size-locks.patch new file mode 100644 index 0000000..c77b4fd --- /dev/null +++ b/0038-sockets-c-r-bufer-size-locks.patch @@ -0,0 +1,69 @@ +From 9d02a38d6771a0eb449d5885eddcf74535f8ba8a Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Thu, 29 Jul 2021 11:27:13 +0300 +Subject: [PATCH 038/120] sockets: c/r bufer size locks + +When one sets socket buffer sizes with setsockopt(SO_{SND,RCV}BUF*), +kernel sets coresponding SOCK_SNDBUF_LOCK or SOCK_RCVBUF_LOCK flags on +struct sock. It means that such a socket with explicitly changed buffer +size can not be auto-adjusted by kernel (e.g. if there is free memory +kernel can auto-increase default socket buffers to improve perfomance). +(see tcp_fixup_rcvbuf() and tcp_sndbuf_expand()) + +CRIU is always changing buf sizes on restore, that means that all +sockets receive lock flags on struct sock and become non-auto-adjusted +after migration. In some cases it can decrease perfomance of network +connections quite a lot. + +So let's c/r socket buf locks (SO_BUF_LOCKS), so that sockets for which +auto-adjustment is available does not lose it. + +Reviewed-by: Alexander Mikhalitsyn +Signed-off-by: Pavel Tikhomirov +--- + criu/sockets.c | 8 ++++++++ + images/sk-opts.proto | 2 ++ + 2 files changed, 10 insertions(+) + +diff --git a/criu/sockets.c b/criu/sockets.c +index 65aa82950..db772707b 100644 +--- a/criu/sockets.c ++++ b/criu/sockets.c +@@ -519,6 +519,10 @@ int restore_socket_opts(int sk, SkOptsEntry *soe) + /* setsockopt() multiplies the input values by 2 */ + ret |= userns_call(sk_setbufs, 0, bufs, sizeof(bufs), sk); + ++ if (soe->has_so_buf_lock) { ++ pr_debug("\trestore buf_lock %d for socket\n", soe->so_buf_lock); ++ ret |= restore_opt(sk, SOL_SOCKET, SO_BUF_LOCK, &soe->so_buf_lock); ++ } + if (soe->has_so_priority) { + pr_debug("\trestore priority %d for socket\n", soe->so_priority); + ret |= restore_opt(sk, SOL_SOCKET, SO_PRIORITY, &soe->so_priority); +@@ -619,6 +623,10 @@ int dump_socket_opts(int sk, SkOptsEntry *soe) + + ret |= dump_opt(sk, SOL_SOCKET, SO_SNDBUF, &soe->so_sndbuf); + ret |= dump_opt(sk, SOL_SOCKET, SO_RCVBUF, &soe->so_rcvbuf); ++ if (kdat.has_sockopt_buf_lock) { ++ soe->has_so_buf_lock = true; ++ ret |= dump_opt(sk, SOL_SOCKET, SO_BUF_LOCK, &soe->so_buf_lock); ++ } + soe->has_so_priority = true; + ret |= dump_opt(sk, SOL_SOCKET, SO_PRIORITY, &soe->so_priority); + soe->has_so_rcvlowat = true; +diff --git a/images/sk-opts.proto b/images/sk-opts.proto +index 2377f6b62..1d24d47cc 100644 +--- a/images/sk-opts.proto ++++ b/images/sk-opts.proto +@@ -31,6 +31,8 @@ message sk_opts_entry { + optional uint32 tcp_keepintvl = 22; + optional uint32 so_oobinline = 23; + optional uint32 so_linger = 24; ++ ++ optional uint32 so_buf_lock = 25; + } + + enum sk_shutdown { +-- +2.34.1 + diff --git a/0039-zdtm-add-test-for-socket-buffer-size-locks.patch b/0039-zdtm-add-test-for-socket-buffer-size-locks.patch new file mode 100644 index 0000000..dd4a1b7 --- /dev/null +++ b/0039-zdtm-add-test-for-socket-buffer-size-locks.patch @@ -0,0 +1,118 @@ +From 579b8b02603d29adf664aab99f9df6cda33acfea Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Thu, 29 Jul 2021 16:16:12 +0300 +Subject: [PATCH 039/120] zdtm: add test for socket buffer size locks + +Just set all possible values 0-3 and chack if it persists. + +Reviewed-by: Alexander Mikhalitsyn +Signed-off-by: Pavel Tikhomirov +--- + test/zdtm/static/Makefile | 1 + + test/zdtm/static/sock_opts02.c | 73 +++++++++++++++++++++++++++++++ + test/zdtm/static/sock_opts02.desc | 1 + + 3 files changed, 75 insertions(+) + create mode 100644 test/zdtm/static/sock_opts02.c + create mode 100644 test/zdtm/static/sock_opts02.desc + +diff --git a/test/zdtm/static/Makefile b/test/zdtm/static/Makefile +index b6aa621c7..3e1e0a498 100644 +--- a/test/zdtm/static/Makefile ++++ b/test/zdtm/static/Makefile +@@ -117,6 +117,7 @@ TST_NOFILE := \ + socket-linger \ + sock_opts00 \ + sock_opts01 \ ++ sock_opts02 \ + sk-unix-unconn \ + ipc_namespace \ + selfexe00 \ +diff --git a/test/zdtm/static/sock_opts02.c b/test/zdtm/static/sock_opts02.c +new file mode 100644 +index 000000000..21a81a28f +--- /dev/null ++++ b/test/zdtm/static/sock_opts02.c +@@ -0,0 +1,73 @@ ++#include ++#include ++#include ++#include ++#include ++ ++#include "zdtmtst.h" ++ ++const char *test_doc = "Check that SO_BUF_LOCK option dumped"; ++const char *test_author = "Pavel Tikhomirov "; ++ ++#ifndef SO_BUF_LOCK ++#define SO_BUF_LOCK 72 ++#endif ++ ++#define NSOCK 4 ++ ++int main(int argc, char **argv) ++{ ++ int sock[NSOCK]; ++ uint32_t val[NSOCK]; ++ int ret, i; ++ int exit_code = 1; ++ ++ test_init(argc, argv); ++ ++ for (i = 0; i < NSOCK; i++) { ++ sock[i] = -1; ++ val[i] = i; ++ } ++ ++ for (i = 0; i < NSOCK; i++) { ++ sock[i] = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP); ++ if (sock[i] < 0) { ++ pr_perror("can't create socket %d", i); ++ goto err; ++ } ++ ++ ret = setsockopt(sock[i], SOL_SOCKET, SO_BUF_LOCK, &val[i], sizeof(val[i])); ++ if (ret < 0) { ++ pr_perror("can't set SO_BUF_LOCK (%u) on socket %d", val[i], i); ++ goto err; ++ } ++ } ++ ++ test_daemon(); ++ test_waitsig(); ++ ++ for (i = 0; i < NSOCK; i++) { ++ uint32_t tmp; ++ socklen_t len; ++ ++ len = sizeof(tmp); ++ ret = getsockopt(sock[i], SOL_SOCKET, SO_BUF_LOCK, &tmp, &len); ++ if (ret < 0) { ++ pr_perror("can't get SO_BUF_LOCK from socket %d", i); ++ goto err; ++ } ++ ++ if (tmp != val[i]) { ++ fail("SO_BUF_LOCK missmatch %u != %u", tmp, val[i]); ++ goto err; ++ } ++ } ++ ++ pass(); ++ exit_code = 0; ++err: ++ for (i = 0; i < NSOCK; i++) ++ close(sock[i]); ++ ++ return exit_code; ++} +diff --git a/test/zdtm/static/sock_opts02.desc b/test/zdtm/static/sock_opts02.desc +new file mode 100644 +index 000000000..37d3a6354 +--- /dev/null ++++ b/test/zdtm/static/sock_opts02.desc +@@ -0,0 +1 @@ ++{'flags': 'suid', 'feature': 'sockopt_buf_lock'} +-- +2.34.1 + diff --git a/0040-zdtm-make-sock_opts02-also-check-lock-change-by-SO_-.patch b/0040-zdtm-make-sock_opts02-also-check-lock-change-by-SO_-.patch new file mode 100644 index 0000000..fcc7425 --- /dev/null +++ b/0040-zdtm-make-sock_opts02-also-check-lock-change-by-SO_-.patch @@ -0,0 +1,115 @@ +From b4cc85671010c1d99659e3ed90b3f03c415e5f8a Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Tue, 3 Aug 2021 13:05:32 +0300 +Subject: [PATCH 040/120] zdtm: make sock_opts02 also check lock change by + SO_*BUF* + +Reviewed-by: Alexander Mikhalitsyn +Signed-off-by: Pavel Tikhomirov +--- + test/zdtm/static/sock_opts02.c | 63 +++++++++++++++++++++++++++++----- + 1 file changed, 54 insertions(+), 9 deletions(-) + +diff --git a/test/zdtm/static/sock_opts02.c b/test/zdtm/static/sock_opts02.c +index 21a81a28f..7ea98744a 100644 +--- a/test/zdtm/static/sock_opts02.c ++++ b/test/zdtm/static/sock_opts02.c +@@ -13,32 +13,77 @@ const char *test_author = "Pavel Tikhomirov "; + #define SO_BUF_LOCK 72 + #endif + +-#define NSOCK 4 ++#ifndef SOCK_SNDBUF_LOCK ++#define SOCK_SNDBUF_LOCK 1 ++#endif ++#ifndef SOCK_RCVBUF_LOCK ++#define SOCK_RCVBUF_LOCK 2 ++#endif ++ ++#define BUFSIZE 16384 ++ ++struct sk_opt { ++ int type; ++ uint32_t val; ++ uint32_t lock; ++} sk_opts[] = { { SO_BUF_LOCK, 0, 0 }, ++ { SO_BUF_LOCK, SOCK_SNDBUF_LOCK, SOCK_SNDBUF_LOCK }, ++ { SO_BUF_LOCK, SOCK_RCVBUF_LOCK, SOCK_RCVBUF_LOCK }, ++ { SO_BUF_LOCK, SOCK_SNDBUF_LOCK | SOCK_RCVBUF_LOCK, SOCK_SNDBUF_LOCK | SOCK_RCVBUF_LOCK }, ++ { SO_SNDBUF, BUFSIZE, SOCK_SNDBUF_LOCK }, ++ { SO_RCVBUF, BUFSIZE, SOCK_RCVBUF_LOCK } }; ++ ++#define NSOCK ARRAY_SIZE(sk_opts) ++ ++char *type_to_str(int type) ++{ ++ switch (type) { ++ case SO_BUF_LOCK: ++ return "SO_BUF_LOCK"; ++ case SO_SNDBUFFORCE: ++ return "SO_SNDBUFFORCE"; ++ case SO_RCVBUFFORCE: ++ return "SO_RCVBUFFORCE"; ++ } ++ return NULL; ++} + + int main(int argc, char **argv) + { + int sock[NSOCK]; +- uint32_t val[NSOCK]; + int ret, i; + int exit_code = 1; + + test_init(argc, argv); + +- for (i = 0; i < NSOCK; i++) { ++ for (i = 0; i < NSOCK; i++) + sock[i] = -1; +- val[i] = i; +- } + + for (i = 0; i < NSOCK; i++) { ++ uint32_t tmp; ++ socklen_t len; ++ + sock[i] = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP); + if (sock[i] < 0) { + pr_perror("can't create socket %d", i); + goto err; + } + +- ret = setsockopt(sock[i], SOL_SOCKET, SO_BUF_LOCK, &val[i], sizeof(val[i])); ++ ret = setsockopt(sock[i], SOL_SOCKET, sk_opts[i].type, &sk_opts[i].val, sizeof(sk_opts[i].val)); ++ if (ret < 0) { ++ pr_perror("can't set %s (%u) on socket %d", type_to_str(sk_opts[i].type), sk_opts[i].val, i); ++ goto err; ++ } ++ ++ len = sizeof(tmp); ++ ret = getsockopt(sock[i], SOL_SOCKET, SO_BUF_LOCK, &tmp, &len); + if (ret < 0) { +- pr_perror("can't set SO_BUF_LOCK (%u) on socket %d", val[i], i); ++ pr_perror("can't get SO_BUF_LOCK from socket %d", i); ++ goto err; ++ } ++ ++ if (tmp != sk_opts[i].lock) { ++ fail("SO_BUF_LOCK missmatch %u != %u", tmp, sk_opts[i].lock); + goto err; + } + } +@@ -57,8 +102,8 @@ int main(int argc, char **argv) + goto err; + } + +- if (tmp != val[i]) { +- fail("SO_BUF_LOCK missmatch %u != %u", tmp, val[i]); ++ if (tmp != sk_opts[i].lock) { ++ fail("SO_BUF_LOCK missmatch %u != %u", tmp, sk_opts[i].lock); + goto err; + } + } +-- +2.34.1 + diff --git a/0041-clang-format-enable-AlignTrailingComments.patch b/0041-clang-format-enable-AlignTrailingComments.patch new file mode 100644 index 0000000..f6baa5b --- /dev/null +++ b/0041-clang-format-enable-AlignTrailingComments.patch @@ -0,0 +1,173 @@ +From 78723d0b5747134ef4b6fe2663fbcfc2b4737e89 Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Thu, 28 Oct 2021 17:15:52 +0300 +Subject: [PATCH 041/120] clang-format: enable AlignTrailingComments + +Code becomes much more human-readable after enabling it. + +Example 1: + +Before: +``` +struct file_desc { + u32 id; /* File id, unique */ + struct hlist_node hash; /* Descriptor hashing and lookup */ + struct list_head fd_info_head; /* Chain of fdinfo_list_entry-s with same ID and type but different pids */ + struct file_desc_ops *ops; /* Associated operations */ + struct list_head fake_master_list; /* To chain in the list of file_desc, which don't + have a fle in a task, that having permissions */ +}; +``` +After: +``` +struct file_desc { + u32 id; /* File id, unique */ + struct hlist_node hash; /* Descriptor hashing and lookup */ + struct list_head fd_info_head; /* Chain of fdinfo_list_entry-s with same ID and type but different pids */ + struct file_desc_ops *ops; /* Associated operations */ + struct list_head fake_master_list; /* To chain in the list of file_desc, which don't + * have a fle in a task, that having permissions */ +}; +``` + +Example 2: + +Before: +``` +enum fsconfig_command { + FSCONFIG_SET_FLAG = 0, /* Set parameter, supplying no value */ + FSCONFIG_SET_STRING = 1, /* Set parameter, supplying a string value */ + FSCONFIG_SET_BINARY = 2, /* Set parameter, supplying a binary blob value */ + FSCONFIG_SET_PATH = 3, /* Set parameter, supplying an object by path */ + FSCONFIG_SET_PATH_EMPTY = 4, /* Set parameter, supplying an object by (empty) path */ + FSCONFIG_SET_FD = 5, /* Set parameter, supplying an object by fd */ + FSCONFIG_CMD_CREATE = 6, /* Invoke superblock creation */ + FSCONFIG_CMD_RECONFIGURE = 7, /* Invoke superblock reconfiguration */ +}; +``` +After: +``` +enum fsconfig_command { + FSCONFIG_SET_FLAG = 0, /* Set parameter, supplying no value */ + FSCONFIG_SET_STRING = 1, /* Set parameter, supplying a string value */ + FSCONFIG_SET_BINARY = 2, /* Set parameter, supplying a binary blob value */ + FSCONFIG_SET_PATH = 3, /* Set parameter, supplying an object by path */ + FSCONFIG_SET_PATH_EMPTY = 4, /* Set parameter, supplying an object by (empty) path */ + FSCONFIG_SET_FD = 5, /* Set parameter, supplying an object by fd */ + FSCONFIG_CMD_CREATE = 6, /* Invoke superblock creation */ + FSCONFIG_CMD_RECONFIGURE = 7, /* Invoke superblock reconfiguration */ +}; +``` + +Example 3: + +Before: +``` + ret = libnet_build_tcp(ntohs(sk->dst_addr->v4.sin_port), /* source port */ + ntohs(sk->src_addr->v4.sin_port), /* destination port */ + data->inq_seq, /* sequence number */ + data->outq_seq - data->outq_len, /* acknowledgement num */ + flags, /* control flags */ + data->rcv_wnd, /* window size */ + 0, /* checksum */ + 10, /* urgent pointer */ + LIBNET_TCP_H + 20, /* TCP packet size */ + NULL, /* payload */ + 0, /* payload size */ + l, /* libnet handle */ + 0); /* libnet id */ +``` +After: +``` + ret = libnet_build_tcp(ntohs(sk->dst_addr->v4.sin_port), /* source port */ + ntohs(sk->src_addr->v4.sin_port), /* destination port */ + data->inq_seq, /* sequence number */ + data->outq_seq - data->outq_len, /* acknowledgement num */ + flags, /* control flags */ + data->rcv_wnd, /* window size */ + 0, /* checksum */ + 10, /* urgent pointer */ + LIBNET_TCP_H + 20, /* TCP packet size */ + NULL, /* payload */ + 0, /* payload size */ + l, /* libnet handle */ + 0); /* libnet id */ +``` + +Example 4: + +Before: +``` +static struct testcase __testcases[] = { + { 2, 1, 2, 1, 2, 1 }, /* session00 */ + { 4, 2, 4, 2, 4, 1 }, /* |\_session00 */ + { 15, 4, 4, 4, 15, 1 }, /* | |\_session00 */ + { 16, 4, 4, 4, 15, 1 }, /* | \_session00 */ + { 17, 4, 4, 4, 17, 0 }, /* | |\_session00 */ + { 18, 4, 4, 4, 17, 1 }, /* | \_session00 */ + { 5, 2, 2, 2, 2, 1 }, /* |\_session00 */ + { 8, 2, 8, 2, 8, 1 }, /* |\_session00 */ + { 9, 8, 2, 2, 2, 1 }, /* | \_session00 */ + { 10, 2, 10, 2, 10, 1 }, /* |\_session00 */ + { 11, 10, 11, 2, 11, 1 }, /* | \_session00 */ + { 12, 11, 2, 2, 2, 1 }, /* | \_session00 */ + { 13, 2, 2, 2, 2, 0 }, /* \_session00 */ + { 3, 13, 2, 2, 2, 1 }, /* session00 */ + { 6, 2, 6, 2, 6, 0 }, /* \_session00 */ + { 14, 6, 6, 6, 6, 1 }, /* session00 */ +}; +``` +After: +``` +static struct testcase __testcases[] = { + { 2, 1, 2, 1, 2, 1 }, /* session00 */ + { 4, 2, 4, 2, 4, 1 }, /* |\_session00 */ + { 15, 4, 4, 4, 15, 1 }, /* | |\_session00 */ + { 16, 4, 4, 4, 15, 1 }, /* | \_session00 */ + { 17, 4, 4, 4, 17, 0 }, /* | |\_session00 */ + { 18, 4, 4, 4, 17, 1 }, /* | \_session00 */ + { 5, 2, 2, 2, 2, 1 }, /* |\_session00 */ + { 8, 2, 8, 2, 8, 1 }, /* |\_session00 */ + { 9, 8, 2, 2, 2, 1 }, /* | \_session00 */ + { 10, 2, 10, 2, 10, 1 }, /* |\_session00 */ + { 11, 10, 11, 2, 11, 1 }, /* | \_session00 */ + { 12, 11, 2, 2, 2, 1 }, /* | \_session00 */ + { 13, 2, 2, 2, 2, 0 }, /* \_session00 */ + { 3, 13, 2, 2, 2, 1 }, /* session00 */ + { 6, 2, 6, 2, 6, 0 }, /* \_session00 */ + { 14, 6, 6, 6, 6, 1 }, /* session00 */ +}; +``` + +Signed-off-by: Pavel Tikhomirov +--- + .clang-format | 2 +- + scripts/fetch-clang-format.sh | 1 + + 2 files changed, 2 insertions(+), 1 deletion(-) + +diff --git a/.clang-format b/.clang-format +index dd4ade370..96ba5909f 100644 +--- a/.clang-format ++++ b/.clang-format +@@ -15,7 +15,7 @@ AlignConsecutiveAssignments: false + AlignConsecutiveDeclarations: false + AlignEscapedNewlines: Left # Unknown to clang-format-4.0 + AlignOperands: true +-AlignTrailingComments: false ++AlignTrailingComments: true + AlignConsecutiveMacros: true + AllowAllParametersOfDeclarationOnNextLine: false + AllowShortBlocksOnASingleLine: false +diff --git a/scripts/fetch-clang-format.sh b/scripts/fetch-clang-format.sh +index c9006c518..0e9545f2d 100755 +--- a/scripts/fetch-clang-format.sh ++++ b/scripts/fetch-clang-format.sh +@@ -12,4 +12,5 @@ curl -s "${URL}" | sed -e " + s,Intended for clang-format >= 4,Intended for clang-format >= 11,g; + s,ForEachMacros:,ForEachMacros:\n - 'for_each_pstree_item',g; + s,\(AlignTrailingComments:.*\)$,\1\nAlignConsecutiveMacros: true,g; ++ s,AlignTrailingComments: false,AlignTrailingComments: true,g; + " > .clang-format +-- +2.34.1 + diff --git a/0042-clang-format-do-several-manual-comment-fixups.patch b/0042-clang-format-do-several-manual-comment-fixups.patch new file mode 100644 index 0000000..1837b37 --- /dev/null +++ b/0042-clang-format-do-several-manual-comment-fixups.patch @@ -0,0 +1,169 @@ +From 8e8870f6772d61089b98863fcc93e7968ea7a74c Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Thu, 28 Oct 2021 17:17:44 +0300 +Subject: [PATCH 042/120] clang-format: do several manual comment fixups + +Automatic AlignTrailingComments fails to make those comments look right, +so let's do it manually, so that they both satisfy AlignTrailingComments +and also are human-readable. + +Signed-off-by: Pavel Tikhomirov +--- + criu/include/files.h | 10 +++++----- + criu/include/page-pipe.h | 6 ++---- + criu/include/pagemap.h | 19 ++++++++---------- + criu/include/pipes.h | 4 ++-- + criu/shmem.c | 3 ++- + test/zdtm/static/ipc_namespace.c | 33 ++++++++++++++++---------------- + 6 files changed, 36 insertions(+), 39 deletions(-) + +diff --git a/criu/include/files.h b/criu/include/files.h +index 96face71b..26ce1f42a 100644 +--- a/criu/include/files.h ++++ b/criu/include/files.h +@@ -121,12 +121,12 @@ unsigned int find_unused_fd(struct pstree_item *, int hint_fd); + struct fdinfo_list_entry *find_used_fd(struct pstree_item *, int fd); + + struct file_desc { +- u32 id; /* File id, unique */ +- struct hlist_node hash; /* Descriptor hashing and lookup */ +- struct list_head fd_info_head; /* Chain of fdinfo_list_entry-s with same ID and type but different pids */ +- struct file_desc_ops *ops; /* Associated operations */ ++ u32 id; /* File id, unique */ ++ struct hlist_node hash; /* Descriptor hashing and lookup */ ++ struct list_head fd_info_head; /* Chain of fdinfo_list_entry-s with same ID and type but different pids */ ++ struct file_desc_ops *ops; /* Associated operations */ + struct list_head fake_master_list; /* To chain in the list of file_desc, which don't +- have a fle in a task, that having permissions */ ++ * have a fle in a task, that having permissions */ + }; + + struct fdtype_ops { +diff --git a/criu/include/page-pipe.h b/criu/include/page-pipe.h +index a5f97678e..0917869d9 100644 +--- a/criu/include/page-pipe.h ++++ b/criu/include/page-pipe.h +@@ -130,10 +130,8 @@ struct page_pipe { + unsigned int flags; /* PP_FOO flags below */ + }; + +-#define PP_CHUNK_MODE \ +- 0x1 /* Restrict the maximum buffer size of pipes +- and dump memory for a few iterations */ +-#define PP_OWN_IOVS 0x4 /* create_page_pipe allocated IOVs memory */ ++#define PP_CHUNK_MODE 0x1 /* Restrict the maximum buffer size of pipes and dump memory for a few iterations */ ++#define PP_OWN_IOVS 0x4 /* create_page_pipe allocated IOVs memory */ + + struct page_pipe *create_page_pipe(unsigned int nr_segs, struct iovec *iovs, unsigned flags); + extern void destroy_page_pipe(struct page_pipe *p); +diff --git a/criu/include/pagemap.h b/criu/include/pagemap.h +index c39c25d0c..8c7180559 100644 +--- a/criu/include/pagemap.h ++++ b/criu/include/pagemap.h +@@ -63,17 +63,14 @@ struct page_read { + struct cr_img *pi; + u32 pages_img_id; + +- PagemapEntry *pe; /* current pagemap we are on */ +- struct page_read *parent; /* parent pagemap (if ->in_parent +- pagemap is met in image, then +- go to this guy for page, see +- read_pagemap_page */ +- unsigned long cvaddr; /* vaddr we are on */ +- off_t pi_off; /* current offset in pages file */ +- +- struct iovec bunch; /* record consequent neighbour +- iovecs to punch together */ +- unsigned id; /* for logging */ ++ PagemapEntry *pe; /* current pagemap we are on */ ++ struct page_read *parent; /* parent pagemap (if ->in_parent pagemap is met in image, ++ * then go to this guy for page, see read_pagemap_page */ ++ unsigned long cvaddr; /* vaddr we are on */ ++ off_t pi_off; /* current offset in pages file */ ++ ++ struct iovec bunch; /* record consequent neighbour iovecs to punch together */ ++ unsigned id; /* for logging */ + unsigned long img_id; /* pagemap image file ID */ + + PagemapEntry **pmes; +diff --git a/criu/include/pipes.h b/criu/include/pipes.h +index 6e6310e14..f442d7f65 100644 +--- a/criu/include/pipes.h ++++ b/criu/include/pipes.h +@@ -49,8 +49,8 @@ extern int restore_pipe_data(int img_type, int pfd, u32 id, struct pipe_data_rst + struct pipe_info { + PipeEntry *pe; + struct list_head pipe_list; /* All pipe_info with the same pipe_id +- * This is pure circular list without head */ +- struct list_head list; /* global list of pipes */ ++ * This is pure circular list without head */ ++ struct list_head list; /* global list of pipes */ + struct file_desc d; + unsigned int create : 1, reopen : 1; + }; +diff --git a/criu/shmem.c b/criu/shmem.c +index 1b83327ef..bb48e436b 100644 +--- a/criu/shmem.c ++++ b/criu/shmem.c +@@ -85,7 +85,8 @@ struct shmem_info { + int self_count; /* the number of regions, which belongs to "pid" */ + }; + +- struct { /* For sysvipc restore */ ++ /* For sysvipc restore */ ++ struct { + struct list_head att; /* list of shmem_sysv_att-s */ + int want_write; + }; +diff --git a/test/zdtm/static/ipc_namespace.c b/test/zdtm/static/ipc_namespace.c +index 98241d816..4273951ae 100644 +--- a/test/zdtm/static/ipc_namespace.c ++++ b/test/zdtm/static/ipc_namespace.c +@@ -19,27 +19,28 @@ extern int shmctl(int __shmid, int __cmd, struct shmid_ds *__buf); + + struct ipc_ids { + int in_use; /* TODO: Check for 0 */ +- // unsigned short seq; +- // unsigned short seq_max; +- // struct rw_semaphore rw_mutex; +- // struct idr ipcs_idr; /* TODO */ ++ ++ // unsigned short seq; ++ // unsigned short seq_max; ++ // struct rw_semaphore rw_mutex; ++ // struct idr ipcs_idr; /* TODO */ + }; + + struct ipc_ns { + struct ipc_ids ids[3]; + +- int sem_ctls[4]; // + +- int used_sems; // + +- +- int msg_ctlmax; // + +- int msg_ctlmnb; // + +- int msg_ctlmni; // + +- int msg_bytes; // + +- int msg_hdrs; // + +- int auto_msgmni; // + +- int msg_next_id; // + +- int sem_next_id; // + +- int shm_next_id; // + ++ int sem_ctls[4]; ++ int used_sems; ++ ++ int msg_ctlmax; ++ int msg_ctlmnb; ++ int msg_ctlmni; ++ int msg_bytes; ++ int msg_hdrs; ++ int auto_msgmni; ++ int msg_next_id; ++ int sem_next_id; ++ int shm_next_id; + + size_t shm_ctlmax; + size_t shm_ctlall; +-- +2.34.1 + diff --git a/0043-clang-format-do-automatic-comment-fixups.patch b/0043-clang-format-do-automatic-comment-fixups.patch new file mode 100644 index 0000000..62c25f5 --- /dev/null +++ b/0043-clang-format-do-automatic-comment-fixups.patch @@ -0,0 +1,1889 @@ +From 94ce85cfcb0a780e3698c1d808725f25a02ad73f Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Thu, 28 Oct 2021 18:10:14 +0300 +Subject: [PATCH 043/120] clang-format: do automatic comment fixups + +Result of `make indent` after enabling AlignTrailingComments. + +Signed-off-by: Pavel Tikhomirov +--- + compel/arch/aarch64/src/lib/infect.c | 2 +- + compel/arch/arm/src/lib/infect.c | 2 +- + compel/arch/mips/src/lib/include/ldsodefs.h | 10 +- + .../mips/src/lib/include/uapi/asm/siginfo.h | 14 +- + compel/arch/mips/src/lib/infect.c | 2 +- + .../src/lib/include/uapi/asm/infect-types.h | 6 +- + compel/arch/ppc64/src/lib/infect.c | 2 +- + compel/arch/s390/src/lib/infect.c | 4 +- + .../arch/x86/plugins/std/syscalls/syscall32.c | 6 +- + .../arch/x86/src/lib/include/uapi/asm/cpu.h | 158 +++++++++--------- + .../arch/x86/src/lib/include/uapi/asm/fpu.h | 16 +- + compel/arch/x86/src/lib/infect.c | 4 +- + compel/include/infect-priv.h | 2 +- + compel/include/rpc-pie-priv.h | 2 +- + compel/include/uapi/infect.h | 2 +- + compel/include/uapi/loglevels.h | 6 +- + compel/include/uapi/ptrace.h | 2 +- + compel/src/lib/handle-elf.c | 2 +- + criu/arch/ppc64/restorer.c | 6 +- + criu/arch/ppc64/vdso-pie.c | 4 +- + criu/arch/s390/restorer.c | 6 +- + criu/arch/s390/vdso-pie.c | 6 +- + criu/arch/x86/include/asm/restorer.h | 2 +- + criu/arch/x86/sigaction_compat.c | 4 +- + criu/cgroup.c | 4 +- + criu/cr-check.c | 2 +- + criu/cr-dump.c | 2 +- + criu/files-reg.c | 4 +- + criu/files.c | 4 +- + criu/include/aio.h | 4 +- + criu/include/autofs.h | 2 +- + criu/include/bfd.h | 4 +- + criu/include/file-lock.h | 8 +- + criu/include/files.h | 4 +- + criu/include/image-desc.h | 4 +- + criu/include/inet_diag.h | 2 +- + criu/include/kcmp.h | 4 +- + criu/include/kerndat.h | 2 +- + criu/include/linux/mount.h | 14 +- + criu/include/mount.h | 12 +- + criu/include/namespaces.h | 4 +- + criu/include/page-pipe.h | 24 +-- + criu/include/page-xfer.h | 2 +- + criu/include/pagemap-cache.h | 12 +- + criu/include/pstree.h | 4 +- + criu/include/restorer.h | 4 +- + criu/include/rst_info.h | 2 +- + criu/include/servicefd.h | 6 +- + criu/include/sk-inet.h | 2 +- + criu/include/sysfs_parse.h | 4 +- + criu/include/vma.h | 10 +- + criu/irmap.c | 4 +- + criu/mount.c | 2 +- + criu/net.c | 4 +- + criu/pagemap.c | 6 +- + criu/shmem.c | 2 +- + criu/sk-unix.c | 4 +- + criu/uffd.c | 4 +- + criu/util.c | 4 +- + include/common/arch/ppc64/asm/bitops.h | 2 +- + include/common/arch/x86/asm/bitops.h | 2 +- + include/common/asm-generic/bitops.h | 2 +- + soccr/soccr.c | 66 ++++---- + soccr/soccr.h | 6 +- + test/zdtm/static/aio01.c | 4 +- + test/zdtm/static/auto_dev-ioctl.h | 2 +- + test/zdtm/static/file_locks00.c | 18 +- + test/zdtm/static/ipc_namespace.c | 8 +- + test/zdtm/static/netns-dev.c | 140 ++++++++-------- + test/zdtm/static/s390x_regs_check.c | 14 +- + test/zdtm/static/session01.c | 30 ++-- + test/zdtm/static/sigpending.c | 2 +- + test/zdtm/transition/ptrace.c | 2 +- + 73 files changed, 374 insertions(+), 374 deletions(-) + +diff --git a/compel/arch/aarch64/src/lib/infect.c b/compel/arch/aarch64/src/lib/infect.c +index 7cfa637eb..bd1ed0da3 100644 +--- a/compel/arch/aarch64/src/lib/infect.c ++++ b/compel/arch/aarch64/src/lib/infect.c +@@ -19,7 +19,7 @@ unsigned __page_shift = 0; + */ + const char code_syscall[] = { + 0x01, 0x00, 0x00, 0xd4, /* SVC #0 */ +- 0x00, 0x00, 0x20, 0xd4 /* BRK #0 */ ++ 0x00, 0x00, 0x20, 0xd4 /* BRK #0 */ + }; + + static const int code_syscall_aligned = round_up(sizeof(code_syscall), sizeof(long)); +diff --git a/compel/arch/arm/src/lib/infect.c b/compel/arch/arm/src/lib/infect.c +index 6715afdb3..7700f52ca 100644 +--- a/compel/arch/arm/src/lib/infect.c ++++ b/compel/arch/arm/src/lib/infect.c +@@ -18,7 +18,7 @@ + */ + const char code_syscall[] = { + 0x00, 0x00, 0x00, 0xef, /* SVC #0 */ +- 0xf0, 0x01, 0xf0, 0xe7 /* UDF #32 */ ++ 0xf0, 0x01, 0xf0, 0xe7 /* UDF #32 */ + }; + + static const int code_syscall_aligned = round_up(sizeof(code_syscall), sizeof(long)); +diff --git a/compel/arch/mips/src/lib/include/ldsodefs.h b/compel/arch/mips/src/lib/include/ldsodefs.h +index 8cfde2496..97e79755d 100644 +--- a/compel/arch/mips/src/lib/include/ldsodefs.h ++++ b/compel/arch/mips/src/lib/include/ldsodefs.h +@@ -69,8 +69,8 @@ struct La_mips_64_retval; + /* An entry in a 64 bit SHT_REL section. */ + + typedef struct { +- Elf32_Word r_sym; /* Symbol index */ +- unsigned char r_ssym; /* Special symbol for 2nd relocation */ ++ Elf32_Word r_sym; /* Symbol index */ ++ unsigned char r_ssym; /* Special symbol for 2nd relocation */ + unsigned char r_type3; /* 3rd relocation type */ + unsigned char r_type2; /* 2nd relocation type */ + unsigned char r_type1; /* 1st relocation type */ +@@ -82,14 +82,14 @@ typedef union { + } _Elf64_Mips_R_Info_union; + + typedef struct { +- Elf64_Addr r_offset; /* Address */ ++ Elf64_Addr r_offset; /* Address */ + _Elf64_Mips_R_Info_union r_info; /* Relocation type and symbol index */ + } Elf64_Mips_Rel; + + typedef struct { +- Elf64_Addr r_offset; /* Address */ ++ Elf64_Addr r_offset; /* Address */ + _Elf64_Mips_R_Info_union r_info; /* Relocation type and symbol index */ +- Elf64_Sxword r_addend; /* Addend */ ++ Elf64_Sxword r_addend; /* Addend */ + } Elf64_Mips_Rela; + + #define ELF64_MIPS_R_SYM(i) ((__extension__(_Elf64_Mips_R_Info_union)(i)).r_info_fields.r_sym) +diff --git a/compel/arch/mips/src/lib/include/uapi/asm/siginfo.h b/compel/arch/mips/src/lib/include/uapi/asm/siginfo.h +index 82ae6096b..6db1ddbd3 100644 +--- a/compel/arch/mips/src/lib/include/uapi/asm/siginfo.h ++++ b/compel/arch/mips/src/lib/include/uapi/asm/siginfo.h +@@ -52,14 +52,14 @@ typedef struct siginfo { + + /* kill() */ + struct { +- __kernel_pid_t _pid; /* sender's pid */ ++ __kernel_pid_t _pid; /* sender's pid */ + __ARCH_SI_UID_T _uid; /* sender's uid */ + } _kill; + + /* POSIX.1b timers */ + struct { + __kernel_timer_t _tid; /* timer id */ +- int _overrun; /* overrun count */ ++ int _overrun; /* overrun count */ + char _pad[sizeof(__ARCH_SI_UID_T) - sizeof(int)]; + sigval_t _sigval; /* same as below */ + int _sys_private; /* not to be passed to user */ +@@ -67,16 +67,16 @@ typedef struct siginfo { + + /* POSIX.1b signals */ + struct { +- __kernel_pid_t _pid; /* sender's pid */ ++ __kernel_pid_t _pid; /* sender's pid */ + __ARCH_SI_UID_T _uid; /* sender's uid */ + sigval_t _sigval; + } _rt; + + /* SIGCHLD */ + struct { +- __kernel_pid_t _pid; /* which child */ ++ __kernel_pid_t _pid; /* which child */ + __ARCH_SI_UID_T _uid; /* sender's uid */ +- int _status; /* exit code */ ++ int _status; /* exit code */ + __ARCH_SI_CLOCK_T _utime; + __ARCH_SI_CLOCK_T _stime; + } _sigchld; +@@ -104,8 +104,8 @@ typedef struct siginfo { + + /* SIGSYS */ + struct { +- void *_call_addr; /* calling user insn */ +- int _syscall; /* triggering system call number */ ++ void *_call_addr; /* calling user insn */ ++ int _syscall; /* triggering system call number */ + unsigned int _arch; /* AUDIT_ARCH_* of syscall */ + } _sigsys; + } _sifields; +diff --git a/compel/arch/mips/src/lib/infect.c b/compel/arch/mips/src/lib/infect.c +index 68d0a2728..afa0f5ed5 100644 +--- a/compel/arch/mips/src/lib/infect.c ++++ b/compel/arch/mips/src/lib/infect.c +@@ -24,7 +24,7 @@ + */ + const char code_syscall[] = { + 0x0c, 0x00, 0x00, 0x00, /* syscall */ +- 0x0d, 0x00, 0x00, 0x00 /* break */ ++ 0x0d, 0x00, 0x00, 0x00 /* break */ + }; + + /* 10-byte legacy floating point register */ +diff --git a/compel/arch/ppc64/src/lib/include/uapi/asm/infect-types.h b/compel/arch/ppc64/src/lib/include/uapi/asm/infect-types.h +index fe6192e20..8cf8a135f 100644 +--- a/compel/arch/ppc64/src/lib/include/uapi/asm/infect-types.h ++++ b/compel/arch/ppc64/src/lib/include/uapi/asm/infect-types.h +@@ -21,13 +21,13 @@ typedef struct { + unsigned long xer; + unsigned long ccr; + unsigned long softe; /* Soft enabled/disabled */ +- unsigned long trap; /* Reason for being here */ ++ unsigned long trap; /* Reason for being here */ + /* + * N.B. for critical exceptions on 4xx, the dar and dsisr + * fields are overloaded to hold srr0 and srr1. + */ +- unsigned long dar; /* Fault registers */ +- unsigned long dsisr; /* on 4xx/Book-E used for ESR */ ++ unsigned long dar; /* Fault registers */ ++ unsigned long dsisr; /* on 4xx/Book-E used for ESR */ + unsigned long result; /* Result of a system call */ + } user_regs_struct_t; + +diff --git a/compel/arch/ppc64/src/lib/infect.c b/compel/arch/ppc64/src/lib/infect.c +index fc174d0dd..61cd6e985 100644 +--- a/compel/arch/ppc64/src/lib/infect.c ++++ b/compel/arch/ppc64/src/lib/infect.c +@@ -30,7 +30,7 @@ unsigned __page_shift = 0; + */ + const uint32_t code_syscall[] = { + 0x44000002, /* sc */ +- 0x0fe00000 /* twi 31,0,0 */ ++ 0x0fe00000 /* twi 31,0,0 */ + }; + + static inline __always_unused void __check_code_syscall(void) +diff --git a/compel/arch/s390/src/lib/infect.c b/compel/arch/s390/src/lib/infect.c +index 77ace713a..3cd25e71d 100644 +--- a/compel/arch/s390/src/lib/infect.c ++++ b/compel/arch/s390/src/lib/infect.c +@@ -624,8 +624,8 @@ enum kernel_ts_level { + }; + + /* See arch/s390/include/asm/processor.h */ +-#define TASK_SIZE_LEVEL_3 0x40000000000UL /* 4 TB */ +-#define TASK_SIZE_LEVEL_4 0x20000000000000UL /* 8 PB */ ++#define TASK_SIZE_LEVEL_3 0x40000000000UL /* 4 TB */ ++#define TASK_SIZE_LEVEL_4 0x20000000000000UL /* 8 PB */ + #define TASK_SIZE_LEVEL_5 0xffffffffffffefffUL /* 16 EB - 0x1000 */ + + /* +diff --git a/compel/arch/x86/plugins/std/syscalls/syscall32.c b/compel/arch/x86/plugins/std/syscalls/syscall32.c +index 0f2fec3ff..d09fd38c7 100644 +--- a/compel/arch/x86/plugins/std/syscalls/syscall32.c ++++ b/compel/arch/x86/plugins/std/syscalls/syscall32.c +@@ -1,9 +1,9 @@ + #include "asm/types.h" + #include "syscall-32.h" + +-#define SYS_SOCKET 1 /* sys_socket(2) */ +-#define SYS_BIND 2 /* sys_bind(2) */ +-#define SYS_CONNECT 3 /* sys_connect(2) */ ++#define SYS_SOCKET 1 /* sys_socket(2) */ ++#define SYS_BIND 2 /* sys_bind(2) */ ++#define SYS_CONNECT 3 /* sys_connect(2) */ + #define SYS_SENDTO 11 /* sys_sendto(2) */ + #define SYS_RECVFROM 12 /* sys_recvfrom(2) */ + #define SYS_SHUTDOWN 13 /* sys_shutdown(2) */ +diff --git a/compel/arch/x86/src/lib/include/uapi/asm/cpu.h b/compel/arch/x86/src/lib/include/uapi/asm/cpu.h +index 8d54516af..63ff83dbe 100644 +--- a/compel/arch/x86/src/lib/include/uapi/asm/cpu.h ++++ b/compel/arch/x86/src/lib/include/uapi/asm/cpu.h +@@ -43,16 +43,16 @@ enum cpuid_leafs { + #define NCAPINTS_BITS (NCAPINTS * 32) + + /* Intel-defined CPU features, CPUID level 0x00000001 (EDX), word 0 */ +-#define X86_FEATURE_FPU (0 * 32 + 0) /* Onboard FPU */ +-#define X86_FEATURE_VME (0 * 32 + 1) /* Virtual Mode Extensions */ +-#define X86_FEATURE_DE (0 * 32 + 2) /* Debugging Extensions */ +-#define X86_FEATURE_PSE (0 * 32 + 3) /* Page Size Extensions */ +-#define X86_FEATURE_TSC (0 * 32 + 4) /* Time Stamp Counter */ +-#define X86_FEATURE_MSR (0 * 32 + 5) /* Model-Specific Registers */ +-#define X86_FEATURE_PAE (0 * 32 + 6) /* Physical Address Extensions */ +-#define X86_FEATURE_MCE (0 * 32 + 7) /* Machine Check Exception */ +-#define X86_FEATURE_CX8 (0 * 32 + 8) /* CMPXCHG8 instruction */ +-#define X86_FEATURE_APIC (0 * 32 + 9) /* Onboard APIC */ ++#define X86_FEATURE_FPU (0 * 32 + 0) /* Onboard FPU */ ++#define X86_FEATURE_VME (0 * 32 + 1) /* Virtual Mode Extensions */ ++#define X86_FEATURE_DE (0 * 32 + 2) /* Debugging Extensions */ ++#define X86_FEATURE_PSE (0 * 32 + 3) /* Page Size Extensions */ ++#define X86_FEATURE_TSC (0 * 32 + 4) /* Time Stamp Counter */ ++#define X86_FEATURE_MSR (0 * 32 + 5) /* Model-Specific Registers */ ++#define X86_FEATURE_PAE (0 * 32 + 6) /* Physical Address Extensions */ ++#define X86_FEATURE_MCE (0 * 32 + 7) /* Machine Check Exception */ ++#define X86_FEATURE_CX8 (0 * 32 + 8) /* CMPXCHG8 instruction */ ++#define X86_FEATURE_APIC (0 * 32 + 9) /* Onboard APIC */ + #define X86_FEATURE_SEP (0 * 32 + 11) /* SYSENTER/SYSEXIT */ + #define X86_FEATURE_MTRR (0 * 32 + 12) /* Memory Type Range Registers */ + #define X86_FEATURE_PGE (0 * 32 + 13) /* Page Global Enable */ +@@ -100,12 +100,12 @@ enum cpuid_leafs { + #define X86_FEATURE_CENTAUR_MCR (3 * 32 + 3) /* Centaur MCRs (= MTRRs) */ + + /* CPU types for specific tunings: */ +-#define X86_FEATURE_K8 (3 * 32 + 4) /* "" Opteron, Athlon64 */ +-#define X86_FEATURE_K7 (3 * 32 + 5) /* "" Athlon */ +-#define X86_FEATURE_P3 (3 * 32 + 6) /* "" P3 */ +-#define X86_FEATURE_P4 (3 * 32 + 7) /* "" P4 */ +-#define X86_FEATURE_CONSTANT_TSC (3 * 32 + 8) /* TSC ticks at a constant rate */ +-#define X86_FEATURE_UP (3 * 32 + 9) /* SMP kernel running on UP */ ++#define X86_FEATURE_K8 (3 * 32 + 4) /* "" Opteron, Athlon64 */ ++#define X86_FEATURE_K7 (3 * 32 + 5) /* "" Athlon */ ++#define X86_FEATURE_P3 (3 * 32 + 6) /* "" P3 */ ++#define X86_FEATURE_P4 (3 * 32 + 7) /* "" P4 */ ++#define X86_FEATURE_CONSTANT_TSC (3 * 32 + 8) /* TSC ticks at a constant rate */ ++#define X86_FEATURE_UP (3 * 32 + 9) /* SMP kernel running on UP */ + #define X86_FEATURE_ART (3 * 32 + 10) /* Always running timer (ART) */ + #define X86_FEATURE_ARCH_PERFMON (3 * 32 + 11) /* Intel Architectural PerfMon */ + #define X86_FEATURE_PEBS (3 * 32 + 12) /* Precise-Event Based Sampling */ +@@ -129,16 +129,16 @@ enum cpuid_leafs { + #define X86_FEATURE_TSC_KNOWN_FREQ (3 * 32 + 31) /* TSC has known frequency */ + + /* Intel-defined CPU features, CPUID level 0x00000001 (ECX), word 4 */ +-#define X86_FEATURE_XMM3 (4 * 32 + 0) /* "pni" SSE-3 */ +-#define X86_FEATURE_PCLMULQDQ (4 * 32 + 1) /* PCLMULQDQ instruction */ +-#define X86_FEATURE_DTES64 (4 * 32 + 2) /* 64-bit Debug Store */ +-#define X86_FEATURE_MWAIT (4 * 32 + 3) /* "monitor" MONITOR/MWAIT support */ +-#define X86_FEATURE_DSCPL (4 * 32 + 4) /* "ds_cpl" CPL-qualified (filtered) Debug Store */ +-#define X86_FEATURE_VMX (4 * 32 + 5) /* Hardware virtualization */ +-#define X86_FEATURE_SMX (4 * 32 + 6) /* Safer Mode eXtensions */ +-#define X86_FEATURE_EST (4 * 32 + 7) /* Enhanced SpeedStep */ +-#define X86_FEATURE_TM2 (4 * 32 + 8) /* Thermal Monitor 2 */ +-#define X86_FEATURE_SSSE3 (4 * 32 + 9) /* Supplemental SSE-3 */ ++#define X86_FEATURE_XMM3 (4 * 32 + 0) /* "pni" SSE-3 */ ++#define X86_FEATURE_PCLMULQDQ (4 * 32 + 1) /* PCLMULQDQ instruction */ ++#define X86_FEATURE_DTES64 (4 * 32 + 2) /* 64-bit Debug Store */ ++#define X86_FEATURE_MWAIT (4 * 32 + 3) /* "monitor" MONITOR/MWAIT support */ ++#define X86_FEATURE_DSCPL (4 * 32 + 4) /* "ds_cpl" CPL-qualified (filtered) Debug Store */ ++#define X86_FEATURE_VMX (4 * 32 + 5) /* Hardware virtualization */ ++#define X86_FEATURE_SMX (4 * 32 + 6) /* Safer Mode eXtensions */ ++#define X86_FEATURE_EST (4 * 32 + 7) /* Enhanced SpeedStep */ ++#define X86_FEATURE_TM2 (4 * 32 + 8) /* Thermal Monitor 2 */ ++#define X86_FEATURE_SSSE3 (4 * 32 + 9) /* Supplemental SSE-3 */ + #define X86_FEATURE_CID (4 * 32 + 10) /* Context ID */ + #define X86_FEATURE_SDBG (4 * 32 + 11) /* Silicon Debug */ + #define X86_FEATURE_FMA (4 * 32 + 12) /* Fused multiply-add */ +@@ -162,28 +162,28 @@ enum cpuid_leafs { + #define X86_FEATURE_HYPERVISOR (4 * 32 + 31) /* Running on a hypervisor */ + + /* VIA/Cyrix/Centaur-defined CPU features, CPUID level 0xC0000001, word 5 */ +-#define X86_FEATURE_XSTORE (5 * 32 + 2) /* "rng" RNG present (xstore) */ +-#define X86_FEATURE_XSTORE_EN (5 * 32 + 3) /* "rng_en" RNG enabled */ +-#define X86_FEATURE_XCRYPT (5 * 32 + 6) /* "ace" on-CPU crypto (xcrypt) */ +-#define X86_FEATURE_XCRYPT_EN (5 * 32 + 7) /* "ace_en" on-CPU crypto enabled */ +-#define X86_FEATURE_ACE2 (5 * 32 + 8) /* Advanced Cryptography Engine v2 */ +-#define X86_FEATURE_ACE2_EN (5 * 32 + 9) /* ACE v2 enabled */ ++#define X86_FEATURE_XSTORE (5 * 32 + 2) /* "rng" RNG present (xstore) */ ++#define X86_FEATURE_XSTORE_EN (5 * 32 + 3) /* "rng_en" RNG enabled */ ++#define X86_FEATURE_XCRYPT (5 * 32 + 6) /* "ace" on-CPU crypto (xcrypt) */ ++#define X86_FEATURE_XCRYPT_EN (5 * 32 + 7) /* "ace_en" on-CPU crypto enabled */ ++#define X86_FEATURE_ACE2 (5 * 32 + 8) /* Advanced Cryptography Engine v2 */ ++#define X86_FEATURE_ACE2_EN (5 * 32 + 9) /* ACE v2 enabled */ + #define X86_FEATURE_PHE (5 * 32 + 10) /* PadLock Hash Engine */ + #define X86_FEATURE_PHE_EN (5 * 32 + 11) /* PHE enabled */ + #define X86_FEATURE_PMM (5 * 32 + 12) /* PadLock Montgomery Multiplier */ + #define X86_FEATURE_PMM_EN (5 * 32 + 13) /* PMM enabled */ + + /* More extended AMD flags: CPUID level 0x80000001, ECX, word 6 */ +-#define X86_FEATURE_LAHF_LM (6 * 32 + 0) /* LAHF/SAHF in long mode */ +-#define X86_FEATURE_CMP_LEGACY (6 * 32 + 1) /* If yes HyperThreading not valid */ +-#define X86_FEATURE_SVM (6 * 32 + 2) /* Secure Virtual Machine */ +-#define X86_FEATURE_EXTAPIC (6 * 32 + 3) /* Extended APIC space */ +-#define X86_FEATURE_CR8_LEGACY (6 * 32 + 4) /* CR8 in 32-bit mode */ +-#define X86_FEATURE_ABM (6 * 32 + 5) /* Advanced bit manipulation */ +-#define X86_FEATURE_SSE4A (6 * 32 + 6) /* SSE-4A */ +-#define X86_FEATURE_MISALIGNSSE (6 * 32 + 7) /* Misaligned SSE mode */ +-#define X86_FEATURE_3DNOWPREFETCH (6 * 32 + 8) /* 3DNow prefetch instructions */ +-#define X86_FEATURE_OSVW (6 * 32 + 9) /* OS Visible Workaround */ ++#define X86_FEATURE_LAHF_LM (6 * 32 + 0) /* LAHF/SAHF in long mode */ ++#define X86_FEATURE_CMP_LEGACY (6 * 32 + 1) /* If yes HyperThreading not valid */ ++#define X86_FEATURE_SVM (6 * 32 + 2) /* Secure Virtual Machine */ ++#define X86_FEATURE_EXTAPIC (6 * 32 + 3) /* Extended APIC space */ ++#define X86_FEATURE_CR8_LEGACY (6 * 32 + 4) /* CR8 in 32-bit mode */ ++#define X86_FEATURE_ABM (6 * 32 + 5) /* Advanced bit manipulation */ ++#define X86_FEATURE_SSE4A (6 * 32 + 6) /* SSE-4A */ ++#define X86_FEATURE_MISALIGNSSE (6 * 32 + 7) /* Misaligned SSE mode */ ++#define X86_FEATURE_3DNOWPREFETCH (6 * 32 + 8) /* 3DNow prefetch instructions */ ++#define X86_FEATURE_OSVW (6 * 32 + 9) /* OS Visible Workaround */ + #define X86_FEATURE_IBS (6 * 32 + 10) /* Instruction Based Sampling */ + #define X86_FEATURE_XOP (6 * 32 + 11) /* extended AVX instructions */ + #define X86_FEATURE_SKINIT (6 * 32 + 12) /* SKINIT/STGI instructions */ +@@ -202,14 +202,14 @@ enum cpuid_leafs { + #define X86_FEATURE_MWAITX (6 * 32 + 29) /* MWAIT extension (MONITORX/MWAITX instructions) */ + + /* Intel-defined CPU features, CPUID level 0x00000007:0 (EBX), word 9 */ +-#define X86_FEATURE_FSGSBASE (9 * 32 + 0) /* RDFSBASE, WRFSBASE, RDGSBASE, WRGSBASE instructions*/ +-#define X86_FEATURE_TSC_ADJUST (9 * 32 + 1) /* TSC adjustment MSR 0x3B */ +-#define X86_FEATURE_BMI1 (9 * 32 + 3) /* 1st group bit manipulation extensions */ +-#define X86_FEATURE_HLE (9 * 32 + 4) /* Hardware Lock Elision */ +-#define X86_FEATURE_AVX2 (9 * 32 + 5) /* AVX2 instructions */ +-#define X86_FEATURE_SMEP (9 * 32 + 7) /* Supervisor Mode Execution Protection */ +-#define X86_FEATURE_BMI2 (9 * 32 + 8) /* 2nd group bit manipulation extensions */ +-#define X86_FEATURE_ERMS (9 * 32 + 9) /* Enhanced REP MOVSB/STOSB instructions */ ++#define X86_FEATURE_FSGSBASE (9 * 32 + 0) /* RDFSBASE, WRFSBASE, RDGSBASE, WRGSBASE instructions*/ ++#define X86_FEATURE_TSC_ADJUST (9 * 32 + 1) /* TSC adjustment MSR 0x3B */ ++#define X86_FEATURE_BMI1 (9 * 32 + 3) /* 1st group bit manipulation extensions */ ++#define X86_FEATURE_HLE (9 * 32 + 4) /* Hardware Lock Elision */ ++#define X86_FEATURE_AVX2 (9 * 32 + 5) /* AVX2 instructions */ ++#define X86_FEATURE_SMEP (9 * 32 + 7) /* Supervisor Mode Execution Protection */ ++#define X86_FEATURE_BMI2 (9 * 32 + 8) /* 2nd group bit manipulation extensions */ ++#define X86_FEATURE_ERMS (9 * 32 + 9) /* Enhanced REP MOVSB/STOSB instructions */ + #define X86_FEATURE_INVPCID (9 * 32 + 10) /* Invalidate Processor Context ID */ + #define X86_FEATURE_RTM (9 * 32 + 11) /* Restricted Transactional Memory */ + #define X86_FEATURE_CQM (9 * 32 + 12) /* Cache QoS Monitoring */ +@@ -238,14 +238,14 @@ enum cpuid_leafs { + #define X86_FEATURE_XSAVES (10 * 32 + 3) /* XSAVES/XRSTORS instructions */ + + /* Intel-defined CPU features, CPUID level 0x00000007:0 (ECX), word 11 */ +-#define X86_FEATURE_PREFETCHWT1 (11 * 32 + 0) /* PREFETCHWT1 Intel® Xeon PhiTM only */ +-#define X86_FEATURE_AVX512VBMI (11 * 32 + 1) /* AVX512 Vector Bit Manipulation instructions*/ +-#define X86_FEATURE_UMIP (11 * 32 + 2) /* User Mode Instruction Protection */ +-#define X86_FEATURE_PKU (11 * 32 + 3) /* Protection Keys for Userspace */ +-#define X86_FEATURE_OSPKE (11 * 32 + 4) /* OS Protection Keys Enable */ +-#define X86_FEATURE_AVX512_VBMI2 (11 * 32 + 6) /* Additional AVX512 Vector Bit Manipulation Instructions */ +-#define X86_FEATURE_GFNI (11 * 32 + 8) /* Galois Field New Instructions */ +-#define X86_FEATURE_VAES (11 * 32 + 9) /* Vector AES */ ++#define X86_FEATURE_PREFETCHWT1 (11 * 32 + 0) /* PREFETCHWT1 Intel® Xeon PhiTM only */ ++#define X86_FEATURE_AVX512VBMI (11 * 32 + 1) /* AVX512 Vector Bit Manipulation instructions*/ ++#define X86_FEATURE_UMIP (11 * 32 + 2) /* User Mode Instruction Protection */ ++#define X86_FEATURE_PKU (11 * 32 + 3) /* Protection Keys for Userspace */ ++#define X86_FEATURE_OSPKE (11 * 32 + 4) /* OS Protection Keys Enable */ ++#define X86_FEATURE_AVX512_VBMI2 (11 * 32 + 6) /* Additional AVX512 Vector Bit Manipulation Instructions */ ++#define X86_FEATURE_GFNI (11 * 32 + 8) /* Galois Field New Instructions */ ++#define X86_FEATURE_VAES (11 * 32 + 9) /* Vector AES */ + #define X86_FEATURE_VPCLMULQDQ (11 * 32 + 10) /* Carry-Less Multiplication Double Quadword */ + #define X86_FEATURE_AVX512_VNNI (11 * 32 + 11) /* Vector Neural Network Instructions */ + #define X86_FEATURE_AVX512_BITALG (11 * 32 + 12) /* Support for VPOPCNT[B,W] and VPSHUF-BITQMB instructions */ +@@ -261,35 +261,35 @@ enum cpuid_leafs { + #define X86_FEATURE_CQM_MBM_LOCAL (12 * 32 + 2) /* LLC Local MBM monitoring */ + + /* AMD-defined CPU features, CPUID level 0x80000008 (EBX), word 13 */ +-#define X86_FEATURE_CLZERO (13 * 32 + 0) /* CLZERO instruction */ +-#define X86_FEATURE_IRPERF (13 * 32 + 1) /* Instructions Retired Count */ +-#define X86_FEATURE_XSAVEERPTR (13 * 32 + 2) /* Always save/restore FP error pointers */ ++#define X86_FEATURE_CLZERO (13 * 32 + 0) /* CLZERO instruction */ ++#define X86_FEATURE_IRPERF (13 * 32 + 1) /* Instructions Retired Count */ ++#define X86_FEATURE_XSAVEERPTR (13 * 32 + 2) /* Always save/restore FP error pointers */ + #define X86_FEATURE_IBPB (13 * 32 + 12) /* Indirect Branch Prediction Barrier */ + #define X86_FEATURE_IBRS (13 * 32 + 14) /* Indirect Branch Restricted Speculation */ + #define X86_FEATURE_STIBP (13 * 32 + 15) /* Single Thread Indirect Branch Predictors */ + + /* Thermal and Power Management Leaf, CPUID level 0x00000006 (EAX), word 14 */ +-#define X86_FEATURE_DTHERM (14 * 32 + 0) /* Digital Thermal Sensor */ +-#define X86_FEATURE_IDA (14 * 32 + 1) /* Intel Dynamic Acceleration */ +-#define X86_FEATURE_ARAT (14 * 32 + 2) /* Always Running APIC Timer */ +-#define X86_FEATURE_PLN (14 * 32 + 4) /* Intel Power Limit Notification */ +-#define X86_FEATURE_PTS (14 * 32 + 6) /* Intel Package Thermal Status */ +-#define X86_FEATURE_HWP (14 * 32 + 7) /* Intel Hardware P-states */ +-#define X86_FEATURE_HWP_NOTIFY (14 * 32 + 8) /* HWP Notification */ +-#define X86_FEATURE_HWP_ACT_WINDOW (14 * 32 + 9) /* HWP Activity Window */ ++#define X86_FEATURE_DTHERM (14 * 32 + 0) /* Digital Thermal Sensor */ ++#define X86_FEATURE_IDA (14 * 32 + 1) /* Intel Dynamic Acceleration */ ++#define X86_FEATURE_ARAT (14 * 32 + 2) /* Always Running APIC Timer */ ++#define X86_FEATURE_PLN (14 * 32 + 4) /* Intel Power Limit Notification */ ++#define X86_FEATURE_PTS (14 * 32 + 6) /* Intel Package Thermal Status */ ++#define X86_FEATURE_HWP (14 * 32 + 7) /* Intel Hardware P-states */ ++#define X86_FEATURE_HWP_NOTIFY (14 * 32 + 8) /* HWP Notification */ ++#define X86_FEATURE_HWP_ACT_WINDOW (14 * 32 + 9) /* HWP Activity Window */ + #define X86_FEATURE_HWP_EPP (14 * 32 + 10) /* HWP Energy Perf. Preference */ + #define X86_FEATURE_HWP_PKG_REQ (14 * 32 + 11) /* HWP Package Level Request */ + #define X86_FEATURE_HDC (14 * 32 + 13) /* HDC base registers present */ + + /* AMD SVM Feature Identification, CPUID level 0x8000000a (EDX), word 15 */ +-#define X86_FEATURE_NPT (15 * 32 + 0) /* Nested Page Table support */ +-#define X86_FEATURE_LBRV (15 * 32 + 1) /* LBR Virtualization support */ +-#define X86_FEATURE_SVML (15 * 32 + 2) /* "svm_lock" SVM locking MSR */ +-#define X86_FEATURE_NRIPS (15 * 32 + 3) /* "nrip_save" SVM next_rip save */ +-#define X86_FEATURE_TSCRATEMSR (15 * 32 + 4) /* "tsc_scale" TSC scaling support */ +-#define X86_FEATURE_VMCBCLEAN (15 * 32 + 5) /* "vmcb_clean" VMCB clean bits support */ +-#define X86_FEATURE_FLUSHBYASID (15 * 32 + 6) /* flush-by-ASID support */ +-#define X86_FEATURE_DECODEASSISTS (15 * 32 + 7) /* Decode Assists support */ ++#define X86_FEATURE_NPT (15 * 32 + 0) /* Nested Page Table support */ ++#define X86_FEATURE_LBRV (15 * 32 + 1) /* LBR Virtualization support */ ++#define X86_FEATURE_SVML (15 * 32 + 2) /* "svm_lock" SVM locking MSR */ ++#define X86_FEATURE_NRIPS (15 * 32 + 3) /* "nrip_save" SVM next_rip save */ ++#define X86_FEATURE_TSCRATEMSR (15 * 32 + 4) /* "tsc_scale" TSC scaling support */ ++#define X86_FEATURE_VMCBCLEAN (15 * 32 + 5) /* "vmcb_clean" VMCB clean bits support */ ++#define X86_FEATURE_FLUSHBYASID (15 * 32 + 6) /* flush-by-ASID support */ ++#define X86_FEATURE_DECODEASSISTS (15 * 32 + 7) /* Decode Assists support */ + #define X86_FEATURE_PAUSEFILTER (15 * 32 + 10) /* filtered pause intercept */ + #define X86_FEATURE_PFTHRESHOLD (15 * 32 + 12) /* pause filter threshold */ + #define X86_FEATURE_AVIC (15 * 32 + 13) /* Virtual Interrupt Controller */ +@@ -305,8 +305,8 @@ enum cpuid_leafs { + #define X86_FEATURE_SMCA (17 * 32 + 3) /* Scalable MCA */ + + /* Intel-defined CPU features, CPUID level 0x00000007:0 (EDX), word 18 */ +-#define X86_FEATURE_AVX512_4VNNIW (18 * 32 + 2) /* AVX-512 Neural Network Instructions */ +-#define X86_FEATURE_AVX512_4FMAPS (18 * 32 + 3) /* AVX-512 Multiply Accumulation Single precision */ ++#define X86_FEATURE_AVX512_4VNNIW (18 * 32 + 2) /* AVX-512 Neural Network Instructions */ ++#define X86_FEATURE_AVX512_4FMAPS (18 * 32 + 3) /* AVX-512 Multiply Accumulation Single precision */ + #define X86_FEATURE_PCONFIG (18 * 32 + 18) /* Intel PCONFIG */ + #define X86_FEATURE_SPEC_CTRL (18 * 32 + 26) /* "" Speculation Control (IBRS + IBPB) */ + #define X86_FEATURE_INTEL_STIBP (18 * 32 + 27) /* "" Single Thread Indirect Branch Predictors */ +diff --git a/compel/arch/x86/src/lib/include/uapi/asm/fpu.h b/compel/arch/x86/src/lib/include/uapi/asm/fpu.h +index d740e3c04..a16b658af 100644 +--- a/compel/arch/x86/src/lib/include/uapi/asm/fpu.h ++++ b/compel/arch/x86/src/lib/include/uapi/asm/fpu.h +@@ -105,7 +105,7 @@ struct i387_fxsave_struct { + uint32_t fos; /* FPU Operand Selector */ + }; + }; +- uint32_t mxcsr; /* MXCSR Register State */ ++ uint32_t mxcsr; /* MXCSR Register State */ + uint32_t mxcsr_mask; /* MXCSR Mask */ + + /* 8*16 bytes for each FP-reg = 128 bytes */ +@@ -277,13 +277,13 @@ typedef struct { + } fpu_state_64_t; + + struct user_i387_ia32_struct { +- uint32_t cwd; /* FPU Control Word */ +- uint32_t swd; /* FPU Status Word */ +- uint32_t twd; /* FPU Tag Word */ +- uint32_t fip; /* FPU IP Offset */ +- uint32_t fcs; /* FPU IP Selector */ +- uint32_t foo; /* FPU Operand Pointer Offset */ +- uint32_t fos; /* FPU Operand Pointer Selector */ ++ uint32_t cwd; /* FPU Control Word */ ++ uint32_t swd; /* FPU Status Word */ ++ uint32_t twd; /* FPU Tag Word */ ++ uint32_t fip; /* FPU IP Offset */ ++ uint32_t fcs; /* FPU IP Selector */ ++ uint32_t foo; /* FPU Operand Pointer Offset */ ++ uint32_t fos; /* FPU Operand Pointer Selector */ + uint32_t st_space[20]; /* 8*10 bytes for each FP-reg = 80 bytes */ + }; + +diff --git a/compel/arch/x86/src/lib/infect.c b/compel/arch/x86/src/lib/infect.c +index 1e344bf3a..2f6c557d0 100644 +--- a/compel/arch/x86/src/lib/infect.c ++++ b/compel/arch/x86/src/lib/infect.c +@@ -34,12 +34,12 @@ + * Injected syscall instruction + */ + const char code_syscall[] = { +- 0x0f, 0x05, /* syscall */ ++ 0x0f, 0x05, /* syscall */ + 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc /* int 3, ... */ + }; + + const char code_int_80[] = { +- 0xcd, 0x80, /* int $0x80 */ ++ 0xcd, 0x80, /* int $0x80 */ + 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc /* int 3, ... */ + }; + +diff --git a/compel/include/infect-priv.h b/compel/include/infect-priv.h +index 1c03f4486..9d3442839 100644 +--- a/compel/include/infect-priv.h ++++ b/compel/include/infect-priv.h +@@ -38,7 +38,7 @@ struct parasite_ctl { + unsigned long parasite_ip; /* service routine start ip */ + + unsigned int *cmd; /* address for command */ +- void *args; /* address for arguments */ ++ void *args; /* address for arguments */ + unsigned long args_size; + int tsock; /* transport socket for transferring fds */ + +diff --git a/compel/include/rpc-pie-priv.h b/compel/include/rpc-pie-priv.h +index 2a239c613..5a6b337b2 100644 +--- a/compel/include/rpc-pie-priv.h ++++ b/compel/include/rpc-pie-priv.h +@@ -3,7 +3,7 @@ + struct ctl_msg { + uint32_t cmd; /* command itself */ + uint32_t ack; /* ack on command */ +- int32_t err; /* error code on reply */ ++ int32_t err; /* error code on reply */ + }; + + #define ctl_msg_cmd(_cmd) \ +diff --git a/compel/include/uapi/infect.h b/compel/include/uapi/infect.h +index c3d2ee6a6..7fa0bd8a0 100644 +--- a/compel/include/uapi/infect.h ++++ b/compel/include/uapi/infect.h +@@ -106,7 +106,7 @@ struct infect_ctx { + + unsigned long task_size; + unsigned long syscall_ip; /* entry point of infection */ +- unsigned long flags; /* fine-tune (e.g. faults) */ ++ unsigned long flags; /* fine-tune (e.g. faults) */ + + void (*child_handler)(int, siginfo_t *, void *); /* hander for SIGCHLD deaths */ + struct sigaction orig_handler; +diff --git a/compel/include/uapi/loglevels.h b/compel/include/uapi/loglevels.h +index e76c15657..7a49825d2 100644 +--- a/compel/include/uapi/loglevels.h ++++ b/compel/include/uapi/loglevels.h +@@ -7,10 +7,10 @@ + */ + + enum __compel_log_levels { +- COMPEL_LOG_MSG, /* Print message regardless of log level */ ++ COMPEL_LOG_MSG, /* Print message regardless of log level */ + COMPEL_LOG_ERROR, /* Errors only, when we're in trouble */ +- COMPEL_LOG_WARN, /* Warnings */ +- COMPEL_LOG_INFO, /* Informative, everything is fine */ ++ COMPEL_LOG_WARN, /* Warnings */ ++ COMPEL_LOG_INFO, /* Informative, everything is fine */ + COMPEL_LOG_DEBUG, /* Debug only */ + + COMPEL_DEFAULT_LOGLEVEL = COMPEL_LOG_WARN +diff --git a/compel/include/uapi/ptrace.h b/compel/include/uapi/ptrace.h +index c5291d20d..533e0569f 100644 +--- a/compel/include/uapi/ptrace.h ++++ b/compel/include/uapi/ptrace.h +@@ -62,7 +62,7 @@ + */ + typedef struct { + uint64_t filter_off; /* Input: which filter */ +- uint64_t flags; /* Output: filter's flags */ ++ uint64_t flags; /* Output: filter's flags */ + } seccomp_metadata_t; + + #ifdef PTRACE_EVENT_STOP +diff --git a/compel/src/lib/handle-elf.c b/compel/src/lib/handle-elf.c +index 9662751e0..22c8f2978 100644 +--- a/compel/src/lib/handle-elf.c ++++ b/compel/src/lib/handle-elf.c +@@ -554,7 +554,7 @@ int __handle_elf(void *mem, size_t size) + #endif /* ELF_PPC64 */ + + #ifdef ELF_X86_64 +- case R_X86_64_32: /* Symbol + Addend (4 bytes) */ ++ case R_X86_64_32: /* Symbol + Addend (4 bytes) */ + case R_X86_64_32S: /* Symbol + Addend (4 bytes) */ + pr_debug("\t\t\t\tR_X86_64_32 at 0x%-4lx val 0x%x\n", place, value32); + pr_out(" { .offset = 0x%-8x, .type = COMPEL_TYPE_INT, " +diff --git a/criu/arch/ppc64/restorer.c b/criu/arch/ppc64/restorer.c +index c17ba1669..56c09391e 100644 +--- a/criu/arch/ppc64/restorer.c ++++ b/criu/arch/ppc64/restorer.c +@@ -45,10 +45,10 @@ unsigned long sys_shmat(int shmid, const void *shmaddr, int shmflg) + unsigned long raddr; + int ret; + +- ret = sys_ipc(21 /*SHMAT */, shmid, /* first */ +- shmflg, /* second */ ++ ret = sys_ipc(21 /*SHMAT */, shmid, /* first */ ++ shmflg, /* second */ + (unsigned long)&raddr, /* third */ +- shmaddr, /* ptr */ ++ shmaddr, /* ptr */ + 0 /* fifth not used */); + + if (ret) +diff --git a/criu/arch/ppc64/vdso-pie.c b/criu/arch/ppc64/vdso-pie.c +index f01123efe..a84ae776b 100644 +--- a/criu/arch/ppc64/vdso-pie.c ++++ b/criu/arch/ppc64/vdso-pie.c +@@ -110,9 +110,9 @@ static inline void put_trampoline_call(unsigned long at, unsigned long to, unsig + { + uint32_t *addr = (uint32_t *)at; + +- *addr++ = 0x7C0802a6; /* mflr r0 */ ++ *addr++ = 0x7C0802a6; /* mflr r0 */ + *addr++ = 0x48000001 | ((long)(tr - at - 4) & 0x3fffffc); /* bl tr */ +- *(uint64_t *)addr = to; /* the address to read by the trampoline */ ++ *(uint64_t *)addr = to; /* the address to read by the trampoline */ + + invalidate_caches(at); + } +diff --git a/criu/arch/s390/restorer.c b/criu/arch/s390/restorer.c +index 6907ad75b..8b3bc44ba 100644 +--- a/criu/arch/s390/restorer.c ++++ b/criu/arch/s390/restorer.c +@@ -23,10 +23,10 @@ unsigned long sys_shmat(int shmid, const void *shmaddr, int shmflg) + unsigned long raddr; + int ret; + +- ret = sys_ipc(21 /*SHMAT */, shmid, /* first */ +- shmflg, /* second */ ++ ret = sys_ipc(21 /*SHMAT */, shmid, /* first */ ++ shmflg, /* second */ + (unsigned long)&raddr, /* third */ +- shmaddr, /* ptr */ ++ shmaddr, /* ptr */ + 0 /* fifth not used */); + + if (ret) +diff --git a/criu/arch/s390/vdso-pie.c b/criu/arch/s390/vdso-pie.c +index ad504beda..bf0366b0e 100644 +--- a/criu/arch/s390/vdso-pie.c ++++ b/criu/arch/s390/vdso-pie.c +@@ -18,9 +18,9 @@ + */ + typedef struct { + u8 larl[6]; /* Load relative address of imm64 */ +- u8 lg[6]; /* Load %r1 with imm64 */ +- u8 br[2]; /* Branch to %r1 */ +- u64 addr; /* Jump address */ ++ u8 lg[6]; /* Load %r1 with imm64 */ ++ u8 br[2]; /* Branch to %r1 */ ++ u64 addr; /* Jump address */ + u32 guards; /* Guard bytes */ + } __packed jmp_t; + +diff --git a/criu/arch/x86/include/asm/restorer.h b/criu/arch/x86/include/asm/restorer.h +index 23438314f..f7a6d5058 100644 +--- a/criu/arch/x86/include/asm/restorer.h ++++ b/criu/arch/x86/include/asm/restorer.h +@@ -13,7 +13,7 @@ + extern void restore_tls(tls_t *ptls); + extern int arch_compat_rt_sigaction(void *stack32, int sig, rt_sigaction_t_compat *act); + extern int set_compat_robust_list(uint32_t head_ptr, uint32_t len); +-#else /* CONFIG_COMPAT */ ++#else /* CONFIG_COMPAT */ + static inline void restore_tls(tls_t *ptls) + { + } +diff --git a/criu/arch/x86/sigaction_compat.c b/criu/arch/x86/sigaction_compat.c +index f02b2cc0e..506a8d1bb 100644 +--- a/criu/arch/x86/sigaction_compat.c ++++ b/criu/arch/x86/sigaction_compat.c +@@ -44,8 +44,8 @@ int arch_compat_rt_sigaction(void *stack32, int sig, rt_sigaction_t_compat *act) + memcpy(stack32, act, sizeof(rt_sigaction_t_compat)); + arg.nr = __NR32_rt_sigaction; + arg.arg0 = sig; +- arg.arg1 = (uint32_t)act_stack; /* act */ +- arg.arg2 = 0; /* oldact */ ++ arg.arg1 = (uint32_t)act_stack; /* act */ ++ arg.arg2 = 0; /* oldact */ + arg.arg3 = (uint32_t)sizeof(act->rt_sa_mask); /* sigsetsize */ + + return do_full_int80(&arg); +diff --git a/criu/cgroup.c b/criu/cgroup.c +index ccac37fcc..82d9b16a2 100644 +--- a/criu/cgroup.c ++++ b/criu/cgroup.c +@@ -81,7 +81,7 @@ static bool cg_set_compare(struct cg_set *set, struct list_head *ctls, int what) + if (l2->next != ctls) + c2 = list_first_entry(l2, struct cg_ctl, l); + +- if (!c1 || !c2) /* Nowhere to move next */ ++ if (!c1 || !c2) /* Nowhere to move next */ + return !c1 && !c2; /* Both lists scanned -- match */ + + if (strcmp(c1->name, c2->name)) +@@ -860,7 +860,7 @@ static int dump_cg_dirs(struct list_head *dirs, size_t n_dirs, CgroupDirEntry ** + cde->dir_perms->gid = cur->gid; + + cde->dir_name = cur->path + poff; +- if (poff != 1) /* parent isn't "/" */ ++ if (poff != 1) /* parent isn't "/" */ + cde->dir_name++; /* leading / */ + cde->n_children = cur->n_children; + if (cur->n_children > 0) +diff --git a/criu/cr-check.c b/criu/cr-check.c +index 3e268c439..e46c93815 100644 +--- a/criu/cr-check.c ++++ b/criu/cr-check.c +@@ -1631,7 +1631,7 @@ void pr_check_features(const char *offset, const char *sep, int width) + } + pr_msg("%s", fl->name); // no \n + pos += len; +- if ((fl + 1)->name) { // not the last item ++ if ((fl + 1)->name) { // not the last item + pr_msg("%s", sep); // no \n + pos += sep_len; + } +diff --git a/criu/cr-dump.c b/criu/cr-dump.c +index 940f62246..ecc99f116 100644 +--- a/criu/cr-dump.c ++++ b/criu/cr-dump.c +@@ -615,7 +615,7 @@ static int dump_task_kobj_ids(struct pstree_item *item) + TaskKobjIdsEntry *ids = item->ids; + + elem.pid = pid; +- elem.idx = 0; /* really 0 for all */ ++ elem.idx = 0; /* really 0 for all */ + elem.genid = 0; /* FIXME optimize */ + + new = 0; +diff --git a/criu/files-reg.c b/criu/files-reg.c +index 2b0347575..679477c1c 100644 +--- a/criu/files-reg.c ++++ b/criu/files-reg.c +@@ -2236,8 +2236,8 @@ static struct filemap_ctx ctx; + void filemap_ctx_init(bool auto_close) + { + ctx.desc = NULL; /* to fail the first comparison in open_ */ +- ctx.fd = -1; /* not to close random fd in _fini */ +- ctx.vma = NULL; /* not to put spurious VMA_CLOSE in _fini */ ++ ctx.fd = -1; /* not to close random fd in _fini */ ++ ctx.vma = NULL; /* not to put spurious VMA_CLOSE in _fini */ + /* flags may remain any */ + ctx.close = auto_close; + } +diff --git a/criu/files.c b/criu/files.c +index 93754fb44..69ebc2e82 100644 +--- a/criu/files.c ++++ b/criu/files.c +@@ -506,7 +506,7 @@ static int dump_one_file(struct pid *pid, int fd, int lfd, struct fd_opts *opts, + } + + p.fd_ctl = ctl; /* Some dump_opts require this to talk to parasite */ +- p.dfds = dfds; /* epoll needs to verify if target fd exist */ ++ p.dfds = dfds; /* epoll needs to verify if target fd exist */ + + if (S_ISSOCK(p.stat.st_mode)) + return dump_socket(&p, lfd, e); +@@ -1486,7 +1486,7 @@ int shared_fdt_prepare(struct pstree_item *item) + struct inherit_fd { + struct list_head inh_list; + char *inh_id; /* file identifier */ +- int inh_fd; /* criu's descriptor to inherit */ ++ int inh_fd; /* criu's descriptor to inherit */ + int inh_fd_id; + }; + +diff --git a/criu/include/aio.h b/criu/include/aio.h +index f8a59dfdf..d1655739d 100644 +--- a/criu/include/aio.h ++++ b/criu/include/aio.h +@@ -13,8 +13,8 @@ struct task_restore_args; + int prepare_aios(struct pstree_item *t, struct task_restore_args *ta); + + struct aio_ring { +- unsigned id; /* kernel internal index number */ +- unsigned nr; /* number of io_events */ ++ unsigned id; /* kernel internal index number */ ++ unsigned nr; /* number of io_events */ + unsigned head; /* Written to by userland or under ring_lock + * mutex by aio_read_events_ring(). */ + unsigned tail; +diff --git a/criu/include/autofs.h b/criu/include/autofs.h +index c4e0f23ed..b158025c7 100644 +--- a/criu/include/autofs.h ++++ b/criu/include/autofs.h +@@ -96,7 +96,7 @@ struct args_ismountpoint { + struct autofs_dev_ioctl { + __u32 ver_major; + __u32 ver_minor; +- __u32 size; /* total size of data passed in ++ __u32 size; /* total size of data passed in + * including this struct */ + __s32 ioctlfd; /* automount command fd */ + +diff --git a/criu/include/bfd.h b/criu/include/bfd.h +index 4268f74d4..2846ec628 100644 +--- a/criu/include/bfd.h ++++ b/criu/include/bfd.h +@@ -5,8 +5,8 @@ + + struct bfd_buf; + struct xbuf { +- char *mem; /* buffer */ +- char *data; /* position we see bytes at */ ++ char *mem; /* buffer */ ++ char *data; /* position we see bytes at */ + unsigned int sz; /* bytes sitting after b->pos */ + struct bfd_buf *buf; + }; +diff --git a/criu/include/file-lock.h b/criu/include/file-lock.h +index 0ce2fa340..9ab79b66b 100644 +--- a/criu/include/file-lock.h ++++ b/criu/include/file-lock.h +@@ -30,12 +30,12 @@ + #define LOCK_SH 1 /* shared lock */ + #define LOCK_EX 2 /* exclusive lock */ + #define LOCK_NB \ +- 4 /* or'd with one of the above to prevent ++ 4 /* or'd with one of the above to prevent + blocking */ + #define LOCK_UN 8 /* remove lock */ + +-#define LOCK_MAND 32 /* This is a mandatory flock ... */ +-#define LOCK_READ 64 /* which allows concurrent read operations */ ++#define LOCK_MAND 32 /* This is a mandatory flock ... */ ++#define LOCK_READ 64 /* which allows concurrent read operations */ + #define LOCK_WRITE 128 /* which allows concurrent write operations */ + #define LOCK_RW 192 /* which allows concurrent read & write ops */ + +@@ -47,7 +47,7 @@ struct file_lock { + int fl_kind; + int fl_ltype; + +- pid_t fl_owner; /* process, which created the lock */ ++ pid_t fl_owner; /* process, which created the lock */ + pid_t fl_holder; /* pid of fd on whose the lock is found */ + int maj, min; + unsigned long i_no; +diff --git a/criu/include/files.h b/criu/include/files.h +index 26ce1f42a..aadc09f73 100644 +--- a/criu/include/files.h ++++ b/criu/include/files.h +@@ -82,8 +82,8 @@ enum { + + struct fdinfo_list_entry { + struct list_head desc_list; /* To chain on @fd_info_head */ +- struct file_desc *desc; /* Associated file descriptor */ +- struct list_head ps_list; /* To chain per-task files */ ++ struct file_desc *desc; /* Associated file descriptor */ ++ struct list_head ps_list; /* To chain per-task files */ + struct pstree_item *task; + FdinfoEntry *fe; + int pid; +diff --git a/criu/include/image-desc.h b/criu/include/image-desc.h +index 5045baee8..9f369be64 100644 +--- a/criu/include/image-desc.h ++++ b/criu/include/image-desc.h +@@ -122,8 +122,8 @@ enum { + /* file descriptors template */ + struct cr_fd_desc_tmpl { + const char *fmt; /* format for the name */ +- u32 magic; /* magic in the header */ +- int oflags; /* flags for image_open */ ++ u32 magic; /* magic in the header */ ++ int oflags; /* flags for image_open */ + }; + + extern struct cr_fd_desc_tmpl imgset_template[CR_FD_MAX]; +diff --git a/criu/include/inet_diag.h b/criu/include/inet_diag.h +index ea6f5e14e..4996dd556 100644 +--- a/criu/include/inet_diag.h ++++ b/criu/include/inet_diag.h +@@ -31,7 +31,7 @@ struct inet_diag_req_compat { + struct inet_diag_sockid id; + + __u32 idiag_states; /* States to dump */ +- __u32 idiag_dbs; /* Tables to dump (NI) */ ++ __u32 idiag_dbs; /* Tables to dump (NI) */ + }; + + struct inet_diag_req_v2 { +diff --git a/criu/include/kcmp.h b/criu/include/kcmp.h +index a6774be47..575135f80 100644 +--- a/criu/include/kcmp.h ++++ b/criu/include/kcmp.h +@@ -18,8 +18,8 @@ enum kcmp_type { + + /* Slot for KCMP_EPOLL_TFD */ + typedef struct { +- uint32_t efd; /* epoll file descriptor */ +- uint32_t tfd; /* target file number */ ++ uint32_t efd; /* epoll file descriptor */ ++ uint32_t tfd; /* target file number */ + uint32_t toff; /* target offset within same numbered sequence */ + } kcmp_epoll_slot_t; + +diff --git a/criu/include/kerndat.h b/criu/include/kerndat.h +index 2ded7d1da..a28a95802 100644 +--- a/criu/include/kerndat.h ++++ b/criu/include/kerndat.h +@@ -18,7 +18,7 @@ extern int kerndat_init(void); + + enum pagemap_func { + PM_UNKNOWN, +- PM_DISABLED, /* /proc/pid/pagemap doesn't open (user mode) */ ++ PM_DISABLED, /* /proc/pid/pagemap doesn't open (user mode) */ + PM_FLAGS_ONLY, /* pagemap zeroes pfn part (user mode) */ + PM_FULL, + }; +diff --git a/criu/include/linux/mount.h b/criu/include/linux/mount.h +index 840d6277e..9a3a28b10 100644 +--- a/criu/include/linux/mount.h ++++ b/criu/include/linux/mount.h +@@ -8,13 +8,13 @@ + #include + #else + enum fsconfig_command { +- FSCONFIG_SET_FLAG = 0, /* Set parameter, supplying no value */ +- FSCONFIG_SET_STRING = 1, /* Set parameter, supplying a string value */ +- FSCONFIG_SET_BINARY = 2, /* Set parameter, supplying a binary blob value */ +- FSCONFIG_SET_PATH = 3, /* Set parameter, supplying an object by path */ +- FSCONFIG_SET_PATH_EMPTY = 4, /* Set parameter, supplying an object by (empty) path */ +- FSCONFIG_SET_FD = 5, /* Set parameter, supplying an object by fd */ +- FSCONFIG_CMD_CREATE = 6, /* Invoke superblock creation */ ++ FSCONFIG_SET_FLAG = 0, /* Set parameter, supplying no value */ ++ FSCONFIG_SET_STRING = 1, /* Set parameter, supplying a string value */ ++ FSCONFIG_SET_BINARY = 2, /* Set parameter, supplying a binary blob value */ ++ FSCONFIG_SET_PATH = 3, /* Set parameter, supplying an object by path */ ++ FSCONFIG_SET_PATH_EMPTY = 4, /* Set parameter, supplying an object by (empty) path */ ++ FSCONFIG_SET_FD = 5, /* Set parameter, supplying an object by fd */ ++ FSCONFIG_CMD_CREATE = 6, /* Invoke superblock creation */ + FSCONFIG_CMD_RECONFIGURE = 7, /* Invoke superblock reconfiguration */ + }; + #endif +diff --git a/criu/include/mount.h b/criu/include/mount.h +index 29d80c2a7..833a75ca0 100644 +--- a/criu/include/mount.h ++++ b/criu/include/mount.h +@@ -72,13 +72,13 @@ struct mount_info { + struct list_head children; + struct list_head siblings; + +- struct list_head mnt_bind; /* circular list of derivatives of one real mount */ +- struct list_head mnt_share; /* circular list of shared mounts */ ++ struct list_head mnt_bind; /* circular list of derivatives of one real mount */ ++ struct list_head mnt_share; /* circular list of shared mounts */ + struct list_head mnt_slave_list; /* list of slave mounts */ +- struct list_head mnt_slave; /* slave list entry */ +- struct mount_info *mnt_master; /* slave is on master->mnt_slave_list */ +- struct list_head mnt_propagate; /* circular list of mounts which propagate from each other */ +- struct list_head mnt_notprop; /* temporary list used in can_mount_now */ ++ struct list_head mnt_slave; /* slave list entry */ ++ struct mount_info *mnt_master; /* slave is on master->mnt_slave_list */ ++ struct list_head mnt_propagate; /* circular list of mounts which propagate from each other */ ++ struct list_head mnt_notprop; /* temporary list used in can_mount_now */ + struct list_head mnt_unbindable; /* list of mounts with delayed unbindable */ + + struct list_head postpone; +diff --git a/criu/include/namespaces.h b/criu/include/namespaces.h +index 034605917..e2ea6e17f 100644 +--- a/criu/include/namespaces.h ++++ b/criu/include/namespaces.h +@@ -128,9 +128,9 @@ struct ns_id { + */ + union { + int nsfd_id; /* a namespace descriptor id in fdstore */ +- int ns_fd; /* a namespace file descriptor */ ++ int ns_fd; /* a namespace file descriptor */ + }; +- int nlsk; /* for sockets collection */ ++ int nlsk; /* for sockets collection */ + int seqsk; /* to talk to parasite daemons */ + struct list_head ids; + struct list_head links; +diff --git a/criu/include/page-pipe.h b/criu/include/page-pipe.h +index 0917869d9..15178c015 100644 +--- a/criu/include/page-pipe.h ++++ b/criu/include/page-pipe.h +@@ -90,14 +90,14 @@ struct kernel_pipe_buffer { + */ + + struct page_pipe_buf { +- int p[2]; /* pipe with pages */ ++ int p[2]; /* pipe with pages */ + unsigned int pipe_size; /* how many pages can be fit into pipe */ +- unsigned int pipe_off; /* where this buf is started in a pipe */ +- unsigned int pages_in; /* how many pages are there */ +- unsigned int nr_segs; /* how many iov-s are busy */ ++ unsigned int pipe_off; /* where this buf is started in a pipe */ ++ unsigned int pages_in; /* how many pages are there */ ++ unsigned int nr_segs; /* how many iov-s are busy */ + #define PPB_LAZY (1 << 0) + unsigned int flags; +- struct iovec *iov; /* vaddr:len map */ ++ struct iovec *iov; /* vaddr:len map */ + struct list_head l; /* links into page_pipe->bufs */ + }; + +@@ -113,19 +113,19 @@ struct page_pipe_buf { + #define PP_HOLE_PARENT (1 << 0) + + struct page_pipe { +- unsigned int nr_pipes; /* how many page_pipe_bufs in there */ +- struct list_head bufs; /* list of bufs */ +- struct list_head free_bufs; /* list of bufs */ ++ unsigned int nr_pipes; /* how many page_pipe_bufs in there */ ++ struct list_head bufs; /* list of bufs */ ++ struct list_head free_bufs; /* list of bufs */ + struct page_pipe_buf *prev[PP_PIPE_TYPES]; /* last ppb of each type for pipe sharing */ +- unsigned int nr_iovs; /* number of iovs */ +- unsigned int free_iov; /* first free iov */ ++ unsigned int nr_iovs; /* number of iovs */ ++ unsigned int free_iov; /* first free iov */ + + struct iovec *iovs; /* iovs. They are provided into create_page_pipe + and all bufs have their iov-s in there */ + +- unsigned int nr_holes; /* number of holes allocated */ ++ unsigned int nr_holes; /* number of holes allocated */ + unsigned int free_hole; /* number of holes in use */ +- struct iovec *holes; /* holes */ ++ struct iovec *holes; /* holes */ + unsigned int *hole_flags; + unsigned int flags; /* PP_FOO flags below */ + }; +diff --git a/criu/include/page-xfer.h b/criu/include/page-xfer.h +index e0303dfe0..1bcd4ff20 100644 +--- a/criu/include/page-xfer.h ++++ b/criu/include/page-xfer.h +@@ -36,7 +36,7 @@ struct page_xfer { + union { + struct /* local */ { + struct cr_img *pmi; /* pagemaps */ +- struct cr_img *pi; /* pages */ ++ struct cr_img *pi; /* pages */ + }; + + struct /* page-server */ { +diff --git a/criu/include/pagemap-cache.h b/criu/include/pagemap-cache.h +index 7612ee0f4..1d8bbffaf 100644 +--- a/criu/include/pagemap-cache.h ++++ b/criu/include/pagemap-cache.h +@@ -11,13 +11,13 @@ struct vma_area; + #define PAGEMAP_PFN_OFF(addr) (PAGE_PFN(addr) * sizeof(u64)) + + typedef struct { +- pid_t pid; /* which process it belongs */ +- unsigned long start; /* start of area */ +- unsigned long end; /* end of area */ ++ pid_t pid; /* which process it belongs */ ++ unsigned long start; /* start of area */ ++ unsigned long end; /* end of area */ + const struct list_head *vma_head; /* list head of VMAs we're serving */ +- u64 *map; /* local buffer */ +- size_t map_len; /* length of a buffer */ +- int fd; /* file to read PMs from */ ++ u64 *map; /* local buffer */ ++ size_t map_len; /* length of a buffer */ ++ int fd; /* file to read PMs from */ + } pmc_t; + + #define PMC_INIT \ +diff --git a/criu/include/pstree.h b/criu/include/pstree.h +index c5b0fa7ea..c1c79867b 100644 +--- a/criu/include/pstree.h ++++ b/criu/include/pstree.h +@@ -15,14 +15,14 @@ + struct pstree_item { + struct pstree_item *parent; + struct list_head children; /* list of my children */ +- struct list_head sibling; /* linkage in my parent's children list */ ++ struct list_head sibling; /* linkage in my parent's children list */ + + struct pid *pid; + pid_t pgid; + pid_t sid; + pid_t born_sid; + +- int nr_threads; /* number of threads */ ++ int nr_threads; /* number of threads */ + struct pid *threads; /* array of threads */ + CoreEntry **core; + TaskKobjIdsEntry *ids; +diff --git a/criu/include/restorer.h b/criu/include/restorer.h +index 934d60cf9..308a0b79b 100644 +--- a/criu/include/restorer.h ++++ b/criu/include/restorer.h +@@ -138,7 +138,7 @@ struct task_restore_args { + bool has_thp_enabled; + + /* threads restoration */ +- int nr_threads; /* number of threads */ ++ int nr_threads; /* number of threads */ + thread_restore_fcall_t clone_restore_fn; /* helper address for clone() call */ + struct thread_restore_args *thread_args; /* array of thread arguments */ + struct task_entries *task_entries; +@@ -211,7 +211,7 @@ struct task_restore_args { + bool can_map_vdso; + bool auto_dedup; + unsigned long vdso_rt_size; +- struct vdso_maps vdso_maps_rt; /* runtime vdso symbols */ ++ struct vdso_maps vdso_maps_rt; /* runtime vdso symbols */ + unsigned long vdso_rt_parked_at; /* safe place to keep vdso */ + void **breakpoint; + +diff --git a/criu/include/rst_info.h b/criu/include/rst_info.h +index 2e2107b0e..9664e0a1c 100644 +--- a/criu/include/rst_info.h ++++ b/criu/include/rst_info.h +@@ -17,7 +17,7 @@ struct task_entries { + }; + + struct fdt { +- int nr; /* How many tasks share this fd table */ ++ int nr; /* How many tasks share this fd table */ + pid_t pid; /* Who should restore this fd table */ + /* + * The fd table is ready for restoing, if fdt_lock is equal to nr +diff --git a/criu/include/servicefd.h b/criu/include/servicefd.h +index e75e8444c..c6979de7f 100644 +--- a/criu/include/servicefd.h ++++ b/criu/include/servicefd.h +@@ -22,10 +22,10 @@ enum sfd_type { + * - For dump -- target ns' proc + * - For restore -- CRIU ns' proc + */ +- ROOT_FD_OFF, /* Root of the namespace we dump/restore */ ++ ROOT_FD_OFF, /* Root of the namespace we dump/restore */ + CGROUP_YARD, +- USERNSD_SK, /* Socket for usernsd */ +- NS_FD_OFF, /* Node's net namespace fd */ ++ USERNSD_SK, /* Socket for usernsd */ ++ NS_FD_OFF, /* Node's net namespace fd */ + TRANSPORT_FD_OFF, /* to transfer file descriptors */ + RPC_SK_OFF, + FDSTORE_SK_OFF, +diff --git a/criu/include/sk-inet.h b/criu/include/sk-inet.h +index c832d6387..5dd2a6551 100644 +--- a/criu/include/sk-inet.h ++++ b/criu/include/sk-inet.h +@@ -35,7 +35,7 @@ struct inet_sk_desc { + unsigned int dst_port; + unsigned int state; + unsigned int rqlen; +- unsigned int wqlen; /* sent + unsent data */ ++ unsigned int wqlen; /* sent + unsent data */ + unsigned int uwqlen; /* unsent data */ + unsigned int src_addr[4]; + unsigned int dst_addr[4]; +diff --git a/criu/include/sysfs_parse.h b/criu/include/sysfs_parse.h +index ff0e61148..f987d622f 100644 +--- a/criu/include/sysfs_parse.h ++++ b/criu/include/sysfs_parse.h +@@ -2,9 +2,9 @@ + #define __CR_SYSFS_PARSE_H__ + + #define SYSFS_AUFS "/sys/fs/aufs/" +-#define SBINFO_LEN (3 + 16 + 1) /* si_%lx */ ++#define SBINFO_LEN (3 + 16 + 1) /* si_%lx */ + #define SBINFO_PATH_LEN (sizeof SYSFS_AUFS + SBINFO_LEN) /* /sys/fs/aufs/ */ +-#define AUFSBR_PATH_LEN (SBINFO_PATH_LEN + 6 + 1) /* /sys/fs/aufs//br%3d */ ++#define AUFSBR_PATH_LEN (SBINFO_PATH_LEN + 6 + 1) /* /sys/fs/aufs//br%3d */ + + struct mount_info; + struct vma_area; +diff --git a/criu/include/vma.h b/criu/include/vma.h +index ed9f31ef6..541d6d6fd 100644 +--- a/criu/include/vma.h ++++ b/criu/include/vma.h +@@ -10,14 +10,14 @@ + #include + + struct vm_area_list { +- struct list_head h; /* list of VMAs */ +- unsigned nr; /* nr of all VMAs in the list */ ++ struct list_head h; /* list of VMAs */ ++ unsigned nr; /* nr of all VMAs in the list */ + unsigned int nr_aios; /* nr of AIOs VMAs in the list */ + union { + unsigned long nr_priv_pages; /* dmp: nr of pages in private VMAs */ + unsigned long rst_priv_size; /* rst: size of private VMAs */ + }; +- unsigned long nr_priv_pages_longest; /* nr of pages in longest private VMA */ ++ unsigned long nr_priv_pages_longest; /* nr of pages in longest private VMA */ + unsigned long nr_shared_pages_longest; /* nr of pages in longest shared VMA */ + }; + +@@ -53,8 +53,8 @@ struct vma_area { + struct /* for restore */ { + int (*vm_open)(int pid, struct vma_area *vma); + struct file_desc *vmfd; +- struct vma_area *pvma; /* parent for inherited VMAs */ +- unsigned long *page_bitmap; /* existent pages */ ++ struct vma_area *pvma; /* parent for inherited VMAs */ ++ unsigned long *page_bitmap; /* existent pages */ + unsigned long premmaped_addr; /* restore only */ + + /* +diff --git a/criu/irmap.c b/criu/irmap.c +index 09570c593..7b9d77bc1 100644 +--- a/criu/irmap.c ++++ b/criu/irmap.c +@@ -160,8 +160,8 @@ static int irmap_update_dir(struct irmap *t) + + k = &t->kids[nr - 1]; + +- k->kids = NULL; /* for xrealloc above */ +- k->ino = 0; /* for irmap_update_stat */ ++ k->kids = NULL; /* for xrealloc above */ ++ k->ino = 0; /* for irmap_update_stat */ + k->nr_kids = -1; /* for irmap_update_dir */ + k->path = xsprintf("%s/%s", t->path, de->d_name); + if (!k->path) +diff --git a/criu/mount.c b/criu/mount.c +index ec31f02c2..93725e526 100644 +--- a/criu/mount.c ++++ b/criu/mount.c +@@ -2561,7 +2561,7 @@ static LIST_HEAD(mnt_remap_list); + static int remap_id; + + struct mnt_remap_entry { +- struct mount_info *mi; /* child is remaped into the root yards */ ++ struct mount_info *mi; /* child is remaped into the root yards */ + struct mount_info *parent; /* the origin parent for the child*/ + struct list_head node; + }; +diff --git a/criu/net.c b/criu/net.c +index 02115c4de..50655559d 100644 +--- a/criu/net.c ++++ b/criu/net.c +@@ -1172,7 +1172,7 @@ struct newlink_req { + * request. + */ + struct newlink_extras { +- int link; /* IFLA_LINK */ ++ int link; /* IFLA_LINK */ + int target_netns; /* IFLA_NET_NS_FD */ + }; + +@@ -1744,7 +1744,7 @@ static int __restore_link(struct ns_id *ns, struct net_link *link, int nlsk) + + switch (nde->type) { + case ND_TYPE__LOOPBACK: /* fallthrough */ +- case ND_TYPE__EXTLINK: /* see comment in images/netdev.proto */ ++ case ND_TYPE__EXTLINK: /* see comment in images/netdev.proto */ + return restore_link_parms(link, nlsk); + case ND_TYPE__VENET: + return restore_one_link(ns, link, nlsk, venet_link_info, NULL); +diff --git a/criu/pagemap.c b/criu/pagemap.c +index 77e519dd1..d996db7fc 100644 +--- a/criu/pagemap.c ++++ b/criu/pagemap.c +@@ -30,10 +30,10 @@ + * One "job" for the preadv() syscall in pagemap.c + */ + struct page_read_iov { +- off_t from; /* offset in pi file where to start reading from */ +- off_t end; /* the end of the read == sum to.iov_len -s */ ++ off_t from; /* offset in pi file where to start reading from */ ++ off_t end; /* the end of the read == sum to.iov_len -s */ + struct iovec *to; /* destination iovs */ +- unsigned int nr; /* their number */ ++ unsigned int nr; /* their number */ + + struct list_head l; + }; +diff --git a/criu/shmem.c b/criu/shmem.c +index bb48e436b..a9ee8d7eb 100644 +--- a/criu/shmem.c ++++ b/criu/shmem.c +@@ -81,7 +81,7 @@ struct shmem_info { + * an region. Each time when we found a process with a smaller pid, + * we reset self_count, so we can't have only one counter. + */ +- int count; /* the number of regions */ ++ int count; /* the number of regions */ + int self_count; /* the number of regions, which belongs to "pid" */ + }; + +diff --git a/criu/sk-unix.c b/criu/sk-unix.c +index f3fe60c6e..a819473b4 100644 +--- a/criu/sk-unix.c ++++ b/criu/sk-unix.c +@@ -958,9 +958,9 @@ struct unix_sk_info { + struct unix_sk_info *peer; + struct pprep_head peer_resolve; /* XXX : union with the above? */ + struct file_desc d; +- struct hlist_node hash; /* To lookup socket by ino */ ++ struct hlist_node hash; /* To lookup socket by ino */ + struct list_head connected; /* List of sockets, connected to me */ +- struct list_head node; /* To link in peer's connected list */ ++ struct list_head node; /* To link in peer's connected list */ + struct list_head scm_fles; + struct list_head ghost_node; + size_t ghost_dir_pos; +diff --git a/criu/uffd.c b/criu/uffd.c +index 18bdc040f..f01e6999b 100644 +--- a/criu/uffd.c ++++ b/criu/uffd.c +@@ -71,8 +71,8 @@ static mutex_t *lazy_sock_mutex; + + struct lazy_iov { + struct list_head l; +- unsigned long start; /* run-time start address, tracks remaps */ +- unsigned long end; /* run-time end address, tracks remaps */ ++ unsigned long start; /* run-time start address, tracks remaps */ ++ unsigned long end; /* run-time end address, tracks remaps */ + unsigned long img_start; /* start address at the dump time */ + }; + +diff --git a/criu/util.c b/criu/util.c +index 414879971..2917102fd 100644 +--- a/criu/util.c ++++ b/criu/util.c +@@ -1669,8 +1669,8 @@ __attribute__((returns_twice)) static pid_t raw_legacy_clone(unsigned long flags + */ + "addx %%g0, 0, %%g1" + : "=r"(g1), "=r"(o0), "=r"(o1), "=r"(o2) /* outputs */ +- : "r"(g1), "r"(o0), "r"(o1), "r"(o2) /* inputs */ +- : "%cc"); /* clobbers */ ++ : "r"(g1), "r"(o0), "r"(o1), "r"(o2) /* inputs */ ++ : "%cc"); /* clobbers */ + + is_error = g1; + retval = o0; +diff --git a/include/common/arch/ppc64/asm/bitops.h b/include/common/arch/ppc64/asm/bitops.h +index 704668263..dbfa6be7f 100644 +--- a/include/common/arch/ppc64/asm/bitops.h ++++ b/include/common/arch/ppc64/asm/bitops.h +@@ -196,7 +196,7 @@ static inline unsigned long find_next_bit(const unsigned long *addr, unsigned lo + + found_first: + tmp &= (~0UL >> (BITS_PER_LONG - size)); +- if (tmp == 0UL) /* Are any bits set? */ ++ if (tmp == 0UL) /* Are any bits set? */ + return result + size; /* Nope. */ + found_middle: + return result + __ffs(tmp); +diff --git a/include/common/arch/x86/asm/bitops.h b/include/common/arch/x86/asm/bitops.h +index d7a60589b..c13c1eb45 100644 +--- a/include/common/arch/x86/asm/bitops.h ++++ b/include/common/arch/x86/asm/bitops.h +@@ -113,7 +113,7 @@ static inline unsigned long find_next_bit(const unsigned long *addr, unsigned lo + + found_first: + tmp &= (~0UL >> (BITS_PER_LONG - size)); +- if (tmp == 0UL) /* Are any bits set? */ ++ if (tmp == 0UL) /* Are any bits set? */ + return result + size; /* Nope. */ + found_middle: + return result + __ffs(tmp); +diff --git a/include/common/asm-generic/bitops.h b/include/common/asm-generic/bitops.h +index 064ba4cc4..004da4c4e 100644 +--- a/include/common/asm-generic/bitops.h ++++ b/include/common/asm-generic/bitops.h +@@ -97,7 +97,7 @@ static inline unsigned long find_next_bit(const unsigned long *addr, unsigned lo + + found_first: + tmp &= (~0UL >> (BITS_PER_LONG - size)); +- if (tmp == 0UL) /* Are any bits set? */ ++ if (tmp == 0UL) /* Are any bits set? */ + return result + size; /* Nope. */ + found_middle: + return result + __ffs(tmp); +diff --git a/soccr/soccr.c b/soccr/soccr.c +index f6fb1946b..8be2d28e1 100644 +--- a/soccr/soccr.c ++++ b/soccr/soccr.c +@@ -609,8 +609,8 @@ static int send_fin(struct libsoccr_sk *sk, struct libsoccr_sk_data *data, unsig + libnet_type = LIBNET_RAW4; + + l = libnet_init(libnet_type, /* injection type */ +- NULL, /* network interface */ +- errbuf); /* errbuf */ ++ NULL, /* network interface */ ++ errbuf); /* errbuf */ + if (l == NULL) { + loge("libnet_init failed (%s)\n", errbuf); + return -1; +@@ -623,17 +623,17 @@ static int send_fin(struct libsoccr_sk *sk, struct libsoccr_sk_data *data, unsig + + ret = libnet_build_tcp(ntohs(sk->dst_addr->v4.sin_port), /* source port */ + ntohs(sk->src_addr->v4.sin_port), /* destination port */ +- data->inq_seq, /* sequence number */ +- data->outq_seq - data->outq_len, /* acknowledgement num */ +- flags, /* control flags */ +- data->rcv_wnd, /* window size */ +- 0, /* checksum */ +- 10, /* urgent pointer */ +- LIBNET_TCP_H + 20, /* TCP packet size */ +- NULL, /* payload */ +- 0, /* payload size */ +- l, /* libnet handle */ +- 0); /* libnet id */ ++ data->inq_seq, /* sequence number */ ++ data->outq_seq - data->outq_len, /* acknowledgement num */ ++ flags, /* control flags */ ++ data->rcv_wnd, /* window size */ ++ 0, /* checksum */ ++ 10, /* urgent pointer */ ++ LIBNET_TCP_H + 20, /* TCP packet size */ ++ NULL, /* payload */ ++ 0, /* payload size */ ++ l, /* libnet handle */ ++ 0); /* libnet id */ + if (ret == -1) { + loge("Can't build TCP header: %s\n", libnet_geterror(l)); + goto err; +@@ -646,28 +646,28 @@ static int send_fin(struct libsoccr_sk *sk, struct libsoccr_sk_data *data, unsig + memcpy(&src, &sk->src_addr->v6.sin6_addr, sizeof(src)); + + ret = libnet_build_ipv6(0, 0, LIBNET_TCP_H, /* length */ +- IPPROTO_TCP, /* protocol */ +- 64, /* hop limit */ +- dst, /* source IP */ +- src, /* destination IP */ +- NULL, /* payload */ +- 0, /* payload size */ +- l, /* libnet handle */ +- 0); /* libnet id */ ++ IPPROTO_TCP, /* protocol */ ++ 64, /* hop limit */ ++ dst, /* source IP */ ++ src, /* destination IP */ ++ NULL, /* payload */ ++ 0, /* payload size */ ++ l, /* libnet handle */ ++ 0); /* libnet id */ + } else if (family == AF_INET) + ret = libnet_build_ipv4(LIBNET_IPV4_H + LIBNET_TCP_H + 20, /* length */ +- 0, /* TOS */ +- 242, /* IP ID */ +- 0, /* IP Frag */ +- 64, /* TTL */ +- IPPROTO_TCP, /* protocol */ +- 0, /* checksum */ +- dst_v4, /* source IP */ +- src_v4, /* destination IP */ +- NULL, /* payload */ +- 0, /* payload size */ +- l, /* libnet handle */ +- 0); /* libnet id */ ++ 0, /* TOS */ ++ 242, /* IP ID */ ++ 0, /* IP Frag */ ++ 64, /* TTL */ ++ IPPROTO_TCP, /* protocol */ ++ 0, /* checksum */ ++ dst_v4, /* source IP */ ++ src_v4, /* destination IP */ ++ NULL, /* payload */ ++ 0, /* payload size */ ++ l, /* libnet handle */ ++ 0); /* libnet id */ + else { + loge("Unknown socket family\n"); + goto err; +diff --git a/soccr/soccr.h b/soccr/soccr.h +index 934d43827..e7091e591 100644 +--- a/soccr/soccr.h ++++ b/soccr/soccr.h +@@ -1,9 +1,9 @@ + #ifndef __LIBSOCCR_H__ + #define __LIBSOCCR_H__ +-#include /* sockaddr_in, sockaddr_in6 */ ++#include /* sockaddr_in, sockaddr_in6 */ + #include /* TCP_REPAIR_WINDOW, TCP_TIMESTAMP */ +-#include /* uint32_t */ +-#include /* sockaddr */ ++#include /* uint32_t */ ++#include /* sockaddr */ + + #include "common/config.h" + +diff --git a/test/zdtm/static/aio01.c b/test/zdtm/static/aio01.c +index ed45192b9..100069b03 100644 +--- a/test/zdtm/static/aio01.c ++++ b/test/zdtm/static/aio01.c +@@ -14,8 +14,8 @@ const char *test_doc = "Check head and tail restore correct"; + const char *test_author = "Kirill Tkhai "; + + struct aio_ring { +- unsigned id; /* kernel internal index number */ +- unsigned nr; /* number of io_events */ ++ unsigned id; /* kernel internal index number */ ++ unsigned nr; /* number of io_events */ + unsigned head; /* Written to by userland or under ring_lock + * mutex by aio_read_events_ring(). */ + unsigned tail; +diff --git a/test/zdtm/static/auto_dev-ioctl.h b/test/zdtm/static/auto_dev-ioctl.h +index e65259b30..1b35fe2f7 100644 +--- a/test/zdtm/static/auto_dev-ioctl.h ++++ b/test/zdtm/static/auto_dev-ioctl.h +@@ -95,7 +95,7 @@ struct args_ismountpoint { + struct autofs_dev_ioctl { + __u32 ver_major; + __u32 ver_minor; +- __u32 size; /* total size of data passed in ++ __u32 size; /* total size of data passed in + * including this struct */ + __s32 ioctlfd; /* automount command fd */ + +diff --git a/test/zdtm/static/file_locks00.c b/test/zdtm/static/file_locks00.c +index 0b5d1313b..01782fa7a 100644 +--- a/test/zdtm/static/file_locks00.c ++++ b/test/zdtm/static/file_locks00.c +@@ -23,10 +23,10 @@ static int lock_reg(int fd, int cmd, int type, int whence, off_t offset, off_t l + { + struct flock lock; + +- lock.l_type = type; /* F_RDLCK, F_WRLCK, F_UNLCK */ ++ lock.l_type = type; /* F_RDLCK, F_WRLCK, F_UNLCK */ + lock.l_whence = whence; /* SEEK_SET, SEEK_CUR, SEEK_END */ +- lock.l_start = offset; /* byte offset, relative to l_whence */ +- lock.l_len = len; /* #bytes (0 means to EOF) */ ++ lock.l_start = offset; /* byte offset, relative to l_whence */ ++ lock.l_len = len; /* #bytes (0 means to EOF) */ + + errno = 0; + return fcntl(fd, cmd, &lock); +@@ -40,10 +40,10 @@ static int check_read_lock(int fd, int whence, off_t offset, off_t len) + struct flock lock; + int ret; + +- lock.l_type = F_RDLCK; /* F_RDLCK, F_WRLCK, F_UNLCK */ ++ lock.l_type = F_RDLCK; /* F_RDLCK, F_WRLCK, F_UNLCK */ + lock.l_whence = whence; /* SEEK_SET, SEEK_CUR, SEEK_END */ +- lock.l_start = offset; /* byte offset, relative to l_whence */ +- lock.l_len = len; /* #bytes (0 means to EOF) */ ++ lock.l_start = offset; /* byte offset, relative to l_whence */ ++ lock.l_len = len; /* #bytes (0 means to EOF) */ + lock.l_pid = -1; + + errno = 0; +@@ -69,10 +69,10 @@ static int check_write_lock(int fd, int whence, off_t offset, off_t len) + int ret; + pid_t ppid = getppid(); + +- lock.l_type = F_WRLCK; /* F_RDLCK, F_WRLCK, F_UNLCK */ ++ lock.l_type = F_WRLCK; /* F_RDLCK, F_WRLCK, F_UNLCK */ + lock.l_whence = whence; /* SEEK_SET, SEEK_CUR, SEEK_END */ +- lock.l_start = offset; /* byte offset, relative to l_whence */ +- lock.l_len = len; /* #bytes (0 means to EOF) */ ++ lock.l_start = offset; /* byte offset, relative to l_whence */ ++ lock.l_len = len; /* #bytes (0 means to EOF) */ + lock.l_pid = -1; + + errno = 0; +diff --git a/test/zdtm/static/ipc_namespace.c b/test/zdtm/static/ipc_namespace.c +index 4273951ae..b13b357ba 100644 +--- a/test/zdtm/static/ipc_namespace.c ++++ b/test/zdtm/static/ipc_namespace.c +@@ -52,10 +52,10 @@ struct ipc_ns { + + // unsigned int mq_queues_count; + +- unsigned int mq_queues_max; /* initialized to DFLT_QUEUESMAX */ +- unsigned int mq_msg_max; /* initialized to DFLT_MSGMAX */ +- unsigned int mq_msgsize_max; /* initialized to DFLT_MSGSIZEMAX */ +- unsigned int mq_msg_default; /* initialized to DFLT_MSG */ ++ unsigned int mq_queues_max; /* initialized to DFLT_QUEUESMAX */ ++ unsigned int mq_msg_max; /* initialized to DFLT_MSGMAX */ ++ unsigned int mq_msgsize_max; /* initialized to DFLT_MSGSIZEMAX */ ++ unsigned int mq_msg_default; /* initialized to DFLT_MSG */ + unsigned int mq_msgsize_default; /* initialized to DFLT_MSGSIZE */ + + struct user_ns *user_ns; +diff --git a/test/zdtm/static/netns-dev.c b/test/zdtm/static/netns-dev.c +index e220daa7f..1e6ee1dea 100644 +--- a/test/zdtm/static/netns-dev.c ++++ b/test/zdtm/static/netns-dev.c +@@ -55,36 +55,36 @@ struct range { + }; + + struct range rand_range4[] = { +- { 0, 1 }, /* accept_local */ +- { -1, 0 }, /* accept_source_route */ +- { 0, 1 }, /* arp_accept */ +- { 0, 2 }, /* arp_announce */ +- { 0, 1 }, /* arp_filter */ +- { 0, 8 }, /* arp_ignore */ +- { 0, 1 }, /* arp_notify */ +- { 0, 1 }, /* bootp_relay */ +- { 0, 1 }, /* disable_policy */ +- { 0, 1 }, /* disable_xfrm */ +- { 0, 1 }, /* drop_gratuitous_arp */ +- { 0, 1 }, /* drop_unicast_in_l2_multicast */ +- { 0, INT_MAX }, /* force_igmp_version */ +- { 0, 1 }, /* forwarding */ +- { 0, 1 }, /* accept_redirects */ +- { 0, INT_MAX }, /* igmpv2_unsolicited_report_interval */ +- { 0, INT_MAX }, /* igmpv3_unsolicited_report_interval */ +- { 0, 1 }, /* ignore_routes_with_linkdown */ +- { 0, 1 }, /* log_martians */ +- { 0, 1 }, /* mc_forwarding */ +- { -1, INT_MAX }, /* medium_id */ +- { 0, 1 }, /* promote_secondaries */ +- { 0, 1 }, /* proxy_arp */ +- { 0, 1 }, /* proxy_arp_pvlan */ +- { 0, 1 }, /* route_localnet */ +- { 0, 2 }, /* rp_filter */ +- { 0, 1 }, /* secure_redirects */ +- { 0, 1 }, /* send_redirects */ +- { 0, 1 }, /* shared_media */ +- { 0, 1 }, /* src_valid_mark */ ++ { 0, 1 }, /* accept_local */ ++ { -1, 0 }, /* accept_source_route */ ++ { 0, 1 }, /* arp_accept */ ++ { 0, 2 }, /* arp_announce */ ++ { 0, 1 }, /* arp_filter */ ++ { 0, 8 }, /* arp_ignore */ ++ { 0, 1 }, /* arp_notify */ ++ { 0, 1 }, /* bootp_relay */ ++ { 0, 1 }, /* disable_policy */ ++ { 0, 1 }, /* disable_xfrm */ ++ { 0, 1 }, /* drop_gratuitous_arp */ ++ { 0, 1 }, /* drop_unicast_in_l2_multicast */ ++ { 0, INT_MAX }, /* force_igmp_version */ ++ { 0, 1 }, /* forwarding */ ++ { 0, 1 }, /* accept_redirects */ ++ { 0, INT_MAX }, /* igmpv2_unsolicited_report_interval */ ++ { 0, INT_MAX }, /* igmpv3_unsolicited_report_interval */ ++ { 0, 1 }, /* ignore_routes_with_linkdown */ ++ { 0, 1 }, /* log_martians */ ++ { 0, 1 }, /* mc_forwarding */ ++ { -1, INT_MAX }, /* medium_id */ ++ { 0, 1 }, /* promote_secondaries */ ++ { 0, 1 }, /* proxy_arp */ ++ { 0, 1 }, /* proxy_arp_pvlan */ ++ { 0, 1 }, /* route_localnet */ ++ { 0, 2 }, /* rp_filter */ ++ { 0, 1 }, /* secure_redirects */ ++ { 0, 1 }, /* send_redirects */ ++ { 0, 1 }, /* shared_media */ ++ { 0, 1 }, /* src_valid_mark */ + { INT_MIN, INT_MAX }, /* tag */ + }; + +@@ -139,47 +139,47 @@ char *devconfs6[] = { + #define MAX_ADDRESSES 128 + + struct range rand_range6[] = { +- { 0, 2 }, /* accept_dad */ +- { 0, 2 }, /* accept_ra */ +- { 0, 1 }, /* accept_ra_defrtr */ +- { 0, 1 }, /* accept_ra_from_local */ +- { 0, INT_MAX }, /* accept_ra_min_hop_limit */ +- { 0, 1 }, /* accept_ra_mtu */ +- { 0, 1 }, /* accept_ra_pinfo */ +- { 0, INT_MAX }, /* accept_ra_rt_info_max_plen */ +- { 0, 1 }, /* accept_ra_rtr_pref */ +- { -1, 0 }, /* accept_source_route */ +- { 0, 1 }, /* autoconf */ +- { 0, INT_MAX }, /* dad_transmits */ +- { 0, 1 }, /* disable_ipv6 */ +- { 0, 1 }, /* drop_unicast_in_l2_multicast */ +- { 0, 1 }, /* drop_unsolicited_na */ +- { 0, 2 }, /* force_mld_version */ +- { 0, 1 }, /* force_tllao */ +- { 0, 1 }, /* forwarding */ +- { 0, 1 }, /* accept_redirects */ +- { 1, 255 }, /* hop_limit */ +- { 0, 1 }, /* ignore_routes_with_linkdown */ +- { -1, 1 }, /* keep_addr_on_down */ +- { 0, MAX_ADDRESSES }, /* max_addresses */ +- { 0, INT_MAX }, /* max_desync_factor */ +- { 0, INT_MAX }, /* mldv1_unsolicited_report_interval */ +- { 0, INT_MAX }, /* mldv2_unsolicited_report_interval */ ++ { 0, 2 }, /* accept_dad */ ++ { 0, 2 }, /* accept_ra */ ++ { 0, 1 }, /* accept_ra_defrtr */ ++ { 0, 1 }, /* accept_ra_from_local */ ++ { 0, INT_MAX }, /* accept_ra_min_hop_limit */ ++ { 0, 1 }, /* accept_ra_mtu */ ++ { 0, 1 }, /* accept_ra_pinfo */ ++ { 0, INT_MAX }, /* accept_ra_rt_info_max_plen */ ++ { 0, 1 }, /* accept_ra_rtr_pref */ ++ { -1, 0 }, /* accept_source_route */ ++ { 0, 1 }, /* autoconf */ ++ { 0, INT_MAX }, /* dad_transmits */ ++ { 0, 1 }, /* disable_ipv6 */ ++ { 0, 1 }, /* drop_unicast_in_l2_multicast */ ++ { 0, 1 }, /* drop_unsolicited_na */ ++ { 0, 2 }, /* force_mld_version */ ++ { 0, 1 }, /* force_tllao */ ++ { 0, 1 }, /* forwarding */ ++ { 0, 1 }, /* accept_redirects */ ++ { 1, 255 }, /* hop_limit */ ++ { 0, 1 }, /* ignore_routes_with_linkdown */ ++ { -1, 1 }, /* keep_addr_on_down */ ++ { 0, MAX_ADDRESSES }, /* max_addresses */ ++ { 0, INT_MAX }, /* max_desync_factor */ ++ { 0, INT_MAX }, /* mldv1_unsolicited_report_interval */ ++ { 0, INT_MAX }, /* mldv2_unsolicited_report_interval */ + { IPV6_MIN_MTU, IPV6_MIN_MTU }, /* mtu */ +- { 0, 1 }, /* ndisc_notify */ +- { 0, 1 }, /* optimistic_dad */ +- { 0, 1 }, /* proxy_ndp */ +- { 0, INT_MAX }, /* regen_max_retry */ +- { 0, ROUTER_MAX }, /* router_probe_interval */ +- { 0, ROUTER_MAX }, /* router_solicitation_delay */ +- { 0, ROUTER_MAX }, /* router_solicitation_interval */ +- { 0, ROUTER_MAX }, /* router_solicitations */ +- { 0, 1 }, /* suppress_frag_ndisc */ +- { 0, INT_MAX }, /* temp_prefered_lft */ +- { 0, INT_MAX }, /* temp_valid_lft */ +- { 0, 1 }, /* use_oif_addrs_only */ +- { 0, 1 }, /* use_optimistic */ +- { 0, 2 }, /* use_tempaddr */ ++ { 0, 1 }, /* ndisc_notify */ ++ { 0, 1 }, /* optimistic_dad */ ++ { 0, 1 }, /* proxy_ndp */ ++ { 0, INT_MAX }, /* regen_max_retry */ ++ { 0, ROUTER_MAX }, /* router_probe_interval */ ++ { 0, ROUTER_MAX }, /* router_solicitation_delay */ ++ { 0, ROUTER_MAX }, /* router_solicitation_interval */ ++ { 0, ROUTER_MAX }, /* router_solicitations */ ++ { 0, 1 }, /* suppress_frag_ndisc */ ++ { 0, INT_MAX }, /* temp_prefered_lft */ ++ { 0, INT_MAX }, /* temp_valid_lft */ ++ { 0, 1 }, /* use_oif_addrs_only */ ++ { 0, 1 }, /* use_optimistic */ ++ { 0, 2 }, /* use_tempaddr */ + }; + + struct test_conf { +diff --git a/test/zdtm/static/s390x_regs_check.c b/test/zdtm/static/s390x_regs_check.c +index 8d6b47997..40c480b3f 100644 +--- a/test/zdtm/static/s390x_regs_check.c ++++ b/test/zdtm/static/s390x_regs_check.c +@@ -59,11 +59,11 @@ static int pipefd[2]; + */ + struct reg_set { + const char *name; /* Name of regset */ +- int nr; /* Number of regset */ +- void *data; /* Test data */ +- int len; /* Number of bytes of test data */ +- bool optional; /* Not all kernels/machines have this reg set */ +- bool available; /* Current kernel/machine has this reg set */ ++ int nr; /* Number of regset */ ++ void *data; /* Test data */ ++ int len; /* Number of bytes of test data */ ++ bool optional; /* Not all kernels/machines have this reg set */ ++ bool available; /* Current kernel/machine has this reg set */ + }; + + /* +@@ -397,8 +397,8 @@ static inline void send_tid_and_loop(int fd) + + asm volatile("lgr 2,%0\n" /* Arg 1: fd */ + "la 3,%1\n" /* Arg 2: &tid */ +- "lghi 4,4\n" /* Arg 3: sizeof(int) */ +- "svc 4\n" /* __NR_write SVC: */ ++ "lghi 4,4\n" /* Arg 3: sizeof(int) */ ++ "svc 4\n" /* __NR_write SVC: */ + /* After SVC no more registers are changed */ + "0: j 0b\n" /* Loop here */ + : +diff --git a/test/zdtm/static/session01.c b/test/zdtm/static/session01.c +index 0f727a9a6..31a617de9 100644 +--- a/test/zdtm/static/session01.c ++++ b/test/zdtm/static/session01.c +@@ -40,22 +40,22 @@ enum { + static struct testcase *testcases; + static futex_t *fstate; + static struct testcase __testcases[] = { +- { 2, 1, 2, 1, 2, 1 }, /* session00 */ +- { 4, 2, 4, 2, 4, 1 }, /* |\_session00 */ +- { 15, 4, 4, 4, 15, 1 }, /* | |\_session00 */ +- { 16, 4, 4, 4, 15, 1 }, /* | \_session00 */ +- { 17, 4, 4, 4, 17, 0 }, /* | |\_session00 */ +- { 18, 4, 4, 4, 17, 1 }, /* | \_session00 */ +- { 5, 2, 2, 2, 2, 1 }, /* |\_session00 */ +- { 8, 2, 8, 2, 8, 1 }, /* |\_session00 */ +- { 9, 8, 2, 2, 2, 1 }, /* | \_session00 */ +- { 10, 2, 10, 2, 10, 1 }, /* |\_session00 */ ++ { 2, 1, 2, 1, 2, 1 }, /* session00 */ ++ { 4, 2, 4, 2, 4, 1 }, /* |\_session00 */ ++ { 15, 4, 4, 4, 15, 1 }, /* | |\_session00 */ ++ { 16, 4, 4, 4, 15, 1 }, /* | \_session00 */ ++ { 17, 4, 4, 4, 17, 0 }, /* | |\_session00 */ ++ { 18, 4, 4, 4, 17, 1 }, /* | \_session00 */ ++ { 5, 2, 2, 2, 2, 1 }, /* |\_session00 */ ++ { 8, 2, 8, 2, 8, 1 }, /* |\_session00 */ ++ { 9, 8, 2, 2, 2, 1 }, /* | \_session00 */ ++ { 10, 2, 10, 2, 10, 1 }, /* |\_session00 */ + { 11, 10, 11, 2, 11, 1 }, /* | \_session00 */ +- { 12, 11, 2, 2, 2, 1 }, /* | \_session00 */ +- { 13, 2, 2, 2, 2, 0 }, /* \_session00 */ +- { 3, 13, 2, 2, 2, 1 }, /* session00 */ +- { 6, 2, 6, 2, 6, 0 }, /* \_session00 */ +- { 14, 6, 6, 6, 6, 1 }, /* session00 */ ++ { 12, 11, 2, 2, 2, 1 }, /* | \_session00 */ ++ { 13, 2, 2, 2, 2, 0 }, /* \_session00 */ ++ { 3, 13, 2, 2, 2, 1 }, /* session00 */ ++ { 6, 2, 6, 2, 6, 0 }, /* \_session00 */ ++ { 14, 6, 6, 6, 6, 1 }, /* session00 */ + }; + + #define TESTS (sizeof(__testcases) / sizeof(struct testcase)) +diff --git a/test/zdtm/static/sigpending.c b/test/zdtm/static/sigpending.c +index 1641fdd86..ce03ff55c 100644 +--- a/test/zdtm/static/sigpending.c ++++ b/test/zdtm/static/sigpending.c +@@ -18,7 +18,7 @@ static int numsig; + #define TESTSIG (SIGRTMAX) + #define THREADSIG (SIGRTMIN) + static siginfo_t share_infos[2]; +-static siginfo_t self_infos[64]; /* self */ ++static siginfo_t self_infos[64]; /* self */ + static siginfo_t thread_infos[3]; /* thread */ + static int share_nr; + static int self_nr; +diff --git a/test/zdtm/transition/ptrace.c b/test/zdtm/transition/ptrace.c +index bf6344f1c..ee10c8004 100644 +--- a/test/zdtm/transition/ptrace.c ++++ b/test/zdtm/transition/ptrace.c +@@ -31,7 +31,7 @@ int main(int argc, char **argv) + { + int pid, status, i, stopped; + #define PT_REGS_SIZE 4096 /* big enough for any arch */ +-#define PT_REGS_ALIGN 16 /* big enough for any arch */ ++#define PT_REGS_ALIGN 16 /* big enough for any arch */ + char regs[PT_REGS_SIZE] __attribute__((aligned(PT_REGS_ALIGN))); + + int *pids; +-- +2.34.1 + diff --git a/0044-cr-dump-fail-dumping-when-zombie-process-with-sid-0.patch b/0044-cr-dump-fail-dumping-when-zombie-process-with-sid-0.patch new file mode 100644 index 0000000..7e15ba7 --- /dev/null +++ b/0044-cr-dump-fail-dumping-when-zombie-process-with-sid-0.patch @@ -0,0 +1,35 @@ +From 688149930abd96fd9e1db4ee3b67c727bab4f3d8 Mon Sep 17 00:00:00 2001 +From: Liu Hua +Date: Mon, 1 Nov 2021 20:50:58 +0800 +Subject: [PATCH 044/120] cr-dump: fail dumping when zombie process with sid 0 + +A zombie process with 0 sid has a session leader in +outer pidns and has ignored SIGHUP. Criu has no idea +to restore this type of process, so fail the dumpping. + +Signed-off-by: Liu Hua +--- + criu/cr-dump.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/criu/cr-dump.c b/criu/cr-dump.c +index ecc99f116..c972e343a 100644 +--- a/criu/cr-dump.c ++++ b/criu/cr-dump.c +@@ -1129,6 +1129,13 @@ static int dump_zombies(void) + item->pgid = pps_buf.pgid; + + BUG_ON(!list_empty(&item->children)); ++ ++ if (!item->sid) { ++ pr_err("A session leader of zombie process %d(%d) is outside of its pid namespace\n", ++ item->pid->real, vpid(item)); ++ goto err; ++ } ++ + if (dump_one_zombie(item, &pps_buf) < 0) + goto err; + } +-- +2.34.1 + diff --git a/0045-clang-format-make-x86_ins_capability_mask-human-read.patch b/0045-clang-format-make-x86_ins_capability_mask-human-read.patch new file mode 100644 index 0000000..a362d89 --- /dev/null +++ b/0045-clang-format-make-x86_ins_capability_mask-human-read.patch @@ -0,0 +1,176 @@ +From fef55d6b7cafddc13ecc29920b9726406f820ee6 Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Fri, 29 Oct 2021 10:35:28 +0300 +Subject: [PATCH 045/120] clang-format: make x86_ins_capability_mask + human-readable + +There is no option in clang not to merge as much binary operands as it +fits in column limit, but here we need each bit on new line to make it +readable, so let's disable clang-format for x86_ins_capability_masks. + +Signed-off-by: Pavel Tikhomirov +--- + criu/arch/x86/cpu.c | 139 ++++++++++++++++++++++++++++---------------- + 1 file changed, 89 insertions(+), 50 deletions(-) + +diff --git a/criu/arch/x86/cpu.c b/criu/arch/x86/cpu.c +index d02f4abd5..b3a7ca636 100644 +--- a/criu/arch/x86/cpu.c ++++ b/criu/arch/x86/cpu.c +@@ -107,64 +107,103 @@ int cpu_dump_cpuinfo(void) + + #define __ins_bit(__l, __v) (1u << ((__v)-32u * (__l))) + ++// clang-format off + static uint32_t x86_ins_capability_mask[NCAPINTS] = { +- [CPUID_1_EDX] = __ins_bit(CPUID_1_EDX, X86_FEATURE_FPU) | __ins_bit(CPUID_1_EDX, X86_FEATURE_TSC) | +- __ins_bit(CPUID_1_EDX, X86_FEATURE_CX8) | __ins_bit(CPUID_1_EDX, X86_FEATURE_SEP) | +- __ins_bit(CPUID_1_EDX, X86_FEATURE_CMOV) | __ins_bit(CPUID_1_EDX, X86_FEATURE_CLFLUSH) | +- __ins_bit(CPUID_1_EDX, X86_FEATURE_MMX) | __ins_bit(CPUID_1_EDX, X86_FEATURE_FXSR) | +- __ins_bit(CPUID_1_EDX, X86_FEATURE_XMM) | __ins_bit(CPUID_1_EDX, X86_FEATURE_XMM2), +- +- [CPUID_8000_0001_EDX] = __ins_bit(CPUID_8000_0001_EDX, X86_FEATURE_SYSCALL) | +- __ins_bit(CPUID_8000_0001_EDX, X86_FEATURE_MMXEXT) | +- __ins_bit(CPUID_8000_0001_EDX, X86_FEATURE_RDTSCP) | +- __ins_bit(CPUID_8000_0001_EDX, X86_FEATURE_3DNOWEXT) | +- __ins_bit(CPUID_8000_0001_EDX, X86_FEATURE_3DNOW), +- +- [CPUID_LNX_1] = __ins_bit(CPUID_LNX_1, X86_FEATURE_REP_GOOD) | __ins_bit(CPUID_LNX_1, X86_FEATURE_NOPL), +- +- [CPUID_1_ECX] = __ins_bit(CPUID_1_ECX, X86_FEATURE_XMM3) | __ins_bit(CPUID_1_ECX, X86_FEATURE_PCLMULQDQ) | +- __ins_bit(CPUID_1_ECX, X86_FEATURE_MWAIT) | __ins_bit(CPUID_1_ECX, X86_FEATURE_SSSE3) | +- __ins_bit(CPUID_1_ECX, X86_FEATURE_CX16) | __ins_bit(CPUID_1_ECX, X86_FEATURE_XMM4_1) | +- __ins_bit(CPUID_1_ECX, X86_FEATURE_XMM4_2) | __ins_bit(CPUID_1_ECX, X86_FEATURE_MOVBE) | +- __ins_bit(CPUID_1_ECX, X86_FEATURE_POPCNT) | __ins_bit(CPUID_1_ECX, X86_FEATURE_AES) | +- __ins_bit(CPUID_1_ECX, X86_FEATURE_XSAVE) | __ins_bit(CPUID_1_ECX, X86_FEATURE_OSXSAVE) | +- __ins_bit(CPUID_1_ECX, X86_FEATURE_AVX) | __ins_bit(CPUID_1_ECX, X86_FEATURE_F16C) | +- __ins_bit(CPUID_1_ECX, X86_FEATURE_RDRAND), ++ [CPUID_1_EDX] = ++ __ins_bit(CPUID_1_EDX, X86_FEATURE_FPU) | ++ __ins_bit(CPUID_1_EDX, X86_FEATURE_TSC) | ++ __ins_bit(CPUID_1_EDX, X86_FEATURE_CX8) | ++ __ins_bit(CPUID_1_EDX, X86_FEATURE_SEP) | ++ __ins_bit(CPUID_1_EDX, X86_FEATURE_CMOV) | ++ __ins_bit(CPUID_1_EDX, X86_FEATURE_CLFLUSH) | ++ __ins_bit(CPUID_1_EDX, X86_FEATURE_MMX) | ++ __ins_bit(CPUID_1_EDX, X86_FEATURE_FXSR) | ++ __ins_bit(CPUID_1_EDX, X86_FEATURE_XMM) | ++ __ins_bit(CPUID_1_EDX, X86_FEATURE_XMM2), ++ ++ [CPUID_8000_0001_EDX] = ++ __ins_bit(CPUID_8000_0001_EDX, X86_FEATURE_SYSCALL) | ++ __ins_bit(CPUID_8000_0001_EDX, X86_FEATURE_MMXEXT) | ++ __ins_bit(CPUID_8000_0001_EDX, X86_FEATURE_RDTSCP) | ++ __ins_bit(CPUID_8000_0001_EDX, X86_FEATURE_3DNOWEXT) | ++ __ins_bit(CPUID_8000_0001_EDX, X86_FEATURE_3DNOW), ++ ++ [CPUID_LNX_1] = ++ __ins_bit(CPUID_LNX_1, X86_FEATURE_REP_GOOD) | ++ __ins_bit(CPUID_LNX_1, X86_FEATURE_NOPL), ++ ++ [CPUID_1_ECX] = ++ __ins_bit(CPUID_1_ECX, X86_FEATURE_XMM3) | ++ __ins_bit(CPUID_1_ECX, X86_FEATURE_PCLMULQDQ) | ++ __ins_bit(CPUID_1_ECX, X86_FEATURE_MWAIT) | ++ __ins_bit(CPUID_1_ECX, X86_FEATURE_SSSE3) | ++ __ins_bit(CPUID_1_ECX, X86_FEATURE_CX16) | ++ __ins_bit(CPUID_1_ECX, X86_FEATURE_XMM4_1) | ++ __ins_bit(CPUID_1_ECX, X86_FEATURE_XMM4_2) | ++ __ins_bit(CPUID_1_ECX, X86_FEATURE_MOVBE) | ++ __ins_bit(CPUID_1_ECX, X86_FEATURE_POPCNT) | ++ __ins_bit(CPUID_1_ECX, X86_FEATURE_AES) | ++ __ins_bit(CPUID_1_ECX, X86_FEATURE_XSAVE) | ++ __ins_bit(CPUID_1_ECX, X86_FEATURE_OSXSAVE) | ++ __ins_bit(CPUID_1_ECX, X86_FEATURE_AVX) | ++ __ins_bit(CPUID_1_ECX, X86_FEATURE_F16C) | ++ __ins_bit(CPUID_1_ECX, X86_FEATURE_RDRAND), + + [CPUID_8000_0001_ECX] = +- __ins_bit(CPUID_8000_0001_ECX, X86_FEATURE_ABM) | __ins_bit(CPUID_8000_0001_ECX, X86_FEATURE_SSE4A) | +- __ins_bit(CPUID_8000_0001_ECX, X86_FEATURE_MISALIGNSSE) | +- __ins_bit(CPUID_8000_0001_ECX, X86_FEATURE_3DNOWPREFETCH) | +- __ins_bit(CPUID_8000_0001_ECX, X86_FEATURE_XOP) | __ins_bit(CPUID_8000_0001_ECX, X86_FEATURE_FMA4) | +- __ins_bit(CPUID_8000_0001_ECX, X86_FEATURE_TBM), ++ __ins_bit(CPUID_8000_0001_ECX, X86_FEATURE_ABM) | ++ __ins_bit(CPUID_8000_0001_ECX, X86_FEATURE_SSE4A) | ++ __ins_bit(CPUID_8000_0001_ECX, X86_FEATURE_MISALIGNSSE) | ++ __ins_bit(CPUID_8000_0001_ECX, X86_FEATURE_3DNOWPREFETCH) | ++ __ins_bit(CPUID_8000_0001_ECX, X86_FEATURE_XOP) | ++ __ins_bit(CPUID_8000_0001_ECX, X86_FEATURE_FMA4) | ++ __ins_bit(CPUID_8000_0001_ECX, X86_FEATURE_TBM), + + [CPUID_7_0_EBX] = +- __ins_bit(CPUID_7_0_EBX, X86_FEATURE_FSGSBASE) | __ins_bit(CPUID_7_0_EBX, X86_FEATURE_BMI1) | +- __ins_bit(CPUID_7_0_EBX, X86_FEATURE_HLE) | __ins_bit(CPUID_7_0_EBX, X86_FEATURE_AVX2) | +- __ins_bit(CPUID_7_0_EBX, X86_FEATURE_BMI2) | __ins_bit(CPUID_7_0_EBX, X86_FEATURE_ERMS) | +- __ins_bit(CPUID_7_0_EBX, X86_FEATURE_RTM) | __ins_bit(CPUID_7_0_EBX, X86_FEATURE_MPX) | +- __ins_bit(CPUID_7_0_EBX, X86_FEATURE_AVX512F) | __ins_bit(CPUID_7_0_EBX, X86_FEATURE_AVX512DQ) | +- __ins_bit(CPUID_7_0_EBX, X86_FEATURE_RDSEED) | __ins_bit(CPUID_7_0_EBX, X86_FEATURE_ADX) | +- __ins_bit(CPUID_7_0_EBX, X86_FEATURE_CLFLUSHOPT) | __ins_bit(CPUID_7_0_EBX, X86_FEATURE_AVX512PF) | +- __ins_bit(CPUID_7_0_EBX, X86_FEATURE_AVX512ER) | __ins_bit(CPUID_7_0_EBX, X86_FEATURE_AVX512CD) | +- __ins_bit(CPUID_7_0_EBX, X86_FEATURE_SHA_NI) | __ins_bit(CPUID_7_0_EBX, X86_FEATURE_AVX512BW) | +- __ins_bit(CPUID_7_0_EBX, X86_FEATURE_AVX512VL), +- +- [CPUID_D_1_EAX] = __ins_bit(CPUID_D_1_EAX, X86_FEATURE_XSAVEOPT) | +- __ins_bit(CPUID_D_1_EAX, X86_FEATURE_XSAVEC) | __ins_bit(CPUID_D_1_EAX, X86_FEATURE_XGETBV1), ++ __ins_bit(CPUID_7_0_EBX, X86_FEATURE_FSGSBASE) | ++ __ins_bit(CPUID_7_0_EBX, X86_FEATURE_BMI1) | ++ __ins_bit(CPUID_7_0_EBX, X86_FEATURE_HLE) | ++ __ins_bit(CPUID_7_0_EBX, X86_FEATURE_AVX2) | ++ __ins_bit(CPUID_7_0_EBX, X86_FEATURE_BMI2) | ++ __ins_bit(CPUID_7_0_EBX, X86_FEATURE_ERMS) | ++ __ins_bit(CPUID_7_0_EBX, X86_FEATURE_RTM) | ++ __ins_bit(CPUID_7_0_EBX, X86_FEATURE_MPX) | ++ __ins_bit(CPUID_7_0_EBX, X86_FEATURE_AVX512F) | ++ __ins_bit(CPUID_7_0_EBX, X86_FEATURE_AVX512DQ) | ++ __ins_bit(CPUID_7_0_EBX, X86_FEATURE_RDSEED) | ++ __ins_bit(CPUID_7_0_EBX, X86_FEATURE_ADX) | ++ __ins_bit(CPUID_7_0_EBX, X86_FEATURE_CLFLUSHOPT) | ++ __ins_bit(CPUID_7_0_EBX, X86_FEATURE_AVX512PF) | ++ __ins_bit(CPUID_7_0_EBX, X86_FEATURE_AVX512ER) | ++ __ins_bit(CPUID_7_0_EBX, X86_FEATURE_AVX512CD) | ++ __ins_bit(CPUID_7_0_EBX, X86_FEATURE_SHA_NI) | ++ __ins_bit(CPUID_7_0_EBX, X86_FEATURE_AVX512BW) | ++ __ins_bit(CPUID_7_0_EBX, X86_FEATURE_AVX512VL), ++ ++ [CPUID_D_1_EAX] = ++ __ins_bit(CPUID_D_1_EAX, X86_FEATURE_XSAVEOPT) | ++ __ins_bit(CPUID_D_1_EAX, X86_FEATURE_XSAVEC) | ++ __ins_bit(CPUID_D_1_EAX, X86_FEATURE_XGETBV1), + + [CPUID_7_0_ECX] = +- __ins_bit(CPUID_7_0_ECX, X86_FEATURE_AVX512VBMI) | __ins_bit(CPUID_7_0_ECX, X86_FEATURE_AVX512_VBMI2) | +- __ins_bit(CPUID_7_0_ECX, X86_FEATURE_GFNI) | __ins_bit(CPUID_7_0_ECX, X86_FEATURE_VAES) | +- __ins_bit(CPUID_7_0_ECX, X86_FEATURE_VPCLMULQDQ) | __ins_bit(CPUID_7_0_ECX, X86_FEATURE_AVX512_VNNI) | +- __ins_bit(CPUID_7_0_ECX, X86_FEATURE_AVX512_BITALG) | __ins_bit(CPUID_7_0_ECX, X86_FEATURE_TME) | +- __ins_bit(CPUID_7_0_ECX, X86_FEATURE_AVX512_VPOPCNTDQ) | __ins_bit(CPUID_7_0_ECX, X86_FEATURE_RDPID), +- +- [CPUID_8000_0008_EBX] = __ins_bit(CPUID_8000_0008_EBX, X86_FEATURE_CLZERO), +- +- [CPUID_7_0_EDX] = __ins_bit(CPUID_7_0_EDX, X86_FEATURE_AVX512_4VNNIW) | +- __ins_bit(CPUID_7_0_EDX, X86_FEATURE_AVX512_4FMAPS), ++ __ins_bit(CPUID_7_0_ECX, X86_FEATURE_AVX512VBMI) | ++ __ins_bit(CPUID_7_0_ECX, X86_FEATURE_AVX512_VBMI2) | ++ __ins_bit(CPUID_7_0_ECX, X86_FEATURE_GFNI) | ++ __ins_bit(CPUID_7_0_ECX, X86_FEATURE_VAES) | ++ __ins_bit(CPUID_7_0_ECX, X86_FEATURE_VPCLMULQDQ) | ++ __ins_bit(CPUID_7_0_ECX, X86_FEATURE_AVX512_VNNI) | ++ __ins_bit(CPUID_7_0_ECX, X86_FEATURE_AVX512_BITALG) | ++ __ins_bit(CPUID_7_0_ECX, X86_FEATURE_TME) | ++ __ins_bit(CPUID_7_0_ECX, X86_FEATURE_AVX512_VPOPCNTDQ) | ++ __ins_bit(CPUID_7_0_ECX, X86_FEATURE_RDPID), ++ ++ [CPUID_8000_0008_EBX] = ++ __ins_bit(CPUID_8000_0008_EBX, X86_FEATURE_CLZERO), ++ ++ [CPUID_7_0_EDX] = ++ __ins_bit(CPUID_7_0_EDX, X86_FEATURE_AVX512_4VNNIW) | ++ __ins_bit(CPUID_7_0_EDX, X86_FEATURE_AVX512_4FMAPS), + }; ++// clang-format on + + #undef __ins_bit + +-- +2.34.1 + diff --git a/0046-ci-disable-socket-raw-test-on-centos8.patch b/0046-ci-disable-socket-raw-test-on-centos8.patch new file mode 100644 index 0000000..4be53b6 --- /dev/null +++ b/0046-ci-disable-socket-raw-test-on-centos8.patch @@ -0,0 +1,44 @@ +From 268bd349a2eea76ab18763bc56c12d5a69a2a51d Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Fri, 19 Nov 2021 10:08:37 +0300 +Subject: [PATCH 046/120] ci: disable socket-raw test on centos8 + +We see error in centos8 ci on restore of socket-raw test: + + inet: \tRestore: family AF_INET type SOCK_RAW proto 66 + port 66 state TCP_CLOSE src_addr 0.0.0.0 + Error (criu/sk-inet.c:834): inet: Can't create inet socket: + Protocol not supported + +Centos 8 kernel replaces IPPROTO_MPTCP(262) with "in-kernel" value +IPPROTO_MPTCP_KERN(66) on inet_create(), but later shows this inkernel +value to criu when listing sockets info. Same code in inet_create() +returns EPROTONOSUPPORT on the attempr to create socket with +IPPROTO_MPTCP_KERN. So this ci error is completely rh8 kernel related. +Kernel should not show "in-kernel" value to userspace. But anyway this +is already changed in Centos 9 kernel, so we can just skip socket-raw +test on Centos 8. + +v2: use cirrus.yml + +Signed-off-by: Pavel Tikhomirov +--- + .cirrus.yml | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/.cirrus.yml b/.cirrus.yml +index 671178d8b..235b9821e 100644 +--- a/.cirrus.yml ++++ b/.cirrus.yml +@@ -47,7 +47,7 @@ task: + pip3 install junit_xml + + build_script: | +- make -C scripts/ci local SKIP_CI_PREP=1 CC=gcc CD_TO_TOP=1 ++ make -C scripts/ci local SKIP_CI_PREP=1 CC=gcc CD_TO_TOP=1 ZDTM_OPTS="-x zdtm/static/socket-raw" + + task: + name: CentOS 7 based test +-- +2.34.1 + diff --git a/0047-zdtm.py-make-tests-with-link_remap-exclusive.patch b/0047-zdtm.py-make-tests-with-link_remap-exclusive.patch new file mode 100644 index 0000000..66b0715 --- /dev/null +++ b/0047-zdtm.py-make-tests-with-link_remap-exclusive.patch @@ -0,0 +1,60 @@ +From 014e4f3002a5b5f01f619252cd0b1b1f4632aa9b Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Wed, 3 Nov 2021 18:34:11 +0300 +Subject: [PATCH 047/120] zdtm.py: make tests with --link_remap exclusive + +We see that tests mntns_ghost01 and unlink_fstat03 can run +simultaneousely and thus the former sees leftover link_remap.* files in +the test directory created by the latter, and the latter is still +running so it's ok to have link_remap.* at this point. + +Let's implicitly make all --link-remap tests exclusive (not running in +parallel). + +Fixes: #1633 + +Signed-off-by: Pavel Tikhomirov +--- + test/zdtm.py | 19 +++++++++++++++++-- + 1 file changed, 17 insertions(+), 2 deletions(-) + +diff --git a/test/zdtm.py b/test/zdtm.py +index fc7b8a183..b62136e96 100755 +--- a/test/zdtm.py ++++ b/test/zdtm.py +@@ -1997,7 +1997,22 @@ class Launcher: + raise Exception("The kernel is tainted: %r (%r)" % + (taint, self.__taint)) + +- if test_flag(desc, 'excl'): ++ ''' ++ The option --link-remap allows criu to hardlink open files back to the ++ file-system on dump (should be removed on restore) and we have a sanity ++ check in check_visible_state that they were actually removed at least ++ from the root test directory after restore. ++ ++ As zdtm runs all tests from the same cwd (e.g.: test/zdtm/static) in ++ parallel, hardlinks from one test can mess up with sanity checks of ++ another test or even one test can by mistake use hardlinks created by ++ another test which is even worse. ++ ++ So let's make all tests using --link-remap option non parallel. ++ ''' ++ link_remap_excl = '--link-remap' in desc.get('opts', '').split() + desc.get('dopts', '').split() + desc.get('ropts', '').split() ++ ++ if test_flag(desc, 'excl') or link_remap_excl: + self.wait_all() + + self.__nr += 1 +@@ -2030,7 +2045,7 @@ class Launcher: + "start": time.time() + } + +- if test_flag(desc, 'excl'): ++ if test_flag(desc, 'excl') or link_remap_excl: + self.wait() + + def __wait_one(self, flags): +-- +2.34.1 + diff --git a/0048-tests-improve-the-deterministic-behavior-of-the-test.patch b/0048-tests-improve-the-deterministic-behavior-of-the-test.patch new file mode 100644 index 0000000..733c135 --- /dev/null +++ b/0048-tests-improve-the-deterministic-behavior-of-the-test.patch @@ -0,0 +1,108 @@ +From fd48f1ae384a4be34f45cbd10c7fd5525fffe2e7 Mon Sep 17 00:00:00 2001 +From: Nicolas Viennot +Date: Fri, 29 Oct 2021 03:01:14 +0000 +Subject: [PATCH 048/120] tests: improve the deterministic behavior of the test + suite + +Various I/O objects are unclosed when the object falls out of scope. +This can lead to non-deterministic behavior. + +Also fixed a few missing list(). It doesn't play way with python3. +e.g., `random.shuffle(filter(...))` doesn't work. + +Signed-off-by: Nicolas Viennot +--- + test/zdtm.py | 25 +++++++++++++++---------- + 1 file changed, 15 insertions(+), 10 deletions(-) + +diff --git a/test/zdtm.py b/test/zdtm.py +index b62136e96..b98770079 100755 +--- a/test/zdtm.py ++++ b/test/zdtm.py +@@ -202,6 +202,8 @@ class ns_flavor: + + def __copy_libs(self, binary): + ldd = subprocess.Popen(["ldd", binary], stdout=subprocess.PIPE) ++ stdout, _ = ldd.communicate() ++ + xl = re.compile( + r'^(linux-gate.so|linux-vdso(64)?.so|not a dynamic|.*\s*ldd\s)') + +@@ -216,11 +218,9 @@ class ns_flavor: + map( + lambda x: str(x).strip(), + filter(lambda x: str(x).startswith('\t'), +- ldd.stdout.read().decode( ++ stdout.decode( + 'ascii').splitlines()))))) + +- ldd.wait() +- + for lib in libs: + if not os.access(lib, os.F_OK): + raise test_fail_exc("Can't find lib %s required by %s" % +@@ -331,8 +331,7 @@ def decode_flav(i): + + def tail(path): + p = subprocess.Popen(['tail', '-n1', path], stdout=subprocess.PIPE) +- out = p.stdout.readline() +- p.wait() ++ out, _ = p.communicate() + return out.decode() + + +@@ -801,7 +800,7 @@ class groups_test(zdtm_test): + if flavor.ns: + self.__real_name = name + with open(name) as fd: +- self.__subs = map(lambda x: x.strip(), fd.readlines()) ++ self.__subs = list(map(lambda x: x.strip(), fd.readlines())) + print("Subs:\n%s" % '\n'.join(self.__subs)) + else: + self.__real_name = '' +@@ -819,8 +818,8 @@ class groups_test(zdtm_test): + subprocess.check_call(s_args + [tname + '.cleanout']) + s = subprocess.Popen(s_args + ['--dry-run', tname + '.pid'], + stdout=subprocess.PIPE) +- cmd = s.stdout.readlines().pop().strip() +- s.wait() ++ out, _ = s.communicate() ++ cmd = out.decode().splitlines()[-1].strip() + + return 'cd /' + tdir + ' && ' + cmd + +@@ -2045,6 +2044,9 @@ class Launcher: + "start": time.time() + } + ++ if log: ++ log.close() ++ + if test_flag(desc, 'excl') or link_remap_excl: + self.wait() + +@@ -2068,6 +2070,9 @@ class Launcher: + self.__runtest += 1 + if pid != 0: + sub = self.__subs.pop(pid) ++ # The following wait() is not useful for our domain logic. ++ # It's useful for taming warnings in subprocess.Popen.__del__() ++ sub['sub'].wait() + tc = None + if self.__junit_test_cases is not None: + tc = TestCase(sub['name'], +@@ -2168,9 +2173,9 @@ def all_tests(opts): + continue + files.append(fp) + excl = list(map(lambda x: os.path.join(desc['dir'], x), desc['exclude'])) +- tlist = filter( ++ tlist = list(filter( + lambda x: not x.endswith('.checkskip') and not x.endswith('.hook') and +- x not in excl, map(lambda x: x.strip(), files)) ++ x not in excl, map(lambda x: x.strip(), files))) + return tlist + + +-- +2.34.1 + diff --git a/0049-clang-format-zdtm-fix-clang-complains-about-strange-.patch b/0049-clang-format-zdtm-fix-clang-complains-about-strange-.patch new file mode 100644 index 0000000..dd14e04 --- /dev/null +++ b/0049-clang-format-zdtm-fix-clang-complains-about-strange-.patch @@ -0,0 +1,99 @@ +From d4ae0b77f9ff0380e9766d1a4e0301b1d1521da3 Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Tue, 23 Nov 2021 15:06:03 +0300 +Subject: [PATCH 049/120] clang-format/zdtm: fix clang complains about strange + elseifs + +Clang-format v13 on my Fedora 35 complains about these hunks, more over +reading the formating we had before is a pain: + +} else /* comment */ + if (smth) { + fail("") + return -1; +} + +Let's make explicit {} braces for else, this way it looks much better. + +Fixes: 93dd984ca ("Run 'make indent' on all C files") +Signed-off-by: Pavel Tikhomirov +--- + test/zdtm/static/mprotect00.c | 16 ++++++++++------ + test/zdtm/static/shm-mp.c | 16 ++++++++++------ + 2 files changed, 20 insertions(+), 12 deletions(-) + +diff --git a/test/zdtm/static/mprotect00.c b/test/zdtm/static/mprotect00.c +index 006b64772..717b7ddcf 100644 +--- a/test/zdtm/static/mprotect00.c ++++ b/test/zdtm/static/mprotect00.c +@@ -44,10 +44,12 @@ static int check_prot(char *ptr, int prot) + fail("PROT_READ bypassed"); + return -1; + } +- } else /* we come here on return from SIGSEGV handler */ ++ } else { ++ /* we come here on return from SIGSEGV handler */ + if (prot & PROT_READ) { +- fail("PROT_READ rejected"); +- return -1; ++ fail("PROT_READ rejected"); ++ return -1; ++ } + } + + if (!sigsetjmp(segv_ret, 1)) { +@@ -56,10 +58,12 @@ static int check_prot(char *ptr, int prot) + fail("PROT_WRITE bypassed"); + return -1; + } +- } else /* we come here on return from SIGSEGV handler */ ++ } else { ++ /* we come here on return from SIGSEGV handler */ + if (prot & PROT_WRITE) { +- fail("PROT_WRITE rejected"); +- return -1; ++ fail("PROT_WRITE rejected"); ++ return -1; ++ } + } + + if (signal(SIGSEGV, SIG_DFL) == SIG_ERR) { +diff --git a/test/zdtm/static/shm-mp.c b/test/zdtm/static/shm-mp.c +index 1929dac19..c95f3d84c 100644 +--- a/test/zdtm/static/shm-mp.c ++++ b/test/zdtm/static/shm-mp.c +@@ -33,10 +33,12 @@ static int check_prot(char *ptr, char val, int prot) + fail("PROT_READ bypassed"); + return -1; + } +- } else /* we come here on return from SIGSEGV handler */ ++ } else { ++ /* we come here on return from SIGSEGV handler */ + if (prot & PROT_READ) { +- fail("PROT_READ rejected"); +- return -1; ++ fail("PROT_READ rejected"); ++ return -1; ++ } + } + + if (!sigsetjmp(segv_ret, 1)) { +@@ -45,10 +47,12 @@ static int check_prot(char *ptr, char val, int prot) + fail("PROT_WRITE bypassed"); + return -1; + } +- } else /* we come here on return from SIGSEGV handler */ ++ } else { ++ /* we come here on return from SIGSEGV handler */ + if (prot & PROT_WRITE) { +- fail("PROT_WRITE rejected"); +- return -1; ++ fail("PROT_WRITE rejected"); ++ return -1; ++ } + } + + if (signal(SIGSEGV, SIG_DFL) == SIG_ERR) { +-- +2.34.1 + diff --git a/0050-seize-restore-cgroup-freezer-to-right-state.patch b/0050-seize-restore-cgroup-freezer-to-right-state.patch new file mode 100644 index 0000000..bdc37cf --- /dev/null +++ b/0050-seize-restore-cgroup-freezer-to-right-state.patch @@ -0,0 +1,72 @@ +From 5643067ce662e5ca1730f36e209f17eaf6818f90 Mon Sep 17 00:00:00 2001 +From: Liu Hua +Date: Fri, 5 Nov 2021 17:08:51 +0800 +Subject: [PATCH 050/120] seize: restore cgroup freezer to right state + +The new freezer_state is a complete equivalent of old freezer_thawed +except for the initial value. If old freezer_thawed was not initialized +it was 0 and in freezer_restore_state were threated as if we need to +freeze cgroup "back", thus before this patch if criu dump failed before +freezing dumpee, criu always freeze dumpee in cr_dump_finish which is +wrong. Switching to freezer_state initialized with FREEZER_ERROR fixes +the problem. + +v2: improve description, rename to origin_freezer_state + +Signed-off-by: Liu Hua +--- + criu/seize.c | 13 +++++++------ + 1 file changed, 7 insertions(+), 6 deletions(-) + +diff --git a/criu/seize.c b/criu/seize.c +index 95bf9ef0c..58564ca74 100644 +--- a/criu/seize.c ++++ b/criu/seize.c +@@ -131,11 +131,11 @@ static enum freezer_state get_freezer_state(int fd) + return get_freezer_v1_state(fd); + } + +-static bool freezer_thawed; ++static enum freezer_state origin_freezer_state = FREEZER_ERROR; + + const char *get_real_freezer_state(void) + { +- return freezer_thawed ? thawed : frozen; ++ return origin_freezer_state == THAWED ? thawed : frozen; + } + + static int freezer_write_state(int fd, enum freezer_state new_state) +@@ -192,7 +192,7 @@ static int freezer_restore_state(void) + int fd; + int ret; + +- if (!opts.freeze_cgroup || freezer_thawed) ++ if (!opts.freeze_cgroup || origin_freezer_state != FROZEN) + return 0; + + fd = freezer_open(); +@@ -481,9 +481,10 @@ static int freeze_processes(void) + close(fd); + return -1; + } +- if (state == THAWED) { +- freezer_thawed = true; + ++ origin_freezer_state = state == FREEZING ? FROZEN : state; ++ ++ if (state == THAWED) { + if (freezer_write_state(fd, FROZEN)) { + close(fd); + return -1; +@@ -534,7 +535,7 @@ static int freeze_processes(void) + } + + err: +- if (exit_code == 0 || freezer_thawed) ++ if (exit_code == 0 || origin_freezer_state == THAWED) + exit_code = freezer_write_state(fd, THAWED); + + if (close(fd)) { +-- +2.34.1 + diff --git a/0051-ci-Use-latest-Fedora-for-lint-ci-runs-again.patch b/0051-ci-Use-latest-Fedora-for-lint-ci-runs-again.patch new file mode 100644 index 0000000..8916f9d --- /dev/null +++ b/0051-ci-Use-latest-Fedora-for-lint-ci-runs-again.patch @@ -0,0 +1,30 @@ +From def608a7fefd89ccac455da7a966ad7cd766398c Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Wed, 24 Nov 2021 11:37:58 +0300 +Subject: [PATCH 051/120] ci: Use latest Fedora for lint ci runs again + +Now when we fixed clang-format complains in zdtm, let's switch to lates +clang-format available. This is effectively a revert of commit 07a2f0265 +("ci: use Fedora 34 for lint CI runs"). + +Signed-off-by: Pavel Tikhomirov +--- + .github/workflows/lint.yml | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml +index 49eb6aaac..50b241e9f 100644 +--- a/.github/workflows/lint.yml ++++ b/.github/workflows/lint.yml +@@ -6,7 +6,7 @@ jobs: + build: + runs-on: ubuntu-latest + container: +- image: registry.fedoraproject.org/fedora:34 ++ image: registry.fedoraproject.org/fedora:latest + steps: + - name: Install tools + run: sudo dnf -y install git make python3-flake8 ShellCheck clang-tools-extra which findutils +-- +2.34.1 + diff --git a/0052-crtools-ignore-SIGPIPE-in-swrk-mode.patch b/0052-crtools-ignore-SIGPIPE-in-swrk-mode.patch new file mode 100644 index 0000000..d31c470 --- /dev/null +++ b/0052-crtools-ignore-SIGPIPE-in-swrk-mode.patch @@ -0,0 +1,72 @@ +From 983464ffad11a0f8c5656492f3c342139acd2527 Mon Sep 17 00:00:00 2001 +From: Liu Hua +Date: Thu, 4 Nov 2021 10:04:22 +0800 +Subject: [PATCH 052/120] crtools: ignore SIGPIPE in swrk mode + +Criu ignores SIGPIPE in most cases except swrk mode. And in the +following situtation criu get killed by SIGPIPE and have no chance +to do cleanup: Connection to page server is lost when we do disk-less +migration, criu send PS_IOV_FLUSH via a broken connction in +disconnect_from_page_server. + +This patch let criu ignore SIGPIPE in all paths . + +Signed-off-by: Liu Hua +--- + criu/crtools.c | 33 ++++++++++++++++++--------------- + 1 file changed, 18 insertions(+), 15 deletions(-) + +diff --git a/criu/crtools.c b/criu/crtools.c +index 6a75cd1ea..81c0aa963 100644 +--- a/criu/crtools.c ++++ b/criu/crtools.c +@@ -106,6 +106,24 @@ int main(int argc, char *argv[], char *envp[]) + + log_set_loglevel(opts.log_level); + ++ /* ++ * There kernel might send us lethal signals in the following cases: ++ * 1) Writing a pipe which reader has disappeared. ++ * 2) Writing to a socket of type SOCK_STREAM which is no longer connected. ++ * We deal with write()/Send() failures on our own, and prefer not to get killed. ++ * So we ignore SIGPIPEs. ++ * ++ * Pipes are used in various places: ++ * 1) Receiving application page data ++ * 2) Transmitting data to the image streamer ++ * 3) Emitting logs (potentially to a pipe). ++ * Sockets are mainly used in transmitting memory data. ++ */ ++ if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) { ++ pr_perror("Failed to set a SIGPIPE signal ignore."); ++ return 1; ++ } ++ + if (optind < argc && !strcmp(argv[optind], "swrk")) { + if (argc != optind + 2) { + fprintf(stderr, "Usage: criu swrk \n"); +@@ -175,21 +193,6 @@ int main(int argc, char *argv[], char *envp[]) + } + } + +- /* +- * The kernel might send us lethal signals when writing to a pipe +- * which reader has disappeared. We deal with write() failures on our +- * own, and prefer not to get killed. So we ignore SIGPIPEs. +- * +- * Pipes are used in various places: +- * 1) Receiving application page data +- * 2) Transmitting data to the image streamer +- * 3) Emitting logs (potentially to a pipe). +- */ +- if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) { +- pr_perror("Failed to set a SIGPIPE signal ignore."); +- return 1; +- } +- + /* + * When a process group becomes an orphan, + * its processes are sent a SIGHUP signal +-- +2.34.1 + diff --git a/0053-ci-switch-to-centos-stream-8.patch b/0053-ci-switch-to-centos-stream-8.patch new file mode 100644 index 0000000..7eb543f --- /dev/null +++ b/0053-ci-switch-to-centos-stream-8.patch @@ -0,0 +1,29 @@ +From 21873e0efd64f023a0d7b472ceca1f394f83e58e Mon Sep 17 00:00:00 2001 +From: Adrian Reber +Date: Wed, 24 Nov 2021 16:13:01 +0000 +Subject: [PATCH 053/120] ci: switch to centos-stream-8 + +CentOS 8 goes EOL at the end of 2021. This switches our CentOS 8 based +tests to CentOS Stream 8 which should be supported until 2024. + +Signed-off-by: Adrian Reber +--- + .cirrus.yml | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/.cirrus.yml b/.cirrus.yml +index 235b9821e..ef0de54e9 100644 +--- a/.cirrus.yml ++++ b/.cirrus.yml +@@ -27,7 +27,7 @@ task: + + compute_engine_instance: + image_project: centos-cloud +- image: family/centos-8 ++ image: family/centos-stream-8 + platform: linux + cpu: 4 + memory: 8G +-- +2.34.1 + diff --git a/0054-check-cleanup-child-processes.patch b/0054-check-cleanup-child-processes.patch new file mode 100644 index 0000000..74a9322 --- /dev/null +++ b/0054-check-cleanup-child-processes.patch @@ -0,0 +1,68 @@ +From 6754b16c2e95766493ac27e4122a3b63867133f5 Mon Sep 17 00:00:00 2001 +From: Nicolas Viennot +Date: Fri, 19 Nov 2021 20:58:13 +0000 +Subject: [PATCH 054/120] check: cleanup child processes + +Always wait() for forked child processes. It avoid zombie processes in +containers that don't have an init process reaping orphans. + +Signed-off-by: Nicolas Viennot +--- + criu/cr-check.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/criu/cr-check.c b/criu/cr-check.c +index e46c93815..0320b445a 100644 +--- a/criu/cr-check.c ++++ b/criu/cr-check.c +@@ -575,6 +575,7 @@ static pid_t fork_and_ptrace_attach(int (*child_setup)(void)) + if (read(sk, &c, 1) != 1) { + close(sk); + kill(pid, SIGKILL); ++ waitpid(pid, NULL, 0); + pr_perror("read"); + return -1; + } +@@ -584,6 +585,7 @@ static pid_t fork_and_ptrace_attach(int (*child_setup)(void)) + if (ptrace(PTRACE_ATTACH, pid, NULL, NULL) == -1) { + pr_perror("Unable to ptrace the child"); + kill(pid, SIGKILL); ++ waitpid(pid, NULL, 0); + return -1; + } + +@@ -618,6 +620,7 @@ static int check_ptrace_peeksiginfo(void) + } + + kill(pid, SIGKILL); ++ waitpid(pid, NULL, 0); + return ret; + } + +@@ -768,6 +771,7 @@ static int check_special_mapping_mremap(void) + /* Probably, we're interrupted with a signal - cleanup */ + pr_err("Failed to wait for a child %d\n", errno); + kill(child, SIGKILL); ++ waitpid(child, NULL, 0); + return -1; + } + +@@ -806,6 +810,7 @@ static int check_ptrace_suspend_seccomp(void) + } + + kill(pid, SIGKILL); ++ waitpid(pid, NULL, 0); + return ret; + } + +@@ -846,6 +851,7 @@ static int check_ptrace_dump_seccomp_filters(void) + } + + kill(pid, SIGKILL); ++ waitpid(pid, NULL, 0); + return ret; + } + +-- +2.34.1 + diff --git a/0055-files-reg-fix-error-handling-in-open_path.patch b/0055-files-reg-fix-error-handling-in-open_path.patch new file mode 100644 index 0000000..54c3d97 --- /dev/null +++ b/0055-files-reg-fix-error-handling-in-open_path.patch @@ -0,0 +1,156 @@ +From ae3bf06242d6a8bb2a9946cba4ace96e202ee3f4 Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Thu, 13 Feb 2020 10:43:14 +0300 +Subject: [PATCH 055/120] files-reg: fix error handling in open_path + +1) On error paths need to close fd and unlock mutex. +2) Make rfi_remap return special return code to identify EEXIST from + linkat_hard, all other errors should be reported up. +3) Report unlinkat error as criu should not corrupt fs. + +Cherry-picked from Virtuozzo criu: +https://src.openvz.org/projects/OVZ/repos/criu/commits/fe1d0be14 + +Changes: use close_safe(), fix order in "Fake %s -> %s link" error +message. + +Signed-off-by: Pavel Tikhomirov +--- + criu/files-reg.c | 47 +++++++++++++++++++++++++++++++---------------- + 1 file changed, 31 insertions(+), 16 deletions(-) + +diff --git a/criu/files-reg.c b/criu/files-reg.c +index 679477c1c..4560f253e 100644 +--- a/criu/files-reg.c ++++ b/criu/files-reg.c +@@ -1867,6 +1867,9 @@ out: + * This routine properly resolves d's path handling ghost/link-remaps. + * The open_cb is a routine that does actual open, it differs for + * files, directories, fifos, etc. ++ * ++ * Return 0 on success, -1 on error and 1 to indicate soft error, which can be ++ * retried. + */ + + static int rfi_remap(struct reg_file_info *rfi, int *level) +@@ -1932,6 +1935,8 @@ out_root: + int errno_saved = errno; + rm_parent_dirs(mntns_root, path, *level); + errno = errno_saved; ++ if (errno == EEXIST) ++ return 1; + return -1; + } + +@@ -2008,11 +2013,12 @@ static bool validate_file(const int fd, const struct stat *fd_status, const stru + + int open_path(struct file_desc *d, int (*open_cb)(int mntns_root, struct reg_file_info *, void *), void *arg) + { +- int tmp, mntns_root, level = 0; ++ int tmp = -1, mntns_root, level = 0; + struct reg_file_info *rfi; + char *orig_path = NULL; + char path[PATH_MAX]; + int inh_fd = -1; ++ int ret; + + if (inherited_fd(d, &tmp)) + return tmp; +@@ -2049,14 +2055,9 @@ int open_path(struct file_desc *d, int (*open_cb)(int mntns_root, struct reg_fil + */ + orig_path = rfi->path; + rfi->path = rfi->remap->rpath; +- } else if (rfi_remap(rfi, &level) < 0) { ++ } else if ((ret = rfi_remap(rfi, &level)) == 1) { + static char tmp_path[PATH_MAX]; + +- if (errno != EEXIST) { +- pr_perror("Can't link %s -> %s", rfi->remap->rpath, rfi->path); +- return -1; +- } +- + /* + * The file whose name we're trying to create + * exists. Need to pick some other one, we're +@@ -2070,12 +2071,15 @@ int open_path(struct file_desc *d, int (*open_cb)(int mntns_root, struct reg_fil + orig_path = rfi->path; + rfi->path = tmp_path; + snprintf(tmp_path, sizeof(tmp_path), "%s.cr_link", orig_path); +- pr_debug("Fake %s -> %s link\n", rfi->path, rfi->remap->rpath); ++ pr_debug("Fake %s -> %s link\n", rfi->remap->rpath, rfi->path); + +- if (rfi_remap(rfi, &level) < 0) { ++ if (rfi_remap(rfi, &level)) { + pr_perror("Can't create even fake link!"); +- return -1; ++ goto err; + } ++ } else if (ret < 0) { ++ pr_perror("Can't link %s -> %s", rfi->remap->rpath, rfi->path); ++ goto err; + } + } + +@@ -2085,7 +2089,7 @@ ext: + if (tmp < 0) { + pr_perror("Can't open file %s", rfi->path); + close_safe(&inh_fd); +- return -1; ++ goto err; + } + close_safe(&inh_fd); + +@@ -2094,15 +2098,15 @@ ext: + + if (fstat(tmp, &st) < 0) { + pr_perror("Can't fstat opened file"); +- return -1; ++ goto err; + } + + if (!validate_file(tmp, &st, rfi)) +- return -1; ++ goto err; + + if (rfi->rfe->has_mode && (st.st_mode != rfi->rfe->mode)) { + pr_err("File %s has bad mode 0%o (expect 0%o)\n", rfi->path, (int)st.st_mode, rfi->rfe->mode); +- return -1; ++ goto err; + } + + /* +@@ -2115,7 +2119,11 @@ ext: + + if (rfi->remap) { + if (!rfi->remap->is_dir) { +- unlinkat(mntns_root, rfi->path, 0); ++ pr_debug("Unlink: %d:%s\n", rfi->rfe->mnt_id, rfi->path); ++ if (unlinkat(mntns_root, rfi->path, 0)) { ++ pr_perror("Failed to unlink the remap file"); ++ goto err; ++ } + rm_parent_dirs(mntns_root, rfi->path, level); + } + +@@ -2124,10 +2132,17 @@ ext: + if (orig_path) + rfi->path = orig_path; + +- if (restore_fown(tmp, rfi->rfe->fown)) ++ if (restore_fown(tmp, rfi->rfe->fown)) { ++ close(tmp); + return -1; ++ } + + return tmp; ++err: ++ if (rfi->remap) ++ mutex_unlock(remap_open_lock); ++ close_safe(&tmp); ++ return -1; + } + + int do_open_reg_noseek_flags(int ns_root_fd, struct reg_file_info *rfi, void *arg) +-- +2.34.1 + diff --git a/0056-files-reg-fix-error-handling-of-rm_parent_dirs.patch b/0056-files-reg-fix-error-handling-of-rm_parent_dirs.patch new file mode 100644 index 0000000..f1924b9 --- /dev/null +++ b/0056-files-reg-fix-error-handling-of-rm_parent_dirs.patch @@ -0,0 +1,116 @@ +From 2894e242562f3c639b6cb63f502d7445076d3db1 Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Thu, 13 Feb 2020 13:03:12 +0300 +Subject: [PATCH 056/120] files-reg: fix error handling of rm_parent_dirs + +If unlinkat fails it means that fs is in "corrupted" state - spoiled +with non-unlinked auxiliary directories. + +While on it add fixme note as this function can be racy and BUG_ON if +path contains double slashes. + +Cherry-picked from Virtuozzo criu: +https://src.openvz.org/projects/OVZ/repos/criu/commits/b7b4e69fd + +Changes: simplify while loop condition, remove confusing FIXME, remove +excess !count check in favour of while loop condition check + +Signed-off-by: Pavel Tikhomirov +--- + criu/files-reg.c | 45 ++++++++++++++++++++++++++++++--------------- + 1 file changed, 30 insertions(+), 15 deletions(-) + +diff --git a/criu/files-reg.c b/criu/files-reg.c +index 4560f253e..0e126a32e 100644 +--- a/criu/files-reg.c ++++ b/criu/files-reg.c +@@ -1792,30 +1792,42 @@ out: + return ret; + } + +-static void rm_parent_dirs(int mntns_root, char *path, int count) ++static int rm_parent_dirs(int mntns_root, char *path, int count) + { + char *p, *prev = NULL; ++ int ret = -1; + +- if (!count) +- return; +- +- while (count > 0) { +- count -= 1; ++ while (count-- > 0) { + p = strrchr(path, '/'); +- if (p) ++ if (p) { ++ /* We don't handle "//" in path */ ++ BUG_ON(prev && (prev - p == 1)); + *p = '\0'; ++ } else { ++ /* Inconsistent path and count */ ++ pr_perror("Can't strrchr \"/\" in \"%s\"/\"%s\"]" ++ " left count=%d\n", ++ path, prev ? prev + 1 : "", count + 1); ++ goto err; ++ } ++ + if (prev) + *prev = '/'; ++ prev = p; + +- if (unlinkat(mntns_root, path, AT_REMOVEDIR)) ++ if (unlinkat(mntns_root, path, AT_REMOVEDIR)) { + pr_perror("Can't remove %s AT %d", path, mntns_root); +- else +- pr_debug("Unlinked parent dir: %s AT %d\n", path, mntns_root); +- prev = p; ++ goto err; ++ } ++ pr_debug("Unlinked parent dir: %s AT %d\n", path, mntns_root); + } + ++ ret = 0; ++err: + if (prev) + *prev = '/'; ++ ++ return ret; + } + + /* Construct parent dir name and mkdir parent/grandparents if they're not exist */ +@@ -1847,6 +1859,7 @@ static int make_parent_dirs_if_need(int mntns_root, char *path) + err = mkdirat(mntns_root, path, 0777); + if (err && errno != EEXIST) { + pr_perror("Can't create dir: %s AT %d", path, mntns_root); ++ /* Failing anyway -> no retcode check */ + rm_parent_dirs(mntns_root, path, count); + count = -1; + goto out; +@@ -1933,10 +1946,11 @@ out_root: + + if (linkat_hard(mntns_root, rpath, mntns_root, path, rfi->remap->uid, rfi->remap->gid, 0) < 0) { + int errno_saved = errno; +- rm_parent_dirs(mntns_root, path, *level); +- errno = errno_saved; +- if (errno == EEXIST) ++ ++ if (!rm_parent_dirs(mntns_root, path, *level) && errno_saved == EEXIST) { ++ errno = errno_saved; + return 1; ++ } + return -1; + } + +@@ -2124,7 +2138,8 @@ ext: + pr_perror("Failed to unlink the remap file"); + goto err; + } +- rm_parent_dirs(mntns_root, rfi->path, level); ++ if (rm_parent_dirs(mntns_root, rfi->path, level)) ++ goto err; + } + + mutex_unlock(remap_open_lock); +-- +2.34.1 + diff --git a/0057-ghost-mount-allocate-remounted_rw-in-shmem-to-get-in.patch b/0057-ghost-mount-allocate-remounted_rw-in-shmem-to-get-in.patch new file mode 100644 index 0000000..6d9176b --- /dev/null +++ b/0057-ghost-mount-allocate-remounted_rw-in-shmem-to-get-in.patch @@ -0,0 +1,180 @@ +From 0a2d380e6b9110ec809101757c243ce316f4d1bb Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Thu, 13 Feb 2020 18:28:15 +0300 +Subject: [PATCH 057/120] ghost/mount: allocate remounted_rw in shmem to get + info from other processes + +Previousely remounted_rw was not shared between all processes on +restore, thus cleanup didn't got this info from rfi_remap and these +mounts were wrongly left writable after restore. + +Cherry-picked from Virtuozzo criu: +https://src.openvz.org/projects/OVZ/repos/criu/commits/3a1a592e7 + +Fixes: fd0a3cd9efb9 ("mount: remount ro mounts writable before +ghost-file restore") +Signed-off-by: Pavel Tikhomirov +--- + criu/include/mount.h | 4 ++-- + criu/mount.c | 32 ++++++++++++++++++++++---------- + criu/proc_parse.c | 2 +- + 3 files changed, 25 insertions(+), 13 deletions(-) + +diff --git a/criu/include/mount.h b/criu/include/mount.h +index 833a75ca0..7705279e4 100644 +--- a/criu/include/mount.h ++++ b/criu/include/mount.h +@@ -84,7 +84,7 @@ struct mount_info { + struct list_head postpone; + + int is_overmounted; +- int remounted_rw; ++ int *remounted_rw; + + void *private; /* associated filesystem data */ + }; +@@ -100,7 +100,7 @@ static inline int collect_binfmt_misc(void) + } + #endif + +-extern struct mount_info *mnt_entry_alloc(void); ++extern struct mount_info *mnt_entry_alloc(bool rst); + extern void mnt_entry_free(struct mount_info *mi); + + extern int __mntns_get_root_fd(pid_t pid); +diff --git a/criu/mount.c b/criu/mount.c +index 93725e526..d75ca5598 100644 +--- a/criu/mount.c ++++ b/criu/mount.c +@@ -27,6 +27,7 @@ + #include "external.h" + #include "clone-noasan.h" + #include "fdstore.h" ++#include "rst-malloc.h" + + #include "images/mnt.pb-c.h" + +@@ -1415,7 +1416,8 @@ err: + return -1; + } + +-static __maybe_unused int add_cr_time_mount(struct mount_info *root, char *fsname, const char *path, unsigned int s_dev) ++static __maybe_unused int add_cr_time_mount(struct mount_info *root, char *fsname, const char *path, unsigned int s_dev, ++ bool rst) + { + struct mount_info *mi, *t, *parent; + bool add_slash = false; +@@ -1434,7 +1436,7 @@ static __maybe_unused int add_cr_time_mount(struct mount_info *root, char *fsnam + } + } + +- mi = mnt_entry_alloc(); ++ mi = mnt_entry_alloc(rst); + if (!mi) + return -1; + +@@ -2723,7 +2725,7 @@ err_root: + return exit_code; + } + +-struct mount_info *mnt_entry_alloc() ++struct mount_info *mnt_entry_alloc(bool rst) + { + struct mount_info *new; + +@@ -2734,6 +2736,13 @@ struct mount_info *mnt_entry_alloc() + + new = xzalloc(sizeof(struct mount_info)); + if (new) { ++ if (rst) { ++ new->remounted_rw = shmalloc(sizeof(int)); ++ if (!new->remounted_rw) { ++ xfree(new); ++ return NULL; ++ } ++ } + new->fd = -1; + new->is_overmounted = -1; + INIT_LIST_HEAD(&new->children); +@@ -2956,7 +2965,7 @@ static int collect_mnt_from_image(struct mount_info **head, struct mount_info ** + if (ret <= 0) + break; + +- pm = mnt_entry_alloc(); ++ pm = mnt_entry_alloc(true); + if (!pm) + goto err; + +@@ -3234,7 +3243,7 @@ static int populate_mnt_ns(void) + { + int ret; + +- root_yard_mp = mnt_entry_alloc(); ++ root_yard_mp = mnt_entry_alloc(true); + if (!root_yard_mp) + return -1; + +@@ -3247,7 +3256,7 @@ static int populate_mnt_ns(void) + #ifdef CONFIG_BINFMT_MISC_VIRTUALIZED + if (!opts.has_binfmt_misc && !list_empty(&binfmt_misc_list)) { + /* Add to mount tree. Generic code will mount it later */ +- ret = add_cr_time_mount(root_yard_mp, "binfmt_misc", BINFMT_MISC_HOME, 0); ++ ret = add_cr_time_mount(root_yard_mp, "binfmt_misc", BINFMT_MISC_HOME, 0, true); + if (ret) + return -1; + } +@@ -3697,7 +3706,7 @@ int collect_mnt_namespaces(bool for_dump) + ret = -1; + goto err; + } else if (ret > 0 && add_cr_time_mount(ns->mnt.mntinfo_tree, "binfmt_misc", BINFMT_MISC_HOME, +- s_dev) < 0) { ++ s_dev, false) < 0) { + ret = -1; + goto err; + } +@@ -3838,7 +3847,10 @@ int try_remount_writable(struct mount_info *mi, bool ns) + if (!ns) + remounted = REMOUNTED_RW_SERVICE; + +- if (mi->flags & MS_RDONLY && !(mi->remounted_rw & remounted)) { ++ /* All mounts in mntinfo list should have it on restore */ ++ BUG_ON(mi->remounted_rw == NULL); ++ ++ if (mi->flags & MS_RDONLY && !(*mi->remounted_rw & remounted)) { + if (mnt_is_overmounted(mi)) { + pr_err("The mount %d is overmounted so paths are invisible\n", mi->mnt_id); + return -1; +@@ -3861,7 +3873,7 @@ int try_remount_writable(struct mount_info *mi, bool ns) + if (call_helper_process(ns_remount_writable, mi)) + return -1; + } +- mi->remounted_rw |= remounted; ++ *mi->remounted_rw |= remounted; + } + + return 0; +@@ -3876,7 +3888,7 @@ static int __remount_readonly_mounts(struct ns_id *ns) + if (ns && mi->nsid != ns) + continue; + +- if (!(mi->remounted_rw && REMOUNTED_RW)) ++ if (!(*mi->remounted_rw && REMOUNTED_RW)) + continue; + + /* +diff --git a/criu/proc_parse.c b/criu/proc_parse.c +index 8a9ce3a37..094f9b84e 100644 +--- a/criu/proc_parse.c ++++ b/criu/proc_parse.c +@@ -1541,7 +1541,7 @@ struct mount_info *parse_mountinfo(pid_t pid, struct ns_id *nsid, bool for_dump) + int ret = -1; + char *fsname = NULL; + +- new = mnt_entry_alloc(); ++ new = mnt_entry_alloc(false); + if (!new) + goto end; + +-- +2.34.1 + diff --git a/0058-files-reg-temporary-remount-writable-the-mount-we-do.patch b/0058-files-reg-temporary-remount-writable-the-mount-we-do.patch new file mode 100644 index 0000000..a0e31f2 --- /dev/null +++ b/0058-files-reg-temporary-remount-writable-the-mount-we-do.patch @@ -0,0 +1,46 @@ +From 3aca580025b38aa043f6ef82f24ecab2d2d258e9 Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Thu, 13 Feb 2020 18:26:52 +0300 +Subject: [PATCH 058/120] files-reg: temporary remount writable the mount we do + unlink on + +Previousely I din't mention this case because we had bad error handling +in ghost cleanup path. + +Without these patch but with proper error handling for unlink we have an +error in mntns_ghost01 test: + +Error (criu/files-reg.c:2269): Failed to unlink the remap file: +Read-only file system + +Cherry-picked from Virtuozzo criu: +https://src.openvz.org/projects/OVZ/repos/criu/commits/151c859e1 + +Changes: check lookup_mnt_id return for NULL + +Fixes: fd0a3cd9efb9 ("mount: remount ro mounts writable before +ghost-file restore") +Signed-off-by: Pavel Tikhomirov +--- + criu/files-reg.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/criu/files-reg.c b/criu/files-reg.c +index 0e126a32e..57403d2c6 100644 +--- a/criu/files-reg.c ++++ b/criu/files-reg.c +@@ -2133,6 +2133,11 @@ ext: + + if (rfi->remap) { + if (!rfi->remap->is_dir) { ++ struct mount_info *mi = lookup_mnt_id(rfi->rfe->mnt_id); ++ ++ if (mi && try_remount_writable(mi, true)) ++ goto err; ++ + pr_debug("Unlink: %d:%s\n", rfi->rfe->mnt_id, rfi->path); + if (unlinkat(mntns_root, rfi->path, 0)) { + pr_perror("Failed to unlink the remap file"); +-- +2.34.1 + diff --git a/0059-zdtm-add-ro-mount-check-after-c-r-to-mntns_ghost01.patch b/0059-zdtm-add-ro-mount-check-after-c-r-to-mntns_ghost01.patch new file mode 100644 index 0000000..52d3cb8 --- /dev/null +++ b/0059-zdtm-add-ro-mount-check-after-c-r-to-mntns_ghost01.patch @@ -0,0 +1,47 @@ +From d137057e215de10ee772852126075ce9575e908e Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Tue, 30 Nov 2021 19:03:29 +0300 +Subject: [PATCH 059/120] zdtm: add ro-mount check after c/r to mntns_ghost01 + +This is a test for "ghost/mount: allocate remounted_rw in shmem to get +info from other processes" patch, without the patch test fails with: + + ############# Test zdtm/static/mntns_ghost01 FAIL at result check ############## + Test output: ================================ + 16:15:19.607: 5: ERR: mntns_ghost01.c:95: open for write on rofs -> 7 (errno = 11 (Resource temporarily unavailable)) + 16:15:19.607: 4: FAIL: mntns_ghost01.c:121: Test died (errno = 11 (Resource temporarily unavailable)) + +Signed-off-by: Pavel Tikhomirov +--- + test/zdtm/static/mntns_ghost01.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/test/zdtm/static/mntns_ghost01.c b/test/zdtm/static/mntns_ghost01.c +index 20397d543..2cc2270dd 100644 +--- a/test/zdtm/static/mntns_ghost01.c ++++ b/test/zdtm/static/mntns_ghost01.c +@@ -6,6 +6,7 @@ + #include + #include + #include ++#include + + #include "zdtmtst.h" + +@@ -89,6 +90,13 @@ int main(int argc, char **argv) + return 1; + } + ++ fd = open(ghost_path, O_CREAT | O_WRONLY, 0600); ++ if (fd >= 0 || errno != EROFS) { ++ pr_perror("open for write on rofs -> %d", fd); ++ close(fd); ++ return 1; ++ } ++ + return 0; + } + +-- +2.34.1 + diff --git a/0060-clang-format-disable-wrong-struct-pointer-declaratio.patch b/0060-clang-format-disable-wrong-struct-pointer-declaratio.patch new file mode 100644 index 0000000..65596ec --- /dev/null +++ b/0060-clang-format-disable-wrong-struct-pointer-declaratio.patch @@ -0,0 +1,115 @@ +From bb9c27c217a9b995c101cbb2023c4084ce76a07b Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Thu, 25 Nov 2021 16:51:55 +0300 +Subject: [PATCH 060/120] clang-format: disable wrong struct pointer + declaration format + +When we declare struct and at the same time declare variable pointer of +this struct type, it looks like clang-format threats "*" as a +multiplication operator instead of indirection (pointer declaration) +operator and puts spaces on both sides, which looks wrong. + +Signed-off-by: Pavel Tikhomirov +--- + criu/fdstore.c | 4 +++- + test/zdtm/lib/test.c | 4 +++- + test/zdtm/static/child_subreaper_and_reparent.c | 4 +++- + test/zdtm/static/child_subreaper_existing_child.c | 4 +++- + test/zdtm/static/file_fown.c | 4 +++- + 5 files changed, 15 insertions(+), 5 deletions(-) + +diff --git a/criu/fdstore.c b/criu/fdstore.c +index 77935484f..65264a511 100644 +--- a/criu/fdstore.c ++++ b/criu/fdstore.c +@@ -13,10 +13,12 @@ + #include "rst-malloc.h" + #include "log.h" + ++/* clang-format off */ + static struct fdstore_desc { + int next_id; + mutex_t lock; /* to protect a peek offset */ +-} * desc; ++} *desc; ++/* clang-format on */ + + int fdstore_init(void) + { +diff --git a/test/zdtm/lib/test.c b/test/zdtm/lib/test.c +index 81da81eba..57eb42046 100644 +--- a/test/zdtm/lib/test.c ++++ b/test/zdtm/lib/test.c +@@ -20,9 +20,11 @@ + #include "ns.h" + + futex_t sig_received; ++/* clang-format off */ + static struct { + futex_t stage; +-} * test_shared_state; ++} *test_shared_state; ++/* clang-format on */ + + enum { + TEST_INIT_STAGE = 0, +diff --git a/test/zdtm/static/child_subreaper_and_reparent.c b/test/zdtm/static/child_subreaper_and_reparent.c +index ba03517ba..c71778ae9 100644 +--- a/test/zdtm/static/child_subreaper_and_reparent.c ++++ b/test/zdtm/static/child_subreaper_and_reparent.c +@@ -19,11 +19,13 @@ enum { + TEST_EXIT, + }; + ++/* clang-format off */ + struct shared { + futex_t fstate; + int parent_before_cr; + int parent_after_cr; +-} * sh; ++} *sh; ++/* clang-format on */ + + int orphan(void) + { +diff --git a/test/zdtm/static/child_subreaper_existing_child.c b/test/zdtm/static/child_subreaper_existing_child.c +index 4805aa41d..92d22bc4a 100644 +--- a/test/zdtm/static/child_subreaper_existing_child.c ++++ b/test/zdtm/static/child_subreaper_existing_child.c +@@ -18,10 +18,12 @@ enum { + TEST_EXIT, + }; + ++/* clang-format off */ + struct shared { + futex_t fstate; + int ppid_after_reparent; +-} * sh; ++} *sh; ++/* clang-format on */ + + int orphan(void) + { +diff --git a/test/zdtm/static/file_fown.c b/test/zdtm/static/file_fown.c +index eb42a826e..2c5ba82c2 100644 +--- a/test/zdtm/static/file_fown.c ++++ b/test/zdtm/static/file_fown.c +@@ -22,12 +22,14 @@ + const char *test_doc = "Check for signal delivery on file owners"; + const char *test_author = "Cyrill Gorcunov "; + ++/* clang-format off */ + struct params { + int sigio; + int pipe_flags[2]; + int pipe_pid[2]; + int pipe_sig[2]; +-} * shared; ++} *shared; ++/* clang-format on */ + + static void signal_handler_io(int status) + { +-- +2.34.1 + diff --git a/0061-ci-Run-cross-compile-on-debian-stable.patch b/0061-ci-Run-cross-compile-on-debian-stable.patch new file mode 100644 index 0000000..de26c0d --- /dev/null +++ b/0061-ci-Run-cross-compile-on-debian-stable.patch @@ -0,0 +1,181 @@ +From 9134e859293a3980b25cff043273be1d41ab7d53 Mon Sep 17 00:00:00 2001 +From: Radostin Stoyanov +Date: Sat, 4 Dec 2021 16:18:26 +0000 +Subject: [PATCH 061/120] ci: Run cross compile on debian stable + +The current debian stable release is Bullseye, not Buster. However, we +can use the 'stable' release instead. This would allow the CI to +automatically pick up updates in the future. + +Signed-off-by: Radostin Stoyanov +--- + .github/workflows/cross-compile-daily.yml | 2 +- + .github/workflows/cross-compile.yml | 2 +- + scripts/build/Dockerfile.aarch64-cross.tmpl | 1 - + ...aarch64-cross.hdr => Dockerfile.aarch64-stable-cross.hdr} | 0 + scripts/build/Dockerfile.aarch64-stable-cross.tmpl | 1 + + scripts/build/Dockerfile.armv7-cross.tmpl | 1 - + ...ile.armv7-cross.hdr => Dockerfile.armv7-stable-cross.hdr} | 0 + scripts/build/Dockerfile.armv7-stable-cross.tmpl | 1 + + scripts/build/Dockerfile.mips64el-cross.tmpl | 1 - + ...ps64el-cross.hdr => Dockerfile.mips64el-stable-cross.hdr} | 0 + scripts/build/Dockerfile.mips64el-stable-cross.tmpl | 1 + + scripts/build/Dockerfile.ppc64-cross.tmpl | 1 - + ...ile.ppc64-cross.hdr => Dockerfile.ppc64-stable-cross.hdr} | 0 + scripts/build/Dockerfile.ppc64-stable-cross.tmpl | 1 + + .../{Dockerfile.cross.tmpl => Dockerfile.stable-cross.tmpl} | 5 ++--- + scripts/build/Makefile | 2 +- + 16 files changed, 9 insertions(+), 10 deletions(-) + delete mode 120000 scripts/build/Dockerfile.aarch64-cross.tmpl + rename scripts/build/{Dockerfile.aarch64-cross.hdr => Dockerfile.aarch64-stable-cross.hdr} (100%) + create mode 120000 scripts/build/Dockerfile.aarch64-stable-cross.tmpl + delete mode 120000 scripts/build/Dockerfile.armv7-cross.tmpl + rename scripts/build/{Dockerfile.armv7-cross.hdr => Dockerfile.armv7-stable-cross.hdr} (100%) + create mode 120000 scripts/build/Dockerfile.armv7-stable-cross.tmpl + delete mode 120000 scripts/build/Dockerfile.mips64el-cross.tmpl + rename scripts/build/{Dockerfile.mips64el-cross.hdr => Dockerfile.mips64el-stable-cross.hdr} (100%) + create mode 120000 scripts/build/Dockerfile.mips64el-stable-cross.tmpl + delete mode 120000 scripts/build/Dockerfile.ppc64-cross.tmpl + rename scripts/build/{Dockerfile.ppc64-cross.hdr => Dockerfile.ppc64-stable-cross.hdr} (100%) + create mode 120000 scripts/build/Dockerfile.ppc64-stable-cross.tmpl + rename scripts/build/{Dockerfile.cross.tmpl => Dockerfile.stable-cross.tmpl} (88%) + +diff --git a/.github/workflows/cross-compile-daily.yml b/.github/workflows/cross-compile-daily.yml +index 701213276..927ddced2 100644 +--- a/.github/workflows/cross-compile-daily.yml ++++ b/.github/workflows/cross-compile-daily.yml +@@ -10,7 +10,7 @@ jobs: + runs-on: ubuntu-latest + strategy: + matrix: +- target: [armv7-cross, aarch64-cross, ppc64-cross, mips64el-cross] ++ target: [armv7-stable-cross, aarch64-stable-cross, ppc64-stable-cross, mips64el-stable-cross] + branches: [criu-dev, master] + + steps: +diff --git a/.github/workflows/cross-compile.yml b/.github/workflows/cross-compile.yml +index 90862e7ab..c6745d43e 100644 +--- a/.github/workflows/cross-compile.yml ++++ b/.github/workflows/cross-compile.yml +@@ -8,7 +8,7 @@ jobs: + runs-on: ubuntu-latest + strategy: + matrix: +- target: [armv7-cross, aarch64-cross, ppc64-cross, mips64el-cross] ++ target: [armv7-stable-cross, aarch64-stable-cross, ppc64-stable-cross, mips64el-stable-cross] + + steps: + - uses: actions/checkout@v2 +diff --git a/scripts/build/Dockerfile.aarch64-cross.tmpl b/scripts/build/Dockerfile.aarch64-cross.tmpl +deleted file mode 120000 +index 50eff9213..000000000 +--- a/scripts/build/Dockerfile.aarch64-cross.tmpl ++++ /dev/null +@@ -1 +0,0 @@ +-Dockerfile.cross.tmpl +\ No newline at end of file +diff --git a/scripts/build/Dockerfile.aarch64-cross.hdr b/scripts/build/Dockerfile.aarch64-stable-cross.hdr +similarity index 100% +rename from scripts/build/Dockerfile.aarch64-cross.hdr +rename to scripts/build/Dockerfile.aarch64-stable-cross.hdr +diff --git a/scripts/build/Dockerfile.aarch64-stable-cross.tmpl b/scripts/build/Dockerfile.aarch64-stable-cross.tmpl +new file mode 120000 +index 000000000..81ef22980 +--- /dev/null ++++ b/scripts/build/Dockerfile.aarch64-stable-cross.tmpl +@@ -0,0 +1 @@ ++Dockerfile.stable-cross.tmpl +\ No newline at end of file +diff --git a/scripts/build/Dockerfile.armv7-cross.tmpl b/scripts/build/Dockerfile.armv7-cross.tmpl +deleted file mode 120000 +index 50eff9213..000000000 +--- a/scripts/build/Dockerfile.armv7-cross.tmpl ++++ /dev/null +@@ -1 +0,0 @@ +-Dockerfile.cross.tmpl +\ No newline at end of file +diff --git a/scripts/build/Dockerfile.armv7-cross.hdr b/scripts/build/Dockerfile.armv7-stable-cross.hdr +similarity index 100% +rename from scripts/build/Dockerfile.armv7-cross.hdr +rename to scripts/build/Dockerfile.armv7-stable-cross.hdr +diff --git a/scripts/build/Dockerfile.armv7-stable-cross.tmpl b/scripts/build/Dockerfile.armv7-stable-cross.tmpl +new file mode 120000 +index 000000000..81ef22980 +--- /dev/null ++++ b/scripts/build/Dockerfile.armv7-stable-cross.tmpl +@@ -0,0 +1 @@ ++Dockerfile.stable-cross.tmpl +\ No newline at end of file +diff --git a/scripts/build/Dockerfile.mips64el-cross.tmpl b/scripts/build/Dockerfile.mips64el-cross.tmpl +deleted file mode 120000 +index 50eff9213..000000000 +--- a/scripts/build/Dockerfile.mips64el-cross.tmpl ++++ /dev/null +@@ -1 +0,0 @@ +-Dockerfile.cross.tmpl +\ No newline at end of file +diff --git a/scripts/build/Dockerfile.mips64el-cross.hdr b/scripts/build/Dockerfile.mips64el-stable-cross.hdr +similarity index 100% +rename from scripts/build/Dockerfile.mips64el-cross.hdr +rename to scripts/build/Dockerfile.mips64el-stable-cross.hdr +diff --git a/scripts/build/Dockerfile.mips64el-stable-cross.tmpl b/scripts/build/Dockerfile.mips64el-stable-cross.tmpl +new file mode 120000 +index 000000000..81ef22980 +--- /dev/null ++++ b/scripts/build/Dockerfile.mips64el-stable-cross.tmpl +@@ -0,0 +1 @@ ++Dockerfile.stable-cross.tmpl +\ No newline at end of file +diff --git a/scripts/build/Dockerfile.ppc64-cross.tmpl b/scripts/build/Dockerfile.ppc64-cross.tmpl +deleted file mode 120000 +index 50eff9213..000000000 +--- a/scripts/build/Dockerfile.ppc64-cross.tmpl ++++ /dev/null +@@ -1 +0,0 @@ +-Dockerfile.cross.tmpl +\ No newline at end of file +diff --git a/scripts/build/Dockerfile.ppc64-cross.hdr b/scripts/build/Dockerfile.ppc64-stable-cross.hdr +similarity index 100% +rename from scripts/build/Dockerfile.ppc64-cross.hdr +rename to scripts/build/Dockerfile.ppc64-stable-cross.hdr +diff --git a/scripts/build/Dockerfile.ppc64-stable-cross.tmpl b/scripts/build/Dockerfile.ppc64-stable-cross.tmpl +new file mode 120000 +index 000000000..81ef22980 +--- /dev/null ++++ b/scripts/build/Dockerfile.ppc64-stable-cross.tmpl +@@ -0,0 +1 @@ ++Dockerfile.stable-cross.tmpl +\ No newline at end of file +diff --git a/scripts/build/Dockerfile.cross.tmpl b/scripts/build/Dockerfile.stable-cross.tmpl +similarity index 88% +rename from scripts/build/Dockerfile.cross.tmpl +rename to scripts/build/Dockerfile.stable-cross.tmpl +index 8b95fbb1c..6a68cd1ca 100644 +--- a/scripts/build/Dockerfile.cross.tmpl ++++ b/scripts/build/Dockerfile.stable-cross.tmpl +@@ -1,9 +1,8 @@ + COPY scripts/ci/apt-install /bin/apt-install + + # Add the cross compiler sources +-RUN echo "deb http://deb.debian.org/debian/ buster main" >> /etc/apt/sources.list && \ +- dpkg --add-architecture ${DEBIAN_ARCH} && \ +- apt-install emdebian-archive-keyring ++RUN echo "deb http://deb.debian.org/debian/ stable main" >> /etc/apt/sources.list && \ ++ dpkg --add-architecture ${DEBIAN_ARCH} + + RUN apt-install \ + crossbuild-essential-${DEBIAN_ARCH} \ +diff --git a/scripts/build/Makefile b/scripts/build/Makefile +index 62e3a9920..a436c2839 100644 +--- a/scripts/build/Makefile ++++ b/scripts/build/Makefile +@@ -1,5 +1,5 @@ + ARCHES := x86_64 fedora-asan fedora-rawhide centos7 armv7hf centos8 +-NON_CLANG := armv7-cross aarch64-cross ppc64-cross mips64el-cross ++NON_CLANG := armv7-stable-cross aarch64-stable-cross ppc64-stable-cross mips64el-stable-cross + CREATE_DOCKERFILES := $(ARCHES) $(NON_CLANG) + TARGETS := $(ARCHES) alpine archlinux + TARGETS_CLANG := $(addsuffix $(TARGETS),-clang) +-- +2.34.1 + diff --git a/0062-ci-Run-cross-compile-with-debian-testing.patch b/0062-ci-Run-cross-compile-with-debian-testing.patch new file mode 100644 index 0000000..af00285 --- /dev/null +++ b/0062-ci-Run-cross-compile-with-debian-testing.patch @@ -0,0 +1,197 @@ +From e16ea6a3c23fb8a5f0ed8c19052ee9b4140108cf Mon Sep 17 00:00:00 2001 +From: Radostin Stoyanov +Date: Sat, 4 Dec 2021 16:31:34 +0000 +Subject: [PATCH 062/120] ci: Run cross compile with debian testing + +Debian testing has newer compiler version and running +cross compilation tests would allow us to catch any compilation +errors early. + +Signed-off-by: Radostin Stoyanov +--- + .github/workflows/cross-compile.yml | 11 ++++- + .../Dockerfile.aarch64-testing-cross.hdr | 5 +++ + .../Dockerfile.aarch64-testing-cross.tmpl | 1 + + .../build/Dockerfile.armv7-testing-cross.hdr | 6 +++ + .../build/Dockerfile.armv7-testing-cross.tmpl | 1 + + .../Dockerfile.mips64el-testing-cross.hdr | 6 +++ + .../Dockerfile.mips64el-testing-cross.tmpl | 1 + + .../build/Dockerfile.ppc64-testing-cross.hdr | 5 +++ + .../build/Dockerfile.ppc64-testing-cross.tmpl | 1 + + scripts/build/Dockerfile.testing-cross.tmpl | 42 +++++++++++++++++++ + scripts/build/Makefile | 4 +- + 11 files changed, 81 insertions(+), 2 deletions(-) + create mode 100644 scripts/build/Dockerfile.aarch64-testing-cross.hdr + create mode 120000 scripts/build/Dockerfile.aarch64-testing-cross.tmpl + create mode 100644 scripts/build/Dockerfile.armv7-testing-cross.hdr + create mode 120000 scripts/build/Dockerfile.armv7-testing-cross.tmpl + create mode 100644 scripts/build/Dockerfile.mips64el-testing-cross.hdr + create mode 120000 scripts/build/Dockerfile.mips64el-testing-cross.tmpl + create mode 100644 scripts/build/Dockerfile.ppc64-testing-cross.hdr + create mode 120000 scripts/build/Dockerfile.ppc64-testing-cross.tmpl + create mode 100644 scripts/build/Dockerfile.testing-cross.tmpl + +diff --git a/.github/workflows/cross-compile.yml b/.github/workflows/cross-compile.yml +index c6745d43e..eec6eb577 100644 +--- a/.github/workflows/cross-compile.yml ++++ b/.github/workflows/cross-compile.yml +@@ -8,7 +8,16 @@ jobs: + runs-on: ubuntu-latest + strategy: + matrix: +- target: [armv7-stable-cross, aarch64-stable-cross, ppc64-stable-cross, mips64el-stable-cross] ++ target: [ ++ armv7-stable-cross, ++ armv7-testing-cross, ++ aarch64-stable-cross, ++ aarch64-testing-cross, ++ ppc64-stable-cross, ++ ppc64-testing-cross, ++ mips64el-stable-cross, ++ mips64el-testing-cross ++ ] + + steps: + - uses: actions/checkout@v2 +diff --git a/scripts/build/Dockerfile.aarch64-testing-cross.hdr b/scripts/build/Dockerfile.aarch64-testing-cross.hdr +new file mode 100644 +index 000000000..c61d2af27 +--- /dev/null ++++ b/scripts/build/Dockerfile.aarch64-testing-cross.hdr +@@ -0,0 +1,5 @@ ++FROM docker.io/dockcross/base:latest ++ ++ENV ARCH=aarch64 ++ENV DEBIAN_ARCH=arm64 ++ENV CROSS_TRIPLET=aarch64-linux-gnu +diff --git a/scripts/build/Dockerfile.aarch64-testing-cross.tmpl b/scripts/build/Dockerfile.aarch64-testing-cross.tmpl +new file mode 120000 +index 000000000..c1dd38b21 +--- /dev/null ++++ b/scripts/build/Dockerfile.aarch64-testing-cross.tmpl +@@ -0,0 +1 @@ ++Dockerfile.testing-cross.tmpl +\ No newline at end of file +diff --git a/scripts/build/Dockerfile.armv7-testing-cross.hdr b/scripts/build/Dockerfile.armv7-testing-cross.hdr +new file mode 100644 +index 000000000..f96dc51f7 +--- /dev/null ++++ b/scripts/build/Dockerfile.armv7-testing-cross.hdr +@@ -0,0 +1,6 @@ ++FROM docker.io/dockcross/base:latest ++ ++ENV ARCH=arm ++ENV SUBARCH=armv7 ++ENV DEBIAN_ARCH=armhf ++ENV CROSS_TRIPLET=arm-linux-gnueabihf +diff --git a/scripts/build/Dockerfile.armv7-testing-cross.tmpl b/scripts/build/Dockerfile.armv7-testing-cross.tmpl +new file mode 120000 +index 000000000..c1dd38b21 +--- /dev/null ++++ b/scripts/build/Dockerfile.armv7-testing-cross.tmpl +@@ -0,0 +1 @@ ++Dockerfile.testing-cross.tmpl +\ No newline at end of file +diff --git a/scripts/build/Dockerfile.mips64el-testing-cross.hdr b/scripts/build/Dockerfile.mips64el-testing-cross.hdr +new file mode 100644 +index 000000000..e78c94aa5 +--- /dev/null ++++ b/scripts/build/Dockerfile.mips64el-testing-cross.hdr +@@ -0,0 +1,6 @@ ++FROM dockcross/base:latest ++ ++ENV ARCH=mips ++ENV SUBARCH=mips ++ENV DEBIAN_ARCH=mips64el ++ENV CROSS_TRIPLET=mips64el-linux-gnuabi64 +diff --git a/scripts/build/Dockerfile.mips64el-testing-cross.tmpl b/scripts/build/Dockerfile.mips64el-testing-cross.tmpl +new file mode 120000 +index 000000000..c1dd38b21 +--- /dev/null ++++ b/scripts/build/Dockerfile.mips64el-testing-cross.tmpl +@@ -0,0 +1 @@ ++Dockerfile.testing-cross.tmpl +\ No newline at end of file +diff --git a/scripts/build/Dockerfile.ppc64-testing-cross.hdr b/scripts/build/Dockerfile.ppc64-testing-cross.hdr +new file mode 100644 +index 000000000..38547ac55 +--- /dev/null ++++ b/scripts/build/Dockerfile.ppc64-testing-cross.hdr +@@ -0,0 +1,5 @@ ++FROM dockcross/base:latest ++ ++ENV ARCH=ppc64 ++ENV DEBIAN_ARCH=ppc64el ++ENV CROSS_TRIPLET=powerpc64le-linux-gnu +diff --git a/scripts/build/Dockerfile.ppc64-testing-cross.tmpl b/scripts/build/Dockerfile.ppc64-testing-cross.tmpl +new file mode 120000 +index 000000000..c1dd38b21 +--- /dev/null ++++ b/scripts/build/Dockerfile.ppc64-testing-cross.tmpl +@@ -0,0 +1 @@ ++Dockerfile.testing-cross.tmpl +\ No newline at end of file +diff --git a/scripts/build/Dockerfile.testing-cross.tmpl b/scripts/build/Dockerfile.testing-cross.tmpl +new file mode 100644 +index 000000000..1d5565310 +--- /dev/null ++++ b/scripts/build/Dockerfile.testing-cross.tmpl +@@ -0,0 +1,42 @@ ++COPY scripts/ci/apt-install /bin/apt-install ++ ++# Add the cross compiler sources ++RUN echo "deb http://deb.debian.org/debian/ testing main" >> /etc/apt/sources.list && \ ++ dpkg --add-architecture ${DEBIAN_ARCH} ++ ++RUN apt-install \ ++ crossbuild-essential-${DEBIAN_ARCH} \ ++ libc6-dev-${DEBIAN_ARCH}-cross \ ++ libc6-${DEBIAN_ARCH}-cross \ ++ libbz2-dev:${DEBIAN_ARCH} \ ++ libexpat1-dev:${DEBIAN_ARCH} \ ++ ncurses-dev:${DEBIAN_ARCH} \ ++ libssl-dev:${DEBIAN_ARCH} \ ++ protobuf-c-compiler \ ++ protobuf-compiler \ ++ python3-protobuf \ ++ libnl-3-dev:${DEBIAN_ARCH} \ ++ libprotobuf-dev:${DEBIAN_ARCH} \ ++ libnet-dev:${DEBIAN_ARCH} \ ++ libprotobuf-c-dev:${DEBIAN_ARCH} \ ++ libcap-dev:${DEBIAN_ARCH} \ ++ libaio-dev:${DEBIAN_ARCH} \ ++ libnl-route-3-dev:${DEBIAN_ARCH} ++ ++ENV CROSS_COMPILE=${CROSS_TRIPLET}- \ ++ CROSS_ROOT=/usr/${CROSS_TRIPLET} \ ++ AS=/usr/bin/${CROSS_TRIPLET}-as \ ++ AR=/usr/bin/${CROSS_TRIPLET}-ar \ ++ CC=/usr/bin/${CROSS_TRIPLET}-gcc \ ++ CPP=/usr/bin/${CROSS_TRIPLET}-cpp \ ++ CXX=/usr/bin/${CROSS_TRIPLET}-g++ \ ++ LD=/usr/bin/${CROSS_TRIPLET}-ld \ ++ FC=/usr/bin/${CROSS_TRIPLET}-gfortran ++ ++ENV PATH="${PATH}:${CROSS_ROOT}/bin" \ ++ PKG_CONFIG_PATH=/usr/lib/${CROSS_TRIPLET}/pkgconfig ++ ++COPY . /criu ++WORKDIR /criu ++ ++RUN make mrproper && date && make -j $(nproc) zdtm && date +diff --git a/scripts/build/Makefile b/scripts/build/Makefile +index a436c2839..b24fc80ea 100644 +--- a/scripts/build/Makefile ++++ b/scripts/build/Makefile +@@ -1,5 +1,7 @@ + ARCHES := x86_64 fedora-asan fedora-rawhide centos7 armv7hf centos8 +-NON_CLANG := armv7-stable-cross aarch64-stable-cross ppc64-stable-cross mips64el-stable-cross ++STABLE_CROSS_ARCHES := armv7-stable-cross aarch64-stable-cross ppc64-stable-cross mips64el-stable-cross ++TESTING_CROSS_ARCHES := armv7-testing-cross aarch64-testing-cross ppc64-testing-cross mips64el-testing-cross ++NON_CLANG := $(TESTING_CROSS_ARCHES) $(STABLE_CROSS_ARCHES) + CREATE_DOCKERFILES := $(ARCHES) $(NON_CLANG) + TARGETS := $(ARCHES) alpine archlinux + TARGETS_CLANG := $(addsuffix $(TARGETS),-clang) +-- +2.34.1 + diff --git a/0063-make-Explicitly-enable-FPU-on-ARMv7-builds.patch b/0063-make-Explicitly-enable-FPU-on-ARMv7-builds.patch new file mode 100644 index 0000000..79084c6 --- /dev/null +++ b/0063-make-Explicitly-enable-FPU-on-ARMv7-builds.patch @@ -0,0 +1,48 @@ +From 8887dfb9174a42b699b1fde2dbf9033f66c8363b Mon Sep 17 00:00:00 2001 +From: Salvatore Bonaccorso +Date: Sat, 4 Dec 2021 16:59:51 +0000 +Subject: [PATCH 063/120] make: Explicitly enable FPU on ARMv7 builds + +Starting with gcc-11, Debian's armhf compiler no longer builds with +a default -mfpu= option. Instead it enables the FPU via an extension +to the -march flag (--with-arch=armv7-a+fp). criu's Makefile explicitly +passes its own -march=armv7-a setting, which overrides the +fp default, +so we end up with no FPU: + + cc1: error: '-mfloat-abi=hard': selected architecture lacks an FPU + +Signed-off-by: Radostin Stoyanov +--- + Makefile | 2 +- + test/zdtm/Makefile.inc | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/Makefile b/Makefile +index d35012615..c0d008371 100644 +--- a/Makefile ++++ b/Makefile +@@ -39,7 +39,7 @@ ifeq ($(ARCH),arm) + endif + + ifeq ($(ARMV),7) +- USERCFLAGS += -march=armv7-a ++ USERCFLAGS += -march=armv7-a+fp + endif + + ifeq ($(ARMV),8) +diff --git a/test/zdtm/Makefile.inc b/test/zdtm/Makefile.inc +index 69154fdc9..d34523315 100644 +--- a/test/zdtm/Makefile.inc ++++ b/test/zdtm/Makefile.inc +@@ -25,7 +25,7 @@ ifeq ($(ARCH),arm) + ifeq ($(ARMV),6) + USERCFLAGS += -march=armv6 + else ifeq ($(ARMV),7) +- USERCFLAGS += -march=armv7-a ++ USERCFLAGS += -march=armv7-a+fp + else ifeq ($(ARMV),8) + # To build aarch32 on armv8 Travis-CI (see criu Makefile) + USERCFLAGS += -march=armv7-a +-- +2.34.1 + diff --git a/0064-ci-disable-broken-tests-until-fixed.patch b/0064-ci-disable-broken-tests-until-fixed.patch new file mode 100644 index 0000000..c90b156 --- /dev/null +++ b/0064-ci-disable-broken-tests-until-fixed.patch @@ -0,0 +1,59 @@ +From e7efdffa340d0169b4fb18d9ebba214f546ade5d Mon Sep 17 00:00:00 2001 +From: Adrian Reber +Date: Fri, 3 Dec 2021 16:48:36 +0000 +Subject: [PATCH 064/120] ci: disable broken tests until fixed + +Broken tests are being tracked at + + * https://github.com/checkpoint-restore/criu/issues/1669 + * https://github.com/checkpoint-restore/criu/issues/1635 + +This also enables previously disabled BPF related tests: + + * https://github.com/checkpoint-restore/criu/issues/1354 + +Signed-off-by: Adrian Reber +--- + scripts/ci/vagrant.sh | 6 +++--- + test/jenkins/criu-fault.sh | 8 ++++++++ + 2 files changed, 11 insertions(+), 3 deletions(-) + +diff --git a/scripts/ci/vagrant.sh b/scripts/ci/vagrant.sh +index 839b100c8..25343f96c 100755 +--- a/scripts/ci/vagrant.sh ++++ b/scripts/ci/vagrant.sh +@@ -50,9 +50,9 @@ fedora-no-vdso() { + vagrant reload + ssh default cat /proc/cmdline + ssh default 'cd /vagrant; tar xf criu.tar; cd criu; make -j 4' +- # BPF tests are failing see: https://github.com/checkpoint-restore/criu/issues/1354 +- # Needs to be fixed, skip for now +- ssh default 'cd /vagrant/criu/test; sudo ./zdtm.py run -a --keep-going -x zdtm/static/bpf_hash -x zdtm/static/bpf_array' ++ # Disabling tests which are broken on 5.15 ++ # https://github.com/checkpoint-restore/criu/issues/1669 ++ ssh default 'cd /vagrant/criu/test; sudo ./zdtm.py run -a --keep-going -x zdtm/static/socket_close_data -x zdtm/static/socket_close_data01 -x zdtm/static/fifo_upon_unix_socket01 -x zdtm/static/sk-unix-mntns -x zdtm/static/fifo_upon_unix_socket00 -x zdtm/static/socket-ext -x zdtm/static/sk-unix01 -x zdtm/static/socket_dgram_data -x zdtm/static/sockets_dgram -x zdtm/static/sk-unix-dgram-ghost' + # This test (pidfd_store_sk) requires pidfd_getfd syscall which is guaranteed in Fedora 33. + # It is also skipped from -a because it runs in RPC mode only + ssh default 'cd /vagrant/criu/test; sudo ./zdtm.py run -t zdtm/transition/pidfd_store_sk --rpc --pre 2' +diff --git a/test/jenkins/criu-fault.sh b/test/jenkins/criu-fault.sh +index a8c3a5cf7..bff40aed5 100755 +--- a/test/jenkins/criu-fault.sh ++++ b/test/jenkins/criu-fault.sh +@@ -28,6 +28,14 @@ fi + ./test/zdtm.py run -t zdtm/static/maps04 --fault 131 --keep-going --report report --pre 2:1 || fail + ./test/zdtm.py run -t zdtm/transition/maps008 --fault 131 --keep-going --report report --pre 2:1 || fail + ./test/zdtm.py run -t zdtm/static/maps01 --fault 132 -f h || fail ++ ++# Error injection with --fault 134 fails on newer CPUs used in Circle CI on EC2 ++# Skip the --fault 134 tests ++# https://github.com/checkpoint-restore/criu/issues/1635 ++if [ -n "$CIRCLECI" ]; then ++ exit 0 ++fi ++ + # 134 is corrupting extended registers set, should run in a sub-thread (fpu03) + # without restore (that will check if parasite corrupts extended registers) + ./test/zdtm.py run -t zdtm/static/fpu03 --fault 134 -f h --norst || fail +-- +2.34.1 + diff --git a/0065-test-do-not-use-keep-going-for-single-zdtm-tests.patch b/0065-test-do-not-use-keep-going-for-single-zdtm-tests.patch new file mode 100644 index 0000000..d28c641 --- /dev/null +++ b/0065-test-do-not-use-keep-going-for-single-zdtm-tests.patch @@ -0,0 +1,101 @@ +From 3b81160c57cde29450d27edb383deb6e19188dbf Mon Sep 17 00:00:00 2001 +From: Adrian Reber +Date: Sun, 5 Dec 2021 16:45:20 +0000 +Subject: [PATCH 065/120] test: do not use --keep-going for single zdtm tests + +Looking at CI logs there are often messages like: + + "[WARNING] Option --keep-going is more useful when running multiple tests" + +This commit removes '--keep-going' from single zdtm test runs. + +Signed-off-by: Adrian Reber +--- + test/jenkins/criu-dedup.sh | 10 +++++----- + test/jenkins/criu-fault.sh | 18 +++++++++--------- + test/jenkins/criu-fcg.sh | 12 ++++++------ + 3 files changed, 20 insertions(+), 20 deletions(-) + +diff --git a/test/jenkins/criu-dedup.sh b/test/jenkins/criu-dedup.sh +index 0041496d8..edb1b653d 100755 +--- a/test/jenkins/criu-dedup.sh ++++ b/test/jenkins/criu-dedup.sh +@@ -9,8 +9,8 @@ prep + # Additionally run these tests as they touch a lot of + # memory and it makes sense to additionally check it + # with delays between iterations +-./test/zdtm.py run -t zdtm/transition/maps007 --keep-going --report report -f h --pre 8:.1 --dedup || fail +-./test/zdtm.py run -t zdtm/static/mem-touch --keep-going --report report -f h --pre 8:.1 --dedup || fail +-./test/zdtm.py run -t zdtm/transition/maps008 --keep-going --report report -f h --pre 8:.1 --dedup || fail +-./test/zdtm.py run -t zdtm/transition/maps007 --keep-going --report report -f h --pre 8:.1 --noauto-dedup || fail +-./test/zdtm.py run -t zdtm/static/mem-touch --keep-going --report report -f h --pre 8:.1 --noauto-dedup || fail ++./test/zdtm.py run -t zdtm/transition/maps007 --report report -f h --pre 8:.1 --dedup || fail ++./test/zdtm.py run -t zdtm/static/mem-touch --report report -f h --pre 8:.1 --dedup || fail ++./test/zdtm.py run -t zdtm/transition/maps008 --report report -f h --pre 8:.1 --dedup || fail ++./test/zdtm.py run -t zdtm/transition/maps007 --report report -f h --pre 8:.1 --noauto-dedup || fail ++./test/zdtm.py run -t zdtm/static/mem-touch --report report -f h --pre 8:.1 --noauto-dedup || fail +diff --git a/test/jenkins/criu-fault.sh b/test/jenkins/criu-fault.sh +index bff40aed5..0c5c180e9 100755 +--- a/test/jenkins/criu-fault.sh ++++ b/test/jenkins/criu-fault.sh +@@ -4,10 +4,10 @@ + set -e + source `dirname $0`/criu-lib.sh + prep +-./test/zdtm.py run -t zdtm/static/env00 --fault 1 --keep-going --report report -f h || fail +-./test/zdtm.py run -t zdtm/static/unlink_fstat00 --fault 2 --keep-going --report report -f h || fail +-./test/zdtm.py run -t zdtm/static/maps00 --fault 3 --keep-going --report report -f h || fail +-./test/zdtm.py run -t zdtm/static/inotify_irmap --fault 128 --keep-going --pre 2 -f uns || fail ++./test/zdtm.py run -t zdtm/static/env00 --fault 1 --report report -f h || fail ++./test/zdtm.py run -t zdtm/static/unlink_fstat00 --fault 2 --report report -f h || fail ++./test/zdtm.py run -t zdtm/static/maps00 --fault 3 --report report -f h || fail ++./test/zdtm.py run -t zdtm/static/inotify_irmap --fault 128 --pre 2 -f uns || fail + ./test/zdtm.py run -t zdtm/static/env00 --fault 129 -f uns || fail + ./test/zdtm.py run -t zdtm/transition/fork --fault 130 -f h || fail + ./test/zdtm.py run -t zdtm/static/vdso01 --fault 127 || fail +@@ -17,16 +17,16 @@ if [ "${COMPAT_TEST}" != "y" ] ; then + ./test/zdtm.py run -t zdtm/static/vdso01 --fault 133 -f h || fail + fi + +-./test/zdtm.py run -t zdtm/static/mntns_ghost --fault 2 --keep-going --report report || fail +-./test/zdtm.py run -t zdtm/static/mntns_ghost --fault 4 --keep-going --report report || fail ++./test/zdtm.py run -t zdtm/static/mntns_ghost --fault 2 --report report || fail ++./test/zdtm.py run -t zdtm/static/mntns_ghost --fault 4 --report report || fail + + ./test/zdtm.py run -t zdtm/static/mntns_ghost --fault 6 --report report || fail + ./test/zdtm.py run -t zdtm/static/mntns_link_remap --fault 6 --report report || fail + ./test/zdtm.py run -t zdtm/static/unlink_fstat03 --fault 6 --report report || fail + +-./test/zdtm.py run -t zdtm/static/env00 --fault 5 --keep-going --report report || fail +-./test/zdtm.py run -t zdtm/static/maps04 --fault 131 --keep-going --report report --pre 2:1 || fail +-./test/zdtm.py run -t zdtm/transition/maps008 --fault 131 --keep-going --report report --pre 2:1 || fail ++./test/zdtm.py run -t zdtm/static/env00 --fault 5 --report report || fail ++./test/zdtm.py run -t zdtm/static/maps04 --fault 131 --report report --pre 2:1 || fail ++./test/zdtm.py run -t zdtm/transition/maps008 --fault 131 --report report --pre 2:1 || fail + ./test/zdtm.py run -t zdtm/static/maps01 --fault 132 -f h || fail + + # Error injection with --fault 134 fails on newer CPUs used in Circle CI on EC2 +diff --git a/test/jenkins/criu-fcg.sh b/test/jenkins/criu-fcg.sh +index ca5054f5e..81395b7ba 100755 +--- a/test/jenkins/criu-fcg.sh ++++ b/test/jenkins/criu-fcg.sh +@@ -6,10 +6,10 @@ source `dirname $0`/criu-lib.sh + prep + mount_tmpfs_to_dump + +-./test/zdtm.py run -t zdtm/transition/thread-bomb -f h --keep-going --report report --freezecg zdtm:f || fail +-./test/zdtm.py run -t zdtm/transition/thread-bomb -f h --keep-going --report report --freezecg zdtm:f --pre 3 || fail +-./test/zdtm.py run -t zdtm/transition/thread-bomb -f h --keep-going --report report --freezecg zdtm:f --norst || fail ++./test/zdtm.py run -t zdtm/transition/thread-bomb -f h --report report --freezecg zdtm:f || fail ++./test/zdtm.py run -t zdtm/transition/thread-bomb -f h --report report --freezecg zdtm:f --pre 3 || fail ++./test/zdtm.py run -t zdtm/transition/thread-bomb -f h --report report --freezecg zdtm:f --norst || fail + +-./test/zdtm.py run -t zdtm/transition/thread-bomb -f h --keep-going --report report --freezecg zdtm:t || fail +-./test/zdtm.py run -t zdtm/transition/thread-bomb -f h --keep-going --report report --freezecg zdtm:t --pre 3 || fail +-./test/zdtm.py run -t zdtm/transition/thread-bomb -f h --keep-going --report report --freezecg zdtm:t --norst || fail ++./test/zdtm.py run -t zdtm/transition/thread-bomb -f h --report report --freezecg zdtm:t || fail ++./test/zdtm.py run -t zdtm/transition/thread-bomb -f h --report report --freezecg zdtm:t --pre 3 || fail ++./test/zdtm.py run -t zdtm/transition/thread-bomb -f h --report report --freezecg zdtm:t --norst || fail +-- +2.34.1 + diff --git a/0066-files-reg-try-dump_ghost_remap-if-link-remap-failed-.patch b/0066-files-reg-try-dump_ghost_remap-if-link-remap-failed-.patch new file mode 100644 index 0000000..258818a --- /dev/null +++ b/0066-files-reg-try-dump_ghost_remap-if-link-remap-failed-.patch @@ -0,0 +1,137 @@ +From 94d3c9694f16342e52afe1f3de7077bac9eaf198 Mon Sep 17 00:00:00 2001 +From: ianlang +Date: Fri, 3 Dec 2021 15:15:30 +0800 +Subject: [PATCH 066/120] files-reg: try dump_ghost_remap if link-remap failed + with error ENOENT + +An issue with dumping deleted reg files in overlayfs: + +After deleting a file originated from lower layer in merged dir, +fstat() on the /proc/$pid/map_files symlink returns st_nlink=1, while +linkat() fails with errno ENOENT. + +Signed-off-by: langyenan +--- + criu/files-reg.c | 42 +++++++++++++++++++++++++++++++++++------ + criu/include/fs-magic.h | 4 ++++ + 2 files changed, 40 insertions(+), 6 deletions(-) + +diff --git a/criu/files-reg.c b/criu/files-reg.c +index 57403d2c6..6759e00e5 100644 +--- a/criu/files-reg.c ++++ b/criu/files-reg.c +@@ -959,7 +959,25 @@ void free_link_remaps(void) + } + static int linkat_hard(int odir, char *opath, int ndir, char *npath, uid_t uid, gid_t gid, int flags); + +-static int create_link_remap(char *path, int len, int lfd, u32 *idp, struct ns_id *nsid, const struct stat *st) ++static void check_overlayfs_fallback(char *path, const struct fd_parms *parms, bool *fallback) ++{ ++ if (!fallback || parms->fs_type != OVERLAYFS_SUPER_MAGIC) ++ return; ++ ++ /* ++ * In overlayFS, linkat() fails with ENOENT if the removed file is ++ * originated from lower layer. The cause of failure is that linkat() ++ * sees the file has st_nlink=0, which is different than st_nlink=1 we ++ * got from earlier fstat() on lfd. By setting *fb=true, we will fall ++ * back to dump_ghost_remap() as it is what should have been done to ++ * removed files with st_nlink=0. ++ */ ++ pr_info("Unable to link-remap %s on overlayFS, fall back to dump_ghost_remap\n", path); ++ *fallback = true; ++} ++ ++static int create_link_remap(char *path, int len, int lfd, u32 *idp, struct ns_id *nsid, const struct fd_parms *parms, ++ bool *fallback) + { + char link_name[PATH_MAX], *tmp; + FileEntry fe = FILE_ENTRY__INIT; +@@ -967,6 +985,7 @@ static int create_link_remap(char *path, int len, int lfd, u32 *idp, struct ns_i + FownEntry fwn = FOWN_ENTRY__INIT; + int mntns_root; + int ret; ++ const struct stat *ost = &parms->stat; + + if (!opts.link_remap_ok) { + pr_err("Can't create link remap for %s. " +@@ -1005,11 +1024,12 @@ static int create_link_remap(char *path, int len, int lfd, u32 *idp, struct ns_i + mntns_root = mntns_get_root_fd(nsid); + + again: +- ret = linkat_hard(lfd, "", mntns_root, link_name, st->st_uid, st->st_gid, AT_EMPTY_PATH); ++ ret = linkat_hard(lfd, "", mntns_root, link_name, ost->st_uid, ost->st_gid, AT_EMPTY_PATH); + if (ret < 0 && errno == ENOENT) { + /* Use grand parent, if parent directory does not exist. */ + if (trim_last_parent(link_name) < 0) { + pr_err("trim failed: @%s@\n", link_name); ++ check_overlayfs_fallback(path, parms, fallback); + return -1; + } + goto again; +@@ -1028,12 +1048,13 @@ again: + return pb_write_one(img_from_set(glob_imgset, CR_FD_FILES), &fe, PB_FILE); + } + +-static int dump_linked_remap(char *path, int len, const struct stat *ost, int lfd, u32 id, struct ns_id *nsid) ++static int dump_linked_remap(char *path, int len, const struct fd_parms *parms, int lfd, u32 id, struct ns_id *nsid, ++ bool *fallback) + { + u32 lid; + RemapFilePathEntry rpe = REMAP_FILE_PATH_ENTRY__INIT; + +- if (create_link_remap(path, len, lfd, &lid, nsid, ost)) ++ if (create_link_remap(path, len, lfd, &lid, nsid, parms, fallback)) + return -1; + + rpe.orig_id = id; +@@ -1150,6 +1171,7 @@ static int check_path_remap(struct fd_link *link, const struct fd_parms *parms, + struct stat pst; + const struct stat *ost = &parms->stat; + int flags = 0; ++ bool fallback = false; + + if (parms->fs_type == PROC_SUPER_MAGIC) { + /* The file points to /proc/pid/ where pid is a dead +@@ -1239,7 +1261,7 @@ static int check_path_remap(struct fd_link *link, const struct fd_parms *parms, + * links on it) to have some persistent name at hands. + */ + pr_debug("Dump silly-rename linked remap for %x\n", id); +- return dump_linked_remap(rpath + 1, plen - 1, ost, lfd, id, nsid); ++ return dump_linked_remap(rpath + 1, plen - 1, parms, lfd, id, nsid, NULL); + } + + mntns_root = mntns_get_root_fd(nsid); +@@ -1260,7 +1282,15 @@ static int check_path_remap(struct fd_link *link, const struct fd_parms *parms, + + if (errno == ENOENT) { + link_strip_deleted(link); +- return dump_linked_remap(rpath + 1, plen - 1, ost, lfd, id, nsid); ++ ret = dump_linked_remap(rpath + 1, plen - 1, parms, lfd, id, nsid, &fallback); ++ if (ret < 0 && fallback) { ++ /* fallback is true only if following conditions are true: ++ * 1. linkat() inside dump_linked_remap() failed with ENOENT ++ * 2. parms->fs_type == overlayFS ++ */ ++ return dump_ghost_remap(rpath + 1, ost, lfd, id, nsid); ++ } ++ return ret; + } + + pr_perror("Can't stat path"); +diff --git a/criu/include/fs-magic.h b/criu/include/fs-magic.h +index 46ac8aa27..ad34f4891 100644 +--- a/criu/include/fs-magic.h ++++ b/criu/include/fs-magic.h +@@ -53,4 +53,8 @@ + #define AUTOFS_SUPER_MAGIC 0x0187 + #endif + ++#ifndef OVERLAYFS_SUPER_MAGIC ++#define OVERLAYFS_SUPER_MAGIC 0x794c7630 ++#endif ++ + #endif /* __CR_FS_MAGIC_H__ */ +-- +2.34.1 + diff --git a/0067-util-make-page-server-IPv6-safe.patch b/0067-util-make-page-server-IPv6-safe.patch new file mode 100644 index 0000000..4e5ce61 --- /dev/null +++ b/0067-util-make-page-server-IPv6-safe.patch @@ -0,0 +1,63 @@ +From b9ae48172fff77d41b5cf19d334ccbe002ac0686 Mon Sep 17 00:00:00 2001 +From: Adrian Reber +Date: Tue, 7 Dec 2021 09:10:14 +0000 +Subject: [PATCH 067/120] util: make page-server IPv6 safe + +The function run_tcp_server() was the last place CRIU was still using +the IPv4 only function inet_ntoa(). It was only used during a print, so +that it did not really break anything, but with this commit the output +is now no longer: + + Accepted connection from 0.0.0.0:58396 + +but correctly displaying the IPv6 address + + Accepted connection from ::1:58398 + +if connecting via IPv6. + +Signed-off-by: Adrian Reber +--- + criu/util.c | 15 +++++++++++---- + 1 file changed, 11 insertions(+), 4 deletions(-) + +diff --git a/criu/util.c b/criu/util.c +index 2917102fd..822822186 100644 +--- a/criu/util.c ++++ b/criu/util.c +@@ -1107,7 +1107,7 @@ out: + int run_tcp_server(bool daemon_mode, int *ask, int cfd, int sk) + { + int ret; +- struct sockaddr_in caddr; ++ struct sockaddr_storage caddr; + socklen_t clen = sizeof(caddr); + + if (daemon_mode) { +@@ -1135,13 +1135,20 @@ int run_tcp_server(bool daemon_mode, int *ask, int cfd, int sk) + return -1; + + if (sk >= 0) { ++ char port[6]; ++ char address[INET6_ADDRSTRLEN]; + *ask = accept(sk, (struct sockaddr *)&caddr, &clen); + if (*ask < 0) { + pr_perror("Can't accept connection to server"); + goto err; +- } else +- pr_info("Accepted connection from %s:%u\n", inet_ntoa(caddr.sin_addr), +- (int)ntohs(caddr.sin_port)); ++ } ++ ret = getnameinfo((struct sockaddr *)&caddr, clen, address, sizeof(address), port, sizeof(port), ++ NI_NUMERICHOST | NI_NUMERICSERV); ++ if (ret) { ++ pr_err("Failed converting address: %s\n", gai_strerror(ret)); ++ goto err; ++ } ++ pr_info("Accepted connection from %s:%s\n", address, port); + close(sk); + } + +-- +2.34.1 + diff --git a/0068-sk-unix-Fix-TCP_ESTABLISHED-checks-in-unix-sockets.patch b/0068-sk-unix-Fix-TCP_ESTABLISHED-checks-in-unix-sockets.patch new file mode 100644 index 0000000..58c9fe2 --- /dev/null +++ b/0068-sk-unix-Fix-TCP_ESTABLISHED-checks-in-unix-sockets.patch @@ -0,0 +1,48 @@ +From 4cf1336062e06a4d042771d59eac851ea7273a15 Mon Sep 17 00:00:00 2001 +From: Bui Quang Minh +Date: Thu, 2 Dec 2021 23:01:33 +0700 +Subject: [PATCH 068/120] sk-unix: Fix TCP_ESTABLISHED checks in unix sockets + +Since commit 83301b5367a98 ("af_unix: Set TCP_ESTABLISHED for datagram sockets +too") in Linux kernel, SOCK_DGRAM unix sockets can have TCP_ESTABLISHED state +when connected. So we need to fix checks that assume SOCK_DRAM sockets cannot +have TCP_ESTABLISHED state. + +Signed-off-by: Bui Quang Minh +--- + criu/sk-unix.c | 10 +++------- + 1 file changed, 3 insertions(+), 7 deletions(-) + +diff --git a/criu/sk-unix.c b/criu/sk-unix.c +index a819473b4..d3402c3ac 100644 +--- a/criu/sk-unix.c ++++ b/criu/sk-unix.c +@@ -460,7 +460,7 @@ static int dump_one_unix_fd(int lfd, uint32_t id, const struct fd_parms *p) + pr_warn("Shutdown mismatch %u:%d -> %u:%d\n", ue->ino, ue->shutdown, peer->sd.ino, + peer->shutdown); + } +- } else if (ue->state == TCP_ESTABLISHED) { ++ } else if (ue->state == TCP_ESTABLISHED && ue->type != SOCK_DGRAM) { + const struct unix_sk_listen_icon *e; + + e = lookup_unix_listen_icons(ue->ino); +@@ -1851,14 +1851,10 @@ static int open_unixsk_standalone(struct unix_sk_info *ui, int *new_fd) + + close(sks[1]); + sk = sks[0]; +- } else if (ui->ue->state == TCP_ESTABLISHED && queuer && queuer->ue->ino == FAKE_INO) { ++ } else if ((ui->ue->state == TCP_ESTABLISHED && ui->ue->type == SOCK_STREAM) && queuer && ++ queuer->ue->ino == FAKE_INO) { + int ret, sks[2]; + +- if (ui->ue->type != SOCK_STREAM) { +- pr_err("Non-stream socket %u in established state\n", ui->ue->ino); +- return -1; +- } +- + if (ui->ue->shutdown != SK_SHUTDOWN__BOTH) { + pr_err("Wrong shutdown/peer state for %u\n", ui->ue->ino); + return -1; +-- +2.34.1 + diff --git a/0069-ci-Enable-disabled-unix-socket-related-tests.patch b/0069-ci-Enable-disabled-unix-socket-related-tests.patch new file mode 100644 index 0000000..8041d45 --- /dev/null +++ b/0069-ci-Enable-disabled-unix-socket-related-tests.patch @@ -0,0 +1,34 @@ +From 1cfca8ec896ed84a6ab8878489854fe0529e14a5 Mon Sep 17 00:00:00 2001 +From: Bui Quang Minh +Date: Tue, 7 Dec 2021 23:40:12 +0700 +Subject: [PATCH 069/120] ci: Enable disabled unix socket related tests + +As the unix socket broken tests have been fixed in the pull request + +https://github.com/checkpoint-restore/criu/pull/1680 + +We re-enable these tests. + +Signed-off-by: Bui Quang Minh +--- + scripts/ci/vagrant.sh | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +diff --git a/scripts/ci/vagrant.sh b/scripts/ci/vagrant.sh +index 25343f96c..40c8416e1 100755 +--- a/scripts/ci/vagrant.sh ++++ b/scripts/ci/vagrant.sh +@@ -50,9 +50,7 @@ fedora-no-vdso() { + vagrant reload + ssh default cat /proc/cmdline + ssh default 'cd /vagrant; tar xf criu.tar; cd criu; make -j 4' +- # Disabling tests which are broken on 5.15 +- # https://github.com/checkpoint-restore/criu/issues/1669 +- ssh default 'cd /vagrant/criu/test; sudo ./zdtm.py run -a --keep-going -x zdtm/static/socket_close_data -x zdtm/static/socket_close_data01 -x zdtm/static/fifo_upon_unix_socket01 -x zdtm/static/sk-unix-mntns -x zdtm/static/fifo_upon_unix_socket00 -x zdtm/static/socket-ext -x zdtm/static/sk-unix01 -x zdtm/static/socket_dgram_data -x zdtm/static/sockets_dgram -x zdtm/static/sk-unix-dgram-ghost' ++ ssh default 'cd /vagrant/criu/test; sudo ./zdtm.py run -a --keep-going' + # This test (pidfd_store_sk) requires pidfd_getfd syscall which is guaranteed in Fedora 33. + # It is also skipped from -a because it runs in RPC mode only + ssh default 'cd /vagrant/criu/test; sudo ./zdtm.py run -t zdtm/transition/pidfd_store_sk --rpc --pre 2' +-- +2.34.1 + diff --git a/0070-ci-install-procps-in-Alpine.patch b/0070-ci-install-procps-in-Alpine.patch new file mode 100644 index 0000000..95197f8 --- /dev/null +++ b/0070-ci-install-procps-in-Alpine.patch @@ -0,0 +1,29 @@ +From 010016dc43cd6fec27ba27c636cfd7aa02549433 Mon Sep 17 00:00:00 2001 +From: Radostin Stoyanov +Date: Fri, 10 Dec 2021 15:35:29 +0000 +Subject: [PATCH 070/120] ci: install procps in Alpine + +The version of ps in Alpine image by default is very limited. +It is based on the one from busybox and doesn't support options +such as '-p'. + +Signed-off-by: Radostin Stoyanov +--- + scripts/build/Dockerfile.alpine | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/scripts/build/Dockerfile.alpine b/scripts/build/Dockerfile.alpine +index a6579c0bb..cab72e8a1 100644 +--- a/scripts/build/Dockerfile.alpine ++++ b/scripts/build/Dockerfile.alpine +@@ -6,6 +6,7 @@ RUN apk update && apk add \ + bash \ + build-base \ + coreutils \ ++ procps \ + git \ + gnutls-dev \ + libaio-dev \ +-- +2.34.1 + diff --git a/0071-test-another-try-to-correctly-fix-the-kernel-version.patch b/0071-test-another-try-to-correctly-fix-the-kernel-version.patch new file mode 100644 index 0000000..65cb863 --- /dev/null +++ b/0071-test-another-try-to-correctly-fix-the-kernel-version.patch @@ -0,0 +1,34 @@ +From 1ddc8a3dca2881bef56855bb7741e8814c3753f6 Mon Sep 17 00:00:00 2001 +From: Adrian Reber +Date: Fri, 3 Dec 2021 16:59:56 +0000 +Subject: [PATCH 071/120] test: another try to correctly fix the kernel version + +We try to disable time namespace based testing for kernels older than +5.11. But we fail to come up with the correct if condition. + +This changes (major <= 5) to (major < 5). There are no kernels with +major > 5 so currently the time namespace based are never run. This +should finally change it to run time namespace based tests on kernel +versions newer than 5.10. + +Signed-off-by: Adrian Reber +--- + test/zdtm_ct.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/test/zdtm_ct.c b/test/zdtm_ct.c +index e8d45a9e7..e4b17a512 100644 +--- a/test/zdtm_ct.c ++++ b/test/zdtm_ct.c +@@ -61,7 +61,7 @@ static int create_timens() + if (sscanf(buf.release, "%u.%u", &major, &minor) != 2) + return -1; + +- if ((major <= 5) || (major == 5 && minor < 11)) { ++ if ((major < 5) || (major == 5 && minor < 11)) { + fprintf(stderr, "timens isn't supported on %s\n", buf.release); + return 0; + } +-- +2.34.1 + diff --git a/0072-x86-compel-fault-inject-bound-xsave-features-set.patch b/0072-x86-compel-fault-inject-bound-xsave-features-set.patch new file mode 100644 index 0000000..aef5330 --- /dev/null +++ b/0072-x86-compel-fault-inject-bound-xsave-features-set.patch @@ -0,0 +1,59 @@ +From b270ce214216d6b74d8e3a6e9c6cbfc0c6ffbddd Mon Sep 17 00:00:00 2001 +From: Alexander Mikhalitsyn +Date: Mon, 13 Dec 2021 15:19:50 +0300 +Subject: [PATCH 072/120] x86/compel/fault-inject: bound xsave features set + +Since +e2e8be37 ("x86/compel/fault-inject: Add a fault-injection for corrupting extended regset") +we doing fault-injection test for C/R of threads register set by filling tasks +xsave structures with the garbage. But there are some features for which that's not +safe. It leads to failures like described in #1635 + +In this particular case we meet the problem with PKRU feature, the problem +that after corrupting pkru registers we may restrict access to some vma areas, +so, after that process with the parasite injected get's segfault and crashes. + +Let's manually specify which features is save to fill with the garbage by +keeping proper XFEATURE_MASK_FAULTINJ mask value. + +Fixes: e2e8be37 ("x86/compel/fault-inject: Add a fault-injection for corrupting extended regset") + +https://github.com/checkpoint-restore/criu/issues/1635 + +Signed-off-by: Alexander Mikhalitsyn +--- + compel/arch/x86/src/lib/include/uapi/asm/fpu.h | 5 +++++ + compel/arch/x86/src/lib/infect.c | 1 + + 2 files changed, 6 insertions(+) + +diff --git a/compel/arch/x86/src/lib/include/uapi/asm/fpu.h b/compel/arch/x86/src/lib/include/uapi/asm/fpu.h +index a16b658af..c8ebda097 100644 +--- a/compel/arch/x86/src/lib/include/uapi/asm/fpu.h ++++ b/compel/arch/x86/src/lib/include/uapi/asm/fpu.h +@@ -80,6 +80,11 @@ enum xfeature { + (XFEATURE_MASK_FP | XFEATURE_MASK_SSE | XFEATURE_MASK_YMM | XFEATURE_MASK_OPMASK | XFEATURE_MASK_ZMM_Hi256 | \ + XFEATURE_MASK_Hi16_ZMM | XFEATURE_MASK_PKRU | XFEATURE_MASK_BNDREGS | XFEATURE_MASK_BNDCSR) + ++/* xsave structure features which is safe to fill with garbage (see validate_random_xstate()) */ ++#define XFEATURE_MASK_FAULTINJ \ ++ (XFEATURE_MASK_FP | XFEATURE_MASK_SSE | XFEATURE_MASK_YMM | XFEATURE_MASK_OPMASK | XFEATURE_MASK_ZMM_Hi256 | \ ++ XFEATURE_MASK_Hi16_ZMM) ++ + struct fpx_sw_bytes { + uint32_t magic1; + uint32_t extended_size; +diff --git a/compel/arch/x86/src/lib/infect.c b/compel/arch/x86/src/lib/infect.c +index 2f6c557d0..37b0ee327 100644 +--- a/compel/arch/x86/src/lib/infect.c ++++ b/compel/arch/x86/src/lib/infect.c +@@ -254,6 +254,7 @@ static void validate_random_xstate(struct xsave_struct *xsave) + /* No unknown or supervisor features may be set */ + hdr->xstate_bv &= XFEATURE_MASK_USER; + hdr->xstate_bv &= ~XFEATURE_MASK_SUPERVISOR; ++ hdr->xstate_bv &= XFEATURE_MASK_FAULTINJ; + + for (i = 0; i < XFEATURE_MAX; i++) { + if (!compel_fpu_has_feature(i)) +-- +2.34.1 + diff --git a/0073-x86-compel-fault-inject-print-the-initial-seed.patch b/0073-x86-compel-fault-inject-print-the-initial-seed.patch new file mode 100644 index 0000000..c1564c4 --- /dev/null +++ b/0073-x86-compel-fault-inject-print-the-initial-seed.patch @@ -0,0 +1,41 @@ +From ef96f75f2c84575bd5bf702f933807be4275ee40 Mon Sep 17 00:00:00 2001 +From: Alexander Mikhalitsyn +Date: Mon, 13 Dec 2021 15:32:00 +0300 +Subject: [PATCH 073/120] x86/compel/fault-inject: print the initial seed + +Fixes: e2e8be37 ("x86/compel/fault-inject: Add a fault-injection for corrupting extended regset") + +Signed-off-by: Alexander Mikhalitsyn +--- + compel/arch/x86/src/lib/infect.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/compel/arch/x86/src/lib/infect.c b/compel/arch/x86/src/lib/infect.c +index 37b0ee327..de9013c27 100644 +--- a/compel/arch/x86/src/lib/infect.c ++++ b/compel/arch/x86/src/lib/infect.c +@@ -283,10 +283,10 @@ static int corrupt_extregs(pid_t pid) + bool use_xsave = compel_cpu_has_feature(X86_FEATURE_OSXSAVE); + user_fpregs_struct_t ext_regs; + int *rand_to = (int *)&ext_regs; +- unsigned int seed; ++ unsigned int seed, init_seed; + size_t i; + +- seed = time(NULL); ++ init_seed = seed = time(NULL); + for (i = 0; i < sizeof(ext_regs) / sizeof(int); i++) + *rand_to++ = rand_r(&seed); + +@@ -296,7 +296,7 @@ static int corrupt_extregs(pid_t pid) + * - zdtm.py will grep it auto-magically from logs + * (and the seed will be known from an automatical testing) + */ +- pr_err("Corrupting %s for %d, seed %u\n", use_xsave ? "xsave" : "fpuregs", pid, seed); ++ pr_err("Corrupting %s for %d, seed %u\n", use_xsave ? "xsave" : "fpuregs", pid, init_seed); + + if (!use_xsave) { + if (ptrace(PTRACE_SETFPREGS, pid, NULL, &ext_regs)) { +-- +2.34.1 + diff --git a/0074-ci-enable-x86-xsave-fault-injection-tests-back.patch b/0074-ci-enable-x86-xsave-fault-injection-tests-back.patch new file mode 100644 index 0000000..6c24bee --- /dev/null +++ b/0074-ci-enable-x86-xsave-fault-injection-tests-back.patch @@ -0,0 +1,32 @@ +From df36ad5100646b6c3be4798da92b2c5f0b4aa37f Mon Sep 17 00:00:00 2001 +From: Alexander Mikhalitsyn +Date: Mon, 13 Dec 2021 15:46:47 +0300 +Subject: [PATCH 074/120] ci: enable x86 xsave fault injection tests back + +Signed-off-by: Alexander Mikhalitsyn +--- + test/jenkins/criu-fault.sh | 8 -------- + 1 file changed, 8 deletions(-) + +diff --git a/test/jenkins/criu-fault.sh b/test/jenkins/criu-fault.sh +index 0c5c180e9..9f20091cc 100755 +--- a/test/jenkins/criu-fault.sh ++++ b/test/jenkins/criu-fault.sh +@@ -28,14 +28,6 @@ fi + ./test/zdtm.py run -t zdtm/static/maps04 --fault 131 --report report --pre 2:1 || fail + ./test/zdtm.py run -t zdtm/transition/maps008 --fault 131 --report report --pre 2:1 || fail + ./test/zdtm.py run -t zdtm/static/maps01 --fault 132 -f h || fail +- +-# Error injection with --fault 134 fails on newer CPUs used in Circle CI on EC2 +-# Skip the --fault 134 tests +-# https://github.com/checkpoint-restore/criu/issues/1635 +-if [ -n "$CIRCLECI" ]; then +- exit 0 +-fi +- + # 134 is corrupting extended registers set, should run in a sub-thread (fpu03) + # without restore (that will check if parasite corrupts extended registers) + ./test/zdtm.py run -t zdtm/static/fpu03 --fault 134 -f h --norst || fail +-- +2.34.1 + diff --git a/0075-Add-documentation-for-timeout-option.patch b/0075-Add-documentation-for-timeout-option.patch new file mode 100644 index 0000000..0d93e7b --- /dev/null +++ b/0075-Add-documentation-for-timeout-option.patch @@ -0,0 +1,48 @@ +From 70f20b4460654df0c013f7252365554dc857615b Mon Sep 17 00:00:00 2001 +From: Radostin Stoyanov +Date: Tue, 14 Dec 2021 12:54:19 +0000 +Subject: [PATCH 075/120] Add documentation for --timeout option + +The --timeout option was introduced in [1] to prevent criu dump from +being able to hang indefinitely and allow users to adjust the time limit +in seconds for collecting tasks during the dump operation. + +[1] https://github.com/checkpoint-restore/criu/commit/d0ff730 + +Signed-off-by: Radostin Stoyanov +--- + Documentation/criu.txt | 4 ++++ + criu/crtools.c | 2 ++ + 2 files changed, 6 insertions(+) + +diff --git a/Documentation/criu.txt b/Documentation/criu.txt +index 4c6885fc9..f41b1898c 100644 +--- a/Documentation/criu.txt ++++ b/Documentation/criu.txt +@@ -367,6 +367,10 @@ mount -t cgroup -o devices,freezer none devices,freezer + Allows to link unlinked files back, if possible (modifies filesystem + during *restore*). + ++*--timeout* 'number':: ++ Set a time limit in seconds for collecting tasks during the ++ dump operation. The timeout is 10 seconds by default. ++ + *--ghost-limit* 'size':: + Set the maximum size of deleted file to be carried inside image. + By default, up to 1M file is allowed. Using this +diff --git a/criu/crtools.c b/criu/crtools.c +index 81c0aa963..da47bd684 100644 +--- a/criu/crtools.c ++++ b/criu/crtools.c +@@ -391,6 +391,8 @@ usage: + " -j|--" OPT_SHELL_JOB " allow one to dump and restore shell jobs\n" + " -l|--" OPT_FILE_LOCKS " handle file locks, for safety, only used for container\n" + " -L|--libdir path to a plugin directory (by default " CR_PLUGIN_DEFAULT ")\n" ++ " --timeout NUM a timeout (in seconds) on collecting tasks during dump\n" ++ " (default 10 seconds)\n" + " --force-irmap force resolving names for inotify/fsnotify watches\n" + " --irmap-scan-path FILE\n" + " add a path the irmap hints to scan\n" +-- +2.34.1 + diff --git a/0076-usernsd-UNS_FDOUT-should-not-require-an-input-descri.patch b/0076-usernsd-UNS_FDOUT-should-not-require-an-input-descri.patch new file mode 100644 index 0000000..0440722 --- /dev/null +++ b/0076-usernsd-UNS_FDOUT-should-not-require-an-input-descri.patch @@ -0,0 +1,32 @@ +From fc1e7788ce1cba57afc230c6219d570f5d3074ae Mon Sep 17 00:00:00 2001 +From: Andrei Vagin +Date: Tue, 14 Dec 2021 08:19:16 -0800 +Subject: [PATCH 076/120] usernsd: UNS_FDOUT should not require an input + descriptor + +UNS_FDOUT means only that a userns call will return a file descriptor. + +Signed-off-by: Andrei Vagin +--- + criu/namespaces.c | 5 ----- + 1 file changed, 5 deletions(-) + +diff --git a/criu/namespaces.c b/criu/namespaces.c +index 7fa58682b..c36e631cf 100644 +--- a/criu/namespaces.c ++++ b/criu/namespaces.c +@@ -1330,11 +1330,6 @@ static int usernsd(int sk) + unsc_msg_pid_fd(&um, &pid, &fd); + pr_debug("uns: daemon calls %p (%d, %d, %x)\n", call, pid, fd, flags); + +- if (fd < 0 && flags & UNS_FDOUT) { +- pr_err("uns: bad flags/fd %p %d %x\n", call, fd, flags); +- BUG(); +- } +- + /* + * Caller has sent us bare address of the routine it + * wants to call. Since the caller is fork()-ed from the +-- +2.34.1 + diff --git a/0077-libcriu-add-setting-lsm-mount-context-to-libcriu.patch b/0077-libcriu-add-setting-lsm-mount-context-to-libcriu.patch new file mode 100644 index 0000000..12674e9 --- /dev/null +++ b/0077-libcriu-add-setting-lsm-mount-context-to-libcriu.patch @@ -0,0 +1,67 @@ +From d67af357dfa24f646f2e8abccede1e25d4376267 Mon Sep 17 00:00:00 2001 +From: Adrian Reber +Date: Wed, 1 Dec 2021 11:08:53 +0000 +Subject: [PATCH 077/120] libcriu: add setting lsm-mount-context to libcriu + +Signed-off-by: Adrian Reber +--- + lib/c/criu.c | 15 +++++++++++++++ + lib/c/criu.h | 2 ++ + 2 files changed, 17 insertions(+) + +diff --git a/lib/c/criu.c b/lib/c/criu.c +index ddc6e0731..4ee189aca 100644 +--- a/lib/c/criu.c ++++ b/lib/c/criu.c +@@ -238,6 +238,7 @@ void criu_local_free_opts(criu_opts *opts) + free(opts->rpc->freeze_cgroup); + free(opts->rpc->log_file); + free(opts->rpc->lsm_profile); ++ free(opts->rpc->lsm_mount_context); + free(opts->rpc); + criu_free_service(opts); + free(opts); +@@ -651,6 +652,20 @@ int criu_set_lsm_profile(const char *name) + return criu_local_set_lsm_profile(global_opts, name); + } + ++int criu_local_set_lsm_mount_context(criu_opts *opts, const char *name) ++{ ++ opts->rpc->lsm_mount_context = strdup(name); ++ if (opts->rpc->lsm_mount_context == NULL) { ++ return -ENOMEM; ++ } ++ return 0; ++} ++ ++int criu_set_lsm_mount_context(const char *name) ++{ ++ return criu_local_set_lsm_mount_context(global_opts, name); ++} ++ + void criu_local_set_timeout(criu_opts *opts, unsigned int timeout) + { + opts->rpc->timeout = timeout; +diff --git a/lib/c/criu.h b/lib/c/criu.h +index 949902f55..a374b37f8 100644 +--- a/lib/c/criu.h ++++ b/lib/c/criu.h +@@ -92,6 +92,7 @@ void criu_set_manage_cgroups(bool manage); + void criu_set_manage_cgroups_mode(enum criu_cg_mode mode); + int criu_set_freeze_cgroup(const char *name); + int criu_set_lsm_profile(const char *name); ++int criu_set_lsm_mount_context(const char *name); + void criu_set_timeout(unsigned int timeout); + void criu_set_auto_ext_mnt(bool val); + void criu_set_ext_sharing(bool val); +@@ -249,6 +250,7 @@ void criu_local_set_manage_cgroups(criu_opts *opts, bool manage); + void criu_local_set_manage_cgroups_mode(criu_opts *opts, enum criu_cg_mode mode); + int criu_local_set_freeze_cgroup(criu_opts *opts, const char *name); + int criu_local_set_lsm_profile(criu_opts *opts, const char *name); ++int criu_local_set_lsm_mount_context(criu_opts *opts, const char *name); + void criu_local_set_timeout(criu_opts *opts, unsigned int timeout); + void criu_local_set_auto_ext_mnt(criu_opts *opts, bool val); + void criu_local_set_ext_sharing(criu_opts *opts, bool val); +-- +2.34.1 + diff --git a/0078-ci-use-unstable-release-for-cross-compile.patch b/0078-ci-use-unstable-release-for-cross-compile.patch new file mode 100644 index 0000000..fb1553b --- /dev/null +++ b/0078-ci-use-unstable-release-for-cross-compile.patch @@ -0,0 +1,182 @@ +From 4b75e29f72a84780099798b2e9f5c6651069c6da Mon Sep 17 00:00:00 2001 +From: Radostin Stoyanov +Date: Sat, 18 Dec 2021 17:25:17 +0000 +Subject: [PATCH 078/120] ci: use unstable release for cross-compile + +We added cross-compile tests with testing debian release to be able to +replicate the error reported in #1653, however, installing build +dependencies in this release currently fails with the following error: + +libc6-dev:armhf : Breaks: libc6-dev-armhf-cross (< 2.33~) but 2.32-1cross4 is to be installed + +This is not something we can fix, therefore using the debian unstable +release (instead of testing) could be more reliable option for our CI. +This would still replicate the problem reported in #1653. + +Signed-off-by: Radostin Stoyanov +--- + .github/workflows/cross-compile.yml | 8 ++++---- + scripts/build/Dockerfile.aarch64-testing-cross.tmpl | 1 - + ...ng-cross.hdr => Dockerfile.aarch64-unstable-cross.hdr} | 0 + scripts/build/Dockerfile.aarch64-unstable-cross.tmpl | 1 + + scripts/build/Dockerfile.armv7-testing-cross.tmpl | 1 - + ...ting-cross.hdr => Dockerfile.armv7-unstable-cross.hdr} | 0 + scripts/build/Dockerfile.armv7-unstable-cross.tmpl | 1 + + scripts/build/Dockerfile.mips64el-testing-cross.tmpl | 1 - + ...g-cross.hdr => Dockerfile.mips64el-unstable-cross.hdr} | 0 + scripts/build/Dockerfile.mips64el-unstable-cross.tmpl | 1 + + scripts/build/Dockerfile.ppc64-testing-cross.tmpl | 1 - + ...ting-cross.hdr => Dockerfile.ppc64-unstable-cross.hdr} | 0 + scripts/build/Dockerfile.ppc64-unstable-cross.tmpl | 1 + + ....testing-cross.tmpl => Dockerfile.unstable-cross.tmpl} | 2 +- + scripts/build/Makefile | 4 ++-- + 15 files changed, 11 insertions(+), 11 deletions(-) + delete mode 120000 scripts/build/Dockerfile.aarch64-testing-cross.tmpl + rename scripts/build/{Dockerfile.aarch64-testing-cross.hdr => Dockerfile.aarch64-unstable-cross.hdr} (100%) + create mode 120000 scripts/build/Dockerfile.aarch64-unstable-cross.tmpl + delete mode 120000 scripts/build/Dockerfile.armv7-testing-cross.tmpl + rename scripts/build/{Dockerfile.armv7-testing-cross.hdr => Dockerfile.armv7-unstable-cross.hdr} (100%) + create mode 120000 scripts/build/Dockerfile.armv7-unstable-cross.tmpl + delete mode 120000 scripts/build/Dockerfile.mips64el-testing-cross.tmpl + rename scripts/build/{Dockerfile.mips64el-testing-cross.hdr => Dockerfile.mips64el-unstable-cross.hdr} (100%) + create mode 120000 scripts/build/Dockerfile.mips64el-unstable-cross.tmpl + delete mode 120000 scripts/build/Dockerfile.ppc64-testing-cross.tmpl + rename scripts/build/{Dockerfile.ppc64-testing-cross.hdr => Dockerfile.ppc64-unstable-cross.hdr} (100%) + create mode 120000 scripts/build/Dockerfile.ppc64-unstable-cross.tmpl + rename scripts/build/{Dockerfile.testing-cross.tmpl => Dockerfile.unstable-cross.tmpl} (93%) + +diff --git a/.github/workflows/cross-compile.yml b/.github/workflows/cross-compile.yml +index eec6eb577..461a6e618 100644 +--- a/.github/workflows/cross-compile.yml ++++ b/.github/workflows/cross-compile.yml +@@ -10,13 +10,13 @@ jobs: + matrix: + target: [ + armv7-stable-cross, +- armv7-testing-cross, ++ armv7-unstable-cross, + aarch64-stable-cross, +- aarch64-testing-cross, ++ aarch64-unstable-cross, + ppc64-stable-cross, +- ppc64-testing-cross, ++ ppc64-unstable-cross, + mips64el-stable-cross, +- mips64el-testing-cross ++ mips64el-unstable-cross + ] + + steps: +diff --git a/scripts/build/Dockerfile.aarch64-testing-cross.tmpl b/scripts/build/Dockerfile.aarch64-testing-cross.tmpl +deleted file mode 120000 +index c1dd38b21..000000000 +--- a/scripts/build/Dockerfile.aarch64-testing-cross.tmpl ++++ /dev/null +@@ -1 +0,0 @@ +-Dockerfile.testing-cross.tmpl +\ No newline at end of file +diff --git a/scripts/build/Dockerfile.aarch64-testing-cross.hdr b/scripts/build/Dockerfile.aarch64-unstable-cross.hdr +similarity index 100% +rename from scripts/build/Dockerfile.aarch64-testing-cross.hdr +rename to scripts/build/Dockerfile.aarch64-unstable-cross.hdr +diff --git a/scripts/build/Dockerfile.aarch64-unstable-cross.tmpl b/scripts/build/Dockerfile.aarch64-unstable-cross.tmpl +new file mode 120000 +index 000000000..955ae1fd4 +--- /dev/null ++++ b/scripts/build/Dockerfile.aarch64-unstable-cross.tmpl +@@ -0,0 +1 @@ ++Dockerfile.unstable-cross.tmpl +\ No newline at end of file +diff --git a/scripts/build/Dockerfile.armv7-testing-cross.tmpl b/scripts/build/Dockerfile.armv7-testing-cross.tmpl +deleted file mode 120000 +index c1dd38b21..000000000 +--- a/scripts/build/Dockerfile.armv7-testing-cross.tmpl ++++ /dev/null +@@ -1 +0,0 @@ +-Dockerfile.testing-cross.tmpl +\ No newline at end of file +diff --git a/scripts/build/Dockerfile.armv7-testing-cross.hdr b/scripts/build/Dockerfile.armv7-unstable-cross.hdr +similarity index 100% +rename from scripts/build/Dockerfile.armv7-testing-cross.hdr +rename to scripts/build/Dockerfile.armv7-unstable-cross.hdr +diff --git a/scripts/build/Dockerfile.armv7-unstable-cross.tmpl b/scripts/build/Dockerfile.armv7-unstable-cross.tmpl +new file mode 120000 +index 000000000..955ae1fd4 +--- /dev/null ++++ b/scripts/build/Dockerfile.armv7-unstable-cross.tmpl +@@ -0,0 +1 @@ ++Dockerfile.unstable-cross.tmpl +\ No newline at end of file +diff --git a/scripts/build/Dockerfile.mips64el-testing-cross.tmpl b/scripts/build/Dockerfile.mips64el-testing-cross.tmpl +deleted file mode 120000 +index c1dd38b21..000000000 +--- a/scripts/build/Dockerfile.mips64el-testing-cross.tmpl ++++ /dev/null +@@ -1 +0,0 @@ +-Dockerfile.testing-cross.tmpl +\ No newline at end of file +diff --git a/scripts/build/Dockerfile.mips64el-testing-cross.hdr b/scripts/build/Dockerfile.mips64el-unstable-cross.hdr +similarity index 100% +rename from scripts/build/Dockerfile.mips64el-testing-cross.hdr +rename to scripts/build/Dockerfile.mips64el-unstable-cross.hdr +diff --git a/scripts/build/Dockerfile.mips64el-unstable-cross.tmpl b/scripts/build/Dockerfile.mips64el-unstable-cross.tmpl +new file mode 120000 +index 000000000..955ae1fd4 +--- /dev/null ++++ b/scripts/build/Dockerfile.mips64el-unstable-cross.tmpl +@@ -0,0 +1 @@ ++Dockerfile.unstable-cross.tmpl +\ No newline at end of file +diff --git a/scripts/build/Dockerfile.ppc64-testing-cross.tmpl b/scripts/build/Dockerfile.ppc64-testing-cross.tmpl +deleted file mode 120000 +index c1dd38b21..000000000 +--- a/scripts/build/Dockerfile.ppc64-testing-cross.tmpl ++++ /dev/null +@@ -1 +0,0 @@ +-Dockerfile.testing-cross.tmpl +\ No newline at end of file +diff --git a/scripts/build/Dockerfile.ppc64-testing-cross.hdr b/scripts/build/Dockerfile.ppc64-unstable-cross.hdr +similarity index 100% +rename from scripts/build/Dockerfile.ppc64-testing-cross.hdr +rename to scripts/build/Dockerfile.ppc64-unstable-cross.hdr +diff --git a/scripts/build/Dockerfile.ppc64-unstable-cross.tmpl b/scripts/build/Dockerfile.ppc64-unstable-cross.tmpl +new file mode 120000 +index 000000000..955ae1fd4 +--- /dev/null ++++ b/scripts/build/Dockerfile.ppc64-unstable-cross.tmpl +@@ -0,0 +1 @@ ++Dockerfile.unstable-cross.tmpl +\ No newline at end of file +diff --git a/scripts/build/Dockerfile.testing-cross.tmpl b/scripts/build/Dockerfile.unstable-cross.tmpl +similarity index 93% +rename from scripts/build/Dockerfile.testing-cross.tmpl +rename to scripts/build/Dockerfile.unstable-cross.tmpl +index 1d5565310..dacfd96ef 100644 +--- a/scripts/build/Dockerfile.testing-cross.tmpl ++++ b/scripts/build/Dockerfile.unstable-cross.tmpl +@@ -1,7 +1,7 @@ + COPY scripts/ci/apt-install /bin/apt-install + + # Add the cross compiler sources +-RUN echo "deb http://deb.debian.org/debian/ testing main" >> /etc/apt/sources.list && \ ++RUN echo "deb http://deb.debian.org/debian/ unstable main" >> /etc/apt/sources.list && \ + dpkg --add-architecture ${DEBIAN_ARCH} + + RUN apt-install \ +diff --git a/scripts/build/Makefile b/scripts/build/Makefile +index b24fc80ea..2c006ad87 100644 +--- a/scripts/build/Makefile ++++ b/scripts/build/Makefile +@@ -1,7 +1,7 @@ + ARCHES := x86_64 fedora-asan fedora-rawhide centos7 armv7hf centos8 + STABLE_CROSS_ARCHES := armv7-stable-cross aarch64-stable-cross ppc64-stable-cross mips64el-stable-cross +-TESTING_CROSS_ARCHES := armv7-testing-cross aarch64-testing-cross ppc64-testing-cross mips64el-testing-cross +-NON_CLANG := $(TESTING_CROSS_ARCHES) $(STABLE_CROSS_ARCHES) ++UNSTABLE_CROSS_ARCHES := armv7-unstable-cross aarch64-unstable-cross ppc64-unstable-cross mips64el-unstable-cross ++NON_CLANG := $(UNSTABLE_CROSS_ARCHES) $(STABLE_CROSS_ARCHES) + CREATE_DOCKERFILES := $(ARCHES) $(NON_CLANG) + TARGETS := $(ARCHES) alpine archlinux + TARGETS_CLANG := $(addsuffix $(TARGETS),-clang) +-- +2.34.1 + diff --git a/0079-ci-disable-glibc-rseq-support.patch b/0079-ci-disable-glibc-rseq-support.patch new file mode 100644 index 0000000..bfddd0f --- /dev/null +++ b/0079-ci-disable-glibc-rseq-support.patch @@ -0,0 +1,55 @@ +From d99def7dcfa938918368c91021f72a77f738bc61 Mon Sep 17 00:00:00 2001 +From: Radostin Stoyanov +Date: Fri, 17 Dec 2021 03:01:49 +0000 +Subject: [PATCH 079/120] ci: disable glibc rseq support + +This patch sets the glibc.pthread.rseq tunable [1] to disable rseq +support in glibc as a temporary solution for the problem described in +[2]. This would allow us to run CI tests until CRIU has rseq support. + +This commit also disables the rpc tests as they fail even +when GLIBC_TUNABLES is set. + +[1] https://sourceware.org/git/?p=glibc.git;a=commit;h=e3e589829d16af9f7e73c7b70f74f3c5d5003e45 +[2] https://github.com/checkpoint-restore/criu/issues/1696 + +Signed-off-by: Radostin Stoyanov +--- + scripts/build/Dockerfile.fedora.tmpl | 3 +++ + scripts/ci/run-ci-tests.sh | 7 ++++++- + 2 files changed, 9 insertions(+), 1 deletion(-) + +diff --git a/scripts/build/Dockerfile.fedora.tmpl b/scripts/build/Dockerfile.fedora.tmpl +index 9d3bb0f87..fd4ba4aef 100644 +--- a/scripts/build/Dockerfile.fedora.tmpl ++++ b/scripts/build/Dockerfile.fedora.tmpl +@@ -1,5 +1,8 @@ + ARG CC=gcc + ++# FIXME: Temporary solution for https://github.com/checkpoint-restore/criu/issues/1696 ++ENV GLIBC_TUNABLES=glibc.pthread.rseq=0 ++ + COPY scripts/ci/prepare-for-fedora-rawhide.sh /bin/prepare-for-fedora-rawhide.sh + RUN /bin/prepare-for-fedora-rawhide.sh + +diff --git a/scripts/ci/run-ci-tests.sh b/scripts/ci/run-ci-tests.sh +index 096f907fb..bf7331142 100755 +--- a/scripts/ci/run-ci-tests.sh ++++ b/scripts/ci/run-ci-tests.sh +@@ -235,7 +235,12 @@ if [ -n "$TRAVIS" ] || [ -n "$CIRCLECI" ]; then + # Error (criu/tty.c:1014): tty: Don't have tty to inherit session from, aborting + make -C test/others/shell-job/ run + fi +-make -C test/others/rpc/ run ++ ++# FIXME: rpc tests fail even with set glibc tunable ++# https://github.com/checkpoint-restore/criu/issues/1696 ++if [ "$GLIBC_TUNABLES" != "glibc.pthread.rseq=0" ]; then ++ make -C test/others/rpc/ run ++fi + + ./test/zdtm.py run -t zdtm/static/env00 --sibling + +-- +2.34.1 + diff --git a/0080-libcriu-add-single-pre-dump-support.patch b/0080-libcriu-add-single-pre-dump-support.patch new file mode 100644 index 0000000..a6220b4 --- /dev/null +++ b/0080-libcriu-add-single-pre-dump-support.patch @@ -0,0 +1,185 @@ +From 7b5909592881607f5d5ecc8de144e5bb83f02438 Mon Sep 17 00:00:00 2001 +From: Adrian Reber +Date: Fri, 3 Dec 2021 14:32:33 +0000 +Subject: [PATCH 080/120] libcriu: add single pre-dump support + +In contrast to the CLI it is not possible to do a single pre-dump via +RPC and thus libcriu. In cr-service.c pre-dump always goes into a +pre-dump loop followed by a final dump. runc already works around this +to only do a single pre-dump by killing the CRIU process waiting for the +message for the final dump. + +Trying to implement pre-dump in crun via libcriu it is not as easy to +work around CRIU's pre-dump loop expectations as with runc that directly +talks to CRIU via RPC. + +We know that LXC/LXD also does single pre-dumps using the CLI and runc +also only does single pre-dumps by misusing the pre-dump loop interface. + +With this commit it is possible to trigger a single pre-dump via RPC and +libcriu without misusing the interface provided via cr-service.c. So +this commit basically updates CRIU to the existing use cases. + +The existing pre-dump loop still sounds like a very good idea, but so +far most tools have decided to implement the pre-dump loop themselves. + +With this change we can implement pre-dump in crun to match what is +currently implemented in runc. + +Signed-off-by: Adrian Reber +--- + criu/cr-service.c | 13 ++++++++----- + images/rpc.proto | 2 ++ + lib/c/criu.c | 21 ++++++++++++++++++--- + lib/c/criu.h | 2 ++ + 4 files changed, 30 insertions(+), 8 deletions(-) + +diff --git a/criu/cr-service.c b/criu/cr-service.c +index 0f8bc4cc1..80d12c7b0 100644 +--- a/criu/cr-service.c ++++ b/criu/cr-service.c +@@ -169,11 +169,11 @@ int send_criu_dump_resp(int socket_fd, bool success, bool restored) + return send_criu_msg(socket_fd, &msg); + } + +-static int send_criu_pre_dump_resp(int socket_fd, bool success) ++static int send_criu_pre_dump_resp(int socket_fd, bool success, bool single) + { + CriuResp msg = CRIU_RESP__INIT; + +- msg.type = CRIU_REQ_TYPE__PRE_DUMP; ++ msg.type = single ? CRIU_REQ_TYPE__SINGLE_PRE_DUMP : CRIU_REQ_TYPE__PRE_DUMP; + msg.success = success; + set_resp_err(&msg); + +@@ -845,7 +845,7 @@ out: + return send_criu_msg(sk, &resp); + } + +-static int pre_dump_using_req(int sk, CriuOpts *req) ++static int pre_dump_using_req(int sk, CriuOpts *req, bool single) + { + int pid, status; + bool success = false; +@@ -886,7 +886,7 @@ static int pre_dump_using_req(int sk, CriuOpts *req) + + success = true; + out: +- if (send_criu_pre_dump_resp(sk, success) == -1) { ++ if (send_criu_pre_dump_resp(sk, success, single) == -1) { + pr_perror("Can't send pre-dump resp"); + success = false; + } +@@ -899,7 +899,7 @@ static int pre_dump_loop(int sk, CriuReq *msg) + int ret; + + do { +- ret = pre_dump_using_req(sk, msg->opts); ++ ret = pre_dump_using_req(sk, msg->opts, false); + if (ret < 0) + return ret; + +@@ -1271,6 +1271,9 @@ more: + case CRIU_REQ_TYPE__VERSION: + ret = handle_version(sk, msg); + break; ++ case CRIU_REQ_TYPE__SINGLE_PRE_DUMP: ++ ret = pre_dump_using_req(sk, msg->opts, true); ++ break; + + default: + send_criu_err(sk, "Invalid req"); +diff --git a/images/rpc.proto b/images/rpc.proto +index a9f51ac4b..1d3befd23 100644 +--- a/images/rpc.proto ++++ b/images/rpc.proto +@@ -172,6 +172,8 @@ enum criu_req_type { + + WAIT_PID = 11; + PAGE_SERVER_CHLD = 12; ++ ++ SINGLE_PRE_DUMP = 13; + } + + /* +diff --git a/lib/c/criu.c b/lib/c/criu.c +index 4ee189aca..500574e33 100644 +--- a/lib/c/criu.c ++++ b/lib/c/criu.c +@@ -1527,7 +1527,7 @@ int criu_check(void) + return criu_local_check(global_opts); + } + +-int criu_local_dump(criu_opts *opts) ++static int dump(bool pre_dump, criu_opts *opts) + { + int ret = -1; + CriuReq req = CRIU_REQ__INIT; +@@ -1535,7 +1535,7 @@ int criu_local_dump(criu_opts *opts) + + saved_errno = 0; + +- req.type = CRIU_REQ_TYPE__DUMP; ++ req.type = pre_dump ? CRIU_REQ_TYPE__SINGLE_PRE_DUMP : CRIU_REQ_TYPE__DUMP; + req.opts = opts->rpc; + + ret = send_req_and_recv_resp(opts, &req, &resp); +@@ -1543,7 +1543,7 @@ int criu_local_dump(criu_opts *opts) + goto exit; + + if (resp->success) { +- if (resp->dump->has_restored && resp->dump->restored) ++ if (!pre_dump && resp->dump->has_restored && resp->dump->restored) + ret = 1; + else + ret = 0; +@@ -1561,11 +1561,26 @@ exit: + return ret; + } + ++int criu_local_dump(criu_opts *opts) ++{ ++ return dump(false, opts); ++} ++ + int criu_dump(void) + { + return criu_local_dump(global_opts); + } + ++int criu_local_pre_dump(criu_opts *opts) ++{ ++ return dump(true, opts); ++} ++ ++int criu_pre_dump(void) ++{ ++ return criu_local_pre_dump(global_opts); ++} ++ + int criu_local_dump_iters(criu_opts *opts, int (*more)(criu_predump_info pi)) + { + int ret = -1, fd = -1, uret; +diff --git a/lib/c/criu.h b/lib/c/criu.h +index a374b37f8..c6d4f50a8 100644 +--- a/lib/c/criu.h ++++ b/lib/c/criu.h +@@ -161,6 +161,7 @@ int criu_get_orphan_pts_master_fd(void); + */ + int criu_check(void); + int criu_dump(void); ++int criu_pre_dump(void); + int criu_restore(void); + int criu_restore_child(void); + +@@ -279,6 +280,7 @@ void criu_local_set_notify_cb(criu_opts *opts, int (*cb)(char *action, criu_noti + + int criu_local_check(criu_opts *opts); + int criu_local_dump(criu_opts *opts); ++int criu_local_pre_dump(criu_opts *opts); + int criu_local_restore(criu_opts *opts); + int criu_local_restore_child(criu_opts *opts); + int criu_local_dump_iters(criu_opts *opts, int (*more)(criu_predump_info pi)); +-- +2.34.1 + diff --git a/0081-tests-added-test-for-single-pre-dump-support.patch b/0081-tests-added-test-for-single-pre-dump-support.patch new file mode 100644 index 0000000..2231e20 --- /dev/null +++ b/0081-tests-added-test-for-single-pre-dump-support.patch @@ -0,0 +1,262 @@ +From e4ccdc694a8739125da2c7e8e57f8a30c7451eaf Mon Sep 17 00:00:00 2001 +From: Adrian Reber +Date: Tue, 14 Dec 2021 13:09:19 +0000 +Subject: [PATCH 081/120] tests: added test for single pre-dump support + +Signed-off-by: Adrian Reber +--- + test/others/libcriu/.gitignore | 1 + + test/others/libcriu/Makefile | 1 + + test/others/libcriu/lib.h | 2 + + test/others/libcriu/run.sh | 1 + + test/others/libcriu/test_iters.c | 2 - + test/others/libcriu/test_notify.c | 2 - + test/others/libcriu/test_pre_dump.c | 151 ++++++++++++++++++++++++++++ + test/others/libcriu/test_sub.c | 2 - + 8 files changed, 156 insertions(+), 6 deletions(-) + create mode 100644 test/others/libcriu/test_pre_dump.c + +diff --git a/test/others/libcriu/.gitignore b/test/others/libcriu/.gitignore +index cf1342de2..15abf07ac 100644 +--- a/test/others/libcriu/.gitignore ++++ b/test/others/libcriu/.gitignore +@@ -4,5 +4,6 @@ test_notify + test_self + test_sub + test_join_ns ++test_pre_dump + output/ + libcriu.so.* +diff --git a/test/others/libcriu/Makefile b/test/others/libcriu/Makefile +index 734e66c1a..581574da0 100644 +--- a/test/others/libcriu/Makefile ++++ b/test/others/libcriu/Makefile +@@ -6,6 +6,7 @@ TESTS += test_notify + TESTS += test_iters + TESTS += test_errno + TESTS += test_join_ns ++TESTS += test_pre_dump + + all: $(TESTS) + .PHONY: all +diff --git a/test/others/libcriu/lib.h b/test/others/libcriu/lib.h +index 6fdf8aef2..59372fca5 100644 +--- a/test/others/libcriu/lib.h ++++ b/test/others/libcriu/lib.h +@@ -1,3 +1,5 @@ + void what_err_ret_mean(int ret); + int chk_exit(int status, int want); + int get_version(void); ++ ++#define SUCC_ECODE 42 +diff --git a/test/others/libcriu/run.sh b/test/others/libcriu/run.sh +index 48f25a5f6..1b6c73448 100755 +--- a/test/others/libcriu/run.sh ++++ b/test/others/libcriu/run.sh +@@ -58,6 +58,7 @@ run_test test_notify + if [ "$(uname -m)" = "x86_64" ]; then + # Skip this on aarch64 as aarch64 has no dirty page tracking + run_test test_iters ++ run_test test_pre_dump + fi + run_test test_errno + run_test test_join_ns +diff --git a/test/others/libcriu/test_iters.c b/test/others/libcriu/test_iters.c +index b7e325abb..edbaf87f6 100644 +--- a/test/others/libcriu/test_iters.c ++++ b/test/others/libcriu/test_iters.c +@@ -46,8 +46,6 @@ static int next_iter(criu_predump_info pi) + return cur_iter < MAX_ITERS; + } + +-#define SUCC_ECODE 42 +- + int main(int argc, char **argv) + { + int pid, ret, p[2]; +diff --git a/test/others/libcriu/test_notify.c b/test/others/libcriu/test_notify.c +index 9a54b812a..80ad3ffdc 100644 +--- a/test/others/libcriu/test_notify.c ++++ b/test/others/libcriu/test_notify.c +@@ -10,8 +10,6 @@ + + #include "lib.h" + +-#define SUCC_ECODE 42 +- + static int actions_called = 0; + static int notify(char *action, criu_notify_arg_t na) + { +diff --git a/test/others/libcriu/test_pre_dump.c b/test/others/libcriu/test_pre_dump.c +new file mode 100644 +index 000000000..ed9cd2125 +--- /dev/null ++++ b/test/others/libcriu/test_pre_dump.c +@@ -0,0 +1,151 @@ ++#include "criu.h" ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include "lib.h" ++ ++static int wdir_fd, cur_imgdir = -1; ++ ++static int stop = 0; ++static void sh(int sig) ++{ ++ stop = 1; ++} ++ ++static void open_imgdir(void) ++{ ++ char p[10]; ++ static int id = 0; ++ ++ if (id > 0) { ++ sprintf(p, "../dir-%d", id); ++ criu_set_parent_images(p); ++ } ++ if (cur_imgdir != -1) ++ close(cur_imgdir); ++ sprintf(p, "dir-%d", ++id); ++ mkdirat(wdir_fd, p, 0700); ++ cur_imgdir = openat(wdir_fd, p, O_DIRECTORY); ++ criu_set_images_dir_fd(cur_imgdir); ++} ++ ++int main(int argc, char **argv) ++{ ++ int pid, ret, p[2]; ++ ++ wdir_fd = open(argv[2], O_DIRECTORY); ++ if (wdir_fd < 0) { ++ perror("Can't open wdir"); ++ return 1; ++ } ++ ++ printf("--- Start loop ---\n"); ++ pipe(p); ++ pid = fork(); ++ if (pid < 0) { ++ perror("Can't"); ++ return -1; ++ } ++ ++ if (!pid) { ++ printf(" `- loop: initializing\n"); ++ if (setsid() < 0) ++ exit(1); ++ if (signal(SIGUSR1, sh) == SIG_ERR) ++ exit(1); ++ ++ close(0); ++ close(1); ++ close(2); ++ close(p[0]); ++ ++ ret = SUCC_ECODE; ++ write(p[1], &ret, sizeof(ret)); ++ close(p[1]); ++ ++ while (!stop) ++ sleep(1); ++ exit(SUCC_ECODE); ++ } ++ ++ close(p[1]); ++ ++ /* Wait for kid to start */ ++ ret = -1; ++ read(p[0], &ret, sizeof(ret)); ++ if (ret != SUCC_ECODE) { ++ printf("Error starting loop\n"); ++ goto err; ++ } ++ ++ /* Wait for pipe to get closed, then dump */ ++ read(p[0], &ret, 1); ++ close(p[0]); ++ ++ printf("--- Dump loop ---\n"); ++ criu_init_opts(); ++ criu_set_service_binary(argv[1]); ++ criu_set_pid(pid); ++ criu_set_log_file("dump.log"); ++ criu_set_log_level(CRIU_LOG_DEBUG); ++ criu_set_track_mem(true); ++ ++ open_imgdir(); ++ ret = criu_pre_dump(); ++ if (ret < 0) { ++ what_err_ret_mean(ret); ++ kill(pid, SIGKILL); ++ goto err; ++ } ++ ++ printf(" `- Pre Dump 1 succeeded\n"); ++ ++ open_imgdir(); ++ ret = criu_pre_dump(); ++ if (ret < 0) { ++ what_err_ret_mean(ret); ++ kill(pid, SIGKILL); ++ goto err; ++ } ++ ++ printf(" `- Pre Dump 2 succeeded\n"); ++ ++ open_imgdir(); ++ ret = criu_dump(); ++ if (ret < 0) { ++ what_err_ret_mean(ret); ++ kill(pid, SIGKILL); ++ goto err; ++ } ++ ++ printf(" `- Final Dump succeeded\n"); ++ waitpid(pid, NULL, 0); ++ ++ printf("--- Restore ---\n"); ++ criu_init_opts(); ++ criu_set_log_level(CRIU_LOG_DEBUG); ++ criu_set_log_file("restore.log"); ++ criu_set_images_dir_fd(cur_imgdir); ++ ++ pid = criu_restore_child(); ++ if (pid <= 0) { ++ what_err_ret_mean(pid); ++ return -1; ++ } ++ ++ printf(" `- Restore returned pid %d\n", pid); ++ kill(pid, SIGUSR1); ++err: ++ if (waitpid(pid, &ret, 0) < 0) { ++ perror(" Can't wait kid"); ++ return -1; ++ } ++ ++ return chk_exit(ret, SUCC_ECODE); ++} +diff --git a/test/others/libcriu/test_sub.c b/test/others/libcriu/test_sub.c +index 697abf5d5..af1e09408 100644 +--- a/test/others/libcriu/test_sub.c ++++ b/test/others/libcriu/test_sub.c +@@ -15,8 +15,6 @@ static void sh(int sig) + stop = 1; + } + +-#define SUCC_ECODE 42 +- + int main(int argc, char **argv) + { + int pid, ret, fd, p[2]; +-- +2.34.1 + diff --git a/0082-zdtm.py-clean-up-MAKEFLAGS-env-variable-before-runni.patch b/0082-zdtm.py-clean-up-MAKEFLAGS-env-variable-before-runni.patch new file mode 100644 index 0000000..1c3ac09 --- /dev/null +++ b/0082-zdtm.py-clean-up-MAKEFLAGS-env-variable-before-runni.patch @@ -0,0 +1,56 @@ +From 98675175666d97a9eeadfcc396df8b894e318e78 Mon Sep 17 00:00:00 2001 +From: Alexander Mikhalitsyn +Date: Sat, 18 Dec 2021 10:40:11 +0300 +Subject: [PATCH 082/120] zdtm.py: clean up MAKEFLAGS env variable before + running make instance + +In most cases we run tests as: +./test/zdtm.py run -a + +But it's also possible to run tests from root makefile: +make test + +In this case, if criu tree have no ./test/umount2 binary +built we get the error like: +make[3]: *** No rule to make target 'umount2'. Stop. + +It's worth to mention this "3". That's because we have +build process tree like this: +make -> make -> make -> zdtm.py -> make umount2 +and also we have MAKEFLAGS variable set to: +build=-r -R -f ... + +And that's bad because "-r" option means no builtin +rules and -R means no builtin variables. That makes +`make umount2` not working. Let's just cleanup this +variable to make things work properly. + +Fixes: #1699 +https://github.com/checkpoint-restore/criu/issues/1699 + +Signed-off-by: Alexander Mikhalitsyn +--- + test/zdtm.py | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/test/zdtm.py b/test/zdtm.py +index b98770079..086ae0285 100755 +--- a/test/zdtm.py ++++ b/test/zdtm.py +@@ -607,9 +607,11 @@ class zdtm_test: + @staticmethod + def available(): + if not os.access("umount2", os.X_OK): +- subprocess.check_call(["make", "umount2"]) ++ subprocess.check_call( ++ ["make", "umount2"], env=dict(os.environ, MAKEFLAGS="")) + if not os.access("zdtm_ct", os.X_OK): +- subprocess.check_call(["make", "zdtm_ct"]) ++ subprocess.check_call( ++ ["make", "zdtm_ct"], env=dict(os.environ, MAKEFLAGS="")) + if not os.access("zdtm/lib/libzdtmtst.a", os.F_OK): + subprocess.check_call(["make", "-C", "zdtm/"]) + subprocess.check_call( +-- +2.34.1 + diff --git a/0083-zdtm-zdtm_ct-fix-compilation-error-with-strict-proto.patch b/0083-zdtm-zdtm_ct-fix-compilation-error-with-strict-proto.patch new file mode 100644 index 0000000..515328a --- /dev/null +++ b/0083-zdtm-zdtm_ct-fix-compilation-error-with-strict-proto.patch @@ -0,0 +1,33 @@ +From e0bf87fecbcc353d697dccd3fe0801347caf1423 Mon Sep 17 00:00:00 2001 +From: Alexander Mikhalitsyn +Date: Sat, 18 Dec 2021 11:03:53 +0300 +Subject: [PATCH 083/120] zdtm: zdtm_ct fix compilation error with + strict-prototypes on +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +zdtm_ct.c:44:12: error: function declaration isn’t a prototype [-Werror=strict-prototypes] + 44 | static int create_timens() + +Signed-off-by: Alexander Mikhalitsyn +--- + test/zdtm_ct.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/test/zdtm_ct.c b/test/zdtm_ct.c +index e4b17a512..0e8eeff8a 100644 +--- a/test/zdtm_ct.c ++++ b/test/zdtm_ct.c +@@ -41,7 +41,7 @@ static inline int _settime(clockid_t clk_id, time_t offset) + return 0; + } + +-static int create_timens() ++static int create_timens(void) + { + struct utsname buf; + unsigned major, minor; +-- +2.34.1 + diff --git a/0084-zdtm-remove-mntns-deleted-dst-test-leftover-from-git.patch b/0084-zdtm-remove-mntns-deleted-dst-test-leftover-from-git.patch new file mode 100644 index 0000000..f1b0b39 --- /dev/null +++ b/0084-zdtm-remove-mntns-deleted-dst-test-leftover-from-git.patch @@ -0,0 +1,21 @@ +From 5083232273c93f9115bf91bed373d8ab749106d9 Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Fri, 17 Dec 2021 15:33:55 +0300 +Subject: [PATCH 084/120] zdtm: remove mntns-deleted-dst test leftover from git + +Looks like in commit [1] we've non-intentionally added this tmp file to +git, let's remove it. + +Fixes: 01ee29702 ("s390:zdtm: Enable zdtm for s390") [1] +Signed-off-by: Pavel Tikhomirov +--- + test/zdtm/static/mntns-deleted-dst | 0 + 1 file changed, 0 insertions(+), 0 deletions(-) + delete mode 100644 test/zdtm/static/mntns-deleted-dst + +diff --git a/test/zdtm/static/mntns-deleted-dst b/test/zdtm/static/mntns-deleted-dst +deleted file mode 100644 +index e69de29bb..000000000 +-- +2.34.1 + diff --git a/0085-crtools-remove-excess-always-true-condition.patch b/0085-crtools-remove-excess-always-true-condition.patch new file mode 100644 index 0000000..df2c3a9 --- /dev/null +++ b/0085-crtools-remove-excess-always-true-condition.patch @@ -0,0 +1,29 @@ +From b8825cd2d4242b13d7ca598211c513c7b1308d84 Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Fri, 10 Dec 2021 15:34:19 +0300 +Subject: [PATCH 085/120] crtools: remove excess always true condition + +Several lines above if (optind >= argc) we go to usage label and fail, +thus we don't need to check (optind < argc) here as it is always true. + +Signed-off-by: Pavel Tikhomirov +--- + criu/crtools.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/criu/crtools.c b/criu/crtools.c +index da47bd684..3adfb190f 100644 +--- a/criu/crtools.c ++++ b/criu/crtools.c +@@ -124,7 +124,7 @@ int main(int argc, char *argv[], char *envp[]) + return 1; + } + +- if (optind < argc && !strcmp(argv[optind], "swrk")) { ++ if (!strcmp(argv[optind], "swrk")) { + if (argc != optind + 2) { + fprintf(stderr, "Usage: criu swrk \n"); + return 1; +-- +2.34.1 + diff --git a/0086-crtools-rpc-export-current-criu-mode-to-opts.mode.patch b/0086-crtools-rpc-export-current-criu-mode-to-opts.mode.patch new file mode 100644 index 0000000..4cccc89 --- /dev/null +++ b/0086-crtools-rpc-export-current-criu-mode-to-opts.mode.patch @@ -0,0 +1,309 @@ +From 6006fc1de4d0ee8181682df7fd7a143f4bd89273 Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Fri, 10 Dec 2021 12:13:06 +0300 +Subject: [PATCH 086/120] crtools/rpc: export current criu mode to opts.mode + +We have multiple options which are valid only on restore or only on dump +or in any other specific criu mode, so it would be useful to have info +about current mode in opts so that we can validate other options against +current mode. + +Plan is to use it for mount-v2 option as it is only valid on restore, +and this would make handling of different types mountpoints much easier. + +Realization is a bit different for general code and rpc: + +- When criu mode is set from main() we just parse mode from argv[optind] +just after parse_options() found optind of the command. Note that +opts.mode is available before check_options(). + +- For rpc service we reset opts.mode to CR_SWRK each time we restart +cr_service_work(), in the original service process we still have +CR_SERVICE to differentiate between them, and each request handling +function which does setup_opts_from_req sets opts.mode in accordance +with the processed request type. And it is also available before +check_options(). + +Now in check_options we can add filters on one mode only options. + +Signed-off-by: Pavel Tikhomirov +--- + criu/cr-service.c | 8 +++++ + criu/crtools.c | 73 +++++++++++++++++++++++++++++---------- + criu/include/cr_options.h | 19 ++++++++++ + 3 files changed, 82 insertions(+), 18 deletions(-) + +diff --git a/criu/cr-service.c b/criu/cr-service.c +index 80d12c7b0..59f46b320 100644 +--- a/criu/cr-service.c ++++ b/criu/cr-service.c +@@ -735,6 +735,7 @@ static int dump_using_req(int sk, CriuOpts *req) + bool success = false; + bool self_dump = !req->pid; + ++ opts.mode = CR_DUMP; + if (setup_opts_from_req(sk, req)) + goto exit; + +@@ -777,6 +778,7 @@ static int restore_using_req(int sk, CriuOpts *req) + + opts.restore_detach = true; + ++ opts.mode = CR_RESTORE; + if (setup_opts_from_req(sk, req)) + goto exit; + +@@ -828,6 +830,7 @@ static int check(int sk, CriuOpts *req) + if (pid == 0) { + setproctitle("check --rpc"); + ++ opts.mode = CR_CHECK; + if (setup_opts_from_req(sk, req)) + exit(1); + +@@ -859,6 +862,7 @@ static int pre_dump_using_req(int sk, CriuOpts *req, bool single) + if (pid == 0) { + int ret = 1; + ++ opts.mode = CR_PRE_DUMP; + if (setup_opts_from_req(sk, req)) + goto cout; + +@@ -936,6 +940,7 @@ static int start_page_server_req(int sk, CriuOpts *req, bool daemon_mode) + if (pid == 0) { + close(start_pipe[0]); + ++ opts.mode = CR_PAGE_SERVER; + if (setup_opts_from_req(sk, req)) + goto out_ch; + +@@ -1182,6 +1187,7 @@ static int handle_cpuinfo(int sk, CriuReq *msg) + if (pid == 0) { + int ret = 1; + ++ opts.mode = CR_CPUINFO; + if (setup_opts_from_req(sk, msg->opts)) + goto cout; + +@@ -1231,6 +1237,8 @@ int cr_service_work(int sk) + CriuReq *msg = 0; + + more: ++ opts.mode = CR_SWRK; ++ + if (recv_criu_msg(sk, &msg) != 0) { + pr_perror("Can't recv request"); + goto err; +diff --git a/criu/crtools.c b/criu/crtools.c +index 3adfb190f..d10d7f7d0 100644 +--- a/criu/crtools.c ++++ b/criu/crtools.c +@@ -67,6 +67,38 @@ static int image_dir_mode(char *argv[], int optind) + return -1; + } + ++static int parse_criu_mode(char *mode) ++{ ++ if (!strcmp(mode, "dump")) ++ opts.mode = CR_DUMP; ++ else if (!strcmp(mode, "pre-dump")) ++ opts.mode = CR_PRE_DUMP; ++ else if (!strcmp(mode, "restore")) ++ opts.mode = CR_RESTORE; ++ else if (!strcmp(mode, "lazy-pages")) ++ opts.mode = CR_LAZY_PAGES; ++ else if (!strcmp(mode, "check")) ++ opts.mode = CR_CHECK; ++ else if (!strcmp(mode, "page-server")) ++ opts.mode = CR_PAGE_SERVER; ++ else if (!strcmp(mode, "service")) ++ opts.mode = CR_SERVICE; ++ else if (!strcmp(mode, "swrk")) ++ opts.mode = CR_SWRK; ++ else if (!strcmp(mode, "dedup")) ++ opts.mode = CR_DEDUP; ++ else if (!strcmp(mode, "cpuinfo")) ++ opts.mode = CR_CPUINFO; ++ else if (!strcmp(mode, "exec")) ++ opts.mode = CR_EXEC_DEPRECATED; ++ else if (!strcmp(mode, "show")) ++ opts.mode = CR_SHOW_DEPRECATED; ++ else ++ return -1; ++ ++ return 0; ++} ++ + int main(int argc, char *argv[], char *envp[]) + { + int ret = -1; +@@ -124,7 +156,12 @@ int main(int argc, char *argv[], char *envp[]) + return 1; + } + +- if (!strcmp(argv[optind], "swrk")) { ++ if (parse_criu_mode(argv[optind])) { ++ pr_err("unknown command: %s\n", argv[optind]); ++ goto usage; ++ } ++ ++ if (opts.mode == CR_SWRK) { + if (argc != optind + 2) { + fprintf(stderr, "Usage: criu swrk \n"); + return 1; +@@ -156,7 +193,7 @@ int main(int argc, char *argv[], char *envp[]) + goto usage; + } + +- if (strcmp(argv[optind], "restore")) { ++ if (opts.mode != CR_RESTORE) { + pr_err("--exec-cmd is available for the restore command only\n"); + goto usage; + } +@@ -173,7 +210,7 @@ int main(int argc, char *argv[], char *envp[]) + opts.exec_cmd[argc - optind - 1] = NULL; + } else { + /* No subcommands except for cpuinfo and restore --exec-cmd */ +- if (strcmp(argv[optind], "cpuinfo") && has_sub_command) { ++ if (opts.mode != CR_CPUINFO && has_sub_command) { + pr_err("excessive parameter%s for command %s\n", (argc - optind) > 2 ? "s" : "", argv[optind]); + goto usage; + } +@@ -185,7 +222,7 @@ int main(int argc, char *argv[], char *envp[]) + } + + /* We must not open imgs dir, if service is called */ +- if (strcmp(argv[optind], "service")) { ++ if (opts.mode != CR_SERVICE) { + ret = open_image_dir(opts.imgs_dir, image_dir_mode(argv, optind)); + if (ret < 0) { + pr_err("Couldn't open image dir %s\n", opts.imgs_dir); +@@ -197,8 +234,7 @@ int main(int argc, char *argv[], char *envp[]) + * When a process group becomes an orphan, + * its processes are sent a SIGHUP signal + */ +- if (!strcmp(argv[optind], "restore") && opts.restore_detach && opts.final_state == TASK_STOPPED && +- opts.shell_job) ++ if (opts.mode == CR_RESTORE && opts.restore_detach && opts.final_state == TASK_STOPPED && opts.shell_job) + pr_warn("Stopped and detached shell job will get SIGHUP from OS.\n"); + + if (chdir(opts.work_dir)) { +@@ -218,7 +254,7 @@ int main(int argc, char *argv[], char *envp[]) + kdat.can_map_vdso = 0; + + if (!list_empty(&opts.inherit_fds)) { +- if (strcmp(argv[optind], "restore")) { ++ if (opts.mode != CR_RESTORE) { + pr_err("--inherit-fd is restore-only option\n"); + return 1; + } +@@ -229,13 +265,14 @@ int main(int argc, char *argv[], char *envp[]) + if (opts.img_parent) + pr_info("Will do snapshot from %s\n", opts.img_parent); + +- if (!strcmp(argv[optind], "dump")) { ++ if (opts.mode == CR_DUMP) { + if (!opts.tree_id) + goto opt_pid_missing; ++ + return cr_dump_tasks(opts.tree_id); + } + +- if (!strcmp(argv[optind], "pre-dump")) { ++ if (opts.mode == CR_PRE_DUMP) { + if (!opts.tree_id) + goto opt_pid_missing; + +@@ -247,7 +284,7 @@ int main(int argc, char *argv[], char *envp[]) + return cr_pre_dump_tasks(opts.tree_id) != 0; + } + +- if (!strcmp(argv[optind], "restore")) { ++ if (opts.mode == CR_RESTORE) { + if (opts.tree_id) + pr_warn("Using -t with criu restore is obsoleted\n"); + +@@ -262,22 +299,22 @@ int main(int argc, char *argv[], char *envp[]) + return ret != 0; + } + +- if (!strcmp(argv[optind], "lazy-pages")) ++ if (opts.mode == CR_LAZY_PAGES) + return cr_lazy_pages(opts.daemon_mode) != 0; + +- if (!strcmp(argv[optind], "check")) ++ if (opts.mode == CR_CHECK) + return cr_check() != 0; + +- if (!strcmp(argv[optind], "page-server")) ++ if (opts.mode == CR_PAGE_SERVER) + return cr_page_server(opts.daemon_mode, false, -1) != 0; + +- if (!strcmp(argv[optind], "service")) ++ if (opts.mode == CR_SERVICE) + return cr_service(opts.daemon_mode); + +- if (!strcmp(argv[optind], "dedup")) ++ if (opts.mode == CR_DEDUP) + return cr_dedup() != 0; + +- if (!strcmp(argv[optind], "cpuinfo")) { ++ if (opts.mode == CR_CPUINFO) { + if (!argv[optind + 1]) { + pr_err("cpuinfo requires an action: dump or check\n"); + goto usage; +@@ -288,12 +325,12 @@ int main(int argc, char *argv[], char *envp[]) + return cpuinfo_check(); + } + +- if (!strcmp(argv[optind], "exec")) { ++ if (opts.mode == CR_EXEC_DEPRECATED) { + pr_err("The \"exec\" action is deprecated by the Compel library.\n"); + return -1; + } + +- if (!strcmp(argv[optind], "show")) { ++ if (opts.mode == CR_SHOW_DEPRECATED) { + pr_err("The \"show\" action is deprecated by the CRIT utility.\n"); + pr_err("To view an image use the \"crit decode -i $name --pretty\" command.\n"); + return -1; +diff --git a/criu/include/cr_options.h b/criu/include/cr_options.h +index a34f8dbbf..85648bf1c 100644 +--- a/criu/include/cr_options.h ++++ b/criu/include/cr_options.h +@@ -100,6 +100,22 @@ struct irmap_path_opt { + struct irmap *ir; + }; + ++enum criu_mode { ++ CR_UNSET = 0, ++ CR_DUMP, ++ CR_PRE_DUMP, ++ CR_RESTORE, ++ CR_LAZY_PAGES, ++ CR_CHECK, ++ CR_PAGE_SERVER, ++ CR_SERVICE, ++ CR_SWRK, ++ CR_DEDUP, ++ CR_CPUINFO, ++ CR_EXEC_DEPRECATED, ++ CR_SHOW_DEPRECATED, ++}; ++ + struct cr_options { + int final_state; + int check_extra_features; +@@ -188,6 +204,9 @@ struct cr_options { + + /* This stores which method to use for file validation. */ + int file_validation_method; ++ ++ /* Shows the mode criu is running at the moment: dump/pre-dump/restore/... */ ++ enum criu_mode mode; + }; + + extern struct cr_options opts; +-- +2.34.1 + diff --git a/0087-crtools-use-new-opts.mode-in-image_dir_mode.patch b/0087-crtools-use-new-opts.mode-in-image_dir_mode.patch new file mode 100644 index 0000000..6e357e8 --- /dev/null +++ b/0087-crtools-use-new-opts.mode-in-image_dir_mode.patch @@ -0,0 +1,48 @@ +From 95c3d5131afd2b40271233ea7a024dc19260efd1 Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Wed, 15 Dec 2021 10:49:42 +0300 +Subject: [PATCH 087/120] crtools: use new opts.mode in image_dir_mode + +Also while on it there is no "cpuinfo restore", let's remove it. + +Signed-off-by: Pavel Tikhomirov +--- + criu/crtools.c | 19 ++++++++++++++----- + 1 file changed, 14 insertions(+), 5 deletions(-) + +diff --git a/criu/crtools.c b/criu/crtools.c +index d10d7f7d0..7bf92ffd0 100644 +--- a/criu/crtools.c ++++ b/criu/crtools.c +@@ -56,14 +56,23 @@ void flush_early_log_to_stderr(void) + + static int image_dir_mode(char *argv[], int optind) + { +- if (!strcmp(argv[optind], "dump") || !strcmp(argv[optind], "pre-dump") || +- (!strcmp(argv[optind], "cpuinfo") && !strcmp(argv[optind + 1], "dump"))) ++ switch (opts.mode) { ++ case CR_DUMP: ++ /* fallthrough */ ++ case CR_PRE_DUMP: + return O_DUMP; +- +- if (!strcmp(argv[optind], "restore") || +- (!strcmp(argv[optind], "cpuinfo") && !strcmp(argv[optind + 1], "restore"))) ++ case CR_RESTORE: + return O_RSTR; ++ case CR_CPUINFO: ++ if (!strcmp(argv[optind + 1], "dump")) ++ return O_DUMP; ++ /* fallthrough */ ++ default: ++ return -1; ++ } + ++ /* never reached */ ++ BUG(); + return -1; + } + +-- +2.34.1 + diff --git a/0088-crtools-check-that-cpuinfo-command-has-sub-command.patch b/0088-crtools-check-that-cpuinfo-command-has-sub-command.patch new file mode 100644 index 0000000..7278b9f --- /dev/null +++ b/0088-crtools-check-that-cpuinfo-command-has-sub-command.patch @@ -0,0 +1,29 @@ +From d2632238947d8aa9096deb27ae8ba05971f43de9 Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Thu, 16 Dec 2021 18:05:01 +0300 +Subject: [PATCH 088/120] crtools: check that cpuinfo command has sub-command + +This fixes segfault on empty sub-command for cpuinfo. + +Signed-off-by: Pavel Tikhomirov +--- + criu/crtools.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/criu/crtools.c b/criu/crtools.c +index 7bf92ffd0..0752800f6 100644 +--- a/criu/crtools.c ++++ b/criu/crtools.c +@@ -222,6 +222,9 @@ int main(int argc, char *argv[], char *envp[]) + if (opts.mode != CR_CPUINFO && has_sub_command) { + pr_err("excessive parameter%s for command %s\n", (argc - optind) > 2 ? "s" : "", argv[optind]); + goto usage; ++ } else if (opts.mode == CR_CPUINFO && !has_sub_command) { ++ pr_err("cpuinfo requires an action: dump or check\n"); ++ goto usage; + } + } + +-- +2.34.1 + diff --git a/0089-sk-unix-Add-support-for-SOCK_SEQPACKET-unix-sockets.patch b/0089-sk-unix-Add-support-for-SOCK_SEQPACKET-unix-sockets.patch new file mode 100644 index 0000000..34cb26b --- /dev/null +++ b/0089-sk-unix-Add-support-for-SOCK_SEQPACKET-unix-sockets.patch @@ -0,0 +1,53 @@ +From 2407ff4a1f96fe206bcc246d58f90d24aa8f4e1e Mon Sep 17 00:00:00 2001 +From: Bui Quang Minh +Date: Tue, 14 Dec 2021 22:28:27 +0700 +Subject: [PATCH 089/120] sk-unix: Add support for SOCK_SEQPACKET unix sockets + +Adjust some SOCK_STREAM cases to handle SOCK_SEQPACKET too. + +Signed-off-by: Bui Quang Minh +--- + criu/sk-unix.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/criu/sk-unix.c b/criu/sk-unix.c +index d3402c3ac..194193dff 100644 +--- a/criu/sk-unix.c ++++ b/criu/sk-unix.c +@@ -402,12 +402,12 @@ static int dump_one_unix_fd(int lfd, uint32_t id, const struct fd_parms *p) + sk_encode_shutdown(ue, sk->shutdown); + + /* +- * If a stream listening socket has non-zero rqueue, this +- * means there are in-flight connections waiting to get ++ * If a stream/seqpacket listening socket has non-zero rqueue, ++ * this means there are in-flight connections waiting to get + * accept()-ed. We handle them separately with the "icons" + * (i stands for in-flight, cons -- for connections) things. + */ +- if (sk->rqlen != 0 && !(sk->type == SOCK_STREAM && sk->state == TCP_LISTEN)) { ++ if (sk->rqlen != 0 && sk->state != TCP_LISTEN) { + if (dump_sk_queue(lfd, id)) + goto err; + } +@@ -1610,7 +1610,7 @@ static int bind_unix_sk(int sk, struct unix_sk_info *ui) + if (ui->ue->name.len == 0) + return 0; + +- if ((ui->ue->type == SOCK_STREAM) && (ui->ue->state == TCP_ESTABLISHED)) { ++ if ((ui->ue->type != SOCK_DGRAM) && (ui->ue->state == TCP_ESTABLISHED)) { + /* + * FIXME this can be done, but for doing this properly we + * need to bind socket to its name, then rename one to +@@ -1851,7 +1851,7 @@ static int open_unixsk_standalone(struct unix_sk_info *ui, int *new_fd) + + close(sks[1]); + sk = sks[0]; +- } else if ((ui->ue->state == TCP_ESTABLISHED && ui->ue->type == SOCK_STREAM) && queuer && ++ } else if ((ui->ue->state == TCP_ESTABLISHED && ui->ue->type != SOCK_DGRAM) && queuer && + queuer->ue->ino == FAKE_INO) { + int ret, sks[2]; + +-- +2.34.1 + diff --git a/0090-zdtm-Add-SOCK_SEQPACKET-variants-to-unix-socket-test.patch b/0090-zdtm-Add-SOCK_SEQPACKET-variants-to-unix-socket-test.patch new file mode 100644 index 0000000..9b9024b --- /dev/null +++ b/0090-zdtm-Add-SOCK_SEQPACKET-variants-to-unix-socket-test.patch @@ -0,0 +1,574 @@ +From 41a696dcc5ebef28ce8e9ed28fe9c3e8518868ec Mon Sep 17 00:00:00 2001 +From: Bui Quang Minh +Date: Thu, 16 Dec 2021 09:35:25 +0700 +Subject: [PATCH 090/120] zdtm: Add SOCK_SEQPACKET variants to unix socket + tests + +This commit simply makes copies of SOCK_STREAM unix socket tests and uses +SOCK_SEQPACKET instead. + +Signed-off-by: Bui Quang Minh +--- + test/zdtm/static/Makefile | 23 +++++++++++++++++++ + test/zdtm/static/del_standalone_un.c | 8 ++++++- + .../zdtm/static/del_standalone_un_seqpacket.c | 1 + + test/zdtm/static/scm03-seqpacket.c | 1 + + test/zdtm/static/scm03.c | 8 ++++++- + test/zdtm/static/sk-unix-rel-seqpacket.c | 1 + + test/zdtm/static/sk-unix-rel.c | 10 ++++++-- + test/zdtm/static/sk-unix-unconn-seqpacket.c | 1 + + test/zdtm/static/sk-unix-unconn.c | 10 ++++++-- + test/zdtm/static/sk-unix01-seqpacket.c | 1 + + test/zdtm/static/sk-unix01-seqpacket.desc | 1 + + test/zdtm/static/sk-unix01.c | 12 +++++++--- + test/zdtm/static/socket_queues.c | 8 ++++++- + test/zdtm/static/socket_queues_seqpacket.c | 1 + + test/zdtm/static/sockets00-seqpacket.c | 1 + + test/zdtm/static/sockets00-seqpacket.desc | 1 + + test/zdtm/static/sockets00.c | 12 +++++++--- + test/zdtm/static/sockets01-seqpacket.c | 1 + + test/zdtm/static/sockets01.c | 10 ++++++-- + test/zdtm/static/sockets02-seqpacket.c | 1 + + test/zdtm/static/sockets02.c | 8 ++++++- + test/zdtm/static/sockets03-seqpacket.c | 1 + + test/zdtm/static/sockets03-seqpacket.desc | 1 + + test/zdtm/static/sockets03.c | 10 ++++++-- + test/zdtm/static/sockets_spair.c | 8 ++++++- + test/zdtm/static/sockets_spair_seqpacket.c | 1 + + 26 files changed, 122 insertions(+), 19 deletions(-) + create mode 120000 test/zdtm/static/del_standalone_un_seqpacket.c + create mode 120000 test/zdtm/static/scm03-seqpacket.c + create mode 120000 test/zdtm/static/sk-unix-rel-seqpacket.c + create mode 120000 test/zdtm/static/sk-unix-unconn-seqpacket.c + create mode 120000 test/zdtm/static/sk-unix01-seqpacket.c + create mode 120000 test/zdtm/static/sk-unix01-seqpacket.desc + create mode 120000 test/zdtm/static/socket_queues_seqpacket.c + create mode 120000 test/zdtm/static/sockets00-seqpacket.c + create mode 120000 test/zdtm/static/sockets00-seqpacket.desc + create mode 120000 test/zdtm/static/sockets01-seqpacket.c + create mode 120000 test/zdtm/static/sockets02-seqpacket.c + create mode 120000 test/zdtm/static/sockets03-seqpacket.c + create mode 120000 test/zdtm/static/sockets03-seqpacket.desc + create mode 120000 test/zdtm/static/sockets_spair_seqpacket.c + +diff --git a/test/zdtm/static/Makefile b/test/zdtm/static/Makefile +index 3e1e0a498..4a21978b5 100644 +--- a/test/zdtm/static/Makefile ++++ b/test/zdtm/static/Makefile +@@ -68,9 +68,13 @@ TST_NOFILE := \ + utsname \ + pstree \ + sockets01 \ ++ sockets01-seqpacket \ + sockets02 \ ++ sockets02-seqpacket \ + sockets_spair \ ++ sockets_spair_seqpacket \ + socket_queues \ ++ socket_queues_seqpacket \ + socket-raw \ + socket-tcp \ + socket-tcp-listen \ +@@ -119,6 +123,7 @@ TST_NOFILE := \ + sock_opts01 \ + sock_opts02 \ + sk-unix-unconn \ ++ sk-unix-unconn-seqpacket \ + ipc_namespace \ + selfexe00 \ + sem \ +@@ -187,6 +192,7 @@ TST_NOFILE := \ + scm01 \ + scm02 \ + scm03 \ ++ scm03-seqpacket \ + scm04 \ + scm05 \ + scm06 \ +@@ -284,6 +290,7 @@ TST_FILE = \ + file_attr \ + deleted_unix_sock \ + sk-unix-rel \ ++ sk-unix-rel-seqpacket \ + deleted_dev \ + unlink_fstat00 \ + unlink_fstat01 \ +@@ -311,7 +318,9 @@ TST_FILE = \ + cow01 \ + fdt_shared \ + sockets00 \ ++ sockets00-seqpacket \ + sockets03 \ ++ sockets03-seqpacket \ + sockets_dgram \ + file_lease00 \ + file_lease01 \ +@@ -394,8 +403,10 @@ TST_DIR = \ + mnt_enablefs \ + autofs \ + del_standalone_un \ ++ del_standalone_un_seqpacket \ + sk-unix-mntns \ + sk-unix01 \ ++ sk-unix01-seqpacket \ + sk-unix-dgram-ghost \ + unsupported_children_collision \ + shared_slave_mount_children \ +@@ -607,6 +618,18 @@ socket-tcp6-unconn: CFLAGS += -D ZDTM_IPV6 + socket-tcp4v6-last-ack: CFLAGS += -D ZDTM_TCP_LAST_ACK -D ZDTM_IPV4V6 + socket-tcp4v6-closing: CFLAGS += -D ZDTM_IPV4V6 + ++sockets00-seqpacket: CFLAGS += -D ZDTM_UNIX_SEQPACKET ++sockets01-seqpacket: CFLAGS += -D ZDTM_UNIX_SEQPACKET ++sockets02-seqpacket: CFLAGS += -D ZDTM_UNIX_SEQPACKET ++sockets03-seqpacket: CFLAGS += -D ZDTM_UNIX_SEQPACKET ++sk-unix01-seqpacket: CFLAGS += -D ZDTM_UNIX_SEQPACKET ++sk-unix-rel-seqpacket: CFLAGS += -D ZDTM_UNIX_SEQPACKET ++sockets_spair_seqpacket: CFLAGS += -D ZDTM_UNIX_SEQPACKET ++socket_queues_seqpacket: CFLAGS += -D ZDTM_UNIX_SEQPACKET ++del_standalone_un_seqpacket: CFLAGS += -D ZDTM_UNIX_SEQPACKET ++sk-unix-unconn-seqpacket: CFLAGS += -D ZDTM_UNIX_SEQPACKET ++scm03-seqpacket: CFLAGS += -D ZDTM_UNIX_SEQPACKET ++ + pty-console: CFLAGS += -D ZDTM_DEV_CONSOLE + + shm-unaligned: CFLAGS += -DZDTM_SHM_UNALIGNED +diff --git a/test/zdtm/static/del_standalone_un.c b/test/zdtm/static/del_standalone_un.c +index c9fa84870..b4f99e260 100644 +--- a/test/zdtm/static/del_standalone_un.c ++++ b/test/zdtm/static/del_standalone_un.c +@@ -16,11 +16,17 @@ const char *test_author = "Tycho Andersen "; + char *dirname; + TEST_OPTION(dirname, string, "directory name", 1); + ++#ifdef ZDTM_UNIX_SEQPACKET ++#define SOCK_TYPE SOCK_SEQPACKET ++#else ++#define SOCK_TYPE SOCK_STREAM ++#endif ++ + static int bind_and_listen(struct sockaddr_un *addr) + { + int sk; + +- sk = socket(PF_UNIX, SOCK_STREAM, 0); ++ sk = socket(PF_UNIX, SOCK_TYPE, 0); + if (sk < 0) { + fail("socket"); + return -1; +diff --git a/test/zdtm/static/del_standalone_un_seqpacket.c b/test/zdtm/static/del_standalone_un_seqpacket.c +new file mode 120000 +index 000000000..d88fcbad8 +--- /dev/null ++++ b/test/zdtm/static/del_standalone_un_seqpacket.c +@@ -0,0 +1 @@ ++del_standalone_un.c +\ No newline at end of file +diff --git a/test/zdtm/static/scm03-seqpacket.c b/test/zdtm/static/scm03-seqpacket.c +new file mode 120000 +index 000000000..f1f86dd8b +--- /dev/null ++++ b/test/zdtm/static/scm03-seqpacket.c +@@ -0,0 +1 @@ ++scm03.c +\ No newline at end of file +diff --git a/test/zdtm/static/scm03.c b/test/zdtm/static/scm03.c +index a40fc0101..4453f7e93 100644 +--- a/test/zdtm/static/scm03.c ++++ b/test/zdtm/static/scm03.c +@@ -9,6 +9,12 @@ + const char *test_doc = "Check that SCM_RIGHTS are preserved"; + const char *test_author = "Pavel Emelyanov "; + ++#ifdef ZDTM_UNIX_SEQPACKET ++#define SOCK_TYPE SOCK_SEQPACKET ++#else ++#define SOCK_TYPE SOCK_DGRAM ++#endif ++ + static int send_fd(int via, int fd1, int fd2) + { + struct msghdr h = {}; +@@ -105,7 +111,7 @@ int main(int argc, char **argv) + + test_init(argc, argv); + +- if (socketpair(PF_UNIX, SOCK_DGRAM, 0, sk) < 0) { ++ if (socketpair(PF_UNIX, SOCK_TYPE, 0, sk) < 0) { + pr_perror("Can't make unix pair"); + exit(1); + } +diff --git a/test/zdtm/static/sk-unix-rel-seqpacket.c b/test/zdtm/static/sk-unix-rel-seqpacket.c +new file mode 120000 +index 000000000..1f98e3845 +--- /dev/null ++++ b/test/zdtm/static/sk-unix-rel-seqpacket.c +@@ -0,0 +1 @@ ++sk-unix-rel.c +\ No newline at end of file +diff --git a/test/zdtm/static/sk-unix-rel.c b/test/zdtm/static/sk-unix-rel.c +index 10c19080a..7e4aeafe6 100644 +--- a/test/zdtm/static/sk-unix-rel.c ++++ b/test/zdtm/static/sk-unix-rel.c +@@ -25,6 +25,12 @@ TEST_OPTION(filename, string, "socket file name", 1); + + #define TEST_MODE 0640 + ++#ifdef ZDTM_UNIX_SEQPACKET ++#define SOCK_TYPE SOCK_SEQPACKET ++#else ++#define SOCK_TYPE SOCK_STREAM ++#endif ++ + int main(int argc, char *argv[]) + { + struct sockaddr_un addr; +@@ -54,8 +60,8 @@ int main(int argc, char *argv[]) + memcpy(addr.sun_path, filename, addrlen); + addrlen += sizeof(addr.sun_family); + +- sock[0] = socket(AF_UNIX, SOCK_STREAM, 0); +- sock[1] = socket(AF_UNIX, SOCK_STREAM, 0); ++ sock[0] = socket(AF_UNIX, SOCK_TYPE, 0); ++ sock[1] = socket(AF_UNIX, SOCK_TYPE, 0); + if (sock[0] < 0 || sock[1] < 0) { + fail("socket"); + exit(1); +diff --git a/test/zdtm/static/sk-unix-unconn-seqpacket.c b/test/zdtm/static/sk-unix-unconn-seqpacket.c +new file mode 120000 +index 000000000..f5c276186 +--- /dev/null ++++ b/test/zdtm/static/sk-unix-unconn-seqpacket.c +@@ -0,0 +1 @@ ++sk-unix-unconn.c +\ No newline at end of file +diff --git a/test/zdtm/static/sk-unix-unconn.c b/test/zdtm/static/sk-unix-unconn.c +index caad3d315..62e48247f 100644 +--- a/test/zdtm/static/sk-unix-unconn.c ++++ b/test/zdtm/static/sk-unix-unconn.c +@@ -9,6 +9,12 @@ + const char *test_doc = "Check unconnected unix sockets"; + const char *test_author = "Vagin Andrew "; + ++#ifdef ZDTM_UNIX_SEQPACKET ++#define SOCK_TYPE SOCK_SEQPACKET ++#else ++#define SOCK_TYPE SOCK_STREAM ++#endif ++ + int main(int argc, char **argv) + { + int sk, skc; +@@ -19,13 +25,13 @@ int main(int argc, char **argv) + + test_init(argc, argv); + +- sk = socket(AF_UNIX, SOCK_STREAM, 0); ++ sk = socket(AF_UNIX, SOCK_TYPE, 0); + if (sk == -1) { + pr_perror("socket"); + return 1; + } + +- skc = socket(AF_UNIX, SOCK_STREAM, 0); ++ skc = socket(AF_UNIX, SOCK_TYPE, 0); + if (skc == -1) { + pr_perror("socket"); + return 1; +diff --git a/test/zdtm/static/sk-unix01-seqpacket.c b/test/zdtm/static/sk-unix01-seqpacket.c +new file mode 120000 +index 000000000..bef734ed6 +--- /dev/null ++++ b/test/zdtm/static/sk-unix01-seqpacket.c +@@ -0,0 +1 @@ ++sk-unix01.c +\ No newline at end of file +diff --git a/test/zdtm/static/sk-unix01-seqpacket.desc b/test/zdtm/static/sk-unix01-seqpacket.desc +new file mode 120000 +index 000000000..7a30da25c +--- /dev/null ++++ b/test/zdtm/static/sk-unix01-seqpacket.desc +@@ -0,0 +1 @@ ++sk-unix01.desc +\ No newline at end of file +diff --git a/test/zdtm/static/sk-unix01.c b/test/zdtm/static/sk-unix01.c +index c2bb8b9ed..5146c027f 100644 +--- a/test/zdtm/static/sk-unix01.c ++++ b/test/zdtm/static/sk-unix01.c +@@ -24,6 +24,12 @@ const char *test_author = "Cyrill Gorcunov "; + char *dirname; + TEST_OPTION(dirname, string, "directory name", 1); + ++#ifdef ZDTM_UNIX_SEQPACKET ++#define SOCK_TYPE SOCK_SEQPACKET ++#else ++#define SOCK_TYPE SOCK_STREAM ++#endif ++ + static int sk_alloc_bind(int type, struct sockaddr_un *addr) + { + int sk; +@@ -256,7 +262,7 @@ int main(int argc, char **argv) + + unlink(addr.sun_path); + +- sk_st[0] = sk_alloc_bind(SOCK_STREAM, &addr); ++ sk_st[0] = sk_alloc_bind(SOCK_TYPE, &addr); + if (sk_st[0] < 0) + return 1; + test_msg("sk-st: alloc/bind/listen %d\n", sk_st[0]); +@@ -266,7 +272,7 @@ int main(int argc, char **argv) + return 1; + } + +- sk_st[1] = sk_alloc_connect(SOCK_STREAM, &addr); ++ sk_st[1] = sk_alloc_connect(SOCK_TYPE, &addr); + if (sk_st[1] < 0) + return 1; + test_msg("sk-st: alloc/connect %d\n", sk_st[1]); +@@ -279,7 +285,7 @@ int main(int argc, char **argv) + } + test_msg("sk-st: accept %d\n", sk_st[2]); + +- sk_st[3] = sk_alloc_connect(SOCK_STREAM, &addr); ++ sk_st[3] = sk_alloc_connect(SOCK_TYPE, &addr); + if (sk_st[3] < 0) + return 1; + test_msg("sk-st: alloc/connect %d\n", sk_st[3]); +diff --git a/test/zdtm/static/socket_queues.c b/test/zdtm/static/socket_queues.c +index e30bca0e1..44495f06b 100644 +--- a/test/zdtm/static/socket_queues.c ++++ b/test/zdtm/static/socket_queues.c +@@ -24,6 +24,12 @@ const char *test_author = "Stanislav Kinsbursky \n"; + #define SK_DATA_D1 "packet dgram left" + #define SK_DATA_D2 "packet dgram right" + ++#ifdef ZDTM_UNIX_SEQPACKET ++#define SOCK_TYPE SOCK_SEQPACKET ++#else ++#define SOCK_TYPE SOCK_STREAM ++#endif ++ + int main(int argc, char *argv[]) + { + int ssk_pair_d[2]; +@@ -32,7 +38,7 @@ int main(int argc, char *argv[]) + + test_init(argc, argv); + +- if (socketpair(AF_UNIX, SOCK_STREAM, 0, ssk_pair_s) == -1) { ++ if (socketpair(AF_UNIX, SOCK_TYPE, 0, ssk_pair_s) == -1) { + fail("socketpair"); + exit(1); + } +diff --git a/test/zdtm/static/socket_queues_seqpacket.c b/test/zdtm/static/socket_queues_seqpacket.c +new file mode 120000 +index 000000000..0f3f93ea6 +--- /dev/null ++++ b/test/zdtm/static/socket_queues_seqpacket.c +@@ -0,0 +1 @@ ++socket_queues.c +\ No newline at end of file +diff --git a/test/zdtm/static/sockets00-seqpacket.c b/test/zdtm/static/sockets00-seqpacket.c +new file mode 120000 +index 000000000..4bce9fc31 +--- /dev/null ++++ b/test/zdtm/static/sockets00-seqpacket.c +@@ -0,0 +1 @@ ++sockets00.c +\ No newline at end of file +diff --git a/test/zdtm/static/sockets00-seqpacket.desc b/test/zdtm/static/sockets00-seqpacket.desc +new file mode 120000 +index 000000000..4beea2642 +--- /dev/null ++++ b/test/zdtm/static/sockets00-seqpacket.desc +@@ -0,0 +1 @@ ++sockets00.desc +\ No newline at end of file +diff --git a/test/zdtm/static/sockets00.c b/test/zdtm/static/sockets00.c +index 53890077b..ac5d7d6fe 100644 +--- a/test/zdtm/static/sockets00.c ++++ b/test/zdtm/static/sockets00.c +@@ -25,6 +25,12 @@ TEST_OPTION(filename, string, "socket file name", 1); + + #define TEST_MODE 0640 + ++#ifdef ZDTM_UNIX_SEQPACKET ++#define SOCK_TYPE SOCK_SEQPACKET ++#else ++#define SOCK_TYPE SOCK_STREAM ++#endif ++ + int main(int argc, char *argv[]) + { + int ssk_icon[4]; +@@ -58,9 +64,9 @@ int main(int argc, char *argv[]) + memcpy(addr.sun_path, path, addrlen); + addrlen += sizeof(addr.sun_family); + +- ssk_icon[0] = socket(AF_UNIX, SOCK_STREAM, 0); +- ssk_icon[1] = socket(AF_UNIX, SOCK_STREAM, 0); +- ssk_icon[2] = socket(AF_UNIX, SOCK_STREAM, 0); ++ ssk_icon[0] = socket(AF_UNIX, SOCK_TYPE, 0); ++ ssk_icon[1] = socket(AF_UNIX, SOCK_TYPE, 0); ++ ssk_icon[2] = socket(AF_UNIX, SOCK_TYPE, 0); + if (ssk_icon[0] < 0 || ssk_icon[1] < 0 || ssk_icon[2] < 0) { + fail("socket"); + exit(1); +diff --git a/test/zdtm/static/sockets01-seqpacket.c b/test/zdtm/static/sockets01-seqpacket.c +new file mode 120000 +index 000000000..8d51121e1 +--- /dev/null ++++ b/test/zdtm/static/sockets01-seqpacket.c +@@ -0,0 +1 @@ ++sockets01.c +\ No newline at end of file +diff --git a/test/zdtm/static/sockets01.c b/test/zdtm/static/sockets01.c +index e35a31fec..f56cd219e 100644 +--- a/test/zdtm/static/sockets01.c ++++ b/test/zdtm/static/sockets01.c +@@ -30,6 +30,12 @@ const char *test_author = "Pavel Emelyanov "; + #define TEST_MSG "test-message" + static char buf[sizeof(TEST_MSG)]; + ++#ifdef ZDTM_UNIX_SEQPACKET ++#define SOCK_TYPE SOCK_SEQPACKET ++#else ++#define SOCK_TYPE SOCK_STREAM ++#endif ++ + int main(int argc, char *argv[]) + { + int spu[2], spb[2], dpu[2], dpb[2], dpd[2]; +@@ -40,14 +46,14 @@ int main(int argc, char *argv[]) + signal(SIGPIPE, SIG_IGN); + + /* spu -- stream pair, unidirectional shutdown */ +- if (socketpair(PF_UNIX, SOCK_STREAM, 0, spu) < 0) ++ if (socketpair(PF_UNIX, SOCK_TYPE, 0, spu) < 0) + fin("no stream pair 1"); + + if (shutdown(spu[0], SHUT_RD) < 0) + fin("no stream shutdown 1"); + + /* spb -- stream pair, bidirectional shutdown */ +- if (socketpair(PF_UNIX, SOCK_STREAM, 0, spb) < 0) ++ if (socketpair(PF_UNIX, SOCK_TYPE, 0, spb) < 0) + fin("no stream pair 2"); + + if (shutdown(spb[0], SHUT_RDWR) < 0) +diff --git a/test/zdtm/static/sockets02-seqpacket.c b/test/zdtm/static/sockets02-seqpacket.c +new file mode 120000 +index 000000000..b95831599 +--- /dev/null ++++ b/test/zdtm/static/sockets02-seqpacket.c +@@ -0,0 +1 @@ ++sockets02.c +\ No newline at end of file +diff --git a/test/zdtm/static/sockets02.c b/test/zdtm/static/sockets02.c +index 2729ade2c..d7d84d815 100644 +--- a/test/zdtm/static/sockets02.c ++++ b/test/zdtm/static/sockets02.c +@@ -16,6 +16,12 @@ + const char *test_doc = "Test semi-closed unix stream connection\n"; + const char *test_author = "Pavel Emelyanov \n"; + ++#ifdef ZDTM_UNIX_SEQPACKET ++#define SOCK_TYPE SOCK_SEQPACKET ++#else ++#define SOCK_TYPE SOCK_STREAM ++#endif ++ + int main(int argc, char *argv[]) + { + int ssk_pair[2], ret; +@@ -25,7 +31,7 @@ int main(int argc, char *argv[]) + + data = (char)lrand48(); + +- if (socketpair(AF_UNIX, SOCK_STREAM, 0, ssk_pair) == -1) { ++ if (socketpair(AF_UNIX, SOCK_TYPE, 0, ssk_pair) == -1) { + fail("socketpair"); + exit(1); + } +diff --git a/test/zdtm/static/sockets03-seqpacket.c b/test/zdtm/static/sockets03-seqpacket.c +new file mode 120000 +index 000000000..997cce673 +--- /dev/null ++++ b/test/zdtm/static/sockets03-seqpacket.c +@@ -0,0 +1 @@ ++sockets03.c +\ No newline at end of file +diff --git a/test/zdtm/static/sockets03-seqpacket.desc b/test/zdtm/static/sockets03-seqpacket.desc +new file mode 120000 +index 000000000..3798a8242 +--- /dev/null ++++ b/test/zdtm/static/sockets03-seqpacket.desc +@@ -0,0 +1 @@ ++sockets03.desc +\ No newline at end of file +diff --git a/test/zdtm/static/sockets03.c b/test/zdtm/static/sockets03.c +index cd6f60831..6b0915aaa 100644 +--- a/test/zdtm/static/sockets03.c ++++ b/test/zdtm/static/sockets03.c +@@ -22,6 +22,12 @@ const char *test_author = "Andrey Ryabinin "; + char *filename; + TEST_OPTION(filename, string, "socket file name", 1); + ++#ifdef ZDTM_UNIX_SEQPACKET ++#define SOCK_TYPE SOCK_SEQPACKET ++#else ++#define SOCK_TYPE SOCK_STREAM ++#endif ++ + int main(int argc, char *argv[]) + { + int sk[3]; +@@ -52,8 +58,8 @@ int main(int argc, char *argv[]) + memcpy(addr.sun_path, path, addrlen); + addrlen += sizeof(addr.sun_family); + +- sk[0] = socket(AF_UNIX, SOCK_STREAM, 0); +- sk[1] = socket(AF_UNIX, SOCK_STREAM, 0); ++ sk[0] = socket(AF_UNIX, SOCK_TYPE, 0); ++ sk[1] = socket(AF_UNIX, SOCK_TYPE, 0); + if (sk[0] < 0 || sk[1] < 0) { + fail("socket"); + exit(1); +diff --git a/test/zdtm/static/sockets_spair.c b/test/zdtm/static/sockets_spair.c +index 2dbb132aa..202c2e790 100644 +--- a/test/zdtm/static/sockets_spair.c ++++ b/test/zdtm/static/sockets_spair.c +@@ -18,6 +18,12 @@ const char *test_author = "Cyrill Gorcunov +Date: Tue, 7 Dec 2021 21:29:44 +0000 +Subject: [PATCH 091/120] tls: fix typo + +Signed-off-by: Radostin Stoyanov +--- + criu/tls.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/criu/tls.c b/criu/tls.c +index 60bd105bc..6a7b523ac 100644 +--- a/criu/tls.c ++++ b/criu/tls.c +@@ -8,7 +8,7 @@ + #include "cr_options.h" + #include "xmalloc.h" + +-/* Compatability with GnuTLS verson <3.5 */ ++/* Compatability with GnuTLS version < 3.5 */ + #ifndef GNUTLS_E_CERTIFICATE_VERIFICATION_ERROR + #define GNUTLS_E_CERTIFICATE_VERIFICATION_ERROR GNUTLS_E_CERTIFICATE_ERROR + #endif +-- +2.34.1 + diff --git a/0092-tls-use-ssize_t-for-return-value.patch b/0092-tls-use-ssize_t-for-return-value.patch new file mode 100644 index 0000000..642a9e8 --- /dev/null +++ b/0092-tls-use-ssize_t-for-return-value.patch @@ -0,0 +1,71 @@ +From 6ca82330a3bda6b70ea52fcae163a904d0c0b7df Mon Sep 17 00:00:00 2001 +From: Radostin Stoyanov +Date: Tue, 7 Dec 2021 22:32:54 +0000 +Subject: [PATCH 092/120] tls: use ssize_t for return value + +Signed-off-by: Radostin Stoyanov +--- + criu/tls.c | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/criu/tls.c b/criu/tls.c +index 6a7b523ac..626e529f8 100644 +--- a/criu/tls.c ++++ b/criu/tls.c +@@ -53,7 +53,7 @@ void tls_terminate_session(void) + + ssize_t tls_send(const void *buf, size_t len, int flags) + { +- int ret; ++ ssize_t ret; + + tls_sk_flags = flags; + ret = gnutls_record_send(session, buf, len); +@@ -95,7 +95,7 @@ int tls_send_data_from_fd(int fd, unsigned long len) + return -1; + + while (len > 0) { +- int ret, sent; ++ ssize_t ret, sent; + + copied = read(fd, buf, min(len, buf_size)); + if (copied <= 0) { +@@ -119,7 +119,7 @@ err: + + ssize_t tls_recv(void *buf, size_t len, int flags) + { +- int ret; ++ ssize_t ret; + + tls_sk_flags = flags; + ret = gnutls_record_recv(session, buf, len); +@@ -163,7 +163,7 @@ int tls_recv_data_to_fd(int fd, unsigned long len) + gnutls_packet_t packet; + + while (len > 0) { +- int ret, w; ++ ssize_t ret, w; + gnutls_datum_t pdata; + + ret = gnutls_record_recv_packet(session, &packet); +@@ -301,7 +301,7 @@ static int tls_x509_setup_creds(void) + static ssize_t _tls_push_cb(void *p, const void *data, size_t sz) + { + int fd = *(int *)(p); +- int ret = send(fd, data, sz, tls_sk_flags); ++ ssize_t ret = send(fd, data, sz, tls_sk_flags); + if (ret < 0 && errno != EAGAIN) { + int _errno = errno; + pr_perror("Push callback send failed"); +@@ -313,7 +313,7 @@ static ssize_t _tls_push_cb(void *p, const void *data, size_t sz) + static ssize_t _tls_pull_cb(void *p, void *data, size_t sz) + { + int fd = *(int *)(p); +- int ret = recv(fd, data, sz, tls_sk_flags); ++ ssize_t ret = recv(fd, data, sz, tls_sk_flags); + if (ret < 0 && errno != EAGAIN) { + int _errno = errno; + pr_perror("Pull callback recv failed"); +-- +2.34.1 + diff --git a/0093-tls-add-more-comments.patch b/0093-tls-add-more-comments.patch new file mode 100644 index 0000000..fa89fb4 --- /dev/null +++ b/0093-tls-add-more-comments.patch @@ -0,0 +1,111 @@ +From 8bddd88b3e15d167bad53b14b161f5cb628f2923 Mon Sep 17 00:00:00 2001 +From: Radostin Stoyanov +Date: Thu, 16 Dec 2021 14:26:53 +0000 +Subject: [PATCH 093/120] tls: add more comments + +Signed-off-by: Radostin Stoyanov +--- + criu/tls.c | 26 +++++++++++++++++++++++++- + 1 file changed, 25 insertions(+), 1 deletion(-) + +diff --git a/criu/tls.c b/criu/tls.c +index 626e529f8..9985b037d 100644 +--- a/criu/tls.c ++++ b/criu/tls.c +@@ -40,13 +40,19 @@ void tls_terminate_session(void) + + if (session) { + do { +- /* don't wait for peer to close connection */ ++ /* ++ * Initiate a connection shutdown but don't ++ * wait for peer to close connection. ++ */ + ret = gnutls_bye(session, GNUTLS_SHUT_WR); + } while (ret == GNUTLS_E_AGAIN || ret == GNUTLS_E_INTERRUPTED); ++ /* Free the session object */ + gnutls_deinit(session); + } + + tls_sk = -1; ++ ++ /* Free the credentials object */ + if (x509_cred) + gnutls_certificate_free_credentials(x509_cred); + } +@@ -229,6 +235,7 @@ static int tls_handshake(void) + { + int ret = -1; + while (ret != GNUTLS_E_SUCCESS) { ++ /* Establish TLS session */ + ret = gnutls_handshake(session); + if (gnutls_error_is_fatal(ret)) { + tls_perror("TLS handshake failed", ret); +@@ -257,6 +264,7 @@ static int tls_x509_setup_creds(void) + if (opts.tls_key) + key = opts.tls_key; + ++ /* Load the trusted CA certificates */ + ret = gnutls_certificate_allocate_credentials(&x509_cred); + if (ret != GNUTLS_E_SUCCESS) { + tls_perror("Failed to allocate x509 credentials", ret); +@@ -298,6 +306,10 @@ static int tls_x509_setup_creds(void) + return 0; + } + ++/** ++ * A function used by gnutls to send data. It returns a positive ++ * number indicating the bytes sent, and -1 on error. ++ */ + static ssize_t _tls_push_cb(void *p, const void *data, size_t sz) + { + int fd = *(int *)(p); +@@ -310,6 +322,11 @@ static ssize_t _tls_push_cb(void *p, const void *data, size_t sz) + return ret; + } + ++/** ++ * A callback function used by gnutls to receive data. ++ * It returns 0 on connection termination, a positive number ++ * indicating the number of bytes received, and -1 on error. ++ */ + static ssize_t _tls_pull_cb(void *p, void *data, size_t sz) + { + int fd = *(int *)(p); +@@ -326,26 +343,33 @@ static int tls_x509_setup_session(unsigned int flags) + { + int ret; + ++ /* Create the session object */ + ret = gnutls_init(&session, flags); + if (ret != GNUTLS_E_SUCCESS) { + tls_perror("Failed to initialize session", ret); + return -1; + } + ++ /* Install the trusted certificates */ + ret = gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE, x509_cred); + if (ret != GNUTLS_E_SUCCESS) { + tls_perror("Failed to set session credentials", ret); + return -1; + } + ++ /* Configure the cipher preferences */ + ret = gnutls_set_default_priority(session); + if (ret != GNUTLS_E_SUCCESS) { + tls_perror("Failed to set priority", ret); + return -1; + } + ++ /* Associate the socket with the session object */ + gnutls_transport_set_ptr(session, &tls_sk); ++ ++ /* Set a push function for gnutls to use to send data */ + gnutls_transport_set_push_function(session, _tls_push_cb); ++ /* set a pull function for gnutls to use to receive data */ + gnutls_transport_set_pull_function(session, _tls_pull_cb); + + if (flags == GNUTLS_SERVER) { +-- +2.34.1 + diff --git a/0094-uffd-call-disconnect_from_page_server-to-shutdown-a-.patch b/0094-uffd-call-disconnect_from_page_server-to-shutdown-a-.patch new file mode 100644 index 0000000..20d90e1 --- /dev/null +++ b/0094-uffd-call-disconnect_from_page_server-to-shutdown-a-.patch @@ -0,0 +1,30 @@ +From c37140662d22e86e1096c953b888b6496b7e1f64 Mon Sep 17 00:00:00 2001 +From: Andrei Vagin +Date: Tue, 21 Dec 2021 21:59:13 -0800 +Subject: [PATCH 094/120] uffd: call disconnect_from_page_server to shutdown a + page-server connection + +We need to be sure that page-server doesn't wait for a new command when we +call gnutls_bye() that sends an alert containing a close request. + +Signed-off-by: Andrei Vagin +--- + criu/uffd.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/criu/uffd.c b/criu/uffd.c +index f01e6999b..45ac8ba77 100644 +--- a/criu/uffd.c ++++ b/criu/uffd.c +@@ -1468,7 +1468,7 @@ int cr_lazy_pages(bool daemon) + + ret = handle_requests(epollfd, &events, nr_fds); + +- tls_terminate_session(); ++ disconnect_from_page_server(); + + xfree(events); + return ret; +-- +2.34.1 + diff --git a/0095-tls-allow-to-terminate-connections-synchronously.patch b/0095-tls-allow-to-terminate-connections-synchronously.patch new file mode 100644 index 0000000..c6bea2b --- /dev/null +++ b/0095-tls-allow-to-terminate-connections-synchronously.patch @@ -0,0 +1,100 @@ +From fa03dcfff6a5215ef06c1e579eddb0f5c09f8798 Mon Sep 17 00:00:00 2001 +From: Andrei Vagin +Date: Wed, 22 Dec 2021 09:36:09 -0800 +Subject: [PATCH 095/120] tls: allow to terminate connections synchronously + +GNUTLS_SHUT_RDWR sends an alert containing a close request and waits for +the peer to reply with the same message. + +Signed-off-by: Andrei Vagin +--- + criu/include/tls.h | 4 ++-- + criu/page-xfer.c | 5 +++-- + criu/tls.c | 6 +++--- + 3 files changed, 8 insertions(+), 7 deletions(-) + +diff --git a/criu/include/tls.h b/criu/include/tls.h +index 26f9976fd..f563c092c 100644 +--- a/criu/include/tls.h ++++ b/criu/include/tls.h +@@ -4,7 +4,7 @@ + #ifdef CONFIG_GNUTLS + + int tls_x509_init(int sockfd, bool is_server); +-void tls_terminate_session(void); ++void tls_terminate_session(bool async); + + ssize_t tls_send(const void *buf, size_t len, int flags); + ssize_t tls_recv(void *buf, size_t len, int flags); +@@ -19,7 +19,7 @@ int tls_recv_data_to_fd(int fd, unsigned long len); + #define tls_recv(buf, len, flags) (-1) + #define tls_send_data_from_fd(fd, len) (-1) + #define tls_recv_data_to_fd(fd, len) (-1) +-#define tls_terminate_session() ++#define tls_terminate_session(async) + + #endif /* CONFIG_HAS_GNUTLS */ + +diff --git a/criu/page-xfer.c b/criu/page-xfer.c +index 9adf2c8b2..7ff07680f 100644 +--- a/criu/page-xfer.c ++++ b/criu/page-xfer.c +@@ -1259,6 +1259,8 @@ static int page_server_serve(int sk) + ret = -1; + } + ++ tls_terminate_session(ret != 0); ++ + if (ret == 0 && opts.ps_socket == -1) { + char c; + +@@ -1272,7 +1274,6 @@ static int page_server_serve(int sk) + } + } + +- tls_terminate_session(); + page_server_close(); + + pr_info("Session over\n"); +@@ -1504,7 +1505,7 @@ int disconnect_from_page_server(void) + + ret = 0; + out: +- tls_terminate_session(); ++ tls_terminate_session(ret != 0); + close_safe(&page_server_sk); + + return ret ?: status; +diff --git a/criu/tls.c b/criu/tls.c +index 9985b037d..4feaf613b 100644 +--- a/criu/tls.c ++++ b/criu/tls.c +@@ -31,7 +31,7 @@ static gnutls_certificate_credentials_t x509_cred; + static int tls_sk = -1; + static int tls_sk_flags = 0; + +-void tls_terminate_session(void) ++void tls_terminate_session(bool async) + { + int ret; + +@@ -44,7 +44,7 @@ void tls_terminate_session(void) + * Initiate a connection shutdown but don't + * wait for peer to close connection. + */ +- ret = gnutls_bye(session, GNUTLS_SHUT_WR); ++ ret = gnutls_bye(session, async ? GNUTLS_SHUT_WR : GNUTLS_SHUT_RDWR); + } while (ret == GNUTLS_E_AGAIN || ret == GNUTLS_E_INTERRUPTED); + /* Free the session object */ + gnutls_deinit(session); +@@ -399,6 +399,6 @@ int tls_x509_init(int sockfd, bool is_server) + + return 0; + err: +- tls_terminate_session(); ++ tls_terminate_session(true); + return -1; + } +-- +2.34.1 + diff --git a/0096-page-xfer-stop-waiting-for-a-new-command-after-a-clo.patch b/0096-page-xfer-stop-waiting-for-a-new-command-after-a-clo.patch new file mode 100644 index 0000000..289d530 --- /dev/null +++ b/0096-page-xfer-stop-waiting-for-a-new-command-after-a-clo.patch @@ -0,0 +1,66 @@ +From cc1120addd38d51f38c28fefae669172ba82120d Mon Sep 17 00:00:00 2001 +From: Andrei Vagin +Date: Wed, 22 Dec 2021 09:59:11 -0800 +Subject: [PATCH 096/120] page-xfer: stop waiting for a new command after a + close command + +There is no reason to do that and in case of tls, __recv returns EAGAIN +instead of 0. + +Signed-off-by: Andrei Vagin +--- + criu/page-xfer.c | 16 +++++++++------- + 1 file changed, 9 insertions(+), 7 deletions(-) + +diff --git a/criu/page-xfer.c b/criu/page-xfer.c +index 7ff07680f..60c793009 100644 +--- a/criu/page-xfer.c ++++ b/criu/page-xfer.c +@@ -50,8 +50,8 @@ static void psi2iovec(struct page_server_iov *ps, struct iovec *iov) + #define PS_IOV_ADD_F 6 + #define PS_IOV_GET 7 + +-#define PS_IOV_FLUSH 0x1023 +-#define PS_IOV_FLUSH_N_CLOSE 0x1024 ++#define PS_IOV_CLOSE 0x1023 ++#define PS_IOV_FORCE_CLOSE 0x1024 + + #define PS_CMD_BITS 16 + #define PS_CMD_MASK ((1 << PS_CMD_BITS) - 1) +@@ -1223,8 +1223,8 @@ static int page_server_serve(int sk) + ret = page_server_add(sk, &pi, flags); + break; + } +- case PS_IOV_FLUSH: +- case PS_IOV_FLUSH_N_CLOSE: { ++ case PS_IOV_CLOSE: ++ case PS_IOV_FORCE_CLOSE: { + int32_t status = 0; + + ret = 0; +@@ -1250,7 +1250,9 @@ static int page_server_serve(int sk) + break; + } + +- if (ret || (pi.cmd == PS_IOV_FLUSH_N_CLOSE)) ++ if (ret) ++ break; ++ if (pi.cmd == PS_IOV_CLOSE || pi.cmd == PS_IOV_FORCE_CLOSE) + break; + } + +@@ -1491,9 +1493,9 @@ int disconnect_from_page_server(void) + * the parent process) so we must order the + * page-server to terminate itself. + */ +- pi.cmd = PS_IOV_FLUSH_N_CLOSE; ++ pi.cmd = PS_IOV_FORCE_CLOSE; + else +- pi.cmd = PS_IOV_FLUSH; ++ pi.cmd = PS_IOV_CLOSE; + + if (send_psi(page_server_sk, &pi)) + goto out; +-- +2.34.1 + diff --git a/0097-ci-reenable-the-lazy-thp-test-in-the-lazy-remote-mod.patch b/0097-ci-reenable-the-lazy-thp-test-in-the-lazy-remote-mod.patch new file mode 100644 index 0000000..917884c --- /dev/null +++ b/0097-ci-reenable-the-lazy-thp-test-in-the-lazy-remote-mod.patch @@ -0,0 +1,30 @@ +From 5e975ab787ed677b03aa86f104b90984189c906b Mon Sep 17 00:00:00 2001 +From: Andrei Vagin +Date: Wed, 22 Dec 2021 17:03:04 -0800 +Subject: [PATCH 097/120] ci: reenable the lazy-thp test in the lazy-remote + mode + +Signed-off-by: Andrei Vagin +--- + scripts/ci/run-ci-tests.sh | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +diff --git a/scripts/ci/run-ci-tests.sh b/scripts/ci/run-ci-tests.sh +index bf7331142..7eab9f2dc 100755 +--- a/scripts/ci/run-ci-tests.sh ++++ b/scripts/ci/run-ci-tests.sh +@@ -212,10 +212,8 @@ LAZY_OPTS="-p 2 -T $LAZY_TESTS $LAZY_EXCLUDE $ZDTM_OPTS" + ./test/zdtm.py run $LAZY_OPTS --lazy-pages + # shellcheck disable=SC2086 + ./test/zdtm.py run $LAZY_OPTS --remote-lazy-pages +-# FIXME: post-copy migration of THP over TLS (sometimes) fails with: +-# Error (criu/tls.c:321): tls: Pull callback recv failed: Connection reset by peer + # shellcheck disable=SC2086 +-./test/zdtm.py run $LAZY_OPTS --remote-lazy-pages --tls -x lazy-thp ++./test/zdtm.py run $LAZY_OPTS --remote-lazy-pages --tls + + bash -x ./test/jenkins/criu-fault.sh + if [ "$UNAME_M" == "x86_64" ]; then +-- +2.34.1 + diff --git a/0098-test-log-testname.out.inprogress-if-a-test-has-faile.patch b/0098-test-log-testname.out.inprogress-if-a-test-has-faile.patch new file mode 100644 index 0000000..ff59e28 --- /dev/null +++ b/0098-test-log-testname.out.inprogress-if-a-test-has-faile.patch @@ -0,0 +1,38 @@ +From a5576e1e6b30411aa936ef05c4344121be58f183 Mon Sep 17 00:00:00 2001 +From: Andrei Vagin +Date: Wed, 22 Dec 2021 17:06:21 -0800 +Subject: [PATCH 098/120] test: log testname.out.inprogress if a test has + failed + +This is required if the test failed by timeout. + +Signed-off-by: Andrei Vagin +--- + test/zdtm.py | 11 ++++++----- + 1 file changed, 6 insertions(+), 5 deletions(-) + +diff --git a/test/zdtm.py b/test/zdtm.py +index 086ae0285..c0e24a41a 100755 +--- a/test/zdtm.py ++++ b/test/zdtm.py +@@ -589,11 +589,12 @@ class zdtm_test: + os.unlink(self.__pidfile()) + + def print_output(self): +- if os.access(self.__name + '.out', os.R_OK): +- print("Test output: " + "=" * 32) +- with open(self.__name + '.out') as output: +- print(output.read()) +- print(" <<< " + "=" * 32) ++ for postfix in ['.out', '.out.inprogress']: ++ if os.access(self.__name + postfix, os.R_OK): ++ print("Test output: " + "=" * 32) ++ with open(self.__name + postfix) as output: ++ print(output.read()) ++ print(" <<< " + "=" * 32) + + def static(self): + return self.__name.split('/')[1] == 'static' +-- +2.34.1 + diff --git a/0100-zdtm-static-uffd-events-add-more-log-messages.patch b/0100-zdtm-static-uffd-events-add-more-log-messages.patch new file mode 100644 index 0000000..cf733b8 --- /dev/null +++ b/0100-zdtm-static-uffd-events-add-more-log-messages.patch @@ -0,0 +1,53 @@ +From 4152a88cf588e94c9bf6edb3706cdf81fd25bce2 Mon Sep 17 00:00:00 2001 +From: Andrei Vagin +Date: Wed, 22 Dec 2021 17:08:42 -0800 +Subject: [PATCH 100/120] zdtm/static/uffd-events: add more log messages + +Signed-off-by: Andrei Vagin +--- + test/zdtm/static/uffd-events.c | 12 +++++++----- + 1 file changed, 7 insertions(+), 5 deletions(-) + +diff --git a/test/zdtm/static/uffd-events.c b/test/zdtm/static/uffd-events.c +index c811bcf4c..edd6c09ca 100644 +--- a/test/zdtm/static/uffd-events.c ++++ b/test/zdtm/static/uffd-events.c +@@ -153,28 +153,30 @@ int main(int argc, char **argv) + return 1; + } + ++ test_msg("For a child process\n"); + pid = fork(); + if (pid < 0) { + fail("Can't fork"); + return 1; + } + +- /* check madvise(MADV_DONTNEED) */ ++ test_msg("Check madvise(MADV_DONTNEED)\n"); + if (check_madv_dn(1)) + return 1; + +- /* check growing mremap */ ++ test_msg("Check growing mremap\n"); + if (check_mremap_grow(2)) + return 1; + +- /* check swapped mappings */ ++ test_msg("Check swapped mappings\n"); + if (check_swapped_mappings(3)) + return 1; + + if (pid) { +- int status; ++ int status = -1; + +- waitpid(-1, &status, 0); ++ test_msg("Wait for the child %d\n", pid); ++ waitpid(pid, &status, 0); + if (status) { + fail("child failed"); + return status; +-- +2.34.1 + diff --git a/0101-mount-split-check_mountpoint_fd-from-__open_mountpoi.patch b/0101-mount-split-check_mountpoint_fd-from-__open_mountpoi.patch new file mode 100644 index 0000000..8969503 --- /dev/null +++ b/0101-mount-split-check_mountpoint_fd-from-__open_mountpoi.patch @@ -0,0 +1,120 @@ +From 1d10fc1e0f2589d34b893c6432fcaab2f99018f7 Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Fri, 17 Dec 2021 14:58:47 +0300 +Subject: [PATCH 101/120] mount: split check_mountpoint_fd from + __open_mountpoint + +Now we can reuse "check" part separately in other places. + +Signed-off-by: Pavel Tikhomirov +--- + criu/include/mount.h | 1 + + criu/mount.c | 60 ++++++++++++++++++++++++-------------------- + 2 files changed, 34 insertions(+), 27 deletions(-) + +diff --git a/criu/include/mount.h b/criu/include/mount.h +index 7705279e4..23448d5fc 100644 +--- a/criu/include/mount.h ++++ b/criu/include/mount.h +@@ -109,6 +109,7 @@ extern int mntns_get_root_by_mnt_id(int mnt_id); + extern struct ns_id *lookup_nsid_by_mnt_id(int mnt_id); + + extern int open_mount(unsigned int s_dev); ++extern int check_mountpoint_fd(struct mount_info *pm, int mnt_fd); + extern int __open_mountpoint(struct mount_info *pm, int mnt_fd); + extern int mnt_is_dir(struct mount_info *pm); + extern int open_mountpoint(struct mount_info *pm); +diff --git a/criu/mount.c b/criu/mount.c +index d75ca5598..f6347fd9d 100644 +--- a/criu/mount.c ++++ b/criu/mount.c +@@ -1018,39 +1018,20 @@ int mnt_is_dir(struct mount_info *pm) + return 0; + } + +-/* +- * mnt_fd is a file descriptor on the mountpoint, which is closed in an error case. +- * If mnt_fd is -1, the mountpoint will be opened by this function. +- */ +-int __open_mountpoint(struct mount_info *pm, int mnt_fd) ++int check_mountpoint_fd(struct mount_info *pm, int mnt_fd) + { + struct stat st; +- int dev; +- int ret; +- +- if (mnt_fd == -1) { +- int mntns_root; +- +- mntns_root = mntns_get_root_fd(pm->nsid); +- if (mntns_root < 0) +- return -1; +- +- mnt_fd = openat(mntns_root, pm->ns_mountpoint, O_RDONLY); +- if (mnt_fd < 0) { +- pr_perror("Can't open %s", pm->ns_mountpoint); +- return -1; +- } +- } ++ int ret, dev; + + ret = fstat(mnt_fd, &st); + if (ret < 0) { + pr_perror("fstat(%s) failed", pm->ns_mountpoint); +- goto err; ++ return -1; + } + + if (pm->s_dev_rt == MOUNT_INVALID_DEV) { + pr_err("Resolving over invalid device for %#x %s %s\n", pm->s_dev, pm->fstype->name, pm->ns_mountpoint); +- goto err; ++ return -1; + } + + dev = MKKDEV(major(st.st_dev), minor(st.st_dev)); +@@ -1063,13 +1044,38 @@ int __open_mountpoint(struct mount_info *pm, int mnt_fd) + if (dev != pm->s_dev_rt) { + pr_err("The file system %#x %#x (%#x) %s %s is inaccessible\n", pm->s_dev, pm->s_dev_rt, dev, + pm->fstype->name, pm->ns_mountpoint); +- goto err; ++ return -1; ++ } ++ ++ return 0; ++} ++ ++/* ++ * mnt_fd is a file descriptor on the mountpoint, which is closed in an error case. ++ * If mnt_fd is -1, the mountpoint will be opened by this function. ++ */ ++int __open_mountpoint(struct mount_info *pm, int mnt_fd) ++{ ++ if (mnt_fd == -1) { ++ int mntns_root; ++ ++ mntns_root = mntns_get_root_fd(pm->nsid); ++ if (mntns_root < 0) ++ return -1; ++ ++ mnt_fd = openat(mntns_root, pm->ns_mountpoint, O_RDONLY); ++ if (mnt_fd < 0) { ++ pr_perror("Can't open %s", pm->ns_mountpoint); ++ return -1; ++ } ++ } ++ ++ if (check_mountpoint_fd(pm, mnt_fd)) { ++ close(mnt_fd); ++ return -1; + } + + return mnt_fd; +-err: +- close(mnt_fd); +- return -1; + } + + int open_mount(unsigned int s_dev) +-- +2.34.1 + diff --git a/0102-mount-remove-mnt_fd-argument-of-__open_mountpoint.patch b/0102-mount-remove-mnt_fd-argument-of-__open_mountpoint.patch new file mode 100644 index 0000000..2430f95 --- /dev/null +++ b/0102-mount-remove-mnt_fd-argument-of-__open_mountpoint.patch @@ -0,0 +1,116 @@ +From 0aed7a86a766fa175bac9d573695edc493e26717 Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Fri, 17 Dec 2021 15:13:35 +0300 +Subject: [PATCH 102/120] mount: remove mnt_fd argument of __open_mountpoint + +Only place where we used __open_mountpoint with non -1 mnt_fd is +open_mountpoint. Let's use check_mountpoint_fd for this case, so that we +now can remove mnt_id argument. Also now __open_mountpoint actually +always does open. + +Signed-off-by: Pavel Tikhomirov +--- + criu/fsnotify.c | 4 ++-- + criu/include/mount.h | 2 +- + criu/mount.c | 26 ++++++++++++-------------- + 3 files changed, 15 insertions(+), 17 deletions(-) + +diff --git a/criu/fsnotify.c b/criu/fsnotify.c +index b5dd15dd8..22fb74973 100644 +--- a/criu/fsnotify.c ++++ b/criu/fsnotify.c +@@ -132,7 +132,7 @@ static char *alloc_openable(unsigned int s_dev, unsigned long i_ino, FhEntry *f_ + if (!mnt_is_dir(m)) + continue; + +- mntfd = __open_mountpoint(m, -1); ++ mntfd = __open_mountpoint(m); + pr_debug("\t\tTrying via mntid %d root %s ns_mountpoint @%s (%d)\n", m->mnt_id, m->root, + m->ns_mountpoint, mntfd); + if (mntfd < 0) +@@ -206,7 +206,7 @@ static int open_handle(unsigned int s_dev, unsigned long i_ino, FhEntry *f_handl + if (m->s_dev != s_dev || !mnt_is_dir(m)) + continue; + +- mntfd = __open_mountpoint(m, -1); ++ mntfd = __open_mountpoint(m); + if (mntfd < 0) { + pr_warn("Can't open mount for s_dev %x, continue\n", s_dev); + continue; +diff --git a/criu/include/mount.h b/criu/include/mount.h +index 23448d5fc..3f3a67afa 100644 +--- a/criu/include/mount.h ++++ b/criu/include/mount.h +@@ -110,7 +110,7 @@ extern struct ns_id *lookup_nsid_by_mnt_id(int mnt_id); + + extern int open_mount(unsigned int s_dev); + extern int check_mountpoint_fd(struct mount_info *pm, int mnt_fd); +-extern int __open_mountpoint(struct mount_info *pm, int mnt_fd); ++extern int __open_mountpoint(struct mount_info *pm); + extern int mnt_is_dir(struct mount_info *pm); + extern int open_mountpoint(struct mount_info *pm); + +diff --git a/criu/mount.c b/criu/mount.c +index f6347fd9d..ab6d3ed10 100644 +--- a/criu/mount.c ++++ b/criu/mount.c +@@ -1054,20 +1054,18 @@ int check_mountpoint_fd(struct mount_info *pm, int mnt_fd) + * mnt_fd is a file descriptor on the mountpoint, which is closed in an error case. + * If mnt_fd is -1, the mountpoint will be opened by this function. + */ +-int __open_mountpoint(struct mount_info *pm, int mnt_fd) ++int __open_mountpoint(struct mount_info *pm) + { +- if (mnt_fd == -1) { +- int mntns_root; ++ int mntns_root, mnt_fd; + +- mntns_root = mntns_get_root_fd(pm->nsid); +- if (mntns_root < 0) +- return -1; ++ mntns_root = mntns_get_root_fd(pm->nsid); ++ if (mntns_root < 0) ++ return -1; + +- mnt_fd = openat(mntns_root, pm->ns_mountpoint, O_RDONLY); +- if (mnt_fd < 0) { +- pr_perror("Can't open %s", pm->ns_mountpoint); +- return -1; +- } ++ mnt_fd = openat(mntns_root, pm->ns_mountpoint, O_RDONLY); ++ if (mnt_fd < 0) { ++ pr_perror("Can't open %s", pm->ns_mountpoint); ++ return -1; + } + + if (check_mountpoint_fd(pm, mnt_fd)) { +@@ -1086,7 +1084,7 @@ int open_mount(unsigned int s_dev) + if (!m) + return -ENOENT; + +- return __open_mountpoint(m, -1); ++ return __open_mountpoint(m); + } + + /* Bind-mount a mount point in a temporary place without children */ +@@ -1350,7 +1348,7 @@ int open_mountpoint(struct mount_info *pm) + + /* No overmounts and children - the entire mount is visible */ + if (list_empty(&pm->children) && !mnt_is_overmounted(pm)) +- return __open_mountpoint(pm, -1); ++ return __open_mountpoint(pm); + + pr_info("Mount is not fully visible %s\n", pm->mountpoint); + +@@ -1413,7 +1411,7 @@ int open_mountpoint(struct mount_info *pm) + goto err; + } + +- return __open_mountpoint(pm, fd); ++ return fd < 0 ? __open_mountpoint(pm) : check_mountpoint_fd(pm, fd); + err: + if (ns_old >= 0) + /* coverity[check_return] */ +-- +2.34.1 + diff --git a/0103-proc_parse-add-helper-to-resolve-sdev-from-fd.patch b/0103-proc_parse-add-helper-to-resolve-sdev-from-fd.patch new file mode 100644 index 0000000..381ed81 --- /dev/null +++ b/0103-proc_parse-add-helper-to-resolve-sdev-from-fd.patch @@ -0,0 +1,101 @@ +From 758f3be2d4766f478b74d4026e3c16c93d3b07f9 Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Thu, 16 Dec 2021 16:14:41 +0300 +Subject: [PATCH 103/120] proc_parse: add helper to resolve sdev from fd + +New get_sdev_from_fd helper first gets mnt_id from fd using fdinfo and +then converts mnt_id to sdev using mountinfo. + +By default mnt_id to sdev conversion only works for mounts in mntinfo. + +If parse_mountinfo argument is true, will also parse current process +mountinfo when looking for mount sdev, this should be used only with +temporary mounts just created by criu in current mntns. + +v3: add argument to parse self mountinfo for auxiliary mounts + +Signed-off-by: Pavel Tikhomirov +--- + criu/include/mount.h | 1 + + criu/proc_parse.c | 53 ++++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 54 insertions(+) + +diff --git a/criu/include/mount.h b/criu/include/mount.h +index 3f3a67afa..9c0d7c010 100644 +--- a/criu/include/mount.h ++++ b/criu/include/mount.h +@@ -140,6 +140,7 @@ extern void clean_cr_time_mounts(void); + + extern bool add_skip_mount(const char *mountpoint); + struct ns_id; ++extern int get_sdev_from_fd(int fd, unsigned int *sdev, bool parse_mountinfo); + extern struct mount_info *parse_mountinfo(pid_t pid, struct ns_id *nsid, bool for_dump); + + extern int check_mnt_id(void); +diff --git a/criu/proc_parse.c b/criu/proc_parse.c +index 094f9b84e..3017a64e1 100644 +--- a/criu/proc_parse.c ++++ b/criu/proc_parse.c +@@ -1527,6 +1527,59 @@ out: + return exit_code; + } + ++static int get_mountinfo_sdev_from_mntid(int mnt_id, unsigned int *sdev) ++{ ++ int exit_code = -1; ++ FILE *f; ++ ++ f = fopen_proc(PROC_SELF, "mountinfo"); ++ if (!f) ++ return -1; ++ ++ while (fgets(buf, BUF_SIZE, f)) { ++ unsigned int kmaj, kmin; ++ int id; ++ ++ if (sscanf(buf, "%i %*i %u:%u", &id, &kmaj, &kmin) != 3) { ++ pr_err("Failed to parse mountinfo line %s\n", buf); ++ goto err; ++ } ++ ++ if (id == mnt_id) { ++ *sdev = MKKDEV(kmaj, kmin); ++ exit_code = 0; ++ break; ++ } ++ } ++err: ++ fclose(f); ++ return exit_code; ++} ++ ++/* This works even on btrfs where stat does not show right sdev */ ++int get_sdev_from_fd(int fd, unsigned int *sdev, bool parse_mountinfo) ++{ ++ struct mount_info *mi; ++ int ret, mnt_id; ++ ++ ret = get_fd_mntid(fd, &mnt_id); ++ if (ret < 0) ++ return -1; ++ ++ /* Simple case mnt_id is in dumped mntns */ ++ mi = lookup_mnt_id(mnt_id); ++ if (mi) { ++ *sdev = mi->s_dev_rt; ++ return 0; ++ } ++ ++ if (!parse_mountinfo) ++ return -1; ++ ++ /* Complex case mnt_id is in mntns created by criu */ ++ return get_mountinfo_sdev_from_mntid(mnt_id, sdev); ++} ++ + struct mount_info *parse_mountinfo(pid_t pid, struct ns_id *nsid, bool for_dump) + { + struct mount_info *list = NULL; +-- +2.34.1 + diff --git a/0104-mount-btrfs-make-check_mountpoint_fd-fallback-to-get.patch b/0104-mount-btrfs-make-check_mountpoint_fd-fallback-to-get.patch new file mode 100644 index 0000000..6a2601f --- /dev/null +++ b/0104-mount-btrfs-make-check_mountpoint_fd-fallback-to-get.patch @@ -0,0 +1,140 @@ +From ca615ea1fbc2a20b4d92ced9a904325a49ab4518 Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Thu, 16 Dec 2021 12:57:23 +0300 +Subject: [PATCH 104/120] mount/btrfs: make check_mountpoint_fd fallback to + get_sdev_from_fd + +We face that btrfs returns anonymous device in stat instead of real +superblock dev for volumes, thus all btrfs volume mounts does not pass +check_mountpoint_fd due to dev missmatch between stat and mountinfo. We +can use special helper get_sdev_from_fd instead of stat to try to get +real dev of fd for btrfs. + +We move check_mountpoint_fd from open_mountpoint into get_clean_fd and +ns_open_mountpoint to the point where temporary mount we open fd to is +still in mountinfo, thus get_sdev_from_fd would be able to find tmp +mount in mountinfo. + +Signed-off-by: Pavel Tikhomirov +--- + criu/include/mount.h | 1 + + criu/mount.c | 49 ++++++++++++++++++++++++++++++++++++++++---- + 2 files changed, 46 insertions(+), 4 deletions(-) + +diff --git a/criu/include/mount.h b/criu/include/mount.h +index 9c0d7c010..b959d131c 100644 +--- a/criu/include/mount.h ++++ b/criu/include/mount.h +@@ -109,6 +109,7 @@ extern int mntns_get_root_by_mnt_id(int mnt_id); + extern struct ns_id *lookup_nsid_by_mnt_id(int mnt_id); + + extern int open_mount(unsigned int s_dev); ++extern int __check_mountpoint_fd(struct mount_info *pm, int mnt_fd, bool parse_mountinfo); + extern int check_mountpoint_fd(struct mount_info *pm, int mnt_fd); + extern int __open_mountpoint(struct mount_info *pm); + extern int mnt_is_dir(struct mount_info *pm); +diff --git a/criu/mount.c b/criu/mount.c +index ab6d3ed10..4b57ac703 100644 +--- a/criu/mount.c ++++ b/criu/mount.c +@@ -1018,10 +1018,11 @@ int mnt_is_dir(struct mount_info *pm) + return 0; + } + +-int check_mountpoint_fd(struct mount_info *pm, int mnt_fd) ++int __check_mountpoint_fd(struct mount_info *pm, int mnt_fd, bool parse_mountinfo) + { + struct stat st; +- int ret, dev; ++ unsigned int dev; ++ int ret; + + ret = fstat(mnt_fd, &st); + if (ret < 0) { +@@ -1042,6 +1043,14 @@ int check_mountpoint_fd(struct mount_info *pm, int mnt_fd) + * allocates new device ID). + */ + if (dev != pm->s_dev_rt) { ++ /* ++ * For btrfs device numbers in stat and mountinfo can be ++ * different, fallback to get_sdev_from_fd to get right dev. ++ */ ++ if (!strcmp(pm->fstype->name, "btrfs") && !get_sdev_from_fd(mnt_fd, &dev, parse_mountinfo) && ++ dev == pm->s_dev_rt) ++ return 0; ++ + pr_err("The file system %#x %#x (%#x) %s %s is inaccessible\n", pm->s_dev, pm->s_dev_rt, dev, + pm->fstype->name, pm->ns_mountpoint); + return -1; +@@ -1050,6 +1059,11 @@ int check_mountpoint_fd(struct mount_info *pm, int mnt_fd) + return 0; + } + ++int check_mountpoint_fd(struct mount_info *pm, int mnt_fd) ++{ ++ return __check_mountpoint_fd(pm, mnt_fd, false); ++} ++ + /* + * mnt_fd is a file descriptor on the mountpoint, which is closed in an error case. + * If mnt_fd is -1, the mountpoint will be opened by this function. +@@ -1114,12 +1128,34 @@ static int get_clean_fd(struct mount_info *mi) + char *mnt_path = NULL; + char mnt_path_tmp[] = "/tmp/cr-tmpfs.XXXXXX"; + char mnt_path_root[] = "/cr-tmpfs.XXXXXX"; ++ int fd; + + mnt_path = get_clean_mnt(mi, mnt_path_tmp, mnt_path_root); + if (!mnt_path) + return -1; + +- return open_detach_mount(mnt_path); ++ fd = open(mnt_path, O_RDONLY | O_DIRECTORY, 0); ++ if (fd < 0) { ++ pr_perror("Can't open directory %s", mnt_path); ++ } else { ++ if (__check_mountpoint_fd(mi, fd, true)) ++ goto err_close; ++ } ++ ++ if (umount2(mnt_path, MNT_DETACH)) { ++ pr_perror("Can't detach mount %s", mnt_path); ++ goto err_close; ++ } ++ ++ if (rmdir(mnt_path)) { ++ pr_perror("Can't remove tmp dir %s", mnt_path); ++ goto err_close; ++ } ++ ++ return fd; ++err_close: ++ close_safe(&fd); ++ return -1; + } + + /* +@@ -1337,6 +1373,11 @@ int ns_open_mountpoint(void *arg) + goto err; + } + ++ if (__check_mountpoint_fd(mi, *fd, true)) { ++ close(*fd); ++ goto err; ++ } ++ + return 0; + err: + return 1; +@@ -1411,7 +1452,7 @@ int open_mountpoint(struct mount_info *pm) + goto err; + } + +- return fd < 0 ? __open_mountpoint(pm) : check_mountpoint_fd(pm, fd); ++ return fd < 0 ? __open_mountpoint(pm) : fd; + err: + if (ns_old >= 0) + /* coverity[check_return] */ +-- +2.34.1 + diff --git a/0105-ci-test-criu-image-streamer-with-all-tests.patch b/0105-ci-test-criu-image-streamer-with-all-tests.patch new file mode 100644 index 0000000..9319e58 --- /dev/null +++ b/0105-ci-test-criu-image-streamer-with-all-tests.patch @@ -0,0 +1,33 @@ +From 125b32d35e227b47040cc2e105771bb184c65f87 Mon Sep 17 00:00:00 2001 +From: Nicolas Viennot +Date: Tue, 28 Dec 2021 19:30:09 +0000 +Subject: [PATCH 105/120] ci: test criu-image-streamer with all tests + +All the bugs that were in the way got fixed. We can enable all tests. + +Signed-off-by: Nicolas Viennot +--- + scripts/ci/run-ci-tests.sh | 6 ++---- + 1 file changed, 2 insertions(+), 4 deletions(-) + +diff --git a/scripts/ci/run-ci-tests.sh b/scripts/ci/run-ci-tests.sh +index 7eab9f2dc..d0cd55f7c 100755 +--- a/scripts/ci/run-ci-tests.sh ++++ b/scripts/ci/run-ci-tests.sh +@@ -62,11 +62,9 @@ ci_prep () { + } + + test_stream() { +- # We must test CRIU features that dump content into an image file to ensure +- # streaming compatibility. +- STREAM_TEST_PATTERN='.*(ghost|fifo|unlink|memfd|shmem|socket_queue).*' ++ # Testing CRIU streaming to criu-image-streamer + # shellcheck disable=SC2086 +- ./test/zdtm.py run --stream -p 2 --keep-going -T "$STREAM_TEST_PATTERN" $ZDTM_OPTS ++ ./test/zdtm.py run --stream -p 2 --keep-going -a $ZDTM_OPTS + } + + print_header() { +-- +2.34.1 + diff --git a/0106-readme-add-docker-test-badge.patch b/0106-readme-add-docker-test-badge.patch new file mode 100644 index 0000000..181c42a --- /dev/null +++ b/0106-readme-add-docker-test-badge.patch @@ -0,0 +1,25 @@ +From 3caa619b34653a0c32dd3116c9f6bf0249d9c30d Mon Sep 17 00:00:00 2001 +From: Radostin Stoyanov +Date: Mon, 10 Jan 2022 10:37:19 +0000 +Subject: [PATCH 106/120] readme: add docker test badge + +Signed-off-by: Radostin Stoyanov +--- + README.md | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/README.md b/README.md +index fd86b2c15..6b86cac9e 100644 +--- a/README.md ++++ b/README.md +@@ -1,5 +1,6 @@ + ![X86_64 GCC Test](https://github.com/checkpoint-restore/criu/workflows/X86_64%20GCC%20Test/badge.svg) +-![Podman Test](https://github.com/checkpoint-restore/criu/workflows/Podman%20Test/badge.svg) ++![Docker Test](https://github.com/checkpoint-restore/criu/actions/workflows/docker-test.yml/badge.svg) ++![Podman Test](https://github.com/checkpoint-restore/criu/actions/workflows/podman-test.yml/badge.svg) + [![CircleCI](https://circleci.com/gh/checkpoint-restore/criu.svg?style=svg)](https://circleci.com/gh/checkpoint-restore/criu) + +

+-- +2.34.1 + diff --git a/0107-contributing-remove-old-badges-and-logo.patch b/0107-contributing-remove-old-badges-and-logo.patch new file mode 100644 index 0000000..f97e360 --- /dev/null +++ b/0107-contributing-remove-old-badges-and-logo.patch @@ -0,0 +1,28 @@ +From bf9a5b8e5be78bfac6954850fee1c156eca0f1b7 Mon Sep 17 00:00:00 2001 +From: Radostin Stoyanov +Date: Mon, 10 Jan 2022 10:37:52 +0000 +Subject: [PATCH 107/120] contributing: remove old badges and logo + +CI badges and logo are already present in the readme file. + +Signed-off-by: Radostin Stoyanov +--- + CONTRIBUTING.md | 5 ----- + 1 file changed, 5 deletions(-) + +diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md +index 96972296e..864caf93e 100644 +--- a/CONTRIBUTING.md ++++ b/CONTRIBUTING.md +@@ -1,8 +1,3 @@ +-[![master](https://travis-ci.org/checkpoint-restore/criu.svg?branch=master)](https://travis-ci.org/checkpoint-restore/criu) +-[![development](https://travis-ci.org/checkpoint-restore/criu.svg?branch=criu-dev)](https://travis-ci.org/checkpoint-restore/criu) +-[![Codacy Badge](https://api.codacy.com/project/badge/Grade/55251ec7db28421da4481fc7c1cb0cee)](https://www.codacy.com/app/xemul/criu?utm_source=github.com&utm_medium=referral&utm_content=xemul/criu&utm_campaign=Badge_Grade) +-

+- + ## How to contribute to CRIU + + CRIU project is (almost) the never-ending story, because we have to always keep up with the +-- +2.34.1 + diff --git a/0108-ci-update-to-latest-Vagrant-and-Fedora-images.patch b/0108-ci-update-to-latest-Vagrant-and-Fedora-images.patch new file mode 100644 index 0000000..0042b54 --- /dev/null +++ b/0108-ci-update-to-latest-Vagrant-and-Fedora-images.patch @@ -0,0 +1,37 @@ +From 3377245bb491f0d05c2f468505b6dd9bd64b06bf Mon Sep 17 00:00:00 2001 +From: Adrian Reber +Date: Fri, 3 Dec 2021 17:13:27 +0000 +Subject: [PATCH 108/120] ci: update to latest Vagrant and Fedora images + +Signed-off-by: Adrian Reber +--- + scripts/ci/vagrant.sh | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/scripts/ci/vagrant.sh b/scripts/ci/vagrant.sh +index 40c8416e1..4a4a16445 100755 +--- a/scripts/ci/vagrant.sh ++++ b/scripts/ci/vagrant.sh +@@ -1,14 +1,14 @@ + #!/bin/bash + +-# This script is used to run vagrant based tests on Travis. +-# This script is started via sudo from .travis.yml ++# This script is used to run vagrant based tests on Cirrus CI. ++# This script is started via .cirrus.yml + + set -e + set -x + +-VAGRANT_VERSION=2.2.16 +-FEDORA_VERSION=34 +-FEDORA_BOX_VERSION=34.20210423.0 ++VAGRANT_VERSION=2.2.19 ++FEDORA_VERSION=35 ++FEDORA_BOX_VERSION=35.20211026.0 + + setup() { + if [ -n "$TRAVIS" ]; then +-- +2.34.1 + diff --git a/0109-ci-added-.lgtm.yml-file.patch b/0109-ci-added-.lgtm.yml-file.patch new file mode 100644 index 0000000..890d489 --- /dev/null +++ b/0109-ci-added-.lgtm.yml-file.patch @@ -0,0 +1,56 @@ +From acc68cfe88a2a87260ee599a772391bc124a879d Mon Sep 17 00:00:00 2001 +From: Adrian Reber +Date: Sun, 16 Jan 2022 11:17:33 +0000 +Subject: [PATCH 109/120] ci: added .lgtm.yml file + +A couple of months (or years) ago I looked into lgtm.com for CRIU. Today +on a pull request I saw result from lgtm.com for the first time and it +failed. Not sure what triggered the lgtm.com message into the CRIU +repository, but with the .lgtm.yml file in this commit lgtm.com can +actually build CRIU. + +Signed-off-by: Adrian Reber +--- + .lgtm.yml | 30 ++++++++++++++++++++++++++++++ + 1 file changed, 30 insertions(+) + create mode 100644 .lgtm.yml + +diff --git a/.lgtm.yml b/.lgtm.yml +new file mode 100644 +index 000000000..a28c35de0 +--- /dev/null ++++ b/.lgtm.yml +@@ -0,0 +1,30 @@ ++extraction: ++ cpp: ++ prepare: ++ packages: ++ - "protobuf-c-compiler" ++ - "libprotobuf-c-dev" ++ - "libprotobuf-dev" ++ - "build-essential" ++ - "libprotobuf-dev" ++ - "libprotobuf-c-dev" ++ - "protobuf-c-compiler" ++ - "protobuf-compiler" ++ - "python3-protobuf" ++ - "libnet-dev" ++ - "pkg-config" ++ - "libnl-3-dev" ++ - "libbsd0" ++ - "libbsd-dev" ++ - "iproute2" ++ - "libcap-dev" ++ - "libaio-dev" ++ - "python3-yaml" ++ - "libnl-route-3-dev" ++ - "python-future" ++ - "gnutls-dev" ++ configure: ++ command: ++ - "ls -laR images/google" ++ - "ln -s /usr/include/google/protobuf/descriptor.proto images/google/protobuf/descriptor.proto" ++ - "ls -laR images/google" +-- +2.34.1 + diff --git a/0110-lib-introduce-feature-check-in-libcriu.patch b/0110-lib-introduce-feature-check-in-libcriu.patch new file mode 100644 index 0000000..e09f927 --- /dev/null +++ b/0110-lib-introduce-feature-check-in-libcriu.patch @@ -0,0 +1,144 @@ +From 5b43c3ce81f590866b9330a84526362e3b713d01 Mon Sep 17 00:00:00 2001 +From: Adrian Reber +Date: Mon, 6 Dec 2021 16:51:21 +0000 +Subject: [PATCH 110/120] lib: introduce feature check in libcriu + +This commit adds feature check support to libcriu. It already exists in +the CLI and RPC and this just extends it to libcriu. + +This commit provides one function to do all possible feature checks in +one call. The parameter to the feature check function is a structure and +the user can enable which features should be checked. + +Using a structure makes the function extensible without the need to +break the API/ABI in the future. + +Signed-off-by: Adrian Reber +--- + lib/c/criu.c | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++ + lib/c/criu.h | 29 +++++++++++++++++++++ + 2 files changed, 101 insertions(+) + +diff --git a/lib/c/criu.c b/lib/c/criu.c +index 500574e33..dea5896f7 100644 +--- a/lib/c/criu.c ++++ b/lib/c/criu.c +@@ -1925,3 +1925,75 @@ int criu_join_ns_add(const char *ns, const char *ns_file, const char *extra_opt) + { + return criu_local_join_ns_add(global_opts, ns, ns_file, extra_opt); + } ++ ++int criu_local_feature_check(criu_opts *opts, struct criu_feature_check *features, size_t size) ++{ ++ CriuFeatures criu_features = CRIU_FEATURES__INIT; ++ struct criu_feature_check features_copy = { 0 }; ++ CriuReq req = CRIU_REQ__INIT; ++ CriuResp *resp = NULL; ++ int ret = -1; ++ ++ saved_errno = 0; ++ ++ if (!features) ++ goto exit; ++ ++ if (size > sizeof(struct criu_feature_check)) ++ goto exit; ++ ++ memcpy(&features_copy, features, size); ++ ++ req.type = CRIU_REQ_TYPE__FEATURE_CHECK; ++ req.opts = opts->rpc; ++ ++ if (features_copy.mem_track) { ++ criu_features.has_mem_track = true; ++ criu_features.mem_track = true; ++ } ++ if (features_copy.lazy_pages) { ++ criu_features.has_lazy_pages = true; ++ criu_features.lazy_pages = true; ++ } ++ if (features_copy.pidfd_store) { ++ criu_features.has_pidfd_store = true; ++ criu_features.pidfd_store = true; ++ } ++ req.features = &criu_features; ++ ++ ret = send_req_and_recv_resp(opts, &req, &resp); ++ if (ret) ++ goto exit; ++ ++ memset(&features_copy, 0, sizeof(struct criu_feature_check)); ++ ++ if (resp->success) { ++ if (resp->features->has_mem_track) { ++ features_copy.mem_track = resp->features->mem_track; ++ } ++ if (resp->features->has_lazy_pages) { ++ features_copy.lazy_pages = resp->features->lazy_pages; ++ } ++ if (resp->features->has_pidfd_store) { ++ features_copy.pidfd_store = resp->features->pidfd_store; ++ } ++ memcpy(features, &features_copy, size); ++ } else { ++ ret = -EBADE; ++ } ++ ++exit: ++ if (resp) ++ criu_resp__free_unpacked(resp, NULL); ++ ++ swrk_wait(opts); ++ ++ errno = saved_errno; ++ ++ return ret; ++} ++ ++int criu_feature_check(struct criu_feature_check *features, size_t size) ++{ ++ return criu_local_feature_check(global_opts, features, size); ++} +diff --git a/lib/c/criu.h b/lib/c/criu.h +index c6d4f50a8..aed2c3481 100644 +--- a/lib/c/criu.h ++++ b/lib/c/criu.h +@@ -288,6 +288,35 @@ int criu_local_dump_iters(criu_opts *opts, int (*more)(criu_predump_info pi)); + int criu_local_get_version(criu_opts *opts); + int criu_local_check_version(criu_opts *opts, int minimum); + ++/* ++ * Feature checking allows the user to check if CRIU supports ++ * certain features. There are CRIU features which do not depend ++ * on the version of CRIU but on kernel features or architecture. ++ * ++ * One example is memory tracking. Memory tracking can be disabled ++ * in the kernel or there are architectures which do not support ++ * it (aarch64 for example). By using the feature check a libcriu ++ * user can easily query CRIU if a certain feature is available. ++ * ++ * The features which should be checked can be marked in the ++ * structure 'struct criu_feature_check'. Each structure member ++ * that is set to true will result in CRIU checking for the ++ * availability of that feature in the current combination of ++ * CRIU/kernel/architecture. ++ * ++ * Available features will be set to true when the function ++ * returns successfully. Missing features will be set to false. ++ */ ++ ++struct criu_feature_check { ++ bool mem_track; ++ bool lazy_pages; ++ bool pidfd_store; ++}; ++ ++int criu_feature_check(struct criu_feature_check *features, size_t size); ++int criu_local_feature_check(criu_opts *opts, struct criu_feature_check *features, size_t size); ++ + #ifdef __GNUG__ + } + #endif +-- +2.34.1 + diff --git a/0111-lib-added-tests-for-feature-check-in-libcriu.patch b/0111-lib-added-tests-for-feature-check-in-libcriu.patch new file mode 100644 index 0000000..82a1efe --- /dev/null +++ b/0111-lib-added-tests-for-feature-check-in-libcriu.patch @@ -0,0 +1,132 @@ +From c2a12bb925d343cc6333db7fe5f142d592d5edf6 Mon Sep 17 00:00:00 2001 +From: Adrian Reber +Date: Mon, 6 Dec 2021 16:51:21 +0000 +Subject: [PATCH 111/120] lib: added tests for feature check in libcriu + +Signed-off-by: Adrian Reber +--- + test/others/libcriu/.gitignore | 1 + + test/others/libcriu/Makefile | 1 + + test/others/libcriu/run.sh | 10 ++++ + test/others/libcriu/test_feature_check.c | 65 ++++++++++++++++++++++++ + 4 files changed, 77 insertions(+) + create mode 100644 test/others/libcriu/test_feature_check.c + +diff --git a/test/others/libcriu/.gitignore b/test/others/libcriu/.gitignore +index 15abf07ac..0f6e52bb4 100644 +--- a/test/others/libcriu/.gitignore ++++ b/test/others/libcriu/.gitignore +@@ -5,5 +5,6 @@ test_self + test_sub + test_join_ns + test_pre_dump ++test_feature_check + output/ + libcriu.so.* +diff --git a/test/others/libcriu/Makefile b/test/others/libcriu/Makefile +index 581574da0..ae7330533 100644 +--- a/test/others/libcriu/Makefile ++++ b/test/others/libcriu/Makefile +@@ -7,6 +7,7 @@ TESTS += test_iters + TESTS += test_errno + TESTS += test_join_ns + TESTS += test_pre_dump ++TESTS += test_feature_check + + all: $(TESTS) + .PHONY: all +diff --git a/test/others/libcriu/run.sh b/test/others/libcriu/run.sh +index 1b6c73448..77bdfb87e 100755 +--- a/test/others/libcriu/run.sh ++++ b/test/others/libcriu/run.sh +@@ -62,6 +62,16 @@ if [ "$(uname -m)" = "x86_64" ]; then + fi + run_test test_errno + run_test test_join_ns ++if criu check --feature mem_dirty_track > /dev/null; then ++ export CRIU_FEATURE_MEM_TRACK=1 ++fi ++if criu check --feature uffd-noncoop > /dev/null; then ++ export CRIU_FEATURE_LAZY_PAGES=1 ++fi ++if criu check --feature pidfd_store > /dev/null; then ++ export CRIU_FEATURE_PIDFD_STORE=1 ++fi ++run_test test_feature_check + + echo "== Tests done" + make libcriu_clean +diff --git a/test/others/libcriu/test_feature_check.c b/test/others/libcriu/test_feature_check.c +new file mode 100644 +index 000000000..d88e0de23 +--- /dev/null ++++ b/test/others/libcriu/test_feature_check.c +@@ -0,0 +1,65 @@ ++#include "criu.h" ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "lib.h" ++ ++int main(int argc, char **argv) ++{ ++ int ret; ++ char *env; ++ bool mem_track = 0; ++ bool lazy_pages = 0; ++ bool pidfd_store = 0; ++ struct criu_feature_check features = { ++ .mem_track = true, ++ .lazy_pages = true, ++ .pidfd_store = true, ++ }; ++ ++ printf("--- Start feature check ---\n"); ++ criu_init_opts(); ++ criu_set_service_binary(argv[1]); ++ ++ env = getenv("CRIU_FEATURE_MEM_TRACK"); ++ if (env) { ++ mem_track = true; ++ } ++ env = getenv("CRIU_FEATURE_LAZY_PAGES"); ++ if (env) { ++ lazy_pages = true; ++ } ++ env = getenv("CRIU_FEATURE_PIDFD_STORE"); ++ if (env) { ++ pidfd_store = true; ++ } ++ ++ ret = criu_feature_check(&features, sizeof(features) + 1); ++ printf(" `- passing too large structure to libcriu should return -1: %d\n", ret); ++ if (ret != -1) ++ return -1; ++ ++ ret = criu_feature_check(&features, sizeof(features)); ++ if (ret < 0) { ++ what_err_ret_mean(ret); ++ return ret; ++ } ++ ++ printf(" `- mem_track : %d - expected : %d\n", features.mem_track, mem_track); ++ if (features.mem_track != mem_track) ++ return -1; ++ printf(" `- lazy_pages : %d - expected : %d\n", features.lazy_pages, lazy_pages); ++ if (features.lazy_pages != lazy_pages) ++ return -1; ++ printf(" `- pidfd_store: %d - expected : %d\n", features.pidfd_store, pidfd_store); ++ if (features.pidfd_store != pidfd_store) ++ return -1; ++ ++ return 0; ++} +-- +2.34.1 + diff --git a/0112-pagemap-tiny-fix-on-truncating-memory-image.patch b/0112-pagemap-tiny-fix-on-truncating-memory-image.patch new file mode 100644 index 0000000..3f95215 --- /dev/null +++ b/0112-pagemap-tiny-fix-on-truncating-memory-image.patch @@ -0,0 +1,64 @@ +From 4223e680382586628d6650e289596c3a217326c0 Mon Sep 17 00:00:00 2001 +From: Liu Hua +Date: Thu, 6 Jan 2022 20:44:21 +0800 +Subject: [PATCH 112/120] pagemap: tiny fix on truncating memory image + +When requested iovs are huge, criu needs to invoke more then one +preadv()s. In this situation criu truncates memory image with +offset of first preadv() and length of last one, which leads +to leakage of memory image. This patch fixs truncating with right +offset and length. + +Signed-off-by: Liu Hua +--- + criu/pagemap.c | 19 +++++++++---------- + 1 file changed, 9 insertions(+), 10 deletions(-) + +diff --git a/criu/pagemap.c b/criu/pagemap.c +index d996db7fc..83f69bba3 100644 +--- a/criu/pagemap.c ++++ b/criu/pagemap.c +@@ -535,7 +535,6 @@ static int process_async_reads(struct page_read *pr) + fd = img_raw_fd(pr->pi); + list_for_each_entry_safe(piov, n, &pr->async, l) { + ssize_t ret; +- off_t start = piov->from; + struct iovec *iovs = piov->to; + + pr_debug("Read piov iovs %d, from %ju, len %ju, first %p:%zu\n", piov->nr, piov->from, +@@ -554,13 +553,16 @@ static int process_async_reads(struct page_read *pr) + } + } + +- if (ret != piov->end - piov->from) { +- if (ret < 0) { +- pr_err("Can't read async pr bytes (%zd / %ju read, %ju off, %d iovs)\n", ret, +- piov->end - piov->from, piov->from, piov->nr); +- return -1; +- } ++ if (ret < 0) { ++ pr_err("Can't read async pr bytes (%zd / %ju read, %ju off, %d iovs)\n", ret, ++ piov->end - piov->from, piov->from, piov->nr); ++ return -1; ++ } + ++ if (opts.auto_dedup && punch_hole(pr, piov->from, ret, false)) ++ return -1; ++ ++ if (ret != piov->end - piov->from) { + /* + * The preadv() can return less than requested. It's + * valid and doesn't mean error or EOF. We should advance +@@ -574,9 +576,6 @@ static int process_async_reads(struct page_read *pr) + goto more; + } + +- if (opts.auto_dedup && punch_hole(pr, start, ret, false)) +- return -1; +- + BUG_ON(pr->io_complete); /* FIXME -- implement once needed */ + + list_del(&piov->l); +-- +2.34.1 + diff --git a/0113-zdtm-fix-zdtm-static-maps00-case-in-arm64.patch b/0113-zdtm-fix-zdtm-static-maps00-case-in-arm64.patch new file mode 100644 index 0000000..5fdbf49 --- /dev/null +++ b/0113-zdtm-fix-zdtm-static-maps00-case-in-arm64.patch @@ -0,0 +1,43 @@ +From a162d2b3a0f7715eaef5090631e2ec8c86bdd138 Mon Sep 17 00:00:00 2001 +From: "fu.lin" +Date: Sun, 16 Jan 2022 18:37:09 +0800 +Subject: [PATCH 113/120] zdtm: fix zdtm/static/maps00 case in arm64 + +This case sometimes will cause SIGILL signal in arm64 platform. + +<> notes: + The ARM architecture does not require the hardware to ensure coherency + between instruction caches and memory, even for locations of shared + memory. + +Therefore, we need flush dcache and icache for self-modifying code. + +- https://developer.arm.com/documentation/den0024/a/Caches/Point-of-coherency-and-unification + +Signed-off-by: fu.lin +--- + test/zdtm/static/maps00.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/test/zdtm/static/maps00.c b/test/zdtm/static/maps00.c +index 10a4cac79..b1e55e861 100644 +--- a/test/zdtm/static/maps00.c ++++ b/test/zdtm/static/maps00.c +@@ -158,7 +158,13 @@ static int check_map(struct map *map) + + if (!sigsetjmp(segv_ret, 1)) { + if (map->prot & PROT_WRITE) { +- memcpy(map->ptr, test_func, getpagesize()); ++ memcpy(map->ptr, test_func, ONE_MAP_SIZE); ++ /* The ARM ARM architecture does not require the ++ * hardware to ensure coherency between instruction ++ * caches and memory, flushing dcache and icache is ++ * necessory to prevent SIGILL signal. ++ */ ++ __builtin___clear_cache(map->ptr, map->ptr + ONE_MAP_SIZE); + } else { + if (!(map->flag & MAP_ANONYMOUS)) { + uint8_t funlen = (uint8_t *)check_map - (uint8_t *)test_func; +-- +2.34.1 + diff --git a/0114-compel-fix-GCC-12-failure-out-of-bounds.patch b/0114-compel-fix-GCC-12-failure-out-of-bounds.patch new file mode 100644 index 0000000..60a0001 --- /dev/null +++ b/0114-compel-fix-GCC-12-failure-out-of-bounds.patch @@ -0,0 +1,74 @@ +From dfada9dfe4545ee19806d8812a85b194b90f08a0 Mon Sep 17 00:00:00 2001 +From: Adrian Reber +Date: Tue, 18 Jan 2022 16:49:40 +0000 +Subject: [PATCH 114/120] compel: fix GCC 12 failure (out of bounds) +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This is a confusing change as it seems the original code was just wrong. +GCC 12 complains with: + +In function ‘__conv_val’, + inlined from ‘std_strtoul’ at compel/plugins/std/string.c:202:7: +compel/plugins/std/string.c:154:24: error: array subscript 97 is above array bounds of ‘const char[37]’ [-Werror=array-bounds] + 154 | return &conv_tab[__tolower(c)] - conv_tab; + | ^~~~~~~~~~~~~~~~~~~~~~~ +compel/plugins/std/string.c: In function ‘std_strtoul’: +compel/plugins/std/string.c:10:19: note: while referencing ‘conv_tab’ + 10 | static const char conv_tab[] = "0123456789abcdefghijklmnopqrstuvwxyz"; + | ^~~~~~~~ +cc1: all warnings being treated as errors + +Which sounds correct. The array conv_tab has just 37 elements. + +If I understand the code correctly we are trying to convert anything +that is character between a-z and A-Z to a number for cases where +the base is larger than 10. For a base 11 conversion b|B should return 11. +For a base 35 conversion z|Z should return 35. This is all for a strtoul() +implementation. + +The original code was: + + static const char conv_tab[] = "0123456789abcdefghijklmnopqrstuvwxyz"; + + return &conv_tab[__tolower(c)] - conv_tab; + +and that seems wrong. If conv_tab would have been some kind of hash it could +have worked, but '__tolower()' will always return something larger than +97 ('a') which will always overflow the array. + +But maybe I just don't get that part of the code. + +I replaced it with + + return __tolower(c) - 'a' + 10; + +which does the right thing: 'A' = 10, 'B' = 11 ... 'Z' = 35 + +Signed-off-by: Adrian Reber +--- + compel/plugins/std/string.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/compel/plugins/std/string.c b/compel/plugins/std/string.c +index bde1bc68b..d67e0d1a9 100644 +--- a/compel/plugins/std/string.c ++++ b/compel/plugins/std/string.c +@@ -151,7 +151,12 @@ static unsigned int __conv_val(unsigned char c) + if (__isdigit(c)) + return c - '0'; + else if (__isalpha(c)) +- return &conv_tab[__tolower(c)] - conv_tab; ++ /** ++ * If we want the value of something which __isalpha() == true ++ * it has to be base > 10. 'A' = 10, 'B' = 11 ... 'Z' = 35 ++ */ ++ return __tolower(c) - 'a' + 10; ++ + return -1u; + } + +-- +2.34.1 + diff --git a/0115-criu-fix-configuration-file-scanner-with-GCC-12.patch b/0115-criu-fix-configuration-file-scanner-with-GCC-12.patch new file mode 100644 index 0000000..9e1d9ef --- /dev/null +++ b/0115-criu-fix-configuration-file-scanner-with-GCC-12.patch @@ -0,0 +1,36 @@ +From 93b1526e997cff45b3829aeadb6fac634be7d46f Mon Sep 17 00:00:00 2001 +From: Adrian Reber +Date: Tue, 18 Jan 2022 17:20:35 +0000 +Subject: [PATCH 115/120] criu: fix configuration file scanner with GCC 12 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This fixes: + +criu/config.c: In function ‘parse_statement’: +criu/config.c:232:43: error: the comparison will always evaluate as ‘true’ for the pointer operand in ‘*(configuration + (sizetype)((long unsigned int)i * 8)) + ((sizetype)offset + 1)’ must not be NULL [-Werror=address] + 232 | if (configuration[i] + offset + 1 != 0 && strchr(configuration[i] + offset, ' ')) { + | ^~ + +Signed-off-by: Adrian Reber +--- + criu/config.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/criu/config.c b/criu/config.c +index 91fb0b64d..33f2820a1 100644 +--- a/criu/config.c ++++ b/criu/config.c +@@ -229,7 +229,7 @@ out: + tmp_string[0] = 0; + + /* Check for unsupported configuration file entries */ +- if (configuration[i] + offset + 1 != 0 && strchr(configuration[i] + offset, ' ')) { ++ if (strchr(configuration[i] + offset, ' ')) { + int j; + len = strlen(configuration[i] + offset); + for (j = 0; j < len - 1; j++) { +-- +2.34.1 + diff --git a/0116-compel-fix-parasite-with-GCC-12.patch b/0116-compel-fix-parasite-with-GCC-12.patch new file mode 100644 index 0000000..5812efa --- /dev/null +++ b/0116-compel-fix-parasite-with-GCC-12.patch @@ -0,0 +1,43 @@ +From 04f8368eaee2b29bb92ff0ba4f5c43501408d15e Mon Sep 17 00:00:00 2001 +From: Adrian Reber +Date: Tue, 18 Jan 2022 17:22:46 +0000 +Subject: [PATCH 116/120] compel: fix parasite with GCC 12 + +Parasite creation started to fail with GCC 12: + +On x86_64 with: + ./compel/compel-host hgen -f criu/pie/restorer.built-in.o -o criu/pie/restorer-blob.h + Error (compel/src/lib/handle-elf-host.c:337): Unexpected undefined symbol: `strlen'. External symbol in PIE? + +On aarch64 with: + ld: criu/pie/restorer.o: in function `lsm_set_label': + /drone/src/criu/pie/restorer.c:174: undefined reference to `strlen' + +Line 174 is: "for (len = 0; label[len]; len++)" + +Adding '-ffreestanding' to parasite compilation fixes these errors +because, according to GCC developers: + +"strlen is a standard C function, so I don't see any bug in that being used +unless you do a freestanding compilation (-nostdlib isn't that)." + +Signed-off-by: Adrian Reber +--- + compel/src/main.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/compel/src/main.c b/compel/src/main.c +index a9a50959f..f461ff04d 100644 +--- a/compel/src/main.c ++++ b/compel/src/main.c +@@ -19,6 +19,7 @@ + + #define CFLAGS_DEFAULT_SET \ + "-Wstrict-prototypes " \ ++ "-ffreestanding " \ + "-fno-stack-protector -nostdlib -fomit-frame-pointer " + + #define COMPEL_CFLAGS_PIE CFLAGS_DEFAULT_SET "-fpie" +-- +2.34.1 + diff --git a/0117-ci-set-continue-on-error-for-cross-compile.patch b/0117-ci-set-continue-on-error-for-cross-compile.patch new file mode 100644 index 0000000..be6f62f --- /dev/null +++ b/0117-ci-set-continue-on-error-for-cross-compile.patch @@ -0,0 +1,51 @@ +From 985b92008c070093f7dd593f7d849e340bdb0493 Mon Sep 17 00:00:00 2001 +From: Radostin Stoyanov +Date: Thu, 27 Jan 2022 22:13:33 +0000 +Subject: [PATCH 117/120] ci: set continue-on-error for cross-compile + +Running cross compile tests with Debian unstable sometimes +fails due to missing or outdated packages. + +Signed-off-by: Radostin Stoyanov +--- + .github/workflows/cross-compile.yml | 16 ++++++++++++---- + 1 file changed, 12 insertions(+), 4 deletions(-) + +diff --git a/.github/workflows/cross-compile.yml b/.github/workflows/cross-compile.yml +index 461a6e618..be8e7f09c 100644 +--- a/.github/workflows/cross-compile.yml ++++ b/.github/workflows/cross-compile.yml +@@ -6,18 +6,26 @@ jobs: + build: + + runs-on: ubuntu-latest ++ continue-on-error: ${{ matrix.experimental }} + strategy: ++ fail-fast: false + matrix: ++ experimental: [false] + target: [ + armv7-stable-cross, +- armv7-unstable-cross, + aarch64-stable-cross, +- aarch64-unstable-cross, + ppc64-stable-cross, +- ppc64-unstable-cross, + mips64el-stable-cross, +- mips64el-unstable-cross + ] ++ include: ++ - experimental: true ++ target: armv7-unstable-cross ++ - experimental: true ++ target: aarch64-unstable-cross ++ - experimental: true ++ target: ppc64-unstable-cross ++ - experimental: true ++ target: mips64el-unstable-cross + + steps: + - uses: actions/checkout@v2 +-- +2.34.1 + diff --git a/0118-test-autofs-fix-use-after-free.patch b/0118-test-autofs-fix-use-after-free.patch new file mode 100644 index 0000000..7ae9cdf --- /dev/null +++ b/0118-test-autofs-fix-use-after-free.patch @@ -0,0 +1,67 @@ +From d72daddbb48ad705184d6cddfa70df74d1dd3e20 Mon Sep 17 00:00:00 2001 +From: Radostin Stoyanov +Date: Thu, 27 Jan 2022 14:49:41 +0000 +Subject: [PATCH 118/120] test/autofs: fix use-after-free + +autofs.c:66:17: error: pointer 'str' may be used after 'realloc' [-Werror=use-after-free] + +autofs.c: In function 'check_automount': +../lib/zdtmtst.h:131:9: error: pointer 'mountpoint' may be used after 'free' [-Werror=use-after-free] + 131 | test_msg("ERR: %s:%d: " format " (errno = %d (%s))\n", __FILE__, __LINE__, ##arg, errno, strerror(errno)) + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +autofs.c:277:17: note: in expansion of macro 'pr_perror' + 277 | pr_perror("%s: failed to close fd %d", mountpoint, p->fd); + | ^~~~~~~~~ +autofs.c:268:9: note: call to 'free' here + 268 | free(mountpoint); + | ^~~~~~~~~~~~~~~~ + +Fixes: #1731 + +v2: (@Snorch) always update `str` after successful realloc() + +Signed-off-by: Radostin Stoyanov +--- + test/zdtm/static/autofs.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/test/zdtm/static/autofs.c b/test/zdtm/static/autofs.c +index 2d6078627..ad1795842 100644 +--- a/test/zdtm/static/autofs.c ++++ b/test/zdtm/static/autofs.c +@@ -47,6 +47,7 @@ static char *xvstrcat(char *str, const char *fmt, va_list args) + ret = -ENOMEM; + new = realloc(str, offset + delta); + if (new) { ++ str = new; + va_copy(tmp, args); + ret = vsnprintf(new + offset, delta, fmt, tmp); + va_end(tmp); +@@ -54,7 +55,6 @@ static char *xvstrcat(char *str, const char *fmt, va_list args) + /* NOTE: vsnprintf returns the amount of bytes + * * to allocate. */ + delta = ret + 1; +- str = new; + ret = 0; + } + } +@@ -266,6 +266,7 @@ static int check_automount(struct autofs_params *p) + return err; + + free(mountpoint); ++ mountpoint = NULL; + + err = p->setup(p); + if (err) { +@@ -274,7 +275,7 @@ static int check_automount(struct autofs_params *p) + } + + if (close(p->fd)) { +- pr_perror("%s: failed to close fd %d", mountpoint, p->fd); ++ pr_perror("mountpoint failed to close fd %d", p->fd); + return -errno; + } + +-- +2.34.1 + diff --git a/0119-Fix-formatting-in-criu-documentation.patch b/0119-Fix-formatting-in-criu-documentation.patch new file mode 100644 index 0000000..3be2173 --- /dev/null +++ b/0119-Fix-formatting-in-criu-documentation.patch @@ -0,0 +1,44 @@ +From c2698b90d7f4f96dc7dfda2a0e61780cafd94b1b Mon Sep 17 00:00:00 2001 +From: Ashutosh Mehra +Date: Wed, 26 Jan 2022 14:14:38 -0500 +Subject: [PATCH 119/120] Fix formatting in criu documentation + +Signed-off-by: Ashutosh Mehra +--- + Documentation/criu.txt | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/Documentation/criu.txt b/Documentation/criu.txt +index f41b1898c..57b791138 100644 +--- a/Documentation/criu.txt ++++ b/Documentation/criu.txt +@@ -419,7 +419,7 @@ By default the option is set to *fpu* and *ins*. + Set the method to be used to validate open files. Validation is done + to ensure that the version of the file being restored is the same + version when it was dumped. +- +++ + The 'mode' may be one of the following: + + *filesize*::: +@@ -532,7 +532,7 @@ usually need to be escaped from shell. + Restore cgroups configuration associated with a task from the image. + Controllers are always restored in an optimistic way -- if already present + in system, *criu* reuses it, otherwise it will be created. +- +++ + The 'mode' may be one of the following: + + *none*::: Do not restore cgroup properties but require cgroup to +@@ -656,7 +656,7 @@ are not adequate, but this can be suppressed by using *--cpu-cap=none*. + Set the method to be used to validate open files. Validation is done + to ensure that the version of the file being restored is the same + version when it was dumped. +- +++ + The 'mode' may be one of the following: + + *filesize*::: +-- +2.34.1 + diff --git a/0120-compel-add-rseq-syscall-into-compel-std-plugin-sysca.patch b/0120-compel-add-rseq-syscall-into-compel-std-plugin-sysca.patch new file mode 100644 index 0000000..1b947b1 --- /dev/null +++ b/0120-compel-add-rseq-syscall-into-compel-std-plugin-sysca.patch @@ -0,0 +1,76 @@ +From f097cf5766c5a44b239d36692210bce50deb04ca Mon Sep 17 00:00:00 2001 +From: Alexander Mikhalitsyn +Date: Tue, 21 Dec 2021 17:38:25 +0300 +Subject: [PATCH 01/10] compel: add rseq syscall into compel std plugin syscall + tables + +Add rseq syscall numbers for: +arm/aarch64, mips64, ppc64le, s390, x86_64/x86 + +Signed-off-by: Alexander Mikhalitsyn +--- + compel/arch/arm/plugins/std/syscalls/syscall.def | 1 + + compel/arch/mips/plugins/std/syscalls/syscall_64.tbl | 1 + + compel/arch/ppc64/plugins/std/syscalls/syscall-ppc64.tbl | 1 + + compel/arch/s390/plugins/std/syscalls/syscall-s390.tbl | 1 + + compel/arch/x86/plugins/std/syscalls/syscall_32.tbl | 1 + + compel/arch/x86/plugins/std/syscalls/syscall_64.tbl | 1 + + 6 files changed, 6 insertions(+) + +diff --git a/compel/arch/arm/plugins/std/syscalls/syscall.def b/compel/arch/arm/plugins/std/syscalls/syscall.def +index e6508ed9f..866bb07a7 100644 +--- a/compel/arch/arm/plugins/std/syscalls/syscall.def ++++ b/compel/arch/arm/plugins/std/syscalls/syscall.def +@@ -118,3 +118,4 @@ fsmount 432 432 (int fd, unsigned int flags, unsigned int attr_flags) + clone3 435 435 (struct clone_args *uargs, size_t size) + pidfd_open 434 434 (pid_t pid, unsigned int flags) + pidfd_getfd 438 438 (int pidfd, int targetfd, unsigned int flags) ++rseq 293 398 (void *rseq, uint32_t rseq_len, int flags, uint32_t sig) +diff --git a/compel/arch/mips/plugins/std/syscalls/syscall_64.tbl b/compel/arch/mips/plugins/std/syscalls/syscall_64.tbl +index 7a6db192c..95dc7d3b2 100644 +--- a/compel/arch/mips/plugins/std/syscalls/syscall_64.tbl ++++ b/compel/arch/mips/plugins/std/syscalls/syscall_64.tbl +@@ -115,3 +115,4 @@ __NR_fsmount 5432 sys_fsmount (int fd, unsigned int flags, unsigned int attr + __NR_clone3 5435 sys_clone3 (struct clone_args *uargs, size_t size) + __NR_pidfd_open 5434 sys_pidfd_open (pid_t pid, unsigned int flags) + __NR_pidfd_getfd 5438 sys_pidfd_getfd (int pidfd, int targetfd, unsigned int flags) ++__NR_rseq 5327 sys_rseq (void *rseq, uint32_t rseq_len, int flags, uint32_t sig) +diff --git a/compel/arch/ppc64/plugins/std/syscalls/syscall-ppc64.tbl b/compel/arch/ppc64/plugins/std/syscalls/syscall-ppc64.tbl +index 1bb626bc5..e2ee33945 100644 +--- a/compel/arch/ppc64/plugins/std/syscalls/syscall-ppc64.tbl ++++ b/compel/arch/ppc64/plugins/std/syscalls/syscall-ppc64.tbl +@@ -114,3 +114,4 @@ __NR_fsmount 432 sys_fsmount (int fd, unsigned int flags, unsigned int attr_f + __NR_clone3 435 sys_clone3 (struct clone_args *uargs, size_t size) + __NR_pidfd_open 434 sys_pidfd_open (pid_t pid, unsigned int flags) + __NR_pidfd_getfd 438 sys_pidfd_getfd (int pidfd, int targetfd, unsigned int flags) ++__NR_rseq 387 sys_rseq (void *rseq, uint32_t rseq_len, int flags, uint32_t sig) +diff --git a/compel/arch/s390/plugins/std/syscalls/syscall-s390.tbl b/compel/arch/s390/plugins/std/syscalls/syscall-s390.tbl +index 7178bf483..bf3bf4714 100644 +--- a/compel/arch/s390/plugins/std/syscalls/syscall-s390.tbl ++++ b/compel/arch/s390/plugins/std/syscalls/syscall-s390.tbl +@@ -114,3 +114,4 @@ __NR_fsmount 432 sys_fsmount (int fd, unsigned int flags, unsigned int attr_f + __NR_clone3 435 sys_clone3 (struct clone_args *uargs, size_t size) + __NR_pidfd_open 434 sys_pidfd_open (pid_t pid, unsigned int flags) + __NR_pidfd_getfd 438 sys_pidfd_getfd (int pidfd, int targetfd, unsigned int flags) ++__NR_rseq 383 sys_rseq (void *rseq, uint32_t rseq_len, int flags, uint32_t sig) +diff --git a/compel/arch/x86/plugins/std/syscalls/syscall_32.tbl b/compel/arch/x86/plugins/std/syscalls/syscall_32.tbl +index 7e456cdb7..3938b43a8 100644 +--- a/compel/arch/x86/plugins/std/syscalls/syscall_32.tbl ++++ b/compel/arch/x86/plugins/std/syscalls/syscall_32.tbl +@@ -102,3 +102,4 @@ __NR_fsmount 432 sys_fsmount (int fd, unsigned int flags, unsigned int attr_f + __NR_clone3 435 sys_clone3 (struct clone_args *uargs, size_t size) + __NR_pidfd_open 434 sys_pidfd_open (pid_t pid, unsigned int flags) + __NR_pidfd_getfd 438 sys_pidfd_getfd (int pidfd, int targetfd, unsigned int flags) ++__NR_rseq 386 sys_rseq (void *rseq, uint32_t rseq_len, int flags, uint32_t sig) +diff --git a/compel/arch/x86/plugins/std/syscalls/syscall_64.tbl b/compel/arch/x86/plugins/std/syscalls/syscall_64.tbl +index 2dfcc6eee..28f2fb98d 100644 +--- a/compel/arch/x86/plugins/std/syscalls/syscall_64.tbl ++++ b/compel/arch/x86/plugins/std/syscalls/syscall_64.tbl +@@ -113,3 +113,4 @@ __NR_fsmount 432 sys_fsmount (int fd, unsigned int flags, unsigned int attr_ + __NR_clone3 435 sys_clone3 (struct clone_args *uargs, size_t size) + __NR_pidfd_open 434 sys_pidfd_open (pid_t pid, unsigned int flags) + __NR_pidfd_getfd 438 sys_pidfd_getfd (int pidfd, int targetfd, unsigned int flags) ++__NR_rseq 334 sys_rseq (void *rseq, uint32_t rseq_len, int flags, uint32_t sig) +-- +2.34.1 + diff --git a/0121-kerndat-check-for-rseq-syscall-support.patch b/0121-kerndat-check-for-rseq-syscall-support.patch new file mode 100644 index 0000000..56611e6 --- /dev/null +++ b/0121-kerndat-check-for-rseq-syscall-support.patch @@ -0,0 +1,62 @@ +From 50f46b208eb62578c4c9c809c7934584f4f776b6 Mon Sep 17 00:00:00 2001 +From: Alexander Mikhalitsyn +Date: Tue, 21 Dec 2021 18:27:52 +0300 +Subject: [PATCH 02/10] kerndat: check for rseq syscall support + +Signed-off-by: Alexander Mikhalitsyn +--- + criu/include/kerndat.h | 1 + + criu/kerndat.c | 18 ++++++++++++++++++ + 2 files changed, 19 insertions(+) + +diff --git a/criu/include/kerndat.h b/criu/include/kerndat.h +index a28a95802..3e0a657ba 100644 +--- a/criu/include/kerndat.h ++++ b/criu/include/kerndat.h +@@ -75,6 +75,7 @@ struct kerndat_s { + bool has_nspid; + bool has_nftables_concat; + bool has_sockopt_buf_lock; ++ bool has_rseq; + }; + + extern struct kerndat_s kdat; +diff --git a/criu/kerndat.c b/criu/kerndat.c +index 9f6a6ec42..82143377f 100644 +--- a/criu/kerndat.c ++++ b/criu/kerndat.c +@@ -816,6 +816,20 @@ static int kerndat_x86_has_ptrace_fpu_xsave_bug(void) + return 0; + } + ++static int kerndat_has_rseq(void) ++{ ++ if (syscall(__NR_rseq, NULL, 0, 0, 0) != -1) { ++ pr_err("rseq should fail\n"); ++ return -1; ++ } ++ if (errno == ENOSYS) ++ pr_info("rseq syscall isn't supported\n"); ++ else ++ kdat.has_rseq = true; ++ ++ return 0; ++} ++ + int kerndat_sockopt_buf_lock(void) + { + int exit_code = -1; +@@ -1392,6 +1406,10 @@ int kerndat_init(void) + pr_err("kerndat_sockopt_buf_lock failed when initializing kerndat.\n"); + ret = -1; + } ++ if (!ret && kerndat_has_rseq()) { ++ pr_err("kerndat_has_rseq failed when initializing kerndat.\n"); ++ ret = -1; ++ } + + kerndat_lsm(); + kerndat_mmap_min_addr(); +-- +2.34.1 + diff --git a/0122-util-move-fork_and_ptrace_attach-helper-from-cr-chec.patch b/0122-util-move-fork_and_ptrace_attach-helper-from-cr-chec.patch new file mode 100644 index 0000000..234d3e6 --- /dev/null +++ b/0122-util-move-fork_and_ptrace_attach-helper-from-cr-chec.patch @@ -0,0 +1,163 @@ +From 328810439d055dd0aa0bccf5ec85068649e9a76b Mon Sep 17 00:00:00 2001 +From: Alexander Mikhalitsyn +Date: Tue, 21 Dec 2021 21:17:16 +0300 +Subject: [PATCH 03/10] util: move fork_and_ptrace_attach helper from cr-check + +Signed-off-by: Alexander Mikhalitsyn +--- + criu/cr-check.c | 57 --------------------------------------------- + criu/include/util.h | 1 + + criu/util.c | 57 +++++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 58 insertions(+), 57 deletions(-) + +diff --git a/criu/cr-check.c b/criu/cr-check.c +index 0320b445a..ccda00173 100644 +--- a/criu/cr-check.c ++++ b/criu/cr-check.c +@@ -537,63 +537,6 @@ static int check_sigqueuinfo(void) + return 0; + } + +-static pid_t fork_and_ptrace_attach(int (*child_setup)(void)) +-{ +- pid_t pid; +- int sk_pair[2], sk; +- char c = 0; +- +- if (socketpair(PF_LOCAL, SOCK_SEQPACKET, 0, sk_pair)) { +- pr_perror("socketpair"); +- return -1; +- } +- +- pid = fork(); +- if (pid < 0) { +- pr_perror("fork"); +- return -1; +- } else if (pid == 0) { +- sk = sk_pair[1]; +- close(sk_pair[0]); +- +- if (child_setup && child_setup() != 0) +- exit(1); +- +- if (write(sk, &c, 1) != 1) { +- pr_perror("write"); +- exit(1); +- } +- +- while (1) +- sleep(1000); +- exit(1); +- } +- +- sk = sk_pair[0]; +- close(sk_pair[1]); +- +- if (read(sk, &c, 1) != 1) { +- close(sk); +- kill(pid, SIGKILL); +- waitpid(pid, NULL, 0); +- pr_perror("read"); +- return -1; +- } +- +- close(sk); +- +- if (ptrace(PTRACE_ATTACH, pid, NULL, NULL) == -1) { +- pr_perror("Unable to ptrace the child"); +- kill(pid, SIGKILL); +- waitpid(pid, NULL, 0); +- return -1; +- } +- +- waitpid(pid, NULL, 0); +- +- return pid; +-} +- + static int check_ptrace_peeksiginfo(void) + { + struct ptrace_peeksiginfo_args arg; +diff --git a/criu/include/util.h b/criu/include/util.h +index 19d378fc5..9c2439789 100644 +--- a/criu/include/util.h ++++ b/criu/include/util.h +@@ -166,6 +166,7 @@ extern int is_anon_link_type(char *link, char *type); + + extern int cr_system(int in, int out, int err, char *cmd, char *const argv[], unsigned flags); + extern int cr_system_userns(int in, int out, int err, char *cmd, char *const argv[], unsigned flags, int userns_pid); ++extern pid_t fork_and_ptrace_attach(int (*child_setup)(void)); + extern int cr_daemon(int nochdir, int noclose, int close_fd); + extern int status_ready(void); + extern int is_root_user(void); +diff --git a/criu/util.c b/criu/util.c +index 822822186..15b3c3756 100644 +--- a/criu/util.c ++++ b/criu/util.c +@@ -655,6 +655,63 @@ out: + return ret; + } + ++pid_t fork_and_ptrace_attach(int (*child_setup)(void)) ++{ ++ pid_t pid; ++ int sk_pair[2], sk; ++ char c = 0; ++ ++ if (socketpair(PF_LOCAL, SOCK_SEQPACKET, 0, sk_pair)) { ++ pr_perror("socketpair"); ++ return -1; ++ } ++ ++ pid = fork(); ++ if (pid < 0) { ++ pr_perror("fork"); ++ return -1; ++ } else if (pid == 0) { ++ sk = sk_pair[1]; ++ close(sk_pair[0]); ++ ++ if (child_setup && child_setup() != 0) ++ exit(1); ++ ++ if (write(sk, &c, 1) != 1) { ++ pr_perror("write"); ++ exit(1); ++ } ++ ++ while (1) ++ sleep(1000); ++ exit(1); ++ } ++ ++ sk = sk_pair[0]; ++ close(sk_pair[1]); ++ ++ if (read(sk, &c, 1) != 1) { ++ close(sk); ++ kill(pid, SIGKILL); ++ waitpid(pid, NULL, 0); ++ pr_perror("read"); ++ return -1; ++ } ++ ++ close(sk); ++ ++ if (ptrace(PTRACE_ATTACH, pid, NULL, NULL) == -1) { ++ pr_perror("Unable to ptrace the child"); ++ kill(pid, SIGKILL); ++ waitpid(pid, NULL, 0); ++ return -1; ++ } ++ ++ waitpid(pid, NULL, 0); ++ ++ return pid; ++} ++ + int status_ready(void) + { + char c = 0; +-- +2.34.1 + diff --git a/0123-cr-check-Add-ptrace-rseq-conf-dump-feature.patch b/0123-cr-check-Add-ptrace-rseq-conf-dump-feature.patch new file mode 100644 index 0000000..4366fb7 --- /dev/null +++ b/0123-cr-check-Add-ptrace-rseq-conf-dump-feature.patch @@ -0,0 +1,163 @@ +From e4aca530b7d001fbccf9dfb2cf41c4b32f46a1fe Mon Sep 17 00:00:00 2001 +From: Alexander Mikhalitsyn +Date: Tue, 21 Dec 2021 18:29:14 +0300 +Subject: [PATCH 04/10] cr-check: Add ptrace rseq conf dump feature + +Add "get_rseq_conf" feature corresponding to the +ptrace(PTRACE_GET_RSEQ_CONFIGURATION) support. + +Signed-off-by: Alexander Mikhalitsyn +--- + compel/include/uapi/ptrace.h | 12 +++++++++++ + criu/cr-check.c | 11 ++++++++++ + criu/include/kerndat.h | 1 + + criu/kerndat.c | 41 ++++++++++++++++++++++++++++++++++++ + 4 files changed, 65 insertions(+) + +diff --git a/compel/include/uapi/ptrace.h b/compel/include/uapi/ptrace.h +index 533e0569f..15476f158 100644 +--- a/compel/include/uapi/ptrace.h ++++ b/compel/include/uapi/ptrace.h +@@ -65,6 +65,18 @@ typedef struct { + uint64_t flags; /* Output: filter's flags */ + } seccomp_metadata_t; + ++#ifndef PTRACE_GET_RSEQ_CONFIGURATION ++#define PTRACE_GET_RSEQ_CONFIGURATION 0x420f ++ ++struct ptrace_rseq_configuration { ++ __u64 rseq_abi_pointer; ++ __u32 rseq_abi_size; ++ __u32 signature; ++ __u32 flags; ++ __u32 pad; ++}; ++#endif ++ + #ifdef PTRACE_EVENT_STOP + #if PTRACE_EVENT_STOP == 7 /* Bad value from Linux 3.1-3.3, fixed in 3.4 */ + #undef PTRACE_EVENT_STOP +diff --git a/criu/cr-check.c b/criu/cr-check.c +index ccda00173..092ab2e79 100644 +--- a/criu/cr-check.c ++++ b/criu/cr-check.c +@@ -798,6 +798,15 @@ static int check_ptrace_dump_seccomp_filters(void) + return ret; + } + ++static int check_ptrace_get_rseq_conf(void) ++{ ++ if (!kdat.has_ptrace_get_rseq_conf) { ++ pr_warn("ptrace(PTRACE_GET_RSEQ_CONFIGURATION) isn't supported. C/R of processes which are using rseq() won't work.\n"); ++ return -1; ++ } ++ return 0; ++} ++ + static int check_mem_dirty_track(void) + { + if (!kdat.has_dirty_track) { +@@ -1448,6 +1457,7 @@ int cr_check(void) + ret |= check_apparmor_stacking(); + ret |= check_network_lock_nftables(); + ret |= check_sockopt_buf_lock(); ++ ret |= check_ptrace_get_rseq_conf(); + } + + /* +@@ -1561,6 +1571,7 @@ static struct feature_list feature_list[] = { + { "apparmor_stacking", check_apparmor_stacking }, + { "network_lock_nftables", check_network_lock_nftables }, + { "sockopt_buf_lock", check_sockopt_buf_lock }, ++ { "get_rseq_conf", check_ptrace_get_rseq_conf }, + { NULL, NULL }, + }; + +diff --git a/criu/include/kerndat.h b/criu/include/kerndat.h +index 3e0a657ba..fdbe06c8e 100644 +--- a/criu/include/kerndat.h ++++ b/criu/include/kerndat.h +@@ -76,6 +76,7 @@ struct kerndat_s { + bool has_nftables_concat; + bool has_sockopt_buf_lock; + bool has_rseq; ++ bool has_ptrace_get_rseq_conf; + }; + + extern struct kerndat_s kdat; +diff --git a/criu/kerndat.c b/criu/kerndat.c +index 82143377f..8772a7293 100644 +--- a/criu/kerndat.c ++++ b/criu/kerndat.c +@@ -4,6 +4,8 @@ + #include + #include + #include ++#include ++#include + #include + #include + #include +@@ -36,6 +38,7 @@ + #include "sockets.h" + #include "net.h" + #include "tun.h" ++#include + #include + #include "netfilter.h" + #include "fsnotify.h" +@@ -830,6 +833,40 @@ static int kerndat_has_rseq(void) + return 0; + } + ++static int kerndat_has_ptrace_get_rseq_conf(void) ++{ ++ pid_t pid; ++ int len; ++ struct ptrace_rseq_configuration rseq; ++ ++ pid = fork_and_ptrace_attach(NULL); ++ if (pid < 0) ++ return -1; ++ ++ len = ptrace(PTRACE_GET_RSEQ_CONFIGURATION, pid, sizeof(rseq), &rseq); ++ if (len != sizeof(rseq)) { ++ kdat.has_ptrace_get_rseq_conf = false; ++ pr_info("ptrace(PTRACE_GET_RSEQ_CONFIGURATION) is not supported\n"); ++ goto out; ++ } ++ ++ /* ++ * flags is always zero from the kernel side, if it will be changed ++ * we need to pay attention to that and, possibly, make changes on the CRIU side. ++ */ ++ if (rseq.flags != 0) { ++ kdat.has_ptrace_get_rseq_conf = false; ++ pr_err("ptrace(PTRACE_GET_RSEQ_CONFIGURATION): rseq.flags != 0\n"); ++ } else { ++ kdat.has_ptrace_get_rseq_conf = true; ++ } ++ ++out: ++ kill(pid, SIGKILL); ++ waitpid(pid, NULL, 0); ++ return 0; ++} ++ + int kerndat_sockopt_buf_lock(void) + { + int exit_code = -1; +@@ -1410,6 +1447,10 @@ int kerndat_init(void) + pr_err("kerndat_has_rseq failed when initializing kerndat.\n"); + ret = -1; + } ++ if (!ret && kerndat_has_ptrace_get_rseq_conf()) { ++ pr_err("kerndat_has_ptrace_get_rseq_conf failed when initializing kerndat.\n"); ++ ret = -1; ++ } + + kerndat_lsm(); + kerndat_mmap_min_addr(); +-- +2.34.1 + diff --git a/0124-rseq-initial-support.patch b/0124-rseq-initial-support.patch new file mode 100644 index 0000000..3100ceb --- /dev/null +++ b/0124-rseq-initial-support.patch @@ -0,0 +1,711 @@ +From 5d7cffb87adbf72298eea59ae118ac65aed9fe89 Mon Sep 17 00:00:00 2001 +From: Alexander Mikhalitsyn +Date: Tue, 21 Dec 2021 23:27:26 +0300 +Subject: [PATCH 05/10] rseq: initial support + +TODO: +1. properly handle case when the kernel has rseq() +support but has no ptrace(PTRACE_GET_RSEQ_CONFIGURATION) +support and user processes haven't used rseq(). +2. properly handle "transient" states, when CRIU +comes during rseq was executed. We need test for this +case with some "heavy" rseq + we need to properly handle +RSEQ_CS_* flags. + +Fixes: https://github.com/checkpoint-restore/criu/issues/1696 + +Reported-by: Radostin Stoyanov +Suggested-by: Florian Weimer +Signed-off-by: Alexander Mikhalitsyn +--- + compel/include/uapi/ptrace.h | 16 ++-- + criu/cr-dump.c | 99 ++++++++++++++++++++++++ + criu/cr-restore.c | 17 +++++ + criu/include/linux/rseq.h | 144 +++++++++++++++++++++++++++++++++++ + criu/include/parasite.h | 7 ++ + criu/include/restorer.h | 7 ++ + criu/kerndat.c | 2 +- + criu/parasite-syscall.c | 11 +++ + criu/pie/parasite.c | 104 +++++++++++++++++++++++++ + criu/pie/restorer.c | 24 ++++++ + images/Makefile | 1 + + images/core.proto | 2 + + images/rseq.proto | 9 +++ + 13 files changed, 434 insertions(+), 9 deletions(-) + create mode 100644 criu/include/linux/rseq.h + create mode 100644 images/rseq.proto + +diff --git a/compel/include/uapi/ptrace.h b/compel/include/uapi/ptrace.h +index 15476f158..63dfee97f 100644 +--- a/compel/include/uapi/ptrace.h ++++ b/compel/include/uapi/ptrace.h +@@ -66,14 +66,14 @@ typedef struct { + } seccomp_metadata_t; + + #ifndef PTRACE_GET_RSEQ_CONFIGURATION +-#define PTRACE_GET_RSEQ_CONFIGURATION 0x420f +- +-struct ptrace_rseq_configuration { +- __u64 rseq_abi_pointer; +- __u32 rseq_abi_size; +- __u32 signature; +- __u32 flags; +- __u32 pad; ++#define PTRACE_GET_RSEQ_CONFIGURATION 0x420f ++ ++struct __ptrace_rseq_configuration { ++ uint64_t rseq_abi_pointer; ++ uint32_t rseq_abi_size; ++ uint32_t signature; ++ uint32_t flags; ++ uint32_t pad; + }; + #endif + +diff --git a/criu/cr-dump.c b/criu/cr-dump.c +index c972e343a..8c4a1c9fe 100644 +--- a/criu/cr-dump.c ++++ b/criu/cr-dump.c +@@ -45,6 +45,7 @@ + #include "proc_parse.h" + #include "parasite.h" + #include "parasite-syscall.h" ++#include + #include "files.h" + #include "files-reg.h" + #include "shmem.h" +@@ -187,6 +188,25 @@ static int dump_sched_info(int pid, ThreadCoreEntry *tc) + return 0; + } + ++static int check_thread_rseq(pid_t tid, const struct parasite_check_rseq *ti_rseq, bool has_tc_rseq_entry) ++{ ++ if (!kdat.has_rseq || kdat.has_ptrace_get_rseq_conf) ++ return 0; ++ ++ pr_debug("%d has rseq_inited = %d\n", tid, ti_rseq->rseq_inited); ++ ++ /* ++ * We have no kdat.has_ptrace_get_rseq_conf and user ++ * process has rseq() used, let's fail dump. ++ */ ++ if (ti_rseq->rseq_inited) { ++ pr_err("%d has rseq but kernel lacks get_rseq_conf feature\n", tid); ++ return -1; ++ } ++ ++ return 0; ++} ++ + struct cr_imgset *glob_imgset; + + static int collect_fds(pid_t pid, struct parasite_drain_fd **dfds) +@@ -717,6 +737,17 @@ int dump_thread_core(int pid, CoreEntry *core, const struct parasite_dump_thread + if (!ret) + ret = seccomp_dump_thread(pid, tc); + ++ /* ++ * We are dumping rseq() in the dump_thread_rseq() function, ++ * *before* processes gets infected (because of ptrace requests ++ * API restriction). At this point, if the kernel lacks ++ * kdat.has_ptrace_get_rseq_conf support we have to ensure ++ * that dumpable processes haven't initialized rseq() or ++ * fail dump if rseq() was used. ++ */ ++ if (!ret) ++ ret = check_thread_rseq(pid, &ti->rseq, !!tc->rseq_entry); ++ + return ret; + } + +@@ -1003,6 +1034,68 @@ static int dump_task_signals(pid_t pid, struct pstree_item *item) + return 0; + } + ++static int dump_thread_rseq(pid_t tid, RseqEntry **rseqep) ++{ ++ struct __ptrace_rseq_configuration rseq; ++ RseqEntry *rseqe = NULL; ++ int ret; ++ ++ /* ++ * If we are here it means that rseq() syscall is supported, ++ * but ptrace(PTRACE_GET_RSEQ_CONFIGURATION) isn't supported, ++ * we can just fail dump here. But this is bad idea, IMHO. ++ * ++ * So, we will try to detect if victim process was used rseq(). ++ * See check_rseq() and check_thread_rseq() functions. ++ */ ++ if (!kdat.has_ptrace_get_rseq_conf) ++ return 0; ++ ++ ret = ptrace(PTRACE_GET_RSEQ_CONFIGURATION, tid, sizeof(rseq), &rseq); ++ if (ret != sizeof(rseq)) { ++ pr_perror("ptrace(PTRACE_GET_RSEQ_CONFIGURATION, %d) = %d", tid, ret); ++ return -1; ++ } ++ ++ if (rseq.flags != 0) { ++ pr_err("something wrong with ptrace(PTRACE_GET_RSEQ_CONFIGURATION, %d) flags = 0x%x\n", tid, ++ rseq.flags); ++ return -1; ++ } ++ ++ pr_err("Dump rseq of %d: ptr = 0x%lx sign = 0x%x\n", tid, (unsigned long)rseq.rseq_abi_pointer, rseq.signature); ++ ++ rseqe = xmalloc(sizeof(*rseqe)); ++ if (!rseqe) ++ return -1; ++ ++ rseq_entry__init(rseqe); ++ ++ rseqe->rseq_abi_pointer = rseq.rseq_abi_pointer; ++ rseqe->rseq_abi_size = rseq.rseq_abi_size; ++ rseqe->signature = rseq.signature; ++ ++ *rseqep = rseqe; ++ ++ return 0; ++} ++ ++static int dump_task_rseq(pid_t pid, struct pstree_item *item) ++{ ++ int i; ++ ++ /* if rseq() syscall isn't supported then nothing to dump */ ++ if (!kdat.has_rseq) ++ return 0; ++ ++ for (i = 0; i < item->nr_threads; i++) { ++ if (dump_thread_rseq(item->threads[i].real, &item->core[i]->thread_core->rseq_entry)) ++ return -1; ++ } ++ ++ return 0; ++} ++ + static struct proc_pid_stat pps_buf; + + static int dump_task_threads(struct parasite_ctl *parasite_ctl, const struct pstree_item *item) +@@ -1298,6 +1391,12 @@ static int dump_one_task(struct pstree_item *item, InventoryEntry *parent_ie) + goto err; + } + ++ ret = dump_task_rseq(pid, item); ++ if (ret) { ++ pr_err("Dump %d rseq failed %d\n", pid, ret); ++ goto err; ++ } ++ + parasite_ctl = parasite_infect_seized(pid, item, &vmas); + if (!parasite_ctl) { + pr_err("Can't infect (pid: %d) with parasite\n", pid); +diff --git a/criu/cr-restore.c b/criu/cr-restore.c +index ed62cc5a2..1821c21de 100644 +--- a/criu/cr-restore.c ++++ b/criu/cr-restore.c +@@ -2994,6 +2994,19 @@ static int prep_sched_info(struct rst_sched_param *sp, ThreadCoreEntry *tc) + return 0; + } + ++static int prep_rseq(struct rst_rseq_param *rseq, ThreadCoreEntry *tc) ++{ ++ /* compatibility with older CRIU versions */ ++ if (!tc->rseq_entry) ++ return 0; ++ ++ rseq->rseq_abi_pointer = tc->rseq_entry->rseq_abi_pointer; ++ rseq->rseq_abi_size = tc->rseq_entry->rseq_abi_size; ++ rseq->signature = tc->rseq_entry->signature; ++ ++ return 0; ++} ++ + static rlim_t decode_rlim(rlim_t ival) + { + return ival == -1 ? RLIM_INFINITY : ival; +@@ -3704,6 +3717,10 @@ static int sigreturn_restore(pid_t pid, struct task_restore_args *task_args, uns + thread_args[i].clear_tid_addr = CORE_THREAD_ARCH_INFO(tcore)->clear_tid_addr; + core_get_tls(tcore, &thread_args[i].tls); + ++ ret = prep_rseq(&thread_args[i].rseq, tcore->thread_core); ++ if (ret) ++ goto err; ++ + rst_reloc_creds(&thread_args[i], &creds_pos_next); + + thread_args[i].futex_rla = tcore->thread_core->futex_rla; +diff --git a/criu/include/linux/rseq.h b/criu/include/linux/rseq.h +new file mode 100644 +index 000000000..5c1706a59 +--- /dev/null ++++ b/criu/include/linux/rseq.h +@@ -0,0 +1,144 @@ ++/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ ++#ifndef _UAPI_LINUX_RSEQ_H ++#define _UAPI_LINUX_RSEQ_H ++ ++/* ++ * linux/rseq.h ++ * ++ * Restartable sequences system call API ++ * ++ * Copyright (c) 2015-2018 Mathieu Desnoyers ++ */ ++ ++#include ++#include ++ ++enum rseq_cpu_id_state { ++ RSEQ_CPU_ID_UNINITIALIZED = -1, ++ RSEQ_CPU_ID_REGISTRATION_FAILED = -2, ++}; ++ ++enum rseq_flags { ++ RSEQ_FLAG_UNREGISTER = (1 << 0), ++}; ++ ++enum rseq_cs_flags_bit { ++ RSEQ_CS_FLAG_NO_RESTART_ON_PREEMPT_BIT = 0, ++ RSEQ_CS_FLAG_NO_RESTART_ON_SIGNAL_BIT = 1, ++ RSEQ_CS_FLAG_NO_RESTART_ON_MIGRATE_BIT = 2, ++}; ++ ++enum rseq_cs_flags { ++ RSEQ_CS_FLAG_NO_RESTART_ON_PREEMPT = (1U << RSEQ_CS_FLAG_NO_RESTART_ON_PREEMPT_BIT), ++ RSEQ_CS_FLAG_NO_RESTART_ON_SIGNAL = (1U << RSEQ_CS_FLAG_NO_RESTART_ON_SIGNAL_BIT), ++ RSEQ_CS_FLAG_NO_RESTART_ON_MIGRATE = (1U << RSEQ_CS_FLAG_NO_RESTART_ON_MIGRATE_BIT), ++}; ++ ++/* ++ * struct rseq_cs is aligned on 4 * 8 bytes to ensure it is always ++ * contained within a single cache-line. It is usually declared as ++ * link-time constant data. ++ */ ++struct rseq_cs { ++ /* Version of this structure. */ ++ __u32 version; ++ /* enum rseq_cs_flags */ ++ __u32 flags; ++ __u64 start_ip; ++ /* Offset from start_ip. */ ++ __u64 post_commit_offset; ++ __u64 abort_ip; ++} __attribute__((aligned(4 * sizeof(__u64)))); ++ ++/* ++ * struct rseq is aligned on 4 * 8 bytes to ensure it is always ++ * contained within a single cache-line. ++ * ++ * A single struct rseq per thread is allowed. ++ */ ++struct rseq { ++ /* ++ * Restartable sequences cpu_id_start field. Updated by the ++ * kernel. Read by user-space with single-copy atomicity ++ * semantics. This field should only be read by the thread which ++ * registered this data structure. Aligned on 32-bit. Always ++ * contains a value in the range of possible CPUs, although the ++ * value may not be the actual current CPU (e.g. if rseq is not ++ * initialized). This CPU number value should always be compared ++ * against the value of the cpu_id field before performing a rseq ++ * commit or returning a value read from a data structure indexed ++ * using the cpu_id_start value. ++ */ ++ __u32 cpu_id_start; ++ /* ++ * Restartable sequences cpu_id field. Updated by the kernel. ++ * Read by user-space with single-copy atomicity semantics. This ++ * field should only be read by the thread which registered this ++ * data structure. Aligned on 32-bit. Values ++ * RSEQ_CPU_ID_UNINITIALIZED and RSEQ_CPU_ID_REGISTRATION_FAILED ++ * have a special semantic: the former means "rseq uninitialized", ++ * and latter means "rseq initialization failed". This value is ++ * meant to be read within rseq critical sections and compared ++ * with the cpu_id_start value previously read, before performing ++ * the commit instruction, or read and compared with the ++ * cpu_id_start value before returning a value loaded from a data ++ * structure indexed using the cpu_id_start value. ++ */ ++ __u32 cpu_id; ++ /* ++ * Restartable sequences rseq_cs field. ++ * ++ * Contains NULL when no critical section is active for the current ++ * thread, or holds a pointer to the currently active struct rseq_cs. ++ * ++ * Updated by user-space, which sets the address of the currently ++ * active rseq_cs at the beginning of assembly instruction sequence ++ * block, and set to NULL by the kernel when it restarts an assembly ++ * instruction sequence block, as well as when the kernel detects that ++ * it is preempting or delivering a signal outside of the range ++ * targeted by the rseq_cs. Also needs to be set to NULL by user-space ++ * before reclaiming memory that contains the targeted struct rseq_cs. ++ * ++ * Read and set by the kernel. Set by user-space with single-copy ++ * atomicity semantics. This field should only be updated by the ++ * thread which registered this data structure. Aligned on 64-bit. ++ */ ++ union { ++ __u64 ptr64; ++#ifdef __LP64__ ++ __u64 ptr; ++#else ++ struct { ++#if (defined(__BYTE_ORDER) && (__BYTE_ORDER == __BIG_ENDIAN)) || defined(__BIG_ENDIAN) ++ __u32 padding; /* Initialized to zero. */ ++ __u32 ptr32; ++#else /* LITTLE */ ++ __u32 ptr32; ++ __u32 padding; /* Initialized to zero. */ ++#endif /* ENDIAN */ ++ } ptr; ++#endif ++ } rseq_cs; ++ ++ /* ++ * Restartable sequences flags field. ++ * ++ * This field should only be updated by the thread which ++ * registered this data structure. Read by the kernel. ++ * Mainly used for single-stepping through rseq critical sections ++ * with debuggers. ++ * ++ * - RSEQ_CS_FLAG_NO_RESTART_ON_PREEMPT ++ * Inhibit instruction sequence block restart on preemption ++ * for this thread. ++ * - RSEQ_CS_FLAG_NO_RESTART_ON_SIGNAL ++ * Inhibit instruction sequence block restart on signal ++ * delivery for this thread. ++ * - RSEQ_CS_FLAG_NO_RESTART_ON_MIGRATE ++ * Inhibit instruction sequence block restart on migration for ++ * this thread. ++ */ ++ __u32 flags; ++} __attribute__((aligned(4 * sizeof(__u64)))); ++ ++#endif /* _UAPI_LINUX_RSEQ_H */ +diff --git a/criu/include/parasite.h b/criu/include/parasite.h +index 8107aa49d..5fde80996 100644 +--- a/criu/include/parasite.h ++++ b/criu/include/parasite.h +@@ -164,10 +164,17 @@ struct parasite_dump_creds { + unsigned int groups[0]; + }; + ++struct parasite_check_rseq { ++ bool has_rseq; ++ bool has_ptrace_get_rseq_conf; /* no need to check if supported */ ++ bool rseq_inited; ++}; ++ + struct parasite_dump_thread { + unsigned int *tid_addr; + pid_t tid; + tls_t tls; ++ struct parasite_check_rseq rseq; + stack_t sas; + int pdeath_sig; + char comm[TASK_COMM_LEN]; +diff --git a/criu/include/restorer.h b/criu/include/restorer.h +index 308a0b79b..2e21da522 100644 +--- a/criu/include/restorer.h ++++ b/criu/include/restorer.h +@@ -44,6 +44,12 @@ struct rst_sched_param { + int prio; + }; + ++struct rst_rseq_param { ++ u64 rseq_abi_pointer; ++ u32 rseq_abi_size; ++ u32 signature; ++}; ++ + struct restore_posix_timer { + struct str_posix_timer spt; + struct itimerspec val; +@@ -98,6 +104,7 @@ struct thread_restore_args { + struct task_restore_args *ta; + + tls_t tls; ++ struct rst_rseq_param rseq; + + siginfo_t *siginfo; + unsigned int siginfo_n; +diff --git a/criu/kerndat.c b/criu/kerndat.c +index 8772a7293..7981e4ca0 100644 +--- a/criu/kerndat.c ++++ b/criu/kerndat.c +@@ -837,7 +837,7 @@ static int kerndat_has_ptrace_get_rseq_conf(void) + { + pid_t pid; + int len; +- struct ptrace_rseq_configuration rseq; ++ struct __ptrace_rseq_configuration rseq; + + pid = fork_and_ptrace_attach(NULL); + if (pid < 0) +diff --git a/criu/parasite-syscall.c b/criu/parasite-syscall.c +index 7175adee1..ee4fa86f4 100644 +--- a/criu/parasite-syscall.c ++++ b/criu/parasite-syscall.c +@@ -132,6 +132,13 @@ static int alloc_groups_copy_creds(CredsEntry *ce, struct parasite_dump_creds *c + return ce->groups ? 0 : -ENOMEM; + } + ++static void init_parasite_rseq_arg(struct parasite_check_rseq *rseq) ++{ ++ rseq->has_rseq = kdat.has_rseq; ++ rseq->has_ptrace_get_rseq_conf = kdat.has_ptrace_get_rseq_conf; ++ rseq->rseq_inited = false; ++} ++ + int parasite_dump_thread_leader_seized(struct parasite_ctl *ctl, int pid, CoreEntry *core) + { + ThreadCoreEntry *tc = core->thread_core; +@@ -144,6 +151,8 @@ int parasite_dump_thread_leader_seized(struct parasite_ctl *ctl, int pid, CoreEn + pc = args->creds; + pc->cap_last_cap = kdat.last_cap; + ++ init_parasite_rseq_arg(&args->rseq); ++ + ret = compel_rpc_call_sync(PARASITE_CMD_DUMP_THREAD, ctl); + if (ret < 0) + return ret; +@@ -197,6 +206,8 @@ int parasite_dump_thread_seized(struct parasite_thread_ctl *tctl, struct parasit + + compel_arch_get_tls_thread(tctl, &args->tls); + ++ init_parasite_rseq_arg(&args->rseq); ++ + ret = compel_run_in_thread(tctl, PARASITE_CMD_DUMP_THREAD); + if (ret) { + pr_err("Can't init thread in parasite %d\n", pid); +diff --git a/criu/pie/parasite.c b/criu/pie/parasite.c +index bc0a33cd4..bf4b11bea 100644 +--- a/criu/pie/parasite.c ++++ b/criu/pie/parasite.c +@@ -8,6 +8,8 @@ + #include + #include + ++#include "linux/rseq.h" ++ + #include "common/config.h" + #include "int.h" + #include "types.h" +@@ -167,6 +169,7 @@ static int dump_posix_timers(struct parasite_dump_posix_timers_args *args) + } + + static int dump_creds(struct parasite_dump_creds *args); ++static int check_rseq(struct parasite_check_rseq *rseq); + + static int dump_thread_common(struct parasite_dump_thread *ti) + { +@@ -197,6 +200,12 @@ static int dump_thread_common(struct parasite_dump_thread *ti) + goto out; + } + ++ ret = check_rseq(&ti->rseq); ++ if (ret) { ++ pr_err("Unable to check if rseq() is initialized: %d\n", ret); ++ goto out; ++ } ++ + ret = dump_creds(ti->creds); + out: + return ret; +@@ -313,6 +322,101 @@ grps_err: + return -1; + } + ++static int check_rseq(struct parasite_check_rseq *rseq) ++{ ++ int ret; ++ unsigned long rseq_abi_pointer; ++ unsigned long rseq_abi_size; ++ uint32_t rseq_signature; ++ void *addr; ++ ++ pr_err("hello from %ld rseq.has_ptrace_get_rseq_conf = %d\n", sys_gettid(), rseq->has_ptrace_get_rseq_conf); ++ ++ /* no need to do hacky check if we can get all info from ptrace() */ ++ if (!rseq->has_rseq || rseq->has_ptrace_get_rseq_conf) ++ return 0; ++#if 0 ++ pr_err("rseq: rseq_abi_pointer = %lx signature = %x\n", ++ rseq->rseq_abi_pointer, rseq->signature); ++#endif ++ /* ++ * We need to determine if victim process has rseq() ++ * initialized, but we have no *any* proper kernel interface ++ * supported at this point. ++ * Our plan: ++ * 1. We know that if we call rseq() syscall and process already ++ * has current->rseq filled, then we get: ++ * -EINVAL if current->rseq != rseq || rseq_len != sizeof(*rseq), ++ * -EPERM if current->rseq_sig != sig), ++ * -EBUSY if current->rseq == rseq && rseq_len == sizeof(*rseq) && ++ * current->rseq_sig != sig ++ * if current->rseq == NULL (rseq() wasn't used) then we go to: ++ * IS_ALIGNED(rseq ...) check, if we fail it we get -EINVAL and it ++ * will be hard to distinguish case when rseq() was initialized or not. ++ * Let's construct arguments payload ++ * with: ++ * 1. correct rseq_abi_size ++ * 2. aligned and correct rseq_abi_pointer ++ * And see what rseq() return to us. ++ * If ret value is: ++ * 0: it means that rseq *wasn't* used and we successfuly registered it, ++ * -EINVAL or : it means that rseq is already initialized, ++ * so we *have* to dump it. But as we have has_ptrace_get_rseq_conf = false, ++ * we should just fail dump as it's unsafe to skip rseq() dump for processes ++ * with rseq() initialized. ++ * -EPERM or -EBUSY: should not happen as we take a fresh memory area for rseq ++ */ ++ addr = (void *)sys_mmap(NULL, sizeof(struct rseq), PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); ++ if (addr == MAP_FAILED) { ++ pr_err("mmap() failed for struct rseq ret = %lx\n", (unsigned long)addr); ++ return -1; ++ } ++ ++ memset(addr, 0, sizeof(struct rseq)); ++ ++ /* sys_mmap returns page aligned addresses */ ++ rseq_abi_pointer = (unsigned long)addr; ++ rseq_abi_size = (unsigned long)sizeof(struct rseq); ++ /* it's not so important to have unique signature for us, ++ * because rseq_abi_pointer is guaranteed to be unique ++ */ ++ rseq_signature = 0x12345612; ++ ++ pr_err("\ttrying sys_rseq(%lx, %lx, %x, %x)\n", rseq_abi_pointer, rseq_abi_size, 0, rseq_signature); ++ ret = sys_rseq((void *)rseq_abi_pointer, rseq_abi_size, 0, rseq_signature); ++ if (ret) { ++ if (ret == -EINVAL) { ++ pr_info("\trseq is initialized in the victim Error\n"); ++ rseq->rseq_inited = true; ++ ++ ret = 0; ++ } else { ++ pr_err("\tunexpected failure of sys_rseq(%lx, %lx, %x, %x) = %d\n", rseq_abi_pointer, ++ rseq_abi_size, 0, rseq_signature, ret); ++ ++ ret = -1; ++ } ++ } else { ++ ret = sys_rseq((void *)rseq_abi_pointer, sizeof(struct rseq), RSEQ_FLAG_UNREGISTER, rseq_signature); ++ if (ret) { ++ pr_err("\tfailed to unregister sys_rseq(%lx, %lx, %x, %x) = %d\n", rseq_abi_pointer, ++ rseq_abi_size, RSEQ_FLAG_UNREGISTER, rseq_signature, ret); ++ ++ ret = -1; ++ goto out; ++ } ++ ++ pr_info("\tsys_rseq succeed, let's unregister it back... ok Error\n"); ++ pr_info("\trseq is non-initialized in the victim Error\n"); ++ rseq->rseq_inited = false; ++ ret = 0; ++ } ++ ++out: ++ sys_munmap(addr, sizeof(struct rseq)); ++ return ret; ++} ++ + static int fill_fds_fown(int fd, struct fd_opts *p) + { + int flags, ret; +diff --git a/criu/pie/restorer.c b/criu/pie/restorer.c +index 0051452e4..33920af40 100644 +--- a/criu/pie/restorer.c ++++ b/criu/pie/restorer.c +@@ -425,6 +425,27 @@ static int restore_signals(siginfo_t *ptr, int nr, bool group) + return 0; + } + ++static int restore_rseq(struct rst_rseq_param *rseq) ++{ ++ int ret; ++ ++ if (!rseq->rseq_abi_pointer) { ++ pr_err("rseq: nothing to restore\n"); ++ return 0; ++ } ++ ++ pr_err("rseq: rseq_abi_pointer = %lx signature = %x\n", (unsigned long)rseq->rseq_abi_pointer, rseq->signature); ++ ++ ret = sys_rseq(decode_pointer(rseq->rseq_abi_pointer), rseq->rseq_abi_size, 0, rseq->signature); ++ if (ret) { ++ pr_err("failed sys_rseq(%lx, %lx, %x, %x) = %d\n", (unsigned long)rseq->rseq_abi_pointer, ++ (unsigned long)rseq->rseq_abi_size, 0, rseq->signature, ret); ++ return -1; ++ } ++ ++ return 0; ++} ++ + static int restore_seccomp_filter(pid_t tid, struct thread_restore_args *args) + { + unsigned int flags = args->seccomp_force_tsync ? SECCOMP_FILTER_FLAG_TSYNC : 0; +@@ -549,6 +570,9 @@ static int restore_thread_common(struct thread_restore_args *args) + + restore_tls(&args->tls); + ++ if (restore_rseq(&args->rseq)) ++ return -1; ++ + return 0; + } + +diff --git a/images/Makefile b/images/Makefile +index 2eaeb7cad..004e22ec3 100644 +--- a/images/Makefile ++++ b/images/Makefile +@@ -71,6 +71,7 @@ proto-obj-y += img-streamer.o + proto-obj-y += bpfmap-file.o + proto-obj-y += bpfmap-data.o + proto-obj-y += apparmor.o ++proto-obj-y += rseq.o + + CFLAGS += -iquote $(obj)/ + +diff --git a/images/core.proto b/images/core.proto +index b713119f2..35079f366 100644 +--- a/images/core.proto ++++ b/images/core.proto +@@ -14,6 +14,7 @@ import "timer.proto"; + import "creds.proto"; + import "sa.proto"; + import "siginfo.proto"; ++import "rseq.proto"; + + import "opts.proto"; + +@@ -101,6 +102,7 @@ message thread_core_entry { + + optional string comm = 13; + optional uint64 blk_sigset_extended = 14; ++ optional rseq_entry rseq_entry = 15; + } + + message task_rlimits_entry { +diff --git a/images/rseq.proto b/images/rseq.proto +new file mode 100644 +index 000000000..be2800468 +--- /dev/null ++++ b/images/rseq.proto +@@ -0,0 +1,9 @@ ++// SPDX-License-Identifier: MIT ++ ++syntax = "proto2"; ++ ++message rseq_entry { ++ required uint64 rseq_abi_pointer = 1; ++ required uint32 rseq_abi_size = 2; ++ required uint32 signature = 3; ++} +-- +2.34.1 + diff --git a/0125-zdtm-add-simple-test-for-rseq-C-R.patch b/0125-zdtm-add-simple-test-for-rseq-C-R.patch new file mode 100644 index 0000000..f9d2666 --- /dev/null +++ b/0125-zdtm-add-simple-test-for-rseq-C-R.patch @@ -0,0 +1,233 @@ +From dd043f2fbd5329ff45685ed2009163022f6a6ea3 Mon Sep 17 00:00:00 2001 +From: Alexander Mikhalitsyn +Date: Tue, 21 Dec 2021 23:40:01 +0300 +Subject: [PATCH 06/10] zdtm: add simple test for rseq C/R + +Signed-off-by: Alexander Mikhalitsyn +--- + test/zdtm/static/Makefile | 1 + + test/zdtm/static/rseq.c | 190 +++++++++++++++++++++++++++++++++++++ + test/zdtm/static/rseq.desc | 1 + + 3 files changed, 192 insertions(+) + create mode 100644 test/zdtm/static/rseq.c + create mode 100644 test/zdtm/static/rseq.desc + +diff --git a/test/zdtm/static/Makefile b/test/zdtm/static/Makefile +index 4a21978b5..5a457606c 100644 +--- a/test/zdtm/static/Makefile ++++ b/test/zdtm/static/Makefile +@@ -61,6 +61,7 @@ TST_NOFILE := \ + pthread02 \ + pthread_timers \ + pthread_timers_h \ ++ rseq \ + vdso00 \ + vdso01 \ + vdso02 \ +diff --git a/test/zdtm/static/rseq.c b/test/zdtm/static/rseq.c +new file mode 100644 +index 000000000..f2fccb8f4 +--- /dev/null ++++ b/test/zdtm/static/rseq.c +@@ -0,0 +1,190 @@ ++/* ++ * test for rseq() syscall ++ * See also https://www.efficios.com/blog/2019/02/08/linux-restartable-sequences/ ++ * https://github.com/torvalds/linux/commit/d7822b1e24f2df5df98c76f0e94a5416349ff759 ++ */ ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "zdtmtst.h" ++ ++#if defined(__x86_64__) ++ ++const char *test_doc = "Check that rseq() basic C/R works"; ++const char *test_author = "Alexander Mikhalitsyn "; ++/* parts of code borrowed from https://www.efficios.com/blog/2019/02/08/linux-restartable-sequences/ */ ++ ++/* some useful definitions from kernel uapi */ ++enum rseq_flags { ++ RSEQ_FLAG_UNREGISTER = (1 << 0), ++}; ++ ++struct rseq { ++ uint32_t cpu_id_start; ++ uint32_t cpu_id; ++ uint64_t rseq_cs; ++ uint32_t flags; ++} __attribute__((aligned(4 * sizeof(uint64_t)))); ++ ++#ifndef __NR_rseq ++#define __NR_rseq 334 ++#endif ++/* EOF */ ++ ++static __thread volatile struct rseq __rseq_abi; ++ ++#define RSEQ_SIG 0x53053053 ++#define TESTRSEQ 1 ++#ifdef TESTRSEQ ++static int sys_rseq(volatile struct rseq *rseq_abi, uint32_t rseq_len, int flags, uint32_t sig) ++{ ++ return syscall(__NR_rseq, rseq_abi, rseq_len, flags, sig); ++} ++ ++static void register_thread(void) ++{ ++ int rc; ++ rc = sys_rseq(&__rseq_abi, sizeof(struct rseq), 0, RSEQ_SIG); ++ if (rc) { ++ fail("Failed to register rseq"); ++ exit(1); ++ } ++} ++ ++static void unregister_thread(void) ++{ ++ int rc; ++ rc = sys_rseq(&__rseq_abi, sizeof(struct rseq), RSEQ_FLAG_UNREGISTER, RSEQ_SIG); ++ if (rc) { ++ fail("Failed to unregister rseq"); ++ exit(1); ++ } ++} ++ ++static void check_thread(void) ++{ ++ int rc; ++ rc = sys_rseq(&__rseq_abi, sizeof(struct rseq), 0, RSEQ_SIG); ++ if (!(rc && errno == EBUSY)) { ++ fail("Failed to check rseq %d", rc); ++ exit(1); ++ } ++} ++ ++#define RSEQ_ACCESS_ONCE(x) (*(__volatile__ __typeof__(x) *)&(x)) ++ ++static int rseq_addv(intptr_t *v, intptr_t count, int cpu) ++{ ++ /* clang-format off */ ++ __asm__ __volatile__ goto( ++ ".pushsection __rseq_table, \"aw\"\n\t" ++ ".balign 32\n\t" ++ "cs_obj:\n\t" ++ /* version, flags */ ++ ".long 0, 0\n\t" ++ /* start_ip, post_commit_ip, abort_ip */ ++ ".quad 1f, 2f, 4f\n\t" ++ ".popsection\n\t" ++ "1:\n\t" ++ "leaq cs_obj(%%rip), %%rax\n\t" ++ "movq %%rax, %[rseq_cs]\n\t" ++ "cmpl %[cpu_id], %[current_cpu_id]\n\t" ++ "jnz 4f\n\t" ++ "addq %[count], %[v]\n\t" /* final store */ ++ "2:\n\t" ++ ".pushsection __rseq_failure, \"ax\"\n\t" ++ /* Disassembler-friendly signature: nopl (%rip). */ ++ ".byte 0x0f, 0x1f, 0x05\n\t" ++ ".long 0x53053053\n\t" /* RSEQ_FLAGS */ ++ "4:\n\t" ++ "jmp abort\n\t" ++ ".popsection\n\t" ++ : /* gcc asm goto does not allow outputs */ ++ : [cpu_id] "r" (cpu), ++ [current_cpu_id] "m" (__rseq_abi.cpu_id), ++ [rseq_cs] "m" (__rseq_abi.rseq_cs), ++ /* final store input */ ++ [v] "m" (*v), ++ [count] "er" (count) ++ : "memory", "cc", "rax" ++ : abort ++ ); ++ /* clang-format on */ ++ ++ return 0; ++abort: ++ return -1; ++} ++#endif ++int main(int argc, char *argv[]) ++{ ++#ifdef TESTRSEQ ++ int cpu, ret; ++#endif ++ intptr_t *cpu_data; ++ long nr_cpus = sysconf(_SC_NPROCESSORS_ONLN); ++ ++ test_init(argc, argv); ++ ++ cpu_data = calloc(nr_cpus, sizeof(*cpu_data)); ++ if (!cpu_data) { ++ fail("calloc"); ++ exit(EXIT_FAILURE); ++ } ++ register_thread(); ++ ++ test_msg("Ready for C/R\n"); ++ ++ test_daemon(); ++ test_waitsig(); ++#ifdef TESTRSEQ ++ check_thread(); ++ ++ cpu = RSEQ_ACCESS_ONCE(__rseq_abi.cpu_id_start); ++ ret = rseq_addv(&cpu_data[cpu], 2, cpu); ++ if (ret) ++ fail("Failed to increment per-cpu counter"); ++ else ++ test_msg("cpu_data[%d] == %ld\n", cpu, (long int)cpu_data[cpu]); ++ ++ /* TODO: remove this :) */ ++ (void)cpu; ++ (void)ret; ++ (void)rseq_addv; ++ //unregister_thread(); ++ (void)unregister_thread; ++ (void)register_thread; ++#endif ++ test_msg("cpu, cpu_data %d %ld\n", cpu, (long int)cpu_data[cpu]); ++ if (cpu_data[cpu] == 2) ++ pass(); ++ else ++ fail(); ++ //fail(); ++ //unregister_thread(); ++ //(void)unregister_thread; ++ ++ return 0; ++} ++ ++#else ++ ++int main(int argc, char *argv[]) ++{ ++ test_init(argc, argv); ++ skip("Unsupported arch"); ++ return 0; ++} ++ ++#endif +\ No newline at end of file +diff --git a/test/zdtm/static/rseq.desc b/test/zdtm/static/rseq.desc +new file mode 100644 +index 000000000..0324fa39c +--- /dev/null ++++ b/test/zdtm/static/rseq.desc +@@ -0,0 +1 @@ ++{'flavor': 'h', 'arch': 'x86_64', 'feature': 'get_rseq_conf'} +-- +2.34.1 + diff --git a/0126-Revert-ci-disable-glibc-rseq-support.patch b/0126-Revert-ci-disable-glibc-rseq-support.patch new file mode 100644 index 0000000..a351a90 --- /dev/null +++ b/0126-Revert-ci-disable-glibc-rseq-support.patch @@ -0,0 +1,49 @@ +From bc29294f0746413da4560da3d1e81044d781c7fa Mon Sep 17 00:00:00 2001 +From: Alexander Mikhalitsyn +Date: Tue, 21 Dec 2021 23:42:26 +0300 +Subject: [PATCH 07/10] Revert "ci: disable glibc rseq support" + +Let's see how rseq() C/R feature works + +This reverts commit d99def7dcfa938918368c91021f72a77f738bc61. + +Signed-off-by: Alexander Mikhalitsyn +--- + scripts/build/Dockerfile.fedora.tmpl | 3 --- + scripts/ci/run-ci-tests.sh | 7 +------ + 2 files changed, 1 insertion(+), 9 deletions(-) + +diff --git a/scripts/build/Dockerfile.fedora.tmpl b/scripts/build/Dockerfile.fedora.tmpl +index fd4ba4aef..9d3bb0f87 100644 +--- a/scripts/build/Dockerfile.fedora.tmpl ++++ b/scripts/build/Dockerfile.fedora.tmpl +@@ -1,8 +1,5 @@ + ARG CC=gcc + +-# FIXME: Temporary solution for https://github.com/checkpoint-restore/criu/issues/1696 +-ENV GLIBC_TUNABLES=glibc.pthread.rseq=0 +- + COPY scripts/ci/prepare-for-fedora-rawhide.sh /bin/prepare-for-fedora-rawhide.sh + RUN /bin/prepare-for-fedora-rawhide.sh + +diff --git a/scripts/ci/run-ci-tests.sh b/scripts/ci/run-ci-tests.sh +index d0cd55f7c..169dc5eaa 100755 +--- a/scripts/ci/run-ci-tests.sh ++++ b/scripts/ci/run-ci-tests.sh +@@ -231,12 +231,7 @@ if [ -n "$TRAVIS" ] || [ -n "$CIRCLECI" ]; then + # Error (criu/tty.c:1014): tty: Don't have tty to inherit session from, aborting + make -C test/others/shell-job/ run + fi +- +-# FIXME: rpc tests fail even with set glibc tunable +-# https://github.com/checkpoint-restore/criu/issues/1696 +-if [ "$GLIBC_TUNABLES" != "glibc.pthread.rseq=0" ]; then +- make -C test/others/rpc/ run +-fi ++make -C test/others/rpc/ run + + ./test/zdtm.py run -t zdtm/static/env00 --sibling + +-- +2.34.1 + diff --git a/0127-ci-add-Fedora-Rawhide-based-test-on-Cirrus.patch b/0127-ci-add-Fedora-Rawhide-based-test-on-Cirrus.patch new file mode 100644 index 0000000..79ad13f --- /dev/null +++ b/0127-ci-add-Fedora-Rawhide-based-test-on-Cirrus.patch @@ -0,0 +1,124 @@ +From f35272cd37724a03fd3470066c3b5fca8e5e9d99 Mon Sep 17 00:00:00 2001 +From: Alexander Mikhalitsyn +Date: Thu, 23 Dec 2021 14:57:43 +0300 +Subject: [PATCH 08/10] ci: add Fedora Rawhide based test on Cirrus + +We have ability to use nested virtualization on +Cirrus, and already have "Vagrant Fedora based test (no VDSO)" +test, let's do analogical for Fedora Rawhide to get fresh kernel. + +Suggested-by: Adrian Reber +Signed-off-by: Alexander Mikhalitsyn +--- + .cirrus.yml | 21 +++++++++++++++++++++ + scripts/ci/Makefile | 7 +++++-- + scripts/ci/run-ci-tests.sh | 5 +++++ + scripts/ci/vagrant.sh | 21 +++++++++++++++++++++ + 4 files changed, 52 insertions(+), 2 deletions(-) + +diff --git a/.cirrus.yml b/.cirrus.yml +index ef0de54e9..a7c6f95c6 100644 +--- a/.cirrus.yml ++++ b/.cirrus.yml +@@ -19,6 +19,27 @@ task: + build_script: | + make -C scripts/ci vagrant-fedora-no-vdso + ++task: ++ name: Vagrant Fedora Rawhide based test ++ environment: ++ HOME: "/root" ++ CIRRUS_WORKING_DIR: "/tmp/criu" ++ ++ compute_engine_instance: ++ image_project: cirrus-images ++ image: family/docker-kvm ++ platform: linux ++ cpu: 4 ++ memory: 16G ++ nested_virtualization: true ++ ++ setup_script: | ++ scripts/ci/apt-install make gcc pkg-config git perl-modules iproute2 kmod wget cpu-checker ++ sudo kvm-ok ++ ln -sf /usr/include/google/protobuf/descriptor.proto images/google/protobuf/descriptor.proto ++ build_script: | ++ make -C scripts/ci vagrant-fedora-rawhide ++ + task: + name: CentOS 8 based test + environment: +diff --git a/scripts/ci/Makefile b/scripts/ci/Makefile +index 02b4d871c..9c9264dca 100644 +--- a/scripts/ci/Makefile ++++ b/scripts/ci/Makefile +@@ -41,7 +41,7 @@ export CONTAINER_TERMINAL + ifeq ($(UNAME),x86_64) + # On anything besides x86_64 Travis is running unprivileged LXD + # containers which do not support running docker with '--privileged'. +- CONTAINER_OPTS := --rm $(CONTAINER_TERMINAL) --privileged -v /lib/modules:/lib/modules --tmpfs /run ++ CONTAINER_OPTS := --rm $(CONTAINER_TERMINAL) --privileged --userns=host --cgroupns=host -v /lib/modules:/lib/modules --tmpfs /run + else + CONTAINER_OPTS := --rm -v /lib/modules:/lib/modules --tmpfs /run + endif +@@ -92,7 +92,10 @@ setup-vagrant: + vagrant-fedora-no-vdso: setup-vagrant + ./vagrant.sh fedora-no-vdso + +-.PHONY: setup-vagrant vagrant-fedora-no-vdso ++vagrant-fedora-rawhide: setup-vagrant ++ ./vagrant.sh fedora-rawhide ++ ++.PHONY: setup-vagrant vagrant-fedora-no-vdso vagrant-fedora-rawhide + + %: + $(MAKE) -C ../build $@$(target-suffix) +diff --git a/scripts/ci/run-ci-tests.sh b/scripts/ci/run-ci-tests.sh +index 169dc5eaa..f43776ca0 100755 +--- a/scripts/ci/run-ci-tests.sh ++++ b/scripts/ci/run-ci-tests.sh +@@ -192,6 +192,11 @@ if [ "${STREAM_TEST}" = "1" ]; then + exit 0 + fi + ++# print some useful debug info ++cat /proc/self/status ++ls -la /proc/self/ns ++cat /proc/self/cgroup ++ + # shellcheck disable=SC2086 + ./test/zdtm.py run -a -p 2 --keep-going $ZDTM_OPTS + +diff --git a/scripts/ci/vagrant.sh b/scripts/ci/vagrant.sh +index 4a4a16445..aebf83678 100755 +--- a/scripts/ci/vagrant.sh ++++ b/scripts/ci/vagrant.sh +@@ -56,4 +56,25 @@ fedora-no-vdso() { + ssh default 'cd /vagrant/criu/test; sudo ./zdtm.py run -t zdtm/transition/pidfd_store_sk --rpc --pre 2' + } + ++fedora-rawhide() { ++ #ssh default sudo grubby --update-kernel ALL --args="selinux=0 systemd.unified_cgroup_hierarchy=0" ++ ssh default sudo grubby --update-kernel ALL ++ # ++ # Workaround the problem: ++ # error running container: error from /usr/bin/crun creating container for [...]: sd-bus call: Transport endpoint is not connected ++ # Let's just use runc instead of crun ++ # see also https://github.com/kata-containers/tests/issues/4283 ++ # ++ ssh default 'sudo dnf remove -y crun || true' ++ ssh default sudo dnf install -y podman runc ++ vagrant reload ++ #ssh default sudo setenforce 0 ++ ssh default cat /proc/cmdline ++ ssh default ls -la /proc/self/ns ++ ssh default sudo cat /proc/self/status ++ ssh default sudo cat /proc/self/cgroup ++ #ssh default sudo capsh --print ++ ssh default 'cd /vagrant; tar xf criu.tar; cd criu; sudo -E make -C scripts/ci fedora-rawhide CONTAINER_RUNTIME=podman BUILD_OPTIONS="--security-opt seccomp=unconfined"' ++} ++ + $1 +-- +2.34.1 + diff --git a/0128-fixup-attempt-to-disable-rseq-at-the-thread-start.patch b/0128-fixup-attempt-to-disable-rseq-at-the-thread-start.patch new file mode 100644 index 0000000..d4a673e --- /dev/null +++ b/0128-fixup-attempt-to-disable-rseq-at-the-thread-start.patch @@ -0,0 +1,96 @@ +From 3bef22791deec6280244b43b028044ad7015c5d1 Mon Sep 17 00:00:00 2001 +From: Alexander Mikhalitsyn +Date: Fri, 24 Dec 2021 18:57:54 +0300 +Subject: [PATCH 09/10] fixup: attempt to disable rseq at the thread start + +Signed-off-by: Alexander Mikhalitsyn +--- + criu/clone-noasan.c | 49 +++++++++++++++++++++++++++++++++++++++++++-- + 1 file changed, 47 insertions(+), 2 deletions(-) + +diff --git a/criu/clone-noasan.c b/criu/clone-noasan.c +index d657ea2e8..bcda7865b 100644 +--- a/criu/clone-noasan.c ++++ b/criu/clone-noasan.c +@@ -2,6 +2,10 @@ + #include + #include + ++#if defined(__x86_64__) && (__GLIBC__ >= 2 && __GLIBC_MINOR__ >= 34) ++#include ++#endif ++ + #include + + #include "sched.h" +@@ -34,16 +38,55 @@ + * ... wait for process to finish ... + * unlock_last_pid + */ ++ ++#if defined(__x86_64__) && defined(RSEQ_SIG) ++static inline void * ++thread_pointer (void) ++{ ++ void *result; ++ asm ("mov %%fs:0, %0" : "=r" (result)); ++ return result; ++} ++ ++static inline void ++unregister_rseq_asdf (void) ++{ ++ /* unregister rseq */ ++ syscall(__NR_rseq, (void *)((char *) thread_pointer () + __rseq_offset), __rseq_size, 1, RSEQ_SIG); ++} ++#else ++static inline void ++unregister_rseq_asdf (void) ++{ ++} ++#endif ++ ++struct call_fn_args { ++ int (*fn)(void *); ++ void *arg; ++}; ++ ++int call_fn(void *arg) ++{ ++ struct call_fn_args *a = arg; ++ unregister_rseq_asdf(); ++ return a->fn(a->arg); ++} ++ + int clone_noasan(int (*fn)(void *), int flags, void *arg) + { + void *stack_ptr = (void *)round_down((unsigned long)&stack_ptr - 1024, 16); ++ struct call_fn_args a = { ++ .fn = fn, ++ .arg = arg, ++ }; + + BUG_ON((flags & CLONE_VM) && !(flags & CLONE_VFORK)); + /* + * Reserve some bytes for clone() internal needs + * and use as stack the address above this area. + */ +- return clone(fn, stack_ptr, flags, arg); ++ return clone(call_fn, stack_ptr, flags, (void*)&a); + } + + int clone3_with_pid_noasan(int (*fn)(void *), void *arg, int flags, int exit_signal, pid_t pid) +@@ -78,7 +121,9 @@ int clone3_with_pid_noasan(int (*fn)(void *), void *arg, int flags, int exit_sig + c_args.set_tid = ptr_to_u64(&pid); + c_args.set_tid_size = 1; + pid = syscall(__NR_clone3, &c_args, sizeof(c_args)); +- if (pid == 0) ++ if (pid == 0) { ++ unregister_rseq_asdf(); + exit(fn(arg)); ++ } + return pid; + } +-- +2.34.1 + diff --git a/0129-zdtm-fixup-fix-rseq-test-when-linking-with-fresh-gli.patch b/0129-zdtm-fixup-fix-rseq-test-when-linking-with-fresh-gli.patch new file mode 100644 index 0000000..85c391a --- /dev/null +++ b/0129-zdtm-fixup-fix-rseq-test-when-linking-with-fresh-gli.patch @@ -0,0 +1,145 @@ +From d4274171388ee9594d5ec74451e3de4ac83d9682 Mon Sep 17 00:00:00 2001 +From: Alexander Mikhalitsyn +Date: Fri, 24 Dec 2021 22:56:56 +0300 +Subject: [PATCH 10/10] zdtm fixup: fix rseq test when linking with fresh glibc + +Signed-off-by: Alexander Mikhalitsyn +--- + test/zdtm/static/rseq.c | 58 ++++++++++++++++++++++++++++++++++++----- + 1 file changed, 51 insertions(+), 7 deletions(-) + +diff --git a/test/zdtm/static/rseq.c b/test/zdtm/static/rseq.c +index f2fccb8f4..a679ebd7a 100644 +--- a/test/zdtm/static/rseq.c ++++ b/test/zdtm/static/rseq.c +@@ -19,6 +19,32 @@ + + #include "zdtmtst.h" + ++#if defined(__x86_64__) && (__GLIBC__ >= 2 && __GLIBC_MINOR__ >= 34) ++#include ++#endif ++ ++#if defined(__x86_64__) && defined(RSEQ_SIG) ++static inline void * ++thread_pointer (void) ++{ ++ void *result; ++ asm ("mov %%fs:0, %0" : "=r" (result)); ++ return result; ++} ++ ++static inline void ++unregister_rseq_asdf (void) ++{ ++ /* unregister rseq */ ++ syscall(__NR_rseq, (void *)((char *) thread_pointer () + __rseq_offset), __rseq_size, 1, RSEQ_SIG); ++} ++#else ++static inline void ++unregister_rseq_asdf (void) ++{ ++} ++#endif ++ + #if defined(__x86_64__) + + const char *test_doc = "Check that rseq() basic C/R works"; +@@ -26,6 +52,8 @@ const char *test_author = "Alexander Mikhalitsyn cpu_id), ++ [rseq_cs] "m" (rseq_ptr->rseq_cs), + /* final store input */ + [v] "m" (*v), + [count] "er" (count) +@@ -135,6 +172,13 @@ int main(int argc, char *argv[]) + intptr_t *cpu_data; + long nr_cpus = sysconf(_SC_NPROCESSORS_ONLN); + ++#if RSEQ_TLS_ALLOC ++ rseq_ptr = &__rseq_abi; ++#else ++ //rseq_ptr = malloc(sizeof(struct rseq)); ++ rseq_ptr = mmap(NULL, PAGE_SIZE, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_SHARED, 0, 0); ++#endif ++ + test_init(argc, argv); + + cpu_data = calloc(nr_cpus, sizeof(*cpu_data)); +@@ -151,7 +195,7 @@ int main(int argc, char *argv[]) + #ifdef TESTRSEQ + check_thread(); + +- cpu = RSEQ_ACCESS_ONCE(__rseq_abi.cpu_id_start); ++ cpu = RSEQ_ACCESS_ONCE(rseq_ptr->cpu_id_start); + ret = rseq_addv(&cpu_data[cpu], 2, cpu); + if (ret) + fail("Failed to increment per-cpu counter"); +-- +2.34.1 + diff --git a/criu.spec b/criu.spec index 59c07c2..77a9598 100644 --- a/criu.spec +++ b/criu.spec @@ -18,10 +18,136 @@ License: GPLv2 URL: http://criu.org/ Source0: https://github.com/checkpoint-restore/criu/archive/v%{version}/criu-%{version}.tar.gz +Patch4: 0004-criu-8-add-external-net-option.patch +Patch5: 0005-criu-Introduce-new-device-file-plugin-hooks.patch +Patch6: 0006-criu-plugin-Implement-dummy-amdgpu-plugin-hooks.patch +Patch7: 0007-criu-files-Don-t-cache-fd-ids-for-device-files.patch +Patch8: 0008-tcp-Skip-restoring-TCP-state-when-dumping-with-tcp-c.patch +Patch9: 0009-zdtm-Dumping-restoring-with-tcp-close-on-TCP_CLOSE-s.patch +Patch10: 0010-criu-8-Add-more-detailed-description-about-tcp-close.patch +Patch11: 0011-Add-support-for-python3-in-criu-coredump.patch +Patch12: 0012-Add-new-files-for-running-criu-coredump-via-python-2.patch +Patch13: 0013-coredump-remove-unused-import.patch +Patch14: 0014-coredump-sort-imports.patch +Patch15: 0015-coredump-convert-indentation-to-spaces.patch +Patch16: 0016-python-replace-equality-with-identity-test.patch +Patch17: 0017-coredump-drop-unused-variable.patch +Patch18: 0018-coredump-drop-exec-permission.patch +Patch19: 0019-coredump-lint-fix-for-block-comments.patch +Patch20: 0020-coredump-fix-missing-whitespace-around-operator.patch +Patch21: 0021-coredump-fix-too-many-blank-lines.patch +Patch22: 0022-coredump-fix-comparison-to-true.patch +Patch23: 0023-coredump-lint-fix-visually-indented-line.patch +Patch24: 0024-test-coredump-fix-shellcheck-errors.patch +Patch25: 0025-make-enable-lint-for-coredump.patch +Patch26: 0026-ci-enable-coredump-tests.patch +Patch27: 0027-pie-restorer-remove-excess-hash-printf-specifier.patch +Patch28: 0028-tty-fix-the-null-pointer-of-get_tty_driver.patch +Patch29: 0029-util-use-nftw-in-rmrf-helper.patch +Patch30: 0030-criu-ns-make-pidns-init-first-do-setsid.patch +Patch31: 0031-net-optimize-restore_rule-to-not-open-the-CR_FD_RULE.patch +Patch32: 0032-ci-replace-deprecated-codecov-bash-uploader.patch +Patch33: 0033-ci-fix-userfaultfd-test-failures.patch +Patch34: 0034-ci-use-Fedora-34-for-lint-CI-runs.patch +Patch35: 0035-tests-improve-the-image-streamer-process-control.patch +Patch36: 0036-sockets-don-t-call-sk_setbufs-asyncronously.patch +Patch37: 0037-kerndat-check-for-set-getsockopt-SO_BUF_LOCK-availab.patch +Patch38: 0038-sockets-c-r-bufer-size-locks.patch +Patch39: 0039-zdtm-add-test-for-socket-buffer-size-locks.patch +Patch40: 0040-zdtm-make-sock_opts02-also-check-lock-change-by-SO_-.patch +Patch41: 0041-clang-format-enable-AlignTrailingComments.patch +Patch42: 0042-clang-format-do-several-manual-comment-fixups.patch +Patch43: 0043-clang-format-do-automatic-comment-fixups.patch +Patch44: 0044-cr-dump-fail-dumping-when-zombie-process-with-sid-0.patch +Patch45: 0045-clang-format-make-x86_ins_capability_mask-human-read.patch +Patch46: 0046-ci-disable-socket-raw-test-on-centos8.patch +Patch47: 0047-zdtm.py-make-tests-with-link_remap-exclusive.patch +Patch48: 0048-tests-improve-the-deterministic-behavior-of-the-test.patch +Patch49: 0049-clang-format-zdtm-fix-clang-complains-about-strange-.patch +Patch50: 0050-seize-restore-cgroup-freezer-to-right-state.patch +Patch51: 0051-ci-Use-latest-Fedora-for-lint-ci-runs-again.patch +Patch52: 0052-crtools-ignore-SIGPIPE-in-swrk-mode.patch +Patch53: 0053-ci-switch-to-centos-stream-8.patch +Patch54: 0054-check-cleanup-child-processes.patch +Patch55: 0055-files-reg-fix-error-handling-in-open_path.patch +Patch56: 0056-files-reg-fix-error-handling-of-rm_parent_dirs.patch +Patch57: 0057-ghost-mount-allocate-remounted_rw-in-shmem-to-get-in.patch +Patch58: 0058-files-reg-temporary-remount-writable-the-mount-we-do.patch +Patch59: 0059-zdtm-add-ro-mount-check-after-c-r-to-mntns_ghost01.patch +Patch60: 0060-clang-format-disable-wrong-struct-pointer-declaratio.patch +Patch61: 0061-ci-Run-cross-compile-on-debian-stable.patch +Patch62: 0062-ci-Run-cross-compile-with-debian-testing.patch +Patch63: 0063-make-Explicitly-enable-FPU-on-ARMv7-builds.patch +Patch64: 0064-ci-disable-broken-tests-until-fixed.patch +Patch65: 0065-test-do-not-use-keep-going-for-single-zdtm-tests.patch +Patch66: 0066-files-reg-try-dump_ghost_remap-if-link-remap-failed-.patch +Patch67: 0067-util-make-page-server-IPv6-safe.patch +Patch68: 0068-sk-unix-Fix-TCP_ESTABLISHED-checks-in-unix-sockets.patch +Patch69: 0069-ci-Enable-disabled-unix-socket-related-tests.patch +Patch70: 0070-ci-install-procps-in-Alpine.patch +Patch71: 0071-test-another-try-to-correctly-fix-the-kernel-version.patch +Patch72: 0072-x86-compel-fault-inject-bound-xsave-features-set.patch +Patch73: 0073-x86-compel-fault-inject-print-the-initial-seed.patch +Patch74: 0074-ci-enable-x86-xsave-fault-injection-tests-back.patch +Patch75: 0075-Add-documentation-for-timeout-option.patch +Patch76: 0076-usernsd-UNS_FDOUT-should-not-require-an-input-descri.patch +Patch77: 0077-libcriu-add-setting-lsm-mount-context-to-libcriu.patch +Patch78: 0078-ci-use-unstable-release-for-cross-compile.patch +Patch79: 0079-ci-disable-glibc-rseq-support.patch +Patch80: 0080-libcriu-add-single-pre-dump-support.patch +Patch81: 0081-tests-added-test-for-single-pre-dump-support.patch +Patch82: 0082-zdtm.py-clean-up-MAKEFLAGS-env-variable-before-runni.patch +Patch83: 0083-zdtm-zdtm_ct-fix-compilation-error-with-strict-proto.patch +Patch84: 0084-zdtm-remove-mntns-deleted-dst-test-leftover-from-git.patch +Patch85: 0085-crtools-remove-excess-always-true-condition.patch +Patch86: 0086-crtools-rpc-export-current-criu-mode-to-opts.mode.patch +Patch87: 0087-crtools-use-new-opts.mode-in-image_dir_mode.patch +Patch88: 0088-crtools-check-that-cpuinfo-command-has-sub-command.patch +Patch89: 0089-sk-unix-Add-support-for-SOCK_SEQPACKET-unix-sockets.patch +Patch90: 0090-zdtm-Add-SOCK_SEQPACKET-variants-to-unix-socket-test.patch +Patch91: 0091-tls-fix-typo.patch +Patch92: 0092-tls-use-ssize_t-for-return-value.patch +Patch93: 0093-tls-add-more-comments.patch +Patch94: 0094-uffd-call-disconnect_from_page_server-to-shutdown-a-.patch +Patch95: 0095-tls-allow-to-terminate-connections-synchronously.patch +Patch96: 0096-page-xfer-stop-waiting-for-a-new-command-after-a-clo.patch +Patch97: 0097-ci-reenable-the-lazy-thp-test-in-the-lazy-remote-mod.patch +Patch98: 0098-test-log-testname.out.inprogress-if-a-test-has-faile.patch +Patch99: 0100-zdtm-static-uffd-events-add-more-log-messages.patch +Patch100: 0101-mount-split-check_mountpoint_fd-from-__open_mountpoi.patch +Patch101: 0102-mount-remove-mnt_fd-argument-of-__open_mountpoint.patch +Patch102: 0103-proc_parse-add-helper-to-resolve-sdev-from-fd.patch +Patch103: 0104-mount-btrfs-make-check_mountpoint_fd-fallback-to-get.patch +Patch104: 0105-ci-test-criu-image-streamer-with-all-tests.patch +Patch105: 0106-readme-add-docker-test-badge.patch +Patch106: 0107-contributing-remove-old-badges-and-logo.patch +Patch107: 0108-ci-update-to-latest-Vagrant-and-Fedora-images.patch +Patch108: 0109-ci-added-.lgtm.yml-file.patch +Patch109: 0110-lib-introduce-feature-check-in-libcriu.patch +Patch110: 0111-lib-added-tests-for-feature-check-in-libcriu.patch +Patch111: 0112-pagemap-tiny-fix-on-truncating-memory-image.patch +Patch112: 0113-zdtm-fix-zdtm-static-maps00-case-in-arm64.patch +Patch113: 0114-compel-fix-GCC-12-failure-out-of-bounds.patch +Patch114: 0115-criu-fix-configuration-file-scanner-with-GCC-12.patch +Patch115: 0116-compel-fix-parasite-with-GCC-12.patch +Patch116: 0117-ci-set-continue-on-error-for-cross-compile.patch +Patch117: 0118-test-autofs-fix-use-after-free.patch +Patch118: 0119-Fix-formatting-in-criu-documentation.patch +Patch119: 0120-compel-add-rseq-syscall-into-compel-std-plugin-sysca.patch +Patch120: 0121-kerndat-check-for-rseq-syscall-support.patch +Patch121: 0122-util-move-fork_and_ptrace_attach-helper-from-cr-chec.patch +Patch122: 0123-cr-check-Add-ptrace-rseq-conf-dump-feature.patch +Patch123: 0124-rseq-initial-support.patch +Patch124: 0125-zdtm-add-simple-test-for-rseq-C-R.patch +Patch125: 0126-Revert-ci-disable-glibc-rseq-support.patch +Patch126: 0127-ci-add-Fedora-Rawhide-based-test-on-Cirrus.patch +Patch127: 0128-fixup-attempt-to-disable-rseq-at-the-thread-start.patch +Patch128: 0129-zdtm-fixup-fix-rseq-test-when-linking-with-fresh-gli.patch + # Add protobuf-c as a dependency. # We use this patch because the protobuf-c package name # in RPM and DEB is different. -Patch99: criu.pc.patch +Patch199: criu.pc.patch %if 0%{?rhel} && 0%{?rhel} <= 7 BuildRequires: perl @@ -34,7 +160,7 @@ Source4: criu-ns.1 # The patch aio-fix.patch is needed as RHEL7 # doesn't do "nr_events *= 2" in ioctx_alloc(). -Patch100: aio-fix.patch +Patch200: aio-fix.patch %endif Source5: criu-tmpfiles.conf @@ -117,10 +243,136 @@ This script can help to workaround the so called "PID mismatch" problem. %prep %setup -q +%patch4 -p1 +%patch5 -p1 +%patch6 -p1 +%patch7 -p1 +%patch8 -p1 +%patch9 -p1 +%patch10 -p1 +%patch11 -p1 +%patch12 -p1 +%patch13 -p1 +%patch14 -p1 +%patch15 -p1 +%patch16 -p1 +%patch17 -p1 +%patch18 -p1 +%patch19 -p1 +%patch20 -p1 +%patch21 -p1 +%patch22 -p1 +%patch23 -p1 +%patch24 -p1 +%patch25 -p1 +%patch26 -p1 +%patch27 -p1 +%patch28 -p1 +%patch29 -p1 +%patch30 -p1 +%patch31 -p1 +%patch32 -p1 +%patch33 -p1 +%patch34 -p1 +%patch35 -p1 +%patch36 -p1 +%patch37 -p1 +%patch38 -p1 +%patch39 -p1 +%patch40 -p1 +%patch41 -p1 +%patch42 -p1 +%patch43 -p1 +%patch44 -p1 +%patch45 -p1 +%patch46 -p1 +%patch47 -p1 +%patch48 -p1 +%patch49 -p1 +%patch50 -p1 +%patch51 -p1 +%patch52 -p1 +%patch53 -p1 +%patch54 -p1 +%patch55 -p1 +%patch56 -p1 +%patch57 -p1 +%patch58 -p1 +%patch59 -p1 +%patch60 -p1 +%patch61 -p1 +%patch62 -p1 +%patch63 -p1 +%patch64 -p1 +%patch65 -p1 +%patch66 -p1 +%patch67 -p1 +%patch68 -p1 +%patch69 -p1 +%patch70 -p1 +%patch71 -p1 +%patch72 -p1 +%patch73 -p1 +%patch74 -p1 +%patch75 -p1 +%patch76 -p1 +%patch77 -p1 +%patch78 -p1 +%patch79 -p1 +%patch80 -p1 +%patch81 -p1 +%patch82 -p1 +%patch83 -p1 +%patch84 -p1 +%patch85 -p1 +%patch86 -p1 +%patch87 -p1 +%patch88 -p1 +%patch89 -p1 +%patch90 -p1 +%patch91 -p1 +%patch92 -p1 +%patch93 -p1 +%patch94 -p1 +%patch95 -p1 +%patch96 -p1 +%patch97 -p1 +%patch98 -p1 %patch99 -p1 +%patch100 -p1 +%patch101 -p1 +%patch102 -p1 +%patch103 -p1 +%patch104 -p1 +%patch105 -p1 +%patch106 -p1 +%patch107 -p1 +%patch108 -p1 +%patch109 -p1 +%patch110 -p1 +%patch111 -p1 +%patch112 -p1 +%patch113 -p1 +%patch114 -p1 +%patch115 -p1 +%patch116 -p1 +%patch117 -p1 +%patch118 -p1 +%patch119 -p1 +%patch120 -p1 +%patch121 -p1 +%patch122 -p1 +%patch123 -p1 +%patch124 -p1 +%patch125 -p1 +%patch126 -p1 +%patch127 -p1 +%patch128 -p1 + +%patch199 -p1 %if 0%{?rhel} && 0%{?rhel} <= 7 -%patch100 -p1 +%patch200 -p1 %endif %build From 9d9b0fbcbe44299f774111f5f1fffaee8fef4c9d Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Mon, 31 Jan 2022 15:48:23 +0000 Subject: [PATCH 035/109] Add 3.16.1-6 changelog entry Signed-off-by: Radostin Stoyanov --- criu.spec | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/criu.spec b/criu.spec index 77a9598..4bc774b 100644 --- a/criu.spec +++ b/criu.spec @@ -12,7 +12,7 @@ Name: criu Version: 3.16.1 -Release: 5%{?dist} +Release: 6%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPLv2 URL: http://criu.org/ @@ -456,6 +456,11 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %doc %{_mandir}/man1/criu-ns.1* %changelog +* Mon Jan 31 2022 Radostin Stoyanov - 3.16.1-6 +- Fix typo in changelog +- Replace `asciidoc` and `xmlto` with `asciidoctor` +- Enable initial rseq support + * Thu Jan 20 2022 Fedora Release Engineering - 3.16.1-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild From ee1da30e2bc6508a421db6c0b9ae7fd3c3af0e47 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Wed, 2 Feb 2022 11:24:45 +0000 Subject: [PATCH 036/109] Disable automatic call to %set_build_flags The flags set by this macro break the build on Fedora 36. https://fedoraproject.org/wiki/Changes/SetBuildFlagsBuildCheck Signed-off-by: Radostin Stoyanov --- criu.spec | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/criu.spec b/criu.spec index 4bc774b..b053156 100644 --- a/criu.spec +++ b/criu.spec @@ -10,6 +10,11 @@ # parasite code breaks if annobin is enabled. %undefine _annotated_build +# Disable automatic call to the set_build_flags macro +# at the beginning of the build, check, and install. +# This change was introduced in Fedora 36. +%undefine _auto_set_build_flags + Name: criu Version: 3.16.1 Release: 6%{?dist} From 917a1a92d342646bbc54444c8c7eb9626a821fa3 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Wed, 2 Feb 2022 11:37:03 +0000 Subject: [PATCH 037/109] Fix build with GCC 12 Signed-off-by: Radostin Stoyanov --- criu.spec | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/criu.spec b/criu.spec index b053156..275939b 100644 --- a/criu.spec +++ b/criu.spec @@ -385,6 +385,11 @@ This script can help to workaround the so called "PID mismatch" problem. # that is fixed, disable LTO. %define _lto_cflags %{nil} +# With GCC 12 the build fails with: +# Unexpected undefined symbol: `strlen'. External symbol in PIE? +# '-ffreestanding' makes the compilation work with GCC 12. +CFLAGS+=" -ffreestanding " + # %{?_smp_mflags} does not work # -fstack-protector breaks build CFLAGS+=`echo %{optflags} | sed -e 's,-fstack-protector\S*,,g'` make V=1 WERROR=0 PREFIX=%{_prefix} RUNDIR=/run/criu PYTHON=%{py_binary} From 5e0dd85eb2c682a38970800248a4e66f41aa2b35 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Tue, 8 Feb 2022 11:46:06 +0000 Subject: [PATCH 038/109] Drop global -ffreestanding Signed-off-by: Radostin Stoyanov --- criu.spec | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/criu.spec b/criu.spec index 275939b..d7baacf 100644 --- a/criu.spec +++ b/criu.spec @@ -17,7 +17,7 @@ Name: criu Version: 3.16.1 -Release: 6%{?dist} +Release: 7%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPLv2 URL: http://criu.org/ @@ -385,11 +385,6 @@ This script can help to workaround the so called "PID mismatch" problem. # that is fixed, disable LTO. %define _lto_cflags %{nil} -# With GCC 12 the build fails with: -# Unexpected undefined symbol: `strlen'. External symbol in PIE? -# '-ffreestanding' makes the compilation work with GCC 12. -CFLAGS+=" -ffreestanding " - # %{?_smp_mflags} does not work # -fstack-protector breaks build CFLAGS+=`echo %{optflags} | sed -e 's,-fstack-protector\S*,,g'` make V=1 WERROR=0 PREFIX=%{_prefix} RUNDIR=/run/criu PYTHON=%{py_binary} @@ -466,6 +461,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %doc %{_mandir}/man1/criu-ns.1* %changelog +* Tue Feb 8 2022 Radostin Stoyanov - 3.16.1-7 +- Drop global -ffreestanding + * Mon Jan 31 2022 Radostin Stoyanov - 3.16.1-6 - Fix typo in changelog - Replace `asciidoc` and `xmlto` with `asciidoctor` From 7ab0ac9f4957adbe47c0216bf24ed55d1324e6f6 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Fri, 18 Feb 2022 19:14:42 +0000 Subject: [PATCH 039/109] rebuilt --- criu.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/criu.spec b/criu.spec index d7baacf..b857792 100644 --- a/criu.spec +++ b/criu.spec @@ -17,7 +17,7 @@ Name: criu Version: 3.16.1 -Release: 7%{?dist} +Release: 8%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPLv2 URL: http://criu.org/ @@ -461,6 +461,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %doc %{_mandir}/man1/criu-ns.1* %changelog +* Fri Feb 18 2022 Radostin Stoyanov - 3.16.1-8 +- rebuilt + * Tue Feb 8 2022 Radostin Stoyanov - 3.16.1-7 - Drop global -ffreestanding From 99fccb258026fa1e70083730b6eeb62bf9d0942d Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Tue, 5 Apr 2022 10:59:32 +0100 Subject: [PATCH 040/109] Update rseq support patches Signed-off-by: Radostin Stoyanov --- ... 0001-criu-8-add-external-net-option.patch | 6 +- ...-Don-t-cache-fd-ids-for-device-files.patch | 6 +- ...ng-TCP-state-when-dumping-with-tcp-c.patch | 6 +- ...toring-with-tcp-close-on-TCP_CLOSE-s.patch | 6 +- ...detailed-description-about-tcp-close.patch | 6 +- ...troduce-new-device-file-plugin-hooks.patch | 269 --- ...support-for-python3-in-criu-coredump.patch | 6 +- ...-Implement-dummy-amdgpu-plugin-hooks.patch | 160 -- ...r-running-criu-coredump-via-python-2.patch | 6 +- ...> 0008-coredump-remove-unused-import.patch | 6 +- ....patch => 0009-coredump-sort-imports.patch | 6 +- ...redump-convert-indentation-to-spaces.patch | 6 +- ...-replace-equality-with-identity-test.patch | 6 +- ...> 0012-coredump-drop-unused-variable.patch | 6 +- ...> 0013-coredump-drop-exec-permission.patch | 6 +- ...coredump-lint-fix-for-block-comments.patch | 6 +- ...x-missing-whitespace-around-operator.patch | 6 +- ...16-coredump-fix-too-many-blank-lines.patch | 6 +- ...0017-coredump-fix-comparison-to-true.patch | 6 +- ...dump-lint-fix-visually-indented-line.patch | 6 +- ...-test-coredump-fix-shellcheck-errors.patch | 6 +- ...> 0020-make-enable-lint-for-coredump.patch | 10 +- ...tch => 0021-ci-enable-coredump-tests.patch | 6 +- ...-remove-excess-hash-printf-specifier.patch | 6 +- ...x-the-null-pointer-of-get_tty_driver.patch | 6 +- ...=> 0024-util-use-nftw-in-rmrf-helper.patch | 6 +- ...u-ns-make-pidns-init-first-do-setsid.patch | 6 +- ...tore_rule-to-not-open-the-CR_FD_RULE.patch | 6 +- ...ace-deprecated-codecov-bash-uploader.patch | 10 +- ...028-ci-fix-userfaultfd-test-failures.patch | 6 +- ...29-ci-use-Fedora-34-for-lint-CI-runs.patch | 6 +- ...e-the-image-streamer-process-control.patch | 6 +- ...-don-t-call-sk_setbufs-asyncronously.patch | 6 +- ...r-set-getsockopt-SO_BUF_LOCK-availab.patch | 6 +- ...=> 0033-sockets-c-r-bufer-size-locks.patch | 6 +- ...dd-test-for-socket-buffer-size-locks.patch | 6 +- ...pts02-also-check-lock-change-by-SO_-.patch | 6 +- ...-format-enable-AlignTrailingComments.patch | 6 +- ...mat-do-several-manual-comment-fixups.patch | 6 +- ...g-format-do-automatic-comment-fixups.patch | 8 +- ...mping-when-zombie-process-with-sid-0.patch | 6 +- ...e-x86_ins_capability_mask-human-read.patch | 6 +- ...i-disable-socket-raw-test-on-centos8.patch | 6 +- ...make-tests-with-link_remap-exclusive.patch | 6 +- ...e-deterministic-behavior-of-the-test.patch | 6 +- ...m-fix-clang-complains-about-strange-.patch | 6 +- ...estore-cgroup-freezer-to-right-state.patch | 6 +- ...latest-Fedora-for-lint-ci-runs-again.patch | 6 +- ...-crtools-ignore-SIGPIPE-in-swrk-mode.patch | 6 +- ...=> 0048-ci-switch-to-centos-stream-8.patch | 6 +- ...> 0049-check-cleanup-child-processes.patch | 6 +- ...-reg-fix-error-handling-in-open_path.patch | 8 +- ...fix-error-handling-of-rm_parent_dirs.patch | 8 +- ...cate-remounted_rw-in-shmem-to-get-in.patch | 10 +- ...ary-remount-writable-the-mount-we-do.patch | 8 +- ...unt-check-after-c-r-to-mntns_ghost01.patch | 6 +- ...able-wrong-struct-pointer-declaratio.patch | 6 +- ...i-Run-cross-compile-on-debian-stable.patch | 6 +- ...un-cross-compile-with-debian-testing.patch | 6 +- ...xplicitly-enable-FPU-on-ARMv7-builds.patch | 8 +- ...-ci-disable-broken-tests-until-fixed.patch | 6 +- ...use-keep-going-for-single-zdtm-tests.patch | 6 +- ...mp_ghost_remap-if-link-remap-failed-.patch | 8 +- ...0062-util-make-page-server-IPv6-safe.patch | 6 +- ...P_ESTABLISHED-checks-in-unix-sockets.patch | 6 +- ...e-disabled-unix-socket-related-tests.patch | 6 +- ... => 0065-ci-install-procps-in-Alpine.patch | 6 +- ...-to-correctly-fix-the-kernel-version.patch | 6 +- ...ault-inject-bound-xsave-features-set.patch | 6 +- ...-fault-inject-print-the-initial-seed.patch | 6 +- ...x86-xsave-fault-injection-tests-back.patch | 6 +- ...Add-documentation-for-timeout-option.patch | 6 +- ...T-should-not-require-an-input-descri.patch | 6 +- ...setting-lsm-mount-context-to-libcriu.patch | 6 +- ...e-unstable-release-for-cross-compile.patch | 6 +- ...> 0074-ci-disable-glibc-rseq-support.patch | 6 +- ...-libcriu-add-single-pre-dump-support.patch | 6 +- ...ded-test-for-single-pre-dump-support.patch | 6 +- ...-MAKEFLAGS-env-variable-before-runni.patch | 6 +- ...-compilation-error-with-strict-proto.patch | 6 +- ...s-deleted-dst-test-leftover-from-git.patch | 6 +- ...-remove-excess-always-true-condition.patch | 6 +- ...xport-current-criu-mode-to-opts.mode.patch | 6 +- ...-use-new-opts.mode-in-image_dir_mode.patch | 6 +- ...that-cpuinfo-command-has-sub-command.patch | 6 +- ...port-for-SOCK_SEQPACKET-unix-sockets.patch | 6 +- ...QPACKET-variants-to-unix-socket-test.patch | 6 +- ...-fix-typo.patch => 0086-tls-fix-typo.patch | 6 +- ...087-tls-use-ssize_t-for-return-value.patch | 6 +- ....patch => 0088-tls-add-more-comments.patch | 6 +- ...nect_from_page_server-to-shutdown-a-.patch | 6 +- ...-terminate-connections-synchronously.patch | 6 +- ...aiting-for-a-new-command-after-a-clo.patch | 6 +- ...lazy-thp-test-in-the-lazy-remote-mod.patch | 6 +- ...e.out.inprogress-if-a-test-has-faile.patch | 6 +- ...ils-of-all-logs-if-a-test-has-failed.patch | 38 + ...ic-uffd-events-add-more-log-messages.patch | 6 +- ...k_mountpoint_fd-from-__open_mountpoi.patch | 6 +- ...mnt_fd-argument-of-__open_mountpoint.patch | 6 +- ...e-add-helper-to-resolve-sdev-from-fd.patch | 10 +- ...-check_mountpoint_fd-fallback-to-get.patch | 6 +- ...t-criu-image-streamer-with-all-tests.patch | 6 +- ...=> 0101-readme-add-docker-test-badge.patch | 6 +- ...tributing-remove-old-badges-and-logo.patch | 6 +- ...-to-latest-Vagrant-and-Fedora-images.patch | 6 +- ...atch => 0104-ci-added-.lgtm.yml-file.patch | 6 +- ...b-introduce-feature-check-in-libcriu.patch | 6 +- ...d-tests-for-feature-check-in-libcriu.patch | 6 +- ...-tiny-fix-on-truncating-memory-image.patch | 6 +- ...fix-zdtm-static-maps00-case-in-arm64.patch | 6 +- ...pel-fix-GCC-12-failure-out-of-bounds.patch | 6 +- ...nfiguration-file-scanner-with-GCC-12.patch | 6 +- ...0111-compel-fix-parasite-with-GCC-12.patch | 6 +- ...-continue-on-error-for-cross-compile.patch | 6 +- ... 0113-test-autofs-fix-use-after-free.patch | 6 +- ...Fix-formatting-in-criu-documentation.patch | 6 +- 0115-ci-install-libbsd-dependency.patch | 78 + ...ting-sid-for-shell-job-also-update-m.patch | 33 + ...riu-ns-fix-exit-code-o-for-criu-dump.patch | 29 + ...riu-ns-use-os.waitstatus_to_exitcode.patch | 33 + ...-Fix-sys_mmap-s-returned-value-check.patch | 30 + ...TRACE_GET_THREAD_AREA-errors-are-han.patch | 52 + ...an-unique-ID-of-the-current-criu-run.patch | 72 + ...nerate-unique-transport-socket-names.patch | 30 + ...a-check-for-using-memfd-with-hugetlb.patch | 107 ++ ...rndat-Collect-hugetlb-device-numbers.patch | 414 +++++ ...for-checkpoint-restore-hugetlb-Syste.patch | 116 ++ 0125-zdtm-add-simple-test-for-rseq-C-R.patch | 233 --- ...Revert-ci-disable-glibc-rseq-support.patch | 49 - ...support-for-checkpoint-restore-memfd.patch | 151 ++ ...-Fedora-Rawhide-based-test-on-Cirrus.patch | 124 -- ...-Add-support-for-hugetlb-memory-mapp.patch | 127 ++ ...-to-disable-rseq-at-the-thread-start.patch | 96 -- ...-mem-Skip-premapping-hugetlb-mapping.patch | 40 + ...azy-mode-restore-on-hugetlb-mappings.patch | 32 + ...seq-test-when-linking-with-fresh-gli.patch | 145 -- ...-Add-MAP_HUGETLB-memory-mapping-test.patch | 228 +++ 0131-zdtm-Add-memfd-hugetlb-test.patch | 166 ++ 0132-zdtm-Add-shm-hugetlb-test.patch | 121 ++ ...ETLB-mappings-test-for-parent-child-.patch | 171 ++ ...kip-MAP_HUGETLB-tests-in-stream-test.patch | 40 + 0135-bpfmap-handle-new-field-in-fdinfo.patch | 124 ++ ...test-remove-test-for-LOCK_MAND-flock.patch | 49 + ...-test-disable-rseq-also-on-Archlinux.patch | 29 + 0138-zdtm-fix-missplacement-of-err-True.patch | 32 + ...mxcsr-during-error-injection-to-zero.patch | 45 + ...smaps-remove-useless-nonlinear-check.patch | 39 + ...ount-fix-e_str-leak-in-ext_mount_add.patch | 52 + ...-fix-cr_imgset-leak-in-dump_one_task.patch | 124 ++ ...n-fix-tun_link-leak-in-dump_tun_link.patch | 66 + ...32_t-id-variable-printf-format-speci.patch | 35 + 0145-zdtm-refactor-main.patch | 459 +++++ 0146-zdtm-sort-import-lines.patch | 70 + 0147-zdtm-use-long-form-cli-options.patch | 77 + 0148-zdtm-add-criu-config-option.patch | 127 ++ ...-redundant-config_inotify_irmap-test.patch | 174 ++ 0150-ci-run-criu-config-tests.patch | 51 + ...-config-fix-ns-leak-in-parse_join_ns.patch | 53 + ...-net-fix-e_str-leak-in-veth_pair_add.patch | 51 + ...files-fix-inh-leak-in-inherit_fd_add.patch | 55 + ...nix-fix-e_str-leak-in-unix_sk_id_add.patch | 51 + ...ffd-fix-__u64-print-format-specifier.patch | 39 + ..._master-test-to-correspond-to-it-s-n.patch | 54 + ...o_add_list_before-helper-for-adding-.patch | 98 ++ ...ect-non-fsroot-mounts-as-device-exte.patch | 44 + ...-mounts-of-external-devices-external.patch | 178 ++ ...e-and-source-checks-for-external-mou.patch | 77 + ...bind-list-before-using-it-in-mnt_is_.patch | 164 ++ 0162-util-add-get_relative_path-helper.patch | 142 ++ ...e-tests-for-get_relative_path-helper.patch | 138 ++ ...nd_pick-helper-to-pick-the-desired-b.patch | 62 + ...is_external-_bind-and-can_receive_ma.patch | 160 ++ ...pping-external-mounts-in-dump_one_mo.patch | 45 + ...w-more-info-about-why-we-can-t-mount.patch | 108 ++ ...rnal-mount-before-mounting-it-s-bind.patch | 103 ++ 0169-zdtm-add-new-mnt_ext_root-test.patch | 162 ++ ...p-external-mount-map-to-init-contain.patch | 66 + 0171-zdtm-add-mnt_ext_collision-test.patch | 273 +++ 0172-mount-add-mnt_is_root_bind-helper.patch | 119 ++ ...ed-mount-namespaces-with-different-r.patch | 50 + 0174-zdtm-add-mntns_pivot_root-test.patch | 198 +++ ...-superblock-flags-to-nested-ns-roots.patch | 35 + 0176-zdtm-add-mntns_pivot_root_ro-test.patch | 113 ++ ...eate-auxiliary-binfmt_misc-mount-in-.patch | 176 ++ ...ave-ns_mountpoint-NULL-for-aux-binfm.patch | 33 + ...ace-CRTIME_MNT_ID-with-HELPER_MNT_ID.patch | 77 + ...-can_receive_master_from_root-helper.patch | 62 + ...al-slavery-mounts-to-separate-mnt_ex.patch | 77 + ...erride-master_id-to-1-for-root-binds.patch | 100 ++ ...d-helper-mnt_get_external_bind_nodev.patch | 58 + ...-is_overmounted-as-early-as-possible.patch | 123 ++ ...yard-tree-merge-as-early-as-possible.patch | 121 ++ ...-mount-fix-broken-remounted_rw-check.patch | 36 + ...al-place-for-shared-variables-on-mou.patch | 101 ++ ...mountpoint-in-autofs_create_dentries.patch | 55 + ...-ns_mountpoint-in-mnt_is_overmounted.patch | 43 + ...yard-children-from-mnt_needs_remap-c.patch | 51 + ...ntpoint-in-validate_children_collisi.patch | 36 + ..._mountpoint-in-root_path_from_parent.patch | 55 + ...ntpoint-for-children-overmount-check.patch | 35 + ...t_get_sibling_path-via-get_relative_.patch | 155 ++ ...use-ns_mountpoint-in-collect_mntinfo.patch | 53 + ...ount-use-ns_mountpoint-in-aufs_parse.patch | 31 + ...mount-use-ns_mountpoint-in-mnt_depth.patch | 33 + ...ntpoint-instead-of-mountpoint-where-.patch | 567 +++++++ ...ice_mountpoint-getter-for-mountpoint.patch | 535 ++++++ ...create_ghost_dentry-out-of-create_gh.patch | 120 ++ ...h-create_ghost-to-work-with-mount-v2.patch | 129 ++ ...clean_one_remap-to-work-with-mount-v.patch | 101 ++ ...or-MOVE_MOUNT_SET_GROUP-availability.patch | 285 ++++ 0204-compel-add-open_tree-syscall.patch | 129 ++ ...ether-the-openat2-syscall-is-support.patch | 270 +++ 0206-util-add-resolve_mountpoint-helper.patch | 159 ++ ...ck_options-after-kerndat_init-and-lo.patch | 41 + ...ew-option-mntns-compat-mode-for-old-.patch | 230 +++ 0209-mount-add-plain-mountpoints.patch | 131 ++ ...ort-parent-dirs-helpers-for-mount-v2.patch | 48 + ...ount-remove-double-ns_id-declaration.patch | 27 + ...t-export-common-defines-for-mount-v2.patch | 74 + ...xport-several-functions-for-mount-v2.patch | 150 ++ ...export-global-variables-for-mount-v2.patch | 50 + 0215-mount-add-new-mounts-v2-engine.patch | 1495 +++++++++++++++++ ...ts-compat-mode-on-restore-with-mntns.patch | 71 + 0217-ci-run-tests-for-old-mount-engine.patch | 35 + ...ew-mnt_ext_sharing-test-for-mount-v2.patch | 328 ++++ ...-zdtm-add-mount_complex_sharing-test.patch | 293 ++++ ...tion-group-with-mount-flags-to-mount.patch | 112 ++ ...tm-mount-v2-disable-mnt_tracefs-test.patch | 36 + ...nt_ext_dev-also-run-for-old-mount-en.patch | 45 + ...st-jenkins-test-for-old-mount-engine.patch | 38 + ...tm-mount-v2-disable-pty-console-test.patch | 63 + ...unt-engine-fallback-messages-logleve.patch | 51 + ...-messages-differ-in-different-places.patch | 37 + 0227-zdtm-use-unique-holder-for-cgroups.patch | 96 ++ 0228-scripts-ci-mount-test-cgroups-once.patch | 35 + ...add-a-helper-to-hold-a-pid-namespace.patch | 62 + ...parmor-Fix-Wfortify-source-for-Clang.patch | 34 + 0231-style-delete-some-redundant-code.patch | 49 + ...unused-but-set-variable-for-Clang-15.patch | 28 + 0233-criu-generate-unique-socket-names.patch | 146 ++ 0234-ci-Ubuntu-broke-overlayfs-again.patch | 48 + ...syscall-into-compel-std-plugin-sysca.patch | 44 +- ...rndat-check-for-rseq-syscall-support.patch | 24 +- ...nd_ptrace_attach-helper-from-cr-chec.patch | 15 +- ...ck-Add-ptrace-rseq-conf-dump-feature.patch | 58 +- ...t.patch => 0239-rseq-initial-support.patch | 120 +- ...lude-add-thread_pointer.h-from-Glibc.patch | 245 +++ ...egister-rseq-at-the-thread-start-for.patch | 143 ++ ...lpers-to-get-set-instruction-pointer.patch | 265 +++ ...-fixup-thread-IP-when-inside-rseq-cs.patch | 262 +++ 0244-cr-dump-handle-rseq-flags-field.patch | 383 +++++ 0245-fixup.patch | 35 + criu.spec | 501 ++++-- 253 files changed, 16126 insertions(+), 1709 deletions(-) rename 0004-criu-8-add-external-net-option.patch => 0001-criu-8-add-external-net-option.patch (90%) rename 0007-criu-files-Don-t-cache-fd-ids-for-device-files.patch => 0002-criu-files-Don-t-cache-fd-ids-for-device-files.patch (89%) rename 0008-tcp-Skip-restoring-TCP-state-when-dumping-with-tcp-c.patch => 0003-tcp-Skip-restoring-TCP-state-when-dumping-with-tcp-c.patch (91%) rename 0009-zdtm-Dumping-restoring-with-tcp-close-on-TCP_CLOSE-s.patch => 0004-zdtm-Dumping-restoring-with-tcp-close-on-TCP_CLOSE-s.patch (95%) rename 0010-criu-8-Add-more-detailed-description-about-tcp-close.patch => 0005-criu-8-Add-more-detailed-description-about-tcp-close.patch (88%) delete mode 100644 0005-criu-Introduce-new-device-file-plugin-hooks.patch rename 0011-Add-support-for-python3-in-criu-coredump.patch => 0006-Add-support-for-python3-in-criu-coredump.patch (98%) delete mode 100644 0006-criu-plugin-Implement-dummy-amdgpu-plugin-hooks.patch rename 0012-Add-new-files-for-running-criu-coredump-via-python-2.patch => 0007-Add-new-files-for-running-criu-coredump-via-python-2.patch (94%) rename 0013-coredump-remove-unused-import.patch => 0008-coredump-remove-unused-import.patch (87%) rename 0014-coredump-sort-imports.patch => 0009-coredump-sort-imports.patch (84%) rename 0015-coredump-convert-indentation-to-spaces.patch => 0010-coredump-convert-indentation-to-spaces.patch (95%) rename 0016-python-replace-equality-with-identity-test.patch => 0011-python-replace-equality-with-identity-test.patch (96%) rename 0017-coredump-drop-unused-variable.patch => 0012-coredump-drop-unused-variable.patch (85%) rename 0018-coredump-drop-exec-permission.patch => 0013-coredump-drop-exec-permission.patch (78%) rename 0019-coredump-lint-fix-for-block-comments.patch => 0014-coredump-lint-fix-for-block-comments.patch (99%) rename 0020-coredump-fix-missing-whitespace-around-operator.patch => 0015-coredump-fix-missing-whitespace-around-operator.patch (85%) rename 0021-coredump-fix-too-many-blank-lines.patch => 0016-coredump-fix-too-many-blank-lines.patch (84%) rename 0022-coredump-fix-comparison-to-true.patch => 0017-coredump-fix-comparison-to-true.patch (87%) rename 0023-coredump-lint-fix-visually-indented-line.patch => 0018-coredump-lint-fix-visually-indented-line.patch (93%) rename 0024-test-coredump-fix-shellcheck-errors.patch => 0019-test-coredump-fix-shellcheck-errors.patch (90%) rename 0025-make-enable-lint-for-coredump.patch => 0020-make-enable-lint-for-coredump.patch (82%) rename 0026-ci-enable-coredump-tests.patch => 0021-ci-enable-coredump-tests.patch (90%) rename 0027-pie-restorer-remove-excess-hash-printf-specifier.patch => 0022-pie-restorer-remove-excess-hash-printf-specifier.patch (90%) rename 0028-tty-fix-the-null-pointer-of-get_tty_driver.patch => 0023-tty-fix-the-null-pointer-of-get_tty_driver.patch (87%) rename 0029-util-use-nftw-in-rmrf-helper.patch => 0024-util-use-nftw-in-rmrf-helper.patch (96%) rename 0030-criu-ns-make-pidns-init-first-do-setsid.patch => 0025-criu-ns-make-pidns-init-first-do-setsid.patch (87%) rename 0031-net-optimize-restore_rule-to-not-open-the-CR_FD_RULE.patch => 0026-net-optimize-restore_rule-to-not-open-the-CR_FD_RULE.patch (95%) rename 0032-ci-replace-deprecated-codecov-bash-uploader.patch => 0027-ci-replace-deprecated-codecov-bash-uploader.patch (86%) rename 0033-ci-fix-userfaultfd-test-failures.patch => 0028-ci-fix-userfaultfd-test-failures.patch (89%) rename 0034-ci-use-Fedora-34-for-lint-CI-runs.patch => 0029-ci-use-Fedora-34-for-lint-CI-runs.patch (86%) rename 0035-tests-improve-the-image-streamer-process-control.patch => 0030-tests-improve-the-image-streamer-process-control.patch (97%) rename 0036-sockets-don-t-call-sk_setbufs-asyncronously.patch => 0031-sockets-don-t-call-sk_setbufs-asyncronously.patch (89%) rename 0037-kerndat-check-for-set-getsockopt-SO_BUF_LOCK-availab.patch => 0032-kerndat-check-for-set-getsockopt-SO_BUF_LOCK-availab.patch (96%) rename 0038-sockets-c-r-bufer-size-locks.patch => 0033-sockets-c-r-bufer-size-locks.patch (95%) rename 0039-zdtm-add-test-for-socket-buffer-size-locks.patch => 0034-zdtm-add-test-for-socket-buffer-size-locks.patch (95%) rename 0040-zdtm-make-sock_opts02-also-check-lock-change-by-SO_-.patch => 0035-zdtm-make-sock_opts02-also-check-lock-change-by-SO_-.patch (95%) rename 0041-clang-format-enable-AlignTrailingComments.patch => 0036-clang-format-enable-AlignTrailingComments.patch (98%) rename 0042-clang-format-do-several-manual-comment-fixups.patch => 0037-clang-format-do-several-manual-comment-fixups.patch (97%) rename 0043-clang-format-do-automatic-comment-fixups.patch => 0038-clang-format-do-automatic-comment-fixups.patch (99%) rename 0044-cr-dump-fail-dumping-when-zombie-process-with-sid-0.patch => 0039-cr-dump-fail-dumping-when-zombie-process-with-sid-0.patch (86%) rename 0045-clang-format-make-x86_ins_capability_mask-human-read.patch => 0040-clang-format-make-x86_ins_capability_mask-human-read.patch (98%) rename 0046-ci-disable-socket-raw-test-on-centos8.patch => 0041-ci-disable-socket-raw-test-on-centos8.patch (91%) rename 0047-zdtm.py-make-tests-with-link_remap-exclusive.patch => 0042-zdtm.py-make-tests-with-link_remap-exclusive.patch (93%) rename 0048-tests-improve-the-deterministic-behavior-of-the-test.patch => 0043-tests-improve-the-deterministic-behavior-of-the-test.patch (96%) rename 0049-clang-format-zdtm-fix-clang-complains-about-strange-.patch => 0044-clang-format-zdtm-fix-clang-complains-about-strange-.patch (95%) rename 0050-seize-restore-cgroup-freezer-to-right-state.patch => 0045-seize-restore-cgroup-freezer-to-right-state.patch (93%) rename 0051-ci-Use-latest-Fedora-for-lint-ci-runs-again.patch => 0046-ci-Use-latest-Fedora-for-lint-ci-runs-again.patch (87%) rename 0052-crtools-ignore-SIGPIPE-in-swrk-mode.patch => 0047-crtools-ignore-SIGPIPE-in-swrk-mode.patch (94%) rename 0053-ci-switch-to-centos-stream-8.patch => 0048-ci-switch-to-centos-stream-8.patch (83%) rename 0054-check-cleanup-child-processes.patch => 0049-check-cleanup-child-processes.patch (92%) rename 0055-files-reg-fix-error-handling-in-open_path.patch => 0050-files-reg-fix-error-handling-in-open_path.patch (96%) rename 0056-files-reg-fix-error-handling-of-rm_parent_dirs.patch => 0051-files-reg-fix-error-handling-of-rm_parent_dirs.patch (94%) rename 0057-ghost-mount-allocate-remounted_rw-in-shmem-to-get-in.patch => 0052-ghost-mount-allocate-remounted_rw-in-shmem-to-get-in.patch (95%) rename 0058-files-reg-temporary-remount-writable-the-mount-we-do.patch => 0053-files-reg-temporary-remount-writable-the-mount-we-do.patch (87%) rename 0059-zdtm-add-ro-mount-check-after-c-r-to-mntns_ghost01.patch => 0054-zdtm-add-ro-mount-check-after-c-r-to-mntns_ghost01.patch (90%) rename 0060-clang-format-disable-wrong-struct-pointer-declaratio.patch => 0055-clang-format-disable-wrong-struct-pointer-declaratio.patch (95%) rename 0061-ci-Run-cross-compile-on-debian-stable.patch => 0056-ci-Run-cross-compile-on-debian-stable.patch (98%) rename 0062-ci-Run-cross-compile-with-debian-testing.patch => 0057-ci-Run-cross-compile-with-debian-testing.patch (98%) rename 0063-make-Explicitly-enable-FPU-on-ARMv7-builds.patch => 0058-make-Explicitly-enable-FPU-on-ARMv7-builds.patch (89%) rename 0064-ci-disable-broken-tests-until-fixed.patch => 0059-ci-disable-broken-tests-until-fixed.patch (95%) rename 0065-test-do-not-use-keep-going-for-single-zdtm-tests.patch => 0060-test-do-not-use-keep-going-for-single-zdtm-tests.patch (97%) rename 0066-files-reg-try-dump_ghost_remap-if-link-remap-failed-.patch => 0061-files-reg-try-dump_ghost_remap-if-link-remap-failed-.patch (96%) rename 0067-util-make-page-server-IPv6-safe.patch => 0062-util-make-page-server-IPv6-safe.patch (92%) rename 0068-sk-unix-Fix-TCP_ESTABLISHED-checks-in-unix-sockets.patch => 0063-sk-unix-Fix-TCP_ESTABLISHED-checks-in-unix-sockets.patch (92%) rename 0069-ci-Enable-disabled-unix-socket-related-tests.patch => 0064-ci-Enable-disabled-unix-socket-related-tests.patch (91%) rename 0070-ci-install-procps-in-Alpine.patch => 0065-ci-install-procps-in-Alpine.patch (84%) rename 0071-test-another-try-to-correctly-fix-the-kernel-version.patch => 0066-test-another-try-to-correctly-fix-the-kernel-version.patch (88%) rename 0072-x86-compel-fault-inject-bound-xsave-features-set.patch => 0067-x86-compel-fault-inject-bound-xsave-features-set.patch (95%) rename 0073-x86-compel-fault-inject-print-the-initial-seed.patch => 0068-x86-compel-fault-inject-print-the-initial-seed.patch (91%) rename 0074-ci-enable-x86-xsave-fault-injection-tests-back.patch => 0069-ci-enable-x86-xsave-fault-injection-tests-back.patch (89%) rename 0075-Add-documentation-for-timeout-option.patch => 0070-Add-documentation-for-timeout-option.patch (93%) rename 0076-usernsd-UNS_FDOUT-should-not-require-an-input-descri.patch => 0071-usernsd-UNS_FDOUT-should-not-require-an-input-descri.patch (86%) rename 0077-libcriu-add-setting-lsm-mount-context-to-libcriu.patch => 0072-libcriu-add-setting-lsm-mount-context-to-libcriu.patch (94%) rename 0078-ci-use-unstable-release-for-cross-compile.patch => 0073-ci-use-unstable-release-for-cross-compile.patch (98%) rename 0079-ci-disable-glibc-rseq-support.patch => 0074-ci-disable-glibc-rseq-support.patch (93%) rename 0080-libcriu-add-single-pre-dump-support.patch => 0075-libcriu-add-single-pre-dump-support.patch (97%) rename 0081-tests-added-test-for-single-pre-dump-support.patch => 0076-tests-added-test-for-single-pre-dump-support.patch (97%) rename 0082-zdtm.py-clean-up-MAKEFLAGS-env-variable-before-runni.patch => 0077-zdtm.py-clean-up-MAKEFLAGS-env-variable-before-runni.patch (93%) rename 0083-zdtm-zdtm_ct-fix-compilation-error-with-strict-proto.patch => 0078-zdtm-zdtm_ct-fix-compilation-error-with-strict-proto.patch (86%) rename 0084-zdtm-remove-mntns-deleted-dst-test-leftover-from-git.patch => 0079-zdtm-remove-mntns-deleted-dst-test-leftover-from-git.patch (82%) rename 0085-crtools-remove-excess-always-true-condition.patch => 0080-crtools-remove-excess-always-true-condition.patch (85%) rename 0086-crtools-rpc-export-current-criu-mode-to-opts.mode.patch => 0081-crtools-rpc-export-current-criu-mode-to-opts.mode.patch (98%) rename 0087-crtools-use-new-opts.mode-in-image_dir_mode.patch => 0082-crtools-use-new-opts.mode-in-image_dir_mode.patch (89%) rename 0088-crtools-check-that-cpuinfo-command-has-sub-command.patch => 0083-crtools-check-that-cpuinfo-command-has-sub-command.patch (85%) rename 0089-sk-unix-Add-support-for-SOCK_SEQPACKET-unix-sockets.patch => 0084-sk-unix-Add-support-for-SOCK_SEQPACKET-unix-sockets.patch (93%) rename 0090-zdtm-Add-SOCK_SEQPACKET-variants-to-unix-socket-test.patch => 0085-zdtm-Add-SOCK_SEQPACKET-variants-to-unix-socket-test.patch (99%) rename 0091-tls-fix-typo.patch => 0086-tls-fix-typo.patch (84%) rename 0092-tls-use-ssize_t-for-return-value.patch => 0087-tls-use-ssize_t-for-return-value.patch (93%) rename 0093-tls-add-more-comments.patch => 0088-tls-add-more-comments.patch (96%) rename 0094-uffd-call-disconnect_from_page_server-to-shutdown-a-.patch => 0089-uffd-call-disconnect_from_page_server-to-shutdown-a-.patch (83%) rename 0095-tls-allow-to-terminate-connections-synchronously.patch => 0090-tls-allow-to-terminate-connections-synchronously.patch (95%) rename 0096-page-xfer-stop-waiting-for-a-new-command-after-a-clo.patch => 0091-page-xfer-stop-waiting-for-a-new-command-after-a-clo.patch (92%) rename 0097-ci-reenable-the-lazy-thp-test-in-the-lazy-remote-mod.patch => 0092-ci-reenable-the-lazy-thp-test-in-the-lazy-remote-mod.patch (88%) rename 0098-test-log-testname.out.inprogress-if-a-test-has-faile.patch => 0093-test-log-testname.out.inprogress-if-a-test-has-faile.patch (89%) create mode 100644 0094-zdtm-print-tails-of-all-logs-if-a-test-has-failed.patch rename 0100-zdtm-static-uffd-events-add-more-log-messages.patch => 0095-zdtm-static-uffd-events-add-more-log-messages.patch (89%) rename 0101-mount-split-check_mountpoint_fd-from-__open_mountpoi.patch => 0096-mount-split-check_mountpoint_fd-from-__open_mountpoi.patch (95%) rename 0102-mount-remove-mnt_fd-argument-of-__open_mountpoint.patch => 0097-mount-remove-mnt_fd-argument-of-__open_mountpoint.patch (96%) rename 0103-proc_parse-add-helper-to-resolve-sdev-from-fd.patch => 0098-proc_parse-add-helper-to-resolve-sdev-from-fd.patch (92%) rename 0104-mount-btrfs-make-check_mountpoint_fd-fallback-to-get.patch => 0099-mount-btrfs-make-check_mountpoint_fd-fallback-to-get.patch (96%) rename 0105-ci-test-criu-image-streamer-with-all-tests.patch => 0100-ci-test-criu-image-streamer-with-all-tests.patch (87%) rename 0106-readme-add-docker-test-badge.patch => 0101-readme-add-docker-test-badge.patch (88%) rename 0107-contributing-remove-old-badges-and-logo.patch => 0102-contributing-remove-old-badges-and-logo.patch (89%) rename 0108-ci-update-to-latest-Vagrant-and-Fedora-images.patch => 0103-ci-update-to-latest-Vagrant-and-Fedora-images.patch (86%) rename 0109-ci-added-.lgtm.yml-file.patch => 0104-ci-added-.lgtm.yml-file.patch (92%) rename 0110-lib-introduce-feature-check-in-libcriu.patch => 0105-lib-introduce-feature-check-in-libcriu.patch (96%) rename 0111-lib-added-tests-for-feature-check-in-libcriu.patch => 0106-lib-added-tests-for-feature-check-in-libcriu.patch (96%) rename 0112-pagemap-tiny-fix-on-truncating-memory-image.patch => 0107-pagemap-tiny-fix-on-truncating-memory-image.patch (93%) rename 0113-zdtm-fix-zdtm-static-maps00-case-in-arm64.patch => 0108-zdtm-fix-zdtm-static-maps00-case-in-arm64.patch (91%) rename 0114-compel-fix-GCC-12-failure-out-of-bounds.patch => 0109-compel-fix-GCC-12-failure-out-of-bounds.patch (94%) rename 0115-criu-fix-configuration-file-scanner-with-GCC-12.patch => 0110-criu-fix-configuration-file-scanner-with-GCC-12.patch (89%) rename 0116-compel-fix-parasite-with-GCC-12.patch => 0111-compel-fix-parasite-with-GCC-12.patch (90%) rename 0117-ci-set-continue-on-error-for-cross-compile.patch => 0112-ci-set-continue-on-error-for-cross-compile.patch (91%) rename 0118-test-autofs-fix-use-after-free.patch => 0113-test-autofs-fix-use-after-free.patch (94%) rename 0119-Fix-formatting-in-criu-documentation.patch => 0114-Fix-formatting-in-criu-documentation.patch (91%) create mode 100644 0115-ci-install-libbsd-dependency.patch create mode 100644 0116-pstree-when-updating-sid-for-shell-job-also-update-m.patch create mode 100644 0117-criu-ns-fix-exit-code-o-for-criu-dump.patch create mode 100644 0118-criu-ns-use-os.waitstatus_to_exitcode.patch create mode 100644 0119-restorer-Fix-sys_mmap-s-returned-value-check.patch create mode 100644 0120-compel-fix-how-PTRACE_GET_THREAD_AREA-errors-are-han.patch create mode 100644 0121-util-add-an-unique-ID-of-the-current-criu-run.patch create mode 100644 0122-files-generate-unique-transport-socket-names.patch create mode 100644 0123-check-Add-a-check-for-using-memfd-with-hugetlb.patch create mode 100644 0124-kerndat-Collect-hugetlb-device-numbers.patch create mode 100644 0125-ipc-Add-support-for-checkpoint-restore-hugetlb-Syste.patch delete mode 100644 0125-zdtm-add-simple-test-for-rseq-C-R.patch delete mode 100644 0126-Revert-ci-disable-glibc-rseq-support.patch create mode 100644 0126-memfd-shmem-Add-support-for-checkpoint-restore-memfd.patch delete mode 100644 0127-ci-add-Fedora-Rawhide-based-test-on-Cirrus.patch create mode 100644 0127-proc_parse-files-Add-support-for-hugetlb-memory-mapp.patch delete mode 100644 0128-fixup-attempt-to-disable-rseq-at-the-thread-start.patch create mode 100644 0128-mem-Skip-premapping-hugetlb-mapping.patch create mode 100644 0129-uffd-Skip-lazy-mode-restore-on-hugetlb-mappings.patch delete mode 100644 0129-zdtm-fixup-fix-rseq-test-when-linking-with-fresh-gli.patch create mode 100644 0130-zdtm-Add-MAP_HUGETLB-memory-mapping-test.patch create mode 100644 0131-zdtm-Add-memfd-hugetlb-test.patch create mode 100644 0132-zdtm-Add-shm-hugetlb-test.patch create mode 100644 0133-zdtm-Add-MAP_HUGETLB-mappings-test-for-parent-child-.patch create mode 100644 0134-ci-skip-MAP_HUGETLB-tests-in-stream-test.patch create mode 100644 0135-bpfmap-handle-new-field-in-fdinfo.patch create mode 100644 0136-test-remove-test-for-LOCK_MAND-flock.patch create mode 100644 0137-test-disable-rseq-also-on-Archlinux.patch create mode 100644 0138-zdtm-fix-missplacement-of-err-True.patch create mode 100644 0139-compel-set-mxcsr-during-error-injection-to-zero.patch create mode 100644 0140-proc_smaps-remove-useless-nonlinear-check.patch create mode 100644 0141-mount-fix-e_str-leak-in-ext_mount_add.patch create mode 100644 0142-cr-dump-fix-cr_imgset-leak-in-dump_one_task.patch create mode 100644 0143-tun-fix-tun_link-leak-in-dump_tun_link.patch create mode 100644 0144-sk-unix-fix-uint32_t-id-variable-printf-format-speci.patch create mode 100644 0145-zdtm-refactor-main.patch create mode 100644 0146-zdtm-sort-import-lines.patch create mode 100644 0147-zdtm-use-long-form-cli-options.patch create mode 100644 0148-zdtm-add-criu-config-option.patch create mode 100644 0149-zdtm-drop-redundant-config_inotify_irmap-test.patch create mode 100644 0150-ci-run-criu-config-tests.patch create mode 100644 0151-config-fix-ns-leak-in-parse_join_ns.patch create mode 100644 0152-net-fix-e_str-leak-in-veth_pair_add.patch create mode 100644 0153-files-fix-inh-leak-in-inherit_fd_add.patch create mode 100644 0154-sk-unix-fix-e_str-leak-in-unix_sk_id_add.patch create mode 100644 0155-uffd-fix-__u64-print-format-specifier.patch create mode 100644 0156-zdtm-fix-mnt_ext_master-test-to-correspond-to-it-s-n.patch create mode 100644 0157-mount-add-mntinfo_add_list_before-helper-for-adding-.patch create mode 100644 0158-mount-do-not-detect-non-fsroot-mounts-as-device-exte.patch create mode 100644 0159-mount-mark-mounts-of-external-devices-external.patch create mode 100644 0160-mount-skip-fstype-and-source-checks-for-external-mou.patch create mode 100644 0161-mount-setup-mnt_bind-list-before-using-it-in-mnt_is_.patch create mode 100644 0162-util-add-get_relative_path-helper.patch create mode 100644 0163-unittest-add-some-tests-for-get_relative_path-helper.patch create mode 100644 0164-mount-add-mnt_bind_pick-helper-to-pick-the-desired-b.patch create mode 100644 0165-mount-split-mnt_is_external-_bind-and-can_receive_ma.patch create mode 100644 0166-mount-rework-skipping-external-mounts-in-dump_one_mo.patch create mode 100644 0167-mount-show-more-info-about-why-we-can-t-mount.patch create mode 100644 0168-mount-mount-external-mount-before-mounting-it-s-bind.patch create mode 100644 0169-zdtm-add-new-mnt_ext_root-test.patch create mode 100644 0170-mount-restrict-mp-external-mount-map-to-init-contain.patch create mode 100644 0171-zdtm-add-mnt_ext_collision-test.patch create mode 100644 0172-mount-add-mnt_is_root_bind-helper.patch create mode 100644 0173-mount-allow-nested-mount-namespaces-with-different-r.patch create mode 100644 0174-zdtm-add-mntns_pivot_root-test.patch create mode 100644 0175-mount-apply-superblock-flags-to-nested-ns-roots.patch create mode 100644 0176-zdtm-add-mntns_pivot_root_ro-test.patch create mode 100644 0177-mount-restore-create-auxiliary-binfmt_misc-mount-in-.patch create mode 100644 0178-mount-restore-leave-ns_mountpoint-NULL-for-aux-binfm.patch create mode 100644 0179-mount-replace-CRTIME_MNT_ID-with-HELPER_MNT_ID.patch create mode 100644 0180-mount-add-can_receive_master_from_root-helper.patch create mode 100644 0181-mount-put-external-slavery-mounts-to-separate-mnt_ex.patch create mode 100644 0182-mount-do-not-override-master_id-to-1-for-root-binds.patch create mode 100644 0183-mount-add-helper-mnt_get_external_bind_nodev.patch create mode 100644 0184-mount-prepare-is_overmounted-as-early-as-possible.patch create mode 100644 0185-mount-move-root-yard-tree-merge-as-early-as-possible.patch create mode 100644 0186-mount-fix-broken-remounted_rw-check.patch create mode 100644 0187-mount-make-general-place-for-shared-variables-on-mou.patch create mode 100644 0188-autofs-use-ns_mountpoint-in-autofs_create_dentries.patch create mode 100644 0189-mount-use-ns_mountpoint-in-mnt_is_overmounted.patch create mode 100644 0190-mount-skip-root-yard-children-from-mnt_needs_remap-c.patch create mode 100644 0191-mount-use-ns_mountpoint-in-validate_children_collisi.patch create mode 100644 0192-mount-use-ns_mountpoint-in-root_path_from_parent.patch create mode 100644 0193-mount-use-ns_mountpoint-for-children-overmount-check.patch create mode 100644 0194-path-simplify-mnt_get_sibling_path-via-get_relative_.patch create mode 100644 0195-mount-use-ns_mountpoint-in-collect_mntinfo.patch create mode 100644 0196-mount-use-ns_mountpoint-in-aufs_parse.patch create mode 100644 0197-mount-use-ns_mountpoint-in-mnt_depth.patch create mode 100644 0198-mount-use-ns_mountpoint-instead-of-mountpoint-where-.patch create mode 100644 0199-mount-add-service_mountpoint-getter-for-mountpoint.patch create mode 100644 0200-files-reg-split-create_ghost_dentry-out-of-create_gh.patch create mode 100644 0201-files-reg-teach-create_ghost-to-work-with-mount-v2.patch create mode 100644 0202-files-reg-teach-clean_one_remap-to-work-with-mount-v.patch create mode 100644 0203-kerndat-Check-for-MOVE_MOUNT_SET_GROUP-availability.patch create mode 100644 0204-compel-add-open_tree-syscall.patch create mode 100644 0205-kerndat-check-whether-the-openat2-syscall-is-support.patch create mode 100644 0206-util-add-resolve_mountpoint-helper.patch create mode 100644 0207-crtools-move-check_options-after-kerndat_init-and-lo.patch create mode 100644 0208-config-rpc-add-new-option-mntns-compat-mode-for-old-.patch create mode 100644 0209-mount-add-plain-mountpoints.patch create mode 100644 0210-files-reg-export-parent-dirs-helpers-for-mount-v2.patch create mode 100644 0211-mount-remove-double-ns_id-declaration.patch create mode 100644 0212-mount-export-common-defines-for-mount-v2.patch create mode 100644 0213-mount-export-several-functions-for-mount-v2.patch create mode 100644 0214-mount-export-global-variables-for-mount-v2.patch create mode 100644 0215-mount-add-new-mounts-v2-engine.patch create mode 100644 0216-zdtm-enable-mounts-compat-mode-on-restore-with-mntns.patch create mode 100644 0217-ci-run-tests-for-old-mount-engine.patch create mode 100644 0218-zdtm-add-new-mnt_ext_sharing-test-for-mount-v2.patch create mode 100644 0219-zdtm-add-mount_complex_sharing-test.patch create mode 100644 0220-zdtm-add-propagation-group-with-mount-flags-to-mount.patch create mode 100644 0221-zdtm-mount-v2-disable-mnt_tracefs-test.patch create mode 100644 0222-ci-make-others-mnt_ext_dev-also-run-for-old-mount-en.patch create mode 100644 0223-test-jenkins-test-for-old-mount-engine.patch create mode 100644 0224-zdtm-mount-v2-disable-pty-console-test.patch create mode 100644 0225-mount-v2-make-mount-engine-fallback-messages-logleve.patch create mode 100644 0226-mount-make-error-messages-differ-in-different-places.patch create mode 100644 0227-zdtm-use-unique-holder-for-cgroups.patch create mode 100644 0228-scripts-ci-mount-test-cgroups-once.patch create mode 100644 0229-criu-ns-add-a-helper-to-hold-a-pid-namespace.patch create mode 100644 0230-apparmor-Fix-Wfortify-source-for-Clang.patch create mode 100644 0231-style-delete-some-redundant-code.patch create mode 100644 0232-mount-fix-Wunused-but-set-variable-for-Clang-15.patch create mode 100644 0233-criu-generate-unique-socket-names.patch create mode 100644 0234-ci-Ubuntu-broke-overlayfs-again.patch rename 0120-compel-add-rseq-syscall-into-compel-std-plugin-sysca.patch => 0235-compel-add-rseq-syscall-into-compel-std-plugin-sysca.patch (70%) rename 0121-kerndat-check-for-rseq-syscall-support.patch => 0236-kerndat-check-for-rseq-syscall-support.patch (68%) rename 0122-util-move-fork_and_ptrace_attach-helper-from-cr-chec.patch => 0237-util-move-fork_and_ptrace_attach-helper-from-cr-chec.patch (92%) rename 0123-cr-check-Add-ptrace-rseq-conf-dump-feature.patch => 0238-cr-check-Add-ptrace-rseq-conf-dump-feature.patch (76%) rename 0124-rseq-initial-support.patch => 0239-rseq-initial-support.patch (86%) create mode 100644 0240-include-add-thread_pointer.h-from-Glibc.patch create mode 100644 0241-clone-noasan-unregister-rseq-at-the-thread-start-for.patch create mode 100644 0242-compel-add-helpers-to-get-set-instruction-pointer.patch create mode 100644 0243-cr-dump-fixup-thread-IP-when-inside-rseq-cs.patch create mode 100644 0244-cr-dump-handle-rseq-flags-field.patch create mode 100644 0245-fixup.patch diff --git a/0004-criu-8-add-external-net-option.patch b/0001-criu-8-add-external-net-option.patch similarity index 90% rename from 0004-criu-8-add-external-net-option.patch rename to 0001-criu-8-add-external-net-option.patch index 3d2dd1d..06c8ed8 100644 --- a/0004-criu-8-add-external-net-option.patch +++ b/0001-criu-8-add-external-net-option.patch @@ -1,7 +1,7 @@ -From 93d977ccacdc6dc01c0ef8c6a27a5c8896ceaaf9 Mon Sep 17 00:00:00 2001 +From 8017afbbd530d11b54e8e54ac1bc6a47f9c20ba7 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Mon, 20 Sep 2021 13:50:08 +0100 -Subject: [PATCH 004/120] criu(8): add --external net option +Subject: [PATCH 001/245] criu(8): add --external net option Support for external net namespaces has been introduced with commit c2b21fbf (criu: add support for external net namespaces). @@ -29,5 +29,5 @@ index 690f61e14..3c4c1eaf8 100644 Mark a PID namespace as external. This can be later used to restore a process into an existing PID namespace. The label 'name' can be -- -2.34.1 +2.35.1 diff --git a/0007-criu-files-Don-t-cache-fd-ids-for-device-files.patch b/0002-criu-files-Don-t-cache-fd-ids-for-device-files.patch similarity index 89% rename from 0007-criu-files-Don-t-cache-fd-ids-for-device-files.patch rename to 0002-criu-files-Don-t-cache-fd-ids-for-device-files.patch index 5d169ed..8ff9ebe 100644 --- a/0007-criu-files-Don-t-cache-fd-ids-for-device-files.patch +++ b/0002-criu-files-Don-t-cache-fd-ids-for-device-files.patch @@ -1,7 +1,7 @@ -From 951f8bc4db77ed71a7929c8a0a6c754a5dbb8919 Mon Sep 17 00:00:00 2001 +From 9036f17569638f038edfb6c30454e2fbe3707d69 Mon Sep 17 00:00:00 2001 From: Rajneesh Bhardwaj Date: Tue, 27 Apr 2021 19:08:57 -0400 -Subject: [PATCH 007/120] criu/files: Don't cache fd ids for device files +Subject: [PATCH 002/245] criu/files: Don't cache fd ids for device files Restore operation fails when we perform CR operation of multiple independent proceses that have device files because criu caches @@ -37,5 +37,5 @@ index 1b9d68888..772bd92cf 100644 } -- -2.34.1 +2.35.1 diff --git a/0008-tcp-Skip-restoring-TCP-state-when-dumping-with-tcp-c.patch b/0003-tcp-Skip-restoring-TCP-state-when-dumping-with-tcp-c.patch similarity index 91% rename from 0008-tcp-Skip-restoring-TCP-state-when-dumping-with-tcp-c.patch rename to 0003-tcp-Skip-restoring-TCP-state-when-dumping-with-tcp-c.patch index e2788fd..e2f4fd1 100644 --- a/0008-tcp-Skip-restoring-TCP-state-when-dumping-with-tcp-c.patch +++ b/0003-tcp-Skip-restoring-TCP-state-when-dumping-with-tcp-c.patch @@ -1,7 +1,7 @@ -From de3a7112b8e44993e077ffe03e4e4aa38bd20325 Mon Sep 17 00:00:00 2001 +From da9608458d9130e906387f9da8432998e5a503cd Mon Sep 17 00:00:00 2001 From: Bui Quang Minh Date: Thu, 12 Aug 2021 11:05:09 +0000 -Subject: [PATCH 008/120] tcp: Skip restoring TCP state when dumping with +Subject: [PATCH 003/245] tcp: Skip restoring TCP state when dumping with --tcp-close Since commit e42f5e0 ("tcp: allow to specify --tcp-close on dump"), @@ -36,5 +36,5 @@ index 0afecd2d6..96d5d13bf 100644 pr_perror("Unable to shutdown the socket id %x ino %x", ii->ie->id, ii->ie->ino); } -- -2.34.1 +2.35.1 diff --git a/0009-zdtm-Dumping-restoring-with-tcp-close-on-TCP_CLOSE-s.patch b/0004-zdtm-Dumping-restoring-with-tcp-close-on-TCP_CLOSE-s.patch similarity index 95% rename from 0009-zdtm-Dumping-restoring-with-tcp-close-on-TCP_CLOSE-s.patch rename to 0004-zdtm-Dumping-restoring-with-tcp-close-on-TCP_CLOSE-s.patch index cf09bb4..524cfa3 100644 --- a/0009-zdtm-Dumping-restoring-with-tcp-close-on-TCP_CLOSE-s.patch +++ b/0004-zdtm-Dumping-restoring-with-tcp-close-on-TCP_CLOSE-s.patch @@ -1,7 +1,7 @@ -From 40fc4f667fb614fef765489843aa038b61c31d2e Mon Sep 17 00:00:00 2001 +From 67b6cb52a89947ee3c09f9617b0f303725bfbd8c Mon Sep 17 00:00:00 2001 From: Bui Quang Minh Date: Mon, 20 Sep 2021 20:57:03 +0700 -Subject: [PATCH 009/120] zdtm: Dumping/restoring with --tcp-close on TCP_CLOSE +Subject: [PATCH 004/245] zdtm: Dumping/restoring with --tcp-close on TCP_CLOSE socket Signed-off-by: Bui Quang Minh @@ -106,5 +106,5 @@ index 000000000..c53a1f315 @@ -0,0 +1 @@ +{'opts': '--tcp-close', 'flags': 'reqrst '} -- -2.34.1 +2.35.1 diff --git a/0010-criu-8-Add-more-detailed-description-about-tcp-close.patch b/0005-criu-8-Add-more-detailed-description-about-tcp-close.patch similarity index 88% rename from 0010-criu-8-Add-more-detailed-description-about-tcp-close.patch rename to 0005-criu-8-Add-more-detailed-description-about-tcp-close.patch index 562a1d4..d495563 100644 --- a/0010-criu-8-Add-more-detailed-description-about-tcp-close.patch +++ b/0005-criu-8-Add-more-detailed-description-about-tcp-close.patch @@ -1,7 +1,7 @@ -From 4eb1a3da7d65ae798db324153d693adef13ef6ed Mon Sep 17 00:00:00 2001 +From 910f52c00474036412561fb45fc89d2e04e860d0 Mon Sep 17 00:00:00 2001 From: Bui Quang Minh Date: Mon, 4 Oct 2021 20:38:34 +0700 -Subject: [PATCH 010/120] criu(8): Add more detailed description about +Subject: [PATCH 005/245] criu(8): Add more detailed description about --tcp-close dump option The expected behavior of --tcp-close option when dumpping is to close @@ -29,5 +29,5 @@ index 3c4c1eaf8..4c6885fc9 100644 *--skip-in-flight*:: -- -2.34.1 +2.35.1 diff --git a/0005-criu-Introduce-new-device-file-plugin-hooks.patch b/0005-criu-Introduce-new-device-file-plugin-hooks.patch deleted file mode 100644 index 32d8346..0000000 --- a/0005-criu-Introduce-new-device-file-plugin-hooks.patch +++ /dev/null @@ -1,269 +0,0 @@ -From 32055ece2d1eeb7e5ea7e8345c728e117ae4b737 Mon Sep 17 00:00:00 2001 -From: Rajneesh Bhardwaj -Date: Thu, 15 Apr 2021 12:04:45 -0400 -Subject: [PATCH 005/120] criu: Introduce new device file plugin hooks - -Currently CRIU cannot handle Checkpoint Restore operations when a device -file is involved in a process, however, CRIU allows flexible extensions -via special plugins but still, for certain complex devices such as a GPU, -the existing hooks are not sufficient. This introduces few new hooks -that will be used to support Checkpoint Restore operation with AMD GPU -devices and potentially to other similar devices too. - - - HANDLE_DEVICE_VMA - - UPDATE_VMA_MAP - - RESUME_DEVICES_LATE - - *HANDLE_DEVICE_VMA: - Hook to detect a suitable plugin to handle device file VMA with - PF | IO mappings. - - *UPDATE_VMA_MAP: - Hook to handle VMAs during a device file restore. - - When restoring VMAs for the device files, criu runs sys_mmap in - the pie restore context but the offsets and file path within a - device file may change during restore operation so it needs to be - adjusted properly. - - *RESUME_DEVICES_LATE: - Hook to do some special handling in late restore phase. - - During criu restore phase when a device is getting restored with - the help of a plugin, some device specific operations might need - to be delayed until criu finalizes the VMA placements in address - space of the target process. But by the time criu finalizes this, - its too late since pie phase is over and control is back to criu - master process. This hook allows an external trigger to each - resuming task to check whether it has a device specific operation - pending such as issuing an ioctl call? Since this is called from - criu master process context, supply the pid of the target process - and give a chance to each plugin registered to run device - specific operation if the target pid is valid. - -A future patch will add consumers for these plugin hooks to support AMD -GPUs. - -Signed-off-by: Rajneesh Bhardwaj ---- - criu/cr-restore.c | 23 +++++++++++++++++++ - criu/files-reg.c | 17 ++++++++++++++ - criu/include/criu-plugin.h | 16 +++++++++++++ - criu/plugin.c | 3 +++ - criu/proc_parse.c | 47 +++++++++++++++++++++++++++++++++----- - 5 files changed, 100 insertions(+), 6 deletions(-) - -diff --git a/criu/cr-restore.c b/criu/cr-restore.c -index 9d2d957f8..ed62cc5a2 100644 ---- a/criu/cr-restore.c -+++ b/criu/cr-restore.c -@@ -2388,6 +2388,29 @@ skip_ns_bouncing: - pr_err("Unable to flush breakpoints\n"); - - finalize_restore(); -+ /* -+ * Some external devices such as GPUs might need a very late -+ * trigger to kick-off some events, memory notifiers and for -+ * restarting the previously restored queues during criu restore -+ * stage. This is needed since criu pie code may shuffle VMAs -+ * around so things such as registering MMU notifiers (for GPU -+ * mapped memory) could be done sanely once the pie code hands -+ * over the control to master process. -+ */ -+ for_each_pstree_item(item) { -+ pr_info("Run late stage hook from criu master for external devices\n"); -+ ret = run_plugins(RESUME_DEVICES_LATE, item->pid->real); -+ /* -+ * This may not really be an error. Only certain plugin hooks -+ * (if available) will return success such as amdgpu_plugin that -+ * validates the pid of the resuming tasks in the kernel mode. -+ * Most of the times, it'll be -ENOTSUP and in few cases, it -+ * might actually be a true error code but that would be also -+ * captured in the plugin so no need to print the error here. -+ */ -+ if (ret < 0) -+ pr_debug("restore late stage hook for external plugin failed\n"); -+ } - - ret = run_scripts(ACT_PRE_RESUME); - if (ret) -diff --git a/criu/files-reg.c b/criu/files-reg.c -index ee54d1d7d..2b0347575 100644 ---- a/criu/files-reg.c -+++ b/criu/files-reg.c -@@ -2267,6 +2267,23 @@ static int open_filemap(int pid, struct vma_area *vma) - BUG_ON((vma->vmfd == NULL) || !vma->e->has_fdflags); - flags = vma->e->fdflags; - -+ /* update the new device file page offsets and file paths set during restore */ -+ if (vma->e->status & VMA_UNSUPP) { -+ uint64_t new_pgoff; -+ char new_path[PATH_MAX]; -+ int ret; -+ -+ struct reg_file_info *rfi = container_of(vma->vmfd, struct reg_file_info, d); -+ ret = run_plugins(UPDATE_VMA_MAP, rfi->rfe->name, new_path, vma->e->start, vma->e->pgoff, &new_pgoff); -+ if (ret == 1) { -+ pr_info("New mmap %#016" PRIx64 "->%#016" PRIx64 " path %s\n", vma->e->pgoff, new_pgoff, -+ new_path); -+ vma->e->pgoff = new_pgoff; -+ rfi->path = xstrdup(new_path); -+ pr_debug("Updated rfi->path %s\n", rfi->path); -+ } -+ } -+ - if (ctx.flags != flags || ctx.desc != vma->vmfd) { - if (vma->e->status & VMA_AREA_MEMFD) - ret = memfd_open(vma->vmfd, &flags); -diff --git a/criu/include/criu-plugin.h b/criu/include/criu-plugin.h -index 897666ecd..0bc7a4255 100644 ---- a/criu/include/criu-plugin.h -+++ b/criu/include/criu-plugin.h -@@ -22,6 +22,8 @@ - - #include - #include -+#include -+#include - - #define CRIU_PLUGIN_GEN_VERSION(a, b, c) (((a) << 16) + ((b) << 8) + (c)) - #define CRIU_PLUGIN_VERSION_MAJOR 0 -@@ -48,6 +50,12 @@ enum { - - CR_PLUGIN_HOOK__DUMP_EXT_LINK = 6, - -+ CR_PLUGIN_HOOK__HANDLE_DEVICE_VMA = 7, -+ -+ CR_PLUGIN_HOOK__UPDATE_VMA_MAP = 8, -+ -+ CR_PLUGIN_HOOK__RESUME_DEVICES_LATE = 9, -+ - CR_PLUGIN_HOOK__MAX - }; - -@@ -60,6 +68,10 @@ DECLARE_PLUGIN_HOOK_ARGS(CR_PLUGIN_HOOK__RESTORE_EXT_FILE, int id); - DECLARE_PLUGIN_HOOK_ARGS(CR_PLUGIN_HOOK__DUMP_EXT_MOUNT, char *mountpoint, int id); - DECLARE_PLUGIN_HOOK_ARGS(CR_PLUGIN_HOOK__RESTORE_EXT_MOUNT, int id, char *mountpoint, char *old_root, int *is_file); - DECLARE_PLUGIN_HOOK_ARGS(CR_PLUGIN_HOOK__DUMP_EXT_LINK, int index, int type, char *kind); -+DECLARE_PLUGIN_HOOK_ARGS(CR_PLUGIN_HOOK__HANDLE_DEVICE_VMA, int fd, const struct stat *stat); -+DECLARE_PLUGIN_HOOK_ARGS(CR_PLUGIN_HOOK__UPDATE_VMA_MAP, const char *old_path, char *new_path, const uint64_t addr, -+ const uint64_t old_pgoff, uint64_t *new_pgoff); -+DECLARE_PLUGIN_HOOK_ARGS(CR_PLUGIN_HOOK__RESUME_DEVICES_LATE, int pid); - - enum { - CR_PLUGIN_STAGE__DUMP, -@@ -130,5 +142,9 @@ typedef int(cr_plugin_restore_file_t)(int id); - typedef int(cr_plugin_dump_ext_mount_t)(char *mountpoint, int id); - typedef int(cr_plugin_restore_ext_mount_t)(int id, char *mountpoint, char *old_root, int *is_file); - typedef int(cr_plugin_dump_ext_link_t)(int index, int type, char *kind); -+typedef int(cr_plugin_handle_device_vma_t)(int fd, const struct stat *stat); -+typedef int(cr_plugin_update_vma_map_t)(const char *old_path, char *new_path, const uint64_t addr, -+ const uint64_t old_pgoff, uint64_t *new_pgoff); -+typedef int(cr_plugin_resume_devices_late_t)(int pid); - - #endif /* __CRIU_PLUGIN_H__ */ -diff --git a/criu/plugin.c b/criu/plugin.c -index 3fe03c7cd..f3fea2856 100644 ---- a/criu/plugin.c -+++ b/criu/plugin.c -@@ -54,6 +54,9 @@ static cr_plugin_desc_t *cr_gen_plugin_desc(void *h, char *path) - __assign_hook(DUMP_EXT_MOUNT, "cr_plugin_dump_ext_mount"); - __assign_hook(RESTORE_EXT_MOUNT, "cr_plugin_restore_ext_mount"); - __assign_hook(DUMP_EXT_LINK, "cr_plugin_dump_ext_link"); -+ __assign_hook(HANDLE_DEVICE_VMA, "cr_plugin_handle_device_vma"); -+ __assign_hook(UPDATE_VMA_MAP, "cr_plugin_update_vma_map"); -+ __assign_hook(RESUME_DEVICES_LATE, "cr_plugin_resume_devices_late"); - - #undef __assign_hook - -diff --git a/criu/proc_parse.c b/criu/proc_parse.c -index f3491e781..8a9ce3a37 100644 ---- a/criu/proc_parse.c -+++ b/criu/proc_parse.c -@@ -45,6 +45,7 @@ - #include "protobuf.h" - #include "images/fdinfo.pb-c.h" - #include "images/mnt.pb-c.h" -+#include "plugin.h" - - #include - -@@ -103,6 +104,19 @@ bool is_vma_range_fmt(char *line) - return __is_vma_range_fmt(line); - } - -+bool handle_vma_plugin(int *fd, struct stat *stat) -+{ -+ int ret; -+ -+ ret = run_plugins(HANDLE_DEVICE_VMA, *fd, stat); -+ if (ret < 0) { -+ pr_perror("handle_device_vma plugin failed"); -+ return false; -+ } -+ -+ return true; -+} -+ - static void __parse_vmflags(char *buf, u32 *flags, u64 *madv, int *io_pf) - { - char *tok; -@@ -188,6 +202,7 @@ struct vma_file_info { - int dev_min; - unsigned long ino; - struct vma_area *vma; -+ bool has_device_plugin; - }; - - static inline int vfi_equal(struct vma_file_info *a, struct vma_file_info *b) -@@ -577,11 +592,17 @@ static int handle_vma(pid_t pid, struct vma_area *vma_area, const char *file_pat - } else if (*vm_file_fd >= 0) { - struct stat *st_buf = vma_area->vmst; - -- if (S_ISREG(st_buf->st_mode)) -+ if (S_ISREG(st_buf->st_mode)) { - /* regular file mapping -- supported */; -- else if (S_ISCHR(st_buf->st_mode) && (st_buf->st_rdev == DEVZERO)) -+ pr_debug("Found regular file mapping, OK\n"); -+ } else if (S_ISCHR(st_buf->st_mode) && (st_buf->st_rdev == DEVZERO)) { - /* devzero mapping -- also makes sense */; -- else { -+ pr_debug("Found devzero mapping, OK\n"); -+ } else if (handle_vma_plugin(vm_file_fd, st_buf)) { -+ pr_info("Found device file mapping, plugin is available\n"); -+ vfi->has_device_plugin = true; -+ } else { -+ /* non-regular mapping with no supporting plugin */ - pr_err("Can't handle non-regular mapping on %d's map %" PRIx64 "\n", pid, vma_area->e->start); - goto err; - } -@@ -646,9 +667,23 @@ static int vma_list_add(struct vma_area *vma_area, struct vm_area_list *vma_area - struct vma_file_info *vfi, struct vma_file_info *prev_vfi) - { - if (vma_area->e->status & VMA_UNSUPP) { -- pr_err("Unsupported mapping found %016" PRIx64 "-%016" PRIx64 "\n", vma_area->e->start, -- vma_area->e->end); -- return -1; -+ if (vfi->has_device_plugin) { -+ /* Unsupported VMAs that provide special plugins for -+ * backup can be treated as regular VMAs and criu -+ * should only save their metadata in the dump files. -+ * There can be several special backup plugins hooks -+ * that might run at different stages during checkpoint -+ * and restore. -+ */ -+ pr_debug("Device file mapping %016" PRIx64 "-%016" PRIx64 " " -+ "must be supported via device plugins\n", -+ vma_area->e->start, vma_area->e->end); -+ -+ } else { -+ pr_err("Unsupported mapping found %016" PRIx64 "-%016" PRIx64 "\n", vma_area->e->start, -+ vma_area->e->end); -+ return -1; -+ } - } - - /* Add a guard page only if here is enough space for it */ --- -2.34.1 - diff --git a/0011-Add-support-for-python3-in-criu-coredump.patch b/0006-Add-support-for-python3-in-criu-coredump.patch similarity index 98% rename from 0011-Add-support-for-python3-in-criu-coredump.patch rename to 0006-Add-support-for-python3-in-criu-coredump.patch index aee8e7f..4c3097d 100644 --- a/0011-Add-support-for-python3-in-criu-coredump.patch +++ b/0006-Add-support-for-python3-in-criu-coredump.patch @@ -1,7 +1,7 @@ -From 96acfa9af099f17a14d985ac5e9ee9769d9ebe2c Mon Sep 17 00:00:00 2001 +From 0246feb3ca20256ca3be8e94ebf8b30f75a26e3e Mon Sep 17 00:00:00 2001 From: Andrey Vyazovtsev Date: Thu, 26 Aug 2021 22:22:33 +0300 -Subject: [PATCH 011/120] Add support for python3 in criu-coredump +Subject: [PATCH 006/245] Add support for python3 in criu-coredump Resolve the following python3 portability issues: @@ -307,5 +307,5 @@ index e65919e6b..a670ae866 100644 # /* kill(). */ -- -2.34.1 +2.35.1 diff --git a/0006-criu-plugin-Implement-dummy-amdgpu-plugin-hooks.patch b/0006-criu-plugin-Implement-dummy-amdgpu-plugin-hooks.patch deleted file mode 100644 index 6fb4d9b..0000000 --- a/0006-criu-plugin-Implement-dummy-amdgpu-plugin-hooks.patch +++ /dev/null @@ -1,160 +0,0 @@ -From 3470e3d012a2706463cd77afce0a33f3581c2721 Mon Sep 17 00:00:00 2001 -From: Rajneesh Bhardwaj -Date: Thu, 15 Jul 2021 01:34:08 -0400 -Subject: [PATCH 006/120] criu/plugin: Implement dummy amdgpu plugin hooks - -This is just a placeholder dummy plugin and will be replaced by a proper -plugin that implements support for AMD GPU devices. This just -facilitates the initial pull request and CI build test trigger for early -code review of CRIU specific changes. Future PRs will bring in more -support for amdgpu_plugin to enable CRIU with AMD ROCm. - -Signed-off-by: Rajneesh Bhardwaj ---- - Makefile | 12 ++++++++++-- - Makefile.install | 8 +++++++- - plugins/amdgpu/Makefile | 13 +++++++++++++ - plugins/amdgpu/dummy_plugin.c | 36 +++++++++++++++++++++++++++++++++++ - 4 files changed, 66 insertions(+), 3 deletions(-) - create mode 100644 plugins/amdgpu/Makefile - create mode 100644 plugins/amdgpu/dummy_plugin.c - -diff --git a/Makefile b/Makefile -index a1e3977f8..e361e8a8f 100644 ---- a/Makefile -+++ b/Makefile -@@ -294,15 +294,19 @@ clean mrproper: - $(Q) $(MAKE) $(build)=crit $@ - .PHONY: clean mrproper - -+clean-dummy_amdgpu_plugin: -+ $(Q) $(MAKE) -C plugins/amdgpu clean -+.PHONY: clean dummy_amdgpu_plugin -+ - clean-top: - $(Q) $(MAKE) -C Documentation clean - $(Q) $(MAKE) $(build)=test/compel clean - $(Q) $(RM) .gitid - .PHONY: clean-top - --clean: clean-top -+clean: clean-top clean-dummy_amdgpu_plugin - --mrproper-top: clean-top -+mrproper-top: clean-top clean-dummy_amdgpu_plugin - $(Q) $(RM) $(CONFIG_HEADER) - $(Q) $(RM) $(VERSION_HEADER) - $(Q) $(RM) $(COMPEL_VERSION_HEADER) -@@ -330,6 +334,10 @@ test: zdtm - $(Q) $(MAKE) -C test - .PHONY: test - -+dummy_amdgpu_plugin: -+ $(Q) $(MAKE) -C plugins/amdgpu all -+.PHONY: dummy_amdgpu_plugin -+ - # - # Generating tar requires tag matched CRIU_VERSION. - # If not found then simply use GIT's describe with -diff --git a/Makefile.install b/Makefile.install -index 3987bcc6f..52e8c06da 100644 ---- a/Makefile.install -+++ b/Makefile.install -@@ -7,6 +7,7 @@ MANDIR ?= $(PREFIX)/share/man - INCLUDEDIR ?= $(PREFIX)/include - LIBEXECDIR ?= $(PREFIX)/libexec - RUNDIR ?= /run -+PLUGINDIR ?= /var/lib/criu - - # - # For recent Debian/Ubuntu with multiarch support. -@@ -26,7 +27,7 @@ endif - LIBDIR ?= $(PREFIX)/lib - - export PREFIX BINDIR SBINDIR MANDIR RUNDIR --export LIBDIR INCLUDEDIR LIBEXECDIR -+export LIBDIR INCLUDEDIR LIBEXECDIR PLUGINDIR - - install-man: - $(Q) $(MAKE) -C Documentation install -@@ -40,6 +41,10 @@ install-criu: criu - $(Q) $(MAKE) $(build)=criu install - .PHONY: install-criu - -+install-dummy_amdgpu_plugin: dummy_amdgpu_plugin -+ $(Q) $(MAKE) -C plugins/amdgpu install -+.PHONY: install-dummy_amdgpu_plugin -+ - install-compel: $(compel-install-targets) - $(Q) $(MAKE) $(build)=compel install - $(Q) $(MAKE) $(build)=compel/plugins install -@@ -54,4 +59,5 @@ uninstall: - $(Q) $(MAKE) $(build)=criu $@ - $(Q) $(MAKE) $(build)=compel $@ - $(Q) $(MAKE) $(build)=compel/plugins $@ -+ $(Q) $(MAKE) -C plugins/amdgpu $@ - .PHONY: uninstall -diff --git a/plugins/amdgpu/Makefile b/plugins/amdgpu/Makefile -new file mode 100644 -index 000000000..45a9ec611 ---- /dev/null -+++ b/plugins/amdgpu/Makefile -@@ -0,0 +1,13 @@ -+all: dummy_plugin.so -+ -+dummy_plugin.so: dummy_plugin.c -+ gcc -g -Werror -D _GNU_SOURCE -Wall -shared -nostartfiles dummy_plugin.c -o dummy_plugin.so -iquote ../../../criu/include -iquote ../../criu/include -fPIC -+ -+clean: -+ $(Q) $(RM) dummy_plugin.so -+install: -+ $(Q) mkdir -p $(PLUGINDIR) -+ $(Q) install -m 644 dummy_plugin.so $(PLUGINDIR) -+ -+uninstall: -+ $(Q) $(RM) $(PLUGINDIR)/dummy_plugin.so -diff --git a/plugins/amdgpu/dummy_plugin.c b/plugins/amdgpu/dummy_plugin.c -new file mode 100644 -index 000000000..872276095 ---- /dev/null -+++ b/plugins/amdgpu/dummy_plugin.c -@@ -0,0 +1,36 @@ -+#include -+ -+#include "criu-log.h" -+#include "criu-plugin.h" -+ -+int dummy_plugin_handle_device_vma(int fd, const struct stat *stat) -+{ -+ pr_info("dummy_plugin: Inside %s for fd = %d\n", __func__, fd); -+ /* let criu report failure for the unsupported mapping */ -+ return -ENOTSUP; -+} -+CR_PLUGIN_REGISTER_HOOK(CR_PLUGIN_HOOK__HANDLE_DEVICE_VMA, dummy_plugin_handle_device_vma) -+ -+int dummy_plugin_resume_devices_late(int target_pid) -+{ -+ pr_info("dummy_plugin: Inside %s for target pid = %d\n", __func__, target_pid); -+ return -ENOTSUP; -+} -+CR_PLUGIN_REGISTER_HOOK(CR_PLUGIN_HOOK__RESUME_DEVICES_LATE, dummy_plugin_resume_devices_late) -+ -+/* -+ * return 0 if no match found -+ * return -1 for error or -ENOTSUP. -+ * return 1 if vmap map must be adjusted. -+ */ -+int dummy_plugin_update_vmamap(const char *old_path, char *new_path, const uint64_t addr, const uint64_t old_offset, -+ uint64_t *new_offset) -+{ -+ uint64_t temp = 100; -+ -+ *new_offset = temp; -+ pr_info("dummy_plugin: old_pgoff= 0x%lu new_pgoff = 0x%lx old_path = %s new_path = %s addr = 0x%lu\n", -+ old_offset, *new_offset, old_path, new_path, addr); -+ return -ENOTSUP; -+} -+CR_PLUGIN_REGISTER_HOOK(CR_PLUGIN_HOOK__UPDATE_VMA_MAP, dummy_plugin_update_vmamap) --- -2.34.1 - diff --git a/0012-Add-new-files-for-running-criu-coredump-via-python-2.patch b/0007-Add-new-files-for-running-criu-coredump-via-python-2.patch similarity index 94% rename from 0012-Add-new-files-for-running-criu-coredump-via-python-2.patch rename to 0007-Add-new-files-for-running-criu-coredump-via-python-2.patch index 27d5be2..ddb3d5a 100644 --- a/0012-Add-new-files-for-running-criu-coredump-via-python-2.patch +++ b/0007-Add-new-files-for-running-criu-coredump-via-python-2.patch @@ -1,7 +1,7 @@ -From db79777cf017751ec54d2534966b237927f23a15 Mon Sep 17 00:00:00 2001 +From fe7504f824e0e59f182b3e2eaffa4514c7bdbae1 Mon Sep 17 00:00:00 2001 From: AndreyVV-100 Date: Fri, 23 Jul 2021 12:48:03 +0300 -Subject: [PATCH 012/120] Add new files for running criu-coredump via python 2 +Subject: [PATCH 007/245] Add new files for running criu-coredump via python 2 or 3 Previous commit added support for python3 in criu-coredump. For convenience, @@ -67,5 +67,5 @@ index b514e87d9..e2f63eee3 100755 +CRIU_COREDUMP=$(readlink -f `dirname ${BASH_SOURCE[0]}`/../../criu-coredump/coredump-"${PYTHON}") criu_coredump=$CRIU_COREDUMP -- -2.34.1 +2.35.1 diff --git a/0013-coredump-remove-unused-import.patch b/0008-coredump-remove-unused-import.patch similarity index 87% rename from 0013-coredump-remove-unused-import.patch rename to 0008-coredump-remove-unused-import.patch index 9667259..dfc68d3 100644 --- a/0013-coredump-remove-unused-import.patch +++ b/0008-coredump-remove-unused-import.patch @@ -1,7 +1,7 @@ -From e3f910ff3e9e3326e1df5e6d8e97dbbd8dc4af94 Mon Sep 17 00:00:00 2001 +From db8634929bdb48268f3744aa2acb19fafec00be3 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Sun, 5 Sep 2021 21:31:12 +0100 -Subject: [PATCH 013/120] coredump: remove unused import +Subject: [PATCH 008/245] coredump: remove unused import Signed-off-by: Radostin Stoyanov --- @@ -28,5 +28,5 @@ index b6a587729..bd4f95bb2 100644 +# F401: imported but unused +per-file-ignores = __init__.py:F401 -- -2.34.1 +2.35.1 diff --git a/0014-coredump-sort-imports.patch b/0009-coredump-sort-imports.patch similarity index 84% rename from 0014-coredump-sort-imports.patch rename to 0009-coredump-sort-imports.patch index f7263a8..6a57eb0 100644 --- a/0014-coredump-sort-imports.patch +++ b/0009-coredump-sort-imports.patch @@ -1,7 +1,7 @@ -From 8b69c69dbec5e6b2a84083e609c3de4e15661c90 Mon Sep 17 00:00:00 2001 +From df099bc26bf56bca463ec5e914516b17a4426ae9 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Sun, 5 Sep 2021 21:32:17 +0100 -Subject: [PATCH 014/120] coredump: sort imports +Subject: [PATCH 009/245] coredump: sort imports Signed-off-by: Radostin Stoyanov --- @@ -27,5 +27,5 @@ index d67c335c1..9b4aad5ff 100644 from itertools import ifilter as filter except ImportError: -- -2.34.1 +2.35.1 diff --git a/0015-coredump-convert-indentation-to-spaces.patch b/0010-coredump-convert-indentation-to-spaces.patch similarity index 95% rename from 0015-coredump-convert-indentation-to-spaces.patch rename to 0010-coredump-convert-indentation-to-spaces.patch index 349a141..9e63a32 100644 --- a/0015-coredump-convert-indentation-to-spaces.patch +++ b/0010-coredump-convert-indentation-to-spaces.patch @@ -1,7 +1,7 @@ -From f0f0d7fd59774e1a1a695a49e429239ba4a5a469 Mon Sep 17 00:00:00 2001 +From 5ddabab892cf628be052d29d395adc9b597345df Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Sun, 5 Sep 2021 21:34:00 +0100 -Subject: [PATCH 015/120] coredump: convert indentation to spaces +Subject: [PATCH 010/245] coredump: convert indentation to spaces Signed-off-by: Radostin Stoyanov --- @@ -103,5 +103,5 @@ index 56ba54083..e63abf951 100755 - main() + main() -- -2.34.1 +2.35.1 diff --git a/0016-python-replace-equality-with-identity-test.patch b/0011-python-replace-equality-with-identity-test.patch similarity index 96% rename from 0016-python-replace-equality-with-identity-test.patch rename to 0011-python-replace-equality-with-identity-test.patch index 28ecb6f..e7cb5c2 100644 --- a/0016-python-replace-equality-with-identity-test.patch +++ b/0011-python-replace-equality-with-identity-test.patch @@ -1,7 +1,7 @@ -From e108510070507deb370ef0c857eadc5a9e855a1c Mon Sep 17 00:00:00 2001 +From e111b6e6dd9979ae575b97b14080e93643add683 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Sun, 5 Sep 2021 21:36:10 +0100 -Subject: [PATCH 016/120] python: replace equality with identity test +Subject: [PATCH 011/245] python: replace equality with identity test PEP8 recommends for comparisons to singletons like None to always be done with 'is' or 'is not', never the equality operators. @@ -113,5 +113,5 @@ index 98dbbb7b0..114bf957b 100755 continue -- -2.34.1 +2.35.1 diff --git a/0017-coredump-drop-unused-variable.patch b/0012-coredump-drop-unused-variable.patch similarity index 85% rename from 0017-coredump-drop-unused-variable.patch rename to 0012-coredump-drop-unused-variable.patch index 4ea5aa4..62d97fe 100644 --- a/0017-coredump-drop-unused-variable.patch +++ b/0012-coredump-drop-unused-variable.patch @@ -1,7 +1,7 @@ -From 2f4e9c36f9686a101d6283b9c60e638175d6c817 Mon Sep 17 00:00:00 2001 +From cf5c2292a240fc36e424fad914e1839d05da5e01 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Sun, 5 Sep 2021 21:38:06 +0100 -Subject: [PATCH 017/120] coredump: drop unused variable +Subject: [PATCH 012/245] coredump: drop unused variable Signed-off-by: Radostin Stoyanov --- @@ -22,5 +22,5 @@ index a9a8bb27c..42c2fed19 100644 v.filesz = self._get_vma_dump_size(vma) v.data = self._gen_mem_chunk(pid, vma, v.filesz) -- -2.34.1 +2.35.1 diff --git a/0018-coredump-drop-exec-permission.patch b/0013-coredump-drop-exec-permission.patch similarity index 78% rename from 0018-coredump-drop-exec-permission.patch rename to 0013-coredump-drop-exec-permission.patch index 47d0df3..1b10a3e 100644 --- a/0018-coredump-drop-exec-permission.patch +++ b/0013-coredump-drop-exec-permission.patch @@ -1,7 +1,7 @@ -From 7833c71147357c37203328da9668f384fa08bf47 Mon Sep 17 00:00:00 2001 +From 0f3b2a370d1180e339575d6b86ef46f0bf93edb4 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Sun, 5 Sep 2021 21:42:46 +0100 -Subject: [PATCH 018/120] coredump: drop exec permission +Subject: [PATCH 013/245] coredump: drop exec permission The shebang line in this file was removed in a previous commit and the file should be non-executable. @@ -16,5 +16,5 @@ diff --git a/coredump/coredump.py b/coredump/coredump.py old mode 100755 new mode 100644 -- -2.34.1 +2.35.1 diff --git a/0019-coredump-lint-fix-for-block-comments.patch b/0014-coredump-lint-fix-for-block-comments.patch similarity index 99% rename from 0019-coredump-lint-fix-for-block-comments.patch rename to 0014-coredump-lint-fix-for-block-comments.patch index f1572a3..9106226 100644 --- a/0019-coredump-lint-fix-for-block-comments.patch +++ b/0014-coredump-lint-fix-for-block-comments.patch @@ -1,7 +1,7 @@ -From 71c05419e343a31d2f1de3694cc05b2e71400efd Mon Sep 17 00:00:00 2001 +From b593b4cc141c9e7ac104530755d071274f38f1b1 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Sun, 5 Sep 2021 21:53:06 +0100 -Subject: [PATCH 019/120] coredump: lint fix for block comments +Subject: [PATCH 014/245] coredump: lint fix for block comments Block comment should start with '# ' https://www.flake8rules.com/rules/E265.html @@ -1285,5 +1285,5 @@ index a670ae866..092b47857 100644 + ("ymmh", ymmh_struct) ] # } __aligned(FP_MIN_ALIGN_BYTES) __packed; -- -2.34.1 +2.35.1 diff --git a/0020-coredump-fix-missing-whitespace-around-operator.patch b/0015-coredump-fix-missing-whitespace-around-operator.patch similarity index 85% rename from 0020-coredump-fix-missing-whitespace-around-operator.patch rename to 0015-coredump-fix-missing-whitespace-around-operator.patch index 7972dac..d729249 100644 --- a/0020-coredump-fix-missing-whitespace-around-operator.patch +++ b/0015-coredump-fix-missing-whitespace-around-operator.patch @@ -1,7 +1,7 @@ -From 4abfd7ea70d7c1d8f1ee4b87dcff0e121823b523 Mon Sep 17 00:00:00 2001 +From 1074ea5b55fadc6b189a81c792e1c30bfaa86d8b Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Sun, 5 Sep 2021 22:37:26 +0100 -Subject: [PATCH 020/120] coredump: fix missing whitespace around operator +Subject: [PATCH 015/245] coredump: fix missing whitespace around operator Missing whitespace around arithmetic operator https://www.flake8rules.com/rules/E226.html @@ -25,5 +25,5 @@ index e63abf951..5e63d2138 100644 -- -2.34.1 +2.35.1 diff --git a/0021-coredump-fix-too-many-blank-lines.patch b/0016-coredump-fix-too-many-blank-lines.patch similarity index 84% rename from 0021-coredump-fix-too-many-blank-lines.patch rename to 0016-coredump-fix-too-many-blank-lines.patch index 2cece25..c7cfa24 100644 --- a/0021-coredump-fix-too-many-blank-lines.patch +++ b/0016-coredump-fix-too-many-blank-lines.patch @@ -1,7 +1,7 @@ -From c53231fe5e81412d27ada8bdd4a0dd78f19c3b21 Mon Sep 17 00:00:00 2001 +From b2903a63004600399d5982ce0b36f203702001d7 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Sun, 5 Sep 2021 22:39:50 +0100 -Subject: [PATCH 021/120] coredump: fix too many blank lines +Subject: [PATCH 016/245] coredump: fix too many blank lines https://www.flake8rules.com/rules/E303.html @@ -23,5 +23,5 @@ index 274889800..a232132fd 100644 nhdr.n_namesz = 5 nhdr.n_descsz = ctypes.sizeof(elf.elf_prpsinfo()) -- -2.34.1 +2.35.1 diff --git a/0022-coredump-fix-comparison-to-true.patch b/0017-coredump-fix-comparison-to-true.patch similarity index 87% rename from 0022-coredump-fix-comparison-to-true.patch rename to 0017-coredump-fix-comparison-to-true.patch index 8b37ebf..7be6690 100644 --- a/0022-coredump-fix-comparison-to-true.patch +++ b/0017-coredump-fix-comparison-to-true.patch @@ -1,7 +1,7 @@ -From 718d0039623a7371130cdb568b39ee9f968d31c4 Mon Sep 17 00:00:00 2001 +From b37e0a33b23dbe789f178aca614458637598c506 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Sun, 5 Sep 2021 22:42:19 +0100 -Subject: [PATCH 022/120] coredump: fix comparison to true +Subject: [PATCH 017/245] coredump: fix comparison to true Comparison to true should be 'if cond is true:' or 'if cond:' https://www.flake8rules.com/rules/E712.html @@ -25,5 +25,5 @@ index a232132fd..41d102db7 100644 return self._get_page(ppid, page_no) else: -- -2.34.1 +2.35.1 diff --git a/0023-coredump-lint-fix-visually-indented-line.patch b/0018-coredump-lint-fix-visually-indented-line.patch similarity index 93% rename from 0023-coredump-lint-fix-visually-indented-line.patch rename to 0018-coredump-lint-fix-visually-indented-line.patch index dd5ab2e..23b9600 100644 --- a/0023-coredump-lint-fix-visually-indented-line.patch +++ b/0018-coredump-lint-fix-visually-indented-line.patch @@ -1,7 +1,7 @@ -From bf85f98b0cbdab968d539dbc7c363b596eb0e95e Mon Sep 17 00:00:00 2001 +From e0d45309559dc198619ad8f62d699f601f04dbca Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Sun, 5 Sep 2021 22:47:59 +0100 -Subject: [PATCH 023/120] coredump: lint fix visually indented line +Subject: [PATCH 018/245] coredump: lint fix visually indented line Continuation line over-indented for visual indent https://www.flake8rules.com/rules/E127.html @@ -48,5 +48,5 @@ index 41d102db7..881c40b0a 100644 else: size = 0 -- -2.34.1 +2.35.1 diff --git a/0024-test-coredump-fix-shellcheck-errors.patch b/0019-test-coredump-fix-shellcheck-errors.patch similarity index 90% rename from 0024-test-coredump-fix-shellcheck-errors.patch rename to 0019-test-coredump-fix-shellcheck-errors.patch index d588ef9..4ecff6d 100644 --- a/0024-test-coredump-fix-shellcheck-errors.patch +++ b/0019-test-coredump-fix-shellcheck-errors.patch @@ -1,7 +1,7 @@ -From e56c944db74f9c3b033274271f7a82fef6fed815 Mon Sep 17 00:00:00 2001 +From 599d77b4650a7ce14370ac69fbc825a71e540da4 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Mon, 6 Sep 2021 00:20:58 +0100 -Subject: [PATCH 024/120] test/coredump: fix shellcheck errors +Subject: [PATCH 019/245] test/coredump: fix shellcheck errors ShellCheck reports the following problems: @@ -47,5 +47,5 @@ index 62d9f7edc..dd774e298 100755 done -- -2.34.1 +2.35.1 diff --git a/0025-make-enable-lint-for-coredump.patch b/0020-make-enable-lint-for-coredump.patch similarity index 82% rename from 0025-make-enable-lint-for-coredump.patch rename to 0020-make-enable-lint-for-coredump.patch index 5dd6006..17c7e8d 100644 --- a/0025-make-enable-lint-for-coredump.patch +++ b/0020-make-enable-lint-for-coredump.patch @@ -1,7 +1,7 @@ -From ff7eea013205a1055b6f0e2300db46f6768c6d28 Mon Sep 17 00:00:00 2001 +From 5dc9cc7abb2ba750dc09af0c9983723ac6c03c8d Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Sun, 5 Sep 2021 22:55:24 +0100 -Subject: [PATCH 025/120] make: enable lint for coredump +Subject: [PATCH 020/245] make: enable lint for coredump Signed-off-by: Radostin Stoyanov --- @@ -9,10 +9,10 @@ Signed-off-by: Radostin Stoyanov 1 file changed, 2 insertions(+) diff --git a/Makefile b/Makefile -index e361e8a8f..73b647d6d 100644 +index 08761efed..1f0dec78b 100644 --- a/Makefile +++ b/Makefile -@@ -427,11 +427,13 @@ lint: +@@ -409,11 +409,13 @@ lint: flake8 --config=scripts/flake8.cfg test/others/rpc/config_file.py flake8 --config=scripts/flake8.cfg lib/py/images/pb2dict.py flake8 --config=scripts/flake8.cfg scripts/criu-ns @@ -27,5 +27,5 @@ index e361e8a8f..73b647d6d 100644 # Do not append \n to pr_perror or fail ! git --no-pager grep -E '^\s*\<(pr_perror|fail)\>.*\\n"' -- -2.34.1 +2.35.1 diff --git a/0026-ci-enable-coredump-tests.patch b/0021-ci-enable-coredump-tests.patch similarity index 90% rename from 0026-ci-enable-coredump-tests.patch rename to 0021-ci-enable-coredump-tests.patch index 52d0b54..6bda688 100644 --- a/0026-ci-enable-coredump-tests.patch +++ b/0021-ci-enable-coredump-tests.patch @@ -1,7 +1,7 @@ -From 4a67277e8f67e988aa14106cb69a14d8e3e65815 Mon Sep 17 00:00:00 2001 +From 37301a8a6ef9ecb1efe3f8086cd1ca6bd7fe4b70 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Sun, 5 Sep 2021 23:06:56 +0100 -Subject: [PATCH 026/120] ci: enable coredump tests +Subject: [PATCH 021/245] ci: enable coredump tests Signed-off-by: Radostin Stoyanov --- @@ -35,5 +35,5 @@ index e2f63eee3..45066f760 100755 +CRIU_COREDUMP=$(readlink -f `dirname ${BASH_SOURCE[0]}`/../../coredump/coredump-"${PYTHON}") criu_coredump=$CRIU_COREDUMP -- -2.34.1 +2.35.1 diff --git a/0027-pie-restorer-remove-excess-hash-printf-specifier.patch b/0022-pie-restorer-remove-excess-hash-printf-specifier.patch similarity index 90% rename from 0027-pie-restorer-remove-excess-hash-printf-specifier.patch rename to 0022-pie-restorer-remove-excess-hash-printf-specifier.patch index af3612e..37acf25 100644 --- a/0027-pie-restorer-remove-excess-hash-printf-specifier.patch +++ b/0022-pie-restorer-remove-excess-hash-printf-specifier.patch @@ -1,7 +1,7 @@ -From 8ee0ce3b87d8be2a294881e47e076e8095ea834b Mon Sep 17 00:00:00 2001 +From 817bbf40251e54cc1441250a16e192f7f18a80b6 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 21 Oct 2021 11:47:01 +0300 -Subject: [PATCH 027/120] pie/restorer: remove excess hash printf specifier +Subject: [PATCH 022/245] pie/restorer: remove excess hash printf specifier We use here "%#x" printf specifier in pie code, but sbuf_printf core pie printing function knows nothing about '#' specifier. More over simple @@ -35,5 +35,5 @@ index 4304691bb..0051452e4 100644 (unsigned long long)t->val.it_value.tv_sec, (unsigned long long)t->val.it_value.tv_nsec); -- -2.34.1 +2.35.1 diff --git a/0028-tty-fix-the-null-pointer-of-get_tty_driver.patch b/0023-tty-fix-the-null-pointer-of-get_tty_driver.patch similarity index 87% rename from 0028-tty-fix-the-null-pointer-of-get_tty_driver.patch rename to 0023-tty-fix-the-null-pointer-of-get_tty_driver.patch index cde6613..9a18f06 100644 --- a/0028-tty-fix-the-null-pointer-of-get_tty_driver.patch +++ b/0023-tty-fix-the-null-pointer-of-get_tty_driver.patch @@ -1,7 +1,7 @@ -From 79c194313f14a5a902764ec653a611616125c256 Mon Sep 17 00:00:00 2001 +From 47be9b1891006453ad9ae87960677300822be8b0 Mon Sep 17 00:00:00 2001 From: "fu.lin" Date: Fri, 17 Sep 2021 17:16:48 +0800 -Subject: [PATCH 028/120] tty: fix the null pointer of get_tty_driver +Subject: [PATCH 023/245] tty: fix the null pointer of get_tty_driver v2: split error checking from index variable initialization v3: use PRIx64 for printing dev_t @@ -30,5 +30,5 @@ index 1598ad956..1462193c5 100644 index = driver->fd_get_index(lfd, p); else -- -2.34.1 +2.35.1 diff --git a/0029-util-use-nftw-in-rmrf-helper.patch b/0024-util-use-nftw-in-rmrf-helper.patch similarity index 96% rename from 0029-util-use-nftw-in-rmrf-helper.patch rename to 0024-util-use-nftw-in-rmrf-helper.patch index ab0573b..a335492 100644 --- a/0029-util-use-nftw-in-rmrf-helper.patch +++ b/0024-util-use-nftw-in-rmrf-helper.patch @@ -1,7 +1,7 @@ -From 6dadc8bf0c996385531af6729361751b47b8926b Mon Sep 17 00:00:00 2001 +From 10fa87c08c22d7d7ddca1fbd1c2704f96c079639 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Fri, 22 Oct 2021 17:56:37 +0300 -Subject: [PATCH 029/120] util: use nftw in rmrf helper +Subject: [PATCH 024/245] util: use nftw in rmrf helper This simplifies the code by removing excess recursion and reusing standard function to walk over file-tree instead of opencoding it. @@ -122,5 +122,5 @@ index 06124c220..414879971 100644 __attribute__((returns_twice)) static pid_t raw_legacy_clone(unsigned long flags, int *pidfd) -- -2.34.1 +2.35.1 diff --git a/0030-criu-ns-make-pidns-init-first-do-setsid.patch b/0025-criu-ns-make-pidns-init-first-do-setsid.patch similarity index 87% rename from 0030-criu-ns-make-pidns-init-first-do-setsid.patch rename to 0025-criu-ns-make-pidns-init-first-do-setsid.patch index b472497..485e34a 100644 --- a/0030-criu-ns-make-pidns-init-first-do-setsid.patch +++ b/0025-criu-ns-make-pidns-init-first-do-setsid.patch @@ -1,7 +1,7 @@ -From d6d76e07bb7f4532bb49c1fce99f3fef7fcd87c6 Mon Sep 17 00:00:00 2001 +From 08baf25effeb30d59f98e2eae07acee71ce22b1c Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Mon, 18 Oct 2021 18:43:14 +0300 -Subject: [PATCH 030/120] criu-ns: make pidns init first do setsid +Subject: [PATCH 025/245] criu-ns: make pidns init first do setsid We see that on criu-ns dump/restore/dump of the process which initially was not a session leader (with --shell-job option) we see sid == 0 for @@ -33,5 +33,5 @@ index d76db3606..72c0753e5 100755 run_criu(restore_args) -- -2.34.1 +2.35.1 diff --git a/0031-net-optimize-restore_rule-to-not-open-the-CR_FD_RULE.patch b/0026-net-optimize-restore_rule-to-not-open-the-CR_FD_RULE.patch similarity index 95% rename from 0031-net-optimize-restore_rule-to-not-open-the-CR_FD_RULE.patch rename to 0026-net-optimize-restore_rule-to-not-open-the-CR_FD_RULE.patch index eaec151..62ae705 100644 --- a/0031-net-optimize-restore_rule-to-not-open-the-CR_FD_RULE.patch +++ b/0026-net-optimize-restore_rule-to-not-open-the-CR_FD_RULE.patch @@ -1,7 +1,7 @@ -From 62090e89b553a022bf564e76840dc67ea786ec65 Mon Sep 17 00:00:00 2001 +From 87d8857fa7fdaed252f52782eb4f65b4ab990536 Mon Sep 17 00:00:00 2001 From: Nicolas Viennot Date: Thu, 28 Oct 2021 21:05:57 +0000 -Subject: [PATCH 031/120] net: optimize restore_rule() to not open the +Subject: [PATCH 026/245] net: optimize restore_rule() to not open the CR_FD_RULE image file twice Previously, `open_image(CR_FD_RULE, O_RSTR, pid)` was called twice. @@ -109,5 +109,5 @@ index 7b45f0633..02115c4de 100644 /* -- -2.34.1 +2.35.1 diff --git a/0032-ci-replace-deprecated-codecov-bash-uploader.patch b/0027-ci-replace-deprecated-codecov-bash-uploader.patch similarity index 86% rename from 0032-ci-replace-deprecated-codecov-bash-uploader.patch rename to 0027-ci-replace-deprecated-codecov-bash-uploader.patch index cbd2944..a958d9f 100644 --- a/0032-ci-replace-deprecated-codecov-bash-uploader.patch +++ b/0027-ci-replace-deprecated-codecov-bash-uploader.patch @@ -1,7 +1,7 @@ -From e11c742e018aeaf60f0e3abef33c557b4799fb9a Mon Sep 17 00:00:00 2001 +From dfa69352b7115aa65a735a43b5d5cdd95511eed6 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Wed, 27 Oct 2021 07:27:22 +0000 -Subject: [PATCH 032/120] ci: replace deprecated codecov bash uploader +Subject: [PATCH 027/245] ci: replace deprecated codecov bash uploader Replace deprecated codecov bash uploader with new version: @@ -26,10 +26,10 @@ index f1b38e77e..f782c5b9d 100644 - name: Run Coverage Analysis run: sudo -E make codecov diff --git a/Makefile b/Makefile -index 73b647d6d..d35012615 100644 +index 1f0dec78b..c0b8b7e54 100644 --- a/Makefile +++ b/Makefile -@@ -449,7 +449,9 @@ lint: +@@ -431,7 +431,9 @@ lint: codecov: SHELL := $(shell which bash) codecov: @@ -41,5 +41,5 @@ index 73b647d6d..d35012615 100644 fetch-clang-format: .FORCE -- -2.34.1 +2.35.1 diff --git a/0033-ci-fix-userfaultfd-test-failures.patch b/0028-ci-fix-userfaultfd-test-failures.patch similarity index 89% rename from 0033-ci-fix-userfaultfd-test-failures.patch rename to 0028-ci-fix-userfaultfd-test-failures.patch index 7b8024c..f6ba568 100644 --- a/0033-ci-fix-userfaultfd-test-failures.patch +++ b/0028-ci-fix-userfaultfd-test-failures.patch @@ -1,7 +1,7 @@ -From a86a66fc2cbb77cdf0df69f3589c325018261d67 Mon Sep 17 00:00:00 2001 +From 5c4c99dc3d477408e5bd249e03254ca4a3bafb87 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Thu, 4 Nov 2021 09:10:38 +0000 -Subject: [PATCH 033/120] ci: fix userfaultfd test failures +Subject: [PATCH 028/245] ci: fix userfaultfd test failures Newer kernels (5.11) require echo 1 > /proc/sys/vm/unprivileged_userfaultfd @@ -32,5 +32,5 @@ index 51aa7db9e..096f907fb 100755 LAZY_TESTS='.*(maps0|uffd-events|lazy-thp|futex|fork).*' -- -2.34.1 +2.35.1 diff --git a/0034-ci-use-Fedora-34-for-lint-CI-runs.patch b/0029-ci-use-Fedora-34-for-lint-CI-runs.patch similarity index 86% rename from 0034-ci-use-Fedora-34-for-lint-CI-runs.patch rename to 0029-ci-use-Fedora-34-for-lint-CI-runs.patch index a99a177..a1aa182 100644 --- a/0034-ci-use-Fedora-34-for-lint-CI-runs.patch +++ b/0029-ci-use-Fedora-34-for-lint-CI-runs.patch @@ -1,7 +1,7 @@ -From 07a2f0265d3d6eebec6b3a7538179f6b50da270b Mon Sep 17 00:00:00 2001 +From 3bc19101b9458cb920b79492063be1b71312f0a5 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Thu, 4 Nov 2021 09:18:31 +0000 -Subject: [PATCH 034/120] ci: use Fedora 34 for lint CI runs +Subject: [PATCH 029/245] ci: use Fedora 34 for lint CI runs Fedora 35 comes with clang 13 which provides different results for clang-format than clang 12 in Fedora 34. @@ -25,5 +25,5 @@ index 50b241e9f..49eb6aaac 100644 - name: Install tools run: sudo dnf -y install git make python3-flake8 ShellCheck clang-tools-extra which findutils -- -2.34.1 +2.35.1 diff --git a/0035-tests-improve-the-image-streamer-process-control.patch b/0030-tests-improve-the-image-streamer-process-control.patch similarity index 97% rename from 0035-tests-improve-the-image-streamer-process-control.patch rename to 0030-tests-improve-the-image-streamer-process-control.patch index 677b67a..1ec3da6 100644 --- a/0035-tests-improve-the-image-streamer-process-control.patch +++ b/0030-tests-improve-the-image-streamer-process-control.patch @@ -1,7 +1,7 @@ -From b405b1b0142bea0eeec1437a867b1c0ef7a3afe1 Mon Sep 17 00:00:00 2001 +From 3b1a22da26051f157aaf3272bb4bb78a545920c2 Mon Sep 17 00:00:00 2001 From: Nicolas Viennot Date: Fri, 29 Oct 2021 02:49:31 +0000 -Subject: [PATCH 035/120] tests: improve the image streamer process control +Subject: [PATCH 030/245] tests: improve the image streamer process control When exceptions are raised during testing, the image streamer process should be terminated as opposed to being left hanging. @@ -141,5 +141,5 @@ index 0a52e1b96..fc7b8a183 100755 def try_run_hook(test, args): -- -2.34.1 +2.35.1 diff --git a/0036-sockets-don-t-call-sk_setbufs-asyncronously.patch b/0031-sockets-don-t-call-sk_setbufs-asyncronously.patch similarity index 89% rename from 0036-sockets-don-t-call-sk_setbufs-asyncronously.patch rename to 0031-sockets-don-t-call-sk_setbufs-asyncronously.patch index 518eec3..4733fae 100644 --- a/0036-sockets-don-t-call-sk_setbufs-asyncronously.patch +++ b/0031-sockets-don-t-call-sk_setbufs-asyncronously.patch @@ -1,7 +1,7 @@ -From d1e0bcf8130183cdcbd7e80dcbe18a5e7674f259 Mon Sep 17 00:00:00 2001 +From 654c2ee79dae4429287d5ea458952759a7a4632e Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 29 Jul 2021 14:21:37 +0300 -Subject: [PATCH 036/120] sockets: don't call sk_setbufs asyncronously +Subject: [PATCH 031/245] sockets: don't call sk_setbufs asyncronously We want to also c/r socket buf locks (SO_BUF_LOCKS) which are also implicitly set by setsockopt(SO_{SND,RCV}BUF*), so we need to order @@ -28,5 +28,5 @@ index 9426b5b94..65aa82950 100644 if (soe->has_so_priority) { pr_debug("\trestore priority %d for socket\n", soe->so_priority); -- -2.34.1 +2.35.1 diff --git a/0037-kerndat-check-for-set-getsockopt-SO_BUF_LOCK-availab.patch b/0032-kerndat-check-for-set-getsockopt-SO_BUF_LOCK-availab.patch similarity index 96% rename from 0037-kerndat-check-for-set-getsockopt-SO_BUF_LOCK-availab.patch rename to 0032-kerndat-check-for-set-getsockopt-SO_BUF_LOCK-availab.patch index d153bec..27136e7 100644 --- a/0037-kerndat-check-for-set-getsockopt-SO_BUF_LOCK-availab.patch +++ b/0032-kerndat-check-for-set-getsockopt-SO_BUF_LOCK-availab.patch @@ -1,7 +1,7 @@ -From 5e13d03743d7d99f292858669d13d0350938106e Mon Sep 17 00:00:00 2001 +From c030e495ed3b5e59acd8c7bdcad8baea1697b909 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 29 Jul 2021 14:57:17 +0300 -Subject: [PATCH 037/120] kerndat: check for set/getsockopt SO_BUF_LOCK +Subject: [PATCH 032/245] kerndat: check for set/getsockopt SO_BUF_LOCK availability This is a new kernel feature to let criu restore sockets with kernel @@ -128,5 +128,5 @@ index 0e88ba43e..9f6a6ec42 100644 kerndat_lsm(); kerndat_mmap_min_addr(); -- -2.34.1 +2.35.1 diff --git a/0038-sockets-c-r-bufer-size-locks.patch b/0033-sockets-c-r-bufer-size-locks.patch similarity index 95% rename from 0038-sockets-c-r-bufer-size-locks.patch rename to 0033-sockets-c-r-bufer-size-locks.patch index c77b4fd..fb89c78 100644 --- a/0038-sockets-c-r-bufer-size-locks.patch +++ b/0033-sockets-c-r-bufer-size-locks.patch @@ -1,7 +1,7 @@ -From 9d02a38d6771a0eb449d5885eddcf74535f8ba8a Mon Sep 17 00:00:00 2001 +From 5aea67fc45f4cf986f396c4f99e5317b9ba08ef6 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 29 Jul 2021 11:27:13 +0300 -Subject: [PATCH 038/120] sockets: c/r bufer size locks +Subject: [PATCH 033/245] sockets: c/r bufer size locks When one sets socket buffer sizes with setsockopt(SO_{SND,RCV}BUF*), kernel sets coresponding SOCK_SNDBUF_LOCK or SOCK_RCVBUF_LOCK flags on @@ -65,5 +65,5 @@ index 2377f6b62..1d24d47cc 100644 enum sk_shutdown { -- -2.34.1 +2.35.1 diff --git a/0039-zdtm-add-test-for-socket-buffer-size-locks.patch b/0034-zdtm-add-test-for-socket-buffer-size-locks.patch similarity index 95% rename from 0039-zdtm-add-test-for-socket-buffer-size-locks.patch rename to 0034-zdtm-add-test-for-socket-buffer-size-locks.patch index dd4a1b7..95c2fe2 100644 --- a/0039-zdtm-add-test-for-socket-buffer-size-locks.patch +++ b/0034-zdtm-add-test-for-socket-buffer-size-locks.patch @@ -1,7 +1,7 @@ -From 579b8b02603d29adf664aab99f9df6cda33acfea Mon Sep 17 00:00:00 2001 +From 16ba0ca25d5e3ee030c4a78fbacd1ad9e1a8a6e0 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 29 Jul 2021 16:16:12 +0300 -Subject: [PATCH 039/120] zdtm: add test for socket buffer size locks +Subject: [PATCH 034/245] zdtm: add test for socket buffer size locks Just set all possible values 0-3 and chack if it persists. @@ -114,5 +114,5 @@ index 000000000..37d3a6354 @@ -0,0 +1 @@ +{'flags': 'suid', 'feature': 'sockopt_buf_lock'} -- -2.34.1 +2.35.1 diff --git a/0040-zdtm-make-sock_opts02-also-check-lock-change-by-SO_-.patch b/0035-zdtm-make-sock_opts02-also-check-lock-change-by-SO_-.patch similarity index 95% rename from 0040-zdtm-make-sock_opts02-also-check-lock-change-by-SO_-.patch rename to 0035-zdtm-make-sock_opts02-also-check-lock-change-by-SO_-.patch index fcc7425..17807ce 100644 --- a/0040-zdtm-make-sock_opts02-also-check-lock-change-by-SO_-.patch +++ b/0035-zdtm-make-sock_opts02-also-check-lock-change-by-SO_-.patch @@ -1,7 +1,7 @@ -From b4cc85671010c1d99659e3ed90b3f03c415e5f8a Mon Sep 17 00:00:00 2001 +From 7168eac9043df54efba6a892ae4e1578ebb9c5c8 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Tue, 3 Aug 2021 13:05:32 +0300 -Subject: [PATCH 040/120] zdtm: make sock_opts02 also check lock change by +Subject: [PATCH 035/245] zdtm: make sock_opts02 also check lock change by SO_*BUF* Reviewed-by: Alexander Mikhalitsyn @@ -111,5 +111,5 @@ index 21a81a28f..7ea98744a 100644 } } -- -2.34.1 +2.35.1 diff --git a/0041-clang-format-enable-AlignTrailingComments.patch b/0036-clang-format-enable-AlignTrailingComments.patch similarity index 98% rename from 0041-clang-format-enable-AlignTrailingComments.patch rename to 0036-clang-format-enable-AlignTrailingComments.patch index f6baa5b..1c278d1 100644 --- a/0041-clang-format-enable-AlignTrailingComments.patch +++ b/0036-clang-format-enable-AlignTrailingComments.patch @@ -1,7 +1,7 @@ -From 78723d0b5747134ef4b6fe2663fbcfc2b4737e89 Mon Sep 17 00:00:00 2001 +From 0b5a590b0522207411d0439f958b1a8fcfbd4cba Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 28 Oct 2021 17:15:52 +0300 -Subject: [PATCH 041/120] clang-format: enable AlignTrailingComments +Subject: [PATCH 036/245] clang-format: enable AlignTrailingComments Code becomes much more human-readable after enabling it. @@ -169,5 +169,5 @@ index c9006c518..0e9545f2d 100755 + s,AlignTrailingComments: false,AlignTrailingComments: true,g; " > .clang-format -- -2.34.1 +2.35.1 diff --git a/0042-clang-format-do-several-manual-comment-fixups.patch b/0037-clang-format-do-several-manual-comment-fixups.patch similarity index 97% rename from 0042-clang-format-do-several-manual-comment-fixups.patch rename to 0037-clang-format-do-several-manual-comment-fixups.patch index 1837b37..e6d45ef 100644 --- a/0042-clang-format-do-several-manual-comment-fixups.patch +++ b/0037-clang-format-do-several-manual-comment-fixups.patch @@ -1,7 +1,7 @@ -From 8e8870f6772d61089b98863fcc93e7968ea7a74c Mon Sep 17 00:00:00 2001 +From ffa271086ac15e18203d64611afff81b4c9d2ab3 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 28 Oct 2021 17:17:44 +0300 -Subject: [PATCH 042/120] clang-format: do several manual comment fixups +Subject: [PATCH 037/245] clang-format: do several manual comment fixups Automatic AlignTrailingComments fails to make those comments look right, so let's do it manually, so that they both satisfy AlignTrailingComments @@ -165,5 +165,5 @@ index 98241d816..4273951ae 100644 size_t shm_ctlmax; size_t shm_ctlall; -- -2.34.1 +2.35.1 diff --git a/0043-clang-format-do-automatic-comment-fixups.patch b/0038-clang-format-do-automatic-comment-fixups.patch similarity index 99% rename from 0043-clang-format-do-automatic-comment-fixups.patch rename to 0038-clang-format-do-automatic-comment-fixups.patch index 62c25f5..81e4774 100644 --- a/0043-clang-format-do-automatic-comment-fixups.patch +++ b/0038-clang-format-do-automatic-comment-fixups.patch @@ -1,7 +1,7 @@ -From 94ce85cfcb0a780e3698c1d808725f25a02ad73f Mon Sep 17 00:00:00 2001 +From 913b7e1987c76e61c8fa2eda8e37fbf4cac4855e Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 28 Oct 2021 18:10:14 +0300 -Subject: [PATCH 043/120] clang-format: do automatic comment fixups +Subject: [PATCH 038/245] clang-format: do automatic comment fixups Result of `make indent` after enabling AlignTrailingComments. @@ -788,7 +788,7 @@ index 940f62246..ecc99f116 100644 new = 0; diff --git a/criu/files-reg.c b/criu/files-reg.c -index 2b0347575..679477c1c 100644 +index ee54d1d7d..e330466f6 100644 --- a/criu/files-reg.c +++ b/criu/files-reg.c @@ -2236,8 +2236,8 @@ static struct filemap_ctx ctx; @@ -1885,5 +1885,5 @@ index bf6344f1c..ee10c8004 100644 int *pids; -- -2.34.1 +2.35.1 diff --git a/0044-cr-dump-fail-dumping-when-zombie-process-with-sid-0.patch b/0039-cr-dump-fail-dumping-when-zombie-process-with-sid-0.patch similarity index 86% rename from 0044-cr-dump-fail-dumping-when-zombie-process-with-sid-0.patch rename to 0039-cr-dump-fail-dumping-when-zombie-process-with-sid-0.patch index 7e15ba7..9e6aeac 100644 --- a/0044-cr-dump-fail-dumping-when-zombie-process-with-sid-0.patch +++ b/0039-cr-dump-fail-dumping-when-zombie-process-with-sid-0.patch @@ -1,7 +1,7 @@ -From 688149930abd96fd9e1db4ee3b67c727bab4f3d8 Mon Sep 17 00:00:00 2001 +From c26f1f39b4371605ebf0ae5c5dacbdb2ad142ccd Mon Sep 17 00:00:00 2001 From: Liu Hua Date: Mon, 1 Nov 2021 20:50:58 +0800 -Subject: [PATCH 044/120] cr-dump: fail dumping when zombie process with sid 0 +Subject: [PATCH 039/245] cr-dump: fail dumping when zombie process with sid 0 A zombie process with 0 sid has a session leader in outer pidns and has ignored SIGHUP. Criu has no idea @@ -31,5 +31,5 @@ index ecc99f116..c972e343a 100644 goto err; } -- -2.34.1 +2.35.1 diff --git a/0045-clang-format-make-x86_ins_capability_mask-human-read.patch b/0040-clang-format-make-x86_ins_capability_mask-human-read.patch similarity index 98% rename from 0045-clang-format-make-x86_ins_capability_mask-human-read.patch rename to 0040-clang-format-make-x86_ins_capability_mask-human-read.patch index a362d89..da73336 100644 --- a/0045-clang-format-make-x86_ins_capability_mask-human-read.patch +++ b/0040-clang-format-make-x86_ins_capability_mask-human-read.patch @@ -1,7 +1,7 @@ -From fef55d6b7cafddc13ecc29920b9726406f820ee6 Mon Sep 17 00:00:00 2001 +From baed4b2d5783c9670a29292a228b4b491a20f2f2 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Fri, 29 Oct 2021 10:35:28 +0300 -Subject: [PATCH 045/120] clang-format: make x86_ins_capability_mask +Subject: [PATCH 040/245] clang-format: make x86_ins_capability_mask human-readable There is no option in clang not to merge as much binary operands as it @@ -172,5 +172,5 @@ index d02f4abd5..b3a7ca636 100644 #undef __ins_bit -- -2.34.1 +2.35.1 diff --git a/0046-ci-disable-socket-raw-test-on-centos8.patch b/0041-ci-disable-socket-raw-test-on-centos8.patch similarity index 91% rename from 0046-ci-disable-socket-raw-test-on-centos8.patch rename to 0041-ci-disable-socket-raw-test-on-centos8.patch index 4be53b6..ec3b008 100644 --- a/0046-ci-disable-socket-raw-test-on-centos8.patch +++ b/0041-ci-disable-socket-raw-test-on-centos8.patch @@ -1,7 +1,7 @@ -From 268bd349a2eea76ab18763bc56c12d5a69a2a51d Mon Sep 17 00:00:00 2001 +From 223d0ca7aa2de6cbde1ffe6b3f453352e2eb7c8c Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Fri, 19 Nov 2021 10:08:37 +0300 -Subject: [PATCH 046/120] ci: disable socket-raw test on centos8 +Subject: [PATCH 041/245] ci: disable socket-raw test on centos8 We see error in centos8 ci on restore of socket-raw test: @@ -40,5 +40,5 @@ index 671178d8b..235b9821e 100644 task: name: CentOS 7 based test -- -2.34.1 +2.35.1 diff --git a/0047-zdtm.py-make-tests-with-link_remap-exclusive.patch b/0042-zdtm.py-make-tests-with-link_remap-exclusive.patch similarity index 93% rename from 0047-zdtm.py-make-tests-with-link_remap-exclusive.patch rename to 0042-zdtm.py-make-tests-with-link_remap-exclusive.patch index 66b0715..8c290d5 100644 --- a/0047-zdtm.py-make-tests-with-link_remap-exclusive.patch +++ b/0042-zdtm.py-make-tests-with-link_remap-exclusive.patch @@ -1,7 +1,7 @@ -From 014e4f3002a5b5f01f619252cd0b1b1f4632aa9b Mon Sep 17 00:00:00 2001 +From 4210c29859bd25ded46a83e586ae956d98c79971 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Wed, 3 Nov 2021 18:34:11 +0300 -Subject: [PATCH 047/120] zdtm.py: make tests with --link_remap exclusive +Subject: [PATCH 042/245] zdtm.py: make tests with --link_remap exclusive We see that tests mntns_ghost01 and unlink_fstat03 can run simultaneousely and thus the former sees leftover link_remap.* files in @@ -56,5 +56,5 @@ index fc7b8a183..b62136e96 100755 def __wait_one(self, flags): -- -2.34.1 +2.35.1 diff --git a/0048-tests-improve-the-deterministic-behavior-of-the-test.patch b/0043-tests-improve-the-deterministic-behavior-of-the-test.patch similarity index 96% rename from 0048-tests-improve-the-deterministic-behavior-of-the-test.patch rename to 0043-tests-improve-the-deterministic-behavior-of-the-test.patch index 733c135..52a0386 100644 --- a/0048-tests-improve-the-deterministic-behavior-of-the-test.patch +++ b/0043-tests-improve-the-deterministic-behavior-of-the-test.patch @@ -1,7 +1,7 @@ -From fd48f1ae384a4be34f45cbd10c7fd5525fffe2e7 Mon Sep 17 00:00:00 2001 +From 6e835673838d54caca7fd039598ef3c4afecfbc6 Mon Sep 17 00:00:00 2001 From: Nicolas Viennot Date: Fri, 29 Oct 2021 03:01:14 +0000 -Subject: [PATCH 048/120] tests: improve the deterministic behavior of the test +Subject: [PATCH 043/245] tests: improve the deterministic behavior of the test suite Various I/O objects are unclosed when the object falls out of scope. @@ -104,5 +104,5 @@ index b62136e96..b98770079 100755 -- -2.34.1 +2.35.1 diff --git a/0049-clang-format-zdtm-fix-clang-complains-about-strange-.patch b/0044-clang-format-zdtm-fix-clang-complains-about-strange-.patch similarity index 95% rename from 0049-clang-format-zdtm-fix-clang-complains-about-strange-.patch rename to 0044-clang-format-zdtm-fix-clang-complains-about-strange-.patch index dd14e04..de7040c 100644 --- a/0049-clang-format-zdtm-fix-clang-complains-about-strange-.patch +++ b/0044-clang-format-zdtm-fix-clang-complains-about-strange-.patch @@ -1,7 +1,7 @@ -From d4ae0b77f9ff0380e9766d1a4e0301b1d1521da3 Mon Sep 17 00:00:00 2001 +From ecbcbce3f0e2fb6af3d33700352eb626edb63783 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Tue, 23 Nov 2021 15:06:03 +0300 -Subject: [PATCH 049/120] clang-format/zdtm: fix clang complains about strange +Subject: [PATCH 044/245] clang-format/zdtm: fix clang complains about strange elseifs Clang-format v13 on my Fedora 35 complains about these hunks, more over @@ -95,5 +95,5 @@ index 1929dac19..c95f3d84c 100644 if (signal(SIGSEGV, SIG_DFL) == SIG_ERR) { -- -2.34.1 +2.35.1 diff --git a/0050-seize-restore-cgroup-freezer-to-right-state.patch b/0045-seize-restore-cgroup-freezer-to-right-state.patch similarity index 93% rename from 0050-seize-restore-cgroup-freezer-to-right-state.patch rename to 0045-seize-restore-cgroup-freezer-to-right-state.patch index bdc37cf..7450269 100644 --- a/0050-seize-restore-cgroup-freezer-to-right-state.patch +++ b/0045-seize-restore-cgroup-freezer-to-right-state.patch @@ -1,7 +1,7 @@ -From 5643067ce662e5ca1730f36e209f17eaf6818f90 Mon Sep 17 00:00:00 2001 +From b7b727c7a97083f17ee12a5690c60e44b4abb52c Mon Sep 17 00:00:00 2001 From: Liu Hua Date: Fri, 5 Nov 2021 17:08:51 +0800 -Subject: [PATCH 050/120] seize: restore cgroup freezer to right state +Subject: [PATCH 045/245] seize: restore cgroup freezer to right state The new freezer_state is a complete equivalent of old freezer_thawed except for the initial value. If old freezer_thawed was not initialized @@ -68,5 +68,5 @@ index 95bf9ef0c..58564ca74 100644 if (close(fd)) { -- -2.34.1 +2.35.1 diff --git a/0051-ci-Use-latest-Fedora-for-lint-ci-runs-again.patch b/0046-ci-Use-latest-Fedora-for-lint-ci-runs-again.patch similarity index 87% rename from 0051-ci-Use-latest-Fedora-for-lint-ci-runs-again.patch rename to 0046-ci-Use-latest-Fedora-for-lint-ci-runs-again.patch index 8916f9d..440de7c 100644 --- a/0051-ci-Use-latest-Fedora-for-lint-ci-runs-again.patch +++ b/0046-ci-Use-latest-Fedora-for-lint-ci-runs-again.patch @@ -1,7 +1,7 @@ -From def608a7fefd89ccac455da7a966ad7cd766398c Mon Sep 17 00:00:00 2001 +From 985c6c5f10872bade13f7085bd0eaeaef1ea648a Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Wed, 24 Nov 2021 11:37:58 +0300 -Subject: [PATCH 051/120] ci: Use latest Fedora for lint ci runs again +Subject: [PATCH 046/245] ci: Use latest Fedora for lint ci runs again Now when we fixed clang-format complains in zdtm, let's switch to lates clang-format available. This is effectively a revert of commit 07a2f0265 @@ -26,5 +26,5 @@ index 49eb6aaac..50b241e9f 100644 - name: Install tools run: sudo dnf -y install git make python3-flake8 ShellCheck clang-tools-extra which findutils -- -2.34.1 +2.35.1 diff --git a/0052-crtools-ignore-SIGPIPE-in-swrk-mode.patch b/0047-crtools-ignore-SIGPIPE-in-swrk-mode.patch similarity index 94% rename from 0052-crtools-ignore-SIGPIPE-in-swrk-mode.patch rename to 0047-crtools-ignore-SIGPIPE-in-swrk-mode.patch index d31c470..8d3d112 100644 --- a/0052-crtools-ignore-SIGPIPE-in-swrk-mode.patch +++ b/0047-crtools-ignore-SIGPIPE-in-swrk-mode.patch @@ -1,7 +1,7 @@ -From 983464ffad11a0f8c5656492f3c342139acd2527 Mon Sep 17 00:00:00 2001 +From 9c9eb25ff627f6a7ec272269983041b0594c2779 Mon Sep 17 00:00:00 2001 From: Liu Hua Date: Thu, 4 Nov 2021 10:04:22 +0800 -Subject: [PATCH 052/120] crtools: ignore SIGPIPE in swrk mode +Subject: [PATCH 047/245] crtools: ignore SIGPIPE in swrk mode Criu ignores SIGPIPE in most cases except swrk mode. And in the following situtation criu get killed by SIGPIPE and have no chance @@ -68,5 +68,5 @@ index 6a75cd1ea..81c0aa963 100644 * When a process group becomes an orphan, * its processes are sent a SIGHUP signal -- -2.34.1 +2.35.1 diff --git a/0053-ci-switch-to-centos-stream-8.patch b/0048-ci-switch-to-centos-stream-8.patch similarity index 83% rename from 0053-ci-switch-to-centos-stream-8.patch rename to 0048-ci-switch-to-centos-stream-8.patch index 7eb543f..758944d 100644 --- a/0053-ci-switch-to-centos-stream-8.patch +++ b/0048-ci-switch-to-centos-stream-8.patch @@ -1,7 +1,7 @@ -From 21873e0efd64f023a0d7b472ceca1f394f83e58e Mon Sep 17 00:00:00 2001 +From c80d6aab7f205be069e2b46dbd8abc3ca910d336 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Wed, 24 Nov 2021 16:13:01 +0000 -Subject: [PATCH 053/120] ci: switch to centos-stream-8 +Subject: [PATCH 048/245] ci: switch to centos-stream-8 CentOS 8 goes EOL at the end of 2021. This switches our CentOS 8 based tests to CentOS Stream 8 which should be supported until 2024. @@ -25,5 +25,5 @@ index 235b9821e..ef0de54e9 100644 cpu: 4 memory: 8G -- -2.34.1 +2.35.1 diff --git a/0054-check-cleanup-child-processes.patch b/0049-check-cleanup-child-processes.patch similarity index 92% rename from 0054-check-cleanup-child-processes.patch rename to 0049-check-cleanup-child-processes.patch index 74a9322..100b2d5 100644 --- a/0054-check-cleanup-child-processes.patch +++ b/0049-check-cleanup-child-processes.patch @@ -1,7 +1,7 @@ -From 6754b16c2e95766493ac27e4122a3b63867133f5 Mon Sep 17 00:00:00 2001 +From 75efde9dfaace269db69465e838aab58124a66b6 Mon Sep 17 00:00:00 2001 From: Nicolas Viennot Date: Fri, 19 Nov 2021 20:58:13 +0000 -Subject: [PATCH 054/120] check: cleanup child processes +Subject: [PATCH 049/245] check: cleanup child processes Always wait() for forked child processes. It avoid zombie processes in containers that don't have an init process reaping orphans. @@ -64,5 +64,5 @@ index e46c93815..0320b445a 100644 } -- -2.34.1 +2.35.1 diff --git a/0055-files-reg-fix-error-handling-in-open_path.patch b/0050-files-reg-fix-error-handling-in-open_path.patch similarity index 96% rename from 0055-files-reg-fix-error-handling-in-open_path.patch rename to 0050-files-reg-fix-error-handling-in-open_path.patch index 54c3d97..f2e6b81 100644 --- a/0055-files-reg-fix-error-handling-in-open_path.patch +++ b/0050-files-reg-fix-error-handling-in-open_path.patch @@ -1,7 +1,7 @@ -From ae3bf06242d6a8bb2a9946cba4ace96e202ee3f4 Mon Sep 17 00:00:00 2001 +From cfd4d1fb786306658336d98b02d421b2ec925d4c Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 13 Feb 2020 10:43:14 +0300 -Subject: [PATCH 055/120] files-reg: fix error handling in open_path +Subject: [PATCH 050/245] files-reg: fix error handling in open_path 1) On error paths need to close fd and unlock mutex. 2) Make rfi_remap return special return code to identify EEXIST from @@ -20,7 +20,7 @@ Signed-off-by: Pavel Tikhomirov 1 file changed, 31 insertions(+), 16 deletions(-) diff --git a/criu/files-reg.c b/criu/files-reg.c -index 679477c1c..4560f253e 100644 +index e330466f6..96ec82c73 100644 --- a/criu/files-reg.c +++ b/criu/files-reg.c @@ -1867,6 +1867,9 @@ out: @@ -152,5 +152,5 @@ index 679477c1c..4560f253e 100644 int do_open_reg_noseek_flags(int ns_root_fd, struct reg_file_info *rfi, void *arg) -- -2.34.1 +2.35.1 diff --git a/0056-files-reg-fix-error-handling-of-rm_parent_dirs.patch b/0051-files-reg-fix-error-handling-of-rm_parent_dirs.patch similarity index 94% rename from 0056-files-reg-fix-error-handling-of-rm_parent_dirs.patch rename to 0051-files-reg-fix-error-handling-of-rm_parent_dirs.patch index f1924b9..134d0a0 100644 --- a/0056-files-reg-fix-error-handling-of-rm_parent_dirs.patch +++ b/0051-files-reg-fix-error-handling-of-rm_parent_dirs.patch @@ -1,7 +1,7 @@ -From 2894e242562f3c639b6cb63f502d7445076d3db1 Mon Sep 17 00:00:00 2001 +From f9aced49154576d73810a8d12e7847d44e6b63fc Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 13 Feb 2020 13:03:12 +0300 -Subject: [PATCH 056/120] files-reg: fix error handling of rm_parent_dirs +Subject: [PATCH 051/245] files-reg: fix error handling of rm_parent_dirs If unlinkat fails it means that fs is in "corrupted" state - spoiled with non-unlinked auxiliary directories. @@ -21,7 +21,7 @@ Signed-off-by: Pavel Tikhomirov 1 file changed, 30 insertions(+), 15 deletions(-) diff --git a/criu/files-reg.c b/criu/files-reg.c -index 4560f253e..0e126a32e 100644 +index 96ec82c73..6a2ea2fe4 100644 --- a/criu/files-reg.c +++ b/criu/files-reg.c @@ -1792,30 +1792,42 @@ out: @@ -112,5 +112,5 @@ index 4560f253e..0e126a32e 100644 mutex_unlock(remap_open_lock); -- -2.34.1 +2.35.1 diff --git a/0057-ghost-mount-allocate-remounted_rw-in-shmem-to-get-in.patch b/0052-ghost-mount-allocate-remounted_rw-in-shmem-to-get-in.patch similarity index 95% rename from 0057-ghost-mount-allocate-remounted_rw-in-shmem-to-get-in.patch rename to 0052-ghost-mount-allocate-remounted_rw-in-shmem-to-get-in.patch index 6d9176b..d785b20 100644 --- a/0057-ghost-mount-allocate-remounted_rw-in-shmem-to-get-in.patch +++ b/0052-ghost-mount-allocate-remounted_rw-in-shmem-to-get-in.patch @@ -1,7 +1,7 @@ -From 0a2d380e6b9110ec809101757c243ce316f4d1bb Mon Sep 17 00:00:00 2001 +From 2eac9738a4244c007252d0537a46e9443e957210 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 13 Feb 2020 18:28:15 +0300 -Subject: [PATCH 057/120] ghost/mount: allocate remounted_rw in shmem to get +Subject: [PATCH 052/245] ghost/mount: allocate remounted_rw in shmem to get info from other processes Previousely remounted_rw was not shared between all processes on @@ -163,10 +163,10 @@ index 93725e526..d75ca5598 100644 /* diff --git a/criu/proc_parse.c b/criu/proc_parse.c -index 8a9ce3a37..094f9b84e 100644 +index f3491e781..c734fc24a 100644 --- a/criu/proc_parse.c +++ b/criu/proc_parse.c -@@ -1541,7 +1541,7 @@ struct mount_info *parse_mountinfo(pid_t pid, struct ns_id *nsid, bool for_dump) +@@ -1506,7 +1506,7 @@ struct mount_info *parse_mountinfo(pid_t pid, struct ns_id *nsid, bool for_dump) int ret = -1; char *fsname = NULL; @@ -176,5 +176,5 @@ index 8a9ce3a37..094f9b84e 100644 goto end; -- -2.34.1 +2.35.1 diff --git a/0058-files-reg-temporary-remount-writable-the-mount-we-do.patch b/0053-files-reg-temporary-remount-writable-the-mount-we-do.patch similarity index 87% rename from 0058-files-reg-temporary-remount-writable-the-mount-we-do.patch rename to 0053-files-reg-temporary-remount-writable-the-mount-we-do.patch index a0e31f2..4f3aad4 100644 --- a/0058-files-reg-temporary-remount-writable-the-mount-we-do.patch +++ b/0053-files-reg-temporary-remount-writable-the-mount-we-do.patch @@ -1,7 +1,7 @@ -From 3aca580025b38aa043f6ef82f24ecab2d2d258e9 Mon Sep 17 00:00:00 2001 +From e7f694d31fe3f94398d62c786c87391f1ff59a11 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 13 Feb 2020 18:26:52 +0300 -Subject: [PATCH 058/120] files-reg: temporary remount writable the mount we do +Subject: [PATCH 053/245] files-reg: temporary remount writable the mount we do unlink on Previousely I din't mention this case because we had bad error handling @@ -26,7 +26,7 @@ Signed-off-by: Pavel Tikhomirov 1 file changed, 5 insertions(+) diff --git a/criu/files-reg.c b/criu/files-reg.c -index 0e126a32e..57403d2c6 100644 +index 6a2ea2fe4..1224b6ac2 100644 --- a/criu/files-reg.c +++ b/criu/files-reg.c @@ -2133,6 +2133,11 @@ ext: @@ -42,5 +42,5 @@ index 0e126a32e..57403d2c6 100644 if (unlinkat(mntns_root, rfi->path, 0)) { pr_perror("Failed to unlink the remap file"); -- -2.34.1 +2.35.1 diff --git a/0059-zdtm-add-ro-mount-check-after-c-r-to-mntns_ghost01.patch b/0054-zdtm-add-ro-mount-check-after-c-r-to-mntns_ghost01.patch similarity index 90% rename from 0059-zdtm-add-ro-mount-check-after-c-r-to-mntns_ghost01.patch rename to 0054-zdtm-add-ro-mount-check-after-c-r-to-mntns_ghost01.patch index 52d3cb8..52699c5 100644 --- a/0059-zdtm-add-ro-mount-check-after-c-r-to-mntns_ghost01.patch +++ b/0054-zdtm-add-ro-mount-check-after-c-r-to-mntns_ghost01.patch @@ -1,7 +1,7 @@ -From d137057e215de10ee772852126075ce9575e908e Mon Sep 17 00:00:00 2001 +From 5e50667eaef07435f731861e701edb41e7f4b3b3 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Tue, 30 Nov 2021 19:03:29 +0300 -Subject: [PATCH 059/120] zdtm: add ro-mount check after c/r to mntns_ghost01 +Subject: [PATCH 054/245] zdtm: add ro-mount check after c/r to mntns_ghost01 This is a test for "ghost/mount: allocate remounted_rw in shmem to get info from other processes" patch, without the patch test fails with: @@ -43,5 +43,5 @@ index 20397d543..2cc2270dd 100644 } -- -2.34.1 +2.35.1 diff --git a/0060-clang-format-disable-wrong-struct-pointer-declaratio.patch b/0055-clang-format-disable-wrong-struct-pointer-declaratio.patch similarity index 95% rename from 0060-clang-format-disable-wrong-struct-pointer-declaratio.patch rename to 0055-clang-format-disable-wrong-struct-pointer-declaratio.patch index 65596ec..1b22005 100644 --- a/0060-clang-format-disable-wrong-struct-pointer-declaratio.patch +++ b/0055-clang-format-disable-wrong-struct-pointer-declaratio.patch @@ -1,7 +1,7 @@ -From bb9c27c217a9b995c101cbb2023c4084ce76a07b Mon Sep 17 00:00:00 2001 +From 6f4ddeb5201f7e0f6c330ed56e221c3c51627c19 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 25 Nov 2021 16:51:55 +0300 -Subject: [PATCH 060/120] clang-format: disable wrong struct pointer +Subject: [PATCH 055/245] clang-format: disable wrong struct pointer declaration format When we declare struct and at the same time declare variable pointer of @@ -111,5 +111,5 @@ index eb42a826e..2c5ba82c2 100644 static void signal_handler_io(int status) { -- -2.34.1 +2.35.1 diff --git a/0061-ci-Run-cross-compile-on-debian-stable.patch b/0056-ci-Run-cross-compile-on-debian-stable.patch similarity index 98% rename from 0061-ci-Run-cross-compile-on-debian-stable.patch rename to 0056-ci-Run-cross-compile-on-debian-stable.patch index de26c0d..0b9dae6 100644 --- a/0061-ci-Run-cross-compile-on-debian-stable.patch +++ b/0056-ci-Run-cross-compile-on-debian-stable.patch @@ -1,7 +1,7 @@ -From 9134e859293a3980b25cff043273be1d41ab7d53 Mon Sep 17 00:00:00 2001 +From ac3cebb2f0164a56f6e3941b82570ceb7f18985c Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Sat, 4 Dec 2021 16:18:26 +0000 -Subject: [PATCH 061/120] ci: Run cross compile on debian stable +Subject: [PATCH 056/245] ci: Run cross compile on debian stable The current debian stable release is Bullseye, not Buster. However, we can use the 'stable' release instead. This would allow the CI to @@ -177,5 +177,5 @@ index 62e3a9920..a436c2839 100644 TARGETS := $(ARCHES) alpine archlinux TARGETS_CLANG := $(addsuffix $(TARGETS),-clang) -- -2.34.1 +2.35.1 diff --git a/0062-ci-Run-cross-compile-with-debian-testing.patch b/0057-ci-Run-cross-compile-with-debian-testing.patch similarity index 98% rename from 0062-ci-Run-cross-compile-with-debian-testing.patch rename to 0057-ci-Run-cross-compile-with-debian-testing.patch index af00285..1f1bc76 100644 --- a/0062-ci-Run-cross-compile-with-debian-testing.patch +++ b/0057-ci-Run-cross-compile-with-debian-testing.patch @@ -1,7 +1,7 @@ -From e16ea6a3c23fb8a5f0ed8c19052ee9b4140108cf Mon Sep 17 00:00:00 2001 +From 1f497887c18e123925a759cc4079009c5a0224da Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Sat, 4 Dec 2021 16:31:34 +0000 -Subject: [PATCH 062/120] ci: Run cross compile with debian testing +Subject: [PATCH 057/245] ci: Run cross compile with debian testing Debian testing has newer compiler version and running cross compilation tests would allow us to catch any compilation @@ -193,5 +193,5 @@ index a436c2839..b24fc80ea 100644 TARGETS := $(ARCHES) alpine archlinux TARGETS_CLANG := $(addsuffix $(TARGETS),-clang) -- -2.34.1 +2.35.1 diff --git a/0063-make-Explicitly-enable-FPU-on-ARMv7-builds.patch b/0058-make-Explicitly-enable-FPU-on-ARMv7-builds.patch similarity index 89% rename from 0063-make-Explicitly-enable-FPU-on-ARMv7-builds.patch rename to 0058-make-Explicitly-enable-FPU-on-ARMv7-builds.patch index 79084c6..596aff9 100644 --- a/0063-make-Explicitly-enable-FPU-on-ARMv7-builds.patch +++ b/0058-make-Explicitly-enable-FPU-on-ARMv7-builds.patch @@ -1,7 +1,7 @@ -From 8887dfb9174a42b699b1fde2dbf9033f66c8363b Mon Sep 17 00:00:00 2001 +From 0e25a6d2bb43abb2cab4716169dfa34a0c005f4c Mon Sep 17 00:00:00 2001 From: Salvatore Bonaccorso Date: Sat, 4 Dec 2021 16:59:51 +0000 -Subject: [PATCH 063/120] make: Explicitly enable FPU on ARMv7 builds +Subject: [PATCH 058/245] make: Explicitly enable FPU on ARMv7 builds Starting with gcc-11, Debian's armhf compiler no longer builds with a default -mfpu= option. Instead it enables the FPU via an extension @@ -18,7 +18,7 @@ Signed-off-by: Radostin Stoyanov 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile -index d35012615..c0d008371 100644 +index c0b8b7e54..f08d9be3a 100644 --- a/Makefile +++ b/Makefile @@ -39,7 +39,7 @@ ifeq ($(ARCH),arm) @@ -44,5 +44,5 @@ index 69154fdc9..d34523315 100644 # To build aarch32 on armv8 Travis-CI (see criu Makefile) USERCFLAGS += -march=armv7-a -- -2.34.1 +2.35.1 diff --git a/0064-ci-disable-broken-tests-until-fixed.patch b/0059-ci-disable-broken-tests-until-fixed.patch similarity index 95% rename from 0064-ci-disable-broken-tests-until-fixed.patch rename to 0059-ci-disable-broken-tests-until-fixed.patch index c90b156..609ee65 100644 --- a/0064-ci-disable-broken-tests-until-fixed.patch +++ b/0059-ci-disable-broken-tests-until-fixed.patch @@ -1,7 +1,7 @@ -From e7efdffa340d0169b4fb18d9ebba214f546ade5d Mon Sep 17 00:00:00 2001 +From b7c9aa86039a8179e956de31965a3ffd468135da Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Fri, 3 Dec 2021 16:48:36 +0000 -Subject: [PATCH 064/120] ci: disable broken tests until fixed +Subject: [PATCH 059/245] ci: disable broken tests until fixed Broken tests are being tracked at @@ -55,5 +55,5 @@ index a8c3a5cf7..bff40aed5 100755 # without restore (that will check if parasite corrupts extended registers) ./test/zdtm.py run -t zdtm/static/fpu03 --fault 134 -f h --norst || fail -- -2.34.1 +2.35.1 diff --git a/0065-test-do-not-use-keep-going-for-single-zdtm-tests.patch b/0060-test-do-not-use-keep-going-for-single-zdtm-tests.patch similarity index 97% rename from 0065-test-do-not-use-keep-going-for-single-zdtm-tests.patch rename to 0060-test-do-not-use-keep-going-for-single-zdtm-tests.patch index d28c641..51e2ffa 100644 --- a/0065-test-do-not-use-keep-going-for-single-zdtm-tests.patch +++ b/0060-test-do-not-use-keep-going-for-single-zdtm-tests.patch @@ -1,7 +1,7 @@ -From 3b81160c57cde29450d27edb383deb6e19188dbf Mon Sep 17 00:00:00 2001 +From f64eb15e2380185fcf3c01dc6630acbe6c3053f6 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Sun, 5 Dec 2021 16:45:20 +0000 -Subject: [PATCH 065/120] test: do not use --keep-going for single zdtm tests +Subject: [PATCH 060/245] test: do not use --keep-going for single zdtm tests Looking at CI logs there are often messages like: @@ -97,5 +97,5 @@ index ca5054f5e..81395b7ba 100755 +./test/zdtm.py run -t zdtm/transition/thread-bomb -f h --report report --freezecg zdtm:t --pre 3 || fail +./test/zdtm.py run -t zdtm/transition/thread-bomb -f h --report report --freezecg zdtm:t --norst || fail -- -2.34.1 +2.35.1 diff --git a/0066-files-reg-try-dump_ghost_remap-if-link-remap-failed-.patch b/0061-files-reg-try-dump_ghost_remap-if-link-remap-failed-.patch similarity index 96% rename from 0066-files-reg-try-dump_ghost_remap-if-link-remap-failed-.patch rename to 0061-files-reg-try-dump_ghost_remap-if-link-remap-failed-.patch index 258818a..643a16c 100644 --- a/0066-files-reg-try-dump_ghost_remap-if-link-remap-failed-.patch +++ b/0061-files-reg-try-dump_ghost_remap-if-link-remap-failed-.patch @@ -1,7 +1,7 @@ -From 94d3c9694f16342e52afe1f3de7077bac9eaf198 Mon Sep 17 00:00:00 2001 +From 3cf39aafb1dcdbcd3c39411a2c6834858860716c Mon Sep 17 00:00:00 2001 From: ianlang Date: Fri, 3 Dec 2021 15:15:30 +0800 -Subject: [PATCH 066/120] files-reg: try dump_ghost_remap if link-remap failed +Subject: [PATCH 061/245] files-reg: try dump_ghost_remap if link-remap failed with error ENOENT An issue with dumping deleted reg files in overlayfs: @@ -17,7 +17,7 @@ Signed-off-by: langyenan 2 files changed, 40 insertions(+), 6 deletions(-) diff --git a/criu/files-reg.c b/criu/files-reg.c -index 57403d2c6..6759e00e5 100644 +index 1224b6ac2..141843a7a 100644 --- a/criu/files-reg.c +++ b/criu/files-reg.c @@ -959,7 +959,25 @@ void free_link_remaps(void) @@ -133,5 +133,5 @@ index 46ac8aa27..ad34f4891 100644 + #endif /* __CR_FS_MAGIC_H__ */ -- -2.34.1 +2.35.1 diff --git a/0067-util-make-page-server-IPv6-safe.patch b/0062-util-make-page-server-IPv6-safe.patch similarity index 92% rename from 0067-util-make-page-server-IPv6-safe.patch rename to 0062-util-make-page-server-IPv6-safe.patch index 4e5ce61..c6b92fb 100644 --- a/0067-util-make-page-server-IPv6-safe.patch +++ b/0062-util-make-page-server-IPv6-safe.patch @@ -1,7 +1,7 @@ -From b9ae48172fff77d41b5cf19d334ccbe002ac0686 Mon Sep 17 00:00:00 2001 +From 047d277ff49bfbe3ff7baaedb9b7e37faadd6341 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Tue, 7 Dec 2021 09:10:14 +0000 -Subject: [PATCH 067/120] util: make page-server IPv6 safe +Subject: [PATCH 062/245] util: make page-server IPv6 safe The function run_tcp_server() was the last place CRIU was still using the IPv4 only function inet_ntoa(). It was only used during a print, so @@ -59,5 +59,5 @@ index 2917102fd..822822186 100644 } -- -2.34.1 +2.35.1 diff --git a/0068-sk-unix-Fix-TCP_ESTABLISHED-checks-in-unix-sockets.patch b/0063-sk-unix-Fix-TCP_ESTABLISHED-checks-in-unix-sockets.patch similarity index 92% rename from 0068-sk-unix-Fix-TCP_ESTABLISHED-checks-in-unix-sockets.patch rename to 0063-sk-unix-Fix-TCP_ESTABLISHED-checks-in-unix-sockets.patch index 58c9fe2..6d6e2be 100644 --- a/0068-sk-unix-Fix-TCP_ESTABLISHED-checks-in-unix-sockets.patch +++ b/0063-sk-unix-Fix-TCP_ESTABLISHED-checks-in-unix-sockets.patch @@ -1,7 +1,7 @@ -From 4cf1336062e06a4d042771d59eac851ea7273a15 Mon Sep 17 00:00:00 2001 +From 1470c8037319d2a59eb557ed55175df6abe23eaa Mon Sep 17 00:00:00 2001 From: Bui Quang Minh Date: Thu, 2 Dec 2021 23:01:33 +0700 -Subject: [PATCH 068/120] sk-unix: Fix TCP_ESTABLISHED checks in unix sockets +Subject: [PATCH 063/245] sk-unix: Fix TCP_ESTABLISHED checks in unix sockets Since commit 83301b5367a98 ("af_unix: Set TCP_ESTABLISHED for datagram sockets too") in Linux kernel, SOCK_DGRAM unix sockets can have TCP_ESTABLISHED state @@ -44,5 +44,5 @@ index a819473b4..d3402c3ac 100644 pr_err("Wrong shutdown/peer state for %u\n", ui->ue->ino); return -1; -- -2.34.1 +2.35.1 diff --git a/0069-ci-Enable-disabled-unix-socket-related-tests.patch b/0064-ci-Enable-disabled-unix-socket-related-tests.patch similarity index 91% rename from 0069-ci-Enable-disabled-unix-socket-related-tests.patch rename to 0064-ci-Enable-disabled-unix-socket-related-tests.patch index 8041d45..06e9515 100644 --- a/0069-ci-Enable-disabled-unix-socket-related-tests.patch +++ b/0064-ci-Enable-disabled-unix-socket-related-tests.patch @@ -1,7 +1,7 @@ -From 1cfca8ec896ed84a6ab8878489854fe0529e14a5 Mon Sep 17 00:00:00 2001 +From 677a6adba8234c5626fb9595fd32de61ae2b71bc Mon Sep 17 00:00:00 2001 From: Bui Quang Minh Date: Tue, 7 Dec 2021 23:40:12 +0700 -Subject: [PATCH 069/120] ci: Enable disabled unix socket related tests +Subject: [PATCH 064/245] ci: Enable disabled unix socket related tests As the unix socket broken tests have been fixed in the pull request @@ -30,5 +30,5 @@ index 25343f96c..40c8416e1 100755 # It is also skipped from -a because it runs in RPC mode only ssh default 'cd /vagrant/criu/test; sudo ./zdtm.py run -t zdtm/transition/pidfd_store_sk --rpc --pre 2' -- -2.34.1 +2.35.1 diff --git a/0070-ci-install-procps-in-Alpine.patch b/0065-ci-install-procps-in-Alpine.patch similarity index 84% rename from 0070-ci-install-procps-in-Alpine.patch rename to 0065-ci-install-procps-in-Alpine.patch index 95197f8..499068e 100644 --- a/0070-ci-install-procps-in-Alpine.patch +++ b/0065-ci-install-procps-in-Alpine.patch @@ -1,7 +1,7 @@ -From 010016dc43cd6fec27ba27c636cfd7aa02549433 Mon Sep 17 00:00:00 2001 +From 1ec95e91a54670cb30308700bd29085e86668eb0 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Fri, 10 Dec 2021 15:35:29 +0000 -Subject: [PATCH 070/120] ci: install procps in Alpine +Subject: [PATCH 065/245] ci: install procps in Alpine The version of ps in Alpine image by default is very limited. It is based on the one from busybox and doesn't support options @@ -25,5 +25,5 @@ index a6579c0bb..cab72e8a1 100644 gnutls-dev \ libaio-dev \ -- -2.34.1 +2.35.1 diff --git a/0071-test-another-try-to-correctly-fix-the-kernel-version.patch b/0066-test-another-try-to-correctly-fix-the-kernel-version.patch similarity index 88% rename from 0071-test-another-try-to-correctly-fix-the-kernel-version.patch rename to 0066-test-another-try-to-correctly-fix-the-kernel-version.patch index 65cb863..a24b3a8 100644 --- a/0071-test-another-try-to-correctly-fix-the-kernel-version.patch +++ b/0066-test-another-try-to-correctly-fix-the-kernel-version.patch @@ -1,7 +1,7 @@ -From 1ddc8a3dca2881bef56855bb7741e8814c3753f6 Mon Sep 17 00:00:00 2001 +From 3b2d70bd75dbd2de8887b00d5e6e4e5a5bbda850 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Fri, 3 Dec 2021 16:59:56 +0000 -Subject: [PATCH 071/120] test: another try to correctly fix the kernel version +Subject: [PATCH 066/245] test: another try to correctly fix the kernel version We try to disable time namespace based testing for kernels older than 5.11. But we fail to come up with the correct if condition. @@ -30,5 +30,5 @@ index e8d45a9e7..e4b17a512 100644 return 0; } -- -2.34.1 +2.35.1 diff --git a/0072-x86-compel-fault-inject-bound-xsave-features-set.patch b/0067-x86-compel-fault-inject-bound-xsave-features-set.patch similarity index 95% rename from 0072-x86-compel-fault-inject-bound-xsave-features-set.patch rename to 0067-x86-compel-fault-inject-bound-xsave-features-set.patch index aef5330..f0f64f4 100644 --- a/0072-x86-compel-fault-inject-bound-xsave-features-set.patch +++ b/0067-x86-compel-fault-inject-bound-xsave-features-set.patch @@ -1,7 +1,7 @@ -From b270ce214216d6b74d8e3a6e9c6cbfc0c6ffbddd Mon Sep 17 00:00:00 2001 +From 648babc34a25899a0d29f989d1cdcfb2191a872a Mon Sep 17 00:00:00 2001 From: Alexander Mikhalitsyn Date: Mon, 13 Dec 2021 15:19:50 +0300 -Subject: [PATCH 072/120] x86/compel/fault-inject: bound xsave features set +Subject: [PATCH 067/245] x86/compel/fault-inject: bound xsave features set Since e2e8be37 ("x86/compel/fault-inject: Add a fault-injection for corrupting extended regset") @@ -55,5 +55,5 @@ index 2f6c557d0..37b0ee327 100644 for (i = 0; i < XFEATURE_MAX; i++) { if (!compel_fpu_has_feature(i)) -- -2.34.1 +2.35.1 diff --git a/0073-x86-compel-fault-inject-print-the-initial-seed.patch b/0068-x86-compel-fault-inject-print-the-initial-seed.patch similarity index 91% rename from 0073-x86-compel-fault-inject-print-the-initial-seed.patch rename to 0068-x86-compel-fault-inject-print-the-initial-seed.patch index c1564c4..523b21d 100644 --- a/0073-x86-compel-fault-inject-print-the-initial-seed.patch +++ b/0068-x86-compel-fault-inject-print-the-initial-seed.patch @@ -1,7 +1,7 @@ -From ef96f75f2c84575bd5bf702f933807be4275ee40 Mon Sep 17 00:00:00 2001 +From 2d5a6e074dd245c44e7bcea37d43f69eddbf4c02 Mon Sep 17 00:00:00 2001 From: Alexander Mikhalitsyn Date: Mon, 13 Dec 2021 15:32:00 +0300 -Subject: [PATCH 073/120] x86/compel/fault-inject: print the initial seed +Subject: [PATCH 068/245] x86/compel/fault-inject: print the initial seed Fixes: e2e8be37 ("x86/compel/fault-inject: Add a fault-injection for corrupting extended regset") @@ -37,5 +37,5 @@ index 37b0ee327..de9013c27 100644 if (!use_xsave) { if (ptrace(PTRACE_SETFPREGS, pid, NULL, &ext_regs)) { -- -2.34.1 +2.35.1 diff --git a/0074-ci-enable-x86-xsave-fault-injection-tests-back.patch b/0069-ci-enable-x86-xsave-fault-injection-tests-back.patch similarity index 89% rename from 0074-ci-enable-x86-xsave-fault-injection-tests-back.patch rename to 0069-ci-enable-x86-xsave-fault-injection-tests-back.patch index 6c24bee..bf26e5b 100644 --- a/0074-ci-enable-x86-xsave-fault-injection-tests-back.patch +++ b/0069-ci-enable-x86-xsave-fault-injection-tests-back.patch @@ -1,7 +1,7 @@ -From df36ad5100646b6c3be4798da92b2c5f0b4aa37f Mon Sep 17 00:00:00 2001 +From 6b22a374016fa980d088e1d93f6330bdfa689433 Mon Sep 17 00:00:00 2001 From: Alexander Mikhalitsyn Date: Mon, 13 Dec 2021 15:46:47 +0300 -Subject: [PATCH 074/120] ci: enable x86 xsave fault injection tests back +Subject: [PATCH 069/245] ci: enable x86 xsave fault injection tests back Signed-off-by: Alexander Mikhalitsyn --- @@ -28,5 +28,5 @@ index 0c5c180e9..9f20091cc 100755 # without restore (that will check if parasite corrupts extended registers) ./test/zdtm.py run -t zdtm/static/fpu03 --fault 134 -f h --norst || fail -- -2.34.1 +2.35.1 diff --git a/0075-Add-documentation-for-timeout-option.patch b/0070-Add-documentation-for-timeout-option.patch similarity index 93% rename from 0075-Add-documentation-for-timeout-option.patch rename to 0070-Add-documentation-for-timeout-option.patch index 0d93e7b..a5b491f 100644 --- a/0075-Add-documentation-for-timeout-option.patch +++ b/0070-Add-documentation-for-timeout-option.patch @@ -1,7 +1,7 @@ -From 70f20b4460654df0c013f7252365554dc857615b Mon Sep 17 00:00:00 2001 +From 11c6077ebb5e57569844818f104514fa1ba60af1 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Tue, 14 Dec 2021 12:54:19 +0000 -Subject: [PATCH 075/120] Add documentation for --timeout option +Subject: [PATCH 070/245] Add documentation for --timeout option The --timeout option was introduced in [1] to prevent criu dump from being able to hang indefinitely and allow users to adjust the time limit @@ -44,5 +44,5 @@ index 81c0aa963..da47bd684 100644 " --irmap-scan-path FILE\n" " add a path the irmap hints to scan\n" -- -2.34.1 +2.35.1 diff --git a/0076-usernsd-UNS_FDOUT-should-not-require-an-input-descri.patch b/0071-usernsd-UNS_FDOUT-should-not-require-an-input-descri.patch similarity index 86% rename from 0076-usernsd-UNS_FDOUT-should-not-require-an-input-descri.patch rename to 0071-usernsd-UNS_FDOUT-should-not-require-an-input-descri.patch index 0440722..44e3606 100644 --- a/0076-usernsd-UNS_FDOUT-should-not-require-an-input-descri.patch +++ b/0071-usernsd-UNS_FDOUT-should-not-require-an-input-descri.patch @@ -1,7 +1,7 @@ -From fc1e7788ce1cba57afc230c6219d570f5d3074ae Mon Sep 17 00:00:00 2001 +From 0c452fee7e3abb8e117bd390610f39b95069dc1b Mon Sep 17 00:00:00 2001 From: Andrei Vagin Date: Tue, 14 Dec 2021 08:19:16 -0800 -Subject: [PATCH 076/120] usernsd: UNS_FDOUT should not require an input +Subject: [PATCH 071/245] usernsd: UNS_FDOUT should not require an input descriptor UNS_FDOUT means only that a userns call will return a file descriptor. @@ -28,5 +28,5 @@ index 7fa58682b..c36e631cf 100644 * Caller has sent us bare address of the routine it * wants to call. Since the caller is fork()-ed from the -- -2.34.1 +2.35.1 diff --git a/0077-libcriu-add-setting-lsm-mount-context-to-libcriu.patch b/0072-libcriu-add-setting-lsm-mount-context-to-libcriu.patch similarity index 94% rename from 0077-libcriu-add-setting-lsm-mount-context-to-libcriu.patch rename to 0072-libcriu-add-setting-lsm-mount-context-to-libcriu.patch index 12674e9..1e39440 100644 --- a/0077-libcriu-add-setting-lsm-mount-context-to-libcriu.patch +++ b/0072-libcriu-add-setting-lsm-mount-context-to-libcriu.patch @@ -1,7 +1,7 @@ -From d67af357dfa24f646f2e8abccede1e25d4376267 Mon Sep 17 00:00:00 2001 +From b38e38b2872fcf3d00d3861d0f04a55b28c01ac4 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Wed, 1 Dec 2021 11:08:53 +0000 -Subject: [PATCH 077/120] libcriu: add setting lsm-mount-context to libcriu +Subject: [PATCH 072/245] libcriu: add setting lsm-mount-context to libcriu Signed-off-by: Adrian Reber --- @@ -63,5 +63,5 @@ index 949902f55..a374b37f8 100644 void criu_local_set_auto_ext_mnt(criu_opts *opts, bool val); void criu_local_set_ext_sharing(criu_opts *opts, bool val); -- -2.34.1 +2.35.1 diff --git a/0078-ci-use-unstable-release-for-cross-compile.patch b/0073-ci-use-unstable-release-for-cross-compile.patch similarity index 98% rename from 0078-ci-use-unstable-release-for-cross-compile.patch rename to 0073-ci-use-unstable-release-for-cross-compile.patch index fb1553b..7404f2a 100644 --- a/0078-ci-use-unstable-release-for-cross-compile.patch +++ b/0073-ci-use-unstable-release-for-cross-compile.patch @@ -1,7 +1,7 @@ -From 4b75e29f72a84780099798b2e9f5c6651069c6da Mon Sep 17 00:00:00 2001 +From 031db58a9e9439c49d93f8424b361f3618fb688d Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Sat, 18 Dec 2021 17:25:17 +0000 -Subject: [PATCH 078/120] ci: use unstable release for cross-compile +Subject: [PATCH 073/245] ci: use unstable release for cross-compile We added cross-compile tests with testing debian release to be able to replicate the error reported in #1653, however, installing build @@ -178,5 +178,5 @@ index b24fc80ea..2c006ad87 100644 TARGETS := $(ARCHES) alpine archlinux TARGETS_CLANG := $(addsuffix $(TARGETS),-clang) -- -2.34.1 +2.35.1 diff --git a/0079-ci-disable-glibc-rseq-support.patch b/0074-ci-disable-glibc-rseq-support.patch similarity index 93% rename from 0079-ci-disable-glibc-rseq-support.patch rename to 0074-ci-disable-glibc-rseq-support.patch index bfddd0f..61e1e77 100644 --- a/0079-ci-disable-glibc-rseq-support.patch +++ b/0074-ci-disable-glibc-rseq-support.patch @@ -1,7 +1,7 @@ -From d99def7dcfa938918368c91021f72a77f738bc61 Mon Sep 17 00:00:00 2001 +From 595b1caf66a8fb61488c98fad4952fbfb3c12aba Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Fri, 17 Dec 2021 03:01:49 +0000 -Subject: [PATCH 079/120] ci: disable glibc rseq support +Subject: [PATCH 074/245] ci: disable glibc rseq support This patch sets the glibc.pthread.rseq tunable [1] to disable rseq support in glibc as a temporary solution for the problem described in @@ -51,5 +51,5 @@ index 096f907fb..bf7331142 100755 ./test/zdtm.py run -t zdtm/static/env00 --sibling -- -2.34.1 +2.35.1 diff --git a/0080-libcriu-add-single-pre-dump-support.patch b/0075-libcriu-add-single-pre-dump-support.patch similarity index 97% rename from 0080-libcriu-add-single-pre-dump-support.patch rename to 0075-libcriu-add-single-pre-dump-support.patch index a6220b4..3863297 100644 --- a/0080-libcriu-add-single-pre-dump-support.patch +++ b/0075-libcriu-add-single-pre-dump-support.patch @@ -1,7 +1,7 @@ -From 7b5909592881607f5d5ecc8de144e5bb83f02438 Mon Sep 17 00:00:00 2001 +From 9edcc3be3052028de05221edfd18d4b9fb245761 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Fri, 3 Dec 2021 14:32:33 +0000 -Subject: [PATCH 080/120] libcriu: add single pre-dump support +Subject: [PATCH 075/245] libcriu: add single pre-dump support In contrast to the CLI it is not possible to do a single pre-dump via RPC and thus libcriu. In cr-service.c pre-dump always goes into a @@ -181,5 +181,5 @@ index a374b37f8..c6d4f50a8 100644 int criu_local_restore_child(criu_opts *opts); int criu_local_dump_iters(criu_opts *opts, int (*more)(criu_predump_info pi)); -- -2.34.1 +2.35.1 diff --git a/0081-tests-added-test-for-single-pre-dump-support.patch b/0076-tests-added-test-for-single-pre-dump-support.patch similarity index 97% rename from 0081-tests-added-test-for-single-pre-dump-support.patch rename to 0076-tests-added-test-for-single-pre-dump-support.patch index 2231e20..9dc08d2 100644 --- a/0081-tests-added-test-for-single-pre-dump-support.patch +++ b/0076-tests-added-test-for-single-pre-dump-support.patch @@ -1,7 +1,7 @@ -From e4ccdc694a8739125da2c7e8e57f8a30c7451eaf Mon Sep 17 00:00:00 2001 +From 0f5b3f1a3e005e50a294bd0601a6e3c99539a1cf Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Tue, 14 Dec 2021 13:09:19 +0000 -Subject: [PATCH 081/120] tests: added test for single pre-dump support +Subject: [PATCH 076/245] tests: added test for single pre-dump support Signed-off-by: Adrian Reber --- @@ -258,5 +258,5 @@ index 697abf5d5..af1e09408 100644 { int pid, ret, fd, p[2]; -- -2.34.1 +2.35.1 diff --git a/0082-zdtm.py-clean-up-MAKEFLAGS-env-variable-before-runni.patch b/0077-zdtm.py-clean-up-MAKEFLAGS-env-variable-before-runni.patch similarity index 93% rename from 0082-zdtm.py-clean-up-MAKEFLAGS-env-variable-before-runni.patch rename to 0077-zdtm.py-clean-up-MAKEFLAGS-env-variable-before-runni.patch index 1c3ac09..e7dbbe1 100644 --- a/0082-zdtm.py-clean-up-MAKEFLAGS-env-variable-before-runni.patch +++ b/0077-zdtm.py-clean-up-MAKEFLAGS-env-variable-before-runni.patch @@ -1,7 +1,7 @@ -From 98675175666d97a9eeadfcc396df8b894e318e78 Mon Sep 17 00:00:00 2001 +From bfd24ce3b3f0c1e86001b55492a487db2f75b72d Mon Sep 17 00:00:00 2001 From: Alexander Mikhalitsyn Date: Sat, 18 Dec 2021 10:40:11 +0300 -Subject: [PATCH 082/120] zdtm.py: clean up MAKEFLAGS env variable before +Subject: [PATCH 077/245] zdtm.py: clean up MAKEFLAGS env variable before running make instance In most cases we run tests as: @@ -52,5 +52,5 @@ index b98770079..086ae0285 100755 subprocess.check_call(["make", "-C", "zdtm/"]) subprocess.check_call( -- -2.34.1 +2.35.1 diff --git a/0083-zdtm-zdtm_ct-fix-compilation-error-with-strict-proto.patch b/0078-zdtm-zdtm_ct-fix-compilation-error-with-strict-proto.patch similarity index 86% rename from 0083-zdtm-zdtm_ct-fix-compilation-error-with-strict-proto.patch rename to 0078-zdtm-zdtm_ct-fix-compilation-error-with-strict-proto.patch index 515328a..6ca59d9 100644 --- a/0083-zdtm-zdtm_ct-fix-compilation-error-with-strict-proto.patch +++ b/0078-zdtm-zdtm_ct-fix-compilation-error-with-strict-proto.patch @@ -1,7 +1,7 @@ -From e0bf87fecbcc353d697dccd3fe0801347caf1423 Mon Sep 17 00:00:00 2001 +From cf3e1067f3639426defccf7b322da1eb7a05ca21 Mon Sep 17 00:00:00 2001 From: Alexander Mikhalitsyn Date: Sat, 18 Dec 2021 11:03:53 +0300 -Subject: [PATCH 083/120] zdtm: zdtm_ct fix compilation error with +Subject: [PATCH 078/245] zdtm: zdtm_ct fix compilation error with strict-prototypes on MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -29,5 +29,5 @@ index e4b17a512..0e8eeff8a 100644 struct utsname buf; unsigned major, minor; -- -2.34.1 +2.35.1 diff --git a/0084-zdtm-remove-mntns-deleted-dst-test-leftover-from-git.patch b/0079-zdtm-remove-mntns-deleted-dst-test-leftover-from-git.patch similarity index 82% rename from 0084-zdtm-remove-mntns-deleted-dst-test-leftover-from-git.patch rename to 0079-zdtm-remove-mntns-deleted-dst-test-leftover-from-git.patch index f1b0b39..1182267 100644 --- a/0084-zdtm-remove-mntns-deleted-dst-test-leftover-from-git.patch +++ b/0079-zdtm-remove-mntns-deleted-dst-test-leftover-from-git.patch @@ -1,7 +1,7 @@ -From 5083232273c93f9115bf91bed373d8ab749106d9 Mon Sep 17 00:00:00 2001 +From 077c823160b35e94fd6e68d993c4abefecbb2083 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Fri, 17 Dec 2021 15:33:55 +0300 -Subject: [PATCH 084/120] zdtm: remove mntns-deleted-dst test leftover from git +Subject: [PATCH 079/245] zdtm: remove mntns-deleted-dst test leftover from git Looks like in commit [1] we've non-intentionally added this tmp file to git, let's remove it. @@ -17,5 +17,5 @@ diff --git a/test/zdtm/static/mntns-deleted-dst b/test/zdtm/static/mntns-deleted deleted file mode 100644 index e69de29bb..000000000 -- -2.34.1 +2.35.1 diff --git a/0085-crtools-remove-excess-always-true-condition.patch b/0080-crtools-remove-excess-always-true-condition.patch similarity index 85% rename from 0085-crtools-remove-excess-always-true-condition.patch rename to 0080-crtools-remove-excess-always-true-condition.patch index df2c3a9..6adf370 100644 --- a/0085-crtools-remove-excess-always-true-condition.patch +++ b/0080-crtools-remove-excess-always-true-condition.patch @@ -1,7 +1,7 @@ -From b8825cd2d4242b13d7ca598211c513c7b1308d84 Mon Sep 17 00:00:00 2001 +From 3f3cad68232130c52c528b6eb977fdd379fcded6 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Fri, 10 Dec 2021 15:34:19 +0300 -Subject: [PATCH 085/120] crtools: remove excess always true condition +Subject: [PATCH 080/245] crtools: remove excess always true condition Several lines above if (optind >= argc) we go to usage label and fail, thus we don't need to check (optind < argc) here as it is always true. @@ -25,5 +25,5 @@ index da47bd684..3adfb190f 100644 fprintf(stderr, "Usage: criu swrk \n"); return 1; -- -2.34.1 +2.35.1 diff --git a/0086-crtools-rpc-export-current-criu-mode-to-opts.mode.patch b/0081-crtools-rpc-export-current-criu-mode-to-opts.mode.patch similarity index 98% rename from 0086-crtools-rpc-export-current-criu-mode-to-opts.mode.patch rename to 0081-crtools-rpc-export-current-criu-mode-to-opts.mode.patch index 4cccc89..04b7d71 100644 --- a/0086-crtools-rpc-export-current-criu-mode-to-opts.mode.patch +++ b/0081-crtools-rpc-export-current-criu-mode-to-opts.mode.patch @@ -1,7 +1,7 @@ -From 6006fc1de4d0ee8181682df7fd7a143f4bd89273 Mon Sep 17 00:00:00 2001 +From fe0929766ede95a4f5cc07ec28c288f2d2699448 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Fri, 10 Dec 2021 12:13:06 +0300 -Subject: [PATCH 086/120] crtools/rpc: export current criu mode to opts.mode +Subject: [PATCH 081/245] crtools/rpc: export current criu mode to opts.mode We have multiple options which are valid only on restore or only on dump or in any other specific criu mode, so it would be useful to have info @@ -305,5 +305,5 @@ index a34f8dbbf..85648bf1c 100644 extern struct cr_options opts; -- -2.34.1 +2.35.1 diff --git a/0087-crtools-use-new-opts.mode-in-image_dir_mode.patch b/0082-crtools-use-new-opts.mode-in-image_dir_mode.patch similarity index 89% rename from 0087-crtools-use-new-opts.mode-in-image_dir_mode.patch rename to 0082-crtools-use-new-opts.mode-in-image_dir_mode.patch index 6e357e8..116deaf 100644 --- a/0087-crtools-use-new-opts.mode-in-image_dir_mode.patch +++ b/0082-crtools-use-new-opts.mode-in-image_dir_mode.patch @@ -1,7 +1,7 @@ -From 95c3d5131afd2b40271233ea7a024dc19260efd1 Mon Sep 17 00:00:00 2001 +From bec81335ad40077e8194c3bf7b9c9fa31098046f Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Wed, 15 Dec 2021 10:49:42 +0300 -Subject: [PATCH 087/120] crtools: use new opts.mode in image_dir_mode +Subject: [PATCH 082/245] crtools: use new opts.mode in image_dir_mode Also while on it there is no "cpuinfo restore", let's remove it. @@ -44,5 +44,5 @@ index d10d7f7d0..7bf92ffd0 100644 } -- -2.34.1 +2.35.1 diff --git a/0088-crtools-check-that-cpuinfo-command-has-sub-command.patch b/0083-crtools-check-that-cpuinfo-command-has-sub-command.patch similarity index 85% rename from 0088-crtools-check-that-cpuinfo-command-has-sub-command.patch rename to 0083-crtools-check-that-cpuinfo-command-has-sub-command.patch index 7278b9f..8539a1a 100644 --- a/0088-crtools-check-that-cpuinfo-command-has-sub-command.patch +++ b/0083-crtools-check-that-cpuinfo-command-has-sub-command.patch @@ -1,7 +1,7 @@ -From d2632238947d8aa9096deb27ae8ba05971f43de9 Mon Sep 17 00:00:00 2001 +From ab85c0944536729aa49b27ca80d14fe9eb5ce66e Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 16 Dec 2021 18:05:01 +0300 -Subject: [PATCH 088/120] crtools: check that cpuinfo command has sub-command +Subject: [PATCH 083/245] crtools: check that cpuinfo command has sub-command This fixes segfault on empty sub-command for cpuinfo. @@ -25,5 +25,5 @@ index 7bf92ffd0..0752800f6 100644 } -- -2.34.1 +2.35.1 diff --git a/0089-sk-unix-Add-support-for-SOCK_SEQPACKET-unix-sockets.patch b/0084-sk-unix-Add-support-for-SOCK_SEQPACKET-unix-sockets.patch similarity index 93% rename from 0089-sk-unix-Add-support-for-SOCK_SEQPACKET-unix-sockets.patch rename to 0084-sk-unix-Add-support-for-SOCK_SEQPACKET-unix-sockets.patch index 34cb26b..8ffb163 100644 --- a/0089-sk-unix-Add-support-for-SOCK_SEQPACKET-unix-sockets.patch +++ b/0084-sk-unix-Add-support-for-SOCK_SEQPACKET-unix-sockets.patch @@ -1,7 +1,7 @@ -From 2407ff4a1f96fe206bcc246d58f90d24aa8f4e1e Mon Sep 17 00:00:00 2001 +From 96bc16b15d06d6176fc8bc95cd4db815cd9ad536 Mon Sep 17 00:00:00 2001 From: Bui Quang Minh Date: Tue, 14 Dec 2021 22:28:27 +0700 -Subject: [PATCH 089/120] sk-unix: Add support for SOCK_SEQPACKET unix sockets +Subject: [PATCH 084/245] sk-unix: Add support for SOCK_SEQPACKET unix sockets Adjust some SOCK_STREAM cases to handle SOCK_SEQPACKET too. @@ -49,5 +49,5 @@ index d3402c3ac..194193dff 100644 int ret, sks[2]; -- -2.34.1 +2.35.1 diff --git a/0090-zdtm-Add-SOCK_SEQPACKET-variants-to-unix-socket-test.patch b/0085-zdtm-Add-SOCK_SEQPACKET-variants-to-unix-socket-test.patch similarity index 99% rename from 0090-zdtm-Add-SOCK_SEQPACKET-variants-to-unix-socket-test.patch rename to 0085-zdtm-Add-SOCK_SEQPACKET-variants-to-unix-socket-test.patch index 9b9024b..7434e75 100644 --- a/0090-zdtm-Add-SOCK_SEQPACKET-variants-to-unix-socket-test.patch +++ b/0085-zdtm-Add-SOCK_SEQPACKET-variants-to-unix-socket-test.patch @@ -1,7 +1,7 @@ -From 41a696dcc5ebef28ce8e9ed28fe9c3e8518868ec Mon Sep 17 00:00:00 2001 +From 315619c91047dce2fc11e4dbb074d31fcd409327 Mon Sep 17 00:00:00 2001 From: Bui Quang Minh Date: Thu, 16 Dec 2021 09:35:25 +0700 -Subject: [PATCH 090/120] zdtm: Add SOCK_SEQPACKET variants to unix socket +Subject: [PATCH 085/245] zdtm: Add SOCK_SEQPACKET variants to unix socket tests This commit simply makes copies of SOCK_STREAM unix socket tests and uses @@ -570,5 +570,5 @@ index 000000000..a52ccb6c9 +sockets_spair.c \ No newline at end of file -- -2.34.1 +2.35.1 diff --git a/0091-tls-fix-typo.patch b/0086-tls-fix-typo.patch similarity index 84% rename from 0091-tls-fix-typo.patch rename to 0086-tls-fix-typo.patch index 618f38b..f53aed2 100644 --- a/0091-tls-fix-typo.patch +++ b/0086-tls-fix-typo.patch @@ -1,7 +1,7 @@ -From 0bef863f00df370b32c7c3288dbe1c805ad6905e Mon Sep 17 00:00:00 2001 +From 64178a1c7fa4ce1107074520392b98906672317f Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Tue, 7 Dec 2021 21:29:44 +0000 -Subject: [PATCH 091/120] tls: fix typo +Subject: [PATCH 086/245] tls: fix typo Signed-off-by: Radostin Stoyanov --- @@ -22,5 +22,5 @@ index 60bd105bc..6a7b523ac 100644 #define GNUTLS_E_CERTIFICATE_VERIFICATION_ERROR GNUTLS_E_CERTIFICATE_ERROR #endif -- -2.34.1 +2.35.1 diff --git a/0092-tls-use-ssize_t-for-return-value.patch b/0087-tls-use-ssize_t-for-return-value.patch similarity index 93% rename from 0092-tls-use-ssize_t-for-return-value.patch rename to 0087-tls-use-ssize_t-for-return-value.patch index 642a9e8..f1fad8f 100644 --- a/0092-tls-use-ssize_t-for-return-value.patch +++ b/0087-tls-use-ssize_t-for-return-value.patch @@ -1,7 +1,7 @@ -From 6ca82330a3bda6b70ea52fcae163a904d0c0b7df Mon Sep 17 00:00:00 2001 +From 71221e60aa8465e6794d749ef8d5dd404416a17d Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Tue, 7 Dec 2021 22:32:54 +0000 -Subject: [PATCH 092/120] tls: use ssize_t for return value +Subject: [PATCH 087/245] tls: use ssize_t for return value Signed-off-by: Radostin Stoyanov --- @@ -67,5 +67,5 @@ index 6a7b523ac..626e529f8 100644 int _errno = errno; pr_perror("Pull callback recv failed"); -- -2.34.1 +2.35.1 diff --git a/0093-tls-add-more-comments.patch b/0088-tls-add-more-comments.patch similarity index 96% rename from 0093-tls-add-more-comments.patch rename to 0088-tls-add-more-comments.patch index fa89fb4..3a3a007 100644 --- a/0093-tls-add-more-comments.patch +++ b/0088-tls-add-more-comments.patch @@ -1,7 +1,7 @@ -From 8bddd88b3e15d167bad53b14b161f5cb628f2923 Mon Sep 17 00:00:00 2001 +From 7451db84fbabc4efa4eec9eb1f0302af11c5ccd1 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Thu, 16 Dec 2021 14:26:53 +0000 -Subject: [PATCH 093/120] tls: add more comments +Subject: [PATCH 088/245] tls: add more comments Signed-off-by: Radostin Stoyanov --- @@ -107,5 +107,5 @@ index 626e529f8..9985b037d 100644 if (flags == GNUTLS_SERVER) { -- -2.34.1 +2.35.1 diff --git a/0094-uffd-call-disconnect_from_page_server-to-shutdown-a-.patch b/0089-uffd-call-disconnect_from_page_server-to-shutdown-a-.patch similarity index 83% rename from 0094-uffd-call-disconnect_from_page_server-to-shutdown-a-.patch rename to 0089-uffd-call-disconnect_from_page_server-to-shutdown-a-.patch index 20d90e1..217cc3c 100644 --- a/0094-uffd-call-disconnect_from_page_server-to-shutdown-a-.patch +++ b/0089-uffd-call-disconnect_from_page_server-to-shutdown-a-.patch @@ -1,7 +1,7 @@ -From c37140662d22e86e1096c953b888b6496b7e1f64 Mon Sep 17 00:00:00 2001 +From 58b97c0ae5bbeeac50dc83fb79a7b55bf2b8e683 Mon Sep 17 00:00:00 2001 From: Andrei Vagin Date: Tue, 21 Dec 2021 21:59:13 -0800 -Subject: [PATCH 094/120] uffd: call disconnect_from_page_server to shutdown a +Subject: [PATCH 089/245] uffd: call disconnect_from_page_server to shutdown a page-server connection We need to be sure that page-server doesn't wait for a new command when we @@ -26,5 +26,5 @@ index f01e6999b..45ac8ba77 100644 xfree(events); return ret; -- -2.34.1 +2.35.1 diff --git a/0095-tls-allow-to-terminate-connections-synchronously.patch b/0090-tls-allow-to-terminate-connections-synchronously.patch similarity index 95% rename from 0095-tls-allow-to-terminate-connections-synchronously.patch rename to 0090-tls-allow-to-terminate-connections-synchronously.patch index c6bea2b..d124bde 100644 --- a/0095-tls-allow-to-terminate-connections-synchronously.patch +++ b/0090-tls-allow-to-terminate-connections-synchronously.patch @@ -1,7 +1,7 @@ -From fa03dcfff6a5215ef06c1e579eddb0f5c09f8798 Mon Sep 17 00:00:00 2001 +From 6e2b052636e3f57b22302db21bd5c6d8eba9ba8b Mon Sep 17 00:00:00 2001 From: Andrei Vagin Date: Wed, 22 Dec 2021 09:36:09 -0800 -Subject: [PATCH 095/120] tls: allow to terminate connections synchronously +Subject: [PATCH 090/245] tls: allow to terminate connections synchronously GNUTLS_SHUT_RDWR sends an alert containing a close request and waits for the peer to reply with the same message. @@ -96,5 +96,5 @@ index 9985b037d..4feaf613b 100644 return -1; } -- -2.34.1 +2.35.1 diff --git a/0096-page-xfer-stop-waiting-for-a-new-command-after-a-clo.patch b/0091-page-xfer-stop-waiting-for-a-new-command-after-a-clo.patch similarity index 92% rename from 0096-page-xfer-stop-waiting-for-a-new-command-after-a-clo.patch rename to 0091-page-xfer-stop-waiting-for-a-new-command-after-a-clo.patch index 289d530..f46b223 100644 --- a/0096-page-xfer-stop-waiting-for-a-new-command-after-a-clo.patch +++ b/0091-page-xfer-stop-waiting-for-a-new-command-after-a-clo.patch @@ -1,7 +1,7 @@ -From cc1120addd38d51f38c28fefae669172ba82120d Mon Sep 17 00:00:00 2001 +From 80aff4e7b4c7331bd7724939389539c2eb6e8e85 Mon Sep 17 00:00:00 2001 From: Andrei Vagin Date: Wed, 22 Dec 2021 09:59:11 -0800 -Subject: [PATCH 096/120] page-xfer: stop waiting for a new command after a +Subject: [PATCH 091/245] page-xfer: stop waiting for a new command after a close command There is no reason to do that and in case of tls, __recv returns EAGAIN @@ -62,5 +62,5 @@ index 7ff07680f..60c793009 100644 if (send_psi(page_server_sk, &pi)) goto out; -- -2.34.1 +2.35.1 diff --git a/0097-ci-reenable-the-lazy-thp-test-in-the-lazy-remote-mod.patch b/0092-ci-reenable-the-lazy-thp-test-in-the-lazy-remote-mod.patch similarity index 88% rename from 0097-ci-reenable-the-lazy-thp-test-in-the-lazy-remote-mod.patch rename to 0092-ci-reenable-the-lazy-thp-test-in-the-lazy-remote-mod.patch index 917884c..9aa082e 100644 --- a/0097-ci-reenable-the-lazy-thp-test-in-the-lazy-remote-mod.patch +++ b/0092-ci-reenable-the-lazy-thp-test-in-the-lazy-remote-mod.patch @@ -1,7 +1,7 @@ -From 5e975ab787ed677b03aa86f104b90984189c906b Mon Sep 17 00:00:00 2001 +From 0c7a9e1c464ac6b1c497b27fc5989ece8e286771 Mon Sep 17 00:00:00 2001 From: Andrei Vagin Date: Wed, 22 Dec 2021 17:03:04 -0800 -Subject: [PATCH 097/120] ci: reenable the lazy-thp test in the lazy-remote +Subject: [PATCH 092/245] ci: reenable the lazy-thp test in the lazy-remote mode Signed-off-by: Andrei Vagin @@ -26,5 +26,5 @@ index bf7331142..7eab9f2dc 100755 bash -x ./test/jenkins/criu-fault.sh if [ "$UNAME_M" == "x86_64" ]; then -- -2.34.1 +2.35.1 diff --git a/0098-test-log-testname.out.inprogress-if-a-test-has-faile.patch b/0093-test-log-testname.out.inprogress-if-a-test-has-faile.patch similarity index 89% rename from 0098-test-log-testname.out.inprogress-if-a-test-has-faile.patch rename to 0093-test-log-testname.out.inprogress-if-a-test-has-faile.patch index ff59e28..acd9867 100644 --- a/0098-test-log-testname.out.inprogress-if-a-test-has-faile.patch +++ b/0093-test-log-testname.out.inprogress-if-a-test-has-faile.patch @@ -1,7 +1,7 @@ -From a5576e1e6b30411aa936ef05c4344121be58f183 Mon Sep 17 00:00:00 2001 +From 5f907445551685bd30af7567c08662f7100a0d70 Mon Sep 17 00:00:00 2001 From: Andrei Vagin Date: Wed, 22 Dec 2021 17:06:21 -0800 -Subject: [PATCH 098/120] test: log testname.out.inprogress if a test has +Subject: [PATCH 093/245] test: log testname.out.inprogress if a test has failed This is required if the test failed by timeout. @@ -34,5 +34,5 @@ index 086ae0285..c0e24a41a 100755 def static(self): return self.__name.split('/')[1] == 'static' -- -2.34.1 +2.35.1 diff --git a/0094-zdtm-print-tails-of-all-logs-if-a-test-has-failed.patch b/0094-zdtm-print-tails-of-all-logs-if-a-test-has-failed.patch new file mode 100644 index 0000000..3967d1a --- /dev/null +++ b/0094-zdtm-print-tails-of-all-logs-if-a-test-has-failed.patch @@ -0,0 +1,38 @@ +From cb604bacff3e469d53fd39e63d13e98cd460b9cb Mon Sep 17 00:00:00 2001 +From: Andrei Vagin +Date: Wed, 22 Dec 2021 17:08:16 -0800 +Subject: [PATCH 094/245] zdtm: print tails of all logs if a test has failed + +Signed-off-by: Andrei Vagin +--- + test/zdtm.py | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/test/zdtm.py b/test/zdtm.py +index c0e24a41a..14e6aa1b0 100755 +--- a/test/zdtm.py ++++ b/test/zdtm.py +@@ -1475,17 +1475,17 @@ class criu: + self.__lazy_pages_p.terminate() + print("criu lazy-pages exited with %s" % + self.__lazy_pages_p.wait()) +- grep_errors(os.path.join(self.__ddir(), "lazy-pages.log")) ++ grep_errors(os.path.join(self.__ddir(), "lazy-pages.log"), err=True) + self.__lazy_pages_p = None + if self.__page_server_p: + self.__page_server_p.terminate() + print("criu page-server exited with %s" % + self.__page_server_p.wait()) +- grep_errors(os.path.join(self.__ddir(), "page-server.log")) ++ grep_errors(os.path.join(self.__ddir(), "page-server.log"), err=True) + self.__page_server_p = None + if self.__dump_process: + self.__dump_process.terminate() +- print("criu dump exited with %s" % self.__dump_process.wait()) ++ print("criu dump exited with %s" % self.__dump_process.wait(), err=True) + grep_errors(os.path.join(self.__ddir(), "dump.log")) + self.__dump_process = None + if self.__img_streamer_process: +-- +2.35.1 + diff --git a/0100-zdtm-static-uffd-events-add-more-log-messages.patch b/0095-zdtm-static-uffd-events-add-more-log-messages.patch similarity index 89% rename from 0100-zdtm-static-uffd-events-add-more-log-messages.patch rename to 0095-zdtm-static-uffd-events-add-more-log-messages.patch index cf733b8..8e80c73 100644 --- a/0100-zdtm-static-uffd-events-add-more-log-messages.patch +++ b/0095-zdtm-static-uffd-events-add-more-log-messages.patch @@ -1,7 +1,7 @@ -From 4152a88cf588e94c9bf6edb3706cdf81fd25bce2 Mon Sep 17 00:00:00 2001 +From c36dbb082e60a4a267502cf73661eec78eb8d034 Mon Sep 17 00:00:00 2001 From: Andrei Vagin Date: Wed, 22 Dec 2021 17:08:42 -0800 -Subject: [PATCH 100/120] zdtm/static/uffd-events: add more log messages +Subject: [PATCH 095/245] zdtm/static/uffd-events: add more log messages Signed-off-by: Andrei Vagin --- @@ -49,5 +49,5 @@ index c811bcf4c..edd6c09ca 100644 fail("child failed"); return status; -- -2.34.1 +2.35.1 diff --git a/0101-mount-split-check_mountpoint_fd-from-__open_mountpoi.patch b/0096-mount-split-check_mountpoint_fd-from-__open_mountpoi.patch similarity index 95% rename from 0101-mount-split-check_mountpoint_fd-from-__open_mountpoi.patch rename to 0096-mount-split-check_mountpoint_fd-from-__open_mountpoi.patch index 8969503..4413302 100644 --- a/0101-mount-split-check_mountpoint_fd-from-__open_mountpoi.patch +++ b/0096-mount-split-check_mountpoint_fd-from-__open_mountpoi.patch @@ -1,7 +1,7 @@ -From 1d10fc1e0f2589d34b893c6432fcaab2f99018f7 Mon Sep 17 00:00:00 2001 +From 3e716ab20a6de56bce5ac7d66d67e7c3507facae Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Fri, 17 Dec 2021 14:58:47 +0300 -Subject: [PATCH 101/120] mount: split check_mountpoint_fd from +Subject: [PATCH 096/245] mount: split check_mountpoint_fd from __open_mountpoint Now we can reuse "check" part separately in other places. @@ -116,5 +116,5 @@ index d75ca5598..f6347fd9d 100644 int open_mount(unsigned int s_dev) -- -2.34.1 +2.35.1 diff --git a/0102-mount-remove-mnt_fd-argument-of-__open_mountpoint.patch b/0097-mount-remove-mnt_fd-argument-of-__open_mountpoint.patch similarity index 96% rename from 0102-mount-remove-mnt_fd-argument-of-__open_mountpoint.patch rename to 0097-mount-remove-mnt_fd-argument-of-__open_mountpoint.patch index 2430f95..11974c4 100644 --- a/0102-mount-remove-mnt_fd-argument-of-__open_mountpoint.patch +++ b/0097-mount-remove-mnt_fd-argument-of-__open_mountpoint.patch @@ -1,7 +1,7 @@ -From 0aed7a86a766fa175bac9d573695edc493e26717 Mon Sep 17 00:00:00 2001 +From e1d20922e907d173d7f3308c00440d93e21bb568 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Fri, 17 Dec 2021 15:13:35 +0300 -Subject: [PATCH 102/120] mount: remove mnt_fd argument of __open_mountpoint +Subject: [PATCH 097/245] mount: remove mnt_fd argument of __open_mountpoint Only place where we used __open_mountpoint with non -1 mnt_fd is open_mountpoint. Let's use check_mountpoint_fd for this case, so that we @@ -112,5 +112,5 @@ index f6347fd9d..ab6d3ed10 100644 if (ns_old >= 0) /* coverity[check_return] */ -- -2.34.1 +2.35.1 diff --git a/0103-proc_parse-add-helper-to-resolve-sdev-from-fd.patch b/0098-proc_parse-add-helper-to-resolve-sdev-from-fd.patch similarity index 92% rename from 0103-proc_parse-add-helper-to-resolve-sdev-from-fd.patch rename to 0098-proc_parse-add-helper-to-resolve-sdev-from-fd.patch index 381ed81..9ad0640 100644 --- a/0103-proc_parse-add-helper-to-resolve-sdev-from-fd.patch +++ b/0098-proc_parse-add-helper-to-resolve-sdev-from-fd.patch @@ -1,7 +1,7 @@ -From 758f3be2d4766f478b74d4026e3c16c93d3b07f9 Mon Sep 17 00:00:00 2001 +From 7b3b76f8d1650e3f208bfd85583755376b30b93a Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 16 Dec 2021 16:14:41 +0300 -Subject: [PATCH 103/120] proc_parse: add helper to resolve sdev from fd +Subject: [PATCH 098/245] proc_parse: add helper to resolve sdev from fd New get_sdev_from_fd helper first gets mnt_id from fd using fdinfo and then converts mnt_id to sdev using mountinfo. @@ -33,10 +33,10 @@ index 3f3a67afa..9c0d7c010 100644 extern int check_mnt_id(void); diff --git a/criu/proc_parse.c b/criu/proc_parse.c -index 094f9b84e..3017a64e1 100644 +index c734fc24a..eb3efc877 100644 --- a/criu/proc_parse.c +++ b/criu/proc_parse.c -@@ -1527,6 +1527,59 @@ out: +@@ -1492,6 +1492,59 @@ out: return exit_code; } @@ -97,5 +97,5 @@ index 094f9b84e..3017a64e1 100644 { struct mount_info *list = NULL; -- -2.34.1 +2.35.1 diff --git a/0104-mount-btrfs-make-check_mountpoint_fd-fallback-to-get.patch b/0099-mount-btrfs-make-check_mountpoint_fd-fallback-to-get.patch similarity index 96% rename from 0104-mount-btrfs-make-check_mountpoint_fd-fallback-to-get.patch rename to 0099-mount-btrfs-make-check_mountpoint_fd-fallback-to-get.patch index 6a2601f..011264b 100644 --- a/0104-mount-btrfs-make-check_mountpoint_fd-fallback-to-get.patch +++ b/0099-mount-btrfs-make-check_mountpoint_fd-fallback-to-get.patch @@ -1,7 +1,7 @@ -From ca615ea1fbc2a20b4d92ced9a904325a49ab4518 Mon Sep 17 00:00:00 2001 +From ce0be851f296738bb10043477a52250502394182 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 16 Dec 2021 12:57:23 +0300 -Subject: [PATCH 104/120] mount/btrfs: make check_mountpoint_fd fallback to +Subject: [PATCH 099/245] mount/btrfs: make check_mountpoint_fd fallback to get_sdev_from_fd We face that btrfs returns anonymous device in stat instead of real @@ -136,5 +136,5 @@ index ab6d3ed10..4b57ac703 100644 if (ns_old >= 0) /* coverity[check_return] */ -- -2.34.1 +2.35.1 diff --git a/0105-ci-test-criu-image-streamer-with-all-tests.patch b/0100-ci-test-criu-image-streamer-with-all-tests.patch similarity index 87% rename from 0105-ci-test-criu-image-streamer-with-all-tests.patch rename to 0100-ci-test-criu-image-streamer-with-all-tests.patch index 9319e58..98d26c3 100644 --- a/0105-ci-test-criu-image-streamer-with-all-tests.patch +++ b/0100-ci-test-criu-image-streamer-with-all-tests.patch @@ -1,7 +1,7 @@ -From 125b32d35e227b47040cc2e105771bb184c65f87 Mon Sep 17 00:00:00 2001 +From b003ce7cb55f656c3c29fee5cb3021213463910f Mon Sep 17 00:00:00 2001 From: Nicolas Viennot Date: Tue, 28 Dec 2021 19:30:09 +0000 -Subject: [PATCH 105/120] ci: test criu-image-streamer with all tests +Subject: [PATCH 100/245] ci: test criu-image-streamer with all tests All the bugs that were in the way got fixed. We can enable all tests. @@ -29,5 +29,5 @@ index 7eab9f2dc..d0cd55f7c 100755 print_header() { -- -2.34.1 +2.35.1 diff --git a/0106-readme-add-docker-test-badge.patch b/0101-readme-add-docker-test-badge.patch similarity index 88% rename from 0106-readme-add-docker-test-badge.patch rename to 0101-readme-add-docker-test-badge.patch index 181c42a..06d81f5 100644 --- a/0106-readme-add-docker-test-badge.patch +++ b/0101-readme-add-docker-test-badge.patch @@ -1,7 +1,7 @@ -From 3caa619b34653a0c32dd3116c9f6bf0249d9c30d Mon Sep 17 00:00:00 2001 +From 616e9d9f937d7adf49573f2e15b9edd6aed9ba46 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Mon, 10 Jan 2022 10:37:19 +0000 -Subject: [PATCH 106/120] readme: add docker test badge +Subject: [PATCH 101/245] readme: add docker test badge Signed-off-by: Radostin Stoyanov --- @@ -21,5 +21,5 @@ index fd86b2c15..6b86cac9e 100644

-- -2.34.1 +2.35.1 diff --git a/0107-contributing-remove-old-badges-and-logo.patch b/0102-contributing-remove-old-badges-and-logo.patch similarity index 89% rename from 0107-contributing-remove-old-badges-and-logo.patch rename to 0102-contributing-remove-old-badges-and-logo.patch index f97e360..847b08c 100644 --- a/0107-contributing-remove-old-badges-and-logo.patch +++ b/0102-contributing-remove-old-badges-and-logo.patch @@ -1,7 +1,7 @@ -From bf9a5b8e5be78bfac6954850fee1c156eca0f1b7 Mon Sep 17 00:00:00 2001 +From d6d3e35c7ca3d1cc838b95d36dc224edd2d23942 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Mon, 10 Jan 2022 10:37:52 +0000 -Subject: [PATCH 107/120] contributing: remove old badges and logo +Subject: [PATCH 102/245] contributing: remove old badges and logo CI badges and logo are already present in the readme file. @@ -24,5 +24,5 @@ index 96972296e..864caf93e 100644 CRIU project is (almost) the never-ending story, because we have to always keep up with the -- -2.34.1 +2.35.1 diff --git a/0108-ci-update-to-latest-Vagrant-and-Fedora-images.patch b/0103-ci-update-to-latest-Vagrant-and-Fedora-images.patch similarity index 86% rename from 0108-ci-update-to-latest-Vagrant-and-Fedora-images.patch rename to 0103-ci-update-to-latest-Vagrant-and-Fedora-images.patch index 0042b54..3b3d754 100644 --- a/0108-ci-update-to-latest-Vagrant-and-Fedora-images.patch +++ b/0103-ci-update-to-latest-Vagrant-and-Fedora-images.patch @@ -1,7 +1,7 @@ -From 3377245bb491f0d05c2f468505b6dd9bd64b06bf Mon Sep 17 00:00:00 2001 +From 673373c3bc8ff0e464b2392cfe4aab5e67748454 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Fri, 3 Dec 2021 17:13:27 +0000 -Subject: [PATCH 108/120] ci: update to latest Vagrant and Fedora images +Subject: [PATCH 103/245] ci: update to latest Vagrant and Fedora images Signed-off-by: Adrian Reber --- @@ -33,5 +33,5 @@ index 40c8416e1..4a4a16445 100755 setup() { if [ -n "$TRAVIS" ]; then -- -2.34.1 +2.35.1 diff --git a/0109-ci-added-.lgtm.yml-file.patch b/0104-ci-added-.lgtm.yml-file.patch similarity index 92% rename from 0109-ci-added-.lgtm.yml-file.patch rename to 0104-ci-added-.lgtm.yml-file.patch index 890d489..0ba086c 100644 --- a/0109-ci-added-.lgtm.yml-file.patch +++ b/0104-ci-added-.lgtm.yml-file.patch @@ -1,7 +1,7 @@ -From acc68cfe88a2a87260ee599a772391bc124a879d Mon Sep 17 00:00:00 2001 +From 2af4e839804f5f60e080dd3667d8acf0682502dd Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Sun, 16 Jan 2022 11:17:33 +0000 -Subject: [PATCH 109/120] ci: added .lgtm.yml file +Subject: [PATCH 104/245] ci: added .lgtm.yml file A couple of months (or years) ago I looked into lgtm.com for CRIU. Today on a pull request I saw result from lgtm.com for the first time and it @@ -52,5 +52,5 @@ index 000000000..a28c35de0 + - "ln -s /usr/include/google/protobuf/descriptor.proto images/google/protobuf/descriptor.proto" + - "ls -laR images/google" -- -2.34.1 +2.35.1 diff --git a/0110-lib-introduce-feature-check-in-libcriu.patch b/0105-lib-introduce-feature-check-in-libcriu.patch similarity index 96% rename from 0110-lib-introduce-feature-check-in-libcriu.patch rename to 0105-lib-introduce-feature-check-in-libcriu.patch index e09f927..66897bb 100644 --- a/0110-lib-introduce-feature-check-in-libcriu.patch +++ b/0105-lib-introduce-feature-check-in-libcriu.patch @@ -1,7 +1,7 @@ -From 5b43c3ce81f590866b9330a84526362e3b713d01 Mon Sep 17 00:00:00 2001 +From 0a26cde1b8b454b64951ce1b0b67c937e2188241 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Mon, 6 Dec 2021 16:51:21 +0000 -Subject: [PATCH 110/120] lib: introduce feature check in libcriu +Subject: [PATCH 105/245] lib: introduce feature check in libcriu This commit adds feature check support to libcriu. It already exists in the CLI and RPC and this just extends it to libcriu. @@ -140,5 +140,5 @@ index c6d4f50a8..aed2c3481 100644 } #endif -- -2.34.1 +2.35.1 diff --git a/0111-lib-added-tests-for-feature-check-in-libcriu.patch b/0106-lib-added-tests-for-feature-check-in-libcriu.patch similarity index 96% rename from 0111-lib-added-tests-for-feature-check-in-libcriu.patch rename to 0106-lib-added-tests-for-feature-check-in-libcriu.patch index 82a1efe..9556617 100644 --- a/0111-lib-added-tests-for-feature-check-in-libcriu.patch +++ b/0106-lib-added-tests-for-feature-check-in-libcriu.patch @@ -1,7 +1,7 @@ -From c2a12bb925d343cc6333db7fe5f142d592d5edf6 Mon Sep 17 00:00:00 2001 +From edb88c7c7bddc69e03130507f2f96e03e930c0c0 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Mon, 6 Dec 2021 16:51:21 +0000 -Subject: [PATCH 111/120] lib: added tests for feature check in libcriu +Subject: [PATCH 106/245] lib: added tests for feature check in libcriu Signed-off-by: Adrian Reber --- @@ -128,5 +128,5 @@ index 000000000..d88e0de23 + return 0; +} -- -2.34.1 +2.35.1 diff --git a/0112-pagemap-tiny-fix-on-truncating-memory-image.patch b/0107-pagemap-tiny-fix-on-truncating-memory-image.patch similarity index 93% rename from 0112-pagemap-tiny-fix-on-truncating-memory-image.patch rename to 0107-pagemap-tiny-fix-on-truncating-memory-image.patch index 3f95215..f6b6504 100644 --- a/0112-pagemap-tiny-fix-on-truncating-memory-image.patch +++ b/0107-pagemap-tiny-fix-on-truncating-memory-image.patch @@ -1,7 +1,7 @@ -From 4223e680382586628d6650e289596c3a217326c0 Mon Sep 17 00:00:00 2001 +From 9df7dbdc6168918a8bbf401631885cd14eba62fe Mon Sep 17 00:00:00 2001 From: Liu Hua Date: Thu, 6 Jan 2022 20:44:21 +0800 -Subject: [PATCH 112/120] pagemap: tiny fix on truncating memory image +Subject: [PATCH 107/245] pagemap: tiny fix on truncating memory image When requested iovs are huge, criu needs to invoke more then one preadv()s. In this situation criu truncates memory image with @@ -60,5 +60,5 @@ index d996db7fc..83f69bba3 100644 list_del(&piov->l); -- -2.34.1 +2.35.1 diff --git a/0113-zdtm-fix-zdtm-static-maps00-case-in-arm64.patch b/0108-zdtm-fix-zdtm-static-maps00-case-in-arm64.patch similarity index 91% rename from 0113-zdtm-fix-zdtm-static-maps00-case-in-arm64.patch rename to 0108-zdtm-fix-zdtm-static-maps00-case-in-arm64.patch index 5fdbf49..6c9dcb4 100644 --- a/0113-zdtm-fix-zdtm-static-maps00-case-in-arm64.patch +++ b/0108-zdtm-fix-zdtm-static-maps00-case-in-arm64.patch @@ -1,7 +1,7 @@ -From a162d2b3a0f7715eaef5090631e2ec8c86bdd138 Mon Sep 17 00:00:00 2001 +From 996178e6696ddf3a4a18eeca0c6a3c58a38b07e1 Mon Sep 17 00:00:00 2001 From: "fu.lin" Date: Sun, 16 Jan 2022 18:37:09 +0800 -Subject: [PATCH 113/120] zdtm: fix zdtm/static/maps00 case in arm64 +Subject: [PATCH 108/245] zdtm: fix zdtm/static/maps00 case in arm64 This case sometimes will cause SIGILL signal in arm64 platform. @@ -39,5 +39,5 @@ index 10a4cac79..b1e55e861 100644 if (!(map->flag & MAP_ANONYMOUS)) { uint8_t funlen = (uint8_t *)check_map - (uint8_t *)test_func; -- -2.34.1 +2.35.1 diff --git a/0114-compel-fix-GCC-12-failure-out-of-bounds.patch b/0109-compel-fix-GCC-12-failure-out-of-bounds.patch similarity index 94% rename from 0114-compel-fix-GCC-12-failure-out-of-bounds.patch rename to 0109-compel-fix-GCC-12-failure-out-of-bounds.patch index 60a0001..08b86ad 100644 --- a/0114-compel-fix-GCC-12-failure-out-of-bounds.patch +++ b/0109-compel-fix-GCC-12-failure-out-of-bounds.patch @@ -1,7 +1,7 @@ -From dfada9dfe4545ee19806d8812a85b194b90f08a0 Mon Sep 17 00:00:00 2001 +From 0f99b5243eedf276479a92fbf9213eb15a3c241a Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Tue, 18 Jan 2022 16:49:40 +0000 -Subject: [PATCH 114/120] compel: fix GCC 12 failure (out of bounds) +Subject: [PATCH 109/245] compel: fix GCC 12 failure (out of bounds) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -70,5 +70,5 @@ index bde1bc68b..d67e0d1a9 100644 } -- -2.34.1 +2.35.1 diff --git a/0115-criu-fix-configuration-file-scanner-with-GCC-12.patch b/0110-criu-fix-configuration-file-scanner-with-GCC-12.patch similarity index 89% rename from 0115-criu-fix-configuration-file-scanner-with-GCC-12.patch rename to 0110-criu-fix-configuration-file-scanner-with-GCC-12.patch index 9e1d9ef..118f397 100644 --- a/0115-criu-fix-configuration-file-scanner-with-GCC-12.patch +++ b/0110-criu-fix-configuration-file-scanner-with-GCC-12.patch @@ -1,7 +1,7 @@ -From 93b1526e997cff45b3829aeadb6fac634be7d46f Mon Sep 17 00:00:00 2001 +From d7576bbbae2fbf9eafd81d26203ddcd71698b750 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Tue, 18 Jan 2022 17:20:35 +0000 -Subject: [PATCH 115/120] criu: fix configuration file scanner with GCC 12 +Subject: [PATCH 110/245] criu: fix configuration file scanner with GCC 12 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -32,5 +32,5 @@ index 91fb0b64d..33f2820a1 100644 len = strlen(configuration[i] + offset); for (j = 0; j < len - 1; j++) { -- -2.34.1 +2.35.1 diff --git a/0116-compel-fix-parasite-with-GCC-12.patch b/0111-compel-fix-parasite-with-GCC-12.patch similarity index 90% rename from 0116-compel-fix-parasite-with-GCC-12.patch rename to 0111-compel-fix-parasite-with-GCC-12.patch index 5812efa..734b267 100644 --- a/0116-compel-fix-parasite-with-GCC-12.patch +++ b/0111-compel-fix-parasite-with-GCC-12.patch @@ -1,7 +1,7 @@ -From 04f8368eaee2b29bb92ff0ba4f5c43501408d15e Mon Sep 17 00:00:00 2001 +From 0d33fb189ff89b80e40a82b70e9357df1f5482b2 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Tue, 18 Jan 2022 17:22:46 +0000 -Subject: [PATCH 116/120] compel: fix parasite with GCC 12 +Subject: [PATCH 111/245] compel: fix parasite with GCC 12 Parasite creation started to fail with GCC 12: @@ -39,5 +39,5 @@ index a9a50959f..f461ff04d 100644 #define COMPEL_CFLAGS_PIE CFLAGS_DEFAULT_SET "-fpie" -- -2.34.1 +2.35.1 diff --git a/0117-ci-set-continue-on-error-for-cross-compile.patch b/0112-ci-set-continue-on-error-for-cross-compile.patch similarity index 91% rename from 0117-ci-set-continue-on-error-for-cross-compile.patch rename to 0112-ci-set-continue-on-error-for-cross-compile.patch index be6f62f..6ed4ca4 100644 --- a/0117-ci-set-continue-on-error-for-cross-compile.patch +++ b/0112-ci-set-continue-on-error-for-cross-compile.patch @@ -1,7 +1,7 @@ -From 985b92008c070093f7dd593f7d849e340bdb0493 Mon Sep 17 00:00:00 2001 +From e659ab526e49ee61b4630bd6f77ef825ced8373c Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Thu, 27 Jan 2022 22:13:33 +0000 -Subject: [PATCH 117/120] ci: set continue-on-error for cross-compile +Subject: [PATCH 112/245] ci: set continue-on-error for cross-compile Running cross compile tests with Debian unstable sometimes fails due to missing or outdated packages. @@ -47,5 +47,5 @@ index 461a6e618..be8e7f09c 100644 steps: - uses: actions/checkout@v2 -- -2.34.1 +2.35.1 diff --git a/0118-test-autofs-fix-use-after-free.patch b/0113-test-autofs-fix-use-after-free.patch similarity index 94% rename from 0118-test-autofs-fix-use-after-free.patch rename to 0113-test-autofs-fix-use-after-free.patch index 7ae9cdf..5cbaca4 100644 --- a/0118-test-autofs-fix-use-after-free.patch +++ b/0113-test-autofs-fix-use-after-free.patch @@ -1,7 +1,7 @@ -From d72daddbb48ad705184d6cddfa70df74d1dd3e20 Mon Sep 17 00:00:00 2001 +From 588625722f69f9e7dc976f658910e95d8508619f Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Thu, 27 Jan 2022 14:49:41 +0000 -Subject: [PATCH 118/120] test/autofs: fix use-after-free +Subject: [PATCH 113/245] test/autofs: fix use-after-free autofs.c:66:17: error: pointer 'str' may be used after 'realloc' [-Werror=use-after-free] @@ -63,5 +63,5 @@ index 2d6078627..ad1795842 100644 } -- -2.34.1 +2.35.1 diff --git a/0119-Fix-formatting-in-criu-documentation.patch b/0114-Fix-formatting-in-criu-documentation.patch similarity index 91% rename from 0119-Fix-formatting-in-criu-documentation.patch rename to 0114-Fix-formatting-in-criu-documentation.patch index 3be2173..0e7a8c4 100644 --- a/0119-Fix-formatting-in-criu-documentation.patch +++ b/0114-Fix-formatting-in-criu-documentation.patch @@ -1,7 +1,7 @@ -From c2698b90d7f4f96dc7dfda2a0e61780cafd94b1b Mon Sep 17 00:00:00 2001 +From 103e7ed6f355acd93dc090f4e63e98c7c941f12b Mon Sep 17 00:00:00 2001 From: Ashutosh Mehra Date: Wed, 26 Jan 2022 14:14:38 -0500 -Subject: [PATCH 119/120] Fix formatting in criu documentation +Subject: [PATCH 114/245] Fix formatting in criu documentation Signed-off-by: Ashutosh Mehra --- @@ -40,5 +40,5 @@ index f41b1898c..57b791138 100644 *filesize*::: -- -2.34.1 +2.35.1 diff --git a/0115-ci-install-libbsd-dependency.patch b/0115-ci-install-libbsd-dependency.patch new file mode 100644 index 0000000..c9b8d82 --- /dev/null +++ b/0115-ci-install-libbsd-dependency.patch @@ -0,0 +1,78 @@ +From b917d808bc474321b09751625b3b7e2b03818633 Mon Sep 17 00:00:00 2001 +From: Radostin Stoyanov +Date: Tue, 1 Feb 2022 15:59:14 +0000 +Subject: [PATCH 115/245] ci: install libbsd dependency + +The libbsd dependency is used to enable support for `setproctitle()` +and `strlcpy()`. + +Signed-off-by: Radostin Stoyanov +--- + .cirrus.yml | 4 ++-- + .lgtm.yml | 1 + + scripts/ci/prepare-for-fedora-rawhide.sh | 1 + + scripts/ci/vagrant.sh | 2 +- + 4 files changed, 5 insertions(+), 3 deletions(-) + +diff --git a/.cirrus.yml b/.cirrus.yml +index ef0de54e9..588cf3e82 100644 +--- a/.cirrus.yml ++++ b/.cirrus.yml +@@ -36,7 +36,7 @@ task: + ln -sf /usr/include/google/protobuf/descriptor.proto images/google/protobuf/descriptor.proto + yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm dnf-plugins-core + yum config-manager --set-enabled powertools +- yum install -y --allowerasing asciidoc gcc git gnutls-devel libaio-devel libasan libcap-devel libnet-devel libnl3-devel libselinux-devel make protobuf-c-devel protobuf-devel python3-devel python3-flake8 python3-PyYAML python3-future python3-protobuf xmlto ++ yum install -y --allowerasing asciidoc gcc git gnutls-devel libaio-devel libasan libcap-devel libnet-devel libnl3-devel libbsd-devel libselinux-devel make protobuf-c-devel protobuf-devel python3-devel python3-flake8 python3-PyYAML python3-future python3-protobuf xmlto + alternatives --set python /usr/bin/python3 + systemctl stop sssd + # Even with selinux in permissive mode the selinux tests will be executed +@@ -64,7 +64,7 @@ task: + + setup_script: | + ln -sf /usr/include/google/protobuf/descriptor.proto images/google/protobuf/descriptor.proto +- yum install -y findutils gcc git gnutls-devel iproute iptables libaio-devel libasan libcap-devel libnet-devel libnl3-devel make procps-ng protobuf-c-devel protobuf-devel protobuf-python python python-flake8 python-ipaddress python2-future python2-junit_xml python-yaml python-six sudo tar which e2fsprogs python2-pip rubygem-asciidoctor libselinux-devel ++ yum install -y findutils gcc git gnutls-devel iproute iptables libaio-devel libasan libcap-devel libnet-devel libnl3-devel libbsd-devel make procps-ng protobuf-c-devel protobuf-devel protobuf-python python python-flake8 python-ipaddress python2-future python2-junit_xml python-yaml python-six sudo tar which e2fsprogs python2-pip rubygem-asciidoctor libselinux-devel + # Even with selinux in permissive mode the selinux tests will be executed + # The Cirrus CI user runs as a service from selinux point of view and is + # much more restricted than a normal shell (system_u:system_r:unconfined_service_t:s0) +diff --git a/.lgtm.yml b/.lgtm.yml +index a28c35de0..a884a53ef 100644 +--- a/.lgtm.yml ++++ b/.lgtm.yml +@@ -19,6 +19,7 @@ extraction: + - "iproute2" + - "libcap-dev" + - "libaio-dev" ++ - "libbsd-dev" + - "python3-yaml" + - "libnl-route-3-dev" + - "python-future" +diff --git a/scripts/ci/prepare-for-fedora-rawhide.sh b/scripts/ci/prepare-for-fedora-rawhide.sh +index e5900e563..f4d3155f9 100755 +--- a/scripts/ci/prepare-for-fedora-rawhide.sh ++++ b/scripts/ci/prepare-for-fedora-rawhide.sh +@@ -17,6 +17,7 @@ dnf install -y \ + libcap-devel \ + libnet-devel \ + libnl3-devel \ ++ libbsd-devel \ + make \ + procps-ng \ + protobuf-c-devel \ +diff --git a/scripts/ci/vagrant.sh b/scripts/ci/vagrant.sh +index 4a4a16445..0440193bc 100755 +--- a/scripts/ci/vagrant.sh ++++ b/scripts/ci/vagrant.sh +@@ -37,7 +37,7 @@ setup() { + vagrant ssh-config >> /root/.ssh/config + ssh default sudo dnf upgrade -y + ssh default sudo dnf install -y gcc git gnutls-devel nftables-devel libaio-devel \ +- libasan libcap-devel libnet-devel libnl3-devel make protobuf-c-devel \ ++ libasan libcap-devel libnet-devel libnl3-devel libbsd-devel make protobuf-c-devel \ + protobuf-devel python3-flake8 python3-future python3-protobuf \ + python3-junit_xml rubygem-asciidoctor iptables libselinux-devel libbpf-devel + # Disable sssd to avoid zdtm test failures in pty04 due to sssd socket +-- +2.35.1 + diff --git a/0116-pstree-when-updating-sid-for-shell-job-also-update-m.patch b/0116-pstree-when-updating-sid-for-shell-job-also-update-m.patch new file mode 100644 index 0000000..e73b5f8 --- /dev/null +++ b/0116-pstree-when-updating-sid-for-shell-job-also-update-m.patch @@ -0,0 +1,33 @@ +From 0e6cf87f121c72669d13d32ac8faafae3cc114bc Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Thu, 27 Jan 2022 10:28:29 +0300 +Subject: [PATCH 116/245] pstree: when updating sid for shell job also update + matching pgid + +If we replace old_sid with current_sid we should also do same +replacement for matching pgid (=old_sid). + +Reported in CRIU gitter by Younes Manton (@ymanton) + +Signed-off-by: Pavel Tikhomirov +--- + criu/pstree.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/criu/pstree.c b/criu/pstree.c +index d5080e515..d29de730a 100644 +--- a/criu/pstree.c ++++ b/criu/pstree.c +@@ -382,6 +382,9 @@ static int prepare_pstree_for_shell_job(pid_t pid) + for_each_pstree_item(pi) { + if (pi->sid == old_sid) + pi->sid = current_sid; ++ ++ if (pi->pgid == old_sid) ++ pi->pgid = current_sid; + } + + if (lookup_create_item(current_sid) == NULL) +-- +2.35.1 + diff --git a/0117-criu-ns-fix-exit-code-o-for-criu-dump.patch b/0117-criu-ns-fix-exit-code-o-for-criu-dump.patch new file mode 100644 index 0000000..7e9feb5 --- /dev/null +++ b/0117-criu-ns-fix-exit-code-o-for-criu-dump.patch @@ -0,0 +1,29 @@ +From 991a8231313eeb0e56f70990de5e768e6ef8203b Mon Sep 17 00:00:00 2001 +From: Radostin Stoyanov +Date: Tue, 1 Feb 2022 13:44:42 +0000 +Subject: [PATCH 117/245] criu-ns: fix exit code o for criu dump + +Fixes: #1739 + +Reported-by: @PavloMykhailyshyn +Signed-off-by: Radostin Stoyanov +--- + scripts/criu-ns | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/scripts/criu-ns b/scripts/criu-ns +index 72c0753e5..6aa618218 100755 +--- a/scripts/criu-ns ++++ b/scripts/criu-ns +@@ -203,7 +203,7 @@ def wrap_dump(): + criu_pid = os.fork() + if criu_pid == 0: + run_criu(sys.argv[1:]) +- return _wait_for_process_status(pid) ++ return _wait_for_process_status(criu_pid) + + + def show_usage(): +-- +2.35.1 + diff --git a/0118-criu-ns-use-os.waitstatus_to_exitcode.patch b/0118-criu-ns-use-os.waitstatus_to_exitcode.patch new file mode 100644 index 0000000..6edaaf4 --- /dev/null +++ b/0118-criu-ns-use-os.waitstatus_to_exitcode.patch @@ -0,0 +1,33 @@ +From 278c5b3edd1bcf2515faa10d5e341deae36b8db9 Mon Sep 17 00:00:00 2001 +From: Radostin Stoyanov +Date: Fri, 4 Feb 2022 20:41:07 +0000 +Subject: [PATCH 118/245] criu-ns: use os.waitstatus_to_exitcode() + +os.WEXITSTATUS() returns the process exit status and it should be used +only if WIFEXITED() is true, i.e., the process terminated normally. + +os.waitstatus_to_exitcode() does the same as os.WEXITSTATUS() but it +also handles the case when the process has been terminated by a signal. + +Suggested-by: Andrei Vagin +Signed-off-by: Radostin Stoyanov +--- + scripts/criu-ns | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/scripts/criu-ns b/scripts/criu-ns +index 6aa618218..930d20c80 100755 +--- a/scripts/criu-ns ++++ b/scripts/criu-ns +@@ -68,7 +68,7 @@ def _wait_for_process_status(criu_pid): + try: + (pid, status) = os.wait() + if pid == criu_pid: +- return os.WEXITSTATUS(status) ++ return os.waitstatus_to_exitcode(status) + except OSError: + return -251 + +-- +2.35.1 + diff --git a/0119-restorer-Fix-sys_mmap-s-returned-value-check.patch b/0119-restorer-Fix-sys_mmap-s-returned-value-check.patch new file mode 100644 index 0000000..f14efde --- /dev/null +++ b/0119-restorer-Fix-sys_mmap-s-returned-value-check.patch @@ -0,0 +1,30 @@ +From 85e612fe770ae23f097e43faeec42cabf4b83d21 Mon Sep 17 00:00:00 2001 +From: Bui Quang Minh +Date: Sat, 5 Feb 2022 14:23:38 +0700 +Subject: [PATCH 119/245] restorer: Fix sys_mmap's returned value check + +As we call mmap syscall directly, the returned value in error case is the error +number not -1 like in libc wrapper. Use IS_ERR for correct checking in error +case. + +Signed-off-by: Bui Quang Minh +--- + criu/pie/restorer.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/criu/pie/restorer.c b/criu/pie/restorer.c +index 0051452e4..7aa788181 100644 +--- a/criu/pie/restorer.c ++++ b/criu/pie/restorer.c +@@ -952,7 +952,7 @@ static int vma_remap(VmaEntry *vma_entry, int uffd) + + /* Move src to non-overlapping place (step 3) */ + addr = sys_mmap(NULL, len, PROT_NONE, MAP_PRIVATE | MAP_ANONYMOUS, 0, 0); +- if (addr == (unsigned long)MAP_FAILED) { ++ if (IS_ERR((void *)addr)) { + pr_err("Unable to reserve memory (%lx)\n", addr); + return -1; + } +-- +2.35.1 + diff --git a/0120-compel-fix-how-PTRACE_GET_THREAD_AREA-errors-are-han.patch b/0120-compel-fix-how-PTRACE_GET_THREAD_AREA-errors-are-han.patch new file mode 100644 index 0000000..e5fcac9 --- /dev/null +++ b/0120-compel-fix-how-PTRACE_GET_THREAD_AREA-errors-are-han.patch @@ -0,0 +1,52 @@ +From ce4a2f6accc6dede778dd90b7e54daa6f3b6e3b8 Mon Sep 17 00:00:00 2001 +From: Mike Rapoport +Date: Sun, 13 Feb 2022 08:48:07 +0200 +Subject: [PATCH 120/245] compel: fix how PTRACE_GET_THREAD_AREA errors are + handled + +When PTRACE_GET_THREAD_AREA errors on kernels with +!CONFIG_IA32_EMULATION beacuse of missing support (-EIO), compel should +ignore uch errors in native mode. + +However the check for error type uses return value of ptrace rather than +errno, which will always result in error propagation. + +Use errno to detect type of error to fix this. + +Signed-off-by: Mike Rapoport +--- + compel/arch/x86/src/lib/thread_area.c | 17 +++++++++-------- + 1 file changed, 9 insertions(+), 8 deletions(-) + +diff --git a/compel/arch/x86/src/lib/thread_area.c b/compel/arch/x86/src/lib/thread_area.c +index 4750c6cdd..271d89dcd 100644 +--- a/compel/arch/x86/src/lib/thread_area.c ++++ b/compel/arch/x86/src/lib/thread_area.c +@@ -53,15 +53,16 @@ int __compel_arch_fetch_thread_area(int tid, struct thread_ctx *th) + user_desc_t *d = &ptls->desc[i]; + + err = ptrace(PTRACE_GET_THREAD_AREA, tid, GDT_ENTRY_TLS_MIN + i, d); +- /* +- * Ignoring absent syscall on !CONFIG_IA32_EMULATION +- * where such mixed code can't run. +- * XXX: Add compile CONFIG_X86_IGNORE_64BIT_TLS +- * (for x86_64 systems with CONFIG_IA32_EMULATION) +- */ +- if (err == -EIO && native_mode) +- return 0; + if (err) { ++ /* ++ * Ignoring absent syscall on !CONFIG_IA32_EMULATION ++ * where such mixed code can't run. ++ * XXX: Add compile CONFIG_X86_IGNORE_64BIT_TLS ++ * (for x86_64 systems with CONFIG_IA32_EMULATION) ++ */ ++ if (errno == EIO && native_mode) ++ return 0; ++ + pr_perror("get_thread_area failed for %d", tid); + return err; + } +-- +2.35.1 + diff --git a/0121-util-add-an-unique-ID-of-the-current-criu-run.patch b/0121-util-add-an-unique-ID-of-the-current-criu-run.patch new file mode 100644 index 0000000..4ebcebd --- /dev/null +++ b/0121-util-add-an-unique-ID-of-the-current-criu-run.patch @@ -0,0 +1,72 @@ +From 42ff2dd8d495a8ef50da4bcc76987050993497a7 Mon Sep 17 00:00:00 2001 +From: Andrei Vagin +Date: Sat, 12 Feb 2022 17:17:27 -0800 +Subject: [PATCH 121/245] util: add an unique ID of the current criu run + +This ID will be used to generate resource ID-s that can conflicts with +other CRIU processes. + +Signed-off-by: Andrei Vagin +--- + criu/crtools.c | 2 ++ + criu/include/util.h | 6 ++++++ + criu/util.c | 11 +++++++++++ + 3 files changed, 19 insertions(+) + +diff --git a/criu/crtools.c b/criu/crtools.c +index 0752800f6..3c3491603 100644 +--- a/criu/crtools.c ++++ b/criu/crtools.c +@@ -254,6 +254,8 @@ int main(int argc, char *argv[], char *envp[]) + return 1; + } + ++ util_init(); ++ + if (log_init(opts.output)) + return 1; + +diff --git a/criu/include/util.h b/criu/include/util.h +index 19d378fc5..ca934dea0 100644 +--- a/criu/include/util.h ++++ b/criu/include/util.h +@@ -393,4 +393,10 @@ static inline void cleanup_freep(void *p) + + extern int run_command(char *buf, size_t buf_size, int (*child_fn)(void *), void *args); + ++/* ++ * criu_run_id is a unique value of the current run. It can be used to ++ * generate resource ID-s to avoid conflicts with other CRIU processes. ++ */ ++extern uint64_t criu_run_id; ++extern void util_init(void); + #endif /* __CR_UTIL_H__ */ +diff --git a/criu/util.c b/criu/util.c +index 822822186..d83be0c0d 100644 +--- a/criu/util.c ++++ b/criu/util.c +@@ -27,6 +27,7 @@ + #include + #include + #include ++#include + + #include "linux/mount.h" + +@@ -1804,3 +1805,13 @@ int run_command(char *buf, size_t buf_size, int (*child_fn)(void *), void *args) + + return fret; + } ++ ++uint64_t criu_run_id; ++ ++void util_init() ++{ ++ struct timespec tp; ++ ++ clock_gettime(CLOCK_MONOTONIC, &tp); ++ criu_run_id = ((uint64_t)getpid() << 32) + tp.tv_sec + tp.tv_nsec; ++} +-- +2.35.1 + diff --git a/0122-files-generate-unique-transport-socket-names.patch b/0122-files-generate-unique-transport-socket-names.patch new file mode 100644 index 0000000..0f0275b --- /dev/null +++ b/0122-files-generate-unique-transport-socket-names.patch @@ -0,0 +1,30 @@ +From e55f38cae12e8017c71ac1ee2458379ff5a38ca5 Mon Sep 17 00:00:00 2001 +From: Andrei Vagin +Date: Sat, 12 Feb 2022 17:24:07 -0800 +Subject: [PATCH 122/245] files: generate unique transport socket names + +Transport socket names have to be unique for each criu run. + +Fixes #1735 #1720 + +Signed-off-by: Andrei Vagin +--- + criu/files.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/criu/files.c b/criu/files.c +index 69ebc2e82..429493ccb 100644 +--- a/criu/files.c ++++ b/criu/files.c +@@ -957,7 +957,7 @@ static int receive_fd(struct fdinfo_list_entry *fle); + static void transport_name_gen(struct sockaddr_un *addr, int *len, int pid) + { + addr->sun_family = AF_UNIX; +- snprintf(addr->sun_path, UNIX_PATH_MAX, "x/crtools-fd-%d", pid); ++ snprintf(addr->sun_path, UNIX_PATH_MAX, "x/crtools-fd-%d-%" PRIx64, pid, criu_run_id); + *len = SUN_LEN(addr); + *addr->sun_path = '\0'; + } +-- +2.35.1 + diff --git a/0123-check-Add-a-check-for-using-memfd-with-hugetlb.patch b/0123-check-Add-a-check-for-using-memfd-with-hugetlb.patch new file mode 100644 index 0000000..b81b231 --- /dev/null +++ b/0123-check-Add-a-check-for-using-memfd-with-hugetlb.patch @@ -0,0 +1,107 @@ +From 50810e99345bd770239050d4a7c436c809b9ae09 Mon Sep 17 00:00:00 2001 +From: Bui Quang Minh +Date: Wed, 15 Dec 2021 22:15:21 +0700 +Subject: [PATCH 123/245] check: Add a check for using memfd with hugetlb + +Signed-off-by: Bui Quang Minh +--- + criu/cr-check.c | 10 ++++++++++ + criu/include/kerndat.h | 1 + + criu/kerndat.c | 27 +++++++++++++++++++++++++++ + 3 files changed, 38 insertions(+) + +diff --git a/criu/cr-check.c b/criu/cr-check.c +index 0320b445a..ced084df2 100644 +--- a/criu/cr-check.c ++++ b/criu/cr-check.c +@@ -1368,6 +1368,14 @@ static int check_ns_pid(void) + return 0; + } + ++static int check_memfd_hugetlb(void) ++{ ++ if (!kdat.has_memfd_hugetlb) ++ return -1; ++ ++ return 0; ++} ++ + static int check_network_lock_nftables(void) + { + if (!kdat.has_nftables_concat) { +@@ -1505,6 +1513,7 @@ int cr_check(void) + ret |= check_apparmor_stacking(); + ret |= check_network_lock_nftables(); + ret |= check_sockopt_buf_lock(); ++ ret |= check_memfd_hugetlb(); + } + + /* +@@ -1618,6 +1627,7 @@ static struct feature_list feature_list[] = { + { "apparmor_stacking", check_apparmor_stacking }, + { "network_lock_nftables", check_network_lock_nftables }, + { "sockopt_buf_lock", check_sockopt_buf_lock }, ++ { "memfd_hugetlb", check_memfd_hugetlb }, + { NULL, NULL }, + }; + +diff --git a/criu/include/kerndat.h b/criu/include/kerndat.h +index a28a95802..0de5eb778 100644 +--- a/criu/include/kerndat.h ++++ b/criu/include/kerndat.h +@@ -36,6 +36,7 @@ struct kerndat_s { + u64 zero_page_pfn; + bool has_dirty_track; + bool has_memfd; ++ bool has_memfd_hugetlb; + bool has_fdinfo_lock; + unsigned long task_size; + bool ipv6; +diff --git a/criu/kerndat.c b/criu/kerndat.c +index 9f6a6ec42..b13ebee81 100644 +--- a/criu/kerndat.c ++++ b/criu/kerndat.c +@@ -420,6 +420,29 @@ static bool kerndat_has_memfd_create(void) + return 0; + } + ++static bool kerndat_has_memfd_hugetlb(void) ++{ ++ int ret; ++ ++ if (!kdat.has_memfd) { ++ kdat.has_memfd_hugetlb = false; ++ return 0; ++ } ++ ++ ret = memfd_create("", MFD_HUGETLB); ++ if (ret >= 0) { ++ kdat.has_memfd_hugetlb = true; ++ close(ret); ++ } else if (ret == -1 && errno == EINVAL) { ++ kdat.has_memfd_hugetlb = false; ++ } else { ++ pr_perror("Unexpected error from memfd_create(\"\", MFD_HUGETLB)"); ++ return -1; ++ } ++ ++ return 0; ++} ++ + static int get_task_size(void) + { + kdat.task_size = compel_task_size(); +@@ -1320,6 +1343,10 @@ int kerndat_init(void) + pr_err("kerndat_has_memfd_create failed when initializing kerndat.\n"); + ret = -1; + } ++ if (!ret && kerndat_has_memfd_hugetlb()) { ++ pr_err("kerndat_has_memfd_hugetlb failed when initializing kerndat.\n"); ++ ret = -1; ++ } + if (!ret && kerndat_detect_stack_guard_gap()) { + pr_err("kerndat_detect_stack_guard_gap failed when initializing kerndat.\n"); + ret = -1; +-- +2.35.1 + diff --git a/0124-kerndat-Collect-hugetlb-device-numbers.patch b/0124-kerndat-Collect-hugetlb-device-numbers.patch new file mode 100644 index 0000000..de35537 --- /dev/null +++ b/0124-kerndat-Collect-hugetlb-device-numbers.patch @@ -0,0 +1,414 @@ +From cd8f553d7d165a5e4588ec0914b27a1bfb9d4446 Mon Sep 17 00:00:00 2001 +From: Bui Quang Minh +Date: Wed, 15 Dec 2021 22:26:08 +0700 +Subject: [PATCH 124/245] kerndat: Collect hugetlb device numbers + +These numbers are used to determine whether a memory mapping is backed by +hugetlb and its page size. + +As the hugepage can be allocated more after the first time we collect kerndat, +we need to collect the missing device numbers every time we load the kerndat +cache. + +Signed-off-by: Bui Quang Minh +--- + criu/Makefile.crtools | 1 + + criu/hugetlb.c | 47 +++++++++++++++ + criu/include/hugetlb.h | 55 +++++++++++++++++ + criu/include/kerndat.h | 2 + + criu/include/sizes.h | 50 ++++++++++++++++ + criu/kerndat.c | 130 ++++++++++++++++++++++++++++++++++++----- + 6 files changed, 269 insertions(+), 16 deletions(-) + create mode 100644 criu/hugetlb.c + create mode 100644 criu/include/hugetlb.h + create mode 100644 criu/include/sizes.h + +diff --git a/criu/Makefile.crtools b/criu/Makefile.crtools +index 50a2fa9c5..46d7fd424 100644 +--- a/criu/Makefile.crtools ++++ b/criu/Makefile.crtools +@@ -96,6 +96,7 @@ CFLAGS_pie-util-vdso-elf32.o += -DCONFIG_VDSO_32 + obj-$(CONFIG_COMPAT) += vdso-compat.o + CFLAGS_REMOVE_vdso-compat.o += $(CFLAGS-ASAN) $(CFLAGS-GCOV) + obj-y += pidfd-store.o ++obj-y += hugetlb.o + + PROTOBUF_GEN := scripts/protobuf-gen.sh + +diff --git a/criu/hugetlb.c b/criu/hugetlb.c +new file mode 100644 +index 000000000..aa98662d8 +--- /dev/null ++++ b/criu/hugetlb.c +@@ -0,0 +1,47 @@ ++#include "hugetlb.h" ++#include "kerndat.h" ++#include "sizes.h" ++ ++// clang-format off ++struct htlb_info hugetlb_info[HUGETLB_MAX] = { ++ [HUGETLB_16KB] = { SZ_16K, MAP_HUGETLB_16KB }, ++ [HUGETLB_64KB] = { SZ_64K, MAP_HUGETLB_64KB }, ++ [HUGETLB_512KB] = { SZ_512K, MAP_HUGETLB_512KB }, ++ [HUGETLB_1MB] = { SZ_1M, MAP_HUGETLB_1MB }, ++ [HUGETLB_2MB] = { SZ_2M, MAP_HUGETLB_2MB }, ++ [HUGETLB_8MB] = { SZ_8M, MAP_HUGETLB_8MB }, ++ [HUGETLB_16MB] = { SZ_16M, MAP_HUGETLB_16MB }, ++ [HUGETLB_32MB] = { SZ_32M, MAP_HUGETLB_32MB }, ++ [HUGETLB_256MB] = { SZ_256M, MAP_HUGETLB_256MB }, ++ [HUGETLB_512MB] = { SZ_512M, MAP_HUGETLB_512MB }, ++ [HUGETLB_1GB] = { SZ_1G, MAP_HUGETLB_1GB }, ++ [HUGETLB_2GB] = { SZ_2G, MAP_HUGETLB_2GB }, ++ [HUGETLB_16GB] = { SZ_16G, MAP_HUGETLB_16GB }, ++}; ++// clang-format on ++ ++int is_hugetlb_dev(dev_t dev, int *hugetlb_size_flag) ++{ ++ int i; ++ ++ for (i = 0; i < HUGETLB_MAX; i++) { ++ if (kdat.hugetlb_dev[i] == dev) { ++ if (hugetlb_size_flag) ++ *hugetlb_size_flag = hugetlb_info[i].flag; ++ return 1; ++ } ++ } ++ ++ return 0; ++} ++ ++unsigned long get_size_from_hugetlb_flag(int flag) ++{ ++ int i; ++ ++ for (i = 0; i < HUGETLB_MAX; i++) ++ if (flag == hugetlb_info[i].flag) ++ return hugetlb_info[i].size; ++ ++ return -1; ++} +diff --git a/criu/include/hugetlb.h b/criu/include/hugetlb.h +new file mode 100644 +index 000000000..c0e83652b +--- /dev/null ++++ b/criu/include/hugetlb.h +@@ -0,0 +1,55 @@ ++#ifndef __CR_HUGETLB_H_ ++#define __CR_HUGETLB_H_ ++ ++#include ++#include ++ ++enum hugepage_size { ++ HUGETLB_16KB, ++ HUGETLB_64KB, ++ HUGETLB_512KB, ++ HUGETLB_1MB, ++ HUGETLB_2MB, ++ HUGETLB_8MB, ++ HUGETLB_16MB, ++ HUGETLB_32MB, ++ HUGETLB_256MB, ++ HUGETLB_512MB, ++ HUGETLB_1GB, ++ HUGETLB_2GB, ++ HUGETLB_16GB, ++ HUGETLB_MAX ++}; ++ ++#define MAP_HUGETLB_SHIFT 26 ++#define MAP_HUGETLB_SIZE_MASK (0x3f << MAP_HUGETLB_SHIFT) ++ ++#define MAP_HUGETLB_16KB (14 << MAP_HUGETLB_SHIFT) ++#define MAP_HUGETLB_64KB (16 << MAP_HUGETLB_SHIFT) ++#define MAP_HUGETLB_512KB (19 << MAP_HUGETLB_SHIFT) ++#define MAP_HUGETLB_1MB (20 << MAP_HUGETLB_SHIFT) ++#define MAP_HUGETLB_2MB (21 << MAP_HUGETLB_SHIFT) ++#define MAP_HUGETLB_8MB (23 << MAP_HUGETLB_SHIFT) ++#define MAP_HUGETLB_16MB (24 << MAP_HUGETLB_SHIFT) ++#define MAP_HUGETLB_32MB (25 << MAP_HUGETLB_SHIFT) ++#define MAP_HUGETLB_256MB (28 << MAP_HUGETLB_SHIFT) ++#define MAP_HUGETLB_512MB (29 << MAP_HUGETLB_SHIFT) ++#define MAP_HUGETLB_1GB (30 << MAP_HUGETLB_SHIFT) ++#define MAP_HUGETLB_2GB (31 << MAP_HUGETLB_SHIFT) ++#define MAP_HUGETLB_16GB (34 << MAP_HUGETLB_SHIFT) ++ ++struct htlb_info { ++ unsigned long long size; ++ int flag; ++}; ++ ++extern struct htlb_info hugetlb_info[HUGETLB_MAX]; ++ ++int is_hugetlb_dev(dev_t dev, int *hugetlb_size_flag); ++unsigned long get_size_from_hugetlb_flag(int flag); ++ ++#ifndef MFD_HUGETLB ++#define MFD_HUGETLB 4 ++#endif ++ ++#endif +diff --git a/criu/include/kerndat.h b/criu/include/kerndat.h +index 0de5eb778..25825ee51 100644 +--- a/criu/include/kerndat.h ++++ b/criu/include/kerndat.h +@@ -6,6 +6,7 @@ + #include "common/config.h" + #include "asm/kerndat.h" + #include "util-vdso.h" ++#include "hugetlb.h" + + struct stat; + +@@ -76,6 +77,7 @@ struct kerndat_s { + bool has_nspid; + bool has_nftables_concat; + bool has_sockopt_buf_lock; ++ dev_t hugetlb_dev[HUGETLB_MAX]; + }; + + extern struct kerndat_s kdat; +diff --git a/criu/include/sizes.h b/criu/include/sizes.h +new file mode 100644 +index 000000000..0ec977fc0 +--- /dev/null ++++ b/criu/include/sizes.h +@@ -0,0 +1,50 @@ ++#ifndef __CR_SIZES_H__ ++#define __CR_SIZES_H__ ++ ++/* ++ * Copied from the Linux kernel header include/linux/sizes.h ++ */ ++ ++#define SZ_1 0x00000001 ++#define SZ_2 0x00000002 ++#define SZ_4 0x00000004 ++#define SZ_8 0x00000008 ++#define SZ_16 0x00000010 ++#define SZ_32 0x00000020 ++#define SZ_64 0x00000040 ++#define SZ_128 0x00000080 ++#define SZ_256 0x00000100 ++#define SZ_512 0x00000200 ++ ++#define SZ_1K 0x00000400 ++#define SZ_2K 0x00000800 ++#define SZ_4K 0x00001000 ++#define SZ_8K 0x00002000 ++#define SZ_16K 0x00004000 ++#define SZ_32K 0x00008000 ++#define SZ_64K 0x00010000 ++#define SZ_128K 0x00020000 ++#define SZ_256K 0x00040000 ++#define SZ_512K 0x00080000 ++ ++#define SZ_1M 0x00100000 ++#define SZ_2M 0x00200000 ++#define SZ_4M 0x00400000 ++#define SZ_8M 0x00800000 ++#define SZ_16M 0x01000000 ++#define SZ_32M 0x02000000 ++#define SZ_64M 0x04000000 ++#define SZ_128M 0x08000000 ++#define SZ_256M 0x10000000 ++#define SZ_512M 0x20000000 ++ ++#define SZ_1G 0x40000000 ++#define SZ_2G 0x80000000 ++ ++#define SZ_4G 0x100000000ULL ++#define SZ_8G 0x200000000ULL ++#define SZ_16G 0x400000000ULL ++#define SZ_32G 0x800000000ULL ++#define SZ_64T 0x400000000000ULL ++ ++#endif /* __CR_SIZES_H__ */ +diff --git a/criu/kerndat.c b/criu/kerndat.c +index b13ebee81..da1fb5511 100644 +--- a/criu/kerndat.c ++++ b/criu/kerndat.c +@@ -183,20 +183,12 @@ static int kerndat_files_stat(void) + return 0; + } + +-static int kerndat_get_shmemdev(void) ++static int kerndat_get_dev(dev_t *dev, char *map, size_t size) + { +- void *map; + char maps[128]; + struct stat buf; +- dev_t dev; +- +- map = mmap(NULL, PAGE_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, 0, 0); +- if (map == MAP_FAILED) { +- pr_perror("Can't mmap memory for shmemdev test"); +- return -1; +- } + +- sprintf(maps, "/proc/self/map_files/%lx-%lx", (unsigned long)map, (unsigned long)map + page_size()); ++ sprintf(maps, "/proc/self/map_files/%lx-%lx", (unsigned long)map, (unsigned long)map + size); + if (stat(maps, &buf) < 0) { + int e = errno; + if (errno == EPERM) { +@@ -205,16 +197,34 @@ static int kerndat_get_shmemdev(void) + * OK, let's go the slower route. + */ + +- if (parse_self_maps((unsigned long)map, &dev) < 0) { ++ if (parse_self_maps((unsigned long)map, dev) < 0) { + pr_err("Can't read self maps\n"); +- goto err; ++ return -1; + } + } else { + pr_perror("Can't stat self map_files %d", e); +- goto err; ++ return -1; + } +- } else +- dev = buf.st_dev; ++ } else { ++ *dev = buf.st_dev; ++ } ++ ++ return 0; ++} ++ ++static int kerndat_get_shmemdev(void) ++{ ++ void *map; ++ dev_t dev; ++ ++ map = mmap(NULL, PAGE_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, 0, 0); ++ if (map == MAP_FAILED) { ++ pr_perror("Can't mmap memory for shmemdev test"); ++ return -1; ++ } ++ ++ if (kerndat_get_dev(&dev, map, PAGE_SIZE)) ++ goto err; + + munmap(map, PAGE_SIZE); + kdat.shmem_dev = dev; +@@ -226,6 +236,60 @@ err: + return -1; + } + ++/* Return -1 -- error ++ * Return 0 -- successful but can't get any new device's numbers ++ * Return 1 -- successful and get new device's numbers ++ * ++ * At first, all kdat.hugetlb_dev elements are initialized to 0. ++ * When the function finishes, ++ * kdat.hugetlb_dev[i] == -1 -- this hugetlb page size is not supported ++ * kdat.hugetlb_dev[i] == 0 -- this hugetlb page size is supported but can't collect device's number ++ * Otherwise, kdat.hugetlb_dev[i] contains the corresponding device's number ++ * ++ * Next time the function is called, it only tries to collect the device's number of hugetlb page size ++ * that is supported but can't be collected in the previous call (kdat.hugetlb_dev[i] == 0) ++ */ ++static int kerndat_get_hugetlb_dev(void) ++{ ++ void *map; ++ int i, flag, ret = 0; ++ unsigned long long size; ++ dev_t dev; ++ ++ for (i = 0; i < HUGETLB_MAX; i++) { ++ /* Skip if this hugetlb size is not supported or the device's number has been collected */ ++ if (kdat.hugetlb_dev[i]) ++ continue; ++ ++ size = hugetlb_info[i].size; ++ flag = hugetlb_info[i].flag; ++ map = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_HUGETLB | flag, 0, 0); ++ if (map == MAP_FAILED) { ++ if (errno == EINVAL) { ++ kdat.hugetlb_dev[i] = (dev_t)-1; ++ continue; ++ } else if (errno == ENOMEM) { ++ pr_info("Hugetlb size %llu Mb is supported but cannot get dev's number\n", size >> 20); ++ continue; ++ } else { ++ pr_perror("Unexpected result when get hugetlb dev"); ++ return -1; ++ } ++ } ++ ++ if (kerndat_get_dev(&dev, map, size)) { ++ munmap(map, size); ++ return -1; ++ } ++ ++ munmap(map, size); ++ kdat.hugetlb_dev[i] = dev; ++ ret = 1; ++ pr_info("Found hugetlb device at %" PRIx64 "\n", kdat.hugetlb_dev[i]); ++ } ++ return ret; ++} ++ + static dev_t get_host_dev(unsigned int which) + { + static struct kst { +@@ -1260,13 +1324,43 @@ static int kerndat_has_nftables_concat(void) + #endif + } + ++/* ++ * Some features depend on resource that can be dynamically changed ++ * at the OS runtime. There are cases that we cannot determine the ++ * availability of those features at the first time we run kerndat ++ * check. So in later kerndat checks, we need to retry to get those ++ * information. This function contains calls to those kerndat checks. ++ * ++ * Those kerndat checks must ++ * Return -1 on error ++ * Return 0 when the check is successful but no new information ++ * Return 1 when the check is successful and there is new information ++ */ ++int kerndat_try_load_new(void) ++{ ++ int ret; ++ ++ ret = kerndat_get_hugetlb_dev(); ++ if (ret < 0) ++ return ret; ++ ++ /* New information is found, we need to save to the cache */ ++ if (ret) ++ kerndat_save_cache(); ++ return 0; ++} ++ + int kerndat_init(void) + { + int ret; + + ret = kerndat_try_load_cache(); +- if (ret <= 0) ++ if (ret < 0) + return ret; ++ ++ if (ret == 0) ++ return kerndat_try_load_new(); ++ + ret = 0; + + /* kerndat_try_load_cache can leave some trash in kdat */ +@@ -1283,6 +1377,10 @@ int kerndat_init(void) + pr_err("kerndat_get_shmemdev failed when initializing kerndat.\n"); + ret = -1; + } ++ if (!ret && kerndat_get_hugetlb_dev() < 0) { ++ pr_err("kerndat_get_hugetlb_dev failed when initializing kerndat.\n"); ++ ret = -1; ++ } + if (!ret && kerndat_get_dirty_track()) { + pr_err("kerndat_get_dirty_track failed when initializing kerndat.\n"); + ret = -1; +-- +2.35.1 + diff --git a/0125-ipc-Add-support-for-checkpoint-restore-hugetlb-Syste.patch b/0125-ipc-Add-support-for-checkpoint-restore-hugetlb-Syste.patch new file mode 100644 index 0000000..db714a0 --- /dev/null +++ b/0125-ipc-Add-support-for-checkpoint-restore-hugetlb-Syste.patch @@ -0,0 +1,116 @@ +From b8ec2e49bb3b1403569a0db599338ba5edcac09a Mon Sep 17 00:00:00 2001 +From: Bui Quang Minh +Date: Wed, 15 Dec 2021 22:53:09 +0700 +Subject: [PATCH 125/245] ipc: Add support for checkpoint/restore hugetlb + System V shared memory + +Attach the System V shared memory segments to the address space via shmat() to +determine if they are backed by hugetlb and their page size. Use these +information for setting the correct flags on restore. + +Signed-off-by: Bui Quang Minh +--- + criu/ipc_ns.c | 48 ++++++++++++++++++++++++++++++++++++++++++-- + images/ipc-shm.proto | 1 + + 2 files changed, 47 insertions(+), 2 deletions(-) + +diff --git a/criu/ipc_ns.c b/criu/ipc_ns.c +index a2eb72f28..4fe082fbb 100644 +--- a/criu/ipc_ns.c ++++ b/criu/ipc_ns.c +@@ -15,6 +15,7 @@ + #include "sysctl.h" + #include "ipc_ns.h" + #include "shmem.h" ++#include "types.h" + + #include "protobuf.h" + #include "images/ipc-var.pb-c.h" +@@ -354,6 +355,42 @@ static int dump_ipc_shm_pages(const IpcShmEntry *shm) + return ret; + } + ++static int dump_shm_hugetlb_flag(IpcShmEntry *shm, int id, unsigned long size) ++{ ++ void *addr; ++ int ret, hugetlb_flag, exit_code = -1; ++ struct stat st; ++ char path[64]; ++ ++ addr = shmat(id, NULL, SHM_RDONLY); ++ if (addr == (void *)-1) { ++ pr_perror("Failed to attach shm"); ++ return -1; ++ } ++ ++ /* The shm segment size may not be aligned, ++ * we need to align it up to next page size ++ */ ++ size = (size + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1); ++ snprintf(path, sizeof(path), "/proc/self/map_files/%lx-%lx", (unsigned long)addr, (unsigned long)addr + size); ++ ++ ret = stat(path, &st); ++ if (ret < 0) { ++ pr_perror("Can't stat map_files"); ++ goto detach; ++ } ++ ++ if (is_hugetlb_dev(st.st_dev, &hugetlb_flag)) { ++ shm->has_hugetlb_flag = true; ++ shm->hugetlb_flag = hugetlb_flag | SHM_HUGETLB; ++ } ++ ++ exit_code = 0; ++detach: ++ shmdt(addr); ++ return exit_code; ++} ++ + static int dump_ipc_shm_seg(struct cr_img *img, int id, const struct shmid_ds *ds) + { + IpcShmEntry shm = IPC_SHM_ENTRY__INIT; +@@ -364,6 +401,10 @@ static int dump_ipc_shm_seg(struct cr_img *img, int id, const struct shmid_ds *d + shm.size = ds->shm_segsz; + shm.has_in_pagemaps = true; + shm.in_pagemaps = true; ++ ++ if (dump_shm_hugetlb_flag(&shm, id, ds->shm_segsz)) ++ return -1; ++ + fill_ipc_desc(id, shm.desc, &ds->shm_perm); + pr_info_ipc_shm(&shm); + +@@ -798,7 +839,7 @@ static int prepare_ipc_shm_pages(struct cr_img *img, const IpcShmEntry *shm) + + static int prepare_ipc_shm_seg(struct cr_img *img, const IpcShmEntry *shm) + { +- int ret, id; ++ int ret, id, hugetlb_flag = 0; + struct sysctl_req req[] = { + { "kernel/shm_next_id", &shm->desc->id, CTL_U32 }, + }; +@@ -813,7 +854,10 @@ static int prepare_ipc_shm_seg(struct cr_img *img, const IpcShmEntry *shm) + return ret; + } + +- id = shmget(shm->desc->key, shm->size, shm->desc->mode | IPC_CREAT | IPC_EXCL); ++ if (shm->has_hugetlb_flag) ++ hugetlb_flag = shm->hugetlb_flag; ++ ++ id = shmget(shm->desc->key, shm->size, hugetlb_flag | shm->desc->mode | IPC_CREAT | IPC_EXCL); + if (id == -1) { + pr_perror("Failed to create shm set"); + return -errno; +diff --git a/images/ipc-shm.proto b/images/ipc-shm.proto +index 7865dad8d..c5feebac0 100644 +--- a/images/ipc-shm.proto ++++ b/images/ipc-shm.proto +@@ -8,4 +8,5 @@ message ipc_shm_entry { + required ipc_desc_entry desc = 1; + required uint64 size = 2; + optional bool in_pagemaps = 3; ++ optional uint32 hugetlb_flag = 4; + } +-- +2.35.1 + diff --git a/0125-zdtm-add-simple-test-for-rseq-C-R.patch b/0125-zdtm-add-simple-test-for-rseq-C-R.patch deleted file mode 100644 index f9d2666..0000000 --- a/0125-zdtm-add-simple-test-for-rseq-C-R.patch +++ /dev/null @@ -1,233 +0,0 @@ -From dd043f2fbd5329ff45685ed2009163022f6a6ea3 Mon Sep 17 00:00:00 2001 -From: Alexander Mikhalitsyn -Date: Tue, 21 Dec 2021 23:40:01 +0300 -Subject: [PATCH 06/10] zdtm: add simple test for rseq C/R - -Signed-off-by: Alexander Mikhalitsyn ---- - test/zdtm/static/Makefile | 1 + - test/zdtm/static/rseq.c | 190 +++++++++++++++++++++++++++++++++++++ - test/zdtm/static/rseq.desc | 1 + - 3 files changed, 192 insertions(+) - create mode 100644 test/zdtm/static/rseq.c - create mode 100644 test/zdtm/static/rseq.desc - -diff --git a/test/zdtm/static/Makefile b/test/zdtm/static/Makefile -index 4a21978b5..5a457606c 100644 ---- a/test/zdtm/static/Makefile -+++ b/test/zdtm/static/Makefile -@@ -61,6 +61,7 @@ TST_NOFILE := \ - pthread02 \ - pthread_timers \ - pthread_timers_h \ -+ rseq \ - vdso00 \ - vdso01 \ - vdso02 \ -diff --git a/test/zdtm/static/rseq.c b/test/zdtm/static/rseq.c -new file mode 100644 -index 000000000..f2fccb8f4 ---- /dev/null -+++ b/test/zdtm/static/rseq.c -@@ -0,0 +1,190 @@ -+/* -+ * test for rseq() syscall -+ * See also https://www.efficios.com/blog/2019/02/08/linux-restartable-sequences/ -+ * https://github.com/torvalds/linux/commit/d7822b1e24f2df5df98c76f0e94a5416349ff759 -+ */ -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "zdtmtst.h" -+ -+#if defined(__x86_64__) -+ -+const char *test_doc = "Check that rseq() basic C/R works"; -+const char *test_author = "Alexander Mikhalitsyn "; -+/* parts of code borrowed from https://www.efficios.com/blog/2019/02/08/linux-restartable-sequences/ */ -+ -+/* some useful definitions from kernel uapi */ -+enum rseq_flags { -+ RSEQ_FLAG_UNREGISTER = (1 << 0), -+}; -+ -+struct rseq { -+ uint32_t cpu_id_start; -+ uint32_t cpu_id; -+ uint64_t rseq_cs; -+ uint32_t flags; -+} __attribute__((aligned(4 * sizeof(uint64_t)))); -+ -+#ifndef __NR_rseq -+#define __NR_rseq 334 -+#endif -+/* EOF */ -+ -+static __thread volatile struct rseq __rseq_abi; -+ -+#define RSEQ_SIG 0x53053053 -+#define TESTRSEQ 1 -+#ifdef TESTRSEQ -+static int sys_rseq(volatile struct rseq *rseq_abi, uint32_t rseq_len, int flags, uint32_t sig) -+{ -+ return syscall(__NR_rseq, rseq_abi, rseq_len, flags, sig); -+} -+ -+static void register_thread(void) -+{ -+ int rc; -+ rc = sys_rseq(&__rseq_abi, sizeof(struct rseq), 0, RSEQ_SIG); -+ if (rc) { -+ fail("Failed to register rseq"); -+ exit(1); -+ } -+} -+ -+static void unregister_thread(void) -+{ -+ int rc; -+ rc = sys_rseq(&__rseq_abi, sizeof(struct rseq), RSEQ_FLAG_UNREGISTER, RSEQ_SIG); -+ if (rc) { -+ fail("Failed to unregister rseq"); -+ exit(1); -+ } -+} -+ -+static void check_thread(void) -+{ -+ int rc; -+ rc = sys_rseq(&__rseq_abi, sizeof(struct rseq), 0, RSEQ_SIG); -+ if (!(rc && errno == EBUSY)) { -+ fail("Failed to check rseq %d", rc); -+ exit(1); -+ } -+} -+ -+#define RSEQ_ACCESS_ONCE(x) (*(__volatile__ __typeof__(x) *)&(x)) -+ -+static int rseq_addv(intptr_t *v, intptr_t count, int cpu) -+{ -+ /* clang-format off */ -+ __asm__ __volatile__ goto( -+ ".pushsection __rseq_table, \"aw\"\n\t" -+ ".balign 32\n\t" -+ "cs_obj:\n\t" -+ /* version, flags */ -+ ".long 0, 0\n\t" -+ /* start_ip, post_commit_ip, abort_ip */ -+ ".quad 1f, 2f, 4f\n\t" -+ ".popsection\n\t" -+ "1:\n\t" -+ "leaq cs_obj(%%rip), %%rax\n\t" -+ "movq %%rax, %[rseq_cs]\n\t" -+ "cmpl %[cpu_id], %[current_cpu_id]\n\t" -+ "jnz 4f\n\t" -+ "addq %[count], %[v]\n\t" /* final store */ -+ "2:\n\t" -+ ".pushsection __rseq_failure, \"ax\"\n\t" -+ /* Disassembler-friendly signature: nopl (%rip). */ -+ ".byte 0x0f, 0x1f, 0x05\n\t" -+ ".long 0x53053053\n\t" /* RSEQ_FLAGS */ -+ "4:\n\t" -+ "jmp abort\n\t" -+ ".popsection\n\t" -+ : /* gcc asm goto does not allow outputs */ -+ : [cpu_id] "r" (cpu), -+ [current_cpu_id] "m" (__rseq_abi.cpu_id), -+ [rseq_cs] "m" (__rseq_abi.rseq_cs), -+ /* final store input */ -+ [v] "m" (*v), -+ [count] "er" (count) -+ : "memory", "cc", "rax" -+ : abort -+ ); -+ /* clang-format on */ -+ -+ return 0; -+abort: -+ return -1; -+} -+#endif -+int main(int argc, char *argv[]) -+{ -+#ifdef TESTRSEQ -+ int cpu, ret; -+#endif -+ intptr_t *cpu_data; -+ long nr_cpus = sysconf(_SC_NPROCESSORS_ONLN); -+ -+ test_init(argc, argv); -+ -+ cpu_data = calloc(nr_cpus, sizeof(*cpu_data)); -+ if (!cpu_data) { -+ fail("calloc"); -+ exit(EXIT_FAILURE); -+ } -+ register_thread(); -+ -+ test_msg("Ready for C/R\n"); -+ -+ test_daemon(); -+ test_waitsig(); -+#ifdef TESTRSEQ -+ check_thread(); -+ -+ cpu = RSEQ_ACCESS_ONCE(__rseq_abi.cpu_id_start); -+ ret = rseq_addv(&cpu_data[cpu], 2, cpu); -+ if (ret) -+ fail("Failed to increment per-cpu counter"); -+ else -+ test_msg("cpu_data[%d] == %ld\n", cpu, (long int)cpu_data[cpu]); -+ -+ /* TODO: remove this :) */ -+ (void)cpu; -+ (void)ret; -+ (void)rseq_addv; -+ //unregister_thread(); -+ (void)unregister_thread; -+ (void)register_thread; -+#endif -+ test_msg("cpu, cpu_data %d %ld\n", cpu, (long int)cpu_data[cpu]); -+ if (cpu_data[cpu] == 2) -+ pass(); -+ else -+ fail(); -+ //fail(); -+ //unregister_thread(); -+ //(void)unregister_thread; -+ -+ return 0; -+} -+ -+#else -+ -+int main(int argc, char *argv[]) -+{ -+ test_init(argc, argv); -+ skip("Unsupported arch"); -+ return 0; -+} -+ -+#endif -\ No newline at end of file -diff --git a/test/zdtm/static/rseq.desc b/test/zdtm/static/rseq.desc -new file mode 100644 -index 000000000..0324fa39c ---- /dev/null -+++ b/test/zdtm/static/rseq.desc -@@ -0,0 +1 @@ -+{'flavor': 'h', 'arch': 'x86_64', 'feature': 'get_rseq_conf'} --- -2.34.1 - diff --git a/0126-Revert-ci-disable-glibc-rseq-support.patch b/0126-Revert-ci-disable-glibc-rseq-support.patch deleted file mode 100644 index a351a90..0000000 --- a/0126-Revert-ci-disable-glibc-rseq-support.patch +++ /dev/null @@ -1,49 +0,0 @@ -From bc29294f0746413da4560da3d1e81044d781c7fa Mon Sep 17 00:00:00 2001 -From: Alexander Mikhalitsyn -Date: Tue, 21 Dec 2021 23:42:26 +0300 -Subject: [PATCH 07/10] Revert "ci: disable glibc rseq support" - -Let's see how rseq() C/R feature works - -This reverts commit d99def7dcfa938918368c91021f72a77f738bc61. - -Signed-off-by: Alexander Mikhalitsyn ---- - scripts/build/Dockerfile.fedora.tmpl | 3 --- - scripts/ci/run-ci-tests.sh | 7 +------ - 2 files changed, 1 insertion(+), 9 deletions(-) - -diff --git a/scripts/build/Dockerfile.fedora.tmpl b/scripts/build/Dockerfile.fedora.tmpl -index fd4ba4aef..9d3bb0f87 100644 ---- a/scripts/build/Dockerfile.fedora.tmpl -+++ b/scripts/build/Dockerfile.fedora.tmpl -@@ -1,8 +1,5 @@ - ARG CC=gcc - --# FIXME: Temporary solution for https://github.com/checkpoint-restore/criu/issues/1696 --ENV GLIBC_TUNABLES=glibc.pthread.rseq=0 -- - COPY scripts/ci/prepare-for-fedora-rawhide.sh /bin/prepare-for-fedora-rawhide.sh - RUN /bin/prepare-for-fedora-rawhide.sh - -diff --git a/scripts/ci/run-ci-tests.sh b/scripts/ci/run-ci-tests.sh -index d0cd55f7c..169dc5eaa 100755 ---- a/scripts/ci/run-ci-tests.sh -+++ b/scripts/ci/run-ci-tests.sh -@@ -231,12 +231,7 @@ if [ -n "$TRAVIS" ] || [ -n "$CIRCLECI" ]; then - # Error (criu/tty.c:1014): tty: Don't have tty to inherit session from, aborting - make -C test/others/shell-job/ run - fi -- --# FIXME: rpc tests fail even with set glibc tunable --# https://github.com/checkpoint-restore/criu/issues/1696 --if [ "$GLIBC_TUNABLES" != "glibc.pthread.rseq=0" ]; then -- make -C test/others/rpc/ run --fi -+make -C test/others/rpc/ run - - ./test/zdtm.py run -t zdtm/static/env00 --sibling - --- -2.34.1 - diff --git a/0126-memfd-shmem-Add-support-for-checkpoint-restore-memfd.patch b/0126-memfd-shmem-Add-support-for-checkpoint-restore-memfd.patch new file mode 100644 index 0000000..101e78b --- /dev/null +++ b/0126-memfd-shmem-Add-support-for-checkpoint-restore-memfd.patch @@ -0,0 +1,151 @@ +From 2d241a537ec32e1bb3590f5b63a23221c116af1b Mon Sep 17 00:00:00 2001 +From: Bui Quang Minh +Date: Wed, 15 Dec 2021 23:01:29 +0700 +Subject: [PATCH 126/245] memfd, shmem: Add support for checkpoint/restore + memfd and anon shared memory + +Co-developed-by: Andrei Vagin +Signed-off-by: Bui Quang Minh +--- + criu/memfd.c | 15 +++++++++------ + criu/shmem.c | 32 ++++++++++++++++++++++++++++---- + images/memfd.proto | 1 + + 3 files changed, 38 insertions(+), 10 deletions(-) + +diff --git a/criu/memfd.c b/criu/memfd.c +index cb3704499..84ea00c95 100644 +--- a/criu/memfd.c ++++ b/criu/memfd.c +@@ -18,6 +18,7 @@ + #include "file-ids.h" + #include "namespaces.h" + #include "shmem.h" ++#include "hugetlb.h" + + #include "protobuf.h" + #include "images/memfd.pb-c.h" +@@ -57,18 +58,13 @@ static u32 memfd_inode_ids = 1; + + int is_memfd(dev_t dev) + { +- /* +- * TODO When MAP_HUGETLB is used, the file device is not shmem_dev, +- * Note that other parts of CRIU have similar issues, see +- * is_anon_shmem_map(). +- */ + return dev == kdat.shmem_dev; + } + + static int dump_memfd_inode(int fd, struct memfd_dump_inode *inode, const char *name, const struct stat *st) + { + MemfdInodeEntry mie = MEMFD_INODE_ENTRY__INIT; +- int ret = -1; ++ int ret = -1, flag; + u32 shmid; + + /* +@@ -91,6 +87,10 @@ static int dump_memfd_inode(int fd, struct memfd_dump_inode *inode, const char * + mie.name = (char *)name; + mie.size = st->st_size; + mie.shmid = shmid; ++ if (is_hugetlb_dev(inode->dev, &flag)) { ++ mie.has_hugetlb_flag = true; ++ mie.hugetlb_flag = flag | MFD_HUGETLB; ++ } + + mie.seals = fcntl(fd, F_GET_SEALS); + if (mie.seals == -1) +@@ -258,6 +258,9 @@ static int memfd_open_inode_nocache(struct memfd_restore_inode *inode) + flags = MFD_ALLOW_SEALING; + } + ++ if (mie->has_hugetlb_flag) ++ flags |= mie->hugetlb_flag; ++ + fd = memfd_create(mie->name, flags); + if (fd < 0) { + pr_perror("Can't create memfd:%s", mie->name); +diff --git a/criu/shmem.c b/criu/shmem.c +index a9ee8d7eb..81e701586 100644 +--- a/criu/shmem.c ++++ b/criu/shmem.c +@@ -26,6 +26,7 @@ + #include "memfd.h" + #include "protobuf.h" + #include "images/pagemap.pb-c.h" ++#include "namespaces.h" + + #ifndef SEEK_DATA + #define SEEK_DATA 3 +@@ -534,13 +535,24 @@ out: + return ret; + } + ++struct open_map_file_args { ++ unsigned long addr, size; ++}; ++ ++static int open_map_file(void *args, int fd, pid_t pid) ++{ ++ struct open_map_file_args *vma = args; ++ ++ return open_proc_rw(pid, "map_files/%lx-%lx", vma->addr, vma->addr + vma->size); ++} ++ + static int open_shmem(int pid, struct vma_area *vma) + { + VmaEntry *vi = vma->e; + struct shmem_info *si; + void *addr = MAP_FAILED; + int f = -1; +- int flags; ++ int flags, is_hugetlb, memfd_flag = 0; + + si = shmem_find(vi->shmid); + pr_info("Search for %#016" PRIx64 " shmem 0x%" PRIx64 " %p/%d\n", vi->start, vi->shmid, si, si ? si->pid : -1); +@@ -564,9 +576,17 @@ static int open_shmem(int pid, struct vma_area *vma) + goto out; + } + ++ is_hugetlb = vi->flags & MAP_HUGETLB; ++ + flags = MAP_SHARED; +- if (kdat.has_memfd) { +- f = memfd_create("", 0); ++ if (is_hugetlb) { ++ int size_flag = vi->flags & MAP_HUGETLB_SIZE_MASK; ++ flags |= MAP_HUGETLB | size_flag; ++ memfd_flag |= MFD_HUGETLB | size_flag; ++ } ++ ++ if (kdat.has_memfd && (!is_hugetlb || kdat.has_memfd_hugetlb)) { ++ f = memfd_create("", memfd_flag); + if (f < 0) { + pr_perror("Unable to create memfd"); + goto err; +@@ -599,7 +619,11 @@ static int open_shmem(int pid, struct vma_area *vma) + } + + if (f == -1) { +- f = open_proc_rw(getpid(), "map_files/%lx-%lx", (unsigned long)addr, (unsigned long)addr + si->size); ++ struct open_map_file_args args = { ++ .addr = (unsigned long)addr, ++ .size = si->size, ++ }; ++ f = userns_call(open_map_file, UNS_FDOUT, &args, sizeof(args), -1); + if (f < 0) + goto err; + } +diff --git a/images/memfd.proto b/images/memfd.proto +index a944f145d..0e625416a 100644 +--- a/images/memfd.proto ++++ b/images/memfd.proto +@@ -21,4 +21,5 @@ message memfd_inode_entry { + required uint32 shmid = 5; + required uint32 seals = 6 [(criu).flags = "seals.flags"]; + required uint64 inode_id = 7; ++ optional uint32 hugetlb_flag = 8; + }; +-- +2.35.1 + diff --git a/0127-ci-add-Fedora-Rawhide-based-test-on-Cirrus.patch b/0127-ci-add-Fedora-Rawhide-based-test-on-Cirrus.patch deleted file mode 100644 index 79ad13f..0000000 --- a/0127-ci-add-Fedora-Rawhide-based-test-on-Cirrus.patch +++ /dev/null @@ -1,124 +0,0 @@ -From f35272cd37724a03fd3470066c3b5fca8e5e9d99 Mon Sep 17 00:00:00 2001 -From: Alexander Mikhalitsyn -Date: Thu, 23 Dec 2021 14:57:43 +0300 -Subject: [PATCH 08/10] ci: add Fedora Rawhide based test on Cirrus - -We have ability to use nested virtualization on -Cirrus, and already have "Vagrant Fedora based test (no VDSO)" -test, let's do analogical for Fedora Rawhide to get fresh kernel. - -Suggested-by: Adrian Reber -Signed-off-by: Alexander Mikhalitsyn ---- - .cirrus.yml | 21 +++++++++++++++++++++ - scripts/ci/Makefile | 7 +++++-- - scripts/ci/run-ci-tests.sh | 5 +++++ - scripts/ci/vagrant.sh | 21 +++++++++++++++++++++ - 4 files changed, 52 insertions(+), 2 deletions(-) - -diff --git a/.cirrus.yml b/.cirrus.yml -index ef0de54e9..a7c6f95c6 100644 ---- a/.cirrus.yml -+++ b/.cirrus.yml -@@ -19,6 +19,27 @@ task: - build_script: | - make -C scripts/ci vagrant-fedora-no-vdso - -+task: -+ name: Vagrant Fedora Rawhide based test -+ environment: -+ HOME: "/root" -+ CIRRUS_WORKING_DIR: "/tmp/criu" -+ -+ compute_engine_instance: -+ image_project: cirrus-images -+ image: family/docker-kvm -+ platform: linux -+ cpu: 4 -+ memory: 16G -+ nested_virtualization: true -+ -+ setup_script: | -+ scripts/ci/apt-install make gcc pkg-config git perl-modules iproute2 kmod wget cpu-checker -+ sudo kvm-ok -+ ln -sf /usr/include/google/protobuf/descriptor.proto images/google/protobuf/descriptor.proto -+ build_script: | -+ make -C scripts/ci vagrant-fedora-rawhide -+ - task: - name: CentOS 8 based test - environment: -diff --git a/scripts/ci/Makefile b/scripts/ci/Makefile -index 02b4d871c..9c9264dca 100644 ---- a/scripts/ci/Makefile -+++ b/scripts/ci/Makefile -@@ -41,7 +41,7 @@ export CONTAINER_TERMINAL - ifeq ($(UNAME),x86_64) - # On anything besides x86_64 Travis is running unprivileged LXD - # containers which do not support running docker with '--privileged'. -- CONTAINER_OPTS := --rm $(CONTAINER_TERMINAL) --privileged -v /lib/modules:/lib/modules --tmpfs /run -+ CONTAINER_OPTS := --rm $(CONTAINER_TERMINAL) --privileged --userns=host --cgroupns=host -v /lib/modules:/lib/modules --tmpfs /run - else - CONTAINER_OPTS := --rm -v /lib/modules:/lib/modules --tmpfs /run - endif -@@ -92,7 +92,10 @@ setup-vagrant: - vagrant-fedora-no-vdso: setup-vagrant - ./vagrant.sh fedora-no-vdso - --.PHONY: setup-vagrant vagrant-fedora-no-vdso -+vagrant-fedora-rawhide: setup-vagrant -+ ./vagrant.sh fedora-rawhide -+ -+.PHONY: setup-vagrant vagrant-fedora-no-vdso vagrant-fedora-rawhide - - %: - $(MAKE) -C ../build $@$(target-suffix) -diff --git a/scripts/ci/run-ci-tests.sh b/scripts/ci/run-ci-tests.sh -index 169dc5eaa..f43776ca0 100755 ---- a/scripts/ci/run-ci-tests.sh -+++ b/scripts/ci/run-ci-tests.sh -@@ -192,6 +192,11 @@ if [ "${STREAM_TEST}" = "1" ]; then - exit 0 - fi - -+# print some useful debug info -+cat /proc/self/status -+ls -la /proc/self/ns -+cat /proc/self/cgroup -+ - # shellcheck disable=SC2086 - ./test/zdtm.py run -a -p 2 --keep-going $ZDTM_OPTS - -diff --git a/scripts/ci/vagrant.sh b/scripts/ci/vagrant.sh -index 4a4a16445..aebf83678 100755 ---- a/scripts/ci/vagrant.sh -+++ b/scripts/ci/vagrant.sh -@@ -56,4 +56,25 @@ fedora-no-vdso() { - ssh default 'cd /vagrant/criu/test; sudo ./zdtm.py run -t zdtm/transition/pidfd_store_sk --rpc --pre 2' - } - -+fedora-rawhide() { -+ #ssh default sudo grubby --update-kernel ALL --args="selinux=0 systemd.unified_cgroup_hierarchy=0" -+ ssh default sudo grubby --update-kernel ALL -+ # -+ # Workaround the problem: -+ # error running container: error from /usr/bin/crun creating container for [...]: sd-bus call: Transport endpoint is not connected -+ # Let's just use runc instead of crun -+ # see also https://github.com/kata-containers/tests/issues/4283 -+ # -+ ssh default 'sudo dnf remove -y crun || true' -+ ssh default sudo dnf install -y podman runc -+ vagrant reload -+ #ssh default sudo setenforce 0 -+ ssh default cat /proc/cmdline -+ ssh default ls -la /proc/self/ns -+ ssh default sudo cat /proc/self/status -+ ssh default sudo cat /proc/self/cgroup -+ #ssh default sudo capsh --print -+ ssh default 'cd /vagrant; tar xf criu.tar; cd criu; sudo -E make -C scripts/ci fedora-rawhide CONTAINER_RUNTIME=podman BUILD_OPTIONS="--security-opt seccomp=unconfined"' -+} -+ - $1 --- -2.34.1 - diff --git a/0127-proc_parse-files-Add-support-for-hugetlb-memory-mapp.patch b/0127-proc_parse-files-Add-support-for-hugetlb-memory-mapp.patch new file mode 100644 index 0000000..85eda90 --- /dev/null +++ b/0127-proc_parse-files-Add-support-for-hugetlb-memory-mapp.patch @@ -0,0 +1,127 @@ +From cb412fc56d8b30e3917364e58b3411f1cdc069ab Mon Sep 17 00:00:00 2001 +From: Bui Quang Minh +Date: Wed, 15 Dec 2021 23:03:29 +0700 +Subject: [PATCH 127/245] proc_parse, files: Add support for hugetlb memory + mapping + +When memfd can be used with hugetlb, we use memfd for checkpoint/restore +anonymous shared memory. Otherwise, map_files symlinks is used for +checkpoint/restore anonymous shared memory. + +Signed-off-by: Bui Quang Minh +--- + criu/files.c | 3 ++- + criu/proc_parse.c | 38 +++++++++++++++++++++++++++++++------- + 2 files changed, 33 insertions(+), 8 deletions(-) + +diff --git a/criu/files.c b/criu/files.c +index 429493ccb..7f4b90086 100644 +--- a/criu/files.c ++++ b/criu/files.c +@@ -548,7 +548,8 @@ static int dump_one_file(struct pid *pid, int fd, int lfd, struct fd_opts *opts, + + p.link = &link; + +- if (is_memfd(p.stat.st_dev)) ++ /* TODO: Dump for hugetlb fd when memfd hugetlb is not supported */ ++ if (is_memfd(p.stat.st_dev) || (kdat.has_memfd_hugetlb && is_hugetlb_dev(p.stat.st_dev, NULL))) + ops = &memfd_dump_ops; + else if (link.name[1] == '/') + ops = ®file_dump_ops; +diff --git a/criu/proc_parse.c b/criu/proc_parse.c +index eb3efc877..9009b96f7 100644 +--- a/criu/proc_parse.c ++++ b/criu/proc_parse.c +@@ -41,6 +41,7 @@ + #include "path.h" + #include "fault-injection.h" + #include "memfd.h" ++#include "hugetlb.h" + + #include "protobuf.h" + #include "images/fdinfo.pb-c.h" +@@ -259,7 +260,7 @@ static int vma_stat(struct vma_area *vma, int fd) + static int vma_get_mapfile_user(const char *fname, struct vma_area *vma, struct vma_file_info *vfi, int *vm_file_fd, + const char *path) + { +- int fd; ++ int fd, hugetlb_flag = 0; + dev_t vfi_dev; + + /* +@@ -316,17 +317,19 @@ static int vma_get_mapfile_user(const char *fname, struct vma_area *vma, struct + return -1; + } + +- if (is_anon_shmem_map(vfi_dev)) { ++ if (is_hugetlb_dev(vfi_dev, &hugetlb_flag) || is_anon_shmem_map(vfi_dev)) { + if (!(vma->e->flags & MAP_SHARED)) +- return -1; ++ vma->e->status |= VMA_ANON_PRIVATE; ++ else ++ vma->e->status |= VMA_ANON_SHARED; + + vma->e->flags |= MAP_ANONYMOUS; +- vma->e->status |= VMA_ANON_SHARED; + vma->e->shmid = vfi->ino; ++ vma->e->flags |= hugetlb_flag; + + if (!strncmp(fname, "/SYSV", 5)) { + vma->e->status |= VMA_AREA_SYSVIPC; +- } else { ++ } else if (vma->e->flags & MAP_SHARED) { + if (fault_injected(FI_HUGE_ANON_SHMEM_ID)) + vma->e->shmid += FI_HUGE_ANON_SHMEM_ID_BASE; + } +@@ -576,6 +579,7 @@ static int handle_vma(pid_t pid, struct vma_area *vma_area, const char *file_pat + } + } else if (*vm_file_fd >= 0) { + struct stat *st_buf = vma_area->vmst; ++ int hugetlb_flag = 0; + + if (S_ISREG(st_buf->st_mode)) + /* regular file mapping -- supported */; +@@ -586,7 +590,8 @@ static int handle_vma(pid_t pid, struct vma_area *vma_area, const char *file_pat + goto err; + } + +- if (is_anon_shmem_map(st_buf->st_dev) && !strncmp(file_path, "/SYSV", 5)) { ++ if ((is_anon_shmem_map(st_buf->st_dev) || is_hugetlb_dev(st_buf->st_dev, NULL)) && ++ !strncmp(file_path, "/SYSV", 5)) { + vma_area->e->flags |= MAP_ANONYMOUS; + vma_area->e->status |= VMA_ANON_SHARED; + vma_area->e->shmid = st_buf->st_ino; +@@ -595,10 +600,29 @@ static int handle_vma(pid_t pid, struct vma_area *vma_area, const char *file_pat + pr_info("path: %s\n", file_path); + vma_area->e->status |= VMA_AREA_SYSVIPC; + } else { +- if (is_anon_shmem_map(st_buf->st_dev)) { ++ /* Dump shmem dev, hugetlb dev (private and share) mappings the same way as memfd ++ * when possible. ++ */ ++ if (is_memfd(st_buf->st_dev) || is_anon_shmem_map(st_buf->st_dev) || ++ (kdat.has_memfd_hugetlb && is_hugetlb_dev(st_buf->st_dev, &hugetlb_flag))) { + vma_area->e->status |= VMA_AREA_MEMFD; ++ vma_area->e->flags |= hugetlb_flag; + if (fault_injected(FI_HUGE_ANON_SHMEM_ID)) + vma_area->e->shmid += FI_HUGE_ANON_SHMEM_ID_BASE; ++ } else if (is_hugetlb_dev(st_buf->st_dev, &hugetlb_flag)) { ++ /* hugetlb mapping but memfd does not support HUGETLB */ ++ vma_area->e->flags |= hugetlb_flag; ++ vma_area->e->flags |= MAP_ANONYMOUS; ++ ++ if (vma_area->e->flags & MAP_SHARED) { ++ vma_area->e->status |= VMA_ANON_SHARED; ++ vma_area->e->shmid = st_buf->st_ino; ++ } else { ++ vma_area->e->status |= VMA_ANON_PRIVATE; ++ } ++ ++ close_safe(vm_file_fd); ++ return 0; + } + + if (vma_area->e->flags & MAP_PRIVATE) +-- +2.35.1 + diff --git a/0128-fixup-attempt-to-disable-rseq-at-the-thread-start.patch b/0128-fixup-attempt-to-disable-rseq-at-the-thread-start.patch deleted file mode 100644 index d4a673e..0000000 --- a/0128-fixup-attempt-to-disable-rseq-at-the-thread-start.patch +++ /dev/null @@ -1,96 +0,0 @@ -From 3bef22791deec6280244b43b028044ad7015c5d1 Mon Sep 17 00:00:00 2001 -From: Alexander Mikhalitsyn -Date: Fri, 24 Dec 2021 18:57:54 +0300 -Subject: [PATCH 09/10] fixup: attempt to disable rseq at the thread start - -Signed-off-by: Alexander Mikhalitsyn ---- - criu/clone-noasan.c | 49 +++++++++++++++++++++++++++++++++++++++++++-- - 1 file changed, 47 insertions(+), 2 deletions(-) - -diff --git a/criu/clone-noasan.c b/criu/clone-noasan.c -index d657ea2e8..bcda7865b 100644 ---- a/criu/clone-noasan.c -+++ b/criu/clone-noasan.c -@@ -2,6 +2,10 @@ - #include - #include - -+#if defined(__x86_64__) && (__GLIBC__ >= 2 && __GLIBC_MINOR__ >= 34) -+#include -+#endif -+ - #include - - #include "sched.h" -@@ -34,16 +38,55 @@ - * ... wait for process to finish ... - * unlock_last_pid - */ -+ -+#if defined(__x86_64__) && defined(RSEQ_SIG) -+static inline void * -+thread_pointer (void) -+{ -+ void *result; -+ asm ("mov %%fs:0, %0" : "=r" (result)); -+ return result; -+} -+ -+static inline void -+unregister_rseq_asdf (void) -+{ -+ /* unregister rseq */ -+ syscall(__NR_rseq, (void *)((char *) thread_pointer () + __rseq_offset), __rseq_size, 1, RSEQ_SIG); -+} -+#else -+static inline void -+unregister_rseq_asdf (void) -+{ -+} -+#endif -+ -+struct call_fn_args { -+ int (*fn)(void *); -+ void *arg; -+}; -+ -+int call_fn(void *arg) -+{ -+ struct call_fn_args *a = arg; -+ unregister_rseq_asdf(); -+ return a->fn(a->arg); -+} -+ - int clone_noasan(int (*fn)(void *), int flags, void *arg) - { - void *stack_ptr = (void *)round_down((unsigned long)&stack_ptr - 1024, 16); -+ struct call_fn_args a = { -+ .fn = fn, -+ .arg = arg, -+ }; - - BUG_ON((flags & CLONE_VM) && !(flags & CLONE_VFORK)); - /* - * Reserve some bytes for clone() internal needs - * and use as stack the address above this area. - */ -- return clone(fn, stack_ptr, flags, arg); -+ return clone(call_fn, stack_ptr, flags, (void*)&a); - } - - int clone3_with_pid_noasan(int (*fn)(void *), void *arg, int flags, int exit_signal, pid_t pid) -@@ -78,7 +121,9 @@ int clone3_with_pid_noasan(int (*fn)(void *), void *arg, int flags, int exit_sig - c_args.set_tid = ptr_to_u64(&pid); - c_args.set_tid_size = 1; - pid = syscall(__NR_clone3, &c_args, sizeof(c_args)); -- if (pid == 0) -+ if (pid == 0) { -+ unregister_rseq_asdf(); - exit(fn(arg)); -+ } - return pid; - } --- -2.34.1 - diff --git a/0128-mem-Skip-premapping-hugetlb-mapping.patch b/0128-mem-Skip-premapping-hugetlb-mapping.patch new file mode 100644 index 0000000..b31e9b3 --- /dev/null +++ b/0128-mem-Skip-premapping-hugetlb-mapping.patch @@ -0,0 +1,40 @@ +From 5de55e2f87d815abc30373ee70798644239eb718 Mon Sep 17 00:00:00 2001 +From: Bui Quang Minh +Date: Wed, 9 Feb 2022 22:11:51 +0700 +Subject: [PATCH 128/245] mem: Skip premapping hugetlb mapping + +As we cannot use mremap() to move the hugetlb mapping around until Linux kernel +version 5.16, we need to skip premapping hugetlb mapping. + +Signed-off-by: Bui Quang Minh +--- + criu/mem.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/criu/mem.c b/criu/mem.c +index ca74bfbb6..6b7e4be4b 100644 +--- a/criu/mem.c ++++ b/criu/mem.c +@@ -733,6 +733,9 @@ static inline bool check_cow_vmas(struct vma_area *vma, struct vma_area *pvma) + return false; + if (!vma_area_is_private(pvma, kdat.task_size)) + return false; ++ /* ... but not hugetlb mappings */ ++ if (vma->e->flags & MAP_HUGETLB || pvma->e->flags & MAP_HUGETLB) ++ return false; + /* ... have growsdown and anon flags coincide */ + if ((vma->e->flags ^ pvma->e->flags) & (MAP_GROWSDOWN | MAP_ANONYMOUS)) + return false; +@@ -971,6 +974,9 @@ static int premap_priv_vmas(struct pstree_item *t, struct vm_area_list *vmas, vo + if (!vma_area_is_private(vma, kdat.task_size)) + continue; + ++ if (vma->e->flags & MAP_HUGETLB) ++ continue; ++ + if (vma->pvma == NULL && pr->pieok && !vma_force_premap(vma, &vmas->h)) { + /* + * VMA in question is not shared with anyone. We'll +-- +2.35.1 + diff --git a/0129-uffd-Skip-lazy-mode-restore-on-hugetlb-mappings.patch b/0129-uffd-Skip-lazy-mode-restore-on-hugetlb-mappings.patch new file mode 100644 index 0000000..5a68965 --- /dev/null +++ b/0129-uffd-Skip-lazy-mode-restore-on-hugetlb-mappings.patch @@ -0,0 +1,32 @@ +From 7460bfb291b585fd97803dbe99b5a23b3fd61ab5 Mon Sep 17 00:00:00 2001 +From: Bui Quang Minh +Date: Wed, 9 Feb 2022 22:12:53 +0700 +Subject: [PATCH 129/245] uffd: Skip lazy-mode restore on hugetlb mappings + +As hugetlb mappings are not premapped, they are not registered to uffd service +in restorer code. We must not mark these mappings as PPB_LAZY in generate_iovs() +otherwise when restoring content of these mappings, we will keep looking for in +uffd and get ENOENT because they are not registered. + +Signed-off-by: Bui Quang Minh +--- + criu/include/vma.h | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/criu/include/vma.h b/criu/include/vma.h +index 541d6d6fd..106c56af2 100644 +--- a/criu/include/vma.h ++++ b/criu/include/vma.h +@@ -122,7 +122,8 @@ static inline struct vma_area *vma_next(struct vma_area *vma) + static inline bool vma_entry_can_be_lazy(VmaEntry *e) + { + return ((e->flags & MAP_ANONYMOUS) && (e->flags & MAP_PRIVATE) && !(e->flags & MAP_LOCKED) && +- !(vma_entry_is(e, VMA_AREA_VDSO)) && !(vma_entry_is(e, VMA_AREA_VSYSCALL))); ++ !(vma_entry_is(e, VMA_AREA_VDSO)) && !(vma_entry_is(e, VMA_AREA_VSYSCALL)) && ++ !(e->flags & MAP_HUGETLB)); + } + + #endif /* __CR_VMA_H__ */ +-- +2.35.1 + diff --git a/0129-zdtm-fixup-fix-rseq-test-when-linking-with-fresh-gli.patch b/0129-zdtm-fixup-fix-rseq-test-when-linking-with-fresh-gli.patch deleted file mode 100644 index 85c391a..0000000 --- a/0129-zdtm-fixup-fix-rseq-test-when-linking-with-fresh-gli.patch +++ /dev/null @@ -1,145 +0,0 @@ -From d4274171388ee9594d5ec74451e3de4ac83d9682 Mon Sep 17 00:00:00 2001 -From: Alexander Mikhalitsyn -Date: Fri, 24 Dec 2021 22:56:56 +0300 -Subject: [PATCH 10/10] zdtm fixup: fix rseq test when linking with fresh glibc - -Signed-off-by: Alexander Mikhalitsyn ---- - test/zdtm/static/rseq.c | 58 ++++++++++++++++++++++++++++++++++++----- - 1 file changed, 51 insertions(+), 7 deletions(-) - -diff --git a/test/zdtm/static/rseq.c b/test/zdtm/static/rseq.c -index f2fccb8f4..a679ebd7a 100644 ---- a/test/zdtm/static/rseq.c -+++ b/test/zdtm/static/rseq.c -@@ -19,6 +19,32 @@ - - #include "zdtmtst.h" - -+#if defined(__x86_64__) && (__GLIBC__ >= 2 && __GLIBC_MINOR__ >= 34) -+#include -+#endif -+ -+#if defined(__x86_64__) && defined(RSEQ_SIG) -+static inline void * -+thread_pointer (void) -+{ -+ void *result; -+ asm ("mov %%fs:0, %0" : "=r" (result)); -+ return result; -+} -+ -+static inline void -+unregister_rseq_asdf (void) -+{ -+ /* unregister rseq */ -+ syscall(__NR_rseq, (void *)((char *) thread_pointer () + __rseq_offset), __rseq_size, 1, RSEQ_SIG); -+} -+#else -+static inline void -+unregister_rseq_asdf (void) -+{ -+} -+#endif -+ - #if defined(__x86_64__) - - const char *test_doc = "Check that rseq() basic C/R works"; -@@ -26,6 +52,8 @@ const char *test_author = "Alexander Mikhalitsyn cpu_id), -+ [rseq_cs] "m" (rseq_ptr->rseq_cs), - /* final store input */ - [v] "m" (*v), - [count] "er" (count) -@@ -135,6 +172,13 @@ int main(int argc, char *argv[]) - intptr_t *cpu_data; - long nr_cpus = sysconf(_SC_NPROCESSORS_ONLN); - -+#if RSEQ_TLS_ALLOC -+ rseq_ptr = &__rseq_abi; -+#else -+ //rseq_ptr = malloc(sizeof(struct rseq)); -+ rseq_ptr = mmap(NULL, PAGE_SIZE, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_SHARED, 0, 0); -+#endif -+ - test_init(argc, argv); - - cpu_data = calloc(nr_cpus, sizeof(*cpu_data)); -@@ -151,7 +195,7 @@ int main(int argc, char *argv[]) - #ifdef TESTRSEQ - check_thread(); - -- cpu = RSEQ_ACCESS_ONCE(__rseq_abi.cpu_id_start); -+ cpu = RSEQ_ACCESS_ONCE(rseq_ptr->cpu_id_start); - ret = rseq_addv(&cpu_data[cpu], 2, cpu); - if (ret) - fail("Failed to increment per-cpu counter"); --- -2.34.1 - diff --git a/0130-zdtm-Add-MAP_HUGETLB-memory-mapping-test.patch b/0130-zdtm-Add-MAP_HUGETLB-memory-mapping-test.patch new file mode 100644 index 0000000..c64b8da --- /dev/null +++ b/0130-zdtm-Add-MAP_HUGETLB-memory-mapping-test.patch @@ -0,0 +1,228 @@ +From 0cd3c2e6d5161a7ace1067f32104248d97f3960e Mon Sep 17 00:00:00 2001 +From: Bui Quang Minh +Date: Tue, 26 Oct 2021 22:22:08 +0700 +Subject: [PATCH 130/245] zdtm: Add MAP_HUGETLB memory mapping test + +This commit add a test for checkpoint/restore MAP_HUGETLB memory mappings. +A new zdtm helper get_mapping_dev() is added to get the device number of +the memory mapping. + +Signed-off-by: Bui Quang Minh +--- + test/zdtm.py | 15 +++++++ + test/zdtm/lib/Makefile | 2 +- + test/zdtm/lib/mem.c | 32 ++++++++++++++ + test/zdtm/lib/zdtmtst.h | 1 + + test/zdtm/static/Makefile | 1 + + test/zdtm/static/maps09.c | 89 +++++++++++++++++++++++++++++++++++++++ + 6 files changed, 139 insertions(+), 1 deletion(-) + create mode 100644 test/zdtm/lib/mem.c + create mode 100644 test/zdtm/static/maps09.c + +diff --git a/test/zdtm.py b/test/zdtm.py +index 14e6aa1b0..cf73a17ae 100755 +--- a/test/zdtm.py ++++ b/test/zdtm.py +@@ -2566,6 +2566,17 @@ def clean_stuff(opts): + f.clean() + + ++def set_nr_hugepages(nr): ++ orig_hugepages = 0 ++ with open("/proc/sys/vm/nr_hugepages", "r") as f: ++ orig_hugepages = int(f.read()) ++ ++ with open("/proc/sys/vm/nr_hugepages", "w") as f: ++ f.write("{}\n".format(nr)) ++ ++ return orig_hugepages ++ ++ + # + # main() starts here + # +@@ -2738,7 +2749,11 @@ if opts['action'] == 'run': + for tst in test_classes.values(): + tst.available() + ++orig_hugepages = set_nr_hugepages(20) ++ + opts['action'](opts) + ++set_nr_hugepages(orig_hugepages) ++ + for tst in test_classes.values(): + tst.cleanup() +diff --git a/test/zdtm/lib/Makefile b/test/zdtm/lib/Makefile +index ceec2b878..3ec58dfaf 100644 +--- a/test/zdtm/lib/Makefile ++++ b/test/zdtm/lib/Makefile +@@ -4,7 +4,7 @@ CFLAGS += $(USERCFLAGS) + + LIB := libzdtmtst.a + +-LIBSRC := datagen.c msg.c parseargs.c test.c streamutil.c lock.c ns.c tcp.c unix.c fs.c sysctl.c ++LIBSRC := datagen.c msg.c parseargs.c test.c streamutil.c lock.c ns.c tcp.c unix.c fs.c sysctl.c mem.c + + PKG_CONFIG ?= pkg-config + pkg-config-check = $(shell sh -c '$(PKG_CONFIG) $(1) && echo y') +diff --git a/test/zdtm/lib/mem.c b/test/zdtm/lib/mem.c +new file mode 100644 +index 000000000..f612e7a15 +--- /dev/null ++++ b/test/zdtm/lib/mem.c +@@ -0,0 +1,32 @@ ++#include ++#include ++#include ++ ++#include "zdtmtst.h" ++ ++dev_t get_mapping_dev(void *addr) ++{ ++ char buf[1024]; ++ FILE *f; ++ unsigned int major, minor; ++ int ret; ++ ++ f = fopen("/proc/self/maps", "r"); ++ if (f == NULL) { ++ pr_perror("Failed to open maps file"); ++ return (dev_t)-1; ++ } ++ ++ while (fgets(buf, sizeof(buf), f)) { ++ if ((unsigned long)addr == strtoul(buf, NULL, 16)) { ++ ret = sscanf(buf, "%*x-%*x %*c%*c%*c%*c %*x %x:%x", &major, &minor); ++ if (ret != 2) { ++ pr_err("Can't parse /proc/self/maps\n"); ++ return (dev_t)-1; ++ } ++ return makedev(major, minor); ++ } ++ } ++ ++ return (dev_t)-1; ++} +diff --git a/test/zdtm/lib/zdtmtst.h b/test/zdtm/lib/zdtmtst.h +index c6d77011d..803d33e3d 100644 +--- a/test/zdtm/lib/zdtmtst.h ++++ b/test/zdtm/lib/zdtmtst.h +@@ -164,6 +164,7 @@ extern const char *test_doc; + extern int tcp_init_server_with_opts(int family, int *port, struct zdtm_tcp_opts *opts); + extern pid_t sys_clone_unified(unsigned long flags, void *child_stack, void *parent_tid, void *child_tid, + unsigned long newtls); ++extern dev_t get_mapping_dev(void *addr); + + #define ssprintf(s, fmt, ...) \ + ({ \ +diff --git a/test/zdtm/static/Makefile b/test/zdtm/static/Makefile +index 4a21978b5..0e5f096fa 100644 +--- a/test/zdtm/static/Makefile ++++ b/test/zdtm/static/Makefile +@@ -131,6 +131,7 @@ TST_NOFILE := \ + maps02 \ + maps04 \ + maps05 \ ++ maps09 \ + mlock_setuid \ + xids00 \ + groups \ +diff --git a/test/zdtm/static/maps09.c b/test/zdtm/static/maps09.c +new file mode 100644 +index 000000000..216263b4c +--- /dev/null ++++ b/test/zdtm/static/maps09.c +@@ -0,0 +1,89 @@ ++#include ++ ++#include "zdtmtst.h" ++ ++#define MEM_SIZE (4UL * (1UL << 20)) /* 4MB */ ++#define MEM_OFFSET (MEM_SIZE - PAGE_SIZE) ++ ++const char *test_doc = "Test MAP_HUGETLB mapping"; ++const char *test_author = "Bui Quang Minh "; ++ ++int main(int argc, char **argv) ++{ ++ void *m1, *m2; ++ dev_t dev1, dev2; ++ uint32_t crc; ++ ++ test_init(argc, argv); ++ m1 = mmap(NULL, MEM_SIZE, PROT_READ | PROT_WRITE, MAP_HUGETLB | MAP_SHARED | MAP_ANONYMOUS, 0, 0); ++ if (m1 == MAP_FAILED) { ++ pr_perror("Failed to mmap %lu Mb anonymous shared memory", MEM_SIZE >> 20); ++ return 1; ++ } ++ ++ dev1 = get_mapping_dev(m1); ++ if (dev1 == (dev_t)-1) { ++ fail("Can't get mapping dev"); ++ return 1; ++ } ++ ++ m2 = mmap(NULL, MEM_SIZE, PROT_READ | PROT_WRITE, MAP_HUGETLB | MAP_PRIVATE | MAP_ANONYMOUS, 0, 0); ++ if (m2 == MAP_FAILED) { ++ pr_perror("Failed to mmap %lu Mb anonymous private memory", MEM_SIZE >> 20); ++ return 1; ++ } ++ ++ dev2 = get_mapping_dev(m2); ++ if (dev2 == (dev_t)-1) { ++ fail("Can't get mapping dev"); ++ return 1; ++ } ++ ++ crc = ~0; ++ datagen(m1, PAGE_SIZE, &crc); ++ crc = ~0; ++ datagen(m1 + MEM_OFFSET, PAGE_SIZE, &crc); ++ crc = ~0; ++ datagen(m2, PAGE_SIZE, &crc); ++ crc = ~0; ++ datagen(m2 + MEM_OFFSET, PAGE_SIZE, &crc); ++ crc = ~0; ++ ++ test_daemon(); ++ test_waitsig(); ++ ++ crc = ~0; ++ if (datachk(m1, PAGE_SIZE, &crc)) { ++ fail("Data mismatch"); ++ return 1; ++ } ++ crc = ~0; ++ if (datachk(m1 + MEM_OFFSET, PAGE_SIZE, &crc)) { ++ fail("Data mismatch"); ++ return 1; ++ } ++ crc = ~0; ++ if (datachk(m2, PAGE_SIZE, &crc)) { ++ fail("Data mismatch"); ++ return 1; ++ } ++ crc = ~0; ++ if (datachk(m2 + MEM_OFFSET, PAGE_SIZE, &crc)) { ++ fail("Data mismatch"); ++ return 1; ++ } ++ ++ if (dev1 != get_mapping_dev(m1)) { ++ fail("Mapping dev mismatch"); ++ return 1; ++ } ++ ++ if (dev2 != get_mapping_dev(m2)) { ++ fail("Mapping dev mismatch"); ++ return 1; ++ } ++ ++ pass(); ++ ++ return 0; ++} +-- +2.35.1 + diff --git a/0131-zdtm-Add-memfd-hugetlb-test.patch b/0131-zdtm-Add-memfd-hugetlb-test.patch new file mode 100644 index 0000000..a3daadb --- /dev/null +++ b/0131-zdtm-Add-memfd-hugetlb-test.patch @@ -0,0 +1,166 @@ +From ee16f173785327667bc4702e6c2f1c0419d6fc95 Mon Sep 17 00:00:00 2001 +From: Bui Quang Minh +Date: Tue, 26 Oct 2021 22:31:44 +0700 +Subject: [PATCH 131/245] zdtm: Add memfd hugetlb test + +Signed-off-by: Bui Quang Minh +--- + test/zdtm/static/Makefile | 2 ++ + test/zdtm/static/memfd02-hugetlb.c | 1 + + test/zdtm/static/memfd02-hugetlb.desc | 1 + + test/zdtm/static/memfd02.c | 52 +++++++++++++++++++++++---- + 4 files changed, 50 insertions(+), 6 deletions(-) + create mode 120000 test/zdtm/static/memfd02-hugetlb.c + create mode 100644 test/zdtm/static/memfd02-hugetlb.desc + +diff --git a/test/zdtm/static/Makefile b/test/zdtm/static/Makefile +index 0e5f096fa..3b244e52d 100644 +--- a/test/zdtm/static/Makefile ++++ b/test/zdtm/static/Makefile +@@ -248,6 +248,7 @@ TST_NOFILE := \ + memfd00 \ + memfd01 \ + memfd02 \ ++ memfd02-hugetlb \ + memfd03 \ + shmemfd \ + shmemfd-priv \ +@@ -618,6 +619,7 @@ socket-tcp6-closing: CFLAGS += -D ZDTM_IPV6 + socket-tcp6-unconn: CFLAGS += -D ZDTM_IPV6 + socket-tcp4v6-last-ack: CFLAGS += -D ZDTM_TCP_LAST_ACK -D ZDTM_IPV4V6 + socket-tcp4v6-closing: CFLAGS += -D ZDTM_IPV4V6 ++memfd02-hugetlb: CFLAGS += -D ZDTM_HUGETLB + + sockets00-seqpacket: CFLAGS += -D ZDTM_UNIX_SEQPACKET + sockets01-seqpacket: CFLAGS += -D ZDTM_UNIX_SEQPACKET +diff --git a/test/zdtm/static/memfd02-hugetlb.c b/test/zdtm/static/memfd02-hugetlb.c +new file mode 120000 +index 000000000..db0820633 +--- /dev/null ++++ b/test/zdtm/static/memfd02-hugetlb.c +@@ -0,0 +1 @@ ++memfd02.c +\ No newline at end of file +diff --git a/test/zdtm/static/memfd02-hugetlb.desc b/test/zdtm/static/memfd02-hugetlb.desc +new file mode 100644 +index 000000000..f88ad828b +--- /dev/null ++++ b/test/zdtm/static/memfd02-hugetlb.desc +@@ -0,0 +1 @@ ++{'feature': 'memfd_hugetlb'} +diff --git a/test/zdtm/static/memfd02.c b/test/zdtm/static/memfd02.c +index 12e294921..8950e38e2 100644 +--- a/test/zdtm/static/memfd02.c ++++ b/test/zdtm/static/memfd02.c +@@ -13,6 +13,10 @@ + + #include "zdtmtst.h" + ++#ifndef MFD_HUGETLB ++#define MFD_HUGETLB 4 ++#endif ++ + const char *test_doc = "memfd mmap"; + const char *test_author = "Nicolas Viennot "; + +@@ -29,14 +33,24 @@ static int _memfd_create(const char *name, unsigned int flags) + + int main(int argc, char *argv[]) + { ++#ifdef ZDTM_HUGETLB ++#define LEN (2 * (1 << 20)) /* 2MB */ ++#else + #define LEN 6 +- int fd; ++#endif ++ ++ int fd, flag = 0; + void *addr_shared, *addr_private; + char buf[LEN]; ++ dev_t dev1, dev2; + + test_init(argc, argv); + +- fd = _memfd_create("somename", MFD_CLOEXEC); ++#ifdef ZDTM_HUGETLB ++ flag = MFD_HUGETLB; ++#endif ++ ++ fd = _memfd_create("somename", MFD_CLOEXEC | flag); + if (fd < 0) + err(1, "Can't call memfd_create"); + +@@ -47,16 +61,32 @@ int main(int argc, char *argv[]) + if (addr_shared == MAP_FAILED) + err(1, "Can't mmap"); + ++ dev1 = get_mapping_dev(addr_shared); ++ if (dev1 == (dev_t)-1) { ++ fail("Can't get mapping dev"); ++ return 1; ++ } ++ ++#ifdef ZDTM_HUGETLB ++ strcpy(addr_shared, "write1"); ++#else + write(fd, "write1", LEN); ++#endif + + addr_private = mmap(NULL, LEN, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0); + if (addr_private == MAP_FAILED) + err(1, "Can't mmap"); + ++ dev2 = get_mapping_dev(addr_private); ++ if (dev2 == (dev_t)-1) { ++ fail("Can't get mapping dev"); ++ return 1; ++ } ++ + test_daemon(); + test_waitsig(); + +- if (memcmp(addr_shared, "write1", LEN)) { ++ if (strncmp(addr_shared, "write1", LEN)) { + fail("content mismatch (shared)"); + return 1; + } +@@ -68,23 +98,33 @@ int main(int argc, char *argv[]) + return 1; + } + +- if (memcmp(buf, "write2", LEN)) { ++ if (strncmp(buf, "write2", LEN)) { + fail("content mismatch (shared)"); + return 1; + } + +- if (memcmp(addr_private, "write2", LEN)) { ++ if (strncmp(addr_private, "write2", LEN)) { + fail("content mismatch (private)"); + return 1; + } + + strcpy(addr_private, "write3"); + +- if (memcmp(addr_shared, "write2", LEN)) { ++ if (strncmp(addr_shared, "write2", LEN)) { + fail("content mismatch (shared)"); + return 1; + } + ++ if (dev1 != get_mapping_dev(addr_shared)) { ++ fail("Mapping dev mismatch"); ++ return 1; ++ } ++ ++ if (dev2 != get_mapping_dev(addr_private)) { ++ fail("Mapping dev mismatch"); ++ return 1; ++ } ++ + pass(); + + return 0; +-- +2.35.1 + diff --git a/0132-zdtm-Add-shm-hugetlb-test.patch b/0132-zdtm-Add-shm-hugetlb-test.patch new file mode 100644 index 0000000..098ef94 --- /dev/null +++ b/0132-zdtm-Add-shm-hugetlb-test.patch @@ -0,0 +1,121 @@ +From fcb4236677ec1b8cbf53f5a513a173d39cc23e24 Mon Sep 17 00:00:00 2001 +From: Bui Quang Minh +Date: Tue, 26 Oct 2021 22:34:22 +0700 +Subject: [PATCH 132/245] zdtm: Add shm hugetlb test + +Signed-off-by: Bui Quang Minh +--- + test/zdtm/static/Makefile | 5 +++++ + test/zdtm/static/shm-hugetlb.c | 1 + + test/zdtm/static/shm-hugetlb.desc | 1 + + test/zdtm/static/shm.c | 22 +++++++++++++++++++--- + 4 files changed, 26 insertions(+), 3 deletions(-) + create mode 120000 test/zdtm/static/shm-hugetlb.c + create mode 100644 test/zdtm/static/shm-hugetlb.desc + +diff --git a/test/zdtm/static/Makefile b/test/zdtm/static/Makefile +index 3b244e52d..48aa8587d 100644 +--- a/test/zdtm/static/Makefile ++++ b/test/zdtm/static/Makefile +@@ -436,6 +436,7 @@ TST = \ + umask00 \ + cmdlinenv00 \ + shm-unaligned \ ++ shm-hugetlb \ + + TST_STATE = \ + conntracks \ +@@ -475,6 +476,9 @@ cmdlinenv00.pid: cmdlinenv00 + shm-unaligned.pid: shm-unaligned + $( +Date: Fri, 31 Dec 2021 17:15:18 +0700 +Subject: [PATCH 133/245] zdtm: Add MAP_HUGETLB mappings test for parent-child + relationship processes + +Signed-off-by: Bui Quang Minh +--- + test/zdtm/static/Makefile | 1 + + test/zdtm/static/maps10.c | 136 ++++++++++++++++++++++++++++++++++++++ + 2 files changed, 137 insertions(+) + create mode 100644 test/zdtm/static/maps10.c + +diff --git a/test/zdtm/static/Makefile b/test/zdtm/static/Makefile +index 48aa8587d..1b057c70c 100644 +--- a/test/zdtm/static/Makefile ++++ b/test/zdtm/static/Makefile +@@ -132,6 +132,7 @@ TST_NOFILE := \ + maps04 \ + maps05 \ + maps09 \ ++ maps10 \ + mlock_setuid \ + xids00 \ + groups \ +diff --git a/test/zdtm/static/maps10.c b/test/zdtm/static/maps10.c +new file mode 100644 +index 000000000..51e37863b +--- /dev/null ++++ b/test/zdtm/static/maps10.c +@@ -0,0 +1,136 @@ ++#include ++#include ++#include ++#include ++#include ++#include "zdtmtst.h" ++ ++const char *test_doc = "Test MAP_HUGETLB mapping in parent-child relationship processes"; ++const char *test_author = "Bui Quang Minh "; ++ ++#define MEM_SIZE (2UL * (1UL << 20)) /* 2MB */ ++ ++int main(int argc, char **argv) ++{ ++ void *p1, *p2, *s1; ++ task_waiter_t t; ++ pid_t pid; ++ uint32_t crc, tmp_crc; ++ int status; ++ ++ test_init(argc, argv); ++ task_waiter_init(&t); ++ ++ p1 = mmap(NULL, MEM_SIZE, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_HUGETLB, 0, 0); ++ if (p1 == MAP_FAILED) { ++ pr_perror("Map failed"); ++ return 1; ++ } ++ ++ p2 = mmap(NULL, MEM_SIZE, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_HUGETLB, 0, 0); ++ if (p2 == MAP_FAILED) { ++ pr_perror("Map failed"); ++ return 1; ++ } ++ ++ s1 = mmap(NULL, MEM_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS | MAP_HUGETLB, 0, 0); ++ if (s1 == MAP_FAILED) { ++ pr_perror("Map failed"); ++ return 1; ++ } ++ ++ crc = ~0; ++ datagen(p1, MEM_SIZE, &crc); ++ crc = ~0; ++ datagen(p2, MEM_SIZE, &crc); ++ tmp_crc = crc; ++ ++ pid = test_fork(); ++ if (pid < 0) { ++ pr_perror("fork failed"); ++ return 1; ++ } ++ ++ if (pid == 0) { ++ crc = ~0; ++ datagen(p2, MEM_SIZE, &crc); ++ tmp_crc = crc; ++ crc = ~0; ++ datagen(s1, MEM_SIZE, &crc); ++ ++ task_waiter_complete(&t, 1); ++ test_waitsig(); ++ ++ crc = ~0; ++ if (datachk(p1, MEM_SIZE, &crc)) { ++ fail("Data mismatch"); ++ return 1; ++ } ++ ++ crc = ~0; ++ if (datachk(p2, MEM_SIZE, &crc)) { ++ fail("Data mismatch"); ++ return 1; ++ } ++ ++ if (crc != tmp_crc) { ++ fail("Data mismatch"); ++ return 1; ++ } ++ ++ crc = ~0; ++ if (datachk(s1, MEM_SIZE, &crc)) { ++ fail("Data mismatch"); ++ return 1; ++ } ++ ++ return 0; ++ } ++ ++ task_waiter_wait4(&t, 1); ++ ++ test_daemon(); ++ test_waitsig(); ++ ++ kill(pid, SIGTERM); ++ wait(&status); ++ if (WIFEXITED(status)) { ++ if (WEXITSTATUS(status)) ++ goto err; ++ } else { ++ goto err; ++ } ++ ++ crc = ~0; ++ if (datachk(p1, MEM_SIZE, &crc)) { ++ fail("Data mismatch"); ++ return 1; ++ } ++ ++ crc = ~0; ++ if (datachk(p2, MEM_SIZE, &crc)) { ++ fail("Data mismatch"); ++ return 1; ++ } ++ ++ if (crc != tmp_crc) { ++ fail("Data mismatch"); ++ return 1; ++ } ++ ++ crc = ~0; ++ if (datachk(s1, MEM_SIZE, &crc)) { ++ fail("Data mismatch"); ++ return 1; ++ } ++ ++ pass(); ++ ++ return 0; ++err: ++ if (waitpid(-1, NULL, WNOHANG) == 0) { ++ kill(pid, SIGTERM); ++ wait(NULL); ++ } ++ return 1; ++} +\ No newline at end of file +-- +2.35.1 + diff --git a/0134-ci-skip-MAP_HUGETLB-tests-in-stream-test.patch b/0134-ci-skip-MAP_HUGETLB-tests-in-stream-test.patch new file mode 100644 index 0000000..02a993d --- /dev/null +++ b/0134-ci-skip-MAP_HUGETLB-tests-in-stream-test.patch @@ -0,0 +1,40 @@ +From 09c33d32399abd1a60a87a016560f44f73d0e5ea Mon Sep 17 00:00:00 2001 +From: Bui Quang Minh +Date: Sat, 12 Feb 2022 16:00:39 +0700 +Subject: [PATCH 134/245] ci: skip MAP_HUGETLB tests in stream test + +Currently, hugetlb mappings is not premapped so in the restore content phase, we +skip page read these pages, enqueue the iovec for later reading in restorer and +eventually close the page read. However, image-streamer expects the whole image +to be read and the image is not re-opened, sent twice. These MAP_HUGETLB test +cases will result in EPIPE error. Temporarily disable these test cases for now. + +Signed-off-by: Bui Quang Minh +--- + scripts/ci/run-ci-tests.sh | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +diff --git a/scripts/ci/run-ci-tests.sh b/scripts/ci/run-ci-tests.sh +index d0cd55f7c..50216634e 100755 +--- a/scripts/ci/run-ci-tests.sh ++++ b/scripts/ci/run-ci-tests.sh +@@ -63,8 +63,15 @@ ci_prep () { + + test_stream() { + # Testing CRIU streaming to criu-image-streamer ++ ++ # FIXME: Currently, hugetlb mappings is not premapped, so in the restore content ++ # phase, we skip page read these pages, enqueue the iovec for later reading in ++ # restorer and eventually close the page read. However, image-streamer expects the ++ # whole image to be read and the image is not reopened, sent twice. These MAP_HUGETLB ++ # test cases will result in EPIPE error at the moment. ++ STREAM_TEST_EXCLUDE="-x maps09 -x maps10" + # shellcheck disable=SC2086 +- ./test/zdtm.py run --stream -p 2 --keep-going -a $ZDTM_OPTS ++ ./test/zdtm.py run --stream -p 2 --keep-going -a $STREAM_TEST_EXCLUDE $ZDTM_OPTS + } + + print_header() { +-- +2.35.1 + diff --git a/0135-bpfmap-handle-new-field-in-fdinfo.patch b/0135-bpfmap-handle-new-field-in-fdinfo.patch new file mode 100644 index 0000000..2dce9aa --- /dev/null +++ b/0135-bpfmap-handle-new-field-in-fdinfo.patch @@ -0,0 +1,124 @@ +From ab887fa5e04c2605464e6b4f6f6582c6c3b8d1c2 Mon Sep 17 00:00:00 2001 +From: Adrian Reber +Date: Tue, 15 Feb 2022 16:55:45 +0000 +Subject: [PATCH 135/245] bpfmap: handle new field in fdinfo + +Starting with Linux Kernel release 5.16 the fdinfo proc entry contains +a map_extra field which breaks CRIU parsing of bpfmap entries. + +This commit adds the map_extra as a possible field to CRIU. The value of +map_extra is not passed to the kernel on restore as it does not seem to +be evaluated in the code paths CRIU restore is using for BPF. + +This fixes CRIU CI using Fedora with 5.16. + +See Linux commit 9330986c03006ab1d33d243b7cfe598a7a3c1baa + "bpf: Add bloom filter map implementation" + +Signed-off-by: Adrian Reber +--- + criu/bpfmap.c | 3 +++ + criu/proc_parse.c | 36 +++++++++++++++++++++++++++--------- + images/bpfmap-file.proto | 1 + + 3 files changed, 31 insertions(+), 9 deletions(-) + +diff --git a/criu/bpfmap.c b/criu/bpfmap.c +index 55b381c18..64071d382 100644 +--- a/criu/bpfmap.c ++++ b/criu/bpfmap.c +@@ -292,6 +292,9 @@ static int bpfmap_open(struct file_desc *d, int *new_fd) + return -1; + } + ++ if (bpfe->has_map_extra && bpfe->map_extra) ++ pr_warn("bpfmap map_extra has non-zero value. This will not be restored.\n"); ++ + if (restore_bpfmap_data(bpfmap_fd, bpfe->map_id, bpfmap_data_hash_table)) + return -1; + +diff --git a/criu/proc_parse.c b/criu/proc_parse.c +index 9009b96f7..13ec76e3b 100644 +--- a/criu/proc_parse.c ++++ b/criu/proc_parse.c +@@ -1737,6 +1737,12 @@ nodata: + typedef struct bpfmap_fmt { + char *fmt; + void *value; ++ /* ++ * If newer kernels are adding additional entries, these entries need ++ * to be marked as optional in the protobuf definition and the parsing ++ * must be able to ignore it if running on an older kernel. ++ */ ++ protobuf_c_boolean *optional; + } bpfmap_fmt; + + static int parse_bpfmap(struct bfd *f, char *str, BpfmapFileEntry *bpf) +@@ -1749,27 +1755,36 @@ static int parse_bpfmap(struct bfd *f, char *str, BpfmapFileEntry *bpf) + * uint32_t value_size + * uint32_t max_entries + * uint32_t map_flags ++ * uint64_t map_extra + * uint64_t memlock + * uint32_t map_id + * boolean frozen + */ + ++ /* This needs to be in the same order as in the fdinfo entry. */ + bpfmap_fmt map[] = { +- { "map_type: %u", &bpf->map_type }, +- { "key_size: %u", &bpf->key_size }, +- { "value_size: %u", &bpf->value_size }, +- { "max_entries: %u", &bpf->max_entries }, +- { "map_flags: %" PRIx32 "", &bpf->map_flags }, +- { "memlock: %" PRIu64 "", &bpf->memlock }, +- { "map_id: %u", &bpf->map_id }, +- { "frozen: %d", &bpf->frozen }, ++ { "map_type: %u", &bpf->map_type, NULL }, ++ { "key_size: %u", &bpf->key_size, NULL }, ++ { "value_size: %u", &bpf->value_size, NULL }, ++ { "max_entries: %u", &bpf->max_entries, NULL }, ++ { "map_flags: %" PRIx32 "", &bpf->map_flags, NULL }, ++ { "map_extra: %" PRIx64 "", &bpf->map_extra, &bpf->has_map_extra }, ++ { "memlock: %" PRIu64 "", &bpf->memlock, NULL }, ++ { "map_id: %u", &bpf->map_id, NULL }, ++ { "frozen: %d", &bpf->frozen, NULL }, + }; + + size_t n = sizeof(map) / sizeof(bpfmap_fmt); + int i; + + for (i = 0; i < n; i++) { +- if (sscanf(str, map[i].fmt, map[i].value) != 1) ++ bool parsing_failed = false; ++ if (sscanf(str, map[i].fmt, map[i].value) != 1) { ++ parsing_failed = true; ++ } ++ if (map[i].optional && !parsing_failed) ++ *map[i].optional = true; ++ if (!map[i].optional && parsing_failed) + return -1; + + if (i == n - 1) +@@ -1782,6 +1797,9 @@ static int parse_bpfmap(struct bfd *f, char *str, BpfmapFileEntry *bpf) + } + } + ++ if (bpf->has_map_extra && bpf->map_extra) ++ pr_warn("Non-zero value for fdinfo map_extra entry found. This will not be restored.\n"); ++ + return 0; + } + +diff --git a/images/bpfmap-file.proto b/images/bpfmap-file.proto +index 34a6c1dd2..895321e13 100644 +--- a/images/bpfmap-file.proto ++++ b/images/bpfmap-file.proto +@@ -21,4 +21,5 @@ message bpfmap_file_entry { + required string map_name = 13; + required uint32 ifindex = 14 [default = 0]; + optional sint32 mnt_id = 15 [default = -1]; ++ optional uint64 map_extra = 16; + } +-- +2.35.1 + diff --git a/0136-test-remove-test-for-LOCK_MAND-flock.patch b/0136-test-remove-test-for-LOCK_MAND-flock.patch new file mode 100644 index 0000000..e0d961a --- /dev/null +++ b/0136-test-remove-test-for-LOCK_MAND-flock.patch @@ -0,0 +1,49 @@ +From 222eedb93d505ce966e4ec7491edfc34080f668f Mon Sep 17 00:00:00 2001 +From: Adrian Reber +Date: Tue, 15 Feb 2022 17:01:32 +0000 +Subject: [PATCH 136/245] test: remove test for LOCK_MAND flock + +Linux Kernel release 5.16 removed support for LOCK_MAND flock and so the +test to verify if LOCK_MAND works started to fail with 5.16. + +The kernel also logs following message: + + Attempt to set a LOCK_MAND lock via flock(2). This support has been removed and the request ignored. + +This fixes CRIU CI using Fedora with 5.16. + +See Linux Kernel commit 90f7d7a0d0d68623b5f7df5621a8d54d9518fcc4 + "locks: remove LOCK_MAND flock lock support" + +Signed-off-by: Adrian Reber +--- + test/zdtm/static/file_locks01.c | 6 ------ + 1 file changed, 6 deletions(-) + +diff --git a/test/zdtm/static/file_locks01.c b/test/zdtm/static/file_locks01.c +index 6c2e54ff4..beea171f5 100644 +--- a/test/zdtm/static/file_locks01.c ++++ b/test/zdtm/static/file_locks01.c +@@ -159,7 +159,6 @@ int main(int argc, char **argv) + + flock(fd_0, LOCK_SH); + flock(fd_1, LOCK_EX); +- flock(fd_2, LOCK_MAND | LOCK_READ); + + test_daemon(); + test_waitsig(); +@@ -172,11 +171,6 @@ int main(int argc, char **argv) + fail("Failed on fd %d", fd_1); + ret |= 1; + } +- if (check_file_lock(fd_2, "MSNFS", "READ", dev, inodes[2])) { +- fail("Failed on fd %d", fd_2); +- ret |= 1; +- } +- + if (!ret) + pass(); + +-- +2.35.1 + diff --git a/0137-test-disable-rseq-also-on-Archlinux.patch b/0137-test-disable-rseq-also-on-Archlinux.patch new file mode 100644 index 0000000..404a74f --- /dev/null +++ b/0137-test-disable-rseq-also-on-Archlinux.patch @@ -0,0 +1,29 @@ +From 29bd4f0dd513a15e96c3374267b185d04ccf0357 Mon Sep 17 00:00:00 2001 +From: Adrian Reber +Date: Tue, 15 Feb 2022 18:09:27 +0000 +Subject: [PATCH 137/245] test: disable rseq also on Archlinux + +Seems like Archlinux also uses rseq now and that breaks CRIU. +Also disable rseq on Archlinux. + +Signed-off-by: Adrian Reber +--- + scripts/build/Dockerfile.archlinux | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/scripts/build/Dockerfile.archlinux b/scripts/build/Dockerfile.archlinux +index d226244ee..b226d5701 100644 +--- a/scripts/build/Dockerfile.archlinux ++++ b/scripts/build/Dockerfile.archlinux +@@ -1,5 +1,8 @@ + FROM docker.io/library/archlinux:latest + ++# FIXME: Temporary solution for https://github.com/checkpoint-restore/criu/issues/1696 ++ENV GLIBC_TUNABLES=glibc.pthread.rseq=0 ++ + ARG CC=gcc + + RUN pacman -Syu --noconfirm \ +-- +2.35.1 + diff --git a/0138-zdtm-fix-missplacement-of-err-True.patch b/0138-zdtm-fix-missplacement-of-err-True.patch new file mode 100644 index 0000000..e9e74da --- /dev/null +++ b/0138-zdtm-fix-missplacement-of-err-True.patch @@ -0,0 +1,32 @@ +From 7c3994f673107cbde368b385116358ce2a122ca8 Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Fri, 18 Feb 2022 18:13:14 +0300 +Subject: [PATCH 138/245] zdtm: fix missplacement of err=True + +There is no 'err' argument for print(), it should be in grep_errors() in +line below. + +Fixes: bed670f62 ("zdtm: print tails of all logs if a test has failed") +Signed-off-by: Pavel Tikhomirov +--- + test/zdtm.py | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/test/zdtm.py b/test/zdtm.py +index cf73a17ae..daad1b687 100755 +--- a/test/zdtm.py ++++ b/test/zdtm.py +@@ -1485,8 +1485,8 @@ class criu: + self.__page_server_p = None + if self.__dump_process: + self.__dump_process.terminate() +- print("criu dump exited with %s" % self.__dump_process.wait(), err=True) +- grep_errors(os.path.join(self.__ddir(), "dump.log")) ++ print("criu dump exited with %s" % self.__dump_process.wait()) ++ grep_errors(os.path.join(self.__ddir(), "dump.log"), err=True) + self.__dump_process = None + if self.__img_streamer_process: + self.__img_streamer_process.terminate() +-- +2.35.1 + diff --git a/0139-compel-set-mxcsr-during-error-injection-to-zero.patch b/0139-compel-set-mxcsr-during-error-injection-to-zero.patch new file mode 100644 index 0000000..dab875e --- /dev/null +++ b/0139-compel-set-mxcsr-during-error-injection-to-zero.patch @@ -0,0 +1,45 @@ +From 509bbef51ab2f3ed3d4156c07ca03dbb0ad63c29 Mon Sep 17 00:00:00 2001 +From: Adrian Reber +Date: Wed, 9 Mar 2022 08:40:35 +0000 +Subject: [PATCH 139/245] compel: set mxcsr during error injection to zero + +During error injection tests there are random values loaded in some of +the registers. The kernel, however, has the following check: + + if (mxcsr[0] & ~mxcsr_feature_mask) + return -EINVAL; + +So depending on the random values loaded mxcsr might have values that +the kernel rejects with EINVAL. Setting mxcsr to zero during the tests +lets the error injection test pass. + +Signed-off-by: Adrian Reber +--- + compel/arch/x86/src/lib/infect.c | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/compel/arch/x86/src/lib/infect.c b/compel/arch/x86/src/lib/infect.c +index de9013c27..0d3e9e9a0 100644 +--- a/compel/arch/x86/src/lib/infect.c ++++ b/compel/arch/x86/src/lib/infect.c +@@ -272,6 +272,17 @@ static void validate_random_xstate(struct xsave_struct *xsave) + + /* No reserved bits may be set */ + memset(&hdr->reserved, 0, sizeof(hdr->reserved)); ++ ++ /* ++ * While using PTRACE_SETREGSET the kernel checks that ++ * "Reserved bits in MXCSR must be zero." ++ * if (mxcsr[0] & ~mxcsr_feature_mask) ++ * return -EINVAL; ++ * ++ * As the mxcsr_feature_mask depends on the CPU the easiest solution for ++ * this error injection test is to set mxcsr just to zero. ++ */ ++ xsave->i387.mxcsr = 0; + } + + /* +-- +2.35.1 + diff --git a/0140-proc_smaps-remove-useless-nonlinear-check.patch b/0140-proc_smaps-remove-useless-nonlinear-check.patch new file mode 100644 index 0000000..5e5a189 --- /dev/null +++ b/0140-proc_smaps-remove-useless-nonlinear-check.patch @@ -0,0 +1,39 @@ +From 85ae3104dac41a6cbbb76c9b8b1a78a71184cb7a Mon Sep 17 00:00:00 2001 +From: anatasluo +Date: Tue, 8 Mar 2022 08:34:14 +0000 +Subject: [PATCH 140/245] proc_smaps: remove useless nonlinear check + +nonlinear information has been removed since commit +1da4b35b001481df99 in kernel. + +Signed-off-by: anatasluo +--- + criu/proc_parse.c | 12 +----------- + 1 file changed, 1 insertion(+), 11 deletions(-) + +diff --git a/criu/proc_parse.c b/criu/proc_parse.c +index 13ec76e3b..5cd5e6db8 100644 +--- a/criu/proc_parse.c ++++ b/criu/proc_parse.c +@@ -754,17 +754,7 @@ int parse_smaps(pid_t pid, struct vm_area_list *vma_area_list, dump_filemap_t du + eof = (str == NULL); + + if (!eof && !__is_vma_range_fmt(str)) { +- if (!strncmp(str, "Nonlinear", 9)) { +- BUG_ON(!vma_area); +- pr_err("Nonlinear mapping found %016" PRIx64 "-%016" PRIx64 "\n", vma_area->e->start, +- vma_area->e->end); +- /* +- * VMA is already on list and will be +- * freed later as list get destroyed. +- */ +- vma_area = NULL; +- goto err; +- } else if (!strncmp(str, "VmFlags: ", 9)) { ++ if (!strncmp(str, "VmFlags: ", 9)) { + BUG_ON(!vma_area); + parse_vma_vmflags(&str[9], vma_area); + continue; +-- +2.35.1 + diff --git a/0141-mount-fix-e_str-leak-in-ext_mount_add.patch b/0141-mount-fix-e_str-leak-in-ext_mount_add.patch new file mode 100644 index 0000000..5faf120 --- /dev/null +++ b/0141-mount-fix-e_str-leak-in-ext_mount_add.patch @@ -0,0 +1,52 @@ +From 06ad515e6b084900aef7a9b5b62f3dbc0dfd0b6d Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Wed, 9 Mar 2022 14:32:25 +0300 +Subject: [PATCH 141/245] mount: fix e_str leak in ext_mount_add + +coverity CID 389202: +54int ext_mount_add(char *key, char *val) + 55{ + 56 char *e_str; + 57 + 1. alloc_fn: Storage is returned from allocation function malloc. + 2. var_assign: Assigning: ___p = storage returned from malloc(strlen(key) + strlen(val) + 8UL). + 3. Condition !___p, taking false branch. + 4. leaked_storage: Variable ___p going out of scope leaks the storage it points to. + 5. var_assign: Assigning: e_str = ({...; ___p;}). + 58 e_str = xmalloc(strlen(key) + strlen(val) + 8); + 6. Condition !e_str, taking false branch. + 59 if (!e_str) + 60 return -1; +... + 7. noescape: Resource e_str is not freed or pointed-to in sprintf. + 73 sprintf(e_str, "mnt[%s]:%s", key, val); + 8. noescape: Resource e_str is not freed or pointed-to in add_external. [show details] + CID 389202 (#1 of 1): Resource leak (RESOURCE_LEAK)9. leaked_storage: Variable e_str going out of scope leaks the storage it points to. + 74 return add_external(e_str); + 75} + +We need to free e_str after add_external used it. + +v2: use cleanup_free attribute (@adrianreber) + +Signed-off-by: Pavel Tikhomirov +--- + criu/mount.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/criu/mount.c b/criu/mount.c +index 4b57ac703..c301aaeeb 100644 +--- a/criu/mount.c ++++ b/criu/mount.c +@@ -55,7 +55,7 @@ static LIST_HEAD(delayed_unbindable); + + int ext_mount_add(char *key, char *val) + { +- char *e_str; ++ cleanup_free char *e_str = NULL; + + e_str = xmalloc(strlen(key) + strlen(val) + 8); + if (!e_str) +-- +2.35.1 + diff --git a/0142-cr-dump-fix-cr_imgset-leak-in-dump_one_task.patch b/0142-cr-dump-fix-cr_imgset-leak-in-dump_one_task.patch new file mode 100644 index 0000000..d829a1f --- /dev/null +++ b/0142-cr-dump-fix-cr_imgset-leak-in-dump_one_task.patch @@ -0,0 +1,124 @@ +From 403e91569597b937bd69ca5f60b4516d85dc793f Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Wed, 9 Mar 2022 15:14:50 +0300 +Subject: [PATCH 142/245] cr-dump: fix cr_imgset leak in dump_one_task + +coverity CID 389194: + +1238static int dump_one_task(struct pstree_item *item, InventoryEntry *parent_ie) +1239{ +... +1245 struct cr_imgset *cr_imgset = NULL; +... + 11. alloc_fn: Storage is returned from allocation function cr_task_imgset_open. [show details] + 12. var_assign: Assigning: cr_imgset = storage returned from cr_task_imgset_open(vpid(item), 577). +1355 cr_imgset = cr_task_imgset_open(vpid(item), O_DUMP); + 13. Condition !cr_imgset, taking false branch. +1356 if (!cr_imgset) +1357 goto err_cure; +1358 +... + 25. Condition opts.lazy_pages, taking false branch. +1427 if (opts.lazy_pages) +1428 ret = compel_cure_remote(parasite_ctl); +1429 else +1430 ret = compel_cure(parasite_ctl); + 26. Condition ret, taking true branch. +1431 if (ret) { +1432 pr_err("Can't cure (pid: %d) from parasite\n", pid); + 27. Jumping to label err. +1433 goto err; +1434 } +... +1448 close_cr_imgset(&cr_imgset); +1449 exit_code = 0; +1450err: +1451 close_pid_proc(); +1452 free_mappings(&vmas); +1453 xfree(dfds); + CID 389194 (#1 of 1): Resource leak (RESOURCE_LEAK)28. leaked_storage: Variable cr_imgset going out of scope leaks the storage it points to. +1454 return exit_code; +1455 +1456err_cure: +1457 close_cr_imgset(&cr_imgset); +1458err_cure_imgset: +1459 ret = compel_cure(parasite_ctl); +1460 if (ret) +1461 pr_err("Can't cure (pid: %d) from parasite\n", pid); +1462 goto err; +1463} + +On compel_cure() error path we do not do close_cr_imgset() thich leads +to leaked cr_imgset, let's move corresponding close_cr_imgset below err +label. Also now we can merge remove close_cr_imgset() in err_cure label +as it goes to err label later anyway. Separate err_cure_imgset label is +not needed as close_cr_imgset() is ready for cr_imgset == NULL. + +v2: remove excess close_cr_imgset() in label err_cure (@adrianreber) + +Signed-off-by: Pavel Tikhomirov +--- + criu/cr-dump.c | 14 ++++++-------- + 1 file changed, 6 insertions(+), 8 deletions(-) + +diff --git a/criu/cr-dump.c b/criu/cr-dump.c +index c972e343a..eb1fb5e9a 100644 +--- a/criu/cr-dump.c ++++ b/criu/cr-dump.c +@@ -1315,29 +1315,29 @@ static int dump_one_task(struct pstree_item *item, InventoryEntry *parent_ie) + pfd = parasite_get_proc_fd_seized(parasite_ctl); + if (pfd < 0) { + pr_err("Can't get proc fd (pid: %d)\n", pid); +- goto err_cure_imgset; ++ goto err_cure; + } + + if (install_service_fd(CR_PROC_FD_OFF, pfd) < 0) +- goto err_cure_imgset; ++ goto err_cure; + } + + ret = parasite_fixup_vdso(parasite_ctl, pid, &vmas); + if (ret) { + pr_err("Can't fixup vdso VMAs (pid: %d)\n", pid); +- goto err_cure_imgset; ++ goto err_cure; + } + + ret = parasite_collect_aios(parasite_ctl, &vmas); /* FIXME -- merge with above */ + if (ret) { + pr_err("Failed to check aio rings (pid: %d)\n", pid); +- goto err_cure_imgset; ++ goto err_cure; + } + + ret = parasite_dump_misc_seized(parasite_ctl, &misc); + if (ret) { + pr_err("Can't dump misc (pid: %d)\n", pid); +- goto err_cure_imgset; ++ goto err_cure; + } + + item->pid->ns[0].virt = misc.pid; +@@ -1445,17 +1445,15 @@ static int dump_one_task(struct pstree_item *item, InventoryEntry *parent_ie) + goto err; + } + +- close_cr_imgset(&cr_imgset); + exit_code = 0; + err: ++ close_cr_imgset(&cr_imgset); + close_pid_proc(); + free_mappings(&vmas); + xfree(dfds); + return exit_code; + + err_cure: +- close_cr_imgset(&cr_imgset); +-err_cure_imgset: + ret = compel_cure(parasite_ctl); + if (ret) + pr_err("Can't cure (pid: %d) from parasite\n", pid); +-- +2.35.1 + diff --git a/0143-tun-fix-tun_link-leak-in-dump_tun_link.patch b/0143-tun-fix-tun_link-leak-in-dump_tun_link.patch new file mode 100644 index 0000000..de14eb2 --- /dev/null +++ b/0143-tun-fix-tun_link-leak-in-dump_tun_link.patch @@ -0,0 +1,66 @@ +From 33df574cd57a0919d1acd0e9184f4986d9974031 Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Wed, 9 Mar 2022 13:52:00 +0300 +Subject: [PATCH 143/245] tun: fix tun_link leak in dump_tun_link + +coverity CID 389205: + +452int dump_tun_link(NetDeviceEntry *nde, struct cr_imgset *fds, struct nlattr **info) +453{ +... +458 struct tun_link *tl; +... + 2. alloc_fn: Storage is returned from allocation function get_tun_link_fd. [show details] + 3. var_assign: Assigning: tl = storage returned from get_tun_link_fd(nde->name, nde->peer_nsid, tle.flags). +475 tl = get_tun_link_fd(nde->name, nde->peer_nsid, tle.flags); + 4. Condition !tl, taking false branch. +476 if (!tl) +477 return ret; +478 +479 tle.vnethdr = tl->dmp.vnethdr; +480 tle.sndbuf = tl->dmp.sndbuf; +481 +482 nde->tun = &tle; + CID 389205 (#1 of 1): Resource leak (RESOURCE_LEAK)5. leaked_storage: Variable tl going out of scope leaks the storage it points to. +483 return write_netdev_img(nde, fds, info); +484} + +Function get_tun_link_fd() can both return tun_link entry from tun_links +list and a newly allocated one. So we should not free entry if it is +from list and should free it when it is a new one to fix leak. + +Signed-off-by: Pavel Tikhomirov +--- + criu/tun.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/criu/tun.c b/criu/tun.c +index 2a2f950da..bc84604b3 100644 +--- a/criu/tun.c ++++ b/criu/tun.c +@@ -155,6 +155,7 @@ static struct tun_link *__dump_tun_link_fd(int fd, char *name, unsigned ns_id, u + goto err; + strlcpy(tl->name, name, sizeof(tl->name)); + tl->ns_id = ns_id; ++ INIT_LIST_HEAD(&tl->l); + + if (ioctl(fd, TUNGETVNETHDRSZ, &tl->dmp.vnethdr) < 0) { + pr_perror("Can't dump vnethdr size for %s", name); +@@ -479,6 +480,14 @@ int dump_tun_link(NetDeviceEntry *nde, struct cr_imgset *fds, struct nlattr **in + tle.vnethdr = tl->dmp.vnethdr; + tle.sndbuf = tl->dmp.sndbuf; + ++ /* ++ * Function get_tun_link_fd() can return either entry ++ * from tun_links list or a newly allocated one, need to ++ * free it only if not in list. ++ */ ++ if (list_empty(&tl->l)) ++ xfree(tl); ++ + nde->tun = &tle; + return write_netdev_img(nde, fds, info); + } +-- +2.35.1 + diff --git a/0144-sk-unix-fix-uint32_t-id-variable-printf-format-speci.patch b/0144-sk-unix-fix-uint32_t-id-variable-printf-format-speci.patch new file mode 100644 index 0000000..e1694af --- /dev/null +++ b/0144-sk-unix-fix-uint32_t-id-variable-printf-format-speci.patch @@ -0,0 +1,35 @@ +From 1b54115953453e739fe1a68dd3ced39912c352f3 Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Thu, 10 Mar 2022 13:35:50 +0300 +Subject: [PATCH 144/245] sk-unix: fix uint32_t id variable printf format + specifier + +coverity CID 389193: +CID 389193 (#1 of 1): Printf format string issue (PW.BAD_PRINTF_FORMAT_STRING) +1. bad_printf_format_string: invalid format string conversion +598 pr_warn("Can't stat socket %#x(%s), skipping: %m (err %d)\n", id, rpath, errno); + +Specifier "%#x" is wrong for id as it is of type uint32_t, let's change +it to "%#" PRIx32 "" to fix the problem. + +Signed-off-by: Pavel Tikhomirov +--- + criu/sk-unix.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/criu/sk-unix.c b/criu/sk-unix.c +index 194193dff..90c9eb11b 100644 +--- a/criu/sk-unix.c ++++ b/criu/sk-unix.c +@@ -595,7 +595,7 @@ static int unix_resolve_name_old(int lfd, uint32_t id, struct unix_sk_desc *d, U + snprintf(rpath, sizeof(rpath), ".%s", name); + if (fstatat(mntns_root, rpath, &st, 0)) { + if (errno != ENOENT) { +- pr_warn("Can't stat socket %#x(%s), skipping: %m (err %d)\n", id, rpath, errno); ++ pr_warn("Can't stat socket %#" PRIx32 "(%s), skipping: %m (err %d)\n", id, rpath, errno); + goto skip; + } + +-- +2.35.1 + diff --git a/0145-zdtm-refactor-main.patch b/0145-zdtm-refactor-main.patch new file mode 100644 index 0000000..451784a --- /dev/null +++ b/0145-zdtm-refactor-main.patch @@ -0,0 +1,459 @@ +From 0edd663bb959e5a424abba670ac87fbd45edd0b9 Mon Sep 17 00:00:00 2001 +From: Radostin Stoyanov +Date: Sat, 24 Jul 2021 12:19:22 +0100 +Subject: [PATCH 145/245] zdtm: refactor main + +This patch improves the readability of zdtm by refactoring the top-level +code into a main function. + +https://docs.python.org/3/library/__main__.html + +Signed-off-by: Radostin Stoyanov +--- + test/zdtm.py | 390 ++++++++++++++++++++++++++------------------------- + 1 file changed, 199 insertions(+), 191 deletions(-) + +diff --git a/test/zdtm.py b/test/zdtm.py +index daad1b687..9ad9ab24e 100755 +--- a/test/zdtm.py ++++ b/test/zdtm.py +@@ -28,8 +28,6 @@ import pycriu as crpc + + import yaml + +-os.chdir(os.path.dirname(os.path.abspath(__file__))) +- + # File to store content of streamed images + STREAMED_IMG_FILE_NAME = "img.criu" + +@@ -40,9 +38,6 @@ def alarm(*args): + print("==== ALARM ====") + + +-signal.signal(signal.SIGALRM, alarm) +- +- + def traceit(f, e, a): + if e == "line": + lineno = f.f_lineno +@@ -2511,19 +2506,19 @@ class group: + self.__dump_meta(fname, '.hook') + + +-def group_tests(opts): ++def group_tests(cli_opts): + excl = None + groups = [] + pend_groups = [] +- maxs = int(opts['max_size']) ++ maxs = int(cli_opts['max_size']) + + if not os.access("groups", os.F_OK): + os.mkdir("groups") + +- tlist = all_tests(opts) ++ tlist = all_tests(cli_opts) + random.shuffle(tlist) +- if opts['exclude']: +- excl = re.compile(".*(" + "|".join(opts['exclude']) + ")") ++ if cli_opts['exclude']: ++ excl = re.compile(".*(" + "|".join(cli_opts['exclude']) + ")") + print("Compiled exclusion list") + + for t in tlist: +@@ -2545,7 +2540,7 @@ def group_tests(opts): + groups += pend_groups + + nr = 0 +- suf = opts['name'] or 'group' ++ suf = cli_opts['name'] or 'group' + + for g in groups: + if maxs > 1 and g.size() == 1: # Not much point in group test for this +@@ -2570,190 +2565,203 @@ def set_nr_hugepages(nr): + orig_hugepages = 0 + with open("/proc/sys/vm/nr_hugepages", "r") as f: + orig_hugepages = int(f.read()) +- + with open("/proc/sys/vm/nr_hugepages", "w") as f: + f.write("{}\n".format(nr)) +- + return orig_hugepages + + +-# +-# main() starts here +-# ++def get_cli_args(): ++ """ ++ Parse command-line arguments ++ """ ++ p = argparse.ArgumentParser("CRIU test suite") ++ p.add_argument("--debug", ++ help="Print what's being executed", ++ action='store_true') ++ p.add_argument("--set", help="Which set of tests to use", default='zdtm') ++ ++ sp = p.add_subparsers(help="Use --help for list of actions") ++ ++ rp = sp.add_parser("run", help="Run test(s)") ++ rp.set_defaults(action=run_tests) ++ rp.add_argument("-a", "--all", action='store_true') ++ rp.add_argument("-t", "--test", help="Test name", action='append') ++ rp.add_argument("-T", "--tests", help="Regexp") ++ rp.add_argument("-F", "--from", help="From file") ++ rp.add_argument("-f", "--flavor", help="Flavor to run") ++ rp.add_argument("-x", ++ "--exclude", ++ help="Exclude tests from --all run", ++ action='append') ++ ++ rp.add_argument("--sibling", ++ help="Restore tests as siblings", ++ action='store_true') ++ rp.add_argument("--join-ns", ++ help="Restore tests and join existing namespace", ++ action='store_true') ++ rp.add_argument("--empty-ns", ++ help="Restore tests in empty net namespace", ++ action='store_true') ++ rp.add_argument("--pre", help="Do some pre-dumps before dump (n[:pause])") ++ rp.add_argument("--snaps", ++ help="Instead of pre-dumps do full dumps", ++ action='store_true') ++ rp.add_argument("--dedup", ++ help="Auto-deduplicate images on iterations", ++ action='store_true') ++ rp.add_argument("--noauto-dedup", ++ help="Manual deduplicate images on iterations", ++ action='store_true') ++ rp.add_argument("--nocr", ++ help="Do not CR anything, just check test works", ++ action='store_true') ++ rp.add_argument("--norst", ++ help="Don't restore tasks, leave them running after dump", ++ action='store_true') ++ rp.add_argument("--stop", ++ help="Check that --leave-stopped option stops ps tree.", ++ action='store_true') ++ rp.add_argument("--iters", ++ help="Do CR cycle several times before check (n[:pause])") ++ rp.add_argument("--fault", help="Test fault injection") ++ rp.add_argument( ++ "--sat", ++ help="Generate criu strace-s for sat tool (restore is fake, images are kept)", ++ action='store_true') ++ rp.add_argument( ++ "--sbs", ++ help="Do step-by-step execution, asking user for keypress to continue", ++ action='store_true') ++ rp.add_argument("--freezecg", help="Use freeze cgroup (path:state)") ++ rp.add_argument("--user", help="Run CRIU as regular user", ++ action='store_true') ++ rp.add_argument("--rpc", ++ help="Run CRIU via RPC rather than CLI", ++ action='store_true') ++ ++ rp.add_argument("--page-server", ++ help="Use page server dump", ++ action='store_true') ++ rp.add_argument("--stream", ++ help="Use criu-image-streamer", ++ action='store_true') ++ rp.add_argument("-p", "--parallel", help="Run test in parallel") ++ rp.add_argument("--dry-run", ++ help="Don't run tests, just pretend to", ++ action='store_true') ++ rp.add_argument("--script", help="Add script to get notified by criu") ++ rp.add_argument("-k", ++ "--keep-img", ++ help="Whether or not to keep images after test", ++ choices=['always', 'never', 'failed'], ++ default='failed') ++ rp.add_argument("--report", help="Generate summary report in directory") ++ rp.add_argument("--keep-going", ++ help="Keep running tests in spite of failures", ++ action='store_true') ++ rp.add_argument("--ignore-taint", ++ help="Don't care about a non-zero kernel taint flag", ++ action='store_true') ++ rp.add_argument("--lazy-pages", ++ help="restore pages on demand", ++ action='store_true') ++ rp.add_argument("--lazy-migrate", ++ help="restore pages on demand", ++ action='store_true') ++ rp.add_argument("--remote-lazy-pages", ++ help="simulate lazy migration", ++ action='store_true') ++ rp.add_argument("--tls", help="use TLS for migration", action='store_true') ++ rp.add_argument("--title", help="A test suite title", default="criu") ++ rp.add_argument("--show-stats", ++ help="Show criu statistics", ++ action='store_true') ++ rp.add_argument("--criu-bin", ++ help="Path to criu binary", ++ default='../criu/criu') ++ rp.add_argument("--crit-bin", ++ help="Path to crit binary", ++ default='../crit/crit') ++ rp.add_argument("--criu-image-streamer-dir", ++ help="Directory where the criu-image-streamer binary is located", ++ default="../../criu-image-streamer") ++ rp.add_argument("--pre-dump-mode", ++ help="Use splice or read mode of pre-dumping", ++ choices=['splice', 'read'], ++ default='splice') ++ ++ lp = sp.add_parser("list", help="List tests") ++ lp.set_defaults(action=list_tests) ++ lp.add_argument('-i', ++ '--info', ++ help="Show more info about tests", ++ action='store_true') ++ ++ gp = sp.add_parser("group", help="Generate groups") ++ gp.set_defaults(action=group_tests) ++ gp.add_argument("-m", "--max-size", ++ help="Maximum number of tests in group") ++ gp.add_argument("-n", "--name", help="Common name for group tests") ++ gp.add_argument("-x", ++ "--exclude", ++ help="Exclude tests from --all run", ++ action='append') ++ ++ cp = sp.add_parser("clean", help="Clean something") ++ cp.set_defaults(action=clean_stuff) ++ cp.add_argument("what", choices=['nsroot']) ++ ++ return vars(p.parse_args()) ++ ++ ++def waitpid_and_rip_zombies(pid): ++ """ ++ Collect this namespace's zombies ++ """ ++ while True: ++ wpid, status = os.wait() ++ if wpid == pid: ++ if os.WIFEXITED(status): ++ return os.WEXITSTATUS(status) ++ return 1 ++ ++ ++def fork_zdtm(): ++ """ ++ Fork here, since we're new pidns init and are supposed to ++ collect this namespace's zombies ++ """ ++ if 'CR_CT_TEST_INFO' in os.environ: ++ status = 0 ++ pid = os.fork() ++ if pid == 0: ++ tinfo = eval(os.environ['CR_CT_TEST_INFO']) ++ do_run_test(tinfo[0], tinfo[1], tinfo[2], tinfo[3]) ++ else: ++ status = waitpid_and_rip_zombies(pid) ++ sys.exit(status) + +-if 'CR_CT_TEST_INFO' in os.environ: +- # Fork here, since we're new pidns init and are supposed to +- # collect this namespace's zombies +- status = 0 +- pid = os.fork() +- if pid == 0: +- tinfo = eval(os.environ['CR_CT_TEST_INFO']) +- do_run_test(tinfo[0], tinfo[1], tinfo[2], tinfo[3]) +- else: +- while True: +- wpid, status = os.wait() +- if wpid == pid: +- if os.WIFEXITED(status): +- status = os.WEXITSTATUS(status) +- else: +- status = 1 +- break + +- sys.exit(status) +- +-p = argparse.ArgumentParser("CRIU test suite") +-p.add_argument("--debug", +- help="Print what's being executed", +- action='store_true') +-p.add_argument("--set", help="Which set of tests to use", default='zdtm') +- +-sp = p.add_subparsers(help="Use --help for list of actions") +- +-rp = sp.add_parser("run", help="Run test(s)") +-rp.set_defaults(action=run_tests) +-rp.add_argument("-a", "--all", action='store_true') +-rp.add_argument("-t", "--test", help="Test name", action='append') +-rp.add_argument("-T", "--tests", help="Regexp") +-rp.add_argument("-F", "--from", help="From file") +-rp.add_argument("-f", "--flavor", help="Flavor to run") +-rp.add_argument("-x", +- "--exclude", +- help="Exclude tests from --all run", +- action='append') +- +-rp.add_argument("--sibling", +- help="Restore tests as siblings", +- action='store_true') +-rp.add_argument("--join-ns", +- help="Restore tests and join existing namespace", +- action='store_true') +-rp.add_argument("--empty-ns", +- help="Restore tests in empty net namespace", +- action='store_true') +-rp.add_argument("--pre", help="Do some pre-dumps before dump (n[:pause])") +-rp.add_argument("--snaps", +- help="Instead of pre-dumps do full dumps", +- action='store_true') +-rp.add_argument("--dedup", +- help="Auto-deduplicate images on iterations", +- action='store_true') +-rp.add_argument("--noauto-dedup", +- help="Manual deduplicate images on iterations", +- action='store_true') +-rp.add_argument("--nocr", +- help="Do not CR anything, just check test works", +- action='store_true') +-rp.add_argument("--norst", +- help="Don't restore tasks, leave them running after dump", +- action='store_true') +-rp.add_argument("--stop", +- help="Check that --leave-stopped option stops ps tree.", +- action='store_true') +-rp.add_argument("--iters", +- help="Do CR cycle several times before check (n[:pause])") +-rp.add_argument("--fault", help="Test fault injection") +-rp.add_argument( +- "--sat", +- help="Generate criu strace-s for sat tool (restore is fake, images are kept)", +- action='store_true') +-rp.add_argument( +- "--sbs", +- help="Do step-by-step execution, asking user for keypress to continue", +- action='store_true') +-rp.add_argument("--freezecg", help="Use freeze cgroup (path:state)") +-rp.add_argument("--user", help="Run CRIU as regular user", action='store_true') +-rp.add_argument("--rpc", +- help="Run CRIU via RPC rather than CLI", +- action='store_true') +- +-rp.add_argument("--page-server", +- help="Use page server dump", +- action='store_true') +-rp.add_argument("--stream", +- help="Use criu-image-streamer", +- action='store_true') +-rp.add_argument("-p", "--parallel", help="Run test in parallel") +-rp.add_argument("--dry-run", +- help="Don't run tests, just pretend to", +- action='store_true') +-rp.add_argument("--script", help="Add script to get notified by criu") +-rp.add_argument("-k", +- "--keep-img", +- help="Whether or not to keep images after test", +- choices=['always', 'never', 'failed'], +- default='failed') +-rp.add_argument("--report", help="Generate summary report in directory") +-rp.add_argument("--keep-going", +- help="Keep running tests in spite of failures", +- action='store_true') +-rp.add_argument("--ignore-taint", +- help="Don't care about a non-zero kernel taint flag", +- action='store_true') +-rp.add_argument("--lazy-pages", +- help="restore pages on demand", +- action='store_true') +-rp.add_argument("--lazy-migrate", +- help="restore pages on demand", +- action='store_true') +-rp.add_argument("--remote-lazy-pages", +- help="simulate lazy migration", +- action='store_true') +-rp.add_argument("--tls", help="use TLS for migration", action='store_true') +-rp.add_argument("--title", help="A test suite title", default="criu") +-rp.add_argument("--show-stats", +- help="Show criu statistics", +- action='store_true') +-rp.add_argument("--criu-bin", +- help="Path to criu binary", +- default='../criu/criu') +-rp.add_argument("--crit-bin", +- help="Path to crit binary", +- default='../crit/crit') +-rp.add_argument("--criu-image-streamer-dir", +- help="Directory where the criu-image-streamer binary is located", +- default="../../criu-image-streamer") +-rp.add_argument("--pre-dump-mode", +- help="Use splice or read mode of pre-dumping", +- choices=['splice', 'read'], +- default='splice') +- +-lp = sp.add_parser("list", help="List tests") +-lp.set_defaults(action=list_tests) +-lp.add_argument('-i', +- '--info', +- help="Show more info about tests", +- action='store_true') +- +-gp = sp.add_parser("group", help="Generate groups") +-gp.set_defaults(action=group_tests) +-gp.add_argument("-m", "--max-size", help="Maximum number of tests in group") +-gp.add_argument("-n", "--name", help="Common name for group tests") +-gp.add_argument("-x", +- "--exclude", +- help="Exclude tests from --all run", +- action='append') +- +-cp = sp.add_parser("clean", help="Clean something") +-cp.set_defaults(action=clean_stuff) +-cp.add_argument("what", choices=['nsroot']) +- +-opts = vars(p.parse_args()) +-if opts.get('sat', False): +- opts['keep_img'] = 'always' +- +-if opts['debug']: +- sys.settrace(traceit) +- +-if opts['action'] == 'run': +- criu.available() +-for tst in test_classes.values(): +- tst.available() +- +-orig_hugepages = set_nr_hugepages(20) +- +-opts['action'](opts) +- +-set_nr_hugepages(orig_hugepages) +- +-for tst in test_classes.values(): +- tst.cleanup() ++if __name__ == '__main__': ++ os.chdir(os.path.dirname(os.path.abspath(__file__))) ++ signal.signal(signal.SIGALRM, alarm) ++ fork_zdtm() ++ opts = get_cli_args() ++ if opts.get('sat', False): ++ opts['keep_img'] = 'always' ++ ++ if opts['debug']: ++ sys.settrace(traceit) ++ ++ if opts['action'] == 'run': ++ criu.available() ++ for tst in test_classes.values(): ++ tst.available() ++ ++ orig_hugepages = set_nr_hugepages(20) ++ opts['action'](opts) ++ set_nr_hugepages(orig_hugepages) ++ ++ for tst in test_classes.values(): ++ tst.cleanup() +-- +2.35.1 + diff --git a/0146-zdtm-sort-import-lines.patch b/0146-zdtm-sort-import-lines.patch new file mode 100644 index 0000000..16ff511 --- /dev/null +++ b/0146-zdtm-sort-import-lines.patch @@ -0,0 +1,70 @@ +From 49a2414f365fe2f4c887332b172568d9b121b542 Mon Sep 17 00:00:00 2001 +From: Radostin Stoyanov +Date: Sun, 15 Aug 2021 10:27:37 +0100 +Subject: [PATCH 146/245] zdtm: sort import lines + +These changes have been auto-generated with: + + pip3 install isort autoflake + isort -rc -sl zdtm.py + autoflake --remove-all-unused-imports -i zdtm.py + isort -rc -m 3 zdtm.py + +Signed-off-by: Radostin Stoyanov +--- + test/zdtm.py | 17 +++++++++++------ + 1 file changed, 11 insertions(+), 6 deletions(-) + +diff --git a/test/zdtm.py b/test/zdtm.py +index 9ad9ab24e..bb4a4c3b9 100755 +--- a/test/zdtm.py ++++ b/test/zdtm.py +@@ -1,5 +1,10 @@ + #!/usr/bin/env python +-from __future__ import absolute_import, division, print_function, unicode_literals ++from __future__ import ( ++ absolute_import, ++ division, ++ print_function, ++ unicode_literals ++) + + import argparse + import atexit +@@ -14,6 +19,7 @@ import random + import re + import shutil + import signal ++import socket + import stat + import string + import struct +@@ -21,13 +27,12 @@ import subprocess + import sys + import tempfile + import time +-import socket +-from builtins import (input, int, open, range, str, zip) +- +-import pycriu as crpc ++from builtins import input, int, open, range, str, zip + + import yaml + ++import pycriu as crpc ++ + # File to store content of streamed images + STREAMED_IMG_FILE_NAME = "img.criu" + +@@ -1933,7 +1938,7 @@ class Launcher: + + if opts['report'] and (opts['keep_going'] or self.__total == 1): + global TestSuite, TestCase +- from junit_xml import TestSuite, TestCase ++ from junit_xml import TestCase, TestSuite + now = datetime.datetime.now() + att = 0 + reportname = os.path.join(report_dir, "criu-testreport.tap") +-- +2.35.1 + diff --git a/0147-zdtm-use-long-form-cli-options.patch b/0147-zdtm-use-long-form-cli-options.patch new file mode 100644 index 0000000..a0fbc18 --- /dev/null +++ b/0147-zdtm-use-long-form-cli-options.patch @@ -0,0 +1,77 @@ +From 0cec066cb200680f7cb1429b026c643f1035b5f5 Mon Sep 17 00:00:00 2001 +From: Radostin Stoyanov +Date: Sun, 15 Aug 2021 10:53:29 +0100 +Subject: [PATCH 147/245] zdtm: use long form cli options + +Using long-form command-line options would allows us to provide +them via config file to CRIU. + +Signed-off-by: Radostin Stoyanov +--- + test/zdtm.py | 18 ++++++++++-------- + 1 file changed, 10 insertions(+), 8 deletions(-) + +diff --git a/test/zdtm.py b/test/zdtm.py +index bb4a4c3b9..d02b42814 100755 +--- a/test/zdtm.py ++++ b/test/zdtm.py +@@ -560,7 +560,7 @@ class zdtm_test: + opts += ["--root", self.__flavor.root] + if test_flag(self.__desc, 'crlib'): + opts += [ +- "-L", ++ "--libdir", + os.path.dirname(os.path.realpath(self.__name)) + '/lib' + ] + return opts +@@ -899,14 +899,14 @@ class criu_rpc: + def __set_opts(criu, args, ctx): + while len(args) != 0: + arg = args.pop(0) +- if "-v4" == arg: ++ if "--verbosity=4" == arg: + criu.opts.log_level = 4 +- elif "-o" == arg: ++ elif "--log-file" == arg: + criu.opts.log_file = args.pop(0) +- elif "-D" == arg: ++ elif "--images-dir" == arg: + criu.opts.images_dir_fd = os.open(args.pop(0), os.O_DIRECTORY) + ctx['imgd'] = criu.opts.images_dir_fd +- elif "-t" == arg: ++ elif "--tree" == arg: + criu.opts.pid = int(args.pop(0)) + elif "--pidfile" == arg: + ctx['pidf'] = args.pop(0) +@@ -1118,7 +1118,8 @@ class criu: + if not log: + log = action + ".log" + +- s_args = ["-o", log, "-D", self.__ddir(), "-v4"] + opts ++ s_args = ["--log-file", log, "--images-dir", self.__ddir(), ++ "--verbosity=4"] + opts + + with open(os.path.join(self.__ddir(), action + '.cropt'), 'w') as f: + f.write(' '.join(s_args) + '\n') +@@ -1316,7 +1317,7 @@ class criu: + os.mkdir(self.__ddir()) + os.chmod(self.__ddir(), 0o777) + +- a_opts = ["-t", self.__test.getpid()] ++ a_opts = ["--tree", self.__test.getpid()] + if self.__prev_dump_iter: + a_opts += [ + "--prev-images-dir", +@@ -1461,7 +1462,8 @@ class criu: + return False + + return criu_cli.run( +- "check", ["--no-default-config", "-v0", "--feature", feature], ++ "check", ++ ["--no-default-config", "--verbosity=0", "--feature", feature], + opts['criu_bin']) == 0 + + @staticmethod +-- +2.35.1 + diff --git a/0148-zdtm-add-criu-config-option.patch b/0148-zdtm-add-criu-config-option.patch new file mode 100644 index 0000000..a61806e --- /dev/null +++ b/0148-zdtm-add-criu-config-option.patch @@ -0,0 +1,127 @@ +From 9caafe1d72257646d55976b9c74a2480149b9279 Mon Sep 17 00:00:00 2001 +From: Radostin Stoyanov +Date: Sun, 15 Aug 2021 10:58:32 +0100 +Subject: [PATCH 148/245] zdtm: add --criu-config option + +The --criu-config option allows to run test with CRIU options provided +via configuration files instead of command-line arguments. + +Suggested-by: Andrei Vagin +Signed-off-by: Radostin Stoyanov +--- + test/zdtm.py | 16 ++++++++++++--- + test/zdtm/__init__.py | 0 + test/zdtm/criu_config.py | 42 ++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 55 insertions(+), 3 deletions(-) + create mode 100644 test/zdtm/__init__.py + create mode 100644 test/zdtm/criu_config.py + +diff --git a/test/zdtm.py b/test/zdtm.py +index d02b42814..3fbdb8a18 100755 +--- a/test/zdtm.py ++++ b/test/zdtm.py +@@ -32,6 +32,7 @@ from builtins import input, int, open, range, str, zip + import yaml + + import pycriu as crpc ++from zdtm.criu_config import criu_config + + # File to store content of streamed images + STREAMED_IMG_FILE_NAME = "img.criu" +@@ -1036,7 +1037,6 @@ class criu: + self.__user = bool(opts['user']) + self.__leave_stopped = bool(opts['stop']) + self.__stream = bool(opts['stream']) +- self.__criu = (opts['rpc'] and criu_rpc or criu_cli) + self.__show_stats = bool(opts['show_stats']) + self.__lazy_pages_p = None + self.__page_server_p = None +@@ -1047,6 +1047,13 @@ class criu: + self.__crit_bin = opts['crit_bin'] + self.__pre_dump_mode = opts['pre_dump_mode'] + ++ if opts['rpc']: ++ self.__criu = criu_rpc ++ elif opts['criu_config']: ++ self.__criu = criu_config ++ else: ++ self.__criu = criu_cli ++ + def fini(self): + if self.__lazy_migrate: + ret = self.__dump_process.wait() +@@ -2024,8 +2031,8 @@ class Launcher: + + nd = ('nocr', 'norst', 'pre', 'iters', 'page_server', 'sibling', + 'stop', 'empty_ns', 'fault', 'keep_img', 'report', 'snaps', +- 'sat', 'script', 'rpc', 'lazy_pages', 'join_ns', 'dedup', 'sbs', +- 'freezecg', 'user', 'dry_run', 'noauto_dedup', ++ 'sat', 'script', 'rpc', 'criu_config', 'lazy_pages', 'join_ns', ++ 'dedup', 'sbs', 'freezecg', 'user', 'dry_run', 'noauto_dedup', + 'remote_lazy_pages', 'show_stats', 'lazy_migrate', 'stream', + 'tls', 'criu_bin', 'crit_bin', 'pre_dump_mode') + arg = repr((name, desc, flavor, {d: self.__opts[d] for d in nd})) +@@ -2647,6 +2654,9 @@ def get_cli_args(): + help="Run CRIU via RPC rather than CLI", + action='store_true') + ++ rp.add_argument("--criu-config", ++ help="Use config file to set CRIU options", ++ action='store_true') + rp.add_argument("--page-server", + help="Use page server dump", + action='store_true') +diff --git a/test/zdtm/__init__.py b/test/zdtm/__init__.py +new file mode 100644 +index 000000000..e69de29bb +diff --git a/test/zdtm/criu_config.py b/test/zdtm/criu_config.py +new file mode 100644 +index 000000000..487becfb4 +--- /dev/null ++++ b/test/zdtm/criu_config.py +@@ -0,0 +1,42 @@ ++import os ++import tempfile ++import subprocess ++ ++ ++class criu_config: ++ @staticmethod ++ def run(action, ++ args, ++ criu_bin, ++ fault=None, ++ strace=[], ++ preexec=None, ++ nowait=False): ++ ++ config_path = tempfile.mktemp(".conf", "criu-%s-" % action) ++ with open(config_path, "w") as config_fd: ++ for arg in args: ++ if arg.startswith("--"): ++ config_fd.write("\n") ++ arg = arg.strip("-") ++ config_fd.write("%s " % arg) ++ ++ env = dict( ++ os.environ, ++ ASAN_OPTIONS="log_path=asan.log:disable_coredump=0:detect_leaks=0" ++ ) ++ ++ if fault: ++ print("Forcing %s fault" % fault) ++ env['CRIU_FAULT'] = fault ++ ++ cr = subprocess.Popen( ++ strace + ++ [criu_bin, action, "--no-default-config", "--config", config_path], ++ env=env, ++ close_fds=False, ++ preexec_fn=preexec ++ ) ++ if nowait: ++ return cr ++ return cr.wait() +-- +2.35.1 + diff --git a/0149-zdtm-drop-redundant-config_inotify_irmap-test.patch b/0149-zdtm-drop-redundant-config_inotify_irmap-test.patch new file mode 100644 index 0000000..fee952e --- /dev/null +++ b/0149-zdtm-drop-redundant-config_inotify_irmap-test.patch @@ -0,0 +1,174 @@ +From 7df50d6bdc535dc62e299ef0e94e5dac29d4a7ac Mon Sep 17 00:00:00 2001 +From: Radostin Stoyanov +Date: Sun, 15 Aug 2021 11:16:28 +0100 +Subject: [PATCH 149/245] zdtm: drop redundant config_inotify_irmap test + +The config_inotify_irmap test duplicates inotify_irmap with slight +change to add the --force-irmap and --irmap-scan-path options in +a configuration file. + +The --criu-config option of ZDTM provides more general solution +for testing CRIU options provided in configuration files. + +Signed-off-by: Radostin Stoyanov +--- + scripts/ci/Makefile | 2 +- + test/Makefile | 2 +- + test/zdtm/static/Makefile | 1 - + test/zdtm/static/config_inotify_irmap.c | 95 ---------------------- + test/zdtm/static/config_inotify_irmap.desc | 3 - + 5 files changed, 2 insertions(+), 101 deletions(-) + delete mode 100644 test/zdtm/static/config_inotify_irmap.c + delete mode 100644 test/zdtm/static/config_inotify_irmap.desc + +diff --git a/scripts/ci/Makefile b/scripts/ci/Makefile +index 02b4d871c..3e4d59430 100644 +--- a/scripts/ci/Makefile ++++ b/scripts/ci/Makefile +@@ -18,7 +18,7 @@ export UNAME + CONTAINER_RUNTIME := docker + export CONTAINER_RUNTIME + +-alpine: ZDTM_OPTIONS=-x zdtm/static/binfmt_misc -x zdtm/static/netns-nf -x zdtm/static/sched_policy00 -x zdtm/static/seccomp_strict -x zdtm/static/sigaltstack -x zdtm/static/signalfd00 -x zdtm/static/config_inotify_irmap ++alpine: ZDTM_OPTIONS=-x zdtm/static/binfmt_misc -x zdtm/static/netns-nf -x zdtm/static/sched_policy00 -x zdtm/static/seccomp_strict -x zdtm/static/sigaltstack -x zdtm/static/signalfd00 + + define DOCKER_JSON + { +diff --git a/test/Makefile b/test/Makefile +index cf7dacac4..9938015e0 100644 +--- a/test/Makefile ++++ b/test/Makefile +@@ -51,7 +51,7 @@ clean_root: + .PHONY: clean_root + + clean: clean_root +- $(RM) zdtm_ct zdtm-tst-list umount2 zdtm_test_config.conf ++ $(RM) zdtm_ct zdtm-tst-list umount2 + $(Q) $(RM) *.log + $(Q) $(RM) -r ./dump/ + $(Q) $(MAKE) -C zdtm cleandep clean cleanout +diff --git a/test/zdtm/static/Makefile b/test/zdtm/static/Makefile +index 1b057c70c..33e15f85a 100644 +--- a/test/zdtm/static/Makefile ++++ b/test/zdtm/static/Makefile +@@ -237,7 +237,6 @@ TST_NOFILE := \ + netns_sub_veth \ + netns_sub_sysctl \ + unlink_multiple_largefiles \ +- config_inotify_irmap \ + thp_disable \ + pid_file \ + selinux00 \ +diff --git a/test/zdtm/static/config_inotify_irmap.c b/test/zdtm/static/config_inotify_irmap.c +deleted file mode 100644 +index 94585491a..000000000 +--- a/test/zdtm/static/config_inotify_irmap.c ++++ /dev/null +@@ -1,95 +0,0 @@ +-#include +-#include +- +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-#include "zdtmtst.h" +- +-/* +- * This test reuses inotify_irmap test for testing configuration files +- * functionality. For parts not related to configuration files, please +- * refer to the original test case and it's author. +- */ +- +-const char *test_doc = "Default configuration files usage"; +-const char *test_author = "Veronika Kabatova "; +- +-#define TDIR "/etc" +-char test_files[2][128] = { +- TDIR "/zdtm-test", +- TDIR "/zdtm-test1", +-}; +-#define CONFIG_PATH "../../zdtm_test_config.conf" +- +-#define BUFF_SIZE ((sizeof(struct inotify_event) + PATH_MAX)) +- +-int main(int argc, char *argv[]) +-{ +- FILE *configfile; +- char buf[BUFF_SIZE]; +- int fd, wd, i; +- +- test_init(argc, argv); +- +- for (i = 0; i < 2; i++) { +- unlink(test_files[i]); +- if (creat(test_files[i], 0600) < 0) { +- pr_perror("Can't make test file"); +- exit(1); +- } +- } +- fd = inotify_init1(IN_NONBLOCK); +- if (fd < 0) { +- pr_perror("inotify_init failed"); +- goto err; +- } +- for (i = 0; i < 2; i++) { +- wd = inotify_add_watch(fd, test_files[i], IN_OPEN); +- if (wd < 0) { +- pr_perror("inotify_add_watch failed"); +- goto err; +- } +- } +- +- configfile = fopen(CONFIG_PATH, "w"); +- if (configfile == NULL) { +- pr_perror("Unable to create configuration file %s", CONFIG_PATH); +- goto err; +- } +- fprintf(configfile, "force-irmap\t\nirmap-scan-path /zdtm/static\n"); +- fclose(configfile); +- +- test_daemon(); +- test_waitsig(); +- +- for (i = 0; i < 2; i++) { +- memset(buf, 0, sizeof(buf)); +- wd = open(test_files[i], O_RDONLY); +- if (read(fd, buf, sizeof(buf)) <= 0) { +- fail("No events in queue"); +- unlink(CONFIG_PATH); +- goto err; +- } +- } +- +- close(wd); +- close(fd); +- for (i = 0; i < 2; i++) +- unlink(test_files[i]); +- unlink(CONFIG_PATH); +- pass(); +- return 0; +-err: +- for (i = 0; i < 2; i++) +- unlink(test_files[i]); +- return 1; +-} +diff --git a/test/zdtm/static/config_inotify_irmap.desc b/test/zdtm/static/config_inotify_irmap.desc +deleted file mode 100644 +index 591ae7191..000000000 +--- a/test/zdtm/static/config_inotify_irmap.desc ++++ /dev/null +@@ -1,3 +0,0 @@ +-(lambda confpath: +-{'flags': 'suid', 'opts': '--config %s' % (confpath) +-}) (os.path.abspath('./zdtm_test_config.conf')) +-- +2.35.1 + diff --git a/0150-ci-run-criu-config-tests.patch b/0150-ci-run-criu-config-tests.patch new file mode 100644 index 0000000..f48623c --- /dev/null +++ b/0150-ci-run-criu-config-tests.patch @@ -0,0 +1,51 @@ +From 88caa7a5083039157f340df1497fc7a6c91a9174 Mon Sep 17 00:00:00 2001 +From: Radostin Stoyanov +Date: Sun, 15 Aug 2021 11:29:22 +0100 +Subject: [PATCH 150/245] ci: run criu-config tests + +Signed-off-by: Radostin Stoyanov +--- + scripts/ci/run-ci-tests.sh | 3 +++ + test/Makefile | 5 +++++ + 2 files changed, 8 insertions(+) + +diff --git a/scripts/ci/run-ci-tests.sh b/scripts/ci/run-ci-tests.sh +index 50216634e..5ef3965db 100755 +--- a/scripts/ci/run-ci-tests.sh ++++ b/scripts/ci/run-ci-tests.sh +@@ -202,6 +202,9 @@ fi + # shellcheck disable=SC2086 + ./test/zdtm.py run -a -p 2 --keep-going $ZDTM_OPTS + ++# shellcheck disable=SC2086 ++./test/zdtm.py run -a -p 2 --keep-going --criu-config $ZDTM_OPTS ++ + # Newer kernels are blocking access to userfaultfd: + # uffd: Set unprivileged_userfaultfd sysctl knob to 1 if kernel faults must be handled without obtaining CAP_SYS_PTRACE capability + if [ -e /proc/sys/vm/unprivileged_userfaultfd ]; then +diff --git a/test/Makefile b/test/Makefile +index 9938015e0..8416b1961 100644 +--- a/test/Makefile ++++ b/test/Makefile +@@ -5,6 +5,7 @@ export ZDTM_ARGS + + all: + $(MAKE) zdtm ++ $(MAKE) zdtm-config + $(MAKE) zdtm-pre-dump + $(MAKE) zdtm-snapshot + $(MAKE) zdtm-iter +@@ -23,6 +24,10 @@ zdtm: + ./zdtm.py run -a --parallel 2 + .PHONY: zdtm + ++zdtm-config: ++ ./zdtm.py run -a --parallel 2 --criu-config ++.PHONY: zdtm-config ++ + zdtm-pre-dump: + ./zdtm.py run --pre 2:1 -t zdtm/transition/fork -f uns + .PHONY: zdtm-pre-dump +-- +2.35.1 + diff --git a/0151-config-fix-ns-leak-in-parse_join_ns.patch b/0151-config-fix-ns-leak-in-parse_join_ns.patch new file mode 100644 index 0000000..3a4c390 --- /dev/null +++ b/0151-config-fix-ns-leak-in-parse_join_ns.patch @@ -0,0 +1,53 @@ +From f2d2062d3635921e9a4a43a5c5868abc680183ff Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Thu, 10 Mar 2022 14:15:23 +0300 +Subject: [PATCH 151/245] config: fix ns leak in parse_join_ns + +coverity CID 389192: + +550static int parse_join_ns(const char *ptr) +551{ +... +553 char *ns; +554 + 1. alloc_fn: Storage is returned from allocation function strdup. + 2. var_assign: Assigning: ___p = storage returned from strdup(ptr). + 3. Condition !___p, taking false branch. + 4. leaked_storage: Variable ___p going out of scope leaks the storage it points to. + 5. var_assign: Assigning: ns = ({...; ___p;}). +555 ns = xstrdup(ptr); + 6. Condition ns == NULL, taking false branch. +556 if (ns == NULL) +557 return -1; +558 + 7. noescape: Resource ns is not freed or pointed-to in strchr. +559 aux = strchr(ns, ':'); + 8. Condition aux == NULL, taking true branch. +560 if (aux == NULL) + CID 389192 (#1 of 1): Resource leak (RESOURCE_LEAK)9. leaked_storage: Variable ns going out of scope leaks the storage it points to. +561 return -1; + +We should free ns string after we finish it's use in parse_join_ns, +easiest way to do it is to use cleanup_free attribute. + +Signed-off-by: Pavel Tikhomirov +--- + criu/config.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/criu/config.c b/criu/config.c +index 33f2820a1..4a8338423 100644 +--- a/criu/config.c ++++ b/criu/config.c +@@ -549,7 +549,7 @@ static size_t parse_size(char *optarg) + static int parse_join_ns(const char *ptr) + { + char *aux, *ns_file, *extra_opts = NULL; +- char *ns; ++ cleanup_free char *ns = NULL; + + ns = xstrdup(ptr); + if (ns == NULL) +-- +2.35.1 + diff --git a/0152-net-fix-e_str-leak-in-veth_pair_add.patch b/0152-net-fix-e_str-leak-in-veth_pair_add.patch new file mode 100644 index 0000000..a6c234c --- /dev/null +++ b/0152-net-fix-e_str-leak-in-veth_pair_add.patch @@ -0,0 +1,51 @@ +From 072f84fb2f9b5b14db1b81e789e2bebf913137a3 Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Fri, 11 Mar 2022 19:57:06 +0300 +Subject: [PATCH 152/245] net: fix e_str leak in veth_pair_add + +coverity CID 389187: + +3193int veth_pair_add(char *in, char *out) +3194{ +3195 char *e_str; +3196 + 1. alloc_fn: Storage is returned from allocation function malloc. + 2. var_assign: Assigning: ___p = storage returned from malloc(200UL). + 3. Condition !___p, taking false branch. + 4. leaked_storage: Variable ___p going out of scope leaks the storage it points to. + 5. var_assign: Assigning: e_str = ({...; ___p;}). +3197 e_str = xmalloc(200); /* For 3 IFNAMSIZ + 8 service characters */ + 6. Condition !e_str, taking false branch. +3198 if (!e_str) +3199 return -1; + 7. noescape: Resource e_str is not freed or pointed-to in snprintf. +3200 snprintf(e_str, 200, "veth[%s]:%s", in, out); + 8. noescape: Resource e_str is not freed or pointed-to in add_external. [show details] + CID 389187 (#1 of 1): Resource leak (RESOURCE_LEAK)9. leaked_storage: Variable e_str going out of scope leaks the storage it points to. +3201 return add_external(e_str); +3202} + +We should free e_str string after we finish it's use in veth_pair_add, +easiest way to do it is to use cleanup_free attribute. + +Signed-off-by: Pavel Tikhomirov +--- + criu/net.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/criu/net.c b/criu/net.c +index 50655559d..c82054037 100644 +--- a/criu/net.c ++++ b/criu/net.c +@@ -3192,7 +3192,7 @@ void network_unlock(void) + + int veth_pair_add(char *in, char *out) + { +- char *e_str; ++ cleanup_free char *e_str = NULL; + + e_str = xmalloc(200); /* For 3 IFNAMSIZ + 8 service characters */ + if (!e_str) +-- +2.35.1 + diff --git a/0153-files-fix-inh-leak-in-inherit_fd_add.patch b/0153-files-fix-inh-leak-in-inherit_fd_add.patch new file mode 100644 index 0000000..3cf38ed --- /dev/null +++ b/0153-files-fix-inh-leak-in-inherit_fd_add.patch @@ -0,0 +1,55 @@ +From ea271af140a0d63de19acd7cb4107ef83e734c1d Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Fri, 11 Mar 2022 18:45:37 +0300 +Subject: [PATCH 153/245] files: fix inh leak in inherit_fd_add + +coverity CID 389190: + +1538int inherit_fd_add(int fd, char *key) +1539{ +1540 struct inherit_fd *inh; +... + 2. alloc_fn: Storage is returned from allocation function malloc. + 3. var_assign: Assigning: ___p = storage returned from malloc(32UL). + 4. Condition !___p, taking false branch. + 5. leaked_storage: Variable ___p going out of scope leaks the storage it points to. + 6. var_assign: Assigning: inh = ({...; ___p;}). +1548 inh = xmalloc(sizeof *inh); + 7. Condition inh == NULL, taking false branch. +1549 if (inh == NULL) +1550 return -1; +1551 +... + 9. Condition !___p, taking true branch. +1555 inh->inh_id = xstrdup(key); + 10. Condition inh->inh_id == NULL, taking true branch. +1556 if (inh->inh_id == NULL) + CID 389190 (#1 of 1): Resource leak (RESOURCE_LEAK)11. leaked_storage: Variable inh going out of scope leaks the storage it points to. +1557 return -1; + +We should free inh on inh_id allocation error path in inherit_fd_add. + +Signed-off-by: Pavel Tikhomirov +--- + criu/files.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/criu/files.c b/criu/files.c +index 7f4b90086..d317bc9ab 100644 +--- a/criu/files.c ++++ b/criu/files.c +@@ -1553,8 +1553,10 @@ int inherit_fd_add(int fd, char *key) + inh_fd_max = fd; + + inh->inh_id = xstrdup(key); +- if (inh->inh_id == NULL) ++ if (inh->inh_id == NULL) { ++ xfree(inh); + return -1; ++ } + + inh->inh_fd = fd; + list_add_tail(&inh->inh_list, &opts.inherit_fds); +-- +2.35.1 + diff --git a/0154-sk-unix-fix-e_str-leak-in-unix_sk_id_add.patch b/0154-sk-unix-fix-e_str-leak-in-unix_sk_id_add.patch new file mode 100644 index 0000000..06fa27a --- /dev/null +++ b/0154-sk-unix-fix-e_str-leak-in-unix_sk_id_add.patch @@ -0,0 +1,51 @@ +From 210d54ef1e4534c8d6a861f31f294e7df5134b5b Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Fri, 11 Mar 2022 18:36:55 +0300 +Subject: [PATCH 154/245] sk-unix: fix e_str leak in unix_sk_id_add + +coverity CID 389191: + +int unix_sk_id_add(unsigned int ino) +2327{ +2328 char *e_str; +2329 + 1. alloc_fn: Storage is returned from allocation function malloc. + 2. var_assign: Assigning: ___p = storage returned from malloc(20UL). + 3. Condition !___p, taking false branch. + 4. leaked_storage: Variable ___p going out of scope leaks the storage it points to. + 5. var_assign: Assigning: e_str = ({...; ___p;}). +2330 e_str = xmalloc(20); + 6. Condition !e_str, taking false branch. +2331 if (!e_str) +2332 return -1; + 7. noescape: Resource e_str is not freed or pointed-to in snprintf. +2333 snprintf(e_str, 20, "unix[%u]", ino); + 8. noescape: Resource e_str is not freed or pointed-to in add_external. [show details] + CID 389191 (#1 of 1): Resource leak (RESOURCE_LEAK)9. leaked_storage: Variable e_str going out of scope leaks the storage it points to. +2334 return add_external(e_str); +2335} + +We should free e_str string after we finish it's use in unix_sk_id_add, +easiest way to do it is to use cleanup_free attribute. + +Signed-off-by: Pavel Tikhomirov +--- + criu/sk-unix.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/criu/sk-unix.c b/criu/sk-unix.c +index 90c9eb11b..b2c2aaca0 100644 +--- a/criu/sk-unix.c ++++ b/criu/sk-unix.c +@@ -2325,7 +2325,7 @@ static void try_resolve_unix_peer(struct unix_sk_info *ui) + + int unix_sk_id_add(unsigned int ino) + { +- char *e_str; ++ cleanup_free char *e_str = NULL; + + e_str = xmalloc(20); + if (!e_str) +-- +2.35.1 + diff --git a/0155-uffd-fix-__u64-print-format-specifier.patch b/0155-uffd-fix-__u64-print-format-specifier.patch new file mode 100644 index 0000000..efa17db --- /dev/null +++ b/0155-uffd-fix-__u64-print-format-specifier.patch @@ -0,0 +1,39 @@ +From c4b5110df1cb83dca79ca57d5413bf93968aa040 Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Fri, 11 Mar 2022 17:31:07 +0300 +Subject: [PATCH 155/245] uffd: fix __u64 print format specifier + +coverity CID 389197: + +CID 389197 (#1 of 1): Invalid printf format string (PRINTF_ARGS) +format_error: Length modifier L not applicable to conversion specifier in %Lu. [show details] +284 pr_err("Incompatible uffd API: expected %Lu, got %Lu\n", UFFD_API, uffdio_api.api); + +Looking on C11 standard it seems that "%Lu" is undefined, we better not +use this, see: + +"L Specifies that a following a, A, e, E, f, F, g, or G conversion +specifier applies to a long double argument." +http://port70.net/~nsz/c/c11/n1570.html#7.21.6.1p7 + +Signed-off-by: Pavel Tikhomirov +--- + criu/uffd.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/criu/uffd.c b/criu/uffd.c +index 45ac8ba77..b551698f8 100644 +--- a/criu/uffd.c ++++ b/criu/uffd.c +@@ -281,7 +281,7 @@ int uffd_open(int flags, unsigned long *features, int *err) + } + + if (uffdio_api.api != UFFD_API) { +- pr_err("Incompatible uffd API: expected %Lu, got %Lu\n", UFFD_API, uffdio_api.api); ++ pr_err("Incompatible uffd API: expected %llu, got %llu\n", UFFD_API, uffdio_api.api); + goto close; + } + +-- +2.35.1 + diff --git a/0156-zdtm-fix-mnt_ext_master-test-to-correspond-to-it-s-n.patch b/0156-zdtm-fix-mnt_ext_master-test-to-correspond-to-it-s-n.patch new file mode 100644 index 0000000..c3dd597 --- /dev/null +++ b/0156-zdtm-fix-mnt_ext_master-test-to-correspond-to-it-s-n.patch @@ -0,0 +1,54 @@ +From 80a918b3fad70613e7257c22d4c1ad585908440d Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Mon, 30 Dec 2019 16:17:54 +0300 +Subject: [PATCH 156/245] zdtm: fix mnt_ext_master test to correspond to it's + name + +Before these change the on-host-"zdtm_auto_ext_mnt" mount with +mountpoint "/tmp/zdtm_ext_auto.XXXXXX" was private/shared depending on +it's parent mount "/tmp". And e.g. on my setup the parent mount on +"/tmp" is private and our "host" mount becomes private too. So +in-container-"zdtm_auto_ext_mnt" external mount is also private but test +name hints it should be slave. + +E.g. If I ran mnt_ext_master before this patch, in mnt_ext_master +process mntns we see that our "external" mount is private but not slave: + +[root@fedora criu]# grep zdtm_auto_ext_mnt /proc/167077/mountinfo +1239 1238 0:138 /test /ext_mounts rw,relatime - tmpfs zdtm_auto_ext_mnt rw,seclabel,inode64 + +After this patch: + +[root@fedora criu]# grep zdtm_auto_ext_mnt /proc/166385/mountinfo +1239 1238 0:138 /test /ext_mounts rw,relatime master:413 - tmpfs zdtm_auto_ext_mnt rw,seclabel,inode64 + ^^^^^^^^^^ + +So we just explicitly make on-host-"zdtm_auto_ext_mnt" shared, and this +makes in-container-"zdtm_auto_ext_mnt" external mount slave. + +Cherry-picked from Virtuozzo criu: +https://src.openvz.org/projects/OVZ/repos/criu/commits/a1a221fe9 + +Signed-off-by: Pavel Tikhomirov +--- + test/zdtm/static/mnt_ext_master.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/test/zdtm/static/mnt_ext_master.c b/test/zdtm/static/mnt_ext_master.c +index 5fd8fa8b2..dbadef0b8 100644 +--- a/test/zdtm/static/mnt_ext_master.c ++++ b/test/zdtm/static/mnt_ext_master.c +@@ -39,6 +39,10 @@ int main(int argc, char **argv) + pr_perror("mount"); + return 1; + } ++ if (mount(NULL, dname, NULL, MS_SHARED, NULL)) { ++ pr_perror("shared"); ++ return 1; ++ } + + mkdir(src, 755); + mkdir(dst, 755); +-- +2.35.1 + diff --git a/0157-mount-add-mntinfo_add_list_before-helper-for-adding-.patch b/0157-mount-add-mntinfo_add_list_before-helper-for-adding-.patch new file mode 100644 index 0000000..9483361 --- /dev/null +++ b/0157-mount-add-mntinfo_add_list_before-helper-for-adding-.patch @@ -0,0 +1,98 @@ +From 3a285b79b73a30400ae13605c3d1e6ae46c661e9 Mon Sep 17 00:00:00 2001 +From: Alexander Mikhalitsyn +Date: Sun, 12 Apr 2020 20:53:54 +0300 +Subject: [PATCH 157/245] mount: add mntinfo_add_list_before helper for adding + to mntinfo list + +Use this helper everywhere instead of manually adding mounts to the head +of the list, this way it is much easier to track all places where we do +add to mntinfo list. + +Signed-off-by: Alexander Mikhalitsyn (Virtuozzo) + +Cherry-picked from Virtuozzo criu: +https://src.openvz.org/projects/OVZ/repos/criu/commits/7bca9397b + +Changes: skip hunk adding root_yard_mp to the list because root yard has +not fully initialized mountinfo structure (can break code which uses +mntinfo fallback in lookup_nsid_by_mnt_id), let's only have real mounts +in mntinfo list. Also skip cr_time mount from mntinfo list for the same +reason. + +Signed-off-by: Pavel Tikhomirov +--- + criu/include/mount.h | 3 +++ + criu/mount.c | 11 +++++++---- + criu/proc_parse.c | 6 ++---- + 3 files changed, 12 insertions(+), 8 deletions(-) + +diff --git a/criu/include/mount.h b/criu/include/mount.h +index b959d131c..f180fe58d 100644 +--- a/criu/include/mount.h ++++ b/criu/include/mount.h +@@ -90,6 +90,9 @@ struct mount_info { + }; + + extern struct mount_info *mntinfo; ++ ++extern void mntinfo_add_list_before(struct mount_info **head, struct mount_info *new); ++ + extern struct ns_desc mnt_ns_desc; + #ifdef CONFIG_BINFMT_MISC_VIRTUALIZED + extern int collect_binfmt_misc(void); +diff --git a/criu/mount.c b/criu/mount.c +index c301aaeeb..7035d992a 100644 +--- a/criu/mount.c ++++ b/criu/mount.c +@@ -127,6 +127,12 @@ static void mntinfo_add_list(struct mount_info *new) + } + } + ++void mntinfo_add_list_before(struct mount_info **head, struct mount_info *new) ++{ ++ new->next = *head; ++ *head = new; ++} ++ + static struct mount_info *__lookup_overlayfs(struct mount_info *list, char *rpath, unsigned int st_dev, + unsigned int st_ino, unsigned int mnt_id) + { +@@ -1527,8 +1533,6 @@ static __maybe_unused int add_cr_time_mount(struct mount_info *root, char *fsnam + mi->nsid = parent->nsid; + mi->parent = parent; + mi->parent_mnt_id = parent->mnt_id; +- mi->next = parent->next; +- parent->next = mi; + list_add(&mi->siblings, &parent->children); + pr_info("Add cr-time mountpoint %s with parent %s(%u)\n", mi->mountpoint, parent->mountpoint, parent->mnt_id); + return 0; +@@ -3015,8 +3019,7 @@ static int collect_mnt_from_image(struct mount_info **head, struct mount_info ** + goto err; + + pm->nsid = nsid; +- pm->next = *head; +- *head = pm; ++ mntinfo_add_list_before(head, pm); + if (!*tail) + *tail = pm; + +diff --git a/criu/proc_parse.c b/criu/proc_parse.c +index 5cd5e6db8..260d3669c 100644 +--- a/criu/proc_parse.c ++++ b/criu/proc_parse.c +@@ -1621,10 +1621,8 @@ struct mount_info *parse_mountinfo(pid_t pid, struct ns_id *nsid, bool for_dump) + if (fsname) + free(fsname); + +- if (new) { +- new->next = list; +- list = new; +- } ++ if (new) ++ mntinfo_add_list_before(&list, new); + + if (ret) + goto err; +-- +2.35.1 + diff --git a/0158-mount-do-not-detect-non-fsroot-mounts-as-device-exte.patch b/0158-mount-do-not-detect-non-fsroot-mounts-as-device-exte.patch new file mode 100644 index 0000000..4c06e64 --- /dev/null +++ b/0158-mount-do-not-detect-non-fsroot-mounts-as-device-exte.patch @@ -0,0 +1,44 @@ +From 4ce94c75c78cacbddf6c374f5efa359f1714f18d Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Thu, 16 Jan 2020 12:36:08 +0300 +Subject: [PATCH 158/245] mount: do not detect non-fsroot mounts as + device-external + +Device-external mounts are restored via do_new_mount(), but function +do_new_mount only allows creating mounts with root "/", as it does +simple mount (not bind) without any later root change. Restoring +non-root mounts via do_new_mount is just imposible. + +So let's detect mounts as device-external only when they have fsroot +root, all other non-fsroot binds of this device would be restored as +bindmounts of fsroot ones. + +This is a cosmetic change as though non-root mounts were detected as +device-external before this patch they anyway would not be created with +do_new_mount() because of fsroot/bind check in can_mount_now orders them +to be restored as binds. + +Cherry-picked one hunk from Virtuozzo criu: +https://src.openvz.org/projects/OVZ/repos/criu/commits/afd899539 + +Signed-off-by: Pavel Tikhomirov +--- + criu/mount.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/criu/mount.c b/criu/mount.c +index 7035d992a..7c42c1fc9 100644 +--- a/criu/mount.c ++++ b/criu/mount.c +@@ -476,7 +476,7 @@ static int try_resolve_ext_mount(struct mount_info *info) + + snprintf(devstr, sizeof(devstr), "dev[%d/%d]", kdev_major(info->s_dev), kdev_minor(info->s_dev)); + +- if (info->fstype->code == FSTYPE__UNSUPPORTED) { ++ if (info->fstype->code == FSTYPE__UNSUPPORTED && fsroot_mounted(info)) { + char *val; + + val = external_lookup_by_key(devstr); +-- +2.35.1 + diff --git a/0159-mount-mark-mounts-of-external-devices-external.patch b/0159-mount-mark-mounts-of-external-devices-external.patch new file mode 100644 index 0000000..793bf2b --- /dev/null +++ b/0159-mount-mark-mounts-of-external-devices-external.patch @@ -0,0 +1,178 @@ +From 6685ad8b808184e2dcb6adecab8e0b97844404d2 Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Mon, 16 Sep 2019 18:07:32 +0300 +Subject: [PATCH 159/245] mount: mark mounts of external devices external + +Previously only autodetected and mountpoint external mounts had +mount_info->external field set, let's fix this injustice so that we can +operate all external mounts in a similar manner. + +Also: + +Print info message when device external mount is detected similar to +mountpoint external mounts detection. + +Add helper mnt_is_nodev_external to let do_mount_one, can_mount_now and +do_bind_mount handle device external mounts separately as it was before. + +Handle device external mount right in get_mp_root to set ->external on +restore. (note: calling ext_mount_lookup is only meaningfull for +mountpoint external mounts) + +Add helper mnt_is_dev_external to use in resolve_source to make it more +clear that it is a device external mount restore path. + +All other "if (mi->external)" checks now also handle device external +mounts, but they all look safe to do so and could've done it initially, +here is a list: fusectl_dump, mnt_is_external, dump_one_mountpoint, +propagate_mount. + +Cherry-picked from Virtuozzo criu: +https://src.openvz.org/projects/OVZ/repos/criu/commits/afd899539 + +Changes: cleanup commit message, add some helpers. + +Signed-off-by: Pavel Tikhomirov +--- + criu/include/mount.h | 19 +++++++++++++++++++ + criu/mount.c | 42 ++++++++++++++++++++++++++---------------- + 2 files changed, 45 insertions(+), 16 deletions(-) + +diff --git a/criu/include/mount.h b/criu/include/mount.h +index f180fe58d..b49b55f3f 100644 +--- a/criu/include/mount.h ++++ b/criu/include/mount.h +@@ -93,6 +93,25 @@ extern struct mount_info *mntinfo; + + extern void mntinfo_add_list_before(struct mount_info **head, struct mount_info *new); + ++/* ++ * Put a : in here since those are invalid on ++ * the cli, so we know it's autogenerated in ++ * debugging. ++ */ ++#define AUTODETECTED_MOUNT "CRIU:AUTOGENERATED" ++#define EXTERNAL_DEV_MOUNT "CRIU:EXTERNAL_DEV" ++#define NO_ROOT_MOUNT "CRIU:NO_ROOT" ++ ++static inline bool mnt_is_dev_external(struct mount_info *mi) ++{ ++ return mi->external && !strcmp(mi->external, EXTERNAL_DEV_MOUNT); ++} ++ ++static inline bool mnt_is_nodev_external(struct mount_info *mi) ++{ ++ return mi->external && strcmp(mi->external, EXTERNAL_DEV_MOUNT); ++} ++ + extern struct ns_desc mnt_ns_desc; + #ifdef CONFIG_BINFMT_MISC_VIRTUALIZED + extern int collect_binfmt_misc(void); +diff --git a/criu/mount.c b/criu/mount.c +index 7c42c1fc9..9fea5f395 100644 +--- a/criu/mount.c ++++ b/criu/mount.c +@@ -31,14 +31,7 @@ + + #include "images/mnt.pb-c.h" + +-/* +- * Put a : in here since those are invalid on +- * the cli, so we know it's autogenerated in +- * debugging. +- */ +-#define AUTODETECTED_MOUNT "CRIU:AUTOGENERATED" +-#define NO_ROOT_MOUNT "CRIU:NO_ROOT" +-#define MS_PROPAGATE (MS_SHARED | MS_PRIVATE | MS_UNBINDABLE | MS_SLAVE) ++#define MS_PROPAGATE (MS_SHARED | MS_PRIVATE | MS_UNBINDABLE | MS_SLAVE) + + #undef LOG_PREFIX + #define LOG_PREFIX "mnt: " +@@ -484,6 +477,9 @@ static int try_resolve_ext_mount(struct mount_info *info) + char *source; + int len; + ++ pr_info("Found %s dev-mapping for %s(%d) mountpoint\n", val, info->ns_mountpoint, info->mnt_id); ++ info->external = EXTERNAL_DEV_MOUNT; ++ + len = strlen(val) + sizeof("dev[]"); + source = xrealloc(info->source, len); + if (source == NULL) +@@ -1827,7 +1823,11 @@ static char *resolve_source(struct mount_info *mi) + */ + return mi->source; + +- if (mi->fstype->code == FSTYPE__AUTO) { ++ /* ++ * FSTYPE__AUTO check is a fallback for old images which do not have ++ * explicit EXTERNAL_DEV_MOUNT mark, but still have "dev[key]" in source. ++ */ ++ if (mnt_is_dev_external(mi) || mi->fstype->code == FSTYPE__AUTO) { + struct stat st; + char *val; + +@@ -2217,7 +2217,7 @@ static int do_bind_mount(struct mount_info *mi) + goto out; + } + +- if (mi->external) { ++ if (mnt_is_nodev_external(mi)) { + /* + * We have / pointing to criu's ns root still, + * so just use the mapping's path. The mountpoint +@@ -2376,7 +2376,7 @@ static bool can_mount_now(struct mount_info *mi) + /* Parent should be mounted already, that's how mnt_tree_for_each works */ + BUG_ON(mi->parent && !mi->parent->mounted); + +- if (mi->external) ++ if (mnt_is_nodev_external(mi)) + goto shared; + + /* +@@ -2551,10 +2551,11 @@ static int do_mount_one(struct mount_info *mi) + return -1; + mi->mounted = true; + ret = 0; +- } else if (!mi->bind && !mi->need_plugin && !mi->external) ++ } else if (!mi->bind && !mi->need_plugin && !mnt_is_nodev_external(mi)) { + ret = do_new_mount(mi); +- else ++ } else { + ret = do_bind_mount(mi); ++ } + + if (ret == 0 && fetch_rt_stat(mi, mi->mountpoint)) + return -1; +@@ -2882,10 +2883,11 @@ static int get_mp_root(MntEntry *me, struct mount_info *mi) + * from the command line and put into root's place + */ + +- ext = ext_mount_lookup(me->ext_key); +- if (!ext) { ++ if (!strcmp(me->ext_key, AUTODETECTED_MOUNT)) { + if (!opts.autodetect_ext_mounts) { +- pr_err("No mapping for %s mountpoint\n", me->mountpoint); ++ pr_err("Mount %d:%s is autodetected external mount. " ++ "Try \"--ext-mount-map auto\" to allow them.\n", ++ mi->mnt_id, mi->mountpoint); + return -1; + } + +@@ -2899,6 +2901,14 @@ static int get_mp_root(MntEntry *me, struct mount_info *mi) + */ + + ext = mi->source; ++ } else if (!strcmp(me->ext_key, EXTERNAL_DEV_MOUNT)) { ++ ext = EXTERNAL_DEV_MOUNT; ++ } else { ++ ext = ext_mount_lookup(me->ext_key); ++ if (!ext) { ++ pr_err("No mapping for %d:%s mountpoint\n", mi->mnt_id, mi->mountpoint); ++ return -1; ++ } + } + + mi->external = ext; +-- +2.35.1 + diff --git a/0160-mount-skip-fstype-and-source-checks-for-external-mou.patch b/0160-mount-skip-fstype-and-source-checks-for-external-mou.patch new file mode 100644 index 0000000..8a3a925 --- /dev/null +++ b/0160-mount-skip-fstype-and-source-checks-for-external-mou.patch @@ -0,0 +1,77 @@ +From 85a2a46355e436f8c78c288dac354d610c1bfe97 Mon Sep 17 00:00:00 2001 +From: Alexander Mikhalitsyn +Date: Tue, 21 Apr 2020 18:12:00 +0300 +Subject: [PATCH 160/245] mount: skip fstype and source checks for external + mounts in mounts_sb_equal + +Fstype and source fields can be changed by resolve_external_mounts() or +by try_resolve_ext_mount() for external mounts, but we can have other +mounts from same superblock which are not detected as external, for +instance bind of subdirectory from device-external or bind of +mountpoint-external mount to other mountpoint. So we need to still be +able to find bindmounts between mounts with changed fstype or source and +unchanged mounts. + +So let's make fstype/source checks in mounts_sb_equal ignored for +external mounts. Leave only fstype->sb_equal checks if have them. + +Signed-off-by: Alexander Mikhalitsyn (Virtuozzo) + +Cherry-picked from Virtuozzo criu: +https://src.openvz.org/projects/OVZ/repos/criu/commits/fadc38d84 +Cherry-picked from Virtuozzo criu: +https://src.openvz.org/projects/OVZ/repos/criu/commits/f9700cb12 + +Changes: merge two commits in one and rework, remove ":)", reword +commit-message to make patch self-sufficient. + +Signed-off-by: Pavel Tikhomirov +--- + criu/mount.c | 27 ++++++++++++++++++++------- + 1 file changed, 20 insertions(+), 7 deletions(-) + +diff --git a/criu/mount.c b/criu/mount.c +index 9fea5f395..9d560a0b2 100644 +--- a/criu/mount.c ++++ b/criu/mount.c +@@ -294,17 +294,30 @@ bool phys_stat_dev_match(dev_t st_dev, dev_t phys_dev, struct ns_id *ns, const c + */ + static bool mounts_sb_equal(struct mount_info *a, struct mount_info *b) + { +- if (a->fstype != b->fstype) +- return false; +- + if (a->s_dev != b->s_dev) + return false; + +- if (strcmp(a->source, b->source) != 0) +- return false; ++ /* ++ * If one of compared mounts is external its mount info can have fstype ++ * and source fields changed by resolve_external_mounts() or ++ * try_resolve_ext_mount(), but we still want to detect bindmounts of ++ * this external mount, so let's skip source and fstype checks for it. ++ */ ++ if (!a->external && !b->external) { ++ if (strcmp(a->source, b->source) != 0) ++ return false; ++ ++ if (a->fstype != b->fstype) ++ return false; + +- if (a->fstype->sb_equal) /* :) */ +- return b->fstype->sb_equal(a, b); ++ if (a->fstype->sb_equal) ++ return a->fstype->sb_equal(a, b); ++ } else { ++ if (a->fstype->sb_equal) ++ return a->fstype->sb_equal(a, b); ++ else if (b->fstype->sb_equal) ++ return b->fstype->sb_equal(a, b); ++ } + + if (strcmp(a->options, b->options)) + return false; +-- +2.35.1 + diff --git a/0161-mount-setup-mnt_bind-list-before-using-it-in-mnt_is_.patch b/0161-mount-setup-mnt_bind-list-before-using-it-in-mnt_is_.patch new file mode 100644 index 0000000..2e55161 --- /dev/null +++ b/0161-mount-setup-mnt_bind-list-before-using-it-in-mnt_is_.patch @@ -0,0 +1,164 @@ +From 579cdbc0567451ed2df89584a267c13ba7365b89 Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Fri, 20 Dec 2019 17:26:07 +0300 +Subject: [PATCH 161/245] mount: setup mnt_bind list before using it in + mnt_is_external + +Before this patch mnt_is_external() used non-populated mnt_bind list +when called from resolve_shared_mounts(), thus it could work not as +intended. + +Let's add separate helper search_bindmounts() for populating mnt_bind +list, and add mnt_bind_is_populated to differentiate between +non-populated list and just empty populated list. This way we can add a +BUG_ON to mnt_is_external to catch such order problems in future. + +Cherry-picked from Virtuozzo criu: +https://src.openvz.org/projects/OVZ/repos/criu/commits/e464c1c6d +Cherry-picked from Virtuozzo criu: +https://src.openvz.org/projects/OVZ/repos/criu/commits/8b22b30d5 +Cherry-picked one hunk from Virtuozzo criu: +https://src.openvz.org/projects/OVZ/repos/criu/commits/ca9de41e3 + +Changes: simplify commit message, merge fixups: search bindmounts +earlier so that we have bindmounts info as early as possible, rename +mnt_no_bind to mnt_bind_is_populated and simplify it's logic a bit. + +Signed-off-by: Pavel Tikhomirov +--- + criu/include/mount.h | 1 + + criu/mount.c | 64 +++++++++++++++++++++++++++++++++----------- + 2 files changed, 50 insertions(+), 15 deletions(-) + +diff --git a/criu/include/mount.h b/criu/include/mount.h +index b49b55f3f..03959e1b0 100644 +--- a/criu/include/mount.h ++++ b/criu/include/mount.h +@@ -73,6 +73,7 @@ struct mount_info { + struct list_head siblings; + + struct list_head mnt_bind; /* circular list of derivatives of one real mount */ ++ bool mnt_bind_is_populated; /* indicate that mnt_bind list is ready to use */ + struct list_head mnt_share; /* circular list of shared mounts */ + struct list_head mnt_slave_list; /* list of slave mounts */ + struct list_head mnt_slave; /* slave list entry */ +diff --git a/criu/mount.c b/criu/mount.c +index 9d560a0b2..de6722e69 100644 +--- a/criu/mount.c ++++ b/criu/mount.c +@@ -571,6 +571,11 @@ static bool mnt_is_external(struct mount_info *m) + if (t->external) + return 1; + ++ /* ++ * Shouldn't use mnt_bind list before it was populated in search_bindmounts ++ */ ++ BUG_ON(!m->mnt_bind_is_populated); ++ + if (m->master_id <= 0 && !list_empty(&m->mnt_bind)) + list_for_each_entry(t, &m->mnt_bind, mnt_bind) + if (issubpath(m->root, t->root) && t->external) +@@ -892,6 +897,43 @@ static int same_propagation_group(struct mount_info *a, struct mount_info *b) + return 0; + } + ++/* ++ * Note: Only valid if called consequently on all mounts in mntinfo list. ++ * ++ * Note: We may want to iterate over all bindmounts of some mount, and we would ++ * use ->mnt_bind list for this, but iterating over ->mnt_bind list is ++ * obviously meaningless before search_bindmounts had actually put bindmounts ++ * in it. That's why we have ->mnt_bind_is_populated to protect from misuse of ++ * ->mnt_bind. (As ->mnt_bind list can validly be empty when mount has no ++ * bindmounts we need separate field to indicate population.) ++ */ ++static void __search_bindmounts(struct mount_info *mi) ++{ ++ struct mount_info *t; ++ ++ if (mi->mnt_bind_is_populated) ++ return; ++ ++ for (t = mi->next; t; t = t->next) { ++ if (mounts_sb_equal(mi, t)) { ++ list_add(&t->mnt_bind, &mi->mnt_bind); ++ t->mnt_bind_is_populated = true; ++ pr_debug("\tThe mount %3d is bind for %3d (@%s -> @%s)\n", t->mnt_id, mi->mnt_id, t->mountpoint, ++ mi->mountpoint); ++ } ++ } ++ ++ mi->mnt_bind_is_populated = true; ++} ++ ++static void search_bindmounts(void) ++{ ++ struct mount_info *mi; ++ ++ for (mi = mntinfo; mi; mi = mi->next) ++ __search_bindmounts(mi); ++} ++ + static int resolve_shared_mounts(struct mount_info *info, int root_master_id) + { + struct mount_info *m, *t; +@@ -944,21 +986,6 @@ static int resolve_shared_mounts(struct mount_info *info, int root_master_id) + m->mnt_id, m->mountpoint, m->master_id, m->shared_id); + return -1; + } +- +- /* Search bind-mounts */ +- if (list_empty(&m->mnt_bind)) { +- /* +- * A first mounted point will be set up as a source point +- * for others. Look at propagate_mount() +- */ +- for (t = m->next; t; t = t->next) { +- if (mounts_sb_equal(m, t)) { +- list_add(&t->mnt_bind, &m->mnt_bind); +- pr_debug("\tThe mount %3d is bind for %3d (@%s -> @%s)\n", t->mnt_id, m->mnt_id, +- t->mountpoint, m->mountpoint); +- } +- } +- } + } + + /* Search propagation groups */ +@@ -1539,6 +1566,7 @@ static __maybe_unused int add_cr_time_mount(struct mount_info *root, char *fsnam + break; + } + ++ mi->mnt_bind_is_populated = true; + mi->nsid = parent->nsid; + mi->parent = parent; + mi->parent_mnt_id = parent->mnt_id; +@@ -3143,6 +3171,9 @@ int read_mnt_ns_img(void) + } + + mntinfo = pms; ++ ++ search_bindmounts(); ++ + return 0; + } + +@@ -3320,6 +3351,7 @@ static int populate_mnt_ns(void) + + root_yard_mp->mountpoint = mnt_roots; + root_yard_mp->mounted = true; ++ root_yard_mp->mnt_bind_is_populated = true; + + if (merge_mount_trees(root_yard_mp)) + return -1; +@@ -3756,6 +3788,8 @@ int collect_mnt_namespaces(bool for_dump) + if (ret) + goto err; + ++ search_bindmounts(); ++ + #ifdef CONFIG_BINFMT_MISC_VIRTUALIZED + if (for_dump && !opts.has_binfmt_misc) { + unsigned int s_dev = 0; +-- +2.35.1 + diff --git a/0162-util-add-get_relative_path-helper.patch b/0162-util-add-get_relative_path-helper.patch new file mode 100644 index 0000000..679b915 --- /dev/null +++ b/0162-util-add-get_relative_path-helper.patch @@ -0,0 +1,142 @@ +From 127d2aa360d2f3fa61f6c3930bede8b388379020 Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Thu, 14 May 2020 13:50:20 +0300 +Subject: [PATCH 162/245] util: add get_relative_path helper + +This is a smart way of getting relative paths: + +1) Always returns relative path, no unexpected starting '/'; +2) Detects subpath even if path formats are different, only real directory +and file names matter; +3) No path modiffication/allocation, returns shifted pointer to the +orignal path. + +We have many places where we need to cut subpath from path. Different code +blocks doing this job spread widely across the codebase for instance see: +cut_root_for_bind and root_path_from_parent. But those implementations rely on +the fact that subpath's and path's formats are the same. + +When we modify or concatenate paths we can accidentally get strange +path formats, paths given by user can have strange format, and the job +to manually maintain all paths in "simple" format everywhere is too +hard. So let's just add a tool to compare "strange" paths. + +E.g.: + +get_relative_path("./a////.///./b//././c", "///./a/b") == "c" + +Note: ".." in path is not supported, and we just can't support it right +without full filesystem tree information to resolve paths like +"../../a", so we just treat ".." as a directory name which should work +in simple cases. + +Cherry-picked from Virtuozzo criu: +https://src.openvz.org/projects/OVZ/repos/criu/commits/73a771348 + +Changes: add other useful robust path comparison helpers is_sub_path and +is_same_path based on get_relative_path, fix clang-format. + +Signed-off-by: Pavel Tikhomirov +--- + criu/include/util.h | 4 +++ + criu/util.c | 72 +++++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 76 insertions(+) + +diff --git a/criu/include/util.h b/criu/include/util.h +index ca934dea0..0df1fe266 100644 +--- a/criu/include/util.h ++++ b/criu/include/util.h +@@ -241,6 +241,10 @@ static inline bool issubpath(const char *path, const char *sub_path) + return strstartswith2(path, sub_path, &end) && (end == '/' || end == '\0'); + } + ++extern char *get_relative_path(char *path, char *sub_path); ++extern bool is_sub_path(char *path, char *sub_path); ++extern bool is_same_path(char *path1, char *path2); ++ + int strip_deleted(char *path, int len); + int cut_path_ending(char *path, char *sub_path); + +diff --git a/criu/util.c b/criu/util.c +index d83be0c0d..f14e6467f 100644 +--- a/criu/util.c ++++ b/criu/util.c +@@ -1815,3 +1815,75 @@ void util_init() + clock_gettime(CLOCK_MONOTONIC, &tp); + criu_run_id = ((uint64_t)getpid() << 32) + tp.tv_sec + tp.tv_nsec; + } ++ ++/* ++ * This function cuts sub_path from the path. ++ * 1) It asumes all relative paths given are relative to "/": ++ * /a/b/c is the same as a/b/c ++ * 2) It can handle paths with multiple consequent slashes: ++ * ///a///b///c is the same as /a/b/c ++ * 3) It always returns relative path, with no leading slash: ++ * get_relative_path("/a/b/c", "/") would be "a/b/c" ++ * get_relative_path("/a/b/c", "/a/b") would be "c" ++ * get_relative_path("/", "/") would be "" ++ * 4) It can handle paths with single dots: ++ * get_relative_path("./a/b", "a/") would be "b" ++ * 5) Note ".." in paths are not supported and handled as normal directory name ++ */ ++char *get_relative_path(char *path, char *sub_path) ++{ ++ bool skip_slashes = true; ++ ++ while (1) { ++ if ((*path == '/' || *path == '\0') && (*sub_path == '/' || *sub_path == '\0')) ++ skip_slashes = true; ++ ++ if (skip_slashes) { ++ while (*path == '/' || (path[0] == '.' && (path[1] == '/' || path[1] == '\0'))) ++ path++; ++ while (*sub_path == '/' || (sub_path[0] == '.' && (sub_path[1] == '/' || sub_path[1] == '\0'))) ++ sub_path++; ++ } ++ ++ if (*sub_path == '\0') { ++ if (skip_slashes) ++ return path; ++ return NULL; ++ } ++ skip_slashes = false; ++ ++ if (*path == '\0') ++ return NULL; ++ ++ if (*path != *sub_path) ++ return NULL; ++ ++ path++; ++ sub_path++; ++ } ++ ++ /* will never get here */ ++ return NULL; ++} ++ ++bool is_sub_path(char *path, char *sub_path) ++{ ++ char *rel_path; ++ ++ rel_path = get_relative_path(path, sub_path); ++ if (!rel_path) ++ return false; ++ ++ return true; ++} ++ ++bool is_same_path(char *path1, char *path2) ++{ ++ char *rel_path; ++ ++ rel_path = get_relative_path(path1, path2); ++ if (!rel_path || *rel_path != '\0') ++ return false; ++ ++ return true; ++} +-- +2.35.1 + diff --git a/0163-unittest-add-some-tests-for-get_relative_path-helper.patch b/0163-unittest-add-some-tests-for-get_relative_path-helper.patch new file mode 100644 index 0000000..1010747 --- /dev/null +++ b/0163-unittest-add-some-tests-for-get_relative_path-helper.patch @@ -0,0 +1,138 @@ +From 3287ff222c0f748dddbac8e21b6eeec71d251141 Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Wed, 19 Jan 2022 12:34:51 +0300 +Subject: [PATCH 163/245] unittest: add some tests for get_relative_path helper + +v2: let's also mock kerndat_s.sysctl_nr_open field, to make aarch64 +clang ci happy + +Signed-off-by: Pavel Tikhomirov +--- + criu/Makefile | 1 + + criu/unittest/mock.c | 39 +++++++++++++++++++++++++++++++++++++++ + criu/unittest/unit.c | 43 +++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 83 insertions(+) + +diff --git a/criu/Makefile b/criu/Makefile +index db4e9d81f..55bdb1b7a 100644 +--- a/criu/Makefile ++++ b/criu/Makefile +@@ -87,6 +87,7 @@ $(obj)/criu: $(PROGRAM-BUILTINS) + $(call msg-link, $@) + $(Q) $(CC) $(CFLAGS) $^ $(LIBS) $(WRAPFLAGS) $(LDFLAGS) $(GMONLDOPT) -rdynamic -o $@ + ++UNIT-BUILTINS += $(obj)/util.o + UNIT-BUILTINS += $(obj)/config.o + UNIT-BUILTINS += $(obj)/log.o + UNIT-BUILTINS += $(obj)/string.o +diff --git a/criu/unittest/mock.c b/criu/unittest/mock.c +index fb9d38494..127cc7498 100644 +--- a/criu/unittest/mock.c ++++ b/criu/unittest/mock.c +@@ -97,3 +97,42 @@ int close_service_fd(int type) + void compel_log_init(int log_fn, unsigned int level) + { + } ++ ++void set_cr_errno(int new_err) ++{ ++} ++ ++struct ns_desc { ++}; ++struct ns_desc user_ns_desc; ++int switch_ns(int pid, struct ns_desc *nd, int *rst) ++{ ++ return -1; ++} ++ ++enum script_actions { ACT_FAKE }; ++int run_scripts(enum script_actions act) ++{ ++ return -1; ++} ++ ++typedef struct VmaEntry VmaEntry; ++struct VmaEntry { ++}; ++void vma_entry__init(VmaEntry *message) ++{ ++} ++ ++int clone_noasan(int (*fn)(void *), int flags, void *arg) ++{ ++ return -1; ++} ++ ++struct kerndat_s { ++ unsigned int sysctl_nr_open; ++}; ++struct kerndat_s kdat = {}; ++ ++int service_fd_rlim_cur; ++ ++unsigned __page_size; +diff --git a/criu/unittest/unit.c b/criu/unittest/unit.c +index 3ee141e25..54769e6f2 100644 +--- a/criu/unittest/unit.c ++++ b/criu/unittest/unit.c +@@ -3,6 +3,7 @@ + #include + + #include "log.h" ++#include "util.h" + #include "criu-log.h" + + int parse_statement(int i, char *line, char **configuration); +@@ -100,6 +101,48 @@ int main(int argc, char *argv[], char *envp[]) + i = parse_statement(0, "a b c d e f g h i\n", configuration); + assert(i == -1); + ++ /* get_relative_path */ ++ /* different kinds of representation of "/" */ ++ assert(!strcmp(get_relative_path("/", "/"), "")); ++ assert(!strcmp(get_relative_path("/", ""), "")); ++ assert(!strcmp(get_relative_path("", "/"), "")); ++ assert(!strcmp(get_relative_path(".", "/"), "")); ++ assert(!strcmp(get_relative_path("/", "."), "")); ++ assert(!strcmp(get_relative_path("/", "./"), "")); ++ assert(!strcmp(get_relative_path("./", "/"), "")); ++ assert(!strcmp(get_relative_path("/.", "./"), "")); ++ assert(!strcmp(get_relative_path("./", "/."), "")); ++ assert(!strcmp(get_relative_path(".//////.", ""), "")); ++ assert(!strcmp(get_relative_path("/./", ""), "")); ++ ++ /* all relative paths given are assumed relative to "/" */ ++ assert(!strcmp(get_relative_path("/a/b/c", "a/b/c"), "")); ++ ++ /* multiple slashes are ignored, only directory names matter */ ++ assert(!strcmp(get_relative_path("///alfa///beta///gamma///", "//alfa//beta//gamma//"), "")); ++ ++ /* returned path is always relative */ ++ assert(!strcmp(get_relative_path("/a/b/c", "/"), "a/b/c")); ++ assert(!strcmp(get_relative_path("/a/b/c", "/a/b"), "c")); ++ ++ /* single dots supported */ ++ assert(!strcmp(get_relative_path("./a/b", "a/"), "b")); ++ ++ /* double dots are partially supported */ ++ assert(!strcmp(get_relative_path("a/../b", "a"), "../b")); ++ assert(!strcmp(get_relative_path("a/../b", "a/.."), "b")); ++ assert(!get_relative_path("a/../b/c", "b")); ++ ++ /* if second path is not subpath - NULL returned */ ++ assert(!get_relative_path("/a/b/c", "/a/b/d")); ++ assert(!get_relative_path("/a/b", "/a/b/c")); ++ assert(!get_relative_path("/a/b/c/d", "b/c/d")); ++ ++ assert(!strcmp(get_relative_path("./a////.///./b//././c", "///./a/b"), "c")); ++ ++ /* leaves punctuation in returned string as is */ ++ assert(!strcmp(get_relative_path("./a////.///./b//././c", "a"), "b//././c")); ++ + pr_msg("OK\n"); + return 0; + } +-- +2.35.1 + diff --git a/0164-mount-add-mnt_bind_pick-helper-to-pick-the-desired-b.patch b/0164-mount-add-mnt_bind_pick-helper-to-pick-the-desired-b.patch new file mode 100644 index 0000000..04942fc --- /dev/null +++ b/0164-mount-add-mnt_bind_pick-helper-to-pick-the-desired-b.patch @@ -0,0 +1,62 @@ +From 0bd2d50db651b6f59744e3445fa596bc298dd57e Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Mon, 29 Nov 2021 12:54:51 +0300 +Subject: [PATCH 164/245] mount: add mnt_bind_pick helper to pick the desired + bind + +Adding different pick functions we would be able to search different +things like mounted bind with wider root, or external bind, or external +bind with same sharing group and so on and so forth. + +Signed-off-by: Pavel Tikhomirov +--- + criu/include/mount.h | 2 ++ + criu/mount.c | 21 +++++++++++++++++++++ + 2 files changed, 23 insertions(+) + +diff --git a/criu/include/mount.h b/criu/include/mount.h +index 03959e1b0..c782d84bb 100644 +--- a/criu/include/mount.h ++++ b/criu/include/mount.h +@@ -173,4 +173,6 @@ extern int remount_readonly_mounts(void); + extern int try_remount_writable(struct mount_info *mi, bool ns); + extern bool mnt_is_overmounted(struct mount_info *mi); + ++extern struct mount_info *mnt_bind_pick(struct mount_info *mi, ++ bool (*pick)(struct mount_info *mi, struct mount_info *bind)); + #endif /* __CR_MOUNT_H__ */ +diff --git a/criu/mount.c b/criu/mount.c +index de6722e69..fcdf06d50 100644 +--- a/criu/mount.c ++++ b/criu/mount.c +@@ -934,6 +934,27 @@ static void search_bindmounts(void) + __search_bindmounts(mi); + } + ++struct mount_info *mnt_bind_pick(struct mount_info *mi, bool (*pick)(struct mount_info *mi, struct mount_info *bind)) ++{ ++ struct mount_info *bind; ++ ++ BUG_ON(!mi); ++ ++ if (pick(mi, mi)) ++ return mi; ++ ++ /* ++ * Shouldn't use mnt_bind list before it was populated in search_bindmounts ++ */ ++ BUG_ON(!mi->mnt_bind_is_populated); ++ ++ list_for_each_entry(bind, &mi->mnt_bind, mnt_bind) ++ if (pick(mi, bind)) ++ return bind; ++ ++ return NULL; ++} ++ + static int resolve_shared_mounts(struct mount_info *info, int root_master_id) + { + struct mount_info *m, *t; +-- +2.35.1 + diff --git a/0165-mount-split-mnt_is_external-_bind-and-can_receive_ma.patch b/0165-mount-split-mnt_is_external-_bind-and-can_receive_ma.patch new file mode 100644 index 0000000..23433b9 --- /dev/null +++ b/0165-mount-split-mnt_is_external-_bind-and-can_receive_ma.patch @@ -0,0 +1,160 @@ +From 569a003b3993f27e651dc9f7e644806553d5908f Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Wed, 18 Dec 2019 13:45:22 +0300 +Subject: [PATCH 165/245] mount: split mnt_is_external(_bind) and + can_receive_master_from_external + +We use mnt_is_external(): + +1) In validate_mounts() to skip fsroot existence check for mounts which +will be bind-mounted from external mounts. + +2) In resolve_shared_mounts() to skip error on slave mounts without +master mount, if they can receive these master_id through external +mount. + +3) In dump_one_fs to skip dump of mounts which will be bind-mounted from +external mounts. + +Cases (1) and (3) are the same, but case (2) is quiet different. Lets +split these cases thus making things simplier. + +Effectively these patch does not change criu's behaviour at all. While +I can't say that old mnt_is_external was wrong, it was too complex and +hard for understanding, so it's worth to switch to lookup across +bindmounts list via general mnt_bind_pick() helper. And now when it is +obvious that mnt_is_external looks for external bindmount, let's also +change it's name to mnt_is_external_bind. + +Cherry-picked from Virtuozzo criu: +https://src.openvz.org/projects/OVZ/repos/criu/commits/494b52ba8 + +Changes: use mnt_bind_pick helper, use is_sub_path helper to be more +robust, rename mnt_is_external to mnt_is_external_bind, fix +clang-format, export to mount.h, use mnt_is_nodev_external as we can not +inherit master from device-external mounts. + +Signed-off-by: Pavel Tikhomirov +--- + criu/include/mount.h | 2 ++ + criu/mount.c | 57 ++++++++++++++++++++------------------------ + 2 files changed, 28 insertions(+), 31 deletions(-) + +diff --git a/criu/include/mount.h b/criu/include/mount.h +index c782d84bb..b21c23975 100644 +--- a/criu/include/mount.h ++++ b/criu/include/mount.h +@@ -173,6 +173,8 @@ extern int remount_readonly_mounts(void); + extern int try_remount_writable(struct mount_info *mi, bool ns); + extern bool mnt_is_overmounted(struct mount_info *mi); + ++extern bool mnt_is_external_bind(struct mount_info *mi); ++ + extern struct mount_info *mnt_bind_pick(struct mount_info *mi, + bool (*pick)(struct mount_info *mi, struct mount_info *bind)); + #endif /* __CR_MOUNT_H__ */ +diff --git a/criu/mount.c b/criu/mount.c +index fcdf06d50..ef50d0fa2 100644 +--- a/criu/mount.c ++++ b/criu/mount.c +@@ -552,39 +552,34 @@ static bool mnt_needs_remap(struct mount_info *m) + return false; + } + +-/* +- * Say mount is external if it was explicitly specified as an +- * external or it will be bind from such an explicit external +- * mount, we set bind in propagate_mount and propagate_siblings +- */ +- +-static bool mnt_is_external(struct mount_info *m) ++static bool __mnt_is_external_bind(struct mount_info *mi, struct mount_info *bind) + { +- struct mount_info *t; +- +- while (m) { +- if (m->external) +- return 1; ++ if (bind->external && is_sub_path(mi->root, bind->root)) ++ return true; + +- if (!list_empty(&m->mnt_share)) +- list_for_each_entry(t, &m->mnt_share, mnt_share) +- if (t->external) +- return 1; ++ return false; ++} + +- /* +- * Shouldn't use mnt_bind list before it was populated in search_bindmounts +- */ +- BUG_ON(!m->mnt_bind_is_populated); ++/* ++ * Say mount is external if it was explicitly specified as an external or it ++ * can be bind-mounted from such an explicit external mount. ++ */ ++bool mnt_is_external_bind(struct mount_info *mi) ++{ ++ return mnt_bind_pick(mi, __mnt_is_external_bind); ++} + +- if (m->master_id <= 0 && !list_empty(&m->mnt_bind)) +- list_for_each_entry(t, &m->mnt_bind, mnt_bind) +- if (issubpath(m->root, t->root) && t->external) +- return 1; ++static bool __can_receive_master_from_external(struct mount_info *mi, struct mount_info *bind) ++{ ++ if (mnt_is_nodev_external(bind) && bind->master_id == mi->master_id && is_sub_path(mi->root, bind->root)) ++ return true; + +- m = m->mnt_master; +- } ++ return false; ++} + +- return 0; ++static struct mount_info *can_receive_master_from_external(struct mount_info *mi) ++{ ++ return mnt_bind_pick(mi, __can_receive_master_from_external); + } + + /* +@@ -627,7 +622,7 @@ static int validate_mounts(struct mount_info *info, bool for_dump) + if (validate_children_collision(m)) + return -1; + +- if (mnt_is_external(m)) ++ if (mnt_is_external_bind(m)) + continue; + + /* +@@ -1001,7 +996,7 @@ static int resolve_shared_mounts(struct mount_info *info, int root_master_id) + * If we haven't already determined this mount is external, + * or bind of external, then we don't know where it came from. + */ +- if (need_master && m->parent && !mnt_is_external(m)) { ++ if (need_master && m->parent && !can_receive_master_from_external(m)) { + pr_err("Mount %d %s (master_id: %d shared_id: %d) " + "has unreachable sharing. Try --enable-external-masters.\n", + m->mnt_id, m->mountpoint, m->master_id, m->shared_id); +@@ -1640,7 +1635,7 @@ static int dump_one_fs(struct mount_info *mi) + struct mount_info *t; + bool first = true; + +- if (mi->is_ns_root || mi->need_plugin || mnt_is_external(mi) || !mi->fstype->dump) ++ if (mi->is_ns_root || mi->need_plugin || mnt_is_external_bind(mi) || !mi->fstype->dump) + return 0; + + /* mnt_bind is a cycled list, so list_for_each can't be used here. */ +@@ -2925,7 +2920,7 @@ static int get_mp_root(MntEntry *me, struct mount_info *mi) + me->ext_key = me->root; + /* + * Putting the id of external mount which is provided by user, +- * to ->root can confuse mnt_is_external and other functions ++ * to ->root can confuse mnt_is_external_bind and other functions + * which expect to see the path in the file system to the root + * of these mount (mounts_equal, mnt_build_ids_tree, + * find_fsroot_mount_for, find_best_external_match, etc.) +-- +2.35.1 + diff --git a/0166-mount-rework-skipping-external-mounts-in-dump_one_mo.patch b/0166-mount-rework-skipping-external-mounts-in-dump_one_mo.patch new file mode 100644 index 0000000..c98a8c8 --- /dev/null +++ b/0166-mount-rework-skipping-external-mounts-in-dump_one_mo.patch @@ -0,0 +1,45 @@ +From 8e04c0735d8049a628bc47ba0a92b8c7bde0b922 Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Wed, 12 Jan 2022 13:34:39 +0300 +Subject: [PATCH 166/245] mount: rework skipping external mounts in + dump_one_mountpoint + +Function dump_one_fs already has mnt_is_external_bind check inside, so +there is no point to check pm->external one more time. + +Function check_bindmount is intended to check devpts bindmount's master +was opened in right mount namespace, but if bindmount is external mount +there is no point to check this. Let's also skip check for bindmounts of +external mounts. + +Signed-off-by: Pavel Tikhomirov +--- + criu/mount.c | 11 +++++------ + 1 file changed, 5 insertions(+), 6 deletions(-) + +diff --git a/criu/mount.c b/criu/mount.c +index ef50d0fa2..844f52e4d 100644 +--- a/criu/mount.c ++++ b/criu/mount.c +@@ -1674,13 +1674,12 @@ static int dump_one_mountpoint(struct mount_info *pm, struct cr_img *img) + if (me.fstype == FSTYPE__AUTO) + me.fsname = pm->fsname; + +- if (!pm->external) { +- if (!pm->dumped && dump_one_fs(pm)) +- return -1; ++ if (!pm->dumped && dump_one_fs(pm)) ++ return -1; + +- if (!fsroot_mounted(pm) && pm->fstype->check_bindmount && pm->fstype->check_bindmount(pm)) +- return -1; +- } ++ if (!mnt_is_external_bind(pm) && !fsroot_mounted(pm) && pm->fstype->check_bindmount && ++ pm->fstype->check_bindmount(pm)) ++ return -1; + + if (pm->mnt_id == CRTIME_MNT_ID) { + pr_info("Skip dumping cr-time mountpoint: %s\n", pm->mountpoint); +-- +2.35.1 + diff --git a/0167-mount-show-more-info-about-why-we-can-t-mount.patch b/0167-mount-show-more-info-about-why-we-can-t-mount.patch new file mode 100644 index 0000000..6e4859a --- /dev/null +++ b/0167-mount-show-more-info-about-why-we-can-t-mount.patch @@ -0,0 +1,108 @@ +From 323ca816334a16f0af3aa78587fd09cbe248b0e1 Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Thu, 12 Sep 2019 10:10:37 +0300 +Subject: [PATCH 167/245] mount: show more info about why we can't mount + +Currently if we have mount deadlock it is hard to understand which +mounts lock each other, these makes it easier. + +Cherry-picked from Virtuozzo criu: +https://src.openvz.org/projects/OVZ/repos/criu/commits/8ba8499e2 +Cherry-picked from Virtuozzo criu: +https://src.openvz.org/projects/OVZ/repos/criu/commits/48d044ae11 + +Changes: merge newline fixup. + +Signed-off-by: Pavel Tikhomirov +--- + criu/mount.c | 42 ++++++++++++++++++++++++++++++++---------- + 1 file changed, 32 insertions(+), 10 deletions(-) + +diff --git a/criu/mount.c b/criu/mount.c +index 844f52e4d..f1c970da6 100644 +--- a/criu/mount.c ++++ b/criu/mount.c +@@ -2426,8 +2426,10 @@ static bool rst_mnt_is_root(struct mount_info *m) + + static bool can_mount_now(struct mount_info *mi) + { +- if (rst_mnt_is_root(mi)) ++ if (rst_mnt_is_root(mi)) { ++ pr_debug("%s: true as %d is mntns root\n", __func__, mi->mnt_id); + return true; ++ } + + /* Parent should be mounted already, that's how mnt_tree_for_each works */ + BUG_ON(mi->parent && !mi->parent->mounted); +@@ -2444,21 +2446,35 @@ static bool can_mount_now(struct mount_info *mi) + if (mi->mnt_master) { + struct mount_info *c, *s; + +- if (mi->bind == NULL) ++ if (mi->bind == NULL) { ++ pr_debug("%s: false as %d is slave with unmounted master %d\n", __func__, mi->mnt_id, ++ mi->mnt_master->mnt_id); + return false; ++ } + +- list_for_each_entry(c, &mi->mnt_master->children, siblings) +- if (!c->mounted) ++ list_for_each_entry(c, &mi->mnt_master->children, siblings) { ++ if (!c->mounted) { ++ pr_debug("%s: false as %d is slave with unmounted master's children %d\n", __func__, ++ mi->mnt_id, c->mnt_id); + return false; ++ } ++ } + +- list_for_each_entry(s, &mi->mnt_master->mnt_share, mnt_share) +- list_for_each_entry(c, &s->children, siblings) +- if (!c->mounted) ++ list_for_each_entry(s, &mi->mnt_master->mnt_share, mnt_share) { ++ list_for_each_entry(c, &s->children, siblings) { ++ if (!c->mounted) { ++ pr_debug("%s: false as %d is slave with unmounted children of master's share\n", ++ __func__, mi->mnt_id); + return false; ++ } ++ } ++ } + } + +- if (!fsroot_mounted(mi) && (mi->bind == NULL && !mi->need_plugin)) ++ if (!fsroot_mounted(mi) && (mi->bind == NULL && !mi->need_plugin)) { ++ pr_debug("%s: false as %d is non-root without bind or plugin\n", __func__, mi->mnt_id); + return false; ++ } + + shared: + /* Mount only after all parents of our propagation group mounted */ +@@ -2467,8 +2483,11 @@ shared: + + list_for_each_entry(p, &mi->mnt_propagate, mnt_propagate) { + BUG_ON(!p->parent); +- if (!p->parent->mounted) ++ if (!p->parent->mounted) { ++ pr_debug("%s: false as %d has unmounted parent %d of its propagation group\n", __func__, ++ mi->mnt_id, p->parent->mnt_id); + return false; ++ } + } + } + +@@ -2515,8 +2534,11 @@ shared: + + /* Check not propagated mounts mounted and cleanup list */ + list_for_each_entry_safe(p, t, &mi_notprop, mnt_notprop) { +- if (!p->mounted) ++ if (!p->mounted) { ++ pr_debug("%s: false as %d has unmounted 'anti'-propagation mount %d\n", __func__, ++ mi->mnt_id, p->mnt_id); + can = false; ++ } + list_del_init(&p->mnt_notprop); + } + +-- +2.35.1 + diff --git a/0168-mount-mount-external-mount-before-mounting-it-s-bind.patch b/0168-mount-mount-external-mount-before-mounting-it-s-bind.patch new file mode 100644 index 0000000..9a85d51 --- /dev/null +++ b/0168-mount-mount-external-mount-before-mounting-it-s-bind.patch @@ -0,0 +1,103 @@ +From 2f347af01f5ec1525b989fe4ed9d9c5ead2c5f27 Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Mon, 17 Feb 2020 11:58:41 +0300 +Subject: [PATCH 168/245] mount: mount external mount before mounting it's + binds + +The problem when we don't order these mounts we can get to mounting +non-external bind first via do_new_mount and fail c/r. For instance for +tmpfs we would fail on no image to get contents from. See the test +mnt_ext_root for more info. + +Cherry-picked from Virtuozzo criu: +https://src.openvz.org/projects/OVZ/repos/criu/commits/baf3f8db8 + +Changes: switch to mnt_bind_pick helper, export to mount.h, make check +in can_mount_now skip mounts with ->bind set. + +Signed-off-by: Pavel Tikhomirov +--- + criu/include/mount.h | 2 ++ + criu/mount.c | 27 ++++++++++++++++++++++++++- + 2 files changed, 28 insertions(+), 1 deletion(-) + +diff --git a/criu/include/mount.h b/criu/include/mount.h +index b21c23975..7dffe5b2c 100644 +--- a/criu/include/mount.h ++++ b/criu/include/mount.h +@@ -173,7 +173,9 @@ extern int remount_readonly_mounts(void); + extern int try_remount_writable(struct mount_info *mi, bool ns); + extern bool mnt_is_overmounted(struct mount_info *mi); + ++extern struct mount_info *mnt_get_external_bind(struct mount_info *mi); + extern bool mnt_is_external_bind(struct mount_info *mi); ++extern bool has_mounted_external_bind(struct mount_info *mi); + + extern struct mount_info *mnt_bind_pick(struct mount_info *mi, + bool (*pick)(struct mount_info *mi, struct mount_info *bind)); +diff --git a/criu/mount.c b/criu/mount.c +index f1c970da6..968b6dc03 100644 +--- a/criu/mount.c ++++ b/criu/mount.c +@@ -564,11 +564,16 @@ static bool __mnt_is_external_bind(struct mount_info *mi, struct mount_info *bin + * Say mount is external if it was explicitly specified as an external or it + * can be bind-mounted from such an explicit external mount. + */ +-bool mnt_is_external_bind(struct mount_info *mi) ++struct mount_info *mnt_get_external_bind(struct mount_info *mi) + { + return mnt_bind_pick(mi, __mnt_is_external_bind); + } + ++bool mnt_is_external_bind(struct mount_info *mi) ++{ ++ return mnt_get_external_bind(mi); ++} ++ + static bool __can_receive_master_from_external(struct mount_info *mi, struct mount_info *bind) + { + if (mnt_is_nodev_external(bind) && bind->master_id == mi->master_id && is_sub_path(mi->root, bind->root)) +@@ -582,6 +587,19 @@ static struct mount_info *can_receive_master_from_external(struct mount_info *mi + return mnt_bind_pick(mi, __can_receive_master_from_external); + } + ++static bool __has_mounted_external_bind(struct mount_info *mi, struct mount_info *bind) ++{ ++ if (bind->external && bind->mounted && is_sub_path(mi->root, bind->root)) ++ return true; ++ ++ return false; ++} ++ ++bool has_mounted_external_bind(struct mount_info *mi) ++{ ++ return mnt_bind_pick(mi, __has_mounted_external_bind); ++} ++ + /* + * Having two children with same mountpoint is unsupported. That can happen in + * case of mount propagation inside of shared mounts, in that case it is hard +@@ -2426,6 +2444,8 @@ static bool rst_mnt_is_root(struct mount_info *m) + + static bool can_mount_now(struct mount_info *mi) + { ++ struct mount_info *ext; ++ + if (rst_mnt_is_root(mi)) { + pr_debug("%s: true as %d is mntns root\n", __func__, mi->mnt_id); + return true; +@@ -2437,6 +2457,11 @@ static bool can_mount_now(struct mount_info *mi) + if (mnt_is_nodev_external(mi)) + goto shared; + ++ if (!mi->bind && !mi->external && (ext = mnt_get_external_bind(mi)) && !has_mounted_external_bind(mi)) { ++ pr_debug("%s: false as %d's external %d is not mounted\n", __func__, mi->mnt_id, ext->mnt_id); ++ return false; ++ } ++ + /* + * We're the slave peer: + * - Make sure the master peer is already mounted +-- +2.35.1 + diff --git a/0169-zdtm-add-new-mnt_ext_root-test.patch b/0169-zdtm-add-new-mnt_ext_root-test.patch new file mode 100644 index 0000000..2edd55a --- /dev/null +++ b/0169-zdtm-add-new-mnt_ext_root-test.patch @@ -0,0 +1,162 @@ +From 8f1a5dadf72c917336c06f028b58111b6c00fd50 Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Tue, 18 Feb 2020 13:41:18 +0300 +Subject: [PATCH 169/245] zdtm: add new mnt_ext_root test + +This test simply creates a) root external mount and b) "deeper" +bindmount for it (deeper in terms of mnt_depth). Our mount restore code +tries to mount (b) first and fails (without previous patch ordering +external mounts before their binds). + +Cherry-picked from Virtuozzo criu: +https://src.openvz.org/projects/OVZ/repos/criu/commits/d31954669 + +Signed-off-by: Pavel Tikhomirov +--- + test/zdtm/static/Makefile | 1 + + test/zdtm/static/mnt_ext_root.c | 88 ++++++++++++++++++++++++++++++ + test/zdtm/static/mnt_ext_root.desc | 5 ++ + test/zdtm/static/mnt_ext_root.hook | 12 ++++ + 4 files changed, 106 insertions(+) + create mode 100644 test/zdtm/static/mnt_ext_root.c + create mode 100644 test/zdtm/static/mnt_ext_root.desc + create mode 100755 test/zdtm/static/mnt_ext_root.hook + +diff --git a/test/zdtm/static/Makefile b/test/zdtm/static/Makefile +index 33e15f85a..a64c51cd0 100644 +--- a/test/zdtm/static/Makefile ++++ b/test/zdtm/static/Makefile +@@ -399,6 +399,7 @@ TST_DIR = \ + mnt_ext_auto \ + mnt_ext_master \ + mnt_ext_dev \ ++ mnt_ext_root \ + mnt_tracefs \ + mntns_deleted \ + unlink_regular00 \ +diff --git a/test/zdtm/static/mnt_ext_root.c b/test/zdtm/static/mnt_ext_root.c +new file mode 100644 +index 000000000..9f9554d51 +--- /dev/null ++++ b/test/zdtm/static/mnt_ext_root.c +@@ -0,0 +1,88 @@ ++#include ++#include ++#include ++#include ++ ++#include "zdtmtst.h" ++ ++const char *test_doc = "Check root external mount with \"deepper\" bind"; ++const char *test_author = "Pavel Tikhomirov "; ++ ++char *source = "zdtm_ext_root"; ++char *dirname = "mnt_ext_root.test"; ++TEST_OPTION(dirname, string, "directory name", 1); ++ ++#define BUF_SIZE 4096 ++ ++int main(int argc, char **argv) ++{ ++ char *root, testdir[PATH_MAX]; ++ char dst[PATH_MAX], deep_bind[PATH_MAX]; ++ char *tmp = "/tmp/zdtm_ext_root.tmp"; ++ char *zdtm_newns = getenv("ZDTM_NEWNS"); ++ ++ root = getenv("ZDTM_ROOT"); ++ if (root == NULL) { ++ pr_perror("root"); ++ return 1; ++ } ++ ++ if (!zdtm_newns) { ++ pr_perror("ZDTM_NEWNS is not set"); ++ return 1; ++ } else if (strcmp(zdtm_newns, "1")) { ++ goto test; ++ } ++ ++ /* Prepare directories in test root */ ++ sprintf(testdir, "%s/%s", root, dirname); ++ mkdir(testdir, 0755); ++ ++ sprintf(dst, "%s/%s/dst", root, dirname); ++ mkdir(dst, 0755); ++ sprintf(deep_bind, "%s/%s/deep", root, dirname); ++ mkdir(deep_bind, 0755); ++ sprintf(deep_bind, "%s/%s/deep/bind", root, dirname); ++ mkdir(deep_bind, 0755); ++ ++ /* Prepare mount in criu root */ ++ mkdir(tmp, 0755); ++ if (mount(source, tmp, "tmpfs", 0, NULL)) { ++ pr_perror("mount tmpfs"); ++ return 1; ++ } ++ if (mount(NULL, tmp, NULL, MS_PRIVATE, NULL)) { ++ pr_perror("make private"); ++ return 1; ++ } ++ ++ /* ++ * Create temporary mntns, next mounts will not show up in criu mntns ++ */ ++ if (unshare(CLONE_NEWNS)) { ++ pr_perror("unshare"); ++ return 1; ++ } ++ ++ /* ++ * Populate to the tests mntns root mounts ++ */ ++ if (mount(tmp, dst, NULL, MS_BIND, NULL)) { ++ pr_perror("bind"); ++ return 1; ++ } ++ ++ if (mount(tmp, deep_bind, NULL, MS_BIND, NULL)) { ++ pr_perror("bind"); ++ return 1; ++ } ++ ++test: ++ test_init(argc, argv); ++ ++ test_daemon(); ++ test_waitsig(); ++ ++ pass(); ++ return 0; ++} +diff --git a/test/zdtm/static/mnt_ext_root.desc b/test/zdtm/static/mnt_ext_root.desc +new file mode 100644 +index 000000000..121dbb0a7 +--- /dev/null ++++ b/test/zdtm/static/mnt_ext_root.desc +@@ -0,0 +1,5 @@ ++{ 'dopts': '--external mnt[/mnt_ext_root.test/dst]:ZDTM', ++ 'feature': 'mnt_id', ++ 'flavor': 'ns uns', ++ 'flags': 'suid', ++ 'ropts': '--external mnt[ZDTM]:/tmp/zdtm_ext_root.tmp'} +diff --git a/test/zdtm/static/mnt_ext_root.hook b/test/zdtm/static/mnt_ext_root.hook +new file mode 100755 +index 000000000..c022f91ad +--- /dev/null ++++ b/test/zdtm/static/mnt_ext_root.hook +@@ -0,0 +1,12 @@ ++#!/bin/bash ++ ++[ "$1" == "--clean" ] || exit 0 ++ ++TMP="/tmp/zdtm_ext_root.tmp" ++echo "Cleanup mnt_ext_sharing" ++umount "$TMP" ++rm -rf $TMP ++ ++rm -rf "mnt_ext_root.test" ++ ++exit 0 +-- +2.35.1 + diff --git a/0170-mount-restrict-mp-external-mount-map-to-init-contain.patch b/0170-mount-restrict-mp-external-mount-map-to-init-contain.patch new file mode 100644 index 0000000..8ba4d49 --- /dev/null +++ b/0170-mount-restrict-mp-external-mount-map-to-init-contain.patch @@ -0,0 +1,66 @@ +From 573137b58e00dce2d58c7e669a6a07ecbcddf9b0 Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Fri, 26 Nov 2021 12:53:41 +0300 +Subject: [PATCH 170/245] mount: restrict mp-external mount map to init + container mntns only + +We resolve mountpoint-external mounts on dump by mountpoint comparison, +so if we have other mount (other superblock e.g. in nested mntns) with +same mountpoint we would also resolve this mount as external and restore +it as external: replacing it completely with different mount... That's +wrong, so to make this interface more robust let's only resolve +mountpoint-external mounts in root mntns of container, not in all +mntnses as it was before. + +Note: if actual external mount (bind of external) gets to nested mntns +it's ok not to resolve it as external as criu would bind it from the +resolved mount in root mntns. So external mounts in nested mntns are +still supported after this patch. + +Cherry-picked one hunk from Virtuozzo criu: +https://src.openvz.org/projects/OVZ/repos/criu/commits/034498b28 + +Changes: apply mntns check only to mountpoint-external mounts. + +Signed-off-by: Pavel Tikhomirov +--- + criu/mount.c | 21 +++++++++++++++------ + 1 file changed, 15 insertions(+), 6 deletions(-) + +diff --git a/criu/mount.c b/criu/mount.c +index 968b6dc03..ff9b9b591 100644 +--- a/criu/mount.c ++++ b/criu/mount.c +@@ -470,14 +470,23 @@ static void mnt_tree_show(struct mount_info *tree, int off) + /* Returns -1 on error, 1 if external mount resolved, 0 otherwise */ + static int try_resolve_ext_mount(struct mount_info *info) + { +- char *ext; + char devstr[64]; + +- ext = ext_mount_lookup(info->mountpoint + 1 /* trim the . */); +- if (ext) { +- pr_info("Found %s mapping for %s mountpoint\n", ext, info->mountpoint); +- info->external = ext; +- return 1; ++ /* ++ * Only allow mountpoint-external mounts in root mntns. Their lookup is ++ * based on mountpoint path, but in nested mntns we can have completely ++ * different mount tree and at same mountpoint we can have completely ++ * different mount. ++ */ ++ if (info->nsid->type == NS_ROOT) { ++ char *ext; ++ ++ ext = ext_mount_lookup(info->mountpoint + 1 /* trim the . */); ++ if (ext) { ++ pr_info("Found %s mapping for %s mountpoint\n", ext, info->mountpoint); ++ info->external = ext; ++ return 1; ++ } + } + + snprintf(devstr, sizeof(devstr), "dev[%d/%d]", kdev_major(info->s_dev), kdev_minor(info->s_dev)); +-- +2.35.1 + diff --git a/0171-zdtm-add-mnt_ext_collision-test.patch b/0171-zdtm-add-mnt_ext_collision-test.patch new file mode 100644 index 0000000..8bf24de --- /dev/null +++ b/0171-zdtm-add-mnt_ext_collision-test.patch @@ -0,0 +1,273 @@ +From cd43fdffbaadd0406a73c02939d07493de014244 Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Wed, 12 Jan 2022 16:00:56 +0300 +Subject: [PATCH 171/245] zdtm: add mnt_ext_collision test + +This test creates two mount namespaces, one "root" with external mount +at /mnt_ext_collision.test/dst and one "nested" with different internal +mount at /mnt_ext_collision.test/dst instead. + +This case is important for nested containers, if we dump a container +with some external mount in /mnt we should not also replace mounts in +/mnt for nested containers with the external one. (One example is docker +containers inside Virtuozzo containers.) + +Without previous patch which restricts external mounts resolution to +only root mntns of container this test fails as internal mount is +replaced by external one after migration. + +Signed-off-by: Pavel Tikhomirov +--- + test/zdtm/static/Makefile | 1 + + test/zdtm/static/mnt_ext_collision.c | 194 ++++++++++++++++++++++++ + test/zdtm/static/mnt_ext_collision.desc | 5 + + test/zdtm/static/mnt_ext_collision.hook | 12 ++ + 4 files changed, 212 insertions(+) + create mode 100644 test/zdtm/static/mnt_ext_collision.c + create mode 100644 test/zdtm/static/mnt_ext_collision.desc + create mode 100755 test/zdtm/static/mnt_ext_collision.hook + +diff --git a/test/zdtm/static/Makefile b/test/zdtm/static/Makefile +index a64c51cd0..565b32400 100644 +--- a/test/zdtm/static/Makefile ++++ b/test/zdtm/static/Makefile +@@ -400,6 +400,7 @@ TST_DIR = \ + mnt_ext_master \ + mnt_ext_dev \ + mnt_ext_root \ ++ mnt_ext_collision \ + mnt_tracefs \ + mntns_deleted \ + unlink_regular00 \ +diff --git a/test/zdtm/static/mnt_ext_collision.c b/test/zdtm/static/mnt_ext_collision.c +new file mode 100644 +index 000000000..324a3484c +--- /dev/null ++++ b/test/zdtm/static/mnt_ext_collision.c +@@ -0,0 +1,194 @@ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "zdtmtst.h" ++#include "lock.h" ++ ++const char *test_doc = "Check external mount mountpoint collide with different mount in nested mntns"; ++const char *test_author = "Pavel Tikhomirov "; ++ ++char *dirname = "mnt_ext_collision.test"; ++TEST_OPTION(dirname, string, "directory name", 1); ++ ++char *source = "zdtm_ext_collision"; ++char *source2 = "zdtm_ext_collision_2"; ++ ++enum { ++ TEST_INIT = 0, ++ TEST_CHILD, ++ TEST_CHECK, ++ TEST_EXIT, ++ EMERGENCY_ABORT, ++}; ++ ++futex_t *futex; ++ ++#define BUF_SIZE 4096 ++ ++static int child(void) ++{ ++ char dst[PATH_MAX], dst_file[PATH_MAX]; ++ int fd; ++ ++ if (unshare(CLONE_NEWNS)) { ++ pr_perror("unshare"); ++ goto err; ++ } ++ ++ /* ++ * Umount external mount copy ++ */ ++ sprintf(dst, "/%s/dst", dirname); ++ if (umount(dst)) { ++ pr_perror("umount"); ++ goto err; ++ } ++ ++ /* ++ * Mount tmpfs in its place ++ */ ++ if (mount(source2, dst, "tmpfs", 0, NULL)) { ++ pr_perror("mount tmpfs"); ++ goto err; ++ } ++ ++ sprintf(dst_file, "/%s/dst/file", dirname); ++ fd = open(dst_file, O_RDWR | O_CREAT | O_EXCL, 0666); ++ if (fd < 0) { ++ pr_perror("open"); ++ goto err; ++ } ++ close(fd); ++ ++ futex_set_and_wake(futex, TEST_CHILD); ++ futex_wait_while_lt(futex, TEST_CHECK); ++ ++ if (access(dst_file, F_OK)) { ++ pr_perror("access"); ++ goto err; ++ } ++ ++ futex_set_and_wake(futex, TEST_EXIT); ++ return 0; ++err: ++ futex_set_and_wake(futex, EMERGENCY_ABORT); ++ return 1; ++} ++ ++int main(int argc, char **argv) ++{ ++ char *root, testdir[PATH_MAX]; ++ char lckd[PATH_MAX], dst[PATH_MAX]; ++ char *tmp = "/tmp/zdtm_ext_collision.tmp"; ++ char *zdtm_newns = getenv("ZDTM_NEWNS"); ++ int pid; ++ ++ root = getenv("ZDTM_ROOT"); ++ if (root == NULL) { ++ pr_perror("root"); ++ return 1; ++ } ++ ++ if (!zdtm_newns) { ++ pr_perror("ZDTM_NEWNS is not set"); ++ return 1; ++ } else if (strcmp(zdtm_newns, "1")) { ++ goto test; ++ } ++ ++ /* Prepare directories in test root */ ++ sprintf(testdir, "%s/%s", root, dirname); ++ mkdir(testdir, 0755); ++ ++ sprintf(lckd, "%s/%s/lckd", root, dirname); ++ mkdir(lckd, 0755); ++ sprintf(dst, "%s/%s/dst", root, dirname); ++ mkdir(dst, 0755); ++ ++ /* Prepare mount in criu root */ ++ mkdir(tmp, 0755); ++ if (mount(source, tmp, "tmpfs", 0, NULL)) { ++ pr_perror("mount tmpfs"); ++ return 1; ++ } ++ if (mount(NULL, tmp, NULL, MS_PRIVATE, NULL)) { ++ pr_perror("make private"); ++ return 1; ++ } ++ ++ /* ++ * Create temporary mntns, next mounts will not show up in criu mntns ++ */ ++ if (unshare(CLONE_NEWNS)) { ++ pr_perror("unshare"); ++ return 1; ++ } ++ ++ /* ++ * Populate external mount to the tests mntns root ++ * (in uns flavour this would become locked) ++ */ ++ if (mount(tmp, lckd, NULL, MS_BIND, NULL)) { ++ pr_perror("bind"); ++ return 1; ++ } ++test: ++ test_init(argc, argv); ++ ++ /* ++ * Hack to create unlocked external mount without pivot_root+bind thing ++ */ ++ sprintf(lckd, "/%s/lckd", dirname); ++ sprintf(dst, "/%s/dst", dirname); ++ if (mount(lckd, dst, NULL, MS_BIND, NULL)) { ++ pr_perror("bind"); ++ return 1; ++ } ++ ++ /* ++ * Setup futex for processes syncronization ++ */ ++ futex = mmap(NULL, sizeof(futex), PROT_WRITE | PROT_READ, MAP_SHARED | MAP_ANONYMOUS, -1, 0); ++ if (futex == MAP_FAILED) { ++ pr_perror("mmap"); ++ return 1; ++ } ++ futex_init(futex); ++ ++ /* ++ * Fork child which would have nested mntns ++ */ ++ pid = fork(); ++ if (pid < 0) { ++ pr_perror("fork"); ++ return 1; ++ } else if (pid == 0) { ++ exit(child()); ++ } ++ ++ futex_wait_while_lt(futex, TEST_CHILD); ++ if (futex_get(futex) == EMERGENCY_ABORT) { ++ pr_err("Fail in child\n"); ++ return 1; ++ } ++ ++ test_daemon(); ++ test_waitsig(); ++ ++ futex_set_and_wake(futex, TEST_CHECK); ++ futex_wait_while_lt(futex, TEST_EXIT); ++ if (futex_get(futex) == EMERGENCY_ABORT) { ++ fail("Fail in child on check stage"); ++ return 1; ++ } ++ ++ waitpid(pid, NULL, 0); ++ pass(); ++ return 0; ++} +diff --git a/test/zdtm/static/mnt_ext_collision.desc b/test/zdtm/static/mnt_ext_collision.desc +new file mode 100644 +index 000000000..9b68a4ae0 +--- /dev/null ++++ b/test/zdtm/static/mnt_ext_collision.desc +@@ -0,0 +1,5 @@ ++{ 'dopts': '--external mnt[/mnt_ext_collision.test/dst]:ZDTM', ++ 'feature': 'mnt_id', ++ 'flavor': 'ns uns', ++ 'flags': 'suid', ++ 'ropts': '--external mnt[ZDTM]:/tmp/zdtm_ext_collision.tmp'} +diff --git a/test/zdtm/static/mnt_ext_collision.hook b/test/zdtm/static/mnt_ext_collision.hook +new file mode 100755 +index 000000000..31c908d67 +--- /dev/null ++++ b/test/zdtm/static/mnt_ext_collision.hook +@@ -0,0 +1,12 @@ ++#!/bin/bash ++ ++[ "$1" == "--clean" ] || exit 0 ++ ++TMP="/tmp/zdtm_ext_collision.tmp" ++echo "Cleanup mnt_ext_collision" ++umount "$TMP" ++rm -rf $TMP ++ ++rm -rf "mnt_ext_collision.test" ++ ++exit 0 +-- +2.35.1 + diff --git a/0172-mount-add-mnt_is_root_bind-helper.patch b/0172-mount-add-mnt_is_root_bind-helper.patch new file mode 100644 index 0000000..3573261 --- /dev/null +++ b/0172-mount-add-mnt_is_root_bind-helper.patch @@ -0,0 +1,119 @@ +From e6b94a2ee627fa4806f14310e3cc66d4ca4c08fe Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Fri, 8 May 2020 14:33:13 +0300 +Subject: [PATCH 172/245] mount: add mnt_is_root_bind helper + +Helper mnt_is_root_bind indicates that mount can be bind-mounted from +the root mount (which in it's turn from opts.root). + +Use it in validate_mounts: we should skip unsupported mount from fsroot check +if we know it will be bindmounted from root mount, is_ns_root check was wrong. + +Also fix root mount check in dump_one_fs, root mounts in non root mntns should +be dumped normally if they are not bind-mounts of root mount. + +Cherry-picked from Virtuozzo criu: +https://src.openvz.org/projects/OVZ/repos/criu/commits/25d078971 + +Changes: switch to mnt_bind_pick helper, export to mount.h, also add +mnt_get_root_bind helper for future use in mount-v2, remove excess root +yard hunk. + +Signed-off-by: Pavel Tikhomirov +--- + criu/include/mount.h | 3 +++ + criu/mount.c | 37 +++++++++++++++++++++++++++---------- + 2 files changed, 30 insertions(+), 10 deletions(-) + +diff --git a/criu/include/mount.h b/criu/include/mount.h +index 7dffe5b2c..1ceb394b6 100644 +--- a/criu/include/mount.h ++++ b/criu/include/mount.h +@@ -176,6 +176,9 @@ extern bool mnt_is_overmounted(struct mount_info *mi); + extern struct mount_info *mnt_get_external_bind(struct mount_info *mi); + extern bool mnt_is_external_bind(struct mount_info *mi); + extern bool has_mounted_external_bind(struct mount_info *mi); ++extern bool rst_mnt_is_root(struct mount_info *mi); ++extern struct mount_info *mnt_get_root_bind(struct mount_info *mi); ++extern bool mnt_is_root_bind(struct mount_info *mi); + + extern struct mount_info *mnt_bind_pick(struct mount_info *mi, + bool (*pick)(struct mount_info *mi, struct mount_info *bind)); +diff --git a/criu/mount.c b/criu/mount.c +index ff9b9b591..5591bb67c 100644 +--- a/criu/mount.c ++++ b/criu/mount.c +@@ -609,6 +609,29 @@ bool has_mounted_external_bind(struct mount_info *mi) + return mnt_bind_pick(mi, __has_mounted_external_bind); + } + ++bool rst_mnt_is_root(struct mount_info *mi) ++{ ++ return (mi->is_ns_root && mi->nsid->id == root_item->ids->mnt_ns_id); ++} ++ ++static bool __mnt_is_root_bind(struct mount_info *mi, struct mount_info *bind) ++{ ++ if (rst_mnt_is_root(bind) && is_sub_path(mi->root, bind->root)) ++ return true; ++ ++ return false; ++} ++ ++struct mount_info *mnt_get_root_bind(struct mount_info *mi) ++{ ++ return mnt_bind_pick(mi, __mnt_is_root_bind); ++} ++ ++bool mnt_is_root_bind(struct mount_info *mi) ++{ ++ return mnt_get_root_bind(mi); ++} ++ + /* + * Having two children with same mountpoint is unsupported. That can happen in + * case of mount propagation inside of shared mounts, in that case it is hard +@@ -642,16 +665,15 @@ static int validate_mounts(struct mount_info *info, bool for_dump) + struct mount_info *m, *t; + + for (m = info; m; m = m->next) { +- if (m->parent == NULL || m->is_ns_root) +- /* root mount can be any */ +- continue; +- + if (validate_children_collision(m)) + return -1; + + if (mnt_is_external_bind(m)) + continue; + ++ if (mnt_is_root_bind(m)) ++ continue; ++ + /* + * Mountpoint can point to / of an FS. In that case this FS + * should be of some known type so that we can just mount one. +@@ -1662,7 +1684,7 @@ static int dump_one_fs(struct mount_info *mi) + struct mount_info *t; + bool first = true; + +- if (mi->is_ns_root || mi->need_plugin || mnt_is_external_bind(mi) || !mi->fstype->dump) ++ if (mnt_is_root_bind(mi) || mi->need_plugin || mnt_is_external_bind(mi) || !mi->fstype->dump) + return 0; + + /* mnt_bind is a cycled list, so list_for_each can't be used here. */ +@@ -2446,11 +2468,6 @@ err: + return exit_code; + } + +-static bool rst_mnt_is_root(struct mount_info *m) +-{ +- return (m->is_ns_root && m->nsid->id == root_item->ids->mnt_ns_id); +-} +- + static bool can_mount_now(struct mount_info *mi) + { + struct mount_info *ext; +-- +2.35.1 + diff --git a/0173-mount-allow-nested-mount-namespaces-with-different-r.patch b/0173-mount-allow-nested-mount-namespaces-with-different-r.patch new file mode 100644 index 0000000..3b38454 --- /dev/null +++ b/0173-mount-allow-nested-mount-namespaces-with-different-r.patch @@ -0,0 +1,50 @@ +From 009877169d13f9d6437fc2d11113bccdbad6b15f Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Mon, 27 Apr 2020 18:24:54 +0300 +Subject: [PATCH 173/245] mount: allow nested mount namespaces with different + roots + +Only root in root-mntns is special (see rst_mnt_is_root) all other +mounts are mounted regulary there is no difference between ns root and +any other mount or bind-mount. + +Cherry-picked from Virtuozzo criu: +https://src.openvz.org/projects/OVZ/repos/criu/commits/f41e41dd5 + +Signed-off-by: Pavel Tikhomirov +--- + criu/mount.c | 11 ----------- + 1 file changed, 11 deletions(-) + +diff --git a/criu/mount.c b/criu/mount.c +index 5591bb67c..97a903934 100644 +--- a/criu/mount.c ++++ b/criu/mount.c +@@ -3362,7 +3362,6 @@ void fini_restore_mntns(void) + + static int merge_mount_trees(struct mount_info *root_yard) + { +- struct mount_info *first = NULL; + struct ns_id *nsid; + + /* Merge mount trees together under root_yard */ +@@ -3374,16 +3373,6 @@ static int merge_mount_trees(struct mount_info *root_yard) + + root = nsid->mnt.mntinfo_tree; + +- if (!first) +- first = root; +- else if (!mounts_sb_equal(root, first) || strcmp(root->root, first->root)) { +- pr_err("Nested mount namespaces with different " +- "roots %d (@%s %s) %d (@%s %s) are not supported yet\n", +- root->mnt_id, root->mountpoint, root->root, first->mnt_id, first->mountpoint, +- first->root); +- return -1; +- } +- + pr_debug("Mountpoint %d (@%s) moved to the root yard\n", root->mnt_id, root->mountpoint); + root->parent = root_yard; + list_add(&root->siblings, &root_yard->children); +-- +2.35.1 + diff --git a/0174-zdtm-add-mntns_pivot_root-test.patch b/0174-zdtm-add-mntns_pivot_root-test.patch new file mode 100644 index 0000000..c7ebbc5 --- /dev/null +++ b/0174-zdtm-add-mntns_pivot_root-test.patch @@ -0,0 +1,198 @@ +From 4a1fb7b6d7093f4dd9ed4f544bac69241b641208 Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Wed, 12 Jan 2022 19:30:07 +0300 +Subject: [PATCH 174/245] zdtm: add mntns_pivot_root test + +This creates nested mntns and does pivot_root to tmpfs mount, so that +roots of original test mntns and in nested mntns are different. + +Before allowing nested mntnses with different roots in previous patch +this would fail. + +Signed-off-by: Pavel Tikhomirov +--- + test/zdtm/static/Makefile | 1 + + test/zdtm/static/mntns_pivot_root.c | 150 +++++++++++++++++++++++++ + test/zdtm/static/mntns_pivot_root.desc | 1 + + 3 files changed, 152 insertions(+) + create mode 100644 test/zdtm/static/mntns_pivot_root.c + create mode 100644 test/zdtm/static/mntns_pivot_root.desc + +diff --git a/test/zdtm/static/Makefile b/test/zdtm/static/Makefile +index 565b32400..a22a0540f 100644 +--- a/test/zdtm/static/Makefile ++++ b/test/zdtm/static/Makefile +@@ -401,6 +401,7 @@ TST_DIR = \ + mnt_ext_dev \ + mnt_ext_root \ + mnt_ext_collision \ ++ mntns_pivot_root \ + mnt_tracefs \ + mntns_deleted \ + unlink_regular00 \ +diff --git a/test/zdtm/static/mntns_pivot_root.c b/test/zdtm/static/mntns_pivot_root.c +new file mode 100644 +index 000000000..987b0da3b +--- /dev/null ++++ b/test/zdtm/static/mntns_pivot_root.c +@@ -0,0 +1,150 @@ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "zdtmtst.h" ++#include "lock.h" ++ ++const char *test_doc = "Check nested mntns with different root"; ++const char *test_author = "Pavel Tikhomirov "; ++ ++char *dirname = "mntns_pivot_root.test"; ++TEST_OPTION(dirname, string, "directory name", 1); ++ ++char *source = "mntns_pivot_root"; ++ ++enum { ++ TEST_INIT = 0, ++ TEST_CHILD, ++ TEST_CHECK, ++ TEST_EXIT, ++ EMERGENCY_ABORT, ++}; ++ ++futex_t *futex; ++ ++static int sys_pivot_root(const char *new_root, const char *put_old) ++{ ++ return syscall(SYS_pivot_root, new_root, put_old); ++} ++ ++#define BUF_SIZE 4096 ++ ++static int child(void) ++{ ++ char *put_root = "put_root"; ++ char *testfile = "testfile"; ++ int fd; ++ ++ if (unshare(CLONE_NEWNS)) { ++ pr_perror("unshare"); ++ goto err; ++ } ++ /* ++ * Setup new root ++ */ ++ mkdir(dirname, 0755); ++ ++ if (mount(source, dirname, "tmpfs", 0, NULL)) { ++ pr_perror("mount tmpfs"); ++ goto err; ++ } ++ ++ if (mount(NULL, dirname, NULL, MS_PRIVATE, NULL)) { ++ pr_perror("make private"); ++ goto err; ++ } ++ ++ if (chdir(dirname)) { ++ pr_perror("chdir"); ++ goto err; ++ } ++ ++ mkdir(put_root, 0755); ++ ++ if (sys_pivot_root(".", put_root)) { ++ pr_perror("pivot_root"); ++ goto err; ++ } ++ ++ if (umount2(put_root, MNT_DETACH)) { ++ pr_perror("umount2"); ++ goto err; ++ } ++ ++ fd = open(testfile, O_RDWR | O_CREAT | O_EXCL, 0666); ++ if (fd < 0) { ++ pr_perror("open"); ++ goto err; ++ } ++ close(fd); ++ ++ futex_set_and_wake(futex, TEST_CHILD); ++ futex_wait_while_lt(futex, TEST_CHECK); ++ ++ if (access(testfile, F_OK)) { ++ pr_perror("access"); ++ goto err; ++ } ++ ++ futex_set_and_wake(futex, TEST_EXIT); ++ return 0; ++err: ++ futex_set_and_wake(futex, EMERGENCY_ABORT); ++ return 1; ++} ++ ++int main(int argc, char **argv) ++{ ++ int pid; ++ ++ test_init(argc, argv); ++ ++ /* ++ * Setup futex for processes syncronization ++ */ ++ futex = mmap(NULL, sizeof(futex), PROT_WRITE | PROT_READ, MAP_SHARED | MAP_ANONYMOUS, -1, 0); ++ if (futex == MAP_FAILED) { ++ pr_perror("mmap"); ++ return 1; ++ } ++ futex_init(futex); ++ ++ /* ++ * Fork child which would have nested mntns ++ */ ++ pid = fork(); ++ if (pid < 0) { ++ pr_perror("fork"); ++ return 1; ++ } else if (pid == 0) { ++ exit(child()); ++ } ++ ++ futex_wait_while_lt(futex, TEST_CHILD); ++ if (futex_get(futex) == EMERGENCY_ABORT) { ++ pr_err("Fail in child\n"); ++ return 1; ++ } ++ ++ test_daemon(); ++ test_waitsig(); ++ ++ futex_set_and_wake(futex, TEST_CHECK); ++ futex_wait_while_lt(futex, TEST_EXIT); ++ if (futex_get(futex) == EMERGENCY_ABORT) { ++ fail("Fail in child on check stage"); ++ return 1; ++ } ++ ++ waitpid(pid, NULL, 0); ++ pass(); ++ return 0; ++} +diff --git a/test/zdtm/static/mntns_pivot_root.desc b/test/zdtm/static/mntns_pivot_root.desc +new file mode 100644 +index 000000000..7657ba45c +--- /dev/null ++++ b/test/zdtm/static/mntns_pivot_root.desc +@@ -0,0 +1 @@ ++{'flavor': 'ns uns', 'flags': 'suid'} +-- +2.35.1 + diff --git a/0175-mount-apply-superblock-flags-to-nested-ns-roots.patch b/0175-mount-apply-superblock-flags-to-nested-ns-roots.patch new file mode 100644 index 0000000..7d514ec --- /dev/null +++ b/0175-mount-apply-superblock-flags-to-nested-ns-roots.patch @@ -0,0 +1,35 @@ +From 68aa0fc0b531ecdf954e79af6f04303c167b2d59 Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Wed, 27 May 2020 13:43:49 +0300 +Subject: [PATCH 175/245] mount: apply superblock flags to nested ns roots + +Before this change we didn't apply sb-flags if we mount the root mount of +non-root mntns. There is no point in it, if we got to do_new_mount this root +mount is not external bind, so we won't change sb-flags on host if we change it +for this mount. So we just loose sb-flags on some regular container mount for +no reason. Fix it. + +Cherry-picked from Virtuozzo criu: +https://src.openvz.org/projects/OVZ/repos/criu/commits/e7ffe4c60 + +Signed-off-by: Pavel Tikhomirov +--- + criu/mount.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/criu/mount.c b/criu/mount.c +index 97a903934..dc846a68e 100644 +--- a/criu/mount.c ++++ b/criu/mount.c +@@ -2213,7 +2213,7 @@ static int do_new_mount(struct mount_info *mi) + goto out; + } + +- if (!mi->is_ns_root && remount_ro) { ++ if (remount_ro) { + int fd; + + fd = open(mi->mountpoint, O_PATH); +-- +2.35.1 + diff --git a/0176-zdtm-add-mntns_pivot_root_ro-test.patch b/0176-zdtm-add-mntns_pivot_root_ro-test.patch new file mode 100644 index 0000000..d165f23 --- /dev/null +++ b/0176-zdtm-add-mntns_pivot_root_ro-test.patch @@ -0,0 +1,113 @@ +From b79f69573471a5bcb0ea8e74d5b1eae5dd5e3d24 Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Thu, 13 Jan 2022 10:46:44 +0300 +Subject: [PATCH 176/245] zdtm: add mntns_pivot_root_ro test + +This checks that superblock readonly flag is applied to nested mntns +roots on restore. + +Signed-off-by: Pavel Tikhomirov +--- + test/zdtm/static/Makefile | 2 ++ + test/zdtm/static/mntns_pivot_root.c | 31 +++++++++++++++++++++++ + test/zdtm/static/mntns_pivot_root_ro.c | 1 + + test/zdtm/static/mntns_pivot_root_ro.desc | 1 + + 4 files changed, 35 insertions(+) + create mode 120000 test/zdtm/static/mntns_pivot_root_ro.c + create mode 120000 test/zdtm/static/mntns_pivot_root_ro.desc + +diff --git a/test/zdtm/static/Makefile b/test/zdtm/static/Makefile +index a22a0540f..bf7462756 100644 +--- a/test/zdtm/static/Makefile ++++ b/test/zdtm/static/Makefile +@@ -402,6 +402,7 @@ TST_DIR = \ + mnt_ext_root \ + mnt_ext_collision \ + mntns_pivot_root \ ++ mntns_pivot_root_ro \ + mnt_tracefs \ + mntns_deleted \ + unlink_regular00 \ +@@ -580,6 +581,7 @@ socket-tcp-closed-last-ack: CFLAGS += -D ZDTM_TCP_LAST_ACK + socket-tcp-skip-in-flight: CFLAGS += -D ZDTM_IPV4V6 + tun_ns: CFLAGS += -DTUN_NS + mnt_ext_manual: CFLAGS += -D ZDTM_EXTMAP_MANUAL ++mntns_pivot_root_ro: CFLAGS += -DMNTNS_PIVOT_ROOT_RO + sigpending: LDLIBS += -lrt + vdso01: LDLIBS += -lrt + scm01: CFLAGS += -DKEEP_SENT_FD +diff --git a/test/zdtm/static/mntns_pivot_root.c b/test/zdtm/static/mntns_pivot_root.c +index 987b0da3b..9826efde4 100644 +--- a/test/zdtm/static/mntns_pivot_root.c ++++ b/test/zdtm/static/mntns_pivot_root.c +@@ -8,6 +8,7 @@ + #include + #include + #include ++#include + + #include "zdtmtst.h" + #include "lock.h" +@@ -86,6 +87,21 @@ static int child(void) + } + close(fd); + ++#ifdef MNTNS_PIVOT_ROOT_RO ++ /* ++ * Hack to make cr_pivot_root work on readonly mntns root, ++ * normally nested containers have /tmp directory ++ */ ++ mkdir("tmp", 0755); ++ /* ++ * Make superblock readonly ++ */ ++ if (mount(NULL, "/", NULL, MS_REMOUNT | MS_RDONLY, NULL)) { ++ pr_perror("remount_ro"); ++ goto err; ++ } ++#endif ++ + futex_set_and_wake(futex, TEST_CHILD); + futex_wait_while_lt(futex, TEST_CHECK); + +@@ -94,6 +110,21 @@ static int child(void) + goto err; + } + ++#ifdef MNTNS_PIVOT_ROOT_RO ++ /* ++ * Check superblock readonly ++ */ ++ fd = open(testfile, O_WRONLY); ++ if (fd >= 0) { ++ pr_err("Open on readonly superblock should fail\n"); ++ close(fd); ++ goto err; ++ } else if (errno != EROFS) { ++ pr_perror("open write"); ++ goto err; ++ } ++#endif ++ + futex_set_and_wake(futex, TEST_EXIT); + return 0; + err: +diff --git a/test/zdtm/static/mntns_pivot_root_ro.c b/test/zdtm/static/mntns_pivot_root_ro.c +new file mode 120000 +index 000000000..d352a6369 +--- /dev/null ++++ b/test/zdtm/static/mntns_pivot_root_ro.c +@@ -0,0 +1 @@ ++mntns_pivot_root.c +\ No newline at end of file +diff --git a/test/zdtm/static/mntns_pivot_root_ro.desc b/test/zdtm/static/mntns_pivot_root_ro.desc +new file mode 120000 +index 000000000..8708421ed +--- /dev/null ++++ b/test/zdtm/static/mntns_pivot_root_ro.desc +@@ -0,0 +1 @@ ++mntns_pivot_root.desc +\ No newline at end of file +-- +2.35.1 + diff --git a/0177-mount-restore-create-auxiliary-binfmt_misc-mount-in-.patch b/0177-mount-restore-create-auxiliary-binfmt_misc-mount-in-.patch new file mode 100644 index 0000000..6dc0d17 --- /dev/null +++ b/0177-mount-restore-create-auxiliary-binfmt_misc-mount-in-.patch @@ -0,0 +1,176 @@ +From e1a4ba44de4eb4bd0818236323afee1264d220da Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Tue, 23 Jul 2019 18:33:59 +0300 +Subject: [PATCH 177/245] mount/restore: create auxiliary binfmt_misc mount in + the root yard + +Put our auxiliary binfmt_misc mount in "/binfmt_misc" instead +of "//proc/sys/fs/binfmt_misc". Thus we can restore +binfmt_misc without altering actual mount tree, which looks much more +safe. + +For that we need to remove "fake top mount_info" handling from +add_cr_time_mount as now we intentionally add binfmt_misc mount as a +child of ("fake") root yard. On dump this does not change anything. +Also we need to create mountpoint for binfmt_misc in root yard. + +As now mount is out of restored mount tree we don't need to umount it, +so remove corresponding CRTIME_MNT_ID umount hunk in do_new_mount. + +Note: to make binfmt_misc c/r work criu should be compiled with +CONFIG_BINFMT_MISC_VIRTUALIZED and binfmt_misc should be actually +virtualized and this is only done in Virtuozzo kernel per ve. + +Cherry-picked from Virtuozzo criu: +https://src.openvz.org/projects/OVZ/repos/criu/commits/2eb535843 +Cherry-picked from Virtuozzo criu: +https://src.openvz.org/projects/OVZ/repos/criu/commits/d79c7f441 +Cherry-picked from Virtuozzo criu: +https://src.openvz.org/projects/OVZ/repos/criu/commits/34002bef4 +Cherry-picked one hunk from Virtuozzo criu: +https://src.openvz.org/projects/OVZ/repos/criu/commits/45bf6f0ee + +Changes: merge all fixups together to one consistent patch. + +Signed-off-by: Pavel Tikhomirov +--- + criu/mount.c | 52 ++++++++++++++++++---------------------------------- + 1 file changed, 18 insertions(+), 34 deletions(-) + +diff --git a/criu/mount.c b/criu/mount.c +index dc846a68e..72b17bc1b 100644 +--- a/criu/mount.c ++++ b/criu/mount.c +@@ -1568,29 +1568,16 @@ err: + return -1; + } + +-static __maybe_unused int add_cr_time_mount(struct mount_info *root, char *fsname, const char *path, unsigned int s_dev, +- bool rst) ++static __maybe_unused struct mount_info *add_cr_time_mount(struct mount_info *root, char *fsname, const char *path, ++ unsigned int s_dev, bool rst) + { + struct mount_info *mi, *t, *parent; + bool add_slash = false; + int len; + +- if (!root->nsid) { +- /* On restore we have fake top mount_info. Find real NS_ROOT */ +- list_for_each_entry(t, &root->children, siblings) +- if (t->nsid->type == NS_ROOT) { +- root = t; +- break; +- } +- if (!root->nsid) { +- pr_err("Can't find NS_ROOT\n"); +- return -1; +- } +- } +- + mi = mnt_entry_alloc(rst); + if (!mi) +- return -1; ++ return NULL; + + len = strlen(root->mountpoint); + /* It may be "./" or "./path/to/dir" */ +@@ -1637,11 +1624,11 @@ static __maybe_unused int add_cr_time_mount(struct mount_info *root, char *fsnam + mi->parent_mnt_id = parent->mnt_id; + list_add(&mi->siblings, &parent->children); + pr_info("Add cr-time mountpoint %s with parent %s(%u)\n", mi->mountpoint, parent->mountpoint, parent->mnt_id); +- return 0; ++ return mi; + + err: + mnt_entry_free(mi); +- return -1; ++ return NULL; + } + + /* Returns 1 in case of success, -errno in case of mount fail, and 0 on other errors */ +@@ -2204,15 +2191,6 @@ static int do_new_mount(struct mount_info *mi) + if (tp->restore && tp->restore(mi)) + return -1; + +- if (mi->mnt_id == CRTIME_MNT_ID) { +- /* C-r time mountpoint, umount it */ +- if (umount(mi->mountpoint) < 0) { +- pr_perror("Can't umount %s", mi->mountpoint); +- return -1; +- } +- goto out; +- } +- + if (remount_ro) { + int fd; + +@@ -2242,7 +2220,7 @@ static int do_new_mount(struct mount_info *mi) + BUG_ON(mi->master_id); + if (restore_shared_options(mi, !mi->shared_id, mi->shared_id, 0)) + return -1; +-out: ++ + mi->mounted = true; + + return 0; +@@ -3384,7 +3362,7 @@ static int merge_mount_trees(struct mount_info *root_yard) + /* + * All nested mount namespaces are restore as sub-trees of the root namespace. + */ +-static int populate_roots_yard(void) ++static int populate_roots_yard(struct mount_info *cr_time) + { + struct mnt_remap_entry *r; + char path[PATH_MAX]; +@@ -3415,11 +3393,17 @@ static int populate_roots_yard(void) + } + } + ++ if (cr_time && mkdirpat(AT_FDCWD, cr_time->mountpoint, 0755)) { ++ pr_perror("Unable to create %s", cr_time->mountpoint); ++ return -1; ++ } ++ + return 0; + } + + static int populate_mnt_ns(void) + { ++ struct mount_info *cr_time = NULL; + int ret; + + root_yard_mp = mnt_entry_alloc(true); +@@ -3436,8 +3420,8 @@ static int populate_mnt_ns(void) + #ifdef CONFIG_BINFMT_MISC_VIRTUALIZED + if (!opts.has_binfmt_misc && !list_empty(&binfmt_misc_list)) { + /* Add to mount tree. Generic code will mount it later */ +- ret = add_cr_time_mount(root_yard_mp, "binfmt_misc", BINFMT_MISC_HOME, 0, true); +- if (ret) ++ cr_time = add_cr_time_mount(root_yard_mp, "binfmt_misc", "binfmt_misc", 0, true); ++ if (!cr_time) + return -1; + } + #endif +@@ -3453,7 +3437,7 @@ static int populate_mnt_ns(void) + if (find_remap_mounts(root_yard_mp)) + return -1; + +- if (populate_roots_yard()) ++ if (populate_roots_yard(cr_time)) + return -1; + + if (mount_clean_path()) +@@ -3887,8 +3871,8 @@ int collect_mnt_namespaces(bool for_dump) + } else if (ret == 0) { + ret = -1; + goto err; +- } else if (ret > 0 && add_cr_time_mount(ns->mnt.mntinfo_tree, "binfmt_misc", BINFMT_MISC_HOME, +- s_dev, false) < 0) { ++ } else if (ret > 0 && !add_cr_time_mount(ns->mnt.mntinfo_tree, "binfmt_misc", BINFMT_MISC_HOME, ++ s_dev, false)) { + ret = -1; + goto err; + } +-- +2.35.1 + diff --git a/0178-mount-restore-leave-ns_mountpoint-NULL-for-aux-binfm.patch b/0178-mount-restore-leave-ns_mountpoint-NULL-for-aux-binfm.patch new file mode 100644 index 0000000..87b51dc --- /dev/null +++ b/0178-mount-restore-leave-ns_mountpoint-NULL-for-aux-binfm.patch @@ -0,0 +1,33 @@ +From db85d61119ce01ca7f1fd20b955517ca7afb647d Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Thu, 13 Jan 2022 17:45:46 +0300 +Subject: [PATCH 178/245] mount/restore: leave ns_mountpoint NULL for aux + binfmt_misc mount + +On dump, yes, mountpoint and ns_mountpoint are the same, but on restore +they don't and puting something like "/binfmt_misc" to +ns_mountpoint is wrong, let's leave ns_mountpoint NULL, this mount +should not be compared by ns_mountpoint with other mounts anyway. + +Signed-off-by: Pavel Tikhomirov +--- + criu/mount.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/criu/mount.c b/criu/mount.c +index 72b17bc1b..3b57622b6 100644 +--- a/criu/mount.c ++++ b/criu/mount.c +@@ -1589,7 +1589,8 @@ static __maybe_unused struct mount_info *add_cr_time_mount(struct mount_info *ro + mi->mountpoint = xmalloc(len + strlen(path) + 1); + if (!mi->mountpoint) + goto err; +- mi->ns_mountpoint = mi->mountpoint; ++ if (!rst) ++ mi->ns_mountpoint = mi->mountpoint; + if (!add_slash) + sprintf(mi->mountpoint, "%s%s", root->mountpoint, path); + else +-- +2.35.1 + diff --git a/0179-mount-replace-CRTIME_MNT_ID-with-HELPER_MNT_ID.patch b/0179-mount-replace-CRTIME_MNT_ID-with-HELPER_MNT_ID.patch new file mode 100644 index 0000000..1ed88b1 --- /dev/null +++ b/0179-mount-replace-CRTIME_MNT_ID-with-HELPER_MNT_ID.patch @@ -0,0 +1,77 @@ +From 583409d5cde3e2bd26f932ef1164e18725dd0a8a Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Thu, 7 May 2020 16:13:02 +0300 +Subject: [PATCH 179/245] mount: replace CRTIME_MNT_ID with HELPER_MNT_ID + +Root yard mount also has mnt_id == 0 so it will look better with a new +name. Let's explicitly initialize root yard mnt_id to HELPER_MNT_ID +for the sake of code readability. + +Also in near future we might want to create additional mount helpers to support +mounts in CT with no fsroot mounted. + +Cherry-picked from Virtuozzo criu: +https://src.openvz.org/projects/OVZ/repos/criu/commits/45bf6f0ee + +Changes: split umount hunk to previous patch, set HELPER_MNT_ID for root +yard. + +Signed-off-by: Pavel Tikhomirov +--- + criu/mount.c | 12 +++++++----- + 1 file changed, 7 insertions(+), 5 deletions(-) + +diff --git a/criu/mount.c b/criu/mount.c +index 3b57622b6..1bdd69478 100644 +--- a/criu/mount.c ++++ b/criu/mount.c +@@ -37,7 +37,8 @@ + #define LOG_PREFIX "mnt: " + + #define BINFMT_MISC_HOME "proc/sys/fs/binfmt_misc" +-#define CRTIME_MNT_ID 0 ++ ++#define HELPER_MNT_ID 0 + + #define CONTEXT_OPT "context=" + +@@ -1595,7 +1596,7 @@ static __maybe_unused struct mount_info *add_cr_time_mount(struct mount_info *ro + sprintf(mi->mountpoint, "%s%s", root->mountpoint, path); + else + sprintf(mi->mountpoint, "%s/%s", root->mountpoint, path); +- mi->mnt_id = CRTIME_MNT_ID; ++ mi->mnt_id = HELPER_MNT_ID; + mi->flags = mi->sb_flags = 0; + mi->root = xstrdup("/"); + mi->fsname = xstrdup(fsname); +@@ -1718,8 +1719,8 @@ static int dump_one_mountpoint(struct mount_info *pm, struct cr_img *img) + pm->fstype->check_bindmount(pm)) + return -1; + +- if (pm->mnt_id == CRTIME_MNT_ID) { +- pr_info("Skip dumping cr-time mountpoint: %s\n", pm->mountpoint); ++ if (pm->mnt_id == HELPER_MNT_ID) { ++ pr_info("Skip dumping helper mountpoint: %s\n", pm->mountpoint); + return 0; + } + +@@ -3414,6 +3415,7 @@ static int populate_mnt_ns(void) + root_yard_mp->mountpoint = mnt_roots; + root_yard_mp->mounted = true; + root_yard_mp->mnt_bind_is_populated = true; ++ root_yard_mp->mnt_id = HELPER_MNT_ID; + + if (merge_mount_trees(root_yard_mp)) + return -1; +@@ -3931,7 +3933,7 @@ void clean_cr_time_mounts(void) + for (mi = mntinfo; mi; mi = mi->next) { + int cwd_fd; + +- if (mi->mnt_id != CRTIME_MNT_ID) ++ if (mi->mnt_id != HELPER_MNT_ID) + continue; + ret = switch_mnt_ns(mi->nsid->ns_pid, &ns_old, &cwd_fd); + if (ret) { +-- +2.35.1 + diff --git a/0180-mount-add-can_receive_master_from_root-helper.patch b/0180-mount-add-can_receive_master_from_root-helper.patch new file mode 100644 index 0000000..c9b94d8 --- /dev/null +++ b/0180-mount-add-can_receive_master_from_root-helper.patch @@ -0,0 +1,62 @@ +From 4ca0014e28625bf24cdd646c3ddf11254b246d5a Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Thu, 30 Dec 2021 15:24:30 +0300 +Subject: [PATCH 180/245] mount: add can_receive_master_from_root helper + +If mount has external master_id it can inherit it as a bind of external +mount, but also it can inherit it as a bind of container root mount, so +let's add similar condition to allow such mounts. + +Note: need_master is false for binds of root mount which can inherit +master_id from root mounts yet, this would change in next patch. + +Signed-off-by: Pavel Tikhomirov +--- + criu/mount.c | 23 ++++++++++++++++++++--- + 1 file changed, 20 insertions(+), 3 deletions(-) + +diff --git a/criu/mount.c b/criu/mount.c +index 1bdd69478..03d0e6da1 100644 +--- a/criu/mount.c ++++ b/criu/mount.c +@@ -633,6 +633,19 @@ bool mnt_is_root_bind(struct mount_info *mi) + return mnt_get_root_bind(mi); + } + ++static bool __can_receive_master_from_root(struct mount_info *mi, struct mount_info *bind) ++{ ++ if (rst_mnt_is_root(bind) && bind->master_id == mi->master_id && is_sub_path(mi->root, bind->root)) ++ return true; ++ ++ return false; ++} ++ ++static struct mount_info *can_receive_master_from_root(struct mount_info *mi) ++{ ++ return mnt_bind_pick(mi, __can_receive_master_from_root); ++} ++ + /* + * Having two children with same mountpoint is unsupported. That can happen in + * case of mount propagation inside of shared mounts, in that case it is hard +@@ -1043,10 +1056,14 @@ static int resolve_shared_mounts(struct mount_info *info, int root_master_id) + } + + /* +- * If we haven't already determined this mount is external, +- * or bind of external, then we don't know where it came from. ++ * External master detected + */ +- if (need_master && m->parent && !can_receive_master_from_external(m)) { ++ if (need_master) { ++ if (can_receive_master_from_external(m)) ++ continue; ++ if (can_receive_master_from_root(m)) ++ continue; ++ + pr_err("Mount %d %s (master_id: %d shared_id: %d) " + "has unreachable sharing. Try --enable-external-masters.\n", + m->mnt_id, m->mountpoint, m->master_id, m->shared_id); +-- +2.35.1 + diff --git a/0181-mount-put-external-slavery-mounts-to-separate-mnt_ex.patch b/0181-mount-put-external-slavery-mounts-to-separate-mnt_ex.patch new file mode 100644 index 0000000..295cc85 --- /dev/null +++ b/0181-mount-put-external-slavery-mounts-to-separate-mnt_ex.patch @@ -0,0 +1,77 @@ +From d64abf2fd7f87b87a002060cfb48366d8a5acf42 Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Thu, 20 Feb 2020 10:50:42 +0300 +Subject: [PATCH 181/245] mount: put external slavery mounts to separate + mnt_ext_slave list + +We need to put mounts which need to inherit master_id from external +mounts or from root mount into separate list, so that we can set ->bind +on them right in propagate_siblings. + +Cherry-picked from Virtuozzo criu: +https://src.openvz.org/projects/OVZ/repos/criu/commits/ea592cf6e + +Signed-off-by: Pavel Tikhomirov +--- + criu/include/mount.h | 1 + + criu/mount.c | 17 ++++++++++++++--- + 2 files changed, 15 insertions(+), 3 deletions(-) + +diff --git a/criu/include/mount.h b/criu/include/mount.h +index 1ceb394b6..071c0246e 100644 +--- a/criu/include/mount.h ++++ b/criu/include/mount.h +@@ -77,6 +77,7 @@ struct mount_info { + struct list_head mnt_share; /* circular list of shared mounts */ + struct list_head mnt_slave_list; /* list of slave mounts */ + struct list_head mnt_slave; /* slave list entry */ ++ struct list_head mnt_ext_slave; /* external slave list entry */ + struct mount_info *mnt_master; /* slave is on master->mnt_slave_list */ + struct list_head mnt_propagate; /* circular list of mounts which propagate from each other */ + struct list_head mnt_notprop; /* temporary list used in can_mount_now */ +diff --git a/criu/mount.c b/criu/mount.c +index 03d0e6da1..22c062e36 100644 +--- a/criu/mount.c ++++ b/criu/mount.c +@@ -1059,10 +1059,12 @@ static int resolve_shared_mounts(struct mount_info *info, int root_master_id) + * External master detected + */ + if (need_master) { +- if (can_receive_master_from_external(m)) +- continue; +- if (can_receive_master_from_root(m)) ++ if ((t = can_receive_master_from_external(m)) || (t = can_receive_master_from_root(m))) { ++ pr_debug("Detected external slavery for %d via %d\n", m->mnt_id, t->mnt_id); ++ if (m != t) ++ list_add(&m->mnt_ext_slave, &t->mnt_ext_slave); + continue; ++ } + + pr_err("Mount %d %s (master_id: %d shared_id: %d) " + "has unreachable sharing. Try --enable-external-masters.\n", +@@ -2056,6 +2058,14 @@ static int propagate_siblings(struct mount_info *mi) + t->s_dev_rt = mi->s_dev_rt; + } + ++ list_for_each_entry(t, &mi->mnt_ext_slave, mnt_ext_slave) { ++ if (t->mounted || t->bind) ++ continue; ++ pr_debug("\t\tBind ext-slave %s(%d)\n", t->ns_mountpoint, t->mnt_id); ++ t->bind = mi; ++ t->s_dev_rt = mi->s_dev_rt; ++ } ++ + return 0; + } + +@@ -2924,6 +2934,7 @@ struct mount_info *mnt_entry_alloc(bool rst) + INIT_LIST_HEAD(&new->children); + INIT_LIST_HEAD(&new->siblings); + INIT_LIST_HEAD(&new->mnt_slave_list); ++ INIT_LIST_HEAD(&new->mnt_ext_slave); + INIT_LIST_HEAD(&new->mnt_share); + INIT_LIST_HEAD(&new->mnt_bind); + INIT_LIST_HEAD(&new->mnt_propagate); +-- +2.35.1 + diff --git a/0182-mount-do-not-override-master_id-to-1-for-root-binds.patch b/0182-mount-do-not-override-master_id-to-1-for-root-binds.patch new file mode 100644 index 0000000..7e83dd6 --- /dev/null +++ b/0182-mount-do-not-override-master_id-to-1-for-root-binds.patch @@ -0,0 +1,100 @@ +From c1614365dd48ff9bde55f452e1bbcd75f59394d5 Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Fri, 14 Jan 2022 14:33:30 +0300 +Subject: [PATCH 182/245] mount: do not override master_id to -1 for root binds + +There is no point to lose this information, having -1 everywhere in +mount images instead of acutall master id can be confusing. + +Note that now need_master is true for bindmounts of root mounts with +same master_id as root mount, so now they are handled with a common +code, we've added can_receive_master_from_root check specially to handle +this case right. Also note that in propagate_mount we no more set ->bind +for this case, this is handled by mnt_ext_slave list related code. + +Cherry-picked from Virtuozzo criu: +https://src.openvz.org/projects/OVZ/repos/criu/commits/b3c9dc05e + +Stripped only master_id relative part of original patch, add +preparational patches before this one. + +Signed-off-by: Pavel Tikhomirov +--- + criu/mount.c | 18 +++++------------- + 1 file changed, 5 insertions(+), 13 deletions(-) + +diff --git a/criu/mount.c b/criu/mount.c +index 22c062e36..8d0a17d96 100644 +--- a/criu/mount.c ++++ b/criu/mount.c +@@ -1013,7 +1013,7 @@ struct mount_info *mnt_bind_pick(struct mount_info *mi, bool (*pick)(struct moun + return NULL; + } + +-static int resolve_shared_mounts(struct mount_info *info, int root_master_id) ++static int resolve_shared_mounts(struct mount_info *info) + { + struct mount_info *m, *t; + +@@ -1026,12 +1026,8 @@ static int resolve_shared_mounts(struct mount_info *info, int root_master_id) + for (m = info; m; m = m->next) { + bool need_share, need_master; + +- /* the root master_id can be ignored, because it's already created */ +- if (root_master_id && root_master_id == m->master_id) +- m->master_id = -1; +- + need_share = m->shared_id && list_empty(&m->mnt_share); +- need_master = m->master_id > 0; ++ need_master = m->master_id; + + pr_debug("Inspecting sharing on %2d shared_id %d master_id %d (@%s)\n", m->mnt_id, m->shared_id, + m->master_id, m->mountpoint); +@@ -2110,7 +2106,7 @@ skip_parent: + continue; + if (t->bind) + continue; +- if (t->master_id > 0) ++ if (t->master_id) + continue; + if (!issubpath(t->root, mi->root)) + continue; +@@ -3457,7 +3453,7 @@ static int populate_mnt_ns(void) + } + #endif + +- if (resolve_shared_mounts(mntinfo, 0)) ++ if (resolve_shared_mounts(mntinfo)) + return -1; + + if (validate_mounts(mntinfo, false)) +@@ -3845,7 +3841,6 @@ int mntns_get_root_by_mnt_id(int mnt_id) + struct collect_mntns_arg { + bool need_to_validate; + bool for_dump; +- int root_master_id; + }; + + static int collect_mntns(struct ns_id *ns, void *__arg) +@@ -3862,9 +3857,6 @@ static int collect_mntns(struct ns_id *ns, void *__arg) + + mntinfo_add_list(pms); + +- if (arg->need_to_validate && ns->id == root_item->ids->mnt_ns_id) +- arg->root_master_id = ns->mnt.mntinfo_tree->master_id; +- + return 0; + } + +@@ -3918,7 +3910,7 @@ int collect_mnt_namespaces(bool for_dump) + if (arg.need_to_validate) { + ret = -1; + +- if (resolve_shared_mounts(mntinfo, arg.root_master_id)) ++ if (resolve_shared_mounts(mntinfo)) + goto err; + if (validate_mounts(mntinfo, true)) + goto err; +-- +2.35.1 + diff --git a/0183-mount-add-helper-mnt_get_external_bind_nodev.patch b/0183-mount-add-helper-mnt_get_external_bind_nodev.patch new file mode 100644 index 0000000..67bd648 --- /dev/null +++ b/0183-mount-add-helper-mnt_get_external_bind_nodev.patch @@ -0,0 +1,58 @@ +From 62d2a03d575b7876fb28e54c44407d9e398ed2f8 Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Wed, 27 May 2020 11:50:34 +0300 +Subject: [PATCH 183/245] mount: add helper mnt_get_external_bind_nodev + +Will use it to find shared mount we can bind from and also can inherit +external slavery. Device-external can't give us external slavery. + +Cherry-picked from Virtuozzo criu: +https://src.openvz.org/projects/OVZ/repos/criu/commits/dcd952c4c + +Changes: switch to mnt_bind_pick helper. + +Signed-off-by: Pavel Tikhomirov +--- + criu/include/mount.h | 1 + + criu/mount.c | 13 +++++++++++++ + 2 files changed, 14 insertions(+) + +diff --git a/criu/include/mount.h b/criu/include/mount.h +index 071c0246e..050141058 100644 +--- a/criu/include/mount.h ++++ b/criu/include/mount.h +@@ -180,6 +180,7 @@ extern bool has_mounted_external_bind(struct mount_info *mi); + extern bool rst_mnt_is_root(struct mount_info *mi); + extern struct mount_info *mnt_get_root_bind(struct mount_info *mi); + extern bool mnt_is_root_bind(struct mount_info *mi); ++extern struct mount_info *mnt_get_external_bind_nodev(struct mount_info *mi); + + extern struct mount_info *mnt_bind_pick(struct mount_info *mi, + bool (*pick)(struct mount_info *mi, struct mount_info *bind)); +diff --git a/criu/mount.c b/criu/mount.c +index 8d0a17d96..632da6f5c 100644 +--- a/criu/mount.c ++++ b/criu/mount.c +@@ -646,6 +646,19 @@ static struct mount_info *can_receive_master_from_root(struct mount_info *mi) + return mnt_bind_pick(mi, __can_receive_master_from_root); + } + ++static bool __mnt_is_external_bind_nodev(struct mount_info *mi, struct mount_info *bind) ++{ ++ if (bind->external && !mnt_is_dev_external(bind) && is_sub_path(mi->root, bind->root)) ++ return true; ++ ++ return false; ++} ++ ++struct mount_info *mnt_get_external_bind_nodev(struct mount_info *mi) ++{ ++ return mnt_bind_pick(mi, __mnt_is_external_bind_nodev); ++} ++ + /* + * Having two children with same mountpoint is unsupported. That can happen in + * case of mount propagation inside of shared mounts, in that case it is hard +-- +2.35.1 + diff --git a/0184-mount-prepare-is_overmounted-as-early-as-possible.patch b/0184-mount-prepare-is_overmounted-as-early-as-possible.patch new file mode 100644 index 0000000..b47c79a --- /dev/null +++ b/0184-mount-prepare-is_overmounted-as-early-as-possible.patch @@ -0,0 +1,123 @@ +From 7d5222dce8fc65def14c935b8a669d38d65c81e0 Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Fri, 29 May 2020 10:27:05 +0300 +Subject: [PATCH 184/245] mount: prepare is_overmounted as early as possible + +Function mnt_is_overmounted is designed to detect if mount is overmounted in +current tree using comparison of mountpoints of neighbour mounts for detection. +We want to get actual overmounts in dumped tree, we don't expect that helper +mounts we add or merging will introduce new overmounts. So let's do overmount +detection earlier before adding helpers. + +Set is_overmounted = false for root yard and binfmt helper mounts. + +Cherry-picked from Virtuozzo criu: +https://src.openvz.org/projects/OVZ/repos/criu/commits/e98e1456d + +Changes: rename set_is_overmounted to prepare_is_overmounted, move it +just after collecting mounts from images to mount tree, handle helper +mounts. + +Signed-off-by: Pavel Tikhomirov +--- + criu/include/mount.h | 2 ++ + criu/mount.c | 31 +++++++++++++++++++++++++++---- + 2 files changed, 29 insertions(+), 4 deletions(-) + +diff --git a/criu/include/mount.h b/criu/include/mount.h +index 050141058..519a34d2a 100644 +--- a/criu/include/mount.h ++++ b/criu/include/mount.h +@@ -184,4 +184,6 @@ extern struct mount_info *mnt_get_external_bind_nodev(struct mount_info *mi); + + extern struct mount_info *mnt_bind_pick(struct mount_info *mi, + bool (*pick)(struct mount_info *mi, struct mount_info *bind)); ++ ++extern int mnt_tree_for_each(struct mount_info *start, int (*fn)(struct mount_info *)); + #endif /* __CR_MOUNT_H__ */ +diff --git a/criu/mount.c b/criu/mount.c +index 632da6f5c..30872f1ce 100644 +--- a/criu/mount.c ++++ b/criu/mount.c +@@ -1347,13 +1347,35 @@ exit: + return mi->is_overmounted; + } + +-static int set_is_overmounted(struct mount_info *mi) ++static int __set_is_overmounted(struct mount_info *mi) + { + /* coverity[check_return] */ + mnt_is_overmounted(mi); + return 0; + } + ++/* ++ * mnt_is_overmounted is intended to detect overmounts in original dumped mount ++ * tree, so we pre-save it just after loading mount tree from images, so that ++ * it does not mess up with any helper mounts or tree changes we can do. ++ */ ++static void prepare_is_overmounted(void) ++{ ++ struct ns_id *nsid; ++ ++ for (nsid = ns_ids; nsid; nsid = nsid->next) { ++ struct mount_info *root; ++ ++ if (nsid->nd != &mnt_ns_desc) ++ continue; ++ ++ root = nsid->mnt.mntinfo_tree; ++ ++ BUG_ON(root->parent); ++ mnt_tree_for_each(root, __set_is_overmounted); ++ } ++} ++ + /* + * __umount_children_overmounts() assumes that the mountpoint and + * it's ancestors have no sibling-overmounts, so we can see children +@@ -1649,6 +1671,7 @@ static __maybe_unused struct mount_info *add_cr_time_mount(struct mount_info *ro + } + + mi->mnt_bind_is_populated = true; ++ mi->is_overmounted = false; + mi->nsid = parent->nsid; + mi->parent = parent; + mi->parent_mnt_id = parent->mnt_id; +@@ -1893,7 +1916,7 @@ err: + + #define MNT_WALK_NONE 0 && + +-static int mnt_tree_for_each(struct mount_info *start, int (*fn)(struct mount_info *)) ++int mnt_tree_for_each(struct mount_info *start, int (*fn)(struct mount_info *)) + { + struct mount_info *tmp; + LIST_HEAD(postpone); +@@ -3278,6 +3301,7 @@ int read_mnt_ns_img(void) + mntinfo = pms; + + search_bindmounts(); ++ prepare_is_overmounted(); + + return 0; + } +@@ -3452,6 +3476,7 @@ static int populate_mnt_ns(void) + root_yard_mp->mountpoint = mnt_roots; + root_yard_mp->mounted = true; + root_yard_mp->mnt_bind_is_populated = true; ++ root_yard_mp->is_overmounted = false; + root_yard_mp->mnt_id = HELPER_MNT_ID; + + if (merge_mount_trees(root_yard_mp)) +@@ -3472,8 +3497,6 @@ static int populate_mnt_ns(void) + if (validate_mounts(mntinfo, false)) + return -1; + +- mnt_tree_for_each(root_yard_mp, set_is_overmounted); +- + if (find_remap_mounts(root_yard_mp)) + return -1; + +-- +2.35.1 + diff --git a/0185-mount-move-root-yard-tree-merge-as-early-as-possible.patch b/0185-mount-move-root-yard-tree-merge-as-early-as-possible.patch new file mode 100644 index 0000000..0e00940 --- /dev/null +++ b/0185-mount-move-root-yard-tree-merge-as-early-as-possible.patch @@ -0,0 +1,121 @@ +From bdd198cd917643f92e3b7bec7146eb3f51fec92b Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Mon, 29 Jun 2020 18:04:41 +0300 +Subject: [PATCH 185/245] mount: move root yard tree merge as early as possible + +Let's merge mount trees under root_yard just after reading from image. + +Cherry-picked from Virtuozzo criu: +https://src.openvz.org/projects/OVZ/repos/criu/commits/8e8ecdfdc + +Changes: split only root yard part as a separate patch, and put root +yard alloc into merge_mount_trees. + +Signed-off-by: Pavel Tikhomirov +--- + criu/mount.c | 68 ++++++++++++++++++++++++++-------------------------- + 1 file changed, 34 insertions(+), 34 deletions(-) + +diff --git a/criu/mount.c b/criu/mount.c +index 30872f1ce..b2810b7a5 100644 +--- a/criu/mount.c ++++ b/criu/mount.c +@@ -3271,6 +3271,37 @@ err: + return -1; + } + ++static int merge_mount_trees(void) ++{ ++ struct ns_id *nsid; ++ ++ root_yard_mp = mnt_entry_alloc(true); ++ if (!root_yard_mp) ++ return -1; ++ ++ root_yard_mp->mountpoint = mnt_roots; ++ root_yard_mp->mounted = true; ++ root_yard_mp->mnt_bind_is_populated = true; ++ root_yard_mp->is_overmounted = false; ++ root_yard_mp->mnt_id = HELPER_MNT_ID; ++ ++ /* Merge mount trees together under root_yard_mp */ ++ for (nsid = ns_ids; nsid; nsid = nsid->next) { ++ struct mount_info *root; ++ ++ if (nsid->nd != &mnt_ns_desc) ++ continue; ++ ++ root = nsid->mnt.mntinfo_tree; ++ ++ pr_debug("Mountpoint %d (@%s) moved to the root yard\n", root->mnt_id, root->mountpoint); ++ root->parent = root_yard_mp; ++ list_add(&root->siblings, &root_yard_mp->children); ++ } ++ ++ return 0; ++} ++ + int read_mnt_ns_img(void) + { + struct mount_info *pms = NULL; +@@ -3303,6 +3334,9 @@ int read_mnt_ns_img(void) + search_bindmounts(); + prepare_is_overmounted(); + ++ if (merge_mount_trees()) ++ return -1; ++ + return 0; + } + +@@ -3401,27 +3435,6 @@ void fini_restore_mntns(void) + } + } + +-static int merge_mount_trees(struct mount_info *root_yard) +-{ +- struct ns_id *nsid; +- +- /* Merge mount trees together under root_yard */ +- for (nsid = ns_ids; nsid; nsid = nsid->next) { +- struct mount_info *root; +- +- if (nsid->nd != &mnt_ns_desc) +- continue; +- +- root = nsid->mnt.mntinfo_tree; +- +- pr_debug("Mountpoint %d (@%s) moved to the root yard\n", root->mnt_id, root->mountpoint); +- root->parent = root_yard; +- list_add(&root->siblings, &root_yard->children); +- } +- +- return 0; +-} +- + /* + * All nested mount namespaces are restore as sub-trees of the root namespace. + */ +@@ -3469,19 +3482,6 @@ static int populate_mnt_ns(void) + struct mount_info *cr_time = NULL; + int ret; + +- root_yard_mp = mnt_entry_alloc(true); +- if (!root_yard_mp) +- return -1; +- +- root_yard_mp->mountpoint = mnt_roots; +- root_yard_mp->mounted = true; +- root_yard_mp->mnt_bind_is_populated = true; +- root_yard_mp->is_overmounted = false; +- root_yard_mp->mnt_id = HELPER_MNT_ID; +- +- if (merge_mount_trees(root_yard_mp)) +- return -1; +- + #ifdef CONFIG_BINFMT_MISC_VIRTUALIZED + if (!opts.has_binfmt_misc && !list_empty(&binfmt_misc_list)) { + /* Add to mount tree. Generic code will mount it later */ +-- +2.35.1 + diff --git a/0186-mount-fix-broken-remounted_rw-check.patch b/0186-mount-fix-broken-remounted_rw-check.patch new file mode 100644 index 0000000..d4b51f4 --- /dev/null +++ b/0186-mount-fix-broken-remounted_rw-check.patch @@ -0,0 +1,36 @@ +From 8b6d30c5a762065fb1a30dda7a7b061df3df8cbe Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Wed, 8 Jul 2020 09:57:33 +0300 +Subject: [PATCH 186/245] mount: fix broken remounted_rw check + +Expression (x && REMOUNTED_RW) is always same as just (x). + +It should've been (x & REMOUNTED_RW) to check if mount is marked as +temporary remounted writable and requires to be switched back. + +By fixing this check we eliminate excess readonly remounts. + +Cherry-picked from Virtuozzo criu: +https://src.openvz.org/projects/OVZ/repos/criu/commits/167f8ac67 + +Signed-off-by: Pavel Tikhomirov +--- + criu/mount.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/criu/mount.c b/criu/mount.c +index b2810b7a5..3421ef491 100644 +--- a/criu/mount.c ++++ b/criu/mount.c +@@ -4113,7 +4113,7 @@ static int __remount_readonly_mounts(struct ns_id *ns) + if (ns && mi->nsid != ns) + continue; + +- if (!(*mi->remounted_rw && REMOUNTED_RW)) ++ if (!(*mi->remounted_rw & REMOUNTED_RW)) + continue; + + /* +-- +2.35.1 + diff --git a/0187-mount-make-general-place-for-shared-variables-on-mou.patch b/0187-mount-make-general-place-for-shared-variables-on-mou.patch new file mode 100644 index 0000000..97a630c --- /dev/null +++ b/0187-mount-make-general-place-for-shared-variables-on-mou.patch @@ -0,0 +1,101 @@ +From 6453e35364bc9816aac9087501082aa157d67d23 Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Tue, 16 Jun 2020 16:19:42 +0300 +Subject: [PATCH 187/245] mount: make general place for shared variables on + mount-info on restore + +Put remounted_rw to it. This allows us to easily add some more of such +variables without allocating each one of them separately. + +Due to existance of shfree_last shmalloc'ed region can be inherited from +the previous caller so it needs to be explicitly zero initialized. + +Fixes: 0a2d380e6 ("ghost/mount: allocate remounted_rw in shmem to get +info from other processes") + +Cherry-picked from Virtuozzo criu: +https://src.openvz.org/projects/OVZ/repos/criu/commits/6750e5793 + +Signed-off-by: Pavel Tikhomirov +--- + criu/include/mount.h | 7 ++++++- + criu/mount.c | 13 +++++++------ + 2 files changed, 13 insertions(+), 7 deletions(-) + +diff --git a/criu/include/mount.h b/criu/include/mount.h +index 519a34d2a..3067e4088 100644 +--- a/criu/include/mount.h ++++ b/criu/include/mount.h +@@ -26,6 +26,10 @@ struct ns_id; + */ + #define REMOUNTED_RW_SERVICE 2 + ++struct rst_mount_info { ++ int remounted_rw; ++}; ++ + struct mount_info { + int mnt_id; + int parent_mnt_id; +@@ -86,7 +90,8 @@ struct mount_info { + struct list_head postpone; + + int is_overmounted; +- int *remounted_rw; ++ ++ struct rst_mount_info *rmi; + + void *private; /* associated filesystem data */ + }; +diff --git a/criu/mount.c b/criu/mount.c +index 3421ef491..5fdd60cda 100644 +--- a/criu/mount.c ++++ b/criu/mount.c +@@ -2955,11 +2955,12 @@ struct mount_info *mnt_entry_alloc(bool rst) + new = xzalloc(sizeof(struct mount_info)); + if (new) { + if (rst) { +- new->remounted_rw = shmalloc(sizeof(int)); +- if (!new->remounted_rw) { ++ new->rmi = shmalloc(sizeof(struct rst_mount_info)); ++ if (!new->rmi) { + xfree(new); + return NULL; + } ++ memset(new->rmi, 0, sizeof(struct rst_mount_info)); + } + new->fd = -1; + new->is_overmounted = -1; +@@ -4073,9 +4074,9 @@ int try_remount_writable(struct mount_info *mi, bool ns) + remounted = REMOUNTED_RW_SERVICE; + + /* All mounts in mntinfo list should have it on restore */ +- BUG_ON(mi->remounted_rw == NULL); ++ BUG_ON(mi->rmi == NULL); + +- if (mi->flags & MS_RDONLY && !(*mi->remounted_rw & remounted)) { ++ if (mi->flags & MS_RDONLY && !(mi->rmi->remounted_rw & remounted)) { + if (mnt_is_overmounted(mi)) { + pr_err("The mount %d is overmounted so paths are invisible\n", mi->mnt_id); + return -1; +@@ -4098,7 +4099,7 @@ int try_remount_writable(struct mount_info *mi, bool ns) + if (call_helper_process(ns_remount_writable, mi)) + return -1; + } +- *mi->remounted_rw |= remounted; ++ mi->rmi->remounted_rw |= remounted; + } + + return 0; +@@ -4113,7 +4114,7 @@ static int __remount_readonly_mounts(struct ns_id *ns) + if (ns && mi->nsid != ns) + continue; + +- if (!(*mi->remounted_rw & REMOUNTED_RW)) ++ if (!(mi->rmi->remounted_rw & REMOUNTED_RW)) + continue; + + /* +-- +2.35.1 + diff --git a/0188-autofs-use-ns_mountpoint-in-autofs_create_dentries.patch b/0188-autofs-use-ns_mountpoint-in-autofs_create_dentries.patch new file mode 100644 index 0000000..c1e8a52 --- /dev/null +++ b/0188-autofs-use-ns_mountpoint-in-autofs_create_dentries.patch @@ -0,0 +1,55 @@ +From 3bd5d9b39eac0cd20c427a77f94700530c5c1044 Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Tue, 26 May 2020 16:40:57 +0300 +Subject: [PATCH 188/245] autofs: use ns_mountpoint in autofs_create_dentries + +Replace ->mountpoint with ->ns_mountpoint for determining relations +between mounts. + +Also let's use get_relative_path in autofs_create_dentries as it is more +robust, before that we've missed the case where mountpoint of child of +autofs mount is multilevel subdirectory of parent mountpoint, and always +created them as single level subdirectory. + +Cherry-picked from Virtuozzo criu: +https://src.openvz.org/projects/OVZ/repos/criu/commits/5d5462202 + +Changes: skip children overmount as it does not need a subdirectory. + +Signed-off-by: Pavel Tikhomirov +--- + criu/autofs.c | 15 ++++++++++----- + 1 file changed, 10 insertions(+), 5 deletions(-) + +diff --git a/criu/autofs.c b/criu/autofs.c +index 71edc7bce..9d146b92b 100644 +--- a/criu/autofs.c ++++ b/criu/autofs.c +@@ -725,14 +725,19 @@ static int autofs_create_dentries(const struct mount_info *mi, char *mnt_path) + struct mount_info *c; + + list_for_each_entry(c, &mi->children, siblings) { +- char *path, *basename; ++ char *path, *rel_path; + +- basename = strrchr(c->mountpoint, '/'); +- if (!basename) { +- pr_info("%s: mount path \"%s\" doesn't have '/'\n", __func__, c->mountpoint); ++ rel_path = get_relative_path(c->ns_mountpoint, mi->ns_mountpoint); ++ if (!rel_path) { ++ pr_err("Can't get path %s relative to %s\n", c->ns_mountpoint, mi->ns_mountpoint); + return -1; + } +- path = xsprintf("%s%s", mnt_path, basename); ++ ++ /* Skip children-overmount */ ++ if (*rel_path == '\0') ++ continue; ++ ++ path = xsprintf("%s/%s", mnt_path, rel_path); + if (!path) + return -1; + if (mkdir(path, 0555) < 0) { +-- +2.35.1 + diff --git a/0189-mount-use-ns_mountpoint-in-mnt_is_overmounted.patch b/0189-mount-use-ns_mountpoint-in-mnt_is_overmounted.patch new file mode 100644 index 0000000..0c07830 --- /dev/null +++ b/0189-mount-use-ns_mountpoint-in-mnt_is_overmounted.patch @@ -0,0 +1,43 @@ +From 7fa7b4a49e5e3ff2f244ab85b41baa78d53eabb2 Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Tue, 30 Nov 2021 12:11:02 +0300 +Subject: [PATCH 189/245] mount: use ns_mountpoint in mnt_is_overmounted + +Let's use ->ns_mountpoint in comparison as ->mountpoint can change (e.g. +see how we add ns root in get_mp_mountpoint and in do_remap_mount we can +change it again). We plan to get rid of ->mountpoint everywhere where we +can use unchanged ->ns_mountpoint. + +Cherry-picked hunks from Virtuozzo criu: +https://src.openvz.org/projects/OVZ/repos/criu/commits/e98e1456d + +Signed-off-by: Pavel Tikhomirov +--- + criu/mount.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/criu/mount.c b/criu/mount.c +index 5fdd60cda..83baef4f3 100644 +--- a/criu/mount.c ++++ b/criu/mount.c +@@ -1322,7 +1322,7 @@ bool mnt_is_overmounted(struct mount_info *mi) + list_for_each_entry(t, &m->parent->children, siblings) { + if (m == t) + continue; +- if (issubpath(m->mountpoint, t->mountpoint)) { ++ if (issubpath(m->ns_mountpoint, t->ns_mountpoint)) { + mi->is_overmounted = 1; + goto exit; + } +@@ -1338,7 +1338,7 @@ bool mnt_is_overmounted(struct mount_info *mi) + + /* Check there is no children-overmount */ + list_for_each_entry(c, &mi->children, siblings) +- if (!strcmp(c->mountpoint, mi->mountpoint)) { ++ if (!strcmp(c->ns_mountpoint, mi->ns_mountpoint)) { + mi->is_overmounted = 1; + goto exit; + } +-- +2.35.1 + diff --git a/0190-mount-skip-root-yard-children-from-mnt_needs_remap-c.patch b/0190-mount-skip-root-yard-children-from-mnt_needs_remap-c.patch new file mode 100644 index 0000000..858c52a --- /dev/null +++ b/0190-mount-skip-root-yard-children-from-mnt_needs_remap-c.patch @@ -0,0 +1,51 @@ +From e1bb0fb902c77668bbc41ad7c1fd6a1ea777c8df Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Fri, 29 May 2020 12:40:52 +0300 +Subject: [PATCH 190/245] mount: skip root yard children from mnt_needs_remap + check + +There is no point of remaping ns root mounts they can't overmount anybody. + +This also allows us to switch mnt_needs_remap from ->mountpoint to +->ns_mountpoint for mount comparison in overmount detection. + +Cherry-picked from Virtuozzo criu: +https://src.openvz.org/projects/OVZ/repos/criu/commits/9475bf843 + +Signed-off-by: Pavel Tikhomirov +--- + criu/mount.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/criu/mount.c b/criu/mount.c +index 83baef4f3..fffebe801 100644 +--- a/criu/mount.c ++++ b/criu/mount.c +@@ -541,13 +541,13 @@ static bool mnt_needs_remap(struct mount_info *m) + { + struct mount_info *t; + +- if (!m->parent) ++ if (!m->parent || m->parent == root_yard_mp) + return false; + + list_for_each_entry(t, &m->parent->children, siblings) { + if (m == t) + continue; +- if (issubpath(t->mountpoint, m->mountpoint)) ++ if (issubpath(t->ns_mountpoint, m->ns_mountpoint)) + return true; + } + +@@ -556,7 +556,7 @@ static bool mnt_needs_remap(struct mount_info *m) + * remapped too, else fixup_remap_mounts() won't be able to move parent + * to it's real place, it will move child instead. + */ +- if (!strcmp(m->parent->mountpoint, m->mountpoint)) ++ if (!strcmp(m->parent->ns_mountpoint, m->ns_mountpoint)) + return mnt_needs_remap(m->parent); + + return false; +-- +2.35.1 + diff --git a/0191-mount-use-ns_mountpoint-in-validate_children_collisi.patch b/0191-mount-use-ns_mountpoint-in-validate_children_collisi.patch new file mode 100644 index 0000000..8b82a12 --- /dev/null +++ b/0191-mount-use-ns_mountpoint-in-validate_children_collisi.patch @@ -0,0 +1,36 @@ +From aab7439cca03f04107e1783d43f9dc898a7bea11 Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Fri, 29 May 2020 13:00:48 +0300 +Subject: [PATCH 191/245] mount: use ns_mountpoint in + validate_children_collision + +Function validate_children_collision is both called on dump and on +restore. On dump mountpoint and ns_mountpoint are the same. On restore +as we never call validate_children_collision on helper mounts +(root_yard_mp and cr_time are not in mntinfo list), for all other mounts +strcmp results would be the same with mountpoint and ns_mountpoint. + +Cherry-picked from Virtuozzo criu: +https://src.openvz.org/projects/OVZ/repos/criu/commits/8f4fda5ac + +Signed-off-by: Pavel Tikhomirov +--- + criu/mount.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/criu/mount.c b/criu/mount.c +index fffebe801..3e907172d 100644 +--- a/criu/mount.c ++++ b/criu/mount.c +@@ -676,7 +676,7 @@ static int validate_children_collision(struct mount_info *mnt) + list_for_each_entry(chj, &mnt->children, siblings) { + if (chj == chi) + break; +- if (!strcmp(chj->mountpoint, chi->mountpoint)) { ++ if (!strcmp(chj->ns_mountpoint, chi->ns_mountpoint)) { + pr_err("Mount %d has two children with same " + "mountpoint: %d %d\n", + mnt->mnt_id, chj->mnt_id, chi->mnt_id); +-- +2.35.1 + diff --git a/0192-mount-use-ns_mountpoint-in-root_path_from_parent.patch b/0192-mount-use-ns_mountpoint-in-root_path_from_parent.patch new file mode 100644 index 0000000..4b09fda --- /dev/null +++ b/0192-mount-use-ns_mountpoint-in-root_path_from_parent.patch @@ -0,0 +1,55 @@ +From e78d1e91a6e66757482138da54c4d2efa2e668ff Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Fri, 29 May 2020 13:39:10 +0300 +Subject: [PATCH 192/245] mount: use ns_mountpoint in root_path_from_parent + +Fail root_path_from_parent if parent is root_yard, we want to only +lookup root path in real parent mounts. + +Now it is safe to use ns_mountpoint instead of mountpoint as both +children and parent have it and they are relative. + +Cherry-picked from Virtuozzo criu: +https://src.openvz.org/projects/OVZ/repos/criu/commits/e58a91883 + +Signed-off-by: Pavel Tikhomirov +--- + criu/mount.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/criu/mount.c b/criu/mount.c +index 3e907172d..516752a98 100644 +--- a/criu/mount.c ++++ b/criu/mount.c +@@ -905,11 +905,11 @@ static int root_path_from_parent(struct mount_info *m, char *buf, int size) + bool head_slash = false, tail_slash = false; + int p_len, m_len, len; + +- if (!m->parent) ++ if (!m->parent || m->parent == root_yard_mp) + return -1; + +- p_len = strlen(m->parent->mountpoint); +- m_len = strlen(m->mountpoint); ++ p_len = strlen(m->parent->ns_mountpoint); ++ m_len = strlen(m->ns_mountpoint); + + len = snprintf(buf, size, "%s", m->parent->root); + if (len >= size) +@@ -925,11 +925,11 @@ static int root_path_from_parent(struct mount_info *m, char *buf, int size) + len = m_len - p_len; + BUG_ON(len < 0); + if (len) { +- if (m->mountpoint[p_len] == '/') ++ if (m->ns_mountpoint[p_len] == '/') + head_slash = true; + + len = snprintf(buf, size, "%s%s", (!tail_slash && !head_slash) ? "/" : "", +- m->mountpoint + p_len + (tail_slash && head_slash)); ++ m->ns_mountpoint + p_len + (tail_slash && head_slash)); + if (len >= size) + return -1; + } +-- +2.35.1 + diff --git a/0193-mount-use-ns_mountpoint-for-children-overmount-check.patch b/0193-mount-use-ns_mountpoint-for-children-overmount-check.patch new file mode 100644 index 0000000..e1a8ae9 --- /dev/null +++ b/0193-mount-use-ns_mountpoint-for-children-overmount-check.patch @@ -0,0 +1,35 @@ +From 8900c398fc323924eb9fd6b4ed66b18e5cadd9a9 Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Fri, 29 May 2020 13:52:45 +0300 +Subject: [PATCH 193/245] mount: use ns_mountpoint for children-overmount check + +We need to skip root_yard_mp parent as it has no ns_mountpoint, it also +has no children overmounts so we are safe, all others can be compared by +ns_mountpoints. + +Cherry-picked from Virtuozzo criu: +https://src.openvz.org/projects/OVZ/repos/criu/commits/e5665c976 + +Changes: add mi->parent pre-check, reword commit message. + +Signed-off-by: Pavel Tikhomirov +--- + criu/mount.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/criu/mount.c b/criu/mount.c +index 516752a98..b0c43e3ca 100644 +--- a/criu/mount.c ++++ b/criu/mount.c +@@ -2675,7 +2675,7 @@ static int do_mount_one(struct mount_info *mi) + return 1; + } + +- if (!strcmp(mi->parent->mountpoint, mi->mountpoint)) { ++ if ((mi->parent && mi->parent != root_yard_mp) && !strcmp(mi->parent->ns_mountpoint, mi->ns_mountpoint)) { + mi->parent->fd = open(mi->parent->mountpoint, O_PATH); + if (mi->parent->fd < 0) { + pr_perror("Unable to open %s", mi->mountpoint); +-- +2.35.1 + diff --git a/0194-path-simplify-mnt_get_sibling_path-via-get_relative_.patch b/0194-path-simplify-mnt_get_sibling_path-via-get_relative_.patch new file mode 100644 index 0000000..92eb15a --- /dev/null +++ b/0194-path-simplify-mnt_get_sibling_path-via-get_relative_.patch @@ -0,0 +1,155 @@ +From 421fb3b73b950669600160ea74913e5c3d953d5c Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Wed, 1 Dec 2021 12:52:27 +0300 +Subject: [PATCH 194/245] path: simplify mnt_get_sibling_path via + get_relative_path + +Previous code did: + +1) get rpath: mount's mountpoint relative to it's parent mountpoint +2) get cut_root: parent's root relative to parent's slave root or vice +versa (will be "-" if parents root is wider of "+" if thicker) +3) return parent's slave mountpoint +/- cut_root + rpath + +It can be done more robust with get_relative_path: + +1) get rpath: mount's mountpoint relative to it's parent mountpoint +2) get fsrpath: add rpath to parent's root (path relative to fs root) +3) get rpath: fsrpath relative to parent's slave root +4) return parent's slave mountpoint + rpath + +In the latter approach we do not need to open code workarounds for +consequent slashes in paths (get_relative_path would do this for us), +and we also do not need to have complex logic with +/-. + +While on it let's also switch ->mountpoint to ->ns_mountpoint where +possible, as mountpoint can have unexpected prefixes. + +Cherry-picked from Virtuozzo criu: +https://src.openvz.org/projects/OVZ/repos/criu/commits/0fd09f8571 + +Changes: rework mnt_get_sibling_path more. + +Signed-off-by: Pavel Tikhomirov +--- + criu/mount.c | 4 +++- + criu/path.c | 65 +++++++++++++--------------------------------------- + 2 files changed, 19 insertions(+), 50 deletions(-) + +diff --git a/criu/mount.c b/criu/mount.c +index b0c43e3ca..1ffd3da8d 100644 +--- a/criu/mount.c ++++ b/criu/mount.c +@@ -2040,6 +2040,8 @@ static int umount_from_slaves(struct mount_info *mi) + struct mount_info *t; + char *mpath, buf[PATH_MAX]; + ++ BUG_ON(mi->parent == root_yard_mp); ++ + list_for_each_entry(t, &mi->parent->mnt_slave_list, mnt_slave) { + if (!t->mounted) + continue; +@@ -2107,7 +2109,7 @@ static int propagate_mount(struct mount_info *mi) + + propagate_siblings(mi); + +- if (!mi->parent) ++ if (!mi->parent || mi->parent == root_yard_mp) + goto skip_parent; + + umount_from_slaves(mi); +diff --git a/criu/path.c b/criu/path.c +index 1b71c4cb1..54f5483b9 100644 +--- a/criu/path.c ++++ b/criu/path.c +@@ -6,6 +6,7 @@ + #include "mount.h" + #include "path.h" + #include "log.h" ++#include "util.h" + #include "common/bug.h" + + char *cut_root_for_bind(char *target_root, char *source_root) +@@ -41,64 +42,30 @@ out: + char *mnt_get_sibling_path(struct mount_info *m, struct mount_info *p, char *buf, int len) + { + struct mount_info *pa = m->parent; +- char *rpath, *cut_root, *path = buf; +- int off = 0; ++ char *rpath, fsrpath[PATH_MAX]; + + if (pa == NULL) + return NULL; + +- rpath = m->mountpoint + strlen(pa->mountpoint); +- if (rpath[0] == '/') +- rpath++; +- +- /* +- * Get a path to a sibling of "m" with parent "p", +- * return NULL is p can't have a sibling of m. +- * +- * Here are two cases: +- * When a parent of "m" has longer root than "p": +- * / pm->root / rpath +- * | cut_root | +- * / p->root / +- * In this case, a sibling path is a sum of p->mountpoint, +- * cut_root and rpath. +- * +- * When a parent of m has shorter root than "p": +- * / pm->root / rpath +- * | cut_root | +- * / p->root / rpath +strlen(cut_root) +- * In this case, a sibling path is a sum of p->mountpoint and +- * rpath - strlen(cut_root). +- */ +- +- cut_root = cut_root_for_bind(pa->root, p->root); +- if (cut_root == NULL) ++ rpath = get_relative_path(m->ns_mountpoint, pa->ns_mountpoint); ++ if (!rpath) { ++ pr_warn("child - parent mountpoint missmatch %s - %s\n", m->ns_mountpoint, pa->ns_mountpoint); + return NULL; +- if (p->mountpoint[1] != 0) /* not "/" */ { +- off = snprintf(path, len, "%s", p->mountpoint); +- if (path[off - 1] == '/') /* p->mountpoint = "./" */ +- off--; + } +- len -= off; +- path += off; + +- if (strlen(pa->root) > strlen(p->root)) { +- off = snprintf(path, len, "/%s", cut_root); +- len -= off; +- path += off; +- } else { +- int length = strlen(cut_root); +- if (strncmp(rpath, cut_root, length)) +- return NULL; +- rpath += strlen(cut_root); +- if (length > 0 && (rpath[0] && rpath[0] != '/')) +- return NULL; ++ if (snprintf(fsrpath, sizeof(fsrpath), "%s/%s", pa->root, rpath) >= sizeof(fsrpath)) { ++ pr_warn("snrptintf truncation \"%s / %s\"\n", pa->root, rpath); ++ return NULL; + } +- if (rpath[0] == '/') +- rpath++; + +- if (rpath[0] != '\0') +- snprintf(path, len, "/%s", rpath); ++ rpath = get_relative_path(fsrpath, p->root); ++ if (!rpath) ++ return NULL; ++ ++ if (snprintf(buf, len, "%s/%s", p->ns_mountpoint, rpath) >= sizeof(fsrpath)) { ++ pr_warn("snrptintf truncation \"%s / %s\"\n", p->ns_mountpoint, rpath); ++ return NULL; ++ } + + return buf; + } +-- +2.35.1 + diff --git a/0195-mount-use-ns_mountpoint-in-collect_mntinfo.patch b/0195-mount-use-ns_mountpoint-in-collect_mntinfo.patch new file mode 100644 index 0000000..598df95 --- /dev/null +++ b/0195-mount-use-ns_mountpoint-in-collect_mntinfo.patch @@ -0,0 +1,53 @@ +From ef5460e9d44d4a94bf9845d7d0d8b52cb9b8a35e Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Fri, 29 May 2020 14:34:03 +0300 +Subject: [PATCH 195/245] mount: use ns_mountpoint in collect_mntinfo + +At this point ns_mountpoint is equal to mountpoint. + +More over let's use robust is_same_path helper in should_skip_mount so +that we don't need to rely on ->mountpoint + 1 hacks. + +Cherry-picked from Virtuozzo criu: +https://src.openvz.org/projects/OVZ/repos/criu/commits/d4c4271a0 + +Changes: use is_same_path helper. + +Signed-off-by: Pavel Tikhomirov +--- + criu/proc_parse.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/criu/proc_parse.c b/criu/proc_parse.c +index 260d3669c..fd859a5c0 100644 +--- a/criu/proc_parse.c ++++ b/criu/proc_parse.c +@@ -1456,12 +1456,12 @@ bool add_skip_mount(const char *mountpoint) + return true; + } + +-static bool should_skip_mount(const char *mountpoint) ++static bool should_skip_mount(char *mountpoint) + { + struct str_node *pos; + + list_for_each_entry(pos, &skip_mount_list, node) { +- if (strcmp(mountpoint, pos->string) == 0) ++ if (is_same_path(mountpoint, pos->string)) + return true; + } + +@@ -1590,8 +1590,8 @@ struct mount_info *parse_mountinfo(pid_t pid, struct ns_id *nsid, bool for_dump) + * fail loudly at "dump" stage if an opened file or another mnt + * depends on this one. + */ +- if (for_dump && should_skip_mount(new->mountpoint + 1)) { +- pr_info("\tskip %s @ %s\n", fsname, new->mountpoint); ++ if (for_dump && should_skip_mount(new->ns_mountpoint)) { ++ pr_info("\tskip %s @ %s\n", fsname, new->ns_mountpoint); + mnt_entry_free(new); + new = NULL; + goto end; +-- +2.35.1 + diff --git a/0196-mount-use-ns_mountpoint-in-aufs_parse.patch b/0196-mount-use-ns_mountpoint-in-aufs_parse.patch new file mode 100644 index 0000000..de4d860 --- /dev/null +++ b/0196-mount-use-ns_mountpoint-in-aufs_parse.patch @@ -0,0 +1,31 @@ +From 1f9b525b6f7c9a4a31f0f05b695dbb1c2e0d2592 Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Fri, 29 May 2020 14:40:01 +0300 +Subject: [PATCH 196/245] mount: use ns_mountpoint in aufs_parse + +At this point ns_mountpoint is equal to mountpoint. + +Cherry-picked from Virtuozzo criu: +https://src.openvz.org/projects/OVZ/repos/criu/commits/c70bd7de0 + +Signed-off-by: Pavel Tikhomirov +--- + criu/proc_parse.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/criu/proc_parse.c b/criu/proc_parse.c +index fd859a5c0..413596fbb 100644 +--- a/criu/proc_parse.c ++++ b/criu/proc_parse.c +@@ -2707,7 +2707,7 @@ int aufs_parse(struct mount_info *new) + { + int ret = 0; + +- if (!strcmp(new->mountpoint, "./")) { ++ if (!strcmp(new->ns_mountpoint, "./")) { + opts.aufs = true; + ret = parse_aufs_branches(new); + } +-- +2.35.1 + diff --git a/0197-mount-use-ns_mountpoint-in-mnt_depth.patch b/0197-mount-use-ns_mountpoint-in-mnt_depth.patch new file mode 100644 index 0000000..c7a29c3 --- /dev/null +++ b/0197-mount-use-ns_mountpoint-in-mnt_depth.patch @@ -0,0 +1,33 @@ +From 9dc8da68e08544940403a0159f10c3df9bf664b7 Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Fri, 29 May 2020 15:18:10 +0300 +Subject: [PATCH 197/245] mount: use ns_mountpoint in mnt_depth + +Function mnt_depth is only used on real mounts when building mount tree for +single namespace, thats why we can compare those mounts with ns_mountpoint +safely. + +Cherry-picked from Virtuozzo criu: +https://src.openvz.org/projects/OVZ/repos/criu/commits/2be0ff276 + +Signed-off-by: Pavel Tikhomirov +--- + criu/mount.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/criu/mount.c b/criu/mount.c +index 1ffd3da8d..0c1a67aab 100644 +--- a/criu/mount.c ++++ b/criu/mount.c +@@ -392,7 +392,7 @@ static unsigned int mnt_depth(struct mount_info *m) + unsigned int depth = 0; + char *c; + +- for (c = m->mountpoint; *c != '\0'; c++) ++ for (c = m->ns_mountpoint; *c != '\0'; c++) + if (*c == '/') + depth++; + +-- +2.35.1 + diff --git a/0198-mount-use-ns_mountpoint-instead-of-mountpoint-where-.patch b/0198-mount-use-ns_mountpoint-instead-of-mountpoint-where-.patch new file mode 100644 index 0000000..9873349 --- /dev/null +++ b/0198-mount-use-ns_mountpoint-instead-of-mountpoint-where-.patch @@ -0,0 +1,567 @@ +From fdb14abc5703c4da8afcae05fe10d83445283d61 Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Fri, 29 May 2020 12:02:16 +0300 +Subject: [PATCH 198/245] mount: use ns_mountpoint instead of mountpoint where + possible + +On dump ->mountpoint and ->ns_mountpoint is the same, but on restore +->mountpoint can be changed by mount tree yard setup and remap (and who +knows what else =) ). It is not good to use ->mountpoint for path +comparison between mounts if we are not explictly need to compare +"changed" paths. Imagine the remap change will make two mounts have +different prefixes in ->mountpoint and we won't be able so understand +that those mounts originally were subpaths. + +This patch handles 2 simple cases: + +a) These functions called ONLY ON DUMP so for them there is no effective +change: fixup_overlayfs, fusectl_dump, check_one_mark, __lookup_overlayfs, +mount_resolve_path, try_resolve_ext_mount, validate_mounts (first and third), +resolve_external_mounts, get_clean_mnt, __umount_children_overmounts, +__umount_overmounts, ns_open_mountpoint, open_mountpoint, dump_one_fs, +dump_one_mountpoint, clean_cr_time_mounts, collect_unix_bindmounts. + +b) In these functions ONLY LOGS changed, so no algorithm change: +always_fail, mnt_build_ids_tree, mnt_tree_show, unsupported_nfs_bindmounts, +unsupported_nfs_mount, unsupported_mount, validate_mounts (second), +__search_bindmounts, resolve_shared_mounts, mnt_tree_for_each, resolve_source, +propagate_siblings, propagate_mount, do_mount_one, get_mp_root, +collect_mnt_from_image, merge_mount_trees, ns_remount_writable, +__remount_readonly_mounts, parse_mountinfo. + +All complex cases are handled in separate patches. + +Cherry-picked from Virtuozzo criu: +https://src.openvz.org/projects/OVZ/repos/criu/commits/4972888dd + +Signed-off-by: Pavel Tikhomirov +--- + criu/files.c | 4 +- + criu/filesystems.c | 4 +- + criu/fsnotify.c | 2 +- + criu/mount.c | 119 +++++++++++++++++++++++---------------------- + criu/proc_parse.c | 2 +- + 5 files changed, 67 insertions(+), 64 deletions(-) + +diff --git a/criu/files.c b/criu/files.c +index d317bc9ab..be31692e5 100644 +--- a/criu/files.c ++++ b/criu/files.c +@@ -286,12 +286,12 @@ static int fixup_overlayfs(struct fd_parms *p, struct fd_link *link) + * If the bug is present, the file path from /proc//fd + * does not include the mountpoint, so we prepend it ourselves. + */ +- if (strcmp("./", m->mountpoint) != 0) { ++ if (strcmp("./", m->ns_mountpoint) != 0) { + char buf[PATH_MAX]; + int n; + + strlcpy(buf, link->name, PATH_MAX); +- n = snprintf(link->name, PATH_MAX, "%s/%s", m->mountpoint, buf + 2); ++ n = snprintf(link->name, PATH_MAX, "%s/%s", m->ns_mountpoint, buf + 2); + if (n >= PATH_MAX) { + pr_err("Not enough space to replace %s\n", buf); + return -1; +diff --git a/criu/filesystems.c b/criu/filesystems.c +index 3e0ec2eb3..439735204 100644 +--- a/criu/filesystems.c ++++ b/criu/filesystems.c +@@ -548,7 +548,7 @@ static int fusectl_dump(struct mount_info *pm) + + for (it = mntinfo; it; it = it->next) { + if (it->fstype->code == FSTYPE__FUSE && id == kdev_minor(it->s_dev) && !it->external) { +- pr_err("%s is a fuse mount but not external\n", it->mountpoint); ++ pr_err("%s is a fuse mount but not external\n", it->ns_mountpoint); + goto out; + } + } +@@ -659,7 +659,7 @@ static int dump_empty_fs(struct mount_info *pm) + */ + static int always_fail(struct mount_info *pm) + { +- pr_err("failed to dump fs %s (%s): always fail\n", pm->mountpoint, pm->fstype->name); ++ pr_err("failed to dump fs %s (%s): always fail\n", pm->ns_mountpoint, pm->fstype->name); + return -1; + } + +diff --git a/criu/fsnotify.c b/criu/fsnotify.c +index 22fb74973..fd2e8d84e 100644 +--- a/criu/fsnotify.c ++++ b/criu/fsnotify.c +@@ -404,7 +404,7 @@ static int check_one_mark(FanotifyMarkEntry *fme) + return -1; + } + if (!(root_ns_mask & CLONE_NEWNS)) +- fme->me->path = m->mountpoint + 1; ++ fme->me->path = m->ns_mountpoint + 1; + fme->s_dev = m->s_dev; + + pr_info("mark: s_dev %#08x mnt_id %#08x mask %#08x\n", fme->s_dev, fme->me->mnt_id, fme->mask); +diff --git a/criu/mount.c b/criu/mount.c +index 0c1a67aab..980288818 100644 +--- a/criu/mount.c ++++ b/criu/mount.c +@@ -159,15 +159,18 @@ static struct mount_info *__lookup_overlayfs(struct mount_info *list, char *rpat + } + } + +- /* Concatenates m->mountpoint with rpath and attempts to stat the resulting path */ ++ /* ++ * Concatenates m->ns_mountpoint with rpath and attempts ++ * to stat the resulting path at mntns_root ++ */ + if (is_root_mount(m)) { + ret_stat = fstatat(mntns_root, rpath, &f_stat, 0); + } else { + char _full_path[PATH_MAX]; +- int n = snprintf(_full_path, PATH_MAX, "%s/%s", m->mountpoint, rpath); ++ int n = snprintf(_full_path, PATH_MAX, "%s/%s", m->ns_mountpoint, rpath); + + if (n >= PATH_MAX) { +- pr_err("Not enough space to concatenate %s and %s\n", m->mountpoint, rpath); ++ pr_err("Not enough space to concatenate %s and %s\n", m->ns_mountpoint, rpath); + return ERR_PTR(-ENOSPC); + } + ret_stat = fstatat(mntns_root, _full_path, &f_stat, 0); +@@ -249,11 +252,11 @@ static struct mount_info *mount_resolve_path(struct mount_info *mntinfo_tree, co + list_for_each_entry(c, &m->children, siblings) { + size_t n; + +- n = strlen(c->mountpoint + 1); ++ n = strlen(c->ns_mountpoint + 1); + if (n > pathlen) + continue; + +- if (strncmp(c->mountpoint + 1, path, min(n, pathlen))) ++ if (strncmp(c->ns_mountpoint + 1, path, min(n, pathlen))) + continue; + if (n < pathlen && path[n] != '/') + continue; +@@ -265,7 +268,7 @@ static struct mount_info *mount_resolve_path(struct mount_info *mntinfo_tree, co + break; + } + +- pr_debug("Path `%s' resolved to `%s' mountpoint\n", path, m->mountpoint); ++ pr_debug("Path `%s' resolved to `%s' mountpoint\n", path, m->ns_mountpoint); + return m; + } + +@@ -371,7 +374,7 @@ static struct mount_info *mnt_build_ids_tree(struct mount_info *list) + continue; + } + +- pr_err("No parent found for mountpoint %d (@%s)\n", m->mnt_id, m->mountpoint); ++ pr_err("No parent found for mountpoint %d (@%s)\n", m->mnt_id, m->ns_mountpoint); + return NULL; + } + +@@ -460,7 +463,7 @@ static void mnt_tree_show(struct mount_info *tree, int off) + { + struct mount_info *m; + +- pr_info("%*s[%s](%d->%d)\n", off, "", tree->mountpoint, tree->mnt_id, tree->parent_mnt_id); ++ pr_info("%*s[%s](%d->%d)\n", off, "", tree->ns_mountpoint, tree->mnt_id, tree->parent_mnt_id); + + list_for_each_entry(m, &tree->children, siblings) + mnt_tree_show(m, off + 1); +@@ -482,9 +485,9 @@ static int try_resolve_ext_mount(struct mount_info *info) + if (info->nsid->type == NS_ROOT) { + char *ext; + +- ext = ext_mount_lookup(info->mountpoint + 1 /* trim the . */); ++ ext = ext_mount_lookup(info->ns_mountpoint + 1 /* trim the . */); + if (ext) { +- pr_info("Found %s mapping for %s mountpoint\n", ext, info->mountpoint); ++ pr_info("Found %s mapping for %s mountpoint\n", ext, info->ns_mountpoint); + info->external = ext; + return 1; + } +@@ -714,7 +717,7 @@ static int validate_mounts(struct mount_info *info, bool for_dump) + + if (fsroot_mounted(m)) { + if (m->fstype->code == FSTYPE__UNSUPPORTED) { +- pr_err("FS mnt %s dev %#x root %s unsupported id %d\n", m->mountpoint, m->s_dev, ++ pr_err("FS mnt %s dev %#x root %s unsupported id %d\n", m->ns_mountpoint, m->s_dev, + m->root, m->mnt_id); + return -1; + } +@@ -730,7 +733,7 @@ static int validate_mounts(struct mount_info *info, bool for_dump) + */ + + if (for_dump) { +- ret = run_plugins(DUMP_EXT_MOUNT, m->mountpoint, m->mnt_id); ++ ret = run_plugins(DUMP_EXT_MOUNT, m->ns_mountpoint, m->mnt_id); + if (ret == 0) + m->need_plugin = true; + } else +@@ -744,7 +747,7 @@ static int validate_mounts(struct mount_info *info, bool for_dump) + if (ret < 0) { + if (ret == -ENOTSUP) + pr_err("%d:%s doesn't have a proper root mount\n", m->mnt_id, +- m->mountpoint); ++ m->ns_mountpoint); + return -1; + } + } +@@ -881,7 +884,7 @@ static int resolve_external_mounts(struct mount_info *info) + + cut_root = cut_root_for_bind(m->root, match->root); + +- p = xsprintf("%s/%s", match->mountpoint + 1, cut_root); ++ p = xsprintf("%s/%s", match->ns_mountpoint + 1, cut_root); + if (!p) + return -1; + +@@ -894,7 +897,7 @@ static int resolve_external_mounts(struct mount_info *info) + xfree(m->source); + m->source = p; + +- pr_info("autodetected external mount %s for %s\n", p, m->mountpoint); ++ pr_info("autodetected external mount %s for %s(%d)\n", p, m->ns_mountpoint, m->mnt_id); + } + + return 0; +@@ -989,8 +992,8 @@ static void __search_bindmounts(struct mount_info *mi) + if (mounts_sb_equal(mi, t)) { + list_add(&t->mnt_bind, &mi->mnt_bind); + t->mnt_bind_is_populated = true; +- pr_debug("\tThe mount %3d is bind for %3d (@%s -> @%s)\n", t->mnt_id, mi->mnt_id, t->mountpoint, +- mi->mountpoint); ++ pr_debug("\tThe mount %3d is bind for %3d (@%s -> @%s)\n", t->mnt_id, mi->mnt_id, ++ t->ns_mountpoint, mi->ns_mountpoint); + } + } + +@@ -1043,14 +1046,14 @@ static int resolve_shared_mounts(struct mount_info *info) + need_master = m->master_id; + + pr_debug("Inspecting sharing on %2d shared_id %d master_id %d (@%s)\n", m->mnt_id, m->shared_id, +- m->master_id, m->mountpoint); ++ m->master_id, m->ns_mountpoint); + + for (t = info; t && (need_share || need_master); t = t->next) { + if (t == m) + continue; + if (need_master && t->shared_id == m->master_id) { + pr_debug("\tThe mount %3d is slave for %3d (@%s -> @%s)\n", m->mnt_id, t->mnt_id, +- m->mountpoint, t->mountpoint); ++ m->ns_mountpoint, t->ns_mountpoint); + list_add(&m->mnt_slave, &t->mnt_slave_list); + m->mnt_master = t; + need_master = false; +@@ -1059,7 +1062,7 @@ static int resolve_shared_mounts(struct mount_info *info) + /* Collect all mounts from this group */ + if (need_share && t->shared_id == m->shared_id) { + pr_debug("\tMount %3d is shared with %3d group %3d (@%s -> @%s)\n", m->mnt_id, +- t->mnt_id, m->shared_id, t->mountpoint, m->mountpoint); ++ t->mnt_id, m->shared_id, t->ns_mountpoint, m->ns_mountpoint); + list_add(&t->mnt_share, &m->mnt_share); + } + } +@@ -1077,7 +1080,7 @@ static int resolve_shared_mounts(struct mount_info *info) + + pr_err("Mount %d %s (master_id: %d shared_id: %d) " + "has unreachable sharing. Try --enable-external-masters.\n", +- m->mnt_id, m->mountpoint, m->master_id, m->shared_id); ++ m->mnt_id, m->ns_mountpoint, m->master_id, m->shared_id); + return -1; + } + } +@@ -1104,7 +1107,7 @@ static int resolve_shared_mounts(struct mount_info *info) + else if (ret) { + BUG_ON(!mounts_equal(m, schild)); + pr_debug("\tMount %3d is in same propagation group with %3d (@%s ~ @%s)\n", +- m->mnt_id, schild->mnt_id, m->mountpoint, schild->mountpoint); ++ m->mnt_id, schild->mnt_id, m->ns_mountpoint, schild->ns_mountpoint); + list_add(&schild->mnt_propagate, &m->mnt_propagate); + } + } +@@ -1250,8 +1253,8 @@ static char *get_clean_mnt(struct mount_info *mi, char *mnt_path_tmp, char *mnt_ + return NULL; + } + +- if (mount(mi->mountpoint, mnt_path, NULL, MS_BIND, NULL)) { +- pr_warn("Can't bind-mount %d:%s to %s: %s\n", mi->mnt_id, mi->mountpoint, mnt_path, strerror(errno)); ++ if (mount(mi->ns_mountpoint, mnt_path, NULL, MS_BIND, NULL)) { ++ pr_perror("Can't bind-mount %d:%s to %s", mi->mnt_id, mi->ns_mountpoint, mnt_path); + rmdir(mnt_path); + return NULL; + } +@@ -1392,7 +1395,7 @@ static int __umount_children_overmounts(struct mount_info *mi) + */ + again: + list_for_each_entry(c, &m->children, siblings) { +- if (!strcmp(c->mountpoint, m->mountpoint)) { ++ if (!strcmp(c->ns_mountpoint, m->ns_mountpoint)) { + m = c; + goto again; + } +@@ -1400,8 +1403,8 @@ again: + + /* Unmout children-overmounts in the order of visibility */ + while (m != mi) { +- if (umount2(m->mountpoint, MNT_DETACH)) { +- pr_perror("Unable to umount child-overmount %s", m->mountpoint); ++ if (umount2(m->ns_mountpoint, MNT_DETACH)) { ++ pr_perror("Unable to umount child-overmount %s", m->ns_mountpoint); + return -1; + } + BUG_ON(!m->parent); +@@ -1431,12 +1434,12 @@ static int __umount_overmounts(struct mount_info *m) + /* Unmount sibling-overmounts in visibility order */ + next: + ovm = NULL; +- ovm_len = strlen(m->mountpoint) + 1; ++ ovm_len = strlen(m->ns_mountpoint) + 1; + list_for_each_entry(t, &m->parent->children, siblings) { + if (m == t) + continue; +- if (issubpath(m->mountpoint, t->mountpoint)) { +- int t_len = strlen(t->mountpoint); ++ if (issubpath(m->ns_mountpoint, t->ns_mountpoint)) { ++ int t_len = strlen(t->ns_mountpoint); + + if (t_len < ovm_len && t_len > ovm_len_min) { + ovm = t; +@@ -1452,8 +1455,8 @@ next: + if (__umount_children_overmounts(ovm)) + return -1; + +- if (umount2(ovm->mountpoint, MNT_DETACH)) { +- pr_perror("Unable to umount %s", ovm->mountpoint); ++ if (umount2(ovm->ns_mountpoint, MNT_DETACH)) { ++ pr_perror("Unable to umount %s", ovm->ns_mountpoint + 1); + return -1; + } + +@@ -1525,9 +1528,9 @@ int ns_open_mountpoint(void *arg) + * explicitly as when last process exits mntns all mounts in it are + * cleaned from their children, and we are exactly the last process. + */ +- *fd = open(mi->mountpoint, O_DIRECTORY | O_RDONLY); ++ *fd = open(mi->ns_mountpoint, O_DIRECTORY | O_RDONLY); + if (*fd < 0) { +- pr_perror("Unable to open %s", mi->mountpoint); ++ pr_perror("Unable to open %s(%d)", mi->ns_mountpoint, mi->mnt_id); + goto err; + } + +@@ -1549,7 +1552,7 @@ int open_mountpoint(struct mount_info *pm) + if (list_empty(&pm->children) && !mnt_is_overmounted(pm)) + return __open_mountpoint(pm); + +- pr_info("Mount is not fully visible %s\n", pm->mountpoint); ++ pr_info("Mount is not fully visible %s(%d)\n", pm->ns_mountpoint, pm->mnt_id); + + /* + * We do two things below: +@@ -1567,7 +1570,7 @@ int open_mountpoint(struct mount_info *pm) + goto err; + + if (!mnt_is_overmounted(pm)) { +- pr_info("\tmount has children %s\n", pm->mountpoint); ++ pr_info("\tmount has children %s(%d)\n", pm->ns_mountpoint, pm->mnt_id); + fd = get_clean_fd(pm); + } + +@@ -1579,7 +1582,7 @@ int open_mountpoint(struct mount_info *pm) + int pid, status; + struct clone_arg ca = { .mi = pm, .fd = &fd }; + +- pr_info("\tmount is overmounted or has children %s\n", pm->mountpoint); ++ pr_info("\tmount is overmounted or has children %s(%d)\n", pm->ns_mountpoint, pm->mnt_id); + + /* + * We are overmounted - not accessible in a regular way. We +@@ -1748,7 +1751,7 @@ static int dump_one_fs(struct mount_info *mi) + return 0; + } + +- pr_err("Unable to dump a file system for %d:%s\n", mi->mnt_id, mi->mountpoint); ++ pr_err("Unable to dump a file system for %d:%s\n", mi->mnt_id, mi->ns_mountpoint); + return -1; + } + +@@ -1756,7 +1759,7 @@ static int dump_one_mountpoint(struct mount_info *pm, struct cr_img *img) + { + MntEntry me = MNT_ENTRY__INIT; + +- pr_info("\t%d: %x:%s @ %s\n", pm->mnt_id, pm->s_dev, pm->root, pm->mountpoint); ++ pr_info("\t%d: %x:%s @ %s\n", pm->mnt_id, pm->s_dev, pm->root, pm->ns_mountpoint); + + me.fstype = pm->fstype->code; + +@@ -1771,7 +1774,7 @@ static int dump_one_mountpoint(struct mount_info *pm, struct cr_img *img) + return -1; + + if (pm->mnt_id == HELPER_MNT_ID) { +- pr_info("Skip dumping helper mountpoint: %s\n", pm->mountpoint); ++ pr_info("Skip dumping helper mountpoint: %s\n", pm->ns_mountpoint); + return 0; + } + +@@ -1781,7 +1784,7 @@ static int dump_one_mountpoint(struct mount_info *pm, struct cr_img *img) + me.flags = pm->flags; + me.sb_flags = pm->sb_flags; + me.has_sb_flags = true; +- me.mountpoint = pm->mountpoint + 1; ++ me.mountpoint = pm->ns_mountpoint + 1; + me.source = pm->source; + me.options = pm->options; + me.shared_id = pm->shared_id; +@@ -1923,7 +1926,7 @@ int mnt_tree_for_each(struct mount_info *start, int (*fn)(struct mount_info *)) + LIST_HEAD(postpone2); + int progress; + +- pr_debug("Start with %d:%s\n", start->mnt_id, start->mountpoint); ++ pr_debug("Start with %d:%s\n", start->mnt_id, start->ns_mountpoint); + list_add(&start->postpone, &postpone); + + again: +@@ -1937,7 +1940,7 @@ again: + + pr_err("A few mount points can't be mounted\n"); + list_for_each_entry(m, &postpone2, postpone) { +- pr_err("%d:%d %s %s %s\n", m->mnt_id, m->parent_mnt_id, m->root, m->mountpoint, m->source); ++ pr_err("%d:%d %s %s %s\n", m->mnt_id, m->parent_mnt_id, m->root, m->ns_mountpoint, m->source); + } + return -1; + } +@@ -1985,7 +1988,7 @@ static char *resolve_source(struct mount_info *mi) + return mi->source; + } + +- pr_err("No device for %s mount\n", mi->mountpoint); ++ pr_err("No device for %s(%d) mount\n", mi->ns_mountpoint, mi->mnt_id); + return NULL; + } + +@@ -2079,7 +2082,7 @@ static int propagate_siblings(struct mount_info *mi) + continue; + if (t->bind && t->bind->shared_id == t->shared_id) + continue; +- pr_debug("\t\tBind share %s\n", t->mountpoint); ++ pr_debug("\t\tBind share %s(%d)\n", t->ns_mountpoint, t->mnt_id); + t->bind = mi; + t->s_dev_rt = mi->s_dev_rt; + } +@@ -2087,7 +2090,7 @@ static int propagate_siblings(struct mount_info *mi) + list_for_each_entry(t, &mi->mnt_slave_list, mnt_slave) { + if (t->mounted || t->bind) + continue; +- pr_debug("\t\tBind slave %s\n", t->mountpoint); ++ pr_debug("\t\tBind slave %s(%d)\n", t->ns_mountpoint, t->mnt_id); + t->bind = mi; + t->s_dev_rt = mi->s_dev_rt; + } +@@ -2118,7 +2121,7 @@ static int propagate_mount(struct mount_info *mi) + list_for_each_entry(p, &mi->mnt_propagate, mnt_propagate) { + /* Should not propagate the same mount twice */ + BUG_ON(p->mounted); +- pr_debug("\t\tPropagate %s\n", p->mountpoint); ++ pr_debug("\t\tPropagate %s(%d)\n", p->ns_mountpoint, p->mnt_id); + + /* + * When a mount is propagated, the result mount +@@ -2148,7 +2151,7 @@ skip_parent: + continue; + if (!issubpath(t->root, mi->root)) + continue; +- pr_debug("\t\tBind private %s\n", t->mountpoint); ++ pr_debug("\t\tBind private %s(%d)\n", t->ns_mountpoint, t->mnt_id); + t->bind = mi; + t->s_dev_rt = mi->s_dev_rt; + } +@@ -2673,7 +2676,7 @@ static int do_mount_one(struct mount_info *mi) + return 0; + + if (!can_mount_now(mi)) { +- pr_debug("Postpone slave %s\n", mi->mountpoint); ++ pr_debug("Postpone mount %s(%d)\n", mi->ns_mountpoint, mi->mnt_id); + return 1; + } + +@@ -3059,7 +3062,7 @@ static int get_mp_root(MntEntry *me, struct mount_info *mi) + if (!opts.autodetect_ext_mounts) { + pr_err("Mount %d:%s is autodetected external mount. " + "Try \"--ext-mount-map auto\" to allow them.\n", +- mi->mnt_id, mi->mountpoint); ++ mi->mnt_id, mi->ns_mountpoint); + return -1; + } + +@@ -3078,7 +3081,7 @@ static int get_mp_root(MntEntry *me, struct mount_info *mi) + } else { + ext = ext_mount_lookup(me->ext_key); + if (!ext) { +- pr_err("No mapping for %d:%s mountpoint\n", mi->mnt_id, mi->mountpoint); ++ pr_err("No mapping for %d:%s mountpoint\n", mi->mnt_id, mi->ns_mountpoint); + return -1; + } + } +@@ -3260,7 +3263,7 @@ static int collect_mnt_from_image(struct mount_info **head, struct mount_info ** + if (get_mp_mountpoint(me->mountpoint, pm, root, root_len)) + goto err; + +- pr_debug("\tRead %d mp @ %s\n", pm->mnt_id, pm->mountpoint); ++ pr_debug("\tRead %d mp @ %s\n", pm->mnt_id, pm->ns_mountpoint); + } + + if (me) +@@ -3297,7 +3300,7 @@ static int merge_mount_trees(void) + + root = nsid->mnt.mntinfo_tree; + +- pr_debug("Mountpoint %d (@%s) moved to the root yard\n", root->mnt_id, root->mountpoint); ++ pr_debug("Mountpoint %d (@%s) moved to the root yard\n", root->mnt_id, root->ns_mountpoint); + root->parent = root_yard_mp; + list_add(&root->siblings, &root_yard_mp->children); + } +@@ -4000,8 +4003,8 @@ void clean_cr_time_mounts(void) + continue; + } + +- if (umount(mi->mountpoint) < 0) +- pr_perror("Can't umount forced mount %s", mi->mountpoint); ++ if (umount(mi->ns_mountpoint) < 0) ++ pr_perror("Can't umount forced mount %s", mi->ns_mountpoint); + + if (restore_mnt_ns(ns_old, &cwd_fd)) { + pr_err("cleanup_forced_mounts exiting with wrong mnt_ns\n"); +@@ -4058,7 +4061,7 @@ static int ns_remount_writable(void *arg) + + if (mount(NULL, mi->ns_mountpoint, NULL, MS_REMOUNT | MS_BIND | (mi->flags & ~(MS_PROPAGATE | MS_RDONLY)), + NULL) == -1) { +- pr_perror("Failed to remount %d:%s writable", mi->mnt_id, mi->mountpoint); ++ pr_perror("Failed to remount %d:%s writable", mi->mnt_id, mi->ns_mountpoint); + return 1; + } + return 0; +@@ -4131,9 +4134,9 @@ static int __remount_readonly_mounts(struct ns_id *ns) + pr_debug("Switched to mntns %u:%u\n", ns->id, ns->kid); + } + +- pr_info("Remount %d:%s back to readonly\n", mi->mnt_id, mi->mountpoint); ++ pr_info("Remount %d:%s back to readonly\n", mi->mnt_id, mi->ns_mountpoint); + if (mount(NULL, mi->ns_mountpoint, NULL, MS_REMOUNT | MS_BIND | (mi->flags & ~MS_PROPAGATE), NULL)) { +- pr_perror("Failed to restore %d:%s mount flags %x", mi->mnt_id, mi->mountpoint, mi->flags); ++ pr_perror("Failed to restore %d:%s mount flags %x", mi->mnt_id, mi->ns_mountpoint, mi->flags); + return -1; + } + } +diff --git a/criu/proc_parse.c b/criu/proc_parse.c +index 413596fbb..0fbc440a2 100644 +--- a/criu/proc_parse.c ++++ b/criu/proc_parse.c +@@ -1598,7 +1598,7 @@ struct mount_info *parse_mountinfo(pid_t pid, struct ns_id *nsid, bool for_dump) + } + + pr_info("\ttype %s source %s mnt_id %d s_dev %#x %s @ %s flags %#x options %s\n", fsname, new->source, +- new->mnt_id, new->s_dev, new->root, new->mountpoint, new->flags, new->options); ++ new->mnt_id, new->s_dev, new->root, new->ns_mountpoint, new->flags, new->options); + + if (new->fstype->parse) { + ret = new->fstype->parse(new); +-- +2.35.1 + diff --git a/0199-mount-add-service_mountpoint-getter-for-mountpoint.patch b/0199-mount-add-service_mountpoint-getter-for-mountpoint.patch new file mode 100644 index 0000000..dc7b0a2 --- /dev/null +++ b/0199-mount-add-service_mountpoint-getter-for-mountpoint.patch @@ -0,0 +1,535 @@ +From 06ad6dc02320535221228481a9fb6b864af81992 Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Thu, 28 May 2020 11:14:39 +0300 +Subject: [PATCH 199/245] mount: add service_mountpoint getter for ->mountpoint + +This getter should be used when we wan't to access the mount on the filesystem. +In next patches we want to be able to change the location of the mount on +restore in service mount namespace, while not changing ->mountpoint string. +All places where we don't want to access the mount but instead want to +determine relations between mounts in the initial mount tree or just print path +should use ns_mountpoint. + +This change effectively brings no change of behaviour everything is the same +for now. + +Still leave ->mountpoint references for remap, cr_time and initialization which +need to work with exact variable. + +Cherry-picked from Virtuozzo criu: +https://src.openvz.org/projects/OVZ/repos/criu/commits/235c761e0 + +Signed-off-by: Pavel Tikhomirov +--- + criu/autofs.c | 22 ++++---- + criu/filesystems.c | 4 +- + criu/include/mount.h | 2 + + criu/mount.c | 121 +++++++++++++++++++++++-------------------- + criu/proc_parse.c | 4 +- + criu/tty.c | 4 +- + 6 files changed, 83 insertions(+), 74 deletions(-) + +diff --git a/criu/autofs.c b/criu/autofs.c +index 9d146b92b..c662bea60 100644 +--- a/criu/autofs.c ++++ b/criu/autofs.c +@@ -388,7 +388,7 @@ free_str: + */ + static int access_autofs_mount(struct mount_info *pm) + { +- const char *mnt_path = pm->mountpoint + 1; ++ const char *mnt_path = service_mountpoint(pm) + 1; + dev_t dev_id = pm->s_dev; + int new_pid_ns = -1, old_pid_ns = -1; + int old_mnt_ns, old_cwd_fd; +@@ -498,7 +498,7 @@ static int autofs_create_entry(struct mount_info *pm, AutofsEntry *entry) + * options, then we can read them again and dump it. + */ + if (access_autofs_mount(pm)) { +- pr_err("failed to access autofs %s\n", pm->mountpoint + 1); ++ pr_err("failed to access autofs %s\n", service_mountpoint(pm) + 1); + return -1; + } + if (parse_options(pm->options, entry, &pipe_ino)) +@@ -755,7 +755,7 @@ static int autofs_populate_mount(const struct mount_info *mi, const AutofsEntry + if (entry->mode != AUTOFS_MODE_INDIRECT) + return 0; + +- return autofs_create_dentries(mi, mi->mountpoint); ++ return autofs_create_dentries(mi, service_mountpoint(mi)); + } + + static int autofs_post_mount(const char *mnt_path, dev_t mnt_dev, time_t timeout) +@@ -1031,10 +1031,10 @@ int autofs_mount(struct mount_info *mi, const char *source, const char *filesyst + goto close_pipe; + } + +- pr_info("autofs: mounting to %s with options: \"%s\"\n", mi->mountpoint, opts); ++ pr_info("autofs: mounting to %s with options: \"%s\"\n", service_mountpoint(mi), opts); + +- if (mount(source, mi->mountpoint, filesystemtype, mountflags, opts) < 0) { +- pr_perror("Failed to mount autofs to %s", mi->mountpoint); ++ if (mount(source, service_mountpoint(mi), filesystemtype, mountflags, opts) < 0) { ++ pr_perror("Failed to mount autofs to %s", service_mountpoint(mi)); + goto free_opts; + } + +@@ -1049,8 +1049,8 @@ int autofs_mount(struct mount_info *mi, const char *source, const char *filesyst + * data is not ready yet. So, let's put in on mi->private and copy to + * shared data in autofs_add_mount_info(). + */ +- if (stat(mi->mountpoint, &buf) < 0) { +- pr_perror("Failed to stat %s", mi->mountpoint); ++ if (stat(service_mountpoint(mi), &buf) < 0) { ++ pr_perror("Failed to stat %s", service_mountpoint(mi)); + goto free_info; + } + info->mnt_dev = buf.st_dev; +@@ -1061,7 +1061,7 @@ int autofs_mount(struct mount_info *mi, const char *source, const char *filesyst + goto free_info; + + /* In case of catatonic mounts all we need as the function call below */ +- ret = autofs_post_mount(mi->mountpoint, buf.st_dev, entry->timeout); ++ ret = autofs_post_mount(service_mountpoint(mi), buf.st_dev, entry->timeout); + if (ret < 0) + goto free_info; + +@@ -1084,7 +1084,7 @@ close_pipe: + free_info: + free(info); + umount: +- if (umount(mi->mountpoint) < 0) +- pr_perror("Failed to umount %s", mi->mountpoint); ++ if (umount(service_mountpoint(mi)) < 0) ++ pr_perror("Failed to umount %s", service_mountpoint(mi)); + goto close_pipe; + } +diff --git a/criu/filesystems.c b/criu/filesystems.c +index 439735204..890d5d06d 100644 +--- a/criu/filesystems.c ++++ b/criu/filesystems.c +@@ -290,7 +290,7 @@ static int binfmt_misc_restore_bme(struct mount_info *mi, BinfmtMiscEntry *bme, + goto bad_dump; + + pr_debug("binfmt_misc_pattern=%s\n", buf); +- ret = write_binfmt_misc_entry(mi->mountpoint, buf, bme); ++ ret = write_binfmt_misc_entry(service_mountpoint(mi), buf, bme); + + return ret; + +@@ -452,7 +452,7 @@ static int tmpfs_restore(struct mount_info *pm) + + ret = cr_system(img_raw_fd(img), -1, -1, "tar", + (char *[]){ "tar", "--extract", "--gzip", "--no-unquote", "--no-wildcards", "--directory", +- pm->mountpoint, NULL }, ++ service_mountpoint(pm), NULL }, + 0); + close_image(img); + +diff --git a/criu/include/mount.h b/criu/include/mount.h +index 3067e4088..8eb4ddf9b 100644 +--- a/criu/include/mount.h ++++ b/criu/include/mount.h +@@ -191,4 +191,6 @@ extern struct mount_info *mnt_bind_pick(struct mount_info *mi, + bool (*pick)(struct mount_info *mi, struct mount_info *bind)); + + extern int mnt_tree_for_each(struct mount_info *start, int (*fn)(struct mount_info *)); ++ ++extern char *service_mountpoint(const struct mount_info *mi); + #endif /* __CR_MOUNT_H__ */ +diff --git a/criu/mount.c b/criu/mount.c +index 980288818..bddfe2e7f 100644 +--- a/criu/mount.c ++++ b/criu/mount.c +@@ -47,6 +47,11 @@ static struct mount_info *root_yard_mp = NULL; + + static LIST_HEAD(delayed_unbindable); + ++char *service_mountpoint(const struct mount_info *mi) ++{ ++ return mi->mountpoint; ++} ++ + int ext_mount_add(char *key, char *val) + { + cleanup_free char *e_str = NULL; +@@ -1664,7 +1669,7 @@ static __maybe_unused struct mount_info *add_cr_time_mount(struct mount_info *ro + parent = root; + while (1) { + list_for_each_entry(t, &parent->children, siblings) { +- if (strstartswith(mi->mountpoint, t->mountpoint)) { ++ if (strstartswith(service_mountpoint(mi), service_mountpoint(t))) { + parent = t; + break; + } +@@ -1679,7 +1684,8 @@ static __maybe_unused struct mount_info *add_cr_time_mount(struct mount_info *ro + mi->parent = parent; + mi->parent_mnt_id = parent->mnt_id; + list_add(&mi->siblings, &parent->children); +- pr_info("Add cr-time mountpoint %s with parent %s(%u)\n", mi->mountpoint, parent->mountpoint, parent->mnt_id); ++ pr_info("Add cr-time mountpoint %s with parent %s(%u)\n", service_mountpoint(mi), service_mountpoint(parent), ++ parent->mnt_id); + return mi; + + err: +@@ -1994,23 +2000,23 @@ static char *resolve_source(struct mount_info *mi) + + static int restore_shared_options(struct mount_info *mi, bool private, bool shared, bool slave) + { +- pr_debug("%d:%s private %d shared %d slave %d\n", mi->mnt_id, mi->mountpoint, private, shared, slave); ++ pr_debug("%d:%s private %d shared %d slave %d\n", mi->mnt_id, service_mountpoint(mi), private, shared, slave); + + if (mi->flags & MS_UNBINDABLE) { + if (shared || slave) { +- pr_warn("%s has both unbindable and sharing, ignoring unbindable\n", mi->mountpoint); ++ pr_warn("%s has both unbindable and sharing, ignoring unbindable\n", service_mountpoint(mi)); + } else { + if (!mnt_is_overmounted(mi)) { + /* Someone may still want to bind from us, let them do it. */ +- pr_debug("Temporary leave unbindable mount %s as private\n", mi->mountpoint); +- if (mount(NULL, mi->mountpoint, NULL, MS_PRIVATE, NULL)) { ++ pr_debug("Temporary leave unbindable mount %s as private\n", service_mountpoint(mi)); ++ if (mount(NULL, service_mountpoint(mi), NULL, MS_PRIVATE, NULL)) { + pr_perror("Unable to make %d private", mi->mnt_id); + return -1; + } + list_add(&mi->mnt_unbindable, &delayed_unbindable); + return 0; + } +- if (mount(NULL, mi->mountpoint, NULL, MS_UNBINDABLE, NULL)) { ++ if (mount(NULL, service_mountpoint(mi), NULL, MS_UNBINDABLE, NULL)) { + pr_perror("Unable to make %d unbindable", mi->mnt_id); + return -1; + } +@@ -2018,15 +2024,15 @@ static int restore_shared_options(struct mount_info *mi, bool private, bool shar + } + } + +- if (private && mount(NULL, mi->mountpoint, NULL, MS_PRIVATE, NULL)) { ++ if (private && mount(NULL, service_mountpoint(mi), NULL, MS_PRIVATE, NULL)) { + pr_perror("Unable to make %d private", mi->mnt_id); + return -1; + } +- if (slave && mount(NULL, mi->mountpoint, NULL, MS_SLAVE, NULL)) { ++ if (slave && mount(NULL, service_mountpoint(mi), NULL, MS_SLAVE, NULL)) { + pr_perror("Unable to make %d slave", mi->mnt_id); + return -1; + } +- if (shared && mount(NULL, mi->mountpoint, NULL, MS_SHARED, NULL)) { ++ if (shared && mount(NULL, service_mountpoint(mi), NULL, MS_SHARED, NULL)) { + pr_perror("Unable to make %d shared", mi->mnt_id); + return -1; + } +@@ -2183,9 +2189,9 @@ static int fetch_rt_stat(struct mount_info *m, const char *where) + + static int do_simple_mount(struct mount_info *mi, const char *src, const char *fstype, unsigned long mountflags) + { +- int ret = mount(src, mi->mountpoint, fstype, mountflags, mi->options); ++ int ret = mount(src, service_mountpoint(mi), fstype, mountflags, mi->options); + if (ret) +- pr_perror("Unable to mount %s %s (id=%d)", src, mi->mountpoint, mi->mnt_id); ++ pr_perror("Unable to mount %s %s (id=%d)", src, service_mountpoint(mi), mi->mnt_id); + return ret; + } + +@@ -2250,7 +2256,7 @@ static int do_new_mount(struct mount_info *mi) + sflags &= ~MS_RDONLY; + + if (do_mount(mi, src, mnt_fsname(mi), sflags) < 0) { +- pr_perror("Can't mount at %s", mi->mountpoint); ++ pr_perror("Can't mount at %s", service_mountpoint(mi)); + return -1; + } + +@@ -2260,21 +2266,21 @@ static int do_new_mount(struct mount_info *mi) + if (remount_ro) { + int fd; + +- fd = open(mi->mountpoint, O_PATH); ++ fd = open(service_mountpoint(mi), O_PATH); + if (fd < 0) { +- pr_perror("Unable to open %s", mi->mountpoint); ++ pr_perror("Unable to open %s", service_mountpoint(mi)); + return -1; + } + sflags |= MS_RDONLY | MS_REMOUNT; + if (userns_call(apply_sb_flags, 0, &sflags, sizeof(sflags), fd)) { +- pr_err("Unable to apply mount flags %d for %s\n", mi->sb_flags, mi->mountpoint); ++ pr_err("Unable to apply mount flags %d for %s\n", mi->sb_flags, service_mountpoint(mi)); + close(fd); + return -1; + } + close(fd); + } + +- if (mflags && mount(NULL, mi->mountpoint, NULL, MS_REMOUNT | MS_BIND | mflags, NULL)) { ++ if (mflags && mount(NULL, service_mountpoint(mi), NULL, MS_REMOUNT | MS_BIND | mflags, NULL)) { + pr_perror("Unable to apply bind-mount options"); + return -1; + } +@@ -2296,8 +2302,8 @@ static int restore_ext_mount(struct mount_info *mi) + { + int ret; + +- pr_debug("Restoring external bind mount %s\n", mi->mountpoint); +- ret = run_plugins(RESTORE_EXT_MOUNT, mi->mnt_id, mi->mountpoint, "/", NULL); ++ pr_debug("Restoring external bind mount %s\n", service_mountpoint(mi)); ++ ret = run_plugins(RESTORE_EXT_MOUNT, mi->mnt_id, service_mountpoint(mi), "/", NULL); + if (ret) + pr_err("Can't restore ext mount (%d)\n", ret); + return ret; +@@ -2390,9 +2396,9 @@ static int do_bind_mount(struct mount_info *mi) + */ + mi->private = mi->bind->private; + +- mnt_path = mi->bind->mountpoint; ++ mnt_path = service_mountpoint(mi->bind); + +- /* Access a mount by fd if mi->bind->mountpoint is overmounted */ ++ /* Access a mount by fd if service_mountpoint(mi->bind) is overmounted */ + if (mi->bind->fd >= 0) { + snprintf(mnt_fd_path, sizeof(mnt_fd_path), "/proc/self/fd/%d", mi->bind->fd); + mnt_path = mnt_fd_path; +@@ -2405,14 +2411,14 @@ static int do_bind_mount(struct mount_info *mi) + * The target path may be over-mounted by one of child mounts + * and we need to create a new bind-mount to get access to the path. + */ +- mp_len = strlen(mi->bind->mountpoint); +- if (mp_len > 1) /* skip a joining / if mi->bind->mountpoint isn't "/" */ ++ mp_len = strlen(service_mountpoint(mi->bind)); ++ if (mp_len > 1) /* skip a joining / if service_mountpoint(mi->bind) isn't "/" */ + mp_len++; + + list_for_each_entry(c, &mi->bind->children, siblings) { + if (!c->mounted) + continue; +- if (issubpath(cut_root, c->mountpoint + mp_len)) ++ if (issubpath(cut_root, service_mountpoint(c) + mp_len)) + break; /* a source path is overmounted */ + } + +@@ -2433,11 +2439,11 @@ skip_overmount_check: + snprintf(rpath, sizeof(rpath), "%s/%s", mnt_path, cut_root); + root = rpath; + do_bind: +- pr_info("\tBind %s to %s\n", root, mi->mountpoint); ++ pr_info("\tBind %s to %s\n", root, service_mountpoint(mi)); + + if (unlikely(mi->deleted)) { +- if (stat(mi->mountpoint, &st)) { +- pr_perror("Can't fetch stat on %s", mi->mountpoint); ++ if (stat(service_mountpoint(mi), &st)) { ++ pr_perror("Can't fetch stat on %s", service_mountpoint(mi)); + goto err; + } + +@@ -2459,15 +2465,15 @@ do_bind: + } + } + +- if (mount(root, mi->mountpoint, NULL, MS_BIND | (mi->flags & MS_REC), NULL) < 0) { +- pr_perror("Can't mount at %s", mi->mountpoint); ++ if (mount(root, service_mountpoint(mi), NULL, MS_BIND | (mi->flags & MS_REC), NULL) < 0) { ++ pr_perror("Can't mount at %s", service_mountpoint(mi)); + goto err; + } + + mflags = mi->flags & (~MS_PROPAGATE); + if (!mi->bind || mflags != (mi->bind->flags & (~MS_PROPAGATE))) +- if (mount(NULL, mi->mountpoint, NULL, MS_BIND | MS_REMOUNT | mflags, NULL)) { +- pr_perror("Can't mount at %s", mi->mountpoint); ++ if (mount(NULL, service_mountpoint(mi), NULL, MS_BIND | MS_REMOUNT | mflags, NULL)) { ++ pr_perror("Can't mount at %s", service_mountpoint(mi)); + goto err; + } + +@@ -2649,7 +2655,7 @@ static int do_mount_root(struct mount_info *mi) + if (restore_shared_options(mi, !mi->shared_id && !mi->master_id, mi->shared_id, mi->master_id)) + return -1; + +- return fetch_rt_stat(mi, mi->mountpoint); ++ return fetch_rt_stat(mi, service_mountpoint(mi)); + } + + static int do_close_one(struct mount_info *mi) +@@ -2660,7 +2666,7 @@ static int do_close_one(struct mount_info *mi) + + static int set_unbindable(struct mount_info *mi) + { +- if (mount(NULL, mi->mountpoint, NULL, MS_UNBINDABLE, NULL)) { ++ if (mount(NULL, service_mountpoint(mi), NULL, MS_UNBINDABLE, NULL)) { + pr_perror("Failed setting unbindable flag on %d", mi->mnt_id); + return -1; + } +@@ -2681,14 +2687,14 @@ static int do_mount_one(struct mount_info *mi) + } + + if ((mi->parent && mi->parent != root_yard_mp) && !strcmp(mi->parent->ns_mountpoint, mi->ns_mountpoint)) { +- mi->parent->fd = open(mi->parent->mountpoint, O_PATH); ++ mi->parent->fd = open(service_mountpoint(mi->parent), O_PATH); + if (mi->parent->fd < 0) { +- pr_perror("Unable to open %s", mi->mountpoint); ++ pr_perror("Unable to open %s", service_mountpoint(mi)); + return -1; + } + } + +- pr_debug("\tMounting %s @%s (%d)\n", mi->fstype->name, mi->mountpoint, mi->need_plugin); ++ pr_debug("\tMounting %s %d@%s (%d)\n", mi->fstype->name, mi->mnt_id, service_mountpoint(mi), mi->need_plugin); + + if (rst_mnt_is_root(mi)) { + int fd; +@@ -2701,21 +2707,22 @@ static int do_mount_one(struct mount_info *mi) + + /* do_mount_root() is called from populate_mnt_ns() */ + if (root_ns_mask & CLONE_NEWUSER) { +- fd = open(mi->mountpoint, O_PATH); ++ fd = open(service_mountpoint(mi), O_PATH); + if (fd < 0) { +- pr_perror("Unable to open %s", mi->mountpoint); ++ pr_perror("Unable to open %s", service_mountpoint(mi)); + return -1; + } + + if (userns_call(mount_root, 0, &flags, sizeof(flags), fd)) { +- pr_err("Unable to mount %s\n", mi->mountpoint); ++ pr_err("Unable to mount %s\n", service_mountpoint(mi)); + close(fd); + return -1; + } + close(fd); + } else { +- if (mount(opts.root, mi->mountpoint, NULL, flags, NULL)) { +- pr_perror("Unable to mount %s %s (id=%d)", opts.root, mi->mountpoint, mi->mnt_id); ++ if (mount(opts.root, service_mountpoint(mi), NULL, flags, NULL)) { ++ pr_perror("Unable to mount %s %s (id=%d)", opts.root, service_mountpoint(mi), ++ mi->mnt_id); + return -1; + } + } +@@ -2730,7 +2737,7 @@ static int do_mount_one(struct mount_info *mi) + ret = do_bind_mount(mi); + } + +- if (ret == 0 && fetch_rt_stat(mi, mi->mountpoint)) ++ if (ret == 0 && fetch_rt_stat(mi, service_mountpoint(mi))) + return -1; + + if (ret == 0 && propagate_mount(mi)) +@@ -2739,8 +2746,8 @@ static int do_mount_one(struct mount_info *mi) + if (mi->fstype->code == FSTYPE__UNSUPPORTED) { + struct statfs st; + +- if (statfs(mi->mountpoint, &st)) { +- pr_perror("Unable to statfs %s", mi->mountpoint); ++ if (statfs(service_mountpoint(mi), &st)) { ++ pr_perror("Unable to statfs %s", service_mountpoint(mi)); + return -1; + } + if (st.f_type == BTRFS_SUPER_MAGIC) +@@ -2755,17 +2762,17 @@ static int do_umount_one(struct mount_info *mi) + if (!mi->parent) + return 0; + +- if (mount("none", mi->parent->mountpoint, "none", MS_REC | MS_PRIVATE, NULL)) { +- pr_perror("Can't mark %s as private", mi->parent->mountpoint); ++ if (mount("none", service_mountpoint(mi->parent), "none", MS_REC | MS_PRIVATE, NULL)) { ++ pr_perror("Can't mark %s as private", service_mountpoint(mi->parent)); + return -1; + } + +- if (umount(mi->mountpoint)) { +- pr_perror("Can't umount at %s", mi->mountpoint); ++ if (umount(service_mountpoint(mi))) { ++ pr_perror("Can't umount at %s", service_mountpoint(mi)); + return -1; + } + +- pr_info("Umounted at %s\n", mi->mountpoint); ++ pr_info("Umounted at %s\n", service_mountpoint(mi)); + return 0; + } + +@@ -3113,7 +3120,7 @@ static int get_mp_mountpoint(char *mountpoint, struct mount_info *mi, char *root + + mi->ns_mountpoint = mi->mountpoint + root_len; + +- pr_debug("\t\tWill mount %d @ %s\n", mi->mnt_id, mi->mountpoint); ++ pr_debug("\t\tWill mount %d @ %s %s\n", mi->mnt_id, service_mountpoint(mi), mi->ns_mountpoint); + return 0; + } + +@@ -3469,14 +3476,14 @@ static int populate_roots_yard(struct mount_info *cr_time) + * contains mounts which has to be restored separately + */ + list_for_each_entry(r, &mnt_remap_list, node) { +- if (mkdirpat(AT_FDCWD, r->mi->mountpoint, 0755)) { +- pr_perror("Unable to create %s", r->mi->mountpoint); ++ if (mkdirpat(AT_FDCWD, service_mountpoint(r->mi), 0755)) { ++ pr_perror("Unable to create %s", service_mountpoint(r->mi)); + return -1; + } + } + +- if (cr_time && mkdirpat(AT_FDCWD, cr_time->mountpoint, 0755)) { +- pr_perror("Unable to create %s", cr_time->mountpoint); ++ if (cr_time && mkdirpat(AT_FDCWD, service_mountpoint(cr_time), 0755)) { ++ pr_perror("Unable to create %s", service_mountpoint(cr_time)); + return -1; + } + +@@ -4093,11 +4100,11 @@ int try_remount_writable(struct mount_info *mi, bool ns) + return -1; + } + +- pr_info("Remount %d:%s writable\n", mi->mnt_id, mi->mountpoint); ++ pr_info("Remount %d:%s writable\n", mi->mnt_id, service_mountpoint(mi)); + if (!ns) { +- if (mount(NULL, mi->mountpoint, NULL, ++ if (mount(NULL, service_mountpoint(mi), NULL, + MS_REMOUNT | MS_BIND | (mi->flags & ~(MS_PROPAGATE | MS_RDONLY)), NULL) == -1) { +- pr_perror("Failed to remount %d:%s writable", mi->mnt_id, mi->mountpoint); ++ pr_perror("Failed to remount %d:%s writable", mi->mnt_id, service_mountpoint(mi)); + return -1; + } + } else { +diff --git a/criu/proc_parse.c b/criu/proc_parse.c +index 0fbc440a2..338b42f4b 100644 +--- a/criu/proc_parse.c ++++ b/criu/proc_parse.c +@@ -1603,14 +1603,14 @@ struct mount_info *parse_mountinfo(pid_t pid, struct ns_id *nsid, bool for_dump) + if (new->fstype->parse) { + ret = new->fstype->parse(new); + if (ret < 0) { +- pr_err("Failed to parse FS specific data on %s\n", new->mountpoint); ++ pr_err("Failed to parse FS specific data on %s\n", service_mountpoint(new)); + mnt_entry_free(new); + new = NULL; + goto end; + } + + if (ret > 0) { +- pr_info("\tskipping fs mounted at %s\n", new->mountpoint + 1); ++ pr_info("\tskipping fs mounted at %s\n", service_mountpoint(new) + 1); + mnt_entry_free(new); + new = NULL; + ret = 0; +diff --git a/criu/tty.c b/criu/tty.c +index 1462193c5..0430dbff7 100644 +--- a/criu/tty.c ++++ b/criu/tty.c +@@ -2406,9 +2406,9 @@ int devpts_restore(struct mount_info *pm) + struct mount_info *bm; + int dfd, exit_code = -1; + +- dfd = open(pm->mountpoint, O_RDONLY); ++ dfd = open(service_mountpoint(pm), O_RDONLY); + if (dfd < 0) { +- pr_perror("Unable to open %s", pm->mountpoint); ++ pr_perror("Unable to open %s", service_mountpoint(pm)); + return -1; + } + +-- +2.35.1 + diff --git a/0200-files-reg-split-create_ghost_dentry-out-of-create_gh.patch b/0200-files-reg-split-create_ghost_dentry-out-of-create_gh.patch new file mode 100644 index 0000000..145f127 --- /dev/null +++ b/0200-files-reg-split-create_ghost_dentry-out-of-create_gh.patch @@ -0,0 +1,120 @@ +From 942d9f5e0d484eefbdef9ee69c326aa176da4d10 Mon Sep 17 00:00:00 2001 +From: Stanislav Kinsburskiy +Date: Mon, 11 Jul 2016 14:14:15 +0300 +Subject: [PATCH 200/245] files-reg: split create_ghost_dentry out of + create_ghost + +Will use it to make create_ghost work with mount-v2. + +Signed-off-by: Stanislav Kinsburskiy +Signed-off-by: Cyrill Gorcunov +Signed-off-by: Pavel Tikhomirov + +Cherry-picked from Virtuozzo criu: +https://src.openvz.org/projects/OVZ/repos/criu/commits/156fa4877 +Cherry-picked from Virtuozzo criu: +https://src.openvz.org/projects/OVZ/repos/criu/commits/069bba0ad + +Changes: merge fixup. + +Signed-off-by: Pavel Tikhomirov +--- + criu/files-reg.c | 68 +++++++++++++++++++++++++++--------------------- + 1 file changed, 39 insertions(+), 29 deletions(-) + +diff --git a/criu/files-reg.c b/criu/files-reg.c +index 141843a7a..309ecf77c 100644 +--- a/criu/files-reg.c ++++ b/criu/files-reg.c +@@ -355,32 +355,11 @@ err: + return ret; + } + +-static int create_ghost(struct ghost_file *gf, GhostFileEntry *gfe, struct cr_img *img) ++static int create_ghost_dentry(char *path, GhostFileEntry *gfe, struct cr_img *img) + { +- struct mount_info *mi; +- char path[PATH_MAX]; +- int ret, root_len; ++ int ret = -1; + char *msg; + +- root_len = ret = rst_get_mnt_root(gf->remap.rmnt_id, path, sizeof(path)); +- if (ret < 0) { +- pr_err("The %d mount is not found for ghost\n", gf->remap.rmnt_id); +- goto err; +- } +- +- /* Add a '/' only if we have no at the end */ +- if (path[root_len - 1] != '/') { +- path[root_len++] = '/'; +- path[root_len] = '\0'; +- } +- +- snprintf(path + root_len, sizeof(path) - root_len, "%s", gf->remap.rpath); +- ret = -1; +- +- mi = lookup_mnt_id(gf->remap.rmnt_id); +- /* We get here while in service mntns */ +- if (mi && try_remount_writable(mi, false)) +- goto err; + again: + if (S_ISFIFO(gfe->mode)) { + if ((ret = mknod(path, gfe->mode, 0)) < 0) +@@ -417,16 +396,47 @@ again: + goto err; + } + +- strcpy(gf->remap.rpath, path + root_len); +- pr_debug("Remap rpath is %s\n", gf->remap.rpath); ++ ret = 0; ++err: ++ return ret; ++} ++ ++static int create_ghost(struct ghost_file *gf, GhostFileEntry *gfe, struct cr_img *img) ++{ ++ struct mount_info *mi; ++ char path[PATH_MAX]; ++ int ret, root_len; ++ ++ root_len = ret = rst_get_mnt_root(gf->remap.rmnt_id, path, sizeof(path)); ++ if (ret < 0) { ++ pr_err("The %d mount is not found for ghost\n", gf->remap.rmnt_id); ++ return -1; ++ } + ++ /* Add a '/' only if we have no at the end */ ++ if (path[root_len - 1] != '/') { ++ path[root_len++] = '/'; ++ path[root_len] = '\0'; ++ } ++ ++ snprintf(path + root_len, sizeof(path) - root_len, "%s", gf->remap.rpath); + ret = -1; ++ ++ mi = lookup_mnt_id(gf->remap.rmnt_id); ++ /* We get here while in service mntns */ ++ if (mi && try_remount_writable(mi, false)) ++ return -1; ++ ++ ret = create_ghost_dentry(path, gfe, img); ++ if (ret) ++ return -1; ++ + if (ghost_apply_metadata(path, gfe)) +- goto err; ++ return -1; + +- ret = 0; +-err: +- return ret; ++ strcpy(gf->remap.rpath, path + root_len); ++ pr_debug("Remap rpath is %s\n", gf->remap.rpath); ++ return 0; + } + + static inline void ghost_path(char *path, int plen, struct reg_file_info *rfi, RemapFilePathEntry *rpe) +-- +2.35.1 + diff --git a/0201-files-reg-teach-create_ghost-to-work-with-mount-v2.patch b/0201-files-reg-teach-create_ghost-to-work-with-mount-v2.patch new file mode 100644 index 0000000..c061809 --- /dev/null +++ b/0201-files-reg-teach-create_ghost-to-work-with-mount-v2.patch @@ -0,0 +1,129 @@ +From 494e92c1e7ef7e8ea8e506884de18b2affe21df7 Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Thu, 14 May 2020 14:11:47 +0300 +Subject: [PATCH 201/245] files-reg: teach create_ghost to work with mount-v2 + +While mounts-v2 would mount all mounts plain without tree in service +mntns we can't just use path relative to mntns to find remap. Make it +mount related, it is also compatible with current mount engine. + +Also handle no-mntns case separately in nomntns_create_ghost. + +Cherry-picked from Virtuozzo criu: +https://src.openvz.org/projects/OVZ/repos/criu/commits/9cdf0b3e4 + +Changes: make gf->remap.rpath always relative else we get: +Error (criu/files-reg.c:779): Couldn't unlink remap +/tmp/.criu.mntns.BCurDL/13-0000000000 /zdtm/static/cwd02.test: +No such file or directory + +Signed-off-by: Pavel Tikhomirov +--- + criu/files-reg.c | 65 +++++++++++++++++++++++++++++++++++++----------- + 1 file changed, 50 insertions(+), 15 deletions(-) + +diff --git a/criu/files-reg.c b/criu/files-reg.c +index 309ecf77c..66e2c2c39 100644 +--- a/criu/files-reg.c ++++ b/criu/files-reg.c +@@ -53,6 +53,7 @@ + + #include "files-reg.h" + #include "plugin.h" ++#include "string.h" + + int setfsuid(uid_t fsuid); + int setfsgid(gid_t fsuid); +@@ -401,40 +402,74 @@ err: + return ret; + } + ++static int nomntns_create_ghost(struct ghost_file *gf, GhostFileEntry *gfe, struct cr_img *img) ++{ ++ char path[PATH_MAX]; ++ ++ snprintf(path, sizeof(path), "/%s", gf->remap.rpath); ++ ++ if (create_ghost_dentry(path, gfe, img)) ++ return -1; ++ ++ if (ghost_apply_metadata(path, gfe)) ++ return -1; ++ ++ strlcpy(gf->remap.rpath, path + 1, PATH_MAX); ++ pr_debug("Remap rpath is %s\n", gf->remap.rpath); ++ return 0; ++} ++ + static int create_ghost(struct ghost_file *gf, GhostFileEntry *gfe, struct cr_img *img) + { + struct mount_info *mi; +- char path[PATH_MAX]; +- int ret, root_len; ++ char path[PATH_MAX], *rel_path, *rel_mp; + +- root_len = ret = rst_get_mnt_root(gf->remap.rmnt_id, path, sizeof(path)); +- if (ret < 0) { ++ if (!(root_ns_mask & CLONE_NEWNS)) ++ return nomntns_create_ghost(gf, gfe, img); ++ ++ mi = lookup_mnt_id(gf->remap.rmnt_id); ++ if (!mi) { + pr_err("The %d mount is not found for ghost\n", gf->remap.rmnt_id); + return -1; + } + +- /* Add a '/' only if we have no at the end */ +- if (path[root_len - 1] != '/') { +- path[root_len++] = '/'; +- path[root_len] = '\0'; ++ /* Get path relative to mountpoint from path relative to mntns */ ++ rel_path = get_relative_path(gf->remap.rpath, mi->ns_mountpoint); ++ if (!rel_path) { ++ pr_err("Can't get path %s relative to %s\n", gf->remap.rpath, mi->ns_mountpoint); ++ return -1; + } + +- snprintf(path + root_len, sizeof(path) - root_len, "%s", gf->remap.rpath); +- ret = -1; ++ snprintf(path, sizeof(path), "%s%s%s", service_mountpoint(mi), rel_path[0] ? "/" : "", rel_path); ++ pr_debug("Trying to create ghost on path %s\n", path); + +- mi = lookup_mnt_id(gf->remap.rmnt_id); + /* We get here while in service mntns */ +- if (mi && try_remount_writable(mi, false)) ++ if (try_remount_writable(mi, false)) + return -1; + +- ret = create_ghost_dentry(path, gfe, img); +- if (ret) ++ if (create_ghost_dentry(path, gfe, img)) + return -1; + + if (ghost_apply_metadata(path, gfe)) + return -1; + +- strcpy(gf->remap.rpath, path + root_len); ++ /* ++ * Convert the path back to mntns relative, as create_ghost_dentry ++ * might have changed it. ++ */ ++ rel_path = get_relative_path(path, service_mountpoint(mi)); ++ if (!rel_path) { ++ pr_err("Can't get path %s relative to %s\n", path, service_mountpoint(mi)); ++ return -1; ++ } ++ ++ rel_mp = get_relative_path(mi->ns_mountpoint, "/"); ++ if (!rel_mp) { ++ pr_err("Can't get path %s relative to %s\n", mi->ns_mountpoint, "/"); ++ return -1; ++ } ++ ++ snprintf(gf->remap.rpath, PATH_MAX, "%s%s%s", rel_mp, (rel_mp[0] && rel_path[0]) ? "/" : "", rel_path); + pr_debug("Remap rpath is %s\n", gf->remap.rpath); + return 0; + } +-- +2.35.1 + diff --git a/0202-files-reg-teach-clean_one_remap-to-work-with-mount-v.patch b/0202-files-reg-teach-clean_one_remap-to-work-with-mount-v.patch new file mode 100644 index 0000000..e23a476 --- /dev/null +++ b/0202-files-reg-teach-clean_one_remap-to-work-with-mount-v.patch @@ -0,0 +1,101 @@ +From a50e588c378ebe862e79a17609f1023be06324b0 Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Thu, 14 May 2020 16:36:57 +0300 +Subject: [PATCH 202/245] files-reg: teach clean_one_remap to work with + mount-v2 + +While mounts-v2 mounts all mounts plain without tree in service mntns we can't +just use path relative to mntns to find remap. Make it mount related, it is +also compatible with mounts-v1. + +Also we don't need openat and unlinkat here as we've opened rmntns_root +just before that, lets switch to "non-at" variants. + +Cherry-picked from Virtuozzo criu: +https://src.openvz.org/projects/OVZ/repos/criu/commits/dc9ac0c80 + +Changes: rework to skip vz-specific hunks. + +Signed-off-by: Pavel Tikhomirov +--- + criu/files-reg.c | 46 ++++++++++++++++++++++++++-------------------- + 1 file changed, 26 insertions(+), 20 deletions(-) + +diff --git a/criu/files-reg.c b/criu/files-reg.c +index 66e2c2c39..636853ac8 100644 +--- a/criu/files-reg.c ++++ b/criu/files-reg.c +@@ -748,44 +748,50 @@ int prepare_remaps(void) + static int clean_one_remap(struct remap_info *ri) + { + struct file_remap *remap = ri->rfi->remap; +- int mnt_id, ret, rmntns_root; ++ int mnt_id, ret; + struct mount_info *mi; +- char path[PATH_MAX]; ++ char path[PATH_MAX], *rel_path; + + if (remap->rpath[0] == 0) + return 0; + ++ if (!(root_ns_mask & CLONE_NEWNS)) { ++ snprintf(path, sizeof(path), "/%s", remap->rpath); ++ goto nomntns; ++ } ++ + mnt_id = ri->rfi->rfe->mnt_id; /* rirfirfe %) */ +- ret = rst_get_mnt_root(mnt_id, path, sizeof(path)); +- if (ret < 0) +- return -1; +- if (ret >= sizeof(path) - 1) { +- pr_err("The path buffer is too small\n"); ++ mi = lookup_mnt_id(mnt_id); ++ if (!mi) { ++ pr_err("The %d mount is not found for ghost\n", mnt_id); + return -1; + } + +- rmntns_root = open(path, O_RDONLY); +- if (rmntns_root < 0) { +- pr_perror("Unable to open %s", path); ++ rel_path = get_relative_path(remap->rpath, mi->ns_mountpoint); ++ if (!rel_path) { ++ pr_err("Can't get path %s relative to %s\n", remap->rpath, mi->ns_mountpoint); + return -1; + } + +- mi = lookup_mnt_id(mnt_id); ++ snprintf(path, sizeof(path), "%s%s%s", service_mountpoint(mi), strlen(rel_path) ? "/" : "", rel_path); ++ + /* We get here while in service mntns */ +- if (mi && try_remount_writable(mi, false)) { +- close(rmntns_root); ++ if (try_remount_writable(mi, false)) + return -1; +- } + +- pr_info("Unlink remap %s\n", remap->rpath); ++nomntns: ++ pr_info("Unlink remap %s\n", path); + +- ret = unlinkat(rmntns_root, remap->rpath, remap->is_dir ? AT_REMOVEDIR : 0); +- if (ret < 0) { +- close(rmntns_root); +- pr_perror("Couldn't unlink remap %s %s", path, remap->rpath); ++ if (remap->is_dir) ++ ret = rmdir(path); ++ else ++ ret = unlink(path); ++ ++ if (ret) { ++ pr_perror("Couldn't unlink remap %s", path); + return -1; + } +- close(rmntns_root); ++ + remap->rpath[0] = 0; + + return 0; +-- +2.35.1 + diff --git a/0203-kerndat-Check-for-MOVE_MOUNT_SET_GROUP-availability.patch b/0203-kerndat-Check-for-MOVE_MOUNT_SET_GROUP-availability.patch new file mode 100644 index 0000000..54fc3a5 --- /dev/null +++ b/0203-kerndat-Check-for-MOVE_MOUNT_SET_GROUP-availability.patch @@ -0,0 +1,285 @@ +From d48d4f9e3b5c08028a07e8a77f01cf419db530ec Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Thu, 25 Mar 2021 13:37:55 +0300 +Subject: [PATCH 203/245] kerndat: Check for MOVE_MOUNT_SET_GROUP availability + +Mounts-v2 requires new kernel feature MOVE_MOUNT_SET_GROUP to be able to +restore propagation between mounts right. + +Cherry-picked from Virtuozzo criu: +https://src.openvz.org/projects/OVZ/repos/criu/commits/7da7f9a17 + +Changes: define move_mount syscall, check mainstream kernel +MOVE_MOUNT_SET_GROUP feature, use our "linux/mount.h" to overcome +possible problems of non-existing header on older kernels. + +v3: coverity CID 389201: check ret of umount2 and rmdir at cleanup stage + +Signed-off-by: Pavel Tikhomirov +--- + .../arch/arm/plugins/std/syscalls/syscall.def | 1 + + .../mips/plugins/std/syscalls/syscall_64.tbl | 1 + + .../plugins/std/syscalls/syscall-ppc64.tbl | 1 + + .../plugins/std/syscalls/syscall-s390.tbl | 1 + + .../x86/plugins/std/syscalls/syscall_32.tbl | 1 + + .../x86/plugins/std/syscalls/syscall_64.tbl | 1 + + criu/cr-check.c | 10 +++ + criu/include/kerndat.h | 1 + + criu/include/mount-v2.h | 24 +++++++ + criu/kerndat.c | 69 +++++++++++++++++++ + 10 files changed, 110 insertions(+) + create mode 100644 criu/include/mount-v2.h + +diff --git a/compel/arch/arm/plugins/std/syscalls/syscall.def b/compel/arch/arm/plugins/std/syscalls/syscall.def +index e6508ed9f..6b9cd8b8e 100644 +--- a/compel/arch/arm/plugins/std/syscalls/syscall.def ++++ b/compel/arch/arm/plugins/std/syscalls/syscall.def +@@ -112,6 +112,7 @@ userfaultfd 282 388 (int flags) + fallocate 47 352 (int fd, int mode, loff_t offset, loff_t len) + cacheflush ! 983042 (void *start, void *end, int flags) + ppoll 73 336 (struct pollfd *fds, unsigned int nfds, const struct timespec *tmo, const sigset_t *sigmask, size_t sigsetsize) ++move_mount 429 429 (int from_dfd, const char *from_pathname, int to_dfd, const char *to_pathname, int flags) + fsopen 430 430 (char *fsname, unsigned int flags) + fsconfig 431 431 (int fd, unsigned int cmd, const char *key, const char *value, int aux) + fsmount 432 432 (int fd, unsigned int flags, unsigned int attr_flags) +diff --git a/compel/arch/mips/plugins/std/syscalls/syscall_64.tbl b/compel/arch/mips/plugins/std/syscalls/syscall_64.tbl +index 7a6db192c..430df1824 100644 +--- a/compel/arch/mips/plugins/std/syscalls/syscall_64.tbl ++++ b/compel/arch/mips/plugins/std/syscalls/syscall_64.tbl +@@ -109,6 +109,7 @@ __NR_memfd_create 5314 sys_memfd_create (const char *name, unsigned int flags) + __NR_userfaultfd 5317 sys_userfaultfd (int flags) + + ##TODO for kernel ++__NR_move_mount 5429 sys_move_mount (int from_dfd, const char *from_pathname, int to_dfd, const char *to_pathname, int flags) + __NR_fsopen 5430 sys_fsopen (char *fsname, unsigned int flags) + __NR_fsconfig 5431 sys_fsconfig (int fd, unsigned int cmd, const char *key, const char *value, int aux) + __NR_fsmount 5432 sys_fsmount (int fd, unsigned int flags, unsigned int attr_flags) +diff --git a/compel/arch/ppc64/plugins/std/syscalls/syscall-ppc64.tbl b/compel/arch/ppc64/plugins/std/syscalls/syscall-ppc64.tbl +index 1bb626bc5..138eec2af 100644 +--- a/compel/arch/ppc64/plugins/std/syscalls/syscall-ppc64.tbl ++++ b/compel/arch/ppc64/plugins/std/syscalls/syscall-ppc64.tbl +@@ -108,6 +108,7 @@ __NR_gettimeofday 78 sys_gettimeofday (struct timeval *tv, struct timezone *tz) + __NR_preadv 320 sys_preadv_raw (int fd, struct iovec *iov, unsigned long nr, unsigned long pos_l, unsigned long pos_h) + __NR_userfaultfd 364 sys_userfaultfd (int flags) + __NR_ppoll 281 sys_ppoll (struct pollfd *fds, unsigned int nfds, const struct timespec *tmo, const sigset_t *sigmask, size_t sigsetsize) ++__NR_move_mount 429 sys_move_mount (int from_dfd, const char *from_pathname, int to_dfd, const char *to_pathname, int flags) + __NR_fsopen 430 sys_fsopen (char *fsname, unsigned int flags) + __NR_fsconfig 431 sys_fsconfig (int fd, unsigned int cmd, const char *key, const char *value, int aux) + __NR_fsmount 432 sys_fsmount (int fd, unsigned int flags, unsigned int attr_flags) +diff --git a/compel/arch/s390/plugins/std/syscalls/syscall-s390.tbl b/compel/arch/s390/plugins/std/syscalls/syscall-s390.tbl +index 7178bf483..ae54afa17 100644 +--- a/compel/arch/s390/plugins/std/syscalls/syscall-s390.tbl ++++ b/compel/arch/s390/plugins/std/syscalls/syscall-s390.tbl +@@ -108,6 +108,7 @@ __NR_userfaultfd 355 sys_userfaultfd (int flags) + __NR_preadv 328 sys_preadv_raw (int fd, struct iovec *iov, unsigned long nr, unsigned long pos_l, unsigned long pos_h) + __NR_gettimeofday 78 sys_gettimeofday (struct timeval *tv, struct timezone *tz) + __NR_ppoll 302 sys_ppoll (struct pollfd *fds, unsigned int nfds, const struct timespec *tmo, const sigset_t *sigmask, size_t sigsetsize) ++__NR_move_mount 429 sys_move_mount (int from_dfd, const char *from_pathname, int to_dfd, const char *to_pathname, int flags) + __NR_fsopen 430 sys_fsopen (char *fsname, unsigned int flags) + __NR_fsconfig 431 sys_fsconfig (int fd, unsigned int cmd, const char *key, const char *value, int aux) + __NR_fsmount 432 sys_fsmount (int fd, unsigned int flags, unsigned int attr_flags) +diff --git a/compel/arch/x86/plugins/std/syscalls/syscall_32.tbl b/compel/arch/x86/plugins/std/syscalls/syscall_32.tbl +index 7e456cdb7..e4133f8f9 100644 +--- a/compel/arch/x86/plugins/std/syscalls/syscall_32.tbl ++++ b/compel/arch/x86/plugins/std/syscalls/syscall_32.tbl +@@ -96,6 +96,7 @@ __NR_seccomp 354 sys_seccomp (unsigned int op, unsigned int flags, const char + __NR_memfd_create 356 sys_memfd_create (const char *name, unsigned int flags) + __NR_userfaultfd 374 sys_userfaultfd (int flags) + __NR_ppoll 309 sys_ppoll (struct pollfd *fds, unsigned int nfds, const struct timespec *tmo, const sigset_t *sigmask, size_t sigsetsize) ++__NR_move_mount 429 sys_move_mount (int from_dfd, const char *from_pathname, int to_dfd, const char *to_pathname, int flags) + __NR_fsopen 430 sys_fsopen (char *fsname, unsigned int flags) + __NR_fsconfig 431 sys_fsconfig (int fd, unsigned int cmd, const char *key, const char *value, int aux) + __NR_fsmount 432 sys_fsmount (int fd, unsigned int flags, unsigned int attr_flags) +diff --git a/compel/arch/x86/plugins/std/syscalls/syscall_64.tbl b/compel/arch/x86/plugins/std/syscalls/syscall_64.tbl +index 2dfcc6eee..4c9461473 100644 +--- a/compel/arch/x86/plugins/std/syscalls/syscall_64.tbl ++++ b/compel/arch/x86/plugins/std/syscalls/syscall_64.tbl +@@ -107,6 +107,7 @@ __NR_kcmp 312 sys_kcmp (pid_t pid1, pid_t pid2, int type, unsigned long idx1 + __NR_memfd_create 319 sys_memfd_create (const char *name, unsigned int flags) + __NR_userfaultfd 323 sys_userfaultfd (int flags) + __NR_ppoll 271 sys_ppoll (struct pollfd *fds, unsigned int nfds, const struct timespec *tmo, const sigset_t *sigmask, size_t sigsetsize) ++__NR_move_mount 429 sys_move_mount (int from_dfd, const char *from_pathname, int to_dfd, const char *to_pathname, int flags) + __NR_fsopen 430 sys_fsopen (char *fsname, unsigned int flags) + __NR_fsconfig 431 sys_fsconfig (int fd, unsigned int cmd, const char *key, const char *value, int aux) + __NR_fsmount 432 sys_fsmount (int fd, unsigned int flags, unsigned int attr_flags) +diff --git a/criu/cr-check.c b/criu/cr-check.c +index ced084df2..10d433650 100644 +--- a/criu/cr-check.c ++++ b/criu/cr-check.c +@@ -1394,6 +1394,14 @@ static int check_sockopt_buf_lock(void) + return 0; + } + ++static int check_move_mount_set_group(void) ++{ ++ if (!kdat.has_move_mount_set_group) ++ return -1; ++ ++ return 0; ++} ++ + static int (*chk_feature)(void); + + /* +@@ -1514,6 +1522,7 @@ int cr_check(void) + ret |= check_network_lock_nftables(); + ret |= check_sockopt_buf_lock(); + ret |= check_memfd_hugetlb(); ++ ret |= check_move_mount_set_group(); + } + + /* +@@ -1628,6 +1637,7 @@ static struct feature_list feature_list[] = { + { "network_lock_nftables", check_network_lock_nftables }, + { "sockopt_buf_lock", check_sockopt_buf_lock }, + { "memfd_hugetlb", check_memfd_hugetlb }, ++ { "move_mount_set_group", check_move_mount_set_group }, + { NULL, NULL }, + }; + +diff --git a/criu/include/kerndat.h b/criu/include/kerndat.h +index 25825ee51..f6e3b6133 100644 +--- a/criu/include/kerndat.h ++++ b/criu/include/kerndat.h +@@ -78,6 +78,7 @@ struct kerndat_s { + bool has_nftables_concat; + bool has_sockopt_buf_lock; + dev_t hugetlb_dev[HUGETLB_MAX]; ++ bool has_move_mount_set_group; + }; + + extern struct kerndat_s kdat; +diff --git a/criu/include/mount-v2.h b/criu/include/mount-v2.h +new file mode 100644 +index 000000000..8a4e46b1a +--- /dev/null ++++ b/criu/include/mount-v2.h +@@ -0,0 +1,24 @@ ++#ifndef __CR_MOUNT_V2_H__ ++#define __CR_MOUNT_V2_H__ ++ ++#include "linux/mount.h" ++ ++#include ++ ++#ifndef MOVE_MOUNT_SET_GROUP ++#define MOVE_MOUNT_SET_GROUP 0x00000100 /* Set sharing group instead */ ++#endif ++#ifndef MOVE_MOUNT_F_EMPTY_PATH ++#define MOVE_MOUNT_F_EMPTY_PATH 0x00000004 /* Empty from path permitted */ ++#endif ++#ifndef MOVE_MOUNT_T_EMPTY_PATH ++#define MOVE_MOUNT_T_EMPTY_PATH 0x00000040 /* Empty to path permitted */ ++#endif ++ ++static inline int sys_move_mount(int from_dirfd, const char *from_pathname, int to_dirfd, const char *to_pathname, ++ unsigned int flags) ++{ ++ return syscall(__NR_move_mount, from_dirfd, from_pathname, to_dirfd, to_pathname, flags); ++} ++ ++#endif /* __CR_MOUNT_V2_H__ */ +diff --git a/criu/kerndat.c b/criu/kerndat.c +index da1fb5511..5e49fc116 100644 +--- a/criu/kerndat.c ++++ b/criu/kerndat.c +@@ -14,6 +14,7 @@ + #include + #include + #include ++#include + + #if defined(CONFIG_HAS_NFTABLES_LIB_API_0) || defined(CONFIG_HAS_NFTABLES_LIB_API_1) + #include +@@ -46,6 +47,7 @@ + #include "kcmp.h" + #include "sched.h" + #include "memfd.h" ++#include "mount-v2.h" + + struct kerndat_s kdat = {}; + +@@ -932,6 +934,69 @@ err: + return exit_code; + } + ++static int kerndat_has_move_mount_set_group(void) ++{ ++ char tmpdir[] = "/tmp/.criu.move_mount_set_group.XXXXXX"; ++ char subdir[64]; ++ int exit_code = -1; ++ ++ if (mkdtemp(tmpdir) == NULL) { ++ pr_perror("Fail to make dir %s", tmpdir); ++ return -1; ++ } ++ ++ if (mount("criu.move_mount_set_group", tmpdir, "tmpfs", 0, NULL)) { ++ pr_perror("Fail to mount tmfps to %s", tmpdir); ++ rmdir(tmpdir); ++ return -1; ++ } ++ ++ if (mount(NULL, tmpdir, NULL, MS_PRIVATE, NULL)) { ++ pr_perror("Fail to make %s private", tmpdir); ++ goto out; ++ } ++ ++ if (snprintf(subdir, sizeof(subdir), "%s/subdir", tmpdir) >= sizeof(subdir)) { ++ pr_err("Fail to snprintf subdir\n"); ++ goto out; ++ } ++ ++ if (mkdir(subdir, 0700)) { ++ pr_perror("Fail to make dir %s", subdir); ++ goto out; ++ } ++ ++ if (mount(subdir, subdir, NULL, MS_BIND, NULL)) { ++ pr_perror("Fail to make bind-mount %s", subdir); ++ goto out; ++ } ++ ++ if (mount(NULL, tmpdir, NULL, MS_SHARED, NULL)) { ++ pr_perror("Fail to make %s private", tmpdir); ++ goto out; ++ } ++ ++ if (sys_move_mount(AT_FDCWD, tmpdir, AT_FDCWD, subdir, MOVE_MOUNT_SET_GROUP)) { ++ if (errno == EINVAL || errno == ENOSYS) { ++ pr_debug("No MOVE_MOUNT_SET_GROUP kernel feature\n"); ++ kdat.has_move_mount_set_group = false; ++ exit_code = 0; ++ goto out; ++ } ++ pr_perror("Fail to MOVE_MOUNT_SET_GROUP"); ++ goto out; ++ } ++ ++ kdat.has_move_mount_set_group = true; ++ exit_code = 0; ++out: ++ if (umount2(tmpdir, MNT_DETACH)) ++ pr_warn("Fail to umount2 %s: %m\n", tmpdir); ++ if (rmdir(tmpdir)) ++ pr_warn("Fail to rmdir %s: %m\n", tmpdir); ++ return exit_code; ++} ++ + #define KERNDAT_CACHE_FILE KDAT_RUNDIR "/criu.kdat" + #define KERNDAT_CACHE_FILE_TMP KDAT_RUNDIR "/.criu.kdat" + +@@ -1517,6 +1582,10 @@ int kerndat_init(void) + pr_err("kerndat_sockopt_buf_lock failed when initializing kerndat.\n"); + ret = -1; + } ++ if (!ret && kerndat_has_move_mount_set_group()) { ++ pr_err("kerndat_has_move_mount_set_group failed when initializing kerndat.\n"); ++ ret = -1; ++ } + + kerndat_lsm(); + kerndat_mmap_min_addr(); +-- +2.35.1 + diff --git a/0204-compel-add-open_tree-syscall.patch b/0204-compel-add-open_tree-syscall.patch new file mode 100644 index 0000000..212887b --- /dev/null +++ b/0204-compel-add-open_tree-syscall.patch @@ -0,0 +1,129 @@ +From 51f04ae1074b115f486aaaf0a3feb72d0bf90130 Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Fri, 24 Dec 2021 13:23:29 +0300 +Subject: [PATCH 204/245] compel: add open_tree syscall + +Will use this for cross mount namespace bindmounts. + +Note: don't need separate kdat for mount-v2, as MOVE_MOUNT_SET_GROUP +were added much later than open_tree and all related fixups. + +Signed-off-by: Pavel Tikhomirov +--- + .../arch/arm/plugins/std/syscalls/syscall.def | 1 + + .../mips/plugins/std/syscalls/syscall_64.tbl | 1 + + .../plugins/std/syscalls/syscall-ppc64.tbl | 1 + + .../plugins/std/syscalls/syscall-s390.tbl | 1 + + .../x86/plugins/std/syscalls/syscall_32.tbl | 1 + + .../x86/plugins/std/syscalls/syscall_64.tbl | 1 + + criu/include/mount-v2.h | 24 +++++++++++++++++++ + 7 files changed, 30 insertions(+) + +diff --git a/compel/arch/arm/plugins/std/syscalls/syscall.def b/compel/arch/arm/plugins/std/syscalls/syscall.def +index 6b9cd8b8e..a422b4905 100644 +--- a/compel/arch/arm/plugins/std/syscalls/syscall.def ++++ b/compel/arch/arm/plugins/std/syscalls/syscall.def +@@ -112,6 +112,7 @@ userfaultfd 282 388 (int flags) + fallocate 47 352 (int fd, int mode, loff_t offset, loff_t len) + cacheflush ! 983042 (void *start, void *end, int flags) + ppoll 73 336 (struct pollfd *fds, unsigned int nfds, const struct timespec *tmo, const sigset_t *sigmask, size_t sigsetsize) ++open_tree 428 428 (int dirfd, const char *pathname, unsigned int flags) + move_mount 429 429 (int from_dfd, const char *from_pathname, int to_dfd, const char *to_pathname, int flags) + fsopen 430 430 (char *fsname, unsigned int flags) + fsconfig 431 431 (int fd, unsigned int cmd, const char *key, const char *value, int aux) +diff --git a/compel/arch/mips/plugins/std/syscalls/syscall_64.tbl b/compel/arch/mips/plugins/std/syscalls/syscall_64.tbl +index 430df1824..745782285 100644 +--- a/compel/arch/mips/plugins/std/syscalls/syscall_64.tbl ++++ b/compel/arch/mips/plugins/std/syscalls/syscall_64.tbl +@@ -109,6 +109,7 @@ __NR_memfd_create 5314 sys_memfd_create (const char *name, unsigned int flags) + __NR_userfaultfd 5317 sys_userfaultfd (int flags) + + ##TODO for kernel ++__NR_open_tree 5428 sys_open_tree (int dirfd, const char *pathname, unsigned int flags) + __NR_move_mount 5429 sys_move_mount (int from_dfd, const char *from_pathname, int to_dfd, const char *to_pathname, int flags) + __NR_fsopen 5430 sys_fsopen (char *fsname, unsigned int flags) + __NR_fsconfig 5431 sys_fsconfig (int fd, unsigned int cmd, const char *key, const char *value, int aux) +diff --git a/compel/arch/ppc64/plugins/std/syscalls/syscall-ppc64.tbl b/compel/arch/ppc64/plugins/std/syscalls/syscall-ppc64.tbl +index 138eec2af..0eceebe22 100644 +--- a/compel/arch/ppc64/plugins/std/syscalls/syscall-ppc64.tbl ++++ b/compel/arch/ppc64/plugins/std/syscalls/syscall-ppc64.tbl +@@ -108,6 +108,7 @@ __NR_gettimeofday 78 sys_gettimeofday (struct timeval *tv, struct timezone *tz) + __NR_preadv 320 sys_preadv_raw (int fd, struct iovec *iov, unsigned long nr, unsigned long pos_l, unsigned long pos_h) + __NR_userfaultfd 364 sys_userfaultfd (int flags) + __NR_ppoll 281 sys_ppoll (struct pollfd *fds, unsigned int nfds, const struct timespec *tmo, const sigset_t *sigmask, size_t sigsetsize) ++__NR_open_tree 428 sys_open_tree (int dirfd, const char *pathname, unsigned int flags) + __NR_move_mount 429 sys_move_mount (int from_dfd, const char *from_pathname, int to_dfd, const char *to_pathname, int flags) + __NR_fsopen 430 sys_fsopen (char *fsname, unsigned int flags) + __NR_fsconfig 431 sys_fsconfig (int fd, unsigned int cmd, const char *key, const char *value, int aux) +diff --git a/compel/arch/s390/plugins/std/syscalls/syscall-s390.tbl b/compel/arch/s390/plugins/std/syscalls/syscall-s390.tbl +index ae54afa17..93a8f34d3 100644 +--- a/compel/arch/s390/plugins/std/syscalls/syscall-s390.tbl ++++ b/compel/arch/s390/plugins/std/syscalls/syscall-s390.tbl +@@ -108,6 +108,7 @@ __NR_userfaultfd 355 sys_userfaultfd (int flags) + __NR_preadv 328 sys_preadv_raw (int fd, struct iovec *iov, unsigned long nr, unsigned long pos_l, unsigned long pos_h) + __NR_gettimeofday 78 sys_gettimeofday (struct timeval *tv, struct timezone *tz) + __NR_ppoll 302 sys_ppoll (struct pollfd *fds, unsigned int nfds, const struct timespec *tmo, const sigset_t *sigmask, size_t sigsetsize) ++__NR_open_tree 428 sys_open_tree (int dirfd, const char *pathname, unsigned int flags) + __NR_move_mount 429 sys_move_mount (int from_dfd, const char *from_pathname, int to_dfd, const char *to_pathname, int flags) + __NR_fsopen 430 sys_fsopen (char *fsname, unsigned int flags) + __NR_fsconfig 431 sys_fsconfig (int fd, unsigned int cmd, const char *key, const char *value, int aux) +diff --git a/compel/arch/x86/plugins/std/syscalls/syscall_32.tbl b/compel/arch/x86/plugins/std/syscalls/syscall_32.tbl +index e4133f8f9..14d2e0581 100644 +--- a/compel/arch/x86/plugins/std/syscalls/syscall_32.tbl ++++ b/compel/arch/x86/plugins/std/syscalls/syscall_32.tbl +@@ -96,6 +96,7 @@ __NR_seccomp 354 sys_seccomp (unsigned int op, unsigned int flags, const char + __NR_memfd_create 356 sys_memfd_create (const char *name, unsigned int flags) + __NR_userfaultfd 374 sys_userfaultfd (int flags) + __NR_ppoll 309 sys_ppoll (struct pollfd *fds, unsigned int nfds, const struct timespec *tmo, const sigset_t *sigmask, size_t sigsetsize) ++__NR_open_tree 428 sys_open_tree (int dirfd, const char *pathname, unsigned int flags) + __NR_move_mount 429 sys_move_mount (int from_dfd, const char *from_pathname, int to_dfd, const char *to_pathname, int flags) + __NR_fsopen 430 sys_fsopen (char *fsname, unsigned int flags) + __NR_fsconfig 431 sys_fsconfig (int fd, unsigned int cmd, const char *key, const char *value, int aux) +diff --git a/compel/arch/x86/plugins/std/syscalls/syscall_64.tbl b/compel/arch/x86/plugins/std/syscalls/syscall_64.tbl +index 4c9461473..2f690f48f 100644 +--- a/compel/arch/x86/plugins/std/syscalls/syscall_64.tbl ++++ b/compel/arch/x86/plugins/std/syscalls/syscall_64.tbl +@@ -107,6 +107,7 @@ __NR_kcmp 312 sys_kcmp (pid_t pid1, pid_t pid2, int type, unsigned long idx1 + __NR_memfd_create 319 sys_memfd_create (const char *name, unsigned int flags) + __NR_userfaultfd 323 sys_userfaultfd (int flags) + __NR_ppoll 271 sys_ppoll (struct pollfd *fds, unsigned int nfds, const struct timespec *tmo, const sigset_t *sigmask, size_t sigsetsize) ++__NR_open_tree 428 sys_open_tree (int dirfd, const char *pathname, unsigned int flags) + __NR_move_mount 429 sys_move_mount (int from_dfd, const char *from_pathname, int to_dfd, const char *to_pathname, int flags) + __NR_fsopen 430 sys_fsopen (char *fsname, unsigned int flags) + __NR_fsconfig 431 sys_fsconfig (int fd, unsigned int cmd, const char *key, const char *value, int aux) +diff --git a/criu/include/mount-v2.h b/criu/include/mount-v2.h +index 8a4e46b1a..396ed9594 100644 +--- a/criu/include/mount-v2.h ++++ b/criu/include/mount-v2.h +@@ -21,4 +21,28 @@ static inline int sys_move_mount(int from_dirfd, const char *from_pathname, int + return syscall(__NR_move_mount, from_dirfd, from_pathname, to_dirfd, to_pathname, flags); + } + ++#ifndef OPEN_TREE_CLONE ++#define OPEN_TREE_CLONE 1 /* Clone the target tree and attach the clone */ ++#endif ++#ifndef OPEN_TREE_CLOEXEC ++#define OPEN_TREE_CLOEXEC O_CLOEXEC /* Close the file on execve() */ ++#endif ++#ifndef AT_SYMLINK_NOFOLLOW ++#define AT_SYMLINK_NOFOLLOW 0x100 /* Do not follow symbolic links. */ ++#endif ++#ifndef AT_NO_AUTOMOUNT ++#define AT_NO_AUTOMOUNT 0x800 /* Suppress terminal automount traversal */ ++#endif ++#ifndef AT_EMPTY_PATH ++#define AT_EMPTY_PATH 0x1000 /* Allow empty relative pathname */ ++#endif ++#ifndef AT_RECURSIVE ++#define AT_RECURSIVE 0x8000 /* Apply to the entire subtree */ ++#endif ++ ++static inline int sys_open_tree(int dfd, const char *filename, unsigned int flags) ++{ ++ return syscall(__NR_open_tree, dfd, filename, flags); ++} ++ + #endif /* __CR_MOUNT_V2_H__ */ +-- +2.35.1 + diff --git a/0205-kerndat-check-whether-the-openat2-syscall-is-support.patch b/0205-kerndat-check-whether-the-openat2-syscall-is-support.patch new file mode 100644 index 0000000..c72e3ee --- /dev/null +++ b/0205-kerndat-check-whether-the-openat2-syscall-is-support.patch @@ -0,0 +1,270 @@ +From 4fd088daf734226b17c7590420fd5bea6a5d3f7c Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Wed, 22 Dec 2021 11:07:24 +0300 +Subject: [PATCH 205/245] kerndat: check whether the openat2 syscall is + supported + +Will use openat2 + RESOLVE_NO_XDEV to detect mountpoints. + +Signed-off-by: Pavel Tikhomirov +--- + Makefile.config | 2 +- + .../arch/arm/plugins/std/syscalls/syscall.def | 1 + + .../mips/plugins/std/syscalls/syscall_64.tbl | 1 + + .../plugins/std/syscalls/syscall-ppc64.tbl | 1 + + .../plugins/std/syscalls/syscall-s390.tbl | 1 + + .../x86/plugins/std/syscalls/syscall_32.tbl | 1 + + .../x86/plugins/std/syscalls/syscall_64.tbl | 1 + + .../plugins/include/uapi/std/syscall-types.h | 1 + + criu/cr-check.c | 10 ++++++++++ + criu/include/kerndat.h | 1 + + criu/include/linux/openat2.h | 18 +++++++++++++++++ + criu/include/mount-v2.h | 10 ++++++++++ + criu/kerndat.c | 20 +++++++++++++++++++ + scripts/feature-tests.mak | 12 +++++++++++ + 14 files changed, 79 insertions(+), 1 deletion(-) + create mode 100644 criu/include/linux/openat2.h + +diff --git a/Makefile.config b/Makefile.config +index 6e3e1b062..14599ae8e 100644 +--- a/Makefile.config ++++ b/Makefile.config +@@ -70,7 +70,7 @@ export DEFINES += $(FEATURE_DEFINES) + export CFLAGS += $(FEATURE_DEFINES) + + FEATURES_LIST := TCP_REPAIR STRLCPY STRLCAT PTRACE_PEEKSIGINFO \ +- SETPROCTITLE_INIT MEMFD TCP_REPAIR_WINDOW FSCONFIG MEMFD_CREATE ++ SETPROCTITLE_INIT MEMFD TCP_REPAIR_WINDOW FSCONFIG MEMFD_CREATE OPENAT2 + + # $1 - config name + define gen-feature-test +diff --git a/compel/arch/arm/plugins/std/syscalls/syscall.def b/compel/arch/arm/plugins/std/syscalls/syscall.def +index a422b4905..c9bccc386 100644 +--- a/compel/arch/arm/plugins/std/syscalls/syscall.def ++++ b/compel/arch/arm/plugins/std/syscalls/syscall.def +@@ -119,4 +119,5 @@ fsconfig 431 431 (int fd, unsigned int cmd, const char *key, const char *value + fsmount 432 432 (int fd, unsigned int flags, unsigned int attr_flags) + clone3 435 435 (struct clone_args *uargs, size_t size) + pidfd_open 434 434 (pid_t pid, unsigned int flags) ++openat2 437 437 (int dirfd, char *pathname, struct open_how *how, size_t size) + pidfd_getfd 438 438 (int pidfd, int targetfd, unsigned int flags) +diff --git a/compel/arch/mips/plugins/std/syscalls/syscall_64.tbl b/compel/arch/mips/plugins/std/syscalls/syscall_64.tbl +index 745782285..a74e694e2 100644 +--- a/compel/arch/mips/plugins/std/syscalls/syscall_64.tbl ++++ b/compel/arch/mips/plugins/std/syscalls/syscall_64.tbl +@@ -116,4 +116,5 @@ __NR_fsconfig 5431 sys_fsconfig (int fd, unsigned int cmd, const char *key, + __NR_fsmount 5432 sys_fsmount (int fd, unsigned int flags, unsigned int attr_flags) + __NR_clone3 5435 sys_clone3 (struct clone_args *uargs, size_t size) + __NR_pidfd_open 5434 sys_pidfd_open (pid_t pid, unsigned int flags) ++__NR_openat2 5437 sys_openat2 (int dirfd, char *pathname, struct open_how *how, size_t size) + __NR_pidfd_getfd 5438 sys_pidfd_getfd (int pidfd, int targetfd, unsigned int flags) +diff --git a/compel/arch/ppc64/plugins/std/syscalls/syscall-ppc64.tbl b/compel/arch/ppc64/plugins/std/syscalls/syscall-ppc64.tbl +index 0eceebe22..648239182 100644 +--- a/compel/arch/ppc64/plugins/std/syscalls/syscall-ppc64.tbl ++++ b/compel/arch/ppc64/plugins/std/syscalls/syscall-ppc64.tbl +@@ -115,4 +115,5 @@ __NR_fsconfig 431 sys_fsconfig (int fd, unsigned int cmd, const char *key, co + __NR_fsmount 432 sys_fsmount (int fd, unsigned int flags, unsigned int attr_flags) + __NR_clone3 435 sys_clone3 (struct clone_args *uargs, size_t size) + __NR_pidfd_open 434 sys_pidfd_open (pid_t pid, unsigned int flags) ++__NR_openat2 437 sys_openat2 (int dirfd, char *pathname, struct open_how *how, size_t size) + __NR_pidfd_getfd 438 sys_pidfd_getfd (int pidfd, int targetfd, unsigned int flags) +diff --git a/compel/arch/s390/plugins/std/syscalls/syscall-s390.tbl b/compel/arch/s390/plugins/std/syscalls/syscall-s390.tbl +index 93a8f34d3..169458296 100644 +--- a/compel/arch/s390/plugins/std/syscalls/syscall-s390.tbl ++++ b/compel/arch/s390/plugins/std/syscalls/syscall-s390.tbl +@@ -115,4 +115,5 @@ __NR_fsconfig 431 sys_fsconfig (int fd, unsigned int cmd, const char *key, co + __NR_fsmount 432 sys_fsmount (int fd, unsigned int flags, unsigned int attr_flags) + __NR_clone3 435 sys_clone3 (struct clone_args *uargs, size_t size) + __NR_pidfd_open 434 sys_pidfd_open (pid_t pid, unsigned int flags) ++__NR_openat2 437 sys_openat2 (int dirfd, char *pathname, struct open_how *how, size_t size) + __NR_pidfd_getfd 438 sys_pidfd_getfd (int pidfd, int targetfd, unsigned int flags) +diff --git a/compel/arch/x86/plugins/std/syscalls/syscall_32.tbl b/compel/arch/x86/plugins/std/syscalls/syscall_32.tbl +index 14d2e0581..4179a7f5b 100644 +--- a/compel/arch/x86/plugins/std/syscalls/syscall_32.tbl ++++ b/compel/arch/x86/plugins/std/syscalls/syscall_32.tbl +@@ -103,4 +103,5 @@ __NR_fsconfig 431 sys_fsconfig (int fd, unsigned int cmd, const char *key, co + __NR_fsmount 432 sys_fsmount (int fd, unsigned int flags, unsigned int attr_flags) + __NR_clone3 435 sys_clone3 (struct clone_args *uargs, size_t size) + __NR_pidfd_open 434 sys_pidfd_open (pid_t pid, unsigned int flags) ++__NR_openat2 437 sys_openat2 (int dirfd, char *pathname, struct open_how *how, size_t size) + __NR_pidfd_getfd 438 sys_pidfd_getfd (int pidfd, int targetfd, unsigned int flags) +diff --git a/compel/arch/x86/plugins/std/syscalls/syscall_64.tbl b/compel/arch/x86/plugins/std/syscalls/syscall_64.tbl +index 2f690f48f..9c27ab8b5 100644 +--- a/compel/arch/x86/plugins/std/syscalls/syscall_64.tbl ++++ b/compel/arch/x86/plugins/std/syscalls/syscall_64.tbl +@@ -114,4 +114,5 @@ __NR_fsconfig 431 sys_fsconfig (int fd, unsigned int cmd, const char *key, c + __NR_fsmount 432 sys_fsmount (int fd, unsigned int flags, unsigned int attr_flags) + __NR_clone3 435 sys_clone3 (struct clone_args *uargs, size_t size) + __NR_pidfd_open 434 sys_pidfd_open (pid_t pid, unsigned int flags) ++__NR_openat2 437 sys_openat2 (int dirfd, char *pathname, struct open_how *how, size_t size) + __NR_pidfd_getfd 438 sys_pidfd_getfd (int pidfd, int targetfd, unsigned int flags) +diff --git a/compel/plugins/include/uapi/std/syscall-types.h b/compel/plugins/include/uapi/std/syscall-types.h +index cc1969c01..1eea99daa 100644 +--- a/compel/plugins/include/uapi/std/syscall-types.h ++++ b/compel/plugins/include/uapi/std/syscall-types.h +@@ -40,6 +40,7 @@ struct rusage; + struct iocb; + struct pollfd; + struct clone_args; ++struct open_how; + + typedef unsigned long aio_context_t; + +diff --git a/criu/cr-check.c b/criu/cr-check.c +index 10d433650..52393cc8b 100644 +--- a/criu/cr-check.c ++++ b/criu/cr-check.c +@@ -1402,6 +1402,14 @@ static int check_move_mount_set_group(void) + return 0; + } + ++static int check_openat2(void) ++{ ++ if (!kdat.has_openat2) ++ return -1; ++ ++ return 0; ++} ++ + static int (*chk_feature)(void); + + /* +@@ -1523,6 +1531,7 @@ int cr_check(void) + ret |= check_sockopt_buf_lock(); + ret |= check_memfd_hugetlb(); + ret |= check_move_mount_set_group(); ++ ret |= check_openat2(); + } + + /* +@@ -1638,6 +1647,7 @@ static struct feature_list feature_list[] = { + { "sockopt_buf_lock", check_sockopt_buf_lock }, + { "memfd_hugetlb", check_memfd_hugetlb }, + { "move_mount_set_group", check_move_mount_set_group }, ++ { "openat2", check_openat2 }, + { NULL, NULL }, + }; + +diff --git a/criu/include/kerndat.h b/criu/include/kerndat.h +index f6e3b6133..de14028f5 100644 +--- a/criu/include/kerndat.h ++++ b/criu/include/kerndat.h +@@ -79,6 +79,7 @@ struct kerndat_s { + bool has_sockopt_buf_lock; + dev_t hugetlb_dev[HUGETLB_MAX]; + bool has_move_mount_set_group; ++ bool has_openat2; + }; + + extern struct kerndat_s kdat; +diff --git a/criu/include/linux/openat2.h b/criu/include/linux/openat2.h +new file mode 100644 +index 000000000..1e9ccff05 +--- /dev/null ++++ b/criu/include/linux/openat2.h +@@ -0,0 +1,18 @@ ++#ifndef _CRIU_LINUX_OPENAT2_H ++#define _CRIU_LINUX_OPENAT2_H ++ ++#include ++ ++#include "common/config.h" ++ ++#ifdef CONFIG_HAS_OPENAT2 ++#include ++#else ++struct open_how { ++ __u64 flags; ++ __u64 mode; ++ __u64 resolve; ++}; ++#endif ++ ++#endif +diff --git a/criu/include/mount-v2.h b/criu/include/mount-v2.h +index 396ed9594..a2e2fa1c8 100644 +--- a/criu/include/mount-v2.h ++++ b/criu/include/mount-v2.h +@@ -2,6 +2,7 @@ + #define __CR_MOUNT_V2_H__ + + #include "linux/mount.h" ++#include "linux/openat2.h" + + #include + +@@ -45,4 +46,13 @@ static inline int sys_open_tree(int dfd, const char *filename, unsigned int flag + return syscall(__NR_open_tree, dfd, filename, flags); + } + ++#ifndef RESOLVE_NO_XDEV ++#define RESOLVE_NO_XDEV 0x01 /* Block mount-point crossings (includes bind-mounts). */ ++#endif ++ ++static inline long sys_openat2(int dirfd, const char *pathname, struct open_how *how, size_t size) ++{ ++ return syscall(__NR_openat2, dirfd, pathname, how, size); ++} ++ + #endif /* __CR_MOUNT_V2_H__ */ +diff --git a/criu/kerndat.c b/criu/kerndat.c +index 5e49fc116..93617012a 100644 +--- a/criu/kerndat.c ++++ b/criu/kerndat.c +@@ -997,6 +997,22 @@ out: + return exit_code; + } + ++static int kerndat_has_openat2(void) ++{ ++ if (sys_openat2(AT_FDCWD, ".", NULL, 0) != -1) { ++ pr_err("openat2 should fail\n"); ++ return -1; ++ } ++ if (errno == ENOSYS) { ++ pr_debug("No openat2 syscall support\n"); ++ kdat.has_openat2 = false; ++ } else { ++ kdat.has_openat2 = true; ++ } ++ ++ return 0; ++} ++ + #define KERNDAT_CACHE_FILE KDAT_RUNDIR "/criu.kdat" + #define KERNDAT_CACHE_FILE_TMP KDAT_RUNDIR "/.criu.kdat" + +@@ -1586,6 +1602,10 @@ int kerndat_init(void) + pr_err("kerndat_has_move_mount_set_group failed when initializing kerndat.\n"); + ret = -1; + } ++ if (!ret && kerndat_has_openat2()) { ++ pr_err("kerndat_has_openat2 failed when initializing kerndat.\n"); ++ ret = -1; ++ } + + kerndat_lsm(); + kerndat_mmap_min_addr(); +diff --git a/scripts/feature-tests.mak b/scripts/feature-tests.mak +index 8df20afb7..592552cb8 100644 +--- a/scripts/feature-tests.mak ++++ b/scripts/feature-tests.mak +@@ -184,3 +184,15 @@ int main(void) + return memfd_create(NULL, 0); + } + endef ++ ++define FEATURE_TEST_OPENAT2 ++ ++#include ++ ++int main(void) ++{ ++ if (RESOLVE_NO_XDEV > 0) ++ return 0; ++ return 0; ++} ++endef +-- +2.35.1 + diff --git a/0206-util-add-resolve_mountpoint-helper.patch b/0206-util-add-resolve_mountpoint-helper.patch new file mode 100644 index 0000000..fb0b21d --- /dev/null +++ b/0206-util-add-resolve_mountpoint-helper.patch @@ -0,0 +1,159 @@ +From da16ce9766bc15aa7a623fe4c6e9af6275f943d3 Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Wed, 22 Dec 2021 19:26:32 +0300 +Subject: [PATCH 206/245] util: add resolve_mountpoint helper + +This helper would be useful to get mountpoints of source path of +external mounts without parsing host mountinfo. When we restore +mountpoint-external mount and we need to copy sharing from source via +MOVE_MOUNT_SET_GROUP, it would require from us to give it real +mountpoint of source path to be able to copy sharing group. + +This uses openat2 RESOLVE_NO_XDEV feature which detects crossing +mountpoint boundary instead of potentially slow mountinfo parsing. + +v3: coverity CID 389209: close fd only when it was opened + +Signed-off-by: Pavel Tikhomirov +--- + criu/include/util.h | 3 ++ + criu/util.c | 100 ++++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 103 insertions(+) + +diff --git a/criu/include/util.h b/criu/include/util.h +index 0df1fe266..5ccd24722 100644 +--- a/criu/include/util.h ++++ b/criu/include/util.h +@@ -403,4 +403,7 @@ extern int run_command(char *buf, size_t buf_size, int (*child_fn)(void *), void + */ + extern uint64_t criu_run_id; + extern void util_init(void); ++ ++extern char *resolve_mountpoint(char *path); ++ + #endif /* __CR_UTIL_H__ */ +diff --git a/criu/util.c b/criu/util.c +index f14e6467f..f8da4ac5c 100644 +--- a/criu/util.c ++++ b/criu/util.c +@@ -28,6 +28,7 @@ + #include + #include + #include ++#include + + #include "linux/mount.h" + +@@ -46,6 +47,7 @@ + #include "files.h" + #include "pstree.h" + #include "sched.h" ++#include "mount-v2.h" + + #include "cr-errno.h" + #include "action-scripts.h" +@@ -1887,3 +1889,101 @@ bool is_same_path(char *path1, char *path2) + + return true; + } ++ ++/* ++ * Checks if path is a mountpoint ++ * (path should be visible - no overmounts) ++ */ ++static int path_is_mountpoint(char *path, bool *is_mountpoint) ++{ ++ char *dname, *bname, *free_name; ++ struct open_how how = { ++ .flags = O_PATH, ++ .resolve = RESOLVE_NO_XDEV, ++ }; ++ int exit_code = -1; ++ int dfd, fd; ++ ++ dname = free_name = xstrdup(path); ++ if (!dname) ++ return -1; ++ dname = dirname(dname); ++ ++ bname = get_relative_path(path, dname); ++ if (!bname || *bname == '\0') { ++ pr_err("Failed to get bname for %s\n", path); ++ goto err_free; ++ } ++ ++ dfd = open(dname, O_PATH); ++ if (dfd < 0) { ++ pr_perror("Failed to open dir %s", dname); ++ goto err_free; ++ } ++ ++ fd = sys_openat2(dfd, bname, &how, sizeof(how)); ++ if (fd < 0) { ++ if (errno != EXDEV) { ++ pr_perror("Failed to open %s at %s", bname, dname); ++ goto err_close; ++ } ++ ++ /* ++ * EXDEV means that dfd and bname are from different ++ * mounts, meaning that bname is a mountpoint ++ */ ++ *is_mountpoint = true; ++ } else { ++ /* ++ * No error means that dfd and bname are from same mount, ++ * meaning that bname is not a mountpoint ++ */ ++ *is_mountpoint = false; ++ close(fd); ++ } ++ ++ exit_code = 0; ++err_close: ++ close(dfd); ++err_free: ++ xfree(free_name); ++ return exit_code; ++} ++ ++/* ++ * Resolves real mountpoint path by any path on it ++ * (path should be visible - no overmountes) ++ */ ++char *resolve_mountpoint(char *path) ++{ ++ char *mp_path, *free_path; ++ bool is_mountpoint; ++ ++ mp_path = free_path = xstrdup(path); ++ if (!mp_path) ++ return NULL; ++ ++ while (1) { ++ /* ++ * If we see "/" or "." we can't check if they are mountpoints ++ * by openat2 RESOLVE_NO_XDEV, let's just assume they are. ++ */ ++ if (is_same_path(mp_path, "/")) ++ return mp_path; ++ ++ if (path_is_mountpoint(mp_path, &is_mountpoint) == -1) { ++ xfree(free_path); ++ return NULL; ++ } ++ ++ if (is_mountpoint) ++ return mp_path; ++ ++ /* Try parent directory */ ++ mp_path = dirname(mp_path); ++ } ++ ++ /* never get here */ ++ xfree(free_path); ++ return NULL; ++} +-- +2.35.1 + diff --git a/0207-crtools-move-check_options-after-kerndat_init-and-lo.patch b/0207-crtools-move-check_options-after-kerndat_init-and-lo.patch new file mode 100644 index 0000000..8ecf6b5 --- /dev/null +++ b/0207-crtools-move-check_options-after-kerndat_init-and-lo.patch @@ -0,0 +1,41 @@ +From d077770b9acf0128bf8d3f02a37e5ce4d15883d2 Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Thu, 23 Dec 2021 17:19:49 +0300 +Subject: [PATCH 207/245] crtools: move check_options after kerndat_init and + log_init + +This can be useful to check options which depend on some kernel features +listed in kdat. + +Signed-off-by: Pavel Tikhomirov +--- + criu/crtools.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/criu/crtools.c b/criu/crtools.c +index 3c3491603..86aeb4d2b 100644 +--- a/criu/crtools.c ++++ b/criu/crtools.c +@@ -185,9 +185,6 @@ int main(int argc, char *argv[], char *envp[]) + return cr_service_work(atoi(argv[optind + 1])); + } + +- if (check_options()) +- return 1; +- + if (opts.imgs_dir == NULL) + SET_CHAR_OPTS(imgs_dir, "."); + +@@ -264,6 +261,9 @@ int main(int argc, char *argv[], char *envp[]) + return 1; + } + ++ if (check_options()) ++ return 1; ++ + if (fault_injected(FI_CANNOT_MAP_VDSO)) + kdat.can_map_vdso = 0; + +-- +2.35.1 + diff --git a/0208-config-rpc-add-new-option-mntns-compat-mode-for-old-.patch b/0208-config-rpc-add-new-option-mntns-compat-mode-for-old-.patch new file mode 100644 index 0000000..1cb6660 --- /dev/null +++ b/0208-config-rpc-add-new-option-mntns-compat-mode-for-old-.patch @@ -0,0 +1,230 @@ +From 4bfe5acc009d600e037758938616656a257c8dfb Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Mon, 25 May 2020 17:43:48 +0300 +Subject: [PATCH 208/245] config/rpc: add new option --mntns-compat-mode for + old mount engine + +We plan to switch to Mounts-v2 engine for restoring mounts by default, +this options is to allow switching to old engine. This patch only adds +an option, no engine behind it yet. + +Cherry-picked from Virtuozzo criu: +https://src.openvz.org/projects/OVZ/repos/criu/commits/503f9ad2c + +Changes: allow --mntns-compat-mode option only on restore and only if +MOVE_MOUNT_SET_GROUP is supported (this also requires change in +unittest/mock.c), change id in rpc criu_opts. + +Signed-off-by: Pavel Tikhomirov +--- + criu/Makefile.crtools | 1 + + criu/config.c | 12 ++++++++++++ + criu/cr-service.c | 3 +++ + criu/crtools.c | 3 +++ + criu/include/cr_options.h | 2 ++ + criu/include/mount-v2.h | 2 ++ + criu/mount-v2.c | 20 ++++++++++++++++++++ + criu/unittest/mock.c | 5 +++++ + images/rpc.proto | 1 + + lib/c/criu.c | 11 +++++++++++ + lib/c/criu.h | 2 ++ + 11 files changed, 62 insertions(+) + create mode 100644 criu/mount-v2.c + +diff --git a/criu/Makefile.crtools b/criu/Makefile.crtools +index 46d7fd424..22108cce0 100644 +--- a/criu/Makefile.crtools ++++ b/criu/Makefile.crtools +@@ -41,6 +41,7 @@ obj-y += lsm.o + obj-y += mem.o + obj-y += memfd.o + obj-y += mount.o ++obj-y += mount-v2.o + obj-y += filesystems.o + obj-y += namespaces.o + obj-y += netfilter.o +diff --git a/criu/config.c b/criu/config.c +index 4a8338423..8b6d105ae 100644 +--- a/criu/config.c ++++ b/criu/config.c +@@ -20,6 +20,7 @@ + #include "file-lock.h" + #include "irmap.h" + #include "mount.h" ++#include "mount-v2.h" + #include "namespaces.h" + #include "net.h" + #include "sk-inet.h" +@@ -697,6 +698,7 @@ int parse_options(int argc, char **argv, bool *usage_error, bool *has_exec_cmd, + { "file-validation", required_argument, 0, 1098 }, + { "lsm-mount-context", required_argument, 0, 1099 }, + { "network-lock", required_argument, 0, 1100 }, ++ BOOL_OPT("mntns-compat-mode", &opts.mntns_compat_mode), + {}, + }; + +@@ -1103,6 +1105,16 @@ int check_options(void) + } + #endif + ++ if (opts.mntns_compat_mode && opts.mode != CR_RESTORE) { ++ pr_err("Option --mntns-compat-mode is only valid on restore\n"); ++ return 1; ++ } else if (!opts.mntns_compat_mode && opts.mode == CR_RESTORE) { ++ if (check_mount_v2()) { ++ pr_warn("Mount engine fallback to --mntns-compat-mode mode\n"); ++ opts.mntns_compat_mode = true; ++ } ++ } ++ + if (check_namespace_opts()) { + pr_err("Error: namespace flags conflict\n"); + return 1; +diff --git a/criu/cr-service.c b/criu/cr-service.c +index 59f46b320..a6eb9ebd3 100644 +--- a/criu/cr-service.c ++++ b/criu/cr-service.c +@@ -719,6 +719,9 @@ static int setup_opts_from_req(int sk, CriuOpts *req) + goto err; + } + ++ if (req->mntns_compat_mode) ++ opts.mntns_compat_mode = true; ++ + log_set_loglevel(opts.log_level); + if (check_options()) + goto err; +diff --git a/criu/crtools.c b/criu/crtools.c +index 86aeb4d2b..cc8d9179f 100644 +--- a/criu/crtools.c ++++ b/criu/crtools.c +@@ -408,6 +408,9 @@ usage: + " in lazy-pages mode: 'criu lazy-pages -D DIR'\n" + " --lazy-pages and lazy-pages mode require userfaultfd\n" + " --stream dump/restore images using criu-image-streamer\n" ++ " --mntns-compat-mode Use mount engine in compatibility mode. By default criu\n" ++ " tries to use mount-v2 mode with more reliable algorithm\n" ++ " based on MOVE_MOUNT_SET_GROUP kernel feature\n" + " --network-lock METHOD\n" + " network locking/unlocking method; argument\n" + " can be 'nftables' or 'iptables' (default).\n" +diff --git a/criu/include/cr_options.h b/criu/include/cr_options.h +index 85648bf1c..bf1a762cc 100644 +--- a/criu/include/cr_options.h ++++ b/criu/include/cr_options.h +@@ -207,6 +207,8 @@ struct cr_options { + + /* Shows the mode criu is running at the moment: dump/pre-dump/restore/... */ + enum criu_mode mode; ++ ++ int mntns_compat_mode; + }; + + extern struct cr_options opts; +diff --git a/criu/include/mount-v2.h b/criu/include/mount-v2.h +index a2e2fa1c8..61f62966d 100644 +--- a/criu/include/mount-v2.h ++++ b/criu/include/mount-v2.h +@@ -55,4 +55,6 @@ static inline long sys_openat2(int dirfd, const char *pathname, struct open_how + return syscall(__NR_openat2, dirfd, pathname, how, size); + } + ++extern int check_mount_v2(void); ++ + #endif /* __CR_MOUNT_V2_H__ */ +diff --git a/criu/mount-v2.c b/criu/mount-v2.c +new file mode 100644 +index 000000000..801ade748 +--- /dev/null ++++ b/criu/mount-v2.c +@@ -0,0 +1,20 @@ ++#include "kerndat.h" ++#include "log.h" ++ ++#undef LOG_PREFIX ++#define LOG_PREFIX "mnt-v2: " ++ ++int check_mount_v2(void) ++{ ++ if (!kdat.has_move_mount_set_group) { ++ pr_warn("Mounts-v2 requires MOVE_MOUNT_SET_GROUP support\n"); ++ return -1; ++ } ++ ++ if (!kdat.has_openat2) { ++ pr_warn("Mounts-v2 requires openat2 support\n"); ++ return -1; ++ } ++ ++ return 0; ++} +diff --git a/criu/unittest/mock.c b/criu/unittest/mock.c +index 127cc7498..dc5b627f7 100644 +--- a/criu/unittest/mock.c ++++ b/criu/unittest/mock.c +@@ -136,3 +136,8 @@ struct kerndat_s kdat = {}; + int service_fd_rlim_cur; + + unsigned __page_size; ++ ++int check_mount_v2(void) ++{ ++ return 0; ++} +diff --git a/images/rpc.proto b/images/rpc.proto +index 1d3befd23..a6cc5da48 100644 +--- a/images/rpc.proto ++++ b/images/rpc.proto +@@ -137,6 +137,7 @@ message criu_opts { + optional int32 pidfd_store_sk = 62; + optional string lsm_mount_context = 63; + optional criu_network_lock_method network_lock = 64 [default = IPTABLES]; ++ optional bool mntns_compat_mode = 65; + /* optional bool check_mounts = 128; */ + } + +diff --git a/lib/c/criu.c b/lib/c/criu.c +index dea5896f7..7807d7bc5 100644 +--- a/lib/c/criu.c ++++ b/lib/c/criu.c +@@ -1170,6 +1170,17 @@ int criu_set_page_server_address_port(const char *address, int port) + return criu_local_set_page_server_address_port(global_opts, address, port); + } + ++void criu_local_set_mntns_compat_mode(criu_opts *opts, bool val) ++{ ++ opts->rpc->has_mntns_compat_mode = true; ++ opts->rpc->mntns_compat_mode = val; ++} ++ ++void criu_set_mntns_compat_mode(bool val) ++{ ++ criu_local_set_mntns_compat_mode(global_opts, val); ++} ++ + static CriuResp *recv_resp(int socket_fd) + { + struct msghdr msg_hdr = { 0 }; +diff --git a/lib/c/criu.h b/lib/c/criu.h +index aed2c3481..40e3106fc 100644 +--- a/lib/c/criu.h ++++ b/lib/c/criu.h +@@ -112,6 +112,7 @@ int criu_set_pre_dump_mode(enum criu_pre_dump_mode mode); + void criu_set_pidfd_store_sk(int sk); + int criu_set_network_lock(enum criu_network_lock_method method); + int criu_join_ns_add(const char *ns, const char *ns_file, const char *extra_opt); ++void criu_set_mntns_compat_mode(bool val); + + /* + * The criu_notify_arg_t na argument is an opaque +@@ -275,6 +276,7 @@ int criu_local_set_pre_dump_mode(criu_opts *opts, enum criu_pre_dump_mode mode); + void criu_local_set_pidfd_store_sk(criu_opts *opts, int sk); + int criu_local_set_network_lock(criu_opts *opts, enum criu_network_lock_method method); + int criu_local_join_ns_add(criu_opts *opts, const char *ns, const char *ns_file, const char *extra_opt); ++void criu_local_set_mntns_compat_mode(criu_opts *opts, bool val); + + void criu_local_set_notify_cb(criu_opts *opts, int (*cb)(char *action, criu_notify_arg_t na)); + +-- +2.35.1 + diff --git a/0209-mount-add-plain-mountpoints.patch b/0209-mount-add-plain-mountpoints.patch new file mode 100644 index 0000000..509ee1d --- /dev/null +++ b/0209-mount-add-plain-mountpoints.patch @@ -0,0 +1,131 @@ +From 71ace0aa142e5c94d055c41e90581c98f9c90be0 Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Thu, 28 May 2020 11:30:16 +0300 +Subject: [PATCH 209/245] mount: add plain mountpoints + +This is a preparation of mounts-v2 new algorithm for mount restore, we +add an alternative mountpoints to each mount, so that if we mount mounts +in these mountpoints they will be "plain": each mount in separate +sub-directory of root_yard, mounts will be mounted without tree. Tree +reconstruction will be done in separate step. + +Cherry-picked from Virtuozzo criu: +https://src.openvz.org/projects/OVZ/repos/criu/commits/5e6de171a + +Changes: improve get_plain_mountpoint(). + +Signed-off-by: Pavel Tikhomirov +--- + criu/include/mount.h | 3 +++ + criu/mount.c | 39 +++++++++++++++++++++++++++++++++++++++ + 2 files changed, 42 insertions(+) + +diff --git a/criu/include/mount.h b/criu/include/mount.h +index 8eb4ddf9b..588aedf99 100644 +--- a/criu/include/mount.h ++++ b/criu/include/mount.h +@@ -48,6 +48,7 @@ struct mount_info { + */ + char *mountpoint; + char *ns_mountpoint; ++ char *plain_mountpoint; + int fd; + unsigned flags; + unsigned sb_flags; +@@ -168,6 +169,8 @@ extern int read_mnt_ns_img(void); + extern void cleanup_mnt_ns(void); + extern void clean_cr_time_mounts(void); + ++extern char *get_plain_mountpoint(int mnt_id, char *name); ++ + extern bool add_skip_mount(const char *mountpoint); + struct ns_id; + extern int get_sdev_from_fd(int fd, unsigned int *sdev, bool parse_mountinfo); +diff --git a/criu/mount.c b/criu/mount.c +index bddfe2e7f..64ef2f233 100644 +--- a/criu/mount.c ++++ b/criu/mount.c +@@ -49,6 +49,10 @@ static LIST_HEAD(delayed_unbindable); + + char *service_mountpoint(const struct mount_info *mi) + { ++ if (!opts.mntns_compat_mode && opts.mode == CR_RESTORE) { ++ BUG_ON(!mi->plain_mountpoint); ++ return mi->plain_mountpoint; ++ } + return mi->mountpoint; + } + +@@ -1627,6 +1631,28 @@ err: + return -1; + } + ++/* ++ * Helper for getting a path to mount's plain mountpoint ++ */ ++char *get_plain_mountpoint(int mnt_id, char *name) ++{ ++ static char tmp[PATH_MAX]; ++ int ret; ++ ++ if (!mnt_roots) ++ return NULL; ++ ++ if (name) ++ ret = snprintf(tmp, sizeof(tmp), "%s/mnt-%s", mnt_roots, name); ++ else ++ ret = snprintf(tmp, sizeof(tmp), "%s/mnt-%010d", mnt_roots, mnt_id); ++ ++ if (ret >= sizeof(tmp)) ++ return NULL; ++ ++ return xstrdup(tmp); ++} ++ + static __maybe_unused struct mount_info *add_cr_time_mount(struct mount_info *root, char *fsname, const char *path, + unsigned int s_dev, bool rst) + { +@@ -1654,6 +1680,11 @@ static __maybe_unused struct mount_info *add_cr_time_mount(struct mount_info *ro + sprintf(mi->mountpoint, "%s%s", root->mountpoint, path); + else + sprintf(mi->mountpoint, "%s/%s", root->mountpoint, path); ++ if (rst) { ++ mi->plain_mountpoint = get_plain_mountpoint(-1, "crtime"); ++ if (!mi->plain_mountpoint) ++ goto err; ++ } + mi->mnt_id = HELPER_MNT_ID; + mi->flags = mi->sb_flags = 0; + mi->root = xstrdup("/"); +@@ -2995,6 +3026,7 @@ void mnt_entry_free(struct mount_info *mi) + if (mi) { + xfree(mi->root); + xfree(mi->mountpoint); ++ xfree(mi->plain_mountpoint); + xfree(mi->source); + xfree(mi->options); + xfree(mi->fsname); +@@ -3120,6 +3152,10 @@ static int get_mp_mountpoint(char *mountpoint, struct mount_info *mi, char *root + + mi->ns_mountpoint = mi->mountpoint + root_len; + ++ mi->plain_mountpoint = get_plain_mountpoint(mi->mnt_id, NULL); ++ if (!mi->plain_mountpoint) ++ return -1; ++ + pr_debug("\t\tWill mount %d @ %s %s\n", mi->mnt_id, service_mountpoint(mi), mi->ns_mountpoint); + return 0; + } +@@ -3293,6 +3329,9 @@ static int merge_mount_trees(void) + return -1; + + root_yard_mp->mountpoint = mnt_roots; ++ root_yard_mp->plain_mountpoint = xstrdup(mnt_roots); ++ if (!root_yard_mp->plain_mountpoint) ++ return -1; + root_yard_mp->mounted = true; + root_yard_mp->mnt_bind_is_populated = true; + root_yard_mp->is_overmounted = false; +-- +2.35.1 + diff --git a/0210-files-reg-export-parent-dirs-helpers-for-mount-v2.patch b/0210-files-reg-export-parent-dirs-helpers-for-mount-v2.patch new file mode 100644 index 0000000..268302a --- /dev/null +++ b/0210-files-reg-export-parent-dirs-helpers-for-mount-v2.patch @@ -0,0 +1,48 @@ +From 19d0fad36fc1e52e1202e439c702f155ff67b395 Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Tue, 21 Dec 2021 12:14:23 +0300 +Subject: [PATCH 210/245] files-reg: export parent dirs helpers for mount-v2 + +Signed-off-by: Pavel Tikhomirov +--- + criu/files-reg.c | 4 ++-- + criu/include/files-reg.h | 3 +++ + 2 files changed, 5 insertions(+), 2 deletions(-) + +diff --git a/criu/files-reg.c b/criu/files-reg.c +index 636853ac8..e998b3040 100644 +--- a/criu/files-reg.c ++++ b/criu/files-reg.c +@@ -1873,7 +1873,7 @@ out: + return ret; + } + +-static int rm_parent_dirs(int mntns_root, char *path, int count) ++int rm_parent_dirs(int mntns_root, char *path, int count) + { + char *p, *prev = NULL; + int ret = -1; +@@ -1912,7 +1912,7 @@ err: + } + + /* Construct parent dir name and mkdir parent/grandparents if they're not exist */ +-static int make_parent_dirs_if_need(int mntns_root, char *path) ++int make_parent_dirs_if_need(int mntns_root, char *path) + { + char *p, *last_delim; + int err, count = 0; +diff --git a/criu/include/files-reg.h b/criu/include/files-reg.h +index 953d50288..d4934c4ae 100644 +--- a/criu/include/files-reg.h ++++ b/criu/include/files-reg.h +@@ -58,4 +58,7 @@ static inline int link_strip_deleted(struct fd_link *link) + + extern int dead_pid_conflict(void); + ++extern int rm_parent_dirs(int mntns_root, char *path, int count); ++extern int make_parent_dirs_if_need(int mntns_root, char *path); ++ + #endif /* __CR_FILES_REG_H__ */ +-- +2.35.1 + diff --git a/0211-mount-remove-double-ns_id-declaration.patch b/0211-mount-remove-double-ns_id-declaration.patch new file mode 100644 index 0000000..fca6582 --- /dev/null +++ b/0211-mount-remove-double-ns_id-declaration.patch @@ -0,0 +1,27 @@ +From dd282f4655fc487554fe69476218093921107c6c Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Tue, 21 Dec 2021 12:43:42 +0300 +Subject: [PATCH 211/245] mount: remove double ns_id declaration + +Fixes: d0d117986 ("mount: move functions about mounts from proc_parse.h") + +Signed-off-by: Pavel Tikhomirov +--- + criu/include/mount.h | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/criu/include/mount.h b/criu/include/mount.h +index 588aedf99..562b0cd9b 100644 +--- a/criu/include/mount.h ++++ b/criu/include/mount.h +@@ -172,7 +172,6 @@ extern void clean_cr_time_mounts(void); + extern char *get_plain_mountpoint(int mnt_id, char *name); + + extern bool add_skip_mount(const char *mountpoint); +-struct ns_id; + extern int get_sdev_from_fd(int fd, unsigned int *sdev, bool parse_mountinfo); + extern struct mount_info *parse_mountinfo(pid_t pid, struct ns_id *nsid, bool for_dump); + +-- +2.35.1 + diff --git a/0212-mount-export-common-defines-for-mount-v2.patch b/0212-mount-export-common-defines-for-mount-v2.patch new file mode 100644 index 0000000..1ebd1c2 --- /dev/null +++ b/0212-mount-export-common-defines-for-mount-v2.patch @@ -0,0 +1,74 @@ +From 3aa6f0cee2cf05ad2cc2aa571921cd75f2b864bc Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Tue, 21 Dec 2021 12:46:57 +0300 +Subject: [PATCH 212/245] mount: export common defines for mount-v2 + +Signed-off-by: Pavel Tikhomirov +--- + criu/include/mount.h | 14 ++++++++++++++ + criu/mount.c | 14 -------------- + 2 files changed, 14 insertions(+), 14 deletions(-) + +diff --git a/criu/include/mount.h b/criu/include/mount.h +index 562b0cd9b..dfb9989c0 100644 +--- a/criu/include/mount.h ++++ b/criu/include/mount.h +@@ -10,6 +10,20 @@ struct pstree_item; + struct fstype; + struct ns_id; + ++#define MS_PROPAGATE (MS_SHARED | MS_PRIVATE | MS_UNBINDABLE | MS_SLAVE) ++ ++/* ++ * Here are a set of flags which we know how to handle for the one mount call. ++ * All of them except MS_RDONLY are set only as mnt flags. ++ * MS_RDONLY is set for both mnt ans sb flags, so we can restore it for one ++ * mount call only if it set for both masks. ++ */ ++#define MS_MNT_KNOWN_FLAGS (MS_NOSUID | MS_NOEXEC | MS_NODEV | MS_NOATIME | MS_NODIRATIME | MS_RELATIME | MS_RDONLY) ++ ++#define BINFMT_MISC_HOME "proc/sys/fs/binfmt_misc" ++ ++#define HELPER_MNT_ID 0 ++ + #define MOUNT_INVALID_DEV (0) + + #define MNT_UNREACHABLE INT_MIN +diff --git a/criu/mount.c b/criu/mount.c +index 64ef2f233..d796c9341 100644 +--- a/criu/mount.c ++++ b/criu/mount.c +@@ -31,15 +31,9 @@ + + #include "images/mnt.pb-c.h" + +-#define MS_PROPAGATE (MS_SHARED | MS_PRIVATE | MS_UNBINDABLE | MS_SLAVE) +- + #undef LOG_PREFIX + #define LOG_PREFIX "mnt: " + +-#define BINFMT_MISC_HOME "proc/sys/fs/binfmt_misc" +- +-#define HELPER_MNT_ID 0 +- + #define CONTEXT_OPT "context=" + + /* A helper mount_info entry for the roots yard */ +@@ -2210,14 +2204,6 @@ static int fetch_rt_stat(struct mount_info *m, const char *where) + return 0; + } + +-/* +- * Here are a set of flags which we know how to handle for the one mount call. +- * All of them except MS_RDONLY are set only as mnt flags. +- * MS_RDONLY is set for both mnt ans sb flags, so we can restore it for one +- * mount call only if it set for both masks. +- */ +-#define MS_MNT_KNOWN_FLAGS (MS_NOSUID | MS_NOEXEC | MS_NODEV | MS_NOATIME | MS_NODIRATIME | MS_RELATIME | MS_RDONLY) +- + static int do_simple_mount(struct mount_info *mi, const char *src, const char *fstype, unsigned long mountflags) + { + int ret = mount(src, service_mountpoint(mi), fstype, mountflags, mi->options); +-- +2.35.1 + diff --git a/0213-mount-export-several-functions-for-mount-v2.patch b/0213-mount-export-several-functions-for-mount-v2.patch new file mode 100644 index 0000000..29ac575 --- /dev/null +++ b/0213-mount-export-several-functions-for-mount-v2.patch @@ -0,0 +1,150 @@ +From 830934745e70c0837bf6c657540773243d3c5e16 Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Tue, 21 Dec 2021 13:29:52 +0300 +Subject: [PATCH 213/245] mount: export several functions for mount-v2 + +Signed-off-by: Pavel Tikhomirov +--- + criu/include/mount.h | 14 ++++++++++++++ + criu/mount.c | 28 ++++++++++++---------------- + 2 files changed, 26 insertions(+), 16 deletions(-) + +diff --git a/criu/include/mount.h b/criu/include/mount.h +index dfb9989c0..914024544 100644 +--- a/criu/include/mount.h ++++ b/criu/include/mount.h +@@ -209,4 +209,18 @@ extern struct mount_info *mnt_bind_pick(struct mount_info *mi, + extern int mnt_tree_for_each(struct mount_info *start, int (*fn)(struct mount_info *)); + + extern char *service_mountpoint(const struct mount_info *mi); ++ ++extern int validate_mounts(struct mount_info *info, bool for_dump); ++extern __maybe_unused struct mount_info *add_cr_time_mount(struct mount_info *root, char *fsname, const char *path, ++ unsigned int s_dev, bool rst); ++extern char *resolve_source(struct mount_info *mi); ++extern int fetch_rt_stat(struct mount_info *m, const char *where); ++extern int do_simple_mount(struct mount_info *mi, const char *src, const char *fstype, unsigned long mountflags); ++extern char *mnt_fsname(struct mount_info *mi); ++extern int apply_sb_flags(void *args, int fd, pid_t pid); ++extern int mount_root(void *args, int fd, pid_t pid); ++extern int restore_ext_mount(struct mount_info *mi); ++extern int cr_pivot_root(char *root); ++extern int print_ns_root(struct ns_id *ns, int remap_id, char *buf, int bs); ++ + #endif /* __CR_MOUNT_H__ */ +diff --git a/criu/mount.c b/criu/mount.c +index d796c9341..7549284d9 100644 +--- a/criu/mount.c ++++ b/criu/mount.c +@@ -693,7 +693,7 @@ static int validate_children_collision(struct mount_info *mnt) + return 0; + } + +-static int validate_mounts(struct mount_info *info, bool for_dump) ++int validate_mounts(struct mount_info *info, bool for_dump) + { + struct mount_info *m, *t; + +@@ -1647,8 +1647,8 @@ char *get_plain_mountpoint(int mnt_id, char *name) + return xstrdup(tmp); + } + +-static __maybe_unused struct mount_info *add_cr_time_mount(struct mount_info *root, char *fsname, const char *path, +- unsigned int s_dev, bool rst) ++struct mount_info __maybe_unused *add_cr_time_mount(struct mount_info *root, char *fsname, const char *path, ++ unsigned int s_dev, bool rst) + { + struct mount_info *mi, *t, *parent; + bool add_slash = false; +@@ -1993,7 +1993,7 @@ static int mnt_tree_for_each_reverse(struct mount_info *m, int (*fn)(struct moun + return 0; + } + +-static char *resolve_source(struct mount_info *mi) ++char *resolve_source(struct mount_info *mi) + { + if (kdev_major(mi->s_dev) == 0) + /* +@@ -2191,7 +2191,7 @@ skip_parent: + return 0; + } + +-static int fetch_rt_stat(struct mount_info *m, const char *where) ++int fetch_rt_stat(struct mount_info *m, const char *where) + { + struct stat st; + +@@ -2204,7 +2204,7 @@ static int fetch_rt_stat(struct mount_info *m, const char *where) + return 0; + } + +-static int do_simple_mount(struct mount_info *mi, const char *src, const char *fstype, unsigned long mountflags) ++int do_simple_mount(struct mount_info *mi, const char *src, const char *fstype, unsigned long mountflags) + { + int ret = mount(src, service_mountpoint(mi), fstype, mountflags, mi->options); + if (ret) +@@ -2212,7 +2212,7 @@ static int do_simple_mount(struct mount_info *mi, const char *src, const char *f + return ret; + } + +-static char *mnt_fsname(struct mount_info *mi) ++char *mnt_fsname(struct mount_info *mi) + { + if (mi->fstype->code == FSTYPE__AUTO) + return mi->fsname; +@@ -2240,12 +2240,12 @@ static int userns_mount(char *src, void *args, int fd, pid_t pid) + return err; + } + +-static int apply_sb_flags(void *args, int fd, pid_t pid) ++int apply_sb_flags(void *args, int fd, pid_t pid) + { + return userns_mount(NULL, args, fd, pid); + } + +-static int mount_root(void *args, int fd, pid_t pid) ++int mount_root(void *args, int fd, pid_t pid) + { + return userns_mount(opts.root, args, fd, pid); + } +@@ -2315,7 +2315,7 @@ static int do_new_mount(struct mount_info *mi) + return 0; + } + +-static int restore_ext_mount(struct mount_info *mi) ++int restore_ext_mount(struct mount_info *mi) + { + int ret; + +@@ -2802,10 +2802,6 @@ static int do_umount_one(struct mount_info *mi) + * roots_yard where it will be restored. The remapped mount will be + * moved to the right places after restoring all mounts. + */ +- +-static inline int print_ns_root(struct ns_id *ns, int remap_id, char *buf, int bs); +-static int get_mp_mountpoint(char *mountpoint, struct mount_info *mi, char *root, int root_len); +- + static LIST_HEAD(mnt_remap_list); + static int remap_id; + +@@ -2904,7 +2900,7 @@ static int fixup_remap_mounts(void) + return 0; + } + +-static int cr_pivot_root(char *root) ++int cr_pivot_root(char *root) + { + char tmp_dir_tmpl[] = "crtools-put-root.XXXXXX"; + bool tmp_dir = false; +@@ -3024,7 +3020,7 @@ void mnt_entry_free(struct mount_info *mi) + * Helper for getting a path to where the namespace's root + * is re-constructed. + */ +-static inline int print_ns_root(struct ns_id *ns, int remap_id, char *buf, int bs) ++int print_ns_root(struct ns_id *ns, int remap_id, char *buf, int bs) + { + return snprintf(buf, bs, "%s/%d-%010d", mnt_roots, ns->id, remap_id); + } +-- +2.35.1 + diff --git a/0214-mount-export-global-variables-for-mount-v2.patch b/0214-mount-export-global-variables-for-mount-v2.patch new file mode 100644 index 0000000..1722371 --- /dev/null +++ b/0214-mount-export-global-variables-for-mount-v2.patch @@ -0,0 +1,50 @@ +From 270ea3e162fd31245b92bb1c64cafd00cadedd93 Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Tue, 21 Dec 2021 14:04:19 +0300 +Subject: [PATCH 214/245] mount: export global variables for mount-v2 + +Export root_yard_mp and it's mntns_roots. + +Signed-off-by: Pavel Tikhomirov +--- + criu/include/mount.h | 3 +++ + criu/mount.c | 4 ++-- + 2 files changed, 5 insertions(+), 2 deletions(-) + +diff --git a/criu/include/mount.h b/criu/include/mount.h +index 914024544..c16a5c293 100644 +--- a/criu/include/mount.h ++++ b/criu/include/mount.h +@@ -223,4 +223,7 @@ extern int restore_ext_mount(struct mount_info *mi); + extern int cr_pivot_root(char *root); + extern int print_ns_root(struct ns_id *ns, int remap_id, char *buf, int bs); + ++extern struct mount_info *root_yard_mp; ++extern char *mnt_roots; ++ + #endif /* __CR_MOUNT_H__ */ +diff --git a/criu/mount.c b/criu/mount.c +index 7549284d9..c39b44ac6 100644 +--- a/criu/mount.c ++++ b/criu/mount.c +@@ -37,7 +37,7 @@ + #define CONTEXT_OPT "context=" + + /* A helper mount_info entry for the roots yard */ +-static struct mount_info *root_yard_mp = NULL; ++struct mount_info *root_yard_mp = NULL; + + static LIST_HEAD(delayed_unbindable); + +@@ -349,7 +349,7 @@ static bool mounts_equal(struct mount_info *a, struct mount_info *b) + * mnt_roots is a temporary directory for restoring sub-trees of + * non-root namespaces. + */ +-static char *mnt_roots; ++char *mnt_roots; + + static struct mount_info *mnt_build_ids_tree(struct mount_info *list) + { +-- +2.35.1 + diff --git a/0215-mount-add-new-mounts-v2-engine.patch b/0215-mount-add-new-mounts-v2-engine.patch new file mode 100644 index 0000000..5caf98d --- /dev/null +++ b/0215-mount-add-new-mounts-v2-engine.patch @@ -0,0 +1,1495 @@ +From 2b18e8004dcebda432cd9cedb069eef9126148ad Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Mon, 25 May 2020 18:12:49 +0300 +Subject: [PATCH 215/245] mount: add new mounts-v2 engine + +Design of mounts-v2: + + As a preparation step we classify mounts in groups by (shared_id, + master_id) in new resolve_shared_mounts_v2 (just after reading images). + + New function prepare_mnt_ns_v2 is our main entry point when switching + from old mount engine to new one actually happens. + + First we pre-create each mount namespace nearly empty, only with root + yard in place (pre_create_mount_namespaces). + + We walk the mount tree and mount each mount similar to old mount + engine but not in mount tree but as a sub-directory of root yard + (plain mountpoint) in service (criu) mount namespace. Also we + bind this mount from service mntns to real mntns just after creation. + (do_mount_in_right_mntns) + + Note: this way we initially have the final mount which would be + visible to restored container user with right mnt_id for the sake of + e.g. creating unix sockets on it (for unix socket bindmounts), and + both have copy of the mount in service mntns so that old code which + accesses files on mounts through service mntns still can acces them. + + New can_mount_now_v2 is now free from heuristics we had for restoring + shared groups, we will restore them later via MOVE_MOUNT_SET_GROUP, + for now everything is private. + + Now when all plain mount are created in real mount namespaces, we can + move them to the tree for each namespace. Also we open fds on the + mountpoint: one mp_fd_id before moving and another mnt_fd_id after, + so that we can access each file later from final mntns via those fds. + (assemble_mount_namespaces) + + New restore_mount_sharing_options walks each root sharing group and + their descendants with dfs tree walk. It creates sharing for the first + mount in the sharing group and then sets the same sharing on all other + mounts in this group. + + Sharing creation for fist mount is two step: + + a) If mount has master_id we either copy shared_id from parent sharing + group or from external source and then make mount slave thus + converting it to right master_id. + b) Next if mount has shared_id we just make us shared, creating right + shared_id. + +Cherry-picked from Virtuozzo criu: +https://src.openvz.org/projects/OVZ/repos/criu/commits/596651d02 + +Changes: +- Split all "exporting" to separate preparational patches +- Rework cr_time +- Switch to MOVE_MOUNT_SET_GROUP +- Use resolve_mountpoint for external mounts (for MOVE_MOUNT_SET_GROUP) +- Mounting plain mounts both in service and in restored-final mntns +- Call MOVE_MOUNT_SET_GROUP from usernsd +- Rework can_mount_now_v2 to handle bind of both root and external. +- Use sys_move_mount for mount assembling. + +Signed-off-by: Pavel Tikhomirov +--- + criu/include/mount-v2.h | 35 ++ + criu/include/mount.h | 10 + + criu/mount-v2.c | 1246 +++++++++++++++++++++++++++++++++++++++ + criu/mount.c | 16 + + 4 files changed, 1307 insertions(+) + +diff --git a/criu/include/mount-v2.h b/criu/include/mount-v2.h +index 61f62966d..2f2812221 100644 +--- a/criu/include/mount-v2.h ++++ b/criu/include/mount-v2.h +@@ -4,6 +4,8 @@ + #include "linux/mount.h" + #include "linux/openat2.h" + ++#include "common/list.h" ++ + #include + + #ifndef MOVE_MOUNT_SET_GROUP +@@ -57,4 +59,37 @@ static inline long sys_openat2(int dirfd, const char *pathname, struct open_how + + extern int check_mount_v2(void); + ++struct sharing_group { ++ /* This pair identifies the group */ ++ int shared_id; ++ int master_id; ++ ++ /* List of shared groups */ ++ struct list_head list; ++ ++ /* List of mounts in this group */ ++ struct list_head mnt_list; ++ ++ /* ++ * List of dependant shared groups: ++ * - all siblings have equal master_id ++ * - the parent has shared_id equal to children's master_id ++ * ++ * This is a bit tricky: parent pointer indicates if there is one ++ * parent sharing_group in list or only siblings. ++ * So for traversal if parent pointer is set we can do: ++ * list_for_each_entry(t, &sg->parent->children, siblings) ++ * and overvise we can do: ++ * list_for_each_entry(t, &sg->siblings, siblings) ++ */ ++ struct list_head children; ++ struct list_head siblings; ++ struct sharing_group *parent; ++ ++ char *source; ++}; ++ ++extern int resolve_shared_mounts_v2(void); ++extern int prepare_mnt_ns_v2(void); ++ + #endif /* __CR_MOUNT_V2_H__ */ +diff --git a/criu/include/mount.h b/criu/include/mount.h +index c16a5c293..4d2d64470 100644 +--- a/criu/include/mount.h ++++ b/criu/include/mount.h +@@ -62,7 +62,15 @@ struct mount_info { + */ + char *mountpoint; + char *ns_mountpoint; ++ ++ /* Mount-v2 specific */ + char *plain_mountpoint; ++ int is_dir; ++ int mp_fd_id; ++ int mnt_fd_id; ++ struct sharing_group *sg; ++ struct list_head mnt_sharing; ++ + int fd; + unsigned flags; + unsigned sb_flags; +@@ -79,6 +87,8 @@ struct mount_info { + bool need_plugin; + bool is_ns_root; + bool deleted; ++ int deleted_level; ++ struct list_head deleted_list; + struct mount_info *next; + struct ns_id *nsid; + +diff --git a/criu/mount-v2.c b/criu/mount-v2.c +index 801ade748..ec3965140 100644 +--- a/criu/mount-v2.c ++++ b/criu/mount-v2.c +@@ -1,9 +1,35 @@ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ + #include "kerndat.h" + #include "log.h" ++#include "cr_options.h" ++#include "xmalloc.h" ++#include "util.h" ++#include "filesystems.h" ++#include "mount.h" ++#include "mount-v2.h" ++#include "namespaces.h" ++#include "fs-magic.h" ++#include "path.h" ++#include "files-reg.h" ++#include "fdstore.h" ++#include "common/list.h" ++#include "common/bug.h" ++#include "common/compiler.h" ++ ++#include "images/mnt.pb-c.h" + + #undef LOG_PREFIX + #define LOG_PREFIX "mnt-v2: " + ++LIST_HEAD(sharing_groups); ++ + int check_mount_v2(void) + { + if (!kdat.has_move_mount_set_group) { +@@ -18,3 +44,1223 @@ int check_mount_v2(void) + + return 0; + } ++ ++static struct sharing_group *get_sharing_group(int shared_id, int master_id) ++{ ++ struct sharing_group *sg; ++ ++ list_for_each_entry(sg, &sharing_groups, list) { ++ if (sg->shared_id == shared_id && sg->master_id == master_id) ++ return sg; ++ } ++ ++ return NULL; ++} ++ ++static struct sharing_group *alloc_sharing_group(int shared_id, int master_id) ++{ ++ struct sharing_group *sg; ++ ++ sg = xzalloc(sizeof(struct sharing_group)); ++ if (!sg) ++ return NULL; ++ ++ sg->shared_id = shared_id; ++ sg->master_id = master_id; ++ ++ INIT_LIST_HEAD(&sg->list); ++ INIT_LIST_HEAD(&sg->mnt_list); ++ INIT_LIST_HEAD(&sg->children); ++ INIT_LIST_HEAD(&sg->siblings); ++ ++ list_add(&sg->list, &sharing_groups); ++ ++ return sg; ++} ++ ++int resolve_shared_mounts_v2(void) ++{ ++ struct sharing_group *sg; ++ struct mount_info *mi; ++ ++ /* ++ * Create sharing groups for each unique shared_id+master_id pair and ++ * link each mount to the corresponding sharing group. ++ */ ++ for (mi = mntinfo; mi; mi = mi->next) { ++ if (!mi->shared_id && !mi->master_id) ++ continue; ++ ++ pr_debug("Inspecting sharing on %2d shared_id %d master_id %d (@%s)\n", mi->mnt_id, mi->shared_id, ++ mi->master_id, mi->ns_mountpoint); ++ ++ sg = get_sharing_group(mi->shared_id, mi->master_id); ++ if (!sg) { ++ sg = alloc_sharing_group(mi->shared_id, mi->master_id); ++ if (!sg) ++ return -1; ++ } ++ ++ list_add(&mi->mnt_sharing, &sg->mnt_list); ++ mi->sg = sg; ++ } ++ ++ /* ++ * Collect sharing groups tree. Mount propagation between sharing ++ * groups only goes down this tree, meaning that only mounts of same or ++ * descendant sharing groups recieve mount propagation. ++ */ ++ list_for_each_entry(sg, &sharing_groups, list) { ++ if (sg->master_id) { ++ struct sharing_group *p; ++ ++ /* ++ * Lookup parent sharing group. If one sharing group ++ * has master_id equal to shared_id of another sharing ++ * group than the former is a child (slave) of the ++ * latter. Also sharing groups should not have two ++ * parents so we check this here too. ++ */ ++ list_for_each_entry(p, &sharing_groups, list) { ++ if (p->shared_id != sg->master_id) ++ continue; ++ ++ if (sg->parent) { ++ pr_err("Sharing group (%d, %d) parent collision (%d, %d) (%d, %d)\n", ++ sg->shared_id, sg->master_id, p->shared_id, p->master_id, ++ sg->parent->shared_id, sg->parent->master_id); ++ return -1; ++ } ++ sg->parent = p; ++ ++ if (!list_empty(&sg->siblings)) { ++ pr_err("External slavery sharing group (%d, %d) has parent (%d, %d)\n", ++ sg->shared_id, sg->master_id, p->shared_id, p->master_id); ++ return -1; ++ } ++ list_add(&sg->siblings, &p->children); ++ /* Don't break to check for parent collision */ ++ } ++ ++ /* ++ * If sharing group has master_id but we did't find ++ * parent for it inside the dumped container yet, this ++ * means that the master_id is external and a mount on ++ * host should exist with corresponding shared_id. ++ */ ++ if (!sg->parent && list_empty(&sg->siblings)) { ++ struct mount_info *ext; ++ struct sharing_group *s; ++ char *source = NULL; ++ ++ /* ++ * Though we don't have parent sharing group ++ * (inaccessible sharing), we can still have ++ * siblings, sharing groups with same master_id ++ * but different shared_id, let's collect them ++ * to the list. ++ */ ++ list_for_each_entry(s, &sharing_groups, list) { ++ if (s->master_id != sg->master_id) ++ continue; ++ ++ if (s->parent) { ++ pr_err("External slavery sharing group (%d, %d) has parent (%d, %d)\n", ++ sg->shared_id, sg->master_id, s->parent->shared_id, ++ s->parent->master_id); ++ return -1; ++ } ++ ++ if (!list_empty(&s->siblings)) { ++ pr_err("External slavery sharing group collision (%d, %d) (%d, %d)\n", ++ sg->shared_id, sg->master_id, s->shared_id, s->master_id); ++ return -1; ++ } ++ list_add(&s->siblings, &sg->siblings); ++ } ++ ++ BUG_ON(list_empty(&sg->mnt_list)); ++ mi = list_entry(sg->mnt_list.next, struct mount_info, mnt_sharing); ++ ++ /* ++ * We need to know from which mount on host we ++ * can get this external master_id. There are ++ * two options: mountpoint external mount or ++ * root mount of container. ++ */ ++ if ((ext = mnt_get_external_bind_nodev(mi))) ++ source = ext->external; ++ else if (mnt_is_root_bind(mi)) ++ source = opts.root; ++ ++ if (!source) { ++ pr_err("Sharing group (%d, %d) " ++ "has unreachable sharing. Try --enable-external-masters.\n", ++ sg->shared_id, sg->master_id); ++ return -1; ++ } ++ ++ sg->source = source; ++ list_for_each_entry(s, &sg->siblings, siblings) ++ s->source = sg->source; ++ ++ pr_debug("Detected external slavery for shared group (%d, %d) with source %s\n", ++ sg->shared_id, sg->master_id, source); ++ } ++ } ++ } ++ ++ return 0; ++} ++ ++/* ++ * When first mount from superblock is mounted, give other mounts ++ * a hint that they can now just bindmount from the first one. ++ */ ++static int propagate_mount_v2(struct mount_info *mi) ++{ ++ struct mount_info *t; ++ ++ list_for_each_entry(t, &mi->mnt_bind, mnt_bind) { ++ if (t->mounted) ++ continue; ++ if (t->bind) ++ continue; ++ if (!issubpath(t->root, mi->root)) ++ continue; ++ pr_debug("\t\tPropagate %d to %d\n", mi->mnt_id, t->mnt_id); ++ t->bind = mi; ++ t->s_dev_rt = mi->s_dev_rt; ++ } ++ ++ return 0; ++} ++ ++/* ++ * Mounts first mount of superblock ++ */ ++static int do_new_mount_v2(struct mount_info *mi) ++{ ++ unsigned long sflags = mi->sb_flags; ++ unsigned long mflags = mi->flags & (~MS_PROPAGATE); ++ char *src; ++ struct fstype *tp = mi->fstype; ++ bool remount_ro = (tp->restore && mi->sb_flags & MS_RDONLY); ++ mount_fn_t do_mount = (tp->mount) ? tp->mount : do_simple_mount; ++ ++ src = resolve_source(mi); ++ if (!src) ++ return -1; ++ ++ /* Merge superblock and mount flags if it's possible */ ++ if (!(mflags & ~MS_MNT_KNOWN_FLAGS) && !((sflags ^ mflags) & MS_RDONLY)) { ++ sflags |= mflags; ++ mflags = 0; ++ } ++ ++ if (remount_ro) ++ sflags &= ~MS_RDONLY; ++ ++ if (do_mount(mi, src, mnt_fsname(mi), sflags) < 0) { ++ pr_perror("Can't mount at %s", mi->plain_mountpoint); ++ return -1; ++ } ++ ++ /* ++ * Mount-v2 relies that before mount tree is constructed all mounts ++ * should remain private. Newly created mounts can become non-private ++ * initially depending on parent/source sharing, let's be as explicit ++ * as posible here and make it obvious that mount becomes private. ++ */ ++ if (mount(NULL, mi->plain_mountpoint, NULL, MS_PRIVATE, NULL)) { ++ pr_perror("Can't remount %s with MS_PRIVATE", mi->plain_mountpoint); ++ return -1; ++ } ++ ++ if (tp->restore && tp->restore(mi)) ++ return -1; ++ ++ if (remount_ro) { ++ int fd; ++ ++ fd = open(mi->plain_mountpoint, O_PATH); ++ if (fd < 0) { ++ pr_perror("Unable to open %s", mi->plain_mountpoint); ++ return -1; ++ } ++ sflags |= MS_RDONLY | MS_REMOUNT; ++ if (userns_call(apply_sb_flags, 0, &sflags, sizeof(sflags), fd)) { ++ pr_perror("Unable to apply mount flags %d for %s", mi->sb_flags, mi->plain_mountpoint); ++ close(fd); ++ return -1; ++ } ++ close(fd); ++ } ++ ++ if (mflags && mount(NULL, mi->plain_mountpoint, NULL, MS_REMOUNT | MS_BIND | mflags, NULL)) { ++ pr_perror("Unable to apply bind-mount options"); ++ return -1; ++ } ++ ++ mi->mounted = true; ++ return 0; ++} ++ ++/* ++ * Does simple bindmount, but via new kernel mount api, ++ * which also handles autofs and symlink without resolving. ++ */ ++static int __do_bind_mount_v2(char *from, char *to) ++{ ++ int detached_fd; ++ ++ detached_fd = sys_open_tree(AT_FDCWD, from, AT_NO_AUTOMOUNT | AT_SYMLINK_NOFOLLOW | OPEN_TREE_CLONE); ++ if (detached_fd == -1) { ++ pr_perror("Failed to open_tree %s", from); ++ return -1; ++ } ++ ++ if (sys_move_mount(detached_fd, "", AT_FDCWD, to, MOVE_MOUNT_F_EMPTY_PATH)) { ++ pr_perror("Failed to move_mount from %s to %s", from, to); ++ close(detached_fd); ++ return -1; ++ } ++ close(detached_fd); ++ ++ return 0; ++} ++ ++LIST_HEAD(deleted_mounts); ++ ++/* ++ * Bind-mounts all later mounts of superblock from first one, ++ * also handles first mounts of mountpoint external mounts. ++ */ ++static int do_bind_mount_v2(struct mount_info *mi) ++{ ++ char *root = NULL, *cut_root, rpath[PATH_MAX]; ++ unsigned long mflags; ++ int exit_code = -1; ++ char *mnt_path = NULL; ++ int level = 0; ++ ++ if (mi->need_plugin) { ++ if (restore_ext_mount(mi)) ++ return -1; ++ goto out; ++ } ++ ++ if (mnt_is_nodev_external(mi)) { ++ root = mi->external; ++ goto do_bind; ++ } ++ ++ cut_root = get_relative_path(mi->root, mi->bind->root); ++ if (!cut_root) { ++ pr_err("Failed to find root for %d in our supposed bind %d\n", mi->mnt_id, mi->bind->mnt_id); ++ return -1; ++ } ++ ++ /* ++ * Mount ->private can be initialized on fstype->mount() callback, ++ * which is called for first mount of superblock in do_new_mount(). ++ * Also ->private have to be copied to all other mounts of superblock ++ * to provide users of it with actual data. ++ */ ++ mi->private = mi->bind->private; ++ ++ mnt_path = mi->bind->plain_mountpoint; ++ ++ if (cut_root[0]) { ++ snprintf(rpath, sizeof(rpath), "%s/%s", mnt_path, cut_root); ++ root = rpath; ++ } else { ++ root = mnt_path; ++ } ++do_bind: ++ pr_info("\tBind %s to %s\n", root, mi->plain_mountpoint); ++ ++ if (unlikely(mi->deleted)) { ++ level = make_parent_dirs_if_need(-1, root); ++ if (level < 0) ++ goto err; ++ ++ if (mi->is_dir) { ++ if (mkdir(root, 0600)) { ++ pr_perror("Can't re-create deleted directory %s", root); ++ goto err; ++ } ++ } else { ++ int fd = open(root, O_WRONLY | O_CREAT | O_EXCL, 0600); ++ if (fd < 0) { ++ pr_perror("Can't re-create deleted file %s", root); ++ goto err; ++ } ++ close(fd); ++ } ++ } ++ ++ if (__do_bind_mount_v2(root, mi->plain_mountpoint)) ++ goto err; ++ ++ /* ++ * Mount-v2 relies that before mount tree is constructed all mounts ++ * should remain private. Newly created mounts can become non-private ++ * initially depending on parent/source sharing, let's be as explicit ++ * as posible here and make it obvious that mount becomes private. ++ */ ++ if (mount(NULL, mi->plain_mountpoint, NULL, MS_PRIVATE, NULL)) { ++ pr_perror("Can't remount %s with MS_PRIVATE", mi->plain_mountpoint); ++ goto err; ++ } ++ ++ mflags = mi->flags & (~MS_PROPAGATE); ++ if (!mi->bind || mflags != (mi->bind->flags & (~MS_PROPAGATE))) ++ if (mount(NULL, mi->plain_mountpoint, NULL, MS_BIND | MS_REMOUNT | mflags, NULL)) { ++ pr_perror("Can't bind remount 0x%lx at %s", mflags, mi->plain_mountpoint); ++ goto err; ++ } ++ ++ if (mi->deleted) { ++ /* ++ * Deleted mounts can't be moved, will delete source after ++ * moving to proper position in the mount tree FIXME. ++ */ ++ mi->deleted_level = level; ++ level = 0; ++ list_add(&mi->deleted_list, &deleted_mounts); ++ } ++out: ++ mi->mounted = true; ++ exit_code = 0; ++err: ++ if (level) ++ rm_parent_dirs(-1, root, level); ++ ++ return exit_code; ++} ++ ++/* Mounts root container mount. */ ++static int do_mount_root_v2(struct mount_info *mi) ++{ ++ unsigned long flags = MS_BIND; ++ int fd; ++ ++ if (root_ns_mask & CLONE_NEWUSER) { ++ fd = open(mi->plain_mountpoint, O_PATH); ++ if (fd < 0) { ++ pr_perror("Unable to open %s", mi->plain_mountpoint); ++ return -1; ++ } ++ ++ if (userns_call(mount_root, 0, &flags, sizeof(flags), fd)) { ++ pr_err("Unable to mount %s\n", mi->plain_mountpoint); ++ close(fd); ++ return -1; ++ } ++ close(fd); ++ } else { ++ if (mount(opts.root, mi->plain_mountpoint, NULL, flags, NULL)) { ++ pr_perror("Unable to mount %s %s (id=%d)", opts.root, mi->plain_mountpoint, mi->mnt_id); ++ return -1; ++ } ++ } ++ ++ /* ++ * Mount-v2 relies that before mount tree is constructed all mounts ++ * should remain private. Newly created mounts can become non-private ++ * initially depending on parent/source sharing, let's be as explicit ++ * as posible here and make it obvious that mount becomes private. ++ */ ++ if (mount(NULL, mi->plain_mountpoint, NULL, MS_PRIVATE, NULL)) { ++ pr_perror("Can't remount %s with MS_PRIVATE", mi->plain_mountpoint); ++ return -1; ++ } ++ ++ mi->mounted = true; ++ ++ return 0; ++} ++ ++/* Check if mount is ready to be mounted. */ ++static bool can_mount_now_v2(struct mount_info *mi) ++{ ++ struct mount_info *root, *ext; ++ ++ /* Parent should be mounted already, that's how mnt_tree_for_each works */ ++ BUG_ON(mi->parent && !mi->parent->mounted); ++ ++ /* Root mounts can be mounted at any moment */ ++ if (rst_mnt_is_root(mi)) { ++ pr_debug("%s: true as %d is global root\n", __func__, mi->mnt_id); ++ return true; ++ } ++ ++ /* External mounts can be mounted at any moment */ ++ if (mi->external) { ++ pr_debug("%s: true as %d is external\n", __func__, mi->mnt_id); ++ return true; ++ } ++ ++ /* ++ * Container root and external mounts should go before ++ * anything which should be bindmounted from them. ++ */ ++ if (!mi->bind) { ++ root = mnt_get_root_bind(mi); ++ if (root) { ++ pr_debug("%s: false as %d is bind of not mounted global root %d\n", __func__, mi->mnt_id, ++ root->mnt_id); ++ return false; ++ } ++ ++ ext = mnt_get_external_bind(mi); ++ if (ext) { ++ pr_debug("%s: false as %d is a bind of not mounted external %d\n", __func__, mi->mnt_id, ++ ext->mnt_id); ++ return false; ++ } ++ } ++ ++ /* Non fsroot mounts can not be mounted without bind-mount */ ++ if (!fsroot_mounted(mi) && !mi->bind && !mi->need_plugin) { ++ pr_debug("%s: false as %d is non-root without bind or plugin\n", __func__, mi->mnt_id); ++ return false; ++ } ++ ++ return true; ++} ++ ++static int __set_unbindable_v2(struct mount_info *mi) ++{ ++ if (mi->flags & MS_UNBINDABLE) { ++ if (mount(NULL, service_mountpoint(mi), NULL, MS_UNBINDABLE, NULL)) { ++ pr_perror("Failed to set mount %d unbindable", mi->mnt_id); ++ return -1; ++ } ++ } ++ return 0; ++} ++ ++/* ++ * Setting MS_UNBINDABLE flag is slightly delayed, ++ * obviousely until we finish bind-mounting everything. ++ */ ++static int set_unbindable_v2(void) ++{ ++ int orig_nsfd = -1, nsfd = -1, exit_code = -1; ++ struct mount_info *mi; ++ struct ns_id *nsid; ++ ++ for (nsid = ns_ids; nsid != NULL; nsid = nsid->next) { ++ bool ns_has_unbindable = false; ++ ++ if (nsid->nd != &mnt_ns_desc) ++ continue; ++ ++ for (mi = mntinfo; mi != NULL; mi = mi->next) ++ if (mi->nsid == nsid && mi->flags & MS_UNBINDABLE) ++ ns_has_unbindable = true; ++ ++ if (!ns_has_unbindable) ++ continue; ++ ++ nsfd = fdstore_get(nsid->mnt.nsfd_id); ++ if (nsfd < 0) ++ goto err; ++ ++ if (switch_ns_by_fd(nsfd, &mnt_ns_desc, orig_nsfd == -1 ? &orig_nsfd : NULL)) ++ goto err; ++ close_safe(&nsfd); ++ ++ if (mnt_tree_for_each(nsid->mnt.mntinfo_tree, __set_unbindable_v2)) ++ goto err; ++ } ++ ++ exit_code = 0; ++err: ++ if (orig_nsfd >= 0 && restore_ns(orig_nsfd, &mnt_ns_desc)) ++ exit_code = -1; ++ close_safe(&nsfd); ++ return exit_code; ++} ++ ++/* ++ * Detects if mount is a directory mount or file mount based on stat on ++ * its mountpoint inside already mounted parent mount. This is deeply ++ * integrated in plain mount creation process because before mounting ++ * something plain we need to create right type of mountpoint for it. ++ */ ++static int detect_is_dir(struct mount_info *mi) ++{ ++ static char mountpoint[PATH_MAX]; ++ char *rel_path; ++ struct stat st; ++ ++ if (mi->is_dir != -1) ++ return 0; ++ ++ if (mi->mnt_id == HELPER_MNT_ID) { ++ pr_err("Helper %s should have is_dir pre-set\n", mi->ns_mountpoint); ++ return -1; ++ } ++ ++ if (!mi->parent || mi->parent == root_yard_mp) { ++ pr_err("Mount namespace root mount %d should have is_dir pre-set\n", mi->mnt_id); ++ return -1; ++ } ++ ++ if (!mi->parent->mounted) { ++ pr_err("Parent mount %d of %d should be mounted\n", mi->parent->mnt_id, mi->mnt_id); ++ return -1; ++ } ++ ++ rel_path = get_relative_path(mi->ns_mountpoint, mi->parent->ns_mountpoint); ++ if (!rel_path) { ++ pr_err("Child-parent mountpoint missmatch %d:%s %d:%s\n", mi->mnt_id, mi->ns_mountpoint, ++ mi->parent->mnt_id, mi->parent->ns_mountpoint); ++ return -1; ++ } ++ ++ snprintf(mountpoint, sizeof(mountpoint), "%s%s%s", mi->parent->plain_mountpoint, rel_path[0] ? "/" : "", ++ rel_path); ++ if (stat(mountpoint, &st)) { ++ pr_perror("Can't stat mountpoint %s", mountpoint); ++ return -1; ++ } ++ ++ if (S_ISDIR(st.st_mode)) ++ mi->is_dir = true; ++ else ++ mi->is_dir = false; ++ ++ pr_debug("Mount %d is detected as %s-mount\n", mi->mnt_id, mi->is_dir ? "dir" : "file"); ++ return 0; ++} ++ ++static int create_plain_mountpoint(struct mount_info *mi) ++{ ++ BUG_ON(mi->is_dir == -1); ++ ++ pr_debug("Create plain mountpoint %s for %d\n", mi->plain_mountpoint, mi->mnt_id); ++ if (mi->is_dir) { ++ if (mkdir(mi->plain_mountpoint, 0600)) { ++ pr_perror("Unable to mkdir mountpoint %s", mi->plain_mountpoint); ++ return -1; ++ } ++ } else { ++ int fd; ++ ++ fd = creat(mi->plain_mountpoint, 0600); ++ if (fd < 0) { ++ pr_perror("Unable to create mountpoint %s", mi->plain_mountpoint); ++ return -1; ++ } ++ close(fd); ++ } ++ ++ return 0; ++} ++ ++/* ++ * At this point we already have a mount in service mount namespace now we ++ * bind-mount it to the final restored mount namespace via new kernel mount ++ * API. ++ */ ++static int do_mount_in_right_mntns(struct mount_info *mi) ++{ ++ int nsfd = -1, orig_nsfd = -1, detached_fd = -1, exit_code = -1; ++ ++ if (!mi->nsid) ++ return 0; ++ ++ detached_fd = ++ sys_open_tree(AT_FDCWD, mi->plain_mountpoint, AT_NO_AUTOMOUNT | AT_SYMLINK_NOFOLLOW | OPEN_TREE_CLONE); ++ if (detached_fd == -1) { ++ pr_perror("Failed to open_tree %s", mi->plain_mountpoint); ++ goto err; ++ } ++ ++ nsfd = fdstore_get(mi->nsid->mnt.nsfd_id); ++ if (nsfd < 0) ++ goto err; ++ ++ if (switch_ns_by_fd(nsfd, &mnt_ns_desc, &orig_nsfd)) ++ goto err; ++ ++ if (create_plain_mountpoint(mi)) ++ goto err; ++ ++ if (sys_move_mount(detached_fd, "", AT_FDCWD, mi->plain_mountpoint, MOVE_MOUNT_F_EMPTY_PATH)) { ++ pr_perror("Failed to cross-mntns move_mount plain mount %d", mi->mnt_id); ++ goto err; ++ } ++ ++ exit_code = 0; ++err: ++ if (orig_nsfd >= 0 && restore_ns(orig_nsfd, &mnt_ns_desc)) ++ exit_code = -1; ++ close_safe(&nsfd); ++ close_safe(&detached_fd); ++ return exit_code; ++} ++ ++static int do_mount_one_v2(struct mount_info *mi) ++{ ++ int ret; ++ ++ if (mi->mounted) ++ return 0; ++ ++ if (!can_mount_now_v2(mi)) { ++ pr_debug("Postpone mount %d\n", mi->mnt_id); ++ return 1; ++ } ++ ++ if (detect_is_dir(mi)) ++ return -1; ++ ++ if (create_plain_mountpoint(mi)) ++ return -1; ++ ++ pr_debug("\tMounting %s @%d (%d)\n", mi->fstype->name, mi->mnt_id, mi->need_plugin); ++ ++ if (rst_mnt_is_root(mi)) { ++ if (opts.root == NULL) { ++ pr_err("The --root option is required to restore a mount namespace\n"); ++ return -1; ++ } ++ ret = do_mount_root_v2(mi); ++ } else if (!mi->bind && !mi->need_plugin && (!mi->external || !strcmp(mi->external, EXTERNAL_DEV_MOUNT))) { ++ ret = do_new_mount_v2(mi); ++ } else { ++ ret = do_bind_mount_v2(mi); ++ } ++ ++ if (ret == 0 && fetch_rt_stat(mi, mi->plain_mountpoint)) ++ return -1; ++ ++ if (ret == 0 && propagate_mount_v2(mi)) ++ return -1; ++ ++ if (mi->fstype->code == FSTYPE__UNSUPPORTED) { ++ struct statfs st; ++ ++ if (statfs(mi->plain_mountpoint, &st)) { ++ pr_perror("Unable to statfs %s", mi->plain_mountpoint); ++ return -1; ++ } ++ if (st.f_type == BTRFS_SUPER_MAGIC) ++ mi->fstype = find_fstype_by_name("btrfs"); ++ } ++ ++ if (ret == 0 && do_mount_in_right_mntns(mi)) ++ return -1; ++ ++ return ret; ++} ++ ++static int populate_mnt_ns_v2(void) ++{ ++ if (make_yard(mnt_roots)) ++ return -1; ++ ++ if (mnt_tree_for_each(root_yard_mp, do_mount_one_v2)) ++ return -1; ++ ++ return set_unbindable_v2(); ++} ++ ++/* ++ * This function moves plain mounts into actual mount tree. ++ * ++ * Mounts in children list are sorted the way that sibling overmount goes after ++ * all siblings which it overmounts (see __mnt_resort_children). The function ++ * mnt_tree_for_each is effectively DFS (in case we don't postpone), thus all ++ * descendants of all mounts which we sibling-overmount are mounted before us. ++ * Be carefull, we can't postpone (return >0) from this function because of it. ++ */ ++static int move_mount_to_tree(struct mount_info *mi) ++{ ++ int fd; ++ ++ fd = open(mi->mountpoint, O_PATH); ++ if (fd < 0) { ++ pr_perror("Failed to open real mountpoint of %d", mi->mnt_id); ++ return -1; ++ } ++ ++ mi->mp_fd_id = fdstore_add(fd); ++ close(fd); ++ if (mi->mp_fd_id < 0) { ++ pr_err("Can't add mountpoint of mount %d to fdstore\n", mi->mnt_id); ++ return -1; ++ } ++ ++ pr_info("Move mount %d from %s to %s\n", mi->mnt_id, mi->plain_mountpoint, mi->mountpoint); ++ if (sys_move_mount(AT_FDCWD, mi->plain_mountpoint, AT_FDCWD, mi->mountpoint, 0)) { ++ pr_perror("Failed to move mount %d from %s to %s", mi->mnt_id, mi->plain_mountpoint, mi->mountpoint); ++ return -1; ++ } ++ ++ fd = open(mi->mountpoint, O_PATH); ++ if (fd < 0) { ++ pr_perror("Failed to open real mountpoint of %d", mi->mnt_id); ++ return -1; ++ } ++ ++ mi->mnt_fd_id = fdstore_add(fd); ++ close(fd); ++ if (mi->mnt_fd_id < 0) { ++ pr_err("Can't add mount %d fd to fdstore\n", mi->mnt_id); ++ return -1; ++ } ++ ++ return 0; ++} ++ ++static int assemble_tree_from_plain_mounts(struct ns_id *nsid) ++{ ++ return mnt_tree_for_each(nsid->mnt.mntinfo_tree, move_mount_to_tree); ++} ++ ++/* ++ * With MOVE_MOUNT_SET_GROUP source mount should have wider root than ++ * destination, thus let's choose widest mount from group as first. ++ */ ++static struct mount_info *get_first_mount(struct sharing_group *sg) ++{ ++ struct mount_info *first = NULL, *tmp; ++ int min_len = 0; ++ ++ list_for_each_entry(tmp, &sg->mnt_list, mnt_sharing) { ++ int len = strlen(tmp->root); ++ ++ if (!first || len < min_len) { ++ first = tmp; ++ min_len = len; ++ } ++ } ++ ++ return first; ++} ++ ++struct set_group_arg { ++ int src_id; ++ char source[PATH_MAX]; ++ int dst_id; ++}; ++ ++static int __move_mount_set_group(void *arg, int dfd, int pid) ++{ ++ struct set_group_arg *sga = (struct set_group_arg *)arg; ++ int src_fd, dst_fd, exit_code = -1; ++ ++ if (sga->src_id != -1) { ++ src_fd = fdstore_get(sga->src_id); ++ BUG_ON(src_fd < 0); ++ } else { ++ char *source_mp; ++ ++ BUG_ON(sga->source[0] == '\0'); ++ /* ++ * Source path should not always be a mountpoint as we ++ * automatically resolve it to mountpoint below. ++ */ ++ source_mp = resolve_mountpoint(sga->source); ++ if (!source_mp) { ++ pr_err("Failed to find %s mountpoint\n", sga->source); ++ return -1; ++ } ++ ++ src_fd = open(source_mp, O_PATH); ++ if (src_fd < 0) { ++ pr_perror("Failed to open %s mountpoint", source_mp); ++ xfree(source_mp); ++ return -1; ++ } ++ xfree(source_mp); ++ } ++ ++ dst_fd = fdstore_get(sga->dst_id); ++ BUG_ON(dst_fd < 0); ++ ++ /* Copy shared_id of the source */ ++ if (sys_move_mount(src_fd, "", dst_fd, "", ++ MOVE_MOUNT_SET_GROUP | MOVE_MOUNT_F_EMPTY_PATH | MOVE_MOUNT_T_EMPTY_PATH)) { ++ pr_perror("Failed to copy sharing from %d:%s to %d", sga->src_id, sga->source ?: "", sga->dst_id); ++ goto err; ++ } ++ ++ exit_code = 0; ++err: ++ close(src_fd); ++ close(dst_fd); ++ return exit_code; ++} ++ ++/* ++ * Copy sharing between mounts passing mountpoint fds via fdstore ids. Also it ++ * is possible (for external mounts) to pass path on mountpoint via source path, ++ * it would resolve to mountpoint automatically. ++ */ ++static int move_mount_set_group(int src_id, char *source, int dst_id) ++{ ++ struct set_group_arg sga = { ++ .src_id = src_id, ++ .dst_id = dst_id, ++ }; ++ ++ sga.source[0] = '\0'; ++ if (source) { ++ if (snprintf(sga.source, sizeof(sga.source), "%s", source) >= sizeof(sga.source)) { ++ pr_err("Source %s is too long\n", source); ++ return -1; ++ } ++ } ++ ++ if (userns_call(__move_mount_set_group, 0, &sga, sizeof(sga), -1)) ++ return -1; ++ ++ return 0; ++} ++ ++static int restore_one_sharing_group(struct sharing_group *sg) ++{ ++ struct mount_info *first, *other; ++ char first_path[PATH_MAX]; ++ int first_fd; ++ ++ first = get_first_mount(sg); ++ first_fd = fdstore_get(first->mnt_fd_id); ++ BUG_ON(first_fd < 0); ++ snprintf(first_path, sizeof(first_path), "/proc/self/fd/%d", first_fd); ++ ++ /* Restore first's master_id from shared_id of the source */ ++ if (sg->master_id) { ++ if (sg->parent) { ++ struct mount_info *p; ++ ++ /* Get shared_id from parent sharing group */ ++ p = get_first_mount(sg->parent); ++ if (move_mount_set_group(p->mnt_fd_id, NULL, first->mnt_fd_id)) { ++ pr_err("Failed to copy sharing from %d to %d\n", p->mnt_id, first->mnt_id); ++ close(first_fd); ++ return -1; ++ } ++ } else { ++ /* ++ * External slavery. We rely on the user to give us the ++ * right source for external mount with all proper ++ * sharing optioins setup (it should be either shared ++ * or non-shared slave). If source is a private mount ++ * we would fail. ++ */ ++ if (move_mount_set_group(-1, sg->source, first->mnt_fd_id)) { ++ pr_err("Failed to copy sharing from source %s to %d\n", sg->source, first->mnt_id); ++ close(first_fd); ++ return -1; ++ } ++ } ++ ++ /* Convert shared_id to master_id */ ++ if (mount(NULL, first_path, NULL, MS_SLAVE, NULL)) { ++ pr_perror("Failed to make mount %d slave", first->mnt_id); ++ close(first_fd); ++ return -1; ++ } ++ } ++ ++ /* Restore first's shared_id */ ++ if (sg->shared_id) { ++ if (mount(NULL, first_path, NULL, MS_SHARED, NULL)) { ++ pr_perror("Failed to make mount %d shared", first->mnt_id); ++ close(first_fd); ++ return -1; ++ } ++ } ++ close(first_fd); ++ ++ /* Restore sharing for other mounts from the sharing group */ ++ list_for_each_entry(other, &sg->mnt_list, mnt_sharing) { ++ if (other == first) ++ continue; ++ ++ if (move_mount_set_group(first->mnt_fd_id, NULL, other->mnt_fd_id)) { ++ pr_err("Failed to copy sharing from %d to %d\n", first->mnt_id, other->mnt_id); ++ return -1; ++ } ++ } ++ ++ return 0; ++} ++ ++static struct sharing_group *sharing_group_next(struct sharing_group *sg) ++{ ++ if (!list_empty(&sg->children)) ++ return list_entry(sg->children.next, struct sharing_group, siblings); ++ ++ while (sg->parent) { ++ if (sg->siblings.next == &sg->parent->children) ++ sg = sg->parent; ++ else ++ return list_entry(sg->siblings.next, struct sharing_group, siblings); ++ } ++ ++ return NULL; ++} ++ ++static int restore_mount_sharing_options(void) ++{ ++ struct sharing_group *sg; ++ ++ list_for_each_entry(sg, &sharing_groups, list) { ++ struct sharing_group *t; ++ ++ if (sg->parent) ++ continue; ++ ++ /* Handle dependant sharing groups in tree order */ ++ for (t = sg; t != NULL; t = sharing_group_next(t)) { ++ if (restore_one_sharing_group(t)) ++ return -1; ++ } ++ } ++ ++ return 0; ++} ++ ++static int remove_source_of_deleted_mount(struct mount_info *mi) ++{ ++ char *cut_root, path[PATH_MAX], *root; ++ ++ BUG_ON(!mi->deleted || !mi->bind); ++ ++ cut_root = get_relative_path(mi->root, mi->bind->root); ++ if (!cut_root) { ++ pr_err("Failed to find root for %d in our supposed bind %d\n", mi->mnt_id, mi->bind->mnt_id); ++ return -1; ++ } ++ ++ if (cut_root[0]) { ++ snprintf(path, sizeof(path), "%s/%s", mi->bind->plain_mountpoint, cut_root); ++ root = path; ++ } else { ++ root = mi->bind->plain_mountpoint; ++ } ++ ++ if (mi->is_dir) { ++ if (rmdir(root)) { ++ pr_perror("Can't remove deleted directory %s", root); ++ return -1; ++ } ++ } else { ++ if (unlink(root)) { ++ pr_perror("Can't unlink deleted file %s", root); ++ return -1; ++ } ++ } ++ ++ if (mi->deleted_level) ++ rm_parent_dirs(-1, root, mi->deleted_level); ++ ++ return 0; ++} ++ ++/* Delay making mounts deleted until we've restored sharing groups */ ++static int remove_sources_of_deleted_mounts(void) ++{ ++ struct mount_info *mi; ++ int ret = 0; ++ ++ list_for_each_entry(mi, &deleted_mounts, deleted_list) { ++ if (remove_source_of_deleted_mount(mi)) ++ ret = -1; ++ } ++ ++ return ret; ++} ++ ++static int get_empty_mntns(void) ++{ ++ int orig_nsfd, nsfd = -1; ++ ++ orig_nsfd = open_proc(PROC_SELF, "ns/mnt"); ++ if (orig_nsfd < 0) ++ return -1; ++ ++ /* Create the new mount namespace */ ++ if (unshare(CLONE_NEWNS)) { ++ pr_perror("Unable to create a new mntns"); ++ close(orig_nsfd); ++ return -1; ++ } ++ ++ if (mount("none", "/", NULL, MS_REC | MS_PRIVATE, NULL)) { ++ pr_perror("Can't remount \"/\" with MS_PRIVATE"); ++ goto err; ++ } ++ ++ if (make_yard(mnt_roots)) ++ goto err; ++ ++ if (cr_pivot_root(mnt_roots)) ++ goto err; ++ ++ if (mkdirpat(AT_FDCWD, mnt_roots, 0777)) { ++ pr_err("Failed to setup root yard in empty mntns\n"); ++ goto err; ++ } ++ ++ nsfd = open_proc(PROC_SELF, "ns/mnt"); ++err: ++ if (restore_ns(orig_nsfd, &mnt_ns_desc)) ++ close_safe(&nsfd); ++ return nsfd; ++} ++ ++/* Create almost empty mount namespaces only with root yard precreated */ ++static int pre_create_mount_namespaces(void) ++{ ++ int orig_nsfd = -1, nsfd = -1, empty_mntns, exit_code = -1; ++ char path[PATH_MAX]; ++ struct ns_id *nsid; ++ ++ empty_mntns = get_empty_mntns(); ++ if (empty_mntns == -1) { ++ pr_err("Failed to create empty mntns\n"); ++ goto err; ++ } ++ ++ /* restore mount namespaces */ ++ for (nsid = ns_ids; nsid != NULL; nsid = nsid->next) { ++ if (nsid->nd != &mnt_ns_desc) ++ continue; ++ ++ if (switch_ns_by_fd(empty_mntns, &mnt_ns_desc, orig_nsfd == -1 ? &orig_nsfd : NULL)) ++ goto err; ++ ++ /* Create the new mount namespace */ ++ if (unshare(CLONE_NEWNS)) { ++ pr_perror("Unable to create a new mntns"); ++ goto err; ++ } ++ ++ nsfd = open_proc(PROC_SELF, "ns/mnt"); ++ if (nsfd < 0) ++ goto err; ++ ++ /* Pin new mntns with a file descriptor */ ++ nsid->mnt.nsfd_id = fdstore_add(nsfd); ++ close(nsfd); ++ if (nsid->mnt.nsfd_id < 0) { ++ pr_err("Can't add mntns fd to fdstore\n"); ++ goto err; ++ } ++ ++ if (make_yard(mnt_roots)) ++ goto err; ++ ++ print_ns_root(nsid, 0, path, sizeof(path)); ++ if (mkdir(path, 0600)) { ++ pr_perror("Unable to create %s", path); ++ goto err; ++ } ++ } ++ ++ exit_code = 0; ++err: ++ if (orig_nsfd >= 0 && restore_ns(orig_nsfd, &mnt_ns_desc)) ++ exit_code = -1; ++ close_safe(&empty_mntns); ++ return exit_code; ++} ++ ++/* ++ * Assemble the mount tree for each restored mount namespace ++ * from pre-created plain mounts. ++ */ ++static int assemble_mount_namespaces(void) ++{ ++ int orig_nsfd = -1, nsfd = -1, rootfd = -1, exit_code = -1; ++ char path[PATH_MAX]; ++ struct ns_id *nsid; ++ ++ for (nsid = ns_ids; nsid != NULL; nsid = nsid->next) { ++ if (nsid->nd != &mnt_ns_desc) ++ continue; ++ ++ nsfd = fdstore_get(nsid->mnt.nsfd_id); ++ if (nsfd < 0) ++ goto err; ++ ++ if (switch_ns_by_fd(nsfd, &mnt_ns_desc, orig_nsfd == -1 ? &orig_nsfd : NULL)) { ++ close(nsfd); ++ goto err; ++ } ++ close(nsfd); ++ ++ if (assemble_tree_from_plain_mounts(nsid)) ++ goto err; ++ ++ /* Set its root */ ++ print_ns_root(nsid, 0, path, sizeof(path) - 1); ++ if (cr_pivot_root(path)) ++ goto err; ++ ++ /* root fd is used to restore file mappings */ ++ rootfd = open_proc(PROC_SELF, "root"); ++ if (rootfd < 0) ++ goto err; ++ nsid->mnt.root_fd_id = fdstore_add(rootfd); ++ if (nsid->mnt.root_fd_id < 0) { ++ pr_err("Can't add root fd to fdstore\n"); ++ close(rootfd); ++ goto err; ++ } ++ close(rootfd); ++ } ++ ++ exit_code = 0; ++err: ++ if (orig_nsfd >= 0 && restore_ns(orig_nsfd, &mnt_ns_desc)) ++ exit_code = -1; ++ return exit_code; ++} ++ ++/* The main entry point of mount-v2 for creating mounts */ ++int prepare_mnt_ns_v2(void) ++{ ++ if (!(root_ns_mask & CLONE_NEWNS)) ++ return 0; ++ ++#ifdef CONFIG_BINFMT_MISC_VIRTUALIZED ++ if (!opts.has_binfmt_misc && !list_empty(&binfmt_misc_list)) { ++ /* ++ * Add to root yard along with other plain mounts and mntns ++ * directories. This mount would be created and restored by ++ * generic mount creation code, but it would never be moved to ++ * any restored mount namespaces. ++ */ ++ if (!add_cr_time_mount(root_yard_mp, "binfmt_misc", "binfmt_misc", 0, true)) ++ return -1; ++ } ++#endif ++ ++ if (validate_mounts(mntinfo, false)) ++ return -1; ++ ++ if (pre_create_mount_namespaces()) ++ return -1; ++ ++ if (populate_mnt_ns_v2()) ++ return -1; ++ ++ if (assemble_mount_namespaces()) ++ return -1; ++ ++ if (restore_mount_sharing_options()) ++ return -1; ++ ++ return remove_sources_of_deleted_mounts(); ++} +diff --git a/criu/mount.c b/criu/mount.c +index c39b44ac6..85fcb8843 100644 +--- a/criu/mount.c ++++ b/criu/mount.c +@@ -17,6 +17,7 @@ + #include "plugin.h" + #include "filesystems.h" + #include "mount.h" ++#include "mount-v2.h" + #include "pstree.h" + #include "image.h" + #include "namespaces.h" +@@ -1680,6 +1681,7 @@ struct mount_info __maybe_unused *add_cr_time_mount(struct mount_info *root, cha + goto err; + } + mi->mnt_id = HELPER_MNT_ID; ++ mi->is_dir = true; + mi->flags = mi->sb_flags = 0; + mi->root = xstrdup("/"); + mi->fsname = xstrdup(fsname); +@@ -2987,6 +2989,9 @@ struct mount_info *mnt_entry_alloc(bool rst) + } + memset(new->rmi, 0, sizeof(struct rst_mount_info)); + } ++ new->mp_fd_id = -1; ++ new->mnt_fd_id = -1; ++ new->is_dir = -1; + new->fd = -1; + new->is_overmounted = -1; + INIT_LIST_HEAD(&new->children); +@@ -2999,6 +3004,7 @@ struct mount_info *mnt_entry_alloc(bool rst) + INIT_LIST_HEAD(&new->mnt_notprop); + INIT_LIST_HEAD(&new->mnt_unbindable); + INIT_LIST_HEAD(&new->postpone); ++ INIT_LIST_HEAD(&new->deleted_list); + } + return new; + } +@@ -3314,6 +3320,7 @@ static int merge_mount_trees(void) + root_yard_mp->plain_mountpoint = xstrdup(mnt_roots); + if (!root_yard_mp->plain_mountpoint) + return -1; ++ root_yard_mp->is_dir = true; + root_yard_mp->mounted = true; + root_yard_mp->mnt_bind_is_populated = true; + root_yard_mp->is_overmounted = false; +@@ -3359,6 +3366,9 @@ int read_mnt_ns_img(void) + if (!nsid->mnt.mntinfo_tree) + return -1; + ++ /* mntns root mounts are always directories */ ++ nsid->mnt.mntinfo_tree->is_dir = true; ++ + tail->next = pms; + pms = head; + } +@@ -3368,6 +3378,9 @@ int read_mnt_ns_img(void) + search_bindmounts(); + prepare_is_overmounted(); + ++ if (!opts.mntns_compat_mode && resolve_shared_mounts_v2()) ++ return -1; ++ + if (merge_mount_trees()) + return -1; + +@@ -3691,6 +3704,9 @@ int prepare_mnt_ns(void) + free_mntinfo(old); + } + ++ if (!opts.mntns_compat_mode) ++ return prepare_mnt_ns_v2(); ++ + ret = populate_mnt_ns(); + if (ret) + return -1; +-- +2.35.1 + diff --git a/0216-zdtm-enable-mounts-compat-mode-on-restore-with-mntns.patch b/0216-zdtm-enable-mounts-compat-mode-on-restore-with-mntns.patch new file mode 100644 index 0000000..77600e6 --- /dev/null +++ b/0216-zdtm-enable-mounts-compat-mode-on-restore-with-mntns.patch @@ -0,0 +1,71 @@ +From b43b740a33f13b0a5e902b0ef333a90a76f74d05 Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Wed, 27 May 2020 16:11:20 +0300 +Subject: [PATCH 216/245] zdtm: enable mounts compat mode on restore with + --mntns-compat-mode option + +Cherry-picked from Virtuozzo criu: +https://src.openvz.org/projects/OVZ/repos/criu/commits/e4a430e1f + +Changes: prepend --mntns-compat-mode to r_opts in zdtm.py so that we +can disable this option with --no-mntns-compat-mode from test desc +files. + +Signed-off-by: Pavel Tikhomirov +--- + test/zdtm.py | 11 ++++++++++- + 1 file changed, 10 insertions(+), 1 deletion(-) + +diff --git a/test/zdtm.py b/test/zdtm.py +index 3fbdb8a18..f15420a65 100755 +--- a/test/zdtm.py ++++ b/test/zdtm.py +@@ -953,6 +953,8 @@ class criu_rpc: + if criu_rpc.pidfd_store_socket is None: + criu_rpc.pidfd_store_socket = socket.socket(socket.AF_UNIX, socket.SOCK_DGRAM) + criu.opts.pidfd_store_sk = criu_rpc.pidfd_store_socket.fileno() ++ elif "--mntns-compat-mode" == arg: ++ criu.opts.mntns_compat_mode = True + else: + raise test_fail_exc('RPC for %s(%s) required' % (arg, args.pop(0))) + +@@ -1046,6 +1048,7 @@ class criu: + self.__criu_bin = opts['criu_bin'] + self.__crit_bin = opts['crit_bin'] + self.__pre_dump_mode = opts['pre_dump_mode'] ++ self.__mntns_compat_mode = bool(opts['mntns_compat_mode']) + + if opts['rpc']: + self.__criu = criu_rpc +@@ -1444,6 +1447,9 @@ class criu: + nowait=True) + r_opts += ["--lazy-pages"] + ++ if self.__mntns_compat_mode: ++ r_opts = ['--mntns-compat-mode'] + r_opts ++ + if self.__leave_stopped: + r_opts += ['--leave-stopped'] + +@@ -2034,7 +2040,7 @@ class Launcher: + 'sat', 'script', 'rpc', 'criu_config', 'lazy_pages', 'join_ns', + 'dedup', 'sbs', 'freezecg', 'user', 'dry_run', 'noauto_dedup', + 'remote_lazy_pages', 'show_stats', 'lazy_migrate', 'stream', +- 'tls', 'criu_bin', 'crit_bin', 'pre_dump_mode') ++ 'tls', 'criu_bin', 'crit_bin', 'pre_dump_mode', 'mntns_compat_mode') + arg = repr((name, desc, flavor, {d: self.__opts[d] for d in nd})) + + if self.__use_log: +@@ -2707,6 +2713,9 @@ def get_cli_args(): + help="Use splice or read mode of pre-dumping", + choices=['splice', 'read'], + default='splice') ++ rp.add_argument("--mntns-compat-mode", ++ help="Use old compat mounts restore engine", ++ action='store_true') + + lp = sp.add_parser("list", help="List tests") + lp.set_defaults(action=list_tests) +-- +2.35.1 + diff --git a/0217-ci-run-tests-for-old-mount-engine.patch b/0217-ci-run-tests-for-old-mount-engine.patch new file mode 100644 index 0000000..c387874 --- /dev/null +++ b/0217-ci-run-tests-for-old-mount-engine.patch @@ -0,0 +1,35 @@ +From 73d2b2f9348261a1a47a8532446aa4efc29c4273 Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Fri, 14 Jan 2022 12:12:12 +0300 +Subject: [PATCH 217/245] ci: run tests for old mount engine + +Now when we switched to mount-v2 by default to check old mount engine we +need to explicitly run with --mntns-compat-mode option. + +Note that if the feature move_mount_set_group is not supported then +regular run will just fallback to old mount engine and then we don't +need separate run with --mntns-compat-mode. + +Signed-off-by: Pavel Tikhomirov +--- + scripts/ci/run-ci-tests.sh | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/scripts/ci/run-ci-tests.sh b/scripts/ci/run-ci-tests.sh +index 5ef3965db..dd7c49d63 100755 +--- a/scripts/ci/run-ci-tests.sh ++++ b/scripts/ci/run-ci-tests.sh +@@ -201,6 +201,10 @@ fi + + # shellcheck disable=SC2086 + ./test/zdtm.py run -a -p 2 --keep-going $ZDTM_OPTS ++if criu/criu check --feature move_mount_set_group; then ++ # shellcheck disable=SC2086 ++ ./test/zdtm.py run -a -p 2 --mntns-compat-mode --keep-going $ZDTM_OPTS ++fi + + # shellcheck disable=SC2086 + ./test/zdtm.py run -a -p 2 --keep-going --criu-config $ZDTM_OPTS +-- +2.35.1 + diff --git a/0218-zdtm-add-new-mnt_ext_sharing-test-for-mount-v2.patch b/0218-zdtm-add-new-mnt_ext_sharing-test-for-mount-v2.patch new file mode 100644 index 0000000..0e9401a --- /dev/null +++ b/0218-zdtm-add-new-mnt_ext_sharing-test-for-mount-v2.patch @@ -0,0 +1,328 @@ +From 05a3ccb37f67b40f4b734236b1175b30da0fe693 Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Tue, 31 Dec 2019 15:56:44 +0300 +Subject: [PATCH 218/245] zdtm: add new mnt_ext_sharing test for mount-v2 + +These test simply checks that sharing between two mounts in container: +1) external mount and 2) it's bind persists (case when bind has the same +mountpoint). + +Note: on old mount engine mounts inside container become also shared +with mount in criu mount namespace (outside container) after c/r which +is not right. + +Cherry-picked from Virtuozzo criu: +https://src.openvz.org/projects/OVZ/repos/criu/commits/76a09e850 + +Signed-off-by: Pavel Tikhomirov +--- + test/zdtm/static/Makefile | 1 + + test/zdtm/static/mnt_ext_sharing.c | 236 ++++++++++++++++++++++++++ + test/zdtm/static/mnt_ext_sharing.desc | 5 + + test/zdtm/static/mnt_ext_sharing.hook | 27 +++ + 4 files changed, 269 insertions(+) + create mode 100644 test/zdtm/static/mnt_ext_sharing.c + create mode 100644 test/zdtm/static/mnt_ext_sharing.desc + create mode 100755 test/zdtm/static/mnt_ext_sharing.hook + +diff --git a/test/zdtm/static/Makefile b/test/zdtm/static/Makefile +index bf7462756..9183e7131 100644 +--- a/test/zdtm/static/Makefile ++++ b/test/zdtm/static/Makefile +@@ -403,6 +403,7 @@ TST_DIR = \ + mnt_ext_collision \ + mntns_pivot_root \ + mntns_pivot_root_ro \ ++ mnt_ext_sharing \ + mnt_tracefs \ + mntns_deleted \ + unlink_regular00 \ +diff --git a/test/zdtm/static/mnt_ext_sharing.c b/test/zdtm/static/mnt_ext_sharing.c +new file mode 100644 +index 000000000..b562b5716 +--- /dev/null ++++ b/test/zdtm/static/mnt_ext_sharing.c +@@ -0,0 +1,236 @@ ++#include ++#include ++#include ++#include ++#include ++ ++#include "zdtmtst.h" ++#include "lock.h" ++ ++const char *test_doc = "Check sharing vs external mounts vs mntns"; ++const char *test_author = "Pavel Tikhomirov "; ++ ++char *dirname = "mnt_ext_sharing.test"; ++char *source = "zdtm_ext_sharing"; ++char *internal_source = "zdtm_ext_sharing.internal"; ++#define SUBDIR "subdir" ++TEST_OPTION(dirname, string, "directory name", 1); ++ ++enum { ++ TEST_START, ++ TEST_STARTED, ++ TEST_EXIT, ++ TEST_EXITED, ++}; ++ ++struct shared { ++ futex_t fstate; ++ int ret; ++}; ++ ++struct shared *sh; ++ ++#define BUF_SIZE 4096 ++ ++int pid_mntinfo_get_shid(char *pid, char *source) ++{ ++ char path[PATH_MAX], line[BUF_SIZE]; ++ FILE *mountinfo; ++ char *hyphen, *shared; ++ int ret = -1; ++ ++ sprintf(path, "/proc/%s/mountinfo", pid); ++ mountinfo = fopen(path, "r"); ++ if (!mountinfo) { ++ pr_perror("fopen"); ++ return ret; ++ } ++ ++ while (fgets(line, sizeof(line), mountinfo)) { ++ hyphen = strchr(line, '-'); ++ if (!hyphen) { ++ pr_perror("no hyphen in mountinfo"); ++ break; ++ } ++ ++ if (!strstr(hyphen + 1, source)) ++ continue; ++ ++ shared = strstr(line, "shared:"); ++ if (!shared) { ++ pr_err("no shared id\n"); ++ break; ++ } ++ ++ ret = atoi(shared + 7); ++ break; ++ } ++ ++ fclose(mountinfo); ++ return ret; ++} ++ ++int secondary_mntns_child(void) ++{ ++ if (unshare(CLONE_NEWNS)) { ++ pr_perror("unshare"); ++ sh->ret = 1; ++ futex_abort_and_wake(&sh->fstate); ++ return 1; ++ } ++ futex_set_and_wake(&sh->fstate, TEST_STARTED); ++ futex_wait_until(&sh->fstate, TEST_EXIT); ++ /* These task is just holding the reference to secondary mntns */ ++ futex_set_and_wake(&sh->fstate, TEST_EXITED); ++ return 0; ++} ++ ++int main(int argc, char **argv) ++{ ++ char *root, testdir[PATH_MAX], spid[BUF_SIZE]; ++ char internal_dst[PATH_MAX], internal_src[PATH_MAX], internal_nsdst[PATH_MAX]; ++ int internal_shid_self = -1, internal_shid_pid = -1; ++ char *tmp = "/tmp/zdtm_ext_sharing.tmp"; ++ char *zdtm_newns = getenv("ZDTM_NEWNS"); ++ int pid, status; ++ ++ root = getenv("ZDTM_ROOT"); ++ if (root == NULL) { ++ pr_perror("root"); ++ return 1; ++ } ++ ++ if (!zdtm_newns) { ++ pr_perror("ZDTM_NEWNS is not set"); ++ return 1; ++ } else if (strcmp(zdtm_newns, "1")) { ++ goto test; ++ } ++ ++ /* Prepare directories in test root */ ++ sprintf(testdir, "%s/%s", root, dirname); ++ mkdir(testdir, 0755); ++ ++ sprintf(internal_dst, "%s/%s/internal", root, dirname); ++ mkdir(internal_dst, 0755); ++ ++ /* Prepare directories in criu root */ ++ mkdir(tmp, 0755); ++ if (mount(source, tmp, "tmpfs", 0, NULL)) { ++ pr_perror("mount tmpfs"); ++ return 1; ++ } ++ if (mount(NULL, tmp, NULL, MS_PRIVATE, NULL)) { ++ pr_perror("make private"); ++ return 1; ++ } ++ ++ sprintf(internal_src, "%s/internal", tmp); ++ mkdir(internal_src, 0755); ++ ++ /* Create a shared mount in criu mntns */ ++ if (mount(internal_source, internal_src, "tmpfs", 0, NULL)) { ++ pr_perror("mount tmpfs"); ++ return 1; ++ } ++ if (mount(NULL, internal_src, NULL, MS_PRIVATE, NULL)) { ++ pr_perror("make private"); ++ return 1; ++ } ++ ++ if (mount(NULL, internal_src, NULL, MS_SHARED, NULL)) { ++ pr_perror("make shared"); ++ return 1; ++ } ++ ++ /* ++ * Create temporary mntns, next mounts will not show up in criu mntns ++ */ ++ if (unshare(CLONE_NEWNS)) { ++ pr_perror("unshare"); ++ return 1; ++ } ++ ++ /* ++ * Populate to the tests root only a subdirectory of the internal_src ++ * mount to ensure that it will be restored as an external mount. ++ */ ++ sprintf(internal_src, "%s/internal/%s", tmp, SUBDIR); ++ mkdir(internal_src, 0755); ++ if (mount(internal_src, internal_dst, NULL, MS_BIND, NULL)) { ++ pr_perror("bind"); ++ return 1; ++ } ++ ++test: ++ test_init(argc, argv); ++ ++ sh = mmap(NULL, sizeof(struct shared), PROT_WRITE | PROT_READ, MAP_SHARED | MAP_ANONYMOUS, -1, 0); ++ if (sh == MAP_FAILED) { ++ pr_perror("Failed to alloc shared region"); ++ exit(1); ++ } ++ ++ futex_set(&sh->fstate, TEST_START); ++ sh->ret = 0; ++ ++ sprintf(internal_nsdst, "/%s/internal", dirname); ++ /* Make "external" mount to have internal sharing */ ++ if (mount(NULL, internal_nsdst, NULL, MS_PRIVATE, NULL)) { ++ pr_perror("make shared"); ++ return 1; ++ } ++ ++ if (mount(NULL, internal_nsdst, NULL, MS_SHARED, NULL)) { ++ pr_perror("make shared"); ++ return 1; ++ } ++ ++ /* Create secondary mntns copying all mounts */ ++ pid = fork(); ++ if (pid < 0) { ++ pr_perror("fork"); ++ return 1; ++ } else if (pid == 0) { ++ exit(secondary_mntns_child()); ++ } ++ ++ futex_wait_until(&sh->fstate, TEST_STARTED); ++ if (sh->ret != 0) { ++ pr_err("error in child\n"); ++ return 1; ++ } ++ ++ test_daemon(); ++ test_waitsig(); ++ ++ /* ++ * Check mounts in primary and secondary ++ * mntnses are shared to each other. ++ */ ++ sprintf(spid, "%d", pid); ++ internal_shid_pid = pid_mntinfo_get_shid(spid, internal_source); ++ internal_shid_self = pid_mntinfo_get_shid("self", internal_source); ++ ++ /* Cleanup */ ++ futex_set_and_wake(&sh->fstate, TEST_EXIT); ++ futex_wait_until(&sh->fstate, TEST_EXITED); ++ ++ while (wait(&status) > 0) { ++ if (!WIFEXITED(status) || WEXITSTATUS(status)) { ++ fail("Wrong exit status: %d", status); ++ return 1; ++ } ++ } ++ ++ if (internal_shid_pid == -1 || internal_shid_self == -1 || internal_shid_pid != internal_shid_self) { ++ fail("Shared ids does not match (internal)"); ++ return 1; ++ } ++ ++ /* Print shared id so that it can be checked in cleanup hook */ ++ test_msg("internal_shared_id = %d\n", internal_shid_pid); ++ pass(); ++ ++ return 0; ++} +diff --git a/test/zdtm/static/mnt_ext_sharing.desc b/test/zdtm/static/mnt_ext_sharing.desc +new file mode 100644 +index 000000000..d72505837 +--- /dev/null ++++ b/test/zdtm/static/mnt_ext_sharing.desc +@@ -0,0 +1,5 @@ ++{ 'dopts': '--external mnt[/mnt_ext_sharing.test/internal]:ZDTM', ++ 'feature': 'mnt_id move_mount_set_group', ++ 'flavor': 'ns uns', ++ 'flags': 'suid', ++ 'ropts': '--external mnt[ZDTM]:/tmp/zdtm_ext_sharing.tmp/internal/subdir --no-mntns-compat-mode'} +diff --git a/test/zdtm/static/mnt_ext_sharing.hook b/test/zdtm/static/mnt_ext_sharing.hook +new file mode 100755 +index 000000000..82443b632 +--- /dev/null ++++ b/test/zdtm/static/mnt_ext_sharing.hook +@@ -0,0 +1,27 @@ ++#!/bin/bash ++ ++[ "$1" == "--clean" ] || exit 0 ++ ++function err { ++ echo "$1" ++ exit 1 ++} ++ ++# Check shared ids don't match in criu mntns and test mntns ++OUT="zdtm/static/mnt_ext_sharing.out" ++[ -f "$OUT" ] || err "No $OUT file" ++ ++SHID=$(cat $OUT | grep internal_shared_id | awk '{print $5}') ++[ -z "$SHID" ] && err "Failed to get shared id from file" ++MATCH=$(cat /proc/self/mountinfo | grep "\.* - tmpfs zdtm_ext_sharing.internal") ++[ -z "$MATCH" ] || err "Can lookup internal shared id $SHID in criu mntns" ++ ++TMP="/tmp/zdtm_ext_sharing.tmp" ++echo "Cleanup mnt_ext_sharing" ++umount "$TMP/internal" ++umount "$TMP" ++rm -rf $TMP ++ ++rm -rf "mnt_ext_sharing.test" ++ ++exit 0 +-- +2.35.1 + diff --git a/0219-zdtm-add-mount_complex_sharing-test.patch b/0219-zdtm-add-mount_complex_sharing-test.patch new file mode 100644 index 0000000..cf2ceaa --- /dev/null +++ b/0219-zdtm-add-mount_complex_sharing-test.patch @@ -0,0 +1,293 @@ +From 19621b2b22680d4d9b811ac1a4d55e2b7952f53f Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Tue, 28 Jul 2020 11:49:45 +0300 +Subject: [PATCH 219/245] zdtm: add mount_complex_sharing test + +Mounts-v2 engine should fix multiple problems of old engine relative to +sharing options, lets add a test for such problems. + +Add all four types of shared groups: 1) private, 2) shared, 3) slave +and 4) slave+shared for mounts. Propagate them into sharing and after +propagation change sharing with four ways: 1) don't change, 2) make +private, 3) make slave and 4) make private + make shared. + +This brings 16 cases of different sharing options for mount propagation, +lets check that they all are restored fine. + +Lets create mounts from description to make it easier to improve this +test in future. + +Cherry-picked from Virtuozzo criu: +https://src.openvz.org/projects/OVZ/repos/criu/commits/8bcd0034d + +FIXME: need to check options restored right as we don't have +--check-mounts to do this job for us. + +Signed-off-by: Pavel Tikhomirov +--- + test/zdtm/static/Makefile | 1 + + test/zdtm/static/mount_complex_sharing.c | 228 ++++++++++++++++++++ + test/zdtm/static/mount_complex_sharing.desc | 4 + + 3 files changed, 233 insertions(+) + create mode 100644 test/zdtm/static/mount_complex_sharing.c + create mode 100644 test/zdtm/static/mount_complex_sharing.desc + +diff --git a/test/zdtm/static/Makefile b/test/zdtm/static/Makefile +index 9183e7131..717306dbb 100644 +--- a/test/zdtm/static/Makefile ++++ b/test/zdtm/static/Makefile +@@ -404,6 +404,7 @@ TST_DIR = \ + mntns_pivot_root \ + mntns_pivot_root_ro \ + mnt_ext_sharing \ ++ mount_complex_sharing \ + mnt_tracefs \ + mntns_deleted \ + unlink_regular00 \ +diff --git a/test/zdtm/static/mount_complex_sharing.c b/test/zdtm/static/mount_complex_sharing.c +new file mode 100644 +index 000000000..efc1b14aa +--- /dev/null ++++ b/test/zdtm/static/mount_complex_sharing.c +@@ -0,0 +1,228 @@ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "zdtmtst.h" ++ ++const char *test_doc = "Check complex sharing options for mounts"; ++const char *test_author = "Pavel Tikhomirov "; ++ ++char *dirname = "mount_complex_sharing"; ++TEST_OPTION(dirname, string, "directory name", 1); ++ ++/* ++ * Description for creating a single file: ++ * path - path to create file in (relative to mount) ++ * dir - true if file is a directory ++ * content - if file is not a directory, this string is written into the file ++ */ ++struct file { ++ char *path; ++ bool dir; ++ char *content; ++}; ++ ++/* ++ * Description for creating a single mount: ++ * mountpoint - path to create mount on (relative to dirname) ++ * bind - id of bind source if any or -1 ++ * bind_root - root offset from bind source ++ * fstype - needed for non-binds, always tmpfs ++ * source - source for mounting ++ * shflags - array of sharing options applied after mounting (ending with -1) ++ * mounted - identifies implicitly propagated mounts ++ * files - array of files we need to create on mount (ending with zeroed file) ++ */ ++struct mountinfo { ++ char *mountpoint; ++ int bind; ++ char *bind_root; ++ char *fstype; ++ char *source; ++ int shflags[3]; ++ bool mounted; ++ struct file files[10]; ++}; ++ ++/* clang-format off */ ++struct mountinfo mounts[] = { ++ {"", -1, "", "tmpfs", "tmpfs-dirname", {MS_PRIVATE, -1}, false, ++ { ++ {"shared-bind-1", true}, ++ {"shared-bind-2", true}, ++ {"shared-bind-3", true}, ++ {"shared-bind-4", true}, ++ {"private-mnt", true}, ++ {"shared-mnt", true}, ++ {"slave-mnt", true}, ++ {"slave-shared-mnt", true}, ++ {"testfile", false, "TESTFILE"}, ++ {NULL} ++ } ++ }, ++ ++ {"shared-bind-1", -1, "", "tmpfs", "tmpfs-shared-bind", {MS_SHARED, -1}, false, ++ { ++ {"prop-private", true}, ++ {"prop-shared", true}, ++ {"prop-slave", true}, ++ {"prop-slave-shared", true}, ++ {NULL} ++ } ++ }, ++ {"shared-bind-2", 1, "", NULL, NULL, {-1}, false}, ++ {"shared-bind-3", 1, "", NULL, NULL, {-1}, false}, ++ {"shared-bind-4", 1, "", NULL, NULL, {-1}, false}, ++ ++ {"private-mnt", -1, "", "tmpfs", "tmpfs-mnt", {MS_PRIVATE, -1}, false, ++ { ++ {"subdir", true}, ++ {NULL} ++ } ++ }, ++ {"shared-mnt", 5, "", NULL, NULL, {MS_SHARED, -1}, false}, ++ {"slave-mnt", 6, "", NULL, NULL, {MS_SLAVE, -1}, false}, ++ {"slave-shared-mnt", 7, "", NULL, NULL, {MS_SHARED, -1}, false}, ++ ++ {"shared-bind-1/prop-private", 5, "subdir", NULL, NULL, {-1}, false}, ++ {"shared-bind-1/prop-shared", 6, "subdir", NULL, NULL, {-1}, false}, ++ {"shared-bind-1/prop-slave", 7, "subdir", NULL, NULL, {-1}, false}, ++ {"shared-bind-1/prop-slave-shared", 8, "subdir", NULL, NULL, {-1}, false}, ++ ++ {"shared-bind-2/prop-private", -1, NULL, NULL, NULL, {MS_PRIVATE, -1}, true}, ++ {"shared-bind-2/prop-shared", -1, NULL, NULL, NULL, {MS_PRIVATE, -1}, true}, ++ {"shared-bind-2/prop-slave", -1, NULL, NULL, NULL, {MS_PRIVATE, -1}, true}, ++ {"shared-bind-2/prop-slave-shared", -1, NULL, NULL, NULL, {MS_PRIVATE, -1}, true}, ++ ++ {"shared-bind-3/prop-private", -1, NULL, NULL, NULL, {MS_SLAVE, -1}, true}, ++ {"shared-bind-3/prop-shared", -1, NULL, NULL, NULL, {MS_SLAVE, -1}, true}, ++ {"shared-bind-3/prop-slave", -1, NULL, NULL, NULL, {MS_SLAVE, -1}, true}, ++ {"shared-bind-3/prop-slave-shared", -1, NULL, NULL, NULL, {MS_SLAVE, -1}, true}, ++ ++ {"shared-bind-4/prop-private", -1, NULL, NULL, NULL, {MS_PRIVATE, MS_SHARED, -1}, true}, ++ {"shared-bind-4/prop-shared", -1, NULL, NULL, NULL, {MS_PRIVATE, MS_SHARED, -1}, true}, ++ {"shared-bind-4/prop-slave", -1, NULL, NULL, NULL, {MS_PRIVATE, MS_SHARED, -1}, true}, ++ {"shared-bind-4/prop-slave-shared", -1, NULL, NULL, NULL, {MS_PRIVATE, MS_SHARED, -1}, true}, ++}; ++/* clang-format on */ ++ ++static int fill_content(struct mountinfo *mi) ++{ ++ struct file *file = &mi->files[0]; ++ char path[PATH_MAX]; ++ ++ while (file->path != NULL) { ++ snprintf(path, sizeof(path), "%s/%s/%s", dirname, mi->mountpoint, file->path); ++ ++ if (file->dir) { ++ test_msg("Mkdir %s\n", path); ++ if (mkdir(path, 0700)) { ++ pr_perror("Failed to create dir %s", path); ++ return -1; ++ } ++ } else { ++ int fd, len = strlen(file->content); ++ ++ test_msg("Create file %s with content %s\n", path, file->content); ++ fd = open(path, O_WRONLY | O_CREAT, 0777); ++ if (fd < 0) { ++ pr_perror("Failed to create file %s", path); ++ return -1; ++ } ++ ++ if (write(fd, file->content, len) != len) { ++ pr_perror("Failed to write %s to file %s", file->content, path); ++ close(fd); ++ return -1; ++ } ++ close(fd); ++ } ++ ++ file++; ++ } ++ ++ return 0; ++} ++ ++static int mount_one(struct mountinfo *mi) ++{ ++ char source[PATH_MAX], target[PATH_MAX]; ++ int *shflags = mi->shflags, mflags = 0; ++ char *fstype = NULL; ++ ++ test_msg("Mounting %s %d %s %s %d\n", mi->mountpoint, mi->bind, mi->fstype, mi->source, mi->mounted); ++ ++ snprintf(target, sizeof(target), "%s/%s", dirname, mi->mountpoint); ++ ++ if (mi->mounted) ++ goto sharing; ++ ++ if (mi->bind != -1) { ++ snprintf(source, sizeof(source), "%s/%s/%s", dirname, mounts[mi->bind].mountpoint, mi->bind_root); ++ fstype = NULL; ++ mflags = MS_BIND; ++ } else { ++ snprintf(source, sizeof(source), "%s", mi->source); ++ fstype = mi->fstype; ++ } ++ ++ if (mount(source, target, fstype, mflags, NULL)) { ++ pr_perror("Failed to mount %s %s %s", source, target, fstype); ++ return -1; ++ } ++ ++ if (fill_content(mi)) ++ return -1; ++ ++sharing: ++ while (shflags[0] != -1) { ++ test_msg("Making mount %s 0x%x\n", target, shflags[0]); ++ if (mount(NULL, target, NULL, shflags[0], NULL)) { ++ pr_perror("Failed to make mount %s 0x%x", target, shflags[0]); ++ return -1; ++ } ++ shflags++; ++ } ++ ++ return 0; ++} ++ ++static int mount_loop(void) ++{ ++ int i; ++ ++ for (i = 0; i < ARRAY_SIZE(mounts); i++) { ++ if (mount_one(&mounts[i])) ++ return 1; ++ } ++ ++ return 0; ++} ++ ++int main(int argc, char **argv) ++{ ++ int ret = 1; ++ ++ test_init(argc, argv); ++ ++ if (mkdir(dirname, 0700) && errno != EEXIST) { ++ pr_perror("Failed to create %s", dirname); ++ goto err; ++ } ++ ++ if (mount_loop()) ++ goto err; ++ ++ test_daemon(); ++ test_waitsig(); ++ ++ pass(); ++ ret = 0; ++err: ++ if (ret) ++ fail(); ++ return ret; ++} +diff --git a/test/zdtm/static/mount_complex_sharing.desc b/test/zdtm/static/mount_complex_sharing.desc +new file mode 100644 +index 000000000..8910f4684 +--- /dev/null ++++ b/test/zdtm/static/mount_complex_sharing.desc +@@ -0,0 +1,4 @@ ++{ 'flavor': 'ns uns', ++ 'flags': 'suid', ++ 'feature': 'move_mount_set_group', ++ 'ropts': '--no-mntns-compat-mode'} +-- +2.35.1 + diff --git a/0220-zdtm-add-propagation-group-with-mount-flags-to-mount.patch b/0220-zdtm-add-propagation-group-with-mount-flags-to-mount.patch new file mode 100644 index 0000000..a0705fc --- /dev/null +++ b/0220-zdtm-add-propagation-group-with-mount-flags-to-mount.patch @@ -0,0 +1,112 @@ +From 799d2e2a4d9a3289138206cf1f8b843082490355 Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Wed, 14 Oct 2020 15:56:52 +0300 +Subject: [PATCH 220/245] zdtm: add propagation group with mount flags to + mount_complex_sharing + +Before mounts-v2 we have seen mounts loosing their mount readonly flags +when they were in a propagation group, because CRIU "forgot" to set +them, with new mount engine it should work now as all propagations are +now created on the same path there all other normal mounts are created, +and all mount flags are restored. + +This test actually mounts only one mount, other three are propagations, +lets set mount ro flag for half of them. + +Cherry-picked from Virtuozzo criu: +https://src.openvz.org/projects/OVZ/repos/criu/commits/22584993d + +FIXME: need to check options restored right as we don't have +--check-mounts to do this job for us. + +Reviewed-by: Alexander Mikhalitsyn (Virtuozzo) +Signed-off-by: Pavel Tikhomirov +--- + test/zdtm/static/mount_complex_sharing.c | 27 +++++++++++++++--------- + 1 file changed, 17 insertions(+), 10 deletions(-) + +diff --git a/test/zdtm/static/mount_complex_sharing.c b/test/zdtm/static/mount_complex_sharing.c +index efc1b14aa..b4463c41a 100644 +--- a/test/zdtm/static/mount_complex_sharing.c ++++ b/test/zdtm/static/mount_complex_sharing.c +@@ -32,7 +32,8 @@ struct file { + * bind_root - root offset from bind source + * fstype - needed for non-binds, always tmpfs + * source - source for mounting +- * shflags - array of sharing options applied after mounting (ending with -1) ++ * flags - array of sharing options or mount flags applied after ++ * mounting (ending with -1) + * mounted - identifies implicitly propagated mounts + * files - array of files we need to create on mount (ending with zeroed file) + */ +@@ -42,7 +43,7 @@ struct mountinfo { + char *bind_root; + char *fstype; + char *source; +- int shflags[3]; ++ int flags[3]; + bool mounted; + struct file files[10]; + }; +@@ -70,6 +71,7 @@ struct mountinfo mounts[] = { + {"prop-shared", true}, + {"prop-slave", true}, + {"prop-slave-shared", true}, ++ {"prop-mount-flags", true}, + {NULL} + } + }, +@@ -106,6 +108,11 @@ struct mountinfo mounts[] = { + {"shared-bind-4/prop-shared", -1, NULL, NULL, NULL, {MS_PRIVATE, MS_SHARED, -1}, true}, + {"shared-bind-4/prop-slave", -1, NULL, NULL, NULL, {MS_PRIVATE, MS_SHARED, -1}, true}, + {"shared-bind-4/prop-slave-shared", -1, NULL, NULL, NULL, {MS_PRIVATE, MS_SHARED, -1}, true}, ++ ++ {"shared-bind-1/prop-mount-flags", 5, "subdir", NULL, NULL, {MS_RDONLY|MS_REMOUNT|MS_BIND, -1}, false}, ++ {"shared-bind-2/prop-mount-flags", -1, NULL, NULL, NULL, {MS_RDONLY|MS_REMOUNT|MS_BIND, -1}, true}, ++ {"shared-bind-3/prop-mount-flags", -1, NULL, NULL, NULL, {-1}, true}, ++ {"shared-bind-4/prop-mount-flags", -1, NULL, NULL, NULL, {-1}, true}, + }; + /* clang-format on */ + +@@ -150,7 +157,7 @@ static int fill_content(struct mountinfo *mi) + static int mount_one(struct mountinfo *mi) + { + char source[PATH_MAX], target[PATH_MAX]; +- int *shflags = mi->shflags, mflags = 0; ++ int *flags = mi->flags, mflags = 0; + char *fstype = NULL; + + test_msg("Mounting %s %d %s %s %d\n", mi->mountpoint, mi->bind, mi->fstype, mi->source, mi->mounted); +@@ -158,7 +165,7 @@ static int mount_one(struct mountinfo *mi) + snprintf(target, sizeof(target), "%s/%s", dirname, mi->mountpoint); + + if (mi->mounted) +- goto sharing; ++ goto apply_flags; + + if (mi->bind != -1) { + snprintf(source, sizeof(source), "%s/%s/%s", dirname, mounts[mi->bind].mountpoint, mi->bind_root); +@@ -177,14 +184,14 @@ static int mount_one(struct mountinfo *mi) + if (fill_content(mi)) + return -1; + +-sharing: +- while (shflags[0] != -1) { +- test_msg("Making mount %s 0x%x\n", target, shflags[0]); +- if (mount(NULL, target, NULL, shflags[0], NULL)) { +- pr_perror("Failed to make mount %s 0x%x", target, shflags[0]); ++apply_flags: ++ while (flags[0] != -1) { ++ test_msg("Making mount %s 0x%x\n", target, flags[0]); ++ if (mount(NULL, target, NULL, flags[0], NULL)) { ++ pr_perror("Failed to make mount %s 0x%x", target, flags[0]); + return -1; + } +- shflags++; ++ flags++; + } + + return 0; +-- +2.35.1 + diff --git a/0221-zdtm-mount-v2-disable-mnt_tracefs-test.patch b/0221-zdtm-mount-v2-disable-mnt_tracefs-test.patch new file mode 100644 index 0000000..7d5993f --- /dev/null +++ b/0221-zdtm-mount-v2-disable-mnt_tracefs-test.patch @@ -0,0 +1,36 @@ +From 116692772b5f4ff1818262096ec7934086749be5 Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Tue, 1 Dec 2020 16:07:16 +0300 +Subject: [PATCH 221/245] zdtm/mount-v2: disable mnt_tracefs test + +We can have tracefs separate mount from debugfs and that's why the +/sys/kernel/debug external mount now has children and this thing is not +supported to be bind in container with children, because we don't wan't +external mounts to introduce some unexpected extra external mounts so we +bind them without MS_REC in mount-v2 unlike in old mount engine. + +We can either bind without MS_REC when constructing test or provide all +children mount as separate external mounts to criu, let's just disable +for now. + +Cherry-picked from Virtuozzo criu: +https://src.openvz.org/projects/OVZ/repos/criu/commits/87875c023 + +Signed-off-by: Pavel Tikhomirov +--- + test/zdtm/static/mnt_tracefs.desc | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/test/zdtm/static/mnt_tracefs.desc b/test/zdtm/static/mnt_tracefs.desc +index e90ea9415..7cf98034a 100644 +--- a/test/zdtm/static/mnt_tracefs.desc ++++ b/test/zdtm/static/mnt_tracefs.desc +@@ -1,3 +1,4 @@ + { 'feature': 'mnt_id', + 'flavor': 'uns', +- 'opts': '--ext-mount-map auto --enable-external-masters'} ++ 'opts': '--ext-mount-map auto --enable-external-masters', ++ 'ropts': '--mntns-compat-mode'} +-- +2.35.1 + diff --git a/0222-ci-make-others-mnt_ext_dev-also-run-for-old-mount-en.patch b/0222-ci-make-others-mnt_ext_dev-also-run-for-old-mount-en.patch new file mode 100644 index 0000000..418bb99 --- /dev/null +++ b/0222-ci-make-others-mnt_ext_dev-also-run-for-old-mount-en.patch @@ -0,0 +1,45 @@ +From fa1c38177f1d49a7cfe506a5cfb4c8cd8231a21e Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Fri, 14 Jan 2022 19:29:08 +0300 +Subject: [PATCH 222/245] ci: make others/mnt_ext_dev also run for old mount + engine + +Now when we switched to mount-v2 by default to check old mount engine we +need to explicitly run with --mntns-compat-mode option. + +Signed-off-by: Pavel Tikhomirov +--- + scripts/ci/run-ci-tests.sh | 3 +++ + test/others/mnt-ext-dev/run.sh | 2 +- + 2 files changed, 4 insertions(+), 1 deletion(-) + +diff --git a/scripts/ci/run-ci-tests.sh b/scripts/ci/run-ci-tests.sh +index dd7c49d63..22420b922 100755 +--- a/scripts/ci/run-ci-tests.sh ++++ b/scripts/ci/run-ci-tests.sh +@@ -237,6 +237,9 @@ bash -x ./test/jenkins/criu-inhfd.sh + + if [ -z "$SKIP_EXT_DEV_TEST" ]; then + make -C test/others/mnt-ext-dev/ run ++ if criu/criu check --feature move_mount_set_group; then ++ EXTRA_OPTS=--mntns-compat-mode make -C test/others/mnt-ext-dev/ run ++ fi + fi + + make -C test/others/make/ run CC="$CC" +diff --git a/test/others/mnt-ext-dev/run.sh b/test/others/mnt-ext-dev/run.sh +index 9803a8f77..5a1f44450 100755 +--- a/test/others/mnt-ext-dev/run.sh ++++ b/test/others/mnt-ext-dev/run.sh +@@ -11,7 +11,7 @@ dev=`losetup --find --show zdtm.loop` + mkdir -p ../../dev + cp -ap $dev ../../dev + export ZDTM_MNT_EXT_DEV=$dev +-python ../../zdtm.py run -t zdtm/static/mnt_ext_dev || ret=$? ++python ../../zdtm.py run $EXTRA_OPTS -t zdtm/static/mnt_ext_dev || ret=$? + losetup -d $dev + unlink zdtm.loop + exit $ret +-- +2.35.1 + diff --git a/0223-test-jenkins-test-for-old-mount-engine.patch b/0223-test-jenkins-test-for-old-mount-engine.patch new file mode 100644 index 0000000..32f9347 --- /dev/null +++ b/0223-test-jenkins-test-for-old-mount-engine.patch @@ -0,0 +1,38 @@ +From de47b29c8410d930c55e3341e287964de1395efa Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Mon, 31 Jan 2022 11:02:36 +0300 +Subject: [PATCH 223/245] test/jenkins: test for old mount engine + +Let's run zdtm in jenkins with --mntns-compat-mode option and same for +device-external mount test from others. + +Signed-off-by: Pavel Tikhomirov +--- + test/jenkins/criu-compat-mounts.sh | 15 +++++++++++++++ + 1 file changed, 15 insertions(+) + create mode 100755 test/jenkins/criu-compat-mounts.sh + +diff --git a/test/jenkins/criu-compat-mounts.sh b/test/jenkins/criu-compat-mounts.sh +new file mode 100755 +index 000000000..cc68035f3 +--- /dev/null ++++ b/test/jenkins/criu-compat-mounts.sh +@@ -0,0 +1,15 @@ ++#!/bin/bash ++ ++# Make one regular C/R cycle with mount-v2 disabled ++set -e ++source `dirname $0`/criu-lib.sh ++prep ++FAIL=0 ++./test/zdtm.py run --all --mntns-compat-mode --keep-going --report report --parallel 4 || FAIL=$? ++ ++# Make device-external mounts test ++EXTRA_OPTS=--mntns-compat-mode make -C test/others/mnt-ext-dev/ run || FAIL=$? ++ ++if [ $FAIL -ne 0 ]; then ++ fail ++fi +-- +2.35.1 + diff --git a/0224-zdtm-mount-v2-disable-pty-console-test.patch b/0224-zdtm-mount-v2-disable-pty-console-test.patch new file mode 100644 index 0000000..129ebf3 --- /dev/null +++ b/0224-zdtm-mount-v2-disable-pty-console-test.patch @@ -0,0 +1,63 @@ +From b86b40a1f4d9cba0c1494d94c1aaf496006bffaa Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Mon, 14 Mar 2022 12:01:10 +0300 +Subject: [PATCH 224/245] zdtm/mount-v2: disable pty-console test + + [root@fedora criu]# ./test/zdtm.py run -t zdtm/static/pty-console --iters 2 --keep-going --ignore-taint + [WARNING] Option --keep-going is more useful when running multiple tests + userns is supported + === Run 1/1 ================ zdtm/static/pty-console + ====================== Run zdtm/static/pty-console in uns ====================== + Start test + Test is SUID + ./pty-console --pidfile=pty-console.pid --outfile=pty-console.out + Run criu dump + Run criu restore + Run criu dump + =[log]=> dump/zdtm/static/pty-console/62/2/dump.log + ------------------------ grep Error ------------------------ + b'(00.009325) 101 fdinfo 3: pos: 0 flags: 100000/0' + b'(00.009332) Dumping path for 3 fd via self 19 [/zdtm/static]' + b'(00.009345) 101 fdinfo 4: pos: 0 flags: 100002/0' + b'(00.009352) tty: Dumping tty 20 with id 0xc' + b"(00.009358) Error (criu/files-reg.c:1710): Can't lookup mount=1647 for fd=4 path=/ptmx" + b'(00.009361) ----------------------------------------' + b'(00.009369) Error (criu/cr-dump.c:1368): Dump files (pid: 101) failed with -1' + b'(00.009696) Running network-unlock scripts' + b'(00.012401) Unfreezing tasks into 1' + b'(00.012410) \tUnseizing 86 into 1' + b'(00.012415) \tUnseizing 101 into 1' + b'(00.012428) Error (criu/cr-dump.c:1788): Dumping FAILED.' + ------------------------ ERROR OVER ------------------------ + ################ Test zdtm/static/pty-console FAIL at CRIU dump ################ + Test output: ================================ + + <<< ================================ + Send the 9 signal to 86 + Wait for zdtm/static/pty-console(86) to die for 0.100000 + ##################################### FAIL ##################################### + +Restore on second iteration with mount-v2 fails, that is because +devpts_restore which is called from do_new_mount_v2 via fstype->restore +opens ptmx file in service mntns and saves it to fdstore for later use. +So after first c/r open ptmx fd changes mnt_id in fdinfo to a detached +mount. Let's just disable mount-v2 for this test for now. + +FIXME: We should create separate fstype hook to do_mount_in_right_mntns, +so that we can open files from this hook in actual restored mntns. + +Signed-off-by: Pavel Tikhomirov +--- + test/zdtm/static/pty-console.desc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/test/zdtm/static/pty-console.desc b/test/zdtm/static/pty-console.desc +index fba5e8749..3b3e3f73d 100644 +--- a/test/zdtm/static/pty-console.desc ++++ b/test/zdtm/static/pty-console.desc +@@ -1 +1 @@ +-{'flags': 'suid', 'flavor' : 'ns uns'} ++{'flags': 'suid', 'flavor' : 'ns uns', 'ropts': '--mntns-compat-mode'} +-- +2.35.1 + diff --git a/0225-mount-v2-make-mount-engine-fallback-messages-logleve.patch b/0225-mount-v2-make-mount-engine-fallback-messages-logleve.patch new file mode 100644 index 0000000..5f7b7a7 --- /dev/null +++ b/0225-mount-v2-make-mount-engine-fallback-messages-logleve.patch @@ -0,0 +1,51 @@ +From 10b38162535149095ee7290d98632043c63a21e9 Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Sun, 20 Mar 2022 19:38:34 +0300 +Subject: [PATCH 225/245] mount-v2: make mount engine fallback messages + loglevel debug + +On pre v5.15 kernel we don't have MOVE_MOUNT_SET_GROUP support and thus +all our ci logs are filled with "fallback" messages. Let's decrease log +level to debug, so that we don't see it in ci logs. + +Signed-off-by: Pavel Tikhomirov +--- + criu/config.c | 2 +- + criu/mount-v2.c | 4 ++-- + 2 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/criu/config.c b/criu/config.c +index 8b6d105ae..28641cf0c 100644 +--- a/criu/config.c ++++ b/criu/config.c +@@ -1110,7 +1110,7 @@ int check_options(void) + return 1; + } else if (!opts.mntns_compat_mode && opts.mode == CR_RESTORE) { + if (check_mount_v2()) { +- pr_warn("Mount engine fallback to --mntns-compat-mode mode\n"); ++ pr_debug("Mount engine fallback to --mntns-compat-mode mode\n"); + opts.mntns_compat_mode = true; + } + } +diff --git a/criu/mount-v2.c b/criu/mount-v2.c +index ec3965140..6772072de 100644 +--- a/criu/mount-v2.c ++++ b/criu/mount-v2.c +@@ -33,12 +33,12 @@ LIST_HEAD(sharing_groups); + int check_mount_v2(void) + { + if (!kdat.has_move_mount_set_group) { +- pr_warn("Mounts-v2 requires MOVE_MOUNT_SET_GROUP support\n"); ++ pr_debug("Mounts-v2 requires MOVE_MOUNT_SET_GROUP support\n"); + return -1; + } + + if (!kdat.has_openat2) { +- pr_warn("Mounts-v2 requires openat2 support\n"); ++ pr_debug("Mounts-v2 requires openat2 support\n"); + return -1; + } + +-- +2.35.1 + diff --git a/0226-mount-make-error-messages-differ-in-different-places.patch b/0226-mount-make-error-messages-differ-in-different-places.patch new file mode 100644 index 0000000..dadf9df --- /dev/null +++ b/0226-mount-make-error-messages-differ-in-different-places.patch @@ -0,0 +1,37 @@ +From 41df675d49afa4bb2e68fd0184ea1656b7d9900f Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Mon, 21 Mar 2022 10:19:29 +0300 +Subject: [PATCH 226/245] mount: make error messages differ in different places + +We have three of "Can't mount at %s", let's distinguish simple mount +from bind-mount and re-mount to make log reading easier. + +Signed-off-by: Pavel Tikhomirov +--- + criu/mount.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/criu/mount.c b/criu/mount.c +index 85fcb8843..8b6cdaf45 100644 +--- a/criu/mount.c ++++ b/criu/mount.c +@@ -2485,14 +2485,14 @@ do_bind: + } + + if (mount(root, service_mountpoint(mi), NULL, MS_BIND | (mi->flags & MS_REC), NULL) < 0) { +- pr_perror("Can't mount at %s", service_mountpoint(mi)); ++ pr_perror("Can't bind-mount at %s", service_mountpoint(mi)); + goto err; + } + + mflags = mi->flags & (~MS_PROPAGATE); + if (!mi->bind || mflags != (mi->bind->flags & (~MS_PROPAGATE))) + if (mount(NULL, service_mountpoint(mi), NULL, MS_BIND | MS_REMOUNT | mflags, NULL)) { +- pr_perror("Can't mount at %s", service_mountpoint(mi)); ++ pr_perror("Can't re-mount at %s", service_mountpoint(mi)); + goto err; + } + +-- +2.35.1 + diff --git a/0227-zdtm-use-unique-holder-for-cgroups.patch b/0227-zdtm-use-unique-holder-for-cgroups.patch new file mode 100644 index 0000000..ae25641 --- /dev/null +++ b/0227-zdtm-use-unique-holder-for-cgroups.patch @@ -0,0 +1,96 @@ +From 11e288fdab74a81a6ad678c0d6e24e1f6e689185 Mon Sep 17 00:00:00 2001 +From: Andrei Vagin +Date: Sun, 20 Mar 2022 22:11:19 -0700 +Subject: [PATCH 227/245] zdtm: use unique holder for cgroups + +The idea that each zdtm.py should have own helder, so that two zdtm.py that are +running on the same host don't effect each other. + +Fixes: #1774 +Signed-off-by: Andrei Vagin +--- + test/zdtm.py | 6 ++++-- + test/zdtm_mount_cgroups | 4 +++- + test/zdtm_umount_cgroups | 6 ++++-- + 3 files changed, 11 insertions(+), 5 deletions(-) + +diff --git a/test/zdtm.py b/test/zdtm.py +index f15420a65..a8704b3d7 100755 +--- a/test/zdtm.py ++++ b/test/zdtm.py +@@ -27,6 +27,7 @@ import subprocess + import sys + import tempfile + import time ++import uuid + from builtins import input, int, open, range, str, zip + + import yaml +@@ -38,6 +39,7 @@ from zdtm.criu_config import criu_config + STREAMED_IMG_FILE_NAME = "img.criu" + + prev_line = None ++uuid = uuid.uuid4() + + + def alarm(*args): +@@ -617,12 +619,12 @@ class zdtm_test: + if not os.access("zdtm/lib/libzdtmtst.a", os.F_OK): + subprocess.check_call(["make", "-C", "zdtm/"]) + subprocess.check_call( +- ["flock", "zdtm_mount_cgroups.lock", "./zdtm_mount_cgroups"]) ++ ["flock", "zdtm_mount_cgroups.lock", "./zdtm_mount_cgroups", str(uuid)]) + + @staticmethod + def cleanup(): + subprocess.check_call( +- ["flock", "zdtm_mount_cgroups.lock", "./zdtm_umount_cgroups"]) ++ ["flock", "zdtm_mount_cgroups.lock", "./zdtm_umount_cgroups", str(uuid)]) + + + def load_module_from_file(name, path): +diff --git a/test/zdtm_mount_cgroups b/test/zdtm_mount_cgroups +index 34e0e85ca..a99e16361 100755 +--- a/test/zdtm_mount_cgroups ++++ b/test/zdtm_mount_cgroups +@@ -4,13 +4,15 @@ + # Error (cgroup.c:768): cg: Set 3 is not subset of 2 + # so lets create all test controllers before executing tests. + ++uuid=$1 ++ + cat /proc/self/cgroup | grep -q zdtmtst.defaultroot && exit + + tdir=`mktemp -d zdtm.XXXXXX` + for i in "zdtmtst" "zdtmtst.defaultroot"; do + mount -t cgroup -o none,name=$i zdtm $tdir && + # a fake group prevents destroying of a controller +- mkdir -p $tdir/holder && ++ mkdir -p $tdir/holder.$uuid && + umount -l $tdir || exit 1 + done + rmdir $tdir +diff --git a/test/zdtm_umount_cgroups b/test/zdtm_umount_cgroups +index 75a8ea28f..decd70ff0 100755 +--- a/test/zdtm_umount_cgroups ++++ b/test/zdtm_umount_cgroups +@@ -4,12 +4,14 @@ + + cat /proc/self/cgroup | grep -q zdtmtst.defaultroot || exit 0 + ++uuid=$1 ++ + tdir=`mktemp -d zdtm.XXXXXX` + for i in "zdtmtst" "zdtmtst.defaultroot"; do + mount -t cgroup -o none,name=$i zdtm $tdir || { rmdir $tdir; exit 1; } + # remove a fake group if exists +- if [ -d "$tdir/holder" ]; then +- rmdir $tdir/holder || { umount -l $tdir && rmdir $tdir; exit 1; } ++ if [ -d "$tdir/holder.$uuid" ]; then ++ rmdir $tdir/holder.$uuid || { umount -l $tdir && rmdir $tdir; exit 1; } + fi + umount -l $tdir || exit 1; + done +-- +2.35.1 + diff --git a/0228-scripts-ci-mount-test-cgroups-once.patch b/0228-scripts-ci-mount-test-cgroups-once.patch new file mode 100644 index 0000000..710a406 --- /dev/null +++ b/0228-scripts-ci-mount-test-cgroups-once.patch @@ -0,0 +1,35 @@ +From 7cd8cfad1ed46962363441010ffa83f1de5ff551 Mon Sep 17 00:00:00 2001 +From: Andrei Vagin +Date: Sun, 20 Mar 2022 22:13:45 -0700 +Subject: [PATCH 228/245] scripts/ci: mount test cgroups once + +zdtm.py mounts two named controllers for tests. In CI, we run zdtm.py a few +times, so we can mount (create) these controllers once to avoid any unwanted +effects. + +Signed-off-by: Andrei Vagin +--- + scripts/ci/run-ci-tests.sh | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/scripts/ci/run-ci-tests.sh b/scripts/ci/run-ci-tests.sh +index 22420b922..14e6b1224 100755 +--- a/scripts/ci/run-ci-tests.sh ++++ b/scripts/ci/run-ci-tests.sh +@@ -139,6 +139,13 @@ time make unittest + + ulimit -c unlimited + ++cgid=$$ ++cleanup_cgroup() { ++ ./test/zdtm_umount_cgroups $cgid ++} ++trap cleanup_cgroup EXIT ++./test/zdtm_mount_cgroups $cgid ++ + echo "|$(pwd)/test/abrt.sh %P %p %s %e" > /proc/sys/kernel/core_pattern + + if [ "${COMPAT_TEST}x" = "yx" ] ; then +-- +2.35.1 + diff --git a/0229-criu-ns-add-a-helper-to-hold-a-pid-namespace.patch b/0229-criu-ns-add-a-helper-to-hold-a-pid-namespace.patch new file mode 100644 index 0000000..a3adbe0 --- /dev/null +++ b/0229-criu-ns-add-a-helper-to-hold-a-pid-namespace.patch @@ -0,0 +1,62 @@ +From 734553d5d0c784e8610d7c7ebbcda8607b28188b Mon Sep 17 00:00:00 2001 +From: Andrei Vagin +Date: Sun, 20 Mar 2022 00:43:45 -0700 +Subject: [PATCH 229/245] criu-ns: add a helper to hold a pid namespace + +The init process can exit if it doesn't have any child processes and its +pidns is destroyed in this case. CRIU dump is running in the target pid +namespace and it kills dumped processes at the end. We need to create a +holder process to be sure that the pid namespace will not be destroy +before criu exits. + +Fixes: #1775 + +Signed-off-by: Andrei Vagin +--- + scripts/criu-ns | 23 +++++++++++++++++++++++ + 1 file changed, 23 insertions(+) + +diff --git a/scripts/criu-ns b/scripts/criu-ns +index 930d20c80..9fc58b640 100755 +--- a/scripts/criu-ns ++++ b/scripts/criu-ns +@@ -82,6 +82,27 @@ def run_criu(args): + raise OSError(errno.ENOENT, "No such command") + + ++# pidns_holder creates a process that is reparented to the init. ++# ++# The init process can exit if it doesn't have any child processes and its ++# pidns is destroyed in this case. CRIU dump is running in the target pid ++# namespace and it kills dumped processes at the end. We need to create a ++# holder process to be sure that the pid namespace will not be destroy before ++# criu exits. ++def pidns_holder(): ++ r, w = os.pipe() ++ pid = os.fork() ++ if pid == 0: ++ pid = os.fork() ++ if pid == 0: ++ os.close(w) ++ # The write end is owned by the parent process and it is closed by ++ # kernel when the parent process exits. ++ os.read(r, 1) ++ sys.exit(0) ++ os.waitpid(pid, 0) ++ ++ + def wrap_restore(): + restore_args = sys.argv[1:] + if '--restore-sibling' in restore_args: +@@ -200,6 +221,8 @@ def wrap_dump(): + set_pidns(pid, pid_idx) + set_mntns(pid) + ++ pidns_holder() ++ + criu_pid = os.fork() + if criu_pid == 0: + run_criu(sys.argv[1:]) +-- +2.35.1 + diff --git a/0230-apparmor-Fix-Wfortify-source-for-Clang.patch b/0230-apparmor-Fix-Wfortify-source-for-Clang.patch new file mode 100644 index 0000000..f424dac --- /dev/null +++ b/0230-apparmor-Fix-Wfortify-source-for-Clang.patch @@ -0,0 +1,34 @@ +From 6dd4c918bb3e5381a82a91cdb19119db33c2de74 Mon Sep 17 00:00:00 2001 +From: Fangrui Song +Date: Fri, 25 Mar 2022 17:18:30 -0700 +Subject: [PATCH 230/245] apparmor: Fix -Wfortify-source for Clang + +``` +criu/apparmor.c:679:26: error: 'fscanf' may overflow; destination buffer in argument 3 has size 48, but the corresponding specifier may require size 49 [-Werror,-Wfortify-source] + ret = fscanf(f, "%48s", contents); +``` +The buffer size should be at least one larger than the fscanf maximum +field width. + +Fixes: 8d992a680ef3 ("lsm: support checkpoint/restore of stacked apparmor profiles") +Signed-off-by: Fangrui Song +--- + criu/apparmor.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/criu/apparmor.c b/criu/apparmor.c +index f9ad79619..cc9e7ac2a 100644 +--- a/criu/apparmor.c ++++ b/criu/apparmor.c +@@ -668,7 +668,7 @@ int dump_aa_namespaces(void) + + bool check_aa_ns_dumping(void) + { +- char contents[48]; ++ char contents[49]; + int major, minor, ret; + FILE *f; + +-- +2.35.1 + diff --git a/0231-style-delete-some-redundant-code.patch b/0231-style-delete-some-redundant-code.patch new file mode 100644 index 0000000..05f91c9 --- /dev/null +++ b/0231-style-delete-some-redundant-code.patch @@ -0,0 +1,49 @@ +From 985713ac34cbf89cd894b12168abc13a77114311 Mon Sep 17 00:00:00 2001 +From: jiang wei +Date: Wed, 23 Mar 2022 21:48:16 +0800 +Subject: [PATCH 231/245] style: delete some redundant code + +There is some redundant in compel/src/main.c, making it better + +Signed-off-by: jiang wei +--- + compel/src/main.c | 6 +----- + 1 file changed, 1 insertion(+), 5 deletions(-) + +diff --git a/compel/src/main.c b/compel/src/main.c +index f461ff04d..632354582 100644 +--- a/compel/src/main.c ++++ b/compel/src/main.c +@@ -94,7 +94,6 @@ static int piegen(void) + } + + if (handle_binary(mem, st.st_size)) { +- close(fd), fd = -1; + unlink(opts.output_filename); + goto err; + } +@@ -102,8 +101,7 @@ static int piegen(void) + ret = 0; + + err: +- if (fd >= 0) +- close(fd); ++ close(fd); + if (opts.fout) + fclose(opts.fout); + if (!ret) +@@ -347,11 +345,9 @@ int main(int argc, char *argv[]) + printf("Version: %d.%d.%d\n", COMPEL_SO_VERSION_MAJOR, COMPEL_SO_VERSION_MINOR, + COMPEL_SO_VERSION_SUBLEVEL); + exit(0); +- break; + default: // '?' + // error message already printed by getopt_long() + return usage(1); +- break; + } + } + +-- +2.35.1 + diff --git a/0232-mount-fix-Wunused-but-set-variable-for-Clang-15.patch b/0232-mount-fix-Wunused-but-set-variable-for-Clang-15.patch new file mode 100644 index 0000000..ad0138c --- /dev/null +++ b/0232-mount-fix-Wunused-but-set-variable-for-Clang-15.patch @@ -0,0 +1,28 @@ +From 797bfaf363ba73844de0030f9d8f4fd0252133dc Mon Sep 17 00:00:00 2001 +From: Fangrui Song +Date: Fri, 25 Mar 2022 17:27:11 -0700 +Subject: [PATCH 232/245] mount: fix -Wunused-but-set-variable for Clang 15 + +Since https://reviews.llvm.org/D122271, Clang -Wset-but-unused-variable +gets smarter to warn about unused post-increments. + +Signed-off-by: Fangrui Song +--- + criu/mount.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/criu/mount.c b/criu/mount.c +index 8b6cdaf45..65e186af9 100644 +--- a/criu/mount.c ++++ b/criu/mount.c +@@ -1991,6 +1991,7 @@ static int mnt_tree_for_each_reverse(struct mount_info *m, int (*fn)(struct moun + int progress = 0; + + MNT_TREE_WALK(m, prev, MNT_WALK_NONE, fn, (struct list_head *)NULL, progress); ++ (void)progress; // Suppress -Wused-but-unset-variable for clang>=15 + + return 0; + } +-- +2.35.1 + diff --git a/0233-criu-generate-unique-socket-names.patch b/0233-criu-generate-unique-socket-names.patch new file mode 100644 index 0000000..be45786 --- /dev/null +++ b/0233-criu-generate-unique-socket-names.patch @@ -0,0 +1,146 @@ +From 574316fe95bcbcc74f31a1dc40025baec7ffd1c7 Mon Sep 17 00:00:00 2001 +From: Andrei Vagin +Date: Thu, 31 Mar 2022 23:52:33 -0700 +Subject: [PATCH 233/245] criu: generate unique socket names + +CRIU has a few places where it creates unix sockets and their names have to be +unique for each criu run. + +Fixes: #1798 +Signed-off-by: Andrei Vagin +--- + compel/include/uapi/infect-util.h | 6 ++++++ + compel/src/lib/infect-util.c | 2 ++ + compel/src/lib/infect.c | 3 ++- + criu/fdstore.c | 4 +++- + criu/pidfd-store.c | 3 ++- + criu/unittest/mock.c | 3 +++ + criu/util.c | 3 +++ + 7 files changed, 21 insertions(+), 3 deletions(-) + +diff --git a/compel/include/uapi/infect-util.h b/compel/include/uapi/infect-util.h +index 4e32d13dc..ace6f6b6b 100644 +--- a/compel/include/uapi/infect-util.h ++++ b/compel/include/uapi/infect-util.h +@@ -3,6 +3,12 @@ + + #include "common/compiler.h" + ++/* ++ * compel_run_id is a unique value of the current run. It can be used to ++ * generate resource ID-s to avoid conflicts with other processes. ++ */ ++extern uint64_t compel_run_id; ++ + struct parasite_ctl; + extern int __must_check compel_util_send_fd(struct parasite_ctl *ctl, int fd); + extern int compel_util_recv_fd(struct parasite_ctl *ctl, int *pfd); +diff --git a/compel/src/lib/infect-util.c b/compel/src/lib/infect-util.c +index 5d6d0ddd8..00a7c83f7 100644 +--- a/compel/src/lib/infect-util.c ++++ b/compel/src/lib/infect-util.c +@@ -7,6 +7,8 @@ + #include "infect-rpc.h" + #include "infect-util.h" + ++uint64_t compel_run_id; ++ + int compel_util_send_fd(struct parasite_ctl *ctl, int fd) + { + int sk; +diff --git a/compel/src/lib/infect.c b/compel/src/lib/infect.c +index 0fb9e715c..78e4d7e0e 100644 +--- a/compel/src/lib/infect.c ++++ b/compel/src/lib/infect.c +@@ -1,3 +1,4 @@ ++#include + #include + #include + #include +@@ -364,7 +365,7 @@ static int gen_parasite_saddr(struct sockaddr_un *saddr, int key) + int sun_len; + + saddr->sun_family = AF_UNIX; +- snprintf(saddr->sun_path, UNIX_PATH_MAX, "X/crtools-pr-%d", key); ++ snprintf(saddr->sun_path, UNIX_PATH_MAX, "X/crtools-pr-%d-%" PRIx64, key, compel_run_id); + + sun_len = SUN_LEN(saddr); + *saddr->sun_path = '\0'; +diff --git a/criu/fdstore.c b/criu/fdstore.c +index 65264a511..6a7f73a59 100644 +--- a/criu/fdstore.c ++++ b/criu/fdstore.c +@@ -12,6 +12,7 @@ + #include "xmalloc.h" + #include "rst-malloc.h" + #include "log.h" ++#include "util.h" + + /* clang-format off */ + static struct fdstore_desc { +@@ -56,7 +57,8 @@ int fdstore_init(void) + } + + addr.sun_family = AF_UNIX; +- addrlen = snprintf(addr.sun_path, sizeof(addr.sun_path), "X/criu-fdstore-%" PRIx64, st.st_ino); ++ addrlen = snprintf(addr.sun_path, sizeof(addr.sun_path), "X/criu-fdstore-%" PRIx64 "-%" PRIx64, st.st_ino, ++ criu_run_id); + addrlen += sizeof(addr.sun_family); + + addr.sun_path[0] = 0; +diff --git a/criu/pidfd-store.c b/criu/pidfd-store.c +index 98b478b30..b15568e08 100644 +--- a/criu/pidfd-store.c ++++ b/criu/pidfd-store.c +@@ -100,7 +100,8 @@ int init_pidfd_store_sk(pid_t pid, int sk) + goto err; + } + +- addrlen = snprintf(addr.sun_path, sizeof(addr.sun_path), "X/criu-pidfd-store-%d-%d", pid, sk); ++ addrlen = snprintf(addr.sun_path, sizeof(addr.sun_path), "X/criu-pidfd-store-%d-%d-%" PRIx64, pid, sk, ++ criu_run_id); + addrlen += sizeof(addr.sun_family); + + addr.sun_path[0] = 0; +diff --git a/criu/unittest/mock.c b/criu/unittest/mock.c +index dc5b627f7..0151873dc 100644 +--- a/criu/unittest/mock.c ++++ b/criu/unittest/mock.c +@@ -2,6 +2,7 @@ + + #include + #include ++#include + #include + + int add_external(char *key) +@@ -141,3 +142,5 @@ int check_mount_v2(void) + { + return 0; + } ++ ++uint64_t compel_run_id; +diff --git a/criu/util.c b/criu/util.c +index f8da4ac5c..dd1fd97f5 100644 +--- a/criu/util.c ++++ b/criu/util.c +@@ -52,6 +52,8 @@ + #include "cr-errno.h" + #include "action-scripts.h" + ++#include "compel/infect-util.h" ++ + #define VMA_OPT_LEN 128 + + static int xatol_base(const char *string, long *number, int base) +@@ -1816,6 +1818,7 @@ void util_init() + + clock_gettime(CLOCK_MONOTONIC, &tp); + criu_run_id = ((uint64_t)getpid() << 32) + tp.tv_sec + tp.tv_nsec; ++ compel_run_id = criu_run_id; + } + + /* +-- +2.35.1 + diff --git a/0234-ci-Ubuntu-broke-overlayfs-again.patch b/0234-ci-Ubuntu-broke-overlayfs-again.patch new file mode 100644 index 0000000..fc2403e --- /dev/null +++ b/0234-ci-Ubuntu-broke-overlayfs-again.patch @@ -0,0 +1,48 @@ +From 4edd5dd5b2ef0ad051cec79adbdd10067fd821df Mon Sep 17 00:00:00 2001 +From: Adrian Reber +Date: Tue, 5 Apr 2022 07:05:53 +0000 +Subject: [PATCH 234/245] ci: Ubuntu broke overlayfs again + +Switch to non overlaysfs tests for Podman and Docker. + +Signed-off-by: Adrian Reber +--- + scripts/ci/docker-test.sh | 5 ++++- + scripts/ci/podman-test.sh | 5 ++++- + 2 files changed, 8 insertions(+), 2 deletions(-) + +diff --git a/scripts/ci/docker-test.sh b/scripts/ci/docker-test.sh +index d4b11bd55..397fd7b0e 100755 +--- a/scripts/ci/docker-test.sh ++++ b/scripts/ci/docker-test.sh +@@ -21,7 +21,10 @@ add-apt-repository \ + + . /etc/lsb-release + +-echo '{ "experimental": true }' > /etc/docker/daemon.json ++# overlayfs behaves differently on Ubuntu (18.04) and breaks CRIU ++# https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1857257 ++# Switch to devicemapper ++echo '{ "experimental": true, "storage-driver": "devicemapper" }' > /etc/docker/daemon.json + + CRIU_LOG='/criu.log' + mkdir -p /etc/criu +diff --git a/scripts/ci/podman-test.sh b/scripts/ci/podman-test.sh +index 5e5eb764d..d66b281b3 100755 +--- a/scripts/ci/podman-test.sh ++++ b/scripts/ci/podman-test.sh +@@ -25,7 +25,10 @@ make install + popd + rm -rf "${tmp_dir}" + +-podman info ++# overlaysfs behaves differently on Ubuntu and breaks CRIU ++# https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1857257 ++export STORAGE_DRIVER=vfs ++podman --storage-driver vfs info + + # shellcheck disable=SC2016 + podman run --name cr -d docker.io/library/alpine /bin/sh -c 'i=0; while true; do echo $i; i=$(expr $i + 1); sleep 1; done' +-- +2.35.1 + diff --git a/0120-compel-add-rseq-syscall-into-compel-std-plugin-sysca.patch b/0235-compel-add-rseq-syscall-into-compel-std-plugin-sysca.patch similarity index 70% rename from 0120-compel-add-rseq-syscall-into-compel-std-plugin-sysca.patch rename to 0235-compel-add-rseq-syscall-into-compel-std-plugin-sysca.patch index 1b947b1..a83355e 100644 --- a/0120-compel-add-rseq-syscall-into-compel-std-plugin-sysca.patch +++ b/0235-compel-add-rseq-syscall-into-compel-std-plugin-sysca.patch @@ -1,8 +1,8 @@ -From f097cf5766c5a44b239d36692210bce50deb04ca Mon Sep 17 00:00:00 2001 +From f015c6b97bf6e074783d5c11d511b3263f95332e Mon Sep 17 00:00:00 2001 From: Alexander Mikhalitsyn Date: Tue, 21 Dec 2021 17:38:25 +0300 -Subject: [PATCH 01/10] compel: add rseq syscall into compel std plugin syscall - tables +Subject: [PATCH 235/245] compel: add rseq syscall into compel std plugin + syscall tables Add rseq syscall numbers for: arm/aarch64, mips64, ppc64le, s390, x86_64/x86 @@ -18,59 +18,59 @@ Signed-off-by: Alexander Mikhalitsyn 6 files changed, 6 insertions(+) diff --git a/compel/arch/arm/plugins/std/syscalls/syscall.def b/compel/arch/arm/plugins/std/syscalls/syscall.def -index e6508ed9f..866bb07a7 100644 +index c9bccc386..8bcc3cc50 100644 --- a/compel/arch/arm/plugins/std/syscalls/syscall.def +++ b/compel/arch/arm/plugins/std/syscalls/syscall.def -@@ -118,3 +118,4 @@ fsmount 432 432 (int fd, unsigned int flags, unsigned int attr_flags) - clone3 435 435 (struct clone_args *uargs, size_t size) +@@ -121,3 +121,4 @@ clone3 435 435 (struct clone_args *uargs, size_t size) pidfd_open 434 434 (pid_t pid, unsigned int flags) + openat2 437 437 (int dirfd, char *pathname, struct open_how *how, size_t size) pidfd_getfd 438 438 (int pidfd, int targetfd, unsigned int flags) +rseq 293 398 (void *rseq, uint32_t rseq_len, int flags, uint32_t sig) diff --git a/compel/arch/mips/plugins/std/syscalls/syscall_64.tbl b/compel/arch/mips/plugins/std/syscalls/syscall_64.tbl -index 7a6db192c..95dc7d3b2 100644 +index a74e694e2..505ec849d 100644 --- a/compel/arch/mips/plugins/std/syscalls/syscall_64.tbl +++ b/compel/arch/mips/plugins/std/syscalls/syscall_64.tbl -@@ -115,3 +115,4 @@ __NR_fsmount 5432 sys_fsmount (int fd, unsigned int flags, unsigned int attr - __NR_clone3 5435 sys_clone3 (struct clone_args *uargs, size_t size) +@@ -118,3 +118,4 @@ __NR_clone3 5435 sys_clone3 (struct clone_args *uargs, size_t size) __NR_pidfd_open 5434 sys_pidfd_open (pid_t pid, unsigned int flags) + __NR_openat2 5437 sys_openat2 (int dirfd, char *pathname, struct open_how *how, size_t size) __NR_pidfd_getfd 5438 sys_pidfd_getfd (int pidfd, int targetfd, unsigned int flags) +__NR_rseq 5327 sys_rseq (void *rseq, uint32_t rseq_len, int flags, uint32_t sig) diff --git a/compel/arch/ppc64/plugins/std/syscalls/syscall-ppc64.tbl b/compel/arch/ppc64/plugins/std/syscalls/syscall-ppc64.tbl -index 1bb626bc5..e2ee33945 100644 +index 648239182..af40d7104 100644 --- a/compel/arch/ppc64/plugins/std/syscalls/syscall-ppc64.tbl +++ b/compel/arch/ppc64/plugins/std/syscalls/syscall-ppc64.tbl -@@ -114,3 +114,4 @@ __NR_fsmount 432 sys_fsmount (int fd, unsigned int flags, unsigned int attr_f - __NR_clone3 435 sys_clone3 (struct clone_args *uargs, size_t size) +@@ -117,3 +117,4 @@ __NR_clone3 435 sys_clone3 (struct clone_args *uargs, size_t size) __NR_pidfd_open 434 sys_pidfd_open (pid_t pid, unsigned int flags) + __NR_openat2 437 sys_openat2 (int dirfd, char *pathname, struct open_how *how, size_t size) __NR_pidfd_getfd 438 sys_pidfd_getfd (int pidfd, int targetfd, unsigned int flags) +__NR_rseq 387 sys_rseq (void *rseq, uint32_t rseq_len, int flags, uint32_t sig) diff --git a/compel/arch/s390/plugins/std/syscalls/syscall-s390.tbl b/compel/arch/s390/plugins/std/syscalls/syscall-s390.tbl -index 7178bf483..bf3bf4714 100644 +index 169458296..6a349e1cb 100644 --- a/compel/arch/s390/plugins/std/syscalls/syscall-s390.tbl +++ b/compel/arch/s390/plugins/std/syscalls/syscall-s390.tbl -@@ -114,3 +114,4 @@ __NR_fsmount 432 sys_fsmount (int fd, unsigned int flags, unsigned int attr_f - __NR_clone3 435 sys_clone3 (struct clone_args *uargs, size_t size) +@@ -117,3 +117,4 @@ __NR_clone3 435 sys_clone3 (struct clone_args *uargs, size_t size) __NR_pidfd_open 434 sys_pidfd_open (pid_t pid, unsigned int flags) + __NR_openat2 437 sys_openat2 (int dirfd, char *pathname, struct open_how *how, size_t size) __NR_pidfd_getfd 438 sys_pidfd_getfd (int pidfd, int targetfd, unsigned int flags) +__NR_rseq 383 sys_rseq (void *rseq, uint32_t rseq_len, int flags, uint32_t sig) diff --git a/compel/arch/x86/plugins/std/syscalls/syscall_32.tbl b/compel/arch/x86/plugins/std/syscalls/syscall_32.tbl -index 7e456cdb7..3938b43a8 100644 +index 4179a7f5b..a119a59b2 100644 --- a/compel/arch/x86/plugins/std/syscalls/syscall_32.tbl +++ b/compel/arch/x86/plugins/std/syscalls/syscall_32.tbl -@@ -102,3 +102,4 @@ __NR_fsmount 432 sys_fsmount (int fd, unsigned int flags, unsigned int attr_f - __NR_clone3 435 sys_clone3 (struct clone_args *uargs, size_t size) +@@ -105,3 +105,4 @@ __NR_clone3 435 sys_clone3 (struct clone_args *uargs, size_t size) __NR_pidfd_open 434 sys_pidfd_open (pid_t pid, unsigned int flags) + __NR_openat2 437 sys_openat2 (int dirfd, char *pathname, struct open_how *how, size_t size) __NR_pidfd_getfd 438 sys_pidfd_getfd (int pidfd, int targetfd, unsigned int flags) +__NR_rseq 386 sys_rseq (void *rseq, uint32_t rseq_len, int flags, uint32_t sig) diff --git a/compel/arch/x86/plugins/std/syscalls/syscall_64.tbl b/compel/arch/x86/plugins/std/syscalls/syscall_64.tbl -index 2dfcc6eee..28f2fb98d 100644 +index 9c27ab8b5..16dd86e79 100644 --- a/compel/arch/x86/plugins/std/syscalls/syscall_64.tbl +++ b/compel/arch/x86/plugins/std/syscalls/syscall_64.tbl -@@ -113,3 +113,4 @@ __NR_fsmount 432 sys_fsmount (int fd, unsigned int flags, unsigned int attr_ - __NR_clone3 435 sys_clone3 (struct clone_args *uargs, size_t size) +@@ -116,3 +116,4 @@ __NR_clone3 435 sys_clone3 (struct clone_args *uargs, size_t size) __NR_pidfd_open 434 sys_pidfd_open (pid_t pid, unsigned int flags) + __NR_openat2 437 sys_openat2 (int dirfd, char *pathname, struct open_how *how, size_t size) __NR_pidfd_getfd 438 sys_pidfd_getfd (int pidfd, int targetfd, unsigned int flags) +__NR_rseq 334 sys_rseq (void *rseq, uint32_t rseq_len, int flags, uint32_t sig) -- -2.34.1 +2.35.1 diff --git a/0121-kerndat-check-for-rseq-syscall-support.patch b/0236-kerndat-check-for-rseq-syscall-support.patch similarity index 68% rename from 0121-kerndat-check-for-rseq-syscall-support.patch rename to 0236-kerndat-check-for-rseq-syscall-support.patch index 56611e6..9032c5c 100644 --- a/0121-kerndat-check-for-rseq-syscall-support.patch +++ b/0236-kerndat-check-for-rseq-syscall-support.patch @@ -1,7 +1,7 @@ -From 50f46b208eb62578c4c9c809c7934584f4f776b6 Mon Sep 17 00:00:00 2001 +From e4cc6dda5da18153a5ecfb969d9aa4d64ba05a4c Mon Sep 17 00:00:00 2001 From: Alexander Mikhalitsyn Date: Tue, 21 Dec 2021 18:27:52 +0300 -Subject: [PATCH 02/10] kerndat: check for rseq syscall support +Subject: [PATCH 236/245] kerndat: check for rseq syscall support Signed-off-by: Alexander Mikhalitsyn --- @@ -10,22 +10,22 @@ Signed-off-by: Alexander Mikhalitsyn 2 files changed, 19 insertions(+) diff --git a/criu/include/kerndat.h b/criu/include/kerndat.h -index a28a95802..3e0a657ba 100644 +index de14028f5..986dcdc09 100644 --- a/criu/include/kerndat.h +++ b/criu/include/kerndat.h -@@ -75,6 +75,7 @@ struct kerndat_s { - bool has_nspid; - bool has_nftables_concat; - bool has_sockopt_buf_lock; +@@ -80,6 +80,7 @@ struct kerndat_s { + dev_t hugetlb_dev[HUGETLB_MAX]; + bool has_move_mount_set_group; + bool has_openat2; + bool has_rseq; }; extern struct kerndat_s kdat; diff --git a/criu/kerndat.c b/criu/kerndat.c -index 9f6a6ec42..82143377f 100644 +index 93617012a..05cc5293b 100644 --- a/criu/kerndat.c +++ b/criu/kerndat.c -@@ -816,6 +816,20 @@ static int kerndat_x86_has_ptrace_fpu_xsave_bug(void) +@@ -905,6 +905,20 @@ static int kerndat_x86_has_ptrace_fpu_xsave_bug(void) return 0; } @@ -46,8 +46,8 @@ index 9f6a6ec42..82143377f 100644 int kerndat_sockopt_buf_lock(void) { int exit_code = -1; -@@ -1392,6 +1406,10 @@ int kerndat_init(void) - pr_err("kerndat_sockopt_buf_lock failed when initializing kerndat.\n"); +@@ -1606,6 +1620,10 @@ int kerndat_init(void) + pr_err("kerndat_has_openat2 failed when initializing kerndat.\n"); ret = -1; } + if (!ret && kerndat_has_rseq()) { @@ -58,5 +58,5 @@ index 9f6a6ec42..82143377f 100644 kerndat_lsm(); kerndat_mmap_min_addr(); -- -2.34.1 +2.35.1 diff --git a/0122-util-move-fork_and_ptrace_attach-helper-from-cr-chec.patch b/0237-util-move-fork_and_ptrace_attach-helper-from-cr-chec.patch similarity index 92% rename from 0122-util-move-fork_and_ptrace_attach-helper-from-cr-chec.patch rename to 0237-util-move-fork_and_ptrace_attach-helper-from-cr-chec.patch index 234d3e6..a9a56a2 100644 --- a/0122-util-move-fork_and_ptrace_attach-helper-from-cr-chec.patch +++ b/0237-util-move-fork_and_ptrace_attach-helper-from-cr-chec.patch @@ -1,7 +1,8 @@ -From 328810439d055dd0aa0bccf5ec85068649e9a76b Mon Sep 17 00:00:00 2001 +From e79349513330ecbb1891d49670e7283ce62a2799 Mon Sep 17 00:00:00 2001 From: Alexander Mikhalitsyn Date: Tue, 21 Dec 2021 21:17:16 +0300 -Subject: [PATCH 03/10] util: move fork_and_ptrace_attach helper from cr-check +Subject: [PATCH 237/245] util: move fork_and_ptrace_attach helper from + cr-check Signed-off-by: Alexander Mikhalitsyn --- @@ -11,7 +12,7 @@ Signed-off-by: Alexander Mikhalitsyn 3 files changed, 58 insertions(+), 57 deletions(-) diff --git a/criu/cr-check.c b/criu/cr-check.c -index 0320b445a..ccda00173 100644 +index 52393cc8b..381184374 100644 --- a/criu/cr-check.c +++ b/criu/cr-check.c @@ -537,63 +537,6 @@ static int check_sigqueuinfo(void) @@ -79,7 +80,7 @@ index 0320b445a..ccda00173 100644 { struct ptrace_peeksiginfo_args arg; diff --git a/criu/include/util.h b/criu/include/util.h -index 19d378fc5..9c2439789 100644 +index 5ccd24722..4e29c079e 100644 --- a/criu/include/util.h +++ b/criu/include/util.h @@ -166,6 +166,7 @@ extern int is_anon_link_type(char *link, char *type); @@ -91,10 +92,10 @@ index 19d378fc5..9c2439789 100644 extern int status_ready(void); extern int is_root_user(void); diff --git a/criu/util.c b/criu/util.c -index 822822186..15b3c3756 100644 +index dd1fd97f5..2c7749457 100644 --- a/criu/util.c +++ b/criu/util.c -@@ -655,6 +655,63 @@ out: +@@ -660,6 +660,63 @@ out: return ret; } @@ -159,5 +160,5 @@ index 822822186..15b3c3756 100644 { char c = 0; -- -2.34.1 +2.35.1 diff --git a/0123-cr-check-Add-ptrace-rseq-conf-dump-feature.patch b/0238-cr-check-Add-ptrace-rseq-conf-dump-feature.patch similarity index 76% rename from 0123-cr-check-Add-ptrace-rseq-conf-dump-feature.patch rename to 0238-cr-check-Add-ptrace-rseq-conf-dump-feature.patch index 4366fb7..88b8a8e 100644 --- a/0123-cr-check-Add-ptrace-rseq-conf-dump-feature.patch +++ b/0238-cr-check-Add-ptrace-rseq-conf-dump-feature.patch @@ -1,7 +1,7 @@ -From e4aca530b7d001fbccf9dfb2cf41c4b32f46a1fe Mon Sep 17 00:00:00 2001 +From dbd7a5a689f47694eccdab44290873023007f026 Mon Sep 17 00:00:00 2001 From: Alexander Mikhalitsyn Date: Tue, 21 Dec 2021 18:29:14 +0300 -Subject: [PATCH 04/10] cr-check: Add ptrace rseq conf dump feature +Subject: [PATCH 238/245] cr-check: Add ptrace rseq conf dump feature Add "get_rseq_conf" feature corresponding to the ptrace(PTRACE_GET_RSEQ_CONFIGURATION) support. @@ -15,7 +15,7 @@ Signed-off-by: Alexander Mikhalitsyn 4 files changed, 65 insertions(+) diff --git a/compel/include/uapi/ptrace.h b/compel/include/uapi/ptrace.h -index 533e0569f..15476f158 100644 +index 533e0569f..63dfee97f 100644 --- a/compel/include/uapi/ptrace.h +++ b/compel/include/uapi/ptrace.h @@ -65,6 +65,18 @@ typedef struct { @@ -23,14 +23,14 @@ index 533e0569f..15476f158 100644 } seccomp_metadata_t; +#ifndef PTRACE_GET_RSEQ_CONFIGURATION -+#define PTRACE_GET_RSEQ_CONFIGURATION 0x420f ++#define PTRACE_GET_RSEQ_CONFIGURATION 0x420f + -+struct ptrace_rseq_configuration { -+ __u64 rseq_abi_pointer; -+ __u32 rseq_abi_size; -+ __u32 signature; -+ __u32 flags; -+ __u32 pad; ++struct __ptrace_rseq_configuration { ++ uint64_t rseq_abi_pointer; ++ uint32_t rseq_abi_size; ++ uint32_t signature; ++ uint32_t flags; ++ uint32_t pad; +}; +#endif + @@ -38,7 +38,7 @@ index 533e0569f..15476f158 100644 #if PTRACE_EVENT_STOP == 7 /* Bad value from Linux 3.1-3.3, fixed in 3.4 */ #undef PTRACE_EVENT_STOP diff --git a/criu/cr-check.c b/criu/cr-check.c -index ccda00173..092ab2e79 100644 +index 381184374..a172806f5 100644 --- a/criu/cr-check.c +++ b/criu/cr-check.c @@ -798,6 +798,15 @@ static int check_ptrace_dump_seccomp_filters(void) @@ -57,36 +57,36 @@ index ccda00173..092ab2e79 100644 static int check_mem_dirty_track(void) { if (!kdat.has_dirty_track) { -@@ -1448,6 +1457,7 @@ int cr_check(void) - ret |= check_apparmor_stacking(); - ret |= check_network_lock_nftables(); - ret |= check_sockopt_buf_lock(); +@@ -1475,6 +1484,7 @@ int cr_check(void) + ret |= check_memfd_hugetlb(); + ret |= check_move_mount_set_group(); + ret |= check_openat2(); + ret |= check_ptrace_get_rseq_conf(); } /* -@@ -1561,6 +1571,7 @@ static struct feature_list feature_list[] = { - { "apparmor_stacking", check_apparmor_stacking }, - { "network_lock_nftables", check_network_lock_nftables }, - { "sockopt_buf_lock", check_sockopt_buf_lock }, +@@ -1591,6 +1601,7 @@ static struct feature_list feature_list[] = { + { "memfd_hugetlb", check_memfd_hugetlb }, + { "move_mount_set_group", check_move_mount_set_group }, + { "openat2", check_openat2 }, + { "get_rseq_conf", check_ptrace_get_rseq_conf }, { NULL, NULL }, }; diff --git a/criu/include/kerndat.h b/criu/include/kerndat.h -index 3e0a657ba..fdbe06c8e 100644 +index 986dcdc09..83d867e75 100644 --- a/criu/include/kerndat.h +++ b/criu/include/kerndat.h -@@ -76,6 +76,7 @@ struct kerndat_s { - bool has_nftables_concat; - bool has_sockopt_buf_lock; +@@ -81,6 +81,7 @@ struct kerndat_s { + bool has_move_mount_set_group; + bool has_openat2; bool has_rseq; + bool has_ptrace_get_rseq_conf; }; extern struct kerndat_s kdat; diff --git a/criu/kerndat.c b/criu/kerndat.c -index 82143377f..8772a7293 100644 +index 05cc5293b..04067ab57 100644 --- a/criu/kerndat.c +++ b/criu/kerndat.c @@ -4,6 +4,8 @@ @@ -98,7 +98,7 @@ index 82143377f..8772a7293 100644 #include #include #include -@@ -36,6 +38,7 @@ +@@ -37,6 +39,7 @@ #include "sockets.h" #include "net.h" #include "tun.h" @@ -106,7 +106,7 @@ index 82143377f..8772a7293 100644 #include #include "netfilter.h" #include "fsnotify.h" -@@ -830,6 +833,40 @@ static int kerndat_has_rseq(void) +@@ -919,6 +922,40 @@ static int kerndat_has_rseq(void) return 0; } @@ -114,7 +114,7 @@ index 82143377f..8772a7293 100644 +{ + pid_t pid; + int len; -+ struct ptrace_rseq_configuration rseq; ++ struct __ptrace_rseq_configuration rseq; + + pid = fork_and_ptrace_attach(NULL); + if (pid < 0) @@ -147,7 +147,7 @@ index 82143377f..8772a7293 100644 int kerndat_sockopt_buf_lock(void) { int exit_code = -1; -@@ -1410,6 +1447,10 @@ int kerndat_init(void) +@@ -1624,6 +1661,10 @@ int kerndat_init(void) pr_err("kerndat_has_rseq failed when initializing kerndat.\n"); ret = -1; } @@ -159,5 +159,5 @@ index 82143377f..8772a7293 100644 kerndat_lsm(); kerndat_mmap_min_addr(); -- -2.34.1 +2.35.1 diff --git a/0124-rseq-initial-support.patch b/0239-rseq-initial-support.patch similarity index 86% rename from 0124-rseq-initial-support.patch rename to 0239-rseq-initial-support.patch index 3100ceb..78887b5 100644 --- a/0124-rseq-initial-support.patch +++ b/0239-rseq-initial-support.patch @@ -1,7 +1,7 @@ -From 5d7cffb87adbf72298eea59ae118ac65aed9fe89 Mon Sep 17 00:00:00 2001 +From 2a4d29c3be5cec0efb2cbc3ba20444cd0b358e29 Mon Sep 17 00:00:00 2001 From: Alexander Mikhalitsyn Date: Tue, 21 Dec 2021 23:27:26 +0300 -Subject: [PATCH 05/10] rseq: initial support +Subject: [PATCH 239/245] rseq: initial support TODO: 1. properly handle case when the kernel has rseq() @@ -18,59 +18,30 @@ Reported-by: Radostin Stoyanov Suggested-by: Florian Weimer Signed-off-by: Alexander Mikhalitsyn --- - compel/include/uapi/ptrace.h | 16 ++-- - criu/cr-dump.c | 99 ++++++++++++++++++++++++ - criu/cr-restore.c | 17 +++++ - criu/include/linux/rseq.h | 144 +++++++++++++++++++++++++++++++++++ - criu/include/parasite.h | 7 ++ - criu/include/restorer.h | 7 ++ - criu/kerndat.c | 2 +- - criu/parasite-syscall.c | 11 +++ - criu/pie/parasite.c | 104 +++++++++++++++++++++++++ - criu/pie/restorer.c | 24 ++++++ - images/Makefile | 1 + - images/core.proto | 2 + - images/rseq.proto | 9 +++ - 13 files changed, 434 insertions(+), 9 deletions(-) + criu/cr-dump.c | 99 ++++++++++++++++++++++++++ + criu/cr-restore.c | 22 ++++++ + criu/include/linux/rseq.h | 144 ++++++++++++++++++++++++++++++++++++++ + criu/include/parasite.h | 7 ++ + criu/include/restorer.h | 7 ++ + criu/parasite-syscall.c | 11 +++ + criu/pie/parasite.c | 98 ++++++++++++++++++++++++++ + criu/pie/restorer.c | 25 +++++++ + images/Makefile | 1 + + images/core.proto | 2 + + images/rseq.proto | 9 +++ + 11 files changed, 425 insertions(+) create mode 100644 criu/include/linux/rseq.h create mode 100644 images/rseq.proto -diff --git a/compel/include/uapi/ptrace.h b/compel/include/uapi/ptrace.h -index 15476f158..63dfee97f 100644 ---- a/compel/include/uapi/ptrace.h -+++ b/compel/include/uapi/ptrace.h -@@ -66,14 +66,14 @@ typedef struct { - } seccomp_metadata_t; - - #ifndef PTRACE_GET_RSEQ_CONFIGURATION --#define PTRACE_GET_RSEQ_CONFIGURATION 0x420f -- --struct ptrace_rseq_configuration { -- __u64 rseq_abi_pointer; -- __u32 rseq_abi_size; -- __u32 signature; -- __u32 flags; -- __u32 pad; -+#define PTRACE_GET_RSEQ_CONFIGURATION 0x420f -+ -+struct __ptrace_rseq_configuration { -+ uint64_t rseq_abi_pointer; -+ uint32_t rseq_abi_size; -+ uint32_t signature; -+ uint32_t flags; -+ uint32_t pad; - }; - #endif - diff --git a/criu/cr-dump.c b/criu/cr-dump.c -index c972e343a..8c4a1c9fe 100644 +index eb1fb5e9a..eb645a597 100644 --- a/criu/cr-dump.c +++ b/criu/cr-dump.c @@ -45,6 +45,7 @@ #include "proc_parse.h" #include "parasite.h" #include "parasite-syscall.h" -+#include ++#include "compel/ptrace.h" #include "files.h" #include "files-reg.h" #include "shmem.h" @@ -201,10 +172,10 @@ index c972e343a..8c4a1c9fe 100644 if (!parasite_ctl) { pr_err("Can't infect (pid: %d) with parasite\n", pid); diff --git a/criu/cr-restore.c b/criu/cr-restore.c -index ed62cc5a2..1821c21de 100644 +index 9d2d957f8..8bfa3ef8c 100644 --- a/criu/cr-restore.c +++ b/criu/cr-restore.c -@@ -2994,6 +2994,19 @@ static int prep_sched_info(struct rst_sched_param *sp, ThreadCoreEntry *tc) +@@ -2971,6 +2971,24 @@ static int prep_sched_info(struct rst_sched_param *sp, ThreadCoreEntry *tc) return 0; } @@ -218,13 +189,18 @@ index ed62cc5a2..1821c21de 100644 + rseq->rseq_abi_size = tc->rseq_entry->rseq_abi_size; + rseq->signature = tc->rseq_entry->signature; + ++ if (rseq->rseq_abi_pointer && !kdat.has_rseq) { ++ pr_err("rseq: can't restore as kernel doesn't support it\n"); ++ return -1; ++ } ++ + return 0; +} + static rlim_t decode_rlim(rlim_t ival) { return ival == -1 ? RLIM_INFINITY : ival; -@@ -3704,6 +3717,10 @@ static int sigreturn_restore(pid_t pid, struct task_restore_args *task_args, uns +@@ -3681,6 +3699,10 @@ static int sigreturn_restore(pid_t pid, struct task_restore_args *task_args, uns thread_args[i].clear_tid_addr = CORE_THREAD_ARCH_INFO(tcore)->clear_tid_addr; core_get_tls(tcore, &thread_args[i].tls); @@ -432,19 +408,6 @@ index 308a0b79b..2e21da522 100644 siginfo_t *siginfo; unsigned int siginfo_n; -diff --git a/criu/kerndat.c b/criu/kerndat.c -index 8772a7293..7981e4ca0 100644 ---- a/criu/kerndat.c -+++ b/criu/kerndat.c -@@ -837,7 +837,7 @@ static int kerndat_has_ptrace_get_rseq_conf(void) - { - pid_t pid; - int len; -- struct ptrace_rseq_configuration rseq; -+ struct __ptrace_rseq_configuration rseq; - - pid = fork_and_ptrace_attach(NULL); - if (pid < 0) diff --git a/criu/parasite-syscall.c b/criu/parasite-syscall.c index 7175adee1..ee4fa86f4 100644 --- a/criu/parasite-syscall.c @@ -482,7 +445,7 @@ index 7175adee1..ee4fa86f4 100644 if (ret) { pr_err("Can't init thread in parasite %d\n", pid); diff --git a/criu/pie/parasite.c b/criu/pie/parasite.c -index bc0a33cd4..bf4b11bea 100644 +index bc0a33cd4..8441ac635 100644 --- a/criu/pie/parasite.c +++ b/criu/pie/parasite.c @@ -8,6 +8,8 @@ @@ -515,7 +478,7 @@ index bc0a33cd4..bf4b11bea 100644 ret = dump_creds(ti->creds); out: return ret; -@@ -313,6 +322,101 @@ grps_err: +@@ -313,6 +322,95 @@ grps_err: return -1; } @@ -527,15 +490,10 @@ index bc0a33cd4..bf4b11bea 100644 + uint32_t rseq_signature; + void *addr; + -+ pr_err("hello from %ld rseq.has_ptrace_get_rseq_conf = %d\n", sys_gettid(), rseq->has_ptrace_get_rseq_conf); -+ + /* no need to do hacky check if we can get all info from ptrace() */ + if (!rseq->has_rseq || rseq->has_ptrace_get_rseq_conf) + return 0; -+#if 0 -+ pr_err("rseq: rseq_abi_pointer = %lx signature = %x\n", -+ rseq->rseq_abi_pointer, rseq->signature); -+#endif ++ + /* + * We need to determine if victim process has rseq() + * initialized, but we have no *any* proper kernel interface @@ -579,11 +537,11 @@ index bc0a33cd4..bf4b11bea 100644 + */ + rseq_signature = 0x12345612; + -+ pr_err("\ttrying sys_rseq(%lx, %lx, %x, %x)\n", rseq_abi_pointer, rseq_abi_size, 0, rseq_signature); ++ pr_info("\ttrying sys_rseq(%lx, %lx, %x, %x)\n", rseq_abi_pointer, rseq_abi_size, 0, rseq_signature); + ret = sys_rseq((void *)rseq_abi_pointer, rseq_abi_size, 0, rseq_signature); + if (ret) { + if (ret == -EINVAL) { -+ pr_info("\trseq is initialized in the victim Error\n"); ++ pr_info("\trseq is initialized in the victim\n"); + rseq->rseq_inited = true; + + ret = 0; @@ -600,17 +558,16 @@ index bc0a33cd4..bf4b11bea 100644 + rseq_abi_size, RSEQ_FLAG_UNREGISTER, rseq_signature, ret); + + ret = -1; -+ goto out; ++ /* we can't do munmap() because rseq is registered and we failed to unregister it */ ++ goto out_nounmap; + } + -+ pr_info("\tsys_rseq succeed, let's unregister it back... ok Error\n"); -+ pr_info("\trseq is non-initialized in the victim Error\n"); + rseq->rseq_inited = false; + ret = 0; + } + -+out: + sys_munmap(addr, sizeof(struct rseq)); ++out_nounmap: + return ret; +} + @@ -618,10 +575,10 @@ index bc0a33cd4..bf4b11bea 100644 { int flags, ret; diff --git a/criu/pie/restorer.c b/criu/pie/restorer.c -index 0051452e4..33920af40 100644 +index 7aa788181..48acc8cf4 100644 --- a/criu/pie/restorer.c +++ b/criu/pie/restorer.c -@@ -425,6 +425,27 @@ static int restore_signals(siginfo_t *ptr, int nr, bool group) +@@ -425,6 +425,28 @@ static int restore_signals(siginfo_t *ptr, int nr, bool group) return 0; } @@ -630,11 +587,12 @@ index 0051452e4..33920af40 100644 + int ret; + + if (!rseq->rseq_abi_pointer) { -+ pr_err("rseq: nothing to restore\n"); ++ pr_debug("rseq: nothing to restore\n"); + return 0; + } + -+ pr_err("rseq: rseq_abi_pointer = %lx signature = %x\n", (unsigned long)rseq->rseq_abi_pointer, rseq->signature); ++ pr_debug("rseq: rseq_abi_pointer = %lx signature = %x\n", (unsigned long)rseq->rseq_abi_pointer, ++ rseq->signature); + + ret = sys_rseq(decode_pointer(rseq->rseq_abi_pointer), rseq->rseq_abi_size, 0, rseq->signature); + if (ret) { @@ -649,7 +607,7 @@ index 0051452e4..33920af40 100644 static int restore_seccomp_filter(pid_t tid, struct thread_restore_args *args) { unsigned int flags = args->seccomp_force_tsync ? SECCOMP_FILTER_FLAG_TSYNC : 0; -@@ -549,6 +570,9 @@ static int restore_thread_common(struct thread_restore_args *args) +@@ -549,6 +571,9 @@ static int restore_thread_common(struct thread_restore_args *args) restore_tls(&args->tls); @@ -707,5 +665,5 @@ index 000000000..be2800468 + required uint32 signature = 3; +} -- -2.34.1 +2.35.1 diff --git a/0240-include-add-thread_pointer.h-from-Glibc.patch b/0240-include-add-thread_pointer.h-from-Glibc.patch new file mode 100644 index 0000000..636ceb0 --- /dev/null +++ b/0240-include-add-thread_pointer.h-from-Glibc.patch @@ -0,0 +1,245 @@ +From 7262d5ee6d82ecc9c53bc7b23f458de7e794f097 Mon Sep 17 00:00:00 2001 +From: Alexander Mikhalitsyn +Date: Tue, 22 Feb 2022 14:58:10 +0300 +Subject: [PATCH 240/245] include: add thread_pointer.h from Glibc + +Implementation was taken from the Glibc. + +https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=8dbeb0561eeb876f557ac9eef5721912ec074ea5 +https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=cb976fba4c51ede7bf8cee5035888527c308dfbc + +Signed-off-by: Alexander Mikhalitsyn +--- + .../arch/aarch64/include/asm/thread_pointer.h | 27 ++++++++++++++ + criu/arch/arm/include/asm/thread_pointer.h | 27 ++++++++++++++ + criu/arch/mips/include/asm/thread_pointer.h | 27 ++++++++++++++ + criu/arch/ppc64/include/asm/thread_pointer.h | 33 +++++++++++++++++ + criu/arch/s390/include/asm/thread_pointer.h | 27 ++++++++++++++ + criu/arch/x86/include/asm/thread_pointer.h | 37 +++++++++++++++++++ + 6 files changed, 178 insertions(+) + create mode 100644 criu/arch/aarch64/include/asm/thread_pointer.h + create mode 100644 criu/arch/arm/include/asm/thread_pointer.h + create mode 100644 criu/arch/mips/include/asm/thread_pointer.h + create mode 100644 criu/arch/ppc64/include/asm/thread_pointer.h + create mode 100644 criu/arch/s390/include/asm/thread_pointer.h + create mode 100644 criu/arch/x86/include/asm/thread_pointer.h + +diff --git a/criu/arch/aarch64/include/asm/thread_pointer.h b/criu/arch/aarch64/include/asm/thread_pointer.h +new file mode 100644 +index 000000000..f7e07066a +--- /dev/null ++++ b/criu/arch/aarch64/include/asm/thread_pointer.h +@@ -0,0 +1,27 @@ ++/* __thread_pointer definition. Generic version. ++ Copyright (C) 2021 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library. If not, see ++ . */ ++ ++#ifndef _SYS_THREAD_POINTER_H ++#define _SYS_THREAD_POINTER_H ++ ++static inline void *__criu_thread_pointer(void) ++{ ++ return __builtin_thread_pointer(); ++} ++ ++#endif /* _SYS_THREAD_POINTER_H */ +diff --git a/criu/arch/arm/include/asm/thread_pointer.h b/criu/arch/arm/include/asm/thread_pointer.h +new file mode 100644 +index 000000000..f7e07066a +--- /dev/null ++++ b/criu/arch/arm/include/asm/thread_pointer.h +@@ -0,0 +1,27 @@ ++/* __thread_pointer definition. Generic version. ++ Copyright (C) 2021 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library. If not, see ++ . */ ++ ++#ifndef _SYS_THREAD_POINTER_H ++#define _SYS_THREAD_POINTER_H ++ ++static inline void *__criu_thread_pointer(void) ++{ ++ return __builtin_thread_pointer(); ++} ++ ++#endif /* _SYS_THREAD_POINTER_H */ +diff --git a/criu/arch/mips/include/asm/thread_pointer.h b/criu/arch/mips/include/asm/thread_pointer.h +new file mode 100644 +index 000000000..f7e07066a +--- /dev/null ++++ b/criu/arch/mips/include/asm/thread_pointer.h +@@ -0,0 +1,27 @@ ++/* __thread_pointer definition. Generic version. ++ Copyright (C) 2021 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library. If not, see ++ . */ ++ ++#ifndef _SYS_THREAD_POINTER_H ++#define _SYS_THREAD_POINTER_H ++ ++static inline void *__criu_thread_pointer(void) ++{ ++ return __builtin_thread_pointer(); ++} ++ ++#endif /* _SYS_THREAD_POINTER_H */ +diff --git a/criu/arch/ppc64/include/asm/thread_pointer.h b/criu/arch/ppc64/include/asm/thread_pointer.h +new file mode 100644 +index 000000000..304516fbe +--- /dev/null ++++ b/criu/arch/ppc64/include/asm/thread_pointer.h +@@ -0,0 +1,33 @@ ++/* __thread_pointer definition. powerpc version. ++ Copyright (C) 2021 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library. If not, see ++ . */ ++ ++#ifndef _SYS_THREAD_POINTER_H ++#define _SYS_THREAD_POINTER_H ++ ++#ifdef __powerpc64__ ++register void *__thread_register asm("r13"); ++#else ++register void *__thread_register asm("r2"); ++#endif ++ ++static inline void *__criu_thread_pointer(void) ++{ ++ return __thread_register; ++} ++ ++#endif /* _SYS_THREAD_POINTER_H */ +\ No newline at end of file +diff --git a/criu/arch/s390/include/asm/thread_pointer.h b/criu/arch/s390/include/asm/thread_pointer.h +new file mode 100644 +index 000000000..f7e07066a +--- /dev/null ++++ b/criu/arch/s390/include/asm/thread_pointer.h +@@ -0,0 +1,27 @@ ++/* __thread_pointer definition. Generic version. ++ Copyright (C) 2021 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library. If not, see ++ . */ ++ ++#ifndef _SYS_THREAD_POINTER_H ++#define _SYS_THREAD_POINTER_H ++ ++static inline void *__criu_thread_pointer(void) ++{ ++ return __builtin_thread_pointer(); ++} ++ ++#endif /* _SYS_THREAD_POINTER_H */ +diff --git a/criu/arch/x86/include/asm/thread_pointer.h b/criu/arch/x86/include/asm/thread_pointer.h +new file mode 100644 +index 000000000..08603aed4 +--- /dev/null ++++ b/criu/arch/x86/include/asm/thread_pointer.h +@@ -0,0 +1,37 @@ ++/* __thread_pointer definition. x86 version. ++ Copyright (C) 2021 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library. If not, see ++ . */ ++ ++#ifndef _SYS_THREAD_POINTER_H ++#define _SYS_THREAD_POINTER_H ++ ++static inline void *__criu_thread_pointer(void) ++{ ++#if __GNUC_PREREQ(11, 1) ++ return __builtin_thread_pointer(); ++#else ++ void *__result; ++#ifdef __x86_64__ ++ __asm__("mov %%fs:0, %0" : "=r"(__result)); ++#else ++ __asm__("mov %%gs:0, %0" : "=r"(__result)); ++#endif ++ return __result; ++#endif /* !GCC 11 */ ++} ++ ++#endif /* _SYS_THREAD_POINTER_H */ +\ No newline at end of file +-- +2.35.1 + diff --git a/0241-clone-noasan-unregister-rseq-at-the-thread-start-for.patch b/0241-clone-noasan-unregister-rseq-at-the-thread-start-for.patch new file mode 100644 index 0000000..75c16b2 --- /dev/null +++ b/0241-clone-noasan-unregister-rseq-at-the-thread-start-for.patch @@ -0,0 +1,143 @@ +From 74f602b66fb6ae3559b570cfc369477a579367c8 Mon Sep 17 00:00:00 2001 +From: Alexander Mikhalitsyn +Date: Fri, 24 Dec 2021 18:57:54 +0300 +Subject: [PATCH 241/245] clone-noasan: unregister rseq at the thread start for + new glibc + +Fresh glibc does rseq registration by default during start_thread(). +[ see https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=95e114a0919d844d8fe07839cb6538b7f5ee920e ] + +This cause process crashes during memory restore procedure, because +memory which corresponds to the struct rseq will be overwritten. + +See also +("nptl: Add public rseq symbols and ") +https://sourceware.org/git?p=glibc.git;a=commit;h=c901c3e764d7c7079f006b4e21e877d5036eb4f5 +("nptl: Add for defining __thread_pointer") +https://sourceware.org/git?p=glibc.git;a=commit;h=8dbeb0561eeb876f557ac9eef5721912ec074ea5 + +Signed-off-by: Alexander Mikhalitsyn +--- + criu/clone-noasan.c | 21 ++++++++++++++++++++- + criu/cr-restore.c | 4 ++++ + criu/include/clone-noasan.h | 14 ++++++++++++++ + criu/include/linux/rseq.h | 9 +++++++++ + 4 files changed, 47 insertions(+), 1 deletion(-) + +diff --git a/criu/clone-noasan.c b/criu/clone-noasan.c +index d657ea2e8..6d2170dfb 100644 +--- a/criu/clone-noasan.c ++++ b/criu/clone-noasan.c +@@ -9,6 +9,8 @@ + #include "log.h" + #include "common/bug.h" + ++#include "clone-noasan.h" ++ + /* + * ASan doesn't play nicely with clone if we use current stack for + * child task. ASan puts local variables on the fake stack +@@ -34,16 +36,33 @@ + * ... wait for process to finish ... + * unlock_last_pid + */ ++ ++struct call_fn_args { ++ int (*fn)(void *); ++ void *arg; ++}; ++ ++int call_fn(void *arg) ++{ ++ struct call_fn_args *cargs = arg; ++ unregister_glibc_rseq(); ++ return cargs->fn(cargs->arg); ++} ++ + int clone_noasan(int (*fn)(void *), int flags, void *arg) + { + void *stack_ptr = (void *)round_down((unsigned long)&stack_ptr - 1024, 16); ++ struct call_fn_args fn_args = { ++ .fn = fn, ++ .arg = arg, ++ }; + + BUG_ON((flags & CLONE_VM) && !(flags & CLONE_VFORK)); + /* + * Reserve some bytes for clone() internal needs + * and use as stack the address above this area. + */ +- return clone(fn, stack_ptr, flags, arg); ++ return clone(call_fn, stack_ptr, flags, (void *)&fn_args); + } + + int clone3_with_pid_noasan(int (*fn)(void *), void *arg, int flags, int exit_signal, pid_t pid) +diff --git a/criu/cr-restore.c b/criu/cr-restore.c +index 8bfa3ef8c..b2ddc8db0 100644 +--- a/criu/cr-restore.c ++++ b/criu/cr-restore.c +@@ -1424,6 +1424,10 @@ static inline int fork_with_pid(struct pstree_item *item) + } + } + ++ /* disable rseq to prevent it's inheritance */ ++ if (item == root_item) ++ unregister_glibc_rseq(); ++ + if (kdat.has_clone3_set_tid) { + ret = clone3_with_pid_noasan(restore_task_with_children, &ca, + (ca.clone_flags & ~(CLONE_NEWNET | CLONE_NEWCGROUP | CLONE_NEWTIME)), +diff --git a/criu/include/clone-noasan.h b/criu/include/clone-noasan.h +index aff773296..6d6e51259 100644 +--- a/criu/include/clone-noasan.h ++++ b/criu/include/clone-noasan.h +@@ -1,6 +1,20 @@ + #ifndef __CR_CLONE_NOASAN_H__ + #define __CR_CLONE_NOASAN_H__ + ++#include "linux/rseq.h" ++ ++#if defined(RSEQ_SIG) ++static inline void unregister_glibc_rseq(void) ++{ ++ /* unregister rseq */ ++ syscall(__NR_rseq, (void *)((char *)__criu_thread_pointer() + __rseq_offset), __rseq_size, 1, RSEQ_SIG); ++} ++#else ++static inline void unregister_glibc_rseq(void) ++{ ++} ++#endif ++ + int clone_noasan(int (*fn)(void *), int flags, void *arg); + int clone3_with_pid_noasan(int (*fn)(void *), void *arg, int flags, int exit_signal, pid_t pid); + +diff --git a/criu/include/linux/rseq.h b/criu/include/linux/rseq.h +index 5c1706a59..fafa2c1c0 100644 +--- a/criu/include/linux/rseq.h ++++ b/criu/include/linux/rseq.h +@@ -2,6 +2,14 @@ + #ifndef _UAPI_LINUX_RSEQ_H + #define _UAPI_LINUX_RSEQ_H + ++#ifdef __has_include ++#if __has_include ("sys/rseq.h") ++#include ++#include "asm/thread_pointer.h" ++#endif ++#endif ++ ++#ifndef __GLIBC_HAVE_KERNEL_RSEQ + /* + * linux/rseq.h + * +@@ -140,5 +148,6 @@ struct rseq { + */ + __u32 flags; + } __attribute__((aligned(4 * sizeof(__u64)))); ++#endif /* __GLIBC_HAVE_KERNEL_RSEQ */ + + #endif /* _UAPI_LINUX_RSEQ_H */ +-- +2.35.1 + diff --git a/0242-compel-add-helpers-to-get-set-instruction-pointer.patch b/0242-compel-add-helpers-to-get-set-instruction-pointer.patch new file mode 100644 index 0000000..5af24a3 --- /dev/null +++ b/0242-compel-add-helpers-to-get-set-instruction-pointer.patch @@ -0,0 +1,265 @@ +From 067052969e57789251d604be94caeb7ec2554707 Mon Sep 17 00:00:00 2001 +From: Alexander Mikhalitsyn +Date: Mon, 21 Feb 2022 15:15:52 +0300 +Subject: [PATCH 242/245] compel: add helpers to get/set instruction pointer + +Signed-off-by: Alexander Mikhalitsyn +--- + .../src/lib/include/uapi/asm/infect-types.h | 9 +++++---- + .../src/lib/include/uapi/asm/infect-types.h | 9 +++++---- + .../src/lib/include/uapi/asm/infect-types.h | 9 +++++---- + .../src/lib/include/uapi/asm/infect-types.h | 9 +++++---- + .../src/lib/include/uapi/asm/infect-types.h | 7 ++++--- + .../src/lib/include/uapi/asm/infect-types.h | 9 +++++---- + compel/include/uapi/infect.h | 6 ++++++ + compel/src/lib/infect.c | 20 +++++++++++++++++++ + criu/arch/aarch64/include/asm/types.h | 2 ++ + criu/arch/arm/include/asm/types.h | 2 ++ + criu/arch/mips/include/asm/types.h | 2 ++ + criu/arch/ppc64/include/asm/types.h | 2 ++ + criu/arch/s390/include/asm/types.h | 2 ++ + criu/arch/x86/include/asm/types.h | 2 ++ + 14 files changed, 67 insertions(+), 23 deletions(-) + +diff --git a/compel/arch/aarch64/src/lib/include/uapi/asm/infect-types.h b/compel/arch/aarch64/src/lib/include/uapi/asm/infect-types.h +index f91e73dc4..9d4ce7e2e 100644 +--- a/compel/arch/aarch64/src/lib/include/uapi/asm/infect-types.h ++++ b/compel/arch/aarch64/src/lib/include/uapi/asm/infect-types.h +@@ -23,10 +23,11 @@ typedef struct user_fpsimd_state user_fpregs_struct_t; + #define compel_arch_get_tls_task(ctl, tls) + #define compel_arch_get_tls_thread(tctl, tls) + +-#define REG_RES(r) ((uint64_t)(r).regs[0]) +-#define REG_IP(r) ((uint64_t)(r).pc) +-#define REG_SP(r) ((uint64_t)((r).sp)) +-#define REG_SYSCALL_NR(r) ((uint64_t)(r).regs[8]) ++#define REG_RES(r) ((uint64_t)(r).regs[0]) ++#define REG_IP(r) ((uint64_t)(r).pc) ++#define SET_REG_IP(r, val) ((r).pc = (val)) ++#define REG_SP(r) ((uint64_t)((r).sp)) ++#define REG_SYSCALL_NR(r) ((uint64_t)(r).regs[8]) + + #define user_regs_native(pregs) true + +diff --git a/compel/arch/arm/src/lib/include/uapi/asm/infect-types.h b/compel/arch/arm/src/lib/include/uapi/asm/infect-types.h +index 159b6a9fb..8d328252e 100644 +--- a/compel/arch/arm/src/lib/include/uapi/asm/infect-types.h ++++ b/compel/arch/arm/src/lib/include/uapi/asm/infect-types.h +@@ -56,10 +56,11 @@ struct user_vfp_exc { + unsigned long fpinst2; + }; + +-#define REG_RES(regs) ((regs).ARM_r0) +-#define REG_IP(regs) ((regs).ARM_pc) +-#define REG_SP(regs) ((regs).ARM_sp) +-#define REG_SYSCALL_NR(regs) ((regs).ARM_r7) ++#define REG_RES(regs) ((regs).ARM_r0) ++#define REG_IP(regs) ((regs).ARM_pc) ++#define SET_REG_IP(regs, val) ((regs).ARM_pc = (val)) ++#define REG_SP(regs) ((regs).ARM_sp) ++#define REG_SYSCALL_NR(regs) ((regs).ARM_r7) + + #define user_regs_native(pregs) true + +diff --git a/compel/arch/mips/src/lib/include/uapi/asm/infect-types.h b/compel/arch/mips/src/lib/include/uapi/asm/infect-types.h +index 70b3f85a5..481566a12 100644 +--- a/compel/arch/mips/src/lib/include/uapi/asm/infect-types.h ++++ b/compel/arch/mips/src/lib/include/uapi/asm/infect-types.h +@@ -56,10 +56,11 @@ static inline bool user_regs_native(user_regs_struct_t *pregs) + #define compel_arch_get_tls_task(ctl, tls) + #define compel_arch_get_tls_thread(tctl, tls) + +-#define REG_RES(regs) ((regs).MIPS_v0) +-#define REG_IP(regs) ((regs).cp0_epc) +-#define REG_SP(regs) ((regs).MIPS_sp) +-#define REG_SYSCALL_NR(regs) ((regs).MIPS_v0) ++#define REG_RES(regs) ((regs).MIPS_v0) ++#define REG_IP(regs) ((regs).cp0_epc) ++#define SET_REG_IP(regs, val) ((regs).cp0_epc = (val)) ++#define REG_SP(regs) ((regs).MIPS_sp) ++#define REG_SYSCALL_NR(regs) ((regs).MIPS_v0) + + //#define __NR(syscall, compat) ((compat) ? __NR32_##syscall : __NR_##syscall) + #define __NR(syscall, compat) __NR_##syscall +diff --git a/compel/arch/ppc64/src/lib/include/uapi/asm/infect-types.h b/compel/arch/ppc64/src/lib/include/uapi/asm/infect-types.h +index 8cf8a135f..25fc747e2 100644 +--- a/compel/arch/ppc64/src/lib/include/uapi/asm/infect-types.h ++++ b/compel/arch/ppc64/src/lib/include/uapi/asm/infect-types.h +@@ -72,10 +72,11 @@ typedef struct { + } tm; + } user_fpregs_struct_t; + +-#define REG_RES(regs) ((uint64_t)(regs).gpr[3]) +-#define REG_IP(regs) ((uint64_t)(regs).nip) +-#define REG_SP(regs) ((uint64_t)(regs).gpr[1]) +-#define REG_SYSCALL_NR(regs) ((uint64_t)(regs).gpr[0]) ++#define REG_RES(regs) ((uint64_t)(regs).gpr[3]) ++#define REG_IP(regs) ((uint64_t)(regs).nip) ++#define SET_REG_IP(regs, val) ((regs).nip = (val)) ++#define REG_SP(regs) ((uint64_t)(regs).gpr[1]) ++#define REG_SYSCALL_NR(regs) ((uint64_t)(regs).gpr[0]) + + #define user_regs_native(pregs) true + +diff --git a/compel/arch/s390/src/lib/include/uapi/asm/infect-types.h b/compel/arch/s390/src/lib/include/uapi/asm/infect-types.h +index 896d70ed1..87283bc6b 100644 +--- a/compel/arch/s390/src/lib/include/uapi/asm/infect-types.h ++++ b/compel/arch/s390/src/lib/include/uapi/asm/infect-types.h +@@ -62,9 +62,10 @@ typedef struct { + uint32_t system_call; + } user_regs_struct_t; + +-#define REG_RES(r) ((uint64_t)(r).prstatus.gprs[2]) +-#define REG_IP(r) ((uint64_t)(r).prstatus.psw.addr) +-#define REG_SP(r) ((uint64_t)(r).prstatus.gprs[15]) ++#define REG_RES(r) ((uint64_t)(r).prstatus.gprs[2]) ++#define REG_IP(r) ((uint64_t)(r).prstatus.psw.addr) ++#define SET_REG_IP(r, val) ((r).prstatus.psw.addr = (val)) ++#define REG_SP(r) ((uint64_t)(r).prstatus.gprs[15]) + /* + * We assume that REG_SYSCALL_NR() is only used for pie code where we + * always use svc 0 with opcode in %r1. +diff --git a/compel/arch/x86/src/lib/include/uapi/asm/infect-types.h b/compel/arch/x86/src/lib/include/uapi/asm/infect-types.h +index 34b3ad061..b35504ff8 100644 +--- a/compel/arch/x86/src/lib/include/uapi/asm/infect-types.h ++++ b/compel/arch/x86/src/lib/include/uapi/asm/infect-types.h +@@ -127,10 +127,11 @@ typedef struct { + + typedef struct xsave_struct user_fpregs_struct_t; + +-#define REG_RES(regs) get_user_reg(®s, ax) +-#define REG_IP(regs) get_user_reg(®s, ip) +-#define REG_SP(regs) get_user_reg(®s, sp) +-#define REG_SYSCALL_NR(regs) get_user_reg(®s, orig_ax) ++#define REG_RES(regs) get_user_reg(®s, ax) ++#define REG_IP(regs) get_user_reg(®s, ip) ++#define SET_REG_IP(regs, val) set_user_reg(®s, ip, val) ++#define REG_SP(regs) get_user_reg(®s, sp) ++#define REG_SYSCALL_NR(regs) get_user_reg(®s, orig_ax) + + #define __NR(syscall, compat) ((compat) ? __NR32_##syscall : __NR_##syscall) + +diff --git a/compel/include/uapi/infect.h b/compel/include/uapi/infect.h +index 7fa0bd8a0..e01b3a22c 100644 +--- a/compel/include/uapi/infect.h ++++ b/compel/include/uapi/infect.h +@@ -168,4 +168,10 @@ extern unsigned long compel_task_size(void); + extern uint64_t compel_get_leader_sp(struct parasite_ctl *ctl); + extern uint64_t compel_get_thread_sp(struct parasite_thread_ctl *tctl); + ++extern uint64_t compel_get_leader_ip(struct parasite_ctl *ctl); ++extern uint64_t compel_get_thread_ip(struct parasite_thread_ctl *tctl); ++ ++void compel_set_leader_ip(struct parasite_ctl *ctl, uint64_t v); ++void compel_set_thread_ip(struct parasite_thread_ctl *tctl, uint64_t v); ++ + #endif +diff --git a/compel/src/lib/infect.c b/compel/src/lib/infect.c +index 78e4d7e0e..c49f2f4e5 100644 +--- a/compel/src/lib/infect.c ++++ b/compel/src/lib/infect.c +@@ -1687,3 +1687,23 @@ uint64_t compel_get_thread_sp(struct parasite_thread_ctl *tctl) + { + return REG_SP(tctl->th.regs); + } ++ ++uint64_t compel_get_leader_ip(struct parasite_ctl *ctl) ++{ ++ return REG_IP(ctl->orig.regs); ++} ++ ++uint64_t compel_get_thread_ip(struct parasite_thread_ctl *tctl) ++{ ++ return REG_IP(tctl->th.regs); ++} ++ ++void compel_set_leader_ip(struct parasite_ctl *ctl, uint64_t v) ++{ ++ SET_REG_IP(ctl->orig.regs, v); ++} ++ ++void compel_set_thread_ip(struct parasite_thread_ctl *tctl, uint64_t v) ++{ ++ SET_REG_IP(tctl->th.regs, v); ++} +diff --git a/criu/arch/aarch64/include/asm/types.h b/criu/arch/aarch64/include/asm/types.h +index c860af1cf..363c1cae2 100644 +--- a/criu/arch/aarch64/include/asm/types.h ++++ b/criu/arch/aarch64/include/asm/types.h +@@ -22,6 +22,8 @@ typedef UserAarch64RegsEntry UserRegsEntry; + + #define TI_SP(core) ((core)->ti_aarch64->gpregs->sp) + ++#define TI_IP(core) ((core)->ti_aarch64->gpregs->pc) ++ + static inline void *decode_pointer(uint64_t v) + { + return (void *)v; +diff --git a/criu/arch/arm/include/asm/types.h b/criu/arch/arm/include/asm/types.h +index cfcb8a136..93d2dc23d 100644 +--- a/criu/arch/arm/include/asm/types.h ++++ b/criu/arch/arm/include/asm/types.h +@@ -21,6 +21,8 @@ typedef UserArmRegsEntry UserRegsEntry; + + #define TI_SP(core) ((core)->ti_arm->gpregs->sp) + ++#define TI_IP(core) ((core)->ti_arm->gpregs->ip) ++ + static inline void *decode_pointer(u64 v) + { + return (void *)(u32)v; +diff --git a/criu/arch/mips/include/asm/types.h b/criu/arch/mips/include/asm/types.h +index 237471f3c..2c75b6a92 100644 +--- a/criu/arch/mips/include/asm/types.h ++++ b/criu/arch/mips/include/asm/types.h +@@ -18,6 +18,8 @@ + + #define CORE_THREAD_ARCH_INFO(core) core->ti_mips + ++#define TI_IP(core) ((core)->ti_mips->gpregs->cp0_epc) ++ + typedef UserMipsRegsEntry UserRegsEntry; + + static inline u64 encode_pointer(void *p) +diff --git a/criu/arch/ppc64/include/asm/types.h b/criu/arch/ppc64/include/asm/types.h +index fedeff22a..d60aadde5 100644 +--- a/criu/arch/ppc64/include/asm/types.h ++++ b/criu/arch/ppc64/include/asm/types.h +@@ -19,6 +19,8 @@ typedef UserPpc64RegsEntry UserRegsEntry; + + #define CORE_THREAD_ARCH_INFO(core) core->ti_ppc64 + ++#define TI_IP(core) ((core)->ti_ppc64->gpregs->nip) ++ + static inline void *decode_pointer(uint64_t v) + { + return (void *)v; +diff --git a/criu/arch/s390/include/asm/types.h b/criu/arch/s390/include/asm/types.h +index 7522cf2cd..abf12dec0 100644 +--- a/criu/arch/s390/include/asm/types.h ++++ b/criu/arch/s390/include/asm/types.h +@@ -19,6 +19,8 @@ typedef UserS390RegsEntry UserRegsEntry; + + #define CORE_THREAD_ARCH_INFO(core) core->ti_s390 + ++#define TI_IP(core) ((core)->ti_s390->gpregs->psw_addr) ++ + static inline u64 encode_pointer(void *p) + { + return (u64)p; +diff --git a/criu/arch/x86/include/asm/types.h b/criu/arch/x86/include/asm/types.h +index a0a8ed987..8919d0ae6 100644 +--- a/criu/arch/x86/include/asm/types.h ++++ b/criu/arch/x86/include/asm/types.h +@@ -28,6 +28,8 @@ static inline int core_is_compat(CoreEntry *c) + + #define CORE_THREAD_ARCH_INFO(core) core->thread_info + ++#define TI_IP(core) ((core)->thread_info->gpregs->ip) ++ + typedef UserX86RegsEntry UserRegsEntry; + + static inline u64 encode_pointer(void *p) +-- +2.35.1 + diff --git a/0243-cr-dump-fixup-thread-IP-when-inside-rseq-cs.patch b/0243-cr-dump-fixup-thread-IP-when-inside-rseq-cs.patch new file mode 100644 index 0000000..d727a2a --- /dev/null +++ b/0243-cr-dump-fixup-thread-IP-when-inside-rseq-cs.patch @@ -0,0 +1,262 @@ +From 3b3f3c153e189202bbdbae186e13cc0b3f245195 Mon Sep 17 00:00:00 2001 +From: Alexander Mikhalitsyn +Date: Mon, 21 Feb 2022 15:25:21 +0300 +Subject: [PATCH 243/245] cr-dump: fixup thread IP when inside rseq cs + +Signed-off-by: Alexander Mikhalitsyn +--- + criu/cr-dump.c | 155 +++++++++++++++++++++++++++++++++++++- + criu/include/linux/rseq.h | 2 +- + criu/include/parasite.h | 2 + + criu/include/pstree.h | 1 + + 4 files changed, 155 insertions(+), 5 deletions(-) + +diff --git a/criu/cr-dump.c b/criu/cr-dump.c +index eb645a597..3f12e7721 100644 +--- a/criu/cr-dump.c ++++ b/criu/cr-dump.c +@@ -1034,11 +1034,58 @@ static int dump_task_signals(pid_t pid, struct pstree_item *item) + return 0; + } + +-static int dump_thread_rseq(pid_t tid, RseqEntry **rseqep) ++static int read_rseq_cs(pid_t tid, struct __ptrace_rseq_configuration *rseq, struct rseq_cs *rseq_cs) ++{ ++ int ret; ++ uint64_t addr; ++ ++ /* rseq is not registered */ ++ if (!rseq->rseq_abi_pointer) ++ return 0; ++ ++ /* ++ * We need to cover the case when victim process was inside rseq critical section ++ * at the moment when CRIU comes and seized it. We need to determine the borders ++ * of rseq critical section at first. To achieve that we need to access thread ++ * memory and read pointer to struct rseq_cs. ++ * ++ * We have two ways to access thread memory: from the parasite and using ptrace(). ++ * But it this case we can't use parasite, because if victim process returns to the ++ * execution, on the kernel side __rseq_handle_notify_resume hook will be called, ++ * then rseq_ip_fixup() -> clear_rseq_cs() and user space memory with struct rseq ++ * will be cleared. So, let's use ptrace(PTRACE_PEEKDATA). ++ */ ++ ret = ptrace_peek_area(tid, &addr, decode_pointer(rseq->rseq_abi_pointer + offsetof(struct rseq, rseq_cs)), ++ sizeof(uint64_t)); ++ if (ret) { ++ pr_err("ptrace_peek_area(%d, %lx, %lx, %lx): fail to read rseq_cs addr\n", tid, (unsigned long)&addr, ++ (unsigned long)(rseq->rseq_abi_pointer + offsetof(struct rseq, rseq_cs)), sizeof(uint64_t)); ++ return -1; ++ } ++ ++ /* (struct rseq)->rseq_cs is NULL */ ++ if (!addr) ++ return 0; ++ ++ ret = ptrace_peek_area(tid, rseq_cs, decode_pointer(addr), sizeof(struct rseq_cs)); ++ if (ret) { ++ pr_err("ptrace_peek_area(%d, %lx, %lx, %lx): fail to read rseq_cs struct\n", tid, ++ (unsigned long)rseq_cs, (unsigned long)addr, sizeof(struct rseq_cs)); ++ return -1; ++ } ++ ++ return 0; ++} ++ ++static int dump_thread_rseq(struct pstree_item *item, int i) + { + struct __ptrace_rseq_configuration rseq; + RseqEntry *rseqe = NULL; + int ret; ++ CoreEntry *core = item->core[i]; ++ RseqEntry **rseqep = &core->thread_core->rseq_entry; ++ struct rseq_cs *rseq_cs = &dmpi(item)->thread_rseq_cs[i]; ++ pid_t tid = item->threads[i].real; + + /* + * If we are here it means that rseq() syscall is supported, +@@ -1063,7 +1110,8 @@ static int dump_thread_rseq(pid_t tid, RseqEntry **rseqep) + return -1; + } + +- pr_err("Dump rseq of %d: ptr = 0x%lx sign = 0x%x\n", tid, (unsigned long)rseq.rseq_abi_pointer, rseq.signature); ++ pr_info("Dump rseq of %d: ptr = 0x%lx sign = 0x%x\n", tid, (unsigned long)rseq.rseq_abi_pointer, ++ rseq.signature); + + rseqe = xmalloc(sizeof(*rseqe)); + if (!rseqe) +@@ -1075,25 +1123,118 @@ static int dump_thread_rseq(pid_t tid, RseqEntry **rseqep) + rseqe->rseq_abi_size = rseq.rseq_abi_size; + rseqe->signature = rseq.signature; + ++ if (read_rseq_cs(tid, &rseq, rseq_cs)) ++ goto err; ++ ++ /* save rseq entry to the image */ + *rseqep = rseqe; + + return 0; ++ ++err: ++ xfree(rseqe); ++ return -1; + } + + static int dump_task_rseq(pid_t pid, struct pstree_item *item) + { + int i; ++ struct rseq_cs *thread_rseq_cs; + + /* if rseq() syscall isn't supported then nothing to dump */ + if (!kdat.has_rseq) + return 0; + ++ thread_rseq_cs = xzalloc(sizeof(*thread_rseq_cs) * item->nr_threads); ++ if (!thread_rseq_cs) ++ return -1; ++ ++ dmpi(item)->thread_rseq_cs = thread_rseq_cs; ++ + for (i = 0; i < item->nr_threads; i++) { +- if (dump_thread_rseq(item->threads[i].real, &item->core[i]->thread_core->rseq_entry)) +- return -1; ++ if (dump_thread_rseq(item, i)) ++ goto free_rseq; + } + + return 0; ++ ++free_rseq: ++ xfree(thread_rseq_cs); ++ dmpi(item)->thread_rseq_cs = NULL; ++ return -1; ++} ++ ++static bool task_in_rseq(struct rseq_cs *rseq_cs, uint64_t addr) ++{ ++ return addr >= rseq_cs->start_ip && addr < rseq_cs->start_ip + rseq_cs->post_commit_offset; ++} ++ ++static int fixup_thread_rseq(struct pstree_item *item, int i) ++{ ++ CoreEntry *core = item->core[i]; ++ struct rseq_cs *rseq_cs = &dmpi(item)->thread_rseq_cs[i]; ++ pid_t tid = item->threads[i].real; ++ ++ /* (struct rseq)->rseq_cs is NULL */ ++ if (!rseq_cs->start_ip) ++ return 0; ++ ++ pr_info("fixup_thread_rseq for %d: rseq_cs start_ip = %llx abort_ip = %llx post_commit_offset = %llx flags = %x version = %x; IP = %lx\n", ++ tid, rseq_cs->start_ip, rseq_cs->abort_ip, rseq_cs->post_commit_offset, rseq_cs->flags, ++ rseq_cs->version, (unsigned long)TI_IP(core)); ++ ++ if (rseq_cs->version != 0) { ++ pr_err("unsupported RSEQ ABI version = %d\n", rseq_cs->version); ++ return -1; ++ } ++ ++ if (task_in_rseq(rseq_cs, TI_IP(core))) { ++ struct pid *tid = &item->threads[i]; ++ ++ pr_info("The %d task is in rseq critical section. IP will be set to rseq abort handler addr\n", ++ tid->real); ++ ++ /* ++ * We need to fixup task instruction pointer from ++ * the original one (which lays inside rseq critical section) ++ * to rseq abort handler address. ++ * ++ * It's worth to mention that we need to fixup IP in CoreEntry ++ * (used when full dump/restore is performed) and also in ++ * the parasite regs storage (used if --leave-running option is used, ++ * or if dump error occured and process execution is resumed). ++ */ ++ TI_IP(core) = rseq_cs->abort_ip; ++ ++ if (item->pid->real == tid->real) { ++ compel_set_leader_ip(dmpi(item)->parasite_ctl, rseq_cs->abort_ip); ++ } else { ++ compel_set_thread_ip(dmpi(item)->thread_ctls[i], rseq_cs->abort_ip); ++ } ++ } ++ ++ return 0; ++} ++ ++static int fixup_task_rseq(pid_t pid, struct pstree_item *item) ++{ ++ int ret = 0; ++ int i; ++ ++ if (!kdat.has_ptrace_get_rseq_conf) ++ return 0; ++ ++ for (i = 0; i < item->nr_threads; i++) { ++ if (fixup_thread_rseq(item, i)) { ++ ret = -1; ++ goto exit; ++ } ++ } ++ ++exit: ++ xfree(dmpi(item)->thread_rseq_cs); ++ dmpi(item)->thread_rseq_cs = NULL; ++ return ret; + } + + static struct proc_pid_stat pps_buf; +@@ -1403,6 +1544,12 @@ static int dump_one_task(struct pstree_item *item, InventoryEntry *parent_ie) + goto err; + } + ++ ret = fixup_task_rseq(pid, item); ++ if (ret) { ++ pr_err("Fixup rseq for %d failed %d\n", pid, ret); ++ goto err; ++ } ++ + if (fault_injected(FI_DUMP_EARLY)) { + pr_info("fault: CRIU sudden detach\n"); + kill(getpid(), SIGKILL); +diff --git a/criu/include/linux/rseq.h b/criu/include/linux/rseq.h +index fafa2c1c0..0c826c7f2 100644 +--- a/criu/include/linux/rseq.h ++++ b/criu/include/linux/rseq.h +@@ -3,7 +3,7 @@ + #define _UAPI_LINUX_RSEQ_H + + #ifdef __has_include +-#if __has_include ("sys/rseq.h") ++#if __has_include("sys/rseq.h") + #include + #include "asm/thread_pointer.h" + #endif +diff --git a/criu/include/parasite.h b/criu/include/parasite.h +index 5fde80996..d2a06889f 100644 +--- a/criu/include/parasite.h ++++ b/criu/include/parasite.h +@@ -10,6 +10,8 @@ + #include + #include + ++#include "linux/rseq.h" ++ + #include "image.h" + #include "util-pie.h" + #include "common/lock.h" +diff --git a/criu/include/pstree.h b/criu/include/pstree.h +index c1c79867b..8ae750e1a 100644 +--- a/criu/include/pstree.h ++++ b/criu/include/pstree.h +@@ -63,6 +63,7 @@ struct dmp_info { + struct parasite_ctl *parasite_ctl; + struct parasite_thread_ctl **thread_ctls; + uint64_t *thread_sp; ++ struct rseq_cs *thread_rseq_cs; + + /* + * Although we don't support dumping different struct creds in general, +-- +2.35.1 + diff --git a/0244-cr-dump-handle-rseq-flags-field.patch b/0244-cr-dump-handle-rseq-flags-field.patch new file mode 100644 index 0000000..b2b1a6c --- /dev/null +++ b/0244-cr-dump-handle-rseq-flags-field.patch @@ -0,0 +1,383 @@ +From 51528fc97bf42e8b7e7d19103970e82890f2cb58 Mon Sep 17 00:00:00 2001 +From: Alexander Mikhalitsyn +Date: Tue, 22 Feb 2022 18:22:45 +0300 +Subject: [PATCH 244/245] cr-dump: handle rseq flags field + +Userspace may configure rseq critical section by def + +Signed-off-by: Alexander Mikhalitsyn +--- + criu/cr-dump.c | 85 +++++++++++++++++++++++++---------------- + criu/cr-restore.c | 57 +++++++++++++++++++++++++++ + criu/include/rst_info.h | 8 ++++ + criu/pstree.c | 36 +++++++++++++++++ + images/rseq.proto | 1 + + 5 files changed, 154 insertions(+), 33 deletions(-) + +diff --git a/criu/cr-dump.c b/criu/cr-dump.c +index 3f12e7721..0984bd11c 100644 +--- a/criu/cr-dump.c ++++ b/criu/cr-dump.c +@@ -1034,13 +1034,13 @@ static int dump_task_signals(pid_t pid, struct pstree_item *item) + return 0; + } + +-static int read_rseq_cs(pid_t tid, struct __ptrace_rseq_configuration *rseq, struct rseq_cs *rseq_cs) ++static int read_rseq_cs(pid_t tid, struct __ptrace_rseq_configuration *rseqc, struct rseq_cs *rseq_cs, ++ struct rseq *rseq) + { + int ret; +- uint64_t addr; + + /* rseq is not registered */ +- if (!rseq->rseq_abi_pointer) ++ if (!rseqc->rseq_abi_pointer) + return 0; + + /* +@@ -1055,22 +1055,20 @@ static int read_rseq_cs(pid_t tid, struct __ptrace_rseq_configuration *rseq, str + * then rseq_ip_fixup() -> clear_rseq_cs() and user space memory with struct rseq + * will be cleared. So, let's use ptrace(PTRACE_PEEKDATA). + */ +- ret = ptrace_peek_area(tid, &addr, decode_pointer(rseq->rseq_abi_pointer + offsetof(struct rseq, rseq_cs)), +- sizeof(uint64_t)); ++ ret = ptrace_peek_area(tid, rseq, decode_pointer(rseqc->rseq_abi_pointer), sizeof(struct rseq)); + if (ret) { +- pr_err("ptrace_peek_area(%d, %lx, %lx, %lx): fail to read rseq_cs addr\n", tid, (unsigned long)&addr, +- (unsigned long)(rseq->rseq_abi_pointer + offsetof(struct rseq, rseq_cs)), sizeof(uint64_t)); ++ pr_err("ptrace_peek_area(%d, %lx, %lx, %lx): fail to read rseq struct\n", tid, (unsigned long)rseq, ++ (unsigned long)(rseqc->rseq_abi_pointer), sizeof(uint64_t)); + return -1; + } + +- /* (struct rseq)->rseq_cs is NULL */ +- if (!addr) ++ if (!rseq->rseq_cs.ptr64) + return 0; + +- ret = ptrace_peek_area(tid, rseq_cs, decode_pointer(addr), sizeof(struct rseq_cs)); ++ ret = ptrace_peek_area(tid, rseq_cs, decode_pointer(rseq->rseq_cs.ptr64), sizeof(struct rseq_cs)); + if (ret) { + pr_err("ptrace_peek_area(%d, %lx, %lx, %lx): fail to read rseq_cs struct\n", tid, +- (unsigned long)rseq_cs, (unsigned long)addr, sizeof(struct rseq_cs)); ++ (unsigned long)rseq_cs, (unsigned long)rseq->rseq_cs.ptr64, sizeof(struct rseq_cs)); + return -1; + } + +@@ -1079,11 +1077,12 @@ static int read_rseq_cs(pid_t tid, struct __ptrace_rseq_configuration *rseq, str + + static int dump_thread_rseq(struct pstree_item *item, int i) + { +- struct __ptrace_rseq_configuration rseq; ++ struct __ptrace_rseq_configuration rseqc; + RseqEntry *rseqe = NULL; + int ret; + CoreEntry *core = item->core[i]; + RseqEntry **rseqep = &core->thread_core->rseq_entry; ++ struct rseq rseq; + struct rseq_cs *rseq_cs = &dmpi(item)->thread_rseq_cs[i]; + pid_t tid = item->threads[i].real; + +@@ -1098,20 +1097,20 @@ static int dump_thread_rseq(struct pstree_item *item, int i) + if (!kdat.has_ptrace_get_rseq_conf) + return 0; + +- ret = ptrace(PTRACE_GET_RSEQ_CONFIGURATION, tid, sizeof(rseq), &rseq); +- if (ret != sizeof(rseq)) { ++ ret = ptrace(PTRACE_GET_RSEQ_CONFIGURATION, tid, sizeof(rseqc), &rseqc); ++ if (ret != sizeof(rseqc)) { + pr_perror("ptrace(PTRACE_GET_RSEQ_CONFIGURATION, %d) = %d", tid, ret); + return -1; + } + +- if (rseq.flags != 0) { ++ if (rseqc.flags != 0) { + pr_err("something wrong with ptrace(PTRACE_GET_RSEQ_CONFIGURATION, %d) flags = 0x%x\n", tid, +- rseq.flags); ++ rseqc.flags); + return -1; + } + +- pr_info("Dump rseq of %d: ptr = 0x%lx sign = 0x%x\n", tid, (unsigned long)rseq.rseq_abi_pointer, +- rseq.signature); ++ pr_info("Dump rseq of %d: ptr = 0x%lx sign = 0x%x\n", tid, (unsigned long)rseqc.rseq_abi_pointer, ++ rseqc.signature); + + rseqe = xmalloc(sizeof(*rseqe)); + if (!rseqe) +@@ -1119,13 +1118,22 @@ static int dump_thread_rseq(struct pstree_item *item, int i) + + rseq_entry__init(rseqe); + +- rseqe->rseq_abi_pointer = rseq.rseq_abi_pointer; +- rseqe->rseq_abi_size = rseq.rseq_abi_size; +- rseqe->signature = rseq.signature; ++ rseqe->rseq_abi_pointer = rseqc.rseq_abi_pointer; ++ rseqe->rseq_abi_size = rseqc.rseq_abi_size; ++ rseqe->signature = rseqc.signature; + +- if (read_rseq_cs(tid, &rseq, rseq_cs)) ++ if (read_rseq_cs(tid, &rseqc, rseq_cs, &rseq)) + goto err; + ++ rseqe->has_rseq_cs_pointer = true; ++ rseqe->rseq_cs_pointer = rseq.rseq_cs.ptr64; ++ ++ /* we won't save rseq_cs to the image (only pointer), ++ * so let's combine flags from both struct rseq and struct rseq_cs ++ * (kernel does the same when interpreting RSEQ_CS_FLAG_*) ++ */ ++ rseq_cs->flags |= rseq.flags; ++ + /* save rseq entry to the image */ + *rseqep = rseqe; + +@@ -1175,11 +1183,12 @@ static int fixup_thread_rseq(struct pstree_item *item, int i) + struct rseq_cs *rseq_cs = &dmpi(item)->thread_rseq_cs[i]; + pid_t tid = item->threads[i].real; + +- /* (struct rseq)->rseq_cs is NULL */ ++ /* equivalent to (struct rseq)->rseq_cs is NULL */ + if (!rseq_cs->start_ip) + return 0; + +- pr_info("fixup_thread_rseq for %d: rseq_cs start_ip = %llx abort_ip = %llx post_commit_offset = %llx flags = %x version = %x; IP = %lx\n", ++ pr_debug( ++ "fixup_thread_rseq for %d: rseq_cs start_ip = %llx abort_ip = %llx post_commit_offset = %llx flags = %x version = %x; IP = %lx\n", + tid, rseq_cs->start_ip, rseq_cs->abort_ip, rseq_cs->post_commit_offset, rseq_cs->flags, + rseq_cs->version, (unsigned long)TI_IP(core)); + +@@ -1191,25 +1200,35 @@ static int fixup_thread_rseq(struct pstree_item *item, int i) + if (task_in_rseq(rseq_cs, TI_IP(core))) { + struct pid *tid = &item->threads[i]; + +- pr_info("The %d task is in rseq critical section. IP will be set to rseq abort handler addr\n", +- tid->real); +- + /* + * We need to fixup task instruction pointer from + * the original one (which lays inside rseq critical section) +- * to rseq abort handler address. ++ * to rseq abort handler address. But we need to look on rseq_cs->flags ++ * (please refer to struct rseq -> flags field description). ++ * Naive idea of flags support may be like... let's change instruction pointer (IP) ++ * to rseq_cs->abort_ip if !(rseq_cs->flags & RSEQ_CS_FLAG_NO_RESTART_ON_SIGNAL). ++ * But unfortunately, it doesn't work properly, because the kernel does ++ * clean up of rseq_cs field in the struct rseq (modifies userspace memory). ++ * So, we need to preserve original value of (struct rseq)->rseq_cs field in the ++ * image and restore it's value before releasing threads (see restore_rseq_cs()). + * + * It's worth to mention that we need to fixup IP in CoreEntry + * (used when full dump/restore is performed) and also in + * the parasite regs storage (used if --leave-running option is used, + * or if dump error occured and process execution is resumed). + */ +- TI_IP(core) = rseq_cs->abort_ip; + +- if (item->pid->real == tid->real) { +- compel_set_leader_ip(dmpi(item)->parasite_ctl, rseq_cs->abort_ip); +- } else { +- compel_set_thread_ip(dmpi(item)->thread_ctls[i], rseq_cs->abort_ip); ++ if (!(rseq_cs->flags & RSEQ_CS_FLAG_NO_RESTART_ON_SIGNAL)) { ++ pr_warn("The %d task is in rseq critical section. IP will be set to rseq abort handler addr\n", ++ tid->real); ++ ++ TI_IP(core) = rseq_cs->abort_ip; ++ ++ if (item->pid->real == tid->real) { ++ compel_set_leader_ip(dmpi(item)->parasite_ctl, rseq_cs->abort_ip); ++ } else { ++ compel_set_thread_ip(dmpi(item)->thread_ctls[i], rseq_cs->abort_ip); ++ } + } + } + +diff --git a/criu/cr-restore.c b/criu/cr-restore.c +index b2ddc8db0..ebf40d2df 100644 +--- a/criu/cr-restore.c ++++ b/criu/cr-restore.c +@@ -23,6 +23,7 @@ + #include "common/compiler.h" + + #include "linux/mount.h" ++#include "linux/rseq.h" + + #include "clone-noasan.h" + #include "cr_options.h" +@@ -811,6 +812,18 @@ static int open_cores(int pid, CoreEntry *leader_core) + } + } + ++ for (i = 0; i < current->nr_threads; i++) { ++ ThreadCoreEntry *tc = cores[i]->thread_core; ++ struct rst_rseq *rseqs = rsti(current)->rseqe; ++ ++ /* compatibility with older CRIU versions */ ++ if (!tc->rseq_entry) ++ continue; ++ ++ rseqs[i].rseq_abi_pointer = tc->rseq_entry->rseq_abi_pointer; ++ rseqs[i].rseq_cs_pointer = tc->rseq_entry->rseq_cs_pointer; ++ } ++ + return 0; + err: + xfree(cores); +@@ -1966,6 +1979,47 @@ static int attach_to_tasks(bool root_seized) + return 0; + } + ++static int restore_rseq_cs(void) ++{ ++ struct pstree_item *item; ++ ++ for_each_pstree_item(item) { ++ int i; ++ ++ if (!task_alive(item)) ++ continue; ++ ++ if (item->nr_threads == 1) { ++ item->threads[0].real = item->pid->real; ++ } else { ++ if (parse_threads(item->pid->real, &item->threads, &item->nr_threads)) { ++ pr_err("restore_rseq_cs: parse_threads failed\n"); ++ return -1; ++ } ++ } ++ ++ for (i = 0; i < item->nr_threads; i++) { ++ pid_t pid = item->threads[i].real; ++ struct rst_rseq *rseqe = rsti(item)->rseqe; ++ ++ if (!rseqe) ++ return -1; ++ ++ if (!rseqe[i].rseq_cs_pointer || !rseqe[i].rseq_abi_pointer) ++ continue; ++ ++ if (ptrace_poke_area(pid, &rseqe[i].rseq_cs_pointer, ++ (void *)(rseqe[i].rseq_abi_pointer + offsetof(struct rseq, rseq_cs)), ++ sizeof(uint64_t))) { ++ pr_err("Can't restore rseq_cs pointer (pid: %d)\n", pid); ++ return -1; ++ } ++ } ++ } ++ ++ return 0; ++} ++ + static int catch_tasks(bool root_seized, enum trace_flags *flag) + { + struct pstree_item *item; +@@ -2400,6 +2454,9 @@ skip_ns_bouncing: + if (restore_freezer_state()) + pr_err("Unable to restore freezer state\n"); + ++ /* just before releasing threads we have to restore rseq_cs */ ++ restore_rseq_cs(); ++ + /* Detaches from processes and they continue run through sigreturn. */ + if (finalize_restore_detach()) + goto out_kill_network_unlocked; +diff --git a/criu/include/rst_info.h b/criu/include/rst_info.h +index 9664e0a1c..d0a3db6c5 100644 +--- a/criu/include/rst_info.h ++++ b/criu/include/rst_info.h +@@ -6,6 +6,7 @@ + #include "vma.h" + #include "kerndat.h" + #include "images/mm.pb-c.h" ++#include "images/core.pb-c.h" + + struct task_entries { + int nr_threads, nr_tasks, nr_helpers; +@@ -26,6 +27,11 @@ struct fdt { + futex_t fdt_lock; + }; + ++struct rst_rseq { ++ uint64_t rseq_abi_pointer; ++ uint64_t rseq_cs_pointer; ++}; ++ + struct rst_info { + struct list_head fds; + +@@ -69,6 +75,8 @@ struct rst_info { + + bool has_thp_enabled; + ++ struct rst_rseq *rseqe; ++ + void *breakpoint; + }; + +diff --git a/criu/pstree.c b/criu/pstree.c +index d29de730a..d006c2660 100644 +--- a/criu/pstree.c ++++ b/criu/pstree.c +@@ -954,6 +954,31 @@ static int prepare_pstree_kobj_ids(void) + return 0; + } + ++static int prepare_pstree_rseqs(void) ++{ ++ struct pstree_item *item; ++ ++ for_each_pstree_item(item) { ++ struct rst_rseq *rseqs; ++ size_t sz = sizeof(*rseqs) * item->nr_threads; ++ ++ if (!task_alive(item)) ++ continue; ++ ++ rseqs = shmalloc(sz); ++ if (!rseqs) { ++ pr_err("prepare_pstree_rseqs shmalloc(%ld) failed\n", sz); ++ return -1; ++ } ++ ++ memset(rseqs, 0, sz); ++ ++ rsti(item)->rseqe = rseqs; ++ } ++ ++ return 0; ++} ++ + int prepare_pstree(void) + { + int ret; +@@ -1011,6 +1036,17 @@ int prepare_pstree(void) + * pstree with properly injected helper tasks. + */ + ret = prepare_pstree_ids(pid); ++ if (!ret) ++ /* ++ * We need to alloc shared buffers for RseqEntry'es ++ * arrays (one RseqEntry per pstree item thread). ++ * ++ * We need shared memory because we perform ++ * open_core() on the late stage inside ++ * restore_one_alive_task(), so that's the only ++ * way to transfer that data to the main CRIU process. ++ */ ++ ret = prepare_pstree_rseqs(); + + return ret; + } +diff --git a/images/rseq.proto b/images/rseq.proto +index be2800468..45cb8476d 100644 +--- a/images/rseq.proto ++++ b/images/rseq.proto +@@ -6,4 +6,5 @@ message rseq_entry { + required uint64 rseq_abi_pointer = 1; + required uint32 rseq_abi_size = 2; + required uint32 signature = 3; ++ optional uint64 rseq_cs_pointer = 4; + } +-- +2.35.1 + diff --git a/0245-fixup.patch b/0245-fixup.patch new file mode 100644 index 0000000..a8b626d --- /dev/null +++ b/0245-fixup.patch @@ -0,0 +1,35 @@ +From 75ec2002c702a269062b0fff5443ed4a52571bc7 Mon Sep 17 00:00:00 2001 +From: Radostin Stoyanov +Date: Tue, 5 Apr 2022 10:48:40 +0100 +Subject: [PATCH 245/245] fixup + +Signed-off-by: Radostin Stoyanov +--- + criu/cr-dump.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/criu/cr-dump.c b/criu/cr-dump.c +index 0984bd11c..24d219855 100644 +--- a/criu/cr-dump.c ++++ b/criu/cr-dump.c +@@ -1057,7 +1057,7 @@ static int read_rseq_cs(pid_t tid, struct __ptrace_rseq_configuration *rseqc, st + */ + ret = ptrace_peek_area(tid, rseq, decode_pointer(rseqc->rseq_abi_pointer), sizeof(struct rseq)); + if (ret) { +- pr_err("ptrace_peek_area(%d, %lx, %lx, %lx): fail to read rseq struct\n", tid, (unsigned long)rseq, ++ pr_err("ptrace_peek_area(%d, %lx, %lx, %x): fail to read rseq struct\n", tid, (unsigned long)rseq, + (unsigned long)(rseqc->rseq_abi_pointer), sizeof(uint64_t)); + return -1; + } +@@ -1067,7 +1067,7 @@ static int read_rseq_cs(pid_t tid, struct __ptrace_rseq_configuration *rseqc, st + + ret = ptrace_peek_area(tid, rseq_cs, decode_pointer(rseq->rseq_cs.ptr64), sizeof(struct rseq_cs)); + if (ret) { +- pr_err("ptrace_peek_area(%d, %lx, %lx, %lx): fail to read rseq_cs struct\n", tid, ++ pr_err("ptrace_peek_area(%d, %lx, %lx, %x): fail to read rseq_cs struct\n", tid, + (unsigned long)rseq_cs, (unsigned long)rseq->rseq_cs.ptr64, sizeof(struct rseq_cs)); + return -1; + } +-- +2.35.1 + diff --git a/criu.spec b/criu.spec index b857792..dba7585 100644 --- a/criu.spec +++ b/criu.spec @@ -23,136 +23,256 @@ License: GPLv2 URL: http://criu.org/ Source0: https://github.com/checkpoint-restore/criu/archive/v%{version}/criu-%{version}.tar.gz -Patch4: 0004-criu-8-add-external-net-option.patch -Patch5: 0005-criu-Introduce-new-device-file-plugin-hooks.patch -Patch6: 0006-criu-plugin-Implement-dummy-amdgpu-plugin-hooks.patch -Patch7: 0007-criu-files-Don-t-cache-fd-ids-for-device-files.patch -Patch8: 0008-tcp-Skip-restoring-TCP-state-when-dumping-with-tcp-c.patch -Patch9: 0009-zdtm-Dumping-restoring-with-tcp-close-on-TCP_CLOSE-s.patch -Patch10: 0010-criu-8-Add-more-detailed-description-about-tcp-close.patch -Patch11: 0011-Add-support-for-python3-in-criu-coredump.patch -Patch12: 0012-Add-new-files-for-running-criu-coredump-via-python-2.patch -Patch13: 0013-coredump-remove-unused-import.patch -Patch14: 0014-coredump-sort-imports.patch -Patch15: 0015-coredump-convert-indentation-to-spaces.patch -Patch16: 0016-python-replace-equality-with-identity-test.patch -Patch17: 0017-coredump-drop-unused-variable.patch -Patch18: 0018-coredump-drop-exec-permission.patch -Patch19: 0019-coredump-lint-fix-for-block-comments.patch -Patch20: 0020-coredump-fix-missing-whitespace-around-operator.patch -Patch21: 0021-coredump-fix-too-many-blank-lines.patch -Patch22: 0022-coredump-fix-comparison-to-true.patch -Patch23: 0023-coredump-lint-fix-visually-indented-line.patch -Patch24: 0024-test-coredump-fix-shellcheck-errors.patch -Patch25: 0025-make-enable-lint-for-coredump.patch -Patch26: 0026-ci-enable-coredump-tests.patch -Patch27: 0027-pie-restorer-remove-excess-hash-printf-specifier.patch -Patch28: 0028-tty-fix-the-null-pointer-of-get_tty_driver.patch -Patch29: 0029-util-use-nftw-in-rmrf-helper.patch -Patch30: 0030-criu-ns-make-pidns-init-first-do-setsid.patch -Patch31: 0031-net-optimize-restore_rule-to-not-open-the-CR_FD_RULE.patch -Patch32: 0032-ci-replace-deprecated-codecov-bash-uploader.patch -Patch33: 0033-ci-fix-userfaultfd-test-failures.patch -Patch34: 0034-ci-use-Fedora-34-for-lint-CI-runs.patch -Patch35: 0035-tests-improve-the-image-streamer-process-control.patch -Patch36: 0036-sockets-don-t-call-sk_setbufs-asyncronously.patch -Patch37: 0037-kerndat-check-for-set-getsockopt-SO_BUF_LOCK-availab.patch -Patch38: 0038-sockets-c-r-bufer-size-locks.patch -Patch39: 0039-zdtm-add-test-for-socket-buffer-size-locks.patch -Patch40: 0040-zdtm-make-sock_opts02-also-check-lock-change-by-SO_-.patch -Patch41: 0041-clang-format-enable-AlignTrailingComments.patch -Patch42: 0042-clang-format-do-several-manual-comment-fixups.patch -Patch43: 0043-clang-format-do-automatic-comment-fixups.patch -Patch44: 0044-cr-dump-fail-dumping-when-zombie-process-with-sid-0.patch -Patch45: 0045-clang-format-make-x86_ins_capability_mask-human-read.patch -Patch46: 0046-ci-disable-socket-raw-test-on-centos8.patch -Patch47: 0047-zdtm.py-make-tests-with-link_remap-exclusive.patch -Patch48: 0048-tests-improve-the-deterministic-behavior-of-the-test.patch -Patch49: 0049-clang-format-zdtm-fix-clang-complains-about-strange-.patch -Patch50: 0050-seize-restore-cgroup-freezer-to-right-state.patch -Patch51: 0051-ci-Use-latest-Fedora-for-lint-ci-runs-again.patch -Patch52: 0052-crtools-ignore-SIGPIPE-in-swrk-mode.patch -Patch53: 0053-ci-switch-to-centos-stream-8.patch -Patch54: 0054-check-cleanup-child-processes.patch -Patch55: 0055-files-reg-fix-error-handling-in-open_path.patch -Patch56: 0056-files-reg-fix-error-handling-of-rm_parent_dirs.patch -Patch57: 0057-ghost-mount-allocate-remounted_rw-in-shmem-to-get-in.patch -Patch58: 0058-files-reg-temporary-remount-writable-the-mount-we-do.patch -Patch59: 0059-zdtm-add-ro-mount-check-after-c-r-to-mntns_ghost01.patch -Patch60: 0060-clang-format-disable-wrong-struct-pointer-declaratio.patch -Patch61: 0061-ci-Run-cross-compile-on-debian-stable.patch -Patch62: 0062-ci-Run-cross-compile-with-debian-testing.patch -Patch63: 0063-make-Explicitly-enable-FPU-on-ARMv7-builds.patch -Patch64: 0064-ci-disable-broken-tests-until-fixed.patch -Patch65: 0065-test-do-not-use-keep-going-for-single-zdtm-tests.patch -Patch66: 0066-files-reg-try-dump_ghost_remap-if-link-remap-failed-.patch -Patch67: 0067-util-make-page-server-IPv6-safe.patch -Patch68: 0068-sk-unix-Fix-TCP_ESTABLISHED-checks-in-unix-sockets.patch -Patch69: 0069-ci-Enable-disabled-unix-socket-related-tests.patch -Patch70: 0070-ci-install-procps-in-Alpine.patch -Patch71: 0071-test-another-try-to-correctly-fix-the-kernel-version.patch -Patch72: 0072-x86-compel-fault-inject-bound-xsave-features-set.patch -Patch73: 0073-x86-compel-fault-inject-print-the-initial-seed.patch -Patch74: 0074-ci-enable-x86-xsave-fault-injection-tests-back.patch -Patch75: 0075-Add-documentation-for-timeout-option.patch -Patch76: 0076-usernsd-UNS_FDOUT-should-not-require-an-input-descri.patch -Patch77: 0077-libcriu-add-setting-lsm-mount-context-to-libcriu.patch -Patch78: 0078-ci-use-unstable-release-for-cross-compile.patch -Patch79: 0079-ci-disable-glibc-rseq-support.patch -Patch80: 0080-libcriu-add-single-pre-dump-support.patch -Patch81: 0081-tests-added-test-for-single-pre-dump-support.patch -Patch82: 0082-zdtm.py-clean-up-MAKEFLAGS-env-variable-before-runni.patch -Patch83: 0083-zdtm-zdtm_ct-fix-compilation-error-with-strict-proto.patch -Patch84: 0084-zdtm-remove-mntns-deleted-dst-test-leftover-from-git.patch -Patch85: 0085-crtools-remove-excess-always-true-condition.patch -Patch86: 0086-crtools-rpc-export-current-criu-mode-to-opts.mode.patch -Patch87: 0087-crtools-use-new-opts.mode-in-image_dir_mode.patch -Patch88: 0088-crtools-check-that-cpuinfo-command-has-sub-command.patch -Patch89: 0089-sk-unix-Add-support-for-SOCK_SEQPACKET-unix-sockets.patch -Patch90: 0090-zdtm-Add-SOCK_SEQPACKET-variants-to-unix-socket-test.patch -Patch91: 0091-tls-fix-typo.patch -Patch92: 0092-tls-use-ssize_t-for-return-value.patch -Patch93: 0093-tls-add-more-comments.patch -Patch94: 0094-uffd-call-disconnect_from_page_server-to-shutdown-a-.patch -Patch95: 0095-tls-allow-to-terminate-connections-synchronously.patch -Patch96: 0096-page-xfer-stop-waiting-for-a-new-command-after-a-clo.patch -Patch97: 0097-ci-reenable-the-lazy-thp-test-in-the-lazy-remote-mod.patch -Patch98: 0098-test-log-testname.out.inprogress-if-a-test-has-faile.patch -Patch99: 0100-zdtm-static-uffd-events-add-more-log-messages.patch -Patch100: 0101-mount-split-check_mountpoint_fd-from-__open_mountpoi.patch -Patch101: 0102-mount-remove-mnt_fd-argument-of-__open_mountpoint.patch -Patch102: 0103-proc_parse-add-helper-to-resolve-sdev-from-fd.patch -Patch103: 0104-mount-btrfs-make-check_mountpoint_fd-fallback-to-get.patch -Patch104: 0105-ci-test-criu-image-streamer-with-all-tests.patch -Patch105: 0106-readme-add-docker-test-badge.patch -Patch106: 0107-contributing-remove-old-badges-and-logo.patch -Patch107: 0108-ci-update-to-latest-Vagrant-and-Fedora-images.patch -Patch108: 0109-ci-added-.lgtm.yml-file.patch -Patch109: 0110-lib-introduce-feature-check-in-libcriu.patch -Patch110: 0111-lib-added-tests-for-feature-check-in-libcriu.patch -Patch111: 0112-pagemap-tiny-fix-on-truncating-memory-image.patch -Patch112: 0113-zdtm-fix-zdtm-static-maps00-case-in-arm64.patch -Patch113: 0114-compel-fix-GCC-12-failure-out-of-bounds.patch -Patch114: 0115-criu-fix-configuration-file-scanner-with-GCC-12.patch -Patch115: 0116-compel-fix-parasite-with-GCC-12.patch -Patch116: 0117-ci-set-continue-on-error-for-cross-compile.patch -Patch117: 0118-test-autofs-fix-use-after-free.patch -Patch118: 0119-Fix-formatting-in-criu-documentation.patch -Patch119: 0120-compel-add-rseq-syscall-into-compel-std-plugin-sysca.patch -Patch120: 0121-kerndat-check-for-rseq-syscall-support.patch -Patch121: 0122-util-move-fork_and_ptrace_attach-helper-from-cr-chec.patch -Patch122: 0123-cr-check-Add-ptrace-rseq-conf-dump-feature.patch -Patch123: 0124-rseq-initial-support.patch -Patch124: 0125-zdtm-add-simple-test-for-rseq-C-R.patch -Patch125: 0126-Revert-ci-disable-glibc-rseq-support.patch -Patch126: 0127-ci-add-Fedora-Rawhide-based-test-on-Cirrus.patch -Patch127: 0128-fixup-attempt-to-disable-rseq-at-the-thread-start.patch -Patch128: 0129-zdtm-fixup-fix-rseq-test-when-linking-with-fresh-gli.patch +Patch1: 0001-criu-8-add-external-net-option.patch +Patch2: 0002-criu-files-Don-t-cache-fd-ids-for-device-files.patch +Patch3: 0003-tcp-Skip-restoring-TCP-state-when-dumping-with-tcp-c.patch +Patch4: 0004-zdtm-Dumping-restoring-with-tcp-close-on-TCP_CLOSE-s.patch +Patch5: 0005-criu-8-Add-more-detailed-description-about-tcp-close.patch +Patch6: 0006-Add-support-for-python3-in-criu-coredump.patch +Patch7: 0007-Add-new-files-for-running-criu-coredump-via-python-2.patch +Patch8: 0008-coredump-remove-unused-import.patch +Patch9: 0009-coredump-sort-imports.patch +Patch10: 0010-coredump-convert-indentation-to-spaces.patch +Patch11: 0011-python-replace-equality-with-identity-test.patch +Patch12: 0012-coredump-drop-unused-variable.patch +Patch13: 0013-coredump-drop-exec-permission.patch +Patch14: 0014-coredump-lint-fix-for-block-comments.patch +Patch15: 0015-coredump-fix-missing-whitespace-around-operator.patch +Patch16: 0016-coredump-fix-too-many-blank-lines.patch +Patch17: 0017-coredump-fix-comparison-to-true.patch +Patch18: 0018-coredump-lint-fix-visually-indented-line.patch +Patch19: 0019-test-coredump-fix-shellcheck-errors.patch +Patch20: 0020-make-enable-lint-for-coredump.patch +Patch21: 0021-ci-enable-coredump-tests.patch +Patch22: 0022-pie-restorer-remove-excess-hash-printf-specifier.patch +Patch23: 0023-tty-fix-the-null-pointer-of-get_tty_driver.patch +Patch24: 0024-util-use-nftw-in-rmrf-helper.patch +Patch25: 0025-criu-ns-make-pidns-init-first-do-setsid.patch +Patch26: 0026-net-optimize-restore_rule-to-not-open-the-CR_FD_RULE.patch +Patch27: 0027-ci-replace-deprecated-codecov-bash-uploader.patch +Patch28: 0028-ci-fix-userfaultfd-test-failures.patch +Patch29: 0029-ci-use-Fedora-34-for-lint-CI-runs.patch +Patch30: 0030-tests-improve-the-image-streamer-process-control.patch +Patch31: 0031-sockets-don-t-call-sk_setbufs-asyncronously.patch +Patch32: 0032-kerndat-check-for-set-getsockopt-SO_BUF_LOCK-availab.patch +Patch33: 0033-sockets-c-r-bufer-size-locks.patch +Patch34: 0034-zdtm-add-test-for-socket-buffer-size-locks.patch +Patch35: 0035-zdtm-make-sock_opts02-also-check-lock-change-by-SO_-.patch +Patch36: 0036-clang-format-enable-AlignTrailingComments.patch +Patch37: 0037-clang-format-do-several-manual-comment-fixups.patch +Patch38: 0038-clang-format-do-automatic-comment-fixups.patch +Patch39: 0039-cr-dump-fail-dumping-when-zombie-process-with-sid-0.patch +Patch40: 0040-clang-format-make-x86_ins_capability_mask-human-read.patch +Patch41: 0041-ci-disable-socket-raw-test-on-centos8.patch +Patch42: 0042-zdtm.py-make-tests-with-link_remap-exclusive.patch +Patch43: 0043-tests-improve-the-deterministic-behavior-of-the-test.patch +Patch44: 0044-clang-format-zdtm-fix-clang-complains-about-strange-.patch +Patch45: 0045-seize-restore-cgroup-freezer-to-right-state.patch +Patch46: 0046-ci-Use-latest-Fedora-for-lint-ci-runs-again.patch +Patch47: 0047-crtools-ignore-SIGPIPE-in-swrk-mode.patch +Patch48: 0048-ci-switch-to-centos-stream-8.patch +Patch49: 0049-check-cleanup-child-processes.patch +Patch50: 0050-files-reg-fix-error-handling-in-open_path.patch +Patch51: 0051-files-reg-fix-error-handling-of-rm_parent_dirs.patch +Patch52: 0052-ghost-mount-allocate-remounted_rw-in-shmem-to-get-in.patch +Patch53: 0053-files-reg-temporary-remount-writable-the-mount-we-do.patch +Patch54: 0054-zdtm-add-ro-mount-check-after-c-r-to-mntns_ghost01.patch +Patch55: 0055-clang-format-disable-wrong-struct-pointer-declaratio.patch +Patch56: 0056-ci-Run-cross-compile-on-debian-stable.patch +Patch57: 0057-ci-Run-cross-compile-with-debian-testing.patch +Patch58: 0058-make-Explicitly-enable-FPU-on-ARMv7-builds.patch +Patch59: 0059-ci-disable-broken-tests-until-fixed.patch +Patch60: 0060-test-do-not-use-keep-going-for-single-zdtm-tests.patch +Patch61: 0061-files-reg-try-dump_ghost_remap-if-link-remap-failed-.patch +Patch62: 0062-util-make-page-server-IPv6-safe.patch +Patch63: 0063-sk-unix-Fix-TCP_ESTABLISHED-checks-in-unix-sockets.patch +Patch64: 0064-ci-Enable-disabled-unix-socket-related-tests.patch +Patch65: 0065-ci-install-procps-in-Alpine.patch +Patch66: 0066-test-another-try-to-correctly-fix-the-kernel-version.patch +Patch67: 0067-x86-compel-fault-inject-bound-xsave-features-set.patch +Patch68: 0068-x86-compel-fault-inject-print-the-initial-seed.patch +Patch69: 0069-ci-enable-x86-xsave-fault-injection-tests-back.patch +Patch70: 0070-Add-documentation-for-timeout-option.patch +Patch71: 0071-usernsd-UNS_FDOUT-should-not-require-an-input-descri.patch +Patch72: 0072-libcriu-add-setting-lsm-mount-context-to-libcriu.patch +Patch73: 0073-ci-use-unstable-release-for-cross-compile.patch +Patch74: 0074-ci-disable-glibc-rseq-support.patch +Patch75: 0075-libcriu-add-single-pre-dump-support.patch +Patch76: 0076-tests-added-test-for-single-pre-dump-support.patch +Patch77: 0077-zdtm.py-clean-up-MAKEFLAGS-env-variable-before-runni.patch +Patch78: 0078-zdtm-zdtm_ct-fix-compilation-error-with-strict-proto.patch +Patch79: 0079-zdtm-remove-mntns-deleted-dst-test-leftover-from-git.patch +Patch80: 0080-crtools-remove-excess-always-true-condition.patch +Patch81: 0081-crtools-rpc-export-current-criu-mode-to-opts.mode.patch +Patch82: 0082-crtools-use-new-opts.mode-in-image_dir_mode.patch +Patch83: 0083-crtools-check-that-cpuinfo-command-has-sub-command.patch +Patch84: 0084-sk-unix-Add-support-for-SOCK_SEQPACKET-unix-sockets.patch +Patch85: 0085-zdtm-Add-SOCK_SEQPACKET-variants-to-unix-socket-test.patch +Patch86: 0086-tls-fix-typo.patch +Patch87: 0087-tls-use-ssize_t-for-return-value.patch +Patch88: 0088-tls-add-more-comments.patch +Patch89: 0089-uffd-call-disconnect_from_page_server-to-shutdown-a-.patch +Patch90: 0090-tls-allow-to-terminate-connections-synchronously.patch +Patch91: 0091-page-xfer-stop-waiting-for-a-new-command-after-a-clo.patch +Patch92: 0092-ci-reenable-the-lazy-thp-test-in-the-lazy-remote-mod.patch +Patch93: 0093-test-log-testname.out.inprogress-if-a-test-has-faile.patch +Patch94: 0094-zdtm-print-tails-of-all-logs-if-a-test-has-failed.patch +Patch95: 0095-zdtm-static-uffd-events-add-more-log-messages.patch +Patch96: 0096-mount-split-check_mountpoint_fd-from-__open_mountpoi.patch +Patch97: 0097-mount-remove-mnt_fd-argument-of-__open_mountpoint.patch +Patch98: 0098-proc_parse-add-helper-to-resolve-sdev-from-fd.patch +Patch99: 0099-mount-btrfs-make-check_mountpoint_fd-fallback-to-get.patch +Patch100: 0100-ci-test-criu-image-streamer-with-all-tests.patch +Patch101: 0101-readme-add-docker-test-badge.patch +Patch102: 0102-contributing-remove-old-badges-and-logo.patch +Patch103: 0103-ci-update-to-latest-Vagrant-and-Fedora-images.patch +Patch104: 0104-ci-added-.lgtm.yml-file.patch +Patch105: 0105-lib-introduce-feature-check-in-libcriu.patch +Patch106: 0106-lib-added-tests-for-feature-check-in-libcriu.patch +Patch107: 0107-pagemap-tiny-fix-on-truncating-memory-image.patch +Patch108: 0108-zdtm-fix-zdtm-static-maps00-case-in-arm64.patch +Patch109: 0109-compel-fix-GCC-12-failure-out-of-bounds.patch +Patch110: 0110-criu-fix-configuration-file-scanner-with-GCC-12.patch +Patch111: 0111-compel-fix-parasite-with-GCC-12.patch +Patch112: 0112-ci-set-continue-on-error-for-cross-compile.patch +Patch113: 0113-test-autofs-fix-use-after-free.patch +Patch114: 0114-Fix-formatting-in-criu-documentation.patch +Patch115: 0115-ci-install-libbsd-dependency.patch +Patch116: 0116-pstree-when-updating-sid-for-shell-job-also-update-m.patch +Patch117: 0117-criu-ns-fix-exit-code-o-for-criu-dump.patch +Patch118: 0118-criu-ns-use-os.waitstatus_to_exitcode.patch +Patch119: 0119-restorer-Fix-sys_mmap-s-returned-value-check.patch +Patch120: 0120-compel-fix-how-PTRACE_GET_THREAD_AREA-errors-are-han.patch +Patch121: 0121-util-add-an-unique-ID-of-the-current-criu-run.patch +Patch122: 0122-files-generate-unique-transport-socket-names.patch +Patch123: 0123-check-Add-a-check-for-using-memfd-with-hugetlb.patch +Patch124: 0124-kerndat-Collect-hugetlb-device-numbers.patch +Patch125: 0125-ipc-Add-support-for-checkpoint-restore-hugetlb-Syste.patch +Patch126: 0126-memfd-shmem-Add-support-for-checkpoint-restore-memfd.patch +Patch127: 0127-proc_parse-files-Add-support-for-hugetlb-memory-mapp.patch +Patch128: 0128-mem-Skip-premapping-hugetlb-mapping.patch +Patch129: 0129-uffd-Skip-lazy-mode-restore-on-hugetlb-mappings.patch +Patch130: 0130-zdtm-Add-MAP_HUGETLB-memory-mapping-test.patch +Patch131: 0131-zdtm-Add-memfd-hugetlb-test.patch +Patch132: 0132-zdtm-Add-shm-hugetlb-test.patch +Patch133: 0133-zdtm-Add-MAP_HUGETLB-mappings-test-for-parent-child-.patch +Patch134: 0134-ci-skip-MAP_HUGETLB-tests-in-stream-test.patch +Patch135: 0135-bpfmap-handle-new-field-in-fdinfo.patch +Patch136: 0136-test-remove-test-for-LOCK_MAND-flock.patch +Patch137: 0137-test-disable-rseq-also-on-Archlinux.patch +Patch138: 0138-zdtm-fix-missplacement-of-err-True.patch +Patch139: 0139-compel-set-mxcsr-during-error-injection-to-zero.patch +Patch140: 0140-proc_smaps-remove-useless-nonlinear-check.patch +Patch141: 0141-mount-fix-e_str-leak-in-ext_mount_add.patch +Patch142: 0142-cr-dump-fix-cr_imgset-leak-in-dump_one_task.patch +Patch143: 0143-tun-fix-tun_link-leak-in-dump_tun_link.patch +Patch144: 0144-sk-unix-fix-uint32_t-id-variable-printf-format-speci.patch +Patch145: 0145-zdtm-refactor-main.patch +Patch146: 0146-zdtm-sort-import-lines.patch +Patch147: 0147-zdtm-use-long-form-cli-options.patch +Patch148: 0148-zdtm-add-criu-config-option.patch +Patch149: 0149-zdtm-drop-redundant-config_inotify_irmap-test.patch +Patch150: 0150-ci-run-criu-config-tests.patch +Patch151: 0151-config-fix-ns-leak-in-parse_join_ns.patch +Patch152: 0152-net-fix-e_str-leak-in-veth_pair_add.patch +Patch153: 0153-files-fix-inh-leak-in-inherit_fd_add.patch +Patch154: 0154-sk-unix-fix-e_str-leak-in-unix_sk_id_add.patch +Patch155: 0155-uffd-fix-__u64-print-format-specifier.patch +Patch156: 0156-zdtm-fix-mnt_ext_master-test-to-correspond-to-it-s-n.patch +Patch157: 0157-mount-add-mntinfo_add_list_before-helper-for-adding-.patch +Patch158: 0158-mount-do-not-detect-non-fsroot-mounts-as-device-exte.patch +Patch159: 0159-mount-mark-mounts-of-external-devices-external.patch +Patch160: 0160-mount-skip-fstype-and-source-checks-for-external-mou.patch +Patch161: 0161-mount-setup-mnt_bind-list-before-using-it-in-mnt_is_.patch +Patch162: 0162-util-add-get_relative_path-helper.patch +Patch163: 0163-unittest-add-some-tests-for-get_relative_path-helper.patch +Patch164: 0164-mount-add-mnt_bind_pick-helper-to-pick-the-desired-b.patch +Patch165: 0165-mount-split-mnt_is_external-_bind-and-can_receive_ma.patch +Patch166: 0166-mount-rework-skipping-external-mounts-in-dump_one_mo.patch +Patch167: 0167-mount-show-more-info-about-why-we-can-t-mount.patch +Patch168: 0168-mount-mount-external-mount-before-mounting-it-s-bind.patch +Patch169: 0169-zdtm-add-new-mnt_ext_root-test.patch +Patch170: 0170-mount-restrict-mp-external-mount-map-to-init-contain.patch +Patch171: 0171-zdtm-add-mnt_ext_collision-test.patch +Patch172: 0172-mount-add-mnt_is_root_bind-helper.patch +Patch173: 0173-mount-allow-nested-mount-namespaces-with-different-r.patch +Patch174: 0174-zdtm-add-mntns_pivot_root-test.patch +Patch175: 0175-mount-apply-superblock-flags-to-nested-ns-roots.patch +Patch176: 0176-zdtm-add-mntns_pivot_root_ro-test.patch +Patch177: 0177-mount-restore-create-auxiliary-binfmt_misc-mount-in-.patch +Patch178: 0178-mount-restore-leave-ns_mountpoint-NULL-for-aux-binfm.patch +Patch179: 0179-mount-replace-CRTIME_MNT_ID-with-HELPER_MNT_ID.patch +Patch180: 0180-mount-add-can_receive_master_from_root-helper.patch +Patch181: 0181-mount-put-external-slavery-mounts-to-separate-mnt_ex.patch +Patch182: 0182-mount-do-not-override-master_id-to-1-for-root-binds.patch +Patch183: 0183-mount-add-helper-mnt_get_external_bind_nodev.patch +Patch184: 0184-mount-prepare-is_overmounted-as-early-as-possible.patch +Patch185: 0185-mount-move-root-yard-tree-merge-as-early-as-possible.patch +Patch186: 0186-mount-fix-broken-remounted_rw-check.patch +Patch187: 0187-mount-make-general-place-for-shared-variables-on-mou.patch +Patch188: 0188-autofs-use-ns_mountpoint-in-autofs_create_dentries.patch +Patch189: 0189-mount-use-ns_mountpoint-in-mnt_is_overmounted.patch +Patch190: 0190-mount-skip-root-yard-children-from-mnt_needs_remap-c.patch +Patch191: 0191-mount-use-ns_mountpoint-in-validate_children_collisi.patch +Patch192: 0192-mount-use-ns_mountpoint-in-root_path_from_parent.patch +Patch193: 0193-mount-use-ns_mountpoint-for-children-overmount-check.patch +Patch194: 0194-path-simplify-mnt_get_sibling_path-via-get_relative_.patch +Patch195: 0195-mount-use-ns_mountpoint-in-collect_mntinfo.patch +Patch196: 0196-mount-use-ns_mountpoint-in-aufs_parse.patch +Patch197: 0197-mount-use-ns_mountpoint-in-mnt_depth.patch +Patch198: 0198-mount-use-ns_mountpoint-instead-of-mountpoint-where-.patch +Patch199: 0199-mount-add-service_mountpoint-getter-for-mountpoint.patch +Patch200: 0200-files-reg-split-create_ghost_dentry-out-of-create_gh.patch +Patch201: 0201-files-reg-teach-create_ghost-to-work-with-mount-v2.patch +Patch202: 0202-files-reg-teach-clean_one_remap-to-work-with-mount-v.patch +Patch203: 0203-kerndat-Check-for-MOVE_MOUNT_SET_GROUP-availability.patch +Patch204: 0204-compel-add-open_tree-syscall.patch +Patch205: 0205-kerndat-check-whether-the-openat2-syscall-is-support.patch +Patch206: 0206-util-add-resolve_mountpoint-helper.patch +Patch207: 0207-crtools-move-check_options-after-kerndat_init-and-lo.patch +Patch208: 0208-config-rpc-add-new-option-mntns-compat-mode-for-old-.patch +Patch209: 0209-mount-add-plain-mountpoints.patch +Patch210: 0210-files-reg-export-parent-dirs-helpers-for-mount-v2.patch +Patch211: 0211-mount-remove-double-ns_id-declaration.patch +Patch212: 0212-mount-export-common-defines-for-mount-v2.patch +Patch213: 0213-mount-export-several-functions-for-mount-v2.patch +Patch214: 0214-mount-export-global-variables-for-mount-v2.patch +Patch215: 0215-mount-add-new-mounts-v2-engine.patch +Patch216: 0216-zdtm-enable-mounts-compat-mode-on-restore-with-mntns.patch +Patch217: 0217-ci-run-tests-for-old-mount-engine.patch +Patch218: 0218-zdtm-add-new-mnt_ext_sharing-test-for-mount-v2.patch +Patch219: 0219-zdtm-add-mount_complex_sharing-test.patch +Patch220: 0220-zdtm-add-propagation-group-with-mount-flags-to-mount.patch +Patch221: 0221-zdtm-mount-v2-disable-mnt_tracefs-test.patch +Patch222: 0222-ci-make-others-mnt_ext_dev-also-run-for-old-mount-en.patch +Patch223: 0223-test-jenkins-test-for-old-mount-engine.patch +Patch224: 0224-zdtm-mount-v2-disable-pty-console-test.patch +Patch225: 0225-mount-v2-make-mount-engine-fallback-messages-logleve.patch +Patch226: 0226-mount-make-error-messages-differ-in-different-places.patch +Patch227: 0227-zdtm-use-unique-holder-for-cgroups.patch +Patch228: 0228-scripts-ci-mount-test-cgroups-once.patch +Patch229: 0229-criu-ns-add-a-helper-to-hold-a-pid-namespace.patch +Patch230: 0230-apparmor-Fix-Wfortify-source-for-Clang.patch +Patch231: 0231-style-delete-some-redundant-code.patch +Patch232: 0232-mount-fix-Wunused-but-set-variable-for-Clang-15.patch +Patch233: 0233-criu-generate-unique-socket-names.patch +Patch234: 0234-ci-Ubuntu-broke-overlayfs-again.patch +Patch235: 0235-compel-add-rseq-syscall-into-compel-std-plugin-sysca.patch +Patch236: 0236-kerndat-check-for-rseq-syscall-support.patch +Patch237: 0237-util-move-fork_and_ptrace_attach-helper-from-cr-chec.patch +Patch238: 0238-cr-check-Add-ptrace-rseq-conf-dump-feature.patch +Patch239: 0239-rseq-initial-support.patch +Patch240: 0240-include-add-thread_pointer.h-from-Glibc.patch +Patch241: 0241-clone-noasan-unregister-rseq-at-the-thread-start-for.patch +Patch242: 0242-compel-add-helpers-to-get-set-instruction-pointer.patch +Patch243: 0243-cr-dump-fixup-thread-IP-when-inside-rseq-cs.patch +Patch244: 0244-cr-dump-handle-rseq-flags-field.patch +Patch245: 0245-fixup.patch # Add protobuf-c as a dependency. # We use this patch because the protobuf-c package name # in RPM and DEB is different. -Patch199: criu.pc.patch +Patch299: criu.pc.patch %if 0%{?rhel} && 0%{?rhel} <= 7 BuildRequires: perl @@ -165,7 +285,7 @@ Source4: criu-ns.1 # The patch aio-fix.patch is needed as RHEL7 # doesn't do "nr_events *= 2" in ioctx_alloc(). -Patch200: aio-fix.patch +Patch300: aio-fix.patch %endif Source5: criu-tmpfiles.conf @@ -248,6 +368,9 @@ This script can help to workaround the so called "PID mismatch" problem. %prep %setup -q +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 %patch4 -p1 %patch5 -p1 %patch6 -p1 @@ -373,11 +496,128 @@ This script can help to workaround the so called "PID mismatch" problem. %patch126 -p1 %patch127 -p1 %patch128 -p1 - +%patch129 -p1 +%patch130 -p1 +%patch131 -p1 +%patch132 -p1 +%patch133 -p1 +%patch134 -p1 +%patch135 -p1 +%patch136 -p1 +%patch137 -p1 +%patch138 -p1 +%patch139 -p1 +%patch140 -p1 +%patch141 -p1 +%patch142 -p1 +%patch143 -p1 +%patch144 -p1 +%patch145 -p1 +%patch146 -p1 +%patch147 -p1 +%patch148 -p1 +%patch149 -p1 +%patch150 -p1 +%patch151 -p1 +%patch152 -p1 +%patch153 -p1 +%patch154 -p1 +%patch155 -p1 +%patch156 -p1 +%patch157 -p1 +%patch158 -p1 +%patch159 -p1 +%patch160 -p1 +%patch161 -p1 +%patch162 -p1 +%patch163 -p1 +%patch164 -p1 +%patch165 -p1 +%patch166 -p1 +%patch167 -p1 +%patch168 -p1 +%patch169 -p1 +%patch170 -p1 +%patch171 -p1 +%patch172 -p1 +%patch173 -p1 +%patch174 -p1 +%patch175 -p1 +%patch176 -p1 +%patch177 -p1 +%patch178 -p1 +%patch179 -p1 +%patch180 -p1 +%patch181 -p1 +%patch182 -p1 +%patch183 -p1 +%patch184 -p1 +%patch185 -p1 +%patch186 -p1 +%patch187 -p1 +%patch188 -p1 +%patch189 -p1 +%patch190 -p1 +%patch191 -p1 +%patch192 -p1 +%patch193 -p1 +%patch194 -p1 +%patch195 -p1 +%patch196 -p1 +%patch197 -p1 +%patch198 -p1 %patch199 -p1 +%patch200 -p1 +%patch201 -p1 +%patch202 -p1 +%patch203 -p1 +%patch204 -p1 +%patch205 -p1 +%patch206 -p1 +%patch207 -p1 +%patch208 -p1 +%patch209 -p1 +%patch210 -p1 +%patch211 -p1 +%patch212 -p1 +%patch213 -p1 +%patch214 -p1 +%patch215 -p1 +%patch216 -p1 +%patch217 -p1 +%patch218 -p1 +%patch219 -p1 +%patch220 -p1 +%patch221 -p1 +%patch222 -p1 +%patch223 -p1 +%patch224 -p1 +%patch225 -p1 +%patch226 -p1 +%patch227 -p1 +%patch228 -p1 +%patch229 -p1 +%patch230 -p1 +%patch231 -p1 +%patch232 -p1 +%patch233 -p1 +%patch234 -p1 +%patch235 -p1 +%patch236 -p1 +%patch237 -p1 +%patch238 -p1 +%patch239 -p1 +%patch240 -p1 +%patch241 -p1 +%patch242 -p1 +%patch243 -p1 +%patch244 -p1 +%patch245 -p1 + +%patch299 -p1 %if 0%{?rhel} && 0%{?rhel} <= 7 -%patch200 -p1 +%patch300 -p1 %endif %build @@ -461,6 +701,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %doc %{_mandir}/man1/criu-ns.1* %changelog +* Tue Apr 5 2022 Radostin Stoyanov - 3.16.1-9 +- Update rseq support patches + * Fri Feb 18 2022 Radostin Stoyanov - 3.16.1-8 - rebuilt From c227e2b9c3730f2c79470a4fa60fca6a0c32ef98 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Tue, 5 Apr 2022 12:25:49 +0100 Subject: [PATCH 041/109] Update release to 3.16.1-9 Signed-off-by: Radostin Stoyanov --- criu.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/criu.spec b/criu.spec index dba7585..436309e 100644 --- a/criu.spec +++ b/criu.spec @@ -17,7 +17,7 @@ Name: criu Version: 3.16.1 -Release: 8%{?dist} +Release: 9%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPLv2 URL: http://criu.org/ From 84bca7d01e154f800bba90c0f6fe2bb35e0009e4 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Tue, 5 Apr 2022 12:30:44 +0100 Subject: [PATCH 042/109] Update fixup patch Signed-off-by: Radostin Stoyanov --- 0245-fixup.patch | 10 +++++----- criu.spec | 5 ++++- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/0245-fixup.patch b/0245-fixup.patch index a8b626d..9adb44a 100644 --- a/0245-fixup.patch +++ b/0245-fixup.patch @@ -1,7 +1,7 @@ -From 75ec2002c702a269062b0fff5443ed4a52571bc7 Mon Sep 17 00:00:00 2001 +From 9a0c293c5ea8ca0430d1887b1f2647d0217e222f Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Tue, 5 Apr 2022 10:48:40 +0100 -Subject: [PATCH 245/245] fixup +Subject: [PATCH] fixup Signed-off-by: Radostin Stoyanov --- @@ -9,7 +9,7 @@ Signed-off-by: Radostin Stoyanov 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/criu/cr-dump.c b/criu/cr-dump.c -index 0984bd11c..24d219855 100644 +index 0984bd11c..4ca436d26 100644 --- a/criu/cr-dump.c +++ b/criu/cr-dump.c @@ -1057,7 +1057,7 @@ static int read_rseq_cs(pid_t tid, struct __ptrace_rseq_configuration *rseqc, st @@ -17,7 +17,7 @@ index 0984bd11c..24d219855 100644 ret = ptrace_peek_area(tid, rseq, decode_pointer(rseqc->rseq_abi_pointer), sizeof(struct rseq)); if (ret) { - pr_err("ptrace_peek_area(%d, %lx, %lx, %lx): fail to read rseq struct\n", tid, (unsigned long)rseq, -+ pr_err("ptrace_peek_area(%d, %lx, %lx, %x): fail to read rseq struct\n", tid, (unsigned long)rseq, ++ pr_err("ptrace_peek_area(%d, %lx, %lx, %lu): fail to read rseq struct\n", tid, (unsigned long)rseq, (unsigned long)(rseqc->rseq_abi_pointer), sizeof(uint64_t)); return -1; } @@ -26,7 +26,7 @@ index 0984bd11c..24d219855 100644 ret = ptrace_peek_area(tid, rseq_cs, decode_pointer(rseq->rseq_cs.ptr64), sizeof(struct rseq_cs)); if (ret) { - pr_err("ptrace_peek_area(%d, %lx, %lx, %lx): fail to read rseq_cs struct\n", tid, -+ pr_err("ptrace_peek_area(%d, %lx, %lx, %x): fail to read rseq_cs struct\n", tid, ++ pr_err("ptrace_peek_area(%d, %lx, %lx, %lu): fail to read rseq_cs struct\n", tid, (unsigned long)rseq_cs, (unsigned long)rseq->rseq_cs.ptr64, sizeof(struct rseq_cs)); return -1; } diff --git a/criu.spec b/criu.spec index 436309e..9276ae8 100644 --- a/criu.spec +++ b/criu.spec @@ -17,7 +17,7 @@ Name: criu Version: 3.16.1 -Release: 9%{?dist} +Release: 10%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPLv2 URL: http://criu.org/ @@ -701,6 +701,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %doc %{_mandir}/man1/criu-ns.1* %changelog +* Tue Apr 5 2022 Radostin Stoyanov - 3.16.1-10 +- Update fixup patch + * Tue Apr 5 2022 Radostin Stoyanov - 3.16.1-9 - Update rseq support patches From 9b634ab2ed344241ec0d77629e231679418cc489 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Tue, 5 Apr 2022 15:09:23 +0100 Subject: [PATCH 043/109] Update rseq patches Signed-off-by: Radostin Stoyanov --- 0001-criu-8-add-external-net-option.patch | 4 +- ...-Don-t-cache-fd-ids-for-device-files.patch | 41 -- ...ng-TCP-state-when-dumping-with-tcp-c.patch | 4 +- ...toring-with-tcp-close-on-TCP_CLOSE-s.patch | 4 +- ...detailed-description-about-tcp-close.patch | 4 +- ...support-for-python3-in-criu-coredump.patch | 4 +- ...r-running-criu-coredump-via-python-2.patch | 4 +- ...> 0007-coredump-remove-unused-import.patch | 4 +- ....patch => 0008-coredump-sort-imports.patch | 4 +- ...redump-convert-indentation-to-spaces.patch | 4 +- ...-replace-equality-with-identity-test.patch | 4 +- ...> 0011-coredump-drop-unused-variable.patch | 4 +- ...> 0012-coredump-drop-exec-permission.patch | 4 +- ...coredump-lint-fix-for-block-comments.patch | 4 +- ...x-missing-whitespace-around-operator.patch | 4 +- ...15-coredump-fix-too-many-blank-lines.patch | 4 +- ...0016-coredump-fix-comparison-to-true.patch | 4 +- ...dump-lint-fix-visually-indented-line.patch | 4 +- ...-test-coredump-fix-shellcheck-errors.patch | 4 +- ...> 0019-make-enable-lint-for-coredump.patch | 4 +- ...tch => 0020-ci-enable-coredump-tests.patch | 4 +- ...-remove-excess-hash-printf-specifier.patch | 4 +- ...x-the-null-pointer-of-get_tty_driver.patch | 4 +- ...=> 0023-util-use-nftw-in-rmrf-helper.patch | 4 +- ...u-ns-make-pidns-init-first-do-setsid.patch | 4 +- ...tore_rule-to-not-open-the-CR_FD_RULE.patch | 4 +- ...ace-deprecated-codecov-bash-uploader.patch | 4 +- ...027-ci-fix-userfaultfd-test-failures.patch | 4 +- ...28-ci-use-Fedora-34-for-lint-CI-runs.patch | 4 +- ...e-the-image-streamer-process-control.patch | 4 +- ...-don-t-call-sk_setbufs-asyncronously.patch | 4 +- ...r-set-getsockopt-SO_BUF_LOCK-availab.patch | 4 +- ...=> 0032-sockets-c-r-bufer-size-locks.patch | 4 +- ...dd-test-for-socket-buffer-size-locks.patch | 4 +- ...pts02-also-check-lock-change-by-SO_-.patch | 4 +- ...-format-enable-AlignTrailingComments.patch | 4 +- ...mat-do-several-manual-comment-fixups.patch | 4 +- ...g-format-do-automatic-comment-fixups.patch | 4 +- ...mping-when-zombie-process-with-sid-0.patch | 4 +- ...e-x86_ins_capability_mask-human-read.patch | 4 +- ...i-disable-socket-raw-test-on-centos8.patch | 4 +- ...make-tests-with-link_remap-exclusive.patch | 4 +- ...e-deterministic-behavior-of-the-test.patch | 4 +- ...m-fix-clang-complains-about-strange-.patch | 4 +- ...estore-cgroup-freezer-to-right-state.patch | 4 +- ...latest-Fedora-for-lint-ci-runs-again.patch | 4 +- ...-crtools-ignore-SIGPIPE-in-swrk-mode.patch | 4 +- ...=> 0047-ci-switch-to-centos-stream-8.patch | 4 +- ...> 0048-check-cleanup-child-processes.patch | 4 +- ...-reg-fix-error-handling-in-open_path.patch | 4 +- ...fix-error-handling-of-rm_parent_dirs.patch | 4 +- ...cate-remounted_rw-in-shmem-to-get-in.patch | 4 +- ...ary-remount-writable-the-mount-we-do.patch | 4 +- ...unt-check-after-c-r-to-mntns_ghost01.patch | 4 +- ...able-wrong-struct-pointer-declaratio.patch | 4 +- ...i-Run-cross-compile-on-debian-stable.patch | 4 +- ...un-cross-compile-with-debian-testing.patch | 4 +- ...xplicitly-enable-FPU-on-ARMv7-builds.patch | 4 +- ...-ci-disable-broken-tests-until-fixed.patch | 4 +- ...use-keep-going-for-single-zdtm-tests.patch | 4 +- ...mp_ghost_remap-if-link-remap-failed-.patch | 4 +- ...0061-util-make-page-server-IPv6-safe.patch | 4 +- ...P_ESTABLISHED-checks-in-unix-sockets.patch | 4 +- ...e-disabled-unix-socket-related-tests.patch | 4 +- ... => 0064-ci-install-procps-in-Alpine.patch | 4 +- ...-to-correctly-fix-the-kernel-version.patch | 4 +- ...ault-inject-bound-xsave-features-set.patch | 4 +- ...-fault-inject-print-the-initial-seed.patch | 4 +- ...x86-xsave-fault-injection-tests-back.patch | 4 +- ...Add-documentation-for-timeout-option.patch | 4 +- ...T-should-not-require-an-input-descri.patch | 4 +- ...setting-lsm-mount-context-to-libcriu.patch | 4 +- ...e-unstable-release-for-cross-compile.patch | 4 +- ...> 0073-ci-disable-glibc-rseq-support.patch | 4 +- ...-libcriu-add-single-pre-dump-support.patch | 4 +- ...ded-test-for-single-pre-dump-support.patch | 4 +- ...-MAKEFLAGS-env-variable-before-runni.patch | 4 +- ...-compilation-error-with-strict-proto.patch | 4 +- ...s-deleted-dst-test-leftover-from-git.patch | 4 +- ...-remove-excess-always-true-condition.patch | 4 +- ...xport-current-criu-mode-to-opts.mode.patch | 4 +- ...-use-new-opts.mode-in-image_dir_mode.patch | 4 +- ...that-cpuinfo-command-has-sub-command.patch | 4 +- ...port-for-SOCK_SEQPACKET-unix-sockets.patch | 4 +- ...QPACKET-variants-to-unix-socket-test.patch | 4 +- ...-fix-typo.patch => 0085-tls-fix-typo.patch | 4 +- ...086-tls-use-ssize_t-for-return-value.patch | 4 +- ....patch => 0087-tls-add-more-comments.patch | 4 +- ...nect_from_page_server-to-shutdown-a-.patch | 4 +- ...-terminate-connections-synchronously.patch | 4 +- ...aiting-for-a-new-command-after-a-clo.patch | 4 +- ...lazy-thp-test-in-the-lazy-remote-mod.patch | 4 +- ...e.out.inprogress-if-a-test-has-faile.patch | 4 +- ...ils-of-all-logs-if-a-test-has-failed.patch | 4 +- ...ic-uffd-events-add-more-log-messages.patch | 4 +- ...k_mountpoint_fd-from-__open_mountpoi.patch | 4 +- ...mnt_fd-argument-of-__open_mountpoint.patch | 4 +- ...e-add-helper-to-resolve-sdev-from-fd.patch | 4 +- ...-check_mountpoint_fd-fallback-to-get.patch | 4 +- ...t-criu-image-streamer-with-all-tests.patch | 4 +- ...=> 0100-readme-add-docker-test-badge.patch | 4 +- ...tributing-remove-old-badges-and-logo.patch | 4 +- ...-to-latest-Vagrant-and-Fedora-images.patch | 4 +- ...atch => 0103-ci-added-.lgtm.yml-file.patch | 4 +- ...b-introduce-feature-check-in-libcriu.patch | 4 +- ...d-tests-for-feature-check-in-libcriu.patch | 4 +- ...-tiny-fix-on-truncating-memory-image.patch | 4 +- ...fix-zdtm-static-maps00-case-in-arm64.patch | 4 +- ...pel-fix-GCC-12-failure-out-of-bounds.patch | 4 +- ...nfiguration-file-scanner-with-GCC-12.patch | 4 +- ...0110-compel-fix-parasite-with-GCC-12.patch | 4 +- ...-continue-on-error-for-cross-compile.patch | 4 +- ... 0112-test-autofs-fix-use-after-free.patch | 4 +- ...Fix-formatting-in-criu-documentation.patch | 4 +- ...=> 0114-ci-install-libbsd-dependency.patch | 4 +- ...ting-sid-for-shell-job-also-update-m.patch | 4 +- ...riu-ns-fix-exit-code-o-for-criu-dump.patch | 4 +- ...riu-ns-use-os.waitstatus_to_exitcode.patch | 4 +- ...-Fix-sys_mmap-s-returned-value-check.patch | 4 +- ...TRACE_GET_THREAD_AREA-errors-are-han.patch | 4 +- ...an-unique-ID-of-the-current-criu-run.patch | 4 +- ...nerate-unique-transport-socket-names.patch | 4 +- ...a-check-for-using-memfd-with-hugetlb.patch | 4 +- ...rndat-Collect-hugetlb-device-numbers.patch | 4 +- ...for-checkpoint-restore-hugetlb-Syste.patch | 4 +- ...support-for-checkpoint-restore-memfd.patch | 4 +- ...-Add-support-for-hugetlb-memory-mapp.patch | 4 +- ...-mem-Skip-premapping-hugetlb-mapping.patch | 4 +- ...azy-mode-restore-on-hugetlb-mappings.patch | 4 +- ...-Add-MAP_HUGETLB-memory-mapping-test.patch | 4 +- ... => 0130-zdtm-Add-memfd-hugetlb-test.patch | 4 +- ...ch => 0131-zdtm-Add-shm-hugetlb-test.patch | 4 +- ...ETLB-mappings-test-for-parent-child-.patch | 4 +- ...kip-MAP_HUGETLB-tests-in-stream-test.patch | 4 +- ...34-bpfmap-handle-new-field-in-fdinfo.patch | 4 +- ...test-remove-test-for-LOCK_MAND-flock.patch | 4 +- ...-test-disable-rseq-also-on-Archlinux.patch | 4 +- ...7-zdtm-fix-missplacement-of-err-True.patch | 4 +- ...mxcsr-during-error-injection-to-zero.patch | 4 +- ...smaps-remove-useless-nonlinear-check.patch | 4 +- ...ount-fix-e_str-leak-in-ext_mount_add.patch | 4 +- ...-fix-cr_imgset-leak-in-dump_one_task.patch | 4 +- ...n-fix-tun_link-leak-in-dump_tun_link.patch | 4 +- ...32_t-id-variable-printf-format-speci.patch | 4 +- ...ain.patch => 0144-zdtm-refactor-main.patch | 4 +- ...patch => 0145-zdtm-sort-import-lines.patch | 4 +- ... 0146-zdtm-use-long-form-cli-options.patch | 4 +- ... => 0147-zdtm-add-criu-config-option.patch | 4 +- ...-redundant-config_inotify_irmap-test.patch | 4 +- ...tch => 0149-ci-run-criu-config-tests.patch | 4 +- ...-config-fix-ns-leak-in-parse_join_ns.patch | 4 +- ...-net-fix-e_str-leak-in-veth_pair_add.patch | 4 +- ...files-fix-inh-leak-in-inherit_fd_add.patch | 4 +- ...nix-fix-e_str-leak-in-unix_sk_id_add.patch | 4 +- ...ffd-fix-__u64-print-format-specifier.patch | 4 +- ..._master-test-to-correspond-to-it-s-n.patch | 4 +- ...o_add_list_before-helper-for-adding-.patch | 4 +- ...ect-non-fsroot-mounts-as-device-exte.patch | 4 +- ...-mounts-of-external-devices-external.patch | 4 +- ...e-and-source-checks-for-external-mou.patch | 4 +- ...bind-list-before-using-it-in-mnt_is_.patch | 4 +- ...61-util-add-get_relative_path-helper.patch | 4 +- ...e-tests-for-get_relative_path-helper.patch | 4 +- ...nd_pick-helper-to-pick-the-desired-b.patch | 4 +- ...is_external-_bind-and-can_receive_ma.patch | 4 +- ...pping-external-mounts-in-dump_one_mo.patch | 4 +- ...w-more-info-about-why-we-can-t-mount.patch | 4 +- ...rnal-mount-before-mounting-it-s-bind.patch | 4 +- ... 0168-zdtm-add-new-mnt_ext_root-test.patch | 4 +- ...p-external-mount-map-to-init-contain.patch | 4 +- ...0170-zdtm-add-mnt_ext_collision-test.patch | 4 +- ...71-mount-add-mnt_is_root_bind-helper.patch | 4 +- ...ed-mount-namespaces-with-different-r.patch | 4 +- ... 0173-zdtm-add-mntns_pivot_root-test.patch | 4 +- ...-superblock-flags-to-nested-ns-roots.patch | 4 +- ...75-zdtm-add-mntns_pivot_root_ro-test.patch | 4 +- ...eate-auxiliary-binfmt_misc-mount-in-.patch | 4 +- ...ave-ns_mountpoint-NULL-for-aux-binfm.patch | 4 +- ...ace-CRTIME_MNT_ID-with-HELPER_MNT_ID.patch | 4 +- ...-can_receive_master_from_root-helper.patch | 4 +- ...al-slavery-mounts-to-separate-mnt_ex.patch | 4 +- ...erride-master_id-to-1-for-root-binds.patch | 4 +- ...d-helper-mnt_get_external_bind_nodev.patch | 4 +- ...-is_overmounted-as-early-as-possible.patch | 4 +- ...yard-tree-merge-as-early-as-possible.patch | 4 +- ...-mount-fix-broken-remounted_rw-check.patch | 4 +- ...al-place-for-shared-variables-on-mou.patch | 4 +- ...mountpoint-in-autofs_create_dentries.patch | 4 +- ...-ns_mountpoint-in-mnt_is_overmounted.patch | 4 +- ...yard-children-from-mnt_needs_remap-c.patch | 4 +- ...ntpoint-in-validate_children_collisi.patch | 4 +- ..._mountpoint-in-root_path_from_parent.patch | 4 +- ...ntpoint-for-children-overmount-check.patch | 4 +- ...t_get_sibling_path-via-get_relative_.patch | 4 +- ...use-ns_mountpoint-in-collect_mntinfo.patch | 4 +- ...ount-use-ns_mountpoint-in-aufs_parse.patch | 4 +- ...mount-use-ns_mountpoint-in-mnt_depth.patch | 4 +- ...ntpoint-instead-of-mountpoint-where-.patch | 4 +- ...ice_mountpoint-getter-for-mountpoint.patch | 4 +- ...create_ghost_dentry-out-of-create_gh.patch | 4 +- ...h-create_ghost-to-work-with-mount-v2.patch | 4 +- ...clean_one_remap-to-work-with-mount-v.patch | 4 +- ...or-MOVE_MOUNT_SET_GROUP-availability.patch | 4 +- ...=> 0203-compel-add-open_tree-syscall.patch | 4 +- ...ether-the-openat2-syscall-is-support.patch | 4 +- ...5-util-add-resolve_mountpoint-helper.patch | 4 +- ...ck_options-after-kerndat_init-and-lo.patch | 4 +- ...ew-option-mntns-compat-mode-for-old-.patch | 4 +- ... => 0208-mount-add-plain-mountpoints.patch | 4 +- ...ort-parent-dirs-helpers-for-mount-v2.patch | 4 +- ...ount-remove-double-ns_id-declaration.patch | 4 +- ...t-export-common-defines-for-mount-v2.patch | 4 +- ...xport-several-functions-for-mount-v2.patch | 4 +- ...export-global-variables-for-mount-v2.patch | 4 +- ... 0214-mount-add-new-mounts-v2-engine.patch | 4 +- ...ts-compat-mode-on-restore-with-mntns.patch | 4 +- ...16-ci-run-tests-for-old-mount-engine.patch | 4 +- ...ew-mnt_ext_sharing-test-for-mount-v2.patch | 4 +- ...-zdtm-add-mount_complex_sharing-test.patch | 4 +- ...tion-group-with-mount-flags-to-mount.patch | 4 +- ...tm-mount-v2-disable-mnt_tracefs-test.patch | 4 +- ...nt_ext_dev-also-run-for-old-mount-en.patch | 4 +- ...st-jenkins-test-for-old-mount-engine.patch | 4 +- ...tm-mount-v2-disable-pty-console-test.patch | 4 +- ...unt-engine-fallback-messages-logleve.patch | 4 +- ...-messages-differ-in-different-places.patch | 4 +- ...6-zdtm-use-unique-holder-for-cgroups.patch | 4 +- ...7-scripts-ci-mount-test-cgroups-once.patch | 4 +- ...add-a-helper-to-hold-a-pid-namespace.patch | 4 +- ...parmor-Fix-Wfortify-source-for-Clang.patch | 4 +- ...230-style-delete-some-redundant-code.patch | 4 +- ...unused-but-set-variable-for-Clang-15.patch | 4 +- ...syscall-into-compel-std-plugin-sysca.patch | 4 +- 0233-criu-generate-unique-socket-names.patch | 146 ----- ...rndat-check-for-rseq-syscall-support.patch | 4 +- 0234-ci-Ubuntu-broke-overlayfs-again.patch | 48 -- ...nd_ptrace_attach-helper-from-cr-chec.patch | 8 +- ...ck-Add-ptrace-rseq-conf-dump-feature.patch | 4 +- ...t.patch => 0236-rseq-initial-support.patch | 4 +- ...asic-static-rseq00-test-for-rseq-C-R.patch | 220 ++++++++ ...Revert-ci-disable-glibc-rseq-support.patch | 49 ++ ...-Fedora-Rawhide-based-test-on-Cirrus.patch | 98 ++++ ...lude-add-thread_pointer.h-from-Glibc.patch | 4 +- ...egister-rseq-at-the-thread-start-for.patch | 4 +- ...00-fix-rseq-test-when-linking-with-a.patch | 152 ++++++ ...lpers-to-get-set-instruction-pointer.patch | 8 +- ...-fixup-thread-IP-when-inside-rseq-cs.patch | 23 +- 0245-fixup.patch | 35 -- ...add-transition-rseq01-test-for-amd64.patch | 251 +++++++++ ...-test-disable-rseq-also-on-Archlinux.patch | 28 + ...0247-cr-dump-handle-rseq-flags-field.patch | 40 +- ...transition-test-with-NO_RESTART-CS-f.patch | 175 ++++++ 0249-zdtm-temporary-disable-rseq02-test.patch | 41 ++ criu.spec | 497 +++++++++--------- 254 files changed, 1783 insertions(+), 1025 deletions(-) delete mode 100644 0002-criu-files-Don-t-cache-fd-ids-for-device-files.patch rename 0003-tcp-Skip-restoring-TCP-state-when-dumping-with-tcp-c.patch => 0002-tcp-Skip-restoring-TCP-state-when-dumping-with-tcp-c.patch (91%) rename 0004-zdtm-Dumping-restoring-with-tcp-close-on-TCP_CLOSE-s.patch => 0003-zdtm-Dumping-restoring-with-tcp-close-on-TCP_CLOSE-s.patch (95%) rename 0005-criu-8-Add-more-detailed-description-about-tcp-close.patch => 0004-criu-8-Add-more-detailed-description-about-tcp-close.patch (89%) rename 0006-Add-support-for-python3-in-criu-coredump.patch => 0005-Add-support-for-python3-in-criu-coredump.patch (98%) rename 0007-Add-new-files-for-running-criu-coredump-via-python-2.patch => 0006-Add-new-files-for-running-criu-coredump-via-python-2.patch (94%) rename 0008-coredump-remove-unused-import.patch => 0007-coredump-remove-unused-import.patch (88%) rename 0009-coredump-sort-imports.patch => 0008-coredump-sort-imports.patch (85%) rename 0010-coredump-convert-indentation-to-spaces.patch => 0009-coredump-convert-indentation-to-spaces.patch (96%) rename 0011-python-replace-equality-with-identity-test.patch => 0010-python-replace-equality-with-identity-test.patch (96%) rename 0012-coredump-drop-unused-variable.patch => 0011-coredump-drop-unused-variable.patch (85%) rename 0013-coredump-drop-exec-permission.patch => 0012-coredump-drop-exec-permission.patch (80%) rename 0014-coredump-lint-fix-for-block-comments.patch => 0013-coredump-lint-fix-for-block-comments.patch (99%) rename 0015-coredump-fix-missing-whitespace-around-operator.patch => 0014-coredump-fix-missing-whitespace-around-operator.patch (86%) rename 0016-coredump-fix-too-many-blank-lines.patch => 0015-coredump-fix-too-many-blank-lines.patch (85%) rename 0017-coredump-fix-comparison-to-true.patch => 0016-coredump-fix-comparison-to-true.patch (88%) rename 0018-coredump-lint-fix-visually-indented-line.patch => 0017-coredump-lint-fix-visually-indented-line.patch (94%) rename 0019-test-coredump-fix-shellcheck-errors.patch => 0018-test-coredump-fix-shellcheck-errors.patch (90%) rename 0020-make-enable-lint-for-coredump.patch => 0019-make-enable-lint-for-coredump.patch (88%) rename 0021-ci-enable-coredump-tests.patch => 0020-ci-enable-coredump-tests.patch (90%) rename 0022-pie-restorer-remove-excess-hash-printf-specifier.patch => 0021-pie-restorer-remove-excess-hash-printf-specifier.patch (91%) rename 0023-tty-fix-the-null-pointer-of-get_tty_driver.patch => 0022-tty-fix-the-null-pointer-of-get_tty_driver.patch (87%) rename 0024-util-use-nftw-in-rmrf-helper.patch => 0023-util-use-nftw-in-rmrf-helper.patch (96%) rename 0025-criu-ns-make-pidns-init-first-do-setsid.patch => 0024-criu-ns-make-pidns-init-first-do-setsid.patch (88%) rename 0026-net-optimize-restore_rule-to-not-open-the-CR_FD_RULE.patch => 0025-net-optimize-restore_rule-to-not-open-the-CR_FD_RULE.patch (95%) rename 0027-ci-replace-deprecated-codecov-bash-uploader.patch => 0026-ci-replace-deprecated-codecov-bash-uploader.patch (91%) rename 0028-ci-fix-userfaultfd-test-failures.patch => 0027-ci-fix-userfaultfd-test-failures.patch (90%) rename 0029-ci-use-Fedora-34-for-lint-CI-runs.patch => 0028-ci-use-Fedora-34-for-lint-CI-runs.patch (87%) rename 0030-tests-improve-the-image-streamer-process-control.patch => 0029-tests-improve-the-image-streamer-process-control.patch (97%) rename 0031-sockets-don-t-call-sk_setbufs-asyncronously.patch => 0030-sockets-don-t-call-sk_setbufs-asyncronously.patch (90%) rename 0032-kerndat-check-for-set-getsockopt-SO_BUF_LOCK-availab.patch => 0031-kerndat-check-for-set-getsockopt-SO_BUF_LOCK-availab.patch (96%) rename 0033-sockets-c-r-bufer-size-locks.patch => 0032-sockets-c-r-bufer-size-locks.patch (95%) rename 0034-zdtm-add-test-for-socket-buffer-size-locks.patch => 0033-zdtm-add-test-for-socket-buffer-size-locks.patch (95%) rename 0035-zdtm-make-sock_opts02-also-check-lock-change-by-SO_-.patch => 0034-zdtm-make-sock_opts02-also-check-lock-change-by-SO_-.patch (95%) rename 0036-clang-format-enable-AlignTrailingComments.patch => 0035-clang-format-enable-AlignTrailingComments.patch (98%) rename 0037-clang-format-do-several-manual-comment-fixups.patch => 0036-clang-format-do-several-manual-comment-fixups.patch (97%) rename 0038-clang-format-do-automatic-comment-fixups.patch => 0037-clang-format-do-automatic-comment-fixups.patch (99%) rename 0039-cr-dump-fail-dumping-when-zombie-process-with-sid-0.patch => 0038-cr-dump-fail-dumping-when-zombie-process-with-sid-0.patch (87%) rename 0040-clang-format-make-x86_ins_capability_mask-human-read.patch => 0039-clang-format-make-x86_ins_capability_mask-human-read.patch (98%) rename 0041-ci-disable-socket-raw-test-on-centos8.patch => 0040-ci-disable-socket-raw-test-on-centos8.patch (91%) rename 0042-zdtm.py-make-tests-with-link_remap-exclusive.patch => 0041-zdtm.py-make-tests-with-link_remap-exclusive.patch (94%) rename 0043-tests-improve-the-deterministic-behavior-of-the-test.patch => 0042-tests-improve-the-deterministic-behavior-of-the-test.patch (96%) rename 0044-clang-format-zdtm-fix-clang-complains-about-strange-.patch => 0043-clang-format-zdtm-fix-clang-complains-about-strange-.patch (95%) rename 0045-seize-restore-cgroup-freezer-to-right-state.patch => 0044-seize-restore-cgroup-freezer-to-right-state.patch (94%) rename 0046-ci-Use-latest-Fedora-for-lint-ci-runs-again.patch => 0045-ci-Use-latest-Fedora-for-lint-ci-runs-again.patch (88%) rename 0047-crtools-ignore-SIGPIPE-in-swrk-mode.patch => 0046-crtools-ignore-SIGPIPE-in-swrk-mode.patch (94%) rename 0048-ci-switch-to-centos-stream-8.patch => 0047-ci-switch-to-centos-stream-8.patch (84%) rename 0049-check-cleanup-child-processes.patch => 0048-check-cleanup-child-processes.patch (93%) rename 0050-files-reg-fix-error-handling-in-open_path.patch => 0049-files-reg-fix-error-handling-in-open_path.patch (97%) rename 0051-files-reg-fix-error-handling-of-rm_parent_dirs.patch => 0050-files-reg-fix-error-handling-of-rm_parent_dirs.patch (95%) rename 0052-ghost-mount-allocate-remounted_rw-in-shmem-to-get-in.patch => 0051-ghost-mount-allocate-remounted_rw-in-shmem-to-get-in.patch (97%) rename 0053-files-reg-temporary-remount-writable-the-mount-we-do.patch => 0052-files-reg-temporary-remount-writable-the-mount-we-do.patch (90%) rename 0054-zdtm-add-ro-mount-check-after-c-r-to-mntns_ghost01.patch => 0053-zdtm-add-ro-mount-check-after-c-r-to-mntns_ghost01.patch (91%) rename 0055-clang-format-disable-wrong-struct-pointer-declaratio.patch => 0054-clang-format-disable-wrong-struct-pointer-declaratio.patch (95%) rename 0056-ci-Run-cross-compile-on-debian-stable.patch => 0055-ci-Run-cross-compile-on-debian-stable.patch (98%) rename 0057-ci-Run-cross-compile-with-debian-testing.patch => 0056-ci-Run-cross-compile-with-debian-testing.patch (98%) rename 0058-make-Explicitly-enable-FPU-on-ARMv7-builds.patch => 0057-make-Explicitly-enable-FPU-on-ARMv7-builds.patch (92%) rename 0059-ci-disable-broken-tests-until-fixed.patch => 0058-ci-disable-broken-tests-until-fixed.patch (95%) rename 0060-test-do-not-use-keep-going-for-single-zdtm-tests.patch => 0059-test-do-not-use-keep-going-for-single-zdtm-tests.patch (97%) rename 0061-files-reg-try-dump_ghost_remap-if-link-remap-failed-.patch => 0060-files-reg-try-dump_ghost_remap-if-link-remap-failed-.patch (97%) rename 0062-util-make-page-server-IPv6-safe.patch => 0061-util-make-page-server-IPv6-safe.patch (93%) rename 0063-sk-unix-Fix-TCP_ESTABLISHED-checks-in-unix-sockets.patch => 0062-sk-unix-Fix-TCP_ESTABLISHED-checks-in-unix-sockets.patch (92%) rename 0064-ci-Enable-disabled-unix-socket-related-tests.patch => 0063-ci-Enable-disabled-unix-socket-related-tests.patch (92%) rename 0065-ci-install-procps-in-Alpine.patch => 0064-ci-install-procps-in-Alpine.patch (85%) rename 0066-test-another-try-to-correctly-fix-the-kernel-version.patch => 0065-test-another-try-to-correctly-fix-the-kernel-version.patch (88%) rename 0067-x86-compel-fault-inject-bound-xsave-features-set.patch => 0066-x86-compel-fault-inject-bound-xsave-features-set.patch (95%) rename 0068-x86-compel-fault-inject-print-the-initial-seed.patch => 0067-x86-compel-fault-inject-print-the-initial-seed.patch (91%) rename 0069-ci-enable-x86-xsave-fault-injection-tests-back.patch => 0068-ci-enable-x86-xsave-fault-injection-tests-back.patch (90%) rename 0070-Add-documentation-for-timeout-option.patch => 0069-Add-documentation-for-timeout-option.patch (93%) rename 0071-usernsd-UNS_FDOUT-should-not-require-an-input-descri.patch => 0070-usernsd-UNS_FDOUT-should-not-require-an-input-descri.patch (86%) rename 0072-libcriu-add-setting-lsm-mount-context-to-libcriu.patch => 0071-libcriu-add-setting-lsm-mount-context-to-libcriu.patch (94%) rename 0073-ci-use-unstable-release-for-cross-compile.patch => 0072-ci-use-unstable-release-for-cross-compile.patch (98%) rename 0074-ci-disable-glibc-rseq-support.patch => 0073-ci-disable-glibc-rseq-support.patch (94%) rename 0075-libcriu-add-single-pre-dump-support.patch => 0074-libcriu-add-single-pre-dump-support.patch (97%) rename 0076-tests-added-test-for-single-pre-dump-support.patch => 0075-tests-added-test-for-single-pre-dump-support.patch (97%) rename 0077-zdtm.py-clean-up-MAKEFLAGS-env-variable-before-runni.patch => 0076-zdtm.py-clean-up-MAKEFLAGS-env-variable-before-runni.patch (93%) rename 0078-zdtm-zdtm_ct-fix-compilation-error-with-strict-proto.patch => 0077-zdtm-zdtm_ct-fix-compilation-error-with-strict-proto.patch (86%) rename 0079-zdtm-remove-mntns-deleted-dst-test-leftover-from-git.patch => 0078-zdtm-remove-mntns-deleted-dst-test-leftover-from-git.patch (82%) rename 0080-crtools-remove-excess-always-true-condition.patch => 0079-crtools-remove-excess-always-true-condition.patch (85%) rename 0081-crtools-rpc-export-current-criu-mode-to-opts.mode.patch => 0080-crtools-rpc-export-current-criu-mode-to-opts.mode.patch (98%) rename 0082-crtools-use-new-opts.mode-in-image_dir_mode.patch => 0081-crtools-use-new-opts.mode-in-image_dir_mode.patch (90%) rename 0083-crtools-check-that-cpuinfo-command-has-sub-command.patch => 0082-crtools-check-that-cpuinfo-command-has-sub-command.patch (86%) rename 0084-sk-unix-Add-support-for-SOCK_SEQPACKET-unix-sockets.patch => 0083-sk-unix-Add-support-for-SOCK_SEQPACKET-unix-sockets.patch (93%) rename 0085-zdtm-Add-SOCK_SEQPACKET-variants-to-unix-socket-test.patch => 0084-zdtm-Add-SOCK_SEQPACKET-variants-to-unix-socket-test.patch (99%) rename 0086-tls-fix-typo.patch => 0085-tls-fix-typo.patch (85%) rename 0087-tls-use-ssize_t-for-return-value.patch => 0086-tls-use-ssize_t-for-return-value.patch (93%) rename 0088-tls-add-more-comments.patch => 0087-tls-add-more-comments.patch (96%) rename 0089-uffd-call-disconnect_from_page_server-to-shutdown-a-.patch => 0088-uffd-call-disconnect_from_page_server-to-shutdown-a-.patch (84%) rename 0090-tls-allow-to-terminate-connections-synchronously.patch => 0089-tls-allow-to-terminate-connections-synchronously.patch (95%) rename 0091-page-xfer-stop-waiting-for-a-new-command-after-a-clo.patch => 0090-page-xfer-stop-waiting-for-a-new-command-after-a-clo.patch (92%) rename 0092-ci-reenable-the-lazy-thp-test-in-the-lazy-remote-mod.patch => 0091-ci-reenable-the-lazy-thp-test-in-the-lazy-remote-mod.patch (88%) rename 0093-test-log-testname.out.inprogress-if-a-test-has-faile.patch => 0092-test-log-testname.out.inprogress-if-a-test-has-faile.patch (89%) rename 0094-zdtm-print-tails-of-all-logs-if-a-test-has-failed.patch => 0093-zdtm-print-tails-of-all-logs-if-a-test-has-failed.patch (92%) rename 0095-zdtm-static-uffd-events-add-more-log-messages.patch => 0094-zdtm-static-uffd-events-add-more-log-messages.patch (90%) rename 0096-mount-split-check_mountpoint_fd-from-__open_mountpoi.patch => 0095-mount-split-check_mountpoint_fd-from-__open_mountpoi.patch (96%) rename 0097-mount-remove-mnt_fd-argument-of-__open_mountpoint.patch => 0096-mount-remove-mnt_fd-argument-of-__open_mountpoint.patch (96%) rename 0098-proc_parse-add-helper-to-resolve-sdev-from-fd.patch => 0097-proc_parse-add-helper-to-resolve-sdev-from-fd.patch (95%) rename 0099-mount-btrfs-make-check_mountpoint_fd-fallback-to-get.patch => 0098-mount-btrfs-make-check_mountpoint_fd-fallback-to-get.patch (97%) rename 0100-ci-test-criu-image-streamer-with-all-tests.patch => 0099-ci-test-criu-image-streamer-with-all-tests.patch (88%) rename 0101-readme-add-docker-test-badge.patch => 0100-readme-add-docker-test-badge.patch (89%) rename 0102-contributing-remove-old-badges-and-logo.patch => 0101-contributing-remove-old-badges-and-logo.patch (90%) rename 0103-ci-update-to-latest-Vagrant-and-Fedora-images.patch => 0102-ci-update-to-latest-Vagrant-and-Fedora-images.patch (87%) rename 0104-ci-added-.lgtm.yml-file.patch => 0103-ci-added-.lgtm.yml-file.patch (92%) rename 0105-lib-introduce-feature-check-in-libcriu.patch => 0104-lib-introduce-feature-check-in-libcriu.patch (97%) rename 0106-lib-added-tests-for-feature-check-in-libcriu.patch => 0105-lib-added-tests-for-feature-check-in-libcriu.patch (96%) rename 0107-pagemap-tiny-fix-on-truncating-memory-image.patch => 0106-pagemap-tiny-fix-on-truncating-memory-image.patch (93%) rename 0108-zdtm-fix-zdtm-static-maps00-case-in-arm64.patch => 0107-zdtm-fix-zdtm-static-maps00-case-in-arm64.patch (91%) rename 0109-compel-fix-GCC-12-failure-out-of-bounds.patch => 0108-compel-fix-GCC-12-failure-out-of-bounds.patch (95%) rename 0110-criu-fix-configuration-file-scanner-with-GCC-12.patch => 0109-criu-fix-configuration-file-scanner-with-GCC-12.patch (90%) rename 0111-compel-fix-parasite-with-GCC-12.patch => 0110-compel-fix-parasite-with-GCC-12.patch (91%) rename 0112-ci-set-continue-on-error-for-cross-compile.patch => 0111-ci-set-continue-on-error-for-cross-compile.patch (91%) rename 0113-test-autofs-fix-use-after-free.patch => 0112-test-autofs-fix-use-after-free.patch (94%) rename 0114-Fix-formatting-in-criu-documentation.patch => 0113-Fix-formatting-in-criu-documentation.patch (91%) rename 0115-ci-install-libbsd-dependency.patch => 0114-ci-install-libbsd-dependency.patch (97%) rename 0116-pstree-when-updating-sid-for-shell-job-also-update-m.patch => 0115-pstree-when-updating-sid-for-shell-job-also-update-m.patch (86%) rename 0117-criu-ns-fix-exit-code-o-for-criu-dump.patch => 0116-criu-ns-fix-exit-code-o-for-criu-dump.patch (83%) rename 0118-criu-ns-use-os.waitstatus_to_exitcode.patch => 0117-criu-ns-use-os.waitstatus_to_exitcode.patch (88%) rename 0119-restorer-Fix-sys_mmap-s-returned-value-check.patch => 0118-restorer-Fix-sys_mmap-s-returned-value-check.patch (87%) rename 0120-compel-fix-how-PTRACE_GET_THREAD_AREA-errors-are-han.patch => 0119-compel-fix-how-PTRACE_GET_THREAD_AREA-errors-are-han.patch (92%) rename 0121-util-add-an-unique-ID-of-the-current-criu-run.patch => 0120-util-add-an-unique-ID-of-the-current-criu-run.patch (93%) rename 0122-files-generate-unique-transport-socket-names.patch => 0121-files-generate-unique-transport-socket-names.patch (86%) rename 0123-check-Add-a-check-for-using-memfd-with-hugetlb.patch => 0122-check-Add-a-check-for-using-memfd-with-hugetlb.patch (95%) rename 0124-kerndat-Collect-hugetlb-device-numbers.patch => 0123-kerndat-Collect-hugetlb-device-numbers.patch (98%) rename 0125-ipc-Add-support-for-checkpoint-restore-hugetlb-Syste.patch => 0124-ipc-Add-support-for-checkpoint-restore-hugetlb-Syste.patch (96%) rename 0126-memfd-shmem-Add-support-for-checkpoint-restore-memfd.patch => 0125-memfd-shmem-Add-support-for-checkpoint-restore-memfd.patch (96%) rename 0127-proc_parse-files-Add-support-for-hugetlb-memory-mapp.patch => 0126-proc_parse-files-Add-support-for-hugetlb-memory-mapp.patch (97%) rename 0128-mem-Skip-premapping-hugetlb-mapping.patch => 0127-mem-Skip-premapping-hugetlb-mapping.patch (90%) rename 0129-uffd-Skip-lazy-mode-restore-on-hugetlb-mappings.patch => 0128-uffd-Skip-lazy-mode-restore-on-hugetlb-mappings.patch (89%) rename 0130-zdtm-Add-MAP_HUGETLB-memory-mapping-test.patch => 0129-zdtm-Add-MAP_HUGETLB-memory-mapping-test.patch (97%) rename 0131-zdtm-Add-memfd-hugetlb-test.patch => 0130-zdtm-Add-memfd-hugetlb-test.patch (97%) rename 0132-zdtm-Add-shm-hugetlb-test.patch => 0131-zdtm-Add-shm-hugetlb-test.patch (96%) rename 0133-zdtm-Add-MAP_HUGETLB-mappings-test-for-parent-child-.patch => 0132-zdtm-Add-MAP_HUGETLB-mappings-test-for-parent-child-.patch (96%) rename 0134-ci-skip-MAP_HUGETLB-tests-in-stream-test.patch => 0133-ci-skip-MAP_HUGETLB-tests-in-stream-test.patch (92%) rename 0135-bpfmap-handle-new-field-in-fdinfo.patch => 0134-bpfmap-handle-new-field-in-fdinfo.patch (97%) rename 0136-test-remove-test-for-LOCK_MAND-flock.patch => 0135-test-remove-test-for-LOCK_MAND-flock.patch (90%) rename 0137-test-disable-rseq-also-on-Archlinux.patch => 0136-test-disable-rseq-also-on-Archlinux.patch (85%) rename 0138-zdtm-fix-missplacement-of-err-True.patch => 0137-zdtm-fix-missplacement-of-err-True.patch (89%) rename 0139-compel-set-mxcsr-during-error-injection-to-zero.patch => 0138-compel-set-mxcsr-during-error-injection-to-zero.patch (91%) rename 0140-proc_smaps-remove-useless-nonlinear-check.patch => 0139-proc_smaps-remove-useless-nonlinear-check.patch (89%) rename 0141-mount-fix-e_str-leak-in-ext_mount_add.patch => 0140-mount-fix-e_str-leak-in-ext_mount_add.patch (92%) rename 0142-cr-dump-fix-cr_imgset-leak-in-dump_one_task.patch => 0141-cr-dump-fix-cr_imgset-leak-in-dump_one_task.patch (96%) rename 0143-tun-fix-tun_link-leak-in-dump_tun_link.patch => 0142-tun-fix-tun_link-leak-in-dump_tun_link.patch (94%) rename 0144-sk-unix-fix-uint32_t-id-variable-printf-format-speci.patch => 0143-sk-unix-fix-uint32_t-id-variable-printf-format-speci.patch (90%) rename 0145-zdtm-refactor-main.patch => 0144-zdtm-refactor-main.patch (99%) rename 0146-zdtm-sort-import-lines.patch => 0145-zdtm-sort-import-lines.patch (93%) rename 0147-zdtm-use-long-form-cli-options.patch => 0146-zdtm-use-long-form-cli-options.patch (95%) rename 0148-zdtm-add-criu-config-option.patch => 0147-zdtm-add-criu-config-option.patch (97%) rename 0149-zdtm-drop-redundant-config_inotify_irmap-test.patch => 0148-zdtm-drop-redundant-config_inotify_irmap-test.patch (97%) rename 0150-ci-run-criu-config-tests.patch => 0149-ci-run-criu-config-tests.patch (92%) rename 0151-config-fix-ns-leak-in-parse_join_ns.patch => 0150-config-fix-ns-leak-in-parse_join_ns.patch (92%) rename 0152-net-fix-e_str-leak-in-veth_pair_add.patch => 0151-net-fix-e_str-leak-in-veth_pair_add.patch (93%) rename 0153-files-fix-inh-leak-in-inherit_fd_add.patch => 0152-files-fix-inh-leak-in-inherit_fd_add.patch (92%) rename 0154-sk-unix-fix-e_str-leak-in-unix_sk_id_add.patch => 0153-sk-unix-fix-e_str-leak-in-unix_sk_id_add.patch (92%) rename 0155-uffd-fix-__u64-print-format-specifier.patch => 0154-uffd-fix-__u64-print-format-specifier.patch (90%) rename 0156-zdtm-fix-mnt_ext_master-test-to-correspond-to-it-s-n.patch => 0155-zdtm-fix-mnt_ext_master-test-to-correspond-to-it-s-n.patch (93%) rename 0157-mount-add-mntinfo_add_list_before-helper-for-adding-.patch => 0156-mount-add-mntinfo_add_list_before-helper-for-adding-.patch (95%) rename 0158-mount-do-not-detect-non-fsroot-mounts-as-device-exte.patch => 0157-mount-do-not-detect-non-fsroot-mounts-as-device-exte.patch (92%) rename 0159-mount-mark-mounts-of-external-devices-external.patch => 0158-mount-mark-mounts-of-external-devices-external.patch (97%) rename 0160-mount-skip-fstype-and-source-checks-for-external-mou.patch => 0159-mount-skip-fstype-and-source-checks-for-external-mou.patch (95%) rename 0161-mount-setup-mnt_bind-list-before-using-it-in-mnt_is_.patch => 0160-mount-setup-mnt_bind-list-before-using-it-in-mnt_is_.patch (97%) rename 0162-util-add-get_relative_path-helper.patch => 0161-util-add-get_relative_path-helper.patch (97%) rename 0163-unittest-add-some-tests-for-get_relative_path-helper.patch => 0162-unittest-add-some-tests-for-get_relative_path-helper.patch (96%) rename 0164-mount-add-mnt_bind_pick-helper-to-pick-the-desired-b.patch => 0163-mount-add-mnt_bind_pick-helper-to-pick-the-desired-b.patch (93%) rename 0165-mount-split-mnt_is_external-_bind-and-can_receive_ma.patch => 0164-mount-split-mnt_is_external-_bind-and-can_receive_ma.patch (97%) rename 0166-mount-rework-skipping-external-mounts-in-dump_one_mo.patch => 0165-mount-rework-skipping-external-mounts-in-dump_one_mo.patch (91%) rename 0167-mount-show-more-info-about-why-we-can-t-mount.patch => 0166-mount-show-more-info-about-why-we-can-t-mount.patch (96%) rename 0168-mount-mount-external-mount-before-mounting-it-s-bind.patch => 0167-mount-mount-external-mount-before-mounting-it-s-bind.patch (96%) rename 0169-zdtm-add-new-mnt_ext_root-test.patch => 0168-zdtm-add-new-mnt_ext_root-test.patch (97%) rename 0170-mount-restrict-mp-external-mount-map-to-init-contain.patch => 0169-mount-restrict-mp-external-mount-map-to-init-contain.patch (94%) rename 0171-zdtm-add-mnt_ext_collision-test.patch => 0170-zdtm-add-mnt_ext_collision-test.patch (98%) rename 0172-mount-add-mnt_is_root_bind-helper.patch => 0171-mount-add-mnt_is_root_bind-helper.patch (96%) rename 0173-mount-allow-nested-mount-namespaces-with-different-r.patch => 0172-mount-allow-nested-mount-namespaces-with-different-r.patch (92%) rename 0174-zdtm-add-mntns_pivot_root-test.patch => 0173-zdtm-add-mntns_pivot_root-test.patch (97%) rename 0175-mount-apply-superblock-flags-to-nested-ns-roots.patch => 0174-mount-apply-superblock-flags-to-nested-ns-roots.patch (88%) rename 0176-zdtm-add-mntns_pivot_root_ro-test.patch => 0175-zdtm-add-mntns_pivot_root_ro-test.patch (96%) rename 0177-mount-restore-create-auxiliary-binfmt_misc-mount-in-.patch => 0176-mount-restore-create-auxiliary-binfmt_misc-mount-in-.patch (97%) rename 0178-mount-restore-leave-ns_mountpoint-NULL-for-aux-binfm.patch => 0177-mount-restore-leave-ns_mountpoint-NULL-for-aux-binfm.patch (88%) rename 0179-mount-replace-CRTIME_MNT_ID-with-HELPER_MNT_ID.patch => 0178-mount-replace-CRTIME_MNT_ID-with-HELPER_MNT_ID.patch (94%) rename 0180-mount-add-can_receive_master_from_root-helper.patch => 0179-mount-add-can_receive_master_from_root-helper.patch (94%) rename 0181-mount-put-external-slavery-mounts-to-separate-mnt_ex.patch => 0180-mount-put-external-slavery-mounts-to-separate-mnt_ex.patch (95%) rename 0182-mount-do-not-override-master_id-to-1-for-root-binds.patch => 0181-mount-do-not-override-master_id-to-1-for-root-binds.patch (96%) rename 0183-mount-add-helper-mnt_get_external_bind_nodev.patch => 0182-mount-add-helper-mnt_get_external_bind_nodev.patch (93%) rename 0184-mount-prepare-is_overmounted-as-early-as-possible.patch => 0183-mount-prepare-is_overmounted-as-early-as-possible.patch (96%) rename 0185-mount-move-root-yard-tree-merge-as-early-as-possible.patch => 0184-mount-move-root-yard-tree-merge-as-early-as-possible.patch (95%) rename 0186-mount-fix-broken-remounted_rw-check.patch => 0185-mount-fix-broken-remounted_rw-check.patch (88%) rename 0187-mount-make-general-place-for-shared-variables-on-mou.patch => 0186-mount-make-general-place-for-shared-variables-on-mou.patch (95%) rename 0188-autofs-use-ns_mountpoint-in-autofs_create_dentries.patch => 0187-autofs-use-ns_mountpoint-in-autofs_create_dentries.patch (93%) rename 0189-mount-use-ns_mountpoint-in-mnt_is_overmounted.patch => 0188-mount-use-ns_mountpoint-in-mnt_is_overmounted.patch (91%) rename 0190-mount-skip-root-yard-children-from-mnt_needs_remap-c.patch => 0189-mount-skip-root-yard-children-from-mnt_needs_remap-c.patch (91%) rename 0191-mount-use-ns_mountpoint-in-validate_children_collisi.patch => 0190-mount-use-ns_mountpoint-in-validate_children_collisi.patch (91%) rename 0192-mount-use-ns_mountpoint-in-root_path_from_parent.patch => 0191-mount-use-ns_mountpoint-in-root_path_from_parent.patch (92%) rename 0193-mount-use-ns_mountpoint-for-children-overmount-check.patch => 0192-mount-use-ns_mountpoint-for-children-overmount-check.patch (89%) rename 0194-path-simplify-mnt_get_sibling_path-via-get_relative_.patch => 0193-path-simplify-mnt_get_sibling_path-via-get_relative_.patch (97%) rename 0195-mount-use-ns_mountpoint-in-collect_mntinfo.patch => 0194-mount-use-ns_mountpoint-in-collect_mntinfo.patch (92%) rename 0196-mount-use-ns_mountpoint-in-aufs_parse.patch => 0195-mount-use-ns_mountpoint-in-aufs_parse.patch (85%) rename 0197-mount-use-ns_mountpoint-in-mnt_depth.patch => 0196-mount-use-ns_mountpoint-in-mnt_depth.patch (86%) rename 0198-mount-use-ns_mountpoint-instead-of-mountpoint-where-.patch => 0197-mount-use-ns_mountpoint-instead-of-mountpoint-where-.patch (99%) rename 0199-mount-add-service_mountpoint-getter-for-mountpoint.patch => 0198-mount-add-service_mountpoint-getter-for-mountpoint.patch (99%) rename 0200-files-reg-split-create_ghost_dentry-out-of-create_gh.patch => 0199-files-reg-split-create_ghost_dentry-out-of-create_gh.patch (96%) rename 0201-files-reg-teach-create_ghost-to-work-with-mount-v2.patch => 0200-files-reg-teach-create_ghost-to-work-with-mount-v2.patch (96%) rename 0202-files-reg-teach-clean_one_remap-to-work-with-mount-v.patch => 0201-files-reg-teach-clean_one_remap-to-work-with-mount-v.patch (95%) rename 0203-kerndat-Check-for-MOVE_MOUNT_SET_GROUP-availability.patch => 0202-kerndat-Check-for-MOVE_MOUNT_SET_GROUP-availability.patch (98%) rename 0204-compel-add-open_tree-syscall.patch => 0203-compel-add-open_tree-syscall.patch (98%) rename 0205-kerndat-check-whether-the-openat2-syscall-is-support.patch => 0204-kerndat-check-whether-the-openat2-syscall-is-support.patch (98%) rename 0206-util-add-resolve_mountpoint-helper.patch => 0205-util-add-resolve_mountpoint-helper.patch (96%) rename 0207-crtools-move-check_options-after-kerndat_init-and-lo.patch => 0206-crtools-move-check_options-after-kerndat_init-and-lo.patch (87%) rename 0208-config-rpc-add-new-option-mntns-compat-mode-for-old-.patch => 0207-config-rpc-add-new-option-mntns-compat-mode-for-old-.patch (98%) rename 0209-mount-add-plain-mountpoints.patch => 0208-mount-add-plain-mountpoints.patch (97%) rename 0210-files-reg-export-parent-dirs-helpers-for-mount-v2.patch => 0209-files-reg-export-parent-dirs-helpers-for-mount-v2.patch (91%) rename 0211-mount-remove-double-ns_id-declaration.patch => 0210-mount-remove-double-ns_id-declaration.patch (86%) rename 0212-mount-export-common-defines-for-mount-v2.patch => 0211-mount-export-common-defines-for-mount-v2.patch (94%) rename 0213-mount-export-several-functions-for-mount-v2.patch => 0212-mount-export-several-functions-for-mount-v2.patch (97%) rename 0214-mount-export-global-variables-for-mount-v2.patch => 0213-mount-export-global-variables-for-mount-v2.patch (91%) rename 0215-mount-add-new-mounts-v2-engine.patch => 0214-mount-add-new-mounts-v2-engine.patch (99%) rename 0216-zdtm-enable-mounts-compat-mode-on-restore-with-mntns.patch => 0215-zdtm-enable-mounts-compat-mode-on-restore-with-mntns.patch (95%) rename 0217-ci-run-tests-for-old-mount-engine.patch => 0216-ci-run-tests-for-old-mount-engine.patch (89%) rename 0218-zdtm-add-new-mnt_ext_sharing-test-for-mount-v2.patch => 0217-zdtm-add-new-mnt_ext_sharing-test-for-mount-v2.patch (98%) rename 0219-zdtm-add-mount_complex_sharing-test.patch => 0218-zdtm-add-mount_complex_sharing-test.patch (98%) rename 0220-zdtm-add-propagation-group-with-mount-flags-to-mount.patch => 0219-zdtm-add-propagation-group-with-mount-flags-to-mount.patch (96%) rename 0221-zdtm-mount-v2-disable-mnt_tracefs-test.patch => 0220-zdtm-mount-v2-disable-mnt_tracefs-test.patch (90%) rename 0222-ci-make-others-mnt_ext_dev-also-run-for-old-mount-en.patch => 0221-ci-make-others-mnt_ext_dev-also-run-for-old-mount-en.patch (91%) rename 0223-test-jenkins-test-for-old-mount-engine.patch => 0222-test-jenkins-test-for-old-mount-engine.patch (88%) rename 0224-zdtm-mount-v2-disable-pty-console-test.patch => 0223-zdtm-mount-v2-disable-pty-console-test.patch (95%) rename 0225-mount-v2-make-mount-engine-fallback-messages-logleve.patch => 0224-mount-v2-make-mount-engine-fallback-messages-logleve.patch (92%) rename 0226-mount-make-error-messages-differ-in-different-places.patch => 0225-mount-make-error-messages-differ-in-different-places.patch (89%) rename 0227-zdtm-use-unique-holder-for-cgroups.patch => 0226-zdtm-use-unique-holder-for-cgroups.patch (95%) rename 0228-scripts-ci-mount-test-cgroups-once.patch => 0227-scripts-ci-mount-test-cgroups-once.patch (87%) rename 0229-criu-ns-add-a-helper-to-hold-a-pid-namespace.patch => 0228-criu-ns-add-a-helper-to-hold-a-pid-namespace.patch (93%) rename 0230-apparmor-Fix-Wfortify-source-for-Clang.patch => 0229-apparmor-Fix-Wfortify-source-for-Clang.patch (87%) rename 0231-style-delete-some-redundant-code.patch => 0230-style-delete-some-redundant-code.patch (89%) rename 0232-mount-fix-Wunused-but-set-variable-for-Clang-15.patch => 0231-mount-fix-Wunused-but-set-variable-for-Clang-15.patch (85%) rename 0235-compel-add-rseq-syscall-into-compel-std-plugin-sysca.patch => 0232-compel-add-rseq-syscall-into-compel-std-plugin-sysca.patch (97%) delete mode 100644 0233-criu-generate-unique-socket-names.patch rename 0236-kerndat-check-for-rseq-syscall-support.patch => 0233-kerndat-check-for-rseq-syscall-support.patch (92%) delete mode 100644 0234-ci-Ubuntu-broke-overlayfs-again.patch rename 0237-util-move-fork_and_ptrace_attach-helper-from-cr-chec.patch => 0234-util-move-fork_and_ptrace_attach-helper-from-cr-chec.patch (94%) rename 0238-cr-check-Add-ptrace-rseq-conf-dump-feature.patch => 0235-cr-check-Add-ptrace-rseq-conf-dump-feature.patch (97%) rename 0239-rseq-initial-support.patch => 0236-rseq-initial-support.patch (99%) create mode 100644 0237-zdtm-add-basic-static-rseq00-test-for-rseq-C-R.patch create mode 100644 0238-Revert-ci-disable-glibc-rseq-support.patch create mode 100644 0239-ci-add-Fedora-Rawhide-based-test-on-Cirrus.patch create mode 100644 0242-zdtm-static-rseq00-fix-rseq-test-when-linking-with-a.patch rename 0242-compel-add-helpers-to-get-set-instruction-pointer.patch => 0243-compel-add-helpers-to-get-set-instruction-pointer.patch (97%) rename 0243-cr-dump-fixup-thread-IP-when-inside-rseq-cs.patch => 0244-cr-dump-fixup-thread-IP-when-inside-rseq-cs.patch (91%) delete mode 100644 0245-fixup.patch create mode 100644 0245-zdtm-add-transition-rseq01-test-for-amd64.patch create mode 100644 0246-Revert-test-disable-rseq-also-on-Archlinux.patch rename 0244-cr-dump-handle-rseq-flags-field.patch => 0247-cr-dump-handle-rseq-flags-field.patch (90%) create mode 100644 0248-zdtm-add-rseq02-transition-test-with-NO_RESTART-CS-f.patch create mode 100644 0249-zdtm-temporary-disable-rseq02-test.patch diff --git a/0001-criu-8-add-external-net-option.patch b/0001-criu-8-add-external-net-option.patch index 06c8ed8..19264ed 100644 --- a/0001-criu-8-add-external-net-option.patch +++ b/0001-criu-8-add-external-net-option.patch @@ -1,7 +1,7 @@ -From 8017afbbd530d11b54e8e54ac1bc6a47f9c20ba7 Mon Sep 17 00:00:00 2001 +From 0bb7f1fc1ced67396866a913d39bc61a3bedbed5 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Mon, 20 Sep 2021 13:50:08 +0100 -Subject: [PATCH 001/245] criu(8): add --external net option +Subject: [PATCH 001/249] criu(8): add --external net option Support for external net namespaces has been introduced with commit c2b21fbf (criu: add support for external net namespaces). diff --git a/0002-criu-files-Don-t-cache-fd-ids-for-device-files.patch b/0002-criu-files-Don-t-cache-fd-ids-for-device-files.patch deleted file mode 100644 index 8ff9ebe..0000000 --- a/0002-criu-files-Don-t-cache-fd-ids-for-device-files.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 9036f17569638f038edfb6c30454e2fbe3707d69 Mon Sep 17 00:00:00 2001 -From: Rajneesh Bhardwaj -Date: Tue, 27 Apr 2021 19:08:57 -0400 -Subject: [PATCH 002/245] criu/files: Don't cache fd ids for device files - -Restore operation fails when we perform CR operation of multiple -independent proceses that have device files because criu caches -the ids for the device files with same mnt_ids, inode pair. This -change ensures that even in case of a cached id found for a device, a -unique subid is generated and returned which is used for dumping. - -Suggested-by: Andrei Vagin -Signed-off-by: Rajneesh Bhardwaj ---- - criu/file-ids.c | 10 ++++++++-- - 1 file changed, 8 insertions(+), 2 deletions(-) - -diff --git a/criu/file-ids.c b/criu/file-ids.c -index 1b9d68888..772bd92cf 100644 ---- a/criu/file-ids.c -+++ b/criu/file-ids.c -@@ -77,8 +77,14 @@ int fd_id_generate_special(struct fd_parms *p, u32 *id) - - fi = fd_id_cache_lookup(p); - if (fi) { -- *id = fi->id; -- return 0; -+ if (p->stat.st_mode & (S_IFCHR | S_IFBLK)) { -+ /* Don't cache the id for mapped devices */ -+ *id = fd_tree.subid++; -+ return 1; -+ } else { -+ *id = fi->id; -+ return 0; -+ } - } - } - --- -2.35.1 - diff --git a/0003-tcp-Skip-restoring-TCP-state-when-dumping-with-tcp-c.patch b/0002-tcp-Skip-restoring-TCP-state-when-dumping-with-tcp-c.patch similarity index 91% rename from 0003-tcp-Skip-restoring-TCP-state-when-dumping-with-tcp-c.patch rename to 0002-tcp-Skip-restoring-TCP-state-when-dumping-with-tcp-c.patch index e2f4fd1..62a8554 100644 --- a/0003-tcp-Skip-restoring-TCP-state-when-dumping-with-tcp-c.patch +++ b/0002-tcp-Skip-restoring-TCP-state-when-dumping-with-tcp-c.patch @@ -1,7 +1,7 @@ -From da9608458d9130e906387f9da8432998e5a503cd Mon Sep 17 00:00:00 2001 +From 135c3df15c4b4d968b00ced7cd88133bbdb8962a Mon Sep 17 00:00:00 2001 From: Bui Quang Minh Date: Thu, 12 Aug 2021 11:05:09 +0000 -Subject: [PATCH 003/245] tcp: Skip restoring TCP state when dumping with +Subject: [PATCH 002/249] tcp: Skip restoring TCP state when dumping with --tcp-close Since commit e42f5e0 ("tcp: allow to specify --tcp-close on dump"), diff --git a/0004-zdtm-Dumping-restoring-with-tcp-close-on-TCP_CLOSE-s.patch b/0003-zdtm-Dumping-restoring-with-tcp-close-on-TCP_CLOSE-s.patch similarity index 95% rename from 0004-zdtm-Dumping-restoring-with-tcp-close-on-TCP_CLOSE-s.patch rename to 0003-zdtm-Dumping-restoring-with-tcp-close-on-TCP_CLOSE-s.patch index 524cfa3..b01b2f5 100644 --- a/0004-zdtm-Dumping-restoring-with-tcp-close-on-TCP_CLOSE-s.patch +++ b/0003-zdtm-Dumping-restoring-with-tcp-close-on-TCP_CLOSE-s.patch @@ -1,7 +1,7 @@ -From 67b6cb52a89947ee3c09f9617b0f303725bfbd8c Mon Sep 17 00:00:00 2001 +From acaf5a96370541678c33a91489df069c55084aff Mon Sep 17 00:00:00 2001 From: Bui Quang Minh Date: Mon, 20 Sep 2021 20:57:03 +0700 -Subject: [PATCH 004/245] zdtm: Dumping/restoring with --tcp-close on TCP_CLOSE +Subject: [PATCH 003/249] zdtm: Dumping/restoring with --tcp-close on TCP_CLOSE socket Signed-off-by: Bui Quang Minh diff --git a/0005-criu-8-Add-more-detailed-description-about-tcp-close.patch b/0004-criu-8-Add-more-detailed-description-about-tcp-close.patch similarity index 89% rename from 0005-criu-8-Add-more-detailed-description-about-tcp-close.patch rename to 0004-criu-8-Add-more-detailed-description-about-tcp-close.patch index d495563..43d857b 100644 --- a/0005-criu-8-Add-more-detailed-description-about-tcp-close.patch +++ b/0004-criu-8-Add-more-detailed-description-about-tcp-close.patch @@ -1,7 +1,7 @@ -From 910f52c00474036412561fb45fc89d2e04e860d0 Mon Sep 17 00:00:00 2001 +From 58c3e33e8227bdf2105dcca18a57a7a8bf3ddd1a Mon Sep 17 00:00:00 2001 From: Bui Quang Minh Date: Mon, 4 Oct 2021 20:38:34 +0700 -Subject: [PATCH 005/245] criu(8): Add more detailed description about +Subject: [PATCH 004/249] criu(8): Add more detailed description about --tcp-close dump option The expected behavior of --tcp-close option when dumpping is to close diff --git a/0006-Add-support-for-python3-in-criu-coredump.patch b/0005-Add-support-for-python3-in-criu-coredump.patch similarity index 98% rename from 0006-Add-support-for-python3-in-criu-coredump.patch rename to 0005-Add-support-for-python3-in-criu-coredump.patch index 4c3097d..16b34a6 100644 --- a/0006-Add-support-for-python3-in-criu-coredump.patch +++ b/0005-Add-support-for-python3-in-criu-coredump.patch @@ -1,7 +1,7 @@ -From 0246feb3ca20256ca3be8e94ebf8b30f75a26e3e Mon Sep 17 00:00:00 2001 +From e37aed0ca94e88f503499ddd828241d5b16122e7 Mon Sep 17 00:00:00 2001 From: Andrey Vyazovtsev Date: Thu, 26 Aug 2021 22:22:33 +0300 -Subject: [PATCH 006/245] Add support for python3 in criu-coredump +Subject: [PATCH 005/249] Add support for python3 in criu-coredump Resolve the following python3 portability issues: diff --git a/0007-Add-new-files-for-running-criu-coredump-via-python-2.patch b/0006-Add-new-files-for-running-criu-coredump-via-python-2.patch similarity index 94% rename from 0007-Add-new-files-for-running-criu-coredump-via-python-2.patch rename to 0006-Add-new-files-for-running-criu-coredump-via-python-2.patch index ddb3d5a..574691e 100644 --- a/0007-Add-new-files-for-running-criu-coredump-via-python-2.patch +++ b/0006-Add-new-files-for-running-criu-coredump-via-python-2.patch @@ -1,7 +1,7 @@ -From fe7504f824e0e59f182b3e2eaffa4514c7bdbae1 Mon Sep 17 00:00:00 2001 +From 3a7deb046e713421ee302aac9f726aefeecf60a4 Mon Sep 17 00:00:00 2001 From: AndreyVV-100 Date: Fri, 23 Jul 2021 12:48:03 +0300 -Subject: [PATCH 007/245] Add new files for running criu-coredump via python 2 +Subject: [PATCH 006/249] Add new files for running criu-coredump via python 2 or 3 Previous commit added support for python3 in criu-coredump. For convenience, diff --git a/0008-coredump-remove-unused-import.patch b/0007-coredump-remove-unused-import.patch similarity index 88% rename from 0008-coredump-remove-unused-import.patch rename to 0007-coredump-remove-unused-import.patch index dfc68d3..ae23443 100644 --- a/0008-coredump-remove-unused-import.patch +++ b/0007-coredump-remove-unused-import.patch @@ -1,7 +1,7 @@ -From db8634929bdb48268f3744aa2acb19fafec00be3 Mon Sep 17 00:00:00 2001 +From 08984ba43fee2b7a872a067cfa7ed9e86059ca9d Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Sun, 5 Sep 2021 21:31:12 +0100 -Subject: [PATCH 008/245] coredump: remove unused import +Subject: [PATCH 007/249] coredump: remove unused import Signed-off-by: Radostin Stoyanov --- diff --git a/0009-coredump-sort-imports.patch b/0008-coredump-sort-imports.patch similarity index 85% rename from 0009-coredump-sort-imports.patch rename to 0008-coredump-sort-imports.patch index 6a57eb0..a942fdb 100644 --- a/0009-coredump-sort-imports.patch +++ b/0008-coredump-sort-imports.patch @@ -1,7 +1,7 @@ -From df099bc26bf56bca463ec5e914516b17a4426ae9 Mon Sep 17 00:00:00 2001 +From 93c8beedcee85b7333a4b9137dad606bec5f3f66 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Sun, 5 Sep 2021 21:32:17 +0100 -Subject: [PATCH 009/245] coredump: sort imports +Subject: [PATCH 008/249] coredump: sort imports Signed-off-by: Radostin Stoyanov --- diff --git a/0010-coredump-convert-indentation-to-spaces.patch b/0009-coredump-convert-indentation-to-spaces.patch similarity index 96% rename from 0010-coredump-convert-indentation-to-spaces.patch rename to 0009-coredump-convert-indentation-to-spaces.patch index 9e63a32..0044593 100644 --- a/0010-coredump-convert-indentation-to-spaces.patch +++ b/0009-coredump-convert-indentation-to-spaces.patch @@ -1,7 +1,7 @@ -From 5ddabab892cf628be052d29d395adc9b597345df Mon Sep 17 00:00:00 2001 +From e945c416d6ddba23642defa66c047102c545526b Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Sun, 5 Sep 2021 21:34:00 +0100 -Subject: [PATCH 010/245] coredump: convert indentation to spaces +Subject: [PATCH 009/249] coredump: convert indentation to spaces Signed-off-by: Radostin Stoyanov --- diff --git a/0011-python-replace-equality-with-identity-test.patch b/0010-python-replace-equality-with-identity-test.patch similarity index 96% rename from 0011-python-replace-equality-with-identity-test.patch rename to 0010-python-replace-equality-with-identity-test.patch index e7cb5c2..f583eab 100644 --- a/0011-python-replace-equality-with-identity-test.patch +++ b/0010-python-replace-equality-with-identity-test.patch @@ -1,7 +1,7 @@ -From e111b6e6dd9979ae575b97b14080e93643add683 Mon Sep 17 00:00:00 2001 +From 162e2c214bb7480f583c202cf2145c65027e4400 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Sun, 5 Sep 2021 21:36:10 +0100 -Subject: [PATCH 011/245] python: replace equality with identity test +Subject: [PATCH 010/249] python: replace equality with identity test PEP8 recommends for comparisons to singletons like None to always be done with 'is' or 'is not', never the equality operators. diff --git a/0012-coredump-drop-unused-variable.patch b/0011-coredump-drop-unused-variable.patch similarity index 85% rename from 0012-coredump-drop-unused-variable.patch rename to 0011-coredump-drop-unused-variable.patch index 62d97fe..fb34cb0 100644 --- a/0012-coredump-drop-unused-variable.patch +++ b/0011-coredump-drop-unused-variable.patch @@ -1,7 +1,7 @@ -From cf5c2292a240fc36e424fad914e1839d05da5e01 Mon Sep 17 00:00:00 2001 +From f9f591b867abc61b414b4bee84ac683860c89ae6 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Sun, 5 Sep 2021 21:38:06 +0100 -Subject: [PATCH 012/245] coredump: drop unused variable +Subject: [PATCH 011/249] coredump: drop unused variable Signed-off-by: Radostin Stoyanov --- diff --git a/0013-coredump-drop-exec-permission.patch b/0012-coredump-drop-exec-permission.patch similarity index 80% rename from 0013-coredump-drop-exec-permission.patch rename to 0012-coredump-drop-exec-permission.patch index 1b10a3e..029b785 100644 --- a/0013-coredump-drop-exec-permission.patch +++ b/0012-coredump-drop-exec-permission.patch @@ -1,7 +1,7 @@ -From 0f3b2a370d1180e339575d6b86ef46f0bf93edb4 Mon Sep 17 00:00:00 2001 +From dc6d38708b54aafad660c01112a4ea0f301c5c07 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Sun, 5 Sep 2021 21:42:46 +0100 -Subject: [PATCH 013/245] coredump: drop exec permission +Subject: [PATCH 012/249] coredump: drop exec permission The shebang line in this file was removed in a previous commit and the file should be non-executable. diff --git a/0014-coredump-lint-fix-for-block-comments.patch b/0013-coredump-lint-fix-for-block-comments.patch similarity index 99% rename from 0014-coredump-lint-fix-for-block-comments.patch rename to 0013-coredump-lint-fix-for-block-comments.patch index 9106226..8d0f6fa 100644 --- a/0014-coredump-lint-fix-for-block-comments.patch +++ b/0013-coredump-lint-fix-for-block-comments.patch @@ -1,7 +1,7 @@ -From b593b4cc141c9e7ac104530755d071274f38f1b1 Mon Sep 17 00:00:00 2001 +From ccb2c41bbabaeaa0cec6d31bb0a862a8724568f0 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Sun, 5 Sep 2021 21:53:06 +0100 -Subject: [PATCH 014/245] coredump: lint fix for block comments +Subject: [PATCH 013/249] coredump: lint fix for block comments Block comment should start with '# ' https://www.flake8rules.com/rules/E265.html diff --git a/0015-coredump-fix-missing-whitespace-around-operator.patch b/0014-coredump-fix-missing-whitespace-around-operator.patch similarity index 86% rename from 0015-coredump-fix-missing-whitespace-around-operator.patch rename to 0014-coredump-fix-missing-whitespace-around-operator.patch index d729249..a78370f 100644 --- a/0015-coredump-fix-missing-whitespace-around-operator.patch +++ b/0014-coredump-fix-missing-whitespace-around-operator.patch @@ -1,7 +1,7 @@ -From 1074ea5b55fadc6b189a81c792e1c30bfaa86d8b Mon Sep 17 00:00:00 2001 +From dca95ec84857a23e142bbed9016da09c50868014 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Sun, 5 Sep 2021 22:37:26 +0100 -Subject: [PATCH 015/245] coredump: fix missing whitespace around operator +Subject: [PATCH 014/249] coredump: fix missing whitespace around operator Missing whitespace around arithmetic operator https://www.flake8rules.com/rules/E226.html diff --git a/0016-coredump-fix-too-many-blank-lines.patch b/0015-coredump-fix-too-many-blank-lines.patch similarity index 85% rename from 0016-coredump-fix-too-many-blank-lines.patch rename to 0015-coredump-fix-too-many-blank-lines.patch index c7cfa24..254f642 100644 --- a/0016-coredump-fix-too-many-blank-lines.patch +++ b/0015-coredump-fix-too-many-blank-lines.patch @@ -1,7 +1,7 @@ -From b2903a63004600399d5982ce0b36f203702001d7 Mon Sep 17 00:00:00 2001 +From 3495005412dcfe1a897bc52d24a299b098a6eac1 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Sun, 5 Sep 2021 22:39:50 +0100 -Subject: [PATCH 016/245] coredump: fix too many blank lines +Subject: [PATCH 015/249] coredump: fix too many blank lines https://www.flake8rules.com/rules/E303.html diff --git a/0017-coredump-fix-comparison-to-true.patch b/0016-coredump-fix-comparison-to-true.patch similarity index 88% rename from 0017-coredump-fix-comparison-to-true.patch rename to 0016-coredump-fix-comparison-to-true.patch index 7be6690..592da3f 100644 --- a/0017-coredump-fix-comparison-to-true.patch +++ b/0016-coredump-fix-comparison-to-true.patch @@ -1,7 +1,7 @@ -From b37e0a33b23dbe789f178aca614458637598c506 Mon Sep 17 00:00:00 2001 +From da13809e3122ffde0c3657facb978ba7b54bf3a5 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Sun, 5 Sep 2021 22:42:19 +0100 -Subject: [PATCH 017/245] coredump: fix comparison to true +Subject: [PATCH 016/249] coredump: fix comparison to true Comparison to true should be 'if cond is true:' or 'if cond:' https://www.flake8rules.com/rules/E712.html diff --git a/0018-coredump-lint-fix-visually-indented-line.patch b/0017-coredump-lint-fix-visually-indented-line.patch similarity index 94% rename from 0018-coredump-lint-fix-visually-indented-line.patch rename to 0017-coredump-lint-fix-visually-indented-line.patch index 23b9600..d90cf62 100644 --- a/0018-coredump-lint-fix-visually-indented-line.patch +++ b/0017-coredump-lint-fix-visually-indented-line.patch @@ -1,7 +1,7 @@ -From e0d45309559dc198619ad8f62d699f601f04dbca Mon Sep 17 00:00:00 2001 +From c9c55b3b33dc7e4295e68e816001216b7568c19e Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Sun, 5 Sep 2021 22:47:59 +0100 -Subject: [PATCH 018/245] coredump: lint fix visually indented line +Subject: [PATCH 017/249] coredump: lint fix visually indented line Continuation line over-indented for visual indent https://www.flake8rules.com/rules/E127.html diff --git a/0019-test-coredump-fix-shellcheck-errors.patch b/0018-test-coredump-fix-shellcheck-errors.patch similarity index 90% rename from 0019-test-coredump-fix-shellcheck-errors.patch rename to 0018-test-coredump-fix-shellcheck-errors.patch index 4ecff6d..26aaa99 100644 --- a/0019-test-coredump-fix-shellcheck-errors.patch +++ b/0018-test-coredump-fix-shellcheck-errors.patch @@ -1,7 +1,7 @@ -From 599d77b4650a7ce14370ac69fbc825a71e540da4 Mon Sep 17 00:00:00 2001 +From 23644721afc34abb4a2d08c7dd7f83d5780a61ba Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Mon, 6 Sep 2021 00:20:58 +0100 -Subject: [PATCH 019/245] test/coredump: fix shellcheck errors +Subject: [PATCH 018/249] test/coredump: fix shellcheck errors ShellCheck reports the following problems: diff --git a/0020-make-enable-lint-for-coredump.patch b/0019-make-enable-lint-for-coredump.patch similarity index 88% rename from 0020-make-enable-lint-for-coredump.patch rename to 0019-make-enable-lint-for-coredump.patch index 17c7e8d..2484c08 100644 --- a/0020-make-enable-lint-for-coredump.patch +++ b/0019-make-enable-lint-for-coredump.patch @@ -1,7 +1,7 @@ -From 5dc9cc7abb2ba750dc09af0c9983723ac6c03c8d Mon Sep 17 00:00:00 2001 +From 7bf49f15f48be6ae0cc6adddc17322f7d2e94e3b Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Sun, 5 Sep 2021 22:55:24 +0100 -Subject: [PATCH 020/245] make: enable lint for coredump +Subject: [PATCH 019/249] make: enable lint for coredump Signed-off-by: Radostin Stoyanov --- diff --git a/0021-ci-enable-coredump-tests.patch b/0020-ci-enable-coredump-tests.patch similarity index 90% rename from 0021-ci-enable-coredump-tests.patch rename to 0020-ci-enable-coredump-tests.patch index 6bda688..a6ebe98 100644 --- a/0021-ci-enable-coredump-tests.patch +++ b/0020-ci-enable-coredump-tests.patch @@ -1,7 +1,7 @@ -From 37301a8a6ef9ecb1efe3f8086cd1ca6bd7fe4b70 Mon Sep 17 00:00:00 2001 +From 50311543e8d3567ebd15085cdb4ea3b149d1e90c Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Sun, 5 Sep 2021 23:06:56 +0100 -Subject: [PATCH 021/245] ci: enable coredump tests +Subject: [PATCH 020/249] ci: enable coredump tests Signed-off-by: Radostin Stoyanov --- diff --git a/0022-pie-restorer-remove-excess-hash-printf-specifier.patch b/0021-pie-restorer-remove-excess-hash-printf-specifier.patch similarity index 91% rename from 0022-pie-restorer-remove-excess-hash-printf-specifier.patch rename to 0021-pie-restorer-remove-excess-hash-printf-specifier.patch index 37acf25..9dc7236 100644 --- a/0022-pie-restorer-remove-excess-hash-printf-specifier.patch +++ b/0021-pie-restorer-remove-excess-hash-printf-specifier.patch @@ -1,7 +1,7 @@ -From 817bbf40251e54cc1441250a16e192f7f18a80b6 Mon Sep 17 00:00:00 2001 +From a8956a7579f094de1401b6486501d6d553754b81 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 21 Oct 2021 11:47:01 +0300 -Subject: [PATCH 022/245] pie/restorer: remove excess hash printf specifier +Subject: [PATCH 021/249] pie/restorer: remove excess hash printf specifier We use here "%#x" printf specifier in pie code, but sbuf_printf core pie printing function knows nothing about '#' specifier. More over simple diff --git a/0023-tty-fix-the-null-pointer-of-get_tty_driver.patch b/0022-tty-fix-the-null-pointer-of-get_tty_driver.patch similarity index 87% rename from 0023-tty-fix-the-null-pointer-of-get_tty_driver.patch rename to 0022-tty-fix-the-null-pointer-of-get_tty_driver.patch index 9a18f06..fd2c849 100644 --- a/0023-tty-fix-the-null-pointer-of-get_tty_driver.patch +++ b/0022-tty-fix-the-null-pointer-of-get_tty_driver.patch @@ -1,7 +1,7 @@ -From 47be9b1891006453ad9ae87960677300822be8b0 Mon Sep 17 00:00:00 2001 +From add9597c6c6ed74c643e0784c171eb0ca8deab53 Mon Sep 17 00:00:00 2001 From: "fu.lin" Date: Fri, 17 Sep 2021 17:16:48 +0800 -Subject: [PATCH 023/245] tty: fix the null pointer of get_tty_driver +Subject: [PATCH 022/249] tty: fix the null pointer of get_tty_driver v2: split error checking from index variable initialization v3: use PRIx64 for printing dev_t diff --git a/0024-util-use-nftw-in-rmrf-helper.patch b/0023-util-use-nftw-in-rmrf-helper.patch similarity index 96% rename from 0024-util-use-nftw-in-rmrf-helper.patch rename to 0023-util-use-nftw-in-rmrf-helper.patch index a335492..7a2f6a7 100644 --- a/0024-util-use-nftw-in-rmrf-helper.patch +++ b/0023-util-use-nftw-in-rmrf-helper.patch @@ -1,7 +1,7 @@ -From 10fa87c08c22d7d7ddca1fbd1c2704f96c079639 Mon Sep 17 00:00:00 2001 +From 889fde47e57226278767be69768b733eeb84f15c Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Fri, 22 Oct 2021 17:56:37 +0300 -Subject: [PATCH 024/245] util: use nftw in rmrf helper +Subject: [PATCH 023/249] util: use nftw in rmrf helper This simplifies the code by removing excess recursion and reusing standard function to walk over file-tree instead of opencoding it. diff --git a/0025-criu-ns-make-pidns-init-first-do-setsid.patch b/0024-criu-ns-make-pidns-init-first-do-setsid.patch similarity index 88% rename from 0025-criu-ns-make-pidns-init-first-do-setsid.patch rename to 0024-criu-ns-make-pidns-init-first-do-setsid.patch index 485e34a..90bc189 100644 --- a/0025-criu-ns-make-pidns-init-first-do-setsid.patch +++ b/0024-criu-ns-make-pidns-init-first-do-setsid.patch @@ -1,7 +1,7 @@ -From 08baf25effeb30d59f98e2eae07acee71ce22b1c Mon Sep 17 00:00:00 2001 +From 06a4400fc7b96e7abbeda7f79ee52daa61fe0223 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Mon, 18 Oct 2021 18:43:14 +0300 -Subject: [PATCH 025/245] criu-ns: make pidns init first do setsid +Subject: [PATCH 024/249] criu-ns: make pidns init first do setsid We see that on criu-ns dump/restore/dump of the process which initially was not a session leader (with --shell-job option) we see sid == 0 for diff --git a/0026-net-optimize-restore_rule-to-not-open-the-CR_FD_RULE.patch b/0025-net-optimize-restore_rule-to-not-open-the-CR_FD_RULE.patch similarity index 95% rename from 0026-net-optimize-restore_rule-to-not-open-the-CR_FD_RULE.patch rename to 0025-net-optimize-restore_rule-to-not-open-the-CR_FD_RULE.patch index 62ae705..0547fde 100644 --- a/0026-net-optimize-restore_rule-to-not-open-the-CR_FD_RULE.patch +++ b/0025-net-optimize-restore_rule-to-not-open-the-CR_FD_RULE.patch @@ -1,7 +1,7 @@ -From 87d8857fa7fdaed252f52782eb4f65b4ab990536 Mon Sep 17 00:00:00 2001 +From 2cdae896f304afae1d2b96dd00f2a599266765be Mon Sep 17 00:00:00 2001 From: Nicolas Viennot Date: Thu, 28 Oct 2021 21:05:57 +0000 -Subject: [PATCH 026/245] net: optimize restore_rule() to not open the +Subject: [PATCH 025/249] net: optimize restore_rule() to not open the CR_FD_RULE image file twice Previously, `open_image(CR_FD_RULE, O_RSTR, pid)` was called twice. diff --git a/0027-ci-replace-deprecated-codecov-bash-uploader.patch b/0026-ci-replace-deprecated-codecov-bash-uploader.patch similarity index 91% rename from 0027-ci-replace-deprecated-codecov-bash-uploader.patch rename to 0026-ci-replace-deprecated-codecov-bash-uploader.patch index a958d9f..c845f54 100644 --- a/0027-ci-replace-deprecated-codecov-bash-uploader.patch +++ b/0026-ci-replace-deprecated-codecov-bash-uploader.patch @@ -1,7 +1,7 @@ -From dfa69352b7115aa65a735a43b5d5cdd95511eed6 Mon Sep 17 00:00:00 2001 +From 175fb94e620f9e33358e92bec0262e0586ec554a Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Wed, 27 Oct 2021 07:27:22 +0000 -Subject: [PATCH 027/245] ci: replace deprecated codecov bash uploader +Subject: [PATCH 026/249] ci: replace deprecated codecov bash uploader Replace deprecated codecov bash uploader with new version: diff --git a/0028-ci-fix-userfaultfd-test-failures.patch b/0027-ci-fix-userfaultfd-test-failures.patch similarity index 90% rename from 0028-ci-fix-userfaultfd-test-failures.patch rename to 0027-ci-fix-userfaultfd-test-failures.patch index f6ba568..ca61f9b 100644 --- a/0028-ci-fix-userfaultfd-test-failures.patch +++ b/0027-ci-fix-userfaultfd-test-failures.patch @@ -1,7 +1,7 @@ -From 5c4c99dc3d477408e5bd249e03254ca4a3bafb87 Mon Sep 17 00:00:00 2001 +From a78590464010d9de5c794b4fc12aea8c5a0b46a1 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Thu, 4 Nov 2021 09:10:38 +0000 -Subject: [PATCH 028/245] ci: fix userfaultfd test failures +Subject: [PATCH 027/249] ci: fix userfaultfd test failures Newer kernels (5.11) require echo 1 > /proc/sys/vm/unprivileged_userfaultfd diff --git a/0029-ci-use-Fedora-34-for-lint-CI-runs.patch b/0028-ci-use-Fedora-34-for-lint-CI-runs.patch similarity index 87% rename from 0029-ci-use-Fedora-34-for-lint-CI-runs.patch rename to 0028-ci-use-Fedora-34-for-lint-CI-runs.patch index a1aa182..89e550c 100644 --- a/0029-ci-use-Fedora-34-for-lint-CI-runs.patch +++ b/0028-ci-use-Fedora-34-for-lint-CI-runs.patch @@ -1,7 +1,7 @@ -From 3bc19101b9458cb920b79492063be1b71312f0a5 Mon Sep 17 00:00:00 2001 +From 20c65ae87263315214c48a636dc20b4dbac03215 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Thu, 4 Nov 2021 09:18:31 +0000 -Subject: [PATCH 029/245] ci: use Fedora 34 for lint CI runs +Subject: [PATCH 028/249] ci: use Fedora 34 for lint CI runs Fedora 35 comes with clang 13 which provides different results for clang-format than clang 12 in Fedora 34. diff --git a/0030-tests-improve-the-image-streamer-process-control.patch b/0029-tests-improve-the-image-streamer-process-control.patch similarity index 97% rename from 0030-tests-improve-the-image-streamer-process-control.patch rename to 0029-tests-improve-the-image-streamer-process-control.patch index 1ec3da6..3155588 100644 --- a/0030-tests-improve-the-image-streamer-process-control.patch +++ b/0029-tests-improve-the-image-streamer-process-control.patch @@ -1,7 +1,7 @@ -From 3b1a22da26051f157aaf3272bb4bb78a545920c2 Mon Sep 17 00:00:00 2001 +From ef7f435bccd1a60230a66271723590656e0917b1 Mon Sep 17 00:00:00 2001 From: Nicolas Viennot Date: Fri, 29 Oct 2021 02:49:31 +0000 -Subject: [PATCH 030/245] tests: improve the image streamer process control +Subject: [PATCH 029/249] tests: improve the image streamer process control When exceptions are raised during testing, the image streamer process should be terminated as opposed to being left hanging. diff --git a/0031-sockets-don-t-call-sk_setbufs-asyncronously.patch b/0030-sockets-don-t-call-sk_setbufs-asyncronously.patch similarity index 90% rename from 0031-sockets-don-t-call-sk_setbufs-asyncronously.patch rename to 0030-sockets-don-t-call-sk_setbufs-asyncronously.patch index 4733fae..5d80afe 100644 --- a/0031-sockets-don-t-call-sk_setbufs-asyncronously.patch +++ b/0030-sockets-don-t-call-sk_setbufs-asyncronously.patch @@ -1,7 +1,7 @@ -From 654c2ee79dae4429287d5ea458952759a7a4632e Mon Sep 17 00:00:00 2001 +From 04464397f1d2bf43265ed70bba029bfa57d20092 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 29 Jul 2021 14:21:37 +0300 -Subject: [PATCH 031/245] sockets: don't call sk_setbufs asyncronously +Subject: [PATCH 030/249] sockets: don't call sk_setbufs asyncronously We want to also c/r socket buf locks (SO_BUF_LOCKS) which are also implicitly set by setsockopt(SO_{SND,RCV}BUF*), so we need to order diff --git a/0032-kerndat-check-for-set-getsockopt-SO_BUF_LOCK-availab.patch b/0031-kerndat-check-for-set-getsockopt-SO_BUF_LOCK-availab.patch similarity index 96% rename from 0032-kerndat-check-for-set-getsockopt-SO_BUF_LOCK-availab.patch rename to 0031-kerndat-check-for-set-getsockopt-SO_BUF_LOCK-availab.patch index 27136e7..6d4dd07 100644 --- a/0032-kerndat-check-for-set-getsockopt-SO_BUF_LOCK-availab.patch +++ b/0031-kerndat-check-for-set-getsockopt-SO_BUF_LOCK-availab.patch @@ -1,7 +1,7 @@ -From c030e495ed3b5e59acd8c7bdcad8baea1697b909 Mon Sep 17 00:00:00 2001 +From 5dc443bcd848877677b858e1aa21e0c929f19541 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 29 Jul 2021 14:57:17 +0300 -Subject: [PATCH 032/245] kerndat: check for set/getsockopt SO_BUF_LOCK +Subject: [PATCH 031/249] kerndat: check for set/getsockopt SO_BUF_LOCK availability This is a new kernel feature to let criu restore sockets with kernel diff --git a/0033-sockets-c-r-bufer-size-locks.patch b/0032-sockets-c-r-bufer-size-locks.patch similarity index 95% rename from 0033-sockets-c-r-bufer-size-locks.patch rename to 0032-sockets-c-r-bufer-size-locks.patch index fb89c78..40e34c9 100644 --- a/0033-sockets-c-r-bufer-size-locks.patch +++ b/0032-sockets-c-r-bufer-size-locks.patch @@ -1,7 +1,7 @@ -From 5aea67fc45f4cf986f396c4f99e5317b9ba08ef6 Mon Sep 17 00:00:00 2001 +From ab926314464645eda33d6ccb505e673d9db01296 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 29 Jul 2021 11:27:13 +0300 -Subject: [PATCH 033/245] sockets: c/r bufer size locks +Subject: [PATCH 032/249] sockets: c/r bufer size locks When one sets socket buffer sizes with setsockopt(SO_{SND,RCV}BUF*), kernel sets coresponding SOCK_SNDBUF_LOCK or SOCK_RCVBUF_LOCK flags on diff --git a/0034-zdtm-add-test-for-socket-buffer-size-locks.patch b/0033-zdtm-add-test-for-socket-buffer-size-locks.patch similarity index 95% rename from 0034-zdtm-add-test-for-socket-buffer-size-locks.patch rename to 0033-zdtm-add-test-for-socket-buffer-size-locks.patch index 95c2fe2..a64f826 100644 --- a/0034-zdtm-add-test-for-socket-buffer-size-locks.patch +++ b/0033-zdtm-add-test-for-socket-buffer-size-locks.patch @@ -1,7 +1,7 @@ -From 16ba0ca25d5e3ee030c4a78fbacd1ad9e1a8a6e0 Mon Sep 17 00:00:00 2001 +From b9ef6d19297e0cea7d697513ee685ae13014cdec Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 29 Jul 2021 16:16:12 +0300 -Subject: [PATCH 034/245] zdtm: add test for socket buffer size locks +Subject: [PATCH 033/249] zdtm: add test for socket buffer size locks Just set all possible values 0-3 and chack if it persists. diff --git a/0035-zdtm-make-sock_opts02-also-check-lock-change-by-SO_-.patch b/0034-zdtm-make-sock_opts02-also-check-lock-change-by-SO_-.patch similarity index 95% rename from 0035-zdtm-make-sock_opts02-also-check-lock-change-by-SO_-.patch rename to 0034-zdtm-make-sock_opts02-also-check-lock-change-by-SO_-.patch index 17807ce..8cfea59 100644 --- a/0035-zdtm-make-sock_opts02-also-check-lock-change-by-SO_-.patch +++ b/0034-zdtm-make-sock_opts02-also-check-lock-change-by-SO_-.patch @@ -1,7 +1,7 @@ -From 7168eac9043df54efba6a892ae4e1578ebb9c5c8 Mon Sep 17 00:00:00 2001 +From e6d511315f175d80bb6b1adb9bfc68debb46ffc3 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Tue, 3 Aug 2021 13:05:32 +0300 -Subject: [PATCH 035/245] zdtm: make sock_opts02 also check lock change by +Subject: [PATCH 034/249] zdtm: make sock_opts02 also check lock change by SO_*BUF* Reviewed-by: Alexander Mikhalitsyn diff --git a/0036-clang-format-enable-AlignTrailingComments.patch b/0035-clang-format-enable-AlignTrailingComments.patch similarity index 98% rename from 0036-clang-format-enable-AlignTrailingComments.patch rename to 0035-clang-format-enable-AlignTrailingComments.patch index 1c278d1..8838372 100644 --- a/0036-clang-format-enable-AlignTrailingComments.patch +++ b/0035-clang-format-enable-AlignTrailingComments.patch @@ -1,7 +1,7 @@ -From 0b5a590b0522207411d0439f958b1a8fcfbd4cba Mon Sep 17 00:00:00 2001 +From 8ea9c9fc7360f9c5250632d0818f68af0de73992 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 28 Oct 2021 17:15:52 +0300 -Subject: [PATCH 036/245] clang-format: enable AlignTrailingComments +Subject: [PATCH 035/249] clang-format: enable AlignTrailingComments Code becomes much more human-readable after enabling it. diff --git a/0037-clang-format-do-several-manual-comment-fixups.patch b/0036-clang-format-do-several-manual-comment-fixups.patch similarity index 97% rename from 0037-clang-format-do-several-manual-comment-fixups.patch rename to 0036-clang-format-do-several-manual-comment-fixups.patch index e6d45ef..622bb25 100644 --- a/0037-clang-format-do-several-manual-comment-fixups.patch +++ b/0036-clang-format-do-several-manual-comment-fixups.patch @@ -1,7 +1,7 @@ -From ffa271086ac15e18203d64611afff81b4c9d2ab3 Mon Sep 17 00:00:00 2001 +From 54b25b72065f17594216642bcf8a3267a0a0a489 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 28 Oct 2021 17:17:44 +0300 -Subject: [PATCH 037/245] clang-format: do several manual comment fixups +Subject: [PATCH 036/249] clang-format: do several manual comment fixups Automatic AlignTrailingComments fails to make those comments look right, so let's do it manually, so that they both satisfy AlignTrailingComments diff --git a/0038-clang-format-do-automatic-comment-fixups.patch b/0037-clang-format-do-automatic-comment-fixups.patch similarity index 99% rename from 0038-clang-format-do-automatic-comment-fixups.patch rename to 0037-clang-format-do-automatic-comment-fixups.patch index 81e4774..1eaa294 100644 --- a/0038-clang-format-do-automatic-comment-fixups.patch +++ b/0037-clang-format-do-automatic-comment-fixups.patch @@ -1,7 +1,7 @@ -From 913b7e1987c76e61c8fa2eda8e37fbf4cac4855e Mon Sep 17 00:00:00 2001 +From 901042439368aef3513407abcf2f91780fb609a4 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 28 Oct 2021 18:10:14 +0300 -Subject: [PATCH 038/245] clang-format: do automatic comment fixups +Subject: [PATCH 037/249] clang-format: do automatic comment fixups Result of `make indent` after enabling AlignTrailingComments. diff --git a/0039-cr-dump-fail-dumping-when-zombie-process-with-sid-0.patch b/0038-cr-dump-fail-dumping-when-zombie-process-with-sid-0.patch similarity index 87% rename from 0039-cr-dump-fail-dumping-when-zombie-process-with-sid-0.patch rename to 0038-cr-dump-fail-dumping-when-zombie-process-with-sid-0.patch index 9e6aeac..af595c8 100644 --- a/0039-cr-dump-fail-dumping-when-zombie-process-with-sid-0.patch +++ b/0038-cr-dump-fail-dumping-when-zombie-process-with-sid-0.patch @@ -1,7 +1,7 @@ -From c26f1f39b4371605ebf0ae5c5dacbdb2ad142ccd Mon Sep 17 00:00:00 2001 +From 906549c2de213e25ef6795025604a59609033f9d Mon Sep 17 00:00:00 2001 From: Liu Hua Date: Mon, 1 Nov 2021 20:50:58 +0800 -Subject: [PATCH 039/245] cr-dump: fail dumping when zombie process with sid 0 +Subject: [PATCH 038/249] cr-dump: fail dumping when zombie process with sid 0 A zombie process with 0 sid has a session leader in outer pidns and has ignored SIGHUP. Criu has no idea diff --git a/0040-clang-format-make-x86_ins_capability_mask-human-read.patch b/0039-clang-format-make-x86_ins_capability_mask-human-read.patch similarity index 98% rename from 0040-clang-format-make-x86_ins_capability_mask-human-read.patch rename to 0039-clang-format-make-x86_ins_capability_mask-human-read.patch index da73336..ea63b56 100644 --- a/0040-clang-format-make-x86_ins_capability_mask-human-read.patch +++ b/0039-clang-format-make-x86_ins_capability_mask-human-read.patch @@ -1,7 +1,7 @@ -From baed4b2d5783c9670a29292a228b4b491a20f2f2 Mon Sep 17 00:00:00 2001 +From e15962cc0cf487a85c4c30a2df0c4fd6dabe66de Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Fri, 29 Oct 2021 10:35:28 +0300 -Subject: [PATCH 040/245] clang-format: make x86_ins_capability_mask +Subject: [PATCH 039/249] clang-format: make x86_ins_capability_mask human-readable There is no option in clang not to merge as much binary operands as it diff --git a/0041-ci-disable-socket-raw-test-on-centos8.patch b/0040-ci-disable-socket-raw-test-on-centos8.patch similarity index 91% rename from 0041-ci-disable-socket-raw-test-on-centos8.patch rename to 0040-ci-disable-socket-raw-test-on-centos8.patch index ec3b008..b014a8f 100644 --- a/0041-ci-disable-socket-raw-test-on-centos8.patch +++ b/0040-ci-disable-socket-raw-test-on-centos8.patch @@ -1,7 +1,7 @@ -From 223d0ca7aa2de6cbde1ffe6b3f453352e2eb7c8c Mon Sep 17 00:00:00 2001 +From feb6788016c7de1998d00f54887f00b04fa47830 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Fri, 19 Nov 2021 10:08:37 +0300 -Subject: [PATCH 041/245] ci: disable socket-raw test on centos8 +Subject: [PATCH 040/249] ci: disable socket-raw test on centos8 We see error in centos8 ci on restore of socket-raw test: diff --git a/0042-zdtm.py-make-tests-with-link_remap-exclusive.patch b/0041-zdtm.py-make-tests-with-link_remap-exclusive.patch similarity index 94% rename from 0042-zdtm.py-make-tests-with-link_remap-exclusive.patch rename to 0041-zdtm.py-make-tests-with-link_remap-exclusive.patch index 8c290d5..3439e3c 100644 --- a/0042-zdtm.py-make-tests-with-link_remap-exclusive.patch +++ b/0041-zdtm.py-make-tests-with-link_remap-exclusive.patch @@ -1,7 +1,7 @@ -From 4210c29859bd25ded46a83e586ae956d98c79971 Mon Sep 17 00:00:00 2001 +From e41b2b10e637920665cf590bc170407d414ecf32 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Wed, 3 Nov 2021 18:34:11 +0300 -Subject: [PATCH 042/245] zdtm.py: make tests with --link_remap exclusive +Subject: [PATCH 041/249] zdtm.py: make tests with --link_remap exclusive We see that tests mntns_ghost01 and unlink_fstat03 can run simultaneousely and thus the former sees leftover link_remap.* files in diff --git a/0043-tests-improve-the-deterministic-behavior-of-the-test.patch b/0042-tests-improve-the-deterministic-behavior-of-the-test.patch similarity index 96% rename from 0043-tests-improve-the-deterministic-behavior-of-the-test.patch rename to 0042-tests-improve-the-deterministic-behavior-of-the-test.patch index 52a0386..f6c8e9b 100644 --- a/0043-tests-improve-the-deterministic-behavior-of-the-test.patch +++ b/0042-tests-improve-the-deterministic-behavior-of-the-test.patch @@ -1,7 +1,7 @@ -From 6e835673838d54caca7fd039598ef3c4afecfbc6 Mon Sep 17 00:00:00 2001 +From 038d59609716bac5b343dd03e4361ded84d48519 Mon Sep 17 00:00:00 2001 From: Nicolas Viennot Date: Fri, 29 Oct 2021 03:01:14 +0000 -Subject: [PATCH 043/245] tests: improve the deterministic behavior of the test +Subject: [PATCH 042/249] tests: improve the deterministic behavior of the test suite Various I/O objects are unclosed when the object falls out of scope. diff --git a/0044-clang-format-zdtm-fix-clang-complains-about-strange-.patch b/0043-clang-format-zdtm-fix-clang-complains-about-strange-.patch similarity index 95% rename from 0044-clang-format-zdtm-fix-clang-complains-about-strange-.patch rename to 0043-clang-format-zdtm-fix-clang-complains-about-strange-.patch index de7040c..5deabf6 100644 --- a/0044-clang-format-zdtm-fix-clang-complains-about-strange-.patch +++ b/0043-clang-format-zdtm-fix-clang-complains-about-strange-.patch @@ -1,7 +1,7 @@ -From ecbcbce3f0e2fb6af3d33700352eb626edb63783 Mon Sep 17 00:00:00 2001 +From 25c642cb7840033673f36a270074d7a47b0bbd76 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Tue, 23 Nov 2021 15:06:03 +0300 -Subject: [PATCH 044/245] clang-format/zdtm: fix clang complains about strange +Subject: [PATCH 043/249] clang-format/zdtm: fix clang complains about strange elseifs Clang-format v13 on my Fedora 35 complains about these hunks, more over diff --git a/0045-seize-restore-cgroup-freezer-to-right-state.patch b/0044-seize-restore-cgroup-freezer-to-right-state.patch similarity index 94% rename from 0045-seize-restore-cgroup-freezer-to-right-state.patch rename to 0044-seize-restore-cgroup-freezer-to-right-state.patch index 7450269..56b5099 100644 --- a/0045-seize-restore-cgroup-freezer-to-right-state.patch +++ b/0044-seize-restore-cgroup-freezer-to-right-state.patch @@ -1,7 +1,7 @@ -From b7b727c7a97083f17ee12a5690c60e44b4abb52c Mon Sep 17 00:00:00 2001 +From f1115a8e679c56269e363a609e1b86bc3052963a Mon Sep 17 00:00:00 2001 From: Liu Hua Date: Fri, 5 Nov 2021 17:08:51 +0800 -Subject: [PATCH 045/245] seize: restore cgroup freezer to right state +Subject: [PATCH 044/249] seize: restore cgroup freezer to right state The new freezer_state is a complete equivalent of old freezer_thawed except for the initial value. If old freezer_thawed was not initialized diff --git a/0046-ci-Use-latest-Fedora-for-lint-ci-runs-again.patch b/0045-ci-Use-latest-Fedora-for-lint-ci-runs-again.patch similarity index 88% rename from 0046-ci-Use-latest-Fedora-for-lint-ci-runs-again.patch rename to 0045-ci-Use-latest-Fedora-for-lint-ci-runs-again.patch index 440de7c..e1799a6 100644 --- a/0046-ci-Use-latest-Fedora-for-lint-ci-runs-again.patch +++ b/0045-ci-Use-latest-Fedora-for-lint-ci-runs-again.patch @@ -1,7 +1,7 @@ -From 985c6c5f10872bade13f7085bd0eaeaef1ea648a Mon Sep 17 00:00:00 2001 +From ba0ead357350d413d84fde5d2a35e445aa1aa964 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Wed, 24 Nov 2021 11:37:58 +0300 -Subject: [PATCH 046/245] ci: Use latest Fedora for lint ci runs again +Subject: [PATCH 045/249] ci: Use latest Fedora for lint ci runs again Now when we fixed clang-format complains in zdtm, let's switch to lates clang-format available. This is effectively a revert of commit 07a2f0265 diff --git a/0047-crtools-ignore-SIGPIPE-in-swrk-mode.patch b/0046-crtools-ignore-SIGPIPE-in-swrk-mode.patch similarity index 94% rename from 0047-crtools-ignore-SIGPIPE-in-swrk-mode.patch rename to 0046-crtools-ignore-SIGPIPE-in-swrk-mode.patch index 8d3d112..f67400b 100644 --- a/0047-crtools-ignore-SIGPIPE-in-swrk-mode.patch +++ b/0046-crtools-ignore-SIGPIPE-in-swrk-mode.patch @@ -1,7 +1,7 @@ -From 9c9eb25ff627f6a7ec272269983041b0594c2779 Mon Sep 17 00:00:00 2001 +From 49e0e77e5ca95fbdc0cd419982c0ef07772db04e Mon Sep 17 00:00:00 2001 From: Liu Hua Date: Thu, 4 Nov 2021 10:04:22 +0800 -Subject: [PATCH 047/245] crtools: ignore SIGPIPE in swrk mode +Subject: [PATCH 046/249] crtools: ignore SIGPIPE in swrk mode Criu ignores SIGPIPE in most cases except swrk mode. And in the following situtation criu get killed by SIGPIPE and have no chance diff --git a/0048-ci-switch-to-centos-stream-8.patch b/0047-ci-switch-to-centos-stream-8.patch similarity index 84% rename from 0048-ci-switch-to-centos-stream-8.patch rename to 0047-ci-switch-to-centos-stream-8.patch index 758944d..c900a38 100644 --- a/0048-ci-switch-to-centos-stream-8.patch +++ b/0047-ci-switch-to-centos-stream-8.patch @@ -1,7 +1,7 @@ -From c80d6aab7f205be069e2b46dbd8abc3ca910d336 Mon Sep 17 00:00:00 2001 +From 17e98a26b7d6b71613b8231d53ef33b61292c143 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Wed, 24 Nov 2021 16:13:01 +0000 -Subject: [PATCH 048/245] ci: switch to centos-stream-8 +Subject: [PATCH 047/249] ci: switch to centos-stream-8 CentOS 8 goes EOL at the end of 2021. This switches our CentOS 8 based tests to CentOS Stream 8 which should be supported until 2024. diff --git a/0049-check-cleanup-child-processes.patch b/0048-check-cleanup-child-processes.patch similarity index 93% rename from 0049-check-cleanup-child-processes.patch rename to 0048-check-cleanup-child-processes.patch index 100b2d5..9fe5f0d 100644 --- a/0049-check-cleanup-child-processes.patch +++ b/0048-check-cleanup-child-processes.patch @@ -1,7 +1,7 @@ -From 75efde9dfaace269db69465e838aab58124a66b6 Mon Sep 17 00:00:00 2001 +From aa6fb0bacd5cd9599a6e83b9c19cc10c679a03bf Mon Sep 17 00:00:00 2001 From: Nicolas Viennot Date: Fri, 19 Nov 2021 20:58:13 +0000 -Subject: [PATCH 049/245] check: cleanup child processes +Subject: [PATCH 048/249] check: cleanup child processes Always wait() for forked child processes. It avoid zombie processes in containers that don't have an init process reaping orphans. diff --git a/0050-files-reg-fix-error-handling-in-open_path.patch b/0049-files-reg-fix-error-handling-in-open_path.patch similarity index 97% rename from 0050-files-reg-fix-error-handling-in-open_path.patch rename to 0049-files-reg-fix-error-handling-in-open_path.patch index f2e6b81..3f90c21 100644 --- a/0050-files-reg-fix-error-handling-in-open_path.patch +++ b/0049-files-reg-fix-error-handling-in-open_path.patch @@ -1,7 +1,7 @@ -From cfd4d1fb786306658336d98b02d421b2ec925d4c Mon Sep 17 00:00:00 2001 +From bbc3f37710c5cf1cac507337a536c5523123b2a9 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 13 Feb 2020 10:43:14 +0300 -Subject: [PATCH 050/245] files-reg: fix error handling in open_path +Subject: [PATCH 049/249] files-reg: fix error handling in open_path 1) On error paths need to close fd and unlock mutex. 2) Make rfi_remap return special return code to identify EEXIST from diff --git a/0051-files-reg-fix-error-handling-of-rm_parent_dirs.patch b/0050-files-reg-fix-error-handling-of-rm_parent_dirs.patch similarity index 95% rename from 0051-files-reg-fix-error-handling-of-rm_parent_dirs.patch rename to 0050-files-reg-fix-error-handling-of-rm_parent_dirs.patch index 134d0a0..859815a 100644 --- a/0051-files-reg-fix-error-handling-of-rm_parent_dirs.patch +++ b/0050-files-reg-fix-error-handling-of-rm_parent_dirs.patch @@ -1,7 +1,7 @@ -From f9aced49154576d73810a8d12e7847d44e6b63fc Mon Sep 17 00:00:00 2001 +From e655a0ac8421325f2de8fbe4f6855b06cd2faace Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 13 Feb 2020 13:03:12 +0300 -Subject: [PATCH 051/245] files-reg: fix error handling of rm_parent_dirs +Subject: [PATCH 050/249] files-reg: fix error handling of rm_parent_dirs If unlinkat fails it means that fs is in "corrupted" state - spoiled with non-unlinked auxiliary directories. diff --git a/0052-ghost-mount-allocate-remounted_rw-in-shmem-to-get-in.patch b/0051-ghost-mount-allocate-remounted_rw-in-shmem-to-get-in.patch similarity index 97% rename from 0052-ghost-mount-allocate-remounted_rw-in-shmem-to-get-in.patch rename to 0051-ghost-mount-allocate-remounted_rw-in-shmem-to-get-in.patch index d785b20..f9472f8 100644 --- a/0052-ghost-mount-allocate-remounted_rw-in-shmem-to-get-in.patch +++ b/0051-ghost-mount-allocate-remounted_rw-in-shmem-to-get-in.patch @@ -1,7 +1,7 @@ -From 2eac9738a4244c007252d0537a46e9443e957210 Mon Sep 17 00:00:00 2001 +From 67b257d852572d38375453671ae038312ed94cba Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 13 Feb 2020 18:28:15 +0300 -Subject: [PATCH 052/245] ghost/mount: allocate remounted_rw in shmem to get +Subject: [PATCH 051/249] ghost/mount: allocate remounted_rw in shmem to get info from other processes Previousely remounted_rw was not shared between all processes on diff --git a/0053-files-reg-temporary-remount-writable-the-mount-we-do.patch b/0052-files-reg-temporary-remount-writable-the-mount-we-do.patch similarity index 90% rename from 0053-files-reg-temporary-remount-writable-the-mount-we-do.patch rename to 0052-files-reg-temporary-remount-writable-the-mount-we-do.patch index 4f3aad4..a08c17e 100644 --- a/0053-files-reg-temporary-remount-writable-the-mount-we-do.patch +++ b/0052-files-reg-temporary-remount-writable-the-mount-we-do.patch @@ -1,7 +1,7 @@ -From e7f694d31fe3f94398d62c786c87391f1ff59a11 Mon Sep 17 00:00:00 2001 +From 44aa8a5a75529bb4b256bcbdf490da5b730c5c5f Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 13 Feb 2020 18:26:52 +0300 -Subject: [PATCH 053/245] files-reg: temporary remount writable the mount we do +Subject: [PATCH 052/249] files-reg: temporary remount writable the mount we do unlink on Previousely I din't mention this case because we had bad error handling diff --git a/0054-zdtm-add-ro-mount-check-after-c-r-to-mntns_ghost01.patch b/0053-zdtm-add-ro-mount-check-after-c-r-to-mntns_ghost01.patch similarity index 91% rename from 0054-zdtm-add-ro-mount-check-after-c-r-to-mntns_ghost01.patch rename to 0053-zdtm-add-ro-mount-check-after-c-r-to-mntns_ghost01.patch index 52699c5..797e987 100644 --- a/0054-zdtm-add-ro-mount-check-after-c-r-to-mntns_ghost01.patch +++ b/0053-zdtm-add-ro-mount-check-after-c-r-to-mntns_ghost01.patch @@ -1,7 +1,7 @@ -From 5e50667eaef07435f731861e701edb41e7f4b3b3 Mon Sep 17 00:00:00 2001 +From 0fc0b2d996e0cba450155727239df8aaf31c26f1 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Tue, 30 Nov 2021 19:03:29 +0300 -Subject: [PATCH 054/245] zdtm: add ro-mount check after c/r to mntns_ghost01 +Subject: [PATCH 053/249] zdtm: add ro-mount check after c/r to mntns_ghost01 This is a test for "ghost/mount: allocate remounted_rw in shmem to get info from other processes" patch, without the patch test fails with: diff --git a/0055-clang-format-disable-wrong-struct-pointer-declaratio.patch b/0054-clang-format-disable-wrong-struct-pointer-declaratio.patch similarity index 95% rename from 0055-clang-format-disable-wrong-struct-pointer-declaratio.patch rename to 0054-clang-format-disable-wrong-struct-pointer-declaratio.patch index 1b22005..4ff12da 100644 --- a/0055-clang-format-disable-wrong-struct-pointer-declaratio.patch +++ b/0054-clang-format-disable-wrong-struct-pointer-declaratio.patch @@ -1,7 +1,7 @@ -From 6f4ddeb5201f7e0f6c330ed56e221c3c51627c19 Mon Sep 17 00:00:00 2001 +From 4e24f113c007f81904d6f46b336ed94634555657 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 25 Nov 2021 16:51:55 +0300 -Subject: [PATCH 055/245] clang-format: disable wrong struct pointer +Subject: [PATCH 054/249] clang-format: disable wrong struct pointer declaration format When we declare struct and at the same time declare variable pointer of diff --git a/0056-ci-Run-cross-compile-on-debian-stable.patch b/0055-ci-Run-cross-compile-on-debian-stable.patch similarity index 98% rename from 0056-ci-Run-cross-compile-on-debian-stable.patch rename to 0055-ci-Run-cross-compile-on-debian-stable.patch index 0b9dae6..ad597d1 100644 --- a/0056-ci-Run-cross-compile-on-debian-stable.patch +++ b/0055-ci-Run-cross-compile-on-debian-stable.patch @@ -1,7 +1,7 @@ -From ac3cebb2f0164a56f6e3941b82570ceb7f18985c Mon Sep 17 00:00:00 2001 +From 3dd5cec57d2835e00e69a69f24fa60303216dbda Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Sat, 4 Dec 2021 16:18:26 +0000 -Subject: [PATCH 056/245] ci: Run cross compile on debian stable +Subject: [PATCH 055/249] ci: Run cross compile on debian stable The current debian stable release is Bullseye, not Buster. However, we can use the 'stable' release instead. This would allow the CI to diff --git a/0057-ci-Run-cross-compile-with-debian-testing.patch b/0056-ci-Run-cross-compile-with-debian-testing.patch similarity index 98% rename from 0057-ci-Run-cross-compile-with-debian-testing.patch rename to 0056-ci-Run-cross-compile-with-debian-testing.patch index 1f1bc76..2fd6f74 100644 --- a/0057-ci-Run-cross-compile-with-debian-testing.patch +++ b/0056-ci-Run-cross-compile-with-debian-testing.patch @@ -1,7 +1,7 @@ -From 1f497887c18e123925a759cc4079009c5a0224da Mon Sep 17 00:00:00 2001 +From 28936552df6c83266aa9e8900b5cd92f0aa3a1f7 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Sat, 4 Dec 2021 16:31:34 +0000 -Subject: [PATCH 057/245] ci: Run cross compile with debian testing +Subject: [PATCH 056/249] ci: Run cross compile with debian testing Debian testing has newer compiler version and running cross compilation tests would allow us to catch any compilation diff --git a/0058-make-Explicitly-enable-FPU-on-ARMv7-builds.patch b/0057-make-Explicitly-enable-FPU-on-ARMv7-builds.patch similarity index 92% rename from 0058-make-Explicitly-enable-FPU-on-ARMv7-builds.patch rename to 0057-make-Explicitly-enable-FPU-on-ARMv7-builds.patch index 596aff9..9c1f8ac 100644 --- a/0058-make-Explicitly-enable-FPU-on-ARMv7-builds.patch +++ b/0057-make-Explicitly-enable-FPU-on-ARMv7-builds.patch @@ -1,7 +1,7 @@ -From 0e25a6d2bb43abb2cab4716169dfa34a0c005f4c Mon Sep 17 00:00:00 2001 +From 205ba95597c1f538776e4ed6838f7e082178f5fe Mon Sep 17 00:00:00 2001 From: Salvatore Bonaccorso Date: Sat, 4 Dec 2021 16:59:51 +0000 -Subject: [PATCH 058/245] make: Explicitly enable FPU on ARMv7 builds +Subject: [PATCH 057/249] make: Explicitly enable FPU on ARMv7 builds Starting with gcc-11, Debian's armhf compiler no longer builds with a default -mfpu= option. Instead it enables the FPU via an extension diff --git a/0059-ci-disable-broken-tests-until-fixed.patch b/0058-ci-disable-broken-tests-until-fixed.patch similarity index 95% rename from 0059-ci-disable-broken-tests-until-fixed.patch rename to 0058-ci-disable-broken-tests-until-fixed.patch index 609ee65..3af4a03 100644 --- a/0059-ci-disable-broken-tests-until-fixed.patch +++ b/0058-ci-disable-broken-tests-until-fixed.patch @@ -1,7 +1,7 @@ -From b7c9aa86039a8179e956de31965a3ffd468135da Mon Sep 17 00:00:00 2001 +From d3a8330e09361582888d72a082d5e6fa02f4b9cc Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Fri, 3 Dec 2021 16:48:36 +0000 -Subject: [PATCH 059/245] ci: disable broken tests until fixed +Subject: [PATCH 058/249] ci: disable broken tests until fixed Broken tests are being tracked at diff --git a/0060-test-do-not-use-keep-going-for-single-zdtm-tests.patch b/0059-test-do-not-use-keep-going-for-single-zdtm-tests.patch similarity index 97% rename from 0060-test-do-not-use-keep-going-for-single-zdtm-tests.patch rename to 0059-test-do-not-use-keep-going-for-single-zdtm-tests.patch index 51e2ffa..ead2fbf 100644 --- a/0060-test-do-not-use-keep-going-for-single-zdtm-tests.patch +++ b/0059-test-do-not-use-keep-going-for-single-zdtm-tests.patch @@ -1,7 +1,7 @@ -From f64eb15e2380185fcf3c01dc6630acbe6c3053f6 Mon Sep 17 00:00:00 2001 +From 448c0bdf19285cb7a7fad2872e3f5462ffdeb996 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Sun, 5 Dec 2021 16:45:20 +0000 -Subject: [PATCH 060/245] test: do not use --keep-going for single zdtm tests +Subject: [PATCH 059/249] test: do not use --keep-going for single zdtm tests Looking at CI logs there are often messages like: diff --git a/0061-files-reg-try-dump_ghost_remap-if-link-remap-failed-.patch b/0060-files-reg-try-dump_ghost_remap-if-link-remap-failed-.patch similarity index 97% rename from 0061-files-reg-try-dump_ghost_remap-if-link-remap-failed-.patch rename to 0060-files-reg-try-dump_ghost_remap-if-link-remap-failed-.patch index 643a16c..9f5b630 100644 --- a/0061-files-reg-try-dump_ghost_remap-if-link-remap-failed-.patch +++ b/0060-files-reg-try-dump_ghost_remap-if-link-remap-failed-.patch @@ -1,7 +1,7 @@ -From 3cf39aafb1dcdbcd3c39411a2c6834858860716c Mon Sep 17 00:00:00 2001 +From 6e5fd46d6a30b488ab7f17f0069c598e1f59cdbb Mon Sep 17 00:00:00 2001 From: ianlang Date: Fri, 3 Dec 2021 15:15:30 +0800 -Subject: [PATCH 061/245] files-reg: try dump_ghost_remap if link-remap failed +Subject: [PATCH 060/249] files-reg: try dump_ghost_remap if link-remap failed with error ENOENT An issue with dumping deleted reg files in overlayfs: diff --git a/0062-util-make-page-server-IPv6-safe.patch b/0061-util-make-page-server-IPv6-safe.patch similarity index 93% rename from 0062-util-make-page-server-IPv6-safe.patch rename to 0061-util-make-page-server-IPv6-safe.patch index c6b92fb..cb06f7a 100644 --- a/0062-util-make-page-server-IPv6-safe.patch +++ b/0061-util-make-page-server-IPv6-safe.patch @@ -1,7 +1,7 @@ -From 047d277ff49bfbe3ff7baaedb9b7e37faadd6341 Mon Sep 17 00:00:00 2001 +From a006788dfab8a971218450923a59209c52f4eb88 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Tue, 7 Dec 2021 09:10:14 +0000 -Subject: [PATCH 062/245] util: make page-server IPv6 safe +Subject: [PATCH 061/249] util: make page-server IPv6 safe The function run_tcp_server() was the last place CRIU was still using the IPv4 only function inet_ntoa(). It was only used during a print, so diff --git a/0063-sk-unix-Fix-TCP_ESTABLISHED-checks-in-unix-sockets.patch b/0062-sk-unix-Fix-TCP_ESTABLISHED-checks-in-unix-sockets.patch similarity index 92% rename from 0063-sk-unix-Fix-TCP_ESTABLISHED-checks-in-unix-sockets.patch rename to 0062-sk-unix-Fix-TCP_ESTABLISHED-checks-in-unix-sockets.patch index 6d6e2be..2149781 100644 --- a/0063-sk-unix-Fix-TCP_ESTABLISHED-checks-in-unix-sockets.patch +++ b/0062-sk-unix-Fix-TCP_ESTABLISHED-checks-in-unix-sockets.patch @@ -1,7 +1,7 @@ -From 1470c8037319d2a59eb557ed55175df6abe23eaa Mon Sep 17 00:00:00 2001 +From b6f9c443a78efb50225c2fabd224cea6c71d1c49 Mon Sep 17 00:00:00 2001 From: Bui Quang Minh Date: Thu, 2 Dec 2021 23:01:33 +0700 -Subject: [PATCH 063/245] sk-unix: Fix TCP_ESTABLISHED checks in unix sockets +Subject: [PATCH 062/249] sk-unix: Fix TCP_ESTABLISHED checks in unix sockets Since commit 83301b5367a98 ("af_unix: Set TCP_ESTABLISHED for datagram sockets too") in Linux kernel, SOCK_DGRAM unix sockets can have TCP_ESTABLISHED state diff --git a/0064-ci-Enable-disabled-unix-socket-related-tests.patch b/0063-ci-Enable-disabled-unix-socket-related-tests.patch similarity index 92% rename from 0064-ci-Enable-disabled-unix-socket-related-tests.patch rename to 0063-ci-Enable-disabled-unix-socket-related-tests.patch index 06e9515..e4d66c4 100644 --- a/0064-ci-Enable-disabled-unix-socket-related-tests.patch +++ b/0063-ci-Enable-disabled-unix-socket-related-tests.patch @@ -1,7 +1,7 @@ -From 677a6adba8234c5626fb9595fd32de61ae2b71bc Mon Sep 17 00:00:00 2001 +From c3e4e68b3cab075415f5e500cb884a2e25a434b9 Mon Sep 17 00:00:00 2001 From: Bui Quang Minh Date: Tue, 7 Dec 2021 23:40:12 +0700 -Subject: [PATCH 064/245] ci: Enable disabled unix socket related tests +Subject: [PATCH 063/249] ci: Enable disabled unix socket related tests As the unix socket broken tests have been fixed in the pull request diff --git a/0065-ci-install-procps-in-Alpine.patch b/0064-ci-install-procps-in-Alpine.patch similarity index 85% rename from 0065-ci-install-procps-in-Alpine.patch rename to 0064-ci-install-procps-in-Alpine.patch index 499068e..50cd85a 100644 --- a/0065-ci-install-procps-in-Alpine.patch +++ b/0064-ci-install-procps-in-Alpine.patch @@ -1,7 +1,7 @@ -From 1ec95e91a54670cb30308700bd29085e86668eb0 Mon Sep 17 00:00:00 2001 +From a352d973e7901db8d46322e1cb7fdae5bf920967 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Fri, 10 Dec 2021 15:35:29 +0000 -Subject: [PATCH 065/245] ci: install procps in Alpine +Subject: [PATCH 064/249] ci: install procps in Alpine The version of ps in Alpine image by default is very limited. It is based on the one from busybox and doesn't support options diff --git a/0066-test-another-try-to-correctly-fix-the-kernel-version.patch b/0065-test-another-try-to-correctly-fix-the-kernel-version.patch similarity index 88% rename from 0066-test-another-try-to-correctly-fix-the-kernel-version.patch rename to 0065-test-another-try-to-correctly-fix-the-kernel-version.patch index a24b3a8..3d714df 100644 --- a/0066-test-another-try-to-correctly-fix-the-kernel-version.patch +++ b/0065-test-another-try-to-correctly-fix-the-kernel-version.patch @@ -1,7 +1,7 @@ -From 3b2d70bd75dbd2de8887b00d5e6e4e5a5bbda850 Mon Sep 17 00:00:00 2001 +From 564eaa77e6c780f7dd8195f053a1928447e87b9c Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Fri, 3 Dec 2021 16:59:56 +0000 -Subject: [PATCH 066/245] test: another try to correctly fix the kernel version +Subject: [PATCH 065/249] test: another try to correctly fix the kernel version We try to disable time namespace based testing for kernels older than 5.11. But we fail to come up with the correct if condition. diff --git a/0067-x86-compel-fault-inject-bound-xsave-features-set.patch b/0066-x86-compel-fault-inject-bound-xsave-features-set.patch similarity index 95% rename from 0067-x86-compel-fault-inject-bound-xsave-features-set.patch rename to 0066-x86-compel-fault-inject-bound-xsave-features-set.patch index f0f64f4..30af35b 100644 --- a/0067-x86-compel-fault-inject-bound-xsave-features-set.patch +++ b/0066-x86-compel-fault-inject-bound-xsave-features-set.patch @@ -1,7 +1,7 @@ -From 648babc34a25899a0d29f989d1cdcfb2191a872a Mon Sep 17 00:00:00 2001 +From 41bf30f94b72172e807e4b1ebdc6e7df076b3e75 Mon Sep 17 00:00:00 2001 From: Alexander Mikhalitsyn Date: Mon, 13 Dec 2021 15:19:50 +0300 -Subject: [PATCH 067/245] x86/compel/fault-inject: bound xsave features set +Subject: [PATCH 066/249] x86/compel/fault-inject: bound xsave features set Since e2e8be37 ("x86/compel/fault-inject: Add a fault-injection for corrupting extended regset") diff --git a/0068-x86-compel-fault-inject-print-the-initial-seed.patch b/0067-x86-compel-fault-inject-print-the-initial-seed.patch similarity index 91% rename from 0068-x86-compel-fault-inject-print-the-initial-seed.patch rename to 0067-x86-compel-fault-inject-print-the-initial-seed.patch index 523b21d..87a09e1 100644 --- a/0068-x86-compel-fault-inject-print-the-initial-seed.patch +++ b/0067-x86-compel-fault-inject-print-the-initial-seed.patch @@ -1,7 +1,7 @@ -From 2d5a6e074dd245c44e7bcea37d43f69eddbf4c02 Mon Sep 17 00:00:00 2001 +From eb100eb39cb32d7a559168267a11f5ac9db9c154 Mon Sep 17 00:00:00 2001 From: Alexander Mikhalitsyn Date: Mon, 13 Dec 2021 15:32:00 +0300 -Subject: [PATCH 068/245] x86/compel/fault-inject: print the initial seed +Subject: [PATCH 067/249] x86/compel/fault-inject: print the initial seed Fixes: e2e8be37 ("x86/compel/fault-inject: Add a fault-injection for corrupting extended regset") diff --git a/0069-ci-enable-x86-xsave-fault-injection-tests-back.patch b/0068-ci-enable-x86-xsave-fault-injection-tests-back.patch similarity index 90% rename from 0069-ci-enable-x86-xsave-fault-injection-tests-back.patch rename to 0068-ci-enable-x86-xsave-fault-injection-tests-back.patch index bf26e5b..fb30d03 100644 --- a/0069-ci-enable-x86-xsave-fault-injection-tests-back.patch +++ b/0068-ci-enable-x86-xsave-fault-injection-tests-back.patch @@ -1,7 +1,7 @@ -From 6b22a374016fa980d088e1d93f6330bdfa689433 Mon Sep 17 00:00:00 2001 +From 52cd18643245eb0dfe4cc9d8b21f89e1c8f30d35 Mon Sep 17 00:00:00 2001 From: Alexander Mikhalitsyn Date: Mon, 13 Dec 2021 15:46:47 +0300 -Subject: [PATCH 069/245] ci: enable x86 xsave fault injection tests back +Subject: [PATCH 068/249] ci: enable x86 xsave fault injection tests back Signed-off-by: Alexander Mikhalitsyn --- diff --git a/0070-Add-documentation-for-timeout-option.patch b/0069-Add-documentation-for-timeout-option.patch similarity index 93% rename from 0070-Add-documentation-for-timeout-option.patch rename to 0069-Add-documentation-for-timeout-option.patch index a5b491f..bd3bab8 100644 --- a/0070-Add-documentation-for-timeout-option.patch +++ b/0069-Add-documentation-for-timeout-option.patch @@ -1,7 +1,7 @@ -From 11c6077ebb5e57569844818f104514fa1ba60af1 Mon Sep 17 00:00:00 2001 +From ce3e913a89f979e7d3787dff58351b7ba915bc01 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Tue, 14 Dec 2021 12:54:19 +0000 -Subject: [PATCH 070/245] Add documentation for --timeout option +Subject: [PATCH 069/249] Add documentation for --timeout option The --timeout option was introduced in [1] to prevent criu dump from being able to hang indefinitely and allow users to adjust the time limit diff --git a/0071-usernsd-UNS_FDOUT-should-not-require-an-input-descri.patch b/0070-usernsd-UNS_FDOUT-should-not-require-an-input-descri.patch similarity index 86% rename from 0071-usernsd-UNS_FDOUT-should-not-require-an-input-descri.patch rename to 0070-usernsd-UNS_FDOUT-should-not-require-an-input-descri.patch index 44e3606..1259547 100644 --- a/0071-usernsd-UNS_FDOUT-should-not-require-an-input-descri.patch +++ b/0070-usernsd-UNS_FDOUT-should-not-require-an-input-descri.patch @@ -1,7 +1,7 @@ -From 0c452fee7e3abb8e117bd390610f39b95069dc1b Mon Sep 17 00:00:00 2001 +From d83fe7440c3bce204018bf9167f67bac48118c2a Mon Sep 17 00:00:00 2001 From: Andrei Vagin Date: Tue, 14 Dec 2021 08:19:16 -0800 -Subject: [PATCH 071/245] usernsd: UNS_FDOUT should not require an input +Subject: [PATCH 070/249] usernsd: UNS_FDOUT should not require an input descriptor UNS_FDOUT means only that a userns call will return a file descriptor. diff --git a/0072-libcriu-add-setting-lsm-mount-context-to-libcriu.patch b/0071-libcriu-add-setting-lsm-mount-context-to-libcriu.patch similarity index 94% rename from 0072-libcriu-add-setting-lsm-mount-context-to-libcriu.patch rename to 0071-libcriu-add-setting-lsm-mount-context-to-libcriu.patch index 1e39440..e52b8f1 100644 --- a/0072-libcriu-add-setting-lsm-mount-context-to-libcriu.patch +++ b/0071-libcriu-add-setting-lsm-mount-context-to-libcriu.patch @@ -1,7 +1,7 @@ -From b38e38b2872fcf3d00d3861d0f04a55b28c01ac4 Mon Sep 17 00:00:00 2001 +From bee106f22237800350009d4875be5361c02108c0 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Wed, 1 Dec 2021 11:08:53 +0000 -Subject: [PATCH 072/245] libcriu: add setting lsm-mount-context to libcriu +Subject: [PATCH 071/249] libcriu: add setting lsm-mount-context to libcriu Signed-off-by: Adrian Reber --- diff --git a/0073-ci-use-unstable-release-for-cross-compile.patch b/0072-ci-use-unstable-release-for-cross-compile.patch similarity index 98% rename from 0073-ci-use-unstable-release-for-cross-compile.patch rename to 0072-ci-use-unstable-release-for-cross-compile.patch index 7404f2a..16b9aa3 100644 --- a/0073-ci-use-unstable-release-for-cross-compile.patch +++ b/0072-ci-use-unstable-release-for-cross-compile.patch @@ -1,7 +1,7 @@ -From 031db58a9e9439c49d93f8424b361f3618fb688d Mon Sep 17 00:00:00 2001 +From 564f6313cb85a64460a30123b07197dd98224c32 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Sat, 18 Dec 2021 17:25:17 +0000 -Subject: [PATCH 073/245] ci: use unstable release for cross-compile +Subject: [PATCH 072/249] ci: use unstable release for cross-compile We added cross-compile tests with testing debian release to be able to replicate the error reported in #1653, however, installing build diff --git a/0074-ci-disable-glibc-rseq-support.patch b/0073-ci-disable-glibc-rseq-support.patch similarity index 94% rename from 0074-ci-disable-glibc-rseq-support.patch rename to 0073-ci-disable-glibc-rseq-support.patch index 61e1e77..2a1bfd7 100644 --- a/0074-ci-disable-glibc-rseq-support.patch +++ b/0073-ci-disable-glibc-rseq-support.patch @@ -1,7 +1,7 @@ -From 595b1caf66a8fb61488c98fad4952fbfb3c12aba Mon Sep 17 00:00:00 2001 +From 95e6bc3e53bec3c4f00b7e4ddfab5cf904780dbc Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Fri, 17 Dec 2021 03:01:49 +0000 -Subject: [PATCH 074/245] ci: disable glibc rseq support +Subject: [PATCH 073/249] ci: disable glibc rseq support This patch sets the glibc.pthread.rseq tunable [1] to disable rseq support in glibc as a temporary solution for the problem described in diff --git a/0075-libcriu-add-single-pre-dump-support.patch b/0074-libcriu-add-single-pre-dump-support.patch similarity index 97% rename from 0075-libcriu-add-single-pre-dump-support.patch rename to 0074-libcriu-add-single-pre-dump-support.patch index 3863297..951fe22 100644 --- a/0075-libcriu-add-single-pre-dump-support.patch +++ b/0074-libcriu-add-single-pre-dump-support.patch @@ -1,7 +1,7 @@ -From 9edcc3be3052028de05221edfd18d4b9fb245761 Mon Sep 17 00:00:00 2001 +From 7728a658b207bfa2b4910de7d9781bca993be8dd Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Fri, 3 Dec 2021 14:32:33 +0000 -Subject: [PATCH 075/245] libcriu: add single pre-dump support +Subject: [PATCH 074/249] libcriu: add single pre-dump support In contrast to the CLI it is not possible to do a single pre-dump via RPC and thus libcriu. In cr-service.c pre-dump always goes into a diff --git a/0076-tests-added-test-for-single-pre-dump-support.patch b/0075-tests-added-test-for-single-pre-dump-support.patch similarity index 97% rename from 0076-tests-added-test-for-single-pre-dump-support.patch rename to 0075-tests-added-test-for-single-pre-dump-support.patch index 9dc08d2..6a6d2e1 100644 --- a/0076-tests-added-test-for-single-pre-dump-support.patch +++ b/0075-tests-added-test-for-single-pre-dump-support.patch @@ -1,7 +1,7 @@ -From 0f5b3f1a3e005e50a294bd0601a6e3c99539a1cf Mon Sep 17 00:00:00 2001 +From e9452713606cfdbc9e41c28cde674dcaeaded23a Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Tue, 14 Dec 2021 13:09:19 +0000 -Subject: [PATCH 076/245] tests: added test for single pre-dump support +Subject: [PATCH 075/249] tests: added test for single pre-dump support Signed-off-by: Adrian Reber --- diff --git a/0077-zdtm.py-clean-up-MAKEFLAGS-env-variable-before-runni.patch b/0076-zdtm.py-clean-up-MAKEFLAGS-env-variable-before-runni.patch similarity index 93% rename from 0077-zdtm.py-clean-up-MAKEFLAGS-env-variable-before-runni.patch rename to 0076-zdtm.py-clean-up-MAKEFLAGS-env-variable-before-runni.patch index e7dbbe1..3e41efa 100644 --- a/0077-zdtm.py-clean-up-MAKEFLAGS-env-variable-before-runni.patch +++ b/0076-zdtm.py-clean-up-MAKEFLAGS-env-variable-before-runni.patch @@ -1,7 +1,7 @@ -From bfd24ce3b3f0c1e86001b55492a487db2f75b72d Mon Sep 17 00:00:00 2001 +From f495ba8e621ca3e4875c81f7b4dca0f3e9b79912 Mon Sep 17 00:00:00 2001 From: Alexander Mikhalitsyn Date: Sat, 18 Dec 2021 10:40:11 +0300 -Subject: [PATCH 077/245] zdtm.py: clean up MAKEFLAGS env variable before +Subject: [PATCH 076/249] zdtm.py: clean up MAKEFLAGS env variable before running make instance In most cases we run tests as: diff --git a/0078-zdtm-zdtm_ct-fix-compilation-error-with-strict-proto.patch b/0077-zdtm-zdtm_ct-fix-compilation-error-with-strict-proto.patch similarity index 86% rename from 0078-zdtm-zdtm_ct-fix-compilation-error-with-strict-proto.patch rename to 0077-zdtm-zdtm_ct-fix-compilation-error-with-strict-proto.patch index 6ca59d9..dc74fb7 100644 --- a/0078-zdtm-zdtm_ct-fix-compilation-error-with-strict-proto.patch +++ b/0077-zdtm-zdtm_ct-fix-compilation-error-with-strict-proto.patch @@ -1,7 +1,7 @@ -From cf3e1067f3639426defccf7b322da1eb7a05ca21 Mon Sep 17 00:00:00 2001 +From d1c2c801af398dbf95fc693cf3baa3f24a8741ec Mon Sep 17 00:00:00 2001 From: Alexander Mikhalitsyn Date: Sat, 18 Dec 2021 11:03:53 +0300 -Subject: [PATCH 078/245] zdtm: zdtm_ct fix compilation error with +Subject: [PATCH 077/249] zdtm: zdtm_ct fix compilation error with strict-prototypes on MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 diff --git a/0079-zdtm-remove-mntns-deleted-dst-test-leftover-from-git.patch b/0078-zdtm-remove-mntns-deleted-dst-test-leftover-from-git.patch similarity index 82% rename from 0079-zdtm-remove-mntns-deleted-dst-test-leftover-from-git.patch rename to 0078-zdtm-remove-mntns-deleted-dst-test-leftover-from-git.patch index 1182267..358d5fd 100644 --- a/0079-zdtm-remove-mntns-deleted-dst-test-leftover-from-git.patch +++ b/0078-zdtm-remove-mntns-deleted-dst-test-leftover-from-git.patch @@ -1,7 +1,7 @@ -From 077c823160b35e94fd6e68d993c4abefecbb2083 Mon Sep 17 00:00:00 2001 +From cbc53fdb2d10f56c74abeff6b1ecb8374b38b84b Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Fri, 17 Dec 2021 15:33:55 +0300 -Subject: [PATCH 079/245] zdtm: remove mntns-deleted-dst test leftover from git +Subject: [PATCH 078/249] zdtm: remove mntns-deleted-dst test leftover from git Looks like in commit [1] we've non-intentionally added this tmp file to git, let's remove it. diff --git a/0080-crtools-remove-excess-always-true-condition.patch b/0079-crtools-remove-excess-always-true-condition.patch similarity index 85% rename from 0080-crtools-remove-excess-always-true-condition.patch rename to 0079-crtools-remove-excess-always-true-condition.patch index 6adf370..ef4692f 100644 --- a/0080-crtools-remove-excess-always-true-condition.patch +++ b/0079-crtools-remove-excess-always-true-condition.patch @@ -1,7 +1,7 @@ -From 3f3cad68232130c52c528b6eb977fdd379fcded6 Mon Sep 17 00:00:00 2001 +From cf7485318cdcdb47e912ca7d53ab8965d5518b63 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Fri, 10 Dec 2021 15:34:19 +0300 -Subject: [PATCH 080/245] crtools: remove excess always true condition +Subject: [PATCH 079/249] crtools: remove excess always true condition Several lines above if (optind >= argc) we go to usage label and fail, thus we don't need to check (optind < argc) here as it is always true. diff --git a/0081-crtools-rpc-export-current-criu-mode-to-opts.mode.patch b/0080-crtools-rpc-export-current-criu-mode-to-opts.mode.patch similarity index 98% rename from 0081-crtools-rpc-export-current-criu-mode-to-opts.mode.patch rename to 0080-crtools-rpc-export-current-criu-mode-to-opts.mode.patch index 04b7d71..7c27a7d 100644 --- a/0081-crtools-rpc-export-current-criu-mode-to-opts.mode.patch +++ b/0080-crtools-rpc-export-current-criu-mode-to-opts.mode.patch @@ -1,7 +1,7 @@ -From fe0929766ede95a4f5cc07ec28c288f2d2699448 Mon Sep 17 00:00:00 2001 +From 3adaf3c4434995ce81530a336469ec792c62cc1b Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Fri, 10 Dec 2021 12:13:06 +0300 -Subject: [PATCH 081/245] crtools/rpc: export current criu mode to opts.mode +Subject: [PATCH 080/249] crtools/rpc: export current criu mode to opts.mode We have multiple options which are valid only on restore or only on dump or in any other specific criu mode, so it would be useful to have info diff --git a/0082-crtools-use-new-opts.mode-in-image_dir_mode.patch b/0081-crtools-use-new-opts.mode-in-image_dir_mode.patch similarity index 90% rename from 0082-crtools-use-new-opts.mode-in-image_dir_mode.patch rename to 0081-crtools-use-new-opts.mode-in-image_dir_mode.patch index 116deaf..d58ae92 100644 --- a/0082-crtools-use-new-opts.mode-in-image_dir_mode.patch +++ b/0081-crtools-use-new-opts.mode-in-image_dir_mode.patch @@ -1,7 +1,7 @@ -From bec81335ad40077e8194c3bf7b9c9fa31098046f Mon Sep 17 00:00:00 2001 +From 02e3280066d2d44a520d1ef4dd7128e80182c66b Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Wed, 15 Dec 2021 10:49:42 +0300 -Subject: [PATCH 082/245] crtools: use new opts.mode in image_dir_mode +Subject: [PATCH 081/249] crtools: use new opts.mode in image_dir_mode Also while on it there is no "cpuinfo restore", let's remove it. diff --git a/0083-crtools-check-that-cpuinfo-command-has-sub-command.patch b/0082-crtools-check-that-cpuinfo-command-has-sub-command.patch similarity index 86% rename from 0083-crtools-check-that-cpuinfo-command-has-sub-command.patch rename to 0082-crtools-check-that-cpuinfo-command-has-sub-command.patch index 8539a1a..6dba131 100644 --- a/0083-crtools-check-that-cpuinfo-command-has-sub-command.patch +++ b/0082-crtools-check-that-cpuinfo-command-has-sub-command.patch @@ -1,7 +1,7 @@ -From ab85c0944536729aa49b27ca80d14fe9eb5ce66e Mon Sep 17 00:00:00 2001 +From 37b42d0edbba16460c6190f7e7dd42f6fef7e299 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 16 Dec 2021 18:05:01 +0300 -Subject: [PATCH 083/245] crtools: check that cpuinfo command has sub-command +Subject: [PATCH 082/249] crtools: check that cpuinfo command has sub-command This fixes segfault on empty sub-command for cpuinfo. diff --git a/0084-sk-unix-Add-support-for-SOCK_SEQPACKET-unix-sockets.patch b/0083-sk-unix-Add-support-for-SOCK_SEQPACKET-unix-sockets.patch similarity index 93% rename from 0084-sk-unix-Add-support-for-SOCK_SEQPACKET-unix-sockets.patch rename to 0083-sk-unix-Add-support-for-SOCK_SEQPACKET-unix-sockets.patch index 8ffb163..d30b49b 100644 --- a/0084-sk-unix-Add-support-for-SOCK_SEQPACKET-unix-sockets.patch +++ b/0083-sk-unix-Add-support-for-SOCK_SEQPACKET-unix-sockets.patch @@ -1,7 +1,7 @@ -From 96bc16b15d06d6176fc8bc95cd4db815cd9ad536 Mon Sep 17 00:00:00 2001 +From 858aac29618d89b898af87d9e05169361453beba Mon Sep 17 00:00:00 2001 From: Bui Quang Minh Date: Tue, 14 Dec 2021 22:28:27 +0700 -Subject: [PATCH 084/245] sk-unix: Add support for SOCK_SEQPACKET unix sockets +Subject: [PATCH 083/249] sk-unix: Add support for SOCK_SEQPACKET unix sockets Adjust some SOCK_STREAM cases to handle SOCK_SEQPACKET too. diff --git a/0085-zdtm-Add-SOCK_SEQPACKET-variants-to-unix-socket-test.patch b/0084-zdtm-Add-SOCK_SEQPACKET-variants-to-unix-socket-test.patch similarity index 99% rename from 0085-zdtm-Add-SOCK_SEQPACKET-variants-to-unix-socket-test.patch rename to 0084-zdtm-Add-SOCK_SEQPACKET-variants-to-unix-socket-test.patch index 7434e75..6e40de0 100644 --- a/0085-zdtm-Add-SOCK_SEQPACKET-variants-to-unix-socket-test.patch +++ b/0084-zdtm-Add-SOCK_SEQPACKET-variants-to-unix-socket-test.patch @@ -1,7 +1,7 @@ -From 315619c91047dce2fc11e4dbb074d31fcd409327 Mon Sep 17 00:00:00 2001 +From 2d459717d161abb3330133a8f00ac7b4b9672c42 Mon Sep 17 00:00:00 2001 From: Bui Quang Minh Date: Thu, 16 Dec 2021 09:35:25 +0700 -Subject: [PATCH 085/245] zdtm: Add SOCK_SEQPACKET variants to unix socket +Subject: [PATCH 084/249] zdtm: Add SOCK_SEQPACKET variants to unix socket tests This commit simply makes copies of SOCK_STREAM unix socket tests and uses diff --git a/0086-tls-fix-typo.patch b/0085-tls-fix-typo.patch similarity index 85% rename from 0086-tls-fix-typo.patch rename to 0085-tls-fix-typo.patch index f53aed2..0824a2d 100644 --- a/0086-tls-fix-typo.patch +++ b/0085-tls-fix-typo.patch @@ -1,7 +1,7 @@ -From 64178a1c7fa4ce1107074520392b98906672317f Mon Sep 17 00:00:00 2001 +From 8bbfee99809952bf6eadd5e0142fe8b2e97cf6f6 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Tue, 7 Dec 2021 21:29:44 +0000 -Subject: [PATCH 086/245] tls: fix typo +Subject: [PATCH 085/249] tls: fix typo Signed-off-by: Radostin Stoyanov --- diff --git a/0087-tls-use-ssize_t-for-return-value.patch b/0086-tls-use-ssize_t-for-return-value.patch similarity index 93% rename from 0087-tls-use-ssize_t-for-return-value.patch rename to 0086-tls-use-ssize_t-for-return-value.patch index f1fad8f..7dc904f 100644 --- a/0087-tls-use-ssize_t-for-return-value.patch +++ b/0086-tls-use-ssize_t-for-return-value.patch @@ -1,7 +1,7 @@ -From 71221e60aa8465e6794d749ef8d5dd404416a17d Mon Sep 17 00:00:00 2001 +From 311328d1c2a5715bd091ec6cad7cb0d32af99b26 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Tue, 7 Dec 2021 22:32:54 +0000 -Subject: [PATCH 087/245] tls: use ssize_t for return value +Subject: [PATCH 086/249] tls: use ssize_t for return value Signed-off-by: Radostin Stoyanov --- diff --git a/0088-tls-add-more-comments.patch b/0087-tls-add-more-comments.patch similarity index 96% rename from 0088-tls-add-more-comments.patch rename to 0087-tls-add-more-comments.patch index 3a3a007..2053693 100644 --- a/0088-tls-add-more-comments.patch +++ b/0087-tls-add-more-comments.patch @@ -1,7 +1,7 @@ -From 7451db84fbabc4efa4eec9eb1f0302af11c5ccd1 Mon Sep 17 00:00:00 2001 +From 5e48487aaf227c1e3be2b742956579c177e8b5bd Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Thu, 16 Dec 2021 14:26:53 +0000 -Subject: [PATCH 088/245] tls: add more comments +Subject: [PATCH 087/249] tls: add more comments Signed-off-by: Radostin Stoyanov --- diff --git a/0089-uffd-call-disconnect_from_page_server-to-shutdown-a-.patch b/0088-uffd-call-disconnect_from_page_server-to-shutdown-a-.patch similarity index 84% rename from 0089-uffd-call-disconnect_from_page_server-to-shutdown-a-.patch rename to 0088-uffd-call-disconnect_from_page_server-to-shutdown-a-.patch index 217cc3c..53aad96 100644 --- a/0089-uffd-call-disconnect_from_page_server-to-shutdown-a-.patch +++ b/0088-uffd-call-disconnect_from_page_server-to-shutdown-a-.patch @@ -1,7 +1,7 @@ -From 58b97c0ae5bbeeac50dc83fb79a7b55bf2b8e683 Mon Sep 17 00:00:00 2001 +From 00f2efee03869d2494ed10333372eb401ab27546 Mon Sep 17 00:00:00 2001 From: Andrei Vagin Date: Tue, 21 Dec 2021 21:59:13 -0800 -Subject: [PATCH 089/245] uffd: call disconnect_from_page_server to shutdown a +Subject: [PATCH 088/249] uffd: call disconnect_from_page_server to shutdown a page-server connection We need to be sure that page-server doesn't wait for a new command when we diff --git a/0090-tls-allow-to-terminate-connections-synchronously.patch b/0089-tls-allow-to-terminate-connections-synchronously.patch similarity index 95% rename from 0090-tls-allow-to-terminate-connections-synchronously.patch rename to 0089-tls-allow-to-terminate-connections-synchronously.patch index d124bde..da4caec 100644 --- a/0090-tls-allow-to-terminate-connections-synchronously.patch +++ b/0089-tls-allow-to-terminate-connections-synchronously.patch @@ -1,7 +1,7 @@ -From 6e2b052636e3f57b22302db21bd5c6d8eba9ba8b Mon Sep 17 00:00:00 2001 +From 89c24a1324e6d77f064465bbd2b45d717b07d252 Mon Sep 17 00:00:00 2001 From: Andrei Vagin Date: Wed, 22 Dec 2021 09:36:09 -0800 -Subject: [PATCH 090/245] tls: allow to terminate connections synchronously +Subject: [PATCH 089/249] tls: allow to terminate connections synchronously GNUTLS_SHUT_RDWR sends an alert containing a close request and waits for the peer to reply with the same message. diff --git a/0091-page-xfer-stop-waiting-for-a-new-command-after-a-clo.patch b/0090-page-xfer-stop-waiting-for-a-new-command-after-a-clo.patch similarity index 92% rename from 0091-page-xfer-stop-waiting-for-a-new-command-after-a-clo.patch rename to 0090-page-xfer-stop-waiting-for-a-new-command-after-a-clo.patch index f46b223..3909e69 100644 --- a/0091-page-xfer-stop-waiting-for-a-new-command-after-a-clo.patch +++ b/0090-page-xfer-stop-waiting-for-a-new-command-after-a-clo.patch @@ -1,7 +1,7 @@ -From 80aff4e7b4c7331bd7724939389539c2eb6e8e85 Mon Sep 17 00:00:00 2001 +From 02d8540a973ca5a045eac67c95cd3667ccb12579 Mon Sep 17 00:00:00 2001 From: Andrei Vagin Date: Wed, 22 Dec 2021 09:59:11 -0800 -Subject: [PATCH 091/245] page-xfer: stop waiting for a new command after a +Subject: [PATCH 090/249] page-xfer: stop waiting for a new command after a close command There is no reason to do that and in case of tls, __recv returns EAGAIN diff --git a/0092-ci-reenable-the-lazy-thp-test-in-the-lazy-remote-mod.patch b/0091-ci-reenable-the-lazy-thp-test-in-the-lazy-remote-mod.patch similarity index 88% rename from 0092-ci-reenable-the-lazy-thp-test-in-the-lazy-remote-mod.patch rename to 0091-ci-reenable-the-lazy-thp-test-in-the-lazy-remote-mod.patch index 9aa082e..718e3d1 100644 --- a/0092-ci-reenable-the-lazy-thp-test-in-the-lazy-remote-mod.patch +++ b/0091-ci-reenable-the-lazy-thp-test-in-the-lazy-remote-mod.patch @@ -1,7 +1,7 @@ -From 0c7a9e1c464ac6b1c497b27fc5989ece8e286771 Mon Sep 17 00:00:00 2001 +From 5132edbd018755985e664b8a4ee230265ac8c1eb Mon Sep 17 00:00:00 2001 From: Andrei Vagin Date: Wed, 22 Dec 2021 17:03:04 -0800 -Subject: [PATCH 092/245] ci: reenable the lazy-thp test in the lazy-remote +Subject: [PATCH 091/249] ci: reenable the lazy-thp test in the lazy-remote mode Signed-off-by: Andrei Vagin diff --git a/0093-test-log-testname.out.inprogress-if-a-test-has-faile.patch b/0092-test-log-testname.out.inprogress-if-a-test-has-faile.patch similarity index 89% rename from 0093-test-log-testname.out.inprogress-if-a-test-has-faile.patch rename to 0092-test-log-testname.out.inprogress-if-a-test-has-faile.patch index acd9867..10ab76c 100644 --- a/0093-test-log-testname.out.inprogress-if-a-test-has-faile.patch +++ b/0092-test-log-testname.out.inprogress-if-a-test-has-faile.patch @@ -1,7 +1,7 @@ -From 5f907445551685bd30af7567c08662f7100a0d70 Mon Sep 17 00:00:00 2001 +From e826db402697888e3cf4910fc9de6138c7e1dcf0 Mon Sep 17 00:00:00 2001 From: Andrei Vagin Date: Wed, 22 Dec 2021 17:06:21 -0800 -Subject: [PATCH 093/245] test: log testname.out.inprogress if a test has +Subject: [PATCH 092/249] test: log testname.out.inprogress if a test has failed This is required if the test failed by timeout. diff --git a/0094-zdtm-print-tails-of-all-logs-if-a-test-has-failed.patch b/0093-zdtm-print-tails-of-all-logs-if-a-test-has-failed.patch similarity index 92% rename from 0094-zdtm-print-tails-of-all-logs-if-a-test-has-failed.patch rename to 0093-zdtm-print-tails-of-all-logs-if-a-test-has-failed.patch index 3967d1a..c000115 100644 --- a/0094-zdtm-print-tails-of-all-logs-if-a-test-has-failed.patch +++ b/0093-zdtm-print-tails-of-all-logs-if-a-test-has-failed.patch @@ -1,7 +1,7 @@ -From cb604bacff3e469d53fd39e63d13e98cd460b9cb Mon Sep 17 00:00:00 2001 +From e7296cd2c631aec1b34b1411bd01b38b4a251b2b Mon Sep 17 00:00:00 2001 From: Andrei Vagin Date: Wed, 22 Dec 2021 17:08:16 -0800 -Subject: [PATCH 094/245] zdtm: print tails of all logs if a test has failed +Subject: [PATCH 093/249] zdtm: print tails of all logs if a test has failed Signed-off-by: Andrei Vagin --- diff --git a/0095-zdtm-static-uffd-events-add-more-log-messages.patch b/0094-zdtm-static-uffd-events-add-more-log-messages.patch similarity index 90% rename from 0095-zdtm-static-uffd-events-add-more-log-messages.patch rename to 0094-zdtm-static-uffd-events-add-more-log-messages.patch index 8e80c73..7aed029 100644 --- a/0095-zdtm-static-uffd-events-add-more-log-messages.patch +++ b/0094-zdtm-static-uffd-events-add-more-log-messages.patch @@ -1,7 +1,7 @@ -From c36dbb082e60a4a267502cf73661eec78eb8d034 Mon Sep 17 00:00:00 2001 +From 32375bb1e4dd58c630f0e15e83c6056fffab7176 Mon Sep 17 00:00:00 2001 From: Andrei Vagin Date: Wed, 22 Dec 2021 17:08:42 -0800 -Subject: [PATCH 095/245] zdtm/static/uffd-events: add more log messages +Subject: [PATCH 094/249] zdtm/static/uffd-events: add more log messages Signed-off-by: Andrei Vagin --- diff --git a/0096-mount-split-check_mountpoint_fd-from-__open_mountpoi.patch b/0095-mount-split-check_mountpoint_fd-from-__open_mountpoi.patch similarity index 96% rename from 0096-mount-split-check_mountpoint_fd-from-__open_mountpoi.patch rename to 0095-mount-split-check_mountpoint_fd-from-__open_mountpoi.patch index 4413302..25c035b 100644 --- a/0096-mount-split-check_mountpoint_fd-from-__open_mountpoi.patch +++ b/0095-mount-split-check_mountpoint_fd-from-__open_mountpoi.patch @@ -1,7 +1,7 @@ -From 3e716ab20a6de56bce5ac7d66d67e7c3507facae Mon Sep 17 00:00:00 2001 +From 609533a1d54d27fe96e4adad569716e70c38efa2 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Fri, 17 Dec 2021 14:58:47 +0300 -Subject: [PATCH 096/245] mount: split check_mountpoint_fd from +Subject: [PATCH 095/249] mount: split check_mountpoint_fd from __open_mountpoint Now we can reuse "check" part separately in other places. diff --git a/0097-mount-remove-mnt_fd-argument-of-__open_mountpoint.patch b/0096-mount-remove-mnt_fd-argument-of-__open_mountpoint.patch similarity index 96% rename from 0097-mount-remove-mnt_fd-argument-of-__open_mountpoint.patch rename to 0096-mount-remove-mnt_fd-argument-of-__open_mountpoint.patch index 11974c4..c2b19f6 100644 --- a/0097-mount-remove-mnt_fd-argument-of-__open_mountpoint.patch +++ b/0096-mount-remove-mnt_fd-argument-of-__open_mountpoint.patch @@ -1,7 +1,7 @@ -From e1d20922e907d173d7f3308c00440d93e21bb568 Mon Sep 17 00:00:00 2001 +From 518f18aa83523d218073d100c4aa0f482ec60b53 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Fri, 17 Dec 2021 15:13:35 +0300 -Subject: [PATCH 097/245] mount: remove mnt_fd argument of __open_mountpoint +Subject: [PATCH 096/249] mount: remove mnt_fd argument of __open_mountpoint Only place where we used __open_mountpoint with non -1 mnt_fd is open_mountpoint. Let's use check_mountpoint_fd for this case, so that we diff --git a/0098-proc_parse-add-helper-to-resolve-sdev-from-fd.patch b/0097-proc_parse-add-helper-to-resolve-sdev-from-fd.patch similarity index 95% rename from 0098-proc_parse-add-helper-to-resolve-sdev-from-fd.patch rename to 0097-proc_parse-add-helper-to-resolve-sdev-from-fd.patch index 9ad0640..099f6bc 100644 --- a/0098-proc_parse-add-helper-to-resolve-sdev-from-fd.patch +++ b/0097-proc_parse-add-helper-to-resolve-sdev-from-fd.patch @@ -1,7 +1,7 @@ -From 7b3b76f8d1650e3f208bfd85583755376b30b93a Mon Sep 17 00:00:00 2001 +From c573260ced3929d3c84d51e7073f3636d44ba69f Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 16 Dec 2021 16:14:41 +0300 -Subject: [PATCH 098/245] proc_parse: add helper to resolve sdev from fd +Subject: [PATCH 097/249] proc_parse: add helper to resolve sdev from fd New get_sdev_from_fd helper first gets mnt_id from fd using fdinfo and then converts mnt_id to sdev using mountinfo. diff --git a/0099-mount-btrfs-make-check_mountpoint_fd-fallback-to-get.patch b/0098-mount-btrfs-make-check_mountpoint_fd-fallback-to-get.patch similarity index 97% rename from 0099-mount-btrfs-make-check_mountpoint_fd-fallback-to-get.patch rename to 0098-mount-btrfs-make-check_mountpoint_fd-fallback-to-get.patch index 011264b..1bc79e3 100644 --- a/0099-mount-btrfs-make-check_mountpoint_fd-fallback-to-get.patch +++ b/0098-mount-btrfs-make-check_mountpoint_fd-fallback-to-get.patch @@ -1,7 +1,7 @@ -From ce0be851f296738bb10043477a52250502394182 Mon Sep 17 00:00:00 2001 +From 84b0b31a06a51f5620f53395c8496108879010af Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 16 Dec 2021 12:57:23 +0300 -Subject: [PATCH 099/245] mount/btrfs: make check_mountpoint_fd fallback to +Subject: [PATCH 098/249] mount/btrfs: make check_mountpoint_fd fallback to get_sdev_from_fd We face that btrfs returns anonymous device in stat instead of real diff --git a/0100-ci-test-criu-image-streamer-with-all-tests.patch b/0099-ci-test-criu-image-streamer-with-all-tests.patch similarity index 88% rename from 0100-ci-test-criu-image-streamer-with-all-tests.patch rename to 0099-ci-test-criu-image-streamer-with-all-tests.patch index 98d26c3..b46fa0e 100644 --- a/0100-ci-test-criu-image-streamer-with-all-tests.patch +++ b/0099-ci-test-criu-image-streamer-with-all-tests.patch @@ -1,7 +1,7 @@ -From b003ce7cb55f656c3c29fee5cb3021213463910f Mon Sep 17 00:00:00 2001 +From b635de93ce372b8e3bea213ecd743e26251d7a9a Mon Sep 17 00:00:00 2001 From: Nicolas Viennot Date: Tue, 28 Dec 2021 19:30:09 +0000 -Subject: [PATCH 100/245] ci: test criu-image-streamer with all tests +Subject: [PATCH 099/249] ci: test criu-image-streamer with all tests All the bugs that were in the way got fixed. We can enable all tests. diff --git a/0101-readme-add-docker-test-badge.patch b/0100-readme-add-docker-test-badge.patch similarity index 89% rename from 0101-readme-add-docker-test-badge.patch rename to 0100-readme-add-docker-test-badge.patch index 06d81f5..437cbd6 100644 --- a/0101-readme-add-docker-test-badge.patch +++ b/0100-readme-add-docker-test-badge.patch @@ -1,7 +1,7 @@ -From 616e9d9f937d7adf49573f2e15b9edd6aed9ba46 Mon Sep 17 00:00:00 2001 +From dc89784e542bdbc034eb7503e25dd4d695b3242c Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Mon, 10 Jan 2022 10:37:19 +0000 -Subject: [PATCH 101/245] readme: add docker test badge +Subject: [PATCH 100/249] readme: add docker test badge Signed-off-by: Radostin Stoyanov --- diff --git a/0102-contributing-remove-old-badges-and-logo.patch b/0101-contributing-remove-old-badges-and-logo.patch similarity index 90% rename from 0102-contributing-remove-old-badges-and-logo.patch rename to 0101-contributing-remove-old-badges-and-logo.patch index 847b08c..8908915 100644 --- a/0102-contributing-remove-old-badges-and-logo.patch +++ b/0101-contributing-remove-old-badges-and-logo.patch @@ -1,7 +1,7 @@ -From d6d3e35c7ca3d1cc838b95d36dc224edd2d23942 Mon Sep 17 00:00:00 2001 +From 69f24c0a35c7980fdbedfcc1fe903ca0fe2e86c5 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Mon, 10 Jan 2022 10:37:52 +0000 -Subject: [PATCH 102/245] contributing: remove old badges and logo +Subject: [PATCH 101/249] contributing: remove old badges and logo CI badges and logo are already present in the readme file. diff --git a/0103-ci-update-to-latest-Vagrant-and-Fedora-images.patch b/0102-ci-update-to-latest-Vagrant-and-Fedora-images.patch similarity index 87% rename from 0103-ci-update-to-latest-Vagrant-and-Fedora-images.patch rename to 0102-ci-update-to-latest-Vagrant-and-Fedora-images.patch index 3b3d754..ce66485 100644 --- a/0103-ci-update-to-latest-Vagrant-and-Fedora-images.patch +++ b/0102-ci-update-to-latest-Vagrant-and-Fedora-images.patch @@ -1,7 +1,7 @@ -From 673373c3bc8ff0e464b2392cfe4aab5e67748454 Mon Sep 17 00:00:00 2001 +From 85648ff4af95a547c95a2afaf93a56bc059348af Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Fri, 3 Dec 2021 17:13:27 +0000 -Subject: [PATCH 103/245] ci: update to latest Vagrant and Fedora images +Subject: [PATCH 102/249] ci: update to latest Vagrant and Fedora images Signed-off-by: Adrian Reber --- diff --git a/0104-ci-added-.lgtm.yml-file.patch b/0103-ci-added-.lgtm.yml-file.patch similarity index 92% rename from 0104-ci-added-.lgtm.yml-file.patch rename to 0103-ci-added-.lgtm.yml-file.patch index 0ba086c..a5c1b82 100644 --- a/0104-ci-added-.lgtm.yml-file.patch +++ b/0103-ci-added-.lgtm.yml-file.patch @@ -1,7 +1,7 @@ -From 2af4e839804f5f60e080dd3667d8acf0682502dd Mon Sep 17 00:00:00 2001 +From f697623efc8f8f050402c8009e7ac4c2f72a7d0d Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Sun, 16 Jan 2022 11:17:33 +0000 -Subject: [PATCH 104/245] ci: added .lgtm.yml file +Subject: [PATCH 103/249] ci: added .lgtm.yml file A couple of months (or years) ago I looked into lgtm.com for CRIU. Today on a pull request I saw result from lgtm.com for the first time and it diff --git a/0105-lib-introduce-feature-check-in-libcriu.patch b/0104-lib-introduce-feature-check-in-libcriu.patch similarity index 97% rename from 0105-lib-introduce-feature-check-in-libcriu.patch rename to 0104-lib-introduce-feature-check-in-libcriu.patch index 66897bb..8a48f79 100644 --- a/0105-lib-introduce-feature-check-in-libcriu.patch +++ b/0104-lib-introduce-feature-check-in-libcriu.patch @@ -1,7 +1,7 @@ -From 0a26cde1b8b454b64951ce1b0b67c937e2188241 Mon Sep 17 00:00:00 2001 +From 421c8eab8f79ce4e70b34dcaa2e51524683e5cb3 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Mon, 6 Dec 2021 16:51:21 +0000 -Subject: [PATCH 105/245] lib: introduce feature check in libcriu +Subject: [PATCH 104/249] lib: introduce feature check in libcriu This commit adds feature check support to libcriu. It already exists in the CLI and RPC and this just extends it to libcriu. diff --git a/0106-lib-added-tests-for-feature-check-in-libcriu.patch b/0105-lib-added-tests-for-feature-check-in-libcriu.patch similarity index 96% rename from 0106-lib-added-tests-for-feature-check-in-libcriu.patch rename to 0105-lib-added-tests-for-feature-check-in-libcriu.patch index 9556617..3c5a491 100644 --- a/0106-lib-added-tests-for-feature-check-in-libcriu.patch +++ b/0105-lib-added-tests-for-feature-check-in-libcriu.patch @@ -1,7 +1,7 @@ -From edb88c7c7bddc69e03130507f2f96e03e930c0c0 Mon Sep 17 00:00:00 2001 +From 6fd677682716d80b3a082aba530e021e7c02b078 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Mon, 6 Dec 2021 16:51:21 +0000 -Subject: [PATCH 106/245] lib: added tests for feature check in libcriu +Subject: [PATCH 105/249] lib: added tests for feature check in libcriu Signed-off-by: Adrian Reber --- diff --git a/0107-pagemap-tiny-fix-on-truncating-memory-image.patch b/0106-pagemap-tiny-fix-on-truncating-memory-image.patch similarity index 93% rename from 0107-pagemap-tiny-fix-on-truncating-memory-image.patch rename to 0106-pagemap-tiny-fix-on-truncating-memory-image.patch index f6b6504..c845efb 100644 --- a/0107-pagemap-tiny-fix-on-truncating-memory-image.patch +++ b/0106-pagemap-tiny-fix-on-truncating-memory-image.patch @@ -1,7 +1,7 @@ -From 9df7dbdc6168918a8bbf401631885cd14eba62fe Mon Sep 17 00:00:00 2001 +From 7bf62eb79d70296a375e98e1b7b241ad7faecb55 Mon Sep 17 00:00:00 2001 From: Liu Hua Date: Thu, 6 Jan 2022 20:44:21 +0800 -Subject: [PATCH 107/245] pagemap: tiny fix on truncating memory image +Subject: [PATCH 106/249] pagemap: tiny fix on truncating memory image When requested iovs are huge, criu needs to invoke more then one preadv()s. In this situation criu truncates memory image with diff --git a/0108-zdtm-fix-zdtm-static-maps00-case-in-arm64.patch b/0107-zdtm-fix-zdtm-static-maps00-case-in-arm64.patch similarity index 91% rename from 0108-zdtm-fix-zdtm-static-maps00-case-in-arm64.patch rename to 0107-zdtm-fix-zdtm-static-maps00-case-in-arm64.patch index 6c9dcb4..33cd903 100644 --- a/0108-zdtm-fix-zdtm-static-maps00-case-in-arm64.patch +++ b/0107-zdtm-fix-zdtm-static-maps00-case-in-arm64.patch @@ -1,7 +1,7 @@ -From 996178e6696ddf3a4a18eeca0c6a3c58a38b07e1 Mon Sep 17 00:00:00 2001 +From aae40f3a5307856e3409a4200c6cbafa624cbaec Mon Sep 17 00:00:00 2001 From: "fu.lin" Date: Sun, 16 Jan 2022 18:37:09 +0800 -Subject: [PATCH 108/245] zdtm: fix zdtm/static/maps00 case in arm64 +Subject: [PATCH 107/249] zdtm: fix zdtm/static/maps00 case in arm64 This case sometimes will cause SIGILL signal in arm64 platform. diff --git a/0109-compel-fix-GCC-12-failure-out-of-bounds.patch b/0108-compel-fix-GCC-12-failure-out-of-bounds.patch similarity index 95% rename from 0109-compel-fix-GCC-12-failure-out-of-bounds.patch rename to 0108-compel-fix-GCC-12-failure-out-of-bounds.patch index 08b86ad..109118d 100644 --- a/0109-compel-fix-GCC-12-failure-out-of-bounds.patch +++ b/0108-compel-fix-GCC-12-failure-out-of-bounds.patch @@ -1,7 +1,7 @@ -From 0f99b5243eedf276479a92fbf9213eb15a3c241a Mon Sep 17 00:00:00 2001 +From 81233d507af42ad79ef53eaaa60d1893ac19c2ef Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Tue, 18 Jan 2022 16:49:40 +0000 -Subject: [PATCH 109/245] compel: fix GCC 12 failure (out of bounds) +Subject: [PATCH 108/249] compel: fix GCC 12 failure (out of bounds) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit diff --git a/0110-criu-fix-configuration-file-scanner-with-GCC-12.patch b/0109-criu-fix-configuration-file-scanner-with-GCC-12.patch similarity index 90% rename from 0110-criu-fix-configuration-file-scanner-with-GCC-12.patch rename to 0109-criu-fix-configuration-file-scanner-with-GCC-12.patch index 118f397..b8af6eb 100644 --- a/0110-criu-fix-configuration-file-scanner-with-GCC-12.patch +++ b/0109-criu-fix-configuration-file-scanner-with-GCC-12.patch @@ -1,7 +1,7 @@ -From d7576bbbae2fbf9eafd81d26203ddcd71698b750 Mon Sep 17 00:00:00 2001 +From 631997ebe61f261a240e804cf30e95d03f78582d Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Tue, 18 Jan 2022 17:20:35 +0000 -Subject: [PATCH 110/245] criu: fix configuration file scanner with GCC 12 +Subject: [PATCH 109/249] criu: fix configuration file scanner with GCC 12 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit diff --git a/0111-compel-fix-parasite-with-GCC-12.patch b/0110-compel-fix-parasite-with-GCC-12.patch similarity index 91% rename from 0111-compel-fix-parasite-with-GCC-12.patch rename to 0110-compel-fix-parasite-with-GCC-12.patch index 734b267..7b036c3 100644 --- a/0111-compel-fix-parasite-with-GCC-12.patch +++ b/0110-compel-fix-parasite-with-GCC-12.patch @@ -1,7 +1,7 @@ -From 0d33fb189ff89b80e40a82b70e9357df1f5482b2 Mon Sep 17 00:00:00 2001 +From 72435f60d52ea5fe44ff330c6e30a1b9d05b74f2 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Tue, 18 Jan 2022 17:22:46 +0000 -Subject: [PATCH 111/245] compel: fix parasite with GCC 12 +Subject: [PATCH 110/249] compel: fix parasite with GCC 12 Parasite creation started to fail with GCC 12: diff --git a/0112-ci-set-continue-on-error-for-cross-compile.patch b/0111-ci-set-continue-on-error-for-cross-compile.patch similarity index 91% rename from 0112-ci-set-continue-on-error-for-cross-compile.patch rename to 0111-ci-set-continue-on-error-for-cross-compile.patch index 6ed4ca4..d2d06a1 100644 --- a/0112-ci-set-continue-on-error-for-cross-compile.patch +++ b/0111-ci-set-continue-on-error-for-cross-compile.patch @@ -1,7 +1,7 @@ -From e659ab526e49ee61b4630bd6f77ef825ced8373c Mon Sep 17 00:00:00 2001 +From 7093620c045e5ed3662031cc6a2f224efdc1ac98 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Thu, 27 Jan 2022 22:13:33 +0000 -Subject: [PATCH 112/245] ci: set continue-on-error for cross-compile +Subject: [PATCH 111/249] ci: set continue-on-error for cross-compile Running cross compile tests with Debian unstable sometimes fails due to missing or outdated packages. diff --git a/0113-test-autofs-fix-use-after-free.patch b/0112-test-autofs-fix-use-after-free.patch similarity index 94% rename from 0113-test-autofs-fix-use-after-free.patch rename to 0112-test-autofs-fix-use-after-free.patch index 5cbaca4..3cca450 100644 --- a/0113-test-autofs-fix-use-after-free.patch +++ b/0112-test-autofs-fix-use-after-free.patch @@ -1,7 +1,7 @@ -From 588625722f69f9e7dc976f658910e95d8508619f Mon Sep 17 00:00:00 2001 +From 334ebaef9fb2cad0cb6de248ecc3fa75a9388fb3 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Thu, 27 Jan 2022 14:49:41 +0000 -Subject: [PATCH 113/245] test/autofs: fix use-after-free +Subject: [PATCH 112/249] test/autofs: fix use-after-free autofs.c:66:17: error: pointer 'str' may be used after 'realloc' [-Werror=use-after-free] diff --git a/0114-Fix-formatting-in-criu-documentation.patch b/0113-Fix-formatting-in-criu-documentation.patch similarity index 91% rename from 0114-Fix-formatting-in-criu-documentation.patch rename to 0113-Fix-formatting-in-criu-documentation.patch index 0e7a8c4..75a698b 100644 --- a/0114-Fix-formatting-in-criu-documentation.patch +++ b/0113-Fix-formatting-in-criu-documentation.patch @@ -1,7 +1,7 @@ -From 103e7ed6f355acd93dc090f4e63e98c7c941f12b Mon Sep 17 00:00:00 2001 +From 46055022a6310a8d986d7351571ba6f04769624c Mon Sep 17 00:00:00 2001 From: Ashutosh Mehra Date: Wed, 26 Jan 2022 14:14:38 -0500 -Subject: [PATCH 114/245] Fix formatting in criu documentation +Subject: [PATCH 113/249] Fix formatting in criu documentation Signed-off-by: Ashutosh Mehra --- diff --git a/0115-ci-install-libbsd-dependency.patch b/0114-ci-install-libbsd-dependency.patch similarity index 97% rename from 0115-ci-install-libbsd-dependency.patch rename to 0114-ci-install-libbsd-dependency.patch index c9b8d82..4d8787e 100644 --- a/0115-ci-install-libbsd-dependency.patch +++ b/0114-ci-install-libbsd-dependency.patch @@ -1,7 +1,7 @@ -From b917d808bc474321b09751625b3b7e2b03818633 Mon Sep 17 00:00:00 2001 +From 29f504fd9a029142a985184bc7dc66894f9fa35a Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Tue, 1 Feb 2022 15:59:14 +0000 -Subject: [PATCH 115/245] ci: install libbsd dependency +Subject: [PATCH 114/249] ci: install libbsd dependency The libbsd dependency is used to enable support for `setproctitle()` and `strlcpy()`. diff --git a/0116-pstree-when-updating-sid-for-shell-job-also-update-m.patch b/0115-pstree-when-updating-sid-for-shell-job-also-update-m.patch similarity index 86% rename from 0116-pstree-when-updating-sid-for-shell-job-also-update-m.patch rename to 0115-pstree-when-updating-sid-for-shell-job-also-update-m.patch index e73b5f8..9e4a4b2 100644 --- a/0116-pstree-when-updating-sid-for-shell-job-also-update-m.patch +++ b/0115-pstree-when-updating-sid-for-shell-job-also-update-m.patch @@ -1,7 +1,7 @@ -From 0e6cf87f121c72669d13d32ac8faafae3cc114bc Mon Sep 17 00:00:00 2001 +From d4bd2e60758dc9ba7fced79350080cf0ca6f5fc0 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 27 Jan 2022 10:28:29 +0300 -Subject: [PATCH 116/245] pstree: when updating sid for shell job also update +Subject: [PATCH 115/249] pstree: when updating sid for shell job also update matching pgid If we replace old_sid with current_sid we should also do same diff --git a/0117-criu-ns-fix-exit-code-o-for-criu-dump.patch b/0116-criu-ns-fix-exit-code-o-for-criu-dump.patch similarity index 83% rename from 0117-criu-ns-fix-exit-code-o-for-criu-dump.patch rename to 0116-criu-ns-fix-exit-code-o-for-criu-dump.patch index 7e9feb5..063396d 100644 --- a/0117-criu-ns-fix-exit-code-o-for-criu-dump.patch +++ b/0116-criu-ns-fix-exit-code-o-for-criu-dump.patch @@ -1,7 +1,7 @@ -From 991a8231313eeb0e56f70990de5e768e6ef8203b Mon Sep 17 00:00:00 2001 +From cc3b58c7c362cbaf43df574167f08897e8a80bd7 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Tue, 1 Feb 2022 13:44:42 +0000 -Subject: [PATCH 117/245] criu-ns: fix exit code o for criu dump +Subject: [PATCH 116/249] criu-ns: fix exit code o for criu dump Fixes: #1739 diff --git a/0118-criu-ns-use-os.waitstatus_to_exitcode.patch b/0117-criu-ns-use-os.waitstatus_to_exitcode.patch similarity index 88% rename from 0118-criu-ns-use-os.waitstatus_to_exitcode.patch rename to 0117-criu-ns-use-os.waitstatus_to_exitcode.patch index 6edaaf4..30f4d42 100644 --- a/0118-criu-ns-use-os.waitstatus_to_exitcode.patch +++ b/0117-criu-ns-use-os.waitstatus_to_exitcode.patch @@ -1,7 +1,7 @@ -From 278c5b3edd1bcf2515faa10d5e341deae36b8db9 Mon Sep 17 00:00:00 2001 +From cae5b84f70476b931620670c94bcd47d76a5e32d Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Fri, 4 Feb 2022 20:41:07 +0000 -Subject: [PATCH 118/245] criu-ns: use os.waitstatus_to_exitcode() +Subject: [PATCH 117/249] criu-ns: use os.waitstatus_to_exitcode() os.WEXITSTATUS() returns the process exit status and it should be used only if WIFEXITED() is true, i.e., the process terminated normally. diff --git a/0119-restorer-Fix-sys_mmap-s-returned-value-check.patch b/0118-restorer-Fix-sys_mmap-s-returned-value-check.patch similarity index 87% rename from 0119-restorer-Fix-sys_mmap-s-returned-value-check.patch rename to 0118-restorer-Fix-sys_mmap-s-returned-value-check.patch index f14efde..a4df36b 100644 --- a/0119-restorer-Fix-sys_mmap-s-returned-value-check.patch +++ b/0118-restorer-Fix-sys_mmap-s-returned-value-check.patch @@ -1,7 +1,7 @@ -From 85e612fe770ae23f097e43faeec42cabf4b83d21 Mon Sep 17 00:00:00 2001 +From 3fe8644e5bf60d6ab2ef7bfd09a87f156b2b41f0 Mon Sep 17 00:00:00 2001 From: Bui Quang Minh Date: Sat, 5 Feb 2022 14:23:38 +0700 -Subject: [PATCH 119/245] restorer: Fix sys_mmap's returned value check +Subject: [PATCH 118/249] restorer: Fix sys_mmap's returned value check As we call mmap syscall directly, the returned value in error case is the error number not -1 like in libc wrapper. Use IS_ERR for correct checking in error diff --git a/0120-compel-fix-how-PTRACE_GET_THREAD_AREA-errors-are-han.patch b/0119-compel-fix-how-PTRACE_GET_THREAD_AREA-errors-are-han.patch similarity index 92% rename from 0120-compel-fix-how-PTRACE_GET_THREAD_AREA-errors-are-han.patch rename to 0119-compel-fix-how-PTRACE_GET_THREAD_AREA-errors-are-han.patch index e5fcac9..5a92b49 100644 --- a/0120-compel-fix-how-PTRACE_GET_THREAD_AREA-errors-are-han.patch +++ b/0119-compel-fix-how-PTRACE_GET_THREAD_AREA-errors-are-han.patch @@ -1,7 +1,7 @@ -From ce4a2f6accc6dede778dd90b7e54daa6f3b6e3b8 Mon Sep 17 00:00:00 2001 +From fd30dd42a6ea39d1bde06fa51155e5f1bc286688 Mon Sep 17 00:00:00 2001 From: Mike Rapoport Date: Sun, 13 Feb 2022 08:48:07 +0200 -Subject: [PATCH 120/245] compel: fix how PTRACE_GET_THREAD_AREA errors are +Subject: [PATCH 119/249] compel: fix how PTRACE_GET_THREAD_AREA errors are handled When PTRACE_GET_THREAD_AREA errors on kernels with diff --git a/0121-util-add-an-unique-ID-of-the-current-criu-run.patch b/0120-util-add-an-unique-ID-of-the-current-criu-run.patch similarity index 93% rename from 0121-util-add-an-unique-ID-of-the-current-criu-run.patch rename to 0120-util-add-an-unique-ID-of-the-current-criu-run.patch index 4ebcebd..f3dd064 100644 --- a/0121-util-add-an-unique-ID-of-the-current-criu-run.patch +++ b/0120-util-add-an-unique-ID-of-the-current-criu-run.patch @@ -1,7 +1,7 @@ -From 42ff2dd8d495a8ef50da4bcc76987050993497a7 Mon Sep 17 00:00:00 2001 +From ac8b684c2cc8dafdcc7648ec4cea6f0b27dc2a71 Mon Sep 17 00:00:00 2001 From: Andrei Vagin Date: Sat, 12 Feb 2022 17:17:27 -0800 -Subject: [PATCH 121/245] util: add an unique ID of the current criu run +Subject: [PATCH 120/249] util: add an unique ID of the current criu run This ID will be used to generate resource ID-s that can conflicts with other CRIU processes. diff --git a/0122-files-generate-unique-transport-socket-names.patch b/0121-files-generate-unique-transport-socket-names.patch similarity index 86% rename from 0122-files-generate-unique-transport-socket-names.patch rename to 0121-files-generate-unique-transport-socket-names.patch index 0f0275b..c7028a6 100644 --- a/0122-files-generate-unique-transport-socket-names.patch +++ b/0121-files-generate-unique-transport-socket-names.patch @@ -1,7 +1,7 @@ -From e55f38cae12e8017c71ac1ee2458379ff5a38ca5 Mon Sep 17 00:00:00 2001 +From 518f6e6a84cb377d62b325f92f67596b6562a26d Mon Sep 17 00:00:00 2001 From: Andrei Vagin Date: Sat, 12 Feb 2022 17:24:07 -0800 -Subject: [PATCH 122/245] files: generate unique transport socket names +Subject: [PATCH 121/249] files: generate unique transport socket names Transport socket names have to be unique for each criu run. diff --git a/0123-check-Add-a-check-for-using-memfd-with-hugetlb.patch b/0122-check-Add-a-check-for-using-memfd-with-hugetlb.patch similarity index 95% rename from 0123-check-Add-a-check-for-using-memfd-with-hugetlb.patch rename to 0122-check-Add-a-check-for-using-memfd-with-hugetlb.patch index b81b231..7a264a2 100644 --- a/0123-check-Add-a-check-for-using-memfd-with-hugetlb.patch +++ b/0122-check-Add-a-check-for-using-memfd-with-hugetlb.patch @@ -1,7 +1,7 @@ -From 50810e99345bd770239050d4a7c436c809b9ae09 Mon Sep 17 00:00:00 2001 +From bb95d4c4d2928f1124283742af5978bcd637b6b2 Mon Sep 17 00:00:00 2001 From: Bui Quang Minh Date: Wed, 15 Dec 2021 22:15:21 +0700 -Subject: [PATCH 123/245] check: Add a check for using memfd with hugetlb +Subject: [PATCH 122/249] check: Add a check for using memfd with hugetlb Signed-off-by: Bui Quang Minh --- diff --git a/0124-kerndat-Collect-hugetlb-device-numbers.patch b/0123-kerndat-Collect-hugetlb-device-numbers.patch similarity index 98% rename from 0124-kerndat-Collect-hugetlb-device-numbers.patch rename to 0123-kerndat-Collect-hugetlb-device-numbers.patch index de35537..9387b02 100644 --- a/0124-kerndat-Collect-hugetlb-device-numbers.patch +++ b/0123-kerndat-Collect-hugetlb-device-numbers.patch @@ -1,7 +1,7 @@ -From cd8f553d7d165a5e4588ec0914b27a1bfb9d4446 Mon Sep 17 00:00:00 2001 +From 2eb37a63d8ba56dee5da7acc9f3ccf0cb1a97eb3 Mon Sep 17 00:00:00 2001 From: Bui Quang Minh Date: Wed, 15 Dec 2021 22:26:08 +0700 -Subject: [PATCH 124/245] kerndat: Collect hugetlb device numbers +Subject: [PATCH 123/249] kerndat: Collect hugetlb device numbers These numbers are used to determine whether a memory mapping is backed by hugetlb and its page size. diff --git a/0125-ipc-Add-support-for-checkpoint-restore-hugetlb-Syste.patch b/0124-ipc-Add-support-for-checkpoint-restore-hugetlb-Syste.patch similarity index 96% rename from 0125-ipc-Add-support-for-checkpoint-restore-hugetlb-Syste.patch rename to 0124-ipc-Add-support-for-checkpoint-restore-hugetlb-Syste.patch index db714a0..bf59b00 100644 --- a/0125-ipc-Add-support-for-checkpoint-restore-hugetlb-Syste.patch +++ b/0124-ipc-Add-support-for-checkpoint-restore-hugetlb-Syste.patch @@ -1,7 +1,7 @@ -From b8ec2e49bb3b1403569a0db599338ba5edcac09a Mon Sep 17 00:00:00 2001 +From c3015e3b6daa7159dfb66fd0595dbce342c95d12 Mon Sep 17 00:00:00 2001 From: Bui Quang Minh Date: Wed, 15 Dec 2021 22:53:09 +0700 -Subject: [PATCH 125/245] ipc: Add support for checkpoint/restore hugetlb +Subject: [PATCH 124/249] ipc: Add support for checkpoint/restore hugetlb System V shared memory Attach the System V shared memory segments to the address space via shmat() to diff --git a/0126-memfd-shmem-Add-support-for-checkpoint-restore-memfd.patch b/0125-memfd-shmem-Add-support-for-checkpoint-restore-memfd.patch similarity index 96% rename from 0126-memfd-shmem-Add-support-for-checkpoint-restore-memfd.patch rename to 0125-memfd-shmem-Add-support-for-checkpoint-restore-memfd.patch index 101e78b..f28c98f 100644 --- a/0126-memfd-shmem-Add-support-for-checkpoint-restore-memfd.patch +++ b/0125-memfd-shmem-Add-support-for-checkpoint-restore-memfd.patch @@ -1,7 +1,7 @@ -From 2d241a537ec32e1bb3590f5b63a23221c116af1b Mon Sep 17 00:00:00 2001 +From 18c10885c3cb1b39908361b9250330e21ebf119f Mon Sep 17 00:00:00 2001 From: Bui Quang Minh Date: Wed, 15 Dec 2021 23:01:29 +0700 -Subject: [PATCH 126/245] memfd, shmem: Add support for checkpoint/restore +Subject: [PATCH 125/249] memfd, shmem: Add support for checkpoint/restore memfd and anon shared memory Co-developed-by: Andrei Vagin diff --git a/0127-proc_parse-files-Add-support-for-hugetlb-memory-mapp.patch b/0126-proc_parse-files-Add-support-for-hugetlb-memory-mapp.patch similarity index 97% rename from 0127-proc_parse-files-Add-support-for-hugetlb-memory-mapp.patch rename to 0126-proc_parse-files-Add-support-for-hugetlb-memory-mapp.patch index 85eda90..409d050 100644 --- a/0127-proc_parse-files-Add-support-for-hugetlb-memory-mapp.patch +++ b/0126-proc_parse-files-Add-support-for-hugetlb-memory-mapp.patch @@ -1,7 +1,7 @@ -From cb412fc56d8b30e3917364e58b3411f1cdc069ab Mon Sep 17 00:00:00 2001 +From 3c7bb45946478e856b1c893948a0d2dba4cead20 Mon Sep 17 00:00:00 2001 From: Bui Quang Minh Date: Wed, 15 Dec 2021 23:03:29 +0700 -Subject: [PATCH 127/245] proc_parse, files: Add support for hugetlb memory +Subject: [PATCH 126/249] proc_parse, files: Add support for hugetlb memory mapping When memfd can be used with hugetlb, we use memfd for checkpoint/restore diff --git a/0128-mem-Skip-premapping-hugetlb-mapping.patch b/0127-mem-Skip-premapping-hugetlb-mapping.patch similarity index 90% rename from 0128-mem-Skip-premapping-hugetlb-mapping.patch rename to 0127-mem-Skip-premapping-hugetlb-mapping.patch index b31e9b3..84b2991 100644 --- a/0128-mem-Skip-premapping-hugetlb-mapping.patch +++ b/0127-mem-Skip-premapping-hugetlb-mapping.patch @@ -1,7 +1,7 @@ -From 5de55e2f87d815abc30373ee70798644239eb718 Mon Sep 17 00:00:00 2001 +From 8ec1e04580b30bd0365839a4fef301e95c6c6f2d Mon Sep 17 00:00:00 2001 From: Bui Quang Minh Date: Wed, 9 Feb 2022 22:11:51 +0700 -Subject: [PATCH 128/245] mem: Skip premapping hugetlb mapping +Subject: [PATCH 127/249] mem: Skip premapping hugetlb mapping As we cannot use mremap() to move the hugetlb mapping around until Linux kernel version 5.16, we need to skip premapping hugetlb mapping. diff --git a/0129-uffd-Skip-lazy-mode-restore-on-hugetlb-mappings.patch b/0128-uffd-Skip-lazy-mode-restore-on-hugetlb-mappings.patch similarity index 89% rename from 0129-uffd-Skip-lazy-mode-restore-on-hugetlb-mappings.patch rename to 0128-uffd-Skip-lazy-mode-restore-on-hugetlb-mappings.patch index 5a68965..d5420b4 100644 --- a/0129-uffd-Skip-lazy-mode-restore-on-hugetlb-mappings.patch +++ b/0128-uffd-Skip-lazy-mode-restore-on-hugetlb-mappings.patch @@ -1,7 +1,7 @@ -From 7460bfb291b585fd97803dbe99b5a23b3fd61ab5 Mon Sep 17 00:00:00 2001 +From 70a0a2dd7257c6969f040e18e37c4d8eca4dc224 Mon Sep 17 00:00:00 2001 From: Bui Quang Minh Date: Wed, 9 Feb 2022 22:12:53 +0700 -Subject: [PATCH 129/245] uffd: Skip lazy-mode restore on hugetlb mappings +Subject: [PATCH 128/249] uffd: Skip lazy-mode restore on hugetlb mappings As hugetlb mappings are not premapped, they are not registered to uffd service in restorer code. We must not mark these mappings as PPB_LAZY in generate_iovs() diff --git a/0130-zdtm-Add-MAP_HUGETLB-memory-mapping-test.patch b/0129-zdtm-Add-MAP_HUGETLB-memory-mapping-test.patch similarity index 97% rename from 0130-zdtm-Add-MAP_HUGETLB-memory-mapping-test.patch rename to 0129-zdtm-Add-MAP_HUGETLB-memory-mapping-test.patch index c64b8da..afe9e14 100644 --- a/0130-zdtm-Add-MAP_HUGETLB-memory-mapping-test.patch +++ b/0129-zdtm-Add-MAP_HUGETLB-memory-mapping-test.patch @@ -1,7 +1,7 @@ -From 0cd3c2e6d5161a7ace1067f32104248d97f3960e Mon Sep 17 00:00:00 2001 +From 94453cdd46f5791fe1ecd1fa1624233b95d00941 Mon Sep 17 00:00:00 2001 From: Bui Quang Minh Date: Tue, 26 Oct 2021 22:22:08 +0700 -Subject: [PATCH 130/245] zdtm: Add MAP_HUGETLB memory mapping test +Subject: [PATCH 129/249] zdtm: Add MAP_HUGETLB memory mapping test This commit add a test for checkpoint/restore MAP_HUGETLB memory mappings. A new zdtm helper get_mapping_dev() is added to get the device number of diff --git a/0131-zdtm-Add-memfd-hugetlb-test.patch b/0130-zdtm-Add-memfd-hugetlb-test.patch similarity index 97% rename from 0131-zdtm-Add-memfd-hugetlb-test.patch rename to 0130-zdtm-Add-memfd-hugetlb-test.patch index a3daadb..3cd1d13 100644 --- a/0131-zdtm-Add-memfd-hugetlb-test.patch +++ b/0130-zdtm-Add-memfd-hugetlb-test.patch @@ -1,7 +1,7 @@ -From ee16f173785327667bc4702e6c2f1c0419d6fc95 Mon Sep 17 00:00:00 2001 +From 44da7370c4fe39785d753c6de15caf782d75b7de Mon Sep 17 00:00:00 2001 From: Bui Quang Minh Date: Tue, 26 Oct 2021 22:31:44 +0700 -Subject: [PATCH 131/245] zdtm: Add memfd hugetlb test +Subject: [PATCH 130/249] zdtm: Add memfd hugetlb test Signed-off-by: Bui Quang Minh --- diff --git a/0132-zdtm-Add-shm-hugetlb-test.patch b/0131-zdtm-Add-shm-hugetlb-test.patch similarity index 96% rename from 0132-zdtm-Add-shm-hugetlb-test.patch rename to 0131-zdtm-Add-shm-hugetlb-test.patch index 098ef94..6d3cb02 100644 --- a/0132-zdtm-Add-shm-hugetlb-test.patch +++ b/0131-zdtm-Add-shm-hugetlb-test.patch @@ -1,7 +1,7 @@ -From fcb4236677ec1b8cbf53f5a513a173d39cc23e24 Mon Sep 17 00:00:00 2001 +From 78b113d4563c74a1fc320bfc84afc798c5c8ee91 Mon Sep 17 00:00:00 2001 From: Bui Quang Minh Date: Tue, 26 Oct 2021 22:34:22 +0700 -Subject: [PATCH 132/245] zdtm: Add shm hugetlb test +Subject: [PATCH 131/249] zdtm: Add shm hugetlb test Signed-off-by: Bui Quang Minh --- diff --git a/0133-zdtm-Add-MAP_HUGETLB-mappings-test-for-parent-child-.patch b/0132-zdtm-Add-MAP_HUGETLB-mappings-test-for-parent-child-.patch similarity index 96% rename from 0133-zdtm-Add-MAP_HUGETLB-mappings-test-for-parent-child-.patch rename to 0132-zdtm-Add-MAP_HUGETLB-mappings-test-for-parent-child-.patch index 9326183..3b86ab0 100644 --- a/0133-zdtm-Add-MAP_HUGETLB-mappings-test-for-parent-child-.patch +++ b/0132-zdtm-Add-MAP_HUGETLB-mappings-test-for-parent-child-.patch @@ -1,7 +1,7 @@ -From 922713c230aab7d763f39f72e21b7e2460927437 Mon Sep 17 00:00:00 2001 +From df3ab72beec7972abf925a10294f26529a81beff Mon Sep 17 00:00:00 2001 From: Bui Quang Minh Date: Fri, 31 Dec 2021 17:15:18 +0700 -Subject: [PATCH 133/245] zdtm: Add MAP_HUGETLB mappings test for parent-child +Subject: [PATCH 132/249] zdtm: Add MAP_HUGETLB mappings test for parent-child relationship processes Signed-off-by: Bui Quang Minh diff --git a/0134-ci-skip-MAP_HUGETLB-tests-in-stream-test.patch b/0133-ci-skip-MAP_HUGETLB-tests-in-stream-test.patch similarity index 92% rename from 0134-ci-skip-MAP_HUGETLB-tests-in-stream-test.patch rename to 0133-ci-skip-MAP_HUGETLB-tests-in-stream-test.patch index 02a993d..2a3cd70 100644 --- a/0134-ci-skip-MAP_HUGETLB-tests-in-stream-test.patch +++ b/0133-ci-skip-MAP_HUGETLB-tests-in-stream-test.patch @@ -1,7 +1,7 @@ -From 09c33d32399abd1a60a87a016560f44f73d0e5ea Mon Sep 17 00:00:00 2001 +From 316e3cfddad8409f3978bd7ffbd6bb42f04350e2 Mon Sep 17 00:00:00 2001 From: Bui Quang Minh Date: Sat, 12 Feb 2022 16:00:39 +0700 -Subject: [PATCH 134/245] ci: skip MAP_HUGETLB tests in stream test +Subject: [PATCH 133/249] ci: skip MAP_HUGETLB tests in stream test Currently, hugetlb mappings is not premapped so in the restore content phase, we skip page read these pages, enqueue the iovec for later reading in restorer and diff --git a/0135-bpfmap-handle-new-field-in-fdinfo.patch b/0134-bpfmap-handle-new-field-in-fdinfo.patch similarity index 97% rename from 0135-bpfmap-handle-new-field-in-fdinfo.patch rename to 0134-bpfmap-handle-new-field-in-fdinfo.patch index 2dce9aa..07a6e44 100644 --- a/0135-bpfmap-handle-new-field-in-fdinfo.patch +++ b/0134-bpfmap-handle-new-field-in-fdinfo.patch @@ -1,7 +1,7 @@ -From ab887fa5e04c2605464e6b4f6f6582c6c3b8d1c2 Mon Sep 17 00:00:00 2001 +From 9b35c3b51c0ea314a10d80f935f0b9e25ce20c80 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Tue, 15 Feb 2022 16:55:45 +0000 -Subject: [PATCH 135/245] bpfmap: handle new field in fdinfo +Subject: [PATCH 134/249] bpfmap: handle new field in fdinfo Starting with Linux Kernel release 5.16 the fdinfo proc entry contains a map_extra field which breaks CRIU parsing of bpfmap entries. diff --git a/0136-test-remove-test-for-LOCK_MAND-flock.patch b/0135-test-remove-test-for-LOCK_MAND-flock.patch similarity index 90% rename from 0136-test-remove-test-for-LOCK_MAND-flock.patch rename to 0135-test-remove-test-for-LOCK_MAND-flock.patch index e0d961a..d0e7920 100644 --- a/0136-test-remove-test-for-LOCK_MAND-flock.patch +++ b/0135-test-remove-test-for-LOCK_MAND-flock.patch @@ -1,7 +1,7 @@ -From 222eedb93d505ce966e4ec7491edfc34080f668f Mon Sep 17 00:00:00 2001 +From 1a89b19b66abc45c47c94bc078217af9dc676cac Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Tue, 15 Feb 2022 17:01:32 +0000 -Subject: [PATCH 136/245] test: remove test for LOCK_MAND flock +Subject: [PATCH 135/249] test: remove test for LOCK_MAND flock Linux Kernel release 5.16 removed support for LOCK_MAND flock and so the test to verify if LOCK_MAND works started to fail with 5.16. diff --git a/0137-test-disable-rseq-also-on-Archlinux.patch b/0136-test-disable-rseq-also-on-Archlinux.patch similarity index 85% rename from 0137-test-disable-rseq-also-on-Archlinux.patch rename to 0136-test-disable-rseq-also-on-Archlinux.patch index 404a74f..010af0f 100644 --- a/0137-test-disable-rseq-also-on-Archlinux.patch +++ b/0136-test-disable-rseq-also-on-Archlinux.patch @@ -1,7 +1,7 @@ -From 29bd4f0dd513a15e96c3374267b185d04ccf0357 Mon Sep 17 00:00:00 2001 +From e25f35ccb538c4b1542c608147c541efd2bf95c2 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Tue, 15 Feb 2022 18:09:27 +0000 -Subject: [PATCH 137/245] test: disable rseq also on Archlinux +Subject: [PATCH 136/249] test: disable rseq also on Archlinux Seems like Archlinux also uses rseq now and that breaks CRIU. Also disable rseq on Archlinux. diff --git a/0138-zdtm-fix-missplacement-of-err-True.patch b/0137-zdtm-fix-missplacement-of-err-True.patch similarity index 89% rename from 0138-zdtm-fix-missplacement-of-err-True.patch rename to 0137-zdtm-fix-missplacement-of-err-True.patch index e9e74da..9c06413 100644 --- a/0138-zdtm-fix-missplacement-of-err-True.patch +++ b/0137-zdtm-fix-missplacement-of-err-True.patch @@ -1,7 +1,7 @@ -From 7c3994f673107cbde368b385116358ce2a122ca8 Mon Sep 17 00:00:00 2001 +From 5aa1b1f48e5cd4186a70b7ce47ae23182e698b65 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Fri, 18 Feb 2022 18:13:14 +0300 -Subject: [PATCH 138/245] zdtm: fix missplacement of err=True +Subject: [PATCH 137/249] zdtm: fix missplacement of err=True There is no 'err' argument for print(), it should be in grep_errors() in line below. diff --git a/0139-compel-set-mxcsr-during-error-injection-to-zero.patch b/0138-compel-set-mxcsr-during-error-injection-to-zero.patch similarity index 91% rename from 0139-compel-set-mxcsr-during-error-injection-to-zero.patch rename to 0138-compel-set-mxcsr-during-error-injection-to-zero.patch index dab875e..00cee3c 100644 --- a/0139-compel-set-mxcsr-during-error-injection-to-zero.patch +++ b/0138-compel-set-mxcsr-during-error-injection-to-zero.patch @@ -1,7 +1,7 @@ -From 509bbef51ab2f3ed3d4156c07ca03dbb0ad63c29 Mon Sep 17 00:00:00 2001 +From 89173abcebfe38f584f2340d1ce39437b3c22ff9 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Wed, 9 Mar 2022 08:40:35 +0000 -Subject: [PATCH 139/245] compel: set mxcsr during error injection to zero +Subject: [PATCH 138/249] compel: set mxcsr during error injection to zero During error injection tests there are random values loaded in some of the registers. The kernel, however, has the following check: diff --git a/0140-proc_smaps-remove-useless-nonlinear-check.patch b/0139-proc_smaps-remove-useless-nonlinear-check.patch similarity index 89% rename from 0140-proc_smaps-remove-useless-nonlinear-check.patch rename to 0139-proc_smaps-remove-useless-nonlinear-check.patch index 5e5a189..6f9d011 100644 --- a/0140-proc_smaps-remove-useless-nonlinear-check.patch +++ b/0139-proc_smaps-remove-useless-nonlinear-check.patch @@ -1,7 +1,7 @@ -From 85ae3104dac41a6cbbb76c9b8b1a78a71184cb7a Mon Sep 17 00:00:00 2001 +From ae84fbbcb525715a0d0915a0e4182d0702cd6bd0 Mon Sep 17 00:00:00 2001 From: anatasluo Date: Tue, 8 Mar 2022 08:34:14 +0000 -Subject: [PATCH 140/245] proc_smaps: remove useless nonlinear check +Subject: [PATCH 139/249] proc_smaps: remove useless nonlinear check nonlinear information has been removed since commit 1da4b35b001481df99 in kernel. diff --git a/0141-mount-fix-e_str-leak-in-ext_mount_add.patch b/0140-mount-fix-e_str-leak-in-ext_mount_add.patch similarity index 92% rename from 0141-mount-fix-e_str-leak-in-ext_mount_add.patch rename to 0140-mount-fix-e_str-leak-in-ext_mount_add.patch index 5faf120..947d24d 100644 --- a/0141-mount-fix-e_str-leak-in-ext_mount_add.patch +++ b/0140-mount-fix-e_str-leak-in-ext_mount_add.patch @@ -1,7 +1,7 @@ -From 06ad515e6b084900aef7a9b5b62f3dbc0dfd0b6d Mon Sep 17 00:00:00 2001 +From b6a0ee4f8146442d7fa382bdee669472267c49fa Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Wed, 9 Mar 2022 14:32:25 +0300 -Subject: [PATCH 141/245] mount: fix e_str leak in ext_mount_add +Subject: [PATCH 140/249] mount: fix e_str leak in ext_mount_add coverity CID 389202: 54int ext_mount_add(char *key, char *val) diff --git a/0142-cr-dump-fix-cr_imgset-leak-in-dump_one_task.patch b/0141-cr-dump-fix-cr_imgset-leak-in-dump_one_task.patch similarity index 96% rename from 0142-cr-dump-fix-cr_imgset-leak-in-dump_one_task.patch rename to 0141-cr-dump-fix-cr_imgset-leak-in-dump_one_task.patch index d829a1f..0702751 100644 --- a/0142-cr-dump-fix-cr_imgset-leak-in-dump_one_task.patch +++ b/0141-cr-dump-fix-cr_imgset-leak-in-dump_one_task.patch @@ -1,7 +1,7 @@ -From 403e91569597b937bd69ca5f60b4516d85dc793f Mon Sep 17 00:00:00 2001 +From 7fc272fc191fb2b909a6bc623ff75ea688fe2864 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Wed, 9 Mar 2022 15:14:50 +0300 -Subject: [PATCH 142/245] cr-dump: fix cr_imgset leak in dump_one_task +Subject: [PATCH 141/249] cr-dump: fix cr_imgset leak in dump_one_task coverity CID 389194: diff --git a/0143-tun-fix-tun_link-leak-in-dump_tun_link.patch b/0142-tun-fix-tun_link-leak-in-dump_tun_link.patch similarity index 94% rename from 0143-tun-fix-tun_link-leak-in-dump_tun_link.patch rename to 0142-tun-fix-tun_link-leak-in-dump_tun_link.patch index de14eb2..3009d42 100644 --- a/0143-tun-fix-tun_link-leak-in-dump_tun_link.patch +++ b/0142-tun-fix-tun_link-leak-in-dump_tun_link.patch @@ -1,7 +1,7 @@ -From 33df574cd57a0919d1acd0e9184f4986d9974031 Mon Sep 17 00:00:00 2001 +From 8f2244a4c1d655e101f5dd0f790c56df7f0835dd Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Wed, 9 Mar 2022 13:52:00 +0300 -Subject: [PATCH 143/245] tun: fix tun_link leak in dump_tun_link +Subject: [PATCH 142/249] tun: fix tun_link leak in dump_tun_link coverity CID 389205: diff --git a/0144-sk-unix-fix-uint32_t-id-variable-printf-format-speci.patch b/0143-sk-unix-fix-uint32_t-id-variable-printf-format-speci.patch similarity index 90% rename from 0144-sk-unix-fix-uint32_t-id-variable-printf-format-speci.patch rename to 0143-sk-unix-fix-uint32_t-id-variable-printf-format-speci.patch index e1694af..b4c1239 100644 --- a/0144-sk-unix-fix-uint32_t-id-variable-printf-format-speci.patch +++ b/0143-sk-unix-fix-uint32_t-id-variable-printf-format-speci.patch @@ -1,7 +1,7 @@ -From 1b54115953453e739fe1a68dd3ced39912c352f3 Mon Sep 17 00:00:00 2001 +From 7399d1957001be0af6291c4168602ae154207677 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 10 Mar 2022 13:35:50 +0300 -Subject: [PATCH 144/245] sk-unix: fix uint32_t id variable printf format +Subject: [PATCH 143/249] sk-unix: fix uint32_t id variable printf format specifier coverity CID 389193: diff --git a/0145-zdtm-refactor-main.patch b/0144-zdtm-refactor-main.patch similarity index 99% rename from 0145-zdtm-refactor-main.patch rename to 0144-zdtm-refactor-main.patch index 451784a..7399615 100644 --- a/0145-zdtm-refactor-main.patch +++ b/0144-zdtm-refactor-main.patch @@ -1,7 +1,7 @@ -From 0edd663bb959e5a424abba670ac87fbd45edd0b9 Mon Sep 17 00:00:00 2001 +From 4bf7f3e1dfb0d01e59dd6f9af1b945018b1df034 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Sat, 24 Jul 2021 12:19:22 +0100 -Subject: [PATCH 145/245] zdtm: refactor main +Subject: [PATCH 144/249] zdtm: refactor main This patch improves the readability of zdtm by refactoring the top-level code into a main function. diff --git a/0146-zdtm-sort-import-lines.patch b/0145-zdtm-sort-import-lines.patch similarity index 93% rename from 0146-zdtm-sort-import-lines.patch rename to 0145-zdtm-sort-import-lines.patch index 16ff511..a0510a7 100644 --- a/0146-zdtm-sort-import-lines.patch +++ b/0145-zdtm-sort-import-lines.patch @@ -1,7 +1,7 @@ -From 49a2414f365fe2f4c887332b172568d9b121b542 Mon Sep 17 00:00:00 2001 +From c2f8e185938863082efbd525fabef22d6b719cb3 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Sun, 15 Aug 2021 10:27:37 +0100 -Subject: [PATCH 146/245] zdtm: sort import lines +Subject: [PATCH 145/249] zdtm: sort import lines These changes have been auto-generated with: diff --git a/0147-zdtm-use-long-form-cli-options.patch b/0146-zdtm-use-long-form-cli-options.patch similarity index 95% rename from 0147-zdtm-use-long-form-cli-options.patch rename to 0146-zdtm-use-long-form-cli-options.patch index a0fbc18..4765f2d 100644 --- a/0147-zdtm-use-long-form-cli-options.patch +++ b/0146-zdtm-use-long-form-cli-options.patch @@ -1,7 +1,7 @@ -From 0cec066cb200680f7cb1429b026c643f1035b5f5 Mon Sep 17 00:00:00 2001 +From fa4b4f7103804f3995cace5e4405894737f4ff4a Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Sun, 15 Aug 2021 10:53:29 +0100 -Subject: [PATCH 147/245] zdtm: use long form cli options +Subject: [PATCH 146/249] zdtm: use long form cli options Using long-form command-line options would allows us to provide them via config file to CRIU. diff --git a/0148-zdtm-add-criu-config-option.patch b/0147-zdtm-add-criu-config-option.patch similarity index 97% rename from 0148-zdtm-add-criu-config-option.patch rename to 0147-zdtm-add-criu-config-option.patch index a61806e..6494ba5 100644 --- a/0148-zdtm-add-criu-config-option.patch +++ b/0147-zdtm-add-criu-config-option.patch @@ -1,7 +1,7 @@ -From 9caafe1d72257646d55976b9c74a2480149b9279 Mon Sep 17 00:00:00 2001 +From 3facb361f138a484effb064215fe1b7d45796d6b Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Sun, 15 Aug 2021 10:58:32 +0100 -Subject: [PATCH 148/245] zdtm: add --criu-config option +Subject: [PATCH 147/249] zdtm: add --criu-config option The --criu-config option allows to run test with CRIU options provided via configuration files instead of command-line arguments. diff --git a/0149-zdtm-drop-redundant-config_inotify_irmap-test.patch b/0148-zdtm-drop-redundant-config_inotify_irmap-test.patch similarity index 97% rename from 0149-zdtm-drop-redundant-config_inotify_irmap-test.patch rename to 0148-zdtm-drop-redundant-config_inotify_irmap-test.patch index fee952e..d8d7422 100644 --- a/0149-zdtm-drop-redundant-config_inotify_irmap-test.patch +++ b/0148-zdtm-drop-redundant-config_inotify_irmap-test.patch @@ -1,7 +1,7 @@ -From 7df50d6bdc535dc62e299ef0e94e5dac29d4a7ac Mon Sep 17 00:00:00 2001 +From b69701e308743135e86d461cb66cd807ed2c0fc2 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Sun, 15 Aug 2021 11:16:28 +0100 -Subject: [PATCH 149/245] zdtm: drop redundant config_inotify_irmap test +Subject: [PATCH 148/249] zdtm: drop redundant config_inotify_irmap test The config_inotify_irmap test duplicates inotify_irmap with slight change to add the --force-irmap and --irmap-scan-path options in diff --git a/0150-ci-run-criu-config-tests.patch b/0149-ci-run-criu-config-tests.patch similarity index 92% rename from 0150-ci-run-criu-config-tests.patch rename to 0149-ci-run-criu-config-tests.patch index f48623c..d8c5f2b 100644 --- a/0150-ci-run-criu-config-tests.patch +++ b/0149-ci-run-criu-config-tests.patch @@ -1,7 +1,7 @@ -From 88caa7a5083039157f340df1497fc7a6c91a9174 Mon Sep 17 00:00:00 2001 +From 3fd1487983c59bbf17e45484ceb42011e5d74eda Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Sun, 15 Aug 2021 11:29:22 +0100 -Subject: [PATCH 150/245] ci: run criu-config tests +Subject: [PATCH 149/249] ci: run criu-config tests Signed-off-by: Radostin Stoyanov --- diff --git a/0151-config-fix-ns-leak-in-parse_join_ns.patch b/0150-config-fix-ns-leak-in-parse_join_ns.patch similarity index 92% rename from 0151-config-fix-ns-leak-in-parse_join_ns.patch rename to 0150-config-fix-ns-leak-in-parse_join_ns.patch index 3a4c390..c6f3828 100644 --- a/0151-config-fix-ns-leak-in-parse_join_ns.patch +++ b/0150-config-fix-ns-leak-in-parse_join_ns.patch @@ -1,7 +1,7 @@ -From f2d2062d3635921e9a4a43a5c5868abc680183ff Mon Sep 17 00:00:00 2001 +From 96fdf556f85dc13067e265ec8227ebdeb71ec068 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 10 Mar 2022 14:15:23 +0300 -Subject: [PATCH 151/245] config: fix ns leak in parse_join_ns +Subject: [PATCH 150/249] config: fix ns leak in parse_join_ns coverity CID 389192: diff --git a/0152-net-fix-e_str-leak-in-veth_pair_add.patch b/0151-net-fix-e_str-leak-in-veth_pair_add.patch similarity index 93% rename from 0152-net-fix-e_str-leak-in-veth_pair_add.patch rename to 0151-net-fix-e_str-leak-in-veth_pair_add.patch index a6c234c..3aa88c6 100644 --- a/0152-net-fix-e_str-leak-in-veth_pair_add.patch +++ b/0151-net-fix-e_str-leak-in-veth_pair_add.patch @@ -1,7 +1,7 @@ -From 072f84fb2f9b5b14db1b81e789e2bebf913137a3 Mon Sep 17 00:00:00 2001 +From fc4b654c9264ee5cb48437a96293695d05b89e5b Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Fri, 11 Mar 2022 19:57:06 +0300 -Subject: [PATCH 152/245] net: fix e_str leak in veth_pair_add +Subject: [PATCH 151/249] net: fix e_str leak in veth_pair_add coverity CID 389187: diff --git a/0153-files-fix-inh-leak-in-inherit_fd_add.patch b/0152-files-fix-inh-leak-in-inherit_fd_add.patch similarity index 92% rename from 0153-files-fix-inh-leak-in-inherit_fd_add.patch rename to 0152-files-fix-inh-leak-in-inherit_fd_add.patch index 3cf38ed..18111e9 100644 --- a/0153-files-fix-inh-leak-in-inherit_fd_add.patch +++ b/0152-files-fix-inh-leak-in-inherit_fd_add.patch @@ -1,7 +1,7 @@ -From ea271af140a0d63de19acd7cb4107ef83e734c1d Mon Sep 17 00:00:00 2001 +From 711c1fb9385678320572e8bc35a6342d435cb2ba Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Fri, 11 Mar 2022 18:45:37 +0300 -Subject: [PATCH 153/245] files: fix inh leak in inherit_fd_add +Subject: [PATCH 152/249] files: fix inh leak in inherit_fd_add coverity CID 389190: diff --git a/0154-sk-unix-fix-e_str-leak-in-unix_sk_id_add.patch b/0153-sk-unix-fix-e_str-leak-in-unix_sk_id_add.patch similarity index 92% rename from 0154-sk-unix-fix-e_str-leak-in-unix_sk_id_add.patch rename to 0153-sk-unix-fix-e_str-leak-in-unix_sk_id_add.patch index 06fa27a..31362fe 100644 --- a/0154-sk-unix-fix-e_str-leak-in-unix_sk_id_add.patch +++ b/0153-sk-unix-fix-e_str-leak-in-unix_sk_id_add.patch @@ -1,7 +1,7 @@ -From 210d54ef1e4534c8d6a861f31f294e7df5134b5b Mon Sep 17 00:00:00 2001 +From dac5689422ed1422f33bf6a39b929f3f40d4c86b Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Fri, 11 Mar 2022 18:36:55 +0300 -Subject: [PATCH 154/245] sk-unix: fix e_str leak in unix_sk_id_add +Subject: [PATCH 153/249] sk-unix: fix e_str leak in unix_sk_id_add coverity CID 389191: diff --git a/0155-uffd-fix-__u64-print-format-specifier.patch b/0154-uffd-fix-__u64-print-format-specifier.patch similarity index 90% rename from 0155-uffd-fix-__u64-print-format-specifier.patch rename to 0154-uffd-fix-__u64-print-format-specifier.patch index efa17db..a453bd5 100644 --- a/0155-uffd-fix-__u64-print-format-specifier.patch +++ b/0154-uffd-fix-__u64-print-format-specifier.patch @@ -1,7 +1,7 @@ -From c4b5110df1cb83dca79ca57d5413bf93968aa040 Mon Sep 17 00:00:00 2001 +From d13ed3d1c42afcff082517c08acd825558966127 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Fri, 11 Mar 2022 17:31:07 +0300 -Subject: [PATCH 155/245] uffd: fix __u64 print format specifier +Subject: [PATCH 154/249] uffd: fix __u64 print format specifier coverity CID 389197: diff --git a/0156-zdtm-fix-mnt_ext_master-test-to-correspond-to-it-s-n.patch b/0155-zdtm-fix-mnt_ext_master-test-to-correspond-to-it-s-n.patch similarity index 93% rename from 0156-zdtm-fix-mnt_ext_master-test-to-correspond-to-it-s-n.patch rename to 0155-zdtm-fix-mnt_ext_master-test-to-correspond-to-it-s-n.patch index c3dd597..87fdfa1 100644 --- a/0156-zdtm-fix-mnt_ext_master-test-to-correspond-to-it-s-n.patch +++ b/0155-zdtm-fix-mnt_ext_master-test-to-correspond-to-it-s-n.patch @@ -1,7 +1,7 @@ -From 80a918b3fad70613e7257c22d4c1ad585908440d Mon Sep 17 00:00:00 2001 +From b54f9f22e379da0fba7e8f84265e9af50d0a9dc7 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Mon, 30 Dec 2019 16:17:54 +0300 -Subject: [PATCH 156/245] zdtm: fix mnt_ext_master test to correspond to it's +Subject: [PATCH 155/249] zdtm: fix mnt_ext_master test to correspond to it's name Before these change the on-host-"zdtm_auto_ext_mnt" mount with diff --git a/0157-mount-add-mntinfo_add_list_before-helper-for-adding-.patch b/0156-mount-add-mntinfo_add_list_before-helper-for-adding-.patch similarity index 95% rename from 0157-mount-add-mntinfo_add_list_before-helper-for-adding-.patch rename to 0156-mount-add-mntinfo_add_list_before-helper-for-adding-.patch index 9483361..1bb7e96 100644 --- a/0157-mount-add-mntinfo_add_list_before-helper-for-adding-.patch +++ b/0156-mount-add-mntinfo_add_list_before-helper-for-adding-.patch @@ -1,7 +1,7 @@ -From 3a285b79b73a30400ae13605c3d1e6ae46c661e9 Mon Sep 17 00:00:00 2001 +From e9d53beca393b683e86ed5c5695412317616b1a1 Mon Sep 17 00:00:00 2001 From: Alexander Mikhalitsyn Date: Sun, 12 Apr 2020 20:53:54 +0300 -Subject: [PATCH 157/245] mount: add mntinfo_add_list_before helper for adding +Subject: [PATCH 156/249] mount: add mntinfo_add_list_before helper for adding to mntinfo list Use this helper everywhere instead of manually adding mounts to the head diff --git a/0158-mount-do-not-detect-non-fsroot-mounts-as-device-exte.patch b/0157-mount-do-not-detect-non-fsroot-mounts-as-device-exte.patch similarity index 92% rename from 0158-mount-do-not-detect-non-fsroot-mounts-as-device-exte.patch rename to 0157-mount-do-not-detect-non-fsroot-mounts-as-device-exte.patch index 4c06e64..e352ded 100644 --- a/0158-mount-do-not-detect-non-fsroot-mounts-as-device-exte.patch +++ b/0157-mount-do-not-detect-non-fsroot-mounts-as-device-exte.patch @@ -1,7 +1,7 @@ -From 4ce94c75c78cacbddf6c374f5efa359f1714f18d Mon Sep 17 00:00:00 2001 +From ff991f4b5f369640408887dd7e2c9bc1c9ccc53b Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 16 Jan 2020 12:36:08 +0300 -Subject: [PATCH 158/245] mount: do not detect non-fsroot mounts as +Subject: [PATCH 157/249] mount: do not detect non-fsroot mounts as device-external Device-external mounts are restored via do_new_mount(), but function diff --git a/0159-mount-mark-mounts-of-external-devices-external.patch b/0158-mount-mark-mounts-of-external-devices-external.patch similarity index 97% rename from 0159-mount-mark-mounts-of-external-devices-external.patch rename to 0158-mount-mark-mounts-of-external-devices-external.patch index 793bf2b..7f5742e 100644 --- a/0159-mount-mark-mounts-of-external-devices-external.patch +++ b/0158-mount-mark-mounts-of-external-devices-external.patch @@ -1,7 +1,7 @@ -From 6685ad8b808184e2dcb6adecab8e0b97844404d2 Mon Sep 17 00:00:00 2001 +From 8e1769318b436a69a67e399e432cc0436abf4298 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Mon, 16 Sep 2019 18:07:32 +0300 -Subject: [PATCH 159/245] mount: mark mounts of external devices external +Subject: [PATCH 158/249] mount: mark mounts of external devices external Previously only autodetected and mountpoint external mounts had mount_info->external field set, let's fix this injustice so that we can diff --git a/0160-mount-skip-fstype-and-source-checks-for-external-mou.patch b/0159-mount-skip-fstype-and-source-checks-for-external-mou.patch similarity index 95% rename from 0160-mount-skip-fstype-and-source-checks-for-external-mou.patch rename to 0159-mount-skip-fstype-and-source-checks-for-external-mou.patch index 8a3a925..3204c35 100644 --- a/0160-mount-skip-fstype-and-source-checks-for-external-mou.patch +++ b/0159-mount-skip-fstype-and-source-checks-for-external-mou.patch @@ -1,7 +1,7 @@ -From 85a2a46355e436f8c78c288dac354d610c1bfe97 Mon Sep 17 00:00:00 2001 +From c2396a5fb549f186e6f5f0031e492143d01cc949 Mon Sep 17 00:00:00 2001 From: Alexander Mikhalitsyn Date: Tue, 21 Apr 2020 18:12:00 +0300 -Subject: [PATCH 160/245] mount: skip fstype and source checks for external +Subject: [PATCH 159/249] mount: skip fstype and source checks for external mounts in mounts_sb_equal Fstype and source fields can be changed by resolve_external_mounts() or diff --git a/0161-mount-setup-mnt_bind-list-before-using-it-in-mnt_is_.patch b/0160-mount-setup-mnt_bind-list-before-using-it-in-mnt_is_.patch similarity index 97% rename from 0161-mount-setup-mnt_bind-list-before-using-it-in-mnt_is_.patch rename to 0160-mount-setup-mnt_bind-list-before-using-it-in-mnt_is_.patch index 2e55161..db98818 100644 --- a/0161-mount-setup-mnt_bind-list-before-using-it-in-mnt_is_.patch +++ b/0160-mount-setup-mnt_bind-list-before-using-it-in-mnt_is_.patch @@ -1,7 +1,7 @@ -From 579cdbc0567451ed2df89584a267c13ba7365b89 Mon Sep 17 00:00:00 2001 +From 2b57250db0bec7e396a531c24145ecd07334a402 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Fri, 20 Dec 2019 17:26:07 +0300 -Subject: [PATCH 161/245] mount: setup mnt_bind list before using it in +Subject: [PATCH 160/249] mount: setup mnt_bind list before using it in mnt_is_external Before this patch mnt_is_external() used non-populated mnt_bind list diff --git a/0162-util-add-get_relative_path-helper.patch b/0161-util-add-get_relative_path-helper.patch similarity index 97% rename from 0162-util-add-get_relative_path-helper.patch rename to 0161-util-add-get_relative_path-helper.patch index 679b915..92ae5ba 100644 --- a/0162-util-add-get_relative_path-helper.patch +++ b/0161-util-add-get_relative_path-helper.patch @@ -1,7 +1,7 @@ -From 127d2aa360d2f3fa61f6c3930bede8b388379020 Mon Sep 17 00:00:00 2001 +From eabcda449fa87d3e1e3060528a316988bbf5b748 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 14 May 2020 13:50:20 +0300 -Subject: [PATCH 162/245] util: add get_relative_path helper +Subject: [PATCH 161/249] util: add get_relative_path helper This is a smart way of getting relative paths: diff --git a/0163-unittest-add-some-tests-for-get_relative_path-helper.patch b/0162-unittest-add-some-tests-for-get_relative_path-helper.patch similarity index 96% rename from 0163-unittest-add-some-tests-for-get_relative_path-helper.patch rename to 0162-unittest-add-some-tests-for-get_relative_path-helper.patch index 1010747..6acfc49 100644 --- a/0163-unittest-add-some-tests-for-get_relative_path-helper.patch +++ b/0162-unittest-add-some-tests-for-get_relative_path-helper.patch @@ -1,7 +1,7 @@ -From 3287ff222c0f748dddbac8e21b6eeec71d251141 Mon Sep 17 00:00:00 2001 +From 9cb726827941e24a5e9f0ed12680d4b69e10551c Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Wed, 19 Jan 2022 12:34:51 +0300 -Subject: [PATCH 163/245] unittest: add some tests for get_relative_path helper +Subject: [PATCH 162/249] unittest: add some tests for get_relative_path helper v2: let's also mock kerndat_s.sysctl_nr_open field, to make aarch64 clang ci happy diff --git a/0164-mount-add-mnt_bind_pick-helper-to-pick-the-desired-b.patch b/0163-mount-add-mnt_bind_pick-helper-to-pick-the-desired-b.patch similarity index 93% rename from 0164-mount-add-mnt_bind_pick-helper-to-pick-the-desired-b.patch rename to 0163-mount-add-mnt_bind_pick-helper-to-pick-the-desired-b.patch index 04942fc..805af27 100644 --- a/0164-mount-add-mnt_bind_pick-helper-to-pick-the-desired-b.patch +++ b/0163-mount-add-mnt_bind_pick-helper-to-pick-the-desired-b.patch @@ -1,7 +1,7 @@ -From 0bd2d50db651b6f59744e3445fa596bc298dd57e Mon Sep 17 00:00:00 2001 +From 5a8c2335b2f5ede7faa1b7d38a12a4610d0b2374 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Mon, 29 Nov 2021 12:54:51 +0300 -Subject: [PATCH 164/245] mount: add mnt_bind_pick helper to pick the desired +Subject: [PATCH 163/249] mount: add mnt_bind_pick helper to pick the desired bind Adding different pick functions we would be able to search different diff --git a/0165-mount-split-mnt_is_external-_bind-and-can_receive_ma.patch b/0164-mount-split-mnt_is_external-_bind-and-can_receive_ma.patch similarity index 97% rename from 0165-mount-split-mnt_is_external-_bind-and-can_receive_ma.patch rename to 0164-mount-split-mnt_is_external-_bind-and-can_receive_ma.patch index 23433b9..51de7ff 100644 --- a/0165-mount-split-mnt_is_external-_bind-and-can_receive_ma.patch +++ b/0164-mount-split-mnt_is_external-_bind-and-can_receive_ma.patch @@ -1,7 +1,7 @@ -From 569a003b3993f27e651dc9f7e644806553d5908f Mon Sep 17 00:00:00 2001 +From 05b68230b794d7f16453c6241c90b005d0b277aa Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Wed, 18 Dec 2019 13:45:22 +0300 -Subject: [PATCH 165/245] mount: split mnt_is_external(_bind) and +Subject: [PATCH 164/249] mount: split mnt_is_external(_bind) and can_receive_master_from_external We use mnt_is_external(): diff --git a/0166-mount-rework-skipping-external-mounts-in-dump_one_mo.patch b/0165-mount-rework-skipping-external-mounts-in-dump_one_mo.patch similarity index 91% rename from 0166-mount-rework-skipping-external-mounts-in-dump_one_mo.patch rename to 0165-mount-rework-skipping-external-mounts-in-dump_one_mo.patch index c98a8c8..422f85b 100644 --- a/0166-mount-rework-skipping-external-mounts-in-dump_one_mo.patch +++ b/0165-mount-rework-skipping-external-mounts-in-dump_one_mo.patch @@ -1,7 +1,7 @@ -From 8e04c0735d8049a628bc47ba0a92b8c7bde0b922 Mon Sep 17 00:00:00 2001 +From 9a5362e9160a14fb35c709f7b1862c27caa9dac2 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Wed, 12 Jan 2022 13:34:39 +0300 -Subject: [PATCH 166/245] mount: rework skipping external mounts in +Subject: [PATCH 165/249] mount: rework skipping external mounts in dump_one_mountpoint Function dump_one_fs already has mnt_is_external_bind check inside, so diff --git a/0167-mount-show-more-info-about-why-we-can-t-mount.patch b/0166-mount-show-more-info-about-why-we-can-t-mount.patch similarity index 96% rename from 0167-mount-show-more-info-about-why-we-can-t-mount.patch rename to 0166-mount-show-more-info-about-why-we-can-t-mount.patch index 6e4859a..0e672d2 100644 --- a/0167-mount-show-more-info-about-why-we-can-t-mount.patch +++ b/0166-mount-show-more-info-about-why-we-can-t-mount.patch @@ -1,7 +1,7 @@ -From 323ca816334a16f0af3aa78587fd09cbe248b0e1 Mon Sep 17 00:00:00 2001 +From 43ff6e839fd1a7802075193b1534cc4ae1ea96fb Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 12 Sep 2019 10:10:37 +0300 -Subject: [PATCH 167/245] mount: show more info about why we can't mount +Subject: [PATCH 166/249] mount: show more info about why we can't mount Currently if we have mount deadlock it is hard to understand which mounts lock each other, these makes it easier. diff --git a/0168-mount-mount-external-mount-before-mounting-it-s-bind.patch b/0167-mount-mount-external-mount-before-mounting-it-s-bind.patch similarity index 96% rename from 0168-mount-mount-external-mount-before-mounting-it-s-bind.patch rename to 0167-mount-mount-external-mount-before-mounting-it-s-bind.patch index 9a85d51..ffbc7b6 100644 --- a/0168-mount-mount-external-mount-before-mounting-it-s-bind.patch +++ b/0167-mount-mount-external-mount-before-mounting-it-s-bind.patch @@ -1,7 +1,7 @@ -From 2f347af01f5ec1525b989fe4ed9d9c5ead2c5f27 Mon Sep 17 00:00:00 2001 +From f24aa442f004730f4994e667dd0d794a00427c48 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Mon, 17 Feb 2020 11:58:41 +0300 -Subject: [PATCH 168/245] mount: mount external mount before mounting it's +Subject: [PATCH 167/249] mount: mount external mount before mounting it's binds The problem when we don't order these mounts we can get to mounting diff --git a/0169-zdtm-add-new-mnt_ext_root-test.patch b/0168-zdtm-add-new-mnt_ext_root-test.patch similarity index 97% rename from 0169-zdtm-add-new-mnt_ext_root-test.patch rename to 0168-zdtm-add-new-mnt_ext_root-test.patch index 2edd55a..c4b45c0 100644 --- a/0169-zdtm-add-new-mnt_ext_root-test.patch +++ b/0168-zdtm-add-new-mnt_ext_root-test.patch @@ -1,7 +1,7 @@ -From 8f1a5dadf72c917336c06f028b58111b6c00fd50 Mon Sep 17 00:00:00 2001 +From f59efe89bcc72c7104e08cad64b47d03e098bcca Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Tue, 18 Feb 2020 13:41:18 +0300 -Subject: [PATCH 169/245] zdtm: add new mnt_ext_root test +Subject: [PATCH 168/249] zdtm: add new mnt_ext_root test This test simply creates a) root external mount and b) "deeper" bindmount for it (deeper in terms of mnt_depth). Our mount restore code diff --git a/0170-mount-restrict-mp-external-mount-map-to-init-contain.patch b/0169-mount-restrict-mp-external-mount-map-to-init-contain.patch similarity index 94% rename from 0170-mount-restrict-mp-external-mount-map-to-init-contain.patch rename to 0169-mount-restrict-mp-external-mount-map-to-init-contain.patch index 8ba4d49..d54a606 100644 --- a/0170-mount-restrict-mp-external-mount-map-to-init-contain.patch +++ b/0169-mount-restrict-mp-external-mount-map-to-init-contain.patch @@ -1,7 +1,7 @@ -From 573137b58e00dce2d58c7e669a6a07ecbcddf9b0 Mon Sep 17 00:00:00 2001 +From 0744a30a70c96f6d4de0577c354ec682220ec2e3 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Fri, 26 Nov 2021 12:53:41 +0300 -Subject: [PATCH 170/245] mount: restrict mp-external mount map to init +Subject: [PATCH 169/249] mount: restrict mp-external mount map to init container mntns only We resolve mountpoint-external mounts on dump by mountpoint comparison, diff --git a/0171-zdtm-add-mnt_ext_collision-test.patch b/0170-zdtm-add-mnt_ext_collision-test.patch similarity index 98% rename from 0171-zdtm-add-mnt_ext_collision-test.patch rename to 0170-zdtm-add-mnt_ext_collision-test.patch index 8bf24de..994549d 100644 --- a/0171-zdtm-add-mnt_ext_collision-test.patch +++ b/0170-zdtm-add-mnt_ext_collision-test.patch @@ -1,7 +1,7 @@ -From cd43fdffbaadd0406a73c02939d07493de014244 Mon Sep 17 00:00:00 2001 +From 0e4b310a3a2af3aa6b33c07f402f5a46aa1e51b5 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Wed, 12 Jan 2022 16:00:56 +0300 -Subject: [PATCH 171/245] zdtm: add mnt_ext_collision test +Subject: [PATCH 170/249] zdtm: add mnt_ext_collision test This test creates two mount namespaces, one "root" with external mount at /mnt_ext_collision.test/dst and one "nested" with different internal diff --git a/0172-mount-add-mnt_is_root_bind-helper.patch b/0171-mount-add-mnt_is_root_bind-helper.patch similarity index 96% rename from 0172-mount-add-mnt_is_root_bind-helper.patch rename to 0171-mount-add-mnt_is_root_bind-helper.patch index 3573261..b4686eb 100644 --- a/0172-mount-add-mnt_is_root_bind-helper.patch +++ b/0171-mount-add-mnt_is_root_bind-helper.patch @@ -1,7 +1,7 @@ -From e6b94a2ee627fa4806f14310e3cc66d4ca4c08fe Mon Sep 17 00:00:00 2001 +From 8cf73188d2ce803a13712a10e9894efed7d32123 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Fri, 8 May 2020 14:33:13 +0300 -Subject: [PATCH 172/245] mount: add mnt_is_root_bind helper +Subject: [PATCH 171/249] mount: add mnt_is_root_bind helper Helper mnt_is_root_bind indicates that mount can be bind-mounted from the root mount (which in it's turn from opts.root). diff --git a/0173-mount-allow-nested-mount-namespaces-with-different-r.patch b/0172-mount-allow-nested-mount-namespaces-with-different-r.patch similarity index 92% rename from 0173-mount-allow-nested-mount-namespaces-with-different-r.patch rename to 0172-mount-allow-nested-mount-namespaces-with-different-r.patch index 3b38454..d887842 100644 --- a/0173-mount-allow-nested-mount-namespaces-with-different-r.patch +++ b/0172-mount-allow-nested-mount-namespaces-with-different-r.patch @@ -1,7 +1,7 @@ -From 009877169d13f9d6437fc2d11113bccdbad6b15f Mon Sep 17 00:00:00 2001 +From b775febb36915afcd6e6d320a6c30f08c433c4f0 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Mon, 27 Apr 2020 18:24:54 +0300 -Subject: [PATCH 173/245] mount: allow nested mount namespaces with different +Subject: [PATCH 172/249] mount: allow nested mount namespaces with different roots Only root in root-mntns is special (see rst_mnt_is_root) all other diff --git a/0174-zdtm-add-mntns_pivot_root-test.patch b/0173-zdtm-add-mntns_pivot_root-test.patch similarity index 97% rename from 0174-zdtm-add-mntns_pivot_root-test.patch rename to 0173-zdtm-add-mntns_pivot_root-test.patch index c7ebbc5..4a0ef6d 100644 --- a/0174-zdtm-add-mntns_pivot_root-test.patch +++ b/0173-zdtm-add-mntns_pivot_root-test.patch @@ -1,7 +1,7 @@ -From 4a1fb7b6d7093f4dd9ed4f544bac69241b641208 Mon Sep 17 00:00:00 2001 +From bde8ec21a973e0cb129fa9214a17b8ce91cf8a41 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Wed, 12 Jan 2022 19:30:07 +0300 -Subject: [PATCH 174/245] zdtm: add mntns_pivot_root test +Subject: [PATCH 173/249] zdtm: add mntns_pivot_root test This creates nested mntns and does pivot_root to tmpfs mount, so that roots of original test mntns and in nested mntns are different. diff --git a/0175-mount-apply-superblock-flags-to-nested-ns-roots.patch b/0174-mount-apply-superblock-flags-to-nested-ns-roots.patch similarity index 88% rename from 0175-mount-apply-superblock-flags-to-nested-ns-roots.patch rename to 0174-mount-apply-superblock-flags-to-nested-ns-roots.patch index 7d514ec..cd9c4ee 100644 --- a/0175-mount-apply-superblock-flags-to-nested-ns-roots.patch +++ b/0174-mount-apply-superblock-flags-to-nested-ns-roots.patch @@ -1,7 +1,7 @@ -From 68aa0fc0b531ecdf954e79af6f04303c167b2d59 Mon Sep 17 00:00:00 2001 +From af12f2ef7c38bc06cd9ce43b7feb40bc968ec251 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Wed, 27 May 2020 13:43:49 +0300 -Subject: [PATCH 175/245] mount: apply superblock flags to nested ns roots +Subject: [PATCH 174/249] mount: apply superblock flags to nested ns roots Before this change we didn't apply sb-flags if we mount the root mount of non-root mntns. There is no point in it, if we got to do_new_mount this root diff --git a/0176-zdtm-add-mntns_pivot_root_ro-test.patch b/0175-zdtm-add-mntns_pivot_root_ro-test.patch similarity index 96% rename from 0176-zdtm-add-mntns_pivot_root_ro-test.patch rename to 0175-zdtm-add-mntns_pivot_root_ro-test.patch index d165f23..1a5f14d 100644 --- a/0176-zdtm-add-mntns_pivot_root_ro-test.patch +++ b/0175-zdtm-add-mntns_pivot_root_ro-test.patch @@ -1,7 +1,7 @@ -From b79f69573471a5bcb0ea8e74d5b1eae5dd5e3d24 Mon Sep 17 00:00:00 2001 +From 432f84d74bed3ef0edd2d9271c1b6f3e681fc9ca Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 13 Jan 2022 10:46:44 +0300 -Subject: [PATCH 176/245] zdtm: add mntns_pivot_root_ro test +Subject: [PATCH 175/249] zdtm: add mntns_pivot_root_ro test This checks that superblock readonly flag is applied to nested mntns roots on restore. diff --git a/0177-mount-restore-create-auxiliary-binfmt_misc-mount-in-.patch b/0176-mount-restore-create-auxiliary-binfmt_misc-mount-in-.patch similarity index 97% rename from 0177-mount-restore-create-auxiliary-binfmt_misc-mount-in-.patch rename to 0176-mount-restore-create-auxiliary-binfmt_misc-mount-in-.patch index 6dc0d17..3bfa274 100644 --- a/0177-mount-restore-create-auxiliary-binfmt_misc-mount-in-.patch +++ b/0176-mount-restore-create-auxiliary-binfmt_misc-mount-in-.patch @@ -1,7 +1,7 @@ -From e1a4ba44de4eb4bd0818236323afee1264d220da Mon Sep 17 00:00:00 2001 +From 764cb9f4074b0a4378a80036e7fd8c6a3b0e668c Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Tue, 23 Jul 2019 18:33:59 +0300 -Subject: [PATCH 177/245] mount/restore: create auxiliary binfmt_misc mount in +Subject: [PATCH 176/249] mount/restore: create auxiliary binfmt_misc mount in the root yard Put our auxiliary binfmt_misc mount in "/binfmt_misc" instead diff --git a/0178-mount-restore-leave-ns_mountpoint-NULL-for-aux-binfm.patch b/0177-mount-restore-leave-ns_mountpoint-NULL-for-aux-binfm.patch similarity index 88% rename from 0178-mount-restore-leave-ns_mountpoint-NULL-for-aux-binfm.patch rename to 0177-mount-restore-leave-ns_mountpoint-NULL-for-aux-binfm.patch index 87b51dc..17c45ea 100644 --- a/0178-mount-restore-leave-ns_mountpoint-NULL-for-aux-binfm.patch +++ b/0177-mount-restore-leave-ns_mountpoint-NULL-for-aux-binfm.patch @@ -1,7 +1,7 @@ -From db85d61119ce01ca7f1fd20b955517ca7afb647d Mon Sep 17 00:00:00 2001 +From 3d86ba5d0a0d5acdcfcc18ec6e0f9f95f9f934d2 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 13 Jan 2022 17:45:46 +0300 -Subject: [PATCH 178/245] mount/restore: leave ns_mountpoint NULL for aux +Subject: [PATCH 177/249] mount/restore: leave ns_mountpoint NULL for aux binfmt_misc mount On dump, yes, mountpoint and ns_mountpoint are the same, but on restore diff --git a/0179-mount-replace-CRTIME_MNT_ID-with-HELPER_MNT_ID.patch b/0178-mount-replace-CRTIME_MNT_ID-with-HELPER_MNT_ID.patch similarity index 94% rename from 0179-mount-replace-CRTIME_MNT_ID-with-HELPER_MNT_ID.patch rename to 0178-mount-replace-CRTIME_MNT_ID-with-HELPER_MNT_ID.patch index 1ed88b1..b100f8e 100644 --- a/0179-mount-replace-CRTIME_MNT_ID-with-HELPER_MNT_ID.patch +++ b/0178-mount-replace-CRTIME_MNT_ID-with-HELPER_MNT_ID.patch @@ -1,7 +1,7 @@ -From 583409d5cde3e2bd26f932ef1164e18725dd0a8a Mon Sep 17 00:00:00 2001 +From 63f702594183d1bd5a08cabb0751f63acc94902d Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 7 May 2020 16:13:02 +0300 -Subject: [PATCH 179/245] mount: replace CRTIME_MNT_ID with HELPER_MNT_ID +Subject: [PATCH 178/249] mount: replace CRTIME_MNT_ID with HELPER_MNT_ID Root yard mount also has mnt_id == 0 so it will look better with a new name. Let's explicitly initialize root yard mnt_id to HELPER_MNT_ID diff --git a/0180-mount-add-can_receive_master_from_root-helper.patch b/0179-mount-add-can_receive_master_from_root-helper.patch similarity index 94% rename from 0180-mount-add-can_receive_master_from_root-helper.patch rename to 0179-mount-add-can_receive_master_from_root-helper.patch index c9b94d8..c57396f 100644 --- a/0180-mount-add-can_receive_master_from_root-helper.patch +++ b/0179-mount-add-can_receive_master_from_root-helper.patch @@ -1,7 +1,7 @@ -From 4ca0014e28625bf24cdd646c3ddf11254b246d5a Mon Sep 17 00:00:00 2001 +From 46386c3566ad82f17c96048a275b5ba4c2475fa9 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 30 Dec 2021 15:24:30 +0300 -Subject: [PATCH 180/245] mount: add can_receive_master_from_root helper +Subject: [PATCH 179/249] mount: add can_receive_master_from_root helper If mount has external master_id it can inherit it as a bind of external mount, but also it can inherit it as a bind of container root mount, so diff --git a/0181-mount-put-external-slavery-mounts-to-separate-mnt_ex.patch b/0180-mount-put-external-slavery-mounts-to-separate-mnt_ex.patch similarity index 95% rename from 0181-mount-put-external-slavery-mounts-to-separate-mnt_ex.patch rename to 0180-mount-put-external-slavery-mounts-to-separate-mnt_ex.patch index 295cc85..2e1bcb8 100644 --- a/0181-mount-put-external-slavery-mounts-to-separate-mnt_ex.patch +++ b/0180-mount-put-external-slavery-mounts-to-separate-mnt_ex.patch @@ -1,7 +1,7 @@ -From d64abf2fd7f87b87a002060cfb48366d8a5acf42 Mon Sep 17 00:00:00 2001 +From f08c3b899fbaf2e4b0f496cfdfa1cc5523161c80 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 20 Feb 2020 10:50:42 +0300 -Subject: [PATCH 181/245] mount: put external slavery mounts to separate +Subject: [PATCH 180/249] mount: put external slavery mounts to separate mnt_ext_slave list We need to put mounts which need to inherit master_id from external diff --git a/0182-mount-do-not-override-master_id-to-1-for-root-binds.patch b/0181-mount-do-not-override-master_id-to-1-for-root-binds.patch similarity index 96% rename from 0182-mount-do-not-override-master_id-to-1-for-root-binds.patch rename to 0181-mount-do-not-override-master_id-to-1-for-root-binds.patch index 7e83dd6..ddaf9c6 100644 --- a/0182-mount-do-not-override-master_id-to-1-for-root-binds.patch +++ b/0181-mount-do-not-override-master_id-to-1-for-root-binds.patch @@ -1,7 +1,7 @@ -From c1614365dd48ff9bde55f452e1bbcd75f59394d5 Mon Sep 17 00:00:00 2001 +From 03cb0595a299ffe3e7e55ecb9cc0402277f75e65 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Fri, 14 Jan 2022 14:33:30 +0300 -Subject: [PATCH 182/245] mount: do not override master_id to -1 for root binds +Subject: [PATCH 181/249] mount: do not override master_id to -1 for root binds There is no point to lose this information, having -1 everywhere in mount images instead of acutall master id can be confusing. diff --git a/0183-mount-add-helper-mnt_get_external_bind_nodev.patch b/0182-mount-add-helper-mnt_get_external_bind_nodev.patch similarity index 93% rename from 0183-mount-add-helper-mnt_get_external_bind_nodev.patch rename to 0182-mount-add-helper-mnt_get_external_bind_nodev.patch index 67bd648..ce5d05a 100644 --- a/0183-mount-add-helper-mnt_get_external_bind_nodev.patch +++ b/0182-mount-add-helper-mnt_get_external_bind_nodev.patch @@ -1,7 +1,7 @@ -From 62d2a03d575b7876fb28e54c44407d9e398ed2f8 Mon Sep 17 00:00:00 2001 +From dc2aaeb239af4851d0d157e85d2d2f98bad289d5 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Wed, 27 May 2020 11:50:34 +0300 -Subject: [PATCH 183/245] mount: add helper mnt_get_external_bind_nodev +Subject: [PATCH 182/249] mount: add helper mnt_get_external_bind_nodev Will use it to find shared mount we can bind from and also can inherit external slavery. Device-external can't give us external slavery. diff --git a/0184-mount-prepare-is_overmounted-as-early-as-possible.patch b/0183-mount-prepare-is_overmounted-as-early-as-possible.patch similarity index 96% rename from 0184-mount-prepare-is_overmounted-as-early-as-possible.patch rename to 0183-mount-prepare-is_overmounted-as-early-as-possible.patch index b47c79a..5d47d03 100644 --- a/0184-mount-prepare-is_overmounted-as-early-as-possible.patch +++ b/0183-mount-prepare-is_overmounted-as-early-as-possible.patch @@ -1,7 +1,7 @@ -From 7d5222dce8fc65def14c935b8a669d38d65c81e0 Mon Sep 17 00:00:00 2001 +From 85f9f104c25b032db7f4012e4209d6039ed9042e Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Fri, 29 May 2020 10:27:05 +0300 -Subject: [PATCH 184/245] mount: prepare is_overmounted as early as possible +Subject: [PATCH 183/249] mount: prepare is_overmounted as early as possible Function mnt_is_overmounted is designed to detect if mount is overmounted in current tree using comparison of mountpoints of neighbour mounts for detection. diff --git a/0185-mount-move-root-yard-tree-merge-as-early-as-possible.patch b/0184-mount-move-root-yard-tree-merge-as-early-as-possible.patch similarity index 95% rename from 0185-mount-move-root-yard-tree-merge-as-early-as-possible.patch rename to 0184-mount-move-root-yard-tree-merge-as-early-as-possible.patch index 0e00940..cf719be 100644 --- a/0185-mount-move-root-yard-tree-merge-as-early-as-possible.patch +++ b/0184-mount-move-root-yard-tree-merge-as-early-as-possible.patch @@ -1,7 +1,7 @@ -From bdd198cd917643f92e3b7bec7146eb3f51fec92b Mon Sep 17 00:00:00 2001 +From 96d694c36abfb17427e058958ca61865491da160 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Mon, 29 Jun 2020 18:04:41 +0300 -Subject: [PATCH 185/245] mount: move root yard tree merge as early as possible +Subject: [PATCH 184/249] mount: move root yard tree merge as early as possible Let's merge mount trees under root_yard just after reading from image. diff --git a/0186-mount-fix-broken-remounted_rw-check.patch b/0185-mount-fix-broken-remounted_rw-check.patch similarity index 88% rename from 0186-mount-fix-broken-remounted_rw-check.patch rename to 0185-mount-fix-broken-remounted_rw-check.patch index d4b51f4..71ce9cc 100644 --- a/0186-mount-fix-broken-remounted_rw-check.patch +++ b/0185-mount-fix-broken-remounted_rw-check.patch @@ -1,7 +1,7 @@ -From 8b6d30c5a762065fb1a30dda7a7b061df3df8cbe Mon Sep 17 00:00:00 2001 +From 38a7d96e01f897f1da38d1fcbcbc362fc6628052 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Wed, 8 Jul 2020 09:57:33 +0300 -Subject: [PATCH 186/245] mount: fix broken remounted_rw check +Subject: [PATCH 185/249] mount: fix broken remounted_rw check Expression (x && REMOUNTED_RW) is always same as just (x). diff --git a/0187-mount-make-general-place-for-shared-variables-on-mou.patch b/0186-mount-make-general-place-for-shared-variables-on-mou.patch similarity index 95% rename from 0187-mount-make-general-place-for-shared-variables-on-mou.patch rename to 0186-mount-make-general-place-for-shared-variables-on-mou.patch index 97a630c..f824b9d 100644 --- a/0187-mount-make-general-place-for-shared-variables-on-mou.patch +++ b/0186-mount-make-general-place-for-shared-variables-on-mou.patch @@ -1,7 +1,7 @@ -From 6453e35364bc9816aac9087501082aa157d67d23 Mon Sep 17 00:00:00 2001 +From a554c2d6d9a652ad32f272e7c2a03eec056220e5 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Tue, 16 Jun 2020 16:19:42 +0300 -Subject: [PATCH 187/245] mount: make general place for shared variables on +Subject: [PATCH 186/249] mount: make general place for shared variables on mount-info on restore Put remounted_rw to it. This allows us to easily add some more of such diff --git a/0188-autofs-use-ns_mountpoint-in-autofs_create_dentries.patch b/0187-autofs-use-ns_mountpoint-in-autofs_create_dentries.patch similarity index 93% rename from 0188-autofs-use-ns_mountpoint-in-autofs_create_dentries.patch rename to 0187-autofs-use-ns_mountpoint-in-autofs_create_dentries.patch index c1e8a52..fc6943d 100644 --- a/0188-autofs-use-ns_mountpoint-in-autofs_create_dentries.patch +++ b/0187-autofs-use-ns_mountpoint-in-autofs_create_dentries.patch @@ -1,7 +1,7 @@ -From 3bd5d9b39eac0cd20c427a77f94700530c5c1044 Mon Sep 17 00:00:00 2001 +From f84949f68f001a1a06e9c612f34ec573d962e6c4 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Tue, 26 May 2020 16:40:57 +0300 -Subject: [PATCH 188/245] autofs: use ns_mountpoint in autofs_create_dentries +Subject: [PATCH 187/249] autofs: use ns_mountpoint in autofs_create_dentries Replace ->mountpoint with ->ns_mountpoint for determining relations between mounts. diff --git a/0189-mount-use-ns_mountpoint-in-mnt_is_overmounted.patch b/0188-mount-use-ns_mountpoint-in-mnt_is_overmounted.patch similarity index 91% rename from 0189-mount-use-ns_mountpoint-in-mnt_is_overmounted.patch rename to 0188-mount-use-ns_mountpoint-in-mnt_is_overmounted.patch index 0c07830..394ddd2 100644 --- a/0189-mount-use-ns_mountpoint-in-mnt_is_overmounted.patch +++ b/0188-mount-use-ns_mountpoint-in-mnt_is_overmounted.patch @@ -1,7 +1,7 @@ -From 7fa7b4a49e5e3ff2f244ab85b41baa78d53eabb2 Mon Sep 17 00:00:00 2001 +From eebae8cb3ef05114fbcce56c37d405c18d640d4a Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Tue, 30 Nov 2021 12:11:02 +0300 -Subject: [PATCH 189/245] mount: use ns_mountpoint in mnt_is_overmounted +Subject: [PATCH 188/249] mount: use ns_mountpoint in mnt_is_overmounted Let's use ->ns_mountpoint in comparison as ->mountpoint can change (e.g. see how we add ns root in get_mp_mountpoint and in do_remap_mount we can diff --git a/0190-mount-skip-root-yard-children-from-mnt_needs_remap-c.patch b/0189-mount-skip-root-yard-children-from-mnt_needs_remap-c.patch similarity index 91% rename from 0190-mount-skip-root-yard-children-from-mnt_needs_remap-c.patch rename to 0189-mount-skip-root-yard-children-from-mnt_needs_remap-c.patch index 858c52a..b37ef34 100644 --- a/0190-mount-skip-root-yard-children-from-mnt_needs_remap-c.patch +++ b/0189-mount-skip-root-yard-children-from-mnt_needs_remap-c.patch @@ -1,7 +1,7 @@ -From e1bb0fb902c77668bbc41ad7c1fd6a1ea777c8df Mon Sep 17 00:00:00 2001 +From 744bd436864bda3bef9d5117c802c6d6355dc568 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Fri, 29 May 2020 12:40:52 +0300 -Subject: [PATCH 190/245] mount: skip root yard children from mnt_needs_remap +Subject: [PATCH 189/249] mount: skip root yard children from mnt_needs_remap check There is no point of remaping ns root mounts they can't overmount anybody. diff --git a/0191-mount-use-ns_mountpoint-in-validate_children_collisi.patch b/0190-mount-use-ns_mountpoint-in-validate_children_collisi.patch similarity index 91% rename from 0191-mount-use-ns_mountpoint-in-validate_children_collisi.patch rename to 0190-mount-use-ns_mountpoint-in-validate_children_collisi.patch index 8b82a12..1757c47 100644 --- a/0191-mount-use-ns_mountpoint-in-validate_children_collisi.patch +++ b/0190-mount-use-ns_mountpoint-in-validate_children_collisi.patch @@ -1,7 +1,7 @@ -From aab7439cca03f04107e1783d43f9dc898a7bea11 Mon Sep 17 00:00:00 2001 +From 1c00cde48a8dd65cd49c253af655eb98aa002967 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Fri, 29 May 2020 13:00:48 +0300 -Subject: [PATCH 191/245] mount: use ns_mountpoint in +Subject: [PATCH 190/249] mount: use ns_mountpoint in validate_children_collision Function validate_children_collision is both called on dump and on diff --git a/0192-mount-use-ns_mountpoint-in-root_path_from_parent.patch b/0191-mount-use-ns_mountpoint-in-root_path_from_parent.patch similarity index 92% rename from 0192-mount-use-ns_mountpoint-in-root_path_from_parent.patch rename to 0191-mount-use-ns_mountpoint-in-root_path_from_parent.patch index 4b09fda..1e203c3 100644 --- a/0192-mount-use-ns_mountpoint-in-root_path_from_parent.patch +++ b/0191-mount-use-ns_mountpoint-in-root_path_from_parent.patch @@ -1,7 +1,7 @@ -From e78d1e91a6e66757482138da54c4d2efa2e668ff Mon Sep 17 00:00:00 2001 +From 305750f27c8492bd51145ae4a18ff2dd12793d12 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Fri, 29 May 2020 13:39:10 +0300 -Subject: [PATCH 192/245] mount: use ns_mountpoint in root_path_from_parent +Subject: [PATCH 191/249] mount: use ns_mountpoint in root_path_from_parent Fail root_path_from_parent if parent is root_yard, we want to only lookup root path in real parent mounts. diff --git a/0193-mount-use-ns_mountpoint-for-children-overmount-check.patch b/0192-mount-use-ns_mountpoint-for-children-overmount-check.patch similarity index 89% rename from 0193-mount-use-ns_mountpoint-for-children-overmount-check.patch rename to 0192-mount-use-ns_mountpoint-for-children-overmount-check.patch index e1a8ae9..94146b4 100644 --- a/0193-mount-use-ns_mountpoint-for-children-overmount-check.patch +++ b/0192-mount-use-ns_mountpoint-for-children-overmount-check.patch @@ -1,7 +1,7 @@ -From 8900c398fc323924eb9fd6b4ed66b18e5cadd9a9 Mon Sep 17 00:00:00 2001 +From 16b279a63594bdff1e5376e22794439487d6f0bb Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Fri, 29 May 2020 13:52:45 +0300 -Subject: [PATCH 193/245] mount: use ns_mountpoint for children-overmount check +Subject: [PATCH 192/249] mount: use ns_mountpoint for children-overmount check We need to skip root_yard_mp parent as it has no ns_mountpoint, it also has no children overmounts so we are safe, all others can be compared by diff --git a/0194-path-simplify-mnt_get_sibling_path-via-get_relative_.patch b/0193-path-simplify-mnt_get_sibling_path-via-get_relative_.patch similarity index 97% rename from 0194-path-simplify-mnt_get_sibling_path-via-get_relative_.patch rename to 0193-path-simplify-mnt_get_sibling_path-via-get_relative_.patch index 92eb15a..eff2caa 100644 --- a/0194-path-simplify-mnt_get_sibling_path-via-get_relative_.patch +++ b/0193-path-simplify-mnt_get_sibling_path-via-get_relative_.patch @@ -1,7 +1,7 @@ -From 421fb3b73b950669600160ea74913e5c3d953d5c Mon Sep 17 00:00:00 2001 +From bdb7345ebea7034738a391534bd0c77ce144203c Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Wed, 1 Dec 2021 12:52:27 +0300 -Subject: [PATCH 194/245] path: simplify mnt_get_sibling_path via +Subject: [PATCH 193/249] path: simplify mnt_get_sibling_path via get_relative_path Previous code did: diff --git a/0195-mount-use-ns_mountpoint-in-collect_mntinfo.patch b/0194-mount-use-ns_mountpoint-in-collect_mntinfo.patch similarity index 92% rename from 0195-mount-use-ns_mountpoint-in-collect_mntinfo.patch rename to 0194-mount-use-ns_mountpoint-in-collect_mntinfo.patch index 598df95..be9dbbb 100644 --- a/0195-mount-use-ns_mountpoint-in-collect_mntinfo.patch +++ b/0194-mount-use-ns_mountpoint-in-collect_mntinfo.patch @@ -1,7 +1,7 @@ -From ef5460e9d44d4a94bf9845d7d0d8b52cb9b8a35e Mon Sep 17 00:00:00 2001 +From b37b302d47277d41a3a8287529739805bfa427a4 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Fri, 29 May 2020 14:34:03 +0300 -Subject: [PATCH 195/245] mount: use ns_mountpoint in collect_mntinfo +Subject: [PATCH 194/249] mount: use ns_mountpoint in collect_mntinfo At this point ns_mountpoint is equal to mountpoint. diff --git a/0196-mount-use-ns_mountpoint-in-aufs_parse.patch b/0195-mount-use-ns_mountpoint-in-aufs_parse.patch similarity index 85% rename from 0196-mount-use-ns_mountpoint-in-aufs_parse.patch rename to 0195-mount-use-ns_mountpoint-in-aufs_parse.patch index de4d860..b0f8fe7 100644 --- a/0196-mount-use-ns_mountpoint-in-aufs_parse.patch +++ b/0195-mount-use-ns_mountpoint-in-aufs_parse.patch @@ -1,7 +1,7 @@ -From 1f9b525b6f7c9a4a31f0f05b695dbb1c2e0d2592 Mon Sep 17 00:00:00 2001 +From 8506fbfdc3bcd4983f0808c76540ceba76c1bebb Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Fri, 29 May 2020 14:40:01 +0300 -Subject: [PATCH 196/245] mount: use ns_mountpoint in aufs_parse +Subject: [PATCH 195/249] mount: use ns_mountpoint in aufs_parse At this point ns_mountpoint is equal to mountpoint. diff --git a/0197-mount-use-ns_mountpoint-in-mnt_depth.patch b/0196-mount-use-ns_mountpoint-in-mnt_depth.patch similarity index 86% rename from 0197-mount-use-ns_mountpoint-in-mnt_depth.patch rename to 0196-mount-use-ns_mountpoint-in-mnt_depth.patch index c7a29c3..48dfad8 100644 --- a/0197-mount-use-ns_mountpoint-in-mnt_depth.patch +++ b/0196-mount-use-ns_mountpoint-in-mnt_depth.patch @@ -1,7 +1,7 @@ -From 9dc8da68e08544940403a0159f10c3df9bf664b7 Mon Sep 17 00:00:00 2001 +From b23ba1e4a50e7b9a1ca3f208983d73c683acbea1 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Fri, 29 May 2020 15:18:10 +0300 -Subject: [PATCH 197/245] mount: use ns_mountpoint in mnt_depth +Subject: [PATCH 196/249] mount: use ns_mountpoint in mnt_depth Function mnt_depth is only used on real mounts when building mount tree for single namespace, thats why we can compare those mounts with ns_mountpoint diff --git a/0198-mount-use-ns_mountpoint-instead-of-mountpoint-where-.patch b/0197-mount-use-ns_mountpoint-instead-of-mountpoint-where-.patch similarity index 99% rename from 0198-mount-use-ns_mountpoint-instead-of-mountpoint-where-.patch rename to 0197-mount-use-ns_mountpoint-instead-of-mountpoint-where-.patch index 9873349..b2d8d9f 100644 --- a/0198-mount-use-ns_mountpoint-instead-of-mountpoint-where-.patch +++ b/0197-mount-use-ns_mountpoint-instead-of-mountpoint-where-.patch @@ -1,7 +1,7 @@ -From fdb14abc5703c4da8afcae05fe10d83445283d61 Mon Sep 17 00:00:00 2001 +From fec02ce6c42779386cd621030887194aeb7f2aca Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Fri, 29 May 2020 12:02:16 +0300 -Subject: [PATCH 198/245] mount: use ns_mountpoint instead of mountpoint where +Subject: [PATCH 197/249] mount: use ns_mountpoint instead of mountpoint where possible On dump ->mountpoint and ->ns_mountpoint is the same, but on restore diff --git a/0199-mount-add-service_mountpoint-getter-for-mountpoint.patch b/0198-mount-add-service_mountpoint-getter-for-mountpoint.patch similarity index 99% rename from 0199-mount-add-service_mountpoint-getter-for-mountpoint.patch rename to 0198-mount-add-service_mountpoint-getter-for-mountpoint.patch index dc7b0a2..4bd9ea0 100644 --- a/0199-mount-add-service_mountpoint-getter-for-mountpoint.patch +++ b/0198-mount-add-service_mountpoint-getter-for-mountpoint.patch @@ -1,7 +1,7 @@ -From 06ad6dc02320535221228481a9fb6b864af81992 Mon Sep 17 00:00:00 2001 +From 569d5e17f39c8c206c4b20386b101b29a8fee188 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 28 May 2020 11:14:39 +0300 -Subject: [PATCH 199/245] mount: add service_mountpoint getter for ->mountpoint +Subject: [PATCH 198/249] mount: add service_mountpoint getter for ->mountpoint This getter should be used when we wan't to access the mount on the filesystem. In next patches we want to be able to change the location of the mount on diff --git a/0200-files-reg-split-create_ghost_dentry-out-of-create_gh.patch b/0199-files-reg-split-create_ghost_dentry-out-of-create_gh.patch similarity index 96% rename from 0200-files-reg-split-create_ghost_dentry-out-of-create_gh.patch rename to 0199-files-reg-split-create_ghost_dentry-out-of-create_gh.patch index 145f127..1bf2d51 100644 --- a/0200-files-reg-split-create_ghost_dentry-out-of-create_gh.patch +++ b/0199-files-reg-split-create_ghost_dentry-out-of-create_gh.patch @@ -1,7 +1,7 @@ -From 942d9f5e0d484eefbdef9ee69c326aa176da4d10 Mon Sep 17 00:00:00 2001 +From e9ff05033bda690539b42e658d110ff3991414b4 Mon Sep 17 00:00:00 2001 From: Stanislav Kinsburskiy Date: Mon, 11 Jul 2016 14:14:15 +0300 -Subject: [PATCH 200/245] files-reg: split create_ghost_dentry out of +Subject: [PATCH 199/249] files-reg: split create_ghost_dentry out of create_ghost Will use it to make create_ghost work with mount-v2. diff --git a/0201-files-reg-teach-create_ghost-to-work-with-mount-v2.patch b/0200-files-reg-teach-create_ghost-to-work-with-mount-v2.patch similarity index 96% rename from 0201-files-reg-teach-create_ghost-to-work-with-mount-v2.patch rename to 0200-files-reg-teach-create_ghost-to-work-with-mount-v2.patch index c061809..69c3469 100644 --- a/0201-files-reg-teach-create_ghost-to-work-with-mount-v2.patch +++ b/0200-files-reg-teach-create_ghost-to-work-with-mount-v2.patch @@ -1,7 +1,7 @@ -From 494e92c1e7ef7e8ea8e506884de18b2affe21df7 Mon Sep 17 00:00:00 2001 +From d33eee29e43f5f8a0aa8d4ee9c21006e08685367 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 14 May 2020 14:11:47 +0300 -Subject: [PATCH 201/245] files-reg: teach create_ghost to work with mount-v2 +Subject: [PATCH 200/249] files-reg: teach create_ghost to work with mount-v2 While mounts-v2 would mount all mounts plain without tree in service mntns we can't just use path relative to mntns to find remap. Make it diff --git a/0202-files-reg-teach-clean_one_remap-to-work-with-mount-v.patch b/0201-files-reg-teach-clean_one_remap-to-work-with-mount-v.patch similarity index 95% rename from 0202-files-reg-teach-clean_one_remap-to-work-with-mount-v.patch rename to 0201-files-reg-teach-clean_one_remap-to-work-with-mount-v.patch index e23a476..78d9221 100644 --- a/0202-files-reg-teach-clean_one_remap-to-work-with-mount-v.patch +++ b/0201-files-reg-teach-clean_one_remap-to-work-with-mount-v.patch @@ -1,7 +1,7 @@ -From a50e588c378ebe862e79a17609f1023be06324b0 Mon Sep 17 00:00:00 2001 +From 379cfdd821911d475e0c74e36c9d8913a5f9a989 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 14 May 2020 16:36:57 +0300 -Subject: [PATCH 202/245] files-reg: teach clean_one_remap to work with +Subject: [PATCH 201/249] files-reg: teach clean_one_remap to work with mount-v2 While mounts-v2 mounts all mounts plain without tree in service mntns we can't diff --git a/0203-kerndat-Check-for-MOVE_MOUNT_SET_GROUP-availability.patch b/0202-kerndat-Check-for-MOVE_MOUNT_SET_GROUP-availability.patch similarity index 98% rename from 0203-kerndat-Check-for-MOVE_MOUNT_SET_GROUP-availability.patch rename to 0202-kerndat-Check-for-MOVE_MOUNT_SET_GROUP-availability.patch index 54fc3a5..d06987a 100644 --- a/0203-kerndat-Check-for-MOVE_MOUNT_SET_GROUP-availability.patch +++ b/0202-kerndat-Check-for-MOVE_MOUNT_SET_GROUP-availability.patch @@ -1,7 +1,7 @@ -From d48d4f9e3b5c08028a07e8a77f01cf419db530ec Mon Sep 17 00:00:00 2001 +From 44be7557f0477237945e244de6b26a9472a1591b Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 25 Mar 2021 13:37:55 +0300 -Subject: [PATCH 203/245] kerndat: Check for MOVE_MOUNT_SET_GROUP availability +Subject: [PATCH 202/249] kerndat: Check for MOVE_MOUNT_SET_GROUP availability Mounts-v2 requires new kernel feature MOVE_MOUNT_SET_GROUP to be able to restore propagation between mounts right. diff --git a/0204-compel-add-open_tree-syscall.patch b/0203-compel-add-open_tree-syscall.patch similarity index 98% rename from 0204-compel-add-open_tree-syscall.patch rename to 0203-compel-add-open_tree-syscall.patch index 212887b..05d0b8c 100644 --- a/0204-compel-add-open_tree-syscall.patch +++ b/0203-compel-add-open_tree-syscall.patch @@ -1,7 +1,7 @@ -From 51f04ae1074b115f486aaaf0a3feb72d0bf90130 Mon Sep 17 00:00:00 2001 +From e72cf151b6dfe88f78715fca4dff560350688e66 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Fri, 24 Dec 2021 13:23:29 +0300 -Subject: [PATCH 204/245] compel: add open_tree syscall +Subject: [PATCH 203/249] compel: add open_tree syscall Will use this for cross mount namespace bindmounts. diff --git a/0205-kerndat-check-whether-the-openat2-syscall-is-support.patch b/0204-kerndat-check-whether-the-openat2-syscall-is-support.patch similarity index 98% rename from 0205-kerndat-check-whether-the-openat2-syscall-is-support.patch rename to 0204-kerndat-check-whether-the-openat2-syscall-is-support.patch index c72e3ee..ae9dd65 100644 --- a/0205-kerndat-check-whether-the-openat2-syscall-is-support.patch +++ b/0204-kerndat-check-whether-the-openat2-syscall-is-support.patch @@ -1,7 +1,7 @@ -From 4fd088daf734226b17c7590420fd5bea6a5d3f7c Mon Sep 17 00:00:00 2001 +From 5bffbff69465054b7e9c879e4a18707df1534fe9 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Wed, 22 Dec 2021 11:07:24 +0300 -Subject: [PATCH 205/245] kerndat: check whether the openat2 syscall is +Subject: [PATCH 204/249] kerndat: check whether the openat2 syscall is supported Will use openat2 + RESOLVE_NO_XDEV to detect mountpoints. diff --git a/0206-util-add-resolve_mountpoint-helper.patch b/0205-util-add-resolve_mountpoint-helper.patch similarity index 96% rename from 0206-util-add-resolve_mountpoint-helper.patch rename to 0205-util-add-resolve_mountpoint-helper.patch index fb0b21d..c249c42 100644 --- a/0206-util-add-resolve_mountpoint-helper.patch +++ b/0205-util-add-resolve_mountpoint-helper.patch @@ -1,7 +1,7 @@ -From da16ce9766bc15aa7a623fe4c6e9af6275f943d3 Mon Sep 17 00:00:00 2001 +From 7d1f6274209d2991016f1c4c8bd7b46321ca4d88 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Wed, 22 Dec 2021 19:26:32 +0300 -Subject: [PATCH 206/245] util: add resolve_mountpoint helper +Subject: [PATCH 205/249] util: add resolve_mountpoint helper This helper would be useful to get mountpoints of source path of external mounts without parsing host mountinfo. When we restore diff --git a/0207-crtools-move-check_options-after-kerndat_init-and-lo.patch b/0206-crtools-move-check_options-after-kerndat_init-and-lo.patch similarity index 87% rename from 0207-crtools-move-check_options-after-kerndat_init-and-lo.patch rename to 0206-crtools-move-check_options-after-kerndat_init-and-lo.patch index 8ecf6b5..ce43968 100644 --- a/0207-crtools-move-check_options-after-kerndat_init-and-lo.patch +++ b/0206-crtools-move-check_options-after-kerndat_init-and-lo.patch @@ -1,7 +1,7 @@ -From d077770b9acf0128bf8d3f02a37e5ce4d15883d2 Mon Sep 17 00:00:00 2001 +From dd64b33d47631a47de17e807d7928a345272046c Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 23 Dec 2021 17:19:49 +0300 -Subject: [PATCH 207/245] crtools: move check_options after kerndat_init and +Subject: [PATCH 206/249] crtools: move check_options after kerndat_init and log_init This can be useful to check options which depend on some kernel features diff --git a/0208-config-rpc-add-new-option-mntns-compat-mode-for-old-.patch b/0207-config-rpc-add-new-option-mntns-compat-mode-for-old-.patch similarity index 98% rename from 0208-config-rpc-add-new-option-mntns-compat-mode-for-old-.patch rename to 0207-config-rpc-add-new-option-mntns-compat-mode-for-old-.patch index 1cb6660..935de6f 100644 --- a/0208-config-rpc-add-new-option-mntns-compat-mode-for-old-.patch +++ b/0207-config-rpc-add-new-option-mntns-compat-mode-for-old-.patch @@ -1,7 +1,7 @@ -From 4bfe5acc009d600e037758938616656a257c8dfb Mon Sep 17 00:00:00 2001 +From 273d3f4ccc95eb7bd0553de1caa217835525311c Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Mon, 25 May 2020 17:43:48 +0300 -Subject: [PATCH 208/245] config/rpc: add new option --mntns-compat-mode for +Subject: [PATCH 207/249] config/rpc: add new option --mntns-compat-mode for old mount engine We plan to switch to Mounts-v2 engine for restoring mounts by default, diff --git a/0209-mount-add-plain-mountpoints.patch b/0208-mount-add-plain-mountpoints.patch similarity index 97% rename from 0209-mount-add-plain-mountpoints.patch rename to 0208-mount-add-plain-mountpoints.patch index 509ee1d..4108ddf 100644 --- a/0209-mount-add-plain-mountpoints.patch +++ b/0208-mount-add-plain-mountpoints.patch @@ -1,7 +1,7 @@ -From 71ace0aa142e5c94d055c41e90581c98f9c90be0 Mon Sep 17 00:00:00 2001 +From db674a523b391ccb8eb65191096931cc2e95b9a5 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 28 May 2020 11:30:16 +0300 -Subject: [PATCH 209/245] mount: add plain mountpoints +Subject: [PATCH 208/249] mount: add plain mountpoints This is a preparation of mounts-v2 new algorithm for mount restore, we add an alternative mountpoints to each mount, so that if we mount mounts diff --git a/0210-files-reg-export-parent-dirs-helpers-for-mount-v2.patch b/0209-files-reg-export-parent-dirs-helpers-for-mount-v2.patch similarity index 91% rename from 0210-files-reg-export-parent-dirs-helpers-for-mount-v2.patch rename to 0209-files-reg-export-parent-dirs-helpers-for-mount-v2.patch index 268302a..525b394 100644 --- a/0210-files-reg-export-parent-dirs-helpers-for-mount-v2.patch +++ b/0209-files-reg-export-parent-dirs-helpers-for-mount-v2.patch @@ -1,7 +1,7 @@ -From 19d0fad36fc1e52e1202e439c702f155ff67b395 Mon Sep 17 00:00:00 2001 +From 9191dbc6decd1cf15bcfce5fcb09488f69680c50 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Tue, 21 Dec 2021 12:14:23 +0300 -Subject: [PATCH 210/245] files-reg: export parent dirs helpers for mount-v2 +Subject: [PATCH 209/249] files-reg: export parent dirs helpers for mount-v2 Signed-off-by: Pavel Tikhomirov --- diff --git a/0211-mount-remove-double-ns_id-declaration.patch b/0210-mount-remove-double-ns_id-declaration.patch similarity index 86% rename from 0211-mount-remove-double-ns_id-declaration.patch rename to 0210-mount-remove-double-ns_id-declaration.patch index fca6582..40758c7 100644 --- a/0211-mount-remove-double-ns_id-declaration.patch +++ b/0210-mount-remove-double-ns_id-declaration.patch @@ -1,7 +1,7 @@ -From dd282f4655fc487554fe69476218093921107c6c Mon Sep 17 00:00:00 2001 +From 35f5403cef372bab0f593747c3b0348fc1d10c17 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Tue, 21 Dec 2021 12:43:42 +0300 -Subject: [PATCH 211/245] mount: remove double ns_id declaration +Subject: [PATCH 210/249] mount: remove double ns_id declaration Fixes: d0d117986 ("mount: move functions about mounts from proc_parse.h") diff --git a/0212-mount-export-common-defines-for-mount-v2.patch b/0211-mount-export-common-defines-for-mount-v2.patch similarity index 94% rename from 0212-mount-export-common-defines-for-mount-v2.patch rename to 0211-mount-export-common-defines-for-mount-v2.patch index 1ebd1c2..e350682 100644 --- a/0212-mount-export-common-defines-for-mount-v2.patch +++ b/0211-mount-export-common-defines-for-mount-v2.patch @@ -1,7 +1,7 @@ -From 3aa6f0cee2cf05ad2cc2aa571921cd75f2b864bc Mon Sep 17 00:00:00 2001 +From da341d7cd3e0a9ab312ce9ea18755a938d61e1bb Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Tue, 21 Dec 2021 12:46:57 +0300 -Subject: [PATCH 212/245] mount: export common defines for mount-v2 +Subject: [PATCH 211/249] mount: export common defines for mount-v2 Signed-off-by: Pavel Tikhomirov --- diff --git a/0213-mount-export-several-functions-for-mount-v2.patch b/0212-mount-export-several-functions-for-mount-v2.patch similarity index 97% rename from 0213-mount-export-several-functions-for-mount-v2.patch rename to 0212-mount-export-several-functions-for-mount-v2.patch index 29ac575..775acc1 100644 --- a/0213-mount-export-several-functions-for-mount-v2.patch +++ b/0212-mount-export-several-functions-for-mount-v2.patch @@ -1,7 +1,7 @@ -From 830934745e70c0837bf6c657540773243d3c5e16 Mon Sep 17 00:00:00 2001 +From ee35200cf6627cc0ea2b8067d759c0e4e798d825 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Tue, 21 Dec 2021 13:29:52 +0300 -Subject: [PATCH 213/245] mount: export several functions for mount-v2 +Subject: [PATCH 212/249] mount: export several functions for mount-v2 Signed-off-by: Pavel Tikhomirov --- diff --git a/0214-mount-export-global-variables-for-mount-v2.patch b/0213-mount-export-global-variables-for-mount-v2.patch similarity index 91% rename from 0214-mount-export-global-variables-for-mount-v2.patch rename to 0213-mount-export-global-variables-for-mount-v2.patch index 1722371..8d289d0 100644 --- a/0214-mount-export-global-variables-for-mount-v2.patch +++ b/0213-mount-export-global-variables-for-mount-v2.patch @@ -1,7 +1,7 @@ -From 270ea3e162fd31245b92bb1c64cafd00cadedd93 Mon Sep 17 00:00:00 2001 +From 0dfc8717477416fa14d87335f1be5f2e2f89a71e Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Tue, 21 Dec 2021 14:04:19 +0300 -Subject: [PATCH 214/245] mount: export global variables for mount-v2 +Subject: [PATCH 213/249] mount: export global variables for mount-v2 Export root_yard_mp and it's mntns_roots. diff --git a/0215-mount-add-new-mounts-v2-engine.patch b/0214-mount-add-new-mounts-v2-engine.patch similarity index 99% rename from 0215-mount-add-new-mounts-v2-engine.patch rename to 0214-mount-add-new-mounts-v2-engine.patch index 5caf98d..c4b794a 100644 --- a/0215-mount-add-new-mounts-v2-engine.patch +++ b/0214-mount-add-new-mounts-v2-engine.patch @@ -1,7 +1,7 @@ -From 2b18e8004dcebda432cd9cedb069eef9126148ad Mon Sep 17 00:00:00 2001 +From 14c2dd341a5a3b0a15095ae68047d7c061b53033 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Mon, 25 May 2020 18:12:49 +0300 -Subject: [PATCH 215/245] mount: add new mounts-v2 engine +Subject: [PATCH 214/249] mount: add new mounts-v2 engine Design of mounts-v2: diff --git a/0216-zdtm-enable-mounts-compat-mode-on-restore-with-mntns.patch b/0215-zdtm-enable-mounts-compat-mode-on-restore-with-mntns.patch similarity index 95% rename from 0216-zdtm-enable-mounts-compat-mode-on-restore-with-mntns.patch rename to 0215-zdtm-enable-mounts-compat-mode-on-restore-with-mntns.patch index 77600e6..84295ca 100644 --- a/0216-zdtm-enable-mounts-compat-mode-on-restore-with-mntns.patch +++ b/0215-zdtm-enable-mounts-compat-mode-on-restore-with-mntns.patch @@ -1,7 +1,7 @@ -From b43b740a33f13b0a5e902b0ef333a90a76f74d05 Mon Sep 17 00:00:00 2001 +From 3e814aba5a1ea040b655c5e4102ffaab157a433e Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Wed, 27 May 2020 16:11:20 +0300 -Subject: [PATCH 216/245] zdtm: enable mounts compat mode on restore with +Subject: [PATCH 215/249] zdtm: enable mounts compat mode on restore with --mntns-compat-mode option Cherry-picked from Virtuozzo criu: diff --git a/0217-ci-run-tests-for-old-mount-engine.patch b/0216-ci-run-tests-for-old-mount-engine.patch similarity index 89% rename from 0217-ci-run-tests-for-old-mount-engine.patch rename to 0216-ci-run-tests-for-old-mount-engine.patch index c387874..4b628ad 100644 --- a/0217-ci-run-tests-for-old-mount-engine.patch +++ b/0216-ci-run-tests-for-old-mount-engine.patch @@ -1,7 +1,7 @@ -From 73d2b2f9348261a1a47a8532446aa4efc29c4273 Mon Sep 17 00:00:00 2001 +From e4823210911c344e668eba7783f170816777f388 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Fri, 14 Jan 2022 12:12:12 +0300 -Subject: [PATCH 217/245] ci: run tests for old mount engine +Subject: [PATCH 216/249] ci: run tests for old mount engine Now when we switched to mount-v2 by default to check old mount engine we need to explicitly run with --mntns-compat-mode option. diff --git a/0218-zdtm-add-new-mnt_ext_sharing-test-for-mount-v2.patch b/0217-zdtm-add-new-mnt_ext_sharing-test-for-mount-v2.patch similarity index 98% rename from 0218-zdtm-add-new-mnt_ext_sharing-test-for-mount-v2.patch rename to 0217-zdtm-add-new-mnt_ext_sharing-test-for-mount-v2.patch index 0e9401a..f0d46c2 100644 --- a/0218-zdtm-add-new-mnt_ext_sharing-test-for-mount-v2.patch +++ b/0217-zdtm-add-new-mnt_ext_sharing-test-for-mount-v2.patch @@ -1,7 +1,7 @@ -From 05a3ccb37f67b40f4b734236b1175b30da0fe693 Mon Sep 17 00:00:00 2001 +From 289bfe5cb61a964ed022010e765ba2de489c389d Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Tue, 31 Dec 2019 15:56:44 +0300 -Subject: [PATCH 218/245] zdtm: add new mnt_ext_sharing test for mount-v2 +Subject: [PATCH 217/249] zdtm: add new mnt_ext_sharing test for mount-v2 These test simply checks that sharing between two mounts in container: 1) external mount and 2) it's bind persists (case when bind has the same diff --git a/0219-zdtm-add-mount_complex_sharing-test.patch b/0218-zdtm-add-mount_complex_sharing-test.patch similarity index 98% rename from 0219-zdtm-add-mount_complex_sharing-test.patch rename to 0218-zdtm-add-mount_complex_sharing-test.patch index cf2ceaa..68901e8 100644 --- a/0219-zdtm-add-mount_complex_sharing-test.patch +++ b/0218-zdtm-add-mount_complex_sharing-test.patch @@ -1,7 +1,7 @@ -From 19621b2b22680d4d9b811ac1a4d55e2b7952f53f Mon Sep 17 00:00:00 2001 +From 659f16d27bb23528229427c61b7591eeb51189a1 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Tue, 28 Jul 2020 11:49:45 +0300 -Subject: [PATCH 219/245] zdtm: add mount_complex_sharing test +Subject: [PATCH 218/249] zdtm: add mount_complex_sharing test Mounts-v2 engine should fix multiple problems of old engine relative to sharing options, lets add a test for such problems. diff --git a/0220-zdtm-add-propagation-group-with-mount-flags-to-mount.patch b/0219-zdtm-add-propagation-group-with-mount-flags-to-mount.patch similarity index 96% rename from 0220-zdtm-add-propagation-group-with-mount-flags-to-mount.patch rename to 0219-zdtm-add-propagation-group-with-mount-flags-to-mount.patch index a0705fc..75519c7 100644 --- a/0220-zdtm-add-propagation-group-with-mount-flags-to-mount.patch +++ b/0219-zdtm-add-propagation-group-with-mount-flags-to-mount.patch @@ -1,7 +1,7 @@ -From 799d2e2a4d9a3289138206cf1f8b843082490355 Mon Sep 17 00:00:00 2001 +From b7070dd5675a53b22db912c36242c0dde94d5a3e Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Wed, 14 Oct 2020 15:56:52 +0300 -Subject: [PATCH 220/245] zdtm: add propagation group with mount flags to +Subject: [PATCH 219/249] zdtm: add propagation group with mount flags to mount_complex_sharing Before mounts-v2 we have seen mounts loosing their mount readonly flags diff --git a/0221-zdtm-mount-v2-disable-mnt_tracefs-test.patch b/0220-zdtm-mount-v2-disable-mnt_tracefs-test.patch similarity index 90% rename from 0221-zdtm-mount-v2-disable-mnt_tracefs-test.patch rename to 0220-zdtm-mount-v2-disable-mnt_tracefs-test.patch index 7d5993f..0c0c057 100644 --- a/0221-zdtm-mount-v2-disable-mnt_tracefs-test.patch +++ b/0220-zdtm-mount-v2-disable-mnt_tracefs-test.patch @@ -1,7 +1,7 @@ -From 116692772b5f4ff1818262096ec7934086749be5 Mon Sep 17 00:00:00 2001 +From 5abbefa1f66eaded7f03f1d65a00b6aa8a57ab47 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Tue, 1 Dec 2020 16:07:16 +0300 -Subject: [PATCH 221/245] zdtm/mount-v2: disable mnt_tracefs test +Subject: [PATCH 220/249] zdtm/mount-v2: disable mnt_tracefs test We can have tracefs separate mount from debugfs and that's why the /sys/kernel/debug external mount now has children and this thing is not diff --git a/0222-ci-make-others-mnt_ext_dev-also-run-for-old-mount-en.patch b/0221-ci-make-others-mnt_ext_dev-also-run-for-old-mount-en.patch similarity index 91% rename from 0222-ci-make-others-mnt_ext_dev-also-run-for-old-mount-en.patch rename to 0221-ci-make-others-mnt_ext_dev-also-run-for-old-mount-en.patch index 418bb99..74b8d9e 100644 --- a/0222-ci-make-others-mnt_ext_dev-also-run-for-old-mount-en.patch +++ b/0221-ci-make-others-mnt_ext_dev-also-run-for-old-mount-en.patch @@ -1,7 +1,7 @@ -From fa1c38177f1d49a7cfe506a5cfb4c8cd8231a21e Mon Sep 17 00:00:00 2001 +From c72b743d0ccdfc2af699b87d75af8ddab675fa26 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Fri, 14 Jan 2022 19:29:08 +0300 -Subject: [PATCH 222/245] ci: make others/mnt_ext_dev also run for old mount +Subject: [PATCH 221/249] ci: make others/mnt_ext_dev also run for old mount engine Now when we switched to mount-v2 by default to check old mount engine we diff --git a/0223-test-jenkins-test-for-old-mount-engine.patch b/0222-test-jenkins-test-for-old-mount-engine.patch similarity index 88% rename from 0223-test-jenkins-test-for-old-mount-engine.patch rename to 0222-test-jenkins-test-for-old-mount-engine.patch index 32f9347..c695058 100644 --- a/0223-test-jenkins-test-for-old-mount-engine.patch +++ b/0222-test-jenkins-test-for-old-mount-engine.patch @@ -1,7 +1,7 @@ -From de47b29c8410d930c55e3341e287964de1395efa Mon Sep 17 00:00:00 2001 +From 24dffdc2410627966a82d7cc8b29797cecbab61b Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Mon, 31 Jan 2022 11:02:36 +0300 -Subject: [PATCH 223/245] test/jenkins: test for old mount engine +Subject: [PATCH 222/249] test/jenkins: test for old mount engine Let's run zdtm in jenkins with --mntns-compat-mode option and same for device-external mount test from others. diff --git a/0224-zdtm-mount-v2-disable-pty-console-test.patch b/0223-zdtm-mount-v2-disable-pty-console-test.patch similarity index 95% rename from 0224-zdtm-mount-v2-disable-pty-console-test.patch rename to 0223-zdtm-mount-v2-disable-pty-console-test.patch index 129ebf3..99f5968 100644 --- a/0224-zdtm-mount-v2-disable-pty-console-test.patch +++ b/0223-zdtm-mount-v2-disable-pty-console-test.patch @@ -1,7 +1,7 @@ -From b86b40a1f4d9cba0c1494d94c1aaf496006bffaa Mon Sep 17 00:00:00 2001 +From 16285bfab2f24816554ee6cb70430fcbcae7ac3f Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Mon, 14 Mar 2022 12:01:10 +0300 -Subject: [PATCH 224/245] zdtm/mount-v2: disable pty-console test +Subject: [PATCH 223/249] zdtm/mount-v2: disable pty-console test [root@fedora criu]# ./test/zdtm.py run -t zdtm/static/pty-console --iters 2 --keep-going --ignore-taint [WARNING] Option --keep-going is more useful when running multiple tests diff --git a/0225-mount-v2-make-mount-engine-fallback-messages-logleve.patch b/0224-mount-v2-make-mount-engine-fallback-messages-logleve.patch similarity index 92% rename from 0225-mount-v2-make-mount-engine-fallback-messages-logleve.patch rename to 0224-mount-v2-make-mount-engine-fallback-messages-logleve.patch index 5f7b7a7..8ffc46f 100644 --- a/0225-mount-v2-make-mount-engine-fallback-messages-logleve.patch +++ b/0224-mount-v2-make-mount-engine-fallback-messages-logleve.patch @@ -1,7 +1,7 @@ -From 10b38162535149095ee7290d98632043c63a21e9 Mon Sep 17 00:00:00 2001 +From 14621c81247af478617ad8295c5819e99ffa188c Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Sun, 20 Mar 2022 19:38:34 +0300 -Subject: [PATCH 225/245] mount-v2: make mount engine fallback messages +Subject: [PATCH 224/249] mount-v2: make mount engine fallback messages loglevel debug On pre v5.15 kernel we don't have MOVE_MOUNT_SET_GROUP support and thus diff --git a/0226-mount-make-error-messages-differ-in-different-places.patch b/0225-mount-make-error-messages-differ-in-different-places.patch similarity index 89% rename from 0226-mount-make-error-messages-differ-in-different-places.patch rename to 0225-mount-make-error-messages-differ-in-different-places.patch index dadf9df..7f366c4 100644 --- a/0226-mount-make-error-messages-differ-in-different-places.patch +++ b/0225-mount-make-error-messages-differ-in-different-places.patch @@ -1,7 +1,7 @@ -From 41df675d49afa4bb2e68fd0184ea1656b7d9900f Mon Sep 17 00:00:00 2001 +From b2e857c42a8086f735f0018fab556d259adcc71a Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Mon, 21 Mar 2022 10:19:29 +0300 -Subject: [PATCH 226/245] mount: make error messages differ in different places +Subject: [PATCH 225/249] mount: make error messages differ in different places We have three of "Can't mount at %s", let's distinguish simple mount from bind-mount and re-mount to make log reading easier. diff --git a/0227-zdtm-use-unique-holder-for-cgroups.patch b/0226-zdtm-use-unique-holder-for-cgroups.patch similarity index 95% rename from 0227-zdtm-use-unique-holder-for-cgroups.patch rename to 0226-zdtm-use-unique-holder-for-cgroups.patch index ae25641..c02e2ef 100644 --- a/0227-zdtm-use-unique-holder-for-cgroups.patch +++ b/0226-zdtm-use-unique-holder-for-cgroups.patch @@ -1,7 +1,7 @@ -From 11e288fdab74a81a6ad678c0d6e24e1f6e689185 Mon Sep 17 00:00:00 2001 +From 20f4b7a8a5151dfc49463c01bb7509f6dd74defc Mon Sep 17 00:00:00 2001 From: Andrei Vagin Date: Sun, 20 Mar 2022 22:11:19 -0700 -Subject: [PATCH 227/245] zdtm: use unique holder for cgroups +Subject: [PATCH 226/249] zdtm: use unique holder for cgroups The idea that each zdtm.py should have own helder, so that two zdtm.py that are running on the same host don't effect each other. diff --git a/0228-scripts-ci-mount-test-cgroups-once.patch b/0227-scripts-ci-mount-test-cgroups-once.patch similarity index 87% rename from 0228-scripts-ci-mount-test-cgroups-once.patch rename to 0227-scripts-ci-mount-test-cgroups-once.patch index 710a406..eb8e10b 100644 --- a/0228-scripts-ci-mount-test-cgroups-once.patch +++ b/0227-scripts-ci-mount-test-cgroups-once.patch @@ -1,7 +1,7 @@ -From 7cd8cfad1ed46962363441010ffa83f1de5ff551 Mon Sep 17 00:00:00 2001 +From c0637fc646ee6f0043dbe0bd741ce311e5f9b5b6 Mon Sep 17 00:00:00 2001 From: Andrei Vagin Date: Sun, 20 Mar 2022 22:13:45 -0700 -Subject: [PATCH 228/245] scripts/ci: mount test cgroups once +Subject: [PATCH 227/249] scripts/ci: mount test cgroups once zdtm.py mounts two named controllers for tests. In CI, we run zdtm.py a few times, so we can mount (create) these controllers once to avoid any unwanted diff --git a/0229-criu-ns-add-a-helper-to-hold-a-pid-namespace.patch b/0228-criu-ns-add-a-helper-to-hold-a-pid-namespace.patch similarity index 93% rename from 0229-criu-ns-add-a-helper-to-hold-a-pid-namespace.patch rename to 0228-criu-ns-add-a-helper-to-hold-a-pid-namespace.patch index a3adbe0..2258996 100644 --- a/0229-criu-ns-add-a-helper-to-hold-a-pid-namespace.patch +++ b/0228-criu-ns-add-a-helper-to-hold-a-pid-namespace.patch @@ -1,7 +1,7 @@ -From 734553d5d0c784e8610d7c7ebbcda8607b28188b Mon Sep 17 00:00:00 2001 +From e4c1e520e90b40ed639b544322d8700451d3659f Mon Sep 17 00:00:00 2001 From: Andrei Vagin Date: Sun, 20 Mar 2022 00:43:45 -0700 -Subject: [PATCH 229/245] criu-ns: add a helper to hold a pid namespace +Subject: [PATCH 228/249] criu-ns: add a helper to hold a pid namespace The init process can exit if it doesn't have any child processes and its pidns is destroyed in this case. CRIU dump is running in the target pid diff --git a/0230-apparmor-Fix-Wfortify-source-for-Clang.patch b/0229-apparmor-Fix-Wfortify-source-for-Clang.patch similarity index 87% rename from 0230-apparmor-Fix-Wfortify-source-for-Clang.patch rename to 0229-apparmor-Fix-Wfortify-source-for-Clang.patch index f424dac..3185b22 100644 --- a/0230-apparmor-Fix-Wfortify-source-for-Clang.patch +++ b/0229-apparmor-Fix-Wfortify-source-for-Clang.patch @@ -1,7 +1,7 @@ -From 6dd4c918bb3e5381a82a91cdb19119db33c2de74 Mon Sep 17 00:00:00 2001 +From c4d7e86771edcaed33bce40e93f06d1920a40c4d Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Fri, 25 Mar 2022 17:18:30 -0700 -Subject: [PATCH 230/245] apparmor: Fix -Wfortify-source for Clang +Subject: [PATCH 229/249] apparmor: Fix -Wfortify-source for Clang ``` criu/apparmor.c:679:26: error: 'fscanf' may overflow; destination buffer in argument 3 has size 48, but the corresponding specifier may require size 49 [-Werror,-Wfortify-source] diff --git a/0231-style-delete-some-redundant-code.patch b/0230-style-delete-some-redundant-code.patch similarity index 89% rename from 0231-style-delete-some-redundant-code.patch rename to 0230-style-delete-some-redundant-code.patch index 05f91c9..f7552a0 100644 --- a/0231-style-delete-some-redundant-code.patch +++ b/0230-style-delete-some-redundant-code.patch @@ -1,7 +1,7 @@ -From 985713ac34cbf89cd894b12168abc13a77114311 Mon Sep 17 00:00:00 2001 +From 2060c0cd9e1d7184597050ccab4c0d08b36bb2f4 Mon Sep 17 00:00:00 2001 From: jiang wei Date: Wed, 23 Mar 2022 21:48:16 +0800 -Subject: [PATCH 231/245] style: delete some redundant code +Subject: [PATCH 230/249] style: delete some redundant code There is some redundant in compel/src/main.c, making it better diff --git a/0232-mount-fix-Wunused-but-set-variable-for-Clang-15.patch b/0231-mount-fix-Wunused-but-set-variable-for-Clang-15.patch similarity index 85% rename from 0232-mount-fix-Wunused-but-set-variable-for-Clang-15.patch rename to 0231-mount-fix-Wunused-but-set-variable-for-Clang-15.patch index ad0138c..d5c9d02 100644 --- a/0232-mount-fix-Wunused-but-set-variable-for-Clang-15.patch +++ b/0231-mount-fix-Wunused-but-set-variable-for-Clang-15.patch @@ -1,7 +1,7 @@ -From 797bfaf363ba73844de0030f9d8f4fd0252133dc Mon Sep 17 00:00:00 2001 +From d1fe7612208caa12c03f2e35e91e42a093148bcc Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Fri, 25 Mar 2022 17:27:11 -0700 -Subject: [PATCH 232/245] mount: fix -Wunused-but-set-variable for Clang 15 +Subject: [PATCH 231/249] mount: fix -Wunused-but-set-variable for Clang 15 Since https://reviews.llvm.org/D122271, Clang -Wset-but-unused-variable gets smarter to warn about unused post-increments. diff --git a/0235-compel-add-rseq-syscall-into-compel-std-plugin-sysca.patch b/0232-compel-add-rseq-syscall-into-compel-std-plugin-sysca.patch similarity index 97% rename from 0235-compel-add-rseq-syscall-into-compel-std-plugin-sysca.patch rename to 0232-compel-add-rseq-syscall-into-compel-std-plugin-sysca.patch index a83355e..72e08a0 100644 --- a/0235-compel-add-rseq-syscall-into-compel-std-plugin-sysca.patch +++ b/0232-compel-add-rseq-syscall-into-compel-std-plugin-sysca.patch @@ -1,7 +1,7 @@ -From f015c6b97bf6e074783d5c11d511b3263f95332e Mon Sep 17 00:00:00 2001 +From 9456e11dbb326e93cdd01456b629230db996c0d4 Mon Sep 17 00:00:00 2001 From: Alexander Mikhalitsyn Date: Tue, 21 Dec 2021 17:38:25 +0300 -Subject: [PATCH 235/245] compel: add rseq syscall into compel std plugin +Subject: [PATCH 232/249] compel: add rseq syscall into compel std plugin syscall tables Add rseq syscall numbers for: diff --git a/0233-criu-generate-unique-socket-names.patch b/0233-criu-generate-unique-socket-names.patch deleted file mode 100644 index be45786..0000000 --- a/0233-criu-generate-unique-socket-names.patch +++ /dev/null @@ -1,146 +0,0 @@ -From 574316fe95bcbcc74f31a1dc40025baec7ffd1c7 Mon Sep 17 00:00:00 2001 -From: Andrei Vagin -Date: Thu, 31 Mar 2022 23:52:33 -0700 -Subject: [PATCH 233/245] criu: generate unique socket names - -CRIU has a few places where it creates unix sockets and their names have to be -unique for each criu run. - -Fixes: #1798 -Signed-off-by: Andrei Vagin ---- - compel/include/uapi/infect-util.h | 6 ++++++ - compel/src/lib/infect-util.c | 2 ++ - compel/src/lib/infect.c | 3 ++- - criu/fdstore.c | 4 +++- - criu/pidfd-store.c | 3 ++- - criu/unittest/mock.c | 3 +++ - criu/util.c | 3 +++ - 7 files changed, 21 insertions(+), 3 deletions(-) - -diff --git a/compel/include/uapi/infect-util.h b/compel/include/uapi/infect-util.h -index 4e32d13dc..ace6f6b6b 100644 ---- a/compel/include/uapi/infect-util.h -+++ b/compel/include/uapi/infect-util.h -@@ -3,6 +3,12 @@ - - #include "common/compiler.h" - -+/* -+ * compel_run_id is a unique value of the current run. It can be used to -+ * generate resource ID-s to avoid conflicts with other processes. -+ */ -+extern uint64_t compel_run_id; -+ - struct parasite_ctl; - extern int __must_check compel_util_send_fd(struct parasite_ctl *ctl, int fd); - extern int compel_util_recv_fd(struct parasite_ctl *ctl, int *pfd); -diff --git a/compel/src/lib/infect-util.c b/compel/src/lib/infect-util.c -index 5d6d0ddd8..00a7c83f7 100644 ---- a/compel/src/lib/infect-util.c -+++ b/compel/src/lib/infect-util.c -@@ -7,6 +7,8 @@ - #include "infect-rpc.h" - #include "infect-util.h" - -+uint64_t compel_run_id; -+ - int compel_util_send_fd(struct parasite_ctl *ctl, int fd) - { - int sk; -diff --git a/compel/src/lib/infect.c b/compel/src/lib/infect.c -index 0fb9e715c..78e4d7e0e 100644 ---- a/compel/src/lib/infect.c -+++ b/compel/src/lib/infect.c -@@ -1,3 +1,4 @@ -+#include - #include - #include - #include -@@ -364,7 +365,7 @@ static int gen_parasite_saddr(struct sockaddr_un *saddr, int key) - int sun_len; - - saddr->sun_family = AF_UNIX; -- snprintf(saddr->sun_path, UNIX_PATH_MAX, "X/crtools-pr-%d", key); -+ snprintf(saddr->sun_path, UNIX_PATH_MAX, "X/crtools-pr-%d-%" PRIx64, key, compel_run_id); - - sun_len = SUN_LEN(saddr); - *saddr->sun_path = '\0'; -diff --git a/criu/fdstore.c b/criu/fdstore.c -index 65264a511..6a7f73a59 100644 ---- a/criu/fdstore.c -+++ b/criu/fdstore.c -@@ -12,6 +12,7 @@ - #include "xmalloc.h" - #include "rst-malloc.h" - #include "log.h" -+#include "util.h" - - /* clang-format off */ - static struct fdstore_desc { -@@ -56,7 +57,8 @@ int fdstore_init(void) - } - - addr.sun_family = AF_UNIX; -- addrlen = snprintf(addr.sun_path, sizeof(addr.sun_path), "X/criu-fdstore-%" PRIx64, st.st_ino); -+ addrlen = snprintf(addr.sun_path, sizeof(addr.sun_path), "X/criu-fdstore-%" PRIx64 "-%" PRIx64, st.st_ino, -+ criu_run_id); - addrlen += sizeof(addr.sun_family); - - addr.sun_path[0] = 0; -diff --git a/criu/pidfd-store.c b/criu/pidfd-store.c -index 98b478b30..b15568e08 100644 ---- a/criu/pidfd-store.c -+++ b/criu/pidfd-store.c -@@ -100,7 +100,8 @@ int init_pidfd_store_sk(pid_t pid, int sk) - goto err; - } - -- addrlen = snprintf(addr.sun_path, sizeof(addr.sun_path), "X/criu-pidfd-store-%d-%d", pid, sk); -+ addrlen = snprintf(addr.sun_path, sizeof(addr.sun_path), "X/criu-pidfd-store-%d-%d-%" PRIx64, pid, sk, -+ criu_run_id); - addrlen += sizeof(addr.sun_family); - - addr.sun_path[0] = 0; -diff --git a/criu/unittest/mock.c b/criu/unittest/mock.c -index dc5b627f7..0151873dc 100644 ---- a/criu/unittest/mock.c -+++ b/criu/unittest/mock.c -@@ -2,6 +2,7 @@ - - #include - #include -+#include - #include - - int add_external(char *key) -@@ -141,3 +142,5 @@ int check_mount_v2(void) - { - return 0; - } -+ -+uint64_t compel_run_id; -diff --git a/criu/util.c b/criu/util.c -index f8da4ac5c..dd1fd97f5 100644 ---- a/criu/util.c -+++ b/criu/util.c -@@ -52,6 +52,8 @@ - #include "cr-errno.h" - #include "action-scripts.h" - -+#include "compel/infect-util.h" -+ - #define VMA_OPT_LEN 128 - - static int xatol_base(const char *string, long *number, int base) -@@ -1816,6 +1818,7 @@ void util_init() - - clock_gettime(CLOCK_MONOTONIC, &tp); - criu_run_id = ((uint64_t)getpid() << 32) + tp.tv_sec + tp.tv_nsec; -+ compel_run_id = criu_run_id; - } - - /* --- -2.35.1 - diff --git a/0236-kerndat-check-for-rseq-syscall-support.patch b/0233-kerndat-check-for-rseq-syscall-support.patch similarity index 92% rename from 0236-kerndat-check-for-rseq-syscall-support.patch rename to 0233-kerndat-check-for-rseq-syscall-support.patch index 9032c5c..a9c79ad 100644 --- a/0236-kerndat-check-for-rseq-syscall-support.patch +++ b/0233-kerndat-check-for-rseq-syscall-support.patch @@ -1,7 +1,7 @@ -From e4cc6dda5da18153a5ecfb969d9aa4d64ba05a4c Mon Sep 17 00:00:00 2001 +From 79fd6d1c54c7b8b925df11adbce9ef687b0f0f4f Mon Sep 17 00:00:00 2001 From: Alexander Mikhalitsyn Date: Tue, 21 Dec 2021 18:27:52 +0300 -Subject: [PATCH 236/245] kerndat: check for rseq syscall support +Subject: [PATCH 233/249] kerndat: check for rseq syscall support Signed-off-by: Alexander Mikhalitsyn --- diff --git a/0234-ci-Ubuntu-broke-overlayfs-again.patch b/0234-ci-Ubuntu-broke-overlayfs-again.patch deleted file mode 100644 index fc2403e..0000000 --- a/0234-ci-Ubuntu-broke-overlayfs-again.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 4edd5dd5b2ef0ad051cec79adbdd10067fd821df Mon Sep 17 00:00:00 2001 -From: Adrian Reber -Date: Tue, 5 Apr 2022 07:05:53 +0000 -Subject: [PATCH 234/245] ci: Ubuntu broke overlayfs again - -Switch to non overlaysfs tests for Podman and Docker. - -Signed-off-by: Adrian Reber ---- - scripts/ci/docker-test.sh | 5 ++++- - scripts/ci/podman-test.sh | 5 ++++- - 2 files changed, 8 insertions(+), 2 deletions(-) - -diff --git a/scripts/ci/docker-test.sh b/scripts/ci/docker-test.sh -index d4b11bd55..397fd7b0e 100755 ---- a/scripts/ci/docker-test.sh -+++ b/scripts/ci/docker-test.sh -@@ -21,7 +21,10 @@ add-apt-repository \ - - . /etc/lsb-release - --echo '{ "experimental": true }' > /etc/docker/daemon.json -+# overlayfs behaves differently on Ubuntu (18.04) and breaks CRIU -+# https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1857257 -+# Switch to devicemapper -+echo '{ "experimental": true, "storage-driver": "devicemapper" }' > /etc/docker/daemon.json - - CRIU_LOG='/criu.log' - mkdir -p /etc/criu -diff --git a/scripts/ci/podman-test.sh b/scripts/ci/podman-test.sh -index 5e5eb764d..d66b281b3 100755 ---- a/scripts/ci/podman-test.sh -+++ b/scripts/ci/podman-test.sh -@@ -25,7 +25,10 @@ make install - popd - rm -rf "${tmp_dir}" - --podman info -+# overlaysfs behaves differently on Ubuntu and breaks CRIU -+# https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1857257 -+export STORAGE_DRIVER=vfs -+podman --storage-driver vfs info - - # shellcheck disable=SC2016 - podman run --name cr -d docker.io/library/alpine /bin/sh -c 'i=0; while true; do echo $i; i=$(expr $i + 1); sleep 1; done' --- -2.35.1 - diff --git a/0237-util-move-fork_and_ptrace_attach-helper-from-cr-chec.patch b/0234-util-move-fork_and_ptrace_attach-helper-from-cr-chec.patch similarity index 94% rename from 0237-util-move-fork_and_ptrace_attach-helper-from-cr-chec.patch rename to 0234-util-move-fork_and_ptrace_attach-helper-from-cr-chec.patch index a9a56a2..c831cc7 100644 --- a/0237-util-move-fork_and_ptrace_attach-helper-from-cr-chec.patch +++ b/0234-util-move-fork_and_ptrace_attach-helper-from-cr-chec.patch @@ -1,7 +1,7 @@ -From e79349513330ecbb1891d49670e7283ce62a2799 Mon Sep 17 00:00:00 2001 +From 4dcca982579264fbc3fab176f63c7273799f7a9c Mon Sep 17 00:00:00 2001 From: Alexander Mikhalitsyn Date: Tue, 21 Dec 2021 21:17:16 +0300 -Subject: [PATCH 237/245] util: move fork_and_ptrace_attach helper from +Subject: [PATCH 234/249] util: move fork_and_ptrace_attach helper from cr-check Signed-off-by: Alexander Mikhalitsyn @@ -92,10 +92,10 @@ index 5ccd24722..4e29c079e 100644 extern int status_ready(void); extern int is_root_user(void); diff --git a/criu/util.c b/criu/util.c -index dd1fd97f5..2c7749457 100644 +index f8da4ac5c..4f871f594 100644 --- a/criu/util.c +++ b/criu/util.c -@@ -660,6 +660,63 @@ out: +@@ -658,6 +658,63 @@ out: return ret; } diff --git a/0238-cr-check-Add-ptrace-rseq-conf-dump-feature.patch b/0235-cr-check-Add-ptrace-rseq-conf-dump-feature.patch similarity index 97% rename from 0238-cr-check-Add-ptrace-rseq-conf-dump-feature.patch rename to 0235-cr-check-Add-ptrace-rseq-conf-dump-feature.patch index 88b8a8e..941450d 100644 --- a/0238-cr-check-Add-ptrace-rseq-conf-dump-feature.patch +++ b/0235-cr-check-Add-ptrace-rseq-conf-dump-feature.patch @@ -1,7 +1,7 @@ -From dbd7a5a689f47694eccdab44290873023007f026 Mon Sep 17 00:00:00 2001 +From c4399163eb28d0dd1d2f6d7041f361b9516c2911 Mon Sep 17 00:00:00 2001 From: Alexander Mikhalitsyn Date: Tue, 21 Dec 2021 18:29:14 +0300 -Subject: [PATCH 238/245] cr-check: Add ptrace rseq conf dump feature +Subject: [PATCH 235/249] cr-check: Add ptrace rseq conf dump feature Add "get_rseq_conf" feature corresponding to the ptrace(PTRACE_GET_RSEQ_CONFIGURATION) support. diff --git a/0239-rseq-initial-support.patch b/0236-rseq-initial-support.patch similarity index 99% rename from 0239-rseq-initial-support.patch rename to 0236-rseq-initial-support.patch index 78887b5..3a69c02 100644 --- a/0239-rseq-initial-support.patch +++ b/0236-rseq-initial-support.patch @@ -1,7 +1,7 @@ -From 2a4d29c3be5cec0efb2cbc3ba20444cd0b358e29 Mon Sep 17 00:00:00 2001 +From 5dd6ace5934f8c95f4ac72e248433081f1be87d1 Mon Sep 17 00:00:00 2001 From: Alexander Mikhalitsyn Date: Tue, 21 Dec 2021 23:27:26 +0300 -Subject: [PATCH 239/245] rseq: initial support +Subject: [PATCH 236/249] rseq: initial support TODO: 1. properly handle case when the kernel has rseq() diff --git a/0237-zdtm-add-basic-static-rseq00-test-for-rseq-C-R.patch b/0237-zdtm-add-basic-static-rseq00-test-for-rseq-C-R.patch new file mode 100644 index 0000000..cd18d2b --- /dev/null +++ b/0237-zdtm-add-basic-static-rseq00-test-for-rseq-C-R.patch @@ -0,0 +1,220 @@ +From 2eaa9e9fe9e9cda7b5fd72fc2ebc743a05864883 Mon Sep 17 00:00:00 2001 +From: Alexander Mikhalitsyn +Date: Tue, 21 Dec 2021 23:40:01 +0300 +Subject: [PATCH 237/249] zdtm: add basic static/rseq00 test for rseq C/R + +Signed-off-by: Alexander Mikhalitsyn +--- + test/zdtm/static/Makefile | 1 + + test/zdtm/static/rseq00.c | 177 +++++++++++++++++++++++++++++++++++ + test/zdtm/static/rseq00.desc | 1 + + 3 files changed, 179 insertions(+) + create mode 100644 test/zdtm/static/rseq00.c + create mode 100644 test/zdtm/static/rseq00.desc + +diff --git a/test/zdtm/static/Makefile b/test/zdtm/static/Makefile +index 717306dbb..568886d60 100644 +--- a/test/zdtm/static/Makefile ++++ b/test/zdtm/static/Makefile +@@ -61,6 +61,7 @@ TST_NOFILE := \ + pthread02 \ + pthread_timers \ + pthread_timers_h \ ++ rseq00 \ + vdso00 \ + vdso01 \ + vdso02 \ +diff --git a/test/zdtm/static/rseq00.c b/test/zdtm/static/rseq00.c +new file mode 100644 +index 000000000..95e9f40b4 +--- /dev/null ++++ b/test/zdtm/static/rseq00.c +@@ -0,0 +1,177 @@ ++/* ++ * test for rseq() syscall ++ * See also https://www.efficios.com/blog/2019/02/08/linux-restartable-sequences/ ++ * https://github.com/torvalds/linux/commit/d7822b1e24f2df5df98c76f0e94a5416349ff759 ++ */ ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "zdtmtst.h" ++ ++#if defined(__x86_64__) ++ ++const char *test_doc = "Check that rseq() basic C/R works"; ++const char *test_author = "Alexander Mikhalitsyn "; ++/* parts of code borrowed from https://www.efficios.com/blog/2019/02/08/linux-restartable-sequences/ */ ++ ++/* some useful definitions from kernel uapi */ ++enum rseq_flags { ++ RSEQ_FLAG_UNREGISTER = (1 << 0), ++}; ++ ++struct rseq { ++ uint32_t cpu_id_start; ++ uint32_t cpu_id; ++ uint64_t rseq_cs; ++ uint32_t flags; ++} __attribute__((aligned(4 * sizeof(uint64_t)))); ++ ++#ifndef __NR_rseq ++#define __NR_rseq 334 ++#endif ++/* EOF */ ++ ++static __thread volatile struct rseq __rseq_abi; ++ ++#define RSEQ_SIG 0x53053053 ++ ++static int sys_rseq(volatile struct rseq *rseq_abi, uint32_t rseq_len, int flags, uint32_t sig) ++{ ++ return syscall(__NR_rseq, rseq_abi, rseq_len, flags, sig); ++} ++ ++static void register_thread(void) ++{ ++ int rc; ++ rc = sys_rseq(&__rseq_abi, sizeof(struct rseq), 0, RSEQ_SIG); ++ if (rc) { ++ fail("Failed to register rseq"); ++ exit(1); ++ } ++} ++ ++static void unregister_thread(void) ++{ ++ int rc; ++ rc = sys_rseq(&__rseq_abi, sizeof(struct rseq), RSEQ_FLAG_UNREGISTER, RSEQ_SIG); ++ if (rc) { ++ fail("Failed to unregister rseq"); ++ exit(1); ++ } ++} ++ ++static void check_thread(void) ++{ ++ int rc; ++ rc = sys_rseq(&__rseq_abi, sizeof(struct rseq), 0, RSEQ_SIG); ++ if (!(rc && errno == EBUSY)) { ++ fail("Failed to check rseq %d", rc); ++ exit(1); ++ } ++} ++ ++#define RSEQ_ACCESS_ONCE(x) (*(__volatile__ __typeof__(x) *)&(x)) ++ ++static int rseq_addv(intptr_t *v, intptr_t count, int cpu) ++{ ++ /* clang-format off */ ++ __asm__ __volatile__ goto( ++ ".pushsection __rseq_table, \"aw\"\n\t" ++ ".balign 32\n\t" ++ "cs_obj:\n\t" ++ /* version, flags */ ++ ".long 0, 0\n\t" ++ /* start_ip, post_commit_offset, abort_ip */ ++ ".quad 1f, (2f-1f), 4f\n\t" ++ ".popsection\n\t" ++ "1:\n\t" ++ "leaq cs_obj(%%rip), %%rax\n\t" ++ "movq %%rax, %[rseq_cs]\n\t" ++ "cmpl %[cpu_id], %[current_cpu_id]\n\t" ++ "jnz 4f\n\t" ++ "addq %[count], %[v]\n\t" /* final store */ ++ "2:\n\t" ++ ".pushsection __rseq_failure, \"ax\"\n\t" ++ /* Disassembler-friendly signature: nopl (%rip). */ ++ ".byte 0x0f, 0x1f, 0x05\n\t" ++ ".long 0x53053053\n\t" /* RSEQ_FLAGS */ ++ "4:\n\t" ++ "jmp abort\n\t" ++ ".popsection\n\t" ++ : /* gcc asm goto does not allow outputs */ ++ : [cpu_id] "r" (cpu), ++ [current_cpu_id] "m" (__rseq_abi.cpu_id), ++ [rseq_cs] "m" (__rseq_abi.rseq_cs), ++ /* final store input */ ++ [v] "m" (*v), ++ [count] "er" (count) ++ : "memory", "cc", "rax" ++ : abort ++ ); ++ /* clang-format on */ ++ ++ return 0; ++abort: ++ return -1; ++} ++ ++int main(int argc, char *argv[]) ++{ ++ int cpu, ret; ++ intptr_t *cpu_data; ++ long nr_cpus = sysconf(_SC_NPROCESSORS_ONLN); ++ ++ test_init(argc, argv); ++ ++ cpu_data = calloc(nr_cpus, sizeof(*cpu_data)); ++ if (!cpu_data) { ++ fail("calloc"); ++ exit(EXIT_FAILURE); ++ } ++ ++ register_thread(); ++ ++ test_daemon(); ++ test_waitsig(); ++ ++ check_thread(); ++ ++ cpu = RSEQ_ACCESS_ONCE(__rseq_abi.cpu_id_start); ++ ret = rseq_addv(&cpu_data[cpu], 2, cpu); ++ if (ret) ++ fail("Failed to increment per-cpu counter"); ++ else ++ test_msg("cpu_data[%d] == %ld\n", cpu, (long int)cpu_data[cpu]); ++ ++ if (cpu_data[cpu] == 2) ++ pass(); ++ else ++ fail(); ++ ++ return 0; ++} ++ ++#else /* #if defined(__x86_64__) */ ++ ++int main(int argc, char *argv[]) ++{ ++ test_init(argc, argv); ++ skip("Unsupported arch"); ++ test_daemon(); ++ test_waitsig(); ++ pass(); ++ return 0; ++} ++ ++#endif /* #if defined(__x86_64__) */ +\ No newline at end of file +diff --git a/test/zdtm/static/rseq00.desc b/test/zdtm/static/rseq00.desc +new file mode 100644 +index 000000000..0324fa39c +--- /dev/null ++++ b/test/zdtm/static/rseq00.desc +@@ -0,0 +1 @@ ++{'flavor': 'h', 'arch': 'x86_64', 'feature': 'get_rseq_conf'} +-- +2.35.1 + diff --git a/0238-Revert-ci-disable-glibc-rseq-support.patch b/0238-Revert-ci-disable-glibc-rseq-support.patch new file mode 100644 index 0000000..0d3d264 --- /dev/null +++ b/0238-Revert-ci-disable-glibc-rseq-support.patch @@ -0,0 +1,49 @@ +From 872ac9f34454fd256af9aae7f72976e355244da2 Mon Sep 17 00:00:00 2001 +From: Alexander Mikhalitsyn +Date: Tue, 21 Dec 2021 23:42:26 +0300 +Subject: [PATCH 238/249] Revert "ci: disable glibc rseq support" + +Let's see how rseq() C/R feature works + +This reverts commit d99def7dcfa938918368c91021f72a77f738bc61. + +Signed-off-by: Alexander Mikhalitsyn +--- + scripts/build/Dockerfile.fedora.tmpl | 3 --- + scripts/ci/run-ci-tests.sh | 7 +------ + 2 files changed, 1 insertion(+), 9 deletions(-) + +diff --git a/scripts/build/Dockerfile.fedora.tmpl b/scripts/build/Dockerfile.fedora.tmpl +index fd4ba4aef..9d3bb0f87 100644 +--- a/scripts/build/Dockerfile.fedora.tmpl ++++ b/scripts/build/Dockerfile.fedora.tmpl +@@ -1,8 +1,5 @@ + ARG CC=gcc + +-# FIXME: Temporary solution for https://github.com/checkpoint-restore/criu/issues/1696 +-ENV GLIBC_TUNABLES=glibc.pthread.rseq=0 +- + COPY scripts/ci/prepare-for-fedora-rawhide.sh /bin/prepare-for-fedora-rawhide.sh + RUN /bin/prepare-for-fedora-rawhide.sh + +diff --git a/scripts/ci/run-ci-tests.sh b/scripts/ci/run-ci-tests.sh +index 14e6b1224..f89783630 100755 +--- a/scripts/ci/run-ci-tests.sh ++++ b/scripts/ci/run-ci-tests.sh +@@ -255,12 +255,7 @@ if [ -n "$TRAVIS" ] || [ -n "$CIRCLECI" ]; then + # Error (criu/tty.c:1014): tty: Don't have tty to inherit session from, aborting + make -C test/others/shell-job/ run + fi +- +-# FIXME: rpc tests fail even with set glibc tunable +-# https://github.com/checkpoint-restore/criu/issues/1696 +-if [ "$GLIBC_TUNABLES" != "glibc.pthread.rseq=0" ]; then +- make -C test/others/rpc/ run +-fi ++make -C test/others/rpc/ run + + ./test/zdtm.py run -t zdtm/static/env00 --sibling + +-- +2.35.1 + diff --git a/0239-ci-add-Fedora-Rawhide-based-test-on-Cirrus.patch b/0239-ci-add-Fedora-Rawhide-based-test-on-Cirrus.patch new file mode 100644 index 0000000..3edb3be --- /dev/null +++ b/0239-ci-add-Fedora-Rawhide-based-test-on-Cirrus.patch @@ -0,0 +1,98 @@ +From e31ca9daf19eefd14fdddf2709e9e734301630e1 Mon Sep 17 00:00:00 2001 +From: Alexander Mikhalitsyn +Date: Thu, 23 Dec 2021 14:57:43 +0300 +Subject: [PATCH 239/249] ci: add Fedora Rawhide based test on Cirrus + +We have ability to use nested virtualization on +Cirrus, and already have "Vagrant Fedora based test (no VDSO)" +test, let's do analogical for Fedora Rawhide to get fresh kernel. + +Suggested-by: Adrian Reber +Signed-off-by: Alexander Mikhalitsyn +--- + .cirrus.yml | 21 +++++++++++++++++++++ + scripts/ci/Makefile | 7 +++++-- + scripts/ci/vagrant.sh | 12 ++++++++++++ + 3 files changed, 38 insertions(+), 2 deletions(-) + +diff --git a/.cirrus.yml b/.cirrus.yml +index 588cf3e82..2b6903ddc 100644 +--- a/.cirrus.yml ++++ b/.cirrus.yml +@@ -19,6 +19,27 @@ task: + build_script: | + make -C scripts/ci vagrant-fedora-no-vdso + ++task: ++ name: Vagrant Fedora Rawhide based test ++ environment: ++ HOME: "/root" ++ CIRRUS_WORKING_DIR: "/tmp/criu" ++ ++ compute_engine_instance: ++ image_project: cirrus-images ++ image: family/docker-kvm ++ platform: linux ++ cpu: 4 ++ memory: 16G ++ nested_virtualization: true ++ ++ setup_script: | ++ scripts/ci/apt-install make gcc pkg-config git perl-modules iproute2 kmod wget cpu-checker ++ sudo kvm-ok ++ ln -sf /usr/include/google/protobuf/descriptor.proto images/google/protobuf/descriptor.proto ++ build_script: | ++ make -C scripts/ci vagrant-fedora-rawhide ++ + task: + name: CentOS 8 based test + environment: +diff --git a/scripts/ci/Makefile b/scripts/ci/Makefile +index 3e4d59430..eaab2f201 100644 +--- a/scripts/ci/Makefile ++++ b/scripts/ci/Makefile +@@ -41,7 +41,7 @@ export CONTAINER_TERMINAL + ifeq ($(UNAME),x86_64) + # On anything besides x86_64 Travis is running unprivileged LXD + # containers which do not support running docker with '--privileged'. +- CONTAINER_OPTS := --rm $(CONTAINER_TERMINAL) --privileged -v /lib/modules:/lib/modules --tmpfs /run ++ CONTAINER_OPTS := --rm $(CONTAINER_TERMINAL) --privileged --userns=host --cgroupns=host -v /lib/modules:/lib/modules --tmpfs /run + else + CONTAINER_OPTS := --rm -v /lib/modules:/lib/modules --tmpfs /run + endif +@@ -92,7 +92,10 @@ setup-vagrant: + vagrant-fedora-no-vdso: setup-vagrant + ./vagrant.sh fedora-no-vdso + +-.PHONY: setup-vagrant vagrant-fedora-no-vdso ++vagrant-fedora-rawhide: setup-vagrant ++ ./vagrant.sh fedora-rawhide ++ ++.PHONY: setup-vagrant vagrant-fedora-no-vdso vagrant-fedora-rawhide + + %: + $(MAKE) -C ../build $@$(target-suffix) +diff --git a/scripts/ci/vagrant.sh b/scripts/ci/vagrant.sh +index 0440193bc..af0f7335a 100755 +--- a/scripts/ci/vagrant.sh ++++ b/scripts/ci/vagrant.sh +@@ -56,4 +56,16 @@ fedora-no-vdso() { + ssh default 'cd /vagrant/criu/test; sudo ./zdtm.py run -t zdtm/transition/pidfd_store_sk --rpc --pre 2' + } + ++fedora-rawhide() { ++ # ++ # Workaround the problem: ++ # error running container: error from /usr/bin/crun creating container for [...]: sd-bus call: Transport endpoint is not connected ++ # Let's just use runc instead of crun ++ # see also https://github.com/kata-containers/tests/issues/4283 ++ # ++ ssh default 'sudo dnf remove -y crun || true' ++ ssh default sudo dnf install -y podman runc ++ ssh default 'cd /vagrant; tar xf criu.tar; cd criu; sudo -E make -C scripts/ci fedora-rawhide CONTAINER_RUNTIME=podman BUILD_OPTIONS="--security-opt seccomp=unconfined"' ++} ++ + $1 +-- +2.35.1 + diff --git a/0240-include-add-thread_pointer.h-from-Glibc.patch b/0240-include-add-thread_pointer.h-from-Glibc.patch index 636ceb0..3c06959 100644 --- a/0240-include-add-thread_pointer.h-from-Glibc.patch +++ b/0240-include-add-thread_pointer.h-from-Glibc.patch @@ -1,7 +1,7 @@ -From 7262d5ee6d82ecc9c53bc7b23f458de7e794f097 Mon Sep 17 00:00:00 2001 +From d49426d3dce173c61ede04cbd7a3caee8cd24a78 Mon Sep 17 00:00:00 2001 From: Alexander Mikhalitsyn Date: Tue, 22 Feb 2022 14:58:10 +0300 -Subject: [PATCH 240/245] include: add thread_pointer.h from Glibc +Subject: [PATCH 240/249] include: add thread_pointer.h from Glibc Implementation was taken from the Glibc. diff --git a/0241-clone-noasan-unregister-rseq-at-the-thread-start-for.patch b/0241-clone-noasan-unregister-rseq-at-the-thread-start-for.patch index 75c16b2..dbf2d7f 100644 --- a/0241-clone-noasan-unregister-rseq-at-the-thread-start-for.patch +++ b/0241-clone-noasan-unregister-rseq-at-the-thread-start-for.patch @@ -1,7 +1,7 @@ -From 74f602b66fb6ae3559b570cfc369477a579367c8 Mon Sep 17 00:00:00 2001 +From b26dfea16373b8207f432bbebcfc836b09c05751 Mon Sep 17 00:00:00 2001 From: Alexander Mikhalitsyn Date: Fri, 24 Dec 2021 18:57:54 +0300 -Subject: [PATCH 241/245] clone-noasan: unregister rseq at the thread start for +Subject: [PATCH 241/249] clone-noasan: unregister rseq at the thread start for new glibc Fresh glibc does rseq registration by default during start_thread(). diff --git a/0242-zdtm-static-rseq00-fix-rseq-test-when-linking-with-a.patch b/0242-zdtm-static-rseq00-fix-rseq-test-when-linking-with-a.patch new file mode 100644 index 0000000..c4ed8f6 --- /dev/null +++ b/0242-zdtm-static-rseq00-fix-rseq-test-when-linking-with-a.patch @@ -0,0 +1,152 @@ +From 5f311e25837fdf75643cba8b3f47920308a1625a Mon Sep 17 00:00:00 2001 +From: Alexander Mikhalitsyn +Date: Fri, 24 Dec 2021 22:56:56 +0300 +Subject: [PATCH 242/249] zdtm/static/rseq00: fix rseq test when linking with a + fresh Glibc + +Fresh Glibc does rseq() register by default. We need to unregister +rseq before registering our own. + +Signed-off-by: Alexander Mikhalitsyn +--- + test/zdtm/static/rseq00.c | 66 +++++++++++++++++++++++++++++---------- + 1 file changed, 49 insertions(+), 17 deletions(-) + +diff --git a/test/zdtm/static/rseq00.c b/test/zdtm/static/rseq00.c +index 95e9f40b4..acf790753 100644 +--- a/test/zdtm/static/rseq00.c ++++ b/test/zdtm/static/rseq00.c +@@ -19,13 +19,48 @@ + + #include "zdtmtst.h" + ++#ifdef __has_include ++#if __has_include("sys/rseq.h") ++#include ++#endif ++#endif ++ + #if defined(__x86_64__) + ++#if defined(RSEQ_SIG) ++static inline void *__criu_thread_pointer(void) ++{ ++#if __GNUC_PREREQ(11, 1) ++ return __builtin_thread_pointer(); ++#else ++ void *__result; ++#ifdef __x86_64__ ++ __asm__("mov %%fs:0, %0" : "=r"(__result)); ++#else ++ __asm__("mov %%gs:0, %0" : "=r"(__result)); ++#endif ++ return __result; ++#endif /* !GCC 11 */ ++} ++ ++static inline void unregister_glibc_rseq(void) ++{ ++ /* unregister rseq */ ++ syscall(__NR_rseq, (void *)((char *)__criu_thread_pointer() + __rseq_offset), __rseq_size, 1, RSEQ_SIG); ++} ++#else ++static inline void unregister_glibc_rseq(void) ++{ ++} ++#endif ++ + const char *test_doc = "Check that rseq() basic C/R works"; + const char *test_author = "Alexander Mikhalitsyn "; + /* parts of code borrowed from https://www.efficios.com/blog/2019/02/08/linux-restartable-sequences/ */ + + /* some useful definitions from kernel uapi */ ++#ifndef RSEQ_SIG ++ + enum rseq_flags { + RSEQ_FLAG_UNREGISTER = (1 << 0), + }; +@@ -37,15 +72,18 @@ struct rseq { + uint32_t flags; + } __attribute__((aligned(4 * sizeof(uint64_t)))); + ++#define RSEQ_SIG 0x53053053 ++ ++#endif ++ + #ifndef __NR_rseq + #define __NR_rseq 334 + #endif + /* EOF */ + ++static volatile struct rseq *rseq_ptr; + static __thread volatile struct rseq __rseq_abi; + +-#define RSEQ_SIG 0x53053053 +- + static int sys_rseq(volatile struct rseq *rseq_abi, uint32_t rseq_len, int flags, uint32_t sig) + { + return syscall(__NR_rseq, rseq_abi, rseq_len, flags, sig); +@@ -54,27 +92,18 @@ static int sys_rseq(volatile struct rseq *rseq_abi, uint32_t rseq_len, int flags + static void register_thread(void) + { + int rc; +- rc = sys_rseq(&__rseq_abi, sizeof(struct rseq), 0, RSEQ_SIG); ++ unregister_glibc_rseq(); ++ rc = sys_rseq(rseq_ptr, sizeof(struct rseq), 0, RSEQ_SIG); + if (rc) { + fail("Failed to register rseq"); + exit(1); + } + } + +-static void unregister_thread(void) +-{ +- int rc; +- rc = sys_rseq(&__rseq_abi, sizeof(struct rseq), RSEQ_FLAG_UNREGISTER, RSEQ_SIG); +- if (rc) { +- fail("Failed to unregister rseq"); +- exit(1); +- } +-} +- + static void check_thread(void) + { + int rc; +- rc = sys_rseq(&__rseq_abi, sizeof(struct rseq), 0, RSEQ_SIG); ++ rc = sys_rseq(rseq_ptr, sizeof(struct rseq), 0, RSEQ_SIG); + if (!(rc && errno == EBUSY)) { + fail("Failed to check rseq %d", rc); + exit(1); +@@ -111,8 +140,8 @@ static int rseq_addv(intptr_t *v, intptr_t count, int cpu) + ".popsection\n\t" + : /* gcc asm goto does not allow outputs */ + : [cpu_id] "r" (cpu), +- [current_cpu_id] "m" (__rseq_abi.cpu_id), +- [rseq_cs] "m" (__rseq_abi.rseq_cs), ++ [current_cpu_id] "m" (rseq_ptr->cpu_id), ++ [rseq_cs] "m" (rseq_ptr->rseq_cs), + /* final store input */ + [v] "m" (*v), + [count] "er" (count) +@@ -132,6 +161,9 @@ int main(int argc, char *argv[]) + intptr_t *cpu_data; + long nr_cpus = sysconf(_SC_NPROCESSORS_ONLN); + ++ rseq_ptr = &__rseq_abi; ++ memset((void *)rseq_ptr, 0, sizeof(struct rseq)); ++ + test_init(argc, argv); + + cpu_data = calloc(nr_cpus, sizeof(*cpu_data)); +@@ -147,7 +179,7 @@ int main(int argc, char *argv[]) + + check_thread(); + +- cpu = RSEQ_ACCESS_ONCE(__rseq_abi.cpu_id_start); ++ cpu = RSEQ_ACCESS_ONCE(rseq_ptr->cpu_id_start); + ret = rseq_addv(&cpu_data[cpu], 2, cpu); + if (ret) + fail("Failed to increment per-cpu counter"); +-- +2.35.1 + diff --git a/0242-compel-add-helpers-to-get-set-instruction-pointer.patch b/0243-compel-add-helpers-to-get-set-instruction-pointer.patch similarity index 97% rename from 0242-compel-add-helpers-to-get-set-instruction-pointer.patch rename to 0243-compel-add-helpers-to-get-set-instruction-pointer.patch index 5af24a3..d1e806a 100644 --- a/0242-compel-add-helpers-to-get-set-instruction-pointer.patch +++ b/0243-compel-add-helpers-to-get-set-instruction-pointer.patch @@ -1,7 +1,7 @@ -From 067052969e57789251d604be94caeb7ec2554707 Mon Sep 17 00:00:00 2001 +From cbbd1f1491be604b501ab93bc51b51853abdb7a8 Mon Sep 17 00:00:00 2001 From: Alexander Mikhalitsyn Date: Mon, 21 Feb 2022 15:15:52 +0300 -Subject: [PATCH 242/245] compel: add helpers to get/set instruction pointer +Subject: [PATCH 243/249] compel: add helpers to get/set instruction pointer Signed-off-by: Alexander Mikhalitsyn --- @@ -155,10 +155,10 @@ index 7fa0bd8a0..e01b3a22c 100644 + #endif diff --git a/compel/src/lib/infect.c b/compel/src/lib/infect.c -index 78e4d7e0e..c49f2f4e5 100644 +index 0fb9e715c..6a13cc1b4 100644 --- a/compel/src/lib/infect.c +++ b/compel/src/lib/infect.c -@@ -1687,3 +1687,23 @@ uint64_t compel_get_thread_sp(struct parasite_thread_ctl *tctl) +@@ -1686,3 +1686,23 @@ uint64_t compel_get_thread_sp(struct parasite_thread_ctl *tctl) { return REG_SP(tctl->th.regs); } diff --git a/0243-cr-dump-fixup-thread-IP-when-inside-rseq-cs.patch b/0244-cr-dump-fixup-thread-IP-when-inside-rseq-cs.patch similarity index 91% rename from 0243-cr-dump-fixup-thread-IP-when-inside-rseq-cs.patch rename to 0244-cr-dump-fixup-thread-IP-when-inside-rseq-cs.patch index d727a2a..321bc24 100644 --- a/0243-cr-dump-fixup-thread-IP-when-inside-rseq-cs.patch +++ b/0244-cr-dump-fixup-thread-IP-when-inside-rseq-cs.patch @@ -1,21 +1,21 @@ -From 3b3f3c153e189202bbdbae186e13cc0b3f245195 Mon Sep 17 00:00:00 2001 +From a8d33aa97d51655272bd141fd4fbd6f683a98318 Mon Sep 17 00:00:00 2001 From: Alexander Mikhalitsyn Date: Mon, 21 Feb 2022 15:25:21 +0300 -Subject: [PATCH 243/245] cr-dump: fixup thread IP when inside rseq cs +Subject: [PATCH 244/249] cr-dump: fixup thread IP when inside rseq cs Signed-off-by: Alexander Mikhalitsyn --- - criu/cr-dump.c | 155 +++++++++++++++++++++++++++++++++++++- + criu/cr-dump.c | 156 +++++++++++++++++++++++++++++++++++++- criu/include/linux/rseq.h | 2 +- criu/include/parasite.h | 2 + criu/include/pstree.h | 1 + - 4 files changed, 155 insertions(+), 5 deletions(-) + 4 files changed, 156 insertions(+), 5 deletions(-) diff --git a/criu/cr-dump.c b/criu/cr-dump.c -index eb645a597..3f12e7721 100644 +index eb645a597..1992991a2 100644 --- a/criu/cr-dump.c +++ b/criu/cr-dump.c -@@ -1034,11 +1034,58 @@ static int dump_task_signals(pid_t pid, struct pstree_item *item) +@@ -1034,11 +1034,59 @@ static int dump_task_signals(pid_t pid, struct pstree_item *item) return 0; } @@ -45,7 +45,8 @@ index eb645a597..3f12e7721 100644 + sizeof(uint64_t)); + if (ret) { + pr_err("ptrace_peek_area(%d, %lx, %lx, %lx): fail to read rseq_cs addr\n", tid, (unsigned long)&addr, -+ (unsigned long)(rseq->rseq_abi_pointer + offsetof(struct rseq, rseq_cs)), sizeof(uint64_t)); ++ (unsigned long)(rseq->rseq_abi_pointer + offsetof(struct rseq, rseq_cs)), ++ (unsigned long)sizeof(uint64_t)); + return -1; + } + @@ -56,7 +57,7 @@ index eb645a597..3f12e7721 100644 + ret = ptrace_peek_area(tid, rseq_cs, decode_pointer(addr), sizeof(struct rseq_cs)); + if (ret) { + pr_err("ptrace_peek_area(%d, %lx, %lx, %lx): fail to read rseq_cs struct\n", tid, -+ (unsigned long)rseq_cs, (unsigned long)addr, sizeof(struct rseq_cs)); ++ (unsigned long)rseq_cs, (unsigned long)addr, (unsigned long)sizeof(struct rseq_cs)); + return -1; + } + @@ -75,7 +76,7 @@ index eb645a597..3f12e7721 100644 /* * If we are here it means that rseq() syscall is supported, -@@ -1063,7 +1110,8 @@ static int dump_thread_rseq(pid_t tid, RseqEntry **rseqep) +@@ -1063,7 +1111,8 @@ static int dump_thread_rseq(pid_t tid, RseqEntry **rseqep) return -1; } @@ -85,7 +86,7 @@ index eb645a597..3f12e7721 100644 rseqe = xmalloc(sizeof(*rseqe)); if (!rseqe) -@@ -1075,25 +1123,118 @@ static int dump_thread_rseq(pid_t tid, RseqEntry **rseqep) +@@ -1075,25 +1124,118 @@ static int dump_thread_rseq(pid_t tid, RseqEntry **rseqep) rseqe->rseq_abi_size = rseq.rseq_abi_size; rseqe->signature = rseq.signature; @@ -206,7 +207,7 @@ index eb645a597..3f12e7721 100644 } static struct proc_pid_stat pps_buf; -@@ -1403,6 +1544,12 @@ static int dump_one_task(struct pstree_item *item, InventoryEntry *parent_ie) +@@ -1403,6 +1545,12 @@ static int dump_one_task(struct pstree_item *item, InventoryEntry *parent_ie) goto err; } diff --git a/0245-fixup.patch b/0245-fixup.patch deleted file mode 100644 index 9adb44a..0000000 --- a/0245-fixup.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 9a0c293c5ea8ca0430d1887b1f2647d0217e222f Mon Sep 17 00:00:00 2001 -From: Radostin Stoyanov -Date: Tue, 5 Apr 2022 10:48:40 +0100 -Subject: [PATCH] fixup - -Signed-off-by: Radostin Stoyanov ---- - criu/cr-dump.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/criu/cr-dump.c b/criu/cr-dump.c -index 0984bd11c..4ca436d26 100644 ---- a/criu/cr-dump.c -+++ b/criu/cr-dump.c -@@ -1057,7 +1057,7 @@ static int read_rseq_cs(pid_t tid, struct __ptrace_rseq_configuration *rseqc, st - */ - ret = ptrace_peek_area(tid, rseq, decode_pointer(rseqc->rseq_abi_pointer), sizeof(struct rseq)); - if (ret) { -- pr_err("ptrace_peek_area(%d, %lx, %lx, %lx): fail to read rseq struct\n", tid, (unsigned long)rseq, -+ pr_err("ptrace_peek_area(%d, %lx, %lx, %lu): fail to read rseq struct\n", tid, (unsigned long)rseq, - (unsigned long)(rseqc->rseq_abi_pointer), sizeof(uint64_t)); - return -1; - } -@@ -1067,7 +1067,7 @@ static int read_rseq_cs(pid_t tid, struct __ptrace_rseq_configuration *rseqc, st - - ret = ptrace_peek_area(tid, rseq_cs, decode_pointer(rseq->rseq_cs.ptr64), sizeof(struct rseq_cs)); - if (ret) { -- pr_err("ptrace_peek_area(%d, %lx, %lx, %lx): fail to read rseq_cs struct\n", tid, -+ pr_err("ptrace_peek_area(%d, %lx, %lx, %lu): fail to read rseq_cs struct\n", tid, - (unsigned long)rseq_cs, (unsigned long)rseq->rseq_cs.ptr64, sizeof(struct rseq_cs)); - return -1; - } --- -2.35.1 - diff --git a/0245-zdtm-add-transition-rseq01-test-for-amd64.patch b/0245-zdtm-add-transition-rseq01-test-for-amd64.patch new file mode 100644 index 0000000..b86acce --- /dev/null +++ b/0245-zdtm-add-transition-rseq01-test-for-amd64.patch @@ -0,0 +1,251 @@ +From 7f91af616406a97761d658550fdfcdb38a5e333d Mon Sep 17 00:00:00 2001 +From: Alexander Mikhalitsyn +Date: Mon, 21 Feb 2022 15:45:40 +0300 +Subject: [PATCH 245/249] zdtm: add transition/rseq01 test for amd64 + +Signed-off-by: Alexander Mikhalitsyn +--- + test/zdtm/transition/Makefile | 1 + + test/zdtm/transition/rseq01.c | 209 +++++++++++++++++++++++++++++++ + test/zdtm/transition/rseq01.desc | 1 + + 3 files changed, 211 insertions(+) + create mode 100644 test/zdtm/transition/rseq01.c + create mode 100644 test/zdtm/transition/rseq01.desc + +diff --git a/test/zdtm/transition/Makefile b/test/zdtm/transition/Makefile +index 9388157e8..fae4e27b3 100644 +--- a/test/zdtm/transition/Makefile ++++ b/test/zdtm/transition/Makefile +@@ -23,6 +23,7 @@ TST_NOFILE = \ + lazy-thp \ + pid_reuse \ + pidfd_store_sk \ ++ rseq01 \ + + + TST_FILE = \ +diff --git a/test/zdtm/transition/rseq01.c b/test/zdtm/transition/rseq01.c +new file mode 100644 +index 000000000..a0c3dbc82 +--- /dev/null ++++ b/test/zdtm/transition/rseq01.c +@@ -0,0 +1,209 @@ ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "zdtmtst.h" ++ ++#ifdef __has_include ++#if __has_include("sys/rseq.h") ++#include ++#endif ++#endif ++ ++#if defined(__x86_64__) ++ ++#if defined(__x86_64__) && defined(RSEQ_SIG) ++static inline void *thread_pointer(void) ++{ ++ void *result; ++ asm("mov %%fs:0, %0" : "=r"(result)); ++ return result; ++} ++ ++static inline void unregister_old_rseq(void) ++{ ++ /* unregister rseq */ ++ syscall(__NR_rseq, (void *)((char *)thread_pointer() + __rseq_offset), __rseq_size, 1, RSEQ_SIG); ++} ++#else ++static inline void unregister_old_rseq(void) ++{ ++} ++#endif ++ ++const char *test_doc = "rseq() transition test"; ++const char *test_author = "Alexander Mikhalitsyn "; ++ ++/* parts of code borrowed from https://www.efficios.com/blog/2019/02/08/linux-restartable-sequences/ */ ++ ++/* some useful definitions from kernel uapi */ ++#ifndef RSEQ_SIG ++ ++enum rseq_flags { ++ RSEQ_FLAG_UNREGISTER = (1 << 0), ++}; ++ ++struct rseq { ++ uint32_t cpu_id_start; ++ uint32_t cpu_id; ++ uint64_t rseq_cs; ++ uint32_t flags; ++} __attribute__((aligned(4 * sizeof(uint64_t)))); ++ ++#define RSEQ_SIG 0x53053053 ++ ++#endif ++ ++#ifndef __NR_rseq ++#define __NR_rseq 334 ++#endif ++/* EOF */ ++ ++static volatile struct rseq *rseq_ptr; ++static __thread volatile struct rseq __rseq_abi; ++ ++static int sys_rseq(volatile struct rseq *rseq_abi, uint32_t rseq_len, int flags, uint32_t sig) ++{ ++ return syscall(__NR_rseq, rseq_abi, rseq_len, flags, sig); ++} ++ ++static void register_thread(void) ++{ ++ int rc; ++ unregister_old_rseq(); ++ rc = sys_rseq(rseq_ptr, sizeof(struct rseq), 0, RSEQ_SIG); ++ if (rc) { ++ fail("Failed to register rseq"); ++ exit(1); ++ } ++} ++ ++static void check_thread(void) ++{ ++ int rc; ++ rc = sys_rseq(rseq_ptr, sizeof(struct rseq), 0, RSEQ_SIG); ++ if (!(rc && errno == EBUSY)) { ++ fail("Failed to check rseq %d", rc); ++ exit(1); ++ } ++} ++ ++#define RSEQ_ACCESS_ONCE(x) (*(__volatile__ __typeof__(x) *)&(x)) ++ ++static int rseq_addv(intptr_t *v, intptr_t count, int cpu) ++{ ++ double a = 10000000000000000.0; ++ double b = -1; ++ ++ /* clang-format off */ ++ __asm__ __volatile__ goto( ++ ".pushsection __rseq_table, \"aw\"\n\t" ++ ".balign 32\n\t" ++ "cs_obj:\n\t" ++ /* version, flags */ ++ ".long 0, 0\n\t" ++ /* start_ip, post_commit_offset, abort_ip */ ++ ".quad 1f, (2f-1f), 4f\n\t" ++ ".popsection\n\t" ++ "1:\n\t" ++ "leaq cs_obj(%%rip), %%rax\n\t" ++ "movq %%rax, %[rseq_cs]\n\t" ++ "cmpl %[cpu_id], %[current_cpu_id]\n\t" ++ "jnz 4f\n\t" ++ "addq %[count], %[v]\n\t" /* final store */ ++ "mov $10000000, %%rcx\n\t" ++ "fldl %[x]\n\t" /* we have st clobbered */ ++ "5:\n\t" ++ "fsqrt\n\t" /* heavy instruction */ ++ "dec %%rcx\n\t" ++ "jnz 5b\n\t" ++ "fstpl %[y]\n\t" ++ "2:\n\t" ++ ".pushsection __rseq_failure, \"ax\"\n\t" ++ /* Disassembler-friendly signature: nopl (%rip). */ ++ ".byte 0x0f, 0xb9, 0x3d\n\t" ++ ".long 0x53053053\n\t" /* RSEQ_FLAGS */ ++ "4:\n\t" ++ /*"fstpl %[y]\n\t"*/ ++ "jmp %l[abort]\n\t" ++ /*"jmp 1b\n\t"*/ ++ ".popsection\n\t" ++ : /* gcc asm goto does not allow outputs */ ++ : [cpu_id] "r" (cpu), ++ [current_cpu_id] "m" (rseq_ptr->cpu_id), ++ [rseq_cs] "m" (rseq_ptr->rseq_cs), ++ /* final store input */ ++ [v] "m" (*v), ++ [count] "er" (count), ++ [x] "m" (a), ++ [y] "m" (b) ++ : "memory", "cc", "rax", "rcx", "st" ++ : abort ++ ); ++ /* clang-format on */ ++ ++ return 0; ++abort: ++ return -1; ++} ++ ++int main(int argc, char *argv[]) ++{ ++ int cpu = 0; ++ int ret; ++ intptr_t *cpu_data; ++ long nr_cpus; ++ ++ rseq_ptr = &__rseq_abi; ++ memset((void *)rseq_ptr, 0, sizeof(struct rseq)); ++ ++ test_init(argc, argv); ++ nr_cpus = sysconf(_SC_NPROCESSORS_ONLN); ++ ++ cpu_data = calloc(nr_cpus, sizeof(*cpu_data)); ++ if (!cpu_data) { ++ fail("calloc"); ++ exit(EXIT_FAILURE); ++ } ++ register_thread(); ++ ++ test_daemon(); ++ ++ while (test_go()) { ++ cpu = RSEQ_ACCESS_ONCE(rseq_ptr->cpu_id_start); ++ ret = rseq_addv(&cpu_data[cpu], 2, cpu); ++ if (ret) ++ fail("Failed to increment per-cpu counter"); ++ } ++ ++ test_waitsig(); ++ ++ check_thread(); ++ pass(); ++ ++ return 0; ++} ++ ++#else /* #if defined(__x86_64__) */ ++ ++int main(int argc, char *argv[]) ++{ ++ test_init(argc, argv); ++ skip("Unsupported arch"); ++ test_daemon(); ++ test_waitsig(); ++ pass(); ++ return 0; ++} ++ ++#endif /* #if defined(__x86_64__) */ +diff --git a/test/zdtm/transition/rseq01.desc b/test/zdtm/transition/rseq01.desc +new file mode 100644 +index 000000000..0324fa39c +--- /dev/null ++++ b/test/zdtm/transition/rseq01.desc +@@ -0,0 +1 @@ ++{'flavor': 'h', 'arch': 'x86_64', 'feature': 'get_rseq_conf'} +-- +2.35.1 + diff --git a/0246-Revert-test-disable-rseq-also-on-Archlinux.patch b/0246-Revert-test-disable-rseq-also-on-Archlinux.patch new file mode 100644 index 0000000..0b3e77f --- /dev/null +++ b/0246-Revert-test-disable-rseq-also-on-Archlinux.patch @@ -0,0 +1,28 @@ +From b4e121a54c83c172d3b78b1d9002f4367a2c1fb8 Mon Sep 17 00:00:00 2001 +From: Alexander Mikhalitsyn +Date: Tue, 22 Feb 2022 15:25:37 +0300 +Subject: [PATCH 246/249] Revert "test: disable rseq also on Archlinux" + +This reverts commit f008f740411156b7309219c7e052cb8bc24d5aae. + +Signed-off-by: Alexander Mikhalitsyn +--- + scripts/build/Dockerfile.archlinux | 3 --- + 1 file changed, 3 deletions(-) + +diff --git a/scripts/build/Dockerfile.archlinux b/scripts/build/Dockerfile.archlinux +index b226d5701..d226244ee 100644 +--- a/scripts/build/Dockerfile.archlinux ++++ b/scripts/build/Dockerfile.archlinux +@@ -1,8 +1,5 @@ + FROM docker.io/library/archlinux:latest + +-# FIXME: Temporary solution for https://github.com/checkpoint-restore/criu/issues/1696 +-ENV GLIBC_TUNABLES=glibc.pthread.rseq=0 +- + ARG CC=gcc + + RUN pacman -Syu --noconfirm \ +-- +2.35.1 + diff --git a/0244-cr-dump-handle-rseq-flags-field.patch b/0247-cr-dump-handle-rseq-flags-field.patch similarity index 90% rename from 0244-cr-dump-handle-rseq-flags-field.patch rename to 0247-cr-dump-handle-rseq-flags-field.patch index b2b1a6c..d837bc8 100644 --- a/0244-cr-dump-handle-rseq-flags-field.patch +++ b/0247-cr-dump-handle-rseq-flags-field.patch @@ -1,21 +1,21 @@ -From 51528fc97bf42e8b7e7d19103970e82890f2cb58 Mon Sep 17 00:00:00 2001 +From 392f1ecdcbd53f558f101b384831876f4b3969f9 Mon Sep 17 00:00:00 2001 From: Alexander Mikhalitsyn Date: Tue, 22 Feb 2022 18:22:45 +0300 -Subject: [PATCH 244/245] cr-dump: handle rseq flags field +Subject: [PATCH 247/249] cr-dump: handle rseq flags field Userspace may configure rseq critical section by def Signed-off-by: Alexander Mikhalitsyn --- - criu/cr-dump.c | 85 +++++++++++++++++++++++++---------------- + criu/cr-dump.c | 87 +++++++++++++++++++++++++---------------- criu/cr-restore.c | 57 +++++++++++++++++++++++++++ criu/include/rst_info.h | 8 ++++ criu/pstree.c | 36 +++++++++++++++++ images/rseq.proto | 1 + - 5 files changed, 154 insertions(+), 33 deletions(-) + 5 files changed, 155 insertions(+), 34 deletions(-) diff --git a/criu/cr-dump.c b/criu/cr-dump.c -index 3f12e7721..0984bd11c 100644 +index 1992991a2..5f40f2b5b 100644 --- a/criu/cr-dump.c +++ b/criu/cr-dump.c @@ -1034,13 +1034,13 @@ static int dump_task_signals(pid_t pid, struct pstree_item *item) @@ -35,7 +35,7 @@ index 3f12e7721..0984bd11c 100644 return 0; /* -@@ -1055,22 +1055,20 @@ static int read_rseq_cs(pid_t tid, struct __ptrace_rseq_configuration *rseq, str +@@ -1055,23 +1055,21 @@ static int read_rseq_cs(pid_t tid, struct __ptrace_rseq_configuration *rseq, str * then rseq_ip_fixup() -> clear_rseq_cs() and user space memory with struct rseq * will be cleared. So, let's use ptrace(PTRACE_PEEKDATA). */ @@ -44,9 +44,10 @@ index 3f12e7721..0984bd11c 100644 + ret = ptrace_peek_area(tid, rseq, decode_pointer(rseqc->rseq_abi_pointer), sizeof(struct rseq)); if (ret) { - pr_err("ptrace_peek_area(%d, %lx, %lx, %lx): fail to read rseq_cs addr\n", tid, (unsigned long)&addr, -- (unsigned long)(rseq->rseq_abi_pointer + offsetof(struct rseq, rseq_cs)), sizeof(uint64_t)); +- (unsigned long)(rseq->rseq_abi_pointer + offsetof(struct rseq, rseq_cs)), +- (unsigned long)sizeof(uint64_t)); + pr_err("ptrace_peek_area(%d, %lx, %lx, %lx): fail to read rseq struct\n", tid, (unsigned long)rseq, -+ (unsigned long)(rseqc->rseq_abi_pointer), sizeof(uint64_t)); ++ (unsigned long)(rseqc->rseq_abi_pointer), (unsigned long)sizeof(uint64_t)); return -1; } @@ -59,12 +60,13 @@ index 3f12e7721..0984bd11c 100644 + ret = ptrace_peek_area(tid, rseq_cs, decode_pointer(rseq->rseq_cs.ptr64), sizeof(struct rseq_cs)); if (ret) { pr_err("ptrace_peek_area(%d, %lx, %lx, %lx): fail to read rseq_cs struct\n", tid, -- (unsigned long)rseq_cs, (unsigned long)addr, sizeof(struct rseq_cs)); -+ (unsigned long)rseq_cs, (unsigned long)rseq->rseq_cs.ptr64, sizeof(struct rseq_cs)); +- (unsigned long)rseq_cs, (unsigned long)addr, (unsigned long)sizeof(struct rseq_cs)); ++ (unsigned long)rseq_cs, (unsigned long)rseq->rseq_cs.ptr64, ++ (unsigned long)sizeof(struct rseq_cs)); return -1; } -@@ -1079,11 +1077,12 @@ static int read_rseq_cs(pid_t tid, struct __ptrace_rseq_configuration *rseq, str +@@ -1080,11 +1078,12 @@ static int read_rseq_cs(pid_t tid, struct __ptrace_rseq_configuration *rseq, str static int dump_thread_rseq(struct pstree_item *item, int i) { @@ -78,7 +80,7 @@ index 3f12e7721..0984bd11c 100644 struct rseq_cs *rseq_cs = &dmpi(item)->thread_rseq_cs[i]; pid_t tid = item->threads[i].real; -@@ -1098,20 +1097,20 @@ static int dump_thread_rseq(struct pstree_item *item, int i) +@@ -1099,20 +1098,20 @@ static int dump_thread_rseq(struct pstree_item *item, int i) if (!kdat.has_ptrace_get_rseq_conf) return 0; @@ -105,7 +107,7 @@ index 3f12e7721..0984bd11c 100644 rseqe = xmalloc(sizeof(*rseqe)); if (!rseqe) -@@ -1119,13 +1118,22 @@ static int dump_thread_rseq(struct pstree_item *item, int i) +@@ -1120,13 +1119,22 @@ static int dump_thread_rseq(struct pstree_item *item, int i) rseq_entry__init(rseqe); @@ -132,7 +134,7 @@ index 3f12e7721..0984bd11c 100644 /* save rseq entry to the image */ *rseqep = rseqe; -@@ -1175,11 +1183,12 @@ static int fixup_thread_rseq(struct pstree_item *item, int i) +@@ -1176,11 +1184,12 @@ static int fixup_thread_rseq(struct pstree_item *item, int i) struct rseq_cs *rseq_cs = &dmpi(item)->thread_rseq_cs[i]; pid_t tid = item->threads[i].real; @@ -147,7 +149,7 @@ index 3f12e7721..0984bd11c 100644 tid, rseq_cs->start_ip, rseq_cs->abort_ip, rseq_cs->post_commit_offset, rseq_cs->flags, rseq_cs->version, (unsigned long)TI_IP(core)); -@@ -1191,25 +1200,35 @@ static int fixup_thread_rseq(struct pstree_item *item, int i) +@@ -1192,25 +1201,35 @@ static int fixup_thread_rseq(struct pstree_item *item, int i) if (task_in_rseq(rseq_cs, TI_IP(core))) { struct pid *tid = &item->threads[i]; @@ -193,7 +195,7 @@ index 3f12e7721..0984bd11c 100644 } diff --git a/criu/cr-restore.c b/criu/cr-restore.c -index b2ddc8db0..ebf40d2df 100644 +index b2ddc8db0..77b0a8c0f 100644 --- a/criu/cr-restore.c +++ b/criu/cr-restore.c @@ -23,6 +23,7 @@ @@ -257,7 +259,7 @@ index b2ddc8db0..ebf40d2df 100644 + continue; + + if (ptrace_poke_area(pid, &rseqe[i].rseq_cs_pointer, -+ (void *)(rseqe[i].rseq_abi_pointer + offsetof(struct rseq, rseq_cs)), ++ decode_pointer(rseqe[i].rseq_abi_pointer + offsetof(struct rseq, rseq_cs)), + sizeof(uint64_t))) { + pr_err("Can't restore rseq_cs pointer (pid: %d)\n", pid); + return -1; @@ -315,7 +317,7 @@ index 9664e0a1c..d0a3db6c5 100644 }; diff --git a/criu/pstree.c b/criu/pstree.c -index d29de730a..d006c2660 100644 +index d29de730a..d299f41c0 100644 --- a/criu/pstree.c +++ b/criu/pstree.c @@ -954,6 +954,31 @@ static int prepare_pstree_kobj_ids(void) @@ -335,7 +337,7 @@ index d29de730a..d006c2660 100644 + + rseqs = shmalloc(sz); + if (!rseqs) { -+ pr_err("prepare_pstree_rseqs shmalloc(%ld) failed\n", sz); ++ pr_err("prepare_pstree_rseqs shmalloc(%lu) failed\n", (unsigned long)sz); + return -1; + } + diff --git a/0248-zdtm-add-rseq02-transition-test-with-NO_RESTART-CS-f.patch b/0248-zdtm-add-rseq02-transition-test-with-NO_RESTART-CS-f.patch new file mode 100644 index 0000000..0988931 --- /dev/null +++ b/0248-zdtm-add-rseq02-transition-test-with-NO_RESTART-CS-f.patch @@ -0,0 +1,175 @@ +From ab6d09a8c0303a036b0964c7263075e74b02ce48 Mon Sep 17 00:00:00 2001 +From: Alexander Mikhalitsyn +Date: Wed, 23 Feb 2022 23:20:29 +0300 +Subject: [PATCH 248/249] zdtm: add rseq02 transition test with NO_RESTART CS + flag + +Signed-off-by: Alexander Mikhalitsyn +--- + test/zdtm/transition/Makefile | 2 ++ + test/zdtm/transition/rseq01.c | 59 ++++++++++++++++++++++++++++++-- + test/zdtm/transition/rseq02.c | 1 + + test/zdtm/transition/rseq02.desc | 1 + + 4 files changed, 61 insertions(+), 2 deletions(-) + create mode 120000 test/zdtm/transition/rseq02.c + create mode 120000 test/zdtm/transition/rseq02.desc + +diff --git a/test/zdtm/transition/Makefile b/test/zdtm/transition/Makefile +index fae4e27b3..378a4fc75 100644 +--- a/test/zdtm/transition/Makefile ++++ b/test/zdtm/transition/Makefile +@@ -24,6 +24,7 @@ TST_NOFILE = \ + pid_reuse \ + pidfd_store_sk \ + rseq01 \ ++ rseq02 \ + + + TST_FILE = \ +@@ -82,6 +83,7 @@ ptrace: LDFLAGS += -pthread + fork2: CFLAGS += -D FORK2 + thread-bomb.o: CFLAGS += -pthread + thread-bomb: LDFLAGS += -pthread ++rseq02: CFLAGS += -D NOABORT + + %: %.sh + cp $< $@ +diff --git a/test/zdtm/transition/rseq01.c b/test/zdtm/transition/rseq01.c +index a0c3dbc82..26b8fe335 100644 +--- a/test/zdtm/transition/rseq01.c ++++ b/test/zdtm/transition/rseq01.c +@@ -53,6 +53,18 @@ enum rseq_flags { + RSEQ_FLAG_UNREGISTER = (1 << 0), + }; + ++enum rseq_cs_flags_bit { ++ RSEQ_CS_FLAG_NO_RESTART_ON_PREEMPT_BIT = 0, ++ RSEQ_CS_FLAG_NO_RESTART_ON_SIGNAL_BIT = 1, ++ RSEQ_CS_FLAG_NO_RESTART_ON_MIGRATE_BIT = 2, ++}; ++ ++enum rseq_cs_flags { ++ RSEQ_CS_FLAG_NO_RESTART_ON_PREEMPT = (1U << RSEQ_CS_FLAG_NO_RESTART_ON_PREEMPT_BIT), ++ RSEQ_CS_FLAG_NO_RESTART_ON_SIGNAL = (1U << RSEQ_CS_FLAG_NO_RESTART_ON_SIGNAL_BIT), ++ RSEQ_CS_FLAG_NO_RESTART_ON_MIGRATE = (1U << RSEQ_CS_FLAG_NO_RESTART_ON_MIGRATE_BIT), ++}; ++ + struct rseq { + uint32_t cpu_id_start; + uint32_t cpu_id; +@@ -104,6 +116,7 @@ static int rseq_addv(intptr_t *v, intptr_t count, int cpu) + { + double a = 10000000000000000.0; + double b = -1; ++ uint64_t rseq_cs1 = 0, rseq_cs2 = 0; + + /* clang-format off */ + __asm__ __volatile__ goto( +@@ -128,6 +141,9 @@ static int rseq_addv(intptr_t *v, intptr_t count, int cpu) + "dec %%rcx\n\t" + "jnz 5b\n\t" + "fstpl %[y]\n\t" ++ "movq %%rax, %[rseq_cs_check2]\n\t" ++ "movq %[rseq_cs], %%rax\n\t" ++ "movq %%rax, %[rseq_cs_check1]\n\t" + "2:\n\t" + ".pushsection __rseq_failure, \"ax\"\n\t" + /* Disassembler-friendly signature: nopl (%rip). */ +@@ -142,6 +158,8 @@ static int rseq_addv(intptr_t *v, intptr_t count, int cpu) + : [cpu_id] "r" (cpu), + [current_cpu_id] "m" (rseq_ptr->cpu_id), + [rseq_cs] "m" (rseq_ptr->rseq_cs), ++ [rseq_cs_check1] "m" (rseq_cs1), ++ [rseq_cs_check2] "m" (rseq_cs2), + /* final store input */ + [v] "m" (*v), + [count] "er" (count), +@@ -152,8 +170,21 @@ static int rseq_addv(intptr_t *v, intptr_t count, int cpu) + ); + /* clang-format on */ + ++ test_msg("exit %lx %lx %f %f\n", rseq_cs1, rseq_cs2, a, b); ++ if (rseq_cs1 != rseq_cs2) { ++ /* ++ * It means that we finished critical section ++ * *normally* (haven't jumped to abort) but the kernel had cleaned up ++ * rseq_ptr->rseq_cs before we left critical section ++ * and CRIU wasn't restored it correctly. ++ * That's a bug picture. ++ */ ++ return -1; ++ } ++ + return 0; + abort: ++ test_msg("abort %lx %lx %f %f\n", rseq_cs1, rseq_cs2, a, b); + return -1; + } + +@@ -175,21 +206,45 @@ int main(int argc, char *argv[]) + fail("calloc"); + exit(EXIT_FAILURE); + } ++ + register_thread(); + ++ /* ++ * We want to test that RSEQ_CS_FLAG_NO_RESTART_ON_SIGNAL ++ * is handled properly by CRIU, but that flag can be used ++ * only with all another flags set. ++ * Please, refer to ++ * https://github.com/torvalds/linux/blob/master/kernel/rseq.c#L192 ++ */ ++#ifdef NOABORT ++ rseq_ptr->flags = RSEQ_CS_FLAG_NO_RESTART_ON_PREEMPT | RSEQ_CS_FLAG_NO_RESTART_ON_SIGNAL | ++ RSEQ_CS_FLAG_NO_RESTART_ON_MIGRATE; ++#endif ++ + test_daemon(); + + while (test_go()) { + cpu = RSEQ_ACCESS_ONCE(rseq_ptr->cpu_id_start); + ret = rseq_addv(&cpu_data[cpu], 2, cpu); +- if (ret) ++#ifndef NOABORT ++ /* just ignore abort */ ++ ret = 0; ++#else ++ if (ret) { + fail("Failed to increment per-cpu counter"); ++ break; ++ } ++#endif + } + + test_waitsig(); + + check_thread(); +- pass(); ++ ++ if (ret) ++ fail(); ++ else ++ pass(); + + return 0; + } +diff --git a/test/zdtm/transition/rseq02.c b/test/zdtm/transition/rseq02.c +new file mode 120000 +index 000000000..d56491719 +--- /dev/null ++++ b/test/zdtm/transition/rseq02.c +@@ -0,0 +1 @@ ++rseq01.c +\ No newline at end of file +diff --git a/test/zdtm/transition/rseq02.desc b/test/zdtm/transition/rseq02.desc +new file mode 120000 +index 000000000..b888f0da7 +--- /dev/null ++++ b/test/zdtm/transition/rseq02.desc +@@ -0,0 +1 @@ ++rseq01.desc +\ No newline at end of file +-- +2.35.1 + diff --git a/0249-zdtm-temporary-disable-rseq02-test.patch b/0249-zdtm-temporary-disable-rseq02-test.patch new file mode 100644 index 0000000..f07a174 --- /dev/null +++ b/0249-zdtm-temporary-disable-rseq02-test.patch @@ -0,0 +1,41 @@ +From 149d70490d27bfa302ed977b40f55df4aecd36ea Mon Sep 17 00:00:00 2001 +From: Alexander Mikhalitsyn +Date: Tue, 5 Apr 2022 12:27:07 +0300 +Subject: [PATCH 249/249] zdtm: temporary disable rseq02 test + +That's strange but rseq02 test fails with: +09:06:16.222: 51: exit 555f52082120 555f52082120 +09:06:16.282: 51: exit 555f52082120 555f52082120 +09:06:16.340: 51: exit 555f52082120 555f52082120 +09:06:16.397: 51: exit 555f52082120 555f52082120 +09:06:16.503: 51: exit 0 555f52082120 +09:06:16.503: 51: FAIL: rseq02.c:235: Failed to increment per-cpu counter (errno = 2 (No such file or directory)) +09:06:16.503: 51: FAIL: rseq02.c:246: (errno = 16 (Device or resource busy)) + +It means that rseq_cs pointer was cleaned up by the kernel despite of +NO_RESTART* flags. That's a hardly reproducible and I will investigate that. + +Signed-off-by: Alexander Mikhalitsyn +--- + test/zdtm/transition/rseq02.desc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + mode change 120000 => 100644 test/zdtm/transition/rseq02.desc + +diff --git a/test/zdtm/transition/rseq02.desc b/test/zdtm/transition/rseq02.desc +deleted file mode 120000 +index b888f0da7..000000000 +--- a/test/zdtm/transition/rseq02.desc ++++ /dev/null +@@ -1 +0,0 @@ +-rseq01.desc +\ No newline at end of file +diff --git a/test/zdtm/transition/rseq02.desc b/test/zdtm/transition/rseq02.desc +new file mode 100644 +index 000000000..1ce7f240f +--- /dev/null ++++ b/test/zdtm/transition/rseq02.desc +@@ -0,0 +1 @@ ++{'flavor': 'h', 'arch': 'x86_64', 'feature': 'get_rseq_conf', 'flags': 'noauto'} +-- +2.35.1 + diff --git a/criu.spec b/criu.spec index 9276ae8..c1e1167 100644 --- a/criu.spec +++ b/criu.spec @@ -17,257 +17,261 @@ Name: criu Version: 3.16.1 -Release: 10%{?dist} +Release: 11%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPLv2 URL: http://criu.org/ Source0: https://github.com/checkpoint-restore/criu/archive/v%{version}/criu-%{version}.tar.gz Patch1: 0001-criu-8-add-external-net-option.patch -Patch2: 0002-criu-files-Don-t-cache-fd-ids-for-device-files.patch -Patch3: 0003-tcp-Skip-restoring-TCP-state-when-dumping-with-tcp-c.patch -Patch4: 0004-zdtm-Dumping-restoring-with-tcp-close-on-TCP_CLOSE-s.patch -Patch5: 0005-criu-8-Add-more-detailed-description-about-tcp-close.patch -Patch6: 0006-Add-support-for-python3-in-criu-coredump.patch -Patch7: 0007-Add-new-files-for-running-criu-coredump-via-python-2.patch -Patch8: 0008-coredump-remove-unused-import.patch -Patch9: 0009-coredump-sort-imports.patch -Patch10: 0010-coredump-convert-indentation-to-spaces.patch -Patch11: 0011-python-replace-equality-with-identity-test.patch -Patch12: 0012-coredump-drop-unused-variable.patch -Patch13: 0013-coredump-drop-exec-permission.patch -Patch14: 0014-coredump-lint-fix-for-block-comments.patch -Patch15: 0015-coredump-fix-missing-whitespace-around-operator.patch -Patch16: 0016-coredump-fix-too-many-blank-lines.patch -Patch17: 0017-coredump-fix-comparison-to-true.patch -Patch18: 0018-coredump-lint-fix-visually-indented-line.patch -Patch19: 0019-test-coredump-fix-shellcheck-errors.patch -Patch20: 0020-make-enable-lint-for-coredump.patch -Patch21: 0021-ci-enable-coredump-tests.patch -Patch22: 0022-pie-restorer-remove-excess-hash-printf-specifier.patch -Patch23: 0023-tty-fix-the-null-pointer-of-get_tty_driver.patch -Patch24: 0024-util-use-nftw-in-rmrf-helper.patch -Patch25: 0025-criu-ns-make-pidns-init-first-do-setsid.patch -Patch26: 0026-net-optimize-restore_rule-to-not-open-the-CR_FD_RULE.patch -Patch27: 0027-ci-replace-deprecated-codecov-bash-uploader.patch -Patch28: 0028-ci-fix-userfaultfd-test-failures.patch -Patch29: 0029-ci-use-Fedora-34-for-lint-CI-runs.patch -Patch30: 0030-tests-improve-the-image-streamer-process-control.patch -Patch31: 0031-sockets-don-t-call-sk_setbufs-asyncronously.patch -Patch32: 0032-kerndat-check-for-set-getsockopt-SO_BUF_LOCK-availab.patch -Patch33: 0033-sockets-c-r-bufer-size-locks.patch -Patch34: 0034-zdtm-add-test-for-socket-buffer-size-locks.patch -Patch35: 0035-zdtm-make-sock_opts02-also-check-lock-change-by-SO_-.patch -Patch36: 0036-clang-format-enable-AlignTrailingComments.patch -Patch37: 0037-clang-format-do-several-manual-comment-fixups.patch -Patch38: 0038-clang-format-do-automatic-comment-fixups.patch -Patch39: 0039-cr-dump-fail-dumping-when-zombie-process-with-sid-0.patch -Patch40: 0040-clang-format-make-x86_ins_capability_mask-human-read.patch -Patch41: 0041-ci-disable-socket-raw-test-on-centos8.patch -Patch42: 0042-zdtm.py-make-tests-with-link_remap-exclusive.patch -Patch43: 0043-tests-improve-the-deterministic-behavior-of-the-test.patch -Patch44: 0044-clang-format-zdtm-fix-clang-complains-about-strange-.patch -Patch45: 0045-seize-restore-cgroup-freezer-to-right-state.patch -Patch46: 0046-ci-Use-latest-Fedora-for-lint-ci-runs-again.patch -Patch47: 0047-crtools-ignore-SIGPIPE-in-swrk-mode.patch -Patch48: 0048-ci-switch-to-centos-stream-8.patch -Patch49: 0049-check-cleanup-child-processes.patch -Patch50: 0050-files-reg-fix-error-handling-in-open_path.patch -Patch51: 0051-files-reg-fix-error-handling-of-rm_parent_dirs.patch -Patch52: 0052-ghost-mount-allocate-remounted_rw-in-shmem-to-get-in.patch -Patch53: 0053-files-reg-temporary-remount-writable-the-mount-we-do.patch -Patch54: 0054-zdtm-add-ro-mount-check-after-c-r-to-mntns_ghost01.patch -Patch55: 0055-clang-format-disable-wrong-struct-pointer-declaratio.patch -Patch56: 0056-ci-Run-cross-compile-on-debian-stable.patch -Patch57: 0057-ci-Run-cross-compile-with-debian-testing.patch -Patch58: 0058-make-Explicitly-enable-FPU-on-ARMv7-builds.patch -Patch59: 0059-ci-disable-broken-tests-until-fixed.patch -Patch60: 0060-test-do-not-use-keep-going-for-single-zdtm-tests.patch -Patch61: 0061-files-reg-try-dump_ghost_remap-if-link-remap-failed-.patch -Patch62: 0062-util-make-page-server-IPv6-safe.patch -Patch63: 0063-sk-unix-Fix-TCP_ESTABLISHED-checks-in-unix-sockets.patch -Patch64: 0064-ci-Enable-disabled-unix-socket-related-tests.patch -Patch65: 0065-ci-install-procps-in-Alpine.patch -Patch66: 0066-test-another-try-to-correctly-fix-the-kernel-version.patch -Patch67: 0067-x86-compel-fault-inject-bound-xsave-features-set.patch -Patch68: 0068-x86-compel-fault-inject-print-the-initial-seed.patch -Patch69: 0069-ci-enable-x86-xsave-fault-injection-tests-back.patch -Patch70: 0070-Add-documentation-for-timeout-option.patch -Patch71: 0071-usernsd-UNS_FDOUT-should-not-require-an-input-descri.patch -Patch72: 0072-libcriu-add-setting-lsm-mount-context-to-libcriu.patch -Patch73: 0073-ci-use-unstable-release-for-cross-compile.patch -Patch74: 0074-ci-disable-glibc-rseq-support.patch -Patch75: 0075-libcriu-add-single-pre-dump-support.patch -Patch76: 0076-tests-added-test-for-single-pre-dump-support.patch -Patch77: 0077-zdtm.py-clean-up-MAKEFLAGS-env-variable-before-runni.patch -Patch78: 0078-zdtm-zdtm_ct-fix-compilation-error-with-strict-proto.patch -Patch79: 0079-zdtm-remove-mntns-deleted-dst-test-leftover-from-git.patch -Patch80: 0080-crtools-remove-excess-always-true-condition.patch -Patch81: 0081-crtools-rpc-export-current-criu-mode-to-opts.mode.patch -Patch82: 0082-crtools-use-new-opts.mode-in-image_dir_mode.patch -Patch83: 0083-crtools-check-that-cpuinfo-command-has-sub-command.patch -Patch84: 0084-sk-unix-Add-support-for-SOCK_SEQPACKET-unix-sockets.patch -Patch85: 0085-zdtm-Add-SOCK_SEQPACKET-variants-to-unix-socket-test.patch -Patch86: 0086-tls-fix-typo.patch -Patch87: 0087-tls-use-ssize_t-for-return-value.patch -Patch88: 0088-tls-add-more-comments.patch -Patch89: 0089-uffd-call-disconnect_from_page_server-to-shutdown-a-.patch -Patch90: 0090-tls-allow-to-terminate-connections-synchronously.patch -Patch91: 0091-page-xfer-stop-waiting-for-a-new-command-after-a-clo.patch -Patch92: 0092-ci-reenable-the-lazy-thp-test-in-the-lazy-remote-mod.patch -Patch93: 0093-test-log-testname.out.inprogress-if-a-test-has-faile.patch -Patch94: 0094-zdtm-print-tails-of-all-logs-if-a-test-has-failed.patch -Patch95: 0095-zdtm-static-uffd-events-add-more-log-messages.patch -Patch96: 0096-mount-split-check_mountpoint_fd-from-__open_mountpoi.patch -Patch97: 0097-mount-remove-mnt_fd-argument-of-__open_mountpoint.patch -Patch98: 0098-proc_parse-add-helper-to-resolve-sdev-from-fd.patch -Patch99: 0099-mount-btrfs-make-check_mountpoint_fd-fallback-to-get.patch -Patch100: 0100-ci-test-criu-image-streamer-with-all-tests.patch -Patch101: 0101-readme-add-docker-test-badge.patch -Patch102: 0102-contributing-remove-old-badges-and-logo.patch -Patch103: 0103-ci-update-to-latest-Vagrant-and-Fedora-images.patch -Patch104: 0104-ci-added-.lgtm.yml-file.patch -Patch105: 0105-lib-introduce-feature-check-in-libcriu.patch -Patch106: 0106-lib-added-tests-for-feature-check-in-libcriu.patch -Patch107: 0107-pagemap-tiny-fix-on-truncating-memory-image.patch -Patch108: 0108-zdtm-fix-zdtm-static-maps00-case-in-arm64.patch -Patch109: 0109-compel-fix-GCC-12-failure-out-of-bounds.patch -Patch110: 0110-criu-fix-configuration-file-scanner-with-GCC-12.patch -Patch111: 0111-compel-fix-parasite-with-GCC-12.patch -Patch112: 0112-ci-set-continue-on-error-for-cross-compile.patch -Patch113: 0113-test-autofs-fix-use-after-free.patch -Patch114: 0114-Fix-formatting-in-criu-documentation.patch -Patch115: 0115-ci-install-libbsd-dependency.patch -Patch116: 0116-pstree-when-updating-sid-for-shell-job-also-update-m.patch -Patch117: 0117-criu-ns-fix-exit-code-o-for-criu-dump.patch -Patch118: 0118-criu-ns-use-os.waitstatus_to_exitcode.patch -Patch119: 0119-restorer-Fix-sys_mmap-s-returned-value-check.patch -Patch120: 0120-compel-fix-how-PTRACE_GET_THREAD_AREA-errors-are-han.patch -Patch121: 0121-util-add-an-unique-ID-of-the-current-criu-run.patch -Patch122: 0122-files-generate-unique-transport-socket-names.patch -Patch123: 0123-check-Add-a-check-for-using-memfd-with-hugetlb.patch -Patch124: 0124-kerndat-Collect-hugetlb-device-numbers.patch -Patch125: 0125-ipc-Add-support-for-checkpoint-restore-hugetlb-Syste.patch -Patch126: 0126-memfd-shmem-Add-support-for-checkpoint-restore-memfd.patch -Patch127: 0127-proc_parse-files-Add-support-for-hugetlb-memory-mapp.patch -Patch128: 0128-mem-Skip-premapping-hugetlb-mapping.patch -Patch129: 0129-uffd-Skip-lazy-mode-restore-on-hugetlb-mappings.patch -Patch130: 0130-zdtm-Add-MAP_HUGETLB-memory-mapping-test.patch -Patch131: 0131-zdtm-Add-memfd-hugetlb-test.patch -Patch132: 0132-zdtm-Add-shm-hugetlb-test.patch -Patch133: 0133-zdtm-Add-MAP_HUGETLB-mappings-test-for-parent-child-.patch -Patch134: 0134-ci-skip-MAP_HUGETLB-tests-in-stream-test.patch -Patch135: 0135-bpfmap-handle-new-field-in-fdinfo.patch -Patch136: 0136-test-remove-test-for-LOCK_MAND-flock.patch -Patch137: 0137-test-disable-rseq-also-on-Archlinux.patch -Patch138: 0138-zdtm-fix-missplacement-of-err-True.patch -Patch139: 0139-compel-set-mxcsr-during-error-injection-to-zero.patch -Patch140: 0140-proc_smaps-remove-useless-nonlinear-check.patch -Patch141: 0141-mount-fix-e_str-leak-in-ext_mount_add.patch -Patch142: 0142-cr-dump-fix-cr_imgset-leak-in-dump_one_task.patch -Patch143: 0143-tun-fix-tun_link-leak-in-dump_tun_link.patch -Patch144: 0144-sk-unix-fix-uint32_t-id-variable-printf-format-speci.patch -Patch145: 0145-zdtm-refactor-main.patch -Patch146: 0146-zdtm-sort-import-lines.patch -Patch147: 0147-zdtm-use-long-form-cli-options.patch -Patch148: 0148-zdtm-add-criu-config-option.patch -Patch149: 0149-zdtm-drop-redundant-config_inotify_irmap-test.patch -Patch150: 0150-ci-run-criu-config-tests.patch -Patch151: 0151-config-fix-ns-leak-in-parse_join_ns.patch -Patch152: 0152-net-fix-e_str-leak-in-veth_pair_add.patch -Patch153: 0153-files-fix-inh-leak-in-inherit_fd_add.patch -Patch154: 0154-sk-unix-fix-e_str-leak-in-unix_sk_id_add.patch -Patch155: 0155-uffd-fix-__u64-print-format-specifier.patch -Patch156: 0156-zdtm-fix-mnt_ext_master-test-to-correspond-to-it-s-n.patch -Patch157: 0157-mount-add-mntinfo_add_list_before-helper-for-adding-.patch -Patch158: 0158-mount-do-not-detect-non-fsroot-mounts-as-device-exte.patch -Patch159: 0159-mount-mark-mounts-of-external-devices-external.patch -Patch160: 0160-mount-skip-fstype-and-source-checks-for-external-mou.patch -Patch161: 0161-mount-setup-mnt_bind-list-before-using-it-in-mnt_is_.patch -Patch162: 0162-util-add-get_relative_path-helper.patch -Patch163: 0163-unittest-add-some-tests-for-get_relative_path-helper.patch -Patch164: 0164-mount-add-mnt_bind_pick-helper-to-pick-the-desired-b.patch -Patch165: 0165-mount-split-mnt_is_external-_bind-and-can_receive_ma.patch -Patch166: 0166-mount-rework-skipping-external-mounts-in-dump_one_mo.patch -Patch167: 0167-mount-show-more-info-about-why-we-can-t-mount.patch -Patch168: 0168-mount-mount-external-mount-before-mounting-it-s-bind.patch -Patch169: 0169-zdtm-add-new-mnt_ext_root-test.patch -Patch170: 0170-mount-restrict-mp-external-mount-map-to-init-contain.patch -Patch171: 0171-zdtm-add-mnt_ext_collision-test.patch -Patch172: 0172-mount-add-mnt_is_root_bind-helper.patch -Patch173: 0173-mount-allow-nested-mount-namespaces-with-different-r.patch -Patch174: 0174-zdtm-add-mntns_pivot_root-test.patch -Patch175: 0175-mount-apply-superblock-flags-to-nested-ns-roots.patch -Patch176: 0176-zdtm-add-mntns_pivot_root_ro-test.patch -Patch177: 0177-mount-restore-create-auxiliary-binfmt_misc-mount-in-.patch -Patch178: 0178-mount-restore-leave-ns_mountpoint-NULL-for-aux-binfm.patch -Patch179: 0179-mount-replace-CRTIME_MNT_ID-with-HELPER_MNT_ID.patch -Patch180: 0180-mount-add-can_receive_master_from_root-helper.patch -Patch181: 0181-mount-put-external-slavery-mounts-to-separate-mnt_ex.patch -Patch182: 0182-mount-do-not-override-master_id-to-1-for-root-binds.patch -Patch183: 0183-mount-add-helper-mnt_get_external_bind_nodev.patch -Patch184: 0184-mount-prepare-is_overmounted-as-early-as-possible.patch -Patch185: 0185-mount-move-root-yard-tree-merge-as-early-as-possible.patch -Patch186: 0186-mount-fix-broken-remounted_rw-check.patch -Patch187: 0187-mount-make-general-place-for-shared-variables-on-mou.patch -Patch188: 0188-autofs-use-ns_mountpoint-in-autofs_create_dentries.patch -Patch189: 0189-mount-use-ns_mountpoint-in-mnt_is_overmounted.patch -Patch190: 0190-mount-skip-root-yard-children-from-mnt_needs_remap-c.patch -Patch191: 0191-mount-use-ns_mountpoint-in-validate_children_collisi.patch -Patch192: 0192-mount-use-ns_mountpoint-in-root_path_from_parent.patch -Patch193: 0193-mount-use-ns_mountpoint-for-children-overmount-check.patch -Patch194: 0194-path-simplify-mnt_get_sibling_path-via-get_relative_.patch -Patch195: 0195-mount-use-ns_mountpoint-in-collect_mntinfo.patch -Patch196: 0196-mount-use-ns_mountpoint-in-aufs_parse.patch -Patch197: 0197-mount-use-ns_mountpoint-in-mnt_depth.patch -Patch198: 0198-mount-use-ns_mountpoint-instead-of-mountpoint-where-.patch -Patch199: 0199-mount-add-service_mountpoint-getter-for-mountpoint.patch -Patch200: 0200-files-reg-split-create_ghost_dentry-out-of-create_gh.patch -Patch201: 0201-files-reg-teach-create_ghost-to-work-with-mount-v2.patch -Patch202: 0202-files-reg-teach-clean_one_remap-to-work-with-mount-v.patch -Patch203: 0203-kerndat-Check-for-MOVE_MOUNT_SET_GROUP-availability.patch -Patch204: 0204-compel-add-open_tree-syscall.patch -Patch205: 0205-kerndat-check-whether-the-openat2-syscall-is-support.patch -Patch206: 0206-util-add-resolve_mountpoint-helper.patch -Patch207: 0207-crtools-move-check_options-after-kerndat_init-and-lo.patch -Patch208: 0208-config-rpc-add-new-option-mntns-compat-mode-for-old-.patch -Patch209: 0209-mount-add-plain-mountpoints.patch -Patch210: 0210-files-reg-export-parent-dirs-helpers-for-mount-v2.patch -Patch211: 0211-mount-remove-double-ns_id-declaration.patch -Patch212: 0212-mount-export-common-defines-for-mount-v2.patch -Patch213: 0213-mount-export-several-functions-for-mount-v2.patch -Patch214: 0214-mount-export-global-variables-for-mount-v2.patch -Patch215: 0215-mount-add-new-mounts-v2-engine.patch -Patch216: 0216-zdtm-enable-mounts-compat-mode-on-restore-with-mntns.patch -Patch217: 0217-ci-run-tests-for-old-mount-engine.patch -Patch218: 0218-zdtm-add-new-mnt_ext_sharing-test-for-mount-v2.patch -Patch219: 0219-zdtm-add-mount_complex_sharing-test.patch -Patch220: 0220-zdtm-add-propagation-group-with-mount-flags-to-mount.patch -Patch221: 0221-zdtm-mount-v2-disable-mnt_tracefs-test.patch -Patch222: 0222-ci-make-others-mnt_ext_dev-also-run-for-old-mount-en.patch -Patch223: 0223-test-jenkins-test-for-old-mount-engine.patch -Patch224: 0224-zdtm-mount-v2-disable-pty-console-test.patch -Patch225: 0225-mount-v2-make-mount-engine-fallback-messages-logleve.patch -Patch226: 0226-mount-make-error-messages-differ-in-different-places.patch -Patch227: 0227-zdtm-use-unique-holder-for-cgroups.patch -Patch228: 0228-scripts-ci-mount-test-cgroups-once.patch -Patch229: 0229-criu-ns-add-a-helper-to-hold-a-pid-namespace.patch -Patch230: 0230-apparmor-Fix-Wfortify-source-for-Clang.patch -Patch231: 0231-style-delete-some-redundant-code.patch -Patch232: 0232-mount-fix-Wunused-but-set-variable-for-Clang-15.patch -Patch233: 0233-criu-generate-unique-socket-names.patch -Patch234: 0234-ci-Ubuntu-broke-overlayfs-again.patch -Patch235: 0235-compel-add-rseq-syscall-into-compel-std-plugin-sysca.patch -Patch236: 0236-kerndat-check-for-rseq-syscall-support.patch -Patch237: 0237-util-move-fork_and_ptrace_attach-helper-from-cr-chec.patch -Patch238: 0238-cr-check-Add-ptrace-rseq-conf-dump-feature.patch -Patch239: 0239-rseq-initial-support.patch +Patch2: 0002-tcp-Skip-restoring-TCP-state-when-dumping-with-tcp-c.patch +Patch3: 0003-zdtm-Dumping-restoring-with-tcp-close-on-TCP_CLOSE-s.patch +Patch4: 0004-criu-8-Add-more-detailed-description-about-tcp-close.patch +Patch5: 0005-Add-support-for-python3-in-criu-coredump.patch +Patch6: 0006-Add-new-files-for-running-criu-coredump-via-python-2.patch +Patch7: 0007-coredump-remove-unused-import.patch +Patch8: 0008-coredump-sort-imports.patch +Patch9: 0009-coredump-convert-indentation-to-spaces.patch +Patch10: 0010-python-replace-equality-with-identity-test.patch +Patch11: 0011-coredump-drop-unused-variable.patch +Patch12: 0012-coredump-drop-exec-permission.patch +Patch13: 0013-coredump-lint-fix-for-block-comments.patch +Patch14: 0014-coredump-fix-missing-whitespace-around-operator.patch +Patch15: 0015-coredump-fix-too-many-blank-lines.patch +Patch16: 0016-coredump-fix-comparison-to-true.patch +Patch17: 0017-coredump-lint-fix-visually-indented-line.patch +Patch18: 0018-test-coredump-fix-shellcheck-errors.patch +Patch19: 0019-make-enable-lint-for-coredump.patch +Patch20: 0020-ci-enable-coredump-tests.patch +Patch21: 0021-pie-restorer-remove-excess-hash-printf-specifier.patch +Patch22: 0022-tty-fix-the-null-pointer-of-get_tty_driver.patch +Patch23: 0023-util-use-nftw-in-rmrf-helper.patch +Patch24: 0024-criu-ns-make-pidns-init-first-do-setsid.patch +Patch25: 0025-net-optimize-restore_rule-to-not-open-the-CR_FD_RULE.patch +Patch26: 0026-ci-replace-deprecated-codecov-bash-uploader.patch +Patch27: 0027-ci-fix-userfaultfd-test-failures.patch +Patch28: 0028-ci-use-Fedora-34-for-lint-CI-runs.patch +Patch29: 0029-tests-improve-the-image-streamer-process-control.patch +Patch30: 0030-sockets-don-t-call-sk_setbufs-asyncronously.patch +Patch31: 0031-kerndat-check-for-set-getsockopt-SO_BUF_LOCK-availab.patch +Patch32: 0032-sockets-c-r-bufer-size-locks.patch +Patch33: 0033-zdtm-add-test-for-socket-buffer-size-locks.patch +Patch34: 0034-zdtm-make-sock_opts02-also-check-lock-change-by-SO_-.patch +Patch35: 0035-clang-format-enable-AlignTrailingComments.patch +Patch36: 0036-clang-format-do-several-manual-comment-fixups.patch +Patch37: 0037-clang-format-do-automatic-comment-fixups.patch +Patch38: 0038-cr-dump-fail-dumping-when-zombie-process-with-sid-0.patch +Patch39: 0039-clang-format-make-x86_ins_capability_mask-human-read.patch +Patch40: 0040-ci-disable-socket-raw-test-on-centos8.patch +Patch41: 0041-zdtm.py-make-tests-with-link_remap-exclusive.patch +Patch42: 0042-tests-improve-the-deterministic-behavior-of-the-test.patch +Patch43: 0043-clang-format-zdtm-fix-clang-complains-about-strange-.patch +Patch44: 0044-seize-restore-cgroup-freezer-to-right-state.patch +Patch45: 0045-ci-Use-latest-Fedora-for-lint-ci-runs-again.patch +Patch46: 0046-crtools-ignore-SIGPIPE-in-swrk-mode.patch +Patch47: 0047-ci-switch-to-centos-stream-8.patch +Patch48: 0048-check-cleanup-child-processes.patch +Patch49: 0049-files-reg-fix-error-handling-in-open_path.patch +Patch50: 0050-files-reg-fix-error-handling-of-rm_parent_dirs.patch +Patch51: 0051-ghost-mount-allocate-remounted_rw-in-shmem-to-get-in.patch +Patch52: 0052-files-reg-temporary-remount-writable-the-mount-we-do.patch +Patch53: 0053-zdtm-add-ro-mount-check-after-c-r-to-mntns_ghost01.patch +Patch54: 0054-clang-format-disable-wrong-struct-pointer-declaratio.patch +Patch55: 0055-ci-Run-cross-compile-on-debian-stable.patch +Patch56: 0056-ci-Run-cross-compile-with-debian-testing.patch +Patch57: 0057-make-Explicitly-enable-FPU-on-ARMv7-builds.patch +Patch58: 0058-ci-disable-broken-tests-until-fixed.patch +Patch59: 0059-test-do-not-use-keep-going-for-single-zdtm-tests.patch +Patch60: 0060-files-reg-try-dump_ghost_remap-if-link-remap-failed-.patch +Patch61: 0061-util-make-page-server-IPv6-safe.patch +Patch62: 0062-sk-unix-Fix-TCP_ESTABLISHED-checks-in-unix-sockets.patch +Patch63: 0063-ci-Enable-disabled-unix-socket-related-tests.patch +Patch64: 0064-ci-install-procps-in-Alpine.patch +Patch65: 0065-test-another-try-to-correctly-fix-the-kernel-version.patch +Patch66: 0066-x86-compel-fault-inject-bound-xsave-features-set.patch +Patch67: 0067-x86-compel-fault-inject-print-the-initial-seed.patch +Patch68: 0068-ci-enable-x86-xsave-fault-injection-tests-back.patch +Patch69: 0069-Add-documentation-for-timeout-option.patch +Patch70: 0070-usernsd-UNS_FDOUT-should-not-require-an-input-descri.patch +Patch71: 0071-libcriu-add-setting-lsm-mount-context-to-libcriu.patch +Patch72: 0072-ci-use-unstable-release-for-cross-compile.patch +Patch73: 0073-ci-disable-glibc-rseq-support.patch +Patch74: 0074-libcriu-add-single-pre-dump-support.patch +Patch75: 0075-tests-added-test-for-single-pre-dump-support.patch +Patch76: 0076-zdtm.py-clean-up-MAKEFLAGS-env-variable-before-runni.patch +Patch77: 0077-zdtm-zdtm_ct-fix-compilation-error-with-strict-proto.patch +Patch78: 0078-zdtm-remove-mntns-deleted-dst-test-leftover-from-git.patch +Patch79: 0079-crtools-remove-excess-always-true-condition.patch +Patch80: 0080-crtools-rpc-export-current-criu-mode-to-opts.mode.patch +Patch81: 0081-crtools-use-new-opts.mode-in-image_dir_mode.patch +Patch82: 0082-crtools-check-that-cpuinfo-command-has-sub-command.patch +Patch83: 0083-sk-unix-Add-support-for-SOCK_SEQPACKET-unix-sockets.patch +Patch84: 0084-zdtm-Add-SOCK_SEQPACKET-variants-to-unix-socket-test.patch +Patch85: 0085-tls-fix-typo.patch +Patch86: 0086-tls-use-ssize_t-for-return-value.patch +Patch87: 0087-tls-add-more-comments.patch +Patch88: 0088-uffd-call-disconnect_from_page_server-to-shutdown-a-.patch +Patch89: 0089-tls-allow-to-terminate-connections-synchronously.patch +Patch90: 0090-page-xfer-stop-waiting-for-a-new-command-after-a-clo.patch +Patch91: 0091-ci-reenable-the-lazy-thp-test-in-the-lazy-remote-mod.patch +Patch92: 0092-test-log-testname.out.inprogress-if-a-test-has-faile.patch +Patch93: 0093-zdtm-print-tails-of-all-logs-if-a-test-has-failed.patch +Patch94: 0094-zdtm-static-uffd-events-add-more-log-messages.patch +Patch95: 0095-mount-split-check_mountpoint_fd-from-__open_mountpoi.patch +Patch96: 0096-mount-remove-mnt_fd-argument-of-__open_mountpoint.patch +Patch97: 0097-proc_parse-add-helper-to-resolve-sdev-from-fd.patch +Patch98: 0098-mount-btrfs-make-check_mountpoint_fd-fallback-to-get.patch +Patch99: 0099-ci-test-criu-image-streamer-with-all-tests.patch +Patch100: 0100-readme-add-docker-test-badge.patch +Patch101: 0101-contributing-remove-old-badges-and-logo.patch +Patch102: 0102-ci-update-to-latest-Vagrant-and-Fedora-images.patch +Patch103: 0103-ci-added-.lgtm.yml-file.patch +Patch104: 0104-lib-introduce-feature-check-in-libcriu.patch +Patch105: 0105-lib-added-tests-for-feature-check-in-libcriu.patch +Patch106: 0106-pagemap-tiny-fix-on-truncating-memory-image.patch +Patch107: 0107-zdtm-fix-zdtm-static-maps00-case-in-arm64.patch +Patch108: 0108-compel-fix-GCC-12-failure-out-of-bounds.patch +Patch109: 0109-criu-fix-configuration-file-scanner-with-GCC-12.patch +Patch110: 0110-compel-fix-parasite-with-GCC-12.patch +Patch111: 0111-ci-set-continue-on-error-for-cross-compile.patch +Patch112: 0112-test-autofs-fix-use-after-free.patch +Patch113: 0113-Fix-formatting-in-criu-documentation.patch +Patch114: 0114-ci-install-libbsd-dependency.patch +Patch115: 0115-pstree-when-updating-sid-for-shell-job-also-update-m.patch +Patch116: 0116-criu-ns-fix-exit-code-o-for-criu-dump.patch +Patch117: 0117-criu-ns-use-os.waitstatus_to_exitcode.patch +Patch118: 0118-restorer-Fix-sys_mmap-s-returned-value-check.patch +Patch119: 0119-compel-fix-how-PTRACE_GET_THREAD_AREA-errors-are-han.patch +Patch120: 0120-util-add-an-unique-ID-of-the-current-criu-run.patch +Patch121: 0121-files-generate-unique-transport-socket-names.patch +Patch122: 0122-check-Add-a-check-for-using-memfd-with-hugetlb.patch +Patch123: 0123-kerndat-Collect-hugetlb-device-numbers.patch +Patch124: 0124-ipc-Add-support-for-checkpoint-restore-hugetlb-Syste.patch +Patch125: 0125-memfd-shmem-Add-support-for-checkpoint-restore-memfd.patch +Patch126: 0126-proc_parse-files-Add-support-for-hugetlb-memory-mapp.patch +Patch127: 0127-mem-Skip-premapping-hugetlb-mapping.patch +Patch128: 0128-uffd-Skip-lazy-mode-restore-on-hugetlb-mappings.patch +Patch129: 0129-zdtm-Add-MAP_HUGETLB-memory-mapping-test.patch +Patch130: 0130-zdtm-Add-memfd-hugetlb-test.patch +Patch131: 0131-zdtm-Add-shm-hugetlb-test.patch +Patch132: 0132-zdtm-Add-MAP_HUGETLB-mappings-test-for-parent-child-.patch +Patch133: 0133-ci-skip-MAP_HUGETLB-tests-in-stream-test.patch +Patch134: 0134-bpfmap-handle-new-field-in-fdinfo.patch +Patch135: 0135-test-remove-test-for-LOCK_MAND-flock.patch +Patch136: 0136-test-disable-rseq-also-on-Archlinux.patch +Patch137: 0137-zdtm-fix-missplacement-of-err-True.patch +Patch138: 0138-compel-set-mxcsr-during-error-injection-to-zero.patch +Patch139: 0139-proc_smaps-remove-useless-nonlinear-check.patch +Patch140: 0140-mount-fix-e_str-leak-in-ext_mount_add.patch +Patch141: 0141-cr-dump-fix-cr_imgset-leak-in-dump_one_task.patch +Patch142: 0142-tun-fix-tun_link-leak-in-dump_tun_link.patch +Patch143: 0143-sk-unix-fix-uint32_t-id-variable-printf-format-speci.patch +Patch144: 0144-zdtm-refactor-main.patch +Patch145: 0145-zdtm-sort-import-lines.patch +Patch146: 0146-zdtm-use-long-form-cli-options.patch +Patch147: 0147-zdtm-add-criu-config-option.patch +Patch148: 0148-zdtm-drop-redundant-config_inotify_irmap-test.patch +Patch149: 0149-ci-run-criu-config-tests.patch +Patch150: 0150-config-fix-ns-leak-in-parse_join_ns.patch +Patch151: 0151-net-fix-e_str-leak-in-veth_pair_add.patch +Patch152: 0152-files-fix-inh-leak-in-inherit_fd_add.patch +Patch153: 0153-sk-unix-fix-e_str-leak-in-unix_sk_id_add.patch +Patch154: 0154-uffd-fix-__u64-print-format-specifier.patch +Patch155: 0155-zdtm-fix-mnt_ext_master-test-to-correspond-to-it-s-n.patch +Patch156: 0156-mount-add-mntinfo_add_list_before-helper-for-adding-.patch +Patch157: 0157-mount-do-not-detect-non-fsroot-mounts-as-device-exte.patch +Patch158: 0158-mount-mark-mounts-of-external-devices-external.patch +Patch159: 0159-mount-skip-fstype-and-source-checks-for-external-mou.patch +Patch160: 0160-mount-setup-mnt_bind-list-before-using-it-in-mnt_is_.patch +Patch161: 0161-util-add-get_relative_path-helper.patch +Patch162: 0162-unittest-add-some-tests-for-get_relative_path-helper.patch +Patch163: 0163-mount-add-mnt_bind_pick-helper-to-pick-the-desired-b.patch +Patch164: 0164-mount-split-mnt_is_external-_bind-and-can_receive_ma.patch +Patch165: 0165-mount-rework-skipping-external-mounts-in-dump_one_mo.patch +Patch166: 0166-mount-show-more-info-about-why-we-can-t-mount.patch +Patch167: 0167-mount-mount-external-mount-before-mounting-it-s-bind.patch +Patch168: 0168-zdtm-add-new-mnt_ext_root-test.patch +Patch169: 0169-mount-restrict-mp-external-mount-map-to-init-contain.patch +Patch170: 0170-zdtm-add-mnt_ext_collision-test.patch +Patch171: 0171-mount-add-mnt_is_root_bind-helper.patch +Patch172: 0172-mount-allow-nested-mount-namespaces-with-different-r.patch +Patch173: 0173-zdtm-add-mntns_pivot_root-test.patch +Patch174: 0174-mount-apply-superblock-flags-to-nested-ns-roots.patch +Patch175: 0175-zdtm-add-mntns_pivot_root_ro-test.patch +Patch176: 0176-mount-restore-create-auxiliary-binfmt_misc-mount-in-.patch +Patch177: 0177-mount-restore-leave-ns_mountpoint-NULL-for-aux-binfm.patch +Patch178: 0178-mount-replace-CRTIME_MNT_ID-with-HELPER_MNT_ID.patch +Patch179: 0179-mount-add-can_receive_master_from_root-helper.patch +Patch180: 0180-mount-put-external-slavery-mounts-to-separate-mnt_ex.patch +Patch181: 0181-mount-do-not-override-master_id-to-1-for-root-binds.patch +Patch182: 0182-mount-add-helper-mnt_get_external_bind_nodev.patch +Patch183: 0183-mount-prepare-is_overmounted-as-early-as-possible.patch +Patch184: 0184-mount-move-root-yard-tree-merge-as-early-as-possible.patch +Patch185: 0185-mount-fix-broken-remounted_rw-check.patch +Patch186: 0186-mount-make-general-place-for-shared-variables-on-mou.patch +Patch187: 0187-autofs-use-ns_mountpoint-in-autofs_create_dentries.patch +Patch188: 0188-mount-use-ns_mountpoint-in-mnt_is_overmounted.patch +Patch189: 0189-mount-skip-root-yard-children-from-mnt_needs_remap-c.patch +Patch190: 0190-mount-use-ns_mountpoint-in-validate_children_collisi.patch +Patch191: 0191-mount-use-ns_mountpoint-in-root_path_from_parent.patch +Patch192: 0192-mount-use-ns_mountpoint-for-children-overmount-check.patch +Patch193: 0193-path-simplify-mnt_get_sibling_path-via-get_relative_.patch +Patch194: 0194-mount-use-ns_mountpoint-in-collect_mntinfo.patch +Patch195: 0195-mount-use-ns_mountpoint-in-aufs_parse.patch +Patch196: 0196-mount-use-ns_mountpoint-in-mnt_depth.patch +Patch197: 0197-mount-use-ns_mountpoint-instead-of-mountpoint-where-.patch +Patch198: 0198-mount-add-service_mountpoint-getter-for-mountpoint.patch +Patch199: 0199-files-reg-split-create_ghost_dentry-out-of-create_gh.patch +Patch200: 0200-files-reg-teach-create_ghost-to-work-with-mount-v2.patch +Patch201: 0201-files-reg-teach-clean_one_remap-to-work-with-mount-v.patch +Patch202: 0202-kerndat-Check-for-MOVE_MOUNT_SET_GROUP-availability.patch +Patch203: 0203-compel-add-open_tree-syscall.patch +Patch204: 0204-kerndat-check-whether-the-openat2-syscall-is-support.patch +Patch205: 0205-util-add-resolve_mountpoint-helper.patch +Patch206: 0206-crtools-move-check_options-after-kerndat_init-and-lo.patch +Patch207: 0207-config-rpc-add-new-option-mntns-compat-mode-for-old-.patch +Patch208: 0208-mount-add-plain-mountpoints.patch +Patch209: 0209-files-reg-export-parent-dirs-helpers-for-mount-v2.patch +Patch210: 0210-mount-remove-double-ns_id-declaration.patch +Patch211: 0211-mount-export-common-defines-for-mount-v2.patch +Patch212: 0212-mount-export-several-functions-for-mount-v2.patch +Patch213: 0213-mount-export-global-variables-for-mount-v2.patch +Patch214: 0214-mount-add-new-mounts-v2-engine.patch +Patch215: 0215-zdtm-enable-mounts-compat-mode-on-restore-with-mntns.patch +Patch216: 0216-ci-run-tests-for-old-mount-engine.patch +Patch217: 0217-zdtm-add-new-mnt_ext_sharing-test-for-mount-v2.patch +Patch218: 0218-zdtm-add-mount_complex_sharing-test.patch +Patch219: 0219-zdtm-add-propagation-group-with-mount-flags-to-mount.patch +Patch220: 0220-zdtm-mount-v2-disable-mnt_tracefs-test.patch +Patch221: 0221-ci-make-others-mnt_ext_dev-also-run-for-old-mount-en.patch +Patch222: 0222-test-jenkins-test-for-old-mount-engine.patch +Patch223: 0223-zdtm-mount-v2-disable-pty-console-test.patch +Patch224: 0224-mount-v2-make-mount-engine-fallback-messages-logleve.patch +Patch225: 0225-mount-make-error-messages-differ-in-different-places.patch +Patch226: 0226-zdtm-use-unique-holder-for-cgroups.patch +Patch227: 0227-scripts-ci-mount-test-cgroups-once.patch +Patch228: 0228-criu-ns-add-a-helper-to-hold-a-pid-namespace.patch +Patch229: 0229-apparmor-Fix-Wfortify-source-for-Clang.patch +Patch230: 0230-style-delete-some-redundant-code.patch +Patch231: 0231-mount-fix-Wunused-but-set-variable-for-Clang-15.patch +Patch232: 0232-compel-add-rseq-syscall-into-compel-std-plugin-sysca.patch +Patch233: 0233-kerndat-check-for-rseq-syscall-support.patch +Patch234: 0234-util-move-fork_and_ptrace_attach-helper-from-cr-chec.patch +Patch235: 0235-cr-check-Add-ptrace-rseq-conf-dump-feature.patch +Patch236: 0236-rseq-initial-support.patch +Patch237: 0237-zdtm-add-basic-static-rseq00-test-for-rseq-C-R.patch +Patch238: 0238-Revert-ci-disable-glibc-rseq-support.patch +Patch239: 0239-ci-add-Fedora-Rawhide-based-test-on-Cirrus.patch Patch240: 0240-include-add-thread_pointer.h-from-Glibc.patch Patch241: 0241-clone-noasan-unregister-rseq-at-the-thread-start-for.patch -Patch242: 0242-compel-add-helpers-to-get-set-instruction-pointer.patch -Patch243: 0243-cr-dump-fixup-thread-IP-when-inside-rseq-cs.patch -Patch244: 0244-cr-dump-handle-rseq-flags-field.patch -Patch245: 0245-fixup.patch +Patch242: 0242-zdtm-static-rseq00-fix-rseq-test-when-linking-with-a.patch +Patch243: 0243-compel-add-helpers-to-get-set-instruction-pointer.patch +Patch244: 0244-cr-dump-fixup-thread-IP-when-inside-rseq-cs.patch +Patch245: 0245-zdtm-add-transition-rseq01-test-for-amd64.patch +Patch246: 0246-Revert-test-disable-rseq-also-on-Archlinux.patch +Patch247: 0247-cr-dump-handle-rseq-flags-field.patch +Patch248: 0248-zdtm-add-rseq02-transition-test-with-NO_RESTART-CS-f.patch +Patch249: 0249-zdtm-temporary-disable-rseq02-test.patch # Add protobuf-c as a dependency. # We use this patch because the protobuf-c package name @@ -613,6 +617,10 @@ This script can help to workaround the so called "PID mismatch" problem. %patch243 -p1 %patch244 -p1 %patch245 -p1 +%patch246 -p1 +%patch247 -p1 +%patch248 -p1 +%patch249 -p1 %patch299 -p1 @@ -701,6 +709,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %doc %{_mandir}/man1/criu-ns.1* %changelog +* Tue Apr 5 2022 Radostin Stoyanov - 3.16.1-11 +- Update rseq patches + * Tue Apr 5 2022 Radostin Stoyanov - 3.16.1-10 - Update fixup patch From 3b7bdc24e41a3382b59f34f84e8502449000dd81 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Tue, 5 Apr 2022 21:33:02 +0100 Subject: [PATCH 044/109] Update rseq patches Signed-off-by: Radostin Stoyanov --- 0001-criu-8-add-external-net-option.patch | 2 +- ...ng-TCP-state-when-dumping-with-tcp-c.patch | 2 +- ...toring-with-tcp-close-on-TCP_CLOSE-s.patch | 2 +- ...detailed-description-about-tcp-close.patch | 2 +- ...support-for-python3-in-criu-coredump.patch | 2 +- ...r-running-criu-coredump-via-python-2.patch | 2 +- 0007-coredump-remove-unused-import.patch | 2 +- 0008-coredump-sort-imports.patch | 2 +- ...redump-convert-indentation-to-spaces.patch | 2 +- ...-replace-equality-with-identity-test.patch | 2 +- 0011-coredump-drop-unused-variable.patch | 2 +- 0012-coredump-drop-exec-permission.patch | 2 +- ...coredump-lint-fix-for-block-comments.patch | 2 +- ...x-missing-whitespace-around-operator.patch | 2 +- 0015-coredump-fix-too-many-blank-lines.patch | 2 +- 0016-coredump-fix-comparison-to-true.patch | 2 +- ...dump-lint-fix-visually-indented-line.patch | 2 +- ...-test-coredump-fix-shellcheck-errors.patch | 2 +- 0019-make-enable-lint-for-coredump.patch | 2 +- 0020-ci-enable-coredump-tests.patch | 2 +- ...-remove-excess-hash-printf-specifier.patch | 2 +- ...x-the-null-pointer-of-get_tty_driver.patch | 2 +- 0023-util-use-nftw-in-rmrf-helper.patch | 2 +- ...u-ns-make-pidns-init-first-do-setsid.patch | 2 +- ...tore_rule-to-not-open-the-CR_FD_RULE.patch | 2 +- ...ace-deprecated-codecov-bash-uploader.patch | 2 +- 0027-ci-fix-userfaultfd-test-failures.patch | 2 +- 0028-ci-use-Fedora-34-for-lint-CI-runs.patch | 2 +- ...e-the-image-streamer-process-control.patch | 2 +- ...-don-t-call-sk_setbufs-asyncronously.patch | 2 +- ...r-set-getsockopt-SO_BUF_LOCK-availab.patch | 2 +- 0032-sockets-c-r-bufer-size-locks.patch | 2 +- ...dd-test-for-socket-buffer-size-locks.patch | 2 +- ...pts02-also-check-lock-change-by-SO_-.patch | 2 +- ...-format-enable-AlignTrailingComments.patch | 2 +- ...mat-do-several-manual-comment-fixups.patch | 2 +- ...g-format-do-automatic-comment-fixups.patch | 2 +- ...mping-when-zombie-process-with-sid-0.patch | 2 +- ...e-x86_ins_capability_mask-human-read.patch | 2 +- ...i-disable-socket-raw-test-on-centos8.patch | 2 +- ...make-tests-with-link_remap-exclusive.patch | 2 +- ...e-deterministic-behavior-of-the-test.patch | 2 +- ...m-fix-clang-complains-about-strange-.patch | 2 +- ...estore-cgroup-freezer-to-right-state.patch | 2 +- ...latest-Fedora-for-lint-ci-runs-again.patch | 2 +- ...-crtools-ignore-SIGPIPE-in-swrk-mode.patch | 2 +- 0047-ci-switch-to-centos-stream-8.patch | 2 +- 0048-check-cleanup-child-processes.patch | 2 +- ...-reg-fix-error-handling-in-open_path.patch | 2 +- ...fix-error-handling-of-rm_parent_dirs.patch | 2 +- ...cate-remounted_rw-in-shmem-to-get-in.patch | 2 +- ...ary-remount-writable-the-mount-we-do.patch | 2 +- ...unt-check-after-c-r-to-mntns_ghost01.patch | 2 +- ...able-wrong-struct-pointer-declaratio.patch | 2 +- ...i-Run-cross-compile-on-debian-stable.patch | 2 +- ...un-cross-compile-with-debian-testing.patch | 2 +- ...xplicitly-enable-FPU-on-ARMv7-builds.patch | 2 +- ...-ci-disable-broken-tests-until-fixed.patch | 2 +- ...use-keep-going-for-single-zdtm-tests.patch | 2 +- ...mp_ghost_remap-if-link-remap-failed-.patch | 2 +- 0061-util-make-page-server-IPv6-safe.patch | 2 +- ...P_ESTABLISHED-checks-in-unix-sockets.patch | 2 +- ...e-disabled-unix-socket-related-tests.patch | 2 +- 0064-ci-install-procps-in-Alpine.patch | 2 +- ...-to-correctly-fix-the-kernel-version.patch | 2 +- ...ault-inject-bound-xsave-features-set.patch | 2 +- ...-fault-inject-print-the-initial-seed.patch | 2 +- ...x86-xsave-fault-injection-tests-back.patch | 2 +- ...Add-documentation-for-timeout-option.patch | 2 +- ...T-should-not-require-an-input-descri.patch | 2 +- ...setting-lsm-mount-context-to-libcriu.patch | 2 +- ...e-unstable-release-for-cross-compile.patch | 2 +- 0073-ci-disable-glibc-rseq-support.patch | 2 +- ...-libcriu-add-single-pre-dump-support.patch | 2 +- ...ded-test-for-single-pre-dump-support.patch | 2 +- ...-MAKEFLAGS-env-variable-before-runni.patch | 2 +- ...-compilation-error-with-strict-proto.patch | 2 +- ...s-deleted-dst-test-leftover-from-git.patch | 2 +- ...-remove-excess-always-true-condition.patch | 2 +- ...xport-current-criu-mode-to-opts.mode.patch | 2 +- ...-use-new-opts.mode-in-image_dir_mode.patch | 2 +- ...that-cpuinfo-command-has-sub-command.patch | 2 +- ...port-for-SOCK_SEQPACKET-unix-sockets.patch | 2 +- ...QPACKET-variants-to-unix-socket-test.patch | 2 +- 0085-tls-fix-typo.patch | 2 +- 0086-tls-use-ssize_t-for-return-value.patch | 2 +- 0087-tls-add-more-comments.patch | 2 +- ...nect_from_page_server-to-shutdown-a-.patch | 2 +- ...-terminate-connections-synchronously.patch | 2 +- ...aiting-for-a-new-command-after-a-clo.patch | 2 +- ...lazy-thp-test-in-the-lazy-remote-mod.patch | 2 +- ...e.out.inprogress-if-a-test-has-faile.patch | 2 +- ...ils-of-all-logs-if-a-test-has-failed.patch | 2 +- ...ic-uffd-events-add-more-log-messages.patch | 2 +- ...k_mountpoint_fd-from-__open_mountpoi.patch | 2 +- ...mnt_fd-argument-of-__open_mountpoint.patch | 2 +- ...e-add-helper-to-resolve-sdev-from-fd.patch | 2 +- ...-check_mountpoint_fd-fallback-to-get.patch | 2 +- ...t-criu-image-streamer-with-all-tests.patch | 2 +- 0100-readme-add-docker-test-badge.patch | 2 +- ...tributing-remove-old-badges-and-logo.patch | 2 +- ...-to-latest-Vagrant-and-Fedora-images.patch | 2 +- 0103-ci-added-.lgtm.yml-file.patch | 2 +- ...b-introduce-feature-check-in-libcriu.patch | 2 +- ...d-tests-for-feature-check-in-libcriu.patch | 2 +- ...-tiny-fix-on-truncating-memory-image.patch | 2 +- ...fix-zdtm-static-maps00-case-in-arm64.patch | 2 +- ...pel-fix-GCC-12-failure-out-of-bounds.patch | 2 +- ...nfiguration-file-scanner-with-GCC-12.patch | 2 +- 0110-compel-fix-parasite-with-GCC-12.patch | 2 +- ...-continue-on-error-for-cross-compile.patch | 2 +- 0112-test-autofs-fix-use-after-free.patch | 2 +- ...Fix-formatting-in-criu-documentation.patch | 2 +- 0114-ci-install-libbsd-dependency.patch | 2 +- ...ting-sid-for-shell-job-also-update-m.patch | 2 +- ...riu-ns-fix-exit-code-o-for-criu-dump.patch | 2 +- ...riu-ns-use-os.waitstatus_to_exitcode.patch | 2 +- ...-Fix-sys_mmap-s-returned-value-check.patch | 2 +- ...TRACE_GET_THREAD_AREA-errors-are-han.patch | 2 +- ...an-unique-ID-of-the-current-criu-run.patch | 2 +- ...nerate-unique-transport-socket-names.patch | 2 +- ...a-check-for-using-memfd-with-hugetlb.patch | 2 +- ...rndat-Collect-hugetlb-device-numbers.patch | 2 +- ...for-checkpoint-restore-hugetlb-Syste.patch | 2 +- ...support-for-checkpoint-restore-memfd.patch | 2 +- ...-Add-support-for-hugetlb-memory-mapp.patch | 2 +- ...-mem-Skip-premapping-hugetlb-mapping.patch | 2 +- ...azy-mode-restore-on-hugetlb-mappings.patch | 2 +- ...-Add-MAP_HUGETLB-memory-mapping-test.patch | 2 +- 0130-zdtm-Add-memfd-hugetlb-test.patch | 2 +- 0131-zdtm-Add-shm-hugetlb-test.patch | 2 +- ...ETLB-mappings-test-for-parent-child-.patch | 2 +- ...kip-MAP_HUGETLB-tests-in-stream-test.patch | 2 +- 0134-bpfmap-handle-new-field-in-fdinfo.patch | 2 +- ...test-remove-test-for-LOCK_MAND-flock.patch | 2 +- ...-test-disable-rseq-also-on-Archlinux.patch | 2 +- 0137-zdtm-fix-missplacement-of-err-True.patch | 2 +- ...mxcsr-during-error-injection-to-zero.patch | 2 +- ...smaps-remove-useless-nonlinear-check.patch | 2 +- ...ount-fix-e_str-leak-in-ext_mount_add.patch | 2 +- ...-fix-cr_imgset-leak-in-dump_one_task.patch | 2 +- ...n-fix-tun_link-leak-in-dump_tun_link.patch | 2 +- ...32_t-id-variable-printf-format-speci.patch | 2 +- 0144-zdtm-refactor-main.patch | 2 +- 0145-zdtm-sort-import-lines.patch | 2 +- 0146-zdtm-use-long-form-cli-options.patch | 2 +- 0147-zdtm-add-criu-config-option.patch | 2 +- ...-redundant-config_inotify_irmap-test.patch | 2 +- 0149-ci-run-criu-config-tests.patch | 2 +- ...-config-fix-ns-leak-in-parse_join_ns.patch | 2 +- ...-net-fix-e_str-leak-in-veth_pair_add.patch | 2 +- ...files-fix-inh-leak-in-inherit_fd_add.patch | 2 +- ...nix-fix-e_str-leak-in-unix_sk_id_add.patch | 2 +- ...ffd-fix-__u64-print-format-specifier.patch | 2 +- ..._master-test-to-correspond-to-it-s-n.patch | 2 +- ...o_add_list_before-helper-for-adding-.patch | 2 +- ...ect-non-fsroot-mounts-as-device-exte.patch | 2 +- ...-mounts-of-external-devices-external.patch | 2 +- ...e-and-source-checks-for-external-mou.patch | 2 +- ...bind-list-before-using-it-in-mnt_is_.patch | 2 +- 0161-util-add-get_relative_path-helper.patch | 2 +- ...e-tests-for-get_relative_path-helper.patch | 2 +- ...nd_pick-helper-to-pick-the-desired-b.patch | 2 +- ...is_external-_bind-and-can_receive_ma.patch | 2 +- ...pping-external-mounts-in-dump_one_mo.patch | 2 +- ...w-more-info-about-why-we-can-t-mount.patch | 2 +- ...rnal-mount-before-mounting-it-s-bind.patch | 2 +- 0168-zdtm-add-new-mnt_ext_root-test.patch | 2 +- ...p-external-mount-map-to-init-contain.patch | 2 +- 0170-zdtm-add-mnt_ext_collision-test.patch | 2 +- 0171-mount-add-mnt_is_root_bind-helper.patch | 2 +- ...ed-mount-namespaces-with-different-r.patch | 2 +- 0173-zdtm-add-mntns_pivot_root-test.patch | 2 +- ...-superblock-flags-to-nested-ns-roots.patch | 2 +- 0175-zdtm-add-mntns_pivot_root_ro-test.patch | 2 +- ...eate-auxiliary-binfmt_misc-mount-in-.patch | 2 +- ...ave-ns_mountpoint-NULL-for-aux-binfm.patch | 2 +- ...ace-CRTIME_MNT_ID-with-HELPER_MNT_ID.patch | 2 +- ...-can_receive_master_from_root-helper.patch | 2 +- ...al-slavery-mounts-to-separate-mnt_ex.patch | 2 +- ...erride-master_id-to-1-for-root-binds.patch | 2 +- ...d-helper-mnt_get_external_bind_nodev.patch | 2 +- ...-is_overmounted-as-early-as-possible.patch | 2 +- ...yard-tree-merge-as-early-as-possible.patch | 2 +- ...-mount-fix-broken-remounted_rw-check.patch | 2 +- ...al-place-for-shared-variables-on-mou.patch | 2 +- ...mountpoint-in-autofs_create_dentries.patch | 2 +- ...-ns_mountpoint-in-mnt_is_overmounted.patch | 2 +- ...yard-children-from-mnt_needs_remap-c.patch | 2 +- ...ntpoint-in-validate_children_collisi.patch | 2 +- ..._mountpoint-in-root_path_from_parent.patch | 2 +- ...ntpoint-for-children-overmount-check.patch | 2 +- ...t_get_sibling_path-via-get_relative_.patch | 2 +- ...use-ns_mountpoint-in-collect_mntinfo.patch | 2 +- ...ount-use-ns_mountpoint-in-aufs_parse.patch | 2 +- ...mount-use-ns_mountpoint-in-mnt_depth.patch | 2 +- ...ntpoint-instead-of-mountpoint-where-.patch | 2 +- ...ice_mountpoint-getter-for-mountpoint.patch | 2 +- ...create_ghost_dentry-out-of-create_gh.patch | 2 +- ...h-create_ghost-to-work-with-mount-v2.patch | 2 +- ...clean_one_remap-to-work-with-mount-v.patch | 2 +- ...or-MOVE_MOUNT_SET_GROUP-availability.patch | 2 +- 0203-compel-add-open_tree-syscall.patch | 2 +- ...ether-the-openat2-syscall-is-support.patch | 2 +- 0205-util-add-resolve_mountpoint-helper.patch | 2 +- ...ck_options-after-kerndat_init-and-lo.patch | 2 +- ...ew-option-mntns-compat-mode-for-old-.patch | 2 +- 0208-mount-add-plain-mountpoints.patch | 2 +- ...ort-parent-dirs-helpers-for-mount-v2.patch | 2 +- ...ount-remove-double-ns_id-declaration.patch | 2 +- ...t-export-common-defines-for-mount-v2.patch | 2 +- ...xport-several-functions-for-mount-v2.patch | 2 +- ...export-global-variables-for-mount-v2.patch | 2 +- 0214-mount-add-new-mounts-v2-engine.patch | 2 +- ...ts-compat-mode-on-restore-with-mntns.patch | 2 +- 0216-ci-run-tests-for-old-mount-engine.patch | 2 +- ...ew-mnt_ext_sharing-test-for-mount-v2.patch | 2 +- ...-zdtm-add-mount_complex_sharing-test.patch | 2 +- ...tion-group-with-mount-flags-to-mount.patch | 2 +- ...tm-mount-v2-disable-mnt_tracefs-test.patch | 2 +- ...nt_ext_dev-also-run-for-old-mount-en.patch | 2 +- ...st-jenkins-test-for-old-mount-engine.patch | 2 +- ...tm-mount-v2-disable-pty-console-test.patch | 2 +- ...unt-engine-fallback-messages-logleve.patch | 2 +- ...-messages-differ-in-different-places.patch | 2 +- 0226-zdtm-use-unique-holder-for-cgroups.patch | 2 +- 0227-scripts-ci-mount-test-cgroups-once.patch | 2 +- ...add-a-helper-to-hold-a-pid-namespace.patch | 2 +- ...parmor-Fix-Wfortify-source-for-Clang.patch | 2 +- 0230-style-delete-some-redundant-code.patch | 2 +- ...unused-but-set-variable-for-Clang-15.patch | 2 +- ...syscall-into-compel-std-plugin-sysca.patch | 2 +- ...rndat-check-for-rseq-syscall-support.patch | 2 +- ...nd_ptrace_attach-helper-from-cr-chec.patch | 2 +- ...ck-Add-ptrace-rseq-conf-dump-feature.patch | 2 +- 0236-rseq-initial-support.patch | 57 +++++++++---------- ...asic-static-rseq00-test-for-rseq-C-R.patch | 15 +++-- ...Revert-ci-disable-glibc-rseq-support.patch | 2 +- ...-Fedora-Rawhide-based-test-on-Cirrus.patch | 2 +- ...lude-add-thread_pointer.h-from-Glibc.patch | 2 +- ...egister-rseq-at-the-thread-start-for.patch | 15 ++--- ...00-fix-rseq-test-when-linking-with-a.patch | 10 ++-- ...lpers-to-get-set-instruction-pointer.patch | 2 +- ...-fixup-thread-IP-when-inside-rseq-cs.patch | 24 ++------ ...add-transition-rseq01-test-for-amd64.patch | 15 +++-- ...-test-disable-rseq-also-on-Archlinux.patch | 2 +- 0247-cr-dump-handle-rseq-flags-field.patch | 48 ++++++++-------- ...transition-test-with-NO_RESTART-CS-f.patch | 17 +++--- 0249-zdtm-temporary-disable-rseq02-test.patch | 2 +- criu.spec | 5 +- 250 files changed, 340 insertions(+), 348 deletions(-) diff --git a/0001-criu-8-add-external-net-option.patch b/0001-criu-8-add-external-net-option.patch index 19264ed..2779f41 100644 --- a/0001-criu-8-add-external-net-option.patch +++ b/0001-criu-8-add-external-net-option.patch @@ -1,4 +1,4 @@ -From 0bb7f1fc1ced67396866a913d39bc61a3bedbed5 Mon Sep 17 00:00:00 2001 +From 865ee1b856e1ad8a6ee45192e048c414417b4ee9 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Mon, 20 Sep 2021 13:50:08 +0100 Subject: [PATCH 001/249] criu(8): add --external net option diff --git a/0002-tcp-Skip-restoring-TCP-state-when-dumping-with-tcp-c.patch b/0002-tcp-Skip-restoring-TCP-state-when-dumping-with-tcp-c.patch index 62a8554..c3e6dfe 100644 --- a/0002-tcp-Skip-restoring-TCP-state-when-dumping-with-tcp-c.patch +++ b/0002-tcp-Skip-restoring-TCP-state-when-dumping-with-tcp-c.patch @@ -1,4 +1,4 @@ -From 135c3df15c4b4d968b00ced7cd88133bbdb8962a Mon Sep 17 00:00:00 2001 +From 77c65d7d668d152e660d0a3395348cd69ee0284f Mon Sep 17 00:00:00 2001 From: Bui Quang Minh Date: Thu, 12 Aug 2021 11:05:09 +0000 Subject: [PATCH 002/249] tcp: Skip restoring TCP state when dumping with diff --git a/0003-zdtm-Dumping-restoring-with-tcp-close-on-TCP_CLOSE-s.patch b/0003-zdtm-Dumping-restoring-with-tcp-close-on-TCP_CLOSE-s.patch index b01b2f5..f458f73 100644 --- a/0003-zdtm-Dumping-restoring-with-tcp-close-on-TCP_CLOSE-s.patch +++ b/0003-zdtm-Dumping-restoring-with-tcp-close-on-TCP_CLOSE-s.patch @@ -1,4 +1,4 @@ -From acaf5a96370541678c33a91489df069c55084aff Mon Sep 17 00:00:00 2001 +From 249e34007646ac4c11b0c6c594896aef2eff59e0 Mon Sep 17 00:00:00 2001 From: Bui Quang Minh Date: Mon, 20 Sep 2021 20:57:03 +0700 Subject: [PATCH 003/249] zdtm: Dumping/restoring with --tcp-close on TCP_CLOSE diff --git a/0004-criu-8-Add-more-detailed-description-about-tcp-close.patch b/0004-criu-8-Add-more-detailed-description-about-tcp-close.patch index 43d857b..26c377a 100644 --- a/0004-criu-8-Add-more-detailed-description-about-tcp-close.patch +++ b/0004-criu-8-Add-more-detailed-description-about-tcp-close.patch @@ -1,4 +1,4 @@ -From 58c3e33e8227bdf2105dcca18a57a7a8bf3ddd1a Mon Sep 17 00:00:00 2001 +From e42ff0557a30ab4ddf7dfb594de181b7ec7cdc15 Mon Sep 17 00:00:00 2001 From: Bui Quang Minh Date: Mon, 4 Oct 2021 20:38:34 +0700 Subject: [PATCH 004/249] criu(8): Add more detailed description about diff --git a/0005-Add-support-for-python3-in-criu-coredump.patch b/0005-Add-support-for-python3-in-criu-coredump.patch index 16b34a6..2625cbd 100644 --- a/0005-Add-support-for-python3-in-criu-coredump.patch +++ b/0005-Add-support-for-python3-in-criu-coredump.patch @@ -1,4 +1,4 @@ -From e37aed0ca94e88f503499ddd828241d5b16122e7 Mon Sep 17 00:00:00 2001 +From 215fa63c41d9e5595946ac085babbdd01930ca6f Mon Sep 17 00:00:00 2001 From: Andrey Vyazovtsev Date: Thu, 26 Aug 2021 22:22:33 +0300 Subject: [PATCH 005/249] Add support for python3 in criu-coredump diff --git a/0006-Add-new-files-for-running-criu-coredump-via-python-2.patch b/0006-Add-new-files-for-running-criu-coredump-via-python-2.patch index 574691e..974b216 100644 --- a/0006-Add-new-files-for-running-criu-coredump-via-python-2.patch +++ b/0006-Add-new-files-for-running-criu-coredump-via-python-2.patch @@ -1,4 +1,4 @@ -From 3a7deb046e713421ee302aac9f726aefeecf60a4 Mon Sep 17 00:00:00 2001 +From d08f284b5d5120a8e550b44901ee96b840900b7d Mon Sep 17 00:00:00 2001 From: AndreyVV-100 Date: Fri, 23 Jul 2021 12:48:03 +0300 Subject: [PATCH 006/249] Add new files for running criu-coredump via python 2 diff --git a/0007-coredump-remove-unused-import.patch b/0007-coredump-remove-unused-import.patch index ae23443..5c7ab41 100644 --- a/0007-coredump-remove-unused-import.patch +++ b/0007-coredump-remove-unused-import.patch @@ -1,4 +1,4 @@ -From 08984ba43fee2b7a872a067cfa7ed9e86059ca9d Mon Sep 17 00:00:00 2001 +From 2d4bb6601de571f5dca7cd43089979747f6acc2e Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Sun, 5 Sep 2021 21:31:12 +0100 Subject: [PATCH 007/249] coredump: remove unused import diff --git a/0008-coredump-sort-imports.patch b/0008-coredump-sort-imports.patch index a942fdb..921409f 100644 --- a/0008-coredump-sort-imports.patch +++ b/0008-coredump-sort-imports.patch @@ -1,4 +1,4 @@ -From 93c8beedcee85b7333a4b9137dad606bec5f3f66 Mon Sep 17 00:00:00 2001 +From e849a46256da1c5b8990c7875580172e35210205 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Sun, 5 Sep 2021 21:32:17 +0100 Subject: [PATCH 008/249] coredump: sort imports diff --git a/0009-coredump-convert-indentation-to-spaces.patch b/0009-coredump-convert-indentation-to-spaces.patch index 0044593..1487a99 100644 --- a/0009-coredump-convert-indentation-to-spaces.patch +++ b/0009-coredump-convert-indentation-to-spaces.patch @@ -1,4 +1,4 @@ -From e945c416d6ddba23642defa66c047102c545526b Mon Sep 17 00:00:00 2001 +From 4f99f82cb3fae3ebaf35b853d7ecbbf1a9fecd27 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Sun, 5 Sep 2021 21:34:00 +0100 Subject: [PATCH 009/249] coredump: convert indentation to spaces diff --git a/0010-python-replace-equality-with-identity-test.patch b/0010-python-replace-equality-with-identity-test.patch index f583eab..51bfc4c 100644 --- a/0010-python-replace-equality-with-identity-test.patch +++ b/0010-python-replace-equality-with-identity-test.patch @@ -1,4 +1,4 @@ -From 162e2c214bb7480f583c202cf2145c65027e4400 Mon Sep 17 00:00:00 2001 +From 6d8ba10f26a6f6d73fd0ff64a85f8803b3021a8a Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Sun, 5 Sep 2021 21:36:10 +0100 Subject: [PATCH 010/249] python: replace equality with identity test diff --git a/0011-coredump-drop-unused-variable.patch b/0011-coredump-drop-unused-variable.patch index fb34cb0..a2bd3fd 100644 --- a/0011-coredump-drop-unused-variable.patch +++ b/0011-coredump-drop-unused-variable.patch @@ -1,4 +1,4 @@ -From f9f591b867abc61b414b4bee84ac683860c89ae6 Mon Sep 17 00:00:00 2001 +From 4f14d170a2cf59a7a1ddfad6f6570e9a750eb16c Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Sun, 5 Sep 2021 21:38:06 +0100 Subject: [PATCH 011/249] coredump: drop unused variable diff --git a/0012-coredump-drop-exec-permission.patch b/0012-coredump-drop-exec-permission.patch index 029b785..6abc1ad 100644 --- a/0012-coredump-drop-exec-permission.patch +++ b/0012-coredump-drop-exec-permission.patch @@ -1,4 +1,4 @@ -From dc6d38708b54aafad660c01112a4ea0f301c5c07 Mon Sep 17 00:00:00 2001 +From 9108a60b953530b594fd246bd33693a6b28bba3e Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Sun, 5 Sep 2021 21:42:46 +0100 Subject: [PATCH 012/249] coredump: drop exec permission diff --git a/0013-coredump-lint-fix-for-block-comments.patch b/0013-coredump-lint-fix-for-block-comments.patch index 8d0f6fa..7e0dfb6 100644 --- a/0013-coredump-lint-fix-for-block-comments.patch +++ b/0013-coredump-lint-fix-for-block-comments.patch @@ -1,4 +1,4 @@ -From ccb2c41bbabaeaa0cec6d31bb0a862a8724568f0 Mon Sep 17 00:00:00 2001 +From 9c26f836e94ba374ba0287e0d97d8a6f9e06635b Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Sun, 5 Sep 2021 21:53:06 +0100 Subject: [PATCH 013/249] coredump: lint fix for block comments diff --git a/0014-coredump-fix-missing-whitespace-around-operator.patch b/0014-coredump-fix-missing-whitespace-around-operator.patch index a78370f..542d788 100644 --- a/0014-coredump-fix-missing-whitespace-around-operator.patch +++ b/0014-coredump-fix-missing-whitespace-around-operator.patch @@ -1,4 +1,4 @@ -From dca95ec84857a23e142bbed9016da09c50868014 Mon Sep 17 00:00:00 2001 +From 33b1692e10d8192f583e5fa10d5ab9fb7ac7bef7 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Sun, 5 Sep 2021 22:37:26 +0100 Subject: [PATCH 014/249] coredump: fix missing whitespace around operator diff --git a/0015-coredump-fix-too-many-blank-lines.patch b/0015-coredump-fix-too-many-blank-lines.patch index 254f642..fd16235 100644 --- a/0015-coredump-fix-too-many-blank-lines.patch +++ b/0015-coredump-fix-too-many-blank-lines.patch @@ -1,4 +1,4 @@ -From 3495005412dcfe1a897bc52d24a299b098a6eac1 Mon Sep 17 00:00:00 2001 +From a20c0fe6e518a76db428979d2a145e98fdd79988 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Sun, 5 Sep 2021 22:39:50 +0100 Subject: [PATCH 015/249] coredump: fix too many blank lines diff --git a/0016-coredump-fix-comparison-to-true.patch b/0016-coredump-fix-comparison-to-true.patch index 592da3f..2685ebf 100644 --- a/0016-coredump-fix-comparison-to-true.patch +++ b/0016-coredump-fix-comparison-to-true.patch @@ -1,4 +1,4 @@ -From da13809e3122ffde0c3657facb978ba7b54bf3a5 Mon Sep 17 00:00:00 2001 +From e2fe46e74dd8904f296baa1257cf7191bcd74c4c Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Sun, 5 Sep 2021 22:42:19 +0100 Subject: [PATCH 016/249] coredump: fix comparison to true diff --git a/0017-coredump-lint-fix-visually-indented-line.patch b/0017-coredump-lint-fix-visually-indented-line.patch index d90cf62..78d0bd4 100644 --- a/0017-coredump-lint-fix-visually-indented-line.patch +++ b/0017-coredump-lint-fix-visually-indented-line.patch @@ -1,4 +1,4 @@ -From c9c55b3b33dc7e4295e68e816001216b7568c19e Mon Sep 17 00:00:00 2001 +From 630893e55da8281877ddd833e79e33a5dddd2b1b Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Sun, 5 Sep 2021 22:47:59 +0100 Subject: [PATCH 017/249] coredump: lint fix visually indented line diff --git a/0018-test-coredump-fix-shellcheck-errors.patch b/0018-test-coredump-fix-shellcheck-errors.patch index 26aaa99..cad1f22 100644 --- a/0018-test-coredump-fix-shellcheck-errors.patch +++ b/0018-test-coredump-fix-shellcheck-errors.patch @@ -1,4 +1,4 @@ -From 23644721afc34abb4a2d08c7dd7f83d5780a61ba Mon Sep 17 00:00:00 2001 +From 8fa9bbf2a2d5d5fcc80de865d380af7e7917a371 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Mon, 6 Sep 2021 00:20:58 +0100 Subject: [PATCH 018/249] test/coredump: fix shellcheck errors diff --git a/0019-make-enable-lint-for-coredump.patch b/0019-make-enable-lint-for-coredump.patch index 2484c08..3ee6f3c 100644 --- a/0019-make-enable-lint-for-coredump.patch +++ b/0019-make-enable-lint-for-coredump.patch @@ -1,4 +1,4 @@ -From 7bf49f15f48be6ae0cc6adddc17322f7d2e94e3b Mon Sep 17 00:00:00 2001 +From 7ea1e500fb23ce96dc895c5d59aae5a3728040b0 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Sun, 5 Sep 2021 22:55:24 +0100 Subject: [PATCH 019/249] make: enable lint for coredump diff --git a/0020-ci-enable-coredump-tests.patch b/0020-ci-enable-coredump-tests.patch index a6ebe98..90c3af2 100644 --- a/0020-ci-enable-coredump-tests.patch +++ b/0020-ci-enable-coredump-tests.patch @@ -1,4 +1,4 @@ -From 50311543e8d3567ebd15085cdb4ea3b149d1e90c Mon Sep 17 00:00:00 2001 +From 2b3165ebfecb216a8f07c3d2b7a68723d96f13ff Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Sun, 5 Sep 2021 23:06:56 +0100 Subject: [PATCH 020/249] ci: enable coredump tests diff --git a/0021-pie-restorer-remove-excess-hash-printf-specifier.patch b/0021-pie-restorer-remove-excess-hash-printf-specifier.patch index 9dc7236..ab350c5 100644 --- a/0021-pie-restorer-remove-excess-hash-printf-specifier.patch +++ b/0021-pie-restorer-remove-excess-hash-printf-specifier.patch @@ -1,4 +1,4 @@ -From a8956a7579f094de1401b6486501d6d553754b81 Mon Sep 17 00:00:00 2001 +From fe002c36aa94b8cfde68c12710084be558afec02 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 21 Oct 2021 11:47:01 +0300 Subject: [PATCH 021/249] pie/restorer: remove excess hash printf specifier diff --git a/0022-tty-fix-the-null-pointer-of-get_tty_driver.patch b/0022-tty-fix-the-null-pointer-of-get_tty_driver.patch index fd2c849..525cf40 100644 --- a/0022-tty-fix-the-null-pointer-of-get_tty_driver.patch +++ b/0022-tty-fix-the-null-pointer-of-get_tty_driver.patch @@ -1,4 +1,4 @@ -From add9597c6c6ed74c643e0784c171eb0ca8deab53 Mon Sep 17 00:00:00 2001 +From 373b1b787c96c4ee795000cb0e190ac5d135e17c Mon Sep 17 00:00:00 2001 From: "fu.lin" Date: Fri, 17 Sep 2021 17:16:48 +0800 Subject: [PATCH 022/249] tty: fix the null pointer of get_tty_driver diff --git a/0023-util-use-nftw-in-rmrf-helper.patch b/0023-util-use-nftw-in-rmrf-helper.patch index 7a2f6a7..585698d 100644 --- a/0023-util-use-nftw-in-rmrf-helper.patch +++ b/0023-util-use-nftw-in-rmrf-helper.patch @@ -1,4 +1,4 @@ -From 889fde47e57226278767be69768b733eeb84f15c Mon Sep 17 00:00:00 2001 +From 03cb3026fe42cc66b177e66ab96f27bba4e06ce3 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Fri, 22 Oct 2021 17:56:37 +0300 Subject: [PATCH 023/249] util: use nftw in rmrf helper diff --git a/0024-criu-ns-make-pidns-init-first-do-setsid.patch b/0024-criu-ns-make-pidns-init-first-do-setsid.patch index 90bc189..dbd0c94 100644 --- a/0024-criu-ns-make-pidns-init-first-do-setsid.patch +++ b/0024-criu-ns-make-pidns-init-first-do-setsid.patch @@ -1,4 +1,4 @@ -From 06a4400fc7b96e7abbeda7f79ee52daa61fe0223 Mon Sep 17 00:00:00 2001 +From 5002b2bedcdeac2e682f7995c9210fe351c6f818 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Mon, 18 Oct 2021 18:43:14 +0300 Subject: [PATCH 024/249] criu-ns: make pidns init first do setsid diff --git a/0025-net-optimize-restore_rule-to-not-open-the-CR_FD_RULE.patch b/0025-net-optimize-restore_rule-to-not-open-the-CR_FD_RULE.patch index 0547fde..fdfe0d8 100644 --- a/0025-net-optimize-restore_rule-to-not-open-the-CR_FD_RULE.patch +++ b/0025-net-optimize-restore_rule-to-not-open-the-CR_FD_RULE.patch @@ -1,4 +1,4 @@ -From 2cdae896f304afae1d2b96dd00f2a599266765be Mon Sep 17 00:00:00 2001 +From 23f4a75c65a08007e8c42aa71ceea4d32cebf9cd Mon Sep 17 00:00:00 2001 From: Nicolas Viennot Date: Thu, 28 Oct 2021 21:05:57 +0000 Subject: [PATCH 025/249] net: optimize restore_rule() to not open the diff --git a/0026-ci-replace-deprecated-codecov-bash-uploader.patch b/0026-ci-replace-deprecated-codecov-bash-uploader.patch index c845f54..18418fe 100644 --- a/0026-ci-replace-deprecated-codecov-bash-uploader.patch +++ b/0026-ci-replace-deprecated-codecov-bash-uploader.patch @@ -1,4 +1,4 @@ -From 175fb94e620f9e33358e92bec0262e0586ec554a Mon Sep 17 00:00:00 2001 +From 3920fd02a3494c5888083967a3054d8569866b4a Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Wed, 27 Oct 2021 07:27:22 +0000 Subject: [PATCH 026/249] ci: replace deprecated codecov bash uploader diff --git a/0027-ci-fix-userfaultfd-test-failures.patch b/0027-ci-fix-userfaultfd-test-failures.patch index ca61f9b..50e4024 100644 --- a/0027-ci-fix-userfaultfd-test-failures.patch +++ b/0027-ci-fix-userfaultfd-test-failures.patch @@ -1,4 +1,4 @@ -From a78590464010d9de5c794b4fc12aea8c5a0b46a1 Mon Sep 17 00:00:00 2001 +From 9dcf2c5116dcdac8b5ef99bf995cf5cfe6424c92 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Thu, 4 Nov 2021 09:10:38 +0000 Subject: [PATCH 027/249] ci: fix userfaultfd test failures diff --git a/0028-ci-use-Fedora-34-for-lint-CI-runs.patch b/0028-ci-use-Fedora-34-for-lint-CI-runs.patch index 89e550c..c908f78 100644 --- a/0028-ci-use-Fedora-34-for-lint-CI-runs.patch +++ b/0028-ci-use-Fedora-34-for-lint-CI-runs.patch @@ -1,4 +1,4 @@ -From 20c65ae87263315214c48a636dc20b4dbac03215 Mon Sep 17 00:00:00 2001 +From fa1ec35f42dd652ff57a9c816b11359eae38ddcf Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Thu, 4 Nov 2021 09:18:31 +0000 Subject: [PATCH 028/249] ci: use Fedora 34 for lint CI runs diff --git a/0029-tests-improve-the-image-streamer-process-control.patch b/0029-tests-improve-the-image-streamer-process-control.patch index 3155588..3380c0e 100644 --- a/0029-tests-improve-the-image-streamer-process-control.patch +++ b/0029-tests-improve-the-image-streamer-process-control.patch @@ -1,4 +1,4 @@ -From ef7f435bccd1a60230a66271723590656e0917b1 Mon Sep 17 00:00:00 2001 +From ff5beb22edc05bad44a1e6aecc4433212c991ed6 Mon Sep 17 00:00:00 2001 From: Nicolas Viennot Date: Fri, 29 Oct 2021 02:49:31 +0000 Subject: [PATCH 029/249] tests: improve the image streamer process control diff --git a/0030-sockets-don-t-call-sk_setbufs-asyncronously.patch b/0030-sockets-don-t-call-sk_setbufs-asyncronously.patch index 5d80afe..d3df87a 100644 --- a/0030-sockets-don-t-call-sk_setbufs-asyncronously.patch +++ b/0030-sockets-don-t-call-sk_setbufs-asyncronously.patch @@ -1,4 +1,4 @@ -From 04464397f1d2bf43265ed70bba029bfa57d20092 Mon Sep 17 00:00:00 2001 +From 36869e72971182f0e738edb7174a4505dcc5380c Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 29 Jul 2021 14:21:37 +0300 Subject: [PATCH 030/249] sockets: don't call sk_setbufs asyncronously diff --git a/0031-kerndat-check-for-set-getsockopt-SO_BUF_LOCK-availab.patch b/0031-kerndat-check-for-set-getsockopt-SO_BUF_LOCK-availab.patch index 6d4dd07..96b5132 100644 --- a/0031-kerndat-check-for-set-getsockopt-SO_BUF_LOCK-availab.patch +++ b/0031-kerndat-check-for-set-getsockopt-SO_BUF_LOCK-availab.patch @@ -1,4 +1,4 @@ -From 5dc443bcd848877677b858e1aa21e0c929f19541 Mon Sep 17 00:00:00 2001 +From f00d0d2c8cca8217eaaccf08605192cc3f12503b Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 29 Jul 2021 14:57:17 +0300 Subject: [PATCH 031/249] kerndat: check for set/getsockopt SO_BUF_LOCK diff --git a/0032-sockets-c-r-bufer-size-locks.patch b/0032-sockets-c-r-bufer-size-locks.patch index 40e34c9..20531ab 100644 --- a/0032-sockets-c-r-bufer-size-locks.patch +++ b/0032-sockets-c-r-bufer-size-locks.patch @@ -1,4 +1,4 @@ -From ab926314464645eda33d6ccb505e673d9db01296 Mon Sep 17 00:00:00 2001 +From 4bad0745c28810a2d2bb724b5d13b70d07545ae4 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 29 Jul 2021 11:27:13 +0300 Subject: [PATCH 032/249] sockets: c/r bufer size locks diff --git a/0033-zdtm-add-test-for-socket-buffer-size-locks.patch b/0033-zdtm-add-test-for-socket-buffer-size-locks.patch index a64f826..4c62ead 100644 --- a/0033-zdtm-add-test-for-socket-buffer-size-locks.patch +++ b/0033-zdtm-add-test-for-socket-buffer-size-locks.patch @@ -1,4 +1,4 @@ -From b9ef6d19297e0cea7d697513ee685ae13014cdec Mon Sep 17 00:00:00 2001 +From e32a58fcc35b57d6cbc81214e7c4d8f8539dbc5a Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 29 Jul 2021 16:16:12 +0300 Subject: [PATCH 033/249] zdtm: add test for socket buffer size locks diff --git a/0034-zdtm-make-sock_opts02-also-check-lock-change-by-SO_-.patch b/0034-zdtm-make-sock_opts02-also-check-lock-change-by-SO_-.patch index 8cfea59..a668131 100644 --- a/0034-zdtm-make-sock_opts02-also-check-lock-change-by-SO_-.patch +++ b/0034-zdtm-make-sock_opts02-also-check-lock-change-by-SO_-.patch @@ -1,4 +1,4 @@ -From e6d511315f175d80bb6b1adb9bfc68debb46ffc3 Mon Sep 17 00:00:00 2001 +From 46b0f54fe43b128e4949b2522450b519d20a5fc4 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Tue, 3 Aug 2021 13:05:32 +0300 Subject: [PATCH 034/249] zdtm: make sock_opts02 also check lock change by diff --git a/0035-clang-format-enable-AlignTrailingComments.patch b/0035-clang-format-enable-AlignTrailingComments.patch index 8838372..c816ad2 100644 --- a/0035-clang-format-enable-AlignTrailingComments.patch +++ b/0035-clang-format-enable-AlignTrailingComments.patch @@ -1,4 +1,4 @@ -From 8ea9c9fc7360f9c5250632d0818f68af0de73992 Mon Sep 17 00:00:00 2001 +From ff3ff3b94a45d6907e0d3c6fb850cf3d729ce252 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 28 Oct 2021 17:15:52 +0300 Subject: [PATCH 035/249] clang-format: enable AlignTrailingComments diff --git a/0036-clang-format-do-several-manual-comment-fixups.patch b/0036-clang-format-do-several-manual-comment-fixups.patch index 622bb25..ac0f701 100644 --- a/0036-clang-format-do-several-manual-comment-fixups.patch +++ b/0036-clang-format-do-several-manual-comment-fixups.patch @@ -1,4 +1,4 @@ -From 54b25b72065f17594216642bcf8a3267a0a0a489 Mon Sep 17 00:00:00 2001 +From f8018e956406b88a9bc170354229b5ec40570fef Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 28 Oct 2021 17:17:44 +0300 Subject: [PATCH 036/249] clang-format: do several manual comment fixups diff --git a/0037-clang-format-do-automatic-comment-fixups.patch b/0037-clang-format-do-automatic-comment-fixups.patch index 1eaa294..3fdcb36 100644 --- a/0037-clang-format-do-automatic-comment-fixups.patch +++ b/0037-clang-format-do-automatic-comment-fixups.patch @@ -1,4 +1,4 @@ -From 901042439368aef3513407abcf2f91780fb609a4 Mon Sep 17 00:00:00 2001 +From d42f4cf79a9d248b2129add96186fdb05c39ba5e Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 28 Oct 2021 18:10:14 +0300 Subject: [PATCH 037/249] clang-format: do automatic comment fixups diff --git a/0038-cr-dump-fail-dumping-when-zombie-process-with-sid-0.patch b/0038-cr-dump-fail-dumping-when-zombie-process-with-sid-0.patch index af595c8..2c69846 100644 --- a/0038-cr-dump-fail-dumping-when-zombie-process-with-sid-0.patch +++ b/0038-cr-dump-fail-dumping-when-zombie-process-with-sid-0.patch @@ -1,4 +1,4 @@ -From 906549c2de213e25ef6795025604a59609033f9d Mon Sep 17 00:00:00 2001 +From b03d50673e9159a712e86f7a9c75c5cabc09278d Mon Sep 17 00:00:00 2001 From: Liu Hua Date: Mon, 1 Nov 2021 20:50:58 +0800 Subject: [PATCH 038/249] cr-dump: fail dumping when zombie process with sid 0 diff --git a/0039-clang-format-make-x86_ins_capability_mask-human-read.patch b/0039-clang-format-make-x86_ins_capability_mask-human-read.patch index ea63b56..1b326e7 100644 --- a/0039-clang-format-make-x86_ins_capability_mask-human-read.patch +++ b/0039-clang-format-make-x86_ins_capability_mask-human-read.patch @@ -1,4 +1,4 @@ -From e15962cc0cf487a85c4c30a2df0c4fd6dabe66de Mon Sep 17 00:00:00 2001 +From cf56caeb12eb8900409846d2d3d9383cd210388d Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Fri, 29 Oct 2021 10:35:28 +0300 Subject: [PATCH 039/249] clang-format: make x86_ins_capability_mask diff --git a/0040-ci-disable-socket-raw-test-on-centos8.patch b/0040-ci-disable-socket-raw-test-on-centos8.patch index b014a8f..48286df 100644 --- a/0040-ci-disable-socket-raw-test-on-centos8.patch +++ b/0040-ci-disable-socket-raw-test-on-centos8.patch @@ -1,4 +1,4 @@ -From feb6788016c7de1998d00f54887f00b04fa47830 Mon Sep 17 00:00:00 2001 +From 685364f9766498c2f6640dd7882434dd10cd5119 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Fri, 19 Nov 2021 10:08:37 +0300 Subject: [PATCH 040/249] ci: disable socket-raw test on centos8 diff --git a/0041-zdtm.py-make-tests-with-link_remap-exclusive.patch b/0041-zdtm.py-make-tests-with-link_remap-exclusive.patch index 3439e3c..5fe396f 100644 --- a/0041-zdtm.py-make-tests-with-link_remap-exclusive.patch +++ b/0041-zdtm.py-make-tests-with-link_remap-exclusive.patch @@ -1,4 +1,4 @@ -From e41b2b10e637920665cf590bc170407d414ecf32 Mon Sep 17 00:00:00 2001 +From ac4dcfc49b09e48e8b7cf6ffe25d6a717969ead2 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Wed, 3 Nov 2021 18:34:11 +0300 Subject: [PATCH 041/249] zdtm.py: make tests with --link_remap exclusive diff --git a/0042-tests-improve-the-deterministic-behavior-of-the-test.patch b/0042-tests-improve-the-deterministic-behavior-of-the-test.patch index f6c8e9b..870820d 100644 --- a/0042-tests-improve-the-deterministic-behavior-of-the-test.patch +++ b/0042-tests-improve-the-deterministic-behavior-of-the-test.patch @@ -1,4 +1,4 @@ -From 038d59609716bac5b343dd03e4361ded84d48519 Mon Sep 17 00:00:00 2001 +From e9c9a39b7e5ad461d47ecebfd8d9ba0d1edd6aeb Mon Sep 17 00:00:00 2001 From: Nicolas Viennot Date: Fri, 29 Oct 2021 03:01:14 +0000 Subject: [PATCH 042/249] tests: improve the deterministic behavior of the test diff --git a/0043-clang-format-zdtm-fix-clang-complains-about-strange-.patch b/0043-clang-format-zdtm-fix-clang-complains-about-strange-.patch index 5deabf6..e6f2857 100644 --- a/0043-clang-format-zdtm-fix-clang-complains-about-strange-.patch +++ b/0043-clang-format-zdtm-fix-clang-complains-about-strange-.patch @@ -1,4 +1,4 @@ -From 25c642cb7840033673f36a270074d7a47b0bbd76 Mon Sep 17 00:00:00 2001 +From 044dd55e9585b9b2d1ac15e21cd6e6c08b4d8ee3 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Tue, 23 Nov 2021 15:06:03 +0300 Subject: [PATCH 043/249] clang-format/zdtm: fix clang complains about strange diff --git a/0044-seize-restore-cgroup-freezer-to-right-state.patch b/0044-seize-restore-cgroup-freezer-to-right-state.patch index 56b5099..4f0eae2 100644 --- a/0044-seize-restore-cgroup-freezer-to-right-state.patch +++ b/0044-seize-restore-cgroup-freezer-to-right-state.patch @@ -1,4 +1,4 @@ -From f1115a8e679c56269e363a609e1b86bc3052963a Mon Sep 17 00:00:00 2001 +From 716dba02dac88130918fd11628c81115a5bab586 Mon Sep 17 00:00:00 2001 From: Liu Hua Date: Fri, 5 Nov 2021 17:08:51 +0800 Subject: [PATCH 044/249] seize: restore cgroup freezer to right state diff --git a/0045-ci-Use-latest-Fedora-for-lint-ci-runs-again.patch b/0045-ci-Use-latest-Fedora-for-lint-ci-runs-again.patch index e1799a6..adde306 100644 --- a/0045-ci-Use-latest-Fedora-for-lint-ci-runs-again.patch +++ b/0045-ci-Use-latest-Fedora-for-lint-ci-runs-again.patch @@ -1,4 +1,4 @@ -From ba0ead357350d413d84fde5d2a35e445aa1aa964 Mon Sep 17 00:00:00 2001 +From 1b5cc130824dcbcef2467b7c513ace0dd6a41fe5 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Wed, 24 Nov 2021 11:37:58 +0300 Subject: [PATCH 045/249] ci: Use latest Fedora for lint ci runs again diff --git a/0046-crtools-ignore-SIGPIPE-in-swrk-mode.patch b/0046-crtools-ignore-SIGPIPE-in-swrk-mode.patch index f67400b..5f621c9 100644 --- a/0046-crtools-ignore-SIGPIPE-in-swrk-mode.patch +++ b/0046-crtools-ignore-SIGPIPE-in-swrk-mode.patch @@ -1,4 +1,4 @@ -From 49e0e77e5ca95fbdc0cd419982c0ef07772db04e Mon Sep 17 00:00:00 2001 +From da247673bf35506d48433627421c2d0192159b9c Mon Sep 17 00:00:00 2001 From: Liu Hua Date: Thu, 4 Nov 2021 10:04:22 +0800 Subject: [PATCH 046/249] crtools: ignore SIGPIPE in swrk mode diff --git a/0047-ci-switch-to-centos-stream-8.patch b/0047-ci-switch-to-centos-stream-8.patch index c900a38..4bc5488 100644 --- a/0047-ci-switch-to-centos-stream-8.patch +++ b/0047-ci-switch-to-centos-stream-8.patch @@ -1,4 +1,4 @@ -From 17e98a26b7d6b71613b8231d53ef33b61292c143 Mon Sep 17 00:00:00 2001 +From ecfef3dc95bd1293084916ff2c40250a4442796c Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Wed, 24 Nov 2021 16:13:01 +0000 Subject: [PATCH 047/249] ci: switch to centos-stream-8 diff --git a/0048-check-cleanup-child-processes.patch b/0048-check-cleanup-child-processes.patch index 9fe5f0d..2adda17 100644 --- a/0048-check-cleanup-child-processes.patch +++ b/0048-check-cleanup-child-processes.patch @@ -1,4 +1,4 @@ -From aa6fb0bacd5cd9599a6e83b9c19cc10c679a03bf Mon Sep 17 00:00:00 2001 +From 9e074610d7bc702b9220095691e4d138b0c0df09 Mon Sep 17 00:00:00 2001 From: Nicolas Viennot Date: Fri, 19 Nov 2021 20:58:13 +0000 Subject: [PATCH 048/249] check: cleanup child processes diff --git a/0049-files-reg-fix-error-handling-in-open_path.patch b/0049-files-reg-fix-error-handling-in-open_path.patch index 3f90c21..acfc56f 100644 --- a/0049-files-reg-fix-error-handling-in-open_path.patch +++ b/0049-files-reg-fix-error-handling-in-open_path.patch @@ -1,4 +1,4 @@ -From bbc3f37710c5cf1cac507337a536c5523123b2a9 Mon Sep 17 00:00:00 2001 +From e1485b8d58c4927f7cbd1ee0383c7d7f8580bade Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 13 Feb 2020 10:43:14 +0300 Subject: [PATCH 049/249] files-reg: fix error handling in open_path diff --git a/0050-files-reg-fix-error-handling-of-rm_parent_dirs.patch b/0050-files-reg-fix-error-handling-of-rm_parent_dirs.patch index 859815a..8880742 100644 --- a/0050-files-reg-fix-error-handling-of-rm_parent_dirs.patch +++ b/0050-files-reg-fix-error-handling-of-rm_parent_dirs.patch @@ -1,4 +1,4 @@ -From e655a0ac8421325f2de8fbe4f6855b06cd2faace Mon Sep 17 00:00:00 2001 +From e7c9c5c08d4289962d56ec74bb4b554f5ed42f7e Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 13 Feb 2020 13:03:12 +0300 Subject: [PATCH 050/249] files-reg: fix error handling of rm_parent_dirs diff --git a/0051-ghost-mount-allocate-remounted_rw-in-shmem-to-get-in.patch b/0051-ghost-mount-allocate-remounted_rw-in-shmem-to-get-in.patch index f9472f8..fe0c63d 100644 --- a/0051-ghost-mount-allocate-remounted_rw-in-shmem-to-get-in.patch +++ b/0051-ghost-mount-allocate-remounted_rw-in-shmem-to-get-in.patch @@ -1,4 +1,4 @@ -From 67b257d852572d38375453671ae038312ed94cba Mon Sep 17 00:00:00 2001 +From 90855f58bae7aa9560868403fac00d5bd14be971 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 13 Feb 2020 18:28:15 +0300 Subject: [PATCH 051/249] ghost/mount: allocate remounted_rw in shmem to get diff --git a/0052-files-reg-temporary-remount-writable-the-mount-we-do.patch b/0052-files-reg-temporary-remount-writable-the-mount-we-do.patch index a08c17e..0bb729e 100644 --- a/0052-files-reg-temporary-remount-writable-the-mount-we-do.patch +++ b/0052-files-reg-temporary-remount-writable-the-mount-we-do.patch @@ -1,4 +1,4 @@ -From 44aa8a5a75529bb4b256bcbdf490da5b730c5c5f Mon Sep 17 00:00:00 2001 +From d30c2c86f6f9a81de004a129661ad7aa5d9fcddb Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 13 Feb 2020 18:26:52 +0300 Subject: [PATCH 052/249] files-reg: temporary remount writable the mount we do diff --git a/0053-zdtm-add-ro-mount-check-after-c-r-to-mntns_ghost01.patch b/0053-zdtm-add-ro-mount-check-after-c-r-to-mntns_ghost01.patch index 797e987..c1f2e7d 100644 --- a/0053-zdtm-add-ro-mount-check-after-c-r-to-mntns_ghost01.patch +++ b/0053-zdtm-add-ro-mount-check-after-c-r-to-mntns_ghost01.patch @@ -1,4 +1,4 @@ -From 0fc0b2d996e0cba450155727239df8aaf31c26f1 Mon Sep 17 00:00:00 2001 +From dff6911878ee62f7cd757a0a8e3ecc3fe4ee6ac7 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Tue, 30 Nov 2021 19:03:29 +0300 Subject: [PATCH 053/249] zdtm: add ro-mount check after c/r to mntns_ghost01 diff --git a/0054-clang-format-disable-wrong-struct-pointer-declaratio.patch b/0054-clang-format-disable-wrong-struct-pointer-declaratio.patch index 4ff12da..6433b80 100644 --- a/0054-clang-format-disable-wrong-struct-pointer-declaratio.patch +++ b/0054-clang-format-disable-wrong-struct-pointer-declaratio.patch @@ -1,4 +1,4 @@ -From 4e24f113c007f81904d6f46b336ed94634555657 Mon Sep 17 00:00:00 2001 +From 3174e7ee7e85be9db58373ddceea98e9984f3808 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 25 Nov 2021 16:51:55 +0300 Subject: [PATCH 054/249] clang-format: disable wrong struct pointer diff --git a/0055-ci-Run-cross-compile-on-debian-stable.patch b/0055-ci-Run-cross-compile-on-debian-stable.patch index ad597d1..0e5403d 100644 --- a/0055-ci-Run-cross-compile-on-debian-stable.patch +++ b/0055-ci-Run-cross-compile-on-debian-stable.patch @@ -1,4 +1,4 @@ -From 3dd5cec57d2835e00e69a69f24fa60303216dbda Mon Sep 17 00:00:00 2001 +From b223773cd4ffd0fe8cf6e1384ad95b4c4d1b4109 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Sat, 4 Dec 2021 16:18:26 +0000 Subject: [PATCH 055/249] ci: Run cross compile on debian stable diff --git a/0056-ci-Run-cross-compile-with-debian-testing.patch b/0056-ci-Run-cross-compile-with-debian-testing.patch index 2fd6f74..de7341c 100644 --- a/0056-ci-Run-cross-compile-with-debian-testing.patch +++ b/0056-ci-Run-cross-compile-with-debian-testing.patch @@ -1,4 +1,4 @@ -From 28936552df6c83266aa9e8900b5cd92f0aa3a1f7 Mon Sep 17 00:00:00 2001 +From 5aaf82b4d8bd6c89f7e6b0f639c79b3a2d21eeef Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Sat, 4 Dec 2021 16:31:34 +0000 Subject: [PATCH 056/249] ci: Run cross compile with debian testing diff --git a/0057-make-Explicitly-enable-FPU-on-ARMv7-builds.patch b/0057-make-Explicitly-enable-FPU-on-ARMv7-builds.patch index 9c1f8ac..30b5cf4 100644 --- a/0057-make-Explicitly-enable-FPU-on-ARMv7-builds.patch +++ b/0057-make-Explicitly-enable-FPU-on-ARMv7-builds.patch @@ -1,4 +1,4 @@ -From 205ba95597c1f538776e4ed6838f7e082178f5fe Mon Sep 17 00:00:00 2001 +From 2ff0ffafa7e23b8a0e64ecd5da9d32e59782e2ee Mon Sep 17 00:00:00 2001 From: Salvatore Bonaccorso Date: Sat, 4 Dec 2021 16:59:51 +0000 Subject: [PATCH 057/249] make: Explicitly enable FPU on ARMv7 builds diff --git a/0058-ci-disable-broken-tests-until-fixed.patch b/0058-ci-disable-broken-tests-until-fixed.patch index 3af4a03..20a7cfe 100644 --- a/0058-ci-disable-broken-tests-until-fixed.patch +++ b/0058-ci-disable-broken-tests-until-fixed.patch @@ -1,4 +1,4 @@ -From d3a8330e09361582888d72a082d5e6fa02f4b9cc Mon Sep 17 00:00:00 2001 +From 02eb97d17b8cf91831dd0a63e431b1399a4be42a Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Fri, 3 Dec 2021 16:48:36 +0000 Subject: [PATCH 058/249] ci: disable broken tests until fixed diff --git a/0059-test-do-not-use-keep-going-for-single-zdtm-tests.patch b/0059-test-do-not-use-keep-going-for-single-zdtm-tests.patch index ead2fbf..c693e98 100644 --- a/0059-test-do-not-use-keep-going-for-single-zdtm-tests.patch +++ b/0059-test-do-not-use-keep-going-for-single-zdtm-tests.patch @@ -1,4 +1,4 @@ -From 448c0bdf19285cb7a7fad2872e3f5462ffdeb996 Mon Sep 17 00:00:00 2001 +From 0c6248725ee00d152226d710f9f31362025acdc6 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Sun, 5 Dec 2021 16:45:20 +0000 Subject: [PATCH 059/249] test: do not use --keep-going for single zdtm tests diff --git a/0060-files-reg-try-dump_ghost_remap-if-link-remap-failed-.patch b/0060-files-reg-try-dump_ghost_remap-if-link-remap-failed-.patch index 9f5b630..7ad16c1 100644 --- a/0060-files-reg-try-dump_ghost_remap-if-link-remap-failed-.patch +++ b/0060-files-reg-try-dump_ghost_remap-if-link-remap-failed-.patch @@ -1,4 +1,4 @@ -From 6e5fd46d6a30b488ab7f17f0069c598e1f59cdbb Mon Sep 17 00:00:00 2001 +From a446b513ccd5e91078cbc30cecfd4aa0634119f4 Mon Sep 17 00:00:00 2001 From: ianlang Date: Fri, 3 Dec 2021 15:15:30 +0800 Subject: [PATCH 060/249] files-reg: try dump_ghost_remap if link-remap failed diff --git a/0061-util-make-page-server-IPv6-safe.patch b/0061-util-make-page-server-IPv6-safe.patch index cb06f7a..8428e19 100644 --- a/0061-util-make-page-server-IPv6-safe.patch +++ b/0061-util-make-page-server-IPv6-safe.patch @@ -1,4 +1,4 @@ -From a006788dfab8a971218450923a59209c52f4eb88 Mon Sep 17 00:00:00 2001 +From 0eed6f740c3f1efc580b62d59ee3efff64276077 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Tue, 7 Dec 2021 09:10:14 +0000 Subject: [PATCH 061/249] util: make page-server IPv6 safe diff --git a/0062-sk-unix-Fix-TCP_ESTABLISHED-checks-in-unix-sockets.patch b/0062-sk-unix-Fix-TCP_ESTABLISHED-checks-in-unix-sockets.patch index 2149781..bcdd74e 100644 --- a/0062-sk-unix-Fix-TCP_ESTABLISHED-checks-in-unix-sockets.patch +++ b/0062-sk-unix-Fix-TCP_ESTABLISHED-checks-in-unix-sockets.patch @@ -1,4 +1,4 @@ -From b6f9c443a78efb50225c2fabd224cea6c71d1c49 Mon Sep 17 00:00:00 2001 +From 7360c8d2a013f17c9cccad8305e63321b05f651d Mon Sep 17 00:00:00 2001 From: Bui Quang Minh Date: Thu, 2 Dec 2021 23:01:33 +0700 Subject: [PATCH 062/249] sk-unix: Fix TCP_ESTABLISHED checks in unix sockets diff --git a/0063-ci-Enable-disabled-unix-socket-related-tests.patch b/0063-ci-Enable-disabled-unix-socket-related-tests.patch index e4d66c4..5905600 100644 --- a/0063-ci-Enable-disabled-unix-socket-related-tests.patch +++ b/0063-ci-Enable-disabled-unix-socket-related-tests.patch @@ -1,4 +1,4 @@ -From c3e4e68b3cab075415f5e500cb884a2e25a434b9 Mon Sep 17 00:00:00 2001 +From 1d4d1d36e6b01b0ec7d87e3f0c6e6464929f9e21 Mon Sep 17 00:00:00 2001 From: Bui Quang Minh Date: Tue, 7 Dec 2021 23:40:12 +0700 Subject: [PATCH 063/249] ci: Enable disabled unix socket related tests diff --git a/0064-ci-install-procps-in-Alpine.patch b/0064-ci-install-procps-in-Alpine.patch index 50cd85a..88568d1 100644 --- a/0064-ci-install-procps-in-Alpine.patch +++ b/0064-ci-install-procps-in-Alpine.patch @@ -1,4 +1,4 @@ -From a352d973e7901db8d46322e1cb7fdae5bf920967 Mon Sep 17 00:00:00 2001 +From 6ed22ff628c5cca460584b25be6c5bc7a241b01c Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Fri, 10 Dec 2021 15:35:29 +0000 Subject: [PATCH 064/249] ci: install procps in Alpine diff --git a/0065-test-another-try-to-correctly-fix-the-kernel-version.patch b/0065-test-another-try-to-correctly-fix-the-kernel-version.patch index 3d714df..c6cd645 100644 --- a/0065-test-another-try-to-correctly-fix-the-kernel-version.patch +++ b/0065-test-another-try-to-correctly-fix-the-kernel-version.patch @@ -1,4 +1,4 @@ -From 564eaa77e6c780f7dd8195f053a1928447e87b9c Mon Sep 17 00:00:00 2001 +From afa186872a305406482e8d1ff02aae092a9dfdc0 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Fri, 3 Dec 2021 16:59:56 +0000 Subject: [PATCH 065/249] test: another try to correctly fix the kernel version diff --git a/0066-x86-compel-fault-inject-bound-xsave-features-set.patch b/0066-x86-compel-fault-inject-bound-xsave-features-set.patch index 30af35b..026f235 100644 --- a/0066-x86-compel-fault-inject-bound-xsave-features-set.patch +++ b/0066-x86-compel-fault-inject-bound-xsave-features-set.patch @@ -1,4 +1,4 @@ -From 41bf30f94b72172e807e4b1ebdc6e7df076b3e75 Mon Sep 17 00:00:00 2001 +From 80cabb69fb7bc028e632796a48b930c2238ddd08 Mon Sep 17 00:00:00 2001 From: Alexander Mikhalitsyn Date: Mon, 13 Dec 2021 15:19:50 +0300 Subject: [PATCH 066/249] x86/compel/fault-inject: bound xsave features set diff --git a/0067-x86-compel-fault-inject-print-the-initial-seed.patch b/0067-x86-compel-fault-inject-print-the-initial-seed.patch index 87a09e1..0d6a529 100644 --- a/0067-x86-compel-fault-inject-print-the-initial-seed.patch +++ b/0067-x86-compel-fault-inject-print-the-initial-seed.patch @@ -1,4 +1,4 @@ -From eb100eb39cb32d7a559168267a11f5ac9db9c154 Mon Sep 17 00:00:00 2001 +From efd0cc2c4fba3bc72133f022e3fe393a0346cb51 Mon Sep 17 00:00:00 2001 From: Alexander Mikhalitsyn Date: Mon, 13 Dec 2021 15:32:00 +0300 Subject: [PATCH 067/249] x86/compel/fault-inject: print the initial seed diff --git a/0068-ci-enable-x86-xsave-fault-injection-tests-back.patch b/0068-ci-enable-x86-xsave-fault-injection-tests-back.patch index fb30d03..58ebd7f 100644 --- a/0068-ci-enable-x86-xsave-fault-injection-tests-back.patch +++ b/0068-ci-enable-x86-xsave-fault-injection-tests-back.patch @@ -1,4 +1,4 @@ -From 52cd18643245eb0dfe4cc9d8b21f89e1c8f30d35 Mon Sep 17 00:00:00 2001 +From e92aca9152507f3800cb39a8d9a1acc7ca5e130a Mon Sep 17 00:00:00 2001 From: Alexander Mikhalitsyn Date: Mon, 13 Dec 2021 15:46:47 +0300 Subject: [PATCH 068/249] ci: enable x86 xsave fault injection tests back diff --git a/0069-Add-documentation-for-timeout-option.patch b/0069-Add-documentation-for-timeout-option.patch index bd3bab8..c94a704 100644 --- a/0069-Add-documentation-for-timeout-option.patch +++ b/0069-Add-documentation-for-timeout-option.patch @@ -1,4 +1,4 @@ -From ce3e913a89f979e7d3787dff58351b7ba915bc01 Mon Sep 17 00:00:00 2001 +From b1c13f61a2012f35466768be1de0b3761934fc3a Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Tue, 14 Dec 2021 12:54:19 +0000 Subject: [PATCH 069/249] Add documentation for --timeout option diff --git a/0070-usernsd-UNS_FDOUT-should-not-require-an-input-descri.patch b/0070-usernsd-UNS_FDOUT-should-not-require-an-input-descri.patch index 1259547..83b229a 100644 --- a/0070-usernsd-UNS_FDOUT-should-not-require-an-input-descri.patch +++ b/0070-usernsd-UNS_FDOUT-should-not-require-an-input-descri.patch @@ -1,4 +1,4 @@ -From d83fe7440c3bce204018bf9167f67bac48118c2a Mon Sep 17 00:00:00 2001 +From a03504744be5e55913c690bf1ed26b0f0182af1d Mon Sep 17 00:00:00 2001 From: Andrei Vagin Date: Tue, 14 Dec 2021 08:19:16 -0800 Subject: [PATCH 070/249] usernsd: UNS_FDOUT should not require an input diff --git a/0071-libcriu-add-setting-lsm-mount-context-to-libcriu.patch b/0071-libcriu-add-setting-lsm-mount-context-to-libcriu.patch index e52b8f1..170d14b 100644 --- a/0071-libcriu-add-setting-lsm-mount-context-to-libcriu.patch +++ b/0071-libcriu-add-setting-lsm-mount-context-to-libcriu.patch @@ -1,4 +1,4 @@ -From bee106f22237800350009d4875be5361c02108c0 Mon Sep 17 00:00:00 2001 +From c94a71639925fd56fa59bdf74ba416f3306c1a72 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Wed, 1 Dec 2021 11:08:53 +0000 Subject: [PATCH 071/249] libcriu: add setting lsm-mount-context to libcriu diff --git a/0072-ci-use-unstable-release-for-cross-compile.patch b/0072-ci-use-unstable-release-for-cross-compile.patch index 16b9aa3..41af95d 100644 --- a/0072-ci-use-unstable-release-for-cross-compile.patch +++ b/0072-ci-use-unstable-release-for-cross-compile.patch @@ -1,4 +1,4 @@ -From 564f6313cb85a64460a30123b07197dd98224c32 Mon Sep 17 00:00:00 2001 +From eb0323c25ea6d3ddab0e85c9f24d29154155ae4f Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Sat, 18 Dec 2021 17:25:17 +0000 Subject: [PATCH 072/249] ci: use unstable release for cross-compile diff --git a/0073-ci-disable-glibc-rseq-support.patch b/0073-ci-disable-glibc-rseq-support.patch index 2a1bfd7..fb1232f 100644 --- a/0073-ci-disable-glibc-rseq-support.patch +++ b/0073-ci-disable-glibc-rseq-support.patch @@ -1,4 +1,4 @@ -From 95e6bc3e53bec3c4f00b7e4ddfab5cf904780dbc Mon Sep 17 00:00:00 2001 +From 23ad9ca9074fdf8adc6d155c665853bee0e2190b Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Fri, 17 Dec 2021 03:01:49 +0000 Subject: [PATCH 073/249] ci: disable glibc rseq support diff --git a/0074-libcriu-add-single-pre-dump-support.patch b/0074-libcriu-add-single-pre-dump-support.patch index 951fe22..e3eb5ac 100644 --- a/0074-libcriu-add-single-pre-dump-support.patch +++ b/0074-libcriu-add-single-pre-dump-support.patch @@ -1,4 +1,4 @@ -From 7728a658b207bfa2b4910de7d9781bca993be8dd Mon Sep 17 00:00:00 2001 +From 3c27c8d7a494bcf59b08f9fe203d1e408d1b6a1f Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Fri, 3 Dec 2021 14:32:33 +0000 Subject: [PATCH 074/249] libcriu: add single pre-dump support diff --git a/0075-tests-added-test-for-single-pre-dump-support.patch b/0075-tests-added-test-for-single-pre-dump-support.patch index 6a6d2e1..d0106e7 100644 --- a/0075-tests-added-test-for-single-pre-dump-support.patch +++ b/0075-tests-added-test-for-single-pre-dump-support.patch @@ -1,4 +1,4 @@ -From e9452713606cfdbc9e41c28cde674dcaeaded23a Mon Sep 17 00:00:00 2001 +From 871feecbc5f200ddf7c9c18e0dc8eaa0544d0688 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Tue, 14 Dec 2021 13:09:19 +0000 Subject: [PATCH 075/249] tests: added test for single pre-dump support diff --git a/0076-zdtm.py-clean-up-MAKEFLAGS-env-variable-before-runni.patch b/0076-zdtm.py-clean-up-MAKEFLAGS-env-variable-before-runni.patch index 3e41efa..3474866 100644 --- a/0076-zdtm.py-clean-up-MAKEFLAGS-env-variable-before-runni.patch +++ b/0076-zdtm.py-clean-up-MAKEFLAGS-env-variable-before-runni.patch @@ -1,4 +1,4 @@ -From f495ba8e621ca3e4875c81f7b4dca0f3e9b79912 Mon Sep 17 00:00:00 2001 +From 05b155f1f46eb98e38ad1a0d8a332ab3326323ff Mon Sep 17 00:00:00 2001 From: Alexander Mikhalitsyn Date: Sat, 18 Dec 2021 10:40:11 +0300 Subject: [PATCH 076/249] zdtm.py: clean up MAKEFLAGS env variable before diff --git a/0077-zdtm-zdtm_ct-fix-compilation-error-with-strict-proto.patch b/0077-zdtm-zdtm_ct-fix-compilation-error-with-strict-proto.patch index dc74fb7..bc7426b 100644 --- a/0077-zdtm-zdtm_ct-fix-compilation-error-with-strict-proto.patch +++ b/0077-zdtm-zdtm_ct-fix-compilation-error-with-strict-proto.patch @@ -1,4 +1,4 @@ -From d1c2c801af398dbf95fc693cf3baa3f24a8741ec Mon Sep 17 00:00:00 2001 +From ffb3cfd38ccc307a8c8171220cd744578a679195 Mon Sep 17 00:00:00 2001 From: Alexander Mikhalitsyn Date: Sat, 18 Dec 2021 11:03:53 +0300 Subject: [PATCH 077/249] zdtm: zdtm_ct fix compilation error with diff --git a/0078-zdtm-remove-mntns-deleted-dst-test-leftover-from-git.patch b/0078-zdtm-remove-mntns-deleted-dst-test-leftover-from-git.patch index 358d5fd..66585f1 100644 --- a/0078-zdtm-remove-mntns-deleted-dst-test-leftover-from-git.patch +++ b/0078-zdtm-remove-mntns-deleted-dst-test-leftover-from-git.patch @@ -1,4 +1,4 @@ -From cbc53fdb2d10f56c74abeff6b1ecb8374b38b84b Mon Sep 17 00:00:00 2001 +From 6bb67ad114a16bcabe3fe349309093f00c6f39da Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Fri, 17 Dec 2021 15:33:55 +0300 Subject: [PATCH 078/249] zdtm: remove mntns-deleted-dst test leftover from git diff --git a/0079-crtools-remove-excess-always-true-condition.patch b/0079-crtools-remove-excess-always-true-condition.patch index ef4692f..9c391f2 100644 --- a/0079-crtools-remove-excess-always-true-condition.patch +++ b/0079-crtools-remove-excess-always-true-condition.patch @@ -1,4 +1,4 @@ -From cf7485318cdcdb47e912ca7d53ab8965d5518b63 Mon Sep 17 00:00:00 2001 +From 8950d844260c91535ce1bbfc670ee547ca7c3b85 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Fri, 10 Dec 2021 15:34:19 +0300 Subject: [PATCH 079/249] crtools: remove excess always true condition diff --git a/0080-crtools-rpc-export-current-criu-mode-to-opts.mode.patch b/0080-crtools-rpc-export-current-criu-mode-to-opts.mode.patch index 7c27a7d..944e23f 100644 --- a/0080-crtools-rpc-export-current-criu-mode-to-opts.mode.patch +++ b/0080-crtools-rpc-export-current-criu-mode-to-opts.mode.patch @@ -1,4 +1,4 @@ -From 3adaf3c4434995ce81530a336469ec792c62cc1b Mon Sep 17 00:00:00 2001 +From 9192d6b38b6ed5ddd9c2a89bd384e25f93bb13d6 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Fri, 10 Dec 2021 12:13:06 +0300 Subject: [PATCH 080/249] crtools/rpc: export current criu mode to opts.mode diff --git a/0081-crtools-use-new-opts.mode-in-image_dir_mode.patch b/0081-crtools-use-new-opts.mode-in-image_dir_mode.patch index d58ae92..7503d23 100644 --- a/0081-crtools-use-new-opts.mode-in-image_dir_mode.patch +++ b/0081-crtools-use-new-opts.mode-in-image_dir_mode.patch @@ -1,4 +1,4 @@ -From 02e3280066d2d44a520d1ef4dd7128e80182c66b Mon Sep 17 00:00:00 2001 +From f8250a1c0f62abe60c727d90e39cf6c26fe357f4 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Wed, 15 Dec 2021 10:49:42 +0300 Subject: [PATCH 081/249] crtools: use new opts.mode in image_dir_mode diff --git a/0082-crtools-check-that-cpuinfo-command-has-sub-command.patch b/0082-crtools-check-that-cpuinfo-command-has-sub-command.patch index 6dba131..4772f44 100644 --- a/0082-crtools-check-that-cpuinfo-command-has-sub-command.patch +++ b/0082-crtools-check-that-cpuinfo-command-has-sub-command.patch @@ -1,4 +1,4 @@ -From 37b42d0edbba16460c6190f7e7dd42f6fef7e299 Mon Sep 17 00:00:00 2001 +From f67fb6cf09c1a38f5f7c0bd86fee572bb6cf7bf9 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 16 Dec 2021 18:05:01 +0300 Subject: [PATCH 082/249] crtools: check that cpuinfo command has sub-command diff --git a/0083-sk-unix-Add-support-for-SOCK_SEQPACKET-unix-sockets.patch b/0083-sk-unix-Add-support-for-SOCK_SEQPACKET-unix-sockets.patch index d30b49b..d39be75 100644 --- a/0083-sk-unix-Add-support-for-SOCK_SEQPACKET-unix-sockets.patch +++ b/0083-sk-unix-Add-support-for-SOCK_SEQPACKET-unix-sockets.patch @@ -1,4 +1,4 @@ -From 858aac29618d89b898af87d9e05169361453beba Mon Sep 17 00:00:00 2001 +From ac48b975f6d4c03d0ea2a9f99ed88d03333f7ad3 Mon Sep 17 00:00:00 2001 From: Bui Quang Minh Date: Tue, 14 Dec 2021 22:28:27 +0700 Subject: [PATCH 083/249] sk-unix: Add support for SOCK_SEQPACKET unix sockets diff --git a/0084-zdtm-Add-SOCK_SEQPACKET-variants-to-unix-socket-test.patch b/0084-zdtm-Add-SOCK_SEQPACKET-variants-to-unix-socket-test.patch index 6e40de0..bedc6fd 100644 --- a/0084-zdtm-Add-SOCK_SEQPACKET-variants-to-unix-socket-test.patch +++ b/0084-zdtm-Add-SOCK_SEQPACKET-variants-to-unix-socket-test.patch @@ -1,4 +1,4 @@ -From 2d459717d161abb3330133a8f00ac7b4b9672c42 Mon Sep 17 00:00:00 2001 +From c68b20e449d8dac653b1a9f6a893416d2d38cc07 Mon Sep 17 00:00:00 2001 From: Bui Quang Minh Date: Thu, 16 Dec 2021 09:35:25 +0700 Subject: [PATCH 084/249] zdtm: Add SOCK_SEQPACKET variants to unix socket diff --git a/0085-tls-fix-typo.patch b/0085-tls-fix-typo.patch index 0824a2d..20fd0a5 100644 --- a/0085-tls-fix-typo.patch +++ b/0085-tls-fix-typo.patch @@ -1,4 +1,4 @@ -From 8bbfee99809952bf6eadd5e0142fe8b2e97cf6f6 Mon Sep 17 00:00:00 2001 +From a67c56da45910d3c07bdf54f2aecf43f57ca1451 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Tue, 7 Dec 2021 21:29:44 +0000 Subject: [PATCH 085/249] tls: fix typo diff --git a/0086-tls-use-ssize_t-for-return-value.patch b/0086-tls-use-ssize_t-for-return-value.patch index 7dc904f..316c23e 100644 --- a/0086-tls-use-ssize_t-for-return-value.patch +++ b/0086-tls-use-ssize_t-for-return-value.patch @@ -1,4 +1,4 @@ -From 311328d1c2a5715bd091ec6cad7cb0d32af99b26 Mon Sep 17 00:00:00 2001 +From 3b96f978beb40ebbd1b9b1610d1a2df5181d4bce Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Tue, 7 Dec 2021 22:32:54 +0000 Subject: [PATCH 086/249] tls: use ssize_t for return value diff --git a/0087-tls-add-more-comments.patch b/0087-tls-add-more-comments.patch index 2053693..93d3dc7 100644 --- a/0087-tls-add-more-comments.patch +++ b/0087-tls-add-more-comments.patch @@ -1,4 +1,4 @@ -From 5e48487aaf227c1e3be2b742956579c177e8b5bd Mon Sep 17 00:00:00 2001 +From f6760b9a2e3b714c63e838e7cb0262223a8d501e Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Thu, 16 Dec 2021 14:26:53 +0000 Subject: [PATCH 087/249] tls: add more comments diff --git a/0088-uffd-call-disconnect_from_page_server-to-shutdown-a-.patch b/0088-uffd-call-disconnect_from_page_server-to-shutdown-a-.patch index 53aad96..eb40201 100644 --- a/0088-uffd-call-disconnect_from_page_server-to-shutdown-a-.patch +++ b/0088-uffd-call-disconnect_from_page_server-to-shutdown-a-.patch @@ -1,4 +1,4 @@ -From 00f2efee03869d2494ed10333372eb401ab27546 Mon Sep 17 00:00:00 2001 +From 10199579ab5e5d95465d5e28fa5c72b5d782eebe Mon Sep 17 00:00:00 2001 From: Andrei Vagin Date: Tue, 21 Dec 2021 21:59:13 -0800 Subject: [PATCH 088/249] uffd: call disconnect_from_page_server to shutdown a diff --git a/0089-tls-allow-to-terminate-connections-synchronously.patch b/0089-tls-allow-to-terminate-connections-synchronously.patch index da4caec..d9bdbf0 100644 --- a/0089-tls-allow-to-terminate-connections-synchronously.patch +++ b/0089-tls-allow-to-terminate-connections-synchronously.patch @@ -1,4 +1,4 @@ -From 89c24a1324e6d77f064465bbd2b45d717b07d252 Mon Sep 17 00:00:00 2001 +From 8333e9dd1562b46fd0cb43ab22c9ac28e46ac66f Mon Sep 17 00:00:00 2001 From: Andrei Vagin Date: Wed, 22 Dec 2021 09:36:09 -0800 Subject: [PATCH 089/249] tls: allow to terminate connections synchronously diff --git a/0090-page-xfer-stop-waiting-for-a-new-command-after-a-clo.patch b/0090-page-xfer-stop-waiting-for-a-new-command-after-a-clo.patch index 3909e69..0dedf81 100644 --- a/0090-page-xfer-stop-waiting-for-a-new-command-after-a-clo.patch +++ b/0090-page-xfer-stop-waiting-for-a-new-command-after-a-clo.patch @@ -1,4 +1,4 @@ -From 02d8540a973ca5a045eac67c95cd3667ccb12579 Mon Sep 17 00:00:00 2001 +From 613839c7f2bd851abe9414849320ec2a4241eeb4 Mon Sep 17 00:00:00 2001 From: Andrei Vagin Date: Wed, 22 Dec 2021 09:59:11 -0800 Subject: [PATCH 090/249] page-xfer: stop waiting for a new command after a diff --git a/0091-ci-reenable-the-lazy-thp-test-in-the-lazy-remote-mod.patch b/0091-ci-reenable-the-lazy-thp-test-in-the-lazy-remote-mod.patch index 718e3d1..4dbff09 100644 --- a/0091-ci-reenable-the-lazy-thp-test-in-the-lazy-remote-mod.patch +++ b/0091-ci-reenable-the-lazy-thp-test-in-the-lazy-remote-mod.patch @@ -1,4 +1,4 @@ -From 5132edbd018755985e664b8a4ee230265ac8c1eb Mon Sep 17 00:00:00 2001 +From 9f50a9fb2a88db3d2853f514cddda84c3ff0d683 Mon Sep 17 00:00:00 2001 From: Andrei Vagin Date: Wed, 22 Dec 2021 17:03:04 -0800 Subject: [PATCH 091/249] ci: reenable the lazy-thp test in the lazy-remote diff --git a/0092-test-log-testname.out.inprogress-if-a-test-has-faile.patch b/0092-test-log-testname.out.inprogress-if-a-test-has-faile.patch index 10ab76c..7526386 100644 --- a/0092-test-log-testname.out.inprogress-if-a-test-has-faile.patch +++ b/0092-test-log-testname.out.inprogress-if-a-test-has-faile.patch @@ -1,4 +1,4 @@ -From e826db402697888e3cf4910fc9de6138c7e1dcf0 Mon Sep 17 00:00:00 2001 +From 18fa29e4cb67ffc395930c829809cb36921dac35 Mon Sep 17 00:00:00 2001 From: Andrei Vagin Date: Wed, 22 Dec 2021 17:06:21 -0800 Subject: [PATCH 092/249] test: log testname.out.inprogress if a test has diff --git a/0093-zdtm-print-tails-of-all-logs-if-a-test-has-failed.patch b/0093-zdtm-print-tails-of-all-logs-if-a-test-has-failed.patch index c000115..f595cd1 100644 --- a/0093-zdtm-print-tails-of-all-logs-if-a-test-has-failed.patch +++ b/0093-zdtm-print-tails-of-all-logs-if-a-test-has-failed.patch @@ -1,4 +1,4 @@ -From e7296cd2c631aec1b34b1411bd01b38b4a251b2b Mon Sep 17 00:00:00 2001 +From 6618fa96f8af67826b69bb49cb446579ce860693 Mon Sep 17 00:00:00 2001 From: Andrei Vagin Date: Wed, 22 Dec 2021 17:08:16 -0800 Subject: [PATCH 093/249] zdtm: print tails of all logs if a test has failed diff --git a/0094-zdtm-static-uffd-events-add-more-log-messages.patch b/0094-zdtm-static-uffd-events-add-more-log-messages.patch index 7aed029..70282a6 100644 --- a/0094-zdtm-static-uffd-events-add-more-log-messages.patch +++ b/0094-zdtm-static-uffd-events-add-more-log-messages.patch @@ -1,4 +1,4 @@ -From 32375bb1e4dd58c630f0e15e83c6056fffab7176 Mon Sep 17 00:00:00 2001 +From 9ca813c3237c4c3d5e0e09ed2358f5f1a1d43c1d Mon Sep 17 00:00:00 2001 From: Andrei Vagin Date: Wed, 22 Dec 2021 17:08:42 -0800 Subject: [PATCH 094/249] zdtm/static/uffd-events: add more log messages diff --git a/0095-mount-split-check_mountpoint_fd-from-__open_mountpoi.patch b/0095-mount-split-check_mountpoint_fd-from-__open_mountpoi.patch index 25c035b..902ea84 100644 --- a/0095-mount-split-check_mountpoint_fd-from-__open_mountpoi.patch +++ b/0095-mount-split-check_mountpoint_fd-from-__open_mountpoi.patch @@ -1,4 +1,4 @@ -From 609533a1d54d27fe96e4adad569716e70c38efa2 Mon Sep 17 00:00:00 2001 +From e88e3a0cf79d6625ed4f5e4ffd07a3ee6405fda4 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Fri, 17 Dec 2021 14:58:47 +0300 Subject: [PATCH 095/249] mount: split check_mountpoint_fd from diff --git a/0096-mount-remove-mnt_fd-argument-of-__open_mountpoint.patch b/0096-mount-remove-mnt_fd-argument-of-__open_mountpoint.patch index c2b19f6..427d870 100644 --- a/0096-mount-remove-mnt_fd-argument-of-__open_mountpoint.patch +++ b/0096-mount-remove-mnt_fd-argument-of-__open_mountpoint.patch @@ -1,4 +1,4 @@ -From 518f18aa83523d218073d100c4aa0f482ec60b53 Mon Sep 17 00:00:00 2001 +From 5258c8a15e46c2bf6614c6bd3cfb79463e640abe Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Fri, 17 Dec 2021 15:13:35 +0300 Subject: [PATCH 096/249] mount: remove mnt_fd argument of __open_mountpoint diff --git a/0097-proc_parse-add-helper-to-resolve-sdev-from-fd.patch b/0097-proc_parse-add-helper-to-resolve-sdev-from-fd.patch index 099f6bc..4627133 100644 --- a/0097-proc_parse-add-helper-to-resolve-sdev-from-fd.patch +++ b/0097-proc_parse-add-helper-to-resolve-sdev-from-fd.patch @@ -1,4 +1,4 @@ -From c573260ced3929d3c84d51e7073f3636d44ba69f Mon Sep 17 00:00:00 2001 +From 8b981b4b416781f6d1803a45eb2fc806cf0a9bab Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 16 Dec 2021 16:14:41 +0300 Subject: [PATCH 097/249] proc_parse: add helper to resolve sdev from fd diff --git a/0098-mount-btrfs-make-check_mountpoint_fd-fallback-to-get.patch b/0098-mount-btrfs-make-check_mountpoint_fd-fallback-to-get.patch index 1bc79e3..439c89a 100644 --- a/0098-mount-btrfs-make-check_mountpoint_fd-fallback-to-get.patch +++ b/0098-mount-btrfs-make-check_mountpoint_fd-fallback-to-get.patch @@ -1,4 +1,4 @@ -From 84b0b31a06a51f5620f53395c8496108879010af Mon Sep 17 00:00:00 2001 +From 1b1dc9023d1d169b75d19cc6770407b40589ee13 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 16 Dec 2021 12:57:23 +0300 Subject: [PATCH 098/249] mount/btrfs: make check_mountpoint_fd fallback to diff --git a/0099-ci-test-criu-image-streamer-with-all-tests.patch b/0099-ci-test-criu-image-streamer-with-all-tests.patch index b46fa0e..f1d50ea 100644 --- a/0099-ci-test-criu-image-streamer-with-all-tests.patch +++ b/0099-ci-test-criu-image-streamer-with-all-tests.patch @@ -1,4 +1,4 @@ -From b635de93ce372b8e3bea213ecd743e26251d7a9a Mon Sep 17 00:00:00 2001 +From d5b49695c55387f14748a8543aaba29c7aeacf0f Mon Sep 17 00:00:00 2001 From: Nicolas Viennot Date: Tue, 28 Dec 2021 19:30:09 +0000 Subject: [PATCH 099/249] ci: test criu-image-streamer with all tests diff --git a/0100-readme-add-docker-test-badge.patch b/0100-readme-add-docker-test-badge.patch index 437cbd6..16bbd29 100644 --- a/0100-readme-add-docker-test-badge.patch +++ b/0100-readme-add-docker-test-badge.patch @@ -1,4 +1,4 @@ -From dc89784e542bdbc034eb7503e25dd4d695b3242c Mon Sep 17 00:00:00 2001 +From 46b0679060e62da822f43b4a7fe061f03d5d6274 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Mon, 10 Jan 2022 10:37:19 +0000 Subject: [PATCH 100/249] readme: add docker test badge diff --git a/0101-contributing-remove-old-badges-and-logo.patch b/0101-contributing-remove-old-badges-and-logo.patch index 8908915..f390b60 100644 --- a/0101-contributing-remove-old-badges-and-logo.patch +++ b/0101-contributing-remove-old-badges-and-logo.patch @@ -1,4 +1,4 @@ -From 69f24c0a35c7980fdbedfcc1fe903ca0fe2e86c5 Mon Sep 17 00:00:00 2001 +From b09d362e4f2c4fe9fd8f1085285762a40bc70627 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Mon, 10 Jan 2022 10:37:52 +0000 Subject: [PATCH 101/249] contributing: remove old badges and logo diff --git a/0102-ci-update-to-latest-Vagrant-and-Fedora-images.patch b/0102-ci-update-to-latest-Vagrant-and-Fedora-images.patch index ce66485..6f687c4 100644 --- a/0102-ci-update-to-latest-Vagrant-and-Fedora-images.patch +++ b/0102-ci-update-to-latest-Vagrant-and-Fedora-images.patch @@ -1,4 +1,4 @@ -From 85648ff4af95a547c95a2afaf93a56bc059348af Mon Sep 17 00:00:00 2001 +From eb6062eef811fe062a7d2ce5745405b867559b05 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Fri, 3 Dec 2021 17:13:27 +0000 Subject: [PATCH 102/249] ci: update to latest Vagrant and Fedora images diff --git a/0103-ci-added-.lgtm.yml-file.patch b/0103-ci-added-.lgtm.yml-file.patch index a5c1b82..fdd9801 100644 --- a/0103-ci-added-.lgtm.yml-file.patch +++ b/0103-ci-added-.lgtm.yml-file.patch @@ -1,4 +1,4 @@ -From f697623efc8f8f050402c8009e7ac4c2f72a7d0d Mon Sep 17 00:00:00 2001 +From c465ad91379d1b33c5ee17cac4153865a152a67b Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Sun, 16 Jan 2022 11:17:33 +0000 Subject: [PATCH 103/249] ci: added .lgtm.yml file diff --git a/0104-lib-introduce-feature-check-in-libcriu.patch b/0104-lib-introduce-feature-check-in-libcriu.patch index 8a48f79..f0e3264 100644 --- a/0104-lib-introduce-feature-check-in-libcriu.patch +++ b/0104-lib-introduce-feature-check-in-libcriu.patch @@ -1,4 +1,4 @@ -From 421c8eab8f79ce4e70b34dcaa2e51524683e5cb3 Mon Sep 17 00:00:00 2001 +From c37c8a4ad0effe51f9b182f18bf2e761eaed1ebf Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Mon, 6 Dec 2021 16:51:21 +0000 Subject: [PATCH 104/249] lib: introduce feature check in libcriu diff --git a/0105-lib-added-tests-for-feature-check-in-libcriu.patch b/0105-lib-added-tests-for-feature-check-in-libcriu.patch index 3c5a491..653224e 100644 --- a/0105-lib-added-tests-for-feature-check-in-libcriu.patch +++ b/0105-lib-added-tests-for-feature-check-in-libcriu.patch @@ -1,4 +1,4 @@ -From 6fd677682716d80b3a082aba530e021e7c02b078 Mon Sep 17 00:00:00 2001 +From 2805df0ace12c0b92221a4644b48a95281300bae Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Mon, 6 Dec 2021 16:51:21 +0000 Subject: [PATCH 105/249] lib: added tests for feature check in libcriu diff --git a/0106-pagemap-tiny-fix-on-truncating-memory-image.patch b/0106-pagemap-tiny-fix-on-truncating-memory-image.patch index c845efb..427f177 100644 --- a/0106-pagemap-tiny-fix-on-truncating-memory-image.patch +++ b/0106-pagemap-tiny-fix-on-truncating-memory-image.patch @@ -1,4 +1,4 @@ -From 7bf62eb79d70296a375e98e1b7b241ad7faecb55 Mon Sep 17 00:00:00 2001 +From 5fbbd66aed7aa0b1d68614ec67aeefe49b8a0b36 Mon Sep 17 00:00:00 2001 From: Liu Hua Date: Thu, 6 Jan 2022 20:44:21 +0800 Subject: [PATCH 106/249] pagemap: tiny fix on truncating memory image diff --git a/0107-zdtm-fix-zdtm-static-maps00-case-in-arm64.patch b/0107-zdtm-fix-zdtm-static-maps00-case-in-arm64.patch index 33cd903..88aee4a 100644 --- a/0107-zdtm-fix-zdtm-static-maps00-case-in-arm64.patch +++ b/0107-zdtm-fix-zdtm-static-maps00-case-in-arm64.patch @@ -1,4 +1,4 @@ -From aae40f3a5307856e3409a4200c6cbafa624cbaec Mon Sep 17 00:00:00 2001 +From db82b08f0ab85161dbca45569f62a1a63218e48c Mon Sep 17 00:00:00 2001 From: "fu.lin" Date: Sun, 16 Jan 2022 18:37:09 +0800 Subject: [PATCH 107/249] zdtm: fix zdtm/static/maps00 case in arm64 diff --git a/0108-compel-fix-GCC-12-failure-out-of-bounds.patch b/0108-compel-fix-GCC-12-failure-out-of-bounds.patch index 109118d..21aa580 100644 --- a/0108-compel-fix-GCC-12-failure-out-of-bounds.patch +++ b/0108-compel-fix-GCC-12-failure-out-of-bounds.patch @@ -1,4 +1,4 @@ -From 81233d507af42ad79ef53eaaa60d1893ac19c2ef Mon Sep 17 00:00:00 2001 +From 415071fa73e78ad7dd5162a57da84599f6267f13 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Tue, 18 Jan 2022 16:49:40 +0000 Subject: [PATCH 108/249] compel: fix GCC 12 failure (out of bounds) diff --git a/0109-criu-fix-configuration-file-scanner-with-GCC-12.patch b/0109-criu-fix-configuration-file-scanner-with-GCC-12.patch index b8af6eb..67b4bee 100644 --- a/0109-criu-fix-configuration-file-scanner-with-GCC-12.patch +++ b/0109-criu-fix-configuration-file-scanner-with-GCC-12.patch @@ -1,4 +1,4 @@ -From 631997ebe61f261a240e804cf30e95d03f78582d Mon Sep 17 00:00:00 2001 +From 1a33a445c9b2b705f850f7a7c90279c160a663e7 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Tue, 18 Jan 2022 17:20:35 +0000 Subject: [PATCH 109/249] criu: fix configuration file scanner with GCC 12 diff --git a/0110-compel-fix-parasite-with-GCC-12.patch b/0110-compel-fix-parasite-with-GCC-12.patch index 7b036c3..316ec00 100644 --- a/0110-compel-fix-parasite-with-GCC-12.patch +++ b/0110-compel-fix-parasite-with-GCC-12.patch @@ -1,4 +1,4 @@ -From 72435f60d52ea5fe44ff330c6e30a1b9d05b74f2 Mon Sep 17 00:00:00 2001 +From f43400faacbe2faaca8e873646aa163bae334372 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Tue, 18 Jan 2022 17:22:46 +0000 Subject: [PATCH 110/249] compel: fix parasite with GCC 12 diff --git a/0111-ci-set-continue-on-error-for-cross-compile.patch b/0111-ci-set-continue-on-error-for-cross-compile.patch index d2d06a1..feb577b 100644 --- a/0111-ci-set-continue-on-error-for-cross-compile.patch +++ b/0111-ci-set-continue-on-error-for-cross-compile.patch @@ -1,4 +1,4 @@ -From 7093620c045e5ed3662031cc6a2f224efdc1ac98 Mon Sep 17 00:00:00 2001 +From c9836c658bb8ac32dec823b629396475e76e5582 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Thu, 27 Jan 2022 22:13:33 +0000 Subject: [PATCH 111/249] ci: set continue-on-error for cross-compile diff --git a/0112-test-autofs-fix-use-after-free.patch b/0112-test-autofs-fix-use-after-free.patch index 3cca450..798728a 100644 --- a/0112-test-autofs-fix-use-after-free.patch +++ b/0112-test-autofs-fix-use-after-free.patch @@ -1,4 +1,4 @@ -From 334ebaef9fb2cad0cb6de248ecc3fa75a9388fb3 Mon Sep 17 00:00:00 2001 +From a1a736f3e01f078565586535e5ef66777a4f2ffb Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Thu, 27 Jan 2022 14:49:41 +0000 Subject: [PATCH 112/249] test/autofs: fix use-after-free diff --git a/0113-Fix-formatting-in-criu-documentation.patch b/0113-Fix-formatting-in-criu-documentation.patch index 75a698b..f40c762 100644 --- a/0113-Fix-formatting-in-criu-documentation.patch +++ b/0113-Fix-formatting-in-criu-documentation.patch @@ -1,4 +1,4 @@ -From 46055022a6310a8d986d7351571ba6f04769624c Mon Sep 17 00:00:00 2001 +From ff22fbede563a983d28422d149d0cbb5a2db0fe6 Mon Sep 17 00:00:00 2001 From: Ashutosh Mehra Date: Wed, 26 Jan 2022 14:14:38 -0500 Subject: [PATCH 113/249] Fix formatting in criu documentation diff --git a/0114-ci-install-libbsd-dependency.patch b/0114-ci-install-libbsd-dependency.patch index 4d8787e..da15286 100644 --- a/0114-ci-install-libbsd-dependency.patch +++ b/0114-ci-install-libbsd-dependency.patch @@ -1,4 +1,4 @@ -From 29f504fd9a029142a985184bc7dc66894f9fa35a Mon Sep 17 00:00:00 2001 +From c1eca4505f709e32c0ead1ca42246fb1a844dc72 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Tue, 1 Feb 2022 15:59:14 +0000 Subject: [PATCH 114/249] ci: install libbsd dependency diff --git a/0115-pstree-when-updating-sid-for-shell-job-also-update-m.patch b/0115-pstree-when-updating-sid-for-shell-job-also-update-m.patch index 9e4a4b2..0edcffc 100644 --- a/0115-pstree-when-updating-sid-for-shell-job-also-update-m.patch +++ b/0115-pstree-when-updating-sid-for-shell-job-also-update-m.patch @@ -1,4 +1,4 @@ -From d4bd2e60758dc9ba7fced79350080cf0ca6f5fc0 Mon Sep 17 00:00:00 2001 +From 0aace1a0b90f67356876c6d3fcdf023d6cefcaf3 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 27 Jan 2022 10:28:29 +0300 Subject: [PATCH 115/249] pstree: when updating sid for shell job also update diff --git a/0116-criu-ns-fix-exit-code-o-for-criu-dump.patch b/0116-criu-ns-fix-exit-code-o-for-criu-dump.patch index 063396d..2884595 100644 --- a/0116-criu-ns-fix-exit-code-o-for-criu-dump.patch +++ b/0116-criu-ns-fix-exit-code-o-for-criu-dump.patch @@ -1,4 +1,4 @@ -From cc3b58c7c362cbaf43df574167f08897e8a80bd7 Mon Sep 17 00:00:00 2001 +From 2944fe4e6e8ec6472cf13caf680c44a763639c62 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Tue, 1 Feb 2022 13:44:42 +0000 Subject: [PATCH 116/249] criu-ns: fix exit code o for criu dump diff --git a/0117-criu-ns-use-os.waitstatus_to_exitcode.patch b/0117-criu-ns-use-os.waitstatus_to_exitcode.patch index 30f4d42..3ebf491 100644 --- a/0117-criu-ns-use-os.waitstatus_to_exitcode.patch +++ b/0117-criu-ns-use-os.waitstatus_to_exitcode.patch @@ -1,4 +1,4 @@ -From cae5b84f70476b931620670c94bcd47d76a5e32d Mon Sep 17 00:00:00 2001 +From 0a6ba0915b606dbb70e6d16fcf8be56edb63dedf Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Fri, 4 Feb 2022 20:41:07 +0000 Subject: [PATCH 117/249] criu-ns: use os.waitstatus_to_exitcode() diff --git a/0118-restorer-Fix-sys_mmap-s-returned-value-check.patch b/0118-restorer-Fix-sys_mmap-s-returned-value-check.patch index a4df36b..a6da412 100644 --- a/0118-restorer-Fix-sys_mmap-s-returned-value-check.patch +++ b/0118-restorer-Fix-sys_mmap-s-returned-value-check.patch @@ -1,4 +1,4 @@ -From 3fe8644e5bf60d6ab2ef7bfd09a87f156b2b41f0 Mon Sep 17 00:00:00 2001 +From fee94641cfb63d7387e3d396e055192b68f97223 Mon Sep 17 00:00:00 2001 From: Bui Quang Minh Date: Sat, 5 Feb 2022 14:23:38 +0700 Subject: [PATCH 118/249] restorer: Fix sys_mmap's returned value check diff --git a/0119-compel-fix-how-PTRACE_GET_THREAD_AREA-errors-are-han.patch b/0119-compel-fix-how-PTRACE_GET_THREAD_AREA-errors-are-han.patch index 5a92b49..539567b 100644 --- a/0119-compel-fix-how-PTRACE_GET_THREAD_AREA-errors-are-han.patch +++ b/0119-compel-fix-how-PTRACE_GET_THREAD_AREA-errors-are-han.patch @@ -1,4 +1,4 @@ -From fd30dd42a6ea39d1bde06fa51155e5f1bc286688 Mon Sep 17 00:00:00 2001 +From 5b03917d55de4d6ae0dbd95ef669eea68d89d76d Mon Sep 17 00:00:00 2001 From: Mike Rapoport Date: Sun, 13 Feb 2022 08:48:07 +0200 Subject: [PATCH 119/249] compel: fix how PTRACE_GET_THREAD_AREA errors are diff --git a/0120-util-add-an-unique-ID-of-the-current-criu-run.patch b/0120-util-add-an-unique-ID-of-the-current-criu-run.patch index f3dd064..a7d24ae 100644 --- a/0120-util-add-an-unique-ID-of-the-current-criu-run.patch +++ b/0120-util-add-an-unique-ID-of-the-current-criu-run.patch @@ -1,4 +1,4 @@ -From ac8b684c2cc8dafdcc7648ec4cea6f0b27dc2a71 Mon Sep 17 00:00:00 2001 +From 967129b32f8169a899b57312594b4dd876af4cfd Mon Sep 17 00:00:00 2001 From: Andrei Vagin Date: Sat, 12 Feb 2022 17:17:27 -0800 Subject: [PATCH 120/249] util: add an unique ID of the current criu run diff --git a/0121-files-generate-unique-transport-socket-names.patch b/0121-files-generate-unique-transport-socket-names.patch index c7028a6..8da243d 100644 --- a/0121-files-generate-unique-transport-socket-names.patch +++ b/0121-files-generate-unique-transport-socket-names.patch @@ -1,4 +1,4 @@ -From 518f6e6a84cb377d62b325f92f67596b6562a26d Mon Sep 17 00:00:00 2001 +From f036fdad44b63668cae8f90b2e427768d8f0ac91 Mon Sep 17 00:00:00 2001 From: Andrei Vagin Date: Sat, 12 Feb 2022 17:24:07 -0800 Subject: [PATCH 121/249] files: generate unique transport socket names diff --git a/0122-check-Add-a-check-for-using-memfd-with-hugetlb.patch b/0122-check-Add-a-check-for-using-memfd-with-hugetlb.patch index 7a264a2..0d9685d 100644 --- a/0122-check-Add-a-check-for-using-memfd-with-hugetlb.patch +++ b/0122-check-Add-a-check-for-using-memfd-with-hugetlb.patch @@ -1,4 +1,4 @@ -From bb95d4c4d2928f1124283742af5978bcd637b6b2 Mon Sep 17 00:00:00 2001 +From af22ba3014dfcfd7f8955496886ebc243375d864 Mon Sep 17 00:00:00 2001 From: Bui Quang Minh Date: Wed, 15 Dec 2021 22:15:21 +0700 Subject: [PATCH 122/249] check: Add a check for using memfd with hugetlb diff --git a/0123-kerndat-Collect-hugetlb-device-numbers.patch b/0123-kerndat-Collect-hugetlb-device-numbers.patch index 9387b02..333933a 100644 --- a/0123-kerndat-Collect-hugetlb-device-numbers.patch +++ b/0123-kerndat-Collect-hugetlb-device-numbers.patch @@ -1,4 +1,4 @@ -From 2eb37a63d8ba56dee5da7acc9f3ccf0cb1a97eb3 Mon Sep 17 00:00:00 2001 +From c2dbc30f7e141389494a6b3c2e4000add5019bf2 Mon Sep 17 00:00:00 2001 From: Bui Quang Minh Date: Wed, 15 Dec 2021 22:26:08 +0700 Subject: [PATCH 123/249] kerndat: Collect hugetlb device numbers diff --git a/0124-ipc-Add-support-for-checkpoint-restore-hugetlb-Syste.patch b/0124-ipc-Add-support-for-checkpoint-restore-hugetlb-Syste.patch index bf59b00..26274ca 100644 --- a/0124-ipc-Add-support-for-checkpoint-restore-hugetlb-Syste.patch +++ b/0124-ipc-Add-support-for-checkpoint-restore-hugetlb-Syste.patch @@ -1,4 +1,4 @@ -From c3015e3b6daa7159dfb66fd0595dbce342c95d12 Mon Sep 17 00:00:00 2001 +From 8398b233488b6e08cf69054cf25274b1ad815a00 Mon Sep 17 00:00:00 2001 From: Bui Quang Minh Date: Wed, 15 Dec 2021 22:53:09 +0700 Subject: [PATCH 124/249] ipc: Add support for checkpoint/restore hugetlb diff --git a/0125-memfd-shmem-Add-support-for-checkpoint-restore-memfd.patch b/0125-memfd-shmem-Add-support-for-checkpoint-restore-memfd.patch index f28c98f..31cbf6d 100644 --- a/0125-memfd-shmem-Add-support-for-checkpoint-restore-memfd.patch +++ b/0125-memfd-shmem-Add-support-for-checkpoint-restore-memfd.patch @@ -1,4 +1,4 @@ -From 18c10885c3cb1b39908361b9250330e21ebf119f Mon Sep 17 00:00:00 2001 +From 796f33af1f755e0d45b3e49920156e2d535c4d65 Mon Sep 17 00:00:00 2001 From: Bui Quang Minh Date: Wed, 15 Dec 2021 23:01:29 +0700 Subject: [PATCH 125/249] memfd, shmem: Add support for checkpoint/restore diff --git a/0126-proc_parse-files-Add-support-for-hugetlb-memory-mapp.patch b/0126-proc_parse-files-Add-support-for-hugetlb-memory-mapp.patch index 409d050..e5dd7ec 100644 --- a/0126-proc_parse-files-Add-support-for-hugetlb-memory-mapp.patch +++ b/0126-proc_parse-files-Add-support-for-hugetlb-memory-mapp.patch @@ -1,4 +1,4 @@ -From 3c7bb45946478e856b1c893948a0d2dba4cead20 Mon Sep 17 00:00:00 2001 +From 0cba2304c4796cda832d6e0b16ef2dc305fb6a13 Mon Sep 17 00:00:00 2001 From: Bui Quang Minh Date: Wed, 15 Dec 2021 23:03:29 +0700 Subject: [PATCH 126/249] proc_parse, files: Add support for hugetlb memory diff --git a/0127-mem-Skip-premapping-hugetlb-mapping.patch b/0127-mem-Skip-premapping-hugetlb-mapping.patch index 84b2991..3e67c32 100644 --- a/0127-mem-Skip-premapping-hugetlb-mapping.patch +++ b/0127-mem-Skip-premapping-hugetlb-mapping.patch @@ -1,4 +1,4 @@ -From 8ec1e04580b30bd0365839a4fef301e95c6c6f2d Mon Sep 17 00:00:00 2001 +From 307299bea57d25a41f5fba7b057d3926f4f1231b Mon Sep 17 00:00:00 2001 From: Bui Quang Minh Date: Wed, 9 Feb 2022 22:11:51 +0700 Subject: [PATCH 127/249] mem: Skip premapping hugetlb mapping diff --git a/0128-uffd-Skip-lazy-mode-restore-on-hugetlb-mappings.patch b/0128-uffd-Skip-lazy-mode-restore-on-hugetlb-mappings.patch index d5420b4..140313d 100644 --- a/0128-uffd-Skip-lazy-mode-restore-on-hugetlb-mappings.patch +++ b/0128-uffd-Skip-lazy-mode-restore-on-hugetlb-mappings.patch @@ -1,4 +1,4 @@ -From 70a0a2dd7257c6969f040e18e37c4d8eca4dc224 Mon Sep 17 00:00:00 2001 +From 5372cb96363fed0dbd4a7f1ea5da7979e4846466 Mon Sep 17 00:00:00 2001 From: Bui Quang Minh Date: Wed, 9 Feb 2022 22:12:53 +0700 Subject: [PATCH 128/249] uffd: Skip lazy-mode restore on hugetlb mappings diff --git a/0129-zdtm-Add-MAP_HUGETLB-memory-mapping-test.patch b/0129-zdtm-Add-MAP_HUGETLB-memory-mapping-test.patch index afe9e14..0d6149c 100644 --- a/0129-zdtm-Add-MAP_HUGETLB-memory-mapping-test.patch +++ b/0129-zdtm-Add-MAP_HUGETLB-memory-mapping-test.patch @@ -1,4 +1,4 @@ -From 94453cdd46f5791fe1ecd1fa1624233b95d00941 Mon Sep 17 00:00:00 2001 +From f2793fea9c36f1102186f34d47534287efda63f5 Mon Sep 17 00:00:00 2001 From: Bui Quang Minh Date: Tue, 26 Oct 2021 22:22:08 +0700 Subject: [PATCH 129/249] zdtm: Add MAP_HUGETLB memory mapping test diff --git a/0130-zdtm-Add-memfd-hugetlb-test.patch b/0130-zdtm-Add-memfd-hugetlb-test.patch index 3cd1d13..a3a7f4a 100644 --- a/0130-zdtm-Add-memfd-hugetlb-test.patch +++ b/0130-zdtm-Add-memfd-hugetlb-test.patch @@ -1,4 +1,4 @@ -From 44da7370c4fe39785d753c6de15caf782d75b7de Mon Sep 17 00:00:00 2001 +From be3340e0cc7dc4c77d3656f54d3be48b533a177d Mon Sep 17 00:00:00 2001 From: Bui Quang Minh Date: Tue, 26 Oct 2021 22:31:44 +0700 Subject: [PATCH 130/249] zdtm: Add memfd hugetlb test diff --git a/0131-zdtm-Add-shm-hugetlb-test.patch b/0131-zdtm-Add-shm-hugetlb-test.patch index 6d3cb02..da27eac 100644 --- a/0131-zdtm-Add-shm-hugetlb-test.patch +++ b/0131-zdtm-Add-shm-hugetlb-test.patch @@ -1,4 +1,4 @@ -From 78b113d4563c74a1fc320bfc84afc798c5c8ee91 Mon Sep 17 00:00:00 2001 +From dd448857444438c34793662ef472c76c2810e69d Mon Sep 17 00:00:00 2001 From: Bui Quang Minh Date: Tue, 26 Oct 2021 22:34:22 +0700 Subject: [PATCH 131/249] zdtm: Add shm hugetlb test diff --git a/0132-zdtm-Add-MAP_HUGETLB-mappings-test-for-parent-child-.patch b/0132-zdtm-Add-MAP_HUGETLB-mappings-test-for-parent-child-.patch index 3b86ab0..2498581 100644 --- a/0132-zdtm-Add-MAP_HUGETLB-mappings-test-for-parent-child-.patch +++ b/0132-zdtm-Add-MAP_HUGETLB-mappings-test-for-parent-child-.patch @@ -1,4 +1,4 @@ -From df3ab72beec7972abf925a10294f26529a81beff Mon Sep 17 00:00:00 2001 +From fa2ee21e42b9d1e1b5b328d1294bc34b941b6d56 Mon Sep 17 00:00:00 2001 From: Bui Quang Minh Date: Fri, 31 Dec 2021 17:15:18 +0700 Subject: [PATCH 132/249] zdtm: Add MAP_HUGETLB mappings test for parent-child diff --git a/0133-ci-skip-MAP_HUGETLB-tests-in-stream-test.patch b/0133-ci-skip-MAP_HUGETLB-tests-in-stream-test.patch index 2a3cd70..f96fb73 100644 --- a/0133-ci-skip-MAP_HUGETLB-tests-in-stream-test.patch +++ b/0133-ci-skip-MAP_HUGETLB-tests-in-stream-test.patch @@ -1,4 +1,4 @@ -From 316e3cfddad8409f3978bd7ffbd6bb42f04350e2 Mon Sep 17 00:00:00 2001 +From 9ac3812ec97c4b8d5d9ae0d27585a2319337a0f0 Mon Sep 17 00:00:00 2001 From: Bui Quang Minh Date: Sat, 12 Feb 2022 16:00:39 +0700 Subject: [PATCH 133/249] ci: skip MAP_HUGETLB tests in stream test diff --git a/0134-bpfmap-handle-new-field-in-fdinfo.patch b/0134-bpfmap-handle-new-field-in-fdinfo.patch index 07a6e44..faf064f 100644 --- a/0134-bpfmap-handle-new-field-in-fdinfo.patch +++ b/0134-bpfmap-handle-new-field-in-fdinfo.patch @@ -1,4 +1,4 @@ -From 9b35c3b51c0ea314a10d80f935f0b9e25ce20c80 Mon Sep 17 00:00:00 2001 +From fda874bd37f1dabb6756bf1b2cbc8b06ceeecae9 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Tue, 15 Feb 2022 16:55:45 +0000 Subject: [PATCH 134/249] bpfmap: handle new field in fdinfo diff --git a/0135-test-remove-test-for-LOCK_MAND-flock.patch b/0135-test-remove-test-for-LOCK_MAND-flock.patch index d0e7920..dde8a75 100644 --- a/0135-test-remove-test-for-LOCK_MAND-flock.patch +++ b/0135-test-remove-test-for-LOCK_MAND-flock.patch @@ -1,4 +1,4 @@ -From 1a89b19b66abc45c47c94bc078217af9dc676cac Mon Sep 17 00:00:00 2001 +From d87e53b6721e76839218791a8a2af87d1add7911 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Tue, 15 Feb 2022 17:01:32 +0000 Subject: [PATCH 135/249] test: remove test for LOCK_MAND flock diff --git a/0136-test-disable-rseq-also-on-Archlinux.patch b/0136-test-disable-rseq-also-on-Archlinux.patch index 010af0f..56bddac 100644 --- a/0136-test-disable-rseq-also-on-Archlinux.patch +++ b/0136-test-disable-rseq-also-on-Archlinux.patch @@ -1,4 +1,4 @@ -From e25f35ccb538c4b1542c608147c541efd2bf95c2 Mon Sep 17 00:00:00 2001 +From 171e7e8badc051a6375dfb091da1f4f5777457d2 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Tue, 15 Feb 2022 18:09:27 +0000 Subject: [PATCH 136/249] test: disable rseq also on Archlinux diff --git a/0137-zdtm-fix-missplacement-of-err-True.patch b/0137-zdtm-fix-missplacement-of-err-True.patch index 9c06413..bad17f6 100644 --- a/0137-zdtm-fix-missplacement-of-err-True.patch +++ b/0137-zdtm-fix-missplacement-of-err-True.patch @@ -1,4 +1,4 @@ -From 5aa1b1f48e5cd4186a70b7ce47ae23182e698b65 Mon Sep 17 00:00:00 2001 +From bc3ff0b0253ad5f8c1ab1b75707ee5bc397950e7 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Fri, 18 Feb 2022 18:13:14 +0300 Subject: [PATCH 137/249] zdtm: fix missplacement of err=True diff --git a/0138-compel-set-mxcsr-during-error-injection-to-zero.patch b/0138-compel-set-mxcsr-during-error-injection-to-zero.patch index 00cee3c..e32caf1 100644 --- a/0138-compel-set-mxcsr-during-error-injection-to-zero.patch +++ b/0138-compel-set-mxcsr-during-error-injection-to-zero.patch @@ -1,4 +1,4 @@ -From 89173abcebfe38f584f2340d1ce39437b3c22ff9 Mon Sep 17 00:00:00 2001 +From 4070d001c35654364a7af5d757e91e1db638970e Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Wed, 9 Mar 2022 08:40:35 +0000 Subject: [PATCH 138/249] compel: set mxcsr during error injection to zero diff --git a/0139-proc_smaps-remove-useless-nonlinear-check.patch b/0139-proc_smaps-remove-useless-nonlinear-check.patch index 6f9d011..9c5c980 100644 --- a/0139-proc_smaps-remove-useless-nonlinear-check.patch +++ b/0139-proc_smaps-remove-useless-nonlinear-check.patch @@ -1,4 +1,4 @@ -From ae84fbbcb525715a0d0915a0e4182d0702cd6bd0 Mon Sep 17 00:00:00 2001 +From 7f32e5fc410a6295a7ddbbf6eda62a577d7b940b Mon Sep 17 00:00:00 2001 From: anatasluo Date: Tue, 8 Mar 2022 08:34:14 +0000 Subject: [PATCH 139/249] proc_smaps: remove useless nonlinear check diff --git a/0140-mount-fix-e_str-leak-in-ext_mount_add.patch b/0140-mount-fix-e_str-leak-in-ext_mount_add.patch index 947d24d..8e81bb4 100644 --- a/0140-mount-fix-e_str-leak-in-ext_mount_add.patch +++ b/0140-mount-fix-e_str-leak-in-ext_mount_add.patch @@ -1,4 +1,4 @@ -From b6a0ee4f8146442d7fa382bdee669472267c49fa Mon Sep 17 00:00:00 2001 +From adb3b690cb4b2c46a38a780520fbec1afec3f464 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Wed, 9 Mar 2022 14:32:25 +0300 Subject: [PATCH 140/249] mount: fix e_str leak in ext_mount_add diff --git a/0141-cr-dump-fix-cr_imgset-leak-in-dump_one_task.patch b/0141-cr-dump-fix-cr_imgset-leak-in-dump_one_task.patch index 0702751..a71f590 100644 --- a/0141-cr-dump-fix-cr_imgset-leak-in-dump_one_task.patch +++ b/0141-cr-dump-fix-cr_imgset-leak-in-dump_one_task.patch @@ -1,4 +1,4 @@ -From 7fc272fc191fb2b909a6bc623ff75ea688fe2864 Mon Sep 17 00:00:00 2001 +From 127c80e070b650958793fd9967d18fca3aa93594 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Wed, 9 Mar 2022 15:14:50 +0300 Subject: [PATCH 141/249] cr-dump: fix cr_imgset leak in dump_one_task diff --git a/0142-tun-fix-tun_link-leak-in-dump_tun_link.patch b/0142-tun-fix-tun_link-leak-in-dump_tun_link.patch index 3009d42..282ca0a 100644 --- a/0142-tun-fix-tun_link-leak-in-dump_tun_link.patch +++ b/0142-tun-fix-tun_link-leak-in-dump_tun_link.patch @@ -1,4 +1,4 @@ -From 8f2244a4c1d655e101f5dd0f790c56df7f0835dd Mon Sep 17 00:00:00 2001 +From 1b75d6dc2c1bf12bc9fdbb6093f8e6a6e469fea4 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Wed, 9 Mar 2022 13:52:00 +0300 Subject: [PATCH 142/249] tun: fix tun_link leak in dump_tun_link diff --git a/0143-sk-unix-fix-uint32_t-id-variable-printf-format-speci.patch b/0143-sk-unix-fix-uint32_t-id-variable-printf-format-speci.patch index b4c1239..89a1035 100644 --- a/0143-sk-unix-fix-uint32_t-id-variable-printf-format-speci.patch +++ b/0143-sk-unix-fix-uint32_t-id-variable-printf-format-speci.patch @@ -1,4 +1,4 @@ -From 7399d1957001be0af6291c4168602ae154207677 Mon Sep 17 00:00:00 2001 +From 7606fae91db532ba535799764a04de75598a4e59 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 10 Mar 2022 13:35:50 +0300 Subject: [PATCH 143/249] sk-unix: fix uint32_t id variable printf format diff --git a/0144-zdtm-refactor-main.patch b/0144-zdtm-refactor-main.patch index 7399615..f7e3886 100644 --- a/0144-zdtm-refactor-main.patch +++ b/0144-zdtm-refactor-main.patch @@ -1,4 +1,4 @@ -From 4bf7f3e1dfb0d01e59dd6f9af1b945018b1df034 Mon Sep 17 00:00:00 2001 +From e2ddf69cb3dd07c084a6f62f26638cbe4b29d6ae Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Sat, 24 Jul 2021 12:19:22 +0100 Subject: [PATCH 144/249] zdtm: refactor main diff --git a/0145-zdtm-sort-import-lines.patch b/0145-zdtm-sort-import-lines.patch index a0510a7..ff900fa 100644 --- a/0145-zdtm-sort-import-lines.patch +++ b/0145-zdtm-sort-import-lines.patch @@ -1,4 +1,4 @@ -From c2f8e185938863082efbd525fabef22d6b719cb3 Mon Sep 17 00:00:00 2001 +From d96e617d0374ea0b660b9b97ef5f81adeac29b3e Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Sun, 15 Aug 2021 10:27:37 +0100 Subject: [PATCH 145/249] zdtm: sort import lines diff --git a/0146-zdtm-use-long-form-cli-options.patch b/0146-zdtm-use-long-form-cli-options.patch index 4765f2d..b1f53e5 100644 --- a/0146-zdtm-use-long-form-cli-options.patch +++ b/0146-zdtm-use-long-form-cli-options.patch @@ -1,4 +1,4 @@ -From fa4b4f7103804f3995cace5e4405894737f4ff4a Mon Sep 17 00:00:00 2001 +From 3ca5c1a6d43be4e21c2db457ed6963049b56b594 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Sun, 15 Aug 2021 10:53:29 +0100 Subject: [PATCH 146/249] zdtm: use long form cli options diff --git a/0147-zdtm-add-criu-config-option.patch b/0147-zdtm-add-criu-config-option.patch index 6494ba5..ea8f054 100644 --- a/0147-zdtm-add-criu-config-option.patch +++ b/0147-zdtm-add-criu-config-option.patch @@ -1,4 +1,4 @@ -From 3facb361f138a484effb064215fe1b7d45796d6b Mon Sep 17 00:00:00 2001 +From 37f9d07f8d4dd955d0cc4bf8d08adcff01ba5001 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Sun, 15 Aug 2021 10:58:32 +0100 Subject: [PATCH 147/249] zdtm: add --criu-config option diff --git a/0148-zdtm-drop-redundant-config_inotify_irmap-test.patch b/0148-zdtm-drop-redundant-config_inotify_irmap-test.patch index d8d7422..d96aa88 100644 --- a/0148-zdtm-drop-redundant-config_inotify_irmap-test.patch +++ b/0148-zdtm-drop-redundant-config_inotify_irmap-test.patch @@ -1,4 +1,4 @@ -From b69701e308743135e86d461cb66cd807ed2c0fc2 Mon Sep 17 00:00:00 2001 +From 29a1d9868d8e0f1de630cb31e3687db24636118f Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Sun, 15 Aug 2021 11:16:28 +0100 Subject: [PATCH 148/249] zdtm: drop redundant config_inotify_irmap test diff --git a/0149-ci-run-criu-config-tests.patch b/0149-ci-run-criu-config-tests.patch index d8c5f2b..fa4863a 100644 --- a/0149-ci-run-criu-config-tests.patch +++ b/0149-ci-run-criu-config-tests.patch @@ -1,4 +1,4 @@ -From 3fd1487983c59bbf17e45484ceb42011e5d74eda Mon Sep 17 00:00:00 2001 +From 8ae1b00522e779c332145d3d6f33980c3b91aa4d Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Sun, 15 Aug 2021 11:29:22 +0100 Subject: [PATCH 149/249] ci: run criu-config tests diff --git a/0150-config-fix-ns-leak-in-parse_join_ns.patch b/0150-config-fix-ns-leak-in-parse_join_ns.patch index c6f3828..e23bcc2 100644 --- a/0150-config-fix-ns-leak-in-parse_join_ns.patch +++ b/0150-config-fix-ns-leak-in-parse_join_ns.patch @@ -1,4 +1,4 @@ -From 96fdf556f85dc13067e265ec8227ebdeb71ec068 Mon Sep 17 00:00:00 2001 +From b34fb0f1945c771a2d7d5e472d63bb763a0991f5 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 10 Mar 2022 14:15:23 +0300 Subject: [PATCH 150/249] config: fix ns leak in parse_join_ns diff --git a/0151-net-fix-e_str-leak-in-veth_pair_add.patch b/0151-net-fix-e_str-leak-in-veth_pair_add.patch index 3aa88c6..3536d94 100644 --- a/0151-net-fix-e_str-leak-in-veth_pair_add.patch +++ b/0151-net-fix-e_str-leak-in-veth_pair_add.patch @@ -1,4 +1,4 @@ -From fc4b654c9264ee5cb48437a96293695d05b89e5b Mon Sep 17 00:00:00 2001 +From 31fc58737e0ee24bb2438d76ab37311e52d4b2a3 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Fri, 11 Mar 2022 19:57:06 +0300 Subject: [PATCH 151/249] net: fix e_str leak in veth_pair_add diff --git a/0152-files-fix-inh-leak-in-inherit_fd_add.patch b/0152-files-fix-inh-leak-in-inherit_fd_add.patch index 18111e9..7212043 100644 --- a/0152-files-fix-inh-leak-in-inherit_fd_add.patch +++ b/0152-files-fix-inh-leak-in-inherit_fd_add.patch @@ -1,4 +1,4 @@ -From 711c1fb9385678320572e8bc35a6342d435cb2ba Mon Sep 17 00:00:00 2001 +From 8b4b1107d3aa7ca0286da93b2a1c17b0d2031dfa Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Fri, 11 Mar 2022 18:45:37 +0300 Subject: [PATCH 152/249] files: fix inh leak in inherit_fd_add diff --git a/0153-sk-unix-fix-e_str-leak-in-unix_sk_id_add.patch b/0153-sk-unix-fix-e_str-leak-in-unix_sk_id_add.patch index 31362fe..f7f9980 100644 --- a/0153-sk-unix-fix-e_str-leak-in-unix_sk_id_add.patch +++ b/0153-sk-unix-fix-e_str-leak-in-unix_sk_id_add.patch @@ -1,4 +1,4 @@ -From dac5689422ed1422f33bf6a39b929f3f40d4c86b Mon Sep 17 00:00:00 2001 +From 2dea9c7e8bf225a132999c4ab7117ebc6ab4ec40 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Fri, 11 Mar 2022 18:36:55 +0300 Subject: [PATCH 153/249] sk-unix: fix e_str leak in unix_sk_id_add diff --git a/0154-uffd-fix-__u64-print-format-specifier.patch b/0154-uffd-fix-__u64-print-format-specifier.patch index a453bd5..e1e06cb 100644 --- a/0154-uffd-fix-__u64-print-format-specifier.patch +++ b/0154-uffd-fix-__u64-print-format-specifier.patch @@ -1,4 +1,4 @@ -From d13ed3d1c42afcff082517c08acd825558966127 Mon Sep 17 00:00:00 2001 +From 22c0a189c600b774b832d25958775b503179aa20 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Fri, 11 Mar 2022 17:31:07 +0300 Subject: [PATCH 154/249] uffd: fix __u64 print format specifier diff --git a/0155-zdtm-fix-mnt_ext_master-test-to-correspond-to-it-s-n.patch b/0155-zdtm-fix-mnt_ext_master-test-to-correspond-to-it-s-n.patch index 87fdfa1..54f4a99 100644 --- a/0155-zdtm-fix-mnt_ext_master-test-to-correspond-to-it-s-n.patch +++ b/0155-zdtm-fix-mnt_ext_master-test-to-correspond-to-it-s-n.patch @@ -1,4 +1,4 @@ -From b54f9f22e379da0fba7e8f84265e9af50d0a9dc7 Mon Sep 17 00:00:00 2001 +From d243470ea0e02c7fbdce4504c89b616fe995aaf4 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Mon, 30 Dec 2019 16:17:54 +0300 Subject: [PATCH 155/249] zdtm: fix mnt_ext_master test to correspond to it's diff --git a/0156-mount-add-mntinfo_add_list_before-helper-for-adding-.patch b/0156-mount-add-mntinfo_add_list_before-helper-for-adding-.patch index 1bb7e96..01e77f3 100644 --- a/0156-mount-add-mntinfo_add_list_before-helper-for-adding-.patch +++ b/0156-mount-add-mntinfo_add_list_before-helper-for-adding-.patch @@ -1,4 +1,4 @@ -From e9d53beca393b683e86ed5c5695412317616b1a1 Mon Sep 17 00:00:00 2001 +From d3dae3d5e2ec2ab1532bfaf7cc3b11654ec155a2 Mon Sep 17 00:00:00 2001 From: Alexander Mikhalitsyn Date: Sun, 12 Apr 2020 20:53:54 +0300 Subject: [PATCH 156/249] mount: add mntinfo_add_list_before helper for adding diff --git a/0157-mount-do-not-detect-non-fsroot-mounts-as-device-exte.patch b/0157-mount-do-not-detect-non-fsroot-mounts-as-device-exte.patch index e352ded..99a36ee 100644 --- a/0157-mount-do-not-detect-non-fsroot-mounts-as-device-exte.patch +++ b/0157-mount-do-not-detect-non-fsroot-mounts-as-device-exte.patch @@ -1,4 +1,4 @@ -From ff991f4b5f369640408887dd7e2c9bc1c9ccc53b Mon Sep 17 00:00:00 2001 +From 6990d6a53df2464094ff35210936827d529bbf0c Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 16 Jan 2020 12:36:08 +0300 Subject: [PATCH 157/249] mount: do not detect non-fsroot mounts as diff --git a/0158-mount-mark-mounts-of-external-devices-external.patch b/0158-mount-mark-mounts-of-external-devices-external.patch index 7f5742e..39059f0 100644 --- a/0158-mount-mark-mounts-of-external-devices-external.patch +++ b/0158-mount-mark-mounts-of-external-devices-external.patch @@ -1,4 +1,4 @@ -From 8e1769318b436a69a67e399e432cc0436abf4298 Mon Sep 17 00:00:00 2001 +From fc17357c0215e15ce5e00e6fd7cf70f0245ce805 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Mon, 16 Sep 2019 18:07:32 +0300 Subject: [PATCH 158/249] mount: mark mounts of external devices external diff --git a/0159-mount-skip-fstype-and-source-checks-for-external-mou.patch b/0159-mount-skip-fstype-and-source-checks-for-external-mou.patch index 3204c35..b9decea 100644 --- a/0159-mount-skip-fstype-and-source-checks-for-external-mou.patch +++ b/0159-mount-skip-fstype-and-source-checks-for-external-mou.patch @@ -1,4 +1,4 @@ -From c2396a5fb549f186e6f5f0031e492143d01cc949 Mon Sep 17 00:00:00 2001 +From 602bbfea26532b8f7787a6e084231a25afe1b3c7 Mon Sep 17 00:00:00 2001 From: Alexander Mikhalitsyn Date: Tue, 21 Apr 2020 18:12:00 +0300 Subject: [PATCH 159/249] mount: skip fstype and source checks for external diff --git a/0160-mount-setup-mnt_bind-list-before-using-it-in-mnt_is_.patch b/0160-mount-setup-mnt_bind-list-before-using-it-in-mnt_is_.patch index db98818..e7878e5 100644 --- a/0160-mount-setup-mnt_bind-list-before-using-it-in-mnt_is_.patch +++ b/0160-mount-setup-mnt_bind-list-before-using-it-in-mnt_is_.patch @@ -1,4 +1,4 @@ -From 2b57250db0bec7e396a531c24145ecd07334a402 Mon Sep 17 00:00:00 2001 +From 9cc10e89aa8d1b54f71c2e51c203fcab34bc8b65 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Fri, 20 Dec 2019 17:26:07 +0300 Subject: [PATCH 160/249] mount: setup mnt_bind list before using it in diff --git a/0161-util-add-get_relative_path-helper.patch b/0161-util-add-get_relative_path-helper.patch index 92ae5ba..5b4a914 100644 --- a/0161-util-add-get_relative_path-helper.patch +++ b/0161-util-add-get_relative_path-helper.patch @@ -1,4 +1,4 @@ -From eabcda449fa87d3e1e3060528a316988bbf5b748 Mon Sep 17 00:00:00 2001 +From 0cffe29ffba7f1363bdaf550347396eb90c6c1e9 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 14 May 2020 13:50:20 +0300 Subject: [PATCH 161/249] util: add get_relative_path helper diff --git a/0162-unittest-add-some-tests-for-get_relative_path-helper.patch b/0162-unittest-add-some-tests-for-get_relative_path-helper.patch index 6acfc49..f8fff5b 100644 --- a/0162-unittest-add-some-tests-for-get_relative_path-helper.patch +++ b/0162-unittest-add-some-tests-for-get_relative_path-helper.patch @@ -1,4 +1,4 @@ -From 9cb726827941e24a5e9f0ed12680d4b69e10551c Mon Sep 17 00:00:00 2001 +From b3ddb46a0f5d91320f0901cd47e26e3c89a2bcc4 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Wed, 19 Jan 2022 12:34:51 +0300 Subject: [PATCH 162/249] unittest: add some tests for get_relative_path helper diff --git a/0163-mount-add-mnt_bind_pick-helper-to-pick-the-desired-b.patch b/0163-mount-add-mnt_bind_pick-helper-to-pick-the-desired-b.patch index 805af27..9acf5fe 100644 --- a/0163-mount-add-mnt_bind_pick-helper-to-pick-the-desired-b.patch +++ b/0163-mount-add-mnt_bind_pick-helper-to-pick-the-desired-b.patch @@ -1,4 +1,4 @@ -From 5a8c2335b2f5ede7faa1b7d38a12a4610d0b2374 Mon Sep 17 00:00:00 2001 +From 043054396886bf7c1fc85a4e51bbf35aad6a47fb Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Mon, 29 Nov 2021 12:54:51 +0300 Subject: [PATCH 163/249] mount: add mnt_bind_pick helper to pick the desired diff --git a/0164-mount-split-mnt_is_external-_bind-and-can_receive_ma.patch b/0164-mount-split-mnt_is_external-_bind-and-can_receive_ma.patch index 51de7ff..f957c86 100644 --- a/0164-mount-split-mnt_is_external-_bind-and-can_receive_ma.patch +++ b/0164-mount-split-mnt_is_external-_bind-and-can_receive_ma.patch @@ -1,4 +1,4 @@ -From 05b68230b794d7f16453c6241c90b005d0b277aa Mon Sep 17 00:00:00 2001 +From 0279af775209d9c77cac457deaf927e2a14be126 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Wed, 18 Dec 2019 13:45:22 +0300 Subject: [PATCH 164/249] mount: split mnt_is_external(_bind) and diff --git a/0165-mount-rework-skipping-external-mounts-in-dump_one_mo.patch b/0165-mount-rework-skipping-external-mounts-in-dump_one_mo.patch index 422f85b..0b6f898 100644 --- a/0165-mount-rework-skipping-external-mounts-in-dump_one_mo.patch +++ b/0165-mount-rework-skipping-external-mounts-in-dump_one_mo.patch @@ -1,4 +1,4 @@ -From 9a5362e9160a14fb35c709f7b1862c27caa9dac2 Mon Sep 17 00:00:00 2001 +From 144368adc5472f96fa8f5e9209e56db23a6f5dc5 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Wed, 12 Jan 2022 13:34:39 +0300 Subject: [PATCH 165/249] mount: rework skipping external mounts in diff --git a/0166-mount-show-more-info-about-why-we-can-t-mount.patch b/0166-mount-show-more-info-about-why-we-can-t-mount.patch index 0e672d2..2abffc0 100644 --- a/0166-mount-show-more-info-about-why-we-can-t-mount.patch +++ b/0166-mount-show-more-info-about-why-we-can-t-mount.patch @@ -1,4 +1,4 @@ -From 43ff6e839fd1a7802075193b1534cc4ae1ea96fb Mon Sep 17 00:00:00 2001 +From d97b7cce246e7c5615ffac0f4df6b509f13bf66e Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 12 Sep 2019 10:10:37 +0300 Subject: [PATCH 166/249] mount: show more info about why we can't mount diff --git a/0167-mount-mount-external-mount-before-mounting-it-s-bind.patch b/0167-mount-mount-external-mount-before-mounting-it-s-bind.patch index ffbc7b6..79067a3 100644 --- a/0167-mount-mount-external-mount-before-mounting-it-s-bind.patch +++ b/0167-mount-mount-external-mount-before-mounting-it-s-bind.patch @@ -1,4 +1,4 @@ -From f24aa442f004730f4994e667dd0d794a00427c48 Mon Sep 17 00:00:00 2001 +From 69deac23b1eaf0809aed65d991985b06324e0bd1 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Mon, 17 Feb 2020 11:58:41 +0300 Subject: [PATCH 167/249] mount: mount external mount before mounting it's diff --git a/0168-zdtm-add-new-mnt_ext_root-test.patch b/0168-zdtm-add-new-mnt_ext_root-test.patch index c4b45c0..e6a6db3 100644 --- a/0168-zdtm-add-new-mnt_ext_root-test.patch +++ b/0168-zdtm-add-new-mnt_ext_root-test.patch @@ -1,4 +1,4 @@ -From f59efe89bcc72c7104e08cad64b47d03e098bcca Mon Sep 17 00:00:00 2001 +From 3568904e11811e3ff8831810e5013fe3e925322e Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Tue, 18 Feb 2020 13:41:18 +0300 Subject: [PATCH 168/249] zdtm: add new mnt_ext_root test diff --git a/0169-mount-restrict-mp-external-mount-map-to-init-contain.patch b/0169-mount-restrict-mp-external-mount-map-to-init-contain.patch index d54a606..f07e1db 100644 --- a/0169-mount-restrict-mp-external-mount-map-to-init-contain.patch +++ b/0169-mount-restrict-mp-external-mount-map-to-init-contain.patch @@ -1,4 +1,4 @@ -From 0744a30a70c96f6d4de0577c354ec682220ec2e3 Mon Sep 17 00:00:00 2001 +From 23fecb92464ed85436b60fe2fc484bb02d0a7674 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Fri, 26 Nov 2021 12:53:41 +0300 Subject: [PATCH 169/249] mount: restrict mp-external mount map to init diff --git a/0170-zdtm-add-mnt_ext_collision-test.patch b/0170-zdtm-add-mnt_ext_collision-test.patch index 994549d..e4ac88f 100644 --- a/0170-zdtm-add-mnt_ext_collision-test.patch +++ b/0170-zdtm-add-mnt_ext_collision-test.patch @@ -1,4 +1,4 @@ -From 0e4b310a3a2af3aa6b33c07f402f5a46aa1e51b5 Mon Sep 17 00:00:00 2001 +From 528a9ee1e4999063f0837f0096dcb22b22e7ad79 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Wed, 12 Jan 2022 16:00:56 +0300 Subject: [PATCH 170/249] zdtm: add mnt_ext_collision test diff --git a/0171-mount-add-mnt_is_root_bind-helper.patch b/0171-mount-add-mnt_is_root_bind-helper.patch index b4686eb..11a1f20 100644 --- a/0171-mount-add-mnt_is_root_bind-helper.patch +++ b/0171-mount-add-mnt_is_root_bind-helper.patch @@ -1,4 +1,4 @@ -From 8cf73188d2ce803a13712a10e9894efed7d32123 Mon Sep 17 00:00:00 2001 +From dc0bb734ffe7878140a3ba73aa08c522ec145997 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Fri, 8 May 2020 14:33:13 +0300 Subject: [PATCH 171/249] mount: add mnt_is_root_bind helper diff --git a/0172-mount-allow-nested-mount-namespaces-with-different-r.patch b/0172-mount-allow-nested-mount-namespaces-with-different-r.patch index d887842..0bf7085 100644 --- a/0172-mount-allow-nested-mount-namespaces-with-different-r.patch +++ b/0172-mount-allow-nested-mount-namespaces-with-different-r.patch @@ -1,4 +1,4 @@ -From b775febb36915afcd6e6d320a6c30f08c433c4f0 Mon Sep 17 00:00:00 2001 +From 7dcab4878092b309bb3a4447e582be031bc0eedd Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Mon, 27 Apr 2020 18:24:54 +0300 Subject: [PATCH 172/249] mount: allow nested mount namespaces with different diff --git a/0173-zdtm-add-mntns_pivot_root-test.patch b/0173-zdtm-add-mntns_pivot_root-test.patch index 4a0ef6d..c56fa1d 100644 --- a/0173-zdtm-add-mntns_pivot_root-test.patch +++ b/0173-zdtm-add-mntns_pivot_root-test.patch @@ -1,4 +1,4 @@ -From bde8ec21a973e0cb129fa9214a17b8ce91cf8a41 Mon Sep 17 00:00:00 2001 +From 7de207a821b7c3e5aec9defb4c912a09557fe499 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Wed, 12 Jan 2022 19:30:07 +0300 Subject: [PATCH 173/249] zdtm: add mntns_pivot_root test diff --git a/0174-mount-apply-superblock-flags-to-nested-ns-roots.patch b/0174-mount-apply-superblock-flags-to-nested-ns-roots.patch index cd9c4ee..2b39d6e 100644 --- a/0174-mount-apply-superblock-flags-to-nested-ns-roots.patch +++ b/0174-mount-apply-superblock-flags-to-nested-ns-roots.patch @@ -1,4 +1,4 @@ -From af12f2ef7c38bc06cd9ce43b7feb40bc968ec251 Mon Sep 17 00:00:00 2001 +From 9c142576cc1d3a399696e65ffeac4d89768aea3f Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Wed, 27 May 2020 13:43:49 +0300 Subject: [PATCH 174/249] mount: apply superblock flags to nested ns roots diff --git a/0175-zdtm-add-mntns_pivot_root_ro-test.patch b/0175-zdtm-add-mntns_pivot_root_ro-test.patch index 1a5f14d..732db5d 100644 --- a/0175-zdtm-add-mntns_pivot_root_ro-test.patch +++ b/0175-zdtm-add-mntns_pivot_root_ro-test.patch @@ -1,4 +1,4 @@ -From 432f84d74bed3ef0edd2d9271c1b6f3e681fc9ca Mon Sep 17 00:00:00 2001 +From dbf28040db2c4b956bdc5352f8cf62d8d1ddd53d Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 13 Jan 2022 10:46:44 +0300 Subject: [PATCH 175/249] zdtm: add mntns_pivot_root_ro test diff --git a/0176-mount-restore-create-auxiliary-binfmt_misc-mount-in-.patch b/0176-mount-restore-create-auxiliary-binfmt_misc-mount-in-.patch index 3bfa274..e0ee71f 100644 --- a/0176-mount-restore-create-auxiliary-binfmt_misc-mount-in-.patch +++ b/0176-mount-restore-create-auxiliary-binfmt_misc-mount-in-.patch @@ -1,4 +1,4 @@ -From 764cb9f4074b0a4378a80036e7fd8c6a3b0e668c Mon Sep 17 00:00:00 2001 +From c84fda15593f2f7ebb2a2796906e5b4081738b24 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Tue, 23 Jul 2019 18:33:59 +0300 Subject: [PATCH 176/249] mount/restore: create auxiliary binfmt_misc mount in diff --git a/0177-mount-restore-leave-ns_mountpoint-NULL-for-aux-binfm.patch b/0177-mount-restore-leave-ns_mountpoint-NULL-for-aux-binfm.patch index 17c45ea..f2526ee 100644 --- a/0177-mount-restore-leave-ns_mountpoint-NULL-for-aux-binfm.patch +++ b/0177-mount-restore-leave-ns_mountpoint-NULL-for-aux-binfm.patch @@ -1,4 +1,4 @@ -From 3d86ba5d0a0d5acdcfcc18ec6e0f9f95f9f934d2 Mon Sep 17 00:00:00 2001 +From 7c0606edbb177b4f704f3abeb03f0de81f4cbbb6 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 13 Jan 2022 17:45:46 +0300 Subject: [PATCH 177/249] mount/restore: leave ns_mountpoint NULL for aux diff --git a/0178-mount-replace-CRTIME_MNT_ID-with-HELPER_MNT_ID.patch b/0178-mount-replace-CRTIME_MNT_ID-with-HELPER_MNT_ID.patch index b100f8e..d06528e 100644 --- a/0178-mount-replace-CRTIME_MNT_ID-with-HELPER_MNT_ID.patch +++ b/0178-mount-replace-CRTIME_MNT_ID-with-HELPER_MNT_ID.patch @@ -1,4 +1,4 @@ -From 63f702594183d1bd5a08cabb0751f63acc94902d Mon Sep 17 00:00:00 2001 +From f19d829e45a67ee5a8a8465ba0e92b291f6059b9 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 7 May 2020 16:13:02 +0300 Subject: [PATCH 178/249] mount: replace CRTIME_MNT_ID with HELPER_MNT_ID diff --git a/0179-mount-add-can_receive_master_from_root-helper.patch b/0179-mount-add-can_receive_master_from_root-helper.patch index c57396f..0ffb625 100644 --- a/0179-mount-add-can_receive_master_from_root-helper.patch +++ b/0179-mount-add-can_receive_master_from_root-helper.patch @@ -1,4 +1,4 @@ -From 46386c3566ad82f17c96048a275b5ba4c2475fa9 Mon Sep 17 00:00:00 2001 +From eb6198c4c7ed22665c0013874fe6b4615f88f3d0 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 30 Dec 2021 15:24:30 +0300 Subject: [PATCH 179/249] mount: add can_receive_master_from_root helper diff --git a/0180-mount-put-external-slavery-mounts-to-separate-mnt_ex.patch b/0180-mount-put-external-slavery-mounts-to-separate-mnt_ex.patch index 2e1bcb8..22ee608 100644 --- a/0180-mount-put-external-slavery-mounts-to-separate-mnt_ex.patch +++ b/0180-mount-put-external-slavery-mounts-to-separate-mnt_ex.patch @@ -1,4 +1,4 @@ -From f08c3b899fbaf2e4b0f496cfdfa1cc5523161c80 Mon Sep 17 00:00:00 2001 +From d797005a68cec3b4a87fc60735441715682a42a4 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 20 Feb 2020 10:50:42 +0300 Subject: [PATCH 180/249] mount: put external slavery mounts to separate diff --git a/0181-mount-do-not-override-master_id-to-1-for-root-binds.patch b/0181-mount-do-not-override-master_id-to-1-for-root-binds.patch index ddaf9c6..95e28b6 100644 --- a/0181-mount-do-not-override-master_id-to-1-for-root-binds.patch +++ b/0181-mount-do-not-override-master_id-to-1-for-root-binds.patch @@ -1,4 +1,4 @@ -From 03cb0595a299ffe3e7e55ecb9cc0402277f75e65 Mon Sep 17 00:00:00 2001 +From dc8b6c98040d863aeda2c548ca3991827c341c72 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Fri, 14 Jan 2022 14:33:30 +0300 Subject: [PATCH 181/249] mount: do not override master_id to -1 for root binds diff --git a/0182-mount-add-helper-mnt_get_external_bind_nodev.patch b/0182-mount-add-helper-mnt_get_external_bind_nodev.patch index ce5d05a..4ee928b 100644 --- a/0182-mount-add-helper-mnt_get_external_bind_nodev.patch +++ b/0182-mount-add-helper-mnt_get_external_bind_nodev.patch @@ -1,4 +1,4 @@ -From dc2aaeb239af4851d0d157e85d2d2f98bad289d5 Mon Sep 17 00:00:00 2001 +From dd6be1a5f66bd7c605ada4fbd997e36c3cba65e0 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Wed, 27 May 2020 11:50:34 +0300 Subject: [PATCH 182/249] mount: add helper mnt_get_external_bind_nodev diff --git a/0183-mount-prepare-is_overmounted-as-early-as-possible.patch b/0183-mount-prepare-is_overmounted-as-early-as-possible.patch index 5d47d03..752f04c 100644 --- a/0183-mount-prepare-is_overmounted-as-early-as-possible.patch +++ b/0183-mount-prepare-is_overmounted-as-early-as-possible.patch @@ -1,4 +1,4 @@ -From 85f9f104c25b032db7f4012e4209d6039ed9042e Mon Sep 17 00:00:00 2001 +From d17e33e918bb9e3fffc18a0b1af532841bdb3d69 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Fri, 29 May 2020 10:27:05 +0300 Subject: [PATCH 183/249] mount: prepare is_overmounted as early as possible diff --git a/0184-mount-move-root-yard-tree-merge-as-early-as-possible.patch b/0184-mount-move-root-yard-tree-merge-as-early-as-possible.patch index cf719be..c336198 100644 --- a/0184-mount-move-root-yard-tree-merge-as-early-as-possible.patch +++ b/0184-mount-move-root-yard-tree-merge-as-early-as-possible.patch @@ -1,4 +1,4 @@ -From 96d694c36abfb17427e058958ca61865491da160 Mon Sep 17 00:00:00 2001 +From 784d5274c7a09d452c78a771e4a43476dde35dca Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Mon, 29 Jun 2020 18:04:41 +0300 Subject: [PATCH 184/249] mount: move root yard tree merge as early as possible diff --git a/0185-mount-fix-broken-remounted_rw-check.patch b/0185-mount-fix-broken-remounted_rw-check.patch index 71ce9cc..adc1673 100644 --- a/0185-mount-fix-broken-remounted_rw-check.patch +++ b/0185-mount-fix-broken-remounted_rw-check.patch @@ -1,4 +1,4 @@ -From 38a7d96e01f897f1da38d1fcbcbc362fc6628052 Mon Sep 17 00:00:00 2001 +From 06d7b3ea53c1896e3bc453ba47b47fd7fb77db97 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Wed, 8 Jul 2020 09:57:33 +0300 Subject: [PATCH 185/249] mount: fix broken remounted_rw check diff --git a/0186-mount-make-general-place-for-shared-variables-on-mou.patch b/0186-mount-make-general-place-for-shared-variables-on-mou.patch index f824b9d..6a18781 100644 --- a/0186-mount-make-general-place-for-shared-variables-on-mou.patch +++ b/0186-mount-make-general-place-for-shared-variables-on-mou.patch @@ -1,4 +1,4 @@ -From a554c2d6d9a652ad32f272e7c2a03eec056220e5 Mon Sep 17 00:00:00 2001 +From bcf8e4276323b1e999d355399fc24dc748bdc316 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Tue, 16 Jun 2020 16:19:42 +0300 Subject: [PATCH 186/249] mount: make general place for shared variables on diff --git a/0187-autofs-use-ns_mountpoint-in-autofs_create_dentries.patch b/0187-autofs-use-ns_mountpoint-in-autofs_create_dentries.patch index fc6943d..775ed1c 100644 --- a/0187-autofs-use-ns_mountpoint-in-autofs_create_dentries.patch +++ b/0187-autofs-use-ns_mountpoint-in-autofs_create_dentries.patch @@ -1,4 +1,4 @@ -From f84949f68f001a1a06e9c612f34ec573d962e6c4 Mon Sep 17 00:00:00 2001 +From 88e851616d9f576f38630e0725ebc275f12f4ecb Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Tue, 26 May 2020 16:40:57 +0300 Subject: [PATCH 187/249] autofs: use ns_mountpoint in autofs_create_dentries diff --git a/0188-mount-use-ns_mountpoint-in-mnt_is_overmounted.patch b/0188-mount-use-ns_mountpoint-in-mnt_is_overmounted.patch index 394ddd2..3de0ec6 100644 --- a/0188-mount-use-ns_mountpoint-in-mnt_is_overmounted.patch +++ b/0188-mount-use-ns_mountpoint-in-mnt_is_overmounted.patch @@ -1,4 +1,4 @@ -From eebae8cb3ef05114fbcce56c37d405c18d640d4a Mon Sep 17 00:00:00 2001 +From 99273ed7906b0e88879166e95538ec9b3358cb8e Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Tue, 30 Nov 2021 12:11:02 +0300 Subject: [PATCH 188/249] mount: use ns_mountpoint in mnt_is_overmounted diff --git a/0189-mount-skip-root-yard-children-from-mnt_needs_remap-c.patch b/0189-mount-skip-root-yard-children-from-mnt_needs_remap-c.patch index b37ef34..c8f7df1 100644 --- a/0189-mount-skip-root-yard-children-from-mnt_needs_remap-c.patch +++ b/0189-mount-skip-root-yard-children-from-mnt_needs_remap-c.patch @@ -1,4 +1,4 @@ -From 744bd436864bda3bef9d5117c802c6d6355dc568 Mon Sep 17 00:00:00 2001 +From 246f80532a80d73c8bb6fabc58d91549155b53ac Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Fri, 29 May 2020 12:40:52 +0300 Subject: [PATCH 189/249] mount: skip root yard children from mnt_needs_remap diff --git a/0190-mount-use-ns_mountpoint-in-validate_children_collisi.patch b/0190-mount-use-ns_mountpoint-in-validate_children_collisi.patch index 1757c47..becba86 100644 --- a/0190-mount-use-ns_mountpoint-in-validate_children_collisi.patch +++ b/0190-mount-use-ns_mountpoint-in-validate_children_collisi.patch @@ -1,4 +1,4 @@ -From 1c00cde48a8dd65cd49c253af655eb98aa002967 Mon Sep 17 00:00:00 2001 +From 876abe5b5fd08fb1e23e2f1ae1e157d9ed9ba57e Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Fri, 29 May 2020 13:00:48 +0300 Subject: [PATCH 190/249] mount: use ns_mountpoint in diff --git a/0191-mount-use-ns_mountpoint-in-root_path_from_parent.patch b/0191-mount-use-ns_mountpoint-in-root_path_from_parent.patch index 1e203c3..b9f16aa 100644 --- a/0191-mount-use-ns_mountpoint-in-root_path_from_parent.patch +++ b/0191-mount-use-ns_mountpoint-in-root_path_from_parent.patch @@ -1,4 +1,4 @@ -From 305750f27c8492bd51145ae4a18ff2dd12793d12 Mon Sep 17 00:00:00 2001 +From 042dd19537f68f3412e642858c620a2ccc111337 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Fri, 29 May 2020 13:39:10 +0300 Subject: [PATCH 191/249] mount: use ns_mountpoint in root_path_from_parent diff --git a/0192-mount-use-ns_mountpoint-for-children-overmount-check.patch b/0192-mount-use-ns_mountpoint-for-children-overmount-check.patch index 94146b4..f05e491 100644 --- a/0192-mount-use-ns_mountpoint-for-children-overmount-check.patch +++ b/0192-mount-use-ns_mountpoint-for-children-overmount-check.patch @@ -1,4 +1,4 @@ -From 16b279a63594bdff1e5376e22794439487d6f0bb Mon Sep 17 00:00:00 2001 +From 103bb35c39c07c01b03a557486b9e550ed80311b Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Fri, 29 May 2020 13:52:45 +0300 Subject: [PATCH 192/249] mount: use ns_mountpoint for children-overmount check diff --git a/0193-path-simplify-mnt_get_sibling_path-via-get_relative_.patch b/0193-path-simplify-mnt_get_sibling_path-via-get_relative_.patch index eff2caa..1ec16b8 100644 --- a/0193-path-simplify-mnt_get_sibling_path-via-get_relative_.patch +++ b/0193-path-simplify-mnt_get_sibling_path-via-get_relative_.patch @@ -1,4 +1,4 @@ -From bdb7345ebea7034738a391534bd0c77ce144203c Mon Sep 17 00:00:00 2001 +From 21e9d5515d154da3b7a5b9894ce99654d3c74511 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Wed, 1 Dec 2021 12:52:27 +0300 Subject: [PATCH 193/249] path: simplify mnt_get_sibling_path via diff --git a/0194-mount-use-ns_mountpoint-in-collect_mntinfo.patch b/0194-mount-use-ns_mountpoint-in-collect_mntinfo.patch index be9dbbb..7657eb0 100644 --- a/0194-mount-use-ns_mountpoint-in-collect_mntinfo.patch +++ b/0194-mount-use-ns_mountpoint-in-collect_mntinfo.patch @@ -1,4 +1,4 @@ -From b37b302d47277d41a3a8287529739805bfa427a4 Mon Sep 17 00:00:00 2001 +From 29899d64c171443c6d456d122bf564e2c259ca20 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Fri, 29 May 2020 14:34:03 +0300 Subject: [PATCH 194/249] mount: use ns_mountpoint in collect_mntinfo diff --git a/0195-mount-use-ns_mountpoint-in-aufs_parse.patch b/0195-mount-use-ns_mountpoint-in-aufs_parse.patch index b0f8fe7..f07e4a6 100644 --- a/0195-mount-use-ns_mountpoint-in-aufs_parse.patch +++ b/0195-mount-use-ns_mountpoint-in-aufs_parse.patch @@ -1,4 +1,4 @@ -From 8506fbfdc3bcd4983f0808c76540ceba76c1bebb Mon Sep 17 00:00:00 2001 +From 5ffda01cf26e5cd13c33c2c6ea35f6624073a69b Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Fri, 29 May 2020 14:40:01 +0300 Subject: [PATCH 195/249] mount: use ns_mountpoint in aufs_parse diff --git a/0196-mount-use-ns_mountpoint-in-mnt_depth.patch b/0196-mount-use-ns_mountpoint-in-mnt_depth.patch index 48dfad8..5ffc19c 100644 --- a/0196-mount-use-ns_mountpoint-in-mnt_depth.patch +++ b/0196-mount-use-ns_mountpoint-in-mnt_depth.patch @@ -1,4 +1,4 @@ -From b23ba1e4a50e7b9a1ca3f208983d73c683acbea1 Mon Sep 17 00:00:00 2001 +From 45dba8dd206c5bda0c682de1ee31a99ae5c50f49 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Fri, 29 May 2020 15:18:10 +0300 Subject: [PATCH 196/249] mount: use ns_mountpoint in mnt_depth diff --git a/0197-mount-use-ns_mountpoint-instead-of-mountpoint-where-.patch b/0197-mount-use-ns_mountpoint-instead-of-mountpoint-where-.patch index b2d8d9f..9c4d221 100644 --- a/0197-mount-use-ns_mountpoint-instead-of-mountpoint-where-.patch +++ b/0197-mount-use-ns_mountpoint-instead-of-mountpoint-where-.patch @@ -1,4 +1,4 @@ -From fec02ce6c42779386cd621030887194aeb7f2aca Mon Sep 17 00:00:00 2001 +From 259b1d228857158dea54ccd36e59c712b87b9bc4 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Fri, 29 May 2020 12:02:16 +0300 Subject: [PATCH 197/249] mount: use ns_mountpoint instead of mountpoint where diff --git a/0198-mount-add-service_mountpoint-getter-for-mountpoint.patch b/0198-mount-add-service_mountpoint-getter-for-mountpoint.patch index 4bd9ea0..3b78573 100644 --- a/0198-mount-add-service_mountpoint-getter-for-mountpoint.patch +++ b/0198-mount-add-service_mountpoint-getter-for-mountpoint.patch @@ -1,4 +1,4 @@ -From 569d5e17f39c8c206c4b20386b101b29a8fee188 Mon Sep 17 00:00:00 2001 +From 183c77f7c56eb6bb5f7ac8cedfbef912a2883d5a Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 28 May 2020 11:14:39 +0300 Subject: [PATCH 198/249] mount: add service_mountpoint getter for ->mountpoint diff --git a/0199-files-reg-split-create_ghost_dentry-out-of-create_gh.patch b/0199-files-reg-split-create_ghost_dentry-out-of-create_gh.patch index 1bf2d51..07f8d91 100644 --- a/0199-files-reg-split-create_ghost_dentry-out-of-create_gh.patch +++ b/0199-files-reg-split-create_ghost_dentry-out-of-create_gh.patch @@ -1,4 +1,4 @@ -From e9ff05033bda690539b42e658d110ff3991414b4 Mon Sep 17 00:00:00 2001 +From e0118aee0fdecd9c267c1f23df73ce909827f9bc Mon Sep 17 00:00:00 2001 From: Stanislav Kinsburskiy Date: Mon, 11 Jul 2016 14:14:15 +0300 Subject: [PATCH 199/249] files-reg: split create_ghost_dentry out of diff --git a/0200-files-reg-teach-create_ghost-to-work-with-mount-v2.patch b/0200-files-reg-teach-create_ghost-to-work-with-mount-v2.patch index 69c3469..01b92ab 100644 --- a/0200-files-reg-teach-create_ghost-to-work-with-mount-v2.patch +++ b/0200-files-reg-teach-create_ghost-to-work-with-mount-v2.patch @@ -1,4 +1,4 @@ -From d33eee29e43f5f8a0aa8d4ee9c21006e08685367 Mon Sep 17 00:00:00 2001 +From 45a06d6b9b34f0484ca3dad560e53914db05fff6 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 14 May 2020 14:11:47 +0300 Subject: [PATCH 200/249] files-reg: teach create_ghost to work with mount-v2 diff --git a/0201-files-reg-teach-clean_one_remap-to-work-with-mount-v.patch b/0201-files-reg-teach-clean_one_remap-to-work-with-mount-v.patch index 78d9221..600b589 100644 --- a/0201-files-reg-teach-clean_one_remap-to-work-with-mount-v.patch +++ b/0201-files-reg-teach-clean_one_remap-to-work-with-mount-v.patch @@ -1,4 +1,4 @@ -From 379cfdd821911d475e0c74e36c9d8913a5f9a989 Mon Sep 17 00:00:00 2001 +From bfe17cdd6fda1519870eb89c231d4965f276dc4e Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 14 May 2020 16:36:57 +0300 Subject: [PATCH 201/249] files-reg: teach clean_one_remap to work with diff --git a/0202-kerndat-Check-for-MOVE_MOUNT_SET_GROUP-availability.patch b/0202-kerndat-Check-for-MOVE_MOUNT_SET_GROUP-availability.patch index d06987a..ab8c038 100644 --- a/0202-kerndat-Check-for-MOVE_MOUNT_SET_GROUP-availability.patch +++ b/0202-kerndat-Check-for-MOVE_MOUNT_SET_GROUP-availability.patch @@ -1,4 +1,4 @@ -From 44be7557f0477237945e244de6b26a9472a1591b Mon Sep 17 00:00:00 2001 +From 32a5f0844aa34d3d1ea463f634098b6acc64b56b Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 25 Mar 2021 13:37:55 +0300 Subject: [PATCH 202/249] kerndat: Check for MOVE_MOUNT_SET_GROUP availability diff --git a/0203-compel-add-open_tree-syscall.patch b/0203-compel-add-open_tree-syscall.patch index 05d0b8c..21afacf 100644 --- a/0203-compel-add-open_tree-syscall.patch +++ b/0203-compel-add-open_tree-syscall.patch @@ -1,4 +1,4 @@ -From e72cf151b6dfe88f78715fca4dff560350688e66 Mon Sep 17 00:00:00 2001 +From 86215f7cd94cb9d8705527cddebcbb2c13d0588d Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Fri, 24 Dec 2021 13:23:29 +0300 Subject: [PATCH 203/249] compel: add open_tree syscall diff --git a/0204-kerndat-check-whether-the-openat2-syscall-is-support.patch b/0204-kerndat-check-whether-the-openat2-syscall-is-support.patch index ae9dd65..e4ac068 100644 --- a/0204-kerndat-check-whether-the-openat2-syscall-is-support.patch +++ b/0204-kerndat-check-whether-the-openat2-syscall-is-support.patch @@ -1,4 +1,4 @@ -From 5bffbff69465054b7e9c879e4a18707df1534fe9 Mon Sep 17 00:00:00 2001 +From ea5a4abe92218cdcd3de77f04f4571585d79167c Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Wed, 22 Dec 2021 11:07:24 +0300 Subject: [PATCH 204/249] kerndat: check whether the openat2 syscall is diff --git a/0205-util-add-resolve_mountpoint-helper.patch b/0205-util-add-resolve_mountpoint-helper.patch index c249c42..c071106 100644 --- a/0205-util-add-resolve_mountpoint-helper.patch +++ b/0205-util-add-resolve_mountpoint-helper.patch @@ -1,4 +1,4 @@ -From 7d1f6274209d2991016f1c4c8bd7b46321ca4d88 Mon Sep 17 00:00:00 2001 +From b3fbad7fd38554a9de9f49374847ed8ce8f9415e Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Wed, 22 Dec 2021 19:26:32 +0300 Subject: [PATCH 205/249] util: add resolve_mountpoint helper diff --git a/0206-crtools-move-check_options-after-kerndat_init-and-lo.patch b/0206-crtools-move-check_options-after-kerndat_init-and-lo.patch index ce43968..2537dde 100644 --- a/0206-crtools-move-check_options-after-kerndat_init-and-lo.patch +++ b/0206-crtools-move-check_options-after-kerndat_init-and-lo.patch @@ -1,4 +1,4 @@ -From dd64b33d47631a47de17e807d7928a345272046c Mon Sep 17 00:00:00 2001 +From c0c592f09b30f2c3cc99aa13ada2cc45dcfb72a1 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 23 Dec 2021 17:19:49 +0300 Subject: [PATCH 206/249] crtools: move check_options after kerndat_init and diff --git a/0207-config-rpc-add-new-option-mntns-compat-mode-for-old-.patch b/0207-config-rpc-add-new-option-mntns-compat-mode-for-old-.patch index 935de6f..c92ad32 100644 --- a/0207-config-rpc-add-new-option-mntns-compat-mode-for-old-.patch +++ b/0207-config-rpc-add-new-option-mntns-compat-mode-for-old-.patch @@ -1,4 +1,4 @@ -From 273d3f4ccc95eb7bd0553de1caa217835525311c Mon Sep 17 00:00:00 2001 +From 34cba22d4eabb34a8f1588d4ce5571492c3f2ef3 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Mon, 25 May 2020 17:43:48 +0300 Subject: [PATCH 207/249] config/rpc: add new option --mntns-compat-mode for diff --git a/0208-mount-add-plain-mountpoints.patch b/0208-mount-add-plain-mountpoints.patch index 4108ddf..2d8376d 100644 --- a/0208-mount-add-plain-mountpoints.patch +++ b/0208-mount-add-plain-mountpoints.patch @@ -1,4 +1,4 @@ -From db674a523b391ccb8eb65191096931cc2e95b9a5 Mon Sep 17 00:00:00 2001 +From a14336dbfb6efbf81069bd772ef4860970480c8c Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 28 May 2020 11:30:16 +0300 Subject: [PATCH 208/249] mount: add plain mountpoints diff --git a/0209-files-reg-export-parent-dirs-helpers-for-mount-v2.patch b/0209-files-reg-export-parent-dirs-helpers-for-mount-v2.patch index 525b394..68575ed 100644 --- a/0209-files-reg-export-parent-dirs-helpers-for-mount-v2.patch +++ b/0209-files-reg-export-parent-dirs-helpers-for-mount-v2.patch @@ -1,4 +1,4 @@ -From 9191dbc6decd1cf15bcfce5fcb09488f69680c50 Mon Sep 17 00:00:00 2001 +From 247e677678fdc049d6e827315976a04527f5d84d Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Tue, 21 Dec 2021 12:14:23 +0300 Subject: [PATCH 209/249] files-reg: export parent dirs helpers for mount-v2 diff --git a/0210-mount-remove-double-ns_id-declaration.patch b/0210-mount-remove-double-ns_id-declaration.patch index 40758c7..737f94e 100644 --- a/0210-mount-remove-double-ns_id-declaration.patch +++ b/0210-mount-remove-double-ns_id-declaration.patch @@ -1,4 +1,4 @@ -From 35f5403cef372bab0f593747c3b0348fc1d10c17 Mon Sep 17 00:00:00 2001 +From b7843ffd30c66d4e375f733b6930bb54d42d77f8 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Tue, 21 Dec 2021 12:43:42 +0300 Subject: [PATCH 210/249] mount: remove double ns_id declaration diff --git a/0211-mount-export-common-defines-for-mount-v2.patch b/0211-mount-export-common-defines-for-mount-v2.patch index e350682..68c5de9 100644 --- a/0211-mount-export-common-defines-for-mount-v2.patch +++ b/0211-mount-export-common-defines-for-mount-v2.patch @@ -1,4 +1,4 @@ -From da341d7cd3e0a9ab312ce9ea18755a938d61e1bb Mon Sep 17 00:00:00 2001 +From 294b4e67037e2e49cae1c4b795cfc68256902bbe Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Tue, 21 Dec 2021 12:46:57 +0300 Subject: [PATCH 211/249] mount: export common defines for mount-v2 diff --git a/0212-mount-export-several-functions-for-mount-v2.patch b/0212-mount-export-several-functions-for-mount-v2.patch index 775acc1..671f90f 100644 --- a/0212-mount-export-several-functions-for-mount-v2.patch +++ b/0212-mount-export-several-functions-for-mount-v2.patch @@ -1,4 +1,4 @@ -From ee35200cf6627cc0ea2b8067d759c0e4e798d825 Mon Sep 17 00:00:00 2001 +From d88668190e0254e51a4d16a3ae7c1d1ef8baaefe Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Tue, 21 Dec 2021 13:29:52 +0300 Subject: [PATCH 212/249] mount: export several functions for mount-v2 diff --git a/0213-mount-export-global-variables-for-mount-v2.patch b/0213-mount-export-global-variables-for-mount-v2.patch index 8d289d0..d61ea43 100644 --- a/0213-mount-export-global-variables-for-mount-v2.patch +++ b/0213-mount-export-global-variables-for-mount-v2.patch @@ -1,4 +1,4 @@ -From 0dfc8717477416fa14d87335f1be5f2e2f89a71e Mon Sep 17 00:00:00 2001 +From 036a0d6bb99929b836323ec59d851cda5a87cd2c Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Tue, 21 Dec 2021 14:04:19 +0300 Subject: [PATCH 213/249] mount: export global variables for mount-v2 diff --git a/0214-mount-add-new-mounts-v2-engine.patch b/0214-mount-add-new-mounts-v2-engine.patch index c4b794a..9f5c3ec 100644 --- a/0214-mount-add-new-mounts-v2-engine.patch +++ b/0214-mount-add-new-mounts-v2-engine.patch @@ -1,4 +1,4 @@ -From 14c2dd341a5a3b0a15095ae68047d7c061b53033 Mon Sep 17 00:00:00 2001 +From 8127682e59641682e185e05f17b770fbe05d9087 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Mon, 25 May 2020 18:12:49 +0300 Subject: [PATCH 214/249] mount: add new mounts-v2 engine diff --git a/0215-zdtm-enable-mounts-compat-mode-on-restore-with-mntns.patch b/0215-zdtm-enable-mounts-compat-mode-on-restore-with-mntns.patch index 84295ca..82334db 100644 --- a/0215-zdtm-enable-mounts-compat-mode-on-restore-with-mntns.patch +++ b/0215-zdtm-enable-mounts-compat-mode-on-restore-with-mntns.patch @@ -1,4 +1,4 @@ -From 3e814aba5a1ea040b655c5e4102ffaab157a433e Mon Sep 17 00:00:00 2001 +From 7361b54e7aa213e2c9dda84eba39ff934183b759 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Wed, 27 May 2020 16:11:20 +0300 Subject: [PATCH 215/249] zdtm: enable mounts compat mode on restore with diff --git a/0216-ci-run-tests-for-old-mount-engine.patch b/0216-ci-run-tests-for-old-mount-engine.patch index 4b628ad..ae01403 100644 --- a/0216-ci-run-tests-for-old-mount-engine.patch +++ b/0216-ci-run-tests-for-old-mount-engine.patch @@ -1,4 +1,4 @@ -From e4823210911c344e668eba7783f170816777f388 Mon Sep 17 00:00:00 2001 +From 555e118d60688230e1eddc5c8e5117c49cdcc3aa Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Fri, 14 Jan 2022 12:12:12 +0300 Subject: [PATCH 216/249] ci: run tests for old mount engine diff --git a/0217-zdtm-add-new-mnt_ext_sharing-test-for-mount-v2.patch b/0217-zdtm-add-new-mnt_ext_sharing-test-for-mount-v2.patch index f0d46c2..9bac868 100644 --- a/0217-zdtm-add-new-mnt_ext_sharing-test-for-mount-v2.patch +++ b/0217-zdtm-add-new-mnt_ext_sharing-test-for-mount-v2.patch @@ -1,4 +1,4 @@ -From 289bfe5cb61a964ed022010e765ba2de489c389d Mon Sep 17 00:00:00 2001 +From 8909926e8c1c72a55a18e2e00793069fbe5fe445 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Tue, 31 Dec 2019 15:56:44 +0300 Subject: [PATCH 217/249] zdtm: add new mnt_ext_sharing test for mount-v2 diff --git a/0218-zdtm-add-mount_complex_sharing-test.patch b/0218-zdtm-add-mount_complex_sharing-test.patch index 68901e8..34390c6 100644 --- a/0218-zdtm-add-mount_complex_sharing-test.patch +++ b/0218-zdtm-add-mount_complex_sharing-test.patch @@ -1,4 +1,4 @@ -From 659f16d27bb23528229427c61b7591eeb51189a1 Mon Sep 17 00:00:00 2001 +From 3d674889edc31c439a42e5c01226359a56dd533c Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Tue, 28 Jul 2020 11:49:45 +0300 Subject: [PATCH 218/249] zdtm: add mount_complex_sharing test diff --git a/0219-zdtm-add-propagation-group-with-mount-flags-to-mount.patch b/0219-zdtm-add-propagation-group-with-mount-flags-to-mount.patch index 75519c7..8d02972 100644 --- a/0219-zdtm-add-propagation-group-with-mount-flags-to-mount.patch +++ b/0219-zdtm-add-propagation-group-with-mount-flags-to-mount.patch @@ -1,4 +1,4 @@ -From b7070dd5675a53b22db912c36242c0dde94d5a3e Mon Sep 17 00:00:00 2001 +From 2a5d445efc68e76fef4f7141c2b07c2f16c7fef3 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Wed, 14 Oct 2020 15:56:52 +0300 Subject: [PATCH 219/249] zdtm: add propagation group with mount flags to diff --git a/0220-zdtm-mount-v2-disable-mnt_tracefs-test.patch b/0220-zdtm-mount-v2-disable-mnt_tracefs-test.patch index 0c0c057..0230977 100644 --- a/0220-zdtm-mount-v2-disable-mnt_tracefs-test.patch +++ b/0220-zdtm-mount-v2-disable-mnt_tracefs-test.patch @@ -1,4 +1,4 @@ -From 5abbefa1f66eaded7f03f1d65a00b6aa8a57ab47 Mon Sep 17 00:00:00 2001 +From 551fe1a3cbf8b5e4b4f34d85c1bb807917e5d8c9 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Tue, 1 Dec 2020 16:07:16 +0300 Subject: [PATCH 220/249] zdtm/mount-v2: disable mnt_tracefs test diff --git a/0221-ci-make-others-mnt_ext_dev-also-run-for-old-mount-en.patch b/0221-ci-make-others-mnt_ext_dev-also-run-for-old-mount-en.patch index 74b8d9e..c581116 100644 --- a/0221-ci-make-others-mnt_ext_dev-also-run-for-old-mount-en.patch +++ b/0221-ci-make-others-mnt_ext_dev-also-run-for-old-mount-en.patch @@ -1,4 +1,4 @@ -From c72b743d0ccdfc2af699b87d75af8ddab675fa26 Mon Sep 17 00:00:00 2001 +From ba38f2e6086831518fc3595c4566c0ed9cc736e5 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Fri, 14 Jan 2022 19:29:08 +0300 Subject: [PATCH 221/249] ci: make others/mnt_ext_dev also run for old mount diff --git a/0222-test-jenkins-test-for-old-mount-engine.patch b/0222-test-jenkins-test-for-old-mount-engine.patch index c695058..ae59352 100644 --- a/0222-test-jenkins-test-for-old-mount-engine.patch +++ b/0222-test-jenkins-test-for-old-mount-engine.patch @@ -1,4 +1,4 @@ -From 24dffdc2410627966a82d7cc8b29797cecbab61b Mon Sep 17 00:00:00 2001 +From 2e69fff789bf285853f96ef27f836773a933754b Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Mon, 31 Jan 2022 11:02:36 +0300 Subject: [PATCH 222/249] test/jenkins: test for old mount engine diff --git a/0223-zdtm-mount-v2-disable-pty-console-test.patch b/0223-zdtm-mount-v2-disable-pty-console-test.patch index 99f5968..b10fb40 100644 --- a/0223-zdtm-mount-v2-disable-pty-console-test.patch +++ b/0223-zdtm-mount-v2-disable-pty-console-test.patch @@ -1,4 +1,4 @@ -From 16285bfab2f24816554ee6cb70430fcbcae7ac3f Mon Sep 17 00:00:00 2001 +From 03f00584fc3428f2f1fa1485ecead7e74842fb4e Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Mon, 14 Mar 2022 12:01:10 +0300 Subject: [PATCH 223/249] zdtm/mount-v2: disable pty-console test diff --git a/0224-mount-v2-make-mount-engine-fallback-messages-logleve.patch b/0224-mount-v2-make-mount-engine-fallback-messages-logleve.patch index 8ffc46f..f533982 100644 --- a/0224-mount-v2-make-mount-engine-fallback-messages-logleve.patch +++ b/0224-mount-v2-make-mount-engine-fallback-messages-logleve.patch @@ -1,4 +1,4 @@ -From 14621c81247af478617ad8295c5819e99ffa188c Mon Sep 17 00:00:00 2001 +From b578f95f21e1cec4961948dddce1fd201907302a Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Sun, 20 Mar 2022 19:38:34 +0300 Subject: [PATCH 224/249] mount-v2: make mount engine fallback messages diff --git a/0225-mount-make-error-messages-differ-in-different-places.patch b/0225-mount-make-error-messages-differ-in-different-places.patch index 7f366c4..369be7f 100644 --- a/0225-mount-make-error-messages-differ-in-different-places.patch +++ b/0225-mount-make-error-messages-differ-in-different-places.patch @@ -1,4 +1,4 @@ -From b2e857c42a8086f735f0018fab556d259adcc71a Mon Sep 17 00:00:00 2001 +From 3ce0742b084ce45cc2170c0f92d24190231f54e1 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Mon, 21 Mar 2022 10:19:29 +0300 Subject: [PATCH 225/249] mount: make error messages differ in different places diff --git a/0226-zdtm-use-unique-holder-for-cgroups.patch b/0226-zdtm-use-unique-holder-for-cgroups.patch index c02e2ef..3f5442c 100644 --- a/0226-zdtm-use-unique-holder-for-cgroups.patch +++ b/0226-zdtm-use-unique-holder-for-cgroups.patch @@ -1,4 +1,4 @@ -From 20f4b7a8a5151dfc49463c01bb7509f6dd74defc Mon Sep 17 00:00:00 2001 +From 019adba82026f710cd776b424468fc635a649d2c Mon Sep 17 00:00:00 2001 From: Andrei Vagin Date: Sun, 20 Mar 2022 22:11:19 -0700 Subject: [PATCH 226/249] zdtm: use unique holder for cgroups diff --git a/0227-scripts-ci-mount-test-cgroups-once.patch b/0227-scripts-ci-mount-test-cgroups-once.patch index eb8e10b..c1bd7bd 100644 --- a/0227-scripts-ci-mount-test-cgroups-once.patch +++ b/0227-scripts-ci-mount-test-cgroups-once.patch @@ -1,4 +1,4 @@ -From c0637fc646ee6f0043dbe0bd741ce311e5f9b5b6 Mon Sep 17 00:00:00 2001 +From becbcd27e09030cc1032e013ff08c726acae79bf Mon Sep 17 00:00:00 2001 From: Andrei Vagin Date: Sun, 20 Mar 2022 22:13:45 -0700 Subject: [PATCH 227/249] scripts/ci: mount test cgroups once diff --git a/0228-criu-ns-add-a-helper-to-hold-a-pid-namespace.patch b/0228-criu-ns-add-a-helper-to-hold-a-pid-namespace.patch index 2258996..dfef187 100644 --- a/0228-criu-ns-add-a-helper-to-hold-a-pid-namespace.patch +++ b/0228-criu-ns-add-a-helper-to-hold-a-pid-namespace.patch @@ -1,4 +1,4 @@ -From e4c1e520e90b40ed639b544322d8700451d3659f Mon Sep 17 00:00:00 2001 +From 3a33f672a6de175d5ff8d5440f44898da6fa08ef Mon Sep 17 00:00:00 2001 From: Andrei Vagin Date: Sun, 20 Mar 2022 00:43:45 -0700 Subject: [PATCH 228/249] criu-ns: add a helper to hold a pid namespace diff --git a/0229-apparmor-Fix-Wfortify-source-for-Clang.patch b/0229-apparmor-Fix-Wfortify-source-for-Clang.patch index 3185b22..db3238f 100644 --- a/0229-apparmor-Fix-Wfortify-source-for-Clang.patch +++ b/0229-apparmor-Fix-Wfortify-source-for-Clang.patch @@ -1,4 +1,4 @@ -From c4d7e86771edcaed33bce40e93f06d1920a40c4d Mon Sep 17 00:00:00 2001 +From 32135702ea15c977485ca66cfedd1410896c895c Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Fri, 25 Mar 2022 17:18:30 -0700 Subject: [PATCH 229/249] apparmor: Fix -Wfortify-source for Clang diff --git a/0230-style-delete-some-redundant-code.patch b/0230-style-delete-some-redundant-code.patch index f7552a0..0723e1d 100644 --- a/0230-style-delete-some-redundant-code.patch +++ b/0230-style-delete-some-redundant-code.patch @@ -1,4 +1,4 @@ -From 2060c0cd9e1d7184597050ccab4c0d08b36bb2f4 Mon Sep 17 00:00:00 2001 +From e974a40c0a6055d102bad608d8b1364b9a32fcfe Mon Sep 17 00:00:00 2001 From: jiang wei Date: Wed, 23 Mar 2022 21:48:16 +0800 Subject: [PATCH 230/249] style: delete some redundant code diff --git a/0231-mount-fix-Wunused-but-set-variable-for-Clang-15.patch b/0231-mount-fix-Wunused-but-set-variable-for-Clang-15.patch index d5c9d02..9b8d5bf 100644 --- a/0231-mount-fix-Wunused-but-set-variable-for-Clang-15.patch +++ b/0231-mount-fix-Wunused-but-set-variable-for-Clang-15.patch @@ -1,4 +1,4 @@ -From d1fe7612208caa12c03f2e35e91e42a093148bcc Mon Sep 17 00:00:00 2001 +From 1789a6e25730769e1297632e2059c68c40859aec Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Fri, 25 Mar 2022 17:27:11 -0700 Subject: [PATCH 231/249] mount: fix -Wunused-but-set-variable for Clang 15 diff --git a/0232-compel-add-rseq-syscall-into-compel-std-plugin-sysca.patch b/0232-compel-add-rseq-syscall-into-compel-std-plugin-sysca.patch index 72e08a0..10e0ff5 100644 --- a/0232-compel-add-rseq-syscall-into-compel-std-plugin-sysca.patch +++ b/0232-compel-add-rseq-syscall-into-compel-std-plugin-sysca.patch @@ -1,4 +1,4 @@ -From 9456e11dbb326e93cdd01456b629230db996c0d4 Mon Sep 17 00:00:00 2001 +From 83d4d8a4f22e7820687439afe7622cb5be7bed67 Mon Sep 17 00:00:00 2001 From: Alexander Mikhalitsyn Date: Tue, 21 Dec 2021 17:38:25 +0300 Subject: [PATCH 232/249] compel: add rseq syscall into compel std plugin diff --git a/0233-kerndat-check-for-rseq-syscall-support.patch b/0233-kerndat-check-for-rseq-syscall-support.patch index a9c79ad..cfda6e6 100644 --- a/0233-kerndat-check-for-rseq-syscall-support.patch +++ b/0233-kerndat-check-for-rseq-syscall-support.patch @@ -1,4 +1,4 @@ -From 79fd6d1c54c7b8b925df11adbce9ef687b0f0f4f Mon Sep 17 00:00:00 2001 +From a01c8c82a0bdb066cdc59f96184740b6bbe366b6 Mon Sep 17 00:00:00 2001 From: Alexander Mikhalitsyn Date: Tue, 21 Dec 2021 18:27:52 +0300 Subject: [PATCH 233/249] kerndat: check for rseq syscall support diff --git a/0234-util-move-fork_and_ptrace_attach-helper-from-cr-chec.patch b/0234-util-move-fork_and_ptrace_attach-helper-from-cr-chec.patch index c831cc7..102239a 100644 --- a/0234-util-move-fork_and_ptrace_attach-helper-from-cr-chec.patch +++ b/0234-util-move-fork_and_ptrace_attach-helper-from-cr-chec.patch @@ -1,4 +1,4 @@ -From 4dcca982579264fbc3fab176f63c7273799f7a9c Mon Sep 17 00:00:00 2001 +From 322699312bc16316473f3760eb1548982412979a Mon Sep 17 00:00:00 2001 From: Alexander Mikhalitsyn Date: Tue, 21 Dec 2021 21:17:16 +0300 Subject: [PATCH 234/249] util: move fork_and_ptrace_attach helper from diff --git a/0235-cr-check-Add-ptrace-rseq-conf-dump-feature.patch b/0235-cr-check-Add-ptrace-rseq-conf-dump-feature.patch index 941450d..7b17fb3 100644 --- a/0235-cr-check-Add-ptrace-rseq-conf-dump-feature.patch +++ b/0235-cr-check-Add-ptrace-rseq-conf-dump-feature.patch @@ -1,4 +1,4 @@ -From c4399163eb28d0dd1d2f6d7041f361b9516c2911 Mon Sep 17 00:00:00 2001 +From 0c0bc3dedcf68e59baa6544d2e0a9b3275559376 Mon Sep 17 00:00:00 2001 From: Alexander Mikhalitsyn Date: Tue, 21 Dec 2021 18:29:14 +0300 Subject: [PATCH 235/249] cr-check: Add ptrace rseq conf dump feature diff --git a/0236-rseq-initial-support.patch b/0236-rseq-initial-support.patch index 3a69c02..388f442 100644 --- a/0236-rseq-initial-support.patch +++ b/0236-rseq-initial-support.patch @@ -1,4 +1,4 @@ -From 5dd6ace5934f8c95f4ac72e248433081f1be87d1 Mon Sep 17 00:00:00 2001 +From f8b1b85be77e48477e3449a9c2c70080799444b2 Mon Sep 17 00:00:00 2001 From: Alexander Mikhalitsyn Date: Tue, 21 Dec 2021 23:27:26 +0300 Subject: [PATCH 236/249] rseq: initial support @@ -18,18 +18,18 @@ Reported-by: Radostin Stoyanov Suggested-by: Florian Weimer Signed-off-by: Alexander Mikhalitsyn --- - criu/cr-dump.c | 99 ++++++++++++++++++++++++++ + criu/cr-dump.c | 99 +++++++++++++++++++++++++++ criu/cr-restore.c | 22 ++++++ - criu/include/linux/rseq.h | 144 ++++++++++++++++++++++++++++++++++++++ + criu/include/linux/rseq.h | 137 ++++++++++++++++++++++++++++++++++++++ criu/include/parasite.h | 7 ++ criu/include/restorer.h | 7 ++ criu/parasite-syscall.c | 11 +++ - criu/pie/parasite.c | 98 ++++++++++++++++++++++++++ + criu/pie/parasite.c | 100 ++++++++++++++++++++++++++++ criu/pie/restorer.c | 25 +++++++ images/Makefile | 1 + images/core.proto | 2 + images/rseq.proto | 9 +++ - 11 files changed, 425 insertions(+) + 11 files changed, 420 insertions(+) create mode 100644 criu/include/linux/rseq.h create mode 100644 images/rseq.proto @@ -213,10 +213,10 @@ index 9d2d957f8..8bfa3ef8c 100644 thread_args[i].futex_rla = tcore->thread_core->futex_rla; diff --git a/criu/include/linux/rseq.h b/criu/include/linux/rseq.h new file mode 100644 -index 000000000..5c1706a59 +index 000000000..b227aefdf --- /dev/null +++ b/criu/include/linux/rseq.h -@@ -0,0 +1,144 @@ +@@ -0,0 +1,137 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ +#ifndef _UAPI_LINUX_RSEQ_H +#define _UAPI_LINUX_RSEQ_H @@ -270,12 +270,17 @@ index 000000000..5c1706a59 +} __attribute__((aligned(4 * sizeof(__u64)))); + +/* ++ * We have to have our own copy of struct rseq definition because ++ * of breaking UAPI change: ++ * https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/commit/?id=bfdf4e6208051ed7165b2e92035b4bf11f43eb63 ++ */ ++/* + * struct rseq is aligned on 4 * 8 bytes to ensure it is always + * contained within a single cache-line. + * + * A single struct rseq per thread is allowed. + */ -+struct rseq { ++struct criu_rseq { + /* + * Restartable sequences cpu_id_start field. Updated by the + * kernel. Read by user-space with single-copy atomicity @@ -321,23 +326,11 @@ index 000000000..5c1706a59 + * Read and set by the kernel. Set by user-space with single-copy + * atomicity semantics. This field should only be updated by the + * thread which registered this data structure. Aligned on 64-bit. ++ * ++ * 32-bit architectures should update the low order bits of the ++ * rseq_cs field, leaving the high order bits initialized to 0. + */ -+ union { -+ __u64 ptr64; -+#ifdef __LP64__ -+ __u64 ptr; -+#else -+ struct { -+#if (defined(__BYTE_ORDER) && (__BYTE_ORDER == __BIG_ENDIAN)) || defined(__BIG_ENDIAN) -+ __u32 padding; /* Initialized to zero. */ -+ __u32 ptr32; -+#else /* LITTLE */ -+ __u32 ptr32; -+ __u32 padding; /* Initialized to zero. */ -+#endif /* ENDIAN */ -+ } ptr; -+#endif -+ } rseq_cs; ++ __u64 rseq_cs; + + /* + * Restartable sequences flags field. @@ -445,7 +438,7 @@ index 7175adee1..ee4fa86f4 100644 if (ret) { pr_err("Can't init thread in parasite %d\n", pid); diff --git a/criu/pie/parasite.c b/criu/pie/parasite.c -index bc0a33cd4..8441ac635 100644 +index bc0a33cd4..a74c7721a 100644 --- a/criu/pie/parasite.c +++ b/criu/pie/parasite.c @@ -8,6 +8,8 @@ @@ -478,7 +471,7 @@ index bc0a33cd4..8441ac635 100644 ret = dump_creds(ti->creds); out: return ret; -@@ -313,6 +322,95 @@ grps_err: +@@ -313,6 +322,97 @@ grps_err: return -1; } @@ -521,17 +514,18 @@ index bc0a33cd4..8441ac635 100644 + * with rseq() initialized. + * -EPERM or -EBUSY: should not happen as we take a fresh memory area for rseq + */ -+ addr = (void *)sys_mmap(NULL, sizeof(struct rseq), PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); ++ addr = (void *)sys_mmap(NULL, sizeof(struct criu_rseq), PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, ++ 0); + if (addr == MAP_FAILED) { + pr_err("mmap() failed for struct rseq ret = %lx\n", (unsigned long)addr); + return -1; + } + -+ memset(addr, 0, sizeof(struct rseq)); ++ memset(addr, 0, sizeof(struct criu_rseq)); + + /* sys_mmap returns page aligned addresses */ + rseq_abi_pointer = (unsigned long)addr; -+ rseq_abi_size = (unsigned long)sizeof(struct rseq); ++ rseq_abi_size = (unsigned long)sizeof(struct criu_rseq); + /* it's not so important to have unique signature for us, + * because rseq_abi_pointer is guaranteed to be unique + */ @@ -552,7 +546,8 @@ index bc0a33cd4..8441ac635 100644 + ret = -1; + } + } else { -+ ret = sys_rseq((void *)rseq_abi_pointer, sizeof(struct rseq), RSEQ_FLAG_UNREGISTER, rseq_signature); ++ ret = sys_rseq((void *)rseq_abi_pointer, sizeof(struct criu_rseq), RSEQ_FLAG_UNREGISTER, ++ rseq_signature); + if (ret) { + pr_err("\tfailed to unregister sys_rseq(%lx, %lx, %x, %x) = %d\n", rseq_abi_pointer, + rseq_abi_size, RSEQ_FLAG_UNREGISTER, rseq_signature, ret); @@ -566,7 +561,7 @@ index bc0a33cd4..8441ac635 100644 + ret = 0; + } + -+ sys_munmap(addr, sizeof(struct rseq)); ++ sys_munmap(addr, sizeof(struct criu_rseq)); +out_nounmap: + return ret; +} diff --git a/0237-zdtm-add-basic-static-rseq00-test-for-rseq-C-R.patch b/0237-zdtm-add-basic-static-rseq00-test-for-rseq-C-R.patch index cd18d2b..1b4c2ad 100644 --- a/0237-zdtm-add-basic-static-rseq00-test-for-rseq-C-R.patch +++ b/0237-zdtm-add-basic-static-rseq00-test-for-rseq-C-R.patch @@ -1,4 +1,4 @@ -From 2eaa9e9fe9e9cda7b5fd72fc2ebc743a05864883 Mon Sep 17 00:00:00 2001 +From 909f410fde00cf70419915344012a8074f59b3ec Mon Sep 17 00:00:00 2001 From: Alexander Mikhalitsyn Date: Tue, 21 Dec 2021 23:40:01 +0300 Subject: [PATCH 237/249] zdtm: add basic static/rseq00 test for rseq C/R @@ -6,9 +6,9 @@ Subject: [PATCH 237/249] zdtm: add basic static/rseq00 test for rseq C/R Signed-off-by: Alexander Mikhalitsyn --- test/zdtm/static/Makefile | 1 + - test/zdtm/static/rseq00.c | 177 +++++++++++++++++++++++++++++++++++ + test/zdtm/static/rseq00.c | 180 +++++++++++++++++++++++++++++++++++ test/zdtm/static/rseq00.desc | 1 + - 3 files changed, 179 insertions(+) + 3 files changed, 182 insertions(+) create mode 100644 test/zdtm/static/rseq00.c create mode 100644 test/zdtm/static/rseq00.desc @@ -26,10 +26,10 @@ index 717306dbb..568886d60 100644 vdso02 \ diff --git a/test/zdtm/static/rseq00.c b/test/zdtm/static/rseq00.c new file mode 100644 -index 000000000..95e9f40b4 +index 000000000..b1cffb16e --- /dev/null +++ b/test/zdtm/static/rseq00.c -@@ -0,0 +1,177 @@ +@@ -0,0 +1,180 @@ +/* + * test for rseq() syscall + * See also https://www.efficios.com/blog/2019/02/08/linux-restartable-sequences/ @@ -115,6 +115,8 @@ index 000000000..95e9f40b4 + +#define RSEQ_ACCESS_ONCE(x) (*(__volatile__ __typeof__(x) *)&(x)) + ++#define rseq_after_asm_goto() asm volatile("" : : : "memory") ++ +static int rseq_addv(intptr_t *v, intptr_t count, int cpu) +{ + /* clang-format off */ @@ -152,9 +154,10 @@ index 000000000..95e9f40b4 + : abort + ); + /* clang-format on */ -+ ++ rseq_after_asm_goto(); + return 0; +abort: ++ rseq_after_asm_goto(); + return -1; +} + diff --git a/0238-Revert-ci-disable-glibc-rseq-support.patch b/0238-Revert-ci-disable-glibc-rseq-support.patch index 0d3d264..5742963 100644 --- a/0238-Revert-ci-disable-glibc-rseq-support.patch +++ b/0238-Revert-ci-disable-glibc-rseq-support.patch @@ -1,4 +1,4 @@ -From 872ac9f34454fd256af9aae7f72976e355244da2 Mon Sep 17 00:00:00 2001 +From aff15d704012b630b41b4bf6e871a6cf16ab18ec Mon Sep 17 00:00:00 2001 From: Alexander Mikhalitsyn Date: Tue, 21 Dec 2021 23:42:26 +0300 Subject: [PATCH 238/249] Revert "ci: disable glibc rseq support" diff --git a/0239-ci-add-Fedora-Rawhide-based-test-on-Cirrus.patch b/0239-ci-add-Fedora-Rawhide-based-test-on-Cirrus.patch index 3edb3be..5049dac 100644 --- a/0239-ci-add-Fedora-Rawhide-based-test-on-Cirrus.patch +++ b/0239-ci-add-Fedora-Rawhide-based-test-on-Cirrus.patch @@ -1,4 +1,4 @@ -From e31ca9daf19eefd14fdddf2709e9e734301630e1 Mon Sep 17 00:00:00 2001 +From e1d607f73e2d0b0618bfb3cd35e0633b0ed49222 Mon Sep 17 00:00:00 2001 From: Alexander Mikhalitsyn Date: Thu, 23 Dec 2021 14:57:43 +0300 Subject: [PATCH 239/249] ci: add Fedora Rawhide based test on Cirrus diff --git a/0240-include-add-thread_pointer.h-from-Glibc.patch b/0240-include-add-thread_pointer.h-from-Glibc.patch index 3c06959..ac36940 100644 --- a/0240-include-add-thread_pointer.h-from-Glibc.patch +++ b/0240-include-add-thread_pointer.h-from-Glibc.patch @@ -1,4 +1,4 @@ -From d49426d3dce173c61ede04cbd7a3caee8cd24a78 Mon Sep 17 00:00:00 2001 +From deb22c02824133457ba84201a2340625352ddf0f Mon Sep 17 00:00:00 2001 From: Alexander Mikhalitsyn Date: Tue, 22 Feb 2022 14:58:10 +0300 Subject: [PATCH 240/249] include: add thread_pointer.h from Glibc diff --git a/0241-clone-noasan-unregister-rseq-at-the-thread-start-for.patch b/0241-clone-noasan-unregister-rseq-at-the-thread-start-for.patch index dbf2d7f..6f31a24 100644 --- a/0241-clone-noasan-unregister-rseq-at-the-thread-start-for.patch +++ b/0241-clone-noasan-unregister-rseq-at-the-thread-start-for.patch @@ -1,4 +1,4 @@ -From b26dfea16373b8207f432bbebcfc836b09c05751 Mon Sep 17 00:00:00 2001 +From 8444d7085e64d63d0b08b52947affb6361a865a6 Mon Sep 17 00:00:00 2001 From: Alexander Mikhalitsyn Date: Fri, 24 Dec 2021 18:57:54 +0300 Subject: [PATCH 241/249] clone-noasan: unregister rseq at the thread start for @@ -113,7 +113,7 @@ index aff773296..6d6e51259 100644 int clone3_with_pid_noasan(int (*fn)(void *), void *arg, int flags, int exit_signal, pid_t pid); diff --git a/criu/include/linux/rseq.h b/criu/include/linux/rseq.h -index 5c1706a59..fafa2c1c0 100644 +index b227aefdf..a47876e66 100644 --- a/criu/include/linux/rseq.h +++ b/criu/include/linux/rseq.h @@ -2,6 +2,14 @@ @@ -121,7 +121,7 @@ index 5c1706a59..fafa2c1c0 100644 #define _UAPI_LINUX_RSEQ_H +#ifdef __has_include -+#if __has_include ("sys/rseq.h") ++#if __has_include("sys/rseq.h") +#include +#include "asm/thread_pointer.h" +#endif @@ -131,13 +131,14 @@ index 5c1706a59..fafa2c1c0 100644 /* * linux/rseq.h * -@@ -140,5 +148,6 @@ struct rseq { - */ - __u32 flags; +@@ -49,6 +57,7 @@ struct rseq_cs { + __u64 post_commit_offset; + __u64 abort_ip; } __attribute__((aligned(4 * sizeof(__u64)))); +#endif /* __GLIBC_HAVE_KERNEL_RSEQ */ - #endif /* _UAPI_LINUX_RSEQ_H */ + /* + * We have to have our own copy of struct rseq definition because -- 2.35.1 diff --git a/0242-zdtm-static-rseq00-fix-rseq-test-when-linking-with-a.patch b/0242-zdtm-static-rseq00-fix-rseq-test-when-linking-with-a.patch index c4ed8f6..323bccd 100644 --- a/0242-zdtm-static-rseq00-fix-rseq-test-when-linking-with-a.patch +++ b/0242-zdtm-static-rseq00-fix-rseq-test-when-linking-with-a.patch @@ -1,4 +1,4 @@ -From 5f311e25837fdf75643cba8b3f47920308a1625a Mon Sep 17 00:00:00 2001 +From 1af69a81c53cd23dda7d82ab434c22fbf4ed8959 Mon Sep 17 00:00:00 2001 From: Alexander Mikhalitsyn Date: Fri, 24 Dec 2021 22:56:56 +0300 Subject: [PATCH 242/249] zdtm/static/rseq00: fix rseq test when linking with a @@ -13,7 +13,7 @@ Signed-off-by: Alexander Mikhalitsyn 1 file changed, 49 insertions(+), 17 deletions(-) diff --git a/test/zdtm/static/rseq00.c b/test/zdtm/static/rseq00.c -index 95e9f40b4..acf790753 100644 +index b1cffb16e..a50c8a48e 100644 --- a/test/zdtm/static/rseq00.c +++ b/test/zdtm/static/rseq00.c @@ -19,13 +19,48 @@ @@ -117,7 +117,7 @@ index 95e9f40b4..acf790753 100644 if (!(rc && errno == EBUSY)) { fail("Failed to check rseq %d", rc); exit(1); -@@ -111,8 +140,8 @@ static int rseq_addv(intptr_t *v, intptr_t count, int cpu) +@@ -113,8 +142,8 @@ static int rseq_addv(intptr_t *v, intptr_t count, int cpu) ".popsection\n\t" : /* gcc asm goto does not allow outputs */ : [cpu_id] "r" (cpu), @@ -128,7 +128,7 @@ index 95e9f40b4..acf790753 100644 /* final store input */ [v] "m" (*v), [count] "er" (count) -@@ -132,6 +161,9 @@ int main(int argc, char *argv[]) +@@ -135,6 +164,9 @@ int main(int argc, char *argv[]) intptr_t *cpu_data; long nr_cpus = sysconf(_SC_NPROCESSORS_ONLN); @@ -138,7 +138,7 @@ index 95e9f40b4..acf790753 100644 test_init(argc, argv); cpu_data = calloc(nr_cpus, sizeof(*cpu_data)); -@@ -147,7 +179,7 @@ int main(int argc, char *argv[]) +@@ -150,7 +182,7 @@ int main(int argc, char *argv[]) check_thread(); diff --git a/0243-compel-add-helpers-to-get-set-instruction-pointer.patch b/0243-compel-add-helpers-to-get-set-instruction-pointer.patch index d1e806a..5832781 100644 --- a/0243-compel-add-helpers-to-get-set-instruction-pointer.patch +++ b/0243-compel-add-helpers-to-get-set-instruction-pointer.patch @@ -1,4 +1,4 @@ -From cbbd1f1491be604b501ab93bc51b51853abdb7a8 Mon Sep 17 00:00:00 2001 +From 508e66a3eb46a9cc57a9ea115a0ca85417a9b015 Mon Sep 17 00:00:00 2001 From: Alexander Mikhalitsyn Date: Mon, 21 Feb 2022 15:15:52 +0300 Subject: [PATCH 243/249] compel: add helpers to get/set instruction pointer diff --git a/0244-cr-dump-fixup-thread-IP-when-inside-rseq-cs.patch b/0244-cr-dump-fixup-thread-IP-when-inside-rseq-cs.patch index 321bc24..6330e03 100644 --- a/0244-cr-dump-fixup-thread-IP-when-inside-rseq-cs.patch +++ b/0244-cr-dump-fixup-thread-IP-when-inside-rseq-cs.patch @@ -1,15 +1,14 @@ -From a8d33aa97d51655272bd141fd4fbd6f683a98318 Mon Sep 17 00:00:00 2001 +From dcb3bec96b15682d296387a36350f694ab043e5e Mon Sep 17 00:00:00 2001 From: Alexander Mikhalitsyn Date: Mon, 21 Feb 2022 15:25:21 +0300 Subject: [PATCH 244/249] cr-dump: fixup thread IP when inside rseq cs Signed-off-by: Alexander Mikhalitsyn --- - criu/cr-dump.c | 156 +++++++++++++++++++++++++++++++++++++- - criu/include/linux/rseq.h | 2 +- - criu/include/parasite.h | 2 + - criu/include/pstree.h | 1 + - 4 files changed, 156 insertions(+), 5 deletions(-) + criu/cr-dump.c | 156 ++++++++++++++++++++++++++++++++++++++-- + criu/include/parasite.h | 2 + + criu/include/pstree.h | 1 + + 3 files changed, 155 insertions(+), 4 deletions(-) diff --git a/criu/cr-dump.c b/criu/cr-dump.c index eb645a597..1992991a2 100644 @@ -220,19 +219,6 @@ index eb645a597..1992991a2 100644 if (fault_injected(FI_DUMP_EARLY)) { pr_info("fault: CRIU sudden detach\n"); kill(getpid(), SIGKILL); -diff --git a/criu/include/linux/rseq.h b/criu/include/linux/rseq.h -index fafa2c1c0..0c826c7f2 100644 ---- a/criu/include/linux/rseq.h -+++ b/criu/include/linux/rseq.h -@@ -3,7 +3,7 @@ - #define _UAPI_LINUX_RSEQ_H - - #ifdef __has_include --#if __has_include ("sys/rseq.h") -+#if __has_include("sys/rseq.h") - #include - #include "asm/thread_pointer.h" - #endif diff --git a/criu/include/parasite.h b/criu/include/parasite.h index 5fde80996..d2a06889f 100644 --- a/criu/include/parasite.h diff --git a/0245-zdtm-add-transition-rseq01-test-for-amd64.patch b/0245-zdtm-add-transition-rseq01-test-for-amd64.patch index b86acce..b51c1ea 100644 --- a/0245-zdtm-add-transition-rseq01-test-for-amd64.patch +++ b/0245-zdtm-add-transition-rseq01-test-for-amd64.patch @@ -1,4 +1,4 @@ -From 7f91af616406a97761d658550fdfcdb38a5e333d Mon Sep 17 00:00:00 2001 +From c4a4013816b036f9fed123d3b51f5e83cfce3469 Mon Sep 17 00:00:00 2001 From: Alexander Mikhalitsyn Date: Mon, 21 Feb 2022 15:45:40 +0300 Subject: [PATCH 245/249] zdtm: add transition/rseq01 test for amd64 @@ -6,9 +6,9 @@ Subject: [PATCH 245/249] zdtm: add transition/rseq01 test for amd64 Signed-off-by: Alexander Mikhalitsyn --- test/zdtm/transition/Makefile | 1 + - test/zdtm/transition/rseq01.c | 209 +++++++++++++++++++++++++++++++ + test/zdtm/transition/rseq01.c | 212 +++++++++++++++++++++++++++++++ test/zdtm/transition/rseq01.desc | 1 + - 3 files changed, 211 insertions(+) + 3 files changed, 214 insertions(+) create mode 100644 test/zdtm/transition/rseq01.c create mode 100644 test/zdtm/transition/rseq01.desc @@ -26,10 +26,10 @@ index 9388157e8..fae4e27b3 100644 TST_FILE = \ diff --git a/test/zdtm/transition/rseq01.c b/test/zdtm/transition/rseq01.c new file mode 100644 -index 000000000..a0c3dbc82 +index 000000000..cc8ecfdcd --- /dev/null +++ b/test/zdtm/transition/rseq01.c -@@ -0,0 +1,209 @@ +@@ -0,0 +1,212 @@ +#include +#include +#include @@ -132,6 +132,8 @@ index 000000000..a0c3dbc82 + +#define RSEQ_ACCESS_ONCE(x) (*(__volatile__ __typeof__(x) *)&(x)) + ++#define rseq_after_asm_goto() asm volatile("" : : : "memory") ++ +static int rseq_addv(intptr_t *v, intptr_t count, int cpu) +{ + double a = 10000000000000000.0; @@ -183,9 +185,10 @@ index 000000000..a0c3dbc82 + : abort + ); + /* clang-format on */ -+ ++ rseq_after_asm_goto(); + return 0; +abort: ++ rseq_after_asm_goto(); + return -1; +} + diff --git a/0246-Revert-test-disable-rseq-also-on-Archlinux.patch b/0246-Revert-test-disable-rseq-also-on-Archlinux.patch index 0b3e77f..17269e4 100644 --- a/0246-Revert-test-disable-rseq-also-on-Archlinux.patch +++ b/0246-Revert-test-disable-rseq-also-on-Archlinux.patch @@ -1,4 +1,4 @@ -From b4e121a54c83c172d3b78b1d9002f4367a2c1fb8 Mon Sep 17 00:00:00 2001 +From 49ecd6d864df8cf0951d3c5eeea94d30585c0897 Mon Sep 17 00:00:00 2001 From: Alexander Mikhalitsyn Date: Tue, 22 Feb 2022 15:25:37 +0300 Subject: [PATCH 246/249] Revert "test: disable rseq also on Archlinux" diff --git a/0247-cr-dump-handle-rseq-flags-field.patch b/0247-cr-dump-handle-rseq-flags-field.patch index d837bc8..4569751 100644 --- a/0247-cr-dump-handle-rseq-flags-field.patch +++ b/0247-cr-dump-handle-rseq-flags-field.patch @@ -1,4 +1,4 @@ -From 392f1ecdcbd53f558f101b384831876f4b3969f9 Mon Sep 17 00:00:00 2001 +From e07f53a1d700aa2552ac6fb137f45b9a9bce72db Mon Sep 17 00:00:00 2001 From: Alexander Mikhalitsyn Date: Tue, 22 Feb 2022 18:22:45 +0300 Subject: [PATCH 247/249] cr-dump: handle rseq flags field @@ -7,15 +7,15 @@ Userspace may configure rseq critical section by def Signed-off-by: Alexander Mikhalitsyn --- - criu/cr-dump.c | 87 +++++++++++++++++++++++++---------------- - criu/cr-restore.c | 57 +++++++++++++++++++++++++++ + criu/cr-dump.c | 86 +++++++++++++++++++++++++---------------- + criu/cr-restore.c | 58 +++++++++++++++++++++++++++ criu/include/rst_info.h | 8 ++++ criu/pstree.c | 36 +++++++++++++++++ images/rseq.proto | 1 + 5 files changed, 155 insertions(+), 34 deletions(-) diff --git a/criu/cr-dump.c b/criu/cr-dump.c -index 1992991a2..5f40f2b5b 100644 +index 1992991a2..c708a6599 100644 --- a/criu/cr-dump.c +++ b/criu/cr-dump.c @@ -1034,13 +1034,13 @@ static int dump_task_signals(pid_t pid, struct pstree_item *item) @@ -24,7 +24,7 @@ index 1992991a2..5f40f2b5b 100644 -static int read_rseq_cs(pid_t tid, struct __ptrace_rseq_configuration *rseq, struct rseq_cs *rseq_cs) +static int read_rseq_cs(pid_t tid, struct __ptrace_rseq_configuration *rseqc, struct rseq_cs *rseq_cs, -+ struct rseq *rseq) ++ struct criu_rseq *rseq) { int ret; - uint64_t addr; @@ -35,13 +35,13 @@ index 1992991a2..5f40f2b5b 100644 return 0; /* -@@ -1055,23 +1055,21 @@ static int read_rseq_cs(pid_t tid, struct __ptrace_rseq_configuration *rseq, str +@@ -1055,23 +1055,20 @@ static int read_rseq_cs(pid_t tid, struct __ptrace_rseq_configuration *rseq, str * then rseq_ip_fixup() -> clear_rseq_cs() and user space memory with struct rseq * will be cleared. So, let's use ptrace(PTRACE_PEEKDATA). */ - ret = ptrace_peek_area(tid, &addr, decode_pointer(rseq->rseq_abi_pointer + offsetof(struct rseq, rseq_cs)), - sizeof(uint64_t)); -+ ret = ptrace_peek_area(tid, rseq, decode_pointer(rseqc->rseq_abi_pointer), sizeof(struct rseq)); ++ ret = ptrace_peek_area(tid, rseq, decode_pointer(rseqc->rseq_abi_pointer), sizeof(struct criu_rseq)); if (ret) { - pr_err("ptrace_peek_area(%d, %lx, %lx, %lx): fail to read rseq_cs addr\n", tid, (unsigned long)&addr, - (unsigned long)(rseq->rseq_abi_pointer + offsetof(struct rseq, rseq_cs)), @@ -53,20 +53,19 @@ index 1992991a2..5f40f2b5b 100644 - /* (struct rseq)->rseq_cs is NULL */ - if (!addr) -+ if (!rseq->rseq_cs.ptr64) ++ if (!rseq->rseq_cs) return 0; - ret = ptrace_peek_area(tid, rseq_cs, decode_pointer(addr), sizeof(struct rseq_cs)); -+ ret = ptrace_peek_area(tid, rseq_cs, decode_pointer(rseq->rseq_cs.ptr64), sizeof(struct rseq_cs)); ++ ret = ptrace_peek_area(tid, rseq_cs, decode_pointer(rseq->rseq_cs), sizeof(struct rseq_cs)); if (ret) { pr_err("ptrace_peek_area(%d, %lx, %lx, %lx): fail to read rseq_cs struct\n", tid, - (unsigned long)rseq_cs, (unsigned long)addr, (unsigned long)sizeof(struct rseq_cs)); -+ (unsigned long)rseq_cs, (unsigned long)rseq->rseq_cs.ptr64, -+ (unsigned long)sizeof(struct rseq_cs)); ++ (unsigned long)rseq_cs, (unsigned long)rseq->rseq_cs, (unsigned long)sizeof(struct rseq_cs)); return -1; } -@@ -1080,11 +1078,12 @@ static int read_rseq_cs(pid_t tid, struct __ptrace_rseq_configuration *rseq, str +@@ -1080,11 +1077,12 @@ static int read_rseq_cs(pid_t tid, struct __ptrace_rseq_configuration *rseq, str static int dump_thread_rseq(struct pstree_item *item, int i) { @@ -76,11 +75,11 @@ index 1992991a2..5f40f2b5b 100644 int ret; CoreEntry *core = item->core[i]; RseqEntry **rseqep = &core->thread_core->rseq_entry; -+ struct rseq rseq; ++ struct criu_rseq rseq = {}; struct rseq_cs *rseq_cs = &dmpi(item)->thread_rseq_cs[i]; pid_t tid = item->threads[i].real; -@@ -1099,20 +1098,20 @@ static int dump_thread_rseq(struct pstree_item *item, int i) +@@ -1099,20 +1097,20 @@ static int dump_thread_rseq(struct pstree_item *item, int i) if (!kdat.has_ptrace_get_rseq_conf) return 0; @@ -107,7 +106,7 @@ index 1992991a2..5f40f2b5b 100644 rseqe = xmalloc(sizeof(*rseqe)); if (!rseqe) -@@ -1120,13 +1119,22 @@ static int dump_thread_rseq(struct pstree_item *item, int i) +@@ -1120,13 +1118,22 @@ static int dump_thread_rseq(struct pstree_item *item, int i) rseq_entry__init(rseqe); @@ -123,7 +122,7 @@ index 1992991a2..5f40f2b5b 100644 goto err; + rseqe->has_rseq_cs_pointer = true; -+ rseqe->rseq_cs_pointer = rseq.rseq_cs.ptr64; ++ rseqe->rseq_cs_pointer = rseq.rseq_cs; + + /* we won't save rseq_cs to the image (only pointer), + * so let's combine flags from both struct rseq and struct rseq_cs @@ -134,7 +133,7 @@ index 1992991a2..5f40f2b5b 100644 /* save rseq entry to the image */ *rseqep = rseqe; -@@ -1176,11 +1184,12 @@ static int fixup_thread_rseq(struct pstree_item *item, int i) +@@ -1176,11 +1183,12 @@ static int fixup_thread_rseq(struct pstree_item *item, int i) struct rseq_cs *rseq_cs = &dmpi(item)->thread_rseq_cs[i]; pid_t tid = item->threads[i].real; @@ -149,7 +148,7 @@ index 1992991a2..5f40f2b5b 100644 tid, rseq_cs->start_ip, rseq_cs->abort_ip, rseq_cs->post_commit_offset, rseq_cs->flags, rseq_cs->version, (unsigned long)TI_IP(core)); -@@ -1192,25 +1201,35 @@ static int fixup_thread_rseq(struct pstree_item *item, int i) +@@ -1192,25 +1200,35 @@ static int fixup_thread_rseq(struct pstree_item *item, int i) if (task_in_rseq(rseq_cs, TI_IP(core))) { struct pid *tid = &item->threads[i]; @@ -195,7 +194,7 @@ index 1992991a2..5f40f2b5b 100644 } diff --git a/criu/cr-restore.c b/criu/cr-restore.c -index b2ddc8db0..77b0a8c0f 100644 +index b2ddc8db0..e3770f853 100644 --- a/criu/cr-restore.c +++ b/criu/cr-restore.c @@ -23,6 +23,7 @@ @@ -225,7 +224,7 @@ index b2ddc8db0..77b0a8c0f 100644 return 0; err: xfree(cores); -@@ -1966,6 +1979,47 @@ static int attach_to_tasks(bool root_seized) +@@ -1966,6 +1979,48 @@ static int attach_to_tasks(bool root_seized) return 0; } @@ -258,9 +257,10 @@ index b2ddc8db0..77b0a8c0f 100644 + if (!rseqe[i].rseq_cs_pointer || !rseqe[i].rseq_abi_pointer) + continue; + -+ if (ptrace_poke_area(pid, &rseqe[i].rseq_cs_pointer, -+ decode_pointer(rseqe[i].rseq_abi_pointer + offsetof(struct rseq, rseq_cs)), -+ sizeof(uint64_t))) { ++ if (ptrace_poke_area( ++ pid, &rseqe[i].rseq_cs_pointer, ++ decode_pointer(rseqe[i].rseq_abi_pointer + offsetof(struct criu_rseq, rseq_cs)), ++ sizeof(uint64_t))) { + pr_err("Can't restore rseq_cs pointer (pid: %d)\n", pid); + return -1; + } @@ -273,7 +273,7 @@ index b2ddc8db0..77b0a8c0f 100644 static int catch_tasks(bool root_seized, enum trace_flags *flag) { struct pstree_item *item; -@@ -2400,6 +2454,9 @@ skip_ns_bouncing: +@@ -2400,6 +2455,9 @@ skip_ns_bouncing: if (restore_freezer_state()) pr_err("Unable to restore freezer state\n"); diff --git a/0248-zdtm-add-rseq02-transition-test-with-NO_RESTART-CS-f.patch b/0248-zdtm-add-rseq02-transition-test-with-NO_RESTART-CS-f.patch index 0988931..37e3d61 100644 --- a/0248-zdtm-add-rseq02-transition-test-with-NO_RESTART-CS-f.patch +++ b/0248-zdtm-add-rseq02-transition-test-with-NO_RESTART-CS-f.patch @@ -1,4 +1,4 @@ -From ab6d09a8c0303a036b0964c7263075e74b02ce48 Mon Sep 17 00:00:00 2001 +From 354fcbb88018261832360d3d07290c2913021328 Mon Sep 17 00:00:00 2001 From: Alexander Mikhalitsyn Date: Wed, 23 Feb 2022 23:20:29 +0300 Subject: [PATCH 248/249] zdtm: add rseq02 transition test with NO_RESTART CS @@ -35,7 +35,7 @@ index fae4e27b3..378a4fc75 100644 %: %.sh cp $< $@ diff --git a/test/zdtm/transition/rseq01.c b/test/zdtm/transition/rseq01.c -index a0c3dbc82..26b8fe335 100644 +index cc8ecfdcd..1356cb5ed 100644 --- a/test/zdtm/transition/rseq01.c +++ b/test/zdtm/transition/rseq01.c @@ -53,6 +53,18 @@ enum rseq_flags { @@ -57,7 +57,7 @@ index a0c3dbc82..26b8fe335 100644 struct rseq { uint32_t cpu_id_start; uint32_t cpu_id; -@@ -104,6 +116,7 @@ static int rseq_addv(intptr_t *v, intptr_t count, int cpu) +@@ -106,6 +118,7 @@ static int rseq_addv(intptr_t *v, intptr_t count, int cpu) { double a = 10000000000000000.0; double b = -1; @@ -65,7 +65,7 @@ index a0c3dbc82..26b8fe335 100644 /* clang-format off */ __asm__ __volatile__ goto( -@@ -128,6 +141,9 @@ static int rseq_addv(intptr_t *v, intptr_t count, int cpu) +@@ -130,6 +143,9 @@ static int rseq_addv(intptr_t *v, intptr_t count, int cpu) "dec %%rcx\n\t" "jnz 5b\n\t" "fstpl %[y]\n\t" @@ -75,7 +75,7 @@ index a0c3dbc82..26b8fe335 100644 "2:\n\t" ".pushsection __rseq_failure, \"ax\"\n\t" /* Disassembler-friendly signature: nopl (%rip). */ -@@ -142,6 +158,8 @@ static int rseq_addv(intptr_t *v, intptr_t count, int cpu) +@@ -144,6 +160,8 @@ static int rseq_addv(intptr_t *v, intptr_t count, int cpu) : [cpu_id] "r" (cpu), [current_cpu_id] "m" (rseq_ptr->cpu_id), [rseq_cs] "m" (rseq_ptr->rseq_cs), @@ -84,10 +84,10 @@ index a0c3dbc82..26b8fe335 100644 /* final store input */ [v] "m" (*v), [count] "er" (count), -@@ -152,8 +170,21 @@ static int rseq_addv(intptr_t *v, intptr_t count, int cpu) +@@ -154,9 +172,22 @@ static int rseq_addv(intptr_t *v, intptr_t count, int cpu) ); /* clang-format on */ - + rseq_after_asm_goto(); + test_msg("exit %lx %lx %f %f\n", rseq_cs1, rseq_cs2, a, b); + if (rseq_cs1 != rseq_cs2) { + /* @@ -102,11 +102,12 @@ index a0c3dbc82..26b8fe335 100644 + return 0; abort: + rseq_after_asm_goto(); + test_msg("abort %lx %lx %f %f\n", rseq_cs1, rseq_cs2, a, b); return -1; } -@@ -175,21 +206,45 @@ int main(int argc, char *argv[]) +@@ -178,21 +209,45 @@ int main(int argc, char *argv[]) fail("calloc"); exit(EXIT_FAILURE); } diff --git a/0249-zdtm-temporary-disable-rseq02-test.patch b/0249-zdtm-temporary-disable-rseq02-test.patch index f07a174..a66f6bb 100644 --- a/0249-zdtm-temporary-disable-rseq02-test.patch +++ b/0249-zdtm-temporary-disable-rseq02-test.patch @@ -1,4 +1,4 @@ -From 149d70490d27bfa302ed977b40f55df4aecd36ea Mon Sep 17 00:00:00 2001 +From dd656e5565b9bb77b5a66d80302301f9dfebfa8a Mon Sep 17 00:00:00 2001 From: Alexander Mikhalitsyn Date: Tue, 5 Apr 2022 12:27:07 +0300 Subject: [PATCH 249/249] zdtm: temporary disable rseq02 test diff --git a/criu.spec b/criu.spec index c1e1167..8f8eb15 100644 --- a/criu.spec +++ b/criu.spec @@ -17,7 +17,7 @@ Name: criu Version: 3.16.1 -Release: 11%{?dist} +Release: 12%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPLv2 URL: http://criu.org/ @@ -709,6 +709,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %doc %{_mandir}/man1/criu-ns.1* %changelog +* Tue Apr 5 2022 Radostin Stoyanov - 3.16.1-12 +- Update rseq patches + * Tue Apr 5 2022 Radostin Stoyanov - 3.16.1-11 - Update rseq patches From 00845889d4e25468835e475ae948ca6d1d2dc1fa Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Fri, 6 May 2022 12:46:54 +0100 Subject: [PATCH 045/109] Update to version 3.17 Signed-off-by: Radostin Stoyanov --- .gitignore | 1 + 0001-criu-8-add-external-net-option.patch | 33 - ...ng-TCP-state-when-dumping-with-tcp-c.patch | 40 - ...toring-with-tcp-close-on-TCP_CLOSE-s.patch | 110 - ...detailed-description-about-tcp-close.patch | 33 - ...support-for-python3-in-criu-coredump.patch | 311 --- ...r-running-criu-coredump-via-python-2.patch | 71 - 0007-coredump-remove-unused-import.patch | 32 - 0008-coredump-sort-imports.patch | 31 - ...redump-convert-indentation-to-spaces.patch | 107 - ...-replace-equality-with-identity-test.patch | 117 - 0011-coredump-drop-unused-variable.patch | 26 - 0012-coredump-drop-exec-permission.patch | 20 - ...coredump-lint-fix-for-block-comments.patch | 1289 ----------- ...x-missing-whitespace-around-operator.patch | 29 - 0015-coredump-fix-too-many-blank-lines.patch | 27 - 0016-coredump-fix-comparison-to-true.patch | 29 - ...dump-lint-fix-visually-indented-line.patch | 52 - ...-test-coredump-fix-shellcheck-errors.patch | 51 - 0019-make-enable-lint-for-coredump.patch | 31 - 0020-ci-enable-coredump-tests.patch | 39 - ...-remove-excess-hash-printf-specifier.patch | 39 - ...x-the-null-pointer-of-get_tty_driver.patch | 34 - 0023-util-use-nftw-in-rmrf-helper.patch | 126 -- ...u-ns-make-pidns-init-first-do-setsid.patch | 37 - ...tore_rule-to-not-open-the-CR_FD_RULE.patch | 113 - ...ace-deprecated-codecov-bash-uploader.patch | 45 - 0027-ci-fix-userfaultfd-test-failures.patch | 36 - 0028-ci-use-Fedora-34-for-lint-CI-runs.patch | 29 - ...e-the-image-streamer-process-control.patch | 145 -- ...-don-t-call-sk_setbufs-asyncronously.patch | 32 - ...r-set-getsockopt-SO_BUF_LOCK-availab.patch | 132 -- 0032-sockets-c-r-bufer-size-locks.patch | 69 - ...dd-test-for-socket-buffer-size-locks.patch | 118 - ...pts02-also-check-lock-change-by-SO_-.patch | 115 - ...-format-enable-AlignTrailingComments.patch | 173 -- ...mat-do-several-manual-comment-fixups.patch | 169 -- ...g-format-do-automatic-comment-fixups.patch | 1889 ----------------- ...mping-when-zombie-process-with-sid-0.patch | 35 - ...e-x86_ins_capability_mask-human-read.patch | 176 -- ...i-disable-socket-raw-test-on-centos8.patch | 44 - ...make-tests-with-link_remap-exclusive.patch | 60 - ...e-deterministic-behavior-of-the-test.patch | 108 - ...m-fix-clang-complains-about-strange-.patch | 99 - ...estore-cgroup-freezer-to-right-state.patch | 72 - ...latest-Fedora-for-lint-ci-runs-again.patch | 30 - ...-crtools-ignore-SIGPIPE-in-swrk-mode.patch | 72 - 0047-ci-switch-to-centos-stream-8.patch | 29 - 0048-check-cleanup-child-processes.patch | 68 - ...-reg-fix-error-handling-in-open_path.patch | 156 -- ...fix-error-handling-of-rm_parent_dirs.patch | 116 - ...cate-remounted_rw-in-shmem-to-get-in.patch | 180 -- ...ary-remount-writable-the-mount-we-do.patch | 46 - ...unt-check-after-c-r-to-mntns_ghost01.patch | 47 - ...able-wrong-struct-pointer-declaratio.patch | 115 - ...i-Run-cross-compile-on-debian-stable.patch | 181 -- ...un-cross-compile-with-debian-testing.patch | 197 -- ...xplicitly-enable-FPU-on-ARMv7-builds.patch | 48 - ...-ci-disable-broken-tests-until-fixed.patch | 59 - ...use-keep-going-for-single-zdtm-tests.patch | 101 - ...mp_ghost_remap-if-link-remap-failed-.patch | 137 -- 0061-util-make-page-server-IPv6-safe.patch | 63 - ...P_ESTABLISHED-checks-in-unix-sockets.patch | 48 - ...e-disabled-unix-socket-related-tests.patch | 34 - 0064-ci-install-procps-in-Alpine.patch | 29 - ...-to-correctly-fix-the-kernel-version.patch | 34 - ...ault-inject-bound-xsave-features-set.patch | 59 - ...-fault-inject-print-the-initial-seed.patch | 41 - ...x86-xsave-fault-injection-tests-back.patch | 32 - ...Add-documentation-for-timeout-option.patch | 48 - ...T-should-not-require-an-input-descri.patch | 32 - ...setting-lsm-mount-context-to-libcriu.patch | 67 - ...e-unstable-release-for-cross-compile.patch | 182 -- 0073-ci-disable-glibc-rseq-support.patch | 55 - ...-libcriu-add-single-pre-dump-support.patch | 185 -- ...ded-test-for-single-pre-dump-support.patch | 262 --- ...-MAKEFLAGS-env-variable-before-runni.patch | 56 - ...-compilation-error-with-strict-proto.patch | 33 - ...s-deleted-dst-test-leftover-from-git.patch | 21 - ...-remove-excess-always-true-condition.patch | 29 - ...xport-current-criu-mode-to-opts.mode.patch | 309 --- ...-use-new-opts.mode-in-image_dir_mode.patch | 48 - ...that-cpuinfo-command-has-sub-command.patch | 29 - ...port-for-SOCK_SEQPACKET-unix-sockets.patch | 53 - ...QPACKET-variants-to-unix-socket-test.patch | 574 ----- 0085-tls-fix-typo.patch | 26 - 0086-tls-use-ssize_t-for-return-value.patch | 71 - 0087-tls-add-more-comments.patch | 111 - ...nect_from_page_server-to-shutdown-a-.patch | 30 - ...-terminate-connections-synchronously.patch | 100 - ...aiting-for-a-new-command-after-a-clo.patch | 66 - ...lazy-thp-test-in-the-lazy-remote-mod.patch | 30 - ...e.out.inprogress-if-a-test-has-faile.patch | 38 - ...ils-of-all-logs-if-a-test-has-failed.patch | 38 - ...ic-uffd-events-add-more-log-messages.patch | 53 - ...k_mountpoint_fd-from-__open_mountpoi.patch | 120 -- ...mnt_fd-argument-of-__open_mountpoint.patch | 116 - ...e-add-helper-to-resolve-sdev-from-fd.patch | 101 - ...-check_mountpoint_fd-fallback-to-get.patch | 140 -- ...t-criu-image-streamer-with-all-tests.patch | 33 - 0100-readme-add-docker-test-badge.patch | 25 - ...tributing-remove-old-badges-and-logo.patch | 28 - ...-to-latest-Vagrant-and-Fedora-images.patch | 37 - 0103-ci-added-.lgtm.yml-file.patch | 56 - ...b-introduce-feature-check-in-libcriu.patch | 144 -- ...d-tests-for-feature-check-in-libcriu.patch | 132 -- ...-tiny-fix-on-truncating-memory-image.patch | 64 - ...fix-zdtm-static-maps00-case-in-arm64.patch | 43 - ...pel-fix-GCC-12-failure-out-of-bounds.patch | 74 - ...nfiguration-file-scanner-with-GCC-12.patch | 36 - 0110-compel-fix-parasite-with-GCC-12.patch | 43 - ...-continue-on-error-for-cross-compile.patch | 51 - 0112-test-autofs-fix-use-after-free.patch | 67 - ...Fix-formatting-in-criu-documentation.patch | 44 - 0114-ci-install-libbsd-dependency.patch | 78 - ...ting-sid-for-shell-job-also-update-m.patch | 33 - ...riu-ns-fix-exit-code-o-for-criu-dump.patch | 29 - ...riu-ns-use-os.waitstatus_to_exitcode.patch | 33 - ...-Fix-sys_mmap-s-returned-value-check.patch | 30 - ...TRACE_GET_THREAD_AREA-errors-are-han.patch | 52 - ...an-unique-ID-of-the-current-criu-run.patch | 72 - ...nerate-unique-transport-socket-names.patch | 30 - ...a-check-for-using-memfd-with-hugetlb.patch | 107 - ...rndat-Collect-hugetlb-device-numbers.patch | 414 ---- ...for-checkpoint-restore-hugetlb-Syste.patch | 116 - ...support-for-checkpoint-restore-memfd.patch | 151 -- ...-Add-support-for-hugetlb-memory-mapp.patch | 127 -- ...-mem-Skip-premapping-hugetlb-mapping.patch | 40 - ...azy-mode-restore-on-hugetlb-mappings.patch | 32 - ...-Add-MAP_HUGETLB-memory-mapping-test.patch | 228 -- 0130-zdtm-Add-memfd-hugetlb-test.patch | 166 -- 0131-zdtm-Add-shm-hugetlb-test.patch | 121 -- ...ETLB-mappings-test-for-parent-child-.patch | 171 -- ...kip-MAP_HUGETLB-tests-in-stream-test.patch | 40 - 0134-bpfmap-handle-new-field-in-fdinfo.patch | 124 -- ...test-remove-test-for-LOCK_MAND-flock.patch | 49 - ...-test-disable-rseq-also-on-Archlinux.patch | 29 - 0137-zdtm-fix-missplacement-of-err-True.patch | 32 - ...mxcsr-during-error-injection-to-zero.patch | 45 - ...smaps-remove-useless-nonlinear-check.patch | 39 - ...ount-fix-e_str-leak-in-ext_mount_add.patch | 52 - ...-fix-cr_imgset-leak-in-dump_one_task.patch | 124 -- ...n-fix-tun_link-leak-in-dump_tun_link.patch | 66 - ...32_t-id-variable-printf-format-speci.patch | 35 - 0144-zdtm-refactor-main.patch | 459 ---- 0145-zdtm-sort-import-lines.patch | 70 - 0146-zdtm-use-long-form-cli-options.patch | 77 - 0147-zdtm-add-criu-config-option.patch | 127 -- ...-redundant-config_inotify_irmap-test.patch | 174 -- 0149-ci-run-criu-config-tests.patch | 51 - ...-config-fix-ns-leak-in-parse_join_ns.patch | 53 - ...-net-fix-e_str-leak-in-veth_pair_add.patch | 51 - ...files-fix-inh-leak-in-inherit_fd_add.patch | 55 - ...nix-fix-e_str-leak-in-unix_sk_id_add.patch | 51 - ...ffd-fix-__u64-print-format-specifier.patch | 39 - ..._master-test-to-correspond-to-it-s-n.patch | 54 - ...o_add_list_before-helper-for-adding-.patch | 98 - ...ect-non-fsroot-mounts-as-device-exte.patch | 44 - ...-mounts-of-external-devices-external.patch | 178 -- ...e-and-source-checks-for-external-mou.patch | 77 - ...bind-list-before-using-it-in-mnt_is_.patch | 164 -- 0161-util-add-get_relative_path-helper.patch | 142 -- ...e-tests-for-get_relative_path-helper.patch | 138 -- ...nd_pick-helper-to-pick-the-desired-b.patch | 62 - ...is_external-_bind-and-can_receive_ma.patch | 160 -- ...pping-external-mounts-in-dump_one_mo.patch | 45 - ...w-more-info-about-why-we-can-t-mount.patch | 108 - ...rnal-mount-before-mounting-it-s-bind.patch | 103 - 0168-zdtm-add-new-mnt_ext_root-test.patch | 162 -- ...p-external-mount-map-to-init-contain.patch | 66 - 0170-zdtm-add-mnt_ext_collision-test.patch | 273 --- 0171-mount-add-mnt_is_root_bind-helper.patch | 119 -- ...ed-mount-namespaces-with-different-r.patch | 50 - 0173-zdtm-add-mntns_pivot_root-test.patch | 198 -- ...-superblock-flags-to-nested-ns-roots.patch | 35 - 0175-zdtm-add-mntns_pivot_root_ro-test.patch | 113 - ...eate-auxiliary-binfmt_misc-mount-in-.patch | 176 -- ...ave-ns_mountpoint-NULL-for-aux-binfm.patch | 33 - ...ace-CRTIME_MNT_ID-with-HELPER_MNT_ID.patch | 77 - ...-can_receive_master_from_root-helper.patch | 62 - ...al-slavery-mounts-to-separate-mnt_ex.patch | 77 - ...erride-master_id-to-1-for-root-binds.patch | 100 - ...d-helper-mnt_get_external_bind_nodev.patch | 58 - ...-is_overmounted-as-early-as-possible.patch | 123 -- ...yard-tree-merge-as-early-as-possible.patch | 121 -- ...-mount-fix-broken-remounted_rw-check.patch | 36 - ...al-place-for-shared-variables-on-mou.patch | 101 - ...mountpoint-in-autofs_create_dentries.patch | 55 - ...-ns_mountpoint-in-mnt_is_overmounted.patch | 43 - ...yard-children-from-mnt_needs_remap-c.patch | 51 - ...ntpoint-in-validate_children_collisi.patch | 36 - ..._mountpoint-in-root_path_from_parent.patch | 55 - ...ntpoint-for-children-overmount-check.patch | 35 - ...t_get_sibling_path-via-get_relative_.patch | 155 -- ...use-ns_mountpoint-in-collect_mntinfo.patch | 53 - ...ount-use-ns_mountpoint-in-aufs_parse.patch | 31 - ...mount-use-ns_mountpoint-in-mnt_depth.patch | 33 - ...ntpoint-instead-of-mountpoint-where-.patch | 567 ----- ...ice_mountpoint-getter-for-mountpoint.patch | 535 ----- ...create_ghost_dentry-out-of-create_gh.patch | 120 -- ...h-create_ghost-to-work-with-mount-v2.patch | 129 -- ...clean_one_remap-to-work-with-mount-v.patch | 101 - ...or-MOVE_MOUNT_SET_GROUP-availability.patch | 285 --- 0203-compel-add-open_tree-syscall.patch | 129 -- ...ether-the-openat2-syscall-is-support.patch | 270 --- 0205-util-add-resolve_mountpoint-helper.patch | 159 -- ...ck_options-after-kerndat_init-and-lo.patch | 41 - ...ew-option-mntns-compat-mode-for-old-.patch | 230 -- 0208-mount-add-plain-mountpoints.patch | 131 -- ...ort-parent-dirs-helpers-for-mount-v2.patch | 48 - ...ount-remove-double-ns_id-declaration.patch | 27 - ...t-export-common-defines-for-mount-v2.patch | 74 - ...xport-several-functions-for-mount-v2.patch | 150 -- ...export-global-variables-for-mount-v2.patch | 50 - 0214-mount-add-new-mounts-v2-engine.patch | 1495 ------------- ...ts-compat-mode-on-restore-with-mntns.patch | 71 - 0216-ci-run-tests-for-old-mount-engine.patch | 35 - ...ew-mnt_ext_sharing-test-for-mount-v2.patch | 328 --- ...-zdtm-add-mount_complex_sharing-test.patch | 293 --- ...tion-group-with-mount-flags-to-mount.patch | 112 - ...tm-mount-v2-disable-mnt_tracefs-test.patch | 36 - ...nt_ext_dev-also-run-for-old-mount-en.patch | 45 - ...st-jenkins-test-for-old-mount-engine.patch | 38 - ...tm-mount-v2-disable-pty-console-test.patch | 63 - ...unt-engine-fallback-messages-logleve.patch | 51 - ...-messages-differ-in-different-places.patch | 37 - 0226-zdtm-use-unique-holder-for-cgroups.patch | 96 - 0227-scripts-ci-mount-test-cgroups-once.patch | 35 - ...add-a-helper-to-hold-a-pid-namespace.patch | 62 - ...parmor-Fix-Wfortify-source-for-Clang.patch | 34 - 0230-style-delete-some-redundant-code.patch | 49 - ...unused-but-set-variable-for-Clang-15.patch | 28 - ...syscall-into-compel-std-plugin-sysca.patch | 76 - ...rndat-check-for-rseq-syscall-support.patch | 62 - ...nd_ptrace_attach-helper-from-cr-chec.patch | 164 -- ...ck-Add-ptrace-rseq-conf-dump-feature.patch | 163 -- 0236-rseq-initial-support.patch | 664 ------ ...asic-static-rseq00-test-for-rseq-C-R.patch | 223 -- ...Revert-ci-disable-glibc-rseq-support.patch | 49 - ...-Fedora-Rawhide-based-test-on-Cirrus.patch | 98 - ...lude-add-thread_pointer.h-from-Glibc.patch | 245 --- ...egister-rseq-at-the-thread-start-for.patch | 144 -- ...00-fix-rseq-test-when-linking-with-a.patch | 152 -- ...lpers-to-get-set-instruction-pointer.patch | 265 --- ...-fixup-thread-IP-when-inside-rseq-cs.patch | 249 --- ...add-transition-rseq01-test-for-amd64.patch | 254 --- ...-test-disable-rseq-also-on-Archlinux.patch | 28 - 0247-cr-dump-handle-rseq-flags-field.patch | 385 ---- ...transition-test-with-NO_RESTART-CS-f.patch | 176 -- 0249-zdtm-temporary-disable-rseq02-test.patch | 41 - criu.spec | 524 +---- sources | 2 +- 252 files changed, 16 insertions(+), 29870 deletions(-) delete mode 100644 0001-criu-8-add-external-net-option.patch delete mode 100644 0002-tcp-Skip-restoring-TCP-state-when-dumping-with-tcp-c.patch delete mode 100644 0003-zdtm-Dumping-restoring-with-tcp-close-on-TCP_CLOSE-s.patch delete mode 100644 0004-criu-8-Add-more-detailed-description-about-tcp-close.patch delete mode 100644 0005-Add-support-for-python3-in-criu-coredump.patch delete mode 100644 0006-Add-new-files-for-running-criu-coredump-via-python-2.patch delete mode 100644 0007-coredump-remove-unused-import.patch delete mode 100644 0008-coredump-sort-imports.patch delete mode 100644 0009-coredump-convert-indentation-to-spaces.patch delete mode 100644 0010-python-replace-equality-with-identity-test.patch delete mode 100644 0011-coredump-drop-unused-variable.patch delete mode 100644 0012-coredump-drop-exec-permission.patch delete mode 100644 0013-coredump-lint-fix-for-block-comments.patch delete mode 100644 0014-coredump-fix-missing-whitespace-around-operator.patch delete mode 100644 0015-coredump-fix-too-many-blank-lines.patch delete mode 100644 0016-coredump-fix-comparison-to-true.patch delete mode 100644 0017-coredump-lint-fix-visually-indented-line.patch delete mode 100644 0018-test-coredump-fix-shellcheck-errors.patch delete mode 100644 0019-make-enable-lint-for-coredump.patch delete mode 100644 0020-ci-enable-coredump-tests.patch delete mode 100644 0021-pie-restorer-remove-excess-hash-printf-specifier.patch delete mode 100644 0022-tty-fix-the-null-pointer-of-get_tty_driver.patch delete mode 100644 0023-util-use-nftw-in-rmrf-helper.patch delete mode 100644 0024-criu-ns-make-pidns-init-first-do-setsid.patch delete mode 100644 0025-net-optimize-restore_rule-to-not-open-the-CR_FD_RULE.patch delete mode 100644 0026-ci-replace-deprecated-codecov-bash-uploader.patch delete mode 100644 0027-ci-fix-userfaultfd-test-failures.patch delete mode 100644 0028-ci-use-Fedora-34-for-lint-CI-runs.patch delete mode 100644 0029-tests-improve-the-image-streamer-process-control.patch delete mode 100644 0030-sockets-don-t-call-sk_setbufs-asyncronously.patch delete mode 100644 0031-kerndat-check-for-set-getsockopt-SO_BUF_LOCK-availab.patch delete mode 100644 0032-sockets-c-r-bufer-size-locks.patch delete mode 100644 0033-zdtm-add-test-for-socket-buffer-size-locks.patch delete mode 100644 0034-zdtm-make-sock_opts02-also-check-lock-change-by-SO_-.patch delete mode 100644 0035-clang-format-enable-AlignTrailingComments.patch delete mode 100644 0036-clang-format-do-several-manual-comment-fixups.patch delete mode 100644 0037-clang-format-do-automatic-comment-fixups.patch delete mode 100644 0038-cr-dump-fail-dumping-when-zombie-process-with-sid-0.patch delete mode 100644 0039-clang-format-make-x86_ins_capability_mask-human-read.patch delete mode 100644 0040-ci-disable-socket-raw-test-on-centos8.patch delete mode 100644 0041-zdtm.py-make-tests-with-link_remap-exclusive.patch delete mode 100644 0042-tests-improve-the-deterministic-behavior-of-the-test.patch delete mode 100644 0043-clang-format-zdtm-fix-clang-complains-about-strange-.patch delete mode 100644 0044-seize-restore-cgroup-freezer-to-right-state.patch delete mode 100644 0045-ci-Use-latest-Fedora-for-lint-ci-runs-again.patch delete mode 100644 0046-crtools-ignore-SIGPIPE-in-swrk-mode.patch delete mode 100644 0047-ci-switch-to-centos-stream-8.patch delete mode 100644 0048-check-cleanup-child-processes.patch delete mode 100644 0049-files-reg-fix-error-handling-in-open_path.patch delete mode 100644 0050-files-reg-fix-error-handling-of-rm_parent_dirs.patch delete mode 100644 0051-ghost-mount-allocate-remounted_rw-in-shmem-to-get-in.patch delete mode 100644 0052-files-reg-temporary-remount-writable-the-mount-we-do.patch delete mode 100644 0053-zdtm-add-ro-mount-check-after-c-r-to-mntns_ghost01.patch delete mode 100644 0054-clang-format-disable-wrong-struct-pointer-declaratio.patch delete mode 100644 0055-ci-Run-cross-compile-on-debian-stable.patch delete mode 100644 0056-ci-Run-cross-compile-with-debian-testing.patch delete mode 100644 0057-make-Explicitly-enable-FPU-on-ARMv7-builds.patch delete mode 100644 0058-ci-disable-broken-tests-until-fixed.patch delete mode 100644 0059-test-do-not-use-keep-going-for-single-zdtm-tests.patch delete mode 100644 0060-files-reg-try-dump_ghost_remap-if-link-remap-failed-.patch delete mode 100644 0061-util-make-page-server-IPv6-safe.patch delete mode 100644 0062-sk-unix-Fix-TCP_ESTABLISHED-checks-in-unix-sockets.patch delete mode 100644 0063-ci-Enable-disabled-unix-socket-related-tests.patch delete mode 100644 0064-ci-install-procps-in-Alpine.patch delete mode 100644 0065-test-another-try-to-correctly-fix-the-kernel-version.patch delete mode 100644 0066-x86-compel-fault-inject-bound-xsave-features-set.patch delete mode 100644 0067-x86-compel-fault-inject-print-the-initial-seed.patch delete mode 100644 0068-ci-enable-x86-xsave-fault-injection-tests-back.patch delete mode 100644 0069-Add-documentation-for-timeout-option.patch delete mode 100644 0070-usernsd-UNS_FDOUT-should-not-require-an-input-descri.patch delete mode 100644 0071-libcriu-add-setting-lsm-mount-context-to-libcriu.patch delete mode 100644 0072-ci-use-unstable-release-for-cross-compile.patch delete mode 100644 0073-ci-disable-glibc-rseq-support.patch delete mode 100644 0074-libcriu-add-single-pre-dump-support.patch delete mode 100644 0075-tests-added-test-for-single-pre-dump-support.patch delete mode 100644 0076-zdtm.py-clean-up-MAKEFLAGS-env-variable-before-runni.patch delete mode 100644 0077-zdtm-zdtm_ct-fix-compilation-error-with-strict-proto.patch delete mode 100644 0078-zdtm-remove-mntns-deleted-dst-test-leftover-from-git.patch delete mode 100644 0079-crtools-remove-excess-always-true-condition.patch delete mode 100644 0080-crtools-rpc-export-current-criu-mode-to-opts.mode.patch delete mode 100644 0081-crtools-use-new-opts.mode-in-image_dir_mode.patch delete mode 100644 0082-crtools-check-that-cpuinfo-command-has-sub-command.patch delete mode 100644 0083-sk-unix-Add-support-for-SOCK_SEQPACKET-unix-sockets.patch delete mode 100644 0084-zdtm-Add-SOCK_SEQPACKET-variants-to-unix-socket-test.patch delete mode 100644 0085-tls-fix-typo.patch delete mode 100644 0086-tls-use-ssize_t-for-return-value.patch delete mode 100644 0087-tls-add-more-comments.patch delete mode 100644 0088-uffd-call-disconnect_from_page_server-to-shutdown-a-.patch delete mode 100644 0089-tls-allow-to-terminate-connections-synchronously.patch delete mode 100644 0090-page-xfer-stop-waiting-for-a-new-command-after-a-clo.patch delete mode 100644 0091-ci-reenable-the-lazy-thp-test-in-the-lazy-remote-mod.patch delete mode 100644 0092-test-log-testname.out.inprogress-if-a-test-has-faile.patch delete mode 100644 0093-zdtm-print-tails-of-all-logs-if-a-test-has-failed.patch delete mode 100644 0094-zdtm-static-uffd-events-add-more-log-messages.patch delete mode 100644 0095-mount-split-check_mountpoint_fd-from-__open_mountpoi.patch delete mode 100644 0096-mount-remove-mnt_fd-argument-of-__open_mountpoint.patch delete mode 100644 0097-proc_parse-add-helper-to-resolve-sdev-from-fd.patch delete mode 100644 0098-mount-btrfs-make-check_mountpoint_fd-fallback-to-get.patch delete mode 100644 0099-ci-test-criu-image-streamer-with-all-tests.patch delete mode 100644 0100-readme-add-docker-test-badge.patch delete mode 100644 0101-contributing-remove-old-badges-and-logo.patch delete mode 100644 0102-ci-update-to-latest-Vagrant-and-Fedora-images.patch delete mode 100644 0103-ci-added-.lgtm.yml-file.patch delete mode 100644 0104-lib-introduce-feature-check-in-libcriu.patch delete mode 100644 0105-lib-added-tests-for-feature-check-in-libcriu.patch delete mode 100644 0106-pagemap-tiny-fix-on-truncating-memory-image.patch delete mode 100644 0107-zdtm-fix-zdtm-static-maps00-case-in-arm64.patch delete mode 100644 0108-compel-fix-GCC-12-failure-out-of-bounds.patch delete mode 100644 0109-criu-fix-configuration-file-scanner-with-GCC-12.patch delete mode 100644 0110-compel-fix-parasite-with-GCC-12.patch delete mode 100644 0111-ci-set-continue-on-error-for-cross-compile.patch delete mode 100644 0112-test-autofs-fix-use-after-free.patch delete mode 100644 0113-Fix-formatting-in-criu-documentation.patch delete mode 100644 0114-ci-install-libbsd-dependency.patch delete mode 100644 0115-pstree-when-updating-sid-for-shell-job-also-update-m.patch delete mode 100644 0116-criu-ns-fix-exit-code-o-for-criu-dump.patch delete mode 100644 0117-criu-ns-use-os.waitstatus_to_exitcode.patch delete mode 100644 0118-restorer-Fix-sys_mmap-s-returned-value-check.patch delete mode 100644 0119-compel-fix-how-PTRACE_GET_THREAD_AREA-errors-are-han.patch delete mode 100644 0120-util-add-an-unique-ID-of-the-current-criu-run.patch delete mode 100644 0121-files-generate-unique-transport-socket-names.patch delete mode 100644 0122-check-Add-a-check-for-using-memfd-with-hugetlb.patch delete mode 100644 0123-kerndat-Collect-hugetlb-device-numbers.patch delete mode 100644 0124-ipc-Add-support-for-checkpoint-restore-hugetlb-Syste.patch delete mode 100644 0125-memfd-shmem-Add-support-for-checkpoint-restore-memfd.patch delete mode 100644 0126-proc_parse-files-Add-support-for-hugetlb-memory-mapp.patch delete mode 100644 0127-mem-Skip-premapping-hugetlb-mapping.patch delete mode 100644 0128-uffd-Skip-lazy-mode-restore-on-hugetlb-mappings.patch delete mode 100644 0129-zdtm-Add-MAP_HUGETLB-memory-mapping-test.patch delete mode 100644 0130-zdtm-Add-memfd-hugetlb-test.patch delete mode 100644 0131-zdtm-Add-shm-hugetlb-test.patch delete mode 100644 0132-zdtm-Add-MAP_HUGETLB-mappings-test-for-parent-child-.patch delete mode 100644 0133-ci-skip-MAP_HUGETLB-tests-in-stream-test.patch delete mode 100644 0134-bpfmap-handle-new-field-in-fdinfo.patch delete mode 100644 0135-test-remove-test-for-LOCK_MAND-flock.patch delete mode 100644 0136-test-disable-rseq-also-on-Archlinux.patch delete mode 100644 0137-zdtm-fix-missplacement-of-err-True.patch delete mode 100644 0138-compel-set-mxcsr-during-error-injection-to-zero.patch delete mode 100644 0139-proc_smaps-remove-useless-nonlinear-check.patch delete mode 100644 0140-mount-fix-e_str-leak-in-ext_mount_add.patch delete mode 100644 0141-cr-dump-fix-cr_imgset-leak-in-dump_one_task.patch delete mode 100644 0142-tun-fix-tun_link-leak-in-dump_tun_link.patch delete mode 100644 0143-sk-unix-fix-uint32_t-id-variable-printf-format-speci.patch delete mode 100644 0144-zdtm-refactor-main.patch delete mode 100644 0145-zdtm-sort-import-lines.patch delete mode 100644 0146-zdtm-use-long-form-cli-options.patch delete mode 100644 0147-zdtm-add-criu-config-option.patch delete mode 100644 0148-zdtm-drop-redundant-config_inotify_irmap-test.patch delete mode 100644 0149-ci-run-criu-config-tests.patch delete mode 100644 0150-config-fix-ns-leak-in-parse_join_ns.patch delete mode 100644 0151-net-fix-e_str-leak-in-veth_pair_add.patch delete mode 100644 0152-files-fix-inh-leak-in-inherit_fd_add.patch delete mode 100644 0153-sk-unix-fix-e_str-leak-in-unix_sk_id_add.patch delete mode 100644 0154-uffd-fix-__u64-print-format-specifier.patch delete mode 100644 0155-zdtm-fix-mnt_ext_master-test-to-correspond-to-it-s-n.patch delete mode 100644 0156-mount-add-mntinfo_add_list_before-helper-for-adding-.patch delete mode 100644 0157-mount-do-not-detect-non-fsroot-mounts-as-device-exte.patch delete mode 100644 0158-mount-mark-mounts-of-external-devices-external.patch delete mode 100644 0159-mount-skip-fstype-and-source-checks-for-external-mou.patch delete mode 100644 0160-mount-setup-mnt_bind-list-before-using-it-in-mnt_is_.patch delete mode 100644 0161-util-add-get_relative_path-helper.patch delete mode 100644 0162-unittest-add-some-tests-for-get_relative_path-helper.patch delete mode 100644 0163-mount-add-mnt_bind_pick-helper-to-pick-the-desired-b.patch delete mode 100644 0164-mount-split-mnt_is_external-_bind-and-can_receive_ma.patch delete mode 100644 0165-mount-rework-skipping-external-mounts-in-dump_one_mo.patch delete mode 100644 0166-mount-show-more-info-about-why-we-can-t-mount.patch delete mode 100644 0167-mount-mount-external-mount-before-mounting-it-s-bind.patch delete mode 100644 0168-zdtm-add-new-mnt_ext_root-test.patch delete mode 100644 0169-mount-restrict-mp-external-mount-map-to-init-contain.patch delete mode 100644 0170-zdtm-add-mnt_ext_collision-test.patch delete mode 100644 0171-mount-add-mnt_is_root_bind-helper.patch delete mode 100644 0172-mount-allow-nested-mount-namespaces-with-different-r.patch delete mode 100644 0173-zdtm-add-mntns_pivot_root-test.patch delete mode 100644 0174-mount-apply-superblock-flags-to-nested-ns-roots.patch delete mode 100644 0175-zdtm-add-mntns_pivot_root_ro-test.patch delete mode 100644 0176-mount-restore-create-auxiliary-binfmt_misc-mount-in-.patch delete mode 100644 0177-mount-restore-leave-ns_mountpoint-NULL-for-aux-binfm.patch delete mode 100644 0178-mount-replace-CRTIME_MNT_ID-with-HELPER_MNT_ID.patch delete mode 100644 0179-mount-add-can_receive_master_from_root-helper.patch delete mode 100644 0180-mount-put-external-slavery-mounts-to-separate-mnt_ex.patch delete mode 100644 0181-mount-do-not-override-master_id-to-1-for-root-binds.patch delete mode 100644 0182-mount-add-helper-mnt_get_external_bind_nodev.patch delete mode 100644 0183-mount-prepare-is_overmounted-as-early-as-possible.patch delete mode 100644 0184-mount-move-root-yard-tree-merge-as-early-as-possible.patch delete mode 100644 0185-mount-fix-broken-remounted_rw-check.patch delete mode 100644 0186-mount-make-general-place-for-shared-variables-on-mou.patch delete mode 100644 0187-autofs-use-ns_mountpoint-in-autofs_create_dentries.patch delete mode 100644 0188-mount-use-ns_mountpoint-in-mnt_is_overmounted.patch delete mode 100644 0189-mount-skip-root-yard-children-from-mnt_needs_remap-c.patch delete mode 100644 0190-mount-use-ns_mountpoint-in-validate_children_collisi.patch delete mode 100644 0191-mount-use-ns_mountpoint-in-root_path_from_parent.patch delete mode 100644 0192-mount-use-ns_mountpoint-for-children-overmount-check.patch delete mode 100644 0193-path-simplify-mnt_get_sibling_path-via-get_relative_.patch delete mode 100644 0194-mount-use-ns_mountpoint-in-collect_mntinfo.patch delete mode 100644 0195-mount-use-ns_mountpoint-in-aufs_parse.patch delete mode 100644 0196-mount-use-ns_mountpoint-in-mnt_depth.patch delete mode 100644 0197-mount-use-ns_mountpoint-instead-of-mountpoint-where-.patch delete mode 100644 0198-mount-add-service_mountpoint-getter-for-mountpoint.patch delete mode 100644 0199-files-reg-split-create_ghost_dentry-out-of-create_gh.patch delete mode 100644 0200-files-reg-teach-create_ghost-to-work-with-mount-v2.patch delete mode 100644 0201-files-reg-teach-clean_one_remap-to-work-with-mount-v.patch delete mode 100644 0202-kerndat-Check-for-MOVE_MOUNT_SET_GROUP-availability.patch delete mode 100644 0203-compel-add-open_tree-syscall.patch delete mode 100644 0204-kerndat-check-whether-the-openat2-syscall-is-support.patch delete mode 100644 0205-util-add-resolve_mountpoint-helper.patch delete mode 100644 0206-crtools-move-check_options-after-kerndat_init-and-lo.patch delete mode 100644 0207-config-rpc-add-new-option-mntns-compat-mode-for-old-.patch delete mode 100644 0208-mount-add-plain-mountpoints.patch delete mode 100644 0209-files-reg-export-parent-dirs-helpers-for-mount-v2.patch delete mode 100644 0210-mount-remove-double-ns_id-declaration.patch delete mode 100644 0211-mount-export-common-defines-for-mount-v2.patch delete mode 100644 0212-mount-export-several-functions-for-mount-v2.patch delete mode 100644 0213-mount-export-global-variables-for-mount-v2.patch delete mode 100644 0214-mount-add-new-mounts-v2-engine.patch delete mode 100644 0215-zdtm-enable-mounts-compat-mode-on-restore-with-mntns.patch delete mode 100644 0216-ci-run-tests-for-old-mount-engine.patch delete mode 100644 0217-zdtm-add-new-mnt_ext_sharing-test-for-mount-v2.patch delete mode 100644 0218-zdtm-add-mount_complex_sharing-test.patch delete mode 100644 0219-zdtm-add-propagation-group-with-mount-flags-to-mount.patch delete mode 100644 0220-zdtm-mount-v2-disable-mnt_tracefs-test.patch delete mode 100644 0221-ci-make-others-mnt_ext_dev-also-run-for-old-mount-en.patch delete mode 100644 0222-test-jenkins-test-for-old-mount-engine.patch delete mode 100644 0223-zdtm-mount-v2-disable-pty-console-test.patch delete mode 100644 0224-mount-v2-make-mount-engine-fallback-messages-logleve.patch delete mode 100644 0225-mount-make-error-messages-differ-in-different-places.patch delete mode 100644 0226-zdtm-use-unique-holder-for-cgroups.patch delete mode 100644 0227-scripts-ci-mount-test-cgroups-once.patch delete mode 100644 0228-criu-ns-add-a-helper-to-hold-a-pid-namespace.patch delete mode 100644 0229-apparmor-Fix-Wfortify-source-for-Clang.patch delete mode 100644 0230-style-delete-some-redundant-code.patch delete mode 100644 0231-mount-fix-Wunused-but-set-variable-for-Clang-15.patch delete mode 100644 0232-compel-add-rseq-syscall-into-compel-std-plugin-sysca.patch delete mode 100644 0233-kerndat-check-for-rseq-syscall-support.patch delete mode 100644 0234-util-move-fork_and_ptrace_attach-helper-from-cr-chec.patch delete mode 100644 0235-cr-check-Add-ptrace-rseq-conf-dump-feature.patch delete mode 100644 0236-rseq-initial-support.patch delete mode 100644 0237-zdtm-add-basic-static-rseq00-test-for-rseq-C-R.patch delete mode 100644 0238-Revert-ci-disable-glibc-rseq-support.patch delete mode 100644 0239-ci-add-Fedora-Rawhide-based-test-on-Cirrus.patch delete mode 100644 0240-include-add-thread_pointer.h-from-Glibc.patch delete mode 100644 0241-clone-noasan-unregister-rseq-at-the-thread-start-for.patch delete mode 100644 0242-zdtm-static-rseq00-fix-rseq-test-when-linking-with-a.patch delete mode 100644 0243-compel-add-helpers-to-get-set-instruction-pointer.patch delete mode 100644 0244-cr-dump-fixup-thread-IP-when-inside-rseq-cs.patch delete mode 100644 0245-zdtm-add-transition-rseq01-test-for-amd64.patch delete mode 100644 0246-Revert-test-disable-rseq-also-on-Archlinux.patch delete mode 100644 0247-cr-dump-handle-rseq-flags-field.patch delete mode 100644 0248-zdtm-add-rseq02-transition-test-with-NO_RESTART-CS-f.patch delete mode 100644 0249-zdtm-temporary-disable-rseq02-test.patch diff --git a/.gitignore b/.gitignore index 4c1bda8..19692ad 100644 --- a/.gitignore +++ b/.gitignore @@ -52,3 +52,4 @@ /criu-3.16.tar.bz2 /criu-3.16.tar.gz /criu-3.16.1.tar.gz +/criu-3.17.tar.gz diff --git a/0001-criu-8-add-external-net-option.patch b/0001-criu-8-add-external-net-option.patch deleted file mode 100644 index 2779f41..0000000 --- a/0001-criu-8-add-external-net-option.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 865ee1b856e1ad8a6ee45192e048c414417b4ee9 Mon Sep 17 00:00:00 2001 -From: Radostin Stoyanov -Date: Mon, 20 Sep 2021 13:50:08 +0100 -Subject: [PATCH 001/249] criu(8): add --external net option - -Support for external net namespaces has been introduced with -commit c2b21fbf (criu: add support for external net namespaces). - -Signed-off-by: Radostin Stoyanov ---- - Documentation/criu.txt | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/Documentation/criu.txt b/Documentation/criu.txt -index 690f61e14..3c4c1eaf8 100644 ---- a/Documentation/criu.txt -+++ b/Documentation/criu.txt -@@ -242,6 +242,12 @@ In other words, do not use it unless really needed. - Tell *criu* that one end of a pair of UNIX sockets (created by - *socketpair*(2)) with the given _id_ is OK to be disconnected. - -+*--external* **net[**__inode__**]:**__name__:: -+ Mark a network namespace as external and do not include it in the -+ checkpoint. The label 'name' can be used with *--inherit-fd* during -+ restore to specify a file descriptor to a preconfigured network -+ namespace. -+ - *--external* **pid[**__inode__**]:**__name__:: - Mark a PID namespace as external. This can be later used to restore - a process into an existing PID namespace. The label 'name' can be --- -2.35.1 - diff --git a/0002-tcp-Skip-restoring-TCP-state-when-dumping-with-tcp-c.patch b/0002-tcp-Skip-restoring-TCP-state-when-dumping-with-tcp-c.patch deleted file mode 100644 index c3e6dfe..0000000 --- a/0002-tcp-Skip-restoring-TCP-state-when-dumping-with-tcp-c.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 77c65d7d668d152e660d0a3395348cd69ee0284f Mon Sep 17 00:00:00 2001 -From: Bui Quang Minh -Date: Thu, 12 Aug 2021 11:05:09 +0000 -Subject: [PATCH 002/249] tcp: Skip restoring TCP state when dumping with - --tcp-close - -Since commit e42f5e0 ("tcp: allow to specify --tcp-close on dump"), ---tcp-close option can be used when checkpointing. This option skips -checkpointing established socket's state (including once established -but now closed socket). However, when restoring, we still try to -restore closed socket's state. As a result, a non-existent protobuf -image is opened. - -This commit skips TCP_CLOSE socket when restoring established TCP -connection and removes the redundant check for TCP_LISTEN socket as -TCP_LISTEN socket cannot reach this function. - -Suggested-by: Andrei Vagin -Suggested-by: Radostin Stoyanov -Signed-off-by: Bui Quang Minh ---- - criu/sk-tcp.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/criu/sk-tcp.c b/criu/sk-tcp.c -index 0afecd2d6..96d5d13bf 100644 ---- a/criu/sk-tcp.c -+++ b/criu/sk-tcp.c -@@ -451,7 +451,7 @@ int restore_one_tcp(int fd, struct inet_sk_info *ii) - - pr_info("Restoring TCP connection\n"); - -- if (opts.tcp_close && ii->ie->state != TCP_LISTEN && ii->ie->state != TCP_CLOSE) { -+ if (opts.tcp_close) { - if (shutdown(fd, SHUT_RDWR) && errno != ENOTCONN) { - pr_perror("Unable to shutdown the socket id %x ino %x", ii->ie->id, ii->ie->ino); - } --- -2.35.1 - diff --git a/0003-zdtm-Dumping-restoring-with-tcp-close-on-TCP_CLOSE-s.patch b/0003-zdtm-Dumping-restoring-with-tcp-close-on-TCP_CLOSE-s.patch deleted file mode 100644 index f458f73..0000000 --- a/0003-zdtm-Dumping-restoring-with-tcp-close-on-TCP_CLOSE-s.patch +++ /dev/null @@ -1,110 +0,0 @@ -From 249e34007646ac4c11b0c6c594896aef2eff59e0 Mon Sep 17 00:00:00 2001 -From: Bui Quang Minh -Date: Mon, 20 Sep 2021 20:57:03 +0700 -Subject: [PATCH 003/249] zdtm: Dumping/restoring with --tcp-close on TCP_CLOSE - socket - -Signed-off-by: Bui Quang Minh ---- - test/zdtm/static/Makefile | 1 + - test/zdtm/static/socket-tcp-close2.c | 67 +++++++++++++++++++++++++ - test/zdtm/static/socket-tcp-close2.desc | 1 + - 3 files changed, 69 insertions(+) - create mode 100644 test/zdtm/static/socket-tcp-close2.c - create mode 100644 test/zdtm/static/socket-tcp-close2.desc - -diff --git a/test/zdtm/static/Makefile b/test/zdtm/static/Makefile -index c9e6589f0..b6aa621c7 100644 ---- a/test/zdtm/static/Makefile -+++ b/test/zdtm/static/Makefile -@@ -107,6 +107,7 @@ TST_NOFILE := \ - socket-tcp4v6-closed \ - socket-tcp-close0 \ - socket-tcp-close1 \ -+ socket-tcp-close2 \ - socket-dump-tcp-close \ - socket-tcp-unconn \ - socket-tcp6-unconn \ -diff --git a/test/zdtm/static/socket-tcp-close2.c b/test/zdtm/static/socket-tcp-close2.c -new file mode 100644 -index 000000000..697c99f39 ---- /dev/null -+++ b/test/zdtm/static/socket-tcp-close2.c -@@ -0,0 +1,67 @@ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "zdtmtst.h" -+ -+const char *test_doc = "Check both dump and restore with tcp_close on TCP_CLOSE sockets"; -+const char *test_author = "Bui Quang Minh "; -+ -+static int port = 8880; -+ -+int main(int argc, char **argv) -+{ -+ int fd_s, fd, client; -+ char c; -+ -+ test_init(argc, argv); -+ signal(SIGPIPE, SIG_IGN); -+ -+ fd_s = tcp_init_server(AF_INET, &port); -+ if (fd_s < 0) { -+ pr_err("Server initializations failed\n"); -+ return 1; -+ } -+ -+ client = tcp_init_client(AF_INET, "localhost", port); -+ if (client < 0) { -+ pr_err("Client initializations failed\n"); -+ return 1; -+ } -+ -+ fd = tcp_accept_server(fd_s); -+ if (fd < 0) { -+ pr_err("Can't accept client\n"); -+ return 1; -+ } -+ close(fd_s); -+ -+ shutdown(client, SHUT_WR); -+ shutdown(fd, SHUT_WR); -+ -+ test_daemon(); -+ test_waitsig(); -+ -+ if (read(fd, &c, 1) != 0) { -+ fail("read server"); -+ return 1; -+ } -+ if (read(client, &c, 1) != 0) { -+ fail("read client"); -+ return 1; -+ } -+ if (write(client, &c, 1) != -1) { -+ fail("write client"); -+ return 1; -+ } -+ if (write(fd, &c, 1) != -1) { -+ fail("write server"); -+ return 1; -+ } -+ -+ pass(); -+ return 0; -+} -diff --git a/test/zdtm/static/socket-tcp-close2.desc b/test/zdtm/static/socket-tcp-close2.desc -new file mode 100644 -index 000000000..c53a1f315 ---- /dev/null -+++ b/test/zdtm/static/socket-tcp-close2.desc -@@ -0,0 +1 @@ -+{'opts': '--tcp-close', 'flags': 'reqrst '} --- -2.35.1 - diff --git a/0004-criu-8-Add-more-detailed-description-about-tcp-close.patch b/0004-criu-8-Add-more-detailed-description-about-tcp-close.patch deleted file mode 100644 index 26c377a..0000000 --- a/0004-criu-8-Add-more-detailed-description-about-tcp-close.patch +++ /dev/null @@ -1,33 +0,0 @@ -From e42ff0557a30ab4ddf7dfb594de181b7ec7cdc15 Mon Sep 17 00:00:00 2001 -From: Bui Quang Minh -Date: Mon, 4 Oct 2021 20:38:34 +0700 -Subject: [PATCH 004/249] criu(8): Add more detailed description about - --tcp-close dump option - -The expected behavior of --tcp-close option when dumpping is to close -all established tcp connections including connection that is once -established but now closed. This adds an explicit description about -that behavior. - -Signed-off-by: Bui Quang Minh ---- - Documentation/criu.txt | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/Documentation/criu.txt b/Documentation/criu.txt -index 3c4c1eaf8..4c6885fc9 100644 ---- a/Documentation/criu.txt -+++ b/Documentation/criu.txt -@@ -334,7 +334,8 @@ mount -t cgroup -o devices,freezer none devices,freezer - Checkpoint established TCP connections. - - *--tcp-close*:: -- Don't dump the state of, or block, established tcp connections. -+ Don't dump the state of, or block, established tcp connections -+ (including the connection is once established but now closed). - This is useful when tcp connections are not going to be restored. - - *--skip-in-flight*:: --- -2.35.1 - diff --git a/0005-Add-support-for-python3-in-criu-coredump.patch b/0005-Add-support-for-python3-in-criu-coredump.patch deleted file mode 100644 index 2625cbd..0000000 --- a/0005-Add-support-for-python3-in-criu-coredump.patch +++ /dev/null @@ -1,311 +0,0 @@ -From 215fa63c41d9e5595946ac085babbdd01930ca6f Mon Sep 17 00:00:00 2001 -From: Andrey Vyazovtsev -Date: Thu, 26 Aug 2021 22:22:33 +0300 -Subject: [PATCH 005/249] Add support for python3 in criu-coredump - -Resolve the following python3 portability issues: - -1) Python 3 needs explicit relative import path. - -2) Coredumps are binary data, not unicode strings. Use byte strings -(b"" instead of "") and open files in binary format. - -3) Some functions (for example: filter) return a list in python 2, -but an iterator in python 3. Port code to a common subset of python 2 -and python 3 using itertool. - -4) Division operator / changed meaning in Python 3. Use explicit -integer division (//) where appropriate. - -Signed-off-by: Andrey Vyazovtsev ---- - coredump/criu-coredump | 4 +- - coredump/criu_coredump/__init__.py | 4 +- - coredump/criu_coredump/coredump.py | 68 ++++++++++++++++++------------ - coredump/criu_coredump/elf.py | 2 +- - 4 files changed, 45 insertions(+), 33 deletions(-) - -diff --git a/coredump/criu-coredump b/coredump/criu-coredump -index 25c188c6b..d3113d372 100755 ---- a/coredump/criu-coredump -+++ b/coredump/criu-coredump -@@ -1,4 +1,4 @@ --#!/usr/bin/env python2 -+#!/usr/bin/env python - import argparse - import os - -@@ -10,7 +10,7 @@ def coredump(opts): - for pid in cores: - if opts['pid'] and pid != opts['pid']: - continue -- with open(os.path.realpath(opts['out'])+"/core."+str(pid), 'w+') as f: -+ with open(os.path.realpath(opts['out'])+"/core."+str(pid), 'wb+') as f: - cores[pid].write(f) - - -diff --git a/coredump/criu_coredump/__init__.py b/coredump/criu_coredump/__init__.py -index 213af42ec..7f947518e 100644 ---- a/coredump/criu_coredump/__init__.py -+++ b/coredump/criu_coredump/__init__.py -@@ -1,2 +1,2 @@ --from coredump import * --import elf -+from .coredump import * -+from . import elf -diff --git a/coredump/criu_coredump/coredump.py b/coredump/criu_coredump/coredump.py -index b37ef2291..d67c335c1 100644 ---- a/coredump/criu_coredump/coredump.py -+++ b/coredump/criu_coredump/coredump.py -@@ -29,9 +29,14 @@ - # 4) VMAs contents; - # - import io --import elf -+import sys -+from . import elf - import ctypes - from pycriu import images -+try: -+ from itertools import ifilter as filter -+except ImportError: -+ pass - - # Some memory-related constants - PAGESIZE = 4096 -@@ -88,7 +93,7 @@ class coredump: - for note in self.notes: - buf.write(note.nhdr) - buf.write(note.owner) -- buf.write("\0" * (8 - len(note.owner))) -+ buf.write(b"\0" * (8 - len(note.owner))) - buf.write(note.data) - - offset = ctypes.sizeof(elf.Elf64_Ehdr()) -@@ -136,7 +141,7 @@ class coredump_generator: - path += "-" + str(pid) - path += ".img" - -- with open(path) as f: -+ with open(path, 'rb') as f: - img = images.load(f) - - if single: -@@ -177,7 +182,7 @@ class coredump_generator: - for p in self.coredumps: - if pid and p != pid: - continue -- with open(coredumps_dir + "/" + "core." + str(p), 'w+') as f: -+ with open(coredumps_dir + "/" + "core." + str(p), 'wb+') as f: - self.coredumps[p].write(f) - - def _gen_coredump(self, pid): -@@ -295,7 +300,7 @@ class coredump_generator: - prpsinfo.pr_state = 3 - # Don't even ask me why it is so, just borrowed from linux - # source and made pr_state match. -- prpsinfo.pr_sname = '.' if prpsinfo.pr_state > 5 else "RSDTZW" [ -+ prpsinfo.pr_sname = b'.' if prpsinfo.pr_state > 5 else b"RSDTZW" [ - prpsinfo.pr_state] - prpsinfo.pr_zomb = 1 if prpsinfo.pr_state == 4 else 0 - prpsinfo.pr_nice = core["thread_core"][ -@@ -307,8 +312,12 @@ class coredump_generator: - prpsinfo.pr_ppid = pstree["ppid"] - prpsinfo.pr_pgrp = pstree["pgid"] - prpsinfo.pr_sid = pstree["sid"] -- prpsinfo.pr_fname = core["tc"]["comm"] - prpsinfo.pr_psargs = self._gen_cmdline(pid) -+ if (sys.version_info > (3, 0)): -+ prpsinfo.pr_fname = core["tc"]["comm"].encode() -+ else: -+ prpsinfo.pr_fname = core["tc"]["comm"] -+ - - nhdr = elf.Elf64_Nhdr() - nhdr.n_namesz = 5 -@@ -317,7 +326,7 @@ class coredump_generator: - - note = elf_note() - note.data = prpsinfo -- note.owner = "CORE" -+ note.owner = b"CORE" - note.nhdr = nhdr - - return note -@@ -375,7 +384,7 @@ class coredump_generator: - - note = elf_note() - note.data = prstatus -- note.owner = "CORE" -+ note.owner = b"CORE" - note.nhdr = nhdr - - return note -@@ -411,7 +420,7 @@ class coredump_generator: - - note = elf_note() - note.data = fpregset -- note.owner = "CORE" -+ note.owner = b"CORE" - note.nhdr = nhdr - - return note -@@ -452,7 +461,7 @@ class coredump_generator: - - note = elf_note() - note.data = data -- note.owner = "LINUX" -+ note.owner = b"LINUX" - note.nhdr = nhdr - - return note -@@ -472,7 +481,7 @@ class coredump_generator: - - note = elf_note() - note.data = siginfo -- note.owner = "CORE" -+ note.owner = b"CORE" - note.nhdr = nhdr - - return note -@@ -482,7 +491,7 @@ class coredump_generator: - Generate NT_AUXV note for thread tid of process pid. - """ - mm = self.mms[pid] -- num_auxv = len(mm["mm_saved_auxv"]) / 2 -+ num_auxv = len(mm["mm_saved_auxv"]) // 2 - - class elf_auxv(ctypes.Structure): - _fields_ = [("auxv", elf.Elf64_auxv_t * num_auxv)] -@@ -499,7 +508,7 @@ class coredump_generator: - - note = elf_note() - note.data = auxv -- note.owner = "CORE" -+ note.owner = b"CORE" - note.nhdr = nhdr - - return note -@@ -523,10 +532,10 @@ class coredump_generator: - continue - - shmid = vma["shmid"] -- off = vma["pgoff"] / PAGESIZE -+ off = vma["pgoff"] // PAGESIZE - - files = self.reg_files -- fname = filter(lambda x: x["id"] == shmid, files)[0]["name"] -+ fname = next(filter(lambda x: x["id"] == shmid, files))["name"] - - info = mmaped_file_info() - info.start = vma["start"] -@@ -569,7 +578,10 @@ class coredump_generator: - setattr(data, "start" + str(i), info.start) - setattr(data, "end" + str(i), info.end) - setattr(data, "file_ofs" + str(i), info.file_ofs) -- setattr(data, "name" + str(i), info.name) -+ if (sys.version_info > (3, 0)): -+ setattr(data, "name" + str(i), info.name.encode()) -+ else: -+ setattr(data, "name" + str(i), info.name) - - nhdr = elf.Elf64_Nhdr() - -@@ -579,7 +591,7 @@ class coredump_generator: - - note = elf_note() - note.nhdr = nhdr -- note.owner = "CORE" -+ note.owner = b"CORE" - note.data = data - - return note -@@ -644,7 +656,7 @@ class coredump_generator: - ppid = self.pstree[pid]["ppid"] - return self._get_page(ppid, page_no) - else: -- with open(self._imgs_dir + "/pages-%s.img" % pages_id) as f: -+ with open(self._imgs_dir + "/pages-%s.img" % pages_id, 'rb') as f: - f.seek(off * PAGESIZE) - return f.read(PAGESIZE) - -@@ -657,16 +669,16 @@ class coredump_generator: - f = None - - if size == 0: -- return "" -+ return b"" - - if vma["status"] & status["VMA_AREA_VVAR"]: - #FIXME this is what gdb does, as vvar vma - # is not readable from userspace? -- return "\0" * size -+ return b"\0" * size - elif vma["status"] & status["VMA_AREA_VSYSCALL"]: - #FIXME need to dump it with criu or read from - # current process. -- return "\0" * size -+ return b"\0" * size - - if vma["status"] & status["VMA_FILE_SHARED"] or \ - vma["status"] & status["VMA_FILE_PRIVATE"]: -@@ -675,9 +687,9 @@ class coredump_generator: - off = vma["pgoff"] - - files = self.reg_files -- fname = filter(lambda x: x["id"] == shmid, files)[0]["name"] -+ fname = next(filter(lambda x: x["id"] == shmid, files))["name"] - -- f = open(fname) -+ f = open(fname, 'rb') - f.seek(off) - - start = vma["start"] -@@ -699,10 +711,10 @@ class coredump_generator: - # a file, and changed ones -- from pages.img. - # Finally, if no page is found neither in pages.img nor - # in file, hole in inserted -- a page filled with zeroes. -- start_page = start / PAGESIZE -- end_page = end / PAGESIZE -+ start_page = start // PAGESIZE -+ end_page = end // PAGESIZE - -- buf = "" -+ buf = b"" - for page_no in range(start_page, end_page + 1): - page = None - -@@ -720,7 +732,7 @@ class coredump_generator: - - if page is None: - # Hole -- page = PAGESIZE * "\0" -+ page = PAGESIZE * b"\0" - - # If it is a start or end page, we need to read - # only part of it. -@@ -762,7 +774,7 @@ class coredump_generator: - chunk = self._gen_mem_chunk(pid, vma, size) - - # Replace all '\0's with spaces. -- return chunk.replace('\0', ' ') -+ return chunk.replace(b'\0', b' ') - - def _get_vma_dump_size(self, vma): - """ -diff --git a/coredump/criu_coredump/elf.py b/coredump/criu_coredump/elf.py -index e65919e6b..a670ae866 100644 ---- a/coredump/criu_coredump/elf.py -+++ b/coredump/criu_coredump/elf.py -@@ -368,7 +368,7 @@ elf_fpregset_t = user_fpregs_struct - # siginfo_t related constants. - - _SI_MAX_SIZE = 128 --_SI_PAD_SIZE = (_SI_MAX_SIZE / ctypes.sizeof(ctypes.c_int)) - 4 -+_SI_PAD_SIZE = (_SI_MAX_SIZE // ctypes.sizeof(ctypes.c_int)) - 4 - - - # /* kill(). */ --- -2.35.1 - diff --git a/0006-Add-new-files-for-running-criu-coredump-via-python-2.patch b/0006-Add-new-files-for-running-criu-coredump-via-python-2.patch deleted file mode 100644 index 974b216..0000000 --- a/0006-Add-new-files-for-running-criu-coredump-via-python-2.patch +++ /dev/null @@ -1,71 +0,0 @@ -From d08f284b5d5120a8e550b44901ee96b840900b7d Mon Sep 17 00:00:00 2001 -From: AndreyVV-100 -Date: Fri, 23 Jul 2021 12:48:03 +0300 -Subject: [PATCH 006/249] Add new files for running criu-coredump via python 2 - or 3 - -Previous commit added support for python3 in criu-coredump. For convenience, -add two files (coredump-python2 and coredump-python3) that start -criu-coredump with respective python version. Edit env.sh accordingly. - -Signed-off-by: Andrey Vyazovtsev ---- - coredump/coredump-python2 | 6 ++++++ - coredump/coredump-python3 | 6 ++++++ - coredump/{criu-coredump => coredump.py} | 1 - - test/others/env.sh | 2 +- - 4 files changed, 13 insertions(+), 2 deletions(-) - create mode 100755 coredump/coredump-python2 - create mode 100755 coredump/coredump-python3 - rename coredump/{criu-coredump => coredump.py} (97%) - -diff --git a/coredump/coredump-python2 b/coredump/coredump-python2 -new file mode 100755 -index 000000000..3a15c90a3 ---- /dev/null -+++ b/coredump/coredump-python2 -@@ -0,0 +1,6 @@ -+#!/usr/bin/env python2 -+ -+import coredump -+ -+if __name__ == '__main__': -+ coredump.main() -diff --git a/coredump/coredump-python3 b/coredump/coredump-python3 -new file mode 100755 -index 000000000..82ec6b855 ---- /dev/null -+++ b/coredump/coredump-python3 -@@ -0,0 +1,6 @@ -+#!/usr/bin/env python3 -+ -+import coredump -+ -+if __name__ == '__main__': -+ coredump.main() -diff --git a/coredump/criu-coredump b/coredump/coredump.py -similarity index 97% -rename from coredump/criu-coredump -rename to coredump/coredump.py -index d3113d372..56ba54083 100755 ---- a/coredump/criu-coredump -+++ b/coredump/coredump.py -@@ -1,4 +1,3 @@ --#!/usr/bin/env python - import argparse - import os - -diff --git a/test/others/env.sh b/test/others/env.sh -index b514e87d9..e2f63eee3 100755 ---- a/test/others/env.sh -+++ b/test/others/env.sh -@@ -13,5 +13,5 @@ fi - #export PYTHON - CRIT=$(readlink -f `dirname ${BASH_SOURCE[0]}`/../../crit/crit-"${PYTHON}") - crit=$CRIT --CRIU_COREDUMP=$(readlink -f `dirname ${BASH_SOURCE[0]}`/../../criu-coredump/criu-coredump) -+CRIU_COREDUMP=$(readlink -f `dirname ${BASH_SOURCE[0]}`/../../criu-coredump/coredump-"${PYTHON}") - criu_coredump=$CRIU_COREDUMP --- -2.35.1 - diff --git a/0007-coredump-remove-unused-import.patch b/0007-coredump-remove-unused-import.patch deleted file mode 100644 index 5c7ab41..0000000 --- a/0007-coredump-remove-unused-import.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 2d4bb6601de571f5dca7cd43089979747f6acc2e Mon Sep 17 00:00:00 2001 -From: Radostin Stoyanov -Date: Sun, 5 Sep 2021 21:31:12 +0100 -Subject: [PATCH 007/249] coredump: remove unused import - -Signed-off-by: Radostin Stoyanov ---- - coredump/criu_coredump/__init__.py | 3 +-- - scripts/flake8.cfg | 2 ++ - 2 files changed, 3 insertions(+), 2 deletions(-) - -diff --git a/coredump/criu_coredump/__init__.py b/coredump/criu_coredump/__init__.py -index 7f947518e..c1a437cf4 100644 ---- a/coredump/criu_coredump/__init__.py -+++ b/coredump/criu_coredump/__init__.py -@@ -1,2 +1 @@ --from .coredump import * --from . import elf -+from .coredump import coredump_generator -diff --git a/scripts/flake8.cfg b/scripts/flake8.cfg -index b6a587729..bd4f95bb2 100644 ---- a/scripts/flake8.cfg -+++ b/scripts/flake8.cfg -@@ -2,3 +2,5 @@ - # E501 line too long - # W504 line break after binary operator - ignore = E501,W504 -+# F401: imported but unused -+per-file-ignores = __init__.py:F401 --- -2.35.1 - diff --git a/0008-coredump-sort-imports.patch b/0008-coredump-sort-imports.patch deleted file mode 100644 index 921409f..0000000 --- a/0008-coredump-sort-imports.patch +++ /dev/null @@ -1,31 +0,0 @@ -From e849a46256da1c5b8990c7875580172e35210205 Mon Sep 17 00:00:00 2001 -From: Radostin Stoyanov -Date: Sun, 5 Sep 2021 21:32:17 +0100 -Subject: [PATCH 008/249] coredump: sort imports - -Signed-off-by: Radostin Stoyanov ---- - coredump/criu_coredump/coredump.py | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -diff --git a/coredump/criu_coredump/coredump.py b/coredump/criu_coredump/coredump.py -index d67c335c1..9b4aad5ff 100644 ---- a/coredump/criu_coredump/coredump.py -+++ b/coredump/criu_coredump/coredump.py -@@ -30,9 +30,12 @@ - # - import io - import sys --from . import elf - import ctypes -+ - from pycriu import images -+from . import elf -+ -+ - try: - from itertools import ifilter as filter - except ImportError: --- -2.35.1 - diff --git a/0009-coredump-convert-indentation-to-spaces.patch b/0009-coredump-convert-indentation-to-spaces.patch deleted file mode 100644 index 1487a99..0000000 --- a/0009-coredump-convert-indentation-to-spaces.patch +++ /dev/null @@ -1,107 +0,0 @@ -From 4f99f82cb3fae3ebaf35b853d7ecbbf1a9fecd27 Mon Sep 17 00:00:00 2001 -From: Radostin Stoyanov -Date: Sun, 5 Sep 2021 21:34:00 +0100 -Subject: [PATCH 009/249] coredump: convert indentation to spaces - -Signed-off-by: Radostin Stoyanov ---- - coredump/coredump-python2 | 2 +- - coredump/coredump-python3 | 2 +- - coredump/coredump.py | 58 ++++++++++++++++++++------------------- - 3 files changed, 32 insertions(+), 30 deletions(-) - -diff --git a/coredump/coredump-python2 b/coredump/coredump-python2 -index 3a15c90a3..564c05ce9 100755 ---- a/coredump/coredump-python2 -+++ b/coredump/coredump-python2 -@@ -3,4 +3,4 @@ - import coredump - - if __name__ == '__main__': -- coredump.main() -+ coredump.main() -diff --git a/coredump/coredump-python3 b/coredump/coredump-python3 -index 82ec6b855..3032dbadf 100755 ---- a/coredump/coredump-python3 -+++ b/coredump/coredump-python3 -@@ -3,4 +3,4 @@ - import coredump - - if __name__ == '__main__': -- coredump.main() -+ coredump.main() -diff --git a/coredump/coredump.py b/coredump/coredump.py -index 56ba54083..e63abf951 100755 ---- a/coredump/coredump.py -+++ b/coredump/coredump.py -@@ -3,37 +3,39 @@ import os - - import criu_coredump - -+ - def coredump(opts): -- generator = criu_coredump.coredump_generator() -- cores = generator(os.path.realpath(opts['in'])) -- for pid in cores: -- if opts['pid'] and pid != opts['pid']: -- continue -- with open(os.path.realpath(opts['out'])+"/core."+str(pid), 'wb+') as f: -- cores[pid].write(f) -+ generator = criu_coredump.coredump_generator() -+ cores = generator(os.path.realpath(opts['in'])) -+ for pid in cores: -+ if opts['pid'] and pid != opts['pid']: -+ continue -+ with open(os.path.realpath(opts['out'])+"/core."+str(pid), 'wb+') as f: -+ cores[pid].write(f) - - - def main(): -- desc = 'CRIU core dump' -- parser = argparse.ArgumentParser(description=desc, -- formatter_class=argparse.RawTextHelpFormatter) -- -- parser.add_argument('-i', -- '--in', -- default = '.', -- help = 'directory where to get images from') -- parser.add_argument('-p', -- '--pid', -- type = int, -- help = 'generate coredump for specific pid(all pids py default)') -- parser.add_argument('-o', -- '--out', -- default = '.', -- help = 'directory to write coredumps to') -- -- opts = vars(parser.parse_args()) -- -- coredump(opts) -+ desc = 'CRIU core dump' -+ parser = argparse.ArgumentParser(description=desc, -+ formatter_class=argparse.RawTextHelpFormatter) -+ -+ parser.add_argument('-i', -+ '--in', -+ default='.', -+ help='directory where to get images from') -+ parser.add_argument('-p', -+ '--pid', -+ type=int, -+ help='generate coredump for specific pid(all pids py default)') -+ parser.add_argument('-o', -+ '--out', -+ default='.', -+ help='directory to write coredumps to') -+ -+ opts = vars(parser.parse_args()) -+ -+ coredump(opts) -+ - - if __name__ == '__main__': -- main() -+ main() --- -2.35.1 - diff --git a/0010-python-replace-equality-with-identity-test.patch b/0010-python-replace-equality-with-identity-test.patch deleted file mode 100644 index 51bfc4c..0000000 --- a/0010-python-replace-equality-with-identity-test.patch +++ /dev/null @@ -1,117 +0,0 @@ -From 6d8ba10f26a6f6d73fd0ff64a85f8803b3021a8a Mon Sep 17 00:00:00 2001 -From: Radostin Stoyanov -Date: Sun, 5 Sep 2021 21:36:10 +0100 -Subject: [PATCH 010/249] python: replace equality with identity test - -PEP8 recommends for comparisons to singletons like None to always be -done with 'is' or 'is not', never the equality operators. - -https://python.org/dev/peps/pep-0008/#programming-recommendations - -Signed-off-by: Radostin Stoyanov ---- - coredump/criu_coredump/coredump.py | 6 +++--- - test/exhaustive/pipe.py | 12 ++++++------ - test/exhaustive/unix.py | 2 +- - 3 files changed, 10 insertions(+), 10 deletions(-) - -diff --git a/coredump/criu_coredump/coredump.py b/coredump/criu_coredump/coredump.py -index 9b4aad5ff..a9a8bb27c 100644 ---- a/coredump/criu_coredump/coredump.py -+++ b/coredump/criu_coredump/coredump.py -@@ -725,10 +725,10 @@ class coredump_generator: - # and choose appropriate. - page_mem = self._get_page(pid, page_no) - -- if f != None: -+ if f is not None: - page = f.read(PAGESIZE) - -- if page_mem != None: -+ if page_mem is not None: - # Page from pages.img has higher priority - # than one from maped file on disk. - page = page_mem -@@ -755,7 +755,7 @@ class coredump_generator: - buf += page[n_skip:n_skip + n_read] - - # Don't forget to close file. -- if f != None: -+ if f is not None: - f.close() - - return buf -diff --git a/test/exhaustive/pipe.py b/test/exhaustive/pipe.py -index fdadc480c..7f1c53d34 100755 ---- a/test/exhaustive/pipe.py -+++ b/test/exhaustive/pipe.py -@@ -75,7 +75,7 @@ def get_pipe_rw(pid, fd): - - def check_pipe_y(pid, fd, rw, inos): - ino = get_pipe_ino(pid, fd) -- if ino == None: -+ if ino is None: - return 'missing ' - if not inos.has_key(fd): - inos[fd] = ino -@@ -89,7 +89,7 @@ def check_pipe_y(pid, fd, rw, inos): - - def check_pipe_n(pid, fd): - ino = get_pipe_ino(pid, fd) -- if ino == None: -+ if ino is None: - return None - else: - return 'present ' -@@ -102,7 +102,7 @@ def check_pipe_end(kids, fd, comb, rw, inos): - res = check_pipe_y(t_pid, fd, rw, inos) - else: - res = check_pipe_n(t_pid, fd) -- if res != None: -+ if res is not None: - return res + 'kid(%d)' % t_nr - t_nr += 1 - return None -@@ -111,7 +111,7 @@ def check_pipe_end(kids, fd, comb, rw, inos): - def check_pipe(kids, fds, comb, inos): - for e in (0, 1): # 0 == R, 1 == W, see get_pipe_rw() - res = check_pipe_end(kids, fds[e], comb[e], e, inos) -- if res != None: -+ if res is not None: - return res + 'end(%d)' % e - return None - -@@ -124,7 +124,7 @@ def check_pipes(kids, pipes, comb): - p_inos = {} - for p_fds in pipes: - res = check_pipe(kids, p_fds, comb[p_nr], p_inos) -- if res != None: -+ if res is not None: - return res + 'pipe(%d)' % p_nr - p_nr += 1 - -@@ -182,7 +182,7 @@ def make_comb(comb, opts, status_pipe): - if v == '0': - print('\tCheck pipes') - res = check_pipes(kids, pipes, comb) -- if res == None: -+ if res is None: - ex_code = 0 - else: - print('\tFAIL %s' % res) -diff --git a/test/exhaustive/unix.py b/test/exhaustive/unix.py -index 98dbbb7b0..114bf957b 100755 ---- a/test/exhaustive/unix.py -+++ b/test/exhaustive/unix.py -@@ -304,7 +304,7 @@ class sock: - for psk in st.sockets: - if psk == self: - continue -- if psk.peer != None and psk.peer != self.sk_id: -+ if psk.peer is not None and psk.peer != self.sk_id: - # Peer by someone else, can do nothing - continue - --- -2.35.1 - diff --git a/0011-coredump-drop-unused-variable.patch b/0011-coredump-drop-unused-variable.patch deleted file mode 100644 index a2bd3fd..0000000 --- a/0011-coredump-drop-unused-variable.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 4f14d170a2cf59a7a1ddfad6f6570e9a750eb16c Mon Sep 17 00:00:00 2001 -From: Radostin Stoyanov -Date: Sun, 5 Sep 2021 21:38:06 +0100 -Subject: [PATCH 011/249] coredump: drop unused variable - -Signed-off-by: Radostin Stoyanov ---- - coredump/criu_coredump/coredump.py | 2 -- - 1 file changed, 2 deletions(-) - -diff --git a/coredump/criu_coredump/coredump.py b/coredump/criu_coredump/coredump.py -index a9a8bb27c..42c2fed19 100644 ---- a/coredump/criu_coredump/coredump.py -+++ b/coredump/criu_coredump/coredump.py -@@ -834,8 +834,6 @@ class coredump_generator: - - vmas = [] - for vma in mm["vmas"]: -- size = self._get_vma_dump_size(vma) -- - v = vma_class() - v.filesz = self._get_vma_dump_size(vma) - v.data = self._gen_mem_chunk(pid, vma, v.filesz) --- -2.35.1 - diff --git a/0012-coredump-drop-exec-permission.patch b/0012-coredump-drop-exec-permission.patch deleted file mode 100644 index 6abc1ad..0000000 --- a/0012-coredump-drop-exec-permission.patch +++ /dev/null @@ -1,20 +0,0 @@ -From 9108a60b953530b594fd246bd33693a6b28bba3e Mon Sep 17 00:00:00 2001 -From: Radostin Stoyanov -Date: Sun, 5 Sep 2021 21:42:46 +0100 -Subject: [PATCH 012/249] coredump: drop exec permission - -The shebang line in this file was removed in a previous commit and the -file should be non-executable. - -Signed-off-by: Radostin Stoyanov ---- - coredump/coredump.py | 0 - 1 file changed, 0 insertions(+), 0 deletions(-) - mode change 100755 => 100644 coredump/coredump.py - -diff --git a/coredump/coredump.py b/coredump/coredump.py -old mode 100755 -new mode 100644 --- -2.35.1 - diff --git a/0013-coredump-lint-fix-for-block-comments.patch b/0013-coredump-lint-fix-for-block-comments.patch deleted file mode 100644 index 7e0dfb6..0000000 --- a/0013-coredump-lint-fix-for-block-comments.patch +++ /dev/null @@ -1,1289 +0,0 @@ -From 9c26f836e94ba374ba0287e0d97d8a6f9e06635b Mon Sep 17 00:00:00 2001 -From: Radostin Stoyanov -Date: Sun, 5 Sep 2021 21:53:06 +0100 -Subject: [PATCH 013/249] coredump: lint fix for block comments - -Block comment should start with '# ' -https://www.flake8rules.com/rules/E265.html - -Inline comment should start with '# ' -https://www.flake8rules.com/rules/E262.html - -Signed-off-by: Radostin Stoyanov ---- - coredump/criu_coredump/coredump.py | 11 +- - coredump/criu_coredump/elf.py | 985 +++++++++++++++++------------ - 2 files changed, 577 insertions(+), 419 deletions(-) - -diff --git a/coredump/criu_coredump/coredump.py b/coredump/criu_coredump/coredump.py -index 42c2fed19..274889800 100644 ---- a/coredump/criu_coredump/coredump.py -+++ b/coredump/criu_coredump/coredump.py -@@ -223,7 +223,7 @@ class coredump_generator: - ehdr.e_phoff = ctypes.sizeof(elf.Elf64_Ehdr()) - ehdr.e_ehsize = ctypes.sizeof(elf.Elf64_Ehdr()) - ehdr.e_phentsize = ctypes.sizeof(elf.Elf64_Phdr()) -- #FIXME Case len(phdrs) > PN_XNUM should be handled properly. -+ # FIXME Case len(phdrs) > PN_XNUM should be handled properly. - # See fs/binfmt_elf.c from linux kernel. - ehdr.e_phnum = len(phdrs) - -@@ -346,7 +346,7 @@ class coredump_generator: - - ctypes.memset(ctypes.addressof(prstatus), 0, ctypes.sizeof(prstatus)) - -- #FIXME setting only some of the fields for now. Revisit later. -+ # FIXME setting only some of the fields for now. Revisit later. - prstatus.pr_pid = tid - prstatus.pr_ppid = pstree["ppid"] - prstatus.pr_pgrp = pstree["pgid"] -@@ -414,7 +414,6 @@ class coredump_generator: - *regs["st_space"]) - fpregset.xmm_space = (ctypes.c_uint * len(regs["xmm_space"]))( - *regs["xmm_space"]) -- #fpregset.padding = regs["padding"] unused - - nhdr = elf.Elf64_Nhdr() - nhdr.n_namesz = 5 -@@ -588,7 +587,7 @@ class coredump_generator: - - nhdr = elf.Elf64_Nhdr() - -- nhdr.n_namesz = 5 #XXX strlen + 1 -+ nhdr.n_namesz = 5 # strlen + 1 - nhdr.n_descsz = ctypes.sizeof(elf_files()) - nhdr.n_type = elf.NT_FILE - -@@ -675,11 +674,11 @@ class coredump_generator: - return b"" - - if vma["status"] & status["VMA_AREA_VVAR"]: -- #FIXME this is what gdb does, as vvar vma -+ # FIXME this is what gdb does, as vvar vma - # is not readable from userspace? - return b"\0" * size - elif vma["status"] & status["VMA_AREA_VSYSCALL"]: -- #FIXME need to dump it with criu or read from -+ # FIXME need to dump it with criu or read from - # current process. - return b"\0" * size - -diff --git a/coredump/criu_coredump/elf.py b/coredump/criu_coredump/elf.py -index a670ae866..092b47857 100644 ---- a/coredump/criu_coredump/elf.py -+++ b/coredump/criu_coredump/elf.py -@@ -16,16 +16,13 @@ EI_MAG0 = 0 # #define EI_MAG0 0 /* File identification by - ELFMAG0 = 0x7f # #define ELFMAG0 0x7f /* Magic number byte 0 */ - - EI_MAG1 = 1 # #define EI_MAG1 1 /* File identification byte 1 index */ --ELFMAG1 = ord( -- 'E') # #define ELFMAG1 'E' /* Magic number byte 1 */ -+ELFMAG1 = ord('E') # #define ELFMAG1 'E' /* Magic number byte 1 */ - - EI_MAG2 = 2 # #define EI_MAG2 2 /* File identification byte 2 index */ --ELFMAG2 = ord( -- 'L') # #define ELFMAG2 'L' /* Magic number byte 2 */ -+ELFMAG2 = ord('L') # #define ELFMAG2 'L' /* Magic number byte 2 */ - - EI_MAG3 = 3 # #define EI_MAG3 3 /* File identification byte 3 index */ --ELFMAG3 = ord( -- 'F') # #define ELFMAG3 'F' /* Magic number byte 3 */ -+ELFMAG3 = ord('F') # #define ELFMAG3 'F' /* Magic number byte 3 */ - - EI_CLASS = 4 # #define EI_CLASS 4 /* File class byte index */ - -@@ -48,22 +45,22 @@ EV_CURRENT = 1 # #define EV_CURRENT 1 /* Current version */ - - - class Elf64_Ehdr(ctypes.Structure): # typedef struct -- _fields_ = [ # { -+ _fields_ = [ - ("e_ident", -- ctypes.c_ubyte * EI_NIDENT), # unsigned char e_ident[EI_NIDENT]; -- ("e_type", Elf64_Half), # Elf64_Half e_type; -- ("e_machine", Elf64_Half), # Elf64_Half e_machine; -- ("e_version", Elf64_Word), # Elf64_Word e_version; -- ("e_entry", Elf64_Addr), # Elf64_Addr e_entry; -- ("e_phoff", Elf64_Off), # Elf64_Off e_phoff; -- ("e_shoff", Elf64_Off), # Elf64_Off e_shoff; -- ("e_flags", Elf64_Word), # Elf64_Word e_flags; -- ("e_ehsize", Elf64_Half), # Elf64_Half e_ehsize; -- ("e_phentsize", Elf64_Half), # Elf64_Half e_phentsize; -- ("e_phnum", Elf64_Half), # Elf64_Half e_phnum; -- ("e_shentsize", Elf64_Half), # Elf64_Half e_shentsize; -- ("e_shnum", Elf64_Half), # Elf64_Half e_shnum; -- ("e_shstrndx", Elf64_Half) # Elf64_Half e_shstrndx; -+ ctypes.c_ubyte * EI_NIDENT), # unsigned char e_ident[EI_NIDENT]; -+ ("e_type", Elf64_Half), # Elf64_Half e_type; -+ ("e_machine", Elf64_Half), # Elf64_Half e_machine; -+ ("e_version", Elf64_Word), # Elf64_Word e_version; -+ ("e_entry", Elf64_Addr), # Elf64_Addr e_entry; -+ ("e_phoff", Elf64_Off), # Elf64_Off e_phoff; -+ ("e_shoff", Elf64_Off), # Elf64_Off e_shoff; -+ ("e_flags", Elf64_Word), # Elf64_Word e_flags; -+ ("e_ehsize", Elf64_Half), # Elf64_Half e_ehsize; -+ ("e_phentsize", Elf64_Half), # Elf64_Half e_phentsize; -+ ("e_phnum", Elf64_Half), # Elf64_Half e_phnum; -+ ("e_shentsize", Elf64_Half), # Elf64_Half e_shentsize; -+ ("e_shnum", Elf64_Half), # Elf64_Half e_shnum; -+ ("e_shstrndx", Elf64_Half) # Elf64_Half e_shstrndx; - ] # } Elf64_Ehdr; - - -@@ -80,15 +77,15 @@ PF_R = 1 << 2 # #define PF_R (1 << 2) /* Segment is readable - - - class Elf64_Phdr(ctypes.Structure): # typedef struct -- _fields_ = [ # { -- ("p_type", Elf64_Word), # Elf64_Word p_type; -- ("p_flags", Elf64_Word), # Elf64_Word p_flags; -- ("p_offset", Elf64_Off), # Elf64_Off p_offset; -- ("p_vaddr", Elf64_Addr), # Elf64_Addr p_vaddr; -- ("p_paddr", Elf64_Addr), # Elf64_Addr p_paddr; -- ("p_filesz", Elf64_Xword), # Elf64_Xword p_filesz; -- ("p_memsz", Elf64_Xword), # Elf64_Xword p_memsz; -- ("p_align", Elf64_Xword), # Elf64_Xword p_align; -+ _fields_ = [ -+ ("p_type", Elf64_Word), # Elf64_Word p_type; -+ ("p_flags", Elf64_Word), # Elf64_Word p_flags; -+ ("p_offset", Elf64_Off), # Elf64_Off p_offset; -+ ("p_vaddr", Elf64_Addr), # Elf64_Addr p_vaddr; -+ ("p_paddr", Elf64_Addr), # Elf64_Addr p_paddr; -+ ("p_filesz", Elf64_Xword), # Elf64_Xword p_filesz; -+ ("p_memsz", Elf64_Xword), # Elf64_Xword p_memsz; -+ ("p_align", Elf64_Xword), # Elf64_Xword p_align; - ] # } Elf64_Phdr; - - -@@ -100,78 +97,89 @@ class _Elf64_auxv_t_U(ctypes.Union): - - - class Elf64_auxv_t(ctypes.Structure): # typedef struct -- _fields_ = [ # { -+ _fields_ = [ - ("a_type", -- ctypes.c_uint64), # uint64_t a_type; /* Entry type */ -- ("a_un", _Elf64_auxv_t_U) # union -- # { -- # uint64_t a_val; /* Integer value */ -- # /* We use to have pointer elements added here. We cannot do that, -- # though, since it does not work when using 32-bit definitions -- # on 64-bit platforms and vice versa. */ -- # } a_un; -+ ctypes.c_uint64), # uint64_t a_type; /* Entry type */ -+ ("a_un", _Elf64_auxv_t_U) # union -+ -+ # uint64_t a_val; /* Integer value */ -+ # /* We use to have pointer elements added here. We cannot do that, -+ # though, since it does not work when using 32-bit definitions -+ # on 64-bit platforms and vice versa. */ -+ # } a_un; - ] # } Elf64_auxv_t; - - - # Elf64_Nhdr related constants. - --NT_PRSTATUS = 1 # #define NT_PRSTATUS 1 /* Contains copy of prstatus struct */ --NT_FPREGSET = 2 # #define NT_FPREGSET 2 /* Contains copy of fpregset struct */ --NT_PRPSINFO = 3 # #define NT_PRPSINFO 3 /* Contains copy of prpsinfo struct */ --NT_AUXV = 6 # #define NT_AUXV 6 /* Contains copy of auxv array */ --NT_SIGINFO = 0x53494749 # #define NT_SIGINFO 0x53494749 /* Contains copy of siginfo_t, --# size might increase */ --NT_FILE = 0x46494c45 # #define NT_FILE 0x46494c45 /* Contains information about mapped --# files */ --NT_X86_XSTATE = 0x202 # #define NT_X86_XSTATE 0x202 /* x86 extended state using xsave */ -+NT_PRSTATUS = 1 # #define NT_PRSTATUS 1 /* Contains copy of prstatus struct */ -+NT_FPREGSET = 2 # #define NT_FPREGSET 2 /* Contains copy of fpregset struct */ -+NT_PRPSINFO = 3 # #define NT_PRPSINFO 3 /* Contains copy of prpsinfo struct */ -+NT_AUXV = 6 # #define NT_AUXV 6 /* Contains copy of auxv array */ -+NT_SIGINFO = 0x53494749 # #define NT_SIGINFO 0x53494749 /* Contains copy of siginfo_t, size might increase */ -+NT_FILE = 0x46494c45 # #define NT_FILE 0x46494c45 /* Contains information about mapped files */ -+NT_X86_XSTATE = 0x202 # #define NT_X86_XSTATE 0x202 /* x86 extended state using xsave */ - - - class Elf64_Nhdr(ctypes.Structure): # typedef struct -- _fields_ = [ # { -+ _fields_ = [ - ( - "n_namesz", Elf64_Word -- ), # Elf64_Word n_namesz; /* Length of the note's name. */ -+ ), # Elf64_Word n_namesz; /* Length of the note's name. */ - ( - "n_descsz", Elf64_Word -- ), # Elf64_Word n_descsz; /* Length of the note's descriptor. */ -+ ), # Elf64_Word n_descsz; /* Length of the note's descriptor. */ - ("n_type", Elf64_Word -- ), # Elf64_Word n_type; /* Type of the note. */ -+ ), # Elf64_Word n_type; /* Type of the note. */ - ] # } Elf64_Nhdr; - - - # Elf64_Shdr related constants. - - --class Elf64_Shdr(ctypes.Structure): # typedef struct -- _fields_ = [ # { -+class Elf64_Shdr(ctypes.Structure): -+ _fields_ = [ - ( -+ # Section name (string tbl index) - "sh_name", Elf64_Word -- ), # Elf64_Word sh_name; /* Section name (string tbl index) */ -- ("sh_type", Elf64_Word -- ), # Elf64_Word sh_type; /* Section type */ -- ("sh_flags", Elf64_Xword -- ), # Elf64_Xword sh_flags; /* Section flags */ -+ ), -+ ( -+ # Section type -+ "sh_type", Elf64_Word -+ ), -+ ( -+ # Section flags -+ "sh_flags", Elf64_Xword -+ ), - ( -+ # Section virtual addr at execution - "sh_addr", Elf64_Addr -- ), # Elf64_Addr sh_addr; /* Section virtual addr at execution */ -+ ), - ( -+ # Section file offset - "sh_offset", Elf64_Off -- ), # Elf64_Off sh_offset; /* Section file offset */ -+ ), - ( -+ # Section size in bytes - "sh_size", Elf64_Xword -- ), # Elf64_Xword sh_size; /* Section size in bytes */ -+ ), - ( -+ # Link to another section - "sh_link", Elf64_Word -- ), # Elf64_Word sh_link; /* Link to another section */ -+ ), - ( -+ # Additional section information - "sh_info", Elf64_Word -- ), # Elf64_Word sh_info; /* Additional section information */ -- ("sh_addralign", Elf64_Xword -- ), # Elf64_Xword sh_addralign; /* Section alignment */ -+ ), - ( -+ # Section alignment -+ "sh_addralign", Elf64_Xword -+ ), -+ ( -+ # Entry size if section holds table - "sh_entsize", Elf64_Xword -- ) # Elf64_Xword sh_entsize; /* Entry size if section holds table */ -- ] # } Elf64_Shdr; -+ ) -+ ] - - - # elf_prstatus related constants. -@@ -179,188 +187,264 @@ class Elf64_Shdr(ctypes.Structure): # typedef struct - - # Signal info. - class elf_siginfo(ctypes.Structure): # struct elf_siginfo -- _fields_ = [ # { -- ("si_signo", ctypes.c_int -- ), # int si_signo; /* Signal number. */ -- ("si_code", ctypes.c_int -- ), # int si_code; /* Extra code. */ -- ("si_errno", ctypes.c_int -- ) # int si_errno; /* Errno. */ -- ] # }; -+ _fields_ = [ -+ ( -+ # Signal number -+ "si_signo", ctypes.c_int -+ ), -+ ( -+ # Extra code -+ "si_code", ctypes.c_int -+ ), -+ ( -+ # Errno -+ "si_errno", ctypes.c_int -+ ) -+ ] - - - # A time value that is accurate to the nearest - # microsecond but also has a range of years. - class timeval(ctypes.Structure): # struct timeval -- _fields_ = [ # { -- ("tv_sec", -- ctypes.c_long), # __time_t tv_sec; /* Seconds. */ -- ("tv_usec", ctypes.c_long -- ) # __suseconds_t tv_usec; /* Microseconds. */ -- ] # }; -+ _fields_ = [ -+ ( -+ # __time_t tv_sec; /* Seconds. */ -+ "tv_sec", ctypes.c_long -+ ), -+ ( -+ # __suseconds_t tv_usec; /* Microseconds. */ -+ "tv_usec", ctypes.c_long -+ ) -+ ] - - - class user_regs_struct(ctypes.Structure): # struct user_regs_struct -- _fields_ = [ # { -+ _fields_ = [ - ("r15", -- ctypes.c_ulonglong), # __extension__ unsigned long long int r15; -+ ctypes.c_ulonglong), # __extension__ unsigned long long int r15; - ("r14", -- ctypes.c_ulonglong), # __extension__ unsigned long long int r14; -+ ctypes.c_ulonglong), # __extension__ unsigned long long int r14; - ("r13", -- ctypes.c_ulonglong), # __extension__ unsigned long long int r13; -+ ctypes.c_ulonglong), # __extension__ unsigned long long int r13; - ("r12", -- ctypes.c_ulonglong), # __extension__ unsigned long long int r12; -+ ctypes.c_ulonglong), # __extension__ unsigned long long int r12; - ("rbp", -- ctypes.c_ulonglong), # __extension__ unsigned long long int rbp; -+ ctypes.c_ulonglong), # __extension__ unsigned long long int rbp; - ("rbx", -- ctypes.c_ulonglong), # __extension__ unsigned long long int rbx; -+ ctypes.c_ulonglong), # __extension__ unsigned long long int rbx; - ("r11", -- ctypes.c_ulonglong), # __extension__ unsigned long long int r11; -+ ctypes.c_ulonglong), # __extension__ unsigned long long int r11; - ("r10", -- ctypes.c_ulonglong), # __extension__ unsigned long long int r10; -+ ctypes.c_ulonglong), # __extension__ unsigned long long int r10; - ("r9", -- ctypes.c_ulonglong), # __extension__ unsigned long long int r9; -+ ctypes.c_ulonglong), # __extension__ unsigned long long int r9; - ("r8", -- ctypes.c_ulonglong), # __extension__ unsigned long long int r8; -+ ctypes.c_ulonglong), # __extension__ unsigned long long int r8; - ("rax", -- ctypes.c_ulonglong), # __extension__ unsigned long long int rax; -+ ctypes.c_ulonglong), # __extension__ unsigned long long int rax; - ("rcx", -- ctypes.c_ulonglong), # __extension__ unsigned long long int rcx; -+ ctypes.c_ulonglong), # __extension__ unsigned long long int rcx; - ("rdx", -- ctypes.c_ulonglong), # __extension__ unsigned long long int rdx; -+ ctypes.c_ulonglong), # __extension__ unsigned long long int rdx; - ("rsi", -- ctypes.c_ulonglong), # __extension__ unsigned long long int rsi; -+ ctypes.c_ulonglong), # __extension__ unsigned long long int rsi; - ("rdi", -- ctypes.c_ulonglong), # __extension__ unsigned long long int rdi; -+ ctypes.c_ulonglong), # __extension__ unsigned long long int rdi; - ("orig_rax", ctypes.c_ulonglong -- ), # __extension__ unsigned long long int orig_rax; -+ ), # __extension__ unsigned long long int orig_rax; - ("rip", -- ctypes.c_ulonglong), # __extension__ unsigned long long int rip; -+ ctypes.c_ulonglong), # __extension__ unsigned long long int rip; - ("cs", -- ctypes.c_ulonglong), # __extension__ unsigned long long int cs; -+ ctypes.c_ulonglong), # __extension__ unsigned long long int cs; - ("eflags", -- ctypes.c_ulonglong), # __extension__ unsigned long long int eflags; -+ ctypes.c_ulonglong), # __extension__ unsigned long long int eflags; - ("rsp", -- ctypes.c_ulonglong), # __extension__ unsigned long long int rsp; -+ ctypes.c_ulonglong), # __extension__ unsigned long long int rsp; - ("ss", -- ctypes.c_ulonglong), # __extension__ unsigned long long int ss; -+ ctypes.c_ulonglong), # __extension__ unsigned long long int ss; - ("fs_base", ctypes.c_ulonglong -- ), # __extension__ unsigned long long int fs_base; -+ ), # __extension__ unsigned long long int fs_base; - ("gs_base", ctypes.c_ulonglong -- ), # __extension__ unsigned long long int gs_base; -+ ), # __extension__ unsigned long long int gs_base; - ("ds", -- ctypes.c_ulonglong), # __extension__ unsigned long long int ds; -+ ctypes.c_ulonglong), # __extension__ unsigned long long int ds; - ("es", -- ctypes.c_ulonglong), # __extension__ unsigned long long int es; -+ ctypes.c_ulonglong), # __extension__ unsigned long long int es; - ("fs", -- ctypes.c_ulonglong), # __extension__ unsigned long long int fs; -+ ctypes.c_ulonglong), # __extension__ unsigned long long int fs; - ("gs", ctypes.c_ulonglong -- ) # __extension__ unsigned long long int gs; -- ] # }; -+ ) # __extension__ unsigned long long int gs; -+ ] - - --#elf_greg_t = ctypes.c_ulonglong --#ELF_NGREG = ctypes.sizeof(user_regs_struct)/ctypes.sizeof(elf_greg_t) --#elf_gregset_t = elf_greg_t*ELF_NGREG -+# elf_greg_t = ctypes.c_ulonglong -+# ELF_NGREG = ctypes.sizeof(user_regs_struct)/ctypes.sizeof(elf_greg_t) -+# elf_gregset_t = elf_greg_t*ELF_NGREG - elf_gregset_t = user_regs_struct - - - class elf_prstatus(ctypes.Structure): # struct elf_prstatus -- _fields_ = [ # { -+ _fields_ = [ - ( -+ # Info associated with signal -+ # struct elf_siginfo pr_info; - "pr_info", elf_siginfo -- ), # struct elf_siginfo pr_info; /* Info associated with signal. */ -- ("pr_cursig", ctypes.c_short -- ), # short int pr_cursig; /* Current signal. */ -+ ), -+ ( -+ # Current signal -+ # short int pr_cursig; -+ "pr_cursig", ctypes.c_short -+ ), - ( -+ # Set of pending signals -+ # unsigned long int pr_sigpend; - "pr_sigpend", ctypes.c_ulong -- ), # unsigned long int pr_sigpend; /* Set of pending signals. */ -+ ), - ( -+ # Set of held signals -+ # unsigned long int pr_sighold; - "pr_sighold", ctypes.c_ulong -- ), # unsigned long int pr_sighold; /* Set of held signals. */ -- ("pr_pid", ctypes.c_int), # __pid_t pr_pid; -- ("pr_ppid", ctypes.c_int), # __pid_t pr_ppid; -- ("pr_pgrp", ctypes.c_int), # __pid_t pr_pgrp; -- ("pr_sid", ctypes.c_int), # __pid_t pr_sid; -- ("pr_utime", -- timeval), # struct timeval pr_utime; /* User time. */ -- ("pr_stime", timeval -- ), # struct timeval pr_stime; /* System time. */ -- ( -+ ), -+ ( -+ # Process ID -+ # __pid_t pr_pid; -+ "pr_pid", ctypes.c_int -+ ), -+ ( -+ # Parent process ID -+ # __pid_t pr_ppid; -+ "pr_ppid", ctypes.c_int -+ ), -+ ( -+ # Parent group ID -+ # __pid_t pr_pgrp; -+ "pr_pgrp", ctypes.c_int -+ ), -+ ( -+ # Parent session ID -+ # __pid_t pr_sid; -+ "pr_sid", ctypes.c_int -+ ), -+ ( -+ # User time -+ # struct timeval pr_utime; -+ "pr_utime", timeval -+ ), -+ ( -+ # System time -+ # struct timeval pr_stime; -+ "pr_stime", timeval -+ ), -+ ( -+ # Cumulative user time -+ # struct timeval pr_cutime; - "pr_cutime", timeval -- ), # struct timeval pr_cutime; /* Cumulative user time. */ -+ ), - ( -+ # Cumulative system time -+ # struct timeval pr_cstime; - "pr_cstime", timeval -- ), # struct timeval pr_cstime; /* Cumulative system time. */ -- ("pr_reg", elf_gregset_t -- ), # elf_gregset_t pr_reg; /* GP registers. */ -+ ), - ( -+ # GP registers -+ # elf_gregset_t pr_reg; -+ "pr_reg", elf_gregset_t -+ ), -+ ( -+ # True if math copro being used -+ # int pr_fpvalid; - "pr_fpvalid", ctypes.c_int -- ) # int pr_fpvalid; /* True if math copro being used. */ -- ] # }; -+ ) -+ ] - - - # elf_prpsinfo related constants. - --ELF_PRARGSZ = 80 # #define ELF_PRARGSZ (80) /* Number of chars for args. */ -+# Number of chars for args -+# #define ELF_PRARGSZ (80) -+ELF_PRARGSZ = 80 - - - class elf_prpsinfo(ctypes.Structure): # struct elf_prpsinfo -- _fields_ = [ # { -+ _fields_ = [ - ( -+ # Numeric process state -+ # char pr_state; - "pr_state", ctypes.c_byte -- ), # char pr_state; /* Numeric process state. */ -+ ), - ( -+ # Char for pr_state -+ # char pr_sname; - "pr_sname", ctypes.c_char -- ), # char pr_sname; /* Char for pr_state. */ -- ("pr_zomb", ctypes.c_byte -- ), # char pr_zomb; /* Zombie. */ -- ("pr_nice", ctypes.c_byte -- ), # char pr_nice; /* Nice val. */ -- ("pr_flag", ctypes.c_ulong -- ), # unsigned long int pr_flag; /* Flags. */ -- # #if __WORDSIZE == 32 -- # unsigned short int pr_uid; -- # unsigned short int pr_gid; -- # #else -- ("pr_uid", ctypes.c_uint), # unsigned int pr_uid; -- ("pr_gid", ctypes.c_uint), # unsigned int pr_gid; -- # #endif -- ("pr_pid", ctypes.c_int), # int pr_pid, pr_ppid, pr_pgrp, pr_sid; -+ ), -+ ( -+ # Zombie -+ # char pr_zomb; -+ "pr_zomb", ctypes.c_byte -+ ), -+ ( -+ # Nice value -+ # char pr_nice; -+ "pr_nice", ctypes.c_byte -+ ), -+ ( -+ # Flags -+ # unsigned long int pr_flag; -+ "pr_flag", ctypes.c_ulong -+ ), -+ ( -+ # User ID -+ # unsigned int pr_uid; -+ "pr_uid", ctypes.c_uint -+ ), -+ ( -+ # Group ID -+ # unsigned int pr_gid; -+ "pr_gid", ctypes.c_uint -+ ), -+ ("pr_pid", ctypes.c_int), - ("pr_ppid", ctypes.c_int), - ("pr_pgrp", ctypes.c_int), - ("pr_sid", ctypes.c_int), -- # /* Lots missing */ -+ # /* Lots missing */ - ( -+ # Filename of executable -+ # char pr_fname[16]; - "pr_fname", ctypes.c_char * 16 -- ), # char pr_fname[16]; /* Filename of executable. */ -+ ), - ( -+ # Initial part of arg list -+ # char pr_psargs[ELF_PRARGSZ]; - "pr_psargs", ctypes.c_char * ELF_PRARGSZ -- ) # char pr_psargs[ELF_PRARGSZ]; /* Initial part of arg list. */ -- ] # }; -+ ) -+ ] - - - class user_fpregs_struct(ctypes.Structure): # struct user_fpregs_struct -- _fields_ = [ # { -- ("cwd", ctypes.c_ushort), # unsigned short int cwd; -- ("swd", ctypes.c_ushort), # unsigned short int swd; -- ("ftw", ctypes.c_ushort), # unsigned short int ftw; -- ("fop", ctypes.c_ushort), # unsigned short int fop; -- ("rip", -- ctypes.c_ulonglong), # __extension__ unsigned long long int rip; -- ("rdp", -- ctypes.c_ulonglong), # __extension__ unsigned long long int rdp; -- ("mxcsr", ctypes.c_uint), # unsigned int mxcsr; -- ("mxcr_mask", ctypes.c_uint), # unsigned int mxcr_mask; -- ( -- "st_space", ctypes.c_uint * 32 -- ), # unsigned int st_space[32]; /* 8*16 bytes for each FP-reg = 128 bytes */ -- ( -- "xmm_space", ctypes.c_uint * 64 -- ), # unsigned int xmm_space[64]; /* 16*16 bytes for each XMM-reg = 256 bytes */ -- ("padding", -- ctypes.c_uint * 24), # unsigned int padding[24]; -- ] # }; -+ _fields_ = [ -+ # unsigned short int cwd; -+ ("cwd", ctypes.c_ushort), -+ # unsigned short int swd; -+ ("swd", ctypes.c_ushort), -+ # unsigned short int ftw; -+ ("ftw", ctypes.c_ushort), -+ # unsigned short int fop; -+ ("fop", ctypes.c_ushort), -+ # __extension__ unsigned long long int rip; -+ ("rip", ctypes.c_ulonglong), -+ # __extension__ unsigned long long int rdp; -+ ("rdp", ctypes.c_ulonglong), -+ # unsigned int mxcsr; -+ ("mxcsr", ctypes.c_uint), -+ # unsigned int mxcr_mask; -+ ("mxcr_mask", ctypes.c_uint), -+ # unsigned int st_space[32]; /* 8*16 bytes for each FP-reg = 128 bytes */ -+ ("st_space", ctypes.c_uint * 32), -+ # unsigned int xmm_space[64]; /* 16*16 bytes for each XMM-reg = 256 bytes */ -+ ("xmm_space", ctypes.c_uint * 64), -+ # unsigned int padding[24]; -+ ("padding", ctypes.c_uint * 24), -+ ] - - - elf_fpregset_t = user_fpregs_struct -@@ -371,315 +455,390 @@ _SI_MAX_SIZE = 128 - _SI_PAD_SIZE = (_SI_MAX_SIZE // ctypes.sizeof(ctypes.c_int)) - 4 - - --# /* kill(). */ --class _siginfo_t_U_kill(ctypes.Structure): # struct -- _fields_ = [ # { -- ("si_pid", ctypes.c_int -- ), # __pid_t si_pid; /* Sending process ID. */ -+# /* kill(). */ -+class _siginfo_t_U_kill(ctypes.Structure): # struct -+ _fields_ = [ -+ ( -+ # Sending process ID -+ # __pid_t si_pid; -+ "si_pid", ctypes.c_int -+ ), - ( -+ # Real user ID of sending process -+ # __uid_t si_uid; - "si_uid", ctypes.c_uint -- ) # __uid_t si_uid; /* Real user ID of sending process. */ -- ] # } _kill; -+ ) -+ ] # } _kill; - - - # Type for data associated with a signal. - class sigval_t(ctypes.Union): # typedef union sigval -- _fields_ = [ # { -- ("sival_int", ctypes.c_int), # int sival_int; -- ("sical_ptr", ctypes.c_void_p), # void *sival_ptr; -- ] # } sigval_t; -- -- -- # /* POSIX.1b timers. */ --class _siginfo_t_U_timer(ctypes.Structure): # struct -- _fields_ = [ # { -- ("si_tid", -- ctypes.c_int), # int si_tid; /* Timer ID. */ -- ("si_overrun", ctypes.c_int -- ), # int si_overrun; /* Overrun count. */ -- ("si_sigval", sigval_t -- ) # sigval_t si_sigval; /* Signal value. */ -- ] # } _timer; -- -- -- # /* POSIX.1b signals. */ --class _siginfo_t_U_rt(ctypes.Structure): # struct -- _fields_ = [ # { -- ("si_pid", ctypes.c_int -- ), # __pid_t si_pid; /* Sending process ID. */ -+ _fields_ = [ -+ ("sival_int", ctypes.c_int), # int sival_int; -+ ("sical_ptr", ctypes.c_void_p), # void *sival_ptr; -+ ] # } sigval_t; -+ -+ -+# /* POSIX.1b timers. */ -+class _siginfo_t_U_timer(ctypes.Structure): # struct -+ _fields_ = [ -+ ( -+ # Timer ID -+ # int si_tid; -+ "si_tid", ctypes.c_int -+ ), -+ ( -+ # Overrun count -+ # int si_overrun; -+ "si_overrun", ctypes.c_int -+ ), - ( -+ # Signal value -+ # sigval_t si_sigval; -+ "si_sigval", sigval_t -+ ) -+ ] # } _timer; -+ -+ -+# /* POSIX.1b signals. */ -+class _siginfo_t_U_rt(ctypes.Structure): # struct -+ _fields_ = [ -+ ( -+ # Sending process ID -+ # __pid_t si_pid; -+ "si_pid", ctypes.c_int -+ ), -+ ( -+ # Real user ID of sending process -+ # __uid_t si_uid; - "si_uid", ctypes.c_uint -- ), # __uid_t si_uid; /* Real user ID of sending process. */ -- ("si_sigval", sigval_t -- ) # sigval_t si_sigval; /* Signal value. */ -- ] # } _rt; -+ ), -+ ( -+ # Signal value -+ # sigval_t si_sigval; -+ "si_sigval", sigval_t -+ ) -+ ] # } _rt; - - -- # /* SIGCHLD. */ --class _siginfo_t_U_sigchld(ctypes.Structure): # struct -- _fields_ = [ # { -- ("si_pid", -- ctypes.c_int), # __pid_t si_pid; /* Which child. */ -+# /* SIGCHLD. */ -+class _siginfo_t_U_sigchld(ctypes.Structure): # struct -+ _fields_ = [ -+ ( -+ # Which child -+ # __pid_t si_pid; -+ "si_pid", ctypes.c_int -+ ), - ( -+ # Real user ID of sending process -+ # __uid_t si_uid; - "si_uid", ctypes.c_uint -- ), # __uid_t si_uid; /* Real user ID of sending process. */ -- ("si_status", ctypes.c_int -- ), # int si_status; /* Exit value or signal. */ -- ("si_utime", ctypes.c_long), # __sigchld_clock_t si_utime; -- ("si_stime", ctypes.c_long) # __sigchld_clock_t si_stime; -- ] # } _sigchld; -+ ), -+ ( -+ # Exit value or signal -+ # int si_status; -+ "si_status", ctypes.c_int -+ ), -+ ( -+ # __sigchld_clock_t si_utime; -+ "si_utime", ctypes.c_long -+ ), -+ ( -+ # __sigchld_clock_t si_stime; -+ "si_stime", ctypes.c_long -+ ) -+ ] # } _sigchld; - - -- # /* SIGILL, SIGFPE, SIGSEGV, SIGBUS. */ --class _siginfo_t_U_sigfault(ctypes.Structure): # struct -- _fields_ = [ # { -- ("si_addr", ctypes.c_void_p -- ), # void *si_addr; /* Faulting insn/memory ref. */ -+# /* SIGILL, SIGFPE, SIGSEGV, SIGBUS. */ -+class _siginfo_t_U_sigfault(ctypes.Structure): # struct -+ _fields_ = [ - ( -+ # Faulting insn/memory ref -+ # void *si_addr; -+ "si_addr", ctypes.c_void_p -+ ), -+ ( -+ # Valid LSB of the reported address -+ # short int si_addr_lsb; - "si_addr_lsb", ctypes.c_short -- ) # short int si_addr_lsb; /* Valid LSB of the reported address. */ -- ] # } _sigfault; -+ ) -+ ] # } _sigfault; - - -- # /* SIGPOLL. */ --class _siginfo_t_U_sigpoll(ctypes.Structure): # struct -- _fields_ = [ # { -- ("si_band", ctypes.c_long -- ), # long int si_band; /* Band event for SIGPOLL. */ -- ("si_fd", ctypes.c_int) # int si_fd; -- ] # } _sigpoll; -+# /* SIGPOLL. */ -+class _siginfo_t_U_sigpoll(ctypes.Structure): # struct -+ _fields_ = [ -+ ( -+ # Band event for SIGPOLL -+ # long int si_band; -+ "si_band", ctypes.c_long -+ ), -+ ( -+ # int si_fd; -+ "si_fd", ctypes.c_int -+ ) -+ ] # } _sigpoll; - - -- # /* SIGSYS. */ --class _siginfo_t_U_sigsys(ctypes.Structure): # struct -- _fields_ = [ # { -+# /* SIGSYS. */ -+class _siginfo_t_U_sigsys(ctypes.Structure): # struct -+ _fields_ = [ - ("_call_addr", ctypes.c_void_p -- ), # void *_call_addr; /* Calling user insn. */ -+ ), # void *_call_addr; /* Calling user insn. */ - ( - "_syscall", ctypes.c_int -- ), # int _syscall; /* Triggering system call number. */ -+ ), # int _syscall; /* Triggering system call number. */ - ("_arch", ctypes.c_uint -- ) # unsigned int _arch; /* AUDIT_ARCH_* of syscall. */ -- ] # } _sigsys; -+ ) # unsigned int _arch; /* AUDIT_ARCH_* of syscall. */ -+ ] # } _sigsys; - - --class _siginfo_t_U(ctypes.Union): # union -- _fields_ = [ # { -+class _siginfo_t_U(ctypes.Union): # union -+ _fields_ = [ - ("_pad", -- ctypes.c_int * _SI_PAD_SIZE), # int _pad[__SI_PAD_SIZE]; -- # -- # /* kill(). */ -- ("_kill", _siginfo_t_U_kill), # struct -- # { -- # __pid_t si_pid; /* Sending process ID. */ -- # __uid_t si_uid; /* Real user ID of sending process. */ -- # } _kill; -- # -- # /* POSIX.1b timers. */ -- ("_timer", _siginfo_t_U_timer), # struct -- # { -- # int si_tid; /* Timer ID. */ -- # int si_overrun; /* Overrun count. */ -- # sigval_t si_sigval; /* Signal value. */ -- # } _timer; -- # -- # /* POSIX.1b signals. */ -- ("_rt", _siginfo_t_U_rt), # struct -- # { -- # __pid_t si_pid; /* Sending process ID. */ -- # __uid_t si_uid; /* Real user ID of sending process. */ -- # sigval_t si_sigval; /* Signal value. */ -- # } _rt; -- # -- # /* SIGCHLD. */ -- ("_sigchld", _siginfo_t_U_sigchld), # struct -- # { -- # __pid_t si_pid; /* Which child. */ -- # __uid_t si_uid; /* Real user ID of sending process. */ -- # int si_status; /* Exit value or signal. */ -- # __sigchld_clock_t si_utime; -- # __sigchld_clock_t si_stime; -- # } _sigchld; -- # -- # /* SIGILL, SIGFPE, SIGSEGV, SIGBUS. */ -- ("_sigfault", _siginfo_t_U_sigfault), # struct -- # { -- # void *si_addr; /* Faulting insn/memory ref. */ -- # short int si_addr_lsb; /* Valid LSB of the reported address. */ -- # } _sigfault; -- # -- # /* SIGPOLL. */ -- ("_sigpoll", _siginfo_t_U_sigpoll), # struct -- # { -- # long int si_band; /* Band event for SIGPOLL. */ -- # int si_fd; -- # } _sigpoll; -- # -- # /* SIGSYS. */ -- ("_sigsys", _siginfo_t_U_sigpoll) # struct -- # { -- # void *_call_addr; /* Calling user insn. */ -- # int _syscall; /* Triggering system call number. */ -- # unsigned int _arch; /* AUDIT_ARCH_* of syscall. */ -- # } _sigsys; -- ] # } _sifields; -+ ctypes.c_int * _SI_PAD_SIZE), # int _pad[__SI_PAD_SIZE]; -+ -+ # /* kill(). */ -+ ("_kill", _siginfo_t_U_kill), # struct -+ -+ # __pid_t si_pid; /* Sending process ID. */ -+ # __uid_t si_uid; /* Real user ID of sending process. */ -+ # } _kill; -+ -+ # /* POSIX.1b timers. */ -+ ("_timer", _siginfo_t_U_timer), # struct -+ -+ # int si_tid; /* Timer ID. */ -+ # int si_overrun; /* Overrun count. */ -+ # sigval_t si_sigval; /* Signal value. */ -+ # } _timer; -+ -+ # /* POSIX.1b signals. */ -+ ("_rt", _siginfo_t_U_rt), # struct -+ -+ # __pid_t si_pid; /* Sending process ID. */ -+ # __uid_t si_uid; /* Real user ID of sending process. */ -+ # sigval_t si_sigval; /* Signal value. */ -+ # } _rt; -+ -+ # /* SIGCHLD. */ -+ ("_sigchld", _siginfo_t_U_sigchld), # struct -+ -+ # __pid_t si_pid; /* Which child. */ -+ # __uid_t si_uid; /* Real user ID of sending process. */ -+ # int si_status; /* Exit value or signal. */ -+ # __sigchld_clock_t si_utime; -+ # __sigchld_clock_t si_stime; -+ # } _sigchld; -+ -+ # /* SIGILL, SIGFPE, SIGSEGV, SIGBUS. */ -+ ("_sigfault", _siginfo_t_U_sigfault), # struct -+ -+ # void *si_addr; /* Faulting insn/memory ref. */ -+ # short int si_addr_lsb; /* Valid LSB of the reported address. */ -+ # } _sigfault; -+ -+ # /* SIGPOLL. */ -+ ("_sigpoll", _siginfo_t_U_sigpoll), # struct -+ -+ # long int si_band; /* Band event for SIGPOLL. */ -+ # int si_fd; -+ # } _sigpoll; -+ -+ # /* SIGSYS. */ -+ ("_sigsys", _siginfo_t_U_sigpoll) # struct -+ -+ # void *_call_addr; /* Calling user insn. */ -+ # int _syscall; /* Triggering system call number. */ -+ # unsigned int _arch; /* AUDIT_ARCH_* of syscall. */ -+ # } _sigsys; -+ ] # } _sifields; - - - class siginfo_t(ctypes.Structure): # typedef struct -- _fields_ = [ # { -- ("si_signo", ctypes.c_int -- ), # int si_signo; /* Signal number. */ -+ _fields_ = [ -+ ( -+ # Signal number -+ # int si_signo; -+ "si_signo", ctypes.c_int -+ ), - ( -+ # If non-zero, an errno value associated with -+ # int si_errno; - "si_errno", ctypes.c_int -- ), # int si_errno; /* If non-zero, an errno value associated with -- # this signal, as defined in . */ -- ("si_code", ctypes.c_int -- ), # int si_code; /* Signal code. */ -- # -- ("_sifields", _siginfo_t_U) # union -- # { -- # int _pad[__SI_PAD_SIZE]; -+ ), -+ ( -+ # Signal code - this signal, as defined in -+ # int si_code; -+ "si_code", ctypes.c_int -+ ), -+ ( -+ # Union -+ "_sifields", _siginfo_t_U -+ ) -+ -+ # int _pad[__SI_PAD_SIZE]; - # -- # /* kill(). */ -- # struct -- # { -- # __pid_t si_pid; /* Sending process ID. */ -- # __uid_t si_uid; /* Real user ID of sending process. */ -- # } _kill; -+ # /* kill(). */ -+ # struct -+ -+ # __pid_t si_pid; /* Sending process ID. */ -+ # __uid_t si_uid; /* Real user ID of sending process. */ -+ # } _kill; - # -- # /* POSIX.1b timers. */ -- # struct -- # { -- # int si_tid; /* Timer ID. */ -- # int si_overrun; /* Overrun count. */ -- # sigval_t si_sigval; /* Signal value. */ -- # } _timer; -+ # /* POSIX.1b timers. */ -+ # struct -+ -+ # int si_tid; /* Timer ID. */ -+ # int si_overrun; /* Overrun count. */ -+ # sigval_t si_sigval; /* Signal value. */ -+ # } _timer; - # -- # /* POSIX.1b signals. */ -- # struct -- # { -- # __pid_t si_pid; /* Sending process ID. */ -- # __uid_t si_uid; /* Real user ID of sending process. */ -- # sigval_t si_sigval; /* Signal value. */ -- # } _rt; -+ # /* POSIX.1b signals. */ -+ # struct -+ -+ # __pid_t si_pid; /* Sending process ID. */ -+ # __uid_t si_uid; /* Real user ID of sending process. */ -+ # sigval_t si_sigval; /* Signal value. */ -+ # } _rt; - # -- # /* SIGCHLD. */ -- # struct -- # { -- # __pid_t si_pid; /* Which child. */ -- # __uid_t si_uid; /* Real user ID of sending process. */ -- # int si_status; /* Exit value or signal. */ -- # __sigchld_clock_t si_utime; -- # __sigchld_clock_t si_stime; -- # } _sigchld; -+ # /* SIGCHLD. */ -+ # struct -+ -+ # __pid_t si_pid; /* Which child. */ -+ # __uid_t si_uid; /* Real user ID of sending process. */ -+ # int si_status; /* Exit value or signal. */ -+ # __sigchld_clock_t si_utime; -+ # __sigchld_clock_t si_stime; -+ # } _sigchld; - # -- # /* SIGILL, SIGFPE, SIGSEGV, SIGBUS. */ -- # struct -- # { -- # void *si_addr; /* Faulting insn/memory ref. */ -- # short int si_addr_lsb; /* Valid LSB of the reported address. */ -- # } _sigfault; -+ # /* SIGILL, SIGFPE, SIGSEGV, SIGBUS. */ -+ # struct -+ -+ # void *si_addr; /* Faulting insn/memory ref. */ -+ # short int si_addr_lsb; /* Valid LSB of the reported address. */ -+ # } _sigfault; - # -- # /* SIGPOLL. */ -- # struct -- # { -- # long int si_band; /* Band event for SIGPOLL. */ -- # int si_fd; -- # } _sigpoll; -+ # /* SIGPOLL. */ -+ # struct -+ -+ # long int si_band; /* Band event for SIGPOLL. */ -+ # int si_fd; -+ # } _sigpoll; - # -- # /* SIGSYS. */ -- # struct -- # { -- # void *_call_addr; /* Calling user insn. */ -- # int _syscall; /* Triggering system call number. */ -- # unsigned int _arch; /* AUDIT_ARCH_* of syscall. */ -- # } _sigsys; -- # } _sifields; -- ] # } siginfo_t __SI_ALIGNMENT; -+ # /* SIGSYS. */ -+ # struct -+ -+ # void *_call_addr; /* Calling user insn. */ -+ # int _syscall; /* Triggering system call number. */ -+ # unsigned int _arch; /* AUDIT_ARCH_* of syscall. */ -+ # } _sigsys; -+ # } _sifields; -+ ] # } siginfo_t __SI_ALIGNMENT; - - - # xsave related. - - - class ymmh_struct(ctypes.Structure): # struct ymmh_struct { -- _fields_ = [("ymmh_space", 64 * ctypes.c_uint -- ) # u32 ymmh_space[64]; -- ] # } __packed; -+ _fields_ = [ -+ # u32 ymmh_space[64]; -+ ("ymmh_space", 64 * ctypes.c_uint) -+ ] # } __packed; - - - class xsave_hdr_struct(ctypes.Structure): # struct xsave_hdr_struct { - _fields_ = [ -- ("xstate_bv", ctypes.c_ulonglong -- ), # u64 xstate_bv; -- ("reserved1", ctypes.c_ulonglong * -- 2), # u64 reserved1[2]; -- ("reserved2", ctypes.c_ulonglong * 5 -- ) # u64 reserved2[5]; -+ # u64 xstate_bv; -+ ("xstate_bv", ctypes.c_ulonglong), -+ # u64 reserved1[2]; -+ ("reserved1", ctypes.c_ulonglong * 2), -+ # u64 reserved2[5]; -+ ("reserved2", ctypes.c_ulonglong * 5) - ] # } __packed; - - - class i387_fxsave_struct(ctypes.Structure): # struct i387_fxsave_struct { - _fields_ = [ - ( -+ # Control Word -+ # u16 cwd; - "cwd", ctypes.c_ushort -- ), # u16 cwd; /* Control Word */ -+ ), - ( -+ # Status Word -+ # u16 swd; - "swd", ctypes.c_ushort -- ), # u16 swd; /* Status Word */ -+ ), - ( -+ # Tag Word -+ # u16 twd; - "twd", ctypes.c_ushort -- ), # u16 twd; /* Tag Word */ -+ ), - ( -+ # Last Instruction Opcode -+ # u16 fop; - "fop", ctypes.c_ushort -- ), # u16 fop; /* Last Instruction Opcode */ -- # union { -- # struct { -+ ), -+ # union { -+ # struct { - ( -+ # Instruction Pointer -+ # u64 rip; - "rip", ctypes.c_ulonglong -- ), # u64 rip; /* Instruction Pointer */ -+ ), - ( -+ # Data Pointer -+ # u64 rdp; - "rdp", ctypes.c_ulonglong -- ), # u64 rdp; /* Data Pointer */ -- # }; -- # struct { -- # u32 fip; /* FPU IP Offset */ -- # u32 fcs; /* FPU IP Selector */ -- # u32 foo; /* FPU Operand Offset */ -- # u32 fos; /* FPU Operand Selector */ -- # }; -- # }; -+ ), -+ -+ # struct { -+ # u32 fip; /* FPU IP Offset */ -+ # u32 fcs; /* FPU IP Selector */ -+ # u32 foo; /* FPU Operand Offset */ -+ # u32 fos; /* FPU Operand Selector */ -+ - ( -+ # MXCSR Register State -+ # u32 mxcsr; - "mxcsr", ctypes.c_uint -- ), # u32 mxcsr; /* MXCSR Register State */ -+ ), - ( -+ # MXCSR Mask -+ # u32 mxcsr_mask; - "mxcsr_mask", ctypes.c_uint -- ), # u32 mxcsr_mask; /* MXCSR Mask */ -- # -- # /* 8*16 bytes for each FP-reg = 128 bytes */ -- ("st_space", ctypes.c_uint * 32 -- ), # u32 st_space[32]; -- # -- # /* 16*16 bytes for each XMM-reg = 256 bytes */ -- ("xmm_space", ctypes.c_uint * 64 -- ), # u32 xmm_space[64]; -- # -- ("padding", ctypes.c_uint * 12 -- ), # u32 padding[12]; -- # -- # union { -- ("padding1", ctypes.c_uint * 12 -- ) # u32 padding1[12]; -- # u32 sw_reserved[12]; -- # }; -- # -+ ), -+ # 8*16 bytes for each FP-reg = 128 bytes -+ ( -+ # u32 st_space[32]; -+ "st_space", ctypes.c_uint * 32 -+ ), -+ # 16*16 bytes for each XMM-reg = 256 bytes -+ ( -+ # u32 xmm_space[64]; -+ "xmm_space", ctypes.c_uint * 64 -+ ), -+ ( -+ # u32 padding[12]; -+ "padding", ctypes.c_uint * 12 -+ ), -+ # union { -+ ( -+ # u32 padding1[12]; -+ "padding1", ctypes.c_uint * 12 -+ ) -+ # u32 sw_reserved[12]; - ] # } __aligned(16); - - - class elf_xsave_struct(ctypes.Structure): # struct xsave_struct { - _fields_ = [ -- ("i387", -- i387_fxsave_struct), # struct i387_fxsave_struct i387; -- ("xsave_hdr", xsave_hdr_struct -- ), # struct xsave_hdr_struct xsave_hdr; -- ("ymmh", ymmh_struct) # struct ymmh_struct ymmh; -+ # struct i387_fxsave_struct i387; -+ ("i387", i387_fxsave_struct), -+ # struct xsave_hdr_struct xsave_hdr; -+ ("xsave_hdr", xsave_hdr_struct), -+ # struct ymmh_struct ymmh; -+ ("ymmh", ymmh_struct) - ] # } __aligned(FP_MIN_ALIGN_BYTES) __packed; --- -2.35.1 - diff --git a/0014-coredump-fix-missing-whitespace-around-operator.patch b/0014-coredump-fix-missing-whitespace-around-operator.patch deleted file mode 100644 index 542d788..0000000 --- a/0014-coredump-fix-missing-whitespace-around-operator.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 33b1692e10d8192f583e5fa10d5ab9fb7ac7bef7 Mon Sep 17 00:00:00 2001 -From: Radostin Stoyanov -Date: Sun, 5 Sep 2021 22:37:26 +0100 -Subject: [PATCH 014/249] coredump: fix missing whitespace around operator - -Missing whitespace around arithmetic operator -https://www.flake8rules.com/rules/E226.html - -Signed-off-by: Radostin Stoyanov ---- - coredump/coredump.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/coredump/coredump.py b/coredump/coredump.py -index e63abf951..5e63d2138 100644 ---- a/coredump/coredump.py -+++ b/coredump/coredump.py -@@ -10,7 +10,7 @@ def coredump(opts): - for pid in cores: - if opts['pid'] and pid != opts['pid']: - continue -- with open(os.path.realpath(opts['out'])+"/core."+str(pid), 'wb+') as f: -+ with open(os.path.realpath(opts['out']) + "/core." + str(pid), 'wb+') as f: - cores[pid].write(f) - - --- -2.35.1 - diff --git a/0015-coredump-fix-too-many-blank-lines.patch b/0015-coredump-fix-too-many-blank-lines.patch deleted file mode 100644 index fd16235..0000000 --- a/0015-coredump-fix-too-many-blank-lines.patch +++ /dev/null @@ -1,27 +0,0 @@ -From a20c0fe6e518a76db428979d2a145e98fdd79988 Mon Sep 17 00:00:00 2001 -From: Radostin Stoyanov -Date: Sun, 5 Sep 2021 22:39:50 +0100 -Subject: [PATCH 015/249] coredump: fix too many blank lines - -https://www.flake8rules.com/rules/E303.html - -Signed-off-by: Radostin Stoyanov ---- - coredump/criu_coredump/coredump.py | 1 - - 1 file changed, 1 deletion(-) - -diff --git a/coredump/criu_coredump/coredump.py b/coredump/criu_coredump/coredump.py -index 274889800..a232132fd 100644 ---- a/coredump/criu_coredump/coredump.py -+++ b/coredump/criu_coredump/coredump.py -@@ -321,7 +321,6 @@ class coredump_generator: - else: - prpsinfo.pr_fname = core["tc"]["comm"] - -- - nhdr = elf.Elf64_Nhdr() - nhdr.n_namesz = 5 - nhdr.n_descsz = ctypes.sizeof(elf.elf_prpsinfo()) --- -2.35.1 - diff --git a/0016-coredump-fix-comparison-to-true.patch b/0016-coredump-fix-comparison-to-true.patch deleted file mode 100644 index 2685ebf..0000000 --- a/0016-coredump-fix-comparison-to-true.patch +++ /dev/null @@ -1,29 +0,0 @@ -From e2fe46e74dd8904f296baa1257cf7191bcd74c4c Mon Sep 17 00:00:00 2001 -From: Radostin Stoyanov -Date: Sun, 5 Sep 2021 22:42:19 +0100 -Subject: [PATCH 016/249] coredump: fix comparison to true - -Comparison to true should be 'if cond is true:' or 'if cond:' -https://www.flake8rules.com/rules/E712.html - -Signed-off-by: Radostin Stoyanov ---- - coredump/criu_coredump/coredump.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/coredump/criu_coredump/coredump.py b/coredump/criu_coredump/coredump.py -index a232132fd..41d102db7 100644 ---- a/coredump/criu_coredump/coredump.py -+++ b/coredump/criu_coredump/coredump.py -@@ -653,7 +653,7 @@ class coredump_generator: - if not found: - continue - -- if "in_parent" in m and m["in_parent"] == True: -+ if "in_parent" in m and m["in_parent"]: - ppid = self.pstree[pid]["ppid"] - return self._get_page(ppid, page_no) - else: --- -2.35.1 - diff --git a/0017-coredump-lint-fix-visually-indented-line.patch b/0017-coredump-lint-fix-visually-indented-line.patch deleted file mode 100644 index 78d0bd4..0000000 --- a/0017-coredump-lint-fix-visually-indented-line.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 630893e55da8281877ddd833e79e33a5dddd2b1b Mon Sep 17 00:00:00 2001 -From: Radostin Stoyanov -Date: Sun, 5 Sep 2021 22:47:59 +0100 -Subject: [PATCH 017/249] coredump: lint fix visually indented line - -Continuation line over-indented for visual indent -https://www.flake8rules.com/rules/E127.html - -Visually indented line with same indent as next logical line -https://www.flake8rules.com/rules/E129.html - -Signed-off-by: Radostin Stoyanov ---- - coredump/criu_coredump/coredump.py | 18 +++++++++--------- - 1 file changed, 9 insertions(+), 9 deletions(-) - -diff --git a/coredump/criu_coredump/coredump.py b/coredump/criu_coredump/coredump.py -index 41d102db7..881c40b0a 100644 ---- a/coredump/criu_coredump/coredump.py -+++ b/coredump/criu_coredump/coredump.py -@@ -781,19 +781,19 @@ class coredump_generator: - """ - Calculate amount of vma to put into core dump. - """ -- if vma["status"] & status["VMA_AREA_VVAR"] or \ -- vma["status"] & status["VMA_AREA_VSYSCALL"] or \ -- vma["status"] & status["VMA_AREA_VDSO"]: -+ if (vma["status"] & status["VMA_AREA_VVAR"] or -+ vma["status"] & status["VMA_AREA_VSYSCALL"] or -+ vma["status"] & status["VMA_AREA_VDSO"]): - size = vma["end"] - vma["start"] - elif vma["prot"] == 0: - size = 0 -- elif vma["prot"] & prot["PROT_READ"] and \ -- vma["prot"] & prot["PROT_EXEC"]: -+ elif (vma["prot"] & prot["PROT_READ"] and -+ vma["prot"] & prot["PROT_EXEC"]): - size = PAGESIZE -- elif vma["status"] & status["VMA_ANON_SHARED"] or \ -- vma["status"] & status["VMA_FILE_SHARED"] or \ -- vma["status"] & status["VMA_ANON_PRIVATE"] or \ -- vma["status"] & status["VMA_FILE_PRIVATE"]: -+ elif (vma["status"] & status["VMA_ANON_SHARED"] or -+ vma["status"] & status["VMA_FILE_SHARED"] or -+ vma["status"] & status["VMA_ANON_PRIVATE"] or -+ vma["status"] & status["VMA_FILE_PRIVATE"]): - size = vma["end"] - vma["start"] - else: - size = 0 --- -2.35.1 - diff --git a/0018-test-coredump-fix-shellcheck-errors.patch b/0018-test-coredump-fix-shellcheck-errors.patch deleted file mode 100644 index cad1f22..0000000 --- a/0018-test-coredump-fix-shellcheck-errors.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 8fa9bbf2a2d5d5fcc80de865d380af7e7917a371 Mon Sep 17 00:00:00 2001 -From: Radostin Stoyanov -Date: Mon, 6 Sep 2021 00:20:58 +0100 -Subject: [PATCH 018/249] test/coredump: fix shellcheck errors - -ShellCheck reports the following problems: - -SC2086: Double quote to prevent globbing and word splitting. -SC2035: Use ./*glob* or -- *glob* so names with dashes won't become options. -SC1091: Not following: ../env.sh was not specified as input (see shellcheck -x). - -Signed-off-by: Radostin Stoyanov ---- - test/others/criu-coredump/test.sh | 10 +++++++--- - 1 file changed, 7 insertions(+), 3 deletions(-) - -diff --git a/test/others/criu-coredump/test.sh b/test/others/criu-coredump/test.sh -index 62d9f7edc..dd774e298 100755 ---- a/test/others/criu-coredump/test.sh -+++ b/test/others/criu-coredump/test.sh -@@ -1,4 +1,8 @@ --source ../env.sh -+#!/bin/bash -+ -+set -x -+# shellcheck disable=SC1091 -+source ../env.sh || exit 1 - - function gen_imgs { - PID=$(../loop) -@@ -9,7 +13,7 @@ function gen_imgs { - exit 1 - fi - -- images_list=$(ls -1 *.img) -+ images_list=$(ls -1 ./*.img) - if [ -z "$images_list" ]; then - echo "Failed to generate images" - exit 1 -@@ -32,7 +36,7 @@ function run_test { - for x in $cores - do - echo "=== try readelf $x" -- readelf -a $x || exit $? -+ readelf -a "$x" || exit $? - echo "=== done" - done - --- -2.35.1 - diff --git a/0019-make-enable-lint-for-coredump.patch b/0019-make-enable-lint-for-coredump.patch deleted file mode 100644 index 3ee6f3c..0000000 --- a/0019-make-enable-lint-for-coredump.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 7ea1e500fb23ce96dc895c5d59aae5a3728040b0 Mon Sep 17 00:00:00 2001 -From: Radostin Stoyanov -Date: Sun, 5 Sep 2021 22:55:24 +0100 -Subject: [PATCH 019/249] make: enable lint for coredump - -Signed-off-by: Radostin Stoyanov ---- - Makefile | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/Makefile b/Makefile -index 08761efed..1f0dec78b 100644 ---- a/Makefile -+++ b/Makefile -@@ -409,11 +409,13 @@ lint: - flake8 --config=scripts/flake8.cfg test/others/rpc/config_file.py - flake8 --config=scripts/flake8.cfg lib/py/images/pb2dict.py - flake8 --config=scripts/flake8.cfg scripts/criu-ns -+ flake8 --config=scripts/flake8.cfg coredump/ - shellcheck --version - shellcheck scripts/*.sh - shellcheck scripts/ci/*.sh scripts/ci/apt-install - shellcheck test/others/crit/*.sh - shellcheck test/others/libcriu/*.sh -+ shellcheck test/others/crit/*.sh test/others/criu-coredump/*.sh - shellcheck test/others/config-file/*.sh - # Do not append \n to pr_perror or fail - ! git --no-pager grep -E '^\s*\<(pr_perror|fail)\>.*\\n"' --- -2.35.1 - diff --git a/0020-ci-enable-coredump-tests.patch b/0020-ci-enable-coredump-tests.patch deleted file mode 100644 index 90c3af2..0000000 --- a/0020-ci-enable-coredump-tests.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 2b3165ebfecb216a8f07c3d2b7a68723d96f13ff Mon Sep 17 00:00:00 2001 -From: Radostin Stoyanov -Date: Sun, 5 Sep 2021 23:06:56 +0100 -Subject: [PATCH 020/249] ci: enable coredump tests - -Signed-off-by: Radostin Stoyanov ---- - scripts/ci/run-ci-tests.sh | 3 +++ - test/others/env.sh | 2 +- - 2 files changed, 4 insertions(+), 1 deletion(-) - -diff --git a/scripts/ci/run-ci-tests.sh b/scripts/ci/run-ci-tests.sh -index 7c66e6802..51aa7db9e 100755 ---- a/scripts/ci/run-ci-tests.sh -+++ b/scripts/ci/run-ci-tests.sh -@@ -259,6 +259,9 @@ ip net add test - # more crit testing - make -C test/others/crit run - -+# coredump testing -+make -C test/others/criu-coredump run -+ - # libcriu testing - make -C test/others/libcriu run - -diff --git a/test/others/env.sh b/test/others/env.sh -index e2f63eee3..45066f760 100755 ---- a/test/others/env.sh -+++ b/test/others/env.sh -@@ -13,5 +13,5 @@ fi - #export PYTHON - CRIT=$(readlink -f `dirname ${BASH_SOURCE[0]}`/../../crit/crit-"${PYTHON}") - crit=$CRIT --CRIU_COREDUMP=$(readlink -f `dirname ${BASH_SOURCE[0]}`/../../criu-coredump/coredump-"${PYTHON}") -+CRIU_COREDUMP=$(readlink -f `dirname ${BASH_SOURCE[0]}`/../../coredump/coredump-"${PYTHON}") - criu_coredump=$CRIU_COREDUMP --- -2.35.1 - diff --git a/0021-pie-restorer-remove-excess-hash-printf-specifier.patch b/0021-pie-restorer-remove-excess-hash-printf-specifier.patch deleted file mode 100644 index ab350c5..0000000 --- a/0021-pie-restorer-remove-excess-hash-printf-specifier.patch +++ /dev/null @@ -1,39 +0,0 @@ -From fe002c36aa94b8cfde68c12710084be558afec02 Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Thu, 21 Oct 2021 11:47:01 +0300 -Subject: [PATCH 021/249] pie/restorer: remove excess hash printf specifier - -We use here "%#x" printf specifier in pie code, but sbuf_printf core pie -printing function knows nothing about '#' specifier. More over simple -"%x" in pie does same as "%#x" in stdio printf, see print_hex* functions -add "0x" before hex numbers. - -We've got this error on vzt-cpt runs in Virtuozzo: - -(04.750271) pie: 158: Adjust id -Error: Unknown printf format %# - -So to fix it we can just remove '#'. - -Fixes: ecd432fe2 ("timerfd: Implement c/r procedure") -Signed-off-by: Pavel Tikhomirov ---- - criu/pie/restorer.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/criu/pie/restorer.c b/criu/pie/restorer.c -index 4304691bb..0051452e4 100644 ---- a/criu/pie/restorer.c -+++ b/criu/pie/restorer.c -@@ -1013,7 +1013,7 @@ static int timerfd_arm(struct task_restore_args *args) - - t->val.it_value.tv_sec += (time_t)ts.tv_sec; - -- pr_debug("Adjust id %#x it_value(%llu, %llu) -> it_value(%llu, %llu)\n", t->id, -+ pr_debug("Adjust id %x it_value(%llu, %llu) -> it_value(%llu, %llu)\n", t->id, - (unsigned long long)ts.tv_sec, (unsigned long long)ts.tv_nsec, - (unsigned long long)t->val.it_value.tv_sec, - (unsigned long long)t->val.it_value.tv_nsec); --- -2.35.1 - diff --git a/0022-tty-fix-the-null-pointer-of-get_tty_driver.patch b/0022-tty-fix-the-null-pointer-of-get_tty_driver.patch deleted file mode 100644 index 525cf40..0000000 --- a/0022-tty-fix-the-null-pointer-of-get_tty_driver.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 373b1b787c96c4ee795000cb0e190ac5d135e17c Mon Sep 17 00:00:00 2001 -From: "fu.lin" -Date: Fri, 17 Sep 2021 17:16:48 +0800 -Subject: [PATCH 022/249] tty: fix the null pointer of get_tty_driver - -v2: split error checking from index variable initialization -v3: use PRIx64 for printing dev_t - -Signed-off-by: fu.lin -Signed-off-by: Pavel Tikhomirov ---- - criu/tty.c | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/criu/tty.c b/criu/tty.c -index 1598ad956..1462193c5 100644 ---- a/criu/tty.c -+++ b/criu/tty.c -@@ -1977,6 +1977,12 @@ static int dump_one_tty(int lfd, u32 id, const struct fd_parms *p) - pr_info("Dumping tty %d with id %#x\n", lfd, id); - - driver = get_tty_driver(p->stat.st_rdev, p->stat.st_dev); -+ if (driver == NULL) { -+ pr_err("Unable to find a tty driver (rdev %#" PRIx64 " dev %#" PRIx64 ")\n", p->stat.st_rdev, -+ p->stat.st_dev); -+ return -1; -+ } -+ - if (driver->fd_get_index) - index = driver->fd_get_index(lfd, p); - else --- -2.35.1 - diff --git a/0023-util-use-nftw-in-rmrf-helper.patch b/0023-util-use-nftw-in-rmrf-helper.patch deleted file mode 100644 index 585698d..0000000 --- a/0023-util-use-nftw-in-rmrf-helper.patch +++ /dev/null @@ -1,126 +0,0 @@ -From 03cb3026fe42cc66b177e66ab96f27bba4e06ce3 Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Fri, 22 Oct 2021 17:56:37 +0300 -Subject: [PATCH 023/249] util: use nftw in rmrf helper - -This simplifies the code by removing excess recursion and reusing -standard function to walk over file-tree instead of opencoding it. - -This addresses problem mentioned in my review comment: -https://github.com/checkpoint-restore/criu/pull/1495#discussion_r677554523 - -Fixes: 0db135ac4 ("util: add rm -rf function") - -Signed-off-by: Pavel Tikhomirov ---- - criu/apparmor.c | 2 +- - criu/include/util.h | 4 ++-- - criu/util.c | 46 ++++++++++++++------------------------------- - 3 files changed, 17 insertions(+), 35 deletions(-) - -diff --git a/criu/apparmor.c b/criu/apparmor.c -index 328fc606b..f9ad79619 100644 ---- a/criu/apparmor.c -+++ b/criu/apparmor.c -@@ -630,7 +630,7 @@ int suspend_aa(void) - } - - ret = do_suspend(true); -- if (rm_rf(policydir) < 0) -+ if (rmrf(policydir) < 0) - pr_err("failed removing policy dir %s\n", policydir); - - return ret; -diff --git a/criu/include/util.h b/criu/include/util.h -index a2dac2233..19d378fc5 100644 ---- a/criu/include/util.h -+++ b/criu/include/util.h -@@ -284,8 +284,8 @@ int setup_tcp_server(char *type, char *addr, unsigned short *port); - int run_tcp_server(bool daemon_mode, int *ask, int cfd, int sk); - int setup_tcp_client(char *hostname); - --/* *dir should be writable and at least PATH_MAX long */ --int rm_rf(char *dir); -+/* path should be writable and no more than PATH_MAX long */ -+int rmrf(char *path); - - #define LAST_PID_PATH "sys/kernel/ns_last_pid" - #define PID_MAX_PATH "sys/kernel/pid_max" -diff --git a/criu/util.c b/criu/util.c -index 06124c220..414879971 100644 ---- a/criu/util.c -+++ b/criu/util.c -@@ -1,4 +1,4 @@ --#define _XOPEN_SOURCE -+#define _XOPEN_SOURCE 500 - - #include - #include -@@ -26,6 +26,7 @@ - #include - #include - #include -+#include - - #include "linux/mount.h" - -@@ -1613,44 +1614,25 @@ ssize_t write_all(int fd, const void *buf, size_t size) - return n; - } - --int rm_rf(char *target) -+static int remove_one(const char *fpath, const struct stat *sb, int tflag, struct FTW *ftwbuf) - { -- int offset = strlen(target); -- DIR *dir = NULL; -- struct dirent *de; -- int ret = -1; -+ int ret; - -- dir = opendir(target); -- if (!dir) { -- pr_perror("unable to open %s", target); -+ ret = remove(fpath); -+ if (ret) { -+ pr_perror("rmrf: unable to remove %s", fpath); - return -1; - } - -- while ((de = readdir(dir))) { -- int n; -- -- if (dir_dots(de)) -- continue; -- -- n = snprintf(target + offset, PATH_MAX - offset, "/%s", de->d_name); -- if (n < 0 || n >= PATH_MAX) { -- pr_err("snprintf failed\n"); -- goto out; -- } -- -- if (de->d_type == DT_DIR && rm_rf(target)) -- goto out; -+ return 0; -+} - -- if (remove(target) < 0) { -- pr_perror("unable to remove %s", target); -- goto out; -- } -- } -+#define NFTW_FD_MAX 64 - -- ret = 0; --out: -- target[offset] = 0; -- return ret; -+int rmrf(char *path) -+{ -+ pr_debug("rmrf: removing %s\n", path); -+ return nftw(path, remove_one, NFTW_FD_MAX, FTW_DEPTH | FTW_PHYS); - } - - __attribute__((returns_twice)) static pid_t raw_legacy_clone(unsigned long flags, int *pidfd) --- -2.35.1 - diff --git a/0024-criu-ns-make-pidns-init-first-do-setsid.patch b/0024-criu-ns-make-pidns-init-first-do-setsid.patch deleted file mode 100644 index dbd0c94..0000000 --- a/0024-criu-ns-make-pidns-init-first-do-setsid.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 5002b2bedcdeac2e682f7995c9210fe351c6f818 Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Mon, 18 Oct 2021 18:43:14 +0300 -Subject: [PATCH 024/249] criu-ns: make pidns init first do setsid - -We see that on criu-ns dump/restore/dump of the process which initially -was not a session leader (with --shell-job option) we see sid == 0 for -it and fail with something like: - -Error (criu/cr-dump.c:1333): A session leader of 41585(41585) is outside of its pid namespace - -Note: We should not dump processes with sid 0 (even with --shell-job) as -on restore we can can put such processes from multiple sessions into -one, which is wrong. - -Fixes: #232 - -Signed-off-by: Pavel Tikhomirov ---- - scripts/criu-ns | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/scripts/criu-ns b/scripts/criu-ns -index d76db3606..72c0753e5 100755 ---- a/scripts/criu-ns -+++ b/scripts/criu-ns -@@ -102,6 +102,7 @@ def wrap_restore(): - - criu_pid = os.fork() - if criu_pid == 0: -+ os.setsid() - _mount_new_proc() - run_criu(restore_args) - --- -2.35.1 - diff --git a/0025-net-optimize-restore_rule-to-not-open-the-CR_FD_RULE.patch b/0025-net-optimize-restore_rule-to-not-open-the-CR_FD_RULE.patch deleted file mode 100644 index fdfe0d8..0000000 --- a/0025-net-optimize-restore_rule-to-not-open-the-CR_FD_RULE.patch +++ /dev/null @@ -1,113 +0,0 @@ -From 23f4a75c65a08007e8c42aa71ceea4d32cebf9cd Mon Sep 17 00:00:00 2001 -From: Nicolas Viennot -Date: Thu, 28 Oct 2021 21:05:57 +0000 -Subject: [PATCH 025/249] net: optimize restore_rule() to not open the - CR_FD_RULE image file twice - -Previously, `open_image(CR_FD_RULE, O_RSTR, pid)` was called twice. -Opening an image file twice is not allowed when streaming the image. -This commit optimizes the code to only open the image file once. - -Also improved the error path in restore_ip_dump(). - -Signed-off-by: Nicolas Viennot ---- - criu/net.c | 51 ++++++++++++++++++--------------------------------- - 1 file changed, 18 insertions(+), 33 deletions(-) - -diff --git a/criu/net.c b/criu/net.c -index 7b45f0633..02115c4de 100644 ---- a/criu/net.c -+++ b/criu/net.c -@@ -2250,12 +2250,12 @@ static int restore_ip_dump(int type, int pid, char *cmd) - sockfd = img_raw_fd(img); - if (sockfd < 0) { - pr_err("Getting raw FD failed\n"); -- return -1; -+ goto out_image; - } - tmp_file = tmpfile(); - if (!tmp_file) { - pr_perror("Failed to open tmpfile"); -- return -1; -+ goto out_image; - } - - while ((n = read(sockfd, buf, 1024)) > 0) { -@@ -2264,25 +2264,34 @@ static int restore_ip_dump(int type, int pid, char *cmd) - pr_perror("Failed to write to tmpfile " - "[written: %d; total: %d]", - written, n); -- goto close; -+ goto out_tmp_file; - } - } - - if (fseek(tmp_file, 0, SEEK_SET)) { - pr_perror("Failed to set file position to beginning of tmpfile"); -- goto close; -+ goto out_tmp_file; - } - -- if (img) { -- ret = run_ip_tool(cmd, "restore", NULL, NULL, fileno(tmp_file), -1, 0); -- close_image(img); -+ if (type == CR_FD_RULE) { -+ /* -+ * Delete 3 default rules to prevent duplicates. See kernel's -+ * function fib_default_rules_init() for the details. -+ */ -+ run_ip_tool("rule", "flush", NULL, NULL, -1, -1, 0); -+ run_ip_tool("rule", "delete", "table", "local", -1, -1, 0); - } - --close: -+ ret = run_ip_tool(cmd, "restore", NULL, NULL, fileno(tmp_file), -1, 0); -+ -+out_tmp_file: - if (fclose(tmp_file)) { - pr_perror("Failed to close tmpfile"); - } - -+out_image: -+ close_image(img); -+ - return ret; - } - -@@ -2304,31 +2313,7 @@ static inline int restore_route(int pid) - - static inline int restore_rule(int pid) - { -- struct cr_img *img; -- int ret = 0; -- -- img = open_image(CR_FD_RULE, O_RSTR, pid); -- if (!img) { -- ret = -1; -- goto out; -- } -- -- if (empty_image(img)) -- goto close; -- -- /* -- * Delete 3 default rules to prevent duplicates. See kernel's -- * function fib_default_rules_init() for the details. -- */ -- run_ip_tool("rule", "flush", NULL, NULL, -1, -1, 0); -- run_ip_tool("rule", "delete", "table", "local", -1, -1, 0); -- -- if (restore_ip_dump(CR_FD_RULE, pid, "rule")) -- ret = -1; --close: -- close_image(img); --out: -- return ret; -+ return restore_ip_dump(CR_FD_RULE, pid, "rule"); - } - - /* --- -2.35.1 - diff --git a/0026-ci-replace-deprecated-codecov-bash-uploader.patch b/0026-ci-replace-deprecated-codecov-bash-uploader.patch deleted file mode 100644 index 18418fe..0000000 --- a/0026-ci-replace-deprecated-codecov-bash-uploader.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 3920fd02a3494c5888083967a3054d8569866b4a Mon Sep 17 00:00:00 2001 -From: Adrian Reber -Date: Wed, 27 Oct 2021 07:27:22 +0000 -Subject: [PATCH 026/249] ci: replace deprecated codecov bash uploader - -Replace deprecated codecov bash uploader with new version: - -https://about.codecov.io/blog/introducing-codecovs-new-uploader/ - -Signed-off-by: Adrian Reber ---- - .github/workflows/gcov-test.yml | 2 ++ - Makefile | 4 +++- - 2 files changed, 5 insertions(+), 1 deletion(-) - -diff --git a/.github/workflows/gcov-test.yml b/.github/workflows/gcov-test.yml -index f1b38e77e..f782c5b9d 100644 ---- a/.github/workflows/gcov-test.yml -+++ b/.github/workflows/gcov-test.yml -@@ -10,5 +10,7 @@ jobs: - - uses: actions/checkout@v2 - - name: Run Coverage Tests - run: sudo -E make -C scripts/ci local GCOV=1 -+ - name: Run gcov -+ run: sudo -E find . -name '*gcda' -type f -print0 | sudo -E xargs --null --max-args 128 --max-procs 4 gcov - - name: Run Coverage Analysis - run: sudo -E make codecov -diff --git a/Makefile b/Makefile -index 1f0dec78b..c0b8b7e54 100644 ---- a/Makefile -+++ b/Makefile -@@ -431,7 +431,9 @@ lint: - - codecov: SHELL := $(shell which bash) - codecov: -- bash <(curl -s https://codecov.io/bash) -+ curl -Os https://uploader.codecov.io/latest/linux/codecov -+ chmod +x codecov -+ ./codecov - .PHONY: codecov - - fetch-clang-format: .FORCE --- -2.35.1 - diff --git a/0027-ci-fix-userfaultfd-test-failures.patch b/0027-ci-fix-userfaultfd-test-failures.patch deleted file mode 100644 index 50e4024..0000000 --- a/0027-ci-fix-userfaultfd-test-failures.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 9dcf2c5116dcdac8b5ef99bf995cf5cfe6424c92 Mon Sep 17 00:00:00 2001 -From: Adrian Reber -Date: Thu, 4 Nov 2021 09:10:38 +0000 -Subject: [PATCH 027/249] ci: fix userfaultfd test failures - -Newer kernels (5.11) require echo 1 > /proc/sys/vm/unprivileged_userfaultfd - -Without the 'echo 1' the kernel prints a message like this: - - uffd: Set unprivileged_userfaultfd sysctl knob to 1 if kernel faults must be handled without obtaining CAP_SYS_PTRACE capability - -Signed-off-by: Adrian Reber ---- - scripts/ci/run-ci-tests.sh | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/scripts/ci/run-ci-tests.sh b/scripts/ci/run-ci-tests.sh -index 51aa7db9e..096f907fb 100755 ---- a/scripts/ci/run-ci-tests.sh -+++ b/scripts/ci/run-ci-tests.sh -@@ -197,6 +197,12 @@ fi - # shellcheck disable=SC2086 - ./test/zdtm.py run -a -p 2 --keep-going $ZDTM_OPTS - -+# Newer kernels are blocking access to userfaultfd: -+# uffd: Set unprivileged_userfaultfd sysctl knob to 1 if kernel faults must be handled without obtaining CAP_SYS_PTRACE capability -+if [ -e /proc/sys/vm/unprivileged_userfaultfd ]; then -+ echo 1 > /proc/sys/vm/unprivileged_userfaultfd -+fi -+ - LAZY_EXCLUDE="-x maps04 -x cmdlinenv00 -x maps007" - - LAZY_TESTS='.*(maps0|uffd-events|lazy-thp|futex|fork).*' --- -2.35.1 - diff --git a/0028-ci-use-Fedora-34-for-lint-CI-runs.patch b/0028-ci-use-Fedora-34-for-lint-CI-runs.patch deleted file mode 100644 index c908f78..0000000 --- a/0028-ci-use-Fedora-34-for-lint-CI-runs.patch +++ /dev/null @@ -1,29 +0,0 @@ -From fa1ec35f42dd652ff57a9c816b11359eae38ddcf Mon Sep 17 00:00:00 2001 -From: Adrian Reber -Date: Thu, 4 Nov 2021 09:18:31 +0000 -Subject: [PATCH 028/249] ci: use Fedora 34 for lint CI runs - -Fedora 35 comes with clang 13 which provides different results for -clang-format than clang 12 in Fedora 34. - -Signed-off-by: Adrian Reber ---- - .github/workflows/lint.yml | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml -index 50b241e9f..49eb6aaac 100644 ---- a/.github/workflows/lint.yml -+++ b/.github/workflows/lint.yml -@@ -6,7 +6,7 @@ jobs: - build: - runs-on: ubuntu-latest - container: -- image: registry.fedoraproject.org/fedora:latest -+ image: registry.fedoraproject.org/fedora:34 - steps: - - name: Install tools - run: sudo dnf -y install git make python3-flake8 ShellCheck clang-tools-extra which findutils --- -2.35.1 - diff --git a/0029-tests-improve-the-image-streamer-process-control.patch b/0029-tests-improve-the-image-streamer-process-control.patch deleted file mode 100644 index 3380c0e..0000000 --- a/0029-tests-improve-the-image-streamer-process-control.patch +++ /dev/null @@ -1,145 +0,0 @@ -From ff5beb22edc05bad44a1e6aecc4433212c991ed6 Mon Sep 17 00:00:00 2001 -From: Nicolas Viennot -Date: Fri, 29 Oct 2021 02:49:31 +0000 -Subject: [PATCH 029/249] tests: improve the image streamer process control - -When exceptions are raised during testing, the image streamer process -should be terminated as opposed to being left hanging. -This could lead to the whole test suite to be left hanging as it waits -for all child processes to exit. - -Signed-off-by: Nicolas Viennot ---- - test/zdtm.py | 44 ++++++++++++++++++++++++++++++++++---------- - 1 file changed, 34 insertions(+), 10 deletions(-) - -diff --git a/test/zdtm.py b/test/zdtm.py -index 0a52e1b96..fc7b8a183 100755 ---- a/test/zdtm.py -+++ b/test/zdtm.py -@@ -1039,6 +1039,7 @@ class criu: - self.__lazy_pages_p = None - self.__page_server_p = None - self.__dump_process = None -+ self.__img_streamer_process = None - self.__tls = self.__tls_options() if opts['tls'] else [] - self.__criu_bin = opts['criu_bin'] - self.__crit_bin = opts['crit_bin'] -@@ -1065,6 +1066,11 @@ class criu: - self.__dump_process = None - if ret: - raise test_fail_exc("criu dump exited with %s" % ret) -+ if self.__img_streamer_process: -+ ret = self.wait_for_criu_image_streamer() -+ if ret: -+ raise test_fail_exc("criu-image-streamer exited with %s" % ret) -+ - return - - def logs(self): -@@ -1219,8 +1225,10 @@ class criu: - stent['pages_written']) - - if self.__stream: -- p = self.spawn_criu_image_streamer("extract") -- p.wait() -+ self.spawn_criu_image_streamer("extract") -+ ret = self.wait_for_criu_image_streamer() -+ if ret: -+ raise test_fail_exc("criu-image-streamer (extract) exited with %s" % ret) - - real_written = 0 - for f in os.listdir(self.__ddir()): -@@ -1262,6 +1270,8 @@ class criu: - "--progress-fd {progress_fd}", - action] - -+ log = open(os.path.join(self.__ddir(), "img-streamer.log"), "w") -+ - # * As we are using a shell pipe command, we want to use pipefail. - # Otherwise, failures stay unnoticed. For this, we use bash as sh - # doesn't support that feature. -@@ -1270,7 +1280,9 @@ class criu: - progress_fd=progress_w, - images_dir=self.__ddir(), - img_file=os.path.join(self.__ddir(), STREAMED_IMG_FILE_NAME) -- )], close_fds=False) -+ )], stderr=log, close_fds=False) -+ -+ log.close() - - os.close(progress_w) - progress = os.fdopen(progress_r, "r") -@@ -1287,7 +1299,15 @@ class criu: - raise test_fail_exc( - "criu-image-streamer is not starting (exit_code=%d)" % p.wait()) - -- return p -+ progress.close() -+ -+ self.__img_streamer_process = p -+ -+ def wait_for_criu_image_streamer(self): -+ ret = self.__img_streamer_process.wait() -+ grep_errors(os.path.join(self.__ddir(), "img-streamer.log")) -+ self.__img_streamer_process = None -+ return ret - - def dump(self, action, opts=[]): - self.__iter += 1 -@@ -1319,7 +1339,7 @@ class criu: - a_opts += self.__test.getdopts() - - if self.__stream: -- streamer_p = self.spawn_criu_image_streamer("capture") -+ self.spawn_criu_image_streamer("capture") - a_opts += ["--stream"] - - if self.__dedup: -@@ -1347,9 +1367,9 @@ class criu: - opts=a_opts + opts, - nowait=nowait) - if self.__stream: -- ret = streamer_p.wait() -+ ret = self.wait_for_criu_image_streamer() - if ret: -- raise test_fail_exc("criu-image-streamer exited with %d" % ret) -+ raise test_fail_exc("criu-image-streamer (capture) exited with %d" % ret) - - if self.__mdedup and self.__iter > 1: - self.__criu_act("dedup", opts=[]) -@@ -1382,7 +1402,7 @@ class criu: - r_opts += ['--action-script', os.getcwd() + '/empty-netns-prep.sh'] - - if self.__stream: -- streamer_p = self.spawn_criu_image_streamer("serve") -+ self.spawn_criu_image_streamer("serve") - r_opts += ["--stream"] - - if self.__dedup: -@@ -1419,9 +1439,9 @@ class criu: - - self.__criu_act("restore", opts=r_opts + ["--restore-detached"]) - if self.__stream: -- ret = streamer_p.wait() -+ ret = self.wait_for_criu_image_streamer() - if ret: -- raise test_fail_exc("criu-image-streamer exited with %d" % ret) -+ raise test_fail_exc("criu-image-streamer (serve) exited with %d" % ret) - - self.show_stats("restore") - -@@ -1466,6 +1486,10 @@ class criu: - print("criu dump exited with %s" % self.__dump_process.wait()) - grep_errors(os.path.join(self.__ddir(), "dump.log")) - self.__dump_process = None -+ if self.__img_streamer_process: -+ self.__img_streamer_process.terminate() -+ ret = self.wait_for_criu_image_streamer() -+ print("criu-image-streamer exited with %s" % ret) - - - def try_run_hook(test, args): --- -2.35.1 - diff --git a/0030-sockets-don-t-call-sk_setbufs-asyncronously.patch b/0030-sockets-don-t-call-sk_setbufs-asyncronously.patch deleted file mode 100644 index d3df87a..0000000 --- a/0030-sockets-don-t-call-sk_setbufs-asyncronously.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 36869e72971182f0e738edb7174a4505dcc5380c Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Thu, 29 Jul 2021 14:21:37 +0300 -Subject: [PATCH 030/249] sockets: don't call sk_setbufs asyncronously - -We want to also c/r socket buf locks (SO_BUF_LOCKS) which are also -implicitly set by setsockopt(SO_{SND,RCV}BUF*), so we need to order -these two properly. That's why we need to wait for sk_setbufs to finish. -And there is no much point in seting buffer sizes asyncronously anyway. - -Reviewed-by: Alexander Mikhalitsyn -Signed-off-by: Pavel Tikhomirov ---- - criu/sockets.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/criu/sockets.c b/criu/sockets.c -index 9426b5b94..65aa82950 100644 ---- a/criu/sockets.c -+++ b/criu/sockets.c -@@ -517,7 +517,7 @@ int restore_socket_opts(int sk, SkOptsEntry *soe) - pr_info("%d restore sndbuf %d rcv buf %d\n", sk, soe->so_sndbuf, soe->so_rcvbuf); - - /* setsockopt() multiplies the input values by 2 */ -- ret |= userns_call(sk_setbufs, UNS_ASYNC, bufs, sizeof(bufs), sk); -+ ret |= userns_call(sk_setbufs, 0, bufs, sizeof(bufs), sk); - - if (soe->has_so_priority) { - pr_debug("\trestore priority %d for socket\n", soe->so_priority); --- -2.35.1 - diff --git a/0031-kerndat-check-for-set-getsockopt-SO_BUF_LOCK-availab.patch b/0031-kerndat-check-for-set-getsockopt-SO_BUF_LOCK-availab.patch deleted file mode 100644 index 96b5132..0000000 --- a/0031-kerndat-check-for-set-getsockopt-SO_BUF_LOCK-availab.patch +++ /dev/null @@ -1,132 +0,0 @@ -From f00d0d2c8cca8217eaaccf08605192cc3f12503b Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Thu, 29 Jul 2021 14:57:17 +0300 -Subject: [PATCH 031/249] kerndat: check for set/getsockopt SO_BUF_LOCK - availability - -This is a new kernel feature to let criu restore sockets with kernel -auto-adjusted buffer sizes. - -Reviewed-by: Alexander Mikhalitsyn -Signed-off-by: Pavel Tikhomirov ---- - criu/cr-check.c | 10 ++++++++++ - criu/include/kerndat.h | 1 + - criu/include/sockets.h | 4 ++++ - criu/kerndat.c | 33 +++++++++++++++++++++++++++++++++ - 4 files changed, 48 insertions(+) - -diff --git a/criu/cr-check.c b/criu/cr-check.c -index 3575fb3b3..3e268c439 100644 ---- a/criu/cr-check.c -+++ b/criu/cr-check.c -@@ -1372,6 +1372,14 @@ static int check_network_lock_nftables(void) - return 0; - } - -+static int check_sockopt_buf_lock(void) -+{ -+ if (!kdat.has_sockopt_buf_lock) -+ return -1; -+ -+ return 0; -+} -+ - static int (*chk_feature)(void); - - /* -@@ -1490,6 +1498,7 @@ int cr_check(void) - ret |= check_ns_pid(); - ret |= check_apparmor_stacking(); - ret |= check_network_lock_nftables(); -+ ret |= check_sockopt_buf_lock(); - } - - /* -@@ -1602,6 +1611,7 @@ static struct feature_list feature_list[] = { - { "ns_pid", check_ns_pid }, - { "apparmor_stacking", check_apparmor_stacking }, - { "network_lock_nftables", check_network_lock_nftables }, -+ { "sockopt_buf_lock", check_sockopt_buf_lock }, - { NULL, NULL }, - }; - -diff --git a/criu/include/kerndat.h b/criu/include/kerndat.h -index 80bad7f11..2ded7d1da 100644 ---- a/criu/include/kerndat.h -+++ b/criu/include/kerndat.h -@@ -74,6 +74,7 @@ struct kerndat_s { - bool has_pidfd_getfd; - bool has_nspid; - bool has_nftables_concat; -+ bool has_sockopt_buf_lock; - }; - - extern struct kerndat_s kdat; -diff --git a/criu/include/sockets.h b/criu/include/sockets.h -index 3e8f3d601..399d38664 100644 ---- a/criu/include/sockets.h -+++ b/criu/include/sockets.h -@@ -123,4 +123,8 @@ extern const char *socket_proto_name(unsigned int proto, char *nm, size_t size); - #define ___socket_family_name(family) __socket_info_helper(socket_family_name, family) - #define ___socket_proto_name(proto) __socket_info_helper(socket_proto_name, proto) - -+#ifndef SO_BUF_LOCK -+#define SO_BUF_LOCK 72 -+#endif -+ - #endif /* __CR_SOCKETS_H__ */ -diff --git a/criu/kerndat.c b/criu/kerndat.c -index 0e88ba43e..9f6a6ec42 100644 ---- a/criu/kerndat.c -+++ b/criu/kerndat.c -@@ -816,6 +816,35 @@ static int kerndat_x86_has_ptrace_fpu_xsave_bug(void) - return 0; - } - -+int kerndat_sockopt_buf_lock(void) -+{ -+ int exit_code = -1; -+ socklen_t len; -+ u32 buf_lock; -+ int sock; -+ -+ sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); -+ if (sock < 0) { -+ pr_perror("Unable to create a socket"); -+ return -1; -+ } -+ -+ len = sizeof(buf_lock); -+ if (getsockopt(sock, SOL_SOCKET, SO_BUF_LOCK, &buf_lock, &len)) { -+ if (errno != ENOPROTOOPT) { -+ pr_perror("Unable to get SO_BUF_LOCK with getsockopt"); -+ goto err; -+ } -+ kdat.has_sockopt_buf_lock = false; -+ } else -+ kdat.has_sockopt_buf_lock = true; -+ -+ exit_code = 0; -+err: -+ close(sock); -+ return exit_code; -+} -+ - #define KERNDAT_CACHE_FILE KDAT_RUNDIR "/criu.kdat" - #define KERNDAT_CACHE_FILE_TMP KDAT_RUNDIR "/.criu.kdat" - -@@ -1359,6 +1388,10 @@ int kerndat_init(void) - pr_err("kerndat_has_nftables_concat failed when initializing kerndat.\n"); - ret = -1; - } -+ if (!ret && kerndat_sockopt_buf_lock()) { -+ pr_err("kerndat_sockopt_buf_lock failed when initializing kerndat.\n"); -+ ret = -1; -+ } - - kerndat_lsm(); - kerndat_mmap_min_addr(); --- -2.35.1 - diff --git a/0032-sockets-c-r-bufer-size-locks.patch b/0032-sockets-c-r-bufer-size-locks.patch deleted file mode 100644 index 20531ab..0000000 --- a/0032-sockets-c-r-bufer-size-locks.patch +++ /dev/null @@ -1,69 +0,0 @@ -From 4bad0745c28810a2d2bb724b5d13b70d07545ae4 Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Thu, 29 Jul 2021 11:27:13 +0300 -Subject: [PATCH 032/249] sockets: c/r bufer size locks - -When one sets socket buffer sizes with setsockopt(SO_{SND,RCV}BUF*), -kernel sets coresponding SOCK_SNDBUF_LOCK or SOCK_RCVBUF_LOCK flags on -struct sock. It means that such a socket with explicitly changed buffer -size can not be auto-adjusted by kernel (e.g. if there is free memory -kernel can auto-increase default socket buffers to improve perfomance). -(see tcp_fixup_rcvbuf() and tcp_sndbuf_expand()) - -CRIU is always changing buf sizes on restore, that means that all -sockets receive lock flags on struct sock and become non-auto-adjusted -after migration. In some cases it can decrease perfomance of network -connections quite a lot. - -So let's c/r socket buf locks (SO_BUF_LOCKS), so that sockets for which -auto-adjustment is available does not lose it. - -Reviewed-by: Alexander Mikhalitsyn -Signed-off-by: Pavel Tikhomirov ---- - criu/sockets.c | 8 ++++++++ - images/sk-opts.proto | 2 ++ - 2 files changed, 10 insertions(+) - -diff --git a/criu/sockets.c b/criu/sockets.c -index 65aa82950..db772707b 100644 ---- a/criu/sockets.c -+++ b/criu/sockets.c -@@ -519,6 +519,10 @@ int restore_socket_opts(int sk, SkOptsEntry *soe) - /* setsockopt() multiplies the input values by 2 */ - ret |= userns_call(sk_setbufs, 0, bufs, sizeof(bufs), sk); - -+ if (soe->has_so_buf_lock) { -+ pr_debug("\trestore buf_lock %d for socket\n", soe->so_buf_lock); -+ ret |= restore_opt(sk, SOL_SOCKET, SO_BUF_LOCK, &soe->so_buf_lock); -+ } - if (soe->has_so_priority) { - pr_debug("\trestore priority %d for socket\n", soe->so_priority); - ret |= restore_opt(sk, SOL_SOCKET, SO_PRIORITY, &soe->so_priority); -@@ -619,6 +623,10 @@ int dump_socket_opts(int sk, SkOptsEntry *soe) - - ret |= dump_opt(sk, SOL_SOCKET, SO_SNDBUF, &soe->so_sndbuf); - ret |= dump_opt(sk, SOL_SOCKET, SO_RCVBUF, &soe->so_rcvbuf); -+ if (kdat.has_sockopt_buf_lock) { -+ soe->has_so_buf_lock = true; -+ ret |= dump_opt(sk, SOL_SOCKET, SO_BUF_LOCK, &soe->so_buf_lock); -+ } - soe->has_so_priority = true; - ret |= dump_opt(sk, SOL_SOCKET, SO_PRIORITY, &soe->so_priority); - soe->has_so_rcvlowat = true; -diff --git a/images/sk-opts.proto b/images/sk-opts.proto -index 2377f6b62..1d24d47cc 100644 ---- a/images/sk-opts.proto -+++ b/images/sk-opts.proto -@@ -31,6 +31,8 @@ message sk_opts_entry { - optional uint32 tcp_keepintvl = 22; - optional uint32 so_oobinline = 23; - optional uint32 so_linger = 24; -+ -+ optional uint32 so_buf_lock = 25; - } - - enum sk_shutdown { --- -2.35.1 - diff --git a/0033-zdtm-add-test-for-socket-buffer-size-locks.patch b/0033-zdtm-add-test-for-socket-buffer-size-locks.patch deleted file mode 100644 index 4c62ead..0000000 --- a/0033-zdtm-add-test-for-socket-buffer-size-locks.patch +++ /dev/null @@ -1,118 +0,0 @@ -From e32a58fcc35b57d6cbc81214e7c4d8f8539dbc5a Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Thu, 29 Jul 2021 16:16:12 +0300 -Subject: [PATCH 033/249] zdtm: add test for socket buffer size locks - -Just set all possible values 0-3 and chack if it persists. - -Reviewed-by: Alexander Mikhalitsyn -Signed-off-by: Pavel Tikhomirov ---- - test/zdtm/static/Makefile | 1 + - test/zdtm/static/sock_opts02.c | 73 +++++++++++++++++++++++++++++++ - test/zdtm/static/sock_opts02.desc | 1 + - 3 files changed, 75 insertions(+) - create mode 100644 test/zdtm/static/sock_opts02.c - create mode 100644 test/zdtm/static/sock_opts02.desc - -diff --git a/test/zdtm/static/Makefile b/test/zdtm/static/Makefile -index b6aa621c7..3e1e0a498 100644 ---- a/test/zdtm/static/Makefile -+++ b/test/zdtm/static/Makefile -@@ -117,6 +117,7 @@ TST_NOFILE := \ - socket-linger \ - sock_opts00 \ - sock_opts01 \ -+ sock_opts02 \ - sk-unix-unconn \ - ipc_namespace \ - selfexe00 \ -diff --git a/test/zdtm/static/sock_opts02.c b/test/zdtm/static/sock_opts02.c -new file mode 100644 -index 000000000..21a81a28f ---- /dev/null -+++ b/test/zdtm/static/sock_opts02.c -@@ -0,0 +1,73 @@ -+#include -+#include -+#include -+#include -+#include -+ -+#include "zdtmtst.h" -+ -+const char *test_doc = "Check that SO_BUF_LOCK option dumped"; -+const char *test_author = "Pavel Tikhomirov "; -+ -+#ifndef SO_BUF_LOCK -+#define SO_BUF_LOCK 72 -+#endif -+ -+#define NSOCK 4 -+ -+int main(int argc, char **argv) -+{ -+ int sock[NSOCK]; -+ uint32_t val[NSOCK]; -+ int ret, i; -+ int exit_code = 1; -+ -+ test_init(argc, argv); -+ -+ for (i = 0; i < NSOCK; i++) { -+ sock[i] = -1; -+ val[i] = i; -+ } -+ -+ for (i = 0; i < NSOCK; i++) { -+ sock[i] = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP); -+ if (sock[i] < 0) { -+ pr_perror("can't create socket %d", i); -+ goto err; -+ } -+ -+ ret = setsockopt(sock[i], SOL_SOCKET, SO_BUF_LOCK, &val[i], sizeof(val[i])); -+ if (ret < 0) { -+ pr_perror("can't set SO_BUF_LOCK (%u) on socket %d", val[i], i); -+ goto err; -+ } -+ } -+ -+ test_daemon(); -+ test_waitsig(); -+ -+ for (i = 0; i < NSOCK; i++) { -+ uint32_t tmp; -+ socklen_t len; -+ -+ len = sizeof(tmp); -+ ret = getsockopt(sock[i], SOL_SOCKET, SO_BUF_LOCK, &tmp, &len); -+ if (ret < 0) { -+ pr_perror("can't get SO_BUF_LOCK from socket %d", i); -+ goto err; -+ } -+ -+ if (tmp != val[i]) { -+ fail("SO_BUF_LOCK missmatch %u != %u", tmp, val[i]); -+ goto err; -+ } -+ } -+ -+ pass(); -+ exit_code = 0; -+err: -+ for (i = 0; i < NSOCK; i++) -+ close(sock[i]); -+ -+ return exit_code; -+} -diff --git a/test/zdtm/static/sock_opts02.desc b/test/zdtm/static/sock_opts02.desc -new file mode 100644 -index 000000000..37d3a6354 ---- /dev/null -+++ b/test/zdtm/static/sock_opts02.desc -@@ -0,0 +1 @@ -+{'flags': 'suid', 'feature': 'sockopt_buf_lock'} --- -2.35.1 - diff --git a/0034-zdtm-make-sock_opts02-also-check-lock-change-by-SO_-.patch b/0034-zdtm-make-sock_opts02-also-check-lock-change-by-SO_-.patch deleted file mode 100644 index a668131..0000000 --- a/0034-zdtm-make-sock_opts02-also-check-lock-change-by-SO_-.patch +++ /dev/null @@ -1,115 +0,0 @@ -From 46b0f54fe43b128e4949b2522450b519d20a5fc4 Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Tue, 3 Aug 2021 13:05:32 +0300 -Subject: [PATCH 034/249] zdtm: make sock_opts02 also check lock change by - SO_*BUF* - -Reviewed-by: Alexander Mikhalitsyn -Signed-off-by: Pavel Tikhomirov ---- - test/zdtm/static/sock_opts02.c | 63 +++++++++++++++++++++++++++++----- - 1 file changed, 54 insertions(+), 9 deletions(-) - -diff --git a/test/zdtm/static/sock_opts02.c b/test/zdtm/static/sock_opts02.c -index 21a81a28f..7ea98744a 100644 ---- a/test/zdtm/static/sock_opts02.c -+++ b/test/zdtm/static/sock_opts02.c -@@ -13,32 +13,77 @@ const char *test_author = "Pavel Tikhomirov "; - #define SO_BUF_LOCK 72 - #endif - --#define NSOCK 4 -+#ifndef SOCK_SNDBUF_LOCK -+#define SOCK_SNDBUF_LOCK 1 -+#endif -+#ifndef SOCK_RCVBUF_LOCK -+#define SOCK_RCVBUF_LOCK 2 -+#endif -+ -+#define BUFSIZE 16384 -+ -+struct sk_opt { -+ int type; -+ uint32_t val; -+ uint32_t lock; -+} sk_opts[] = { { SO_BUF_LOCK, 0, 0 }, -+ { SO_BUF_LOCK, SOCK_SNDBUF_LOCK, SOCK_SNDBUF_LOCK }, -+ { SO_BUF_LOCK, SOCK_RCVBUF_LOCK, SOCK_RCVBUF_LOCK }, -+ { SO_BUF_LOCK, SOCK_SNDBUF_LOCK | SOCK_RCVBUF_LOCK, SOCK_SNDBUF_LOCK | SOCK_RCVBUF_LOCK }, -+ { SO_SNDBUF, BUFSIZE, SOCK_SNDBUF_LOCK }, -+ { SO_RCVBUF, BUFSIZE, SOCK_RCVBUF_LOCK } }; -+ -+#define NSOCK ARRAY_SIZE(sk_opts) -+ -+char *type_to_str(int type) -+{ -+ switch (type) { -+ case SO_BUF_LOCK: -+ return "SO_BUF_LOCK"; -+ case SO_SNDBUFFORCE: -+ return "SO_SNDBUFFORCE"; -+ case SO_RCVBUFFORCE: -+ return "SO_RCVBUFFORCE"; -+ } -+ return NULL; -+} - - int main(int argc, char **argv) - { - int sock[NSOCK]; -- uint32_t val[NSOCK]; - int ret, i; - int exit_code = 1; - - test_init(argc, argv); - -- for (i = 0; i < NSOCK; i++) { -+ for (i = 0; i < NSOCK; i++) - sock[i] = -1; -- val[i] = i; -- } - - for (i = 0; i < NSOCK; i++) { -+ uint32_t tmp; -+ socklen_t len; -+ - sock[i] = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP); - if (sock[i] < 0) { - pr_perror("can't create socket %d", i); - goto err; - } - -- ret = setsockopt(sock[i], SOL_SOCKET, SO_BUF_LOCK, &val[i], sizeof(val[i])); -+ ret = setsockopt(sock[i], SOL_SOCKET, sk_opts[i].type, &sk_opts[i].val, sizeof(sk_opts[i].val)); -+ if (ret < 0) { -+ pr_perror("can't set %s (%u) on socket %d", type_to_str(sk_opts[i].type), sk_opts[i].val, i); -+ goto err; -+ } -+ -+ len = sizeof(tmp); -+ ret = getsockopt(sock[i], SOL_SOCKET, SO_BUF_LOCK, &tmp, &len); - if (ret < 0) { -- pr_perror("can't set SO_BUF_LOCK (%u) on socket %d", val[i], i); -+ pr_perror("can't get SO_BUF_LOCK from socket %d", i); -+ goto err; -+ } -+ -+ if (tmp != sk_opts[i].lock) { -+ fail("SO_BUF_LOCK missmatch %u != %u", tmp, sk_opts[i].lock); - goto err; - } - } -@@ -57,8 +102,8 @@ int main(int argc, char **argv) - goto err; - } - -- if (tmp != val[i]) { -- fail("SO_BUF_LOCK missmatch %u != %u", tmp, val[i]); -+ if (tmp != sk_opts[i].lock) { -+ fail("SO_BUF_LOCK missmatch %u != %u", tmp, sk_opts[i].lock); - goto err; - } - } --- -2.35.1 - diff --git a/0035-clang-format-enable-AlignTrailingComments.patch b/0035-clang-format-enable-AlignTrailingComments.patch deleted file mode 100644 index c816ad2..0000000 --- a/0035-clang-format-enable-AlignTrailingComments.patch +++ /dev/null @@ -1,173 +0,0 @@ -From ff3ff3b94a45d6907e0d3c6fb850cf3d729ce252 Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Thu, 28 Oct 2021 17:15:52 +0300 -Subject: [PATCH 035/249] clang-format: enable AlignTrailingComments - -Code becomes much more human-readable after enabling it. - -Example 1: - -Before: -``` -struct file_desc { - u32 id; /* File id, unique */ - struct hlist_node hash; /* Descriptor hashing and lookup */ - struct list_head fd_info_head; /* Chain of fdinfo_list_entry-s with same ID and type but different pids */ - struct file_desc_ops *ops; /* Associated operations */ - struct list_head fake_master_list; /* To chain in the list of file_desc, which don't - have a fle in a task, that having permissions */ -}; -``` -After: -``` -struct file_desc { - u32 id; /* File id, unique */ - struct hlist_node hash; /* Descriptor hashing and lookup */ - struct list_head fd_info_head; /* Chain of fdinfo_list_entry-s with same ID and type but different pids */ - struct file_desc_ops *ops; /* Associated operations */ - struct list_head fake_master_list; /* To chain in the list of file_desc, which don't - * have a fle in a task, that having permissions */ -}; -``` - -Example 2: - -Before: -``` -enum fsconfig_command { - FSCONFIG_SET_FLAG = 0, /* Set parameter, supplying no value */ - FSCONFIG_SET_STRING = 1, /* Set parameter, supplying a string value */ - FSCONFIG_SET_BINARY = 2, /* Set parameter, supplying a binary blob value */ - FSCONFIG_SET_PATH = 3, /* Set parameter, supplying an object by path */ - FSCONFIG_SET_PATH_EMPTY = 4, /* Set parameter, supplying an object by (empty) path */ - FSCONFIG_SET_FD = 5, /* Set parameter, supplying an object by fd */ - FSCONFIG_CMD_CREATE = 6, /* Invoke superblock creation */ - FSCONFIG_CMD_RECONFIGURE = 7, /* Invoke superblock reconfiguration */ -}; -``` -After: -``` -enum fsconfig_command { - FSCONFIG_SET_FLAG = 0, /* Set parameter, supplying no value */ - FSCONFIG_SET_STRING = 1, /* Set parameter, supplying a string value */ - FSCONFIG_SET_BINARY = 2, /* Set parameter, supplying a binary blob value */ - FSCONFIG_SET_PATH = 3, /* Set parameter, supplying an object by path */ - FSCONFIG_SET_PATH_EMPTY = 4, /* Set parameter, supplying an object by (empty) path */ - FSCONFIG_SET_FD = 5, /* Set parameter, supplying an object by fd */ - FSCONFIG_CMD_CREATE = 6, /* Invoke superblock creation */ - FSCONFIG_CMD_RECONFIGURE = 7, /* Invoke superblock reconfiguration */ -}; -``` - -Example 3: - -Before: -``` - ret = libnet_build_tcp(ntohs(sk->dst_addr->v4.sin_port), /* source port */ - ntohs(sk->src_addr->v4.sin_port), /* destination port */ - data->inq_seq, /* sequence number */ - data->outq_seq - data->outq_len, /* acknowledgement num */ - flags, /* control flags */ - data->rcv_wnd, /* window size */ - 0, /* checksum */ - 10, /* urgent pointer */ - LIBNET_TCP_H + 20, /* TCP packet size */ - NULL, /* payload */ - 0, /* payload size */ - l, /* libnet handle */ - 0); /* libnet id */ -``` -After: -``` - ret = libnet_build_tcp(ntohs(sk->dst_addr->v4.sin_port), /* source port */ - ntohs(sk->src_addr->v4.sin_port), /* destination port */ - data->inq_seq, /* sequence number */ - data->outq_seq - data->outq_len, /* acknowledgement num */ - flags, /* control flags */ - data->rcv_wnd, /* window size */ - 0, /* checksum */ - 10, /* urgent pointer */ - LIBNET_TCP_H + 20, /* TCP packet size */ - NULL, /* payload */ - 0, /* payload size */ - l, /* libnet handle */ - 0); /* libnet id */ -``` - -Example 4: - -Before: -``` -static struct testcase __testcases[] = { - { 2, 1, 2, 1, 2, 1 }, /* session00 */ - { 4, 2, 4, 2, 4, 1 }, /* |\_session00 */ - { 15, 4, 4, 4, 15, 1 }, /* | |\_session00 */ - { 16, 4, 4, 4, 15, 1 }, /* | \_session00 */ - { 17, 4, 4, 4, 17, 0 }, /* | |\_session00 */ - { 18, 4, 4, 4, 17, 1 }, /* | \_session00 */ - { 5, 2, 2, 2, 2, 1 }, /* |\_session00 */ - { 8, 2, 8, 2, 8, 1 }, /* |\_session00 */ - { 9, 8, 2, 2, 2, 1 }, /* | \_session00 */ - { 10, 2, 10, 2, 10, 1 }, /* |\_session00 */ - { 11, 10, 11, 2, 11, 1 }, /* | \_session00 */ - { 12, 11, 2, 2, 2, 1 }, /* | \_session00 */ - { 13, 2, 2, 2, 2, 0 }, /* \_session00 */ - { 3, 13, 2, 2, 2, 1 }, /* session00 */ - { 6, 2, 6, 2, 6, 0 }, /* \_session00 */ - { 14, 6, 6, 6, 6, 1 }, /* session00 */ -}; -``` -After: -``` -static struct testcase __testcases[] = { - { 2, 1, 2, 1, 2, 1 }, /* session00 */ - { 4, 2, 4, 2, 4, 1 }, /* |\_session00 */ - { 15, 4, 4, 4, 15, 1 }, /* | |\_session00 */ - { 16, 4, 4, 4, 15, 1 }, /* | \_session00 */ - { 17, 4, 4, 4, 17, 0 }, /* | |\_session00 */ - { 18, 4, 4, 4, 17, 1 }, /* | \_session00 */ - { 5, 2, 2, 2, 2, 1 }, /* |\_session00 */ - { 8, 2, 8, 2, 8, 1 }, /* |\_session00 */ - { 9, 8, 2, 2, 2, 1 }, /* | \_session00 */ - { 10, 2, 10, 2, 10, 1 }, /* |\_session00 */ - { 11, 10, 11, 2, 11, 1 }, /* | \_session00 */ - { 12, 11, 2, 2, 2, 1 }, /* | \_session00 */ - { 13, 2, 2, 2, 2, 0 }, /* \_session00 */ - { 3, 13, 2, 2, 2, 1 }, /* session00 */ - { 6, 2, 6, 2, 6, 0 }, /* \_session00 */ - { 14, 6, 6, 6, 6, 1 }, /* session00 */ -}; -``` - -Signed-off-by: Pavel Tikhomirov ---- - .clang-format | 2 +- - scripts/fetch-clang-format.sh | 1 + - 2 files changed, 2 insertions(+), 1 deletion(-) - -diff --git a/.clang-format b/.clang-format -index dd4ade370..96ba5909f 100644 ---- a/.clang-format -+++ b/.clang-format -@@ -15,7 +15,7 @@ AlignConsecutiveAssignments: false - AlignConsecutiveDeclarations: false - AlignEscapedNewlines: Left # Unknown to clang-format-4.0 - AlignOperands: true --AlignTrailingComments: false -+AlignTrailingComments: true - AlignConsecutiveMacros: true - AllowAllParametersOfDeclarationOnNextLine: false - AllowShortBlocksOnASingleLine: false -diff --git a/scripts/fetch-clang-format.sh b/scripts/fetch-clang-format.sh -index c9006c518..0e9545f2d 100755 ---- a/scripts/fetch-clang-format.sh -+++ b/scripts/fetch-clang-format.sh -@@ -12,4 +12,5 @@ curl -s "${URL}" | sed -e " - s,Intended for clang-format >= 4,Intended for clang-format >= 11,g; - s,ForEachMacros:,ForEachMacros:\n - 'for_each_pstree_item',g; - s,\(AlignTrailingComments:.*\)$,\1\nAlignConsecutiveMacros: true,g; -+ s,AlignTrailingComments: false,AlignTrailingComments: true,g; - " > .clang-format --- -2.35.1 - diff --git a/0036-clang-format-do-several-manual-comment-fixups.patch b/0036-clang-format-do-several-manual-comment-fixups.patch deleted file mode 100644 index ac0f701..0000000 --- a/0036-clang-format-do-several-manual-comment-fixups.patch +++ /dev/null @@ -1,169 +0,0 @@ -From f8018e956406b88a9bc170354229b5ec40570fef Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Thu, 28 Oct 2021 17:17:44 +0300 -Subject: [PATCH 036/249] clang-format: do several manual comment fixups - -Automatic AlignTrailingComments fails to make those comments look right, -so let's do it manually, so that they both satisfy AlignTrailingComments -and also are human-readable. - -Signed-off-by: Pavel Tikhomirov ---- - criu/include/files.h | 10 +++++----- - criu/include/page-pipe.h | 6 ++---- - criu/include/pagemap.h | 19 ++++++++---------- - criu/include/pipes.h | 4 ++-- - criu/shmem.c | 3 ++- - test/zdtm/static/ipc_namespace.c | 33 ++++++++++++++++---------------- - 6 files changed, 36 insertions(+), 39 deletions(-) - -diff --git a/criu/include/files.h b/criu/include/files.h -index 96face71b..26ce1f42a 100644 ---- a/criu/include/files.h -+++ b/criu/include/files.h -@@ -121,12 +121,12 @@ unsigned int find_unused_fd(struct pstree_item *, int hint_fd); - struct fdinfo_list_entry *find_used_fd(struct pstree_item *, int fd); - - struct file_desc { -- u32 id; /* File id, unique */ -- struct hlist_node hash; /* Descriptor hashing and lookup */ -- struct list_head fd_info_head; /* Chain of fdinfo_list_entry-s with same ID and type but different pids */ -- struct file_desc_ops *ops; /* Associated operations */ -+ u32 id; /* File id, unique */ -+ struct hlist_node hash; /* Descriptor hashing and lookup */ -+ struct list_head fd_info_head; /* Chain of fdinfo_list_entry-s with same ID and type but different pids */ -+ struct file_desc_ops *ops; /* Associated operations */ - struct list_head fake_master_list; /* To chain in the list of file_desc, which don't -- have a fle in a task, that having permissions */ -+ * have a fle in a task, that having permissions */ - }; - - struct fdtype_ops { -diff --git a/criu/include/page-pipe.h b/criu/include/page-pipe.h -index a5f97678e..0917869d9 100644 ---- a/criu/include/page-pipe.h -+++ b/criu/include/page-pipe.h -@@ -130,10 +130,8 @@ struct page_pipe { - unsigned int flags; /* PP_FOO flags below */ - }; - --#define PP_CHUNK_MODE \ -- 0x1 /* Restrict the maximum buffer size of pipes -- and dump memory for a few iterations */ --#define PP_OWN_IOVS 0x4 /* create_page_pipe allocated IOVs memory */ -+#define PP_CHUNK_MODE 0x1 /* Restrict the maximum buffer size of pipes and dump memory for a few iterations */ -+#define PP_OWN_IOVS 0x4 /* create_page_pipe allocated IOVs memory */ - - struct page_pipe *create_page_pipe(unsigned int nr_segs, struct iovec *iovs, unsigned flags); - extern void destroy_page_pipe(struct page_pipe *p); -diff --git a/criu/include/pagemap.h b/criu/include/pagemap.h -index c39c25d0c..8c7180559 100644 ---- a/criu/include/pagemap.h -+++ b/criu/include/pagemap.h -@@ -63,17 +63,14 @@ struct page_read { - struct cr_img *pi; - u32 pages_img_id; - -- PagemapEntry *pe; /* current pagemap we are on */ -- struct page_read *parent; /* parent pagemap (if ->in_parent -- pagemap is met in image, then -- go to this guy for page, see -- read_pagemap_page */ -- unsigned long cvaddr; /* vaddr we are on */ -- off_t pi_off; /* current offset in pages file */ -- -- struct iovec bunch; /* record consequent neighbour -- iovecs to punch together */ -- unsigned id; /* for logging */ -+ PagemapEntry *pe; /* current pagemap we are on */ -+ struct page_read *parent; /* parent pagemap (if ->in_parent pagemap is met in image, -+ * then go to this guy for page, see read_pagemap_page */ -+ unsigned long cvaddr; /* vaddr we are on */ -+ off_t pi_off; /* current offset in pages file */ -+ -+ struct iovec bunch; /* record consequent neighbour iovecs to punch together */ -+ unsigned id; /* for logging */ - unsigned long img_id; /* pagemap image file ID */ - - PagemapEntry **pmes; -diff --git a/criu/include/pipes.h b/criu/include/pipes.h -index 6e6310e14..f442d7f65 100644 ---- a/criu/include/pipes.h -+++ b/criu/include/pipes.h -@@ -49,8 +49,8 @@ extern int restore_pipe_data(int img_type, int pfd, u32 id, struct pipe_data_rst - struct pipe_info { - PipeEntry *pe; - struct list_head pipe_list; /* All pipe_info with the same pipe_id -- * This is pure circular list without head */ -- struct list_head list; /* global list of pipes */ -+ * This is pure circular list without head */ -+ struct list_head list; /* global list of pipes */ - struct file_desc d; - unsigned int create : 1, reopen : 1; - }; -diff --git a/criu/shmem.c b/criu/shmem.c -index 1b83327ef..bb48e436b 100644 ---- a/criu/shmem.c -+++ b/criu/shmem.c -@@ -85,7 +85,8 @@ struct shmem_info { - int self_count; /* the number of regions, which belongs to "pid" */ - }; - -- struct { /* For sysvipc restore */ -+ /* For sysvipc restore */ -+ struct { - struct list_head att; /* list of shmem_sysv_att-s */ - int want_write; - }; -diff --git a/test/zdtm/static/ipc_namespace.c b/test/zdtm/static/ipc_namespace.c -index 98241d816..4273951ae 100644 ---- a/test/zdtm/static/ipc_namespace.c -+++ b/test/zdtm/static/ipc_namespace.c -@@ -19,27 +19,28 @@ extern int shmctl(int __shmid, int __cmd, struct shmid_ds *__buf); - - struct ipc_ids { - int in_use; /* TODO: Check for 0 */ -- // unsigned short seq; -- // unsigned short seq_max; -- // struct rw_semaphore rw_mutex; -- // struct idr ipcs_idr; /* TODO */ -+ -+ // unsigned short seq; -+ // unsigned short seq_max; -+ // struct rw_semaphore rw_mutex; -+ // struct idr ipcs_idr; /* TODO */ - }; - - struct ipc_ns { - struct ipc_ids ids[3]; - -- int sem_ctls[4]; // + -- int used_sems; // + -- -- int msg_ctlmax; // + -- int msg_ctlmnb; // + -- int msg_ctlmni; // + -- int msg_bytes; // + -- int msg_hdrs; // + -- int auto_msgmni; // + -- int msg_next_id; // + -- int sem_next_id; // + -- int shm_next_id; // + -+ int sem_ctls[4]; -+ int used_sems; -+ -+ int msg_ctlmax; -+ int msg_ctlmnb; -+ int msg_ctlmni; -+ int msg_bytes; -+ int msg_hdrs; -+ int auto_msgmni; -+ int msg_next_id; -+ int sem_next_id; -+ int shm_next_id; - - size_t shm_ctlmax; - size_t shm_ctlall; --- -2.35.1 - diff --git a/0037-clang-format-do-automatic-comment-fixups.patch b/0037-clang-format-do-automatic-comment-fixups.patch deleted file mode 100644 index 3fdcb36..0000000 --- a/0037-clang-format-do-automatic-comment-fixups.patch +++ /dev/null @@ -1,1889 +0,0 @@ -From d42f4cf79a9d248b2129add96186fdb05c39ba5e Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Thu, 28 Oct 2021 18:10:14 +0300 -Subject: [PATCH 037/249] clang-format: do automatic comment fixups - -Result of `make indent` after enabling AlignTrailingComments. - -Signed-off-by: Pavel Tikhomirov ---- - compel/arch/aarch64/src/lib/infect.c | 2 +- - compel/arch/arm/src/lib/infect.c | 2 +- - compel/arch/mips/src/lib/include/ldsodefs.h | 10 +- - .../mips/src/lib/include/uapi/asm/siginfo.h | 14 +- - compel/arch/mips/src/lib/infect.c | 2 +- - .../src/lib/include/uapi/asm/infect-types.h | 6 +- - compel/arch/ppc64/src/lib/infect.c | 2 +- - compel/arch/s390/src/lib/infect.c | 4 +- - .../arch/x86/plugins/std/syscalls/syscall32.c | 6 +- - .../arch/x86/src/lib/include/uapi/asm/cpu.h | 158 +++++++++--------- - .../arch/x86/src/lib/include/uapi/asm/fpu.h | 16 +- - compel/arch/x86/src/lib/infect.c | 4 +- - compel/include/infect-priv.h | 2 +- - compel/include/rpc-pie-priv.h | 2 +- - compel/include/uapi/infect.h | 2 +- - compel/include/uapi/loglevels.h | 6 +- - compel/include/uapi/ptrace.h | 2 +- - compel/src/lib/handle-elf.c | 2 +- - criu/arch/ppc64/restorer.c | 6 +- - criu/arch/ppc64/vdso-pie.c | 4 +- - criu/arch/s390/restorer.c | 6 +- - criu/arch/s390/vdso-pie.c | 6 +- - criu/arch/x86/include/asm/restorer.h | 2 +- - criu/arch/x86/sigaction_compat.c | 4 +- - criu/cgroup.c | 4 +- - criu/cr-check.c | 2 +- - criu/cr-dump.c | 2 +- - criu/files-reg.c | 4 +- - criu/files.c | 4 +- - criu/include/aio.h | 4 +- - criu/include/autofs.h | 2 +- - criu/include/bfd.h | 4 +- - criu/include/file-lock.h | 8 +- - criu/include/files.h | 4 +- - criu/include/image-desc.h | 4 +- - criu/include/inet_diag.h | 2 +- - criu/include/kcmp.h | 4 +- - criu/include/kerndat.h | 2 +- - criu/include/linux/mount.h | 14 +- - criu/include/mount.h | 12 +- - criu/include/namespaces.h | 4 +- - criu/include/page-pipe.h | 24 +-- - criu/include/page-xfer.h | 2 +- - criu/include/pagemap-cache.h | 12 +- - criu/include/pstree.h | 4 +- - criu/include/restorer.h | 4 +- - criu/include/rst_info.h | 2 +- - criu/include/servicefd.h | 6 +- - criu/include/sk-inet.h | 2 +- - criu/include/sysfs_parse.h | 4 +- - criu/include/vma.h | 10 +- - criu/irmap.c | 4 +- - criu/mount.c | 2 +- - criu/net.c | 4 +- - criu/pagemap.c | 6 +- - criu/shmem.c | 2 +- - criu/sk-unix.c | 4 +- - criu/uffd.c | 4 +- - criu/util.c | 4 +- - include/common/arch/ppc64/asm/bitops.h | 2 +- - include/common/arch/x86/asm/bitops.h | 2 +- - include/common/asm-generic/bitops.h | 2 +- - soccr/soccr.c | 66 ++++---- - soccr/soccr.h | 6 +- - test/zdtm/static/aio01.c | 4 +- - test/zdtm/static/auto_dev-ioctl.h | 2 +- - test/zdtm/static/file_locks00.c | 18 +- - test/zdtm/static/ipc_namespace.c | 8 +- - test/zdtm/static/netns-dev.c | 140 ++++++++-------- - test/zdtm/static/s390x_regs_check.c | 14 +- - test/zdtm/static/session01.c | 30 ++-- - test/zdtm/static/sigpending.c | 2 +- - test/zdtm/transition/ptrace.c | 2 +- - 73 files changed, 374 insertions(+), 374 deletions(-) - -diff --git a/compel/arch/aarch64/src/lib/infect.c b/compel/arch/aarch64/src/lib/infect.c -index 7cfa637eb..bd1ed0da3 100644 ---- a/compel/arch/aarch64/src/lib/infect.c -+++ b/compel/arch/aarch64/src/lib/infect.c -@@ -19,7 +19,7 @@ unsigned __page_shift = 0; - */ - const char code_syscall[] = { - 0x01, 0x00, 0x00, 0xd4, /* SVC #0 */ -- 0x00, 0x00, 0x20, 0xd4 /* BRK #0 */ -+ 0x00, 0x00, 0x20, 0xd4 /* BRK #0 */ - }; - - static const int code_syscall_aligned = round_up(sizeof(code_syscall), sizeof(long)); -diff --git a/compel/arch/arm/src/lib/infect.c b/compel/arch/arm/src/lib/infect.c -index 6715afdb3..7700f52ca 100644 ---- a/compel/arch/arm/src/lib/infect.c -+++ b/compel/arch/arm/src/lib/infect.c -@@ -18,7 +18,7 @@ - */ - const char code_syscall[] = { - 0x00, 0x00, 0x00, 0xef, /* SVC #0 */ -- 0xf0, 0x01, 0xf0, 0xe7 /* UDF #32 */ -+ 0xf0, 0x01, 0xf0, 0xe7 /* UDF #32 */ - }; - - static const int code_syscall_aligned = round_up(sizeof(code_syscall), sizeof(long)); -diff --git a/compel/arch/mips/src/lib/include/ldsodefs.h b/compel/arch/mips/src/lib/include/ldsodefs.h -index 8cfde2496..97e79755d 100644 ---- a/compel/arch/mips/src/lib/include/ldsodefs.h -+++ b/compel/arch/mips/src/lib/include/ldsodefs.h -@@ -69,8 +69,8 @@ struct La_mips_64_retval; - /* An entry in a 64 bit SHT_REL section. */ - - typedef struct { -- Elf32_Word r_sym; /* Symbol index */ -- unsigned char r_ssym; /* Special symbol for 2nd relocation */ -+ Elf32_Word r_sym; /* Symbol index */ -+ unsigned char r_ssym; /* Special symbol for 2nd relocation */ - unsigned char r_type3; /* 3rd relocation type */ - unsigned char r_type2; /* 2nd relocation type */ - unsigned char r_type1; /* 1st relocation type */ -@@ -82,14 +82,14 @@ typedef union { - } _Elf64_Mips_R_Info_union; - - typedef struct { -- Elf64_Addr r_offset; /* Address */ -+ Elf64_Addr r_offset; /* Address */ - _Elf64_Mips_R_Info_union r_info; /* Relocation type and symbol index */ - } Elf64_Mips_Rel; - - typedef struct { -- Elf64_Addr r_offset; /* Address */ -+ Elf64_Addr r_offset; /* Address */ - _Elf64_Mips_R_Info_union r_info; /* Relocation type and symbol index */ -- Elf64_Sxword r_addend; /* Addend */ -+ Elf64_Sxword r_addend; /* Addend */ - } Elf64_Mips_Rela; - - #define ELF64_MIPS_R_SYM(i) ((__extension__(_Elf64_Mips_R_Info_union)(i)).r_info_fields.r_sym) -diff --git a/compel/arch/mips/src/lib/include/uapi/asm/siginfo.h b/compel/arch/mips/src/lib/include/uapi/asm/siginfo.h -index 82ae6096b..6db1ddbd3 100644 ---- a/compel/arch/mips/src/lib/include/uapi/asm/siginfo.h -+++ b/compel/arch/mips/src/lib/include/uapi/asm/siginfo.h -@@ -52,14 +52,14 @@ typedef struct siginfo { - - /* kill() */ - struct { -- __kernel_pid_t _pid; /* sender's pid */ -+ __kernel_pid_t _pid; /* sender's pid */ - __ARCH_SI_UID_T _uid; /* sender's uid */ - } _kill; - - /* POSIX.1b timers */ - struct { - __kernel_timer_t _tid; /* timer id */ -- int _overrun; /* overrun count */ -+ int _overrun; /* overrun count */ - char _pad[sizeof(__ARCH_SI_UID_T) - sizeof(int)]; - sigval_t _sigval; /* same as below */ - int _sys_private; /* not to be passed to user */ -@@ -67,16 +67,16 @@ typedef struct siginfo { - - /* POSIX.1b signals */ - struct { -- __kernel_pid_t _pid; /* sender's pid */ -+ __kernel_pid_t _pid; /* sender's pid */ - __ARCH_SI_UID_T _uid; /* sender's uid */ - sigval_t _sigval; - } _rt; - - /* SIGCHLD */ - struct { -- __kernel_pid_t _pid; /* which child */ -+ __kernel_pid_t _pid; /* which child */ - __ARCH_SI_UID_T _uid; /* sender's uid */ -- int _status; /* exit code */ -+ int _status; /* exit code */ - __ARCH_SI_CLOCK_T _utime; - __ARCH_SI_CLOCK_T _stime; - } _sigchld; -@@ -104,8 +104,8 @@ typedef struct siginfo { - - /* SIGSYS */ - struct { -- void *_call_addr; /* calling user insn */ -- int _syscall; /* triggering system call number */ -+ void *_call_addr; /* calling user insn */ -+ int _syscall; /* triggering system call number */ - unsigned int _arch; /* AUDIT_ARCH_* of syscall */ - } _sigsys; - } _sifields; -diff --git a/compel/arch/mips/src/lib/infect.c b/compel/arch/mips/src/lib/infect.c -index 68d0a2728..afa0f5ed5 100644 ---- a/compel/arch/mips/src/lib/infect.c -+++ b/compel/arch/mips/src/lib/infect.c -@@ -24,7 +24,7 @@ - */ - const char code_syscall[] = { - 0x0c, 0x00, 0x00, 0x00, /* syscall */ -- 0x0d, 0x00, 0x00, 0x00 /* break */ -+ 0x0d, 0x00, 0x00, 0x00 /* break */ - }; - - /* 10-byte legacy floating point register */ -diff --git a/compel/arch/ppc64/src/lib/include/uapi/asm/infect-types.h b/compel/arch/ppc64/src/lib/include/uapi/asm/infect-types.h -index fe6192e20..8cf8a135f 100644 ---- a/compel/arch/ppc64/src/lib/include/uapi/asm/infect-types.h -+++ b/compel/arch/ppc64/src/lib/include/uapi/asm/infect-types.h -@@ -21,13 +21,13 @@ typedef struct { - unsigned long xer; - unsigned long ccr; - unsigned long softe; /* Soft enabled/disabled */ -- unsigned long trap; /* Reason for being here */ -+ unsigned long trap; /* Reason for being here */ - /* - * N.B. for critical exceptions on 4xx, the dar and dsisr - * fields are overloaded to hold srr0 and srr1. - */ -- unsigned long dar; /* Fault registers */ -- unsigned long dsisr; /* on 4xx/Book-E used for ESR */ -+ unsigned long dar; /* Fault registers */ -+ unsigned long dsisr; /* on 4xx/Book-E used for ESR */ - unsigned long result; /* Result of a system call */ - } user_regs_struct_t; - -diff --git a/compel/arch/ppc64/src/lib/infect.c b/compel/arch/ppc64/src/lib/infect.c -index fc174d0dd..61cd6e985 100644 ---- a/compel/arch/ppc64/src/lib/infect.c -+++ b/compel/arch/ppc64/src/lib/infect.c -@@ -30,7 +30,7 @@ unsigned __page_shift = 0; - */ - const uint32_t code_syscall[] = { - 0x44000002, /* sc */ -- 0x0fe00000 /* twi 31,0,0 */ -+ 0x0fe00000 /* twi 31,0,0 */ - }; - - static inline __always_unused void __check_code_syscall(void) -diff --git a/compel/arch/s390/src/lib/infect.c b/compel/arch/s390/src/lib/infect.c -index 77ace713a..3cd25e71d 100644 ---- a/compel/arch/s390/src/lib/infect.c -+++ b/compel/arch/s390/src/lib/infect.c -@@ -624,8 +624,8 @@ enum kernel_ts_level { - }; - - /* See arch/s390/include/asm/processor.h */ --#define TASK_SIZE_LEVEL_3 0x40000000000UL /* 4 TB */ --#define TASK_SIZE_LEVEL_4 0x20000000000000UL /* 8 PB */ -+#define TASK_SIZE_LEVEL_3 0x40000000000UL /* 4 TB */ -+#define TASK_SIZE_LEVEL_4 0x20000000000000UL /* 8 PB */ - #define TASK_SIZE_LEVEL_5 0xffffffffffffefffUL /* 16 EB - 0x1000 */ - - /* -diff --git a/compel/arch/x86/plugins/std/syscalls/syscall32.c b/compel/arch/x86/plugins/std/syscalls/syscall32.c -index 0f2fec3ff..d09fd38c7 100644 ---- a/compel/arch/x86/plugins/std/syscalls/syscall32.c -+++ b/compel/arch/x86/plugins/std/syscalls/syscall32.c -@@ -1,9 +1,9 @@ - #include "asm/types.h" - #include "syscall-32.h" - --#define SYS_SOCKET 1 /* sys_socket(2) */ --#define SYS_BIND 2 /* sys_bind(2) */ --#define SYS_CONNECT 3 /* sys_connect(2) */ -+#define SYS_SOCKET 1 /* sys_socket(2) */ -+#define SYS_BIND 2 /* sys_bind(2) */ -+#define SYS_CONNECT 3 /* sys_connect(2) */ - #define SYS_SENDTO 11 /* sys_sendto(2) */ - #define SYS_RECVFROM 12 /* sys_recvfrom(2) */ - #define SYS_SHUTDOWN 13 /* sys_shutdown(2) */ -diff --git a/compel/arch/x86/src/lib/include/uapi/asm/cpu.h b/compel/arch/x86/src/lib/include/uapi/asm/cpu.h -index 8d54516af..63ff83dbe 100644 ---- a/compel/arch/x86/src/lib/include/uapi/asm/cpu.h -+++ b/compel/arch/x86/src/lib/include/uapi/asm/cpu.h -@@ -43,16 +43,16 @@ enum cpuid_leafs { - #define NCAPINTS_BITS (NCAPINTS * 32) - - /* Intel-defined CPU features, CPUID level 0x00000001 (EDX), word 0 */ --#define X86_FEATURE_FPU (0 * 32 + 0) /* Onboard FPU */ --#define X86_FEATURE_VME (0 * 32 + 1) /* Virtual Mode Extensions */ --#define X86_FEATURE_DE (0 * 32 + 2) /* Debugging Extensions */ --#define X86_FEATURE_PSE (0 * 32 + 3) /* Page Size Extensions */ --#define X86_FEATURE_TSC (0 * 32 + 4) /* Time Stamp Counter */ --#define X86_FEATURE_MSR (0 * 32 + 5) /* Model-Specific Registers */ --#define X86_FEATURE_PAE (0 * 32 + 6) /* Physical Address Extensions */ --#define X86_FEATURE_MCE (0 * 32 + 7) /* Machine Check Exception */ --#define X86_FEATURE_CX8 (0 * 32 + 8) /* CMPXCHG8 instruction */ --#define X86_FEATURE_APIC (0 * 32 + 9) /* Onboard APIC */ -+#define X86_FEATURE_FPU (0 * 32 + 0) /* Onboard FPU */ -+#define X86_FEATURE_VME (0 * 32 + 1) /* Virtual Mode Extensions */ -+#define X86_FEATURE_DE (0 * 32 + 2) /* Debugging Extensions */ -+#define X86_FEATURE_PSE (0 * 32 + 3) /* Page Size Extensions */ -+#define X86_FEATURE_TSC (0 * 32 + 4) /* Time Stamp Counter */ -+#define X86_FEATURE_MSR (0 * 32 + 5) /* Model-Specific Registers */ -+#define X86_FEATURE_PAE (0 * 32 + 6) /* Physical Address Extensions */ -+#define X86_FEATURE_MCE (0 * 32 + 7) /* Machine Check Exception */ -+#define X86_FEATURE_CX8 (0 * 32 + 8) /* CMPXCHG8 instruction */ -+#define X86_FEATURE_APIC (0 * 32 + 9) /* Onboard APIC */ - #define X86_FEATURE_SEP (0 * 32 + 11) /* SYSENTER/SYSEXIT */ - #define X86_FEATURE_MTRR (0 * 32 + 12) /* Memory Type Range Registers */ - #define X86_FEATURE_PGE (0 * 32 + 13) /* Page Global Enable */ -@@ -100,12 +100,12 @@ enum cpuid_leafs { - #define X86_FEATURE_CENTAUR_MCR (3 * 32 + 3) /* Centaur MCRs (= MTRRs) */ - - /* CPU types for specific tunings: */ --#define X86_FEATURE_K8 (3 * 32 + 4) /* "" Opteron, Athlon64 */ --#define X86_FEATURE_K7 (3 * 32 + 5) /* "" Athlon */ --#define X86_FEATURE_P3 (3 * 32 + 6) /* "" P3 */ --#define X86_FEATURE_P4 (3 * 32 + 7) /* "" P4 */ --#define X86_FEATURE_CONSTANT_TSC (3 * 32 + 8) /* TSC ticks at a constant rate */ --#define X86_FEATURE_UP (3 * 32 + 9) /* SMP kernel running on UP */ -+#define X86_FEATURE_K8 (3 * 32 + 4) /* "" Opteron, Athlon64 */ -+#define X86_FEATURE_K7 (3 * 32 + 5) /* "" Athlon */ -+#define X86_FEATURE_P3 (3 * 32 + 6) /* "" P3 */ -+#define X86_FEATURE_P4 (3 * 32 + 7) /* "" P4 */ -+#define X86_FEATURE_CONSTANT_TSC (3 * 32 + 8) /* TSC ticks at a constant rate */ -+#define X86_FEATURE_UP (3 * 32 + 9) /* SMP kernel running on UP */ - #define X86_FEATURE_ART (3 * 32 + 10) /* Always running timer (ART) */ - #define X86_FEATURE_ARCH_PERFMON (3 * 32 + 11) /* Intel Architectural PerfMon */ - #define X86_FEATURE_PEBS (3 * 32 + 12) /* Precise-Event Based Sampling */ -@@ -129,16 +129,16 @@ enum cpuid_leafs { - #define X86_FEATURE_TSC_KNOWN_FREQ (3 * 32 + 31) /* TSC has known frequency */ - - /* Intel-defined CPU features, CPUID level 0x00000001 (ECX), word 4 */ --#define X86_FEATURE_XMM3 (4 * 32 + 0) /* "pni" SSE-3 */ --#define X86_FEATURE_PCLMULQDQ (4 * 32 + 1) /* PCLMULQDQ instruction */ --#define X86_FEATURE_DTES64 (4 * 32 + 2) /* 64-bit Debug Store */ --#define X86_FEATURE_MWAIT (4 * 32 + 3) /* "monitor" MONITOR/MWAIT support */ --#define X86_FEATURE_DSCPL (4 * 32 + 4) /* "ds_cpl" CPL-qualified (filtered) Debug Store */ --#define X86_FEATURE_VMX (4 * 32 + 5) /* Hardware virtualization */ --#define X86_FEATURE_SMX (4 * 32 + 6) /* Safer Mode eXtensions */ --#define X86_FEATURE_EST (4 * 32 + 7) /* Enhanced SpeedStep */ --#define X86_FEATURE_TM2 (4 * 32 + 8) /* Thermal Monitor 2 */ --#define X86_FEATURE_SSSE3 (4 * 32 + 9) /* Supplemental SSE-3 */ -+#define X86_FEATURE_XMM3 (4 * 32 + 0) /* "pni" SSE-3 */ -+#define X86_FEATURE_PCLMULQDQ (4 * 32 + 1) /* PCLMULQDQ instruction */ -+#define X86_FEATURE_DTES64 (4 * 32 + 2) /* 64-bit Debug Store */ -+#define X86_FEATURE_MWAIT (4 * 32 + 3) /* "monitor" MONITOR/MWAIT support */ -+#define X86_FEATURE_DSCPL (4 * 32 + 4) /* "ds_cpl" CPL-qualified (filtered) Debug Store */ -+#define X86_FEATURE_VMX (4 * 32 + 5) /* Hardware virtualization */ -+#define X86_FEATURE_SMX (4 * 32 + 6) /* Safer Mode eXtensions */ -+#define X86_FEATURE_EST (4 * 32 + 7) /* Enhanced SpeedStep */ -+#define X86_FEATURE_TM2 (4 * 32 + 8) /* Thermal Monitor 2 */ -+#define X86_FEATURE_SSSE3 (4 * 32 + 9) /* Supplemental SSE-3 */ - #define X86_FEATURE_CID (4 * 32 + 10) /* Context ID */ - #define X86_FEATURE_SDBG (4 * 32 + 11) /* Silicon Debug */ - #define X86_FEATURE_FMA (4 * 32 + 12) /* Fused multiply-add */ -@@ -162,28 +162,28 @@ enum cpuid_leafs { - #define X86_FEATURE_HYPERVISOR (4 * 32 + 31) /* Running on a hypervisor */ - - /* VIA/Cyrix/Centaur-defined CPU features, CPUID level 0xC0000001, word 5 */ --#define X86_FEATURE_XSTORE (5 * 32 + 2) /* "rng" RNG present (xstore) */ --#define X86_FEATURE_XSTORE_EN (5 * 32 + 3) /* "rng_en" RNG enabled */ --#define X86_FEATURE_XCRYPT (5 * 32 + 6) /* "ace" on-CPU crypto (xcrypt) */ --#define X86_FEATURE_XCRYPT_EN (5 * 32 + 7) /* "ace_en" on-CPU crypto enabled */ --#define X86_FEATURE_ACE2 (5 * 32 + 8) /* Advanced Cryptography Engine v2 */ --#define X86_FEATURE_ACE2_EN (5 * 32 + 9) /* ACE v2 enabled */ -+#define X86_FEATURE_XSTORE (5 * 32 + 2) /* "rng" RNG present (xstore) */ -+#define X86_FEATURE_XSTORE_EN (5 * 32 + 3) /* "rng_en" RNG enabled */ -+#define X86_FEATURE_XCRYPT (5 * 32 + 6) /* "ace" on-CPU crypto (xcrypt) */ -+#define X86_FEATURE_XCRYPT_EN (5 * 32 + 7) /* "ace_en" on-CPU crypto enabled */ -+#define X86_FEATURE_ACE2 (5 * 32 + 8) /* Advanced Cryptography Engine v2 */ -+#define X86_FEATURE_ACE2_EN (5 * 32 + 9) /* ACE v2 enabled */ - #define X86_FEATURE_PHE (5 * 32 + 10) /* PadLock Hash Engine */ - #define X86_FEATURE_PHE_EN (5 * 32 + 11) /* PHE enabled */ - #define X86_FEATURE_PMM (5 * 32 + 12) /* PadLock Montgomery Multiplier */ - #define X86_FEATURE_PMM_EN (5 * 32 + 13) /* PMM enabled */ - - /* More extended AMD flags: CPUID level 0x80000001, ECX, word 6 */ --#define X86_FEATURE_LAHF_LM (6 * 32 + 0) /* LAHF/SAHF in long mode */ --#define X86_FEATURE_CMP_LEGACY (6 * 32 + 1) /* If yes HyperThreading not valid */ --#define X86_FEATURE_SVM (6 * 32 + 2) /* Secure Virtual Machine */ --#define X86_FEATURE_EXTAPIC (6 * 32 + 3) /* Extended APIC space */ --#define X86_FEATURE_CR8_LEGACY (6 * 32 + 4) /* CR8 in 32-bit mode */ --#define X86_FEATURE_ABM (6 * 32 + 5) /* Advanced bit manipulation */ --#define X86_FEATURE_SSE4A (6 * 32 + 6) /* SSE-4A */ --#define X86_FEATURE_MISALIGNSSE (6 * 32 + 7) /* Misaligned SSE mode */ --#define X86_FEATURE_3DNOWPREFETCH (6 * 32 + 8) /* 3DNow prefetch instructions */ --#define X86_FEATURE_OSVW (6 * 32 + 9) /* OS Visible Workaround */ -+#define X86_FEATURE_LAHF_LM (6 * 32 + 0) /* LAHF/SAHF in long mode */ -+#define X86_FEATURE_CMP_LEGACY (6 * 32 + 1) /* If yes HyperThreading not valid */ -+#define X86_FEATURE_SVM (6 * 32 + 2) /* Secure Virtual Machine */ -+#define X86_FEATURE_EXTAPIC (6 * 32 + 3) /* Extended APIC space */ -+#define X86_FEATURE_CR8_LEGACY (6 * 32 + 4) /* CR8 in 32-bit mode */ -+#define X86_FEATURE_ABM (6 * 32 + 5) /* Advanced bit manipulation */ -+#define X86_FEATURE_SSE4A (6 * 32 + 6) /* SSE-4A */ -+#define X86_FEATURE_MISALIGNSSE (6 * 32 + 7) /* Misaligned SSE mode */ -+#define X86_FEATURE_3DNOWPREFETCH (6 * 32 + 8) /* 3DNow prefetch instructions */ -+#define X86_FEATURE_OSVW (6 * 32 + 9) /* OS Visible Workaround */ - #define X86_FEATURE_IBS (6 * 32 + 10) /* Instruction Based Sampling */ - #define X86_FEATURE_XOP (6 * 32 + 11) /* extended AVX instructions */ - #define X86_FEATURE_SKINIT (6 * 32 + 12) /* SKINIT/STGI instructions */ -@@ -202,14 +202,14 @@ enum cpuid_leafs { - #define X86_FEATURE_MWAITX (6 * 32 + 29) /* MWAIT extension (MONITORX/MWAITX instructions) */ - - /* Intel-defined CPU features, CPUID level 0x00000007:0 (EBX), word 9 */ --#define X86_FEATURE_FSGSBASE (9 * 32 + 0) /* RDFSBASE, WRFSBASE, RDGSBASE, WRGSBASE instructions*/ --#define X86_FEATURE_TSC_ADJUST (9 * 32 + 1) /* TSC adjustment MSR 0x3B */ --#define X86_FEATURE_BMI1 (9 * 32 + 3) /* 1st group bit manipulation extensions */ --#define X86_FEATURE_HLE (9 * 32 + 4) /* Hardware Lock Elision */ --#define X86_FEATURE_AVX2 (9 * 32 + 5) /* AVX2 instructions */ --#define X86_FEATURE_SMEP (9 * 32 + 7) /* Supervisor Mode Execution Protection */ --#define X86_FEATURE_BMI2 (9 * 32 + 8) /* 2nd group bit manipulation extensions */ --#define X86_FEATURE_ERMS (9 * 32 + 9) /* Enhanced REP MOVSB/STOSB instructions */ -+#define X86_FEATURE_FSGSBASE (9 * 32 + 0) /* RDFSBASE, WRFSBASE, RDGSBASE, WRGSBASE instructions*/ -+#define X86_FEATURE_TSC_ADJUST (9 * 32 + 1) /* TSC adjustment MSR 0x3B */ -+#define X86_FEATURE_BMI1 (9 * 32 + 3) /* 1st group bit manipulation extensions */ -+#define X86_FEATURE_HLE (9 * 32 + 4) /* Hardware Lock Elision */ -+#define X86_FEATURE_AVX2 (9 * 32 + 5) /* AVX2 instructions */ -+#define X86_FEATURE_SMEP (9 * 32 + 7) /* Supervisor Mode Execution Protection */ -+#define X86_FEATURE_BMI2 (9 * 32 + 8) /* 2nd group bit manipulation extensions */ -+#define X86_FEATURE_ERMS (9 * 32 + 9) /* Enhanced REP MOVSB/STOSB instructions */ - #define X86_FEATURE_INVPCID (9 * 32 + 10) /* Invalidate Processor Context ID */ - #define X86_FEATURE_RTM (9 * 32 + 11) /* Restricted Transactional Memory */ - #define X86_FEATURE_CQM (9 * 32 + 12) /* Cache QoS Monitoring */ -@@ -238,14 +238,14 @@ enum cpuid_leafs { - #define X86_FEATURE_XSAVES (10 * 32 + 3) /* XSAVES/XRSTORS instructions */ - - /* Intel-defined CPU features, CPUID level 0x00000007:0 (ECX), word 11 */ --#define X86_FEATURE_PREFETCHWT1 (11 * 32 + 0) /* PREFETCHWT1 Intel® Xeon PhiTM only */ --#define X86_FEATURE_AVX512VBMI (11 * 32 + 1) /* AVX512 Vector Bit Manipulation instructions*/ --#define X86_FEATURE_UMIP (11 * 32 + 2) /* User Mode Instruction Protection */ --#define X86_FEATURE_PKU (11 * 32 + 3) /* Protection Keys for Userspace */ --#define X86_FEATURE_OSPKE (11 * 32 + 4) /* OS Protection Keys Enable */ --#define X86_FEATURE_AVX512_VBMI2 (11 * 32 + 6) /* Additional AVX512 Vector Bit Manipulation Instructions */ --#define X86_FEATURE_GFNI (11 * 32 + 8) /* Galois Field New Instructions */ --#define X86_FEATURE_VAES (11 * 32 + 9) /* Vector AES */ -+#define X86_FEATURE_PREFETCHWT1 (11 * 32 + 0) /* PREFETCHWT1 Intel® Xeon PhiTM only */ -+#define X86_FEATURE_AVX512VBMI (11 * 32 + 1) /* AVX512 Vector Bit Manipulation instructions*/ -+#define X86_FEATURE_UMIP (11 * 32 + 2) /* User Mode Instruction Protection */ -+#define X86_FEATURE_PKU (11 * 32 + 3) /* Protection Keys for Userspace */ -+#define X86_FEATURE_OSPKE (11 * 32 + 4) /* OS Protection Keys Enable */ -+#define X86_FEATURE_AVX512_VBMI2 (11 * 32 + 6) /* Additional AVX512 Vector Bit Manipulation Instructions */ -+#define X86_FEATURE_GFNI (11 * 32 + 8) /* Galois Field New Instructions */ -+#define X86_FEATURE_VAES (11 * 32 + 9) /* Vector AES */ - #define X86_FEATURE_VPCLMULQDQ (11 * 32 + 10) /* Carry-Less Multiplication Double Quadword */ - #define X86_FEATURE_AVX512_VNNI (11 * 32 + 11) /* Vector Neural Network Instructions */ - #define X86_FEATURE_AVX512_BITALG (11 * 32 + 12) /* Support for VPOPCNT[B,W] and VPSHUF-BITQMB instructions */ -@@ -261,35 +261,35 @@ enum cpuid_leafs { - #define X86_FEATURE_CQM_MBM_LOCAL (12 * 32 + 2) /* LLC Local MBM monitoring */ - - /* AMD-defined CPU features, CPUID level 0x80000008 (EBX), word 13 */ --#define X86_FEATURE_CLZERO (13 * 32 + 0) /* CLZERO instruction */ --#define X86_FEATURE_IRPERF (13 * 32 + 1) /* Instructions Retired Count */ --#define X86_FEATURE_XSAVEERPTR (13 * 32 + 2) /* Always save/restore FP error pointers */ -+#define X86_FEATURE_CLZERO (13 * 32 + 0) /* CLZERO instruction */ -+#define X86_FEATURE_IRPERF (13 * 32 + 1) /* Instructions Retired Count */ -+#define X86_FEATURE_XSAVEERPTR (13 * 32 + 2) /* Always save/restore FP error pointers */ - #define X86_FEATURE_IBPB (13 * 32 + 12) /* Indirect Branch Prediction Barrier */ - #define X86_FEATURE_IBRS (13 * 32 + 14) /* Indirect Branch Restricted Speculation */ - #define X86_FEATURE_STIBP (13 * 32 + 15) /* Single Thread Indirect Branch Predictors */ - - /* Thermal and Power Management Leaf, CPUID level 0x00000006 (EAX), word 14 */ --#define X86_FEATURE_DTHERM (14 * 32 + 0) /* Digital Thermal Sensor */ --#define X86_FEATURE_IDA (14 * 32 + 1) /* Intel Dynamic Acceleration */ --#define X86_FEATURE_ARAT (14 * 32 + 2) /* Always Running APIC Timer */ --#define X86_FEATURE_PLN (14 * 32 + 4) /* Intel Power Limit Notification */ --#define X86_FEATURE_PTS (14 * 32 + 6) /* Intel Package Thermal Status */ --#define X86_FEATURE_HWP (14 * 32 + 7) /* Intel Hardware P-states */ --#define X86_FEATURE_HWP_NOTIFY (14 * 32 + 8) /* HWP Notification */ --#define X86_FEATURE_HWP_ACT_WINDOW (14 * 32 + 9) /* HWP Activity Window */ -+#define X86_FEATURE_DTHERM (14 * 32 + 0) /* Digital Thermal Sensor */ -+#define X86_FEATURE_IDA (14 * 32 + 1) /* Intel Dynamic Acceleration */ -+#define X86_FEATURE_ARAT (14 * 32 + 2) /* Always Running APIC Timer */ -+#define X86_FEATURE_PLN (14 * 32 + 4) /* Intel Power Limit Notification */ -+#define X86_FEATURE_PTS (14 * 32 + 6) /* Intel Package Thermal Status */ -+#define X86_FEATURE_HWP (14 * 32 + 7) /* Intel Hardware P-states */ -+#define X86_FEATURE_HWP_NOTIFY (14 * 32 + 8) /* HWP Notification */ -+#define X86_FEATURE_HWP_ACT_WINDOW (14 * 32 + 9) /* HWP Activity Window */ - #define X86_FEATURE_HWP_EPP (14 * 32 + 10) /* HWP Energy Perf. Preference */ - #define X86_FEATURE_HWP_PKG_REQ (14 * 32 + 11) /* HWP Package Level Request */ - #define X86_FEATURE_HDC (14 * 32 + 13) /* HDC base registers present */ - - /* AMD SVM Feature Identification, CPUID level 0x8000000a (EDX), word 15 */ --#define X86_FEATURE_NPT (15 * 32 + 0) /* Nested Page Table support */ --#define X86_FEATURE_LBRV (15 * 32 + 1) /* LBR Virtualization support */ --#define X86_FEATURE_SVML (15 * 32 + 2) /* "svm_lock" SVM locking MSR */ --#define X86_FEATURE_NRIPS (15 * 32 + 3) /* "nrip_save" SVM next_rip save */ --#define X86_FEATURE_TSCRATEMSR (15 * 32 + 4) /* "tsc_scale" TSC scaling support */ --#define X86_FEATURE_VMCBCLEAN (15 * 32 + 5) /* "vmcb_clean" VMCB clean bits support */ --#define X86_FEATURE_FLUSHBYASID (15 * 32 + 6) /* flush-by-ASID support */ --#define X86_FEATURE_DECODEASSISTS (15 * 32 + 7) /* Decode Assists support */ -+#define X86_FEATURE_NPT (15 * 32 + 0) /* Nested Page Table support */ -+#define X86_FEATURE_LBRV (15 * 32 + 1) /* LBR Virtualization support */ -+#define X86_FEATURE_SVML (15 * 32 + 2) /* "svm_lock" SVM locking MSR */ -+#define X86_FEATURE_NRIPS (15 * 32 + 3) /* "nrip_save" SVM next_rip save */ -+#define X86_FEATURE_TSCRATEMSR (15 * 32 + 4) /* "tsc_scale" TSC scaling support */ -+#define X86_FEATURE_VMCBCLEAN (15 * 32 + 5) /* "vmcb_clean" VMCB clean bits support */ -+#define X86_FEATURE_FLUSHBYASID (15 * 32 + 6) /* flush-by-ASID support */ -+#define X86_FEATURE_DECODEASSISTS (15 * 32 + 7) /* Decode Assists support */ - #define X86_FEATURE_PAUSEFILTER (15 * 32 + 10) /* filtered pause intercept */ - #define X86_FEATURE_PFTHRESHOLD (15 * 32 + 12) /* pause filter threshold */ - #define X86_FEATURE_AVIC (15 * 32 + 13) /* Virtual Interrupt Controller */ -@@ -305,8 +305,8 @@ enum cpuid_leafs { - #define X86_FEATURE_SMCA (17 * 32 + 3) /* Scalable MCA */ - - /* Intel-defined CPU features, CPUID level 0x00000007:0 (EDX), word 18 */ --#define X86_FEATURE_AVX512_4VNNIW (18 * 32 + 2) /* AVX-512 Neural Network Instructions */ --#define X86_FEATURE_AVX512_4FMAPS (18 * 32 + 3) /* AVX-512 Multiply Accumulation Single precision */ -+#define X86_FEATURE_AVX512_4VNNIW (18 * 32 + 2) /* AVX-512 Neural Network Instructions */ -+#define X86_FEATURE_AVX512_4FMAPS (18 * 32 + 3) /* AVX-512 Multiply Accumulation Single precision */ - #define X86_FEATURE_PCONFIG (18 * 32 + 18) /* Intel PCONFIG */ - #define X86_FEATURE_SPEC_CTRL (18 * 32 + 26) /* "" Speculation Control (IBRS + IBPB) */ - #define X86_FEATURE_INTEL_STIBP (18 * 32 + 27) /* "" Single Thread Indirect Branch Predictors */ -diff --git a/compel/arch/x86/src/lib/include/uapi/asm/fpu.h b/compel/arch/x86/src/lib/include/uapi/asm/fpu.h -index d740e3c04..a16b658af 100644 ---- a/compel/arch/x86/src/lib/include/uapi/asm/fpu.h -+++ b/compel/arch/x86/src/lib/include/uapi/asm/fpu.h -@@ -105,7 +105,7 @@ struct i387_fxsave_struct { - uint32_t fos; /* FPU Operand Selector */ - }; - }; -- uint32_t mxcsr; /* MXCSR Register State */ -+ uint32_t mxcsr; /* MXCSR Register State */ - uint32_t mxcsr_mask; /* MXCSR Mask */ - - /* 8*16 bytes for each FP-reg = 128 bytes */ -@@ -277,13 +277,13 @@ typedef struct { - } fpu_state_64_t; - - struct user_i387_ia32_struct { -- uint32_t cwd; /* FPU Control Word */ -- uint32_t swd; /* FPU Status Word */ -- uint32_t twd; /* FPU Tag Word */ -- uint32_t fip; /* FPU IP Offset */ -- uint32_t fcs; /* FPU IP Selector */ -- uint32_t foo; /* FPU Operand Pointer Offset */ -- uint32_t fos; /* FPU Operand Pointer Selector */ -+ uint32_t cwd; /* FPU Control Word */ -+ uint32_t swd; /* FPU Status Word */ -+ uint32_t twd; /* FPU Tag Word */ -+ uint32_t fip; /* FPU IP Offset */ -+ uint32_t fcs; /* FPU IP Selector */ -+ uint32_t foo; /* FPU Operand Pointer Offset */ -+ uint32_t fos; /* FPU Operand Pointer Selector */ - uint32_t st_space[20]; /* 8*10 bytes for each FP-reg = 80 bytes */ - }; - -diff --git a/compel/arch/x86/src/lib/infect.c b/compel/arch/x86/src/lib/infect.c -index 1e344bf3a..2f6c557d0 100644 ---- a/compel/arch/x86/src/lib/infect.c -+++ b/compel/arch/x86/src/lib/infect.c -@@ -34,12 +34,12 @@ - * Injected syscall instruction - */ - const char code_syscall[] = { -- 0x0f, 0x05, /* syscall */ -+ 0x0f, 0x05, /* syscall */ - 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc /* int 3, ... */ - }; - - const char code_int_80[] = { -- 0xcd, 0x80, /* int $0x80 */ -+ 0xcd, 0x80, /* int $0x80 */ - 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc /* int 3, ... */ - }; - -diff --git a/compel/include/infect-priv.h b/compel/include/infect-priv.h -index 1c03f4486..9d3442839 100644 ---- a/compel/include/infect-priv.h -+++ b/compel/include/infect-priv.h -@@ -38,7 +38,7 @@ struct parasite_ctl { - unsigned long parasite_ip; /* service routine start ip */ - - unsigned int *cmd; /* address for command */ -- void *args; /* address for arguments */ -+ void *args; /* address for arguments */ - unsigned long args_size; - int tsock; /* transport socket for transferring fds */ - -diff --git a/compel/include/rpc-pie-priv.h b/compel/include/rpc-pie-priv.h -index 2a239c613..5a6b337b2 100644 ---- a/compel/include/rpc-pie-priv.h -+++ b/compel/include/rpc-pie-priv.h -@@ -3,7 +3,7 @@ - struct ctl_msg { - uint32_t cmd; /* command itself */ - uint32_t ack; /* ack on command */ -- int32_t err; /* error code on reply */ -+ int32_t err; /* error code on reply */ - }; - - #define ctl_msg_cmd(_cmd) \ -diff --git a/compel/include/uapi/infect.h b/compel/include/uapi/infect.h -index c3d2ee6a6..7fa0bd8a0 100644 ---- a/compel/include/uapi/infect.h -+++ b/compel/include/uapi/infect.h -@@ -106,7 +106,7 @@ struct infect_ctx { - - unsigned long task_size; - unsigned long syscall_ip; /* entry point of infection */ -- unsigned long flags; /* fine-tune (e.g. faults) */ -+ unsigned long flags; /* fine-tune (e.g. faults) */ - - void (*child_handler)(int, siginfo_t *, void *); /* hander for SIGCHLD deaths */ - struct sigaction orig_handler; -diff --git a/compel/include/uapi/loglevels.h b/compel/include/uapi/loglevels.h -index e76c15657..7a49825d2 100644 ---- a/compel/include/uapi/loglevels.h -+++ b/compel/include/uapi/loglevels.h -@@ -7,10 +7,10 @@ - */ - - enum __compel_log_levels { -- COMPEL_LOG_MSG, /* Print message regardless of log level */ -+ COMPEL_LOG_MSG, /* Print message regardless of log level */ - COMPEL_LOG_ERROR, /* Errors only, when we're in trouble */ -- COMPEL_LOG_WARN, /* Warnings */ -- COMPEL_LOG_INFO, /* Informative, everything is fine */ -+ COMPEL_LOG_WARN, /* Warnings */ -+ COMPEL_LOG_INFO, /* Informative, everything is fine */ - COMPEL_LOG_DEBUG, /* Debug only */ - - COMPEL_DEFAULT_LOGLEVEL = COMPEL_LOG_WARN -diff --git a/compel/include/uapi/ptrace.h b/compel/include/uapi/ptrace.h -index c5291d20d..533e0569f 100644 ---- a/compel/include/uapi/ptrace.h -+++ b/compel/include/uapi/ptrace.h -@@ -62,7 +62,7 @@ - */ - typedef struct { - uint64_t filter_off; /* Input: which filter */ -- uint64_t flags; /* Output: filter's flags */ -+ uint64_t flags; /* Output: filter's flags */ - } seccomp_metadata_t; - - #ifdef PTRACE_EVENT_STOP -diff --git a/compel/src/lib/handle-elf.c b/compel/src/lib/handle-elf.c -index 9662751e0..22c8f2978 100644 ---- a/compel/src/lib/handle-elf.c -+++ b/compel/src/lib/handle-elf.c -@@ -554,7 +554,7 @@ int __handle_elf(void *mem, size_t size) - #endif /* ELF_PPC64 */ - - #ifdef ELF_X86_64 -- case R_X86_64_32: /* Symbol + Addend (4 bytes) */ -+ case R_X86_64_32: /* Symbol + Addend (4 bytes) */ - case R_X86_64_32S: /* Symbol + Addend (4 bytes) */ - pr_debug("\t\t\t\tR_X86_64_32 at 0x%-4lx val 0x%x\n", place, value32); - pr_out(" { .offset = 0x%-8x, .type = COMPEL_TYPE_INT, " -diff --git a/criu/arch/ppc64/restorer.c b/criu/arch/ppc64/restorer.c -index c17ba1669..56c09391e 100644 ---- a/criu/arch/ppc64/restorer.c -+++ b/criu/arch/ppc64/restorer.c -@@ -45,10 +45,10 @@ unsigned long sys_shmat(int shmid, const void *shmaddr, int shmflg) - unsigned long raddr; - int ret; - -- ret = sys_ipc(21 /*SHMAT */, shmid, /* first */ -- shmflg, /* second */ -+ ret = sys_ipc(21 /*SHMAT */, shmid, /* first */ -+ shmflg, /* second */ - (unsigned long)&raddr, /* third */ -- shmaddr, /* ptr */ -+ shmaddr, /* ptr */ - 0 /* fifth not used */); - - if (ret) -diff --git a/criu/arch/ppc64/vdso-pie.c b/criu/arch/ppc64/vdso-pie.c -index f01123efe..a84ae776b 100644 ---- a/criu/arch/ppc64/vdso-pie.c -+++ b/criu/arch/ppc64/vdso-pie.c -@@ -110,9 +110,9 @@ static inline void put_trampoline_call(unsigned long at, unsigned long to, unsig - { - uint32_t *addr = (uint32_t *)at; - -- *addr++ = 0x7C0802a6; /* mflr r0 */ -+ *addr++ = 0x7C0802a6; /* mflr r0 */ - *addr++ = 0x48000001 | ((long)(tr - at - 4) & 0x3fffffc); /* bl tr */ -- *(uint64_t *)addr = to; /* the address to read by the trampoline */ -+ *(uint64_t *)addr = to; /* the address to read by the trampoline */ - - invalidate_caches(at); - } -diff --git a/criu/arch/s390/restorer.c b/criu/arch/s390/restorer.c -index 6907ad75b..8b3bc44ba 100644 ---- a/criu/arch/s390/restorer.c -+++ b/criu/arch/s390/restorer.c -@@ -23,10 +23,10 @@ unsigned long sys_shmat(int shmid, const void *shmaddr, int shmflg) - unsigned long raddr; - int ret; - -- ret = sys_ipc(21 /*SHMAT */, shmid, /* first */ -- shmflg, /* second */ -+ ret = sys_ipc(21 /*SHMAT */, shmid, /* first */ -+ shmflg, /* second */ - (unsigned long)&raddr, /* third */ -- shmaddr, /* ptr */ -+ shmaddr, /* ptr */ - 0 /* fifth not used */); - - if (ret) -diff --git a/criu/arch/s390/vdso-pie.c b/criu/arch/s390/vdso-pie.c -index ad504beda..bf0366b0e 100644 ---- a/criu/arch/s390/vdso-pie.c -+++ b/criu/arch/s390/vdso-pie.c -@@ -18,9 +18,9 @@ - */ - typedef struct { - u8 larl[6]; /* Load relative address of imm64 */ -- u8 lg[6]; /* Load %r1 with imm64 */ -- u8 br[2]; /* Branch to %r1 */ -- u64 addr; /* Jump address */ -+ u8 lg[6]; /* Load %r1 with imm64 */ -+ u8 br[2]; /* Branch to %r1 */ -+ u64 addr; /* Jump address */ - u32 guards; /* Guard bytes */ - } __packed jmp_t; - -diff --git a/criu/arch/x86/include/asm/restorer.h b/criu/arch/x86/include/asm/restorer.h -index 23438314f..f7a6d5058 100644 ---- a/criu/arch/x86/include/asm/restorer.h -+++ b/criu/arch/x86/include/asm/restorer.h -@@ -13,7 +13,7 @@ - extern void restore_tls(tls_t *ptls); - extern int arch_compat_rt_sigaction(void *stack32, int sig, rt_sigaction_t_compat *act); - extern int set_compat_robust_list(uint32_t head_ptr, uint32_t len); --#else /* CONFIG_COMPAT */ -+#else /* CONFIG_COMPAT */ - static inline void restore_tls(tls_t *ptls) - { - } -diff --git a/criu/arch/x86/sigaction_compat.c b/criu/arch/x86/sigaction_compat.c -index f02b2cc0e..506a8d1bb 100644 ---- a/criu/arch/x86/sigaction_compat.c -+++ b/criu/arch/x86/sigaction_compat.c -@@ -44,8 +44,8 @@ int arch_compat_rt_sigaction(void *stack32, int sig, rt_sigaction_t_compat *act) - memcpy(stack32, act, sizeof(rt_sigaction_t_compat)); - arg.nr = __NR32_rt_sigaction; - arg.arg0 = sig; -- arg.arg1 = (uint32_t)act_stack; /* act */ -- arg.arg2 = 0; /* oldact */ -+ arg.arg1 = (uint32_t)act_stack; /* act */ -+ arg.arg2 = 0; /* oldact */ - arg.arg3 = (uint32_t)sizeof(act->rt_sa_mask); /* sigsetsize */ - - return do_full_int80(&arg); -diff --git a/criu/cgroup.c b/criu/cgroup.c -index ccac37fcc..82d9b16a2 100644 ---- a/criu/cgroup.c -+++ b/criu/cgroup.c -@@ -81,7 +81,7 @@ static bool cg_set_compare(struct cg_set *set, struct list_head *ctls, int what) - if (l2->next != ctls) - c2 = list_first_entry(l2, struct cg_ctl, l); - -- if (!c1 || !c2) /* Nowhere to move next */ -+ if (!c1 || !c2) /* Nowhere to move next */ - return !c1 && !c2; /* Both lists scanned -- match */ - - if (strcmp(c1->name, c2->name)) -@@ -860,7 +860,7 @@ static int dump_cg_dirs(struct list_head *dirs, size_t n_dirs, CgroupDirEntry ** - cde->dir_perms->gid = cur->gid; - - cde->dir_name = cur->path + poff; -- if (poff != 1) /* parent isn't "/" */ -+ if (poff != 1) /* parent isn't "/" */ - cde->dir_name++; /* leading / */ - cde->n_children = cur->n_children; - if (cur->n_children > 0) -diff --git a/criu/cr-check.c b/criu/cr-check.c -index 3e268c439..e46c93815 100644 ---- a/criu/cr-check.c -+++ b/criu/cr-check.c -@@ -1631,7 +1631,7 @@ void pr_check_features(const char *offset, const char *sep, int width) - } - pr_msg("%s", fl->name); // no \n - pos += len; -- if ((fl + 1)->name) { // not the last item -+ if ((fl + 1)->name) { // not the last item - pr_msg("%s", sep); // no \n - pos += sep_len; - } -diff --git a/criu/cr-dump.c b/criu/cr-dump.c -index 940f62246..ecc99f116 100644 ---- a/criu/cr-dump.c -+++ b/criu/cr-dump.c -@@ -615,7 +615,7 @@ static int dump_task_kobj_ids(struct pstree_item *item) - TaskKobjIdsEntry *ids = item->ids; - - elem.pid = pid; -- elem.idx = 0; /* really 0 for all */ -+ elem.idx = 0; /* really 0 for all */ - elem.genid = 0; /* FIXME optimize */ - - new = 0; -diff --git a/criu/files-reg.c b/criu/files-reg.c -index ee54d1d7d..e330466f6 100644 ---- a/criu/files-reg.c -+++ b/criu/files-reg.c -@@ -2236,8 +2236,8 @@ static struct filemap_ctx ctx; - void filemap_ctx_init(bool auto_close) - { - ctx.desc = NULL; /* to fail the first comparison in open_ */ -- ctx.fd = -1; /* not to close random fd in _fini */ -- ctx.vma = NULL; /* not to put spurious VMA_CLOSE in _fini */ -+ ctx.fd = -1; /* not to close random fd in _fini */ -+ ctx.vma = NULL; /* not to put spurious VMA_CLOSE in _fini */ - /* flags may remain any */ - ctx.close = auto_close; - } -diff --git a/criu/files.c b/criu/files.c -index 93754fb44..69ebc2e82 100644 ---- a/criu/files.c -+++ b/criu/files.c -@@ -506,7 +506,7 @@ static int dump_one_file(struct pid *pid, int fd, int lfd, struct fd_opts *opts, - } - - p.fd_ctl = ctl; /* Some dump_opts require this to talk to parasite */ -- p.dfds = dfds; /* epoll needs to verify if target fd exist */ -+ p.dfds = dfds; /* epoll needs to verify if target fd exist */ - - if (S_ISSOCK(p.stat.st_mode)) - return dump_socket(&p, lfd, e); -@@ -1486,7 +1486,7 @@ int shared_fdt_prepare(struct pstree_item *item) - struct inherit_fd { - struct list_head inh_list; - char *inh_id; /* file identifier */ -- int inh_fd; /* criu's descriptor to inherit */ -+ int inh_fd; /* criu's descriptor to inherit */ - int inh_fd_id; - }; - -diff --git a/criu/include/aio.h b/criu/include/aio.h -index f8a59dfdf..d1655739d 100644 ---- a/criu/include/aio.h -+++ b/criu/include/aio.h -@@ -13,8 +13,8 @@ struct task_restore_args; - int prepare_aios(struct pstree_item *t, struct task_restore_args *ta); - - struct aio_ring { -- unsigned id; /* kernel internal index number */ -- unsigned nr; /* number of io_events */ -+ unsigned id; /* kernel internal index number */ -+ unsigned nr; /* number of io_events */ - unsigned head; /* Written to by userland or under ring_lock - * mutex by aio_read_events_ring(). */ - unsigned tail; -diff --git a/criu/include/autofs.h b/criu/include/autofs.h -index c4e0f23ed..b158025c7 100644 ---- a/criu/include/autofs.h -+++ b/criu/include/autofs.h -@@ -96,7 +96,7 @@ struct args_ismountpoint { - struct autofs_dev_ioctl { - __u32 ver_major; - __u32 ver_minor; -- __u32 size; /* total size of data passed in -+ __u32 size; /* total size of data passed in - * including this struct */ - __s32 ioctlfd; /* automount command fd */ - -diff --git a/criu/include/bfd.h b/criu/include/bfd.h -index 4268f74d4..2846ec628 100644 ---- a/criu/include/bfd.h -+++ b/criu/include/bfd.h -@@ -5,8 +5,8 @@ - - struct bfd_buf; - struct xbuf { -- char *mem; /* buffer */ -- char *data; /* position we see bytes at */ -+ char *mem; /* buffer */ -+ char *data; /* position we see bytes at */ - unsigned int sz; /* bytes sitting after b->pos */ - struct bfd_buf *buf; - }; -diff --git a/criu/include/file-lock.h b/criu/include/file-lock.h -index 0ce2fa340..9ab79b66b 100644 ---- a/criu/include/file-lock.h -+++ b/criu/include/file-lock.h -@@ -30,12 +30,12 @@ - #define LOCK_SH 1 /* shared lock */ - #define LOCK_EX 2 /* exclusive lock */ - #define LOCK_NB \ -- 4 /* or'd with one of the above to prevent -+ 4 /* or'd with one of the above to prevent - blocking */ - #define LOCK_UN 8 /* remove lock */ - --#define LOCK_MAND 32 /* This is a mandatory flock ... */ --#define LOCK_READ 64 /* which allows concurrent read operations */ -+#define LOCK_MAND 32 /* This is a mandatory flock ... */ -+#define LOCK_READ 64 /* which allows concurrent read operations */ - #define LOCK_WRITE 128 /* which allows concurrent write operations */ - #define LOCK_RW 192 /* which allows concurrent read & write ops */ - -@@ -47,7 +47,7 @@ struct file_lock { - int fl_kind; - int fl_ltype; - -- pid_t fl_owner; /* process, which created the lock */ -+ pid_t fl_owner; /* process, which created the lock */ - pid_t fl_holder; /* pid of fd on whose the lock is found */ - int maj, min; - unsigned long i_no; -diff --git a/criu/include/files.h b/criu/include/files.h -index 26ce1f42a..aadc09f73 100644 ---- a/criu/include/files.h -+++ b/criu/include/files.h -@@ -82,8 +82,8 @@ enum { - - struct fdinfo_list_entry { - struct list_head desc_list; /* To chain on @fd_info_head */ -- struct file_desc *desc; /* Associated file descriptor */ -- struct list_head ps_list; /* To chain per-task files */ -+ struct file_desc *desc; /* Associated file descriptor */ -+ struct list_head ps_list; /* To chain per-task files */ - struct pstree_item *task; - FdinfoEntry *fe; - int pid; -diff --git a/criu/include/image-desc.h b/criu/include/image-desc.h -index 5045baee8..9f369be64 100644 ---- a/criu/include/image-desc.h -+++ b/criu/include/image-desc.h -@@ -122,8 +122,8 @@ enum { - /* file descriptors template */ - struct cr_fd_desc_tmpl { - const char *fmt; /* format for the name */ -- u32 magic; /* magic in the header */ -- int oflags; /* flags for image_open */ -+ u32 magic; /* magic in the header */ -+ int oflags; /* flags for image_open */ - }; - - extern struct cr_fd_desc_tmpl imgset_template[CR_FD_MAX]; -diff --git a/criu/include/inet_diag.h b/criu/include/inet_diag.h -index ea6f5e14e..4996dd556 100644 ---- a/criu/include/inet_diag.h -+++ b/criu/include/inet_diag.h -@@ -31,7 +31,7 @@ struct inet_diag_req_compat { - struct inet_diag_sockid id; - - __u32 idiag_states; /* States to dump */ -- __u32 idiag_dbs; /* Tables to dump (NI) */ -+ __u32 idiag_dbs; /* Tables to dump (NI) */ - }; - - struct inet_diag_req_v2 { -diff --git a/criu/include/kcmp.h b/criu/include/kcmp.h -index a6774be47..575135f80 100644 ---- a/criu/include/kcmp.h -+++ b/criu/include/kcmp.h -@@ -18,8 +18,8 @@ enum kcmp_type { - - /* Slot for KCMP_EPOLL_TFD */ - typedef struct { -- uint32_t efd; /* epoll file descriptor */ -- uint32_t tfd; /* target file number */ -+ uint32_t efd; /* epoll file descriptor */ -+ uint32_t tfd; /* target file number */ - uint32_t toff; /* target offset within same numbered sequence */ - } kcmp_epoll_slot_t; - -diff --git a/criu/include/kerndat.h b/criu/include/kerndat.h -index 2ded7d1da..a28a95802 100644 ---- a/criu/include/kerndat.h -+++ b/criu/include/kerndat.h -@@ -18,7 +18,7 @@ extern int kerndat_init(void); - - enum pagemap_func { - PM_UNKNOWN, -- PM_DISABLED, /* /proc/pid/pagemap doesn't open (user mode) */ -+ PM_DISABLED, /* /proc/pid/pagemap doesn't open (user mode) */ - PM_FLAGS_ONLY, /* pagemap zeroes pfn part (user mode) */ - PM_FULL, - }; -diff --git a/criu/include/linux/mount.h b/criu/include/linux/mount.h -index 840d6277e..9a3a28b10 100644 ---- a/criu/include/linux/mount.h -+++ b/criu/include/linux/mount.h -@@ -8,13 +8,13 @@ - #include - #else - enum fsconfig_command { -- FSCONFIG_SET_FLAG = 0, /* Set parameter, supplying no value */ -- FSCONFIG_SET_STRING = 1, /* Set parameter, supplying a string value */ -- FSCONFIG_SET_BINARY = 2, /* Set parameter, supplying a binary blob value */ -- FSCONFIG_SET_PATH = 3, /* Set parameter, supplying an object by path */ -- FSCONFIG_SET_PATH_EMPTY = 4, /* Set parameter, supplying an object by (empty) path */ -- FSCONFIG_SET_FD = 5, /* Set parameter, supplying an object by fd */ -- FSCONFIG_CMD_CREATE = 6, /* Invoke superblock creation */ -+ FSCONFIG_SET_FLAG = 0, /* Set parameter, supplying no value */ -+ FSCONFIG_SET_STRING = 1, /* Set parameter, supplying a string value */ -+ FSCONFIG_SET_BINARY = 2, /* Set parameter, supplying a binary blob value */ -+ FSCONFIG_SET_PATH = 3, /* Set parameter, supplying an object by path */ -+ FSCONFIG_SET_PATH_EMPTY = 4, /* Set parameter, supplying an object by (empty) path */ -+ FSCONFIG_SET_FD = 5, /* Set parameter, supplying an object by fd */ -+ FSCONFIG_CMD_CREATE = 6, /* Invoke superblock creation */ - FSCONFIG_CMD_RECONFIGURE = 7, /* Invoke superblock reconfiguration */ - }; - #endif -diff --git a/criu/include/mount.h b/criu/include/mount.h -index 29d80c2a7..833a75ca0 100644 ---- a/criu/include/mount.h -+++ b/criu/include/mount.h -@@ -72,13 +72,13 @@ struct mount_info { - struct list_head children; - struct list_head siblings; - -- struct list_head mnt_bind; /* circular list of derivatives of one real mount */ -- struct list_head mnt_share; /* circular list of shared mounts */ -+ struct list_head mnt_bind; /* circular list of derivatives of one real mount */ -+ struct list_head mnt_share; /* circular list of shared mounts */ - struct list_head mnt_slave_list; /* list of slave mounts */ -- struct list_head mnt_slave; /* slave list entry */ -- struct mount_info *mnt_master; /* slave is on master->mnt_slave_list */ -- struct list_head mnt_propagate; /* circular list of mounts which propagate from each other */ -- struct list_head mnt_notprop; /* temporary list used in can_mount_now */ -+ struct list_head mnt_slave; /* slave list entry */ -+ struct mount_info *mnt_master; /* slave is on master->mnt_slave_list */ -+ struct list_head mnt_propagate; /* circular list of mounts which propagate from each other */ -+ struct list_head mnt_notprop; /* temporary list used in can_mount_now */ - struct list_head mnt_unbindable; /* list of mounts with delayed unbindable */ - - struct list_head postpone; -diff --git a/criu/include/namespaces.h b/criu/include/namespaces.h -index 034605917..e2ea6e17f 100644 ---- a/criu/include/namespaces.h -+++ b/criu/include/namespaces.h -@@ -128,9 +128,9 @@ struct ns_id { - */ - union { - int nsfd_id; /* a namespace descriptor id in fdstore */ -- int ns_fd; /* a namespace file descriptor */ -+ int ns_fd; /* a namespace file descriptor */ - }; -- int nlsk; /* for sockets collection */ -+ int nlsk; /* for sockets collection */ - int seqsk; /* to talk to parasite daemons */ - struct list_head ids; - struct list_head links; -diff --git a/criu/include/page-pipe.h b/criu/include/page-pipe.h -index 0917869d9..15178c015 100644 ---- a/criu/include/page-pipe.h -+++ b/criu/include/page-pipe.h -@@ -90,14 +90,14 @@ struct kernel_pipe_buffer { - */ - - struct page_pipe_buf { -- int p[2]; /* pipe with pages */ -+ int p[2]; /* pipe with pages */ - unsigned int pipe_size; /* how many pages can be fit into pipe */ -- unsigned int pipe_off; /* where this buf is started in a pipe */ -- unsigned int pages_in; /* how many pages are there */ -- unsigned int nr_segs; /* how many iov-s are busy */ -+ unsigned int pipe_off; /* where this buf is started in a pipe */ -+ unsigned int pages_in; /* how many pages are there */ -+ unsigned int nr_segs; /* how many iov-s are busy */ - #define PPB_LAZY (1 << 0) - unsigned int flags; -- struct iovec *iov; /* vaddr:len map */ -+ struct iovec *iov; /* vaddr:len map */ - struct list_head l; /* links into page_pipe->bufs */ - }; - -@@ -113,19 +113,19 @@ struct page_pipe_buf { - #define PP_HOLE_PARENT (1 << 0) - - struct page_pipe { -- unsigned int nr_pipes; /* how many page_pipe_bufs in there */ -- struct list_head bufs; /* list of bufs */ -- struct list_head free_bufs; /* list of bufs */ -+ unsigned int nr_pipes; /* how many page_pipe_bufs in there */ -+ struct list_head bufs; /* list of bufs */ -+ struct list_head free_bufs; /* list of bufs */ - struct page_pipe_buf *prev[PP_PIPE_TYPES]; /* last ppb of each type for pipe sharing */ -- unsigned int nr_iovs; /* number of iovs */ -- unsigned int free_iov; /* first free iov */ -+ unsigned int nr_iovs; /* number of iovs */ -+ unsigned int free_iov; /* first free iov */ - - struct iovec *iovs; /* iovs. They are provided into create_page_pipe - and all bufs have their iov-s in there */ - -- unsigned int nr_holes; /* number of holes allocated */ -+ unsigned int nr_holes; /* number of holes allocated */ - unsigned int free_hole; /* number of holes in use */ -- struct iovec *holes; /* holes */ -+ struct iovec *holes; /* holes */ - unsigned int *hole_flags; - unsigned int flags; /* PP_FOO flags below */ - }; -diff --git a/criu/include/page-xfer.h b/criu/include/page-xfer.h -index e0303dfe0..1bcd4ff20 100644 ---- a/criu/include/page-xfer.h -+++ b/criu/include/page-xfer.h -@@ -36,7 +36,7 @@ struct page_xfer { - union { - struct /* local */ { - struct cr_img *pmi; /* pagemaps */ -- struct cr_img *pi; /* pages */ -+ struct cr_img *pi; /* pages */ - }; - - struct /* page-server */ { -diff --git a/criu/include/pagemap-cache.h b/criu/include/pagemap-cache.h -index 7612ee0f4..1d8bbffaf 100644 ---- a/criu/include/pagemap-cache.h -+++ b/criu/include/pagemap-cache.h -@@ -11,13 +11,13 @@ struct vma_area; - #define PAGEMAP_PFN_OFF(addr) (PAGE_PFN(addr) * sizeof(u64)) - - typedef struct { -- pid_t pid; /* which process it belongs */ -- unsigned long start; /* start of area */ -- unsigned long end; /* end of area */ -+ pid_t pid; /* which process it belongs */ -+ unsigned long start; /* start of area */ -+ unsigned long end; /* end of area */ - const struct list_head *vma_head; /* list head of VMAs we're serving */ -- u64 *map; /* local buffer */ -- size_t map_len; /* length of a buffer */ -- int fd; /* file to read PMs from */ -+ u64 *map; /* local buffer */ -+ size_t map_len; /* length of a buffer */ -+ int fd; /* file to read PMs from */ - } pmc_t; - - #define PMC_INIT \ -diff --git a/criu/include/pstree.h b/criu/include/pstree.h -index c5b0fa7ea..c1c79867b 100644 ---- a/criu/include/pstree.h -+++ b/criu/include/pstree.h -@@ -15,14 +15,14 @@ - struct pstree_item { - struct pstree_item *parent; - struct list_head children; /* list of my children */ -- struct list_head sibling; /* linkage in my parent's children list */ -+ struct list_head sibling; /* linkage in my parent's children list */ - - struct pid *pid; - pid_t pgid; - pid_t sid; - pid_t born_sid; - -- int nr_threads; /* number of threads */ -+ int nr_threads; /* number of threads */ - struct pid *threads; /* array of threads */ - CoreEntry **core; - TaskKobjIdsEntry *ids; -diff --git a/criu/include/restorer.h b/criu/include/restorer.h -index 934d60cf9..308a0b79b 100644 ---- a/criu/include/restorer.h -+++ b/criu/include/restorer.h -@@ -138,7 +138,7 @@ struct task_restore_args { - bool has_thp_enabled; - - /* threads restoration */ -- int nr_threads; /* number of threads */ -+ int nr_threads; /* number of threads */ - thread_restore_fcall_t clone_restore_fn; /* helper address for clone() call */ - struct thread_restore_args *thread_args; /* array of thread arguments */ - struct task_entries *task_entries; -@@ -211,7 +211,7 @@ struct task_restore_args { - bool can_map_vdso; - bool auto_dedup; - unsigned long vdso_rt_size; -- struct vdso_maps vdso_maps_rt; /* runtime vdso symbols */ -+ struct vdso_maps vdso_maps_rt; /* runtime vdso symbols */ - unsigned long vdso_rt_parked_at; /* safe place to keep vdso */ - void **breakpoint; - -diff --git a/criu/include/rst_info.h b/criu/include/rst_info.h -index 2e2107b0e..9664e0a1c 100644 ---- a/criu/include/rst_info.h -+++ b/criu/include/rst_info.h -@@ -17,7 +17,7 @@ struct task_entries { - }; - - struct fdt { -- int nr; /* How many tasks share this fd table */ -+ int nr; /* How many tasks share this fd table */ - pid_t pid; /* Who should restore this fd table */ - /* - * The fd table is ready for restoing, if fdt_lock is equal to nr -diff --git a/criu/include/servicefd.h b/criu/include/servicefd.h -index e75e8444c..c6979de7f 100644 ---- a/criu/include/servicefd.h -+++ b/criu/include/servicefd.h -@@ -22,10 +22,10 @@ enum sfd_type { - * - For dump -- target ns' proc - * - For restore -- CRIU ns' proc - */ -- ROOT_FD_OFF, /* Root of the namespace we dump/restore */ -+ ROOT_FD_OFF, /* Root of the namespace we dump/restore */ - CGROUP_YARD, -- USERNSD_SK, /* Socket for usernsd */ -- NS_FD_OFF, /* Node's net namespace fd */ -+ USERNSD_SK, /* Socket for usernsd */ -+ NS_FD_OFF, /* Node's net namespace fd */ - TRANSPORT_FD_OFF, /* to transfer file descriptors */ - RPC_SK_OFF, - FDSTORE_SK_OFF, -diff --git a/criu/include/sk-inet.h b/criu/include/sk-inet.h -index c832d6387..5dd2a6551 100644 ---- a/criu/include/sk-inet.h -+++ b/criu/include/sk-inet.h -@@ -35,7 +35,7 @@ struct inet_sk_desc { - unsigned int dst_port; - unsigned int state; - unsigned int rqlen; -- unsigned int wqlen; /* sent + unsent data */ -+ unsigned int wqlen; /* sent + unsent data */ - unsigned int uwqlen; /* unsent data */ - unsigned int src_addr[4]; - unsigned int dst_addr[4]; -diff --git a/criu/include/sysfs_parse.h b/criu/include/sysfs_parse.h -index ff0e61148..f987d622f 100644 ---- a/criu/include/sysfs_parse.h -+++ b/criu/include/sysfs_parse.h -@@ -2,9 +2,9 @@ - #define __CR_SYSFS_PARSE_H__ - - #define SYSFS_AUFS "/sys/fs/aufs/" --#define SBINFO_LEN (3 + 16 + 1) /* si_%lx */ -+#define SBINFO_LEN (3 + 16 + 1) /* si_%lx */ - #define SBINFO_PATH_LEN (sizeof SYSFS_AUFS + SBINFO_LEN) /* /sys/fs/aufs/ */ --#define AUFSBR_PATH_LEN (SBINFO_PATH_LEN + 6 + 1) /* /sys/fs/aufs//br%3d */ -+#define AUFSBR_PATH_LEN (SBINFO_PATH_LEN + 6 + 1) /* /sys/fs/aufs//br%3d */ - - struct mount_info; - struct vma_area; -diff --git a/criu/include/vma.h b/criu/include/vma.h -index ed9f31ef6..541d6d6fd 100644 ---- a/criu/include/vma.h -+++ b/criu/include/vma.h -@@ -10,14 +10,14 @@ - #include - - struct vm_area_list { -- struct list_head h; /* list of VMAs */ -- unsigned nr; /* nr of all VMAs in the list */ -+ struct list_head h; /* list of VMAs */ -+ unsigned nr; /* nr of all VMAs in the list */ - unsigned int nr_aios; /* nr of AIOs VMAs in the list */ - union { - unsigned long nr_priv_pages; /* dmp: nr of pages in private VMAs */ - unsigned long rst_priv_size; /* rst: size of private VMAs */ - }; -- unsigned long nr_priv_pages_longest; /* nr of pages in longest private VMA */ -+ unsigned long nr_priv_pages_longest; /* nr of pages in longest private VMA */ - unsigned long nr_shared_pages_longest; /* nr of pages in longest shared VMA */ - }; - -@@ -53,8 +53,8 @@ struct vma_area { - struct /* for restore */ { - int (*vm_open)(int pid, struct vma_area *vma); - struct file_desc *vmfd; -- struct vma_area *pvma; /* parent for inherited VMAs */ -- unsigned long *page_bitmap; /* existent pages */ -+ struct vma_area *pvma; /* parent for inherited VMAs */ -+ unsigned long *page_bitmap; /* existent pages */ - unsigned long premmaped_addr; /* restore only */ - - /* -diff --git a/criu/irmap.c b/criu/irmap.c -index 09570c593..7b9d77bc1 100644 ---- a/criu/irmap.c -+++ b/criu/irmap.c -@@ -160,8 +160,8 @@ static int irmap_update_dir(struct irmap *t) - - k = &t->kids[nr - 1]; - -- k->kids = NULL; /* for xrealloc above */ -- k->ino = 0; /* for irmap_update_stat */ -+ k->kids = NULL; /* for xrealloc above */ -+ k->ino = 0; /* for irmap_update_stat */ - k->nr_kids = -1; /* for irmap_update_dir */ - k->path = xsprintf("%s/%s", t->path, de->d_name); - if (!k->path) -diff --git a/criu/mount.c b/criu/mount.c -index ec31f02c2..93725e526 100644 ---- a/criu/mount.c -+++ b/criu/mount.c -@@ -2561,7 +2561,7 @@ static LIST_HEAD(mnt_remap_list); - static int remap_id; - - struct mnt_remap_entry { -- struct mount_info *mi; /* child is remaped into the root yards */ -+ struct mount_info *mi; /* child is remaped into the root yards */ - struct mount_info *parent; /* the origin parent for the child*/ - struct list_head node; - }; -diff --git a/criu/net.c b/criu/net.c -index 02115c4de..50655559d 100644 ---- a/criu/net.c -+++ b/criu/net.c -@@ -1172,7 +1172,7 @@ struct newlink_req { - * request. - */ - struct newlink_extras { -- int link; /* IFLA_LINK */ -+ int link; /* IFLA_LINK */ - int target_netns; /* IFLA_NET_NS_FD */ - }; - -@@ -1744,7 +1744,7 @@ static int __restore_link(struct ns_id *ns, struct net_link *link, int nlsk) - - switch (nde->type) { - case ND_TYPE__LOOPBACK: /* fallthrough */ -- case ND_TYPE__EXTLINK: /* see comment in images/netdev.proto */ -+ case ND_TYPE__EXTLINK: /* see comment in images/netdev.proto */ - return restore_link_parms(link, nlsk); - case ND_TYPE__VENET: - return restore_one_link(ns, link, nlsk, venet_link_info, NULL); -diff --git a/criu/pagemap.c b/criu/pagemap.c -index 77e519dd1..d996db7fc 100644 ---- a/criu/pagemap.c -+++ b/criu/pagemap.c -@@ -30,10 +30,10 @@ - * One "job" for the preadv() syscall in pagemap.c - */ - struct page_read_iov { -- off_t from; /* offset in pi file where to start reading from */ -- off_t end; /* the end of the read == sum to.iov_len -s */ -+ off_t from; /* offset in pi file where to start reading from */ -+ off_t end; /* the end of the read == sum to.iov_len -s */ - struct iovec *to; /* destination iovs */ -- unsigned int nr; /* their number */ -+ unsigned int nr; /* their number */ - - struct list_head l; - }; -diff --git a/criu/shmem.c b/criu/shmem.c -index bb48e436b..a9ee8d7eb 100644 ---- a/criu/shmem.c -+++ b/criu/shmem.c -@@ -81,7 +81,7 @@ struct shmem_info { - * an region. Each time when we found a process with a smaller pid, - * we reset self_count, so we can't have only one counter. - */ -- int count; /* the number of regions */ -+ int count; /* the number of regions */ - int self_count; /* the number of regions, which belongs to "pid" */ - }; - -diff --git a/criu/sk-unix.c b/criu/sk-unix.c -index f3fe60c6e..a819473b4 100644 ---- a/criu/sk-unix.c -+++ b/criu/sk-unix.c -@@ -958,9 +958,9 @@ struct unix_sk_info { - struct unix_sk_info *peer; - struct pprep_head peer_resolve; /* XXX : union with the above? */ - struct file_desc d; -- struct hlist_node hash; /* To lookup socket by ino */ -+ struct hlist_node hash; /* To lookup socket by ino */ - struct list_head connected; /* List of sockets, connected to me */ -- struct list_head node; /* To link in peer's connected list */ -+ struct list_head node; /* To link in peer's connected list */ - struct list_head scm_fles; - struct list_head ghost_node; - size_t ghost_dir_pos; -diff --git a/criu/uffd.c b/criu/uffd.c -index 18bdc040f..f01e6999b 100644 ---- a/criu/uffd.c -+++ b/criu/uffd.c -@@ -71,8 +71,8 @@ static mutex_t *lazy_sock_mutex; - - struct lazy_iov { - struct list_head l; -- unsigned long start; /* run-time start address, tracks remaps */ -- unsigned long end; /* run-time end address, tracks remaps */ -+ unsigned long start; /* run-time start address, tracks remaps */ -+ unsigned long end; /* run-time end address, tracks remaps */ - unsigned long img_start; /* start address at the dump time */ - }; - -diff --git a/criu/util.c b/criu/util.c -index 414879971..2917102fd 100644 ---- a/criu/util.c -+++ b/criu/util.c -@@ -1669,8 +1669,8 @@ __attribute__((returns_twice)) static pid_t raw_legacy_clone(unsigned long flags - */ - "addx %%g0, 0, %%g1" - : "=r"(g1), "=r"(o0), "=r"(o1), "=r"(o2) /* outputs */ -- : "r"(g1), "r"(o0), "r"(o1), "r"(o2) /* inputs */ -- : "%cc"); /* clobbers */ -+ : "r"(g1), "r"(o0), "r"(o1), "r"(o2) /* inputs */ -+ : "%cc"); /* clobbers */ - - is_error = g1; - retval = o0; -diff --git a/include/common/arch/ppc64/asm/bitops.h b/include/common/arch/ppc64/asm/bitops.h -index 704668263..dbfa6be7f 100644 ---- a/include/common/arch/ppc64/asm/bitops.h -+++ b/include/common/arch/ppc64/asm/bitops.h -@@ -196,7 +196,7 @@ static inline unsigned long find_next_bit(const unsigned long *addr, unsigned lo - - found_first: - tmp &= (~0UL >> (BITS_PER_LONG - size)); -- if (tmp == 0UL) /* Are any bits set? */ -+ if (tmp == 0UL) /* Are any bits set? */ - return result + size; /* Nope. */ - found_middle: - return result + __ffs(tmp); -diff --git a/include/common/arch/x86/asm/bitops.h b/include/common/arch/x86/asm/bitops.h -index d7a60589b..c13c1eb45 100644 ---- a/include/common/arch/x86/asm/bitops.h -+++ b/include/common/arch/x86/asm/bitops.h -@@ -113,7 +113,7 @@ static inline unsigned long find_next_bit(const unsigned long *addr, unsigned lo - - found_first: - tmp &= (~0UL >> (BITS_PER_LONG - size)); -- if (tmp == 0UL) /* Are any bits set? */ -+ if (tmp == 0UL) /* Are any bits set? */ - return result + size; /* Nope. */ - found_middle: - return result + __ffs(tmp); -diff --git a/include/common/asm-generic/bitops.h b/include/common/asm-generic/bitops.h -index 064ba4cc4..004da4c4e 100644 ---- a/include/common/asm-generic/bitops.h -+++ b/include/common/asm-generic/bitops.h -@@ -97,7 +97,7 @@ static inline unsigned long find_next_bit(const unsigned long *addr, unsigned lo - - found_first: - tmp &= (~0UL >> (BITS_PER_LONG - size)); -- if (tmp == 0UL) /* Are any bits set? */ -+ if (tmp == 0UL) /* Are any bits set? */ - return result + size; /* Nope. */ - found_middle: - return result + __ffs(tmp); -diff --git a/soccr/soccr.c b/soccr/soccr.c -index f6fb1946b..8be2d28e1 100644 ---- a/soccr/soccr.c -+++ b/soccr/soccr.c -@@ -609,8 +609,8 @@ static int send_fin(struct libsoccr_sk *sk, struct libsoccr_sk_data *data, unsig - libnet_type = LIBNET_RAW4; - - l = libnet_init(libnet_type, /* injection type */ -- NULL, /* network interface */ -- errbuf); /* errbuf */ -+ NULL, /* network interface */ -+ errbuf); /* errbuf */ - if (l == NULL) { - loge("libnet_init failed (%s)\n", errbuf); - return -1; -@@ -623,17 +623,17 @@ static int send_fin(struct libsoccr_sk *sk, struct libsoccr_sk_data *data, unsig - - ret = libnet_build_tcp(ntohs(sk->dst_addr->v4.sin_port), /* source port */ - ntohs(sk->src_addr->v4.sin_port), /* destination port */ -- data->inq_seq, /* sequence number */ -- data->outq_seq - data->outq_len, /* acknowledgement num */ -- flags, /* control flags */ -- data->rcv_wnd, /* window size */ -- 0, /* checksum */ -- 10, /* urgent pointer */ -- LIBNET_TCP_H + 20, /* TCP packet size */ -- NULL, /* payload */ -- 0, /* payload size */ -- l, /* libnet handle */ -- 0); /* libnet id */ -+ data->inq_seq, /* sequence number */ -+ data->outq_seq - data->outq_len, /* acknowledgement num */ -+ flags, /* control flags */ -+ data->rcv_wnd, /* window size */ -+ 0, /* checksum */ -+ 10, /* urgent pointer */ -+ LIBNET_TCP_H + 20, /* TCP packet size */ -+ NULL, /* payload */ -+ 0, /* payload size */ -+ l, /* libnet handle */ -+ 0); /* libnet id */ - if (ret == -1) { - loge("Can't build TCP header: %s\n", libnet_geterror(l)); - goto err; -@@ -646,28 +646,28 @@ static int send_fin(struct libsoccr_sk *sk, struct libsoccr_sk_data *data, unsig - memcpy(&src, &sk->src_addr->v6.sin6_addr, sizeof(src)); - - ret = libnet_build_ipv6(0, 0, LIBNET_TCP_H, /* length */ -- IPPROTO_TCP, /* protocol */ -- 64, /* hop limit */ -- dst, /* source IP */ -- src, /* destination IP */ -- NULL, /* payload */ -- 0, /* payload size */ -- l, /* libnet handle */ -- 0); /* libnet id */ -+ IPPROTO_TCP, /* protocol */ -+ 64, /* hop limit */ -+ dst, /* source IP */ -+ src, /* destination IP */ -+ NULL, /* payload */ -+ 0, /* payload size */ -+ l, /* libnet handle */ -+ 0); /* libnet id */ - } else if (family == AF_INET) - ret = libnet_build_ipv4(LIBNET_IPV4_H + LIBNET_TCP_H + 20, /* length */ -- 0, /* TOS */ -- 242, /* IP ID */ -- 0, /* IP Frag */ -- 64, /* TTL */ -- IPPROTO_TCP, /* protocol */ -- 0, /* checksum */ -- dst_v4, /* source IP */ -- src_v4, /* destination IP */ -- NULL, /* payload */ -- 0, /* payload size */ -- l, /* libnet handle */ -- 0); /* libnet id */ -+ 0, /* TOS */ -+ 242, /* IP ID */ -+ 0, /* IP Frag */ -+ 64, /* TTL */ -+ IPPROTO_TCP, /* protocol */ -+ 0, /* checksum */ -+ dst_v4, /* source IP */ -+ src_v4, /* destination IP */ -+ NULL, /* payload */ -+ 0, /* payload size */ -+ l, /* libnet handle */ -+ 0); /* libnet id */ - else { - loge("Unknown socket family\n"); - goto err; -diff --git a/soccr/soccr.h b/soccr/soccr.h -index 934d43827..e7091e591 100644 ---- a/soccr/soccr.h -+++ b/soccr/soccr.h -@@ -1,9 +1,9 @@ - #ifndef __LIBSOCCR_H__ - #define __LIBSOCCR_H__ --#include /* sockaddr_in, sockaddr_in6 */ -+#include /* sockaddr_in, sockaddr_in6 */ - #include /* TCP_REPAIR_WINDOW, TCP_TIMESTAMP */ --#include /* uint32_t */ --#include /* sockaddr */ -+#include /* uint32_t */ -+#include /* sockaddr */ - - #include "common/config.h" - -diff --git a/test/zdtm/static/aio01.c b/test/zdtm/static/aio01.c -index ed45192b9..100069b03 100644 ---- a/test/zdtm/static/aio01.c -+++ b/test/zdtm/static/aio01.c -@@ -14,8 +14,8 @@ const char *test_doc = "Check head and tail restore correct"; - const char *test_author = "Kirill Tkhai "; - - struct aio_ring { -- unsigned id; /* kernel internal index number */ -- unsigned nr; /* number of io_events */ -+ unsigned id; /* kernel internal index number */ -+ unsigned nr; /* number of io_events */ - unsigned head; /* Written to by userland or under ring_lock - * mutex by aio_read_events_ring(). */ - unsigned tail; -diff --git a/test/zdtm/static/auto_dev-ioctl.h b/test/zdtm/static/auto_dev-ioctl.h -index e65259b30..1b35fe2f7 100644 ---- a/test/zdtm/static/auto_dev-ioctl.h -+++ b/test/zdtm/static/auto_dev-ioctl.h -@@ -95,7 +95,7 @@ struct args_ismountpoint { - struct autofs_dev_ioctl { - __u32 ver_major; - __u32 ver_minor; -- __u32 size; /* total size of data passed in -+ __u32 size; /* total size of data passed in - * including this struct */ - __s32 ioctlfd; /* automount command fd */ - -diff --git a/test/zdtm/static/file_locks00.c b/test/zdtm/static/file_locks00.c -index 0b5d1313b..01782fa7a 100644 ---- a/test/zdtm/static/file_locks00.c -+++ b/test/zdtm/static/file_locks00.c -@@ -23,10 +23,10 @@ static int lock_reg(int fd, int cmd, int type, int whence, off_t offset, off_t l - { - struct flock lock; - -- lock.l_type = type; /* F_RDLCK, F_WRLCK, F_UNLCK */ -+ lock.l_type = type; /* F_RDLCK, F_WRLCK, F_UNLCK */ - lock.l_whence = whence; /* SEEK_SET, SEEK_CUR, SEEK_END */ -- lock.l_start = offset; /* byte offset, relative to l_whence */ -- lock.l_len = len; /* #bytes (0 means to EOF) */ -+ lock.l_start = offset; /* byte offset, relative to l_whence */ -+ lock.l_len = len; /* #bytes (0 means to EOF) */ - - errno = 0; - return fcntl(fd, cmd, &lock); -@@ -40,10 +40,10 @@ static int check_read_lock(int fd, int whence, off_t offset, off_t len) - struct flock lock; - int ret; - -- lock.l_type = F_RDLCK; /* F_RDLCK, F_WRLCK, F_UNLCK */ -+ lock.l_type = F_RDLCK; /* F_RDLCK, F_WRLCK, F_UNLCK */ - lock.l_whence = whence; /* SEEK_SET, SEEK_CUR, SEEK_END */ -- lock.l_start = offset; /* byte offset, relative to l_whence */ -- lock.l_len = len; /* #bytes (0 means to EOF) */ -+ lock.l_start = offset; /* byte offset, relative to l_whence */ -+ lock.l_len = len; /* #bytes (0 means to EOF) */ - lock.l_pid = -1; - - errno = 0; -@@ -69,10 +69,10 @@ static int check_write_lock(int fd, int whence, off_t offset, off_t len) - int ret; - pid_t ppid = getppid(); - -- lock.l_type = F_WRLCK; /* F_RDLCK, F_WRLCK, F_UNLCK */ -+ lock.l_type = F_WRLCK; /* F_RDLCK, F_WRLCK, F_UNLCK */ - lock.l_whence = whence; /* SEEK_SET, SEEK_CUR, SEEK_END */ -- lock.l_start = offset; /* byte offset, relative to l_whence */ -- lock.l_len = len; /* #bytes (0 means to EOF) */ -+ lock.l_start = offset; /* byte offset, relative to l_whence */ -+ lock.l_len = len; /* #bytes (0 means to EOF) */ - lock.l_pid = -1; - - errno = 0; -diff --git a/test/zdtm/static/ipc_namespace.c b/test/zdtm/static/ipc_namespace.c -index 4273951ae..b13b357ba 100644 ---- a/test/zdtm/static/ipc_namespace.c -+++ b/test/zdtm/static/ipc_namespace.c -@@ -52,10 +52,10 @@ struct ipc_ns { - - // unsigned int mq_queues_count; - -- unsigned int mq_queues_max; /* initialized to DFLT_QUEUESMAX */ -- unsigned int mq_msg_max; /* initialized to DFLT_MSGMAX */ -- unsigned int mq_msgsize_max; /* initialized to DFLT_MSGSIZEMAX */ -- unsigned int mq_msg_default; /* initialized to DFLT_MSG */ -+ unsigned int mq_queues_max; /* initialized to DFLT_QUEUESMAX */ -+ unsigned int mq_msg_max; /* initialized to DFLT_MSGMAX */ -+ unsigned int mq_msgsize_max; /* initialized to DFLT_MSGSIZEMAX */ -+ unsigned int mq_msg_default; /* initialized to DFLT_MSG */ - unsigned int mq_msgsize_default; /* initialized to DFLT_MSGSIZE */ - - struct user_ns *user_ns; -diff --git a/test/zdtm/static/netns-dev.c b/test/zdtm/static/netns-dev.c -index e220daa7f..1e6ee1dea 100644 ---- a/test/zdtm/static/netns-dev.c -+++ b/test/zdtm/static/netns-dev.c -@@ -55,36 +55,36 @@ struct range { - }; - - struct range rand_range4[] = { -- { 0, 1 }, /* accept_local */ -- { -1, 0 }, /* accept_source_route */ -- { 0, 1 }, /* arp_accept */ -- { 0, 2 }, /* arp_announce */ -- { 0, 1 }, /* arp_filter */ -- { 0, 8 }, /* arp_ignore */ -- { 0, 1 }, /* arp_notify */ -- { 0, 1 }, /* bootp_relay */ -- { 0, 1 }, /* disable_policy */ -- { 0, 1 }, /* disable_xfrm */ -- { 0, 1 }, /* drop_gratuitous_arp */ -- { 0, 1 }, /* drop_unicast_in_l2_multicast */ -- { 0, INT_MAX }, /* force_igmp_version */ -- { 0, 1 }, /* forwarding */ -- { 0, 1 }, /* accept_redirects */ -- { 0, INT_MAX }, /* igmpv2_unsolicited_report_interval */ -- { 0, INT_MAX }, /* igmpv3_unsolicited_report_interval */ -- { 0, 1 }, /* ignore_routes_with_linkdown */ -- { 0, 1 }, /* log_martians */ -- { 0, 1 }, /* mc_forwarding */ -- { -1, INT_MAX }, /* medium_id */ -- { 0, 1 }, /* promote_secondaries */ -- { 0, 1 }, /* proxy_arp */ -- { 0, 1 }, /* proxy_arp_pvlan */ -- { 0, 1 }, /* route_localnet */ -- { 0, 2 }, /* rp_filter */ -- { 0, 1 }, /* secure_redirects */ -- { 0, 1 }, /* send_redirects */ -- { 0, 1 }, /* shared_media */ -- { 0, 1 }, /* src_valid_mark */ -+ { 0, 1 }, /* accept_local */ -+ { -1, 0 }, /* accept_source_route */ -+ { 0, 1 }, /* arp_accept */ -+ { 0, 2 }, /* arp_announce */ -+ { 0, 1 }, /* arp_filter */ -+ { 0, 8 }, /* arp_ignore */ -+ { 0, 1 }, /* arp_notify */ -+ { 0, 1 }, /* bootp_relay */ -+ { 0, 1 }, /* disable_policy */ -+ { 0, 1 }, /* disable_xfrm */ -+ { 0, 1 }, /* drop_gratuitous_arp */ -+ { 0, 1 }, /* drop_unicast_in_l2_multicast */ -+ { 0, INT_MAX }, /* force_igmp_version */ -+ { 0, 1 }, /* forwarding */ -+ { 0, 1 }, /* accept_redirects */ -+ { 0, INT_MAX }, /* igmpv2_unsolicited_report_interval */ -+ { 0, INT_MAX }, /* igmpv3_unsolicited_report_interval */ -+ { 0, 1 }, /* ignore_routes_with_linkdown */ -+ { 0, 1 }, /* log_martians */ -+ { 0, 1 }, /* mc_forwarding */ -+ { -1, INT_MAX }, /* medium_id */ -+ { 0, 1 }, /* promote_secondaries */ -+ { 0, 1 }, /* proxy_arp */ -+ { 0, 1 }, /* proxy_arp_pvlan */ -+ { 0, 1 }, /* route_localnet */ -+ { 0, 2 }, /* rp_filter */ -+ { 0, 1 }, /* secure_redirects */ -+ { 0, 1 }, /* send_redirects */ -+ { 0, 1 }, /* shared_media */ -+ { 0, 1 }, /* src_valid_mark */ - { INT_MIN, INT_MAX }, /* tag */ - }; - -@@ -139,47 +139,47 @@ char *devconfs6[] = { - #define MAX_ADDRESSES 128 - - struct range rand_range6[] = { -- { 0, 2 }, /* accept_dad */ -- { 0, 2 }, /* accept_ra */ -- { 0, 1 }, /* accept_ra_defrtr */ -- { 0, 1 }, /* accept_ra_from_local */ -- { 0, INT_MAX }, /* accept_ra_min_hop_limit */ -- { 0, 1 }, /* accept_ra_mtu */ -- { 0, 1 }, /* accept_ra_pinfo */ -- { 0, INT_MAX }, /* accept_ra_rt_info_max_plen */ -- { 0, 1 }, /* accept_ra_rtr_pref */ -- { -1, 0 }, /* accept_source_route */ -- { 0, 1 }, /* autoconf */ -- { 0, INT_MAX }, /* dad_transmits */ -- { 0, 1 }, /* disable_ipv6 */ -- { 0, 1 }, /* drop_unicast_in_l2_multicast */ -- { 0, 1 }, /* drop_unsolicited_na */ -- { 0, 2 }, /* force_mld_version */ -- { 0, 1 }, /* force_tllao */ -- { 0, 1 }, /* forwarding */ -- { 0, 1 }, /* accept_redirects */ -- { 1, 255 }, /* hop_limit */ -- { 0, 1 }, /* ignore_routes_with_linkdown */ -- { -1, 1 }, /* keep_addr_on_down */ -- { 0, MAX_ADDRESSES }, /* max_addresses */ -- { 0, INT_MAX }, /* max_desync_factor */ -- { 0, INT_MAX }, /* mldv1_unsolicited_report_interval */ -- { 0, INT_MAX }, /* mldv2_unsolicited_report_interval */ -+ { 0, 2 }, /* accept_dad */ -+ { 0, 2 }, /* accept_ra */ -+ { 0, 1 }, /* accept_ra_defrtr */ -+ { 0, 1 }, /* accept_ra_from_local */ -+ { 0, INT_MAX }, /* accept_ra_min_hop_limit */ -+ { 0, 1 }, /* accept_ra_mtu */ -+ { 0, 1 }, /* accept_ra_pinfo */ -+ { 0, INT_MAX }, /* accept_ra_rt_info_max_plen */ -+ { 0, 1 }, /* accept_ra_rtr_pref */ -+ { -1, 0 }, /* accept_source_route */ -+ { 0, 1 }, /* autoconf */ -+ { 0, INT_MAX }, /* dad_transmits */ -+ { 0, 1 }, /* disable_ipv6 */ -+ { 0, 1 }, /* drop_unicast_in_l2_multicast */ -+ { 0, 1 }, /* drop_unsolicited_na */ -+ { 0, 2 }, /* force_mld_version */ -+ { 0, 1 }, /* force_tllao */ -+ { 0, 1 }, /* forwarding */ -+ { 0, 1 }, /* accept_redirects */ -+ { 1, 255 }, /* hop_limit */ -+ { 0, 1 }, /* ignore_routes_with_linkdown */ -+ { -1, 1 }, /* keep_addr_on_down */ -+ { 0, MAX_ADDRESSES }, /* max_addresses */ -+ { 0, INT_MAX }, /* max_desync_factor */ -+ { 0, INT_MAX }, /* mldv1_unsolicited_report_interval */ -+ { 0, INT_MAX }, /* mldv2_unsolicited_report_interval */ - { IPV6_MIN_MTU, IPV6_MIN_MTU }, /* mtu */ -- { 0, 1 }, /* ndisc_notify */ -- { 0, 1 }, /* optimistic_dad */ -- { 0, 1 }, /* proxy_ndp */ -- { 0, INT_MAX }, /* regen_max_retry */ -- { 0, ROUTER_MAX }, /* router_probe_interval */ -- { 0, ROUTER_MAX }, /* router_solicitation_delay */ -- { 0, ROUTER_MAX }, /* router_solicitation_interval */ -- { 0, ROUTER_MAX }, /* router_solicitations */ -- { 0, 1 }, /* suppress_frag_ndisc */ -- { 0, INT_MAX }, /* temp_prefered_lft */ -- { 0, INT_MAX }, /* temp_valid_lft */ -- { 0, 1 }, /* use_oif_addrs_only */ -- { 0, 1 }, /* use_optimistic */ -- { 0, 2 }, /* use_tempaddr */ -+ { 0, 1 }, /* ndisc_notify */ -+ { 0, 1 }, /* optimistic_dad */ -+ { 0, 1 }, /* proxy_ndp */ -+ { 0, INT_MAX }, /* regen_max_retry */ -+ { 0, ROUTER_MAX }, /* router_probe_interval */ -+ { 0, ROUTER_MAX }, /* router_solicitation_delay */ -+ { 0, ROUTER_MAX }, /* router_solicitation_interval */ -+ { 0, ROUTER_MAX }, /* router_solicitations */ -+ { 0, 1 }, /* suppress_frag_ndisc */ -+ { 0, INT_MAX }, /* temp_prefered_lft */ -+ { 0, INT_MAX }, /* temp_valid_lft */ -+ { 0, 1 }, /* use_oif_addrs_only */ -+ { 0, 1 }, /* use_optimistic */ -+ { 0, 2 }, /* use_tempaddr */ - }; - - struct test_conf { -diff --git a/test/zdtm/static/s390x_regs_check.c b/test/zdtm/static/s390x_regs_check.c -index 8d6b47997..40c480b3f 100644 ---- a/test/zdtm/static/s390x_regs_check.c -+++ b/test/zdtm/static/s390x_regs_check.c -@@ -59,11 +59,11 @@ static int pipefd[2]; - */ - struct reg_set { - const char *name; /* Name of regset */ -- int nr; /* Number of regset */ -- void *data; /* Test data */ -- int len; /* Number of bytes of test data */ -- bool optional; /* Not all kernels/machines have this reg set */ -- bool available; /* Current kernel/machine has this reg set */ -+ int nr; /* Number of regset */ -+ void *data; /* Test data */ -+ int len; /* Number of bytes of test data */ -+ bool optional; /* Not all kernels/machines have this reg set */ -+ bool available; /* Current kernel/machine has this reg set */ - }; - - /* -@@ -397,8 +397,8 @@ static inline void send_tid_and_loop(int fd) - - asm volatile("lgr 2,%0\n" /* Arg 1: fd */ - "la 3,%1\n" /* Arg 2: &tid */ -- "lghi 4,4\n" /* Arg 3: sizeof(int) */ -- "svc 4\n" /* __NR_write SVC: */ -+ "lghi 4,4\n" /* Arg 3: sizeof(int) */ -+ "svc 4\n" /* __NR_write SVC: */ - /* After SVC no more registers are changed */ - "0: j 0b\n" /* Loop here */ - : -diff --git a/test/zdtm/static/session01.c b/test/zdtm/static/session01.c -index 0f727a9a6..31a617de9 100644 ---- a/test/zdtm/static/session01.c -+++ b/test/zdtm/static/session01.c -@@ -40,22 +40,22 @@ enum { - static struct testcase *testcases; - static futex_t *fstate; - static struct testcase __testcases[] = { -- { 2, 1, 2, 1, 2, 1 }, /* session00 */ -- { 4, 2, 4, 2, 4, 1 }, /* |\_session00 */ -- { 15, 4, 4, 4, 15, 1 }, /* | |\_session00 */ -- { 16, 4, 4, 4, 15, 1 }, /* | \_session00 */ -- { 17, 4, 4, 4, 17, 0 }, /* | |\_session00 */ -- { 18, 4, 4, 4, 17, 1 }, /* | \_session00 */ -- { 5, 2, 2, 2, 2, 1 }, /* |\_session00 */ -- { 8, 2, 8, 2, 8, 1 }, /* |\_session00 */ -- { 9, 8, 2, 2, 2, 1 }, /* | \_session00 */ -- { 10, 2, 10, 2, 10, 1 }, /* |\_session00 */ -+ { 2, 1, 2, 1, 2, 1 }, /* session00 */ -+ { 4, 2, 4, 2, 4, 1 }, /* |\_session00 */ -+ { 15, 4, 4, 4, 15, 1 }, /* | |\_session00 */ -+ { 16, 4, 4, 4, 15, 1 }, /* | \_session00 */ -+ { 17, 4, 4, 4, 17, 0 }, /* | |\_session00 */ -+ { 18, 4, 4, 4, 17, 1 }, /* | \_session00 */ -+ { 5, 2, 2, 2, 2, 1 }, /* |\_session00 */ -+ { 8, 2, 8, 2, 8, 1 }, /* |\_session00 */ -+ { 9, 8, 2, 2, 2, 1 }, /* | \_session00 */ -+ { 10, 2, 10, 2, 10, 1 }, /* |\_session00 */ - { 11, 10, 11, 2, 11, 1 }, /* | \_session00 */ -- { 12, 11, 2, 2, 2, 1 }, /* | \_session00 */ -- { 13, 2, 2, 2, 2, 0 }, /* \_session00 */ -- { 3, 13, 2, 2, 2, 1 }, /* session00 */ -- { 6, 2, 6, 2, 6, 0 }, /* \_session00 */ -- { 14, 6, 6, 6, 6, 1 }, /* session00 */ -+ { 12, 11, 2, 2, 2, 1 }, /* | \_session00 */ -+ { 13, 2, 2, 2, 2, 0 }, /* \_session00 */ -+ { 3, 13, 2, 2, 2, 1 }, /* session00 */ -+ { 6, 2, 6, 2, 6, 0 }, /* \_session00 */ -+ { 14, 6, 6, 6, 6, 1 }, /* session00 */ - }; - - #define TESTS (sizeof(__testcases) / sizeof(struct testcase)) -diff --git a/test/zdtm/static/sigpending.c b/test/zdtm/static/sigpending.c -index 1641fdd86..ce03ff55c 100644 ---- a/test/zdtm/static/sigpending.c -+++ b/test/zdtm/static/sigpending.c -@@ -18,7 +18,7 @@ static int numsig; - #define TESTSIG (SIGRTMAX) - #define THREADSIG (SIGRTMIN) - static siginfo_t share_infos[2]; --static siginfo_t self_infos[64]; /* self */ -+static siginfo_t self_infos[64]; /* self */ - static siginfo_t thread_infos[3]; /* thread */ - static int share_nr; - static int self_nr; -diff --git a/test/zdtm/transition/ptrace.c b/test/zdtm/transition/ptrace.c -index bf6344f1c..ee10c8004 100644 ---- a/test/zdtm/transition/ptrace.c -+++ b/test/zdtm/transition/ptrace.c -@@ -31,7 +31,7 @@ int main(int argc, char **argv) - { - int pid, status, i, stopped; - #define PT_REGS_SIZE 4096 /* big enough for any arch */ --#define PT_REGS_ALIGN 16 /* big enough for any arch */ -+#define PT_REGS_ALIGN 16 /* big enough for any arch */ - char regs[PT_REGS_SIZE] __attribute__((aligned(PT_REGS_ALIGN))); - - int *pids; --- -2.35.1 - diff --git a/0038-cr-dump-fail-dumping-when-zombie-process-with-sid-0.patch b/0038-cr-dump-fail-dumping-when-zombie-process-with-sid-0.patch deleted file mode 100644 index 2c69846..0000000 --- a/0038-cr-dump-fail-dumping-when-zombie-process-with-sid-0.patch +++ /dev/null @@ -1,35 +0,0 @@ -From b03d50673e9159a712e86f7a9c75c5cabc09278d Mon Sep 17 00:00:00 2001 -From: Liu Hua -Date: Mon, 1 Nov 2021 20:50:58 +0800 -Subject: [PATCH 038/249] cr-dump: fail dumping when zombie process with sid 0 - -A zombie process with 0 sid has a session leader in -outer pidns and has ignored SIGHUP. Criu has no idea -to restore this type of process, so fail the dumpping. - -Signed-off-by: Liu Hua ---- - criu/cr-dump.c | 7 +++++++ - 1 file changed, 7 insertions(+) - -diff --git a/criu/cr-dump.c b/criu/cr-dump.c -index ecc99f116..c972e343a 100644 ---- a/criu/cr-dump.c -+++ b/criu/cr-dump.c -@@ -1129,6 +1129,13 @@ static int dump_zombies(void) - item->pgid = pps_buf.pgid; - - BUG_ON(!list_empty(&item->children)); -+ -+ if (!item->sid) { -+ pr_err("A session leader of zombie process %d(%d) is outside of its pid namespace\n", -+ item->pid->real, vpid(item)); -+ goto err; -+ } -+ - if (dump_one_zombie(item, &pps_buf) < 0) - goto err; - } --- -2.35.1 - diff --git a/0039-clang-format-make-x86_ins_capability_mask-human-read.patch b/0039-clang-format-make-x86_ins_capability_mask-human-read.patch deleted file mode 100644 index 1b326e7..0000000 --- a/0039-clang-format-make-x86_ins_capability_mask-human-read.patch +++ /dev/null @@ -1,176 +0,0 @@ -From cf56caeb12eb8900409846d2d3d9383cd210388d Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Fri, 29 Oct 2021 10:35:28 +0300 -Subject: [PATCH 039/249] clang-format: make x86_ins_capability_mask - human-readable - -There is no option in clang not to merge as much binary operands as it -fits in column limit, but here we need each bit on new line to make it -readable, so let's disable clang-format for x86_ins_capability_masks. - -Signed-off-by: Pavel Tikhomirov ---- - criu/arch/x86/cpu.c | 139 ++++++++++++++++++++++++++++---------------- - 1 file changed, 89 insertions(+), 50 deletions(-) - -diff --git a/criu/arch/x86/cpu.c b/criu/arch/x86/cpu.c -index d02f4abd5..b3a7ca636 100644 ---- a/criu/arch/x86/cpu.c -+++ b/criu/arch/x86/cpu.c -@@ -107,64 +107,103 @@ int cpu_dump_cpuinfo(void) - - #define __ins_bit(__l, __v) (1u << ((__v)-32u * (__l))) - -+// clang-format off - static uint32_t x86_ins_capability_mask[NCAPINTS] = { -- [CPUID_1_EDX] = __ins_bit(CPUID_1_EDX, X86_FEATURE_FPU) | __ins_bit(CPUID_1_EDX, X86_FEATURE_TSC) | -- __ins_bit(CPUID_1_EDX, X86_FEATURE_CX8) | __ins_bit(CPUID_1_EDX, X86_FEATURE_SEP) | -- __ins_bit(CPUID_1_EDX, X86_FEATURE_CMOV) | __ins_bit(CPUID_1_EDX, X86_FEATURE_CLFLUSH) | -- __ins_bit(CPUID_1_EDX, X86_FEATURE_MMX) | __ins_bit(CPUID_1_EDX, X86_FEATURE_FXSR) | -- __ins_bit(CPUID_1_EDX, X86_FEATURE_XMM) | __ins_bit(CPUID_1_EDX, X86_FEATURE_XMM2), -- -- [CPUID_8000_0001_EDX] = __ins_bit(CPUID_8000_0001_EDX, X86_FEATURE_SYSCALL) | -- __ins_bit(CPUID_8000_0001_EDX, X86_FEATURE_MMXEXT) | -- __ins_bit(CPUID_8000_0001_EDX, X86_FEATURE_RDTSCP) | -- __ins_bit(CPUID_8000_0001_EDX, X86_FEATURE_3DNOWEXT) | -- __ins_bit(CPUID_8000_0001_EDX, X86_FEATURE_3DNOW), -- -- [CPUID_LNX_1] = __ins_bit(CPUID_LNX_1, X86_FEATURE_REP_GOOD) | __ins_bit(CPUID_LNX_1, X86_FEATURE_NOPL), -- -- [CPUID_1_ECX] = __ins_bit(CPUID_1_ECX, X86_FEATURE_XMM3) | __ins_bit(CPUID_1_ECX, X86_FEATURE_PCLMULQDQ) | -- __ins_bit(CPUID_1_ECX, X86_FEATURE_MWAIT) | __ins_bit(CPUID_1_ECX, X86_FEATURE_SSSE3) | -- __ins_bit(CPUID_1_ECX, X86_FEATURE_CX16) | __ins_bit(CPUID_1_ECX, X86_FEATURE_XMM4_1) | -- __ins_bit(CPUID_1_ECX, X86_FEATURE_XMM4_2) | __ins_bit(CPUID_1_ECX, X86_FEATURE_MOVBE) | -- __ins_bit(CPUID_1_ECX, X86_FEATURE_POPCNT) | __ins_bit(CPUID_1_ECX, X86_FEATURE_AES) | -- __ins_bit(CPUID_1_ECX, X86_FEATURE_XSAVE) | __ins_bit(CPUID_1_ECX, X86_FEATURE_OSXSAVE) | -- __ins_bit(CPUID_1_ECX, X86_FEATURE_AVX) | __ins_bit(CPUID_1_ECX, X86_FEATURE_F16C) | -- __ins_bit(CPUID_1_ECX, X86_FEATURE_RDRAND), -+ [CPUID_1_EDX] = -+ __ins_bit(CPUID_1_EDX, X86_FEATURE_FPU) | -+ __ins_bit(CPUID_1_EDX, X86_FEATURE_TSC) | -+ __ins_bit(CPUID_1_EDX, X86_FEATURE_CX8) | -+ __ins_bit(CPUID_1_EDX, X86_FEATURE_SEP) | -+ __ins_bit(CPUID_1_EDX, X86_FEATURE_CMOV) | -+ __ins_bit(CPUID_1_EDX, X86_FEATURE_CLFLUSH) | -+ __ins_bit(CPUID_1_EDX, X86_FEATURE_MMX) | -+ __ins_bit(CPUID_1_EDX, X86_FEATURE_FXSR) | -+ __ins_bit(CPUID_1_EDX, X86_FEATURE_XMM) | -+ __ins_bit(CPUID_1_EDX, X86_FEATURE_XMM2), -+ -+ [CPUID_8000_0001_EDX] = -+ __ins_bit(CPUID_8000_0001_EDX, X86_FEATURE_SYSCALL) | -+ __ins_bit(CPUID_8000_0001_EDX, X86_FEATURE_MMXEXT) | -+ __ins_bit(CPUID_8000_0001_EDX, X86_FEATURE_RDTSCP) | -+ __ins_bit(CPUID_8000_0001_EDX, X86_FEATURE_3DNOWEXT) | -+ __ins_bit(CPUID_8000_0001_EDX, X86_FEATURE_3DNOW), -+ -+ [CPUID_LNX_1] = -+ __ins_bit(CPUID_LNX_1, X86_FEATURE_REP_GOOD) | -+ __ins_bit(CPUID_LNX_1, X86_FEATURE_NOPL), -+ -+ [CPUID_1_ECX] = -+ __ins_bit(CPUID_1_ECX, X86_FEATURE_XMM3) | -+ __ins_bit(CPUID_1_ECX, X86_FEATURE_PCLMULQDQ) | -+ __ins_bit(CPUID_1_ECX, X86_FEATURE_MWAIT) | -+ __ins_bit(CPUID_1_ECX, X86_FEATURE_SSSE3) | -+ __ins_bit(CPUID_1_ECX, X86_FEATURE_CX16) | -+ __ins_bit(CPUID_1_ECX, X86_FEATURE_XMM4_1) | -+ __ins_bit(CPUID_1_ECX, X86_FEATURE_XMM4_2) | -+ __ins_bit(CPUID_1_ECX, X86_FEATURE_MOVBE) | -+ __ins_bit(CPUID_1_ECX, X86_FEATURE_POPCNT) | -+ __ins_bit(CPUID_1_ECX, X86_FEATURE_AES) | -+ __ins_bit(CPUID_1_ECX, X86_FEATURE_XSAVE) | -+ __ins_bit(CPUID_1_ECX, X86_FEATURE_OSXSAVE) | -+ __ins_bit(CPUID_1_ECX, X86_FEATURE_AVX) | -+ __ins_bit(CPUID_1_ECX, X86_FEATURE_F16C) | -+ __ins_bit(CPUID_1_ECX, X86_FEATURE_RDRAND), - - [CPUID_8000_0001_ECX] = -- __ins_bit(CPUID_8000_0001_ECX, X86_FEATURE_ABM) | __ins_bit(CPUID_8000_0001_ECX, X86_FEATURE_SSE4A) | -- __ins_bit(CPUID_8000_0001_ECX, X86_FEATURE_MISALIGNSSE) | -- __ins_bit(CPUID_8000_0001_ECX, X86_FEATURE_3DNOWPREFETCH) | -- __ins_bit(CPUID_8000_0001_ECX, X86_FEATURE_XOP) | __ins_bit(CPUID_8000_0001_ECX, X86_FEATURE_FMA4) | -- __ins_bit(CPUID_8000_0001_ECX, X86_FEATURE_TBM), -+ __ins_bit(CPUID_8000_0001_ECX, X86_FEATURE_ABM) | -+ __ins_bit(CPUID_8000_0001_ECX, X86_FEATURE_SSE4A) | -+ __ins_bit(CPUID_8000_0001_ECX, X86_FEATURE_MISALIGNSSE) | -+ __ins_bit(CPUID_8000_0001_ECX, X86_FEATURE_3DNOWPREFETCH) | -+ __ins_bit(CPUID_8000_0001_ECX, X86_FEATURE_XOP) | -+ __ins_bit(CPUID_8000_0001_ECX, X86_FEATURE_FMA4) | -+ __ins_bit(CPUID_8000_0001_ECX, X86_FEATURE_TBM), - - [CPUID_7_0_EBX] = -- __ins_bit(CPUID_7_0_EBX, X86_FEATURE_FSGSBASE) | __ins_bit(CPUID_7_0_EBX, X86_FEATURE_BMI1) | -- __ins_bit(CPUID_7_0_EBX, X86_FEATURE_HLE) | __ins_bit(CPUID_7_0_EBX, X86_FEATURE_AVX2) | -- __ins_bit(CPUID_7_0_EBX, X86_FEATURE_BMI2) | __ins_bit(CPUID_7_0_EBX, X86_FEATURE_ERMS) | -- __ins_bit(CPUID_7_0_EBX, X86_FEATURE_RTM) | __ins_bit(CPUID_7_0_EBX, X86_FEATURE_MPX) | -- __ins_bit(CPUID_7_0_EBX, X86_FEATURE_AVX512F) | __ins_bit(CPUID_7_0_EBX, X86_FEATURE_AVX512DQ) | -- __ins_bit(CPUID_7_0_EBX, X86_FEATURE_RDSEED) | __ins_bit(CPUID_7_0_EBX, X86_FEATURE_ADX) | -- __ins_bit(CPUID_7_0_EBX, X86_FEATURE_CLFLUSHOPT) | __ins_bit(CPUID_7_0_EBX, X86_FEATURE_AVX512PF) | -- __ins_bit(CPUID_7_0_EBX, X86_FEATURE_AVX512ER) | __ins_bit(CPUID_7_0_EBX, X86_FEATURE_AVX512CD) | -- __ins_bit(CPUID_7_0_EBX, X86_FEATURE_SHA_NI) | __ins_bit(CPUID_7_0_EBX, X86_FEATURE_AVX512BW) | -- __ins_bit(CPUID_7_0_EBX, X86_FEATURE_AVX512VL), -- -- [CPUID_D_1_EAX] = __ins_bit(CPUID_D_1_EAX, X86_FEATURE_XSAVEOPT) | -- __ins_bit(CPUID_D_1_EAX, X86_FEATURE_XSAVEC) | __ins_bit(CPUID_D_1_EAX, X86_FEATURE_XGETBV1), -+ __ins_bit(CPUID_7_0_EBX, X86_FEATURE_FSGSBASE) | -+ __ins_bit(CPUID_7_0_EBX, X86_FEATURE_BMI1) | -+ __ins_bit(CPUID_7_0_EBX, X86_FEATURE_HLE) | -+ __ins_bit(CPUID_7_0_EBX, X86_FEATURE_AVX2) | -+ __ins_bit(CPUID_7_0_EBX, X86_FEATURE_BMI2) | -+ __ins_bit(CPUID_7_0_EBX, X86_FEATURE_ERMS) | -+ __ins_bit(CPUID_7_0_EBX, X86_FEATURE_RTM) | -+ __ins_bit(CPUID_7_0_EBX, X86_FEATURE_MPX) | -+ __ins_bit(CPUID_7_0_EBX, X86_FEATURE_AVX512F) | -+ __ins_bit(CPUID_7_0_EBX, X86_FEATURE_AVX512DQ) | -+ __ins_bit(CPUID_7_0_EBX, X86_FEATURE_RDSEED) | -+ __ins_bit(CPUID_7_0_EBX, X86_FEATURE_ADX) | -+ __ins_bit(CPUID_7_0_EBX, X86_FEATURE_CLFLUSHOPT) | -+ __ins_bit(CPUID_7_0_EBX, X86_FEATURE_AVX512PF) | -+ __ins_bit(CPUID_7_0_EBX, X86_FEATURE_AVX512ER) | -+ __ins_bit(CPUID_7_0_EBX, X86_FEATURE_AVX512CD) | -+ __ins_bit(CPUID_7_0_EBX, X86_FEATURE_SHA_NI) | -+ __ins_bit(CPUID_7_0_EBX, X86_FEATURE_AVX512BW) | -+ __ins_bit(CPUID_7_0_EBX, X86_FEATURE_AVX512VL), -+ -+ [CPUID_D_1_EAX] = -+ __ins_bit(CPUID_D_1_EAX, X86_FEATURE_XSAVEOPT) | -+ __ins_bit(CPUID_D_1_EAX, X86_FEATURE_XSAVEC) | -+ __ins_bit(CPUID_D_1_EAX, X86_FEATURE_XGETBV1), - - [CPUID_7_0_ECX] = -- __ins_bit(CPUID_7_0_ECX, X86_FEATURE_AVX512VBMI) | __ins_bit(CPUID_7_0_ECX, X86_FEATURE_AVX512_VBMI2) | -- __ins_bit(CPUID_7_0_ECX, X86_FEATURE_GFNI) | __ins_bit(CPUID_7_0_ECX, X86_FEATURE_VAES) | -- __ins_bit(CPUID_7_0_ECX, X86_FEATURE_VPCLMULQDQ) | __ins_bit(CPUID_7_0_ECX, X86_FEATURE_AVX512_VNNI) | -- __ins_bit(CPUID_7_0_ECX, X86_FEATURE_AVX512_BITALG) | __ins_bit(CPUID_7_0_ECX, X86_FEATURE_TME) | -- __ins_bit(CPUID_7_0_ECX, X86_FEATURE_AVX512_VPOPCNTDQ) | __ins_bit(CPUID_7_0_ECX, X86_FEATURE_RDPID), -- -- [CPUID_8000_0008_EBX] = __ins_bit(CPUID_8000_0008_EBX, X86_FEATURE_CLZERO), -- -- [CPUID_7_0_EDX] = __ins_bit(CPUID_7_0_EDX, X86_FEATURE_AVX512_4VNNIW) | -- __ins_bit(CPUID_7_0_EDX, X86_FEATURE_AVX512_4FMAPS), -+ __ins_bit(CPUID_7_0_ECX, X86_FEATURE_AVX512VBMI) | -+ __ins_bit(CPUID_7_0_ECX, X86_FEATURE_AVX512_VBMI2) | -+ __ins_bit(CPUID_7_0_ECX, X86_FEATURE_GFNI) | -+ __ins_bit(CPUID_7_0_ECX, X86_FEATURE_VAES) | -+ __ins_bit(CPUID_7_0_ECX, X86_FEATURE_VPCLMULQDQ) | -+ __ins_bit(CPUID_7_0_ECX, X86_FEATURE_AVX512_VNNI) | -+ __ins_bit(CPUID_7_0_ECX, X86_FEATURE_AVX512_BITALG) | -+ __ins_bit(CPUID_7_0_ECX, X86_FEATURE_TME) | -+ __ins_bit(CPUID_7_0_ECX, X86_FEATURE_AVX512_VPOPCNTDQ) | -+ __ins_bit(CPUID_7_0_ECX, X86_FEATURE_RDPID), -+ -+ [CPUID_8000_0008_EBX] = -+ __ins_bit(CPUID_8000_0008_EBX, X86_FEATURE_CLZERO), -+ -+ [CPUID_7_0_EDX] = -+ __ins_bit(CPUID_7_0_EDX, X86_FEATURE_AVX512_4VNNIW) | -+ __ins_bit(CPUID_7_0_EDX, X86_FEATURE_AVX512_4FMAPS), - }; -+// clang-format on - - #undef __ins_bit - --- -2.35.1 - diff --git a/0040-ci-disable-socket-raw-test-on-centos8.patch b/0040-ci-disable-socket-raw-test-on-centos8.patch deleted file mode 100644 index 48286df..0000000 --- a/0040-ci-disable-socket-raw-test-on-centos8.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 685364f9766498c2f6640dd7882434dd10cd5119 Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Fri, 19 Nov 2021 10:08:37 +0300 -Subject: [PATCH 040/249] ci: disable socket-raw test on centos8 - -We see error in centos8 ci on restore of socket-raw test: - - inet: \tRestore: family AF_INET type SOCK_RAW proto 66 - port 66 state TCP_CLOSE src_addr 0.0.0.0 - Error (criu/sk-inet.c:834): inet: Can't create inet socket: - Protocol not supported - -Centos 8 kernel replaces IPPROTO_MPTCP(262) with "in-kernel" value -IPPROTO_MPTCP_KERN(66) on inet_create(), but later shows this inkernel -value to criu when listing sockets info. Same code in inet_create() -returns EPROTONOSUPPORT on the attempr to create socket with -IPPROTO_MPTCP_KERN. So this ci error is completely rh8 kernel related. -Kernel should not show "in-kernel" value to userspace. But anyway this -is already changed in Centos 9 kernel, so we can just skip socket-raw -test on Centos 8. - -v2: use cirrus.yml - -Signed-off-by: Pavel Tikhomirov ---- - .cirrus.yml | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/.cirrus.yml b/.cirrus.yml -index 671178d8b..235b9821e 100644 ---- a/.cirrus.yml -+++ b/.cirrus.yml -@@ -47,7 +47,7 @@ task: - pip3 install junit_xml - - build_script: | -- make -C scripts/ci local SKIP_CI_PREP=1 CC=gcc CD_TO_TOP=1 -+ make -C scripts/ci local SKIP_CI_PREP=1 CC=gcc CD_TO_TOP=1 ZDTM_OPTS="-x zdtm/static/socket-raw" - - task: - name: CentOS 7 based test --- -2.35.1 - diff --git a/0041-zdtm.py-make-tests-with-link_remap-exclusive.patch b/0041-zdtm.py-make-tests-with-link_remap-exclusive.patch deleted file mode 100644 index 5fe396f..0000000 --- a/0041-zdtm.py-make-tests-with-link_remap-exclusive.patch +++ /dev/null @@ -1,60 +0,0 @@ -From ac4dcfc49b09e48e8b7cf6ffe25d6a717969ead2 Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Wed, 3 Nov 2021 18:34:11 +0300 -Subject: [PATCH 041/249] zdtm.py: make tests with --link_remap exclusive - -We see that tests mntns_ghost01 and unlink_fstat03 can run -simultaneousely and thus the former sees leftover link_remap.* files in -the test directory created by the latter, and the latter is still -running so it's ok to have link_remap.* at this point. - -Let's implicitly make all --link-remap tests exclusive (not running in -parallel). - -Fixes: #1633 - -Signed-off-by: Pavel Tikhomirov ---- - test/zdtm.py | 19 +++++++++++++++++-- - 1 file changed, 17 insertions(+), 2 deletions(-) - -diff --git a/test/zdtm.py b/test/zdtm.py -index fc7b8a183..b62136e96 100755 ---- a/test/zdtm.py -+++ b/test/zdtm.py -@@ -1997,7 +1997,22 @@ class Launcher: - raise Exception("The kernel is tainted: %r (%r)" % - (taint, self.__taint)) - -- if test_flag(desc, 'excl'): -+ ''' -+ The option --link-remap allows criu to hardlink open files back to the -+ file-system on dump (should be removed on restore) and we have a sanity -+ check in check_visible_state that they were actually removed at least -+ from the root test directory after restore. -+ -+ As zdtm runs all tests from the same cwd (e.g.: test/zdtm/static) in -+ parallel, hardlinks from one test can mess up with sanity checks of -+ another test or even one test can by mistake use hardlinks created by -+ another test which is even worse. -+ -+ So let's make all tests using --link-remap option non parallel. -+ ''' -+ link_remap_excl = '--link-remap' in desc.get('opts', '').split() + desc.get('dopts', '').split() + desc.get('ropts', '').split() -+ -+ if test_flag(desc, 'excl') or link_remap_excl: - self.wait_all() - - self.__nr += 1 -@@ -2030,7 +2045,7 @@ class Launcher: - "start": time.time() - } - -- if test_flag(desc, 'excl'): -+ if test_flag(desc, 'excl') or link_remap_excl: - self.wait() - - def __wait_one(self, flags): --- -2.35.1 - diff --git a/0042-tests-improve-the-deterministic-behavior-of-the-test.patch b/0042-tests-improve-the-deterministic-behavior-of-the-test.patch deleted file mode 100644 index 870820d..0000000 --- a/0042-tests-improve-the-deterministic-behavior-of-the-test.patch +++ /dev/null @@ -1,108 +0,0 @@ -From e9c9a39b7e5ad461d47ecebfd8d9ba0d1edd6aeb Mon Sep 17 00:00:00 2001 -From: Nicolas Viennot -Date: Fri, 29 Oct 2021 03:01:14 +0000 -Subject: [PATCH 042/249] tests: improve the deterministic behavior of the test - suite - -Various I/O objects are unclosed when the object falls out of scope. -This can lead to non-deterministic behavior. - -Also fixed a few missing list(). It doesn't play way with python3. -e.g., `random.shuffle(filter(...))` doesn't work. - -Signed-off-by: Nicolas Viennot ---- - test/zdtm.py | 25 +++++++++++++++---------- - 1 file changed, 15 insertions(+), 10 deletions(-) - -diff --git a/test/zdtm.py b/test/zdtm.py -index b62136e96..b98770079 100755 ---- a/test/zdtm.py -+++ b/test/zdtm.py -@@ -202,6 +202,8 @@ class ns_flavor: - - def __copy_libs(self, binary): - ldd = subprocess.Popen(["ldd", binary], stdout=subprocess.PIPE) -+ stdout, _ = ldd.communicate() -+ - xl = re.compile( - r'^(linux-gate.so|linux-vdso(64)?.so|not a dynamic|.*\s*ldd\s)') - -@@ -216,11 +218,9 @@ class ns_flavor: - map( - lambda x: str(x).strip(), - filter(lambda x: str(x).startswith('\t'), -- ldd.stdout.read().decode( -+ stdout.decode( - 'ascii').splitlines()))))) - -- ldd.wait() -- - for lib in libs: - if not os.access(lib, os.F_OK): - raise test_fail_exc("Can't find lib %s required by %s" % -@@ -331,8 +331,7 @@ def decode_flav(i): - - def tail(path): - p = subprocess.Popen(['tail', '-n1', path], stdout=subprocess.PIPE) -- out = p.stdout.readline() -- p.wait() -+ out, _ = p.communicate() - return out.decode() - - -@@ -801,7 +800,7 @@ class groups_test(zdtm_test): - if flavor.ns: - self.__real_name = name - with open(name) as fd: -- self.__subs = map(lambda x: x.strip(), fd.readlines()) -+ self.__subs = list(map(lambda x: x.strip(), fd.readlines())) - print("Subs:\n%s" % '\n'.join(self.__subs)) - else: - self.__real_name = '' -@@ -819,8 +818,8 @@ class groups_test(zdtm_test): - subprocess.check_call(s_args + [tname + '.cleanout']) - s = subprocess.Popen(s_args + ['--dry-run', tname + '.pid'], - stdout=subprocess.PIPE) -- cmd = s.stdout.readlines().pop().strip() -- s.wait() -+ out, _ = s.communicate() -+ cmd = out.decode().splitlines()[-1].strip() - - return 'cd /' + tdir + ' && ' + cmd - -@@ -2045,6 +2044,9 @@ class Launcher: - "start": time.time() - } - -+ if log: -+ log.close() -+ - if test_flag(desc, 'excl') or link_remap_excl: - self.wait() - -@@ -2068,6 +2070,9 @@ class Launcher: - self.__runtest += 1 - if pid != 0: - sub = self.__subs.pop(pid) -+ # The following wait() is not useful for our domain logic. -+ # It's useful for taming warnings in subprocess.Popen.__del__() -+ sub['sub'].wait() - tc = None - if self.__junit_test_cases is not None: - tc = TestCase(sub['name'], -@@ -2168,9 +2173,9 @@ def all_tests(opts): - continue - files.append(fp) - excl = list(map(lambda x: os.path.join(desc['dir'], x), desc['exclude'])) -- tlist = filter( -+ tlist = list(filter( - lambda x: not x.endswith('.checkskip') and not x.endswith('.hook') and -- x not in excl, map(lambda x: x.strip(), files)) -+ x not in excl, map(lambda x: x.strip(), files))) - return tlist - - --- -2.35.1 - diff --git a/0043-clang-format-zdtm-fix-clang-complains-about-strange-.patch b/0043-clang-format-zdtm-fix-clang-complains-about-strange-.patch deleted file mode 100644 index e6f2857..0000000 --- a/0043-clang-format-zdtm-fix-clang-complains-about-strange-.patch +++ /dev/null @@ -1,99 +0,0 @@ -From 044dd55e9585b9b2d1ac15e21cd6e6c08b4d8ee3 Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Tue, 23 Nov 2021 15:06:03 +0300 -Subject: [PATCH 043/249] clang-format/zdtm: fix clang complains about strange - elseifs - -Clang-format v13 on my Fedora 35 complains about these hunks, more over -reading the formating we had before is a pain: - -} else /* comment */ - if (smth) { - fail("") - return -1; -} - -Let's make explicit {} braces for else, this way it looks much better. - -Fixes: 93dd984ca ("Run 'make indent' on all C files") -Signed-off-by: Pavel Tikhomirov ---- - test/zdtm/static/mprotect00.c | 16 ++++++++++------ - test/zdtm/static/shm-mp.c | 16 ++++++++++------ - 2 files changed, 20 insertions(+), 12 deletions(-) - -diff --git a/test/zdtm/static/mprotect00.c b/test/zdtm/static/mprotect00.c -index 006b64772..717b7ddcf 100644 ---- a/test/zdtm/static/mprotect00.c -+++ b/test/zdtm/static/mprotect00.c -@@ -44,10 +44,12 @@ static int check_prot(char *ptr, int prot) - fail("PROT_READ bypassed"); - return -1; - } -- } else /* we come here on return from SIGSEGV handler */ -+ } else { -+ /* we come here on return from SIGSEGV handler */ - if (prot & PROT_READ) { -- fail("PROT_READ rejected"); -- return -1; -+ fail("PROT_READ rejected"); -+ return -1; -+ } - } - - if (!sigsetjmp(segv_ret, 1)) { -@@ -56,10 +58,12 @@ static int check_prot(char *ptr, int prot) - fail("PROT_WRITE bypassed"); - return -1; - } -- } else /* we come here on return from SIGSEGV handler */ -+ } else { -+ /* we come here on return from SIGSEGV handler */ - if (prot & PROT_WRITE) { -- fail("PROT_WRITE rejected"); -- return -1; -+ fail("PROT_WRITE rejected"); -+ return -1; -+ } - } - - if (signal(SIGSEGV, SIG_DFL) == SIG_ERR) { -diff --git a/test/zdtm/static/shm-mp.c b/test/zdtm/static/shm-mp.c -index 1929dac19..c95f3d84c 100644 ---- a/test/zdtm/static/shm-mp.c -+++ b/test/zdtm/static/shm-mp.c -@@ -33,10 +33,12 @@ static int check_prot(char *ptr, char val, int prot) - fail("PROT_READ bypassed"); - return -1; - } -- } else /* we come here on return from SIGSEGV handler */ -+ } else { -+ /* we come here on return from SIGSEGV handler */ - if (prot & PROT_READ) { -- fail("PROT_READ rejected"); -- return -1; -+ fail("PROT_READ rejected"); -+ return -1; -+ } - } - - if (!sigsetjmp(segv_ret, 1)) { -@@ -45,10 +47,12 @@ static int check_prot(char *ptr, char val, int prot) - fail("PROT_WRITE bypassed"); - return -1; - } -- } else /* we come here on return from SIGSEGV handler */ -+ } else { -+ /* we come here on return from SIGSEGV handler */ - if (prot & PROT_WRITE) { -- fail("PROT_WRITE rejected"); -- return -1; -+ fail("PROT_WRITE rejected"); -+ return -1; -+ } - } - - if (signal(SIGSEGV, SIG_DFL) == SIG_ERR) { --- -2.35.1 - diff --git a/0044-seize-restore-cgroup-freezer-to-right-state.patch b/0044-seize-restore-cgroup-freezer-to-right-state.patch deleted file mode 100644 index 4f0eae2..0000000 --- a/0044-seize-restore-cgroup-freezer-to-right-state.patch +++ /dev/null @@ -1,72 +0,0 @@ -From 716dba02dac88130918fd11628c81115a5bab586 Mon Sep 17 00:00:00 2001 -From: Liu Hua -Date: Fri, 5 Nov 2021 17:08:51 +0800 -Subject: [PATCH 044/249] seize: restore cgroup freezer to right state - -The new freezer_state is a complete equivalent of old freezer_thawed -except for the initial value. If old freezer_thawed was not initialized -it was 0 and in freezer_restore_state were threated as if we need to -freeze cgroup "back", thus before this patch if criu dump failed before -freezing dumpee, criu always freeze dumpee in cr_dump_finish which is -wrong. Switching to freezer_state initialized with FREEZER_ERROR fixes -the problem. - -v2: improve description, rename to origin_freezer_state - -Signed-off-by: Liu Hua ---- - criu/seize.c | 13 +++++++------ - 1 file changed, 7 insertions(+), 6 deletions(-) - -diff --git a/criu/seize.c b/criu/seize.c -index 95bf9ef0c..58564ca74 100644 ---- a/criu/seize.c -+++ b/criu/seize.c -@@ -131,11 +131,11 @@ static enum freezer_state get_freezer_state(int fd) - return get_freezer_v1_state(fd); - } - --static bool freezer_thawed; -+static enum freezer_state origin_freezer_state = FREEZER_ERROR; - - const char *get_real_freezer_state(void) - { -- return freezer_thawed ? thawed : frozen; -+ return origin_freezer_state == THAWED ? thawed : frozen; - } - - static int freezer_write_state(int fd, enum freezer_state new_state) -@@ -192,7 +192,7 @@ static int freezer_restore_state(void) - int fd; - int ret; - -- if (!opts.freeze_cgroup || freezer_thawed) -+ if (!opts.freeze_cgroup || origin_freezer_state != FROZEN) - return 0; - - fd = freezer_open(); -@@ -481,9 +481,10 @@ static int freeze_processes(void) - close(fd); - return -1; - } -- if (state == THAWED) { -- freezer_thawed = true; - -+ origin_freezer_state = state == FREEZING ? FROZEN : state; -+ -+ if (state == THAWED) { - if (freezer_write_state(fd, FROZEN)) { - close(fd); - return -1; -@@ -534,7 +535,7 @@ static int freeze_processes(void) - } - - err: -- if (exit_code == 0 || freezer_thawed) -+ if (exit_code == 0 || origin_freezer_state == THAWED) - exit_code = freezer_write_state(fd, THAWED); - - if (close(fd)) { --- -2.35.1 - diff --git a/0045-ci-Use-latest-Fedora-for-lint-ci-runs-again.patch b/0045-ci-Use-latest-Fedora-for-lint-ci-runs-again.patch deleted file mode 100644 index adde306..0000000 --- a/0045-ci-Use-latest-Fedora-for-lint-ci-runs-again.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 1b5cc130824dcbcef2467b7c513ace0dd6a41fe5 Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Wed, 24 Nov 2021 11:37:58 +0300 -Subject: [PATCH 045/249] ci: Use latest Fedora for lint ci runs again - -Now when we fixed clang-format complains in zdtm, let's switch to lates -clang-format available. This is effectively a revert of commit 07a2f0265 -("ci: use Fedora 34 for lint CI runs"). - -Signed-off-by: Pavel Tikhomirov ---- - .github/workflows/lint.yml | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml -index 49eb6aaac..50b241e9f 100644 ---- a/.github/workflows/lint.yml -+++ b/.github/workflows/lint.yml -@@ -6,7 +6,7 @@ jobs: - build: - runs-on: ubuntu-latest - container: -- image: registry.fedoraproject.org/fedora:34 -+ image: registry.fedoraproject.org/fedora:latest - steps: - - name: Install tools - run: sudo dnf -y install git make python3-flake8 ShellCheck clang-tools-extra which findutils --- -2.35.1 - diff --git a/0046-crtools-ignore-SIGPIPE-in-swrk-mode.patch b/0046-crtools-ignore-SIGPIPE-in-swrk-mode.patch deleted file mode 100644 index 5f621c9..0000000 --- a/0046-crtools-ignore-SIGPIPE-in-swrk-mode.patch +++ /dev/null @@ -1,72 +0,0 @@ -From da247673bf35506d48433627421c2d0192159b9c Mon Sep 17 00:00:00 2001 -From: Liu Hua -Date: Thu, 4 Nov 2021 10:04:22 +0800 -Subject: [PATCH 046/249] crtools: ignore SIGPIPE in swrk mode - -Criu ignores SIGPIPE in most cases except swrk mode. And in the -following situtation criu get killed by SIGPIPE and have no chance -to do cleanup: Connection to page server is lost when we do disk-less -migration, criu send PS_IOV_FLUSH via a broken connction in -disconnect_from_page_server. - -This patch let criu ignore SIGPIPE in all paths . - -Signed-off-by: Liu Hua ---- - criu/crtools.c | 33 ++++++++++++++++++--------------- - 1 file changed, 18 insertions(+), 15 deletions(-) - -diff --git a/criu/crtools.c b/criu/crtools.c -index 6a75cd1ea..81c0aa963 100644 ---- a/criu/crtools.c -+++ b/criu/crtools.c -@@ -106,6 +106,24 @@ int main(int argc, char *argv[], char *envp[]) - - log_set_loglevel(opts.log_level); - -+ /* -+ * There kernel might send us lethal signals in the following cases: -+ * 1) Writing a pipe which reader has disappeared. -+ * 2) Writing to a socket of type SOCK_STREAM which is no longer connected. -+ * We deal with write()/Send() failures on our own, and prefer not to get killed. -+ * So we ignore SIGPIPEs. -+ * -+ * Pipes are used in various places: -+ * 1) Receiving application page data -+ * 2) Transmitting data to the image streamer -+ * 3) Emitting logs (potentially to a pipe). -+ * Sockets are mainly used in transmitting memory data. -+ */ -+ if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) { -+ pr_perror("Failed to set a SIGPIPE signal ignore."); -+ return 1; -+ } -+ - if (optind < argc && !strcmp(argv[optind], "swrk")) { - if (argc != optind + 2) { - fprintf(stderr, "Usage: criu swrk \n"); -@@ -175,21 +193,6 @@ int main(int argc, char *argv[], char *envp[]) - } - } - -- /* -- * The kernel might send us lethal signals when writing to a pipe -- * which reader has disappeared. We deal with write() failures on our -- * own, and prefer not to get killed. So we ignore SIGPIPEs. -- * -- * Pipes are used in various places: -- * 1) Receiving application page data -- * 2) Transmitting data to the image streamer -- * 3) Emitting logs (potentially to a pipe). -- */ -- if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) { -- pr_perror("Failed to set a SIGPIPE signal ignore."); -- return 1; -- } -- - /* - * When a process group becomes an orphan, - * its processes are sent a SIGHUP signal --- -2.35.1 - diff --git a/0047-ci-switch-to-centos-stream-8.patch b/0047-ci-switch-to-centos-stream-8.patch deleted file mode 100644 index 4bc5488..0000000 --- a/0047-ci-switch-to-centos-stream-8.patch +++ /dev/null @@ -1,29 +0,0 @@ -From ecfef3dc95bd1293084916ff2c40250a4442796c Mon Sep 17 00:00:00 2001 -From: Adrian Reber -Date: Wed, 24 Nov 2021 16:13:01 +0000 -Subject: [PATCH 047/249] ci: switch to centos-stream-8 - -CentOS 8 goes EOL at the end of 2021. This switches our CentOS 8 based -tests to CentOS Stream 8 which should be supported until 2024. - -Signed-off-by: Adrian Reber ---- - .cirrus.yml | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/.cirrus.yml b/.cirrus.yml -index 235b9821e..ef0de54e9 100644 ---- a/.cirrus.yml -+++ b/.cirrus.yml -@@ -27,7 +27,7 @@ task: - - compute_engine_instance: - image_project: centos-cloud -- image: family/centos-8 -+ image: family/centos-stream-8 - platform: linux - cpu: 4 - memory: 8G --- -2.35.1 - diff --git a/0048-check-cleanup-child-processes.patch b/0048-check-cleanup-child-processes.patch deleted file mode 100644 index 2adda17..0000000 --- a/0048-check-cleanup-child-processes.patch +++ /dev/null @@ -1,68 +0,0 @@ -From 9e074610d7bc702b9220095691e4d138b0c0df09 Mon Sep 17 00:00:00 2001 -From: Nicolas Viennot -Date: Fri, 19 Nov 2021 20:58:13 +0000 -Subject: [PATCH 048/249] check: cleanup child processes - -Always wait() for forked child processes. It avoid zombie processes in -containers that don't have an init process reaping orphans. - -Signed-off-by: Nicolas Viennot ---- - criu/cr-check.c | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/criu/cr-check.c b/criu/cr-check.c -index e46c93815..0320b445a 100644 ---- a/criu/cr-check.c -+++ b/criu/cr-check.c -@@ -575,6 +575,7 @@ static pid_t fork_and_ptrace_attach(int (*child_setup)(void)) - if (read(sk, &c, 1) != 1) { - close(sk); - kill(pid, SIGKILL); -+ waitpid(pid, NULL, 0); - pr_perror("read"); - return -1; - } -@@ -584,6 +585,7 @@ static pid_t fork_and_ptrace_attach(int (*child_setup)(void)) - if (ptrace(PTRACE_ATTACH, pid, NULL, NULL) == -1) { - pr_perror("Unable to ptrace the child"); - kill(pid, SIGKILL); -+ waitpid(pid, NULL, 0); - return -1; - } - -@@ -618,6 +620,7 @@ static int check_ptrace_peeksiginfo(void) - } - - kill(pid, SIGKILL); -+ waitpid(pid, NULL, 0); - return ret; - } - -@@ -768,6 +771,7 @@ static int check_special_mapping_mremap(void) - /* Probably, we're interrupted with a signal - cleanup */ - pr_err("Failed to wait for a child %d\n", errno); - kill(child, SIGKILL); -+ waitpid(child, NULL, 0); - return -1; - } - -@@ -806,6 +810,7 @@ static int check_ptrace_suspend_seccomp(void) - } - - kill(pid, SIGKILL); -+ waitpid(pid, NULL, 0); - return ret; - } - -@@ -846,6 +851,7 @@ static int check_ptrace_dump_seccomp_filters(void) - } - - kill(pid, SIGKILL); -+ waitpid(pid, NULL, 0); - return ret; - } - --- -2.35.1 - diff --git a/0049-files-reg-fix-error-handling-in-open_path.patch b/0049-files-reg-fix-error-handling-in-open_path.patch deleted file mode 100644 index acfc56f..0000000 --- a/0049-files-reg-fix-error-handling-in-open_path.patch +++ /dev/null @@ -1,156 +0,0 @@ -From e1485b8d58c4927f7cbd1ee0383c7d7f8580bade Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Thu, 13 Feb 2020 10:43:14 +0300 -Subject: [PATCH 049/249] files-reg: fix error handling in open_path - -1) On error paths need to close fd and unlock mutex. -2) Make rfi_remap return special return code to identify EEXIST from - linkat_hard, all other errors should be reported up. -3) Report unlinkat error as criu should not corrupt fs. - -Cherry-picked from Virtuozzo criu: -https://src.openvz.org/projects/OVZ/repos/criu/commits/fe1d0be14 - -Changes: use close_safe(), fix order in "Fake %s -> %s link" error -message. - -Signed-off-by: Pavel Tikhomirov ---- - criu/files-reg.c | 47 +++++++++++++++++++++++++++++++---------------- - 1 file changed, 31 insertions(+), 16 deletions(-) - -diff --git a/criu/files-reg.c b/criu/files-reg.c -index e330466f6..96ec82c73 100644 ---- a/criu/files-reg.c -+++ b/criu/files-reg.c -@@ -1867,6 +1867,9 @@ out: - * This routine properly resolves d's path handling ghost/link-remaps. - * The open_cb is a routine that does actual open, it differs for - * files, directories, fifos, etc. -+ * -+ * Return 0 on success, -1 on error and 1 to indicate soft error, which can be -+ * retried. - */ - - static int rfi_remap(struct reg_file_info *rfi, int *level) -@@ -1932,6 +1935,8 @@ out_root: - int errno_saved = errno; - rm_parent_dirs(mntns_root, path, *level); - errno = errno_saved; -+ if (errno == EEXIST) -+ return 1; - return -1; - } - -@@ -2008,11 +2013,12 @@ static bool validate_file(const int fd, const struct stat *fd_status, const stru - - int open_path(struct file_desc *d, int (*open_cb)(int mntns_root, struct reg_file_info *, void *), void *arg) - { -- int tmp, mntns_root, level = 0; -+ int tmp = -1, mntns_root, level = 0; - struct reg_file_info *rfi; - char *orig_path = NULL; - char path[PATH_MAX]; - int inh_fd = -1; -+ int ret; - - if (inherited_fd(d, &tmp)) - return tmp; -@@ -2049,14 +2055,9 @@ int open_path(struct file_desc *d, int (*open_cb)(int mntns_root, struct reg_fil - */ - orig_path = rfi->path; - rfi->path = rfi->remap->rpath; -- } else if (rfi_remap(rfi, &level) < 0) { -+ } else if ((ret = rfi_remap(rfi, &level)) == 1) { - static char tmp_path[PATH_MAX]; - -- if (errno != EEXIST) { -- pr_perror("Can't link %s -> %s", rfi->remap->rpath, rfi->path); -- return -1; -- } -- - /* - * The file whose name we're trying to create - * exists. Need to pick some other one, we're -@@ -2070,12 +2071,15 @@ int open_path(struct file_desc *d, int (*open_cb)(int mntns_root, struct reg_fil - orig_path = rfi->path; - rfi->path = tmp_path; - snprintf(tmp_path, sizeof(tmp_path), "%s.cr_link", orig_path); -- pr_debug("Fake %s -> %s link\n", rfi->path, rfi->remap->rpath); -+ pr_debug("Fake %s -> %s link\n", rfi->remap->rpath, rfi->path); - -- if (rfi_remap(rfi, &level) < 0) { -+ if (rfi_remap(rfi, &level)) { - pr_perror("Can't create even fake link!"); -- return -1; -+ goto err; - } -+ } else if (ret < 0) { -+ pr_perror("Can't link %s -> %s", rfi->remap->rpath, rfi->path); -+ goto err; - } - } - -@@ -2085,7 +2089,7 @@ ext: - if (tmp < 0) { - pr_perror("Can't open file %s", rfi->path); - close_safe(&inh_fd); -- return -1; -+ goto err; - } - close_safe(&inh_fd); - -@@ -2094,15 +2098,15 @@ ext: - - if (fstat(tmp, &st) < 0) { - pr_perror("Can't fstat opened file"); -- return -1; -+ goto err; - } - - if (!validate_file(tmp, &st, rfi)) -- return -1; -+ goto err; - - if (rfi->rfe->has_mode && (st.st_mode != rfi->rfe->mode)) { - pr_err("File %s has bad mode 0%o (expect 0%o)\n", rfi->path, (int)st.st_mode, rfi->rfe->mode); -- return -1; -+ goto err; - } - - /* -@@ -2115,7 +2119,11 @@ ext: - - if (rfi->remap) { - if (!rfi->remap->is_dir) { -- unlinkat(mntns_root, rfi->path, 0); -+ pr_debug("Unlink: %d:%s\n", rfi->rfe->mnt_id, rfi->path); -+ if (unlinkat(mntns_root, rfi->path, 0)) { -+ pr_perror("Failed to unlink the remap file"); -+ goto err; -+ } - rm_parent_dirs(mntns_root, rfi->path, level); - } - -@@ -2124,10 +2132,17 @@ ext: - if (orig_path) - rfi->path = orig_path; - -- if (restore_fown(tmp, rfi->rfe->fown)) -+ if (restore_fown(tmp, rfi->rfe->fown)) { -+ close(tmp); - return -1; -+ } - - return tmp; -+err: -+ if (rfi->remap) -+ mutex_unlock(remap_open_lock); -+ close_safe(&tmp); -+ return -1; - } - - int do_open_reg_noseek_flags(int ns_root_fd, struct reg_file_info *rfi, void *arg) --- -2.35.1 - diff --git a/0050-files-reg-fix-error-handling-of-rm_parent_dirs.patch b/0050-files-reg-fix-error-handling-of-rm_parent_dirs.patch deleted file mode 100644 index 8880742..0000000 --- a/0050-files-reg-fix-error-handling-of-rm_parent_dirs.patch +++ /dev/null @@ -1,116 +0,0 @@ -From e7c9c5c08d4289962d56ec74bb4b554f5ed42f7e Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Thu, 13 Feb 2020 13:03:12 +0300 -Subject: [PATCH 050/249] files-reg: fix error handling of rm_parent_dirs - -If unlinkat fails it means that fs is in "corrupted" state - spoiled -with non-unlinked auxiliary directories. - -While on it add fixme note as this function can be racy and BUG_ON if -path contains double slashes. - -Cherry-picked from Virtuozzo criu: -https://src.openvz.org/projects/OVZ/repos/criu/commits/b7b4e69fd - -Changes: simplify while loop condition, remove confusing FIXME, remove -excess !count check in favour of while loop condition check - -Signed-off-by: Pavel Tikhomirov ---- - criu/files-reg.c | 45 ++++++++++++++++++++++++++++++--------------- - 1 file changed, 30 insertions(+), 15 deletions(-) - -diff --git a/criu/files-reg.c b/criu/files-reg.c -index 96ec82c73..6a2ea2fe4 100644 ---- a/criu/files-reg.c -+++ b/criu/files-reg.c -@@ -1792,30 +1792,42 @@ out: - return ret; - } - --static void rm_parent_dirs(int mntns_root, char *path, int count) -+static int rm_parent_dirs(int mntns_root, char *path, int count) - { - char *p, *prev = NULL; -+ int ret = -1; - -- if (!count) -- return; -- -- while (count > 0) { -- count -= 1; -+ while (count-- > 0) { - p = strrchr(path, '/'); -- if (p) -+ if (p) { -+ /* We don't handle "//" in path */ -+ BUG_ON(prev && (prev - p == 1)); - *p = '\0'; -+ } else { -+ /* Inconsistent path and count */ -+ pr_perror("Can't strrchr \"/\" in \"%s\"/\"%s\"]" -+ " left count=%d\n", -+ path, prev ? prev + 1 : "", count + 1); -+ goto err; -+ } -+ - if (prev) - *prev = '/'; -+ prev = p; - -- if (unlinkat(mntns_root, path, AT_REMOVEDIR)) -+ if (unlinkat(mntns_root, path, AT_REMOVEDIR)) { - pr_perror("Can't remove %s AT %d", path, mntns_root); -- else -- pr_debug("Unlinked parent dir: %s AT %d\n", path, mntns_root); -- prev = p; -+ goto err; -+ } -+ pr_debug("Unlinked parent dir: %s AT %d\n", path, mntns_root); - } - -+ ret = 0; -+err: - if (prev) - *prev = '/'; -+ -+ return ret; - } - - /* Construct parent dir name and mkdir parent/grandparents if they're not exist */ -@@ -1847,6 +1859,7 @@ static int make_parent_dirs_if_need(int mntns_root, char *path) - err = mkdirat(mntns_root, path, 0777); - if (err && errno != EEXIST) { - pr_perror("Can't create dir: %s AT %d", path, mntns_root); -+ /* Failing anyway -> no retcode check */ - rm_parent_dirs(mntns_root, path, count); - count = -1; - goto out; -@@ -1933,10 +1946,11 @@ out_root: - - if (linkat_hard(mntns_root, rpath, mntns_root, path, rfi->remap->uid, rfi->remap->gid, 0) < 0) { - int errno_saved = errno; -- rm_parent_dirs(mntns_root, path, *level); -- errno = errno_saved; -- if (errno == EEXIST) -+ -+ if (!rm_parent_dirs(mntns_root, path, *level) && errno_saved == EEXIST) { -+ errno = errno_saved; - return 1; -+ } - return -1; - } - -@@ -2124,7 +2138,8 @@ ext: - pr_perror("Failed to unlink the remap file"); - goto err; - } -- rm_parent_dirs(mntns_root, rfi->path, level); -+ if (rm_parent_dirs(mntns_root, rfi->path, level)) -+ goto err; - } - - mutex_unlock(remap_open_lock); --- -2.35.1 - diff --git a/0051-ghost-mount-allocate-remounted_rw-in-shmem-to-get-in.patch b/0051-ghost-mount-allocate-remounted_rw-in-shmem-to-get-in.patch deleted file mode 100644 index fe0c63d..0000000 --- a/0051-ghost-mount-allocate-remounted_rw-in-shmem-to-get-in.patch +++ /dev/null @@ -1,180 +0,0 @@ -From 90855f58bae7aa9560868403fac00d5bd14be971 Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Thu, 13 Feb 2020 18:28:15 +0300 -Subject: [PATCH 051/249] ghost/mount: allocate remounted_rw in shmem to get - info from other processes - -Previousely remounted_rw was not shared between all processes on -restore, thus cleanup didn't got this info from rfi_remap and these -mounts were wrongly left writable after restore. - -Cherry-picked from Virtuozzo criu: -https://src.openvz.org/projects/OVZ/repos/criu/commits/3a1a592e7 - -Fixes: fd0a3cd9efb9 ("mount: remount ro mounts writable before -ghost-file restore") -Signed-off-by: Pavel Tikhomirov ---- - criu/include/mount.h | 4 ++-- - criu/mount.c | 32 ++++++++++++++++++++++---------- - criu/proc_parse.c | 2 +- - 3 files changed, 25 insertions(+), 13 deletions(-) - -diff --git a/criu/include/mount.h b/criu/include/mount.h -index 833a75ca0..7705279e4 100644 ---- a/criu/include/mount.h -+++ b/criu/include/mount.h -@@ -84,7 +84,7 @@ struct mount_info { - struct list_head postpone; - - int is_overmounted; -- int remounted_rw; -+ int *remounted_rw; - - void *private; /* associated filesystem data */ - }; -@@ -100,7 +100,7 @@ static inline int collect_binfmt_misc(void) - } - #endif - --extern struct mount_info *mnt_entry_alloc(void); -+extern struct mount_info *mnt_entry_alloc(bool rst); - extern void mnt_entry_free(struct mount_info *mi); - - extern int __mntns_get_root_fd(pid_t pid); -diff --git a/criu/mount.c b/criu/mount.c -index 93725e526..d75ca5598 100644 ---- a/criu/mount.c -+++ b/criu/mount.c -@@ -27,6 +27,7 @@ - #include "external.h" - #include "clone-noasan.h" - #include "fdstore.h" -+#include "rst-malloc.h" - - #include "images/mnt.pb-c.h" - -@@ -1415,7 +1416,8 @@ err: - return -1; - } - --static __maybe_unused int add_cr_time_mount(struct mount_info *root, char *fsname, const char *path, unsigned int s_dev) -+static __maybe_unused int add_cr_time_mount(struct mount_info *root, char *fsname, const char *path, unsigned int s_dev, -+ bool rst) - { - struct mount_info *mi, *t, *parent; - bool add_slash = false; -@@ -1434,7 +1436,7 @@ static __maybe_unused int add_cr_time_mount(struct mount_info *root, char *fsnam - } - } - -- mi = mnt_entry_alloc(); -+ mi = mnt_entry_alloc(rst); - if (!mi) - return -1; - -@@ -2723,7 +2725,7 @@ err_root: - return exit_code; - } - --struct mount_info *mnt_entry_alloc() -+struct mount_info *mnt_entry_alloc(bool rst) - { - struct mount_info *new; - -@@ -2734,6 +2736,13 @@ struct mount_info *mnt_entry_alloc() - - new = xzalloc(sizeof(struct mount_info)); - if (new) { -+ if (rst) { -+ new->remounted_rw = shmalloc(sizeof(int)); -+ if (!new->remounted_rw) { -+ xfree(new); -+ return NULL; -+ } -+ } - new->fd = -1; - new->is_overmounted = -1; - INIT_LIST_HEAD(&new->children); -@@ -2956,7 +2965,7 @@ static int collect_mnt_from_image(struct mount_info **head, struct mount_info ** - if (ret <= 0) - break; - -- pm = mnt_entry_alloc(); -+ pm = mnt_entry_alloc(true); - if (!pm) - goto err; - -@@ -3234,7 +3243,7 @@ static int populate_mnt_ns(void) - { - int ret; - -- root_yard_mp = mnt_entry_alloc(); -+ root_yard_mp = mnt_entry_alloc(true); - if (!root_yard_mp) - return -1; - -@@ -3247,7 +3256,7 @@ static int populate_mnt_ns(void) - #ifdef CONFIG_BINFMT_MISC_VIRTUALIZED - if (!opts.has_binfmt_misc && !list_empty(&binfmt_misc_list)) { - /* Add to mount tree. Generic code will mount it later */ -- ret = add_cr_time_mount(root_yard_mp, "binfmt_misc", BINFMT_MISC_HOME, 0); -+ ret = add_cr_time_mount(root_yard_mp, "binfmt_misc", BINFMT_MISC_HOME, 0, true); - if (ret) - return -1; - } -@@ -3697,7 +3706,7 @@ int collect_mnt_namespaces(bool for_dump) - ret = -1; - goto err; - } else if (ret > 0 && add_cr_time_mount(ns->mnt.mntinfo_tree, "binfmt_misc", BINFMT_MISC_HOME, -- s_dev) < 0) { -+ s_dev, false) < 0) { - ret = -1; - goto err; - } -@@ -3838,7 +3847,10 @@ int try_remount_writable(struct mount_info *mi, bool ns) - if (!ns) - remounted = REMOUNTED_RW_SERVICE; - -- if (mi->flags & MS_RDONLY && !(mi->remounted_rw & remounted)) { -+ /* All mounts in mntinfo list should have it on restore */ -+ BUG_ON(mi->remounted_rw == NULL); -+ -+ if (mi->flags & MS_RDONLY && !(*mi->remounted_rw & remounted)) { - if (mnt_is_overmounted(mi)) { - pr_err("The mount %d is overmounted so paths are invisible\n", mi->mnt_id); - return -1; -@@ -3861,7 +3873,7 @@ int try_remount_writable(struct mount_info *mi, bool ns) - if (call_helper_process(ns_remount_writable, mi)) - return -1; - } -- mi->remounted_rw |= remounted; -+ *mi->remounted_rw |= remounted; - } - - return 0; -@@ -3876,7 +3888,7 @@ static int __remount_readonly_mounts(struct ns_id *ns) - if (ns && mi->nsid != ns) - continue; - -- if (!(mi->remounted_rw && REMOUNTED_RW)) -+ if (!(*mi->remounted_rw && REMOUNTED_RW)) - continue; - - /* -diff --git a/criu/proc_parse.c b/criu/proc_parse.c -index f3491e781..c734fc24a 100644 ---- a/criu/proc_parse.c -+++ b/criu/proc_parse.c -@@ -1506,7 +1506,7 @@ struct mount_info *parse_mountinfo(pid_t pid, struct ns_id *nsid, bool for_dump) - int ret = -1; - char *fsname = NULL; - -- new = mnt_entry_alloc(); -+ new = mnt_entry_alloc(false); - if (!new) - goto end; - --- -2.35.1 - diff --git a/0052-files-reg-temporary-remount-writable-the-mount-we-do.patch b/0052-files-reg-temporary-remount-writable-the-mount-we-do.patch deleted file mode 100644 index 0bb729e..0000000 --- a/0052-files-reg-temporary-remount-writable-the-mount-we-do.patch +++ /dev/null @@ -1,46 +0,0 @@ -From d30c2c86f6f9a81de004a129661ad7aa5d9fcddb Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Thu, 13 Feb 2020 18:26:52 +0300 -Subject: [PATCH 052/249] files-reg: temporary remount writable the mount we do - unlink on - -Previousely I din't mention this case because we had bad error handling -in ghost cleanup path. - -Without these patch but with proper error handling for unlink we have an -error in mntns_ghost01 test: - -Error (criu/files-reg.c:2269): Failed to unlink the remap file: -Read-only file system - -Cherry-picked from Virtuozzo criu: -https://src.openvz.org/projects/OVZ/repos/criu/commits/151c859e1 - -Changes: check lookup_mnt_id return for NULL - -Fixes: fd0a3cd9efb9 ("mount: remount ro mounts writable before -ghost-file restore") -Signed-off-by: Pavel Tikhomirov ---- - criu/files-reg.c | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/criu/files-reg.c b/criu/files-reg.c -index 6a2ea2fe4..1224b6ac2 100644 ---- a/criu/files-reg.c -+++ b/criu/files-reg.c -@@ -2133,6 +2133,11 @@ ext: - - if (rfi->remap) { - if (!rfi->remap->is_dir) { -+ struct mount_info *mi = lookup_mnt_id(rfi->rfe->mnt_id); -+ -+ if (mi && try_remount_writable(mi, true)) -+ goto err; -+ - pr_debug("Unlink: %d:%s\n", rfi->rfe->mnt_id, rfi->path); - if (unlinkat(mntns_root, rfi->path, 0)) { - pr_perror("Failed to unlink the remap file"); --- -2.35.1 - diff --git a/0053-zdtm-add-ro-mount-check-after-c-r-to-mntns_ghost01.patch b/0053-zdtm-add-ro-mount-check-after-c-r-to-mntns_ghost01.patch deleted file mode 100644 index c1f2e7d..0000000 --- a/0053-zdtm-add-ro-mount-check-after-c-r-to-mntns_ghost01.patch +++ /dev/null @@ -1,47 +0,0 @@ -From dff6911878ee62f7cd757a0a8e3ecc3fe4ee6ac7 Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Tue, 30 Nov 2021 19:03:29 +0300 -Subject: [PATCH 053/249] zdtm: add ro-mount check after c/r to mntns_ghost01 - -This is a test for "ghost/mount: allocate remounted_rw in shmem to get -info from other processes" patch, without the patch test fails with: - - ############# Test zdtm/static/mntns_ghost01 FAIL at result check ############## - Test output: ================================ - 16:15:19.607: 5: ERR: mntns_ghost01.c:95: open for write on rofs -> 7 (errno = 11 (Resource temporarily unavailable)) - 16:15:19.607: 4: FAIL: mntns_ghost01.c:121: Test died (errno = 11 (Resource temporarily unavailable)) - -Signed-off-by: Pavel Tikhomirov ---- - test/zdtm/static/mntns_ghost01.c | 8 ++++++++ - 1 file changed, 8 insertions(+) - -diff --git a/test/zdtm/static/mntns_ghost01.c b/test/zdtm/static/mntns_ghost01.c -index 20397d543..2cc2270dd 100644 ---- a/test/zdtm/static/mntns_ghost01.c -+++ b/test/zdtm/static/mntns_ghost01.c -@@ -6,6 +6,7 @@ - #include - #include - #include -+#include - - #include "zdtmtst.h" - -@@ -89,6 +90,13 @@ int main(int argc, char **argv) - return 1; - } - -+ fd = open(ghost_path, O_CREAT | O_WRONLY, 0600); -+ if (fd >= 0 || errno != EROFS) { -+ pr_perror("open for write on rofs -> %d", fd); -+ close(fd); -+ return 1; -+ } -+ - return 0; - } - --- -2.35.1 - diff --git a/0054-clang-format-disable-wrong-struct-pointer-declaratio.patch b/0054-clang-format-disable-wrong-struct-pointer-declaratio.patch deleted file mode 100644 index 6433b80..0000000 --- a/0054-clang-format-disable-wrong-struct-pointer-declaratio.patch +++ /dev/null @@ -1,115 +0,0 @@ -From 3174e7ee7e85be9db58373ddceea98e9984f3808 Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Thu, 25 Nov 2021 16:51:55 +0300 -Subject: [PATCH 054/249] clang-format: disable wrong struct pointer - declaration format - -When we declare struct and at the same time declare variable pointer of -this struct type, it looks like clang-format threats "*" as a -multiplication operator instead of indirection (pointer declaration) -operator and puts spaces on both sides, which looks wrong. - -Signed-off-by: Pavel Tikhomirov ---- - criu/fdstore.c | 4 +++- - test/zdtm/lib/test.c | 4 +++- - test/zdtm/static/child_subreaper_and_reparent.c | 4 +++- - test/zdtm/static/child_subreaper_existing_child.c | 4 +++- - test/zdtm/static/file_fown.c | 4 +++- - 5 files changed, 15 insertions(+), 5 deletions(-) - -diff --git a/criu/fdstore.c b/criu/fdstore.c -index 77935484f..65264a511 100644 ---- a/criu/fdstore.c -+++ b/criu/fdstore.c -@@ -13,10 +13,12 @@ - #include "rst-malloc.h" - #include "log.h" - -+/* clang-format off */ - static struct fdstore_desc { - int next_id; - mutex_t lock; /* to protect a peek offset */ --} * desc; -+} *desc; -+/* clang-format on */ - - int fdstore_init(void) - { -diff --git a/test/zdtm/lib/test.c b/test/zdtm/lib/test.c -index 81da81eba..57eb42046 100644 ---- a/test/zdtm/lib/test.c -+++ b/test/zdtm/lib/test.c -@@ -20,9 +20,11 @@ - #include "ns.h" - - futex_t sig_received; -+/* clang-format off */ - static struct { - futex_t stage; --} * test_shared_state; -+} *test_shared_state; -+/* clang-format on */ - - enum { - TEST_INIT_STAGE = 0, -diff --git a/test/zdtm/static/child_subreaper_and_reparent.c b/test/zdtm/static/child_subreaper_and_reparent.c -index ba03517ba..c71778ae9 100644 ---- a/test/zdtm/static/child_subreaper_and_reparent.c -+++ b/test/zdtm/static/child_subreaper_and_reparent.c -@@ -19,11 +19,13 @@ enum { - TEST_EXIT, - }; - -+/* clang-format off */ - struct shared { - futex_t fstate; - int parent_before_cr; - int parent_after_cr; --} * sh; -+} *sh; -+/* clang-format on */ - - int orphan(void) - { -diff --git a/test/zdtm/static/child_subreaper_existing_child.c b/test/zdtm/static/child_subreaper_existing_child.c -index 4805aa41d..92d22bc4a 100644 ---- a/test/zdtm/static/child_subreaper_existing_child.c -+++ b/test/zdtm/static/child_subreaper_existing_child.c -@@ -18,10 +18,12 @@ enum { - TEST_EXIT, - }; - -+/* clang-format off */ - struct shared { - futex_t fstate; - int ppid_after_reparent; --} * sh; -+} *sh; -+/* clang-format on */ - - int orphan(void) - { -diff --git a/test/zdtm/static/file_fown.c b/test/zdtm/static/file_fown.c -index eb42a826e..2c5ba82c2 100644 ---- a/test/zdtm/static/file_fown.c -+++ b/test/zdtm/static/file_fown.c -@@ -22,12 +22,14 @@ - const char *test_doc = "Check for signal delivery on file owners"; - const char *test_author = "Cyrill Gorcunov "; - -+/* clang-format off */ - struct params { - int sigio; - int pipe_flags[2]; - int pipe_pid[2]; - int pipe_sig[2]; --} * shared; -+} *shared; -+/* clang-format on */ - - static void signal_handler_io(int status) - { --- -2.35.1 - diff --git a/0055-ci-Run-cross-compile-on-debian-stable.patch b/0055-ci-Run-cross-compile-on-debian-stable.patch deleted file mode 100644 index 0e5403d..0000000 --- a/0055-ci-Run-cross-compile-on-debian-stable.patch +++ /dev/null @@ -1,181 +0,0 @@ -From b223773cd4ffd0fe8cf6e1384ad95b4c4d1b4109 Mon Sep 17 00:00:00 2001 -From: Radostin Stoyanov -Date: Sat, 4 Dec 2021 16:18:26 +0000 -Subject: [PATCH 055/249] ci: Run cross compile on debian stable - -The current debian stable release is Bullseye, not Buster. However, we -can use the 'stable' release instead. This would allow the CI to -automatically pick up updates in the future. - -Signed-off-by: Radostin Stoyanov ---- - .github/workflows/cross-compile-daily.yml | 2 +- - .github/workflows/cross-compile.yml | 2 +- - scripts/build/Dockerfile.aarch64-cross.tmpl | 1 - - ...aarch64-cross.hdr => Dockerfile.aarch64-stable-cross.hdr} | 0 - scripts/build/Dockerfile.aarch64-stable-cross.tmpl | 1 + - scripts/build/Dockerfile.armv7-cross.tmpl | 1 - - ...ile.armv7-cross.hdr => Dockerfile.armv7-stable-cross.hdr} | 0 - scripts/build/Dockerfile.armv7-stable-cross.tmpl | 1 + - scripts/build/Dockerfile.mips64el-cross.tmpl | 1 - - ...ps64el-cross.hdr => Dockerfile.mips64el-stable-cross.hdr} | 0 - scripts/build/Dockerfile.mips64el-stable-cross.tmpl | 1 + - scripts/build/Dockerfile.ppc64-cross.tmpl | 1 - - ...ile.ppc64-cross.hdr => Dockerfile.ppc64-stable-cross.hdr} | 0 - scripts/build/Dockerfile.ppc64-stable-cross.tmpl | 1 + - .../{Dockerfile.cross.tmpl => Dockerfile.stable-cross.tmpl} | 5 ++--- - scripts/build/Makefile | 2 +- - 16 files changed, 9 insertions(+), 10 deletions(-) - delete mode 120000 scripts/build/Dockerfile.aarch64-cross.tmpl - rename scripts/build/{Dockerfile.aarch64-cross.hdr => Dockerfile.aarch64-stable-cross.hdr} (100%) - create mode 120000 scripts/build/Dockerfile.aarch64-stable-cross.tmpl - delete mode 120000 scripts/build/Dockerfile.armv7-cross.tmpl - rename scripts/build/{Dockerfile.armv7-cross.hdr => Dockerfile.armv7-stable-cross.hdr} (100%) - create mode 120000 scripts/build/Dockerfile.armv7-stable-cross.tmpl - delete mode 120000 scripts/build/Dockerfile.mips64el-cross.tmpl - rename scripts/build/{Dockerfile.mips64el-cross.hdr => Dockerfile.mips64el-stable-cross.hdr} (100%) - create mode 120000 scripts/build/Dockerfile.mips64el-stable-cross.tmpl - delete mode 120000 scripts/build/Dockerfile.ppc64-cross.tmpl - rename scripts/build/{Dockerfile.ppc64-cross.hdr => Dockerfile.ppc64-stable-cross.hdr} (100%) - create mode 120000 scripts/build/Dockerfile.ppc64-stable-cross.tmpl - rename scripts/build/{Dockerfile.cross.tmpl => Dockerfile.stable-cross.tmpl} (88%) - -diff --git a/.github/workflows/cross-compile-daily.yml b/.github/workflows/cross-compile-daily.yml -index 701213276..927ddced2 100644 ---- a/.github/workflows/cross-compile-daily.yml -+++ b/.github/workflows/cross-compile-daily.yml -@@ -10,7 +10,7 @@ jobs: - runs-on: ubuntu-latest - strategy: - matrix: -- target: [armv7-cross, aarch64-cross, ppc64-cross, mips64el-cross] -+ target: [armv7-stable-cross, aarch64-stable-cross, ppc64-stable-cross, mips64el-stable-cross] - branches: [criu-dev, master] - - steps: -diff --git a/.github/workflows/cross-compile.yml b/.github/workflows/cross-compile.yml -index 90862e7ab..c6745d43e 100644 ---- a/.github/workflows/cross-compile.yml -+++ b/.github/workflows/cross-compile.yml -@@ -8,7 +8,7 @@ jobs: - runs-on: ubuntu-latest - strategy: - matrix: -- target: [armv7-cross, aarch64-cross, ppc64-cross, mips64el-cross] -+ target: [armv7-stable-cross, aarch64-stable-cross, ppc64-stable-cross, mips64el-stable-cross] - - steps: - - uses: actions/checkout@v2 -diff --git a/scripts/build/Dockerfile.aarch64-cross.tmpl b/scripts/build/Dockerfile.aarch64-cross.tmpl -deleted file mode 120000 -index 50eff9213..000000000 ---- a/scripts/build/Dockerfile.aarch64-cross.tmpl -+++ /dev/null -@@ -1 +0,0 @@ --Dockerfile.cross.tmpl -\ No newline at end of file -diff --git a/scripts/build/Dockerfile.aarch64-cross.hdr b/scripts/build/Dockerfile.aarch64-stable-cross.hdr -similarity index 100% -rename from scripts/build/Dockerfile.aarch64-cross.hdr -rename to scripts/build/Dockerfile.aarch64-stable-cross.hdr -diff --git a/scripts/build/Dockerfile.aarch64-stable-cross.tmpl b/scripts/build/Dockerfile.aarch64-stable-cross.tmpl -new file mode 120000 -index 000000000..81ef22980 ---- /dev/null -+++ b/scripts/build/Dockerfile.aarch64-stable-cross.tmpl -@@ -0,0 +1 @@ -+Dockerfile.stable-cross.tmpl -\ No newline at end of file -diff --git a/scripts/build/Dockerfile.armv7-cross.tmpl b/scripts/build/Dockerfile.armv7-cross.tmpl -deleted file mode 120000 -index 50eff9213..000000000 ---- a/scripts/build/Dockerfile.armv7-cross.tmpl -+++ /dev/null -@@ -1 +0,0 @@ --Dockerfile.cross.tmpl -\ No newline at end of file -diff --git a/scripts/build/Dockerfile.armv7-cross.hdr b/scripts/build/Dockerfile.armv7-stable-cross.hdr -similarity index 100% -rename from scripts/build/Dockerfile.armv7-cross.hdr -rename to scripts/build/Dockerfile.armv7-stable-cross.hdr -diff --git a/scripts/build/Dockerfile.armv7-stable-cross.tmpl b/scripts/build/Dockerfile.armv7-stable-cross.tmpl -new file mode 120000 -index 000000000..81ef22980 ---- /dev/null -+++ b/scripts/build/Dockerfile.armv7-stable-cross.tmpl -@@ -0,0 +1 @@ -+Dockerfile.stable-cross.tmpl -\ No newline at end of file -diff --git a/scripts/build/Dockerfile.mips64el-cross.tmpl b/scripts/build/Dockerfile.mips64el-cross.tmpl -deleted file mode 120000 -index 50eff9213..000000000 ---- a/scripts/build/Dockerfile.mips64el-cross.tmpl -+++ /dev/null -@@ -1 +0,0 @@ --Dockerfile.cross.tmpl -\ No newline at end of file -diff --git a/scripts/build/Dockerfile.mips64el-cross.hdr b/scripts/build/Dockerfile.mips64el-stable-cross.hdr -similarity index 100% -rename from scripts/build/Dockerfile.mips64el-cross.hdr -rename to scripts/build/Dockerfile.mips64el-stable-cross.hdr -diff --git a/scripts/build/Dockerfile.mips64el-stable-cross.tmpl b/scripts/build/Dockerfile.mips64el-stable-cross.tmpl -new file mode 120000 -index 000000000..81ef22980 ---- /dev/null -+++ b/scripts/build/Dockerfile.mips64el-stable-cross.tmpl -@@ -0,0 +1 @@ -+Dockerfile.stable-cross.tmpl -\ No newline at end of file -diff --git a/scripts/build/Dockerfile.ppc64-cross.tmpl b/scripts/build/Dockerfile.ppc64-cross.tmpl -deleted file mode 120000 -index 50eff9213..000000000 ---- a/scripts/build/Dockerfile.ppc64-cross.tmpl -+++ /dev/null -@@ -1 +0,0 @@ --Dockerfile.cross.tmpl -\ No newline at end of file -diff --git a/scripts/build/Dockerfile.ppc64-cross.hdr b/scripts/build/Dockerfile.ppc64-stable-cross.hdr -similarity index 100% -rename from scripts/build/Dockerfile.ppc64-cross.hdr -rename to scripts/build/Dockerfile.ppc64-stable-cross.hdr -diff --git a/scripts/build/Dockerfile.ppc64-stable-cross.tmpl b/scripts/build/Dockerfile.ppc64-stable-cross.tmpl -new file mode 120000 -index 000000000..81ef22980 ---- /dev/null -+++ b/scripts/build/Dockerfile.ppc64-stable-cross.tmpl -@@ -0,0 +1 @@ -+Dockerfile.stable-cross.tmpl -\ No newline at end of file -diff --git a/scripts/build/Dockerfile.cross.tmpl b/scripts/build/Dockerfile.stable-cross.tmpl -similarity index 88% -rename from scripts/build/Dockerfile.cross.tmpl -rename to scripts/build/Dockerfile.stable-cross.tmpl -index 8b95fbb1c..6a68cd1ca 100644 ---- a/scripts/build/Dockerfile.cross.tmpl -+++ b/scripts/build/Dockerfile.stable-cross.tmpl -@@ -1,9 +1,8 @@ - COPY scripts/ci/apt-install /bin/apt-install - - # Add the cross compiler sources --RUN echo "deb http://deb.debian.org/debian/ buster main" >> /etc/apt/sources.list && \ -- dpkg --add-architecture ${DEBIAN_ARCH} && \ -- apt-install emdebian-archive-keyring -+RUN echo "deb http://deb.debian.org/debian/ stable main" >> /etc/apt/sources.list && \ -+ dpkg --add-architecture ${DEBIAN_ARCH} - - RUN apt-install \ - crossbuild-essential-${DEBIAN_ARCH} \ -diff --git a/scripts/build/Makefile b/scripts/build/Makefile -index 62e3a9920..a436c2839 100644 ---- a/scripts/build/Makefile -+++ b/scripts/build/Makefile -@@ -1,5 +1,5 @@ - ARCHES := x86_64 fedora-asan fedora-rawhide centos7 armv7hf centos8 --NON_CLANG := armv7-cross aarch64-cross ppc64-cross mips64el-cross -+NON_CLANG := armv7-stable-cross aarch64-stable-cross ppc64-stable-cross mips64el-stable-cross - CREATE_DOCKERFILES := $(ARCHES) $(NON_CLANG) - TARGETS := $(ARCHES) alpine archlinux - TARGETS_CLANG := $(addsuffix $(TARGETS),-clang) --- -2.35.1 - diff --git a/0056-ci-Run-cross-compile-with-debian-testing.patch b/0056-ci-Run-cross-compile-with-debian-testing.patch deleted file mode 100644 index de7341c..0000000 --- a/0056-ci-Run-cross-compile-with-debian-testing.patch +++ /dev/null @@ -1,197 +0,0 @@ -From 5aaf82b4d8bd6c89f7e6b0f639c79b3a2d21eeef Mon Sep 17 00:00:00 2001 -From: Radostin Stoyanov -Date: Sat, 4 Dec 2021 16:31:34 +0000 -Subject: [PATCH 056/249] ci: Run cross compile with debian testing - -Debian testing has newer compiler version and running -cross compilation tests would allow us to catch any compilation -errors early. - -Signed-off-by: Radostin Stoyanov ---- - .github/workflows/cross-compile.yml | 11 ++++- - .../Dockerfile.aarch64-testing-cross.hdr | 5 +++ - .../Dockerfile.aarch64-testing-cross.tmpl | 1 + - .../build/Dockerfile.armv7-testing-cross.hdr | 6 +++ - .../build/Dockerfile.armv7-testing-cross.tmpl | 1 + - .../Dockerfile.mips64el-testing-cross.hdr | 6 +++ - .../Dockerfile.mips64el-testing-cross.tmpl | 1 + - .../build/Dockerfile.ppc64-testing-cross.hdr | 5 +++ - .../build/Dockerfile.ppc64-testing-cross.tmpl | 1 + - scripts/build/Dockerfile.testing-cross.tmpl | 42 +++++++++++++++++++ - scripts/build/Makefile | 4 +- - 11 files changed, 81 insertions(+), 2 deletions(-) - create mode 100644 scripts/build/Dockerfile.aarch64-testing-cross.hdr - create mode 120000 scripts/build/Dockerfile.aarch64-testing-cross.tmpl - create mode 100644 scripts/build/Dockerfile.armv7-testing-cross.hdr - create mode 120000 scripts/build/Dockerfile.armv7-testing-cross.tmpl - create mode 100644 scripts/build/Dockerfile.mips64el-testing-cross.hdr - create mode 120000 scripts/build/Dockerfile.mips64el-testing-cross.tmpl - create mode 100644 scripts/build/Dockerfile.ppc64-testing-cross.hdr - create mode 120000 scripts/build/Dockerfile.ppc64-testing-cross.tmpl - create mode 100644 scripts/build/Dockerfile.testing-cross.tmpl - -diff --git a/.github/workflows/cross-compile.yml b/.github/workflows/cross-compile.yml -index c6745d43e..eec6eb577 100644 ---- a/.github/workflows/cross-compile.yml -+++ b/.github/workflows/cross-compile.yml -@@ -8,7 +8,16 @@ jobs: - runs-on: ubuntu-latest - strategy: - matrix: -- target: [armv7-stable-cross, aarch64-stable-cross, ppc64-stable-cross, mips64el-stable-cross] -+ target: [ -+ armv7-stable-cross, -+ armv7-testing-cross, -+ aarch64-stable-cross, -+ aarch64-testing-cross, -+ ppc64-stable-cross, -+ ppc64-testing-cross, -+ mips64el-stable-cross, -+ mips64el-testing-cross -+ ] - - steps: - - uses: actions/checkout@v2 -diff --git a/scripts/build/Dockerfile.aarch64-testing-cross.hdr b/scripts/build/Dockerfile.aarch64-testing-cross.hdr -new file mode 100644 -index 000000000..c61d2af27 ---- /dev/null -+++ b/scripts/build/Dockerfile.aarch64-testing-cross.hdr -@@ -0,0 +1,5 @@ -+FROM docker.io/dockcross/base:latest -+ -+ENV ARCH=aarch64 -+ENV DEBIAN_ARCH=arm64 -+ENV CROSS_TRIPLET=aarch64-linux-gnu -diff --git a/scripts/build/Dockerfile.aarch64-testing-cross.tmpl b/scripts/build/Dockerfile.aarch64-testing-cross.tmpl -new file mode 120000 -index 000000000..c1dd38b21 ---- /dev/null -+++ b/scripts/build/Dockerfile.aarch64-testing-cross.tmpl -@@ -0,0 +1 @@ -+Dockerfile.testing-cross.tmpl -\ No newline at end of file -diff --git a/scripts/build/Dockerfile.armv7-testing-cross.hdr b/scripts/build/Dockerfile.armv7-testing-cross.hdr -new file mode 100644 -index 000000000..f96dc51f7 ---- /dev/null -+++ b/scripts/build/Dockerfile.armv7-testing-cross.hdr -@@ -0,0 +1,6 @@ -+FROM docker.io/dockcross/base:latest -+ -+ENV ARCH=arm -+ENV SUBARCH=armv7 -+ENV DEBIAN_ARCH=armhf -+ENV CROSS_TRIPLET=arm-linux-gnueabihf -diff --git a/scripts/build/Dockerfile.armv7-testing-cross.tmpl b/scripts/build/Dockerfile.armv7-testing-cross.tmpl -new file mode 120000 -index 000000000..c1dd38b21 ---- /dev/null -+++ b/scripts/build/Dockerfile.armv7-testing-cross.tmpl -@@ -0,0 +1 @@ -+Dockerfile.testing-cross.tmpl -\ No newline at end of file -diff --git a/scripts/build/Dockerfile.mips64el-testing-cross.hdr b/scripts/build/Dockerfile.mips64el-testing-cross.hdr -new file mode 100644 -index 000000000..e78c94aa5 ---- /dev/null -+++ b/scripts/build/Dockerfile.mips64el-testing-cross.hdr -@@ -0,0 +1,6 @@ -+FROM dockcross/base:latest -+ -+ENV ARCH=mips -+ENV SUBARCH=mips -+ENV DEBIAN_ARCH=mips64el -+ENV CROSS_TRIPLET=mips64el-linux-gnuabi64 -diff --git a/scripts/build/Dockerfile.mips64el-testing-cross.tmpl b/scripts/build/Dockerfile.mips64el-testing-cross.tmpl -new file mode 120000 -index 000000000..c1dd38b21 ---- /dev/null -+++ b/scripts/build/Dockerfile.mips64el-testing-cross.tmpl -@@ -0,0 +1 @@ -+Dockerfile.testing-cross.tmpl -\ No newline at end of file -diff --git a/scripts/build/Dockerfile.ppc64-testing-cross.hdr b/scripts/build/Dockerfile.ppc64-testing-cross.hdr -new file mode 100644 -index 000000000..38547ac55 ---- /dev/null -+++ b/scripts/build/Dockerfile.ppc64-testing-cross.hdr -@@ -0,0 +1,5 @@ -+FROM dockcross/base:latest -+ -+ENV ARCH=ppc64 -+ENV DEBIAN_ARCH=ppc64el -+ENV CROSS_TRIPLET=powerpc64le-linux-gnu -diff --git a/scripts/build/Dockerfile.ppc64-testing-cross.tmpl b/scripts/build/Dockerfile.ppc64-testing-cross.tmpl -new file mode 120000 -index 000000000..c1dd38b21 ---- /dev/null -+++ b/scripts/build/Dockerfile.ppc64-testing-cross.tmpl -@@ -0,0 +1 @@ -+Dockerfile.testing-cross.tmpl -\ No newline at end of file -diff --git a/scripts/build/Dockerfile.testing-cross.tmpl b/scripts/build/Dockerfile.testing-cross.tmpl -new file mode 100644 -index 000000000..1d5565310 ---- /dev/null -+++ b/scripts/build/Dockerfile.testing-cross.tmpl -@@ -0,0 +1,42 @@ -+COPY scripts/ci/apt-install /bin/apt-install -+ -+# Add the cross compiler sources -+RUN echo "deb http://deb.debian.org/debian/ testing main" >> /etc/apt/sources.list && \ -+ dpkg --add-architecture ${DEBIAN_ARCH} -+ -+RUN apt-install \ -+ crossbuild-essential-${DEBIAN_ARCH} \ -+ libc6-dev-${DEBIAN_ARCH}-cross \ -+ libc6-${DEBIAN_ARCH}-cross \ -+ libbz2-dev:${DEBIAN_ARCH} \ -+ libexpat1-dev:${DEBIAN_ARCH} \ -+ ncurses-dev:${DEBIAN_ARCH} \ -+ libssl-dev:${DEBIAN_ARCH} \ -+ protobuf-c-compiler \ -+ protobuf-compiler \ -+ python3-protobuf \ -+ libnl-3-dev:${DEBIAN_ARCH} \ -+ libprotobuf-dev:${DEBIAN_ARCH} \ -+ libnet-dev:${DEBIAN_ARCH} \ -+ libprotobuf-c-dev:${DEBIAN_ARCH} \ -+ libcap-dev:${DEBIAN_ARCH} \ -+ libaio-dev:${DEBIAN_ARCH} \ -+ libnl-route-3-dev:${DEBIAN_ARCH} -+ -+ENV CROSS_COMPILE=${CROSS_TRIPLET}- \ -+ CROSS_ROOT=/usr/${CROSS_TRIPLET} \ -+ AS=/usr/bin/${CROSS_TRIPLET}-as \ -+ AR=/usr/bin/${CROSS_TRIPLET}-ar \ -+ CC=/usr/bin/${CROSS_TRIPLET}-gcc \ -+ CPP=/usr/bin/${CROSS_TRIPLET}-cpp \ -+ CXX=/usr/bin/${CROSS_TRIPLET}-g++ \ -+ LD=/usr/bin/${CROSS_TRIPLET}-ld \ -+ FC=/usr/bin/${CROSS_TRIPLET}-gfortran -+ -+ENV PATH="${PATH}:${CROSS_ROOT}/bin" \ -+ PKG_CONFIG_PATH=/usr/lib/${CROSS_TRIPLET}/pkgconfig -+ -+COPY . /criu -+WORKDIR /criu -+ -+RUN make mrproper && date && make -j $(nproc) zdtm && date -diff --git a/scripts/build/Makefile b/scripts/build/Makefile -index a436c2839..b24fc80ea 100644 ---- a/scripts/build/Makefile -+++ b/scripts/build/Makefile -@@ -1,5 +1,7 @@ - ARCHES := x86_64 fedora-asan fedora-rawhide centos7 armv7hf centos8 --NON_CLANG := armv7-stable-cross aarch64-stable-cross ppc64-stable-cross mips64el-stable-cross -+STABLE_CROSS_ARCHES := armv7-stable-cross aarch64-stable-cross ppc64-stable-cross mips64el-stable-cross -+TESTING_CROSS_ARCHES := armv7-testing-cross aarch64-testing-cross ppc64-testing-cross mips64el-testing-cross -+NON_CLANG := $(TESTING_CROSS_ARCHES) $(STABLE_CROSS_ARCHES) - CREATE_DOCKERFILES := $(ARCHES) $(NON_CLANG) - TARGETS := $(ARCHES) alpine archlinux - TARGETS_CLANG := $(addsuffix $(TARGETS),-clang) --- -2.35.1 - diff --git a/0057-make-Explicitly-enable-FPU-on-ARMv7-builds.patch b/0057-make-Explicitly-enable-FPU-on-ARMv7-builds.patch deleted file mode 100644 index 30b5cf4..0000000 --- a/0057-make-Explicitly-enable-FPU-on-ARMv7-builds.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 2ff0ffafa7e23b8a0e64ecd5da9d32e59782e2ee Mon Sep 17 00:00:00 2001 -From: Salvatore Bonaccorso -Date: Sat, 4 Dec 2021 16:59:51 +0000 -Subject: [PATCH 057/249] make: Explicitly enable FPU on ARMv7 builds - -Starting with gcc-11, Debian's armhf compiler no longer builds with -a default -mfpu= option. Instead it enables the FPU via an extension -to the -march flag (--with-arch=armv7-a+fp). criu's Makefile explicitly -passes its own -march=armv7-a setting, which overrides the +fp default, -so we end up with no FPU: - - cc1: error: '-mfloat-abi=hard': selected architecture lacks an FPU - -Signed-off-by: Radostin Stoyanov ---- - Makefile | 2 +- - test/zdtm/Makefile.inc | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/Makefile b/Makefile -index c0b8b7e54..f08d9be3a 100644 ---- a/Makefile -+++ b/Makefile -@@ -39,7 +39,7 @@ ifeq ($(ARCH),arm) - endif - - ifeq ($(ARMV),7) -- USERCFLAGS += -march=armv7-a -+ USERCFLAGS += -march=armv7-a+fp - endif - - ifeq ($(ARMV),8) -diff --git a/test/zdtm/Makefile.inc b/test/zdtm/Makefile.inc -index 69154fdc9..d34523315 100644 ---- a/test/zdtm/Makefile.inc -+++ b/test/zdtm/Makefile.inc -@@ -25,7 +25,7 @@ ifeq ($(ARCH),arm) - ifeq ($(ARMV),6) - USERCFLAGS += -march=armv6 - else ifeq ($(ARMV),7) -- USERCFLAGS += -march=armv7-a -+ USERCFLAGS += -march=armv7-a+fp - else ifeq ($(ARMV),8) - # To build aarch32 on armv8 Travis-CI (see criu Makefile) - USERCFLAGS += -march=armv7-a --- -2.35.1 - diff --git a/0058-ci-disable-broken-tests-until-fixed.patch b/0058-ci-disable-broken-tests-until-fixed.patch deleted file mode 100644 index 20a7cfe..0000000 --- a/0058-ci-disable-broken-tests-until-fixed.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 02eb97d17b8cf91831dd0a63e431b1399a4be42a Mon Sep 17 00:00:00 2001 -From: Adrian Reber -Date: Fri, 3 Dec 2021 16:48:36 +0000 -Subject: [PATCH 058/249] ci: disable broken tests until fixed - -Broken tests are being tracked at - - * https://github.com/checkpoint-restore/criu/issues/1669 - * https://github.com/checkpoint-restore/criu/issues/1635 - -This also enables previously disabled BPF related tests: - - * https://github.com/checkpoint-restore/criu/issues/1354 - -Signed-off-by: Adrian Reber ---- - scripts/ci/vagrant.sh | 6 +++--- - test/jenkins/criu-fault.sh | 8 ++++++++ - 2 files changed, 11 insertions(+), 3 deletions(-) - -diff --git a/scripts/ci/vagrant.sh b/scripts/ci/vagrant.sh -index 839b100c8..25343f96c 100755 ---- a/scripts/ci/vagrant.sh -+++ b/scripts/ci/vagrant.sh -@@ -50,9 +50,9 @@ fedora-no-vdso() { - vagrant reload - ssh default cat /proc/cmdline - ssh default 'cd /vagrant; tar xf criu.tar; cd criu; make -j 4' -- # BPF tests are failing see: https://github.com/checkpoint-restore/criu/issues/1354 -- # Needs to be fixed, skip for now -- ssh default 'cd /vagrant/criu/test; sudo ./zdtm.py run -a --keep-going -x zdtm/static/bpf_hash -x zdtm/static/bpf_array' -+ # Disabling tests which are broken on 5.15 -+ # https://github.com/checkpoint-restore/criu/issues/1669 -+ ssh default 'cd /vagrant/criu/test; sudo ./zdtm.py run -a --keep-going -x zdtm/static/socket_close_data -x zdtm/static/socket_close_data01 -x zdtm/static/fifo_upon_unix_socket01 -x zdtm/static/sk-unix-mntns -x zdtm/static/fifo_upon_unix_socket00 -x zdtm/static/socket-ext -x zdtm/static/sk-unix01 -x zdtm/static/socket_dgram_data -x zdtm/static/sockets_dgram -x zdtm/static/sk-unix-dgram-ghost' - # This test (pidfd_store_sk) requires pidfd_getfd syscall which is guaranteed in Fedora 33. - # It is also skipped from -a because it runs in RPC mode only - ssh default 'cd /vagrant/criu/test; sudo ./zdtm.py run -t zdtm/transition/pidfd_store_sk --rpc --pre 2' -diff --git a/test/jenkins/criu-fault.sh b/test/jenkins/criu-fault.sh -index a8c3a5cf7..bff40aed5 100755 ---- a/test/jenkins/criu-fault.sh -+++ b/test/jenkins/criu-fault.sh -@@ -28,6 +28,14 @@ fi - ./test/zdtm.py run -t zdtm/static/maps04 --fault 131 --keep-going --report report --pre 2:1 || fail - ./test/zdtm.py run -t zdtm/transition/maps008 --fault 131 --keep-going --report report --pre 2:1 || fail - ./test/zdtm.py run -t zdtm/static/maps01 --fault 132 -f h || fail -+ -+# Error injection with --fault 134 fails on newer CPUs used in Circle CI on EC2 -+# Skip the --fault 134 tests -+# https://github.com/checkpoint-restore/criu/issues/1635 -+if [ -n "$CIRCLECI" ]; then -+ exit 0 -+fi -+ - # 134 is corrupting extended registers set, should run in a sub-thread (fpu03) - # without restore (that will check if parasite corrupts extended registers) - ./test/zdtm.py run -t zdtm/static/fpu03 --fault 134 -f h --norst || fail --- -2.35.1 - diff --git a/0059-test-do-not-use-keep-going-for-single-zdtm-tests.patch b/0059-test-do-not-use-keep-going-for-single-zdtm-tests.patch deleted file mode 100644 index c693e98..0000000 --- a/0059-test-do-not-use-keep-going-for-single-zdtm-tests.patch +++ /dev/null @@ -1,101 +0,0 @@ -From 0c6248725ee00d152226d710f9f31362025acdc6 Mon Sep 17 00:00:00 2001 -From: Adrian Reber -Date: Sun, 5 Dec 2021 16:45:20 +0000 -Subject: [PATCH 059/249] test: do not use --keep-going for single zdtm tests - -Looking at CI logs there are often messages like: - - "[WARNING] Option --keep-going is more useful when running multiple tests" - -This commit removes '--keep-going' from single zdtm test runs. - -Signed-off-by: Adrian Reber ---- - test/jenkins/criu-dedup.sh | 10 +++++----- - test/jenkins/criu-fault.sh | 18 +++++++++--------- - test/jenkins/criu-fcg.sh | 12 ++++++------ - 3 files changed, 20 insertions(+), 20 deletions(-) - -diff --git a/test/jenkins/criu-dedup.sh b/test/jenkins/criu-dedup.sh -index 0041496d8..edb1b653d 100755 ---- a/test/jenkins/criu-dedup.sh -+++ b/test/jenkins/criu-dedup.sh -@@ -9,8 +9,8 @@ prep - # Additionally run these tests as they touch a lot of - # memory and it makes sense to additionally check it - # with delays between iterations --./test/zdtm.py run -t zdtm/transition/maps007 --keep-going --report report -f h --pre 8:.1 --dedup || fail --./test/zdtm.py run -t zdtm/static/mem-touch --keep-going --report report -f h --pre 8:.1 --dedup || fail --./test/zdtm.py run -t zdtm/transition/maps008 --keep-going --report report -f h --pre 8:.1 --dedup || fail --./test/zdtm.py run -t zdtm/transition/maps007 --keep-going --report report -f h --pre 8:.1 --noauto-dedup || fail --./test/zdtm.py run -t zdtm/static/mem-touch --keep-going --report report -f h --pre 8:.1 --noauto-dedup || fail -+./test/zdtm.py run -t zdtm/transition/maps007 --report report -f h --pre 8:.1 --dedup || fail -+./test/zdtm.py run -t zdtm/static/mem-touch --report report -f h --pre 8:.1 --dedup || fail -+./test/zdtm.py run -t zdtm/transition/maps008 --report report -f h --pre 8:.1 --dedup || fail -+./test/zdtm.py run -t zdtm/transition/maps007 --report report -f h --pre 8:.1 --noauto-dedup || fail -+./test/zdtm.py run -t zdtm/static/mem-touch --report report -f h --pre 8:.1 --noauto-dedup || fail -diff --git a/test/jenkins/criu-fault.sh b/test/jenkins/criu-fault.sh -index bff40aed5..0c5c180e9 100755 ---- a/test/jenkins/criu-fault.sh -+++ b/test/jenkins/criu-fault.sh -@@ -4,10 +4,10 @@ - set -e - source `dirname $0`/criu-lib.sh - prep --./test/zdtm.py run -t zdtm/static/env00 --fault 1 --keep-going --report report -f h || fail --./test/zdtm.py run -t zdtm/static/unlink_fstat00 --fault 2 --keep-going --report report -f h || fail --./test/zdtm.py run -t zdtm/static/maps00 --fault 3 --keep-going --report report -f h || fail --./test/zdtm.py run -t zdtm/static/inotify_irmap --fault 128 --keep-going --pre 2 -f uns || fail -+./test/zdtm.py run -t zdtm/static/env00 --fault 1 --report report -f h || fail -+./test/zdtm.py run -t zdtm/static/unlink_fstat00 --fault 2 --report report -f h || fail -+./test/zdtm.py run -t zdtm/static/maps00 --fault 3 --report report -f h || fail -+./test/zdtm.py run -t zdtm/static/inotify_irmap --fault 128 --pre 2 -f uns || fail - ./test/zdtm.py run -t zdtm/static/env00 --fault 129 -f uns || fail - ./test/zdtm.py run -t zdtm/transition/fork --fault 130 -f h || fail - ./test/zdtm.py run -t zdtm/static/vdso01 --fault 127 || fail -@@ -17,16 +17,16 @@ if [ "${COMPAT_TEST}" != "y" ] ; then - ./test/zdtm.py run -t zdtm/static/vdso01 --fault 133 -f h || fail - fi - --./test/zdtm.py run -t zdtm/static/mntns_ghost --fault 2 --keep-going --report report || fail --./test/zdtm.py run -t zdtm/static/mntns_ghost --fault 4 --keep-going --report report || fail -+./test/zdtm.py run -t zdtm/static/mntns_ghost --fault 2 --report report || fail -+./test/zdtm.py run -t zdtm/static/mntns_ghost --fault 4 --report report || fail - - ./test/zdtm.py run -t zdtm/static/mntns_ghost --fault 6 --report report || fail - ./test/zdtm.py run -t zdtm/static/mntns_link_remap --fault 6 --report report || fail - ./test/zdtm.py run -t zdtm/static/unlink_fstat03 --fault 6 --report report || fail - --./test/zdtm.py run -t zdtm/static/env00 --fault 5 --keep-going --report report || fail --./test/zdtm.py run -t zdtm/static/maps04 --fault 131 --keep-going --report report --pre 2:1 || fail --./test/zdtm.py run -t zdtm/transition/maps008 --fault 131 --keep-going --report report --pre 2:1 || fail -+./test/zdtm.py run -t zdtm/static/env00 --fault 5 --report report || fail -+./test/zdtm.py run -t zdtm/static/maps04 --fault 131 --report report --pre 2:1 || fail -+./test/zdtm.py run -t zdtm/transition/maps008 --fault 131 --report report --pre 2:1 || fail - ./test/zdtm.py run -t zdtm/static/maps01 --fault 132 -f h || fail - - # Error injection with --fault 134 fails on newer CPUs used in Circle CI on EC2 -diff --git a/test/jenkins/criu-fcg.sh b/test/jenkins/criu-fcg.sh -index ca5054f5e..81395b7ba 100755 ---- a/test/jenkins/criu-fcg.sh -+++ b/test/jenkins/criu-fcg.sh -@@ -6,10 +6,10 @@ source `dirname $0`/criu-lib.sh - prep - mount_tmpfs_to_dump - --./test/zdtm.py run -t zdtm/transition/thread-bomb -f h --keep-going --report report --freezecg zdtm:f || fail --./test/zdtm.py run -t zdtm/transition/thread-bomb -f h --keep-going --report report --freezecg zdtm:f --pre 3 || fail --./test/zdtm.py run -t zdtm/transition/thread-bomb -f h --keep-going --report report --freezecg zdtm:f --norst || fail -+./test/zdtm.py run -t zdtm/transition/thread-bomb -f h --report report --freezecg zdtm:f || fail -+./test/zdtm.py run -t zdtm/transition/thread-bomb -f h --report report --freezecg zdtm:f --pre 3 || fail -+./test/zdtm.py run -t zdtm/transition/thread-bomb -f h --report report --freezecg zdtm:f --norst || fail - --./test/zdtm.py run -t zdtm/transition/thread-bomb -f h --keep-going --report report --freezecg zdtm:t || fail --./test/zdtm.py run -t zdtm/transition/thread-bomb -f h --keep-going --report report --freezecg zdtm:t --pre 3 || fail --./test/zdtm.py run -t zdtm/transition/thread-bomb -f h --keep-going --report report --freezecg zdtm:t --norst || fail -+./test/zdtm.py run -t zdtm/transition/thread-bomb -f h --report report --freezecg zdtm:t || fail -+./test/zdtm.py run -t zdtm/transition/thread-bomb -f h --report report --freezecg zdtm:t --pre 3 || fail -+./test/zdtm.py run -t zdtm/transition/thread-bomb -f h --report report --freezecg zdtm:t --norst || fail --- -2.35.1 - diff --git a/0060-files-reg-try-dump_ghost_remap-if-link-remap-failed-.patch b/0060-files-reg-try-dump_ghost_remap-if-link-remap-failed-.patch deleted file mode 100644 index 7ad16c1..0000000 --- a/0060-files-reg-try-dump_ghost_remap-if-link-remap-failed-.patch +++ /dev/null @@ -1,137 +0,0 @@ -From a446b513ccd5e91078cbc30cecfd4aa0634119f4 Mon Sep 17 00:00:00 2001 -From: ianlang -Date: Fri, 3 Dec 2021 15:15:30 +0800 -Subject: [PATCH 060/249] files-reg: try dump_ghost_remap if link-remap failed - with error ENOENT - -An issue with dumping deleted reg files in overlayfs: - -After deleting a file originated from lower layer in merged dir, -fstat() on the /proc/$pid/map_files symlink returns st_nlink=1, while -linkat() fails with errno ENOENT. - -Signed-off-by: langyenan ---- - criu/files-reg.c | 42 +++++++++++++++++++++++++++++++++++------ - criu/include/fs-magic.h | 4 ++++ - 2 files changed, 40 insertions(+), 6 deletions(-) - -diff --git a/criu/files-reg.c b/criu/files-reg.c -index 1224b6ac2..141843a7a 100644 ---- a/criu/files-reg.c -+++ b/criu/files-reg.c -@@ -959,7 +959,25 @@ void free_link_remaps(void) - } - static int linkat_hard(int odir, char *opath, int ndir, char *npath, uid_t uid, gid_t gid, int flags); - --static int create_link_remap(char *path, int len, int lfd, u32 *idp, struct ns_id *nsid, const struct stat *st) -+static void check_overlayfs_fallback(char *path, const struct fd_parms *parms, bool *fallback) -+{ -+ if (!fallback || parms->fs_type != OVERLAYFS_SUPER_MAGIC) -+ return; -+ -+ /* -+ * In overlayFS, linkat() fails with ENOENT if the removed file is -+ * originated from lower layer. The cause of failure is that linkat() -+ * sees the file has st_nlink=0, which is different than st_nlink=1 we -+ * got from earlier fstat() on lfd. By setting *fb=true, we will fall -+ * back to dump_ghost_remap() as it is what should have been done to -+ * removed files with st_nlink=0. -+ */ -+ pr_info("Unable to link-remap %s on overlayFS, fall back to dump_ghost_remap\n", path); -+ *fallback = true; -+} -+ -+static int create_link_remap(char *path, int len, int lfd, u32 *idp, struct ns_id *nsid, const struct fd_parms *parms, -+ bool *fallback) - { - char link_name[PATH_MAX], *tmp; - FileEntry fe = FILE_ENTRY__INIT; -@@ -967,6 +985,7 @@ static int create_link_remap(char *path, int len, int lfd, u32 *idp, struct ns_i - FownEntry fwn = FOWN_ENTRY__INIT; - int mntns_root; - int ret; -+ const struct stat *ost = &parms->stat; - - if (!opts.link_remap_ok) { - pr_err("Can't create link remap for %s. " -@@ -1005,11 +1024,12 @@ static int create_link_remap(char *path, int len, int lfd, u32 *idp, struct ns_i - mntns_root = mntns_get_root_fd(nsid); - - again: -- ret = linkat_hard(lfd, "", mntns_root, link_name, st->st_uid, st->st_gid, AT_EMPTY_PATH); -+ ret = linkat_hard(lfd, "", mntns_root, link_name, ost->st_uid, ost->st_gid, AT_EMPTY_PATH); - if (ret < 0 && errno == ENOENT) { - /* Use grand parent, if parent directory does not exist. */ - if (trim_last_parent(link_name) < 0) { - pr_err("trim failed: @%s@\n", link_name); -+ check_overlayfs_fallback(path, parms, fallback); - return -1; - } - goto again; -@@ -1028,12 +1048,13 @@ again: - return pb_write_one(img_from_set(glob_imgset, CR_FD_FILES), &fe, PB_FILE); - } - --static int dump_linked_remap(char *path, int len, const struct stat *ost, int lfd, u32 id, struct ns_id *nsid) -+static int dump_linked_remap(char *path, int len, const struct fd_parms *parms, int lfd, u32 id, struct ns_id *nsid, -+ bool *fallback) - { - u32 lid; - RemapFilePathEntry rpe = REMAP_FILE_PATH_ENTRY__INIT; - -- if (create_link_remap(path, len, lfd, &lid, nsid, ost)) -+ if (create_link_remap(path, len, lfd, &lid, nsid, parms, fallback)) - return -1; - - rpe.orig_id = id; -@@ -1150,6 +1171,7 @@ static int check_path_remap(struct fd_link *link, const struct fd_parms *parms, - struct stat pst; - const struct stat *ost = &parms->stat; - int flags = 0; -+ bool fallback = false; - - if (parms->fs_type == PROC_SUPER_MAGIC) { - /* The file points to /proc/pid/ where pid is a dead -@@ -1239,7 +1261,7 @@ static int check_path_remap(struct fd_link *link, const struct fd_parms *parms, - * links on it) to have some persistent name at hands. - */ - pr_debug("Dump silly-rename linked remap for %x\n", id); -- return dump_linked_remap(rpath + 1, plen - 1, ost, lfd, id, nsid); -+ return dump_linked_remap(rpath + 1, plen - 1, parms, lfd, id, nsid, NULL); - } - - mntns_root = mntns_get_root_fd(nsid); -@@ -1260,7 +1282,15 @@ static int check_path_remap(struct fd_link *link, const struct fd_parms *parms, - - if (errno == ENOENT) { - link_strip_deleted(link); -- return dump_linked_remap(rpath + 1, plen - 1, ost, lfd, id, nsid); -+ ret = dump_linked_remap(rpath + 1, plen - 1, parms, lfd, id, nsid, &fallback); -+ if (ret < 0 && fallback) { -+ /* fallback is true only if following conditions are true: -+ * 1. linkat() inside dump_linked_remap() failed with ENOENT -+ * 2. parms->fs_type == overlayFS -+ */ -+ return dump_ghost_remap(rpath + 1, ost, lfd, id, nsid); -+ } -+ return ret; - } - - pr_perror("Can't stat path"); -diff --git a/criu/include/fs-magic.h b/criu/include/fs-magic.h -index 46ac8aa27..ad34f4891 100644 ---- a/criu/include/fs-magic.h -+++ b/criu/include/fs-magic.h -@@ -53,4 +53,8 @@ - #define AUTOFS_SUPER_MAGIC 0x0187 - #endif - -+#ifndef OVERLAYFS_SUPER_MAGIC -+#define OVERLAYFS_SUPER_MAGIC 0x794c7630 -+#endif -+ - #endif /* __CR_FS_MAGIC_H__ */ --- -2.35.1 - diff --git a/0061-util-make-page-server-IPv6-safe.patch b/0061-util-make-page-server-IPv6-safe.patch deleted file mode 100644 index 8428e19..0000000 --- a/0061-util-make-page-server-IPv6-safe.patch +++ /dev/null @@ -1,63 +0,0 @@ -From 0eed6f740c3f1efc580b62d59ee3efff64276077 Mon Sep 17 00:00:00 2001 -From: Adrian Reber -Date: Tue, 7 Dec 2021 09:10:14 +0000 -Subject: [PATCH 061/249] util: make page-server IPv6 safe - -The function run_tcp_server() was the last place CRIU was still using -the IPv4 only function inet_ntoa(). It was only used during a print, so -that it did not really break anything, but with this commit the output -is now no longer: - - Accepted connection from 0.0.0.0:58396 - -but correctly displaying the IPv6 address - - Accepted connection from ::1:58398 - -if connecting via IPv6. - -Signed-off-by: Adrian Reber ---- - criu/util.c | 15 +++++++++++---- - 1 file changed, 11 insertions(+), 4 deletions(-) - -diff --git a/criu/util.c b/criu/util.c -index 2917102fd..822822186 100644 ---- a/criu/util.c -+++ b/criu/util.c -@@ -1107,7 +1107,7 @@ out: - int run_tcp_server(bool daemon_mode, int *ask, int cfd, int sk) - { - int ret; -- struct sockaddr_in caddr; -+ struct sockaddr_storage caddr; - socklen_t clen = sizeof(caddr); - - if (daemon_mode) { -@@ -1135,13 +1135,20 @@ int run_tcp_server(bool daemon_mode, int *ask, int cfd, int sk) - return -1; - - if (sk >= 0) { -+ char port[6]; -+ char address[INET6_ADDRSTRLEN]; - *ask = accept(sk, (struct sockaddr *)&caddr, &clen); - if (*ask < 0) { - pr_perror("Can't accept connection to server"); - goto err; -- } else -- pr_info("Accepted connection from %s:%u\n", inet_ntoa(caddr.sin_addr), -- (int)ntohs(caddr.sin_port)); -+ } -+ ret = getnameinfo((struct sockaddr *)&caddr, clen, address, sizeof(address), port, sizeof(port), -+ NI_NUMERICHOST | NI_NUMERICSERV); -+ if (ret) { -+ pr_err("Failed converting address: %s\n", gai_strerror(ret)); -+ goto err; -+ } -+ pr_info("Accepted connection from %s:%s\n", address, port); - close(sk); - } - --- -2.35.1 - diff --git a/0062-sk-unix-Fix-TCP_ESTABLISHED-checks-in-unix-sockets.patch b/0062-sk-unix-Fix-TCP_ESTABLISHED-checks-in-unix-sockets.patch deleted file mode 100644 index bcdd74e..0000000 --- a/0062-sk-unix-Fix-TCP_ESTABLISHED-checks-in-unix-sockets.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 7360c8d2a013f17c9cccad8305e63321b05f651d Mon Sep 17 00:00:00 2001 -From: Bui Quang Minh -Date: Thu, 2 Dec 2021 23:01:33 +0700 -Subject: [PATCH 062/249] sk-unix: Fix TCP_ESTABLISHED checks in unix sockets - -Since commit 83301b5367a98 ("af_unix: Set TCP_ESTABLISHED for datagram sockets -too") in Linux kernel, SOCK_DGRAM unix sockets can have TCP_ESTABLISHED state -when connected. So we need to fix checks that assume SOCK_DRAM sockets cannot -have TCP_ESTABLISHED state. - -Signed-off-by: Bui Quang Minh ---- - criu/sk-unix.c | 10 +++------- - 1 file changed, 3 insertions(+), 7 deletions(-) - -diff --git a/criu/sk-unix.c b/criu/sk-unix.c -index a819473b4..d3402c3ac 100644 ---- a/criu/sk-unix.c -+++ b/criu/sk-unix.c -@@ -460,7 +460,7 @@ static int dump_one_unix_fd(int lfd, uint32_t id, const struct fd_parms *p) - pr_warn("Shutdown mismatch %u:%d -> %u:%d\n", ue->ino, ue->shutdown, peer->sd.ino, - peer->shutdown); - } -- } else if (ue->state == TCP_ESTABLISHED) { -+ } else if (ue->state == TCP_ESTABLISHED && ue->type != SOCK_DGRAM) { - const struct unix_sk_listen_icon *e; - - e = lookup_unix_listen_icons(ue->ino); -@@ -1851,14 +1851,10 @@ static int open_unixsk_standalone(struct unix_sk_info *ui, int *new_fd) - - close(sks[1]); - sk = sks[0]; -- } else if (ui->ue->state == TCP_ESTABLISHED && queuer && queuer->ue->ino == FAKE_INO) { -+ } else if ((ui->ue->state == TCP_ESTABLISHED && ui->ue->type == SOCK_STREAM) && queuer && -+ queuer->ue->ino == FAKE_INO) { - int ret, sks[2]; - -- if (ui->ue->type != SOCK_STREAM) { -- pr_err("Non-stream socket %u in established state\n", ui->ue->ino); -- return -1; -- } -- - if (ui->ue->shutdown != SK_SHUTDOWN__BOTH) { - pr_err("Wrong shutdown/peer state for %u\n", ui->ue->ino); - return -1; --- -2.35.1 - diff --git a/0063-ci-Enable-disabled-unix-socket-related-tests.patch b/0063-ci-Enable-disabled-unix-socket-related-tests.patch deleted file mode 100644 index 5905600..0000000 --- a/0063-ci-Enable-disabled-unix-socket-related-tests.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 1d4d1d36e6b01b0ec7d87e3f0c6e6464929f9e21 Mon Sep 17 00:00:00 2001 -From: Bui Quang Minh -Date: Tue, 7 Dec 2021 23:40:12 +0700 -Subject: [PATCH 063/249] ci: Enable disabled unix socket related tests - -As the unix socket broken tests have been fixed in the pull request - -https://github.com/checkpoint-restore/criu/pull/1680 - -We re-enable these tests. - -Signed-off-by: Bui Quang Minh ---- - scripts/ci/vagrant.sh | 4 +--- - 1 file changed, 1 insertion(+), 3 deletions(-) - -diff --git a/scripts/ci/vagrant.sh b/scripts/ci/vagrant.sh -index 25343f96c..40c8416e1 100755 ---- a/scripts/ci/vagrant.sh -+++ b/scripts/ci/vagrant.sh -@@ -50,9 +50,7 @@ fedora-no-vdso() { - vagrant reload - ssh default cat /proc/cmdline - ssh default 'cd /vagrant; tar xf criu.tar; cd criu; make -j 4' -- # Disabling tests which are broken on 5.15 -- # https://github.com/checkpoint-restore/criu/issues/1669 -- ssh default 'cd /vagrant/criu/test; sudo ./zdtm.py run -a --keep-going -x zdtm/static/socket_close_data -x zdtm/static/socket_close_data01 -x zdtm/static/fifo_upon_unix_socket01 -x zdtm/static/sk-unix-mntns -x zdtm/static/fifo_upon_unix_socket00 -x zdtm/static/socket-ext -x zdtm/static/sk-unix01 -x zdtm/static/socket_dgram_data -x zdtm/static/sockets_dgram -x zdtm/static/sk-unix-dgram-ghost' -+ ssh default 'cd /vagrant/criu/test; sudo ./zdtm.py run -a --keep-going' - # This test (pidfd_store_sk) requires pidfd_getfd syscall which is guaranteed in Fedora 33. - # It is also skipped from -a because it runs in RPC mode only - ssh default 'cd /vagrant/criu/test; sudo ./zdtm.py run -t zdtm/transition/pidfd_store_sk --rpc --pre 2' --- -2.35.1 - diff --git a/0064-ci-install-procps-in-Alpine.patch b/0064-ci-install-procps-in-Alpine.patch deleted file mode 100644 index 88568d1..0000000 --- a/0064-ci-install-procps-in-Alpine.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 6ed22ff628c5cca460584b25be6c5bc7a241b01c Mon Sep 17 00:00:00 2001 -From: Radostin Stoyanov -Date: Fri, 10 Dec 2021 15:35:29 +0000 -Subject: [PATCH 064/249] ci: install procps in Alpine - -The version of ps in Alpine image by default is very limited. -It is based on the one from busybox and doesn't support options -such as '-p'. - -Signed-off-by: Radostin Stoyanov ---- - scripts/build/Dockerfile.alpine | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/scripts/build/Dockerfile.alpine b/scripts/build/Dockerfile.alpine -index a6579c0bb..cab72e8a1 100644 ---- a/scripts/build/Dockerfile.alpine -+++ b/scripts/build/Dockerfile.alpine -@@ -6,6 +6,7 @@ RUN apk update && apk add \ - bash \ - build-base \ - coreutils \ -+ procps \ - git \ - gnutls-dev \ - libaio-dev \ --- -2.35.1 - diff --git a/0065-test-another-try-to-correctly-fix-the-kernel-version.patch b/0065-test-another-try-to-correctly-fix-the-kernel-version.patch deleted file mode 100644 index c6cd645..0000000 --- a/0065-test-another-try-to-correctly-fix-the-kernel-version.patch +++ /dev/null @@ -1,34 +0,0 @@ -From afa186872a305406482e8d1ff02aae092a9dfdc0 Mon Sep 17 00:00:00 2001 -From: Adrian Reber -Date: Fri, 3 Dec 2021 16:59:56 +0000 -Subject: [PATCH 065/249] test: another try to correctly fix the kernel version - -We try to disable time namespace based testing for kernels older than -5.11. But we fail to come up with the correct if condition. - -This changes (major <= 5) to (major < 5). There are no kernels with -major > 5 so currently the time namespace based are never run. This -should finally change it to run time namespace based tests on kernel -versions newer than 5.10. - -Signed-off-by: Adrian Reber ---- - test/zdtm_ct.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/test/zdtm_ct.c b/test/zdtm_ct.c -index e8d45a9e7..e4b17a512 100644 ---- a/test/zdtm_ct.c -+++ b/test/zdtm_ct.c -@@ -61,7 +61,7 @@ static int create_timens() - if (sscanf(buf.release, "%u.%u", &major, &minor) != 2) - return -1; - -- if ((major <= 5) || (major == 5 && minor < 11)) { -+ if ((major < 5) || (major == 5 && minor < 11)) { - fprintf(stderr, "timens isn't supported on %s\n", buf.release); - return 0; - } --- -2.35.1 - diff --git a/0066-x86-compel-fault-inject-bound-xsave-features-set.patch b/0066-x86-compel-fault-inject-bound-xsave-features-set.patch deleted file mode 100644 index 026f235..0000000 --- a/0066-x86-compel-fault-inject-bound-xsave-features-set.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 80cabb69fb7bc028e632796a48b930c2238ddd08 Mon Sep 17 00:00:00 2001 -From: Alexander Mikhalitsyn -Date: Mon, 13 Dec 2021 15:19:50 +0300 -Subject: [PATCH 066/249] x86/compel/fault-inject: bound xsave features set - -Since -e2e8be37 ("x86/compel/fault-inject: Add a fault-injection for corrupting extended regset") -we doing fault-injection test for C/R of threads register set by filling tasks -xsave structures with the garbage. But there are some features for which that's not -safe. It leads to failures like described in #1635 - -In this particular case we meet the problem with PKRU feature, the problem -that after corrupting pkru registers we may restrict access to some vma areas, -so, after that process with the parasite injected get's segfault and crashes. - -Let's manually specify which features is save to fill with the garbage by -keeping proper XFEATURE_MASK_FAULTINJ mask value. - -Fixes: e2e8be37 ("x86/compel/fault-inject: Add a fault-injection for corrupting extended regset") - -https://github.com/checkpoint-restore/criu/issues/1635 - -Signed-off-by: Alexander Mikhalitsyn ---- - compel/arch/x86/src/lib/include/uapi/asm/fpu.h | 5 +++++ - compel/arch/x86/src/lib/infect.c | 1 + - 2 files changed, 6 insertions(+) - -diff --git a/compel/arch/x86/src/lib/include/uapi/asm/fpu.h b/compel/arch/x86/src/lib/include/uapi/asm/fpu.h -index a16b658af..c8ebda097 100644 ---- a/compel/arch/x86/src/lib/include/uapi/asm/fpu.h -+++ b/compel/arch/x86/src/lib/include/uapi/asm/fpu.h -@@ -80,6 +80,11 @@ enum xfeature { - (XFEATURE_MASK_FP | XFEATURE_MASK_SSE | XFEATURE_MASK_YMM | XFEATURE_MASK_OPMASK | XFEATURE_MASK_ZMM_Hi256 | \ - XFEATURE_MASK_Hi16_ZMM | XFEATURE_MASK_PKRU | XFEATURE_MASK_BNDREGS | XFEATURE_MASK_BNDCSR) - -+/* xsave structure features which is safe to fill with garbage (see validate_random_xstate()) */ -+#define XFEATURE_MASK_FAULTINJ \ -+ (XFEATURE_MASK_FP | XFEATURE_MASK_SSE | XFEATURE_MASK_YMM | XFEATURE_MASK_OPMASK | XFEATURE_MASK_ZMM_Hi256 | \ -+ XFEATURE_MASK_Hi16_ZMM) -+ - struct fpx_sw_bytes { - uint32_t magic1; - uint32_t extended_size; -diff --git a/compel/arch/x86/src/lib/infect.c b/compel/arch/x86/src/lib/infect.c -index 2f6c557d0..37b0ee327 100644 ---- a/compel/arch/x86/src/lib/infect.c -+++ b/compel/arch/x86/src/lib/infect.c -@@ -254,6 +254,7 @@ static void validate_random_xstate(struct xsave_struct *xsave) - /* No unknown or supervisor features may be set */ - hdr->xstate_bv &= XFEATURE_MASK_USER; - hdr->xstate_bv &= ~XFEATURE_MASK_SUPERVISOR; -+ hdr->xstate_bv &= XFEATURE_MASK_FAULTINJ; - - for (i = 0; i < XFEATURE_MAX; i++) { - if (!compel_fpu_has_feature(i)) --- -2.35.1 - diff --git a/0067-x86-compel-fault-inject-print-the-initial-seed.patch b/0067-x86-compel-fault-inject-print-the-initial-seed.patch deleted file mode 100644 index 0d6a529..0000000 --- a/0067-x86-compel-fault-inject-print-the-initial-seed.patch +++ /dev/null @@ -1,41 +0,0 @@ -From efd0cc2c4fba3bc72133f022e3fe393a0346cb51 Mon Sep 17 00:00:00 2001 -From: Alexander Mikhalitsyn -Date: Mon, 13 Dec 2021 15:32:00 +0300 -Subject: [PATCH 067/249] x86/compel/fault-inject: print the initial seed - -Fixes: e2e8be37 ("x86/compel/fault-inject: Add a fault-injection for corrupting extended regset") - -Signed-off-by: Alexander Mikhalitsyn ---- - compel/arch/x86/src/lib/infect.c | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/compel/arch/x86/src/lib/infect.c b/compel/arch/x86/src/lib/infect.c -index 37b0ee327..de9013c27 100644 ---- a/compel/arch/x86/src/lib/infect.c -+++ b/compel/arch/x86/src/lib/infect.c -@@ -283,10 +283,10 @@ static int corrupt_extregs(pid_t pid) - bool use_xsave = compel_cpu_has_feature(X86_FEATURE_OSXSAVE); - user_fpregs_struct_t ext_regs; - int *rand_to = (int *)&ext_regs; -- unsigned int seed; -+ unsigned int seed, init_seed; - size_t i; - -- seed = time(NULL); -+ init_seed = seed = time(NULL); - for (i = 0; i < sizeof(ext_regs) / sizeof(int); i++) - *rand_to++ = rand_r(&seed); - -@@ -296,7 +296,7 @@ static int corrupt_extregs(pid_t pid) - * - zdtm.py will grep it auto-magically from logs - * (and the seed will be known from an automatical testing) - */ -- pr_err("Corrupting %s for %d, seed %u\n", use_xsave ? "xsave" : "fpuregs", pid, seed); -+ pr_err("Corrupting %s for %d, seed %u\n", use_xsave ? "xsave" : "fpuregs", pid, init_seed); - - if (!use_xsave) { - if (ptrace(PTRACE_SETFPREGS, pid, NULL, &ext_regs)) { --- -2.35.1 - diff --git a/0068-ci-enable-x86-xsave-fault-injection-tests-back.patch b/0068-ci-enable-x86-xsave-fault-injection-tests-back.patch deleted file mode 100644 index 58ebd7f..0000000 --- a/0068-ci-enable-x86-xsave-fault-injection-tests-back.patch +++ /dev/null @@ -1,32 +0,0 @@ -From e92aca9152507f3800cb39a8d9a1acc7ca5e130a Mon Sep 17 00:00:00 2001 -From: Alexander Mikhalitsyn -Date: Mon, 13 Dec 2021 15:46:47 +0300 -Subject: [PATCH 068/249] ci: enable x86 xsave fault injection tests back - -Signed-off-by: Alexander Mikhalitsyn ---- - test/jenkins/criu-fault.sh | 8 -------- - 1 file changed, 8 deletions(-) - -diff --git a/test/jenkins/criu-fault.sh b/test/jenkins/criu-fault.sh -index 0c5c180e9..9f20091cc 100755 ---- a/test/jenkins/criu-fault.sh -+++ b/test/jenkins/criu-fault.sh -@@ -28,14 +28,6 @@ fi - ./test/zdtm.py run -t zdtm/static/maps04 --fault 131 --report report --pre 2:1 || fail - ./test/zdtm.py run -t zdtm/transition/maps008 --fault 131 --report report --pre 2:1 || fail - ./test/zdtm.py run -t zdtm/static/maps01 --fault 132 -f h || fail -- --# Error injection with --fault 134 fails on newer CPUs used in Circle CI on EC2 --# Skip the --fault 134 tests --# https://github.com/checkpoint-restore/criu/issues/1635 --if [ -n "$CIRCLECI" ]; then -- exit 0 --fi -- - # 134 is corrupting extended registers set, should run in a sub-thread (fpu03) - # without restore (that will check if parasite corrupts extended registers) - ./test/zdtm.py run -t zdtm/static/fpu03 --fault 134 -f h --norst || fail --- -2.35.1 - diff --git a/0069-Add-documentation-for-timeout-option.patch b/0069-Add-documentation-for-timeout-option.patch deleted file mode 100644 index c94a704..0000000 --- a/0069-Add-documentation-for-timeout-option.patch +++ /dev/null @@ -1,48 +0,0 @@ -From b1c13f61a2012f35466768be1de0b3761934fc3a Mon Sep 17 00:00:00 2001 -From: Radostin Stoyanov -Date: Tue, 14 Dec 2021 12:54:19 +0000 -Subject: [PATCH 069/249] Add documentation for --timeout option - -The --timeout option was introduced in [1] to prevent criu dump from -being able to hang indefinitely and allow users to adjust the time limit -in seconds for collecting tasks during the dump operation. - -[1] https://github.com/checkpoint-restore/criu/commit/d0ff730 - -Signed-off-by: Radostin Stoyanov ---- - Documentation/criu.txt | 4 ++++ - criu/crtools.c | 2 ++ - 2 files changed, 6 insertions(+) - -diff --git a/Documentation/criu.txt b/Documentation/criu.txt -index 4c6885fc9..f41b1898c 100644 ---- a/Documentation/criu.txt -+++ b/Documentation/criu.txt -@@ -367,6 +367,10 @@ mount -t cgroup -o devices,freezer none devices,freezer - Allows to link unlinked files back, if possible (modifies filesystem - during *restore*). - -+*--timeout* 'number':: -+ Set a time limit in seconds for collecting tasks during the -+ dump operation. The timeout is 10 seconds by default. -+ - *--ghost-limit* 'size':: - Set the maximum size of deleted file to be carried inside image. - By default, up to 1M file is allowed. Using this -diff --git a/criu/crtools.c b/criu/crtools.c -index 81c0aa963..da47bd684 100644 ---- a/criu/crtools.c -+++ b/criu/crtools.c -@@ -391,6 +391,8 @@ usage: - " -j|--" OPT_SHELL_JOB " allow one to dump and restore shell jobs\n" - " -l|--" OPT_FILE_LOCKS " handle file locks, for safety, only used for container\n" - " -L|--libdir path to a plugin directory (by default " CR_PLUGIN_DEFAULT ")\n" -+ " --timeout NUM a timeout (in seconds) on collecting tasks during dump\n" -+ " (default 10 seconds)\n" - " --force-irmap force resolving names for inotify/fsnotify watches\n" - " --irmap-scan-path FILE\n" - " add a path the irmap hints to scan\n" --- -2.35.1 - diff --git a/0070-usernsd-UNS_FDOUT-should-not-require-an-input-descri.patch b/0070-usernsd-UNS_FDOUT-should-not-require-an-input-descri.patch deleted file mode 100644 index 83b229a..0000000 --- a/0070-usernsd-UNS_FDOUT-should-not-require-an-input-descri.patch +++ /dev/null @@ -1,32 +0,0 @@ -From a03504744be5e55913c690bf1ed26b0f0182af1d Mon Sep 17 00:00:00 2001 -From: Andrei Vagin -Date: Tue, 14 Dec 2021 08:19:16 -0800 -Subject: [PATCH 070/249] usernsd: UNS_FDOUT should not require an input - descriptor - -UNS_FDOUT means only that a userns call will return a file descriptor. - -Signed-off-by: Andrei Vagin ---- - criu/namespaces.c | 5 ----- - 1 file changed, 5 deletions(-) - -diff --git a/criu/namespaces.c b/criu/namespaces.c -index 7fa58682b..c36e631cf 100644 ---- a/criu/namespaces.c -+++ b/criu/namespaces.c -@@ -1330,11 +1330,6 @@ static int usernsd(int sk) - unsc_msg_pid_fd(&um, &pid, &fd); - pr_debug("uns: daemon calls %p (%d, %d, %x)\n", call, pid, fd, flags); - -- if (fd < 0 && flags & UNS_FDOUT) { -- pr_err("uns: bad flags/fd %p %d %x\n", call, fd, flags); -- BUG(); -- } -- - /* - * Caller has sent us bare address of the routine it - * wants to call. Since the caller is fork()-ed from the --- -2.35.1 - diff --git a/0071-libcriu-add-setting-lsm-mount-context-to-libcriu.patch b/0071-libcriu-add-setting-lsm-mount-context-to-libcriu.patch deleted file mode 100644 index 170d14b..0000000 --- a/0071-libcriu-add-setting-lsm-mount-context-to-libcriu.patch +++ /dev/null @@ -1,67 +0,0 @@ -From c94a71639925fd56fa59bdf74ba416f3306c1a72 Mon Sep 17 00:00:00 2001 -From: Adrian Reber -Date: Wed, 1 Dec 2021 11:08:53 +0000 -Subject: [PATCH 071/249] libcriu: add setting lsm-mount-context to libcriu - -Signed-off-by: Adrian Reber ---- - lib/c/criu.c | 15 +++++++++++++++ - lib/c/criu.h | 2 ++ - 2 files changed, 17 insertions(+) - -diff --git a/lib/c/criu.c b/lib/c/criu.c -index ddc6e0731..4ee189aca 100644 ---- a/lib/c/criu.c -+++ b/lib/c/criu.c -@@ -238,6 +238,7 @@ void criu_local_free_opts(criu_opts *opts) - free(opts->rpc->freeze_cgroup); - free(opts->rpc->log_file); - free(opts->rpc->lsm_profile); -+ free(opts->rpc->lsm_mount_context); - free(opts->rpc); - criu_free_service(opts); - free(opts); -@@ -651,6 +652,20 @@ int criu_set_lsm_profile(const char *name) - return criu_local_set_lsm_profile(global_opts, name); - } - -+int criu_local_set_lsm_mount_context(criu_opts *opts, const char *name) -+{ -+ opts->rpc->lsm_mount_context = strdup(name); -+ if (opts->rpc->lsm_mount_context == NULL) { -+ return -ENOMEM; -+ } -+ return 0; -+} -+ -+int criu_set_lsm_mount_context(const char *name) -+{ -+ return criu_local_set_lsm_mount_context(global_opts, name); -+} -+ - void criu_local_set_timeout(criu_opts *opts, unsigned int timeout) - { - opts->rpc->timeout = timeout; -diff --git a/lib/c/criu.h b/lib/c/criu.h -index 949902f55..a374b37f8 100644 ---- a/lib/c/criu.h -+++ b/lib/c/criu.h -@@ -92,6 +92,7 @@ void criu_set_manage_cgroups(bool manage); - void criu_set_manage_cgroups_mode(enum criu_cg_mode mode); - int criu_set_freeze_cgroup(const char *name); - int criu_set_lsm_profile(const char *name); -+int criu_set_lsm_mount_context(const char *name); - void criu_set_timeout(unsigned int timeout); - void criu_set_auto_ext_mnt(bool val); - void criu_set_ext_sharing(bool val); -@@ -249,6 +250,7 @@ void criu_local_set_manage_cgroups(criu_opts *opts, bool manage); - void criu_local_set_manage_cgroups_mode(criu_opts *opts, enum criu_cg_mode mode); - int criu_local_set_freeze_cgroup(criu_opts *opts, const char *name); - int criu_local_set_lsm_profile(criu_opts *opts, const char *name); -+int criu_local_set_lsm_mount_context(criu_opts *opts, const char *name); - void criu_local_set_timeout(criu_opts *opts, unsigned int timeout); - void criu_local_set_auto_ext_mnt(criu_opts *opts, bool val); - void criu_local_set_ext_sharing(criu_opts *opts, bool val); --- -2.35.1 - diff --git a/0072-ci-use-unstable-release-for-cross-compile.patch b/0072-ci-use-unstable-release-for-cross-compile.patch deleted file mode 100644 index 41af95d..0000000 --- a/0072-ci-use-unstable-release-for-cross-compile.patch +++ /dev/null @@ -1,182 +0,0 @@ -From eb0323c25ea6d3ddab0e85c9f24d29154155ae4f Mon Sep 17 00:00:00 2001 -From: Radostin Stoyanov -Date: Sat, 18 Dec 2021 17:25:17 +0000 -Subject: [PATCH 072/249] ci: use unstable release for cross-compile - -We added cross-compile tests with testing debian release to be able to -replicate the error reported in #1653, however, installing build -dependencies in this release currently fails with the following error: - -libc6-dev:armhf : Breaks: libc6-dev-armhf-cross (< 2.33~) but 2.32-1cross4 is to be installed - -This is not something we can fix, therefore using the debian unstable -release (instead of testing) could be more reliable option for our CI. -This would still replicate the problem reported in #1653. - -Signed-off-by: Radostin Stoyanov ---- - .github/workflows/cross-compile.yml | 8 ++++---- - scripts/build/Dockerfile.aarch64-testing-cross.tmpl | 1 - - ...ng-cross.hdr => Dockerfile.aarch64-unstable-cross.hdr} | 0 - scripts/build/Dockerfile.aarch64-unstable-cross.tmpl | 1 + - scripts/build/Dockerfile.armv7-testing-cross.tmpl | 1 - - ...ting-cross.hdr => Dockerfile.armv7-unstable-cross.hdr} | 0 - scripts/build/Dockerfile.armv7-unstable-cross.tmpl | 1 + - scripts/build/Dockerfile.mips64el-testing-cross.tmpl | 1 - - ...g-cross.hdr => Dockerfile.mips64el-unstable-cross.hdr} | 0 - scripts/build/Dockerfile.mips64el-unstable-cross.tmpl | 1 + - scripts/build/Dockerfile.ppc64-testing-cross.tmpl | 1 - - ...ting-cross.hdr => Dockerfile.ppc64-unstable-cross.hdr} | 0 - scripts/build/Dockerfile.ppc64-unstable-cross.tmpl | 1 + - ....testing-cross.tmpl => Dockerfile.unstable-cross.tmpl} | 2 +- - scripts/build/Makefile | 4 ++-- - 15 files changed, 11 insertions(+), 11 deletions(-) - delete mode 120000 scripts/build/Dockerfile.aarch64-testing-cross.tmpl - rename scripts/build/{Dockerfile.aarch64-testing-cross.hdr => Dockerfile.aarch64-unstable-cross.hdr} (100%) - create mode 120000 scripts/build/Dockerfile.aarch64-unstable-cross.tmpl - delete mode 120000 scripts/build/Dockerfile.armv7-testing-cross.tmpl - rename scripts/build/{Dockerfile.armv7-testing-cross.hdr => Dockerfile.armv7-unstable-cross.hdr} (100%) - create mode 120000 scripts/build/Dockerfile.armv7-unstable-cross.tmpl - delete mode 120000 scripts/build/Dockerfile.mips64el-testing-cross.tmpl - rename scripts/build/{Dockerfile.mips64el-testing-cross.hdr => Dockerfile.mips64el-unstable-cross.hdr} (100%) - create mode 120000 scripts/build/Dockerfile.mips64el-unstable-cross.tmpl - delete mode 120000 scripts/build/Dockerfile.ppc64-testing-cross.tmpl - rename scripts/build/{Dockerfile.ppc64-testing-cross.hdr => Dockerfile.ppc64-unstable-cross.hdr} (100%) - create mode 120000 scripts/build/Dockerfile.ppc64-unstable-cross.tmpl - rename scripts/build/{Dockerfile.testing-cross.tmpl => Dockerfile.unstable-cross.tmpl} (93%) - -diff --git a/.github/workflows/cross-compile.yml b/.github/workflows/cross-compile.yml -index eec6eb577..461a6e618 100644 ---- a/.github/workflows/cross-compile.yml -+++ b/.github/workflows/cross-compile.yml -@@ -10,13 +10,13 @@ jobs: - matrix: - target: [ - armv7-stable-cross, -- armv7-testing-cross, -+ armv7-unstable-cross, - aarch64-stable-cross, -- aarch64-testing-cross, -+ aarch64-unstable-cross, - ppc64-stable-cross, -- ppc64-testing-cross, -+ ppc64-unstable-cross, - mips64el-stable-cross, -- mips64el-testing-cross -+ mips64el-unstable-cross - ] - - steps: -diff --git a/scripts/build/Dockerfile.aarch64-testing-cross.tmpl b/scripts/build/Dockerfile.aarch64-testing-cross.tmpl -deleted file mode 120000 -index c1dd38b21..000000000 ---- a/scripts/build/Dockerfile.aarch64-testing-cross.tmpl -+++ /dev/null -@@ -1 +0,0 @@ --Dockerfile.testing-cross.tmpl -\ No newline at end of file -diff --git a/scripts/build/Dockerfile.aarch64-testing-cross.hdr b/scripts/build/Dockerfile.aarch64-unstable-cross.hdr -similarity index 100% -rename from scripts/build/Dockerfile.aarch64-testing-cross.hdr -rename to scripts/build/Dockerfile.aarch64-unstable-cross.hdr -diff --git a/scripts/build/Dockerfile.aarch64-unstable-cross.tmpl b/scripts/build/Dockerfile.aarch64-unstable-cross.tmpl -new file mode 120000 -index 000000000..955ae1fd4 ---- /dev/null -+++ b/scripts/build/Dockerfile.aarch64-unstable-cross.tmpl -@@ -0,0 +1 @@ -+Dockerfile.unstable-cross.tmpl -\ No newline at end of file -diff --git a/scripts/build/Dockerfile.armv7-testing-cross.tmpl b/scripts/build/Dockerfile.armv7-testing-cross.tmpl -deleted file mode 120000 -index c1dd38b21..000000000 ---- a/scripts/build/Dockerfile.armv7-testing-cross.tmpl -+++ /dev/null -@@ -1 +0,0 @@ --Dockerfile.testing-cross.tmpl -\ No newline at end of file -diff --git a/scripts/build/Dockerfile.armv7-testing-cross.hdr b/scripts/build/Dockerfile.armv7-unstable-cross.hdr -similarity index 100% -rename from scripts/build/Dockerfile.armv7-testing-cross.hdr -rename to scripts/build/Dockerfile.armv7-unstable-cross.hdr -diff --git a/scripts/build/Dockerfile.armv7-unstable-cross.tmpl b/scripts/build/Dockerfile.armv7-unstable-cross.tmpl -new file mode 120000 -index 000000000..955ae1fd4 ---- /dev/null -+++ b/scripts/build/Dockerfile.armv7-unstable-cross.tmpl -@@ -0,0 +1 @@ -+Dockerfile.unstable-cross.tmpl -\ No newline at end of file -diff --git a/scripts/build/Dockerfile.mips64el-testing-cross.tmpl b/scripts/build/Dockerfile.mips64el-testing-cross.tmpl -deleted file mode 120000 -index c1dd38b21..000000000 ---- a/scripts/build/Dockerfile.mips64el-testing-cross.tmpl -+++ /dev/null -@@ -1 +0,0 @@ --Dockerfile.testing-cross.tmpl -\ No newline at end of file -diff --git a/scripts/build/Dockerfile.mips64el-testing-cross.hdr b/scripts/build/Dockerfile.mips64el-unstable-cross.hdr -similarity index 100% -rename from scripts/build/Dockerfile.mips64el-testing-cross.hdr -rename to scripts/build/Dockerfile.mips64el-unstable-cross.hdr -diff --git a/scripts/build/Dockerfile.mips64el-unstable-cross.tmpl b/scripts/build/Dockerfile.mips64el-unstable-cross.tmpl -new file mode 120000 -index 000000000..955ae1fd4 ---- /dev/null -+++ b/scripts/build/Dockerfile.mips64el-unstable-cross.tmpl -@@ -0,0 +1 @@ -+Dockerfile.unstable-cross.tmpl -\ No newline at end of file -diff --git a/scripts/build/Dockerfile.ppc64-testing-cross.tmpl b/scripts/build/Dockerfile.ppc64-testing-cross.tmpl -deleted file mode 120000 -index c1dd38b21..000000000 ---- a/scripts/build/Dockerfile.ppc64-testing-cross.tmpl -+++ /dev/null -@@ -1 +0,0 @@ --Dockerfile.testing-cross.tmpl -\ No newline at end of file -diff --git a/scripts/build/Dockerfile.ppc64-testing-cross.hdr b/scripts/build/Dockerfile.ppc64-unstable-cross.hdr -similarity index 100% -rename from scripts/build/Dockerfile.ppc64-testing-cross.hdr -rename to scripts/build/Dockerfile.ppc64-unstable-cross.hdr -diff --git a/scripts/build/Dockerfile.ppc64-unstable-cross.tmpl b/scripts/build/Dockerfile.ppc64-unstable-cross.tmpl -new file mode 120000 -index 000000000..955ae1fd4 ---- /dev/null -+++ b/scripts/build/Dockerfile.ppc64-unstable-cross.tmpl -@@ -0,0 +1 @@ -+Dockerfile.unstable-cross.tmpl -\ No newline at end of file -diff --git a/scripts/build/Dockerfile.testing-cross.tmpl b/scripts/build/Dockerfile.unstable-cross.tmpl -similarity index 93% -rename from scripts/build/Dockerfile.testing-cross.tmpl -rename to scripts/build/Dockerfile.unstable-cross.tmpl -index 1d5565310..dacfd96ef 100644 ---- a/scripts/build/Dockerfile.testing-cross.tmpl -+++ b/scripts/build/Dockerfile.unstable-cross.tmpl -@@ -1,7 +1,7 @@ - COPY scripts/ci/apt-install /bin/apt-install - - # Add the cross compiler sources --RUN echo "deb http://deb.debian.org/debian/ testing main" >> /etc/apt/sources.list && \ -+RUN echo "deb http://deb.debian.org/debian/ unstable main" >> /etc/apt/sources.list && \ - dpkg --add-architecture ${DEBIAN_ARCH} - - RUN apt-install \ -diff --git a/scripts/build/Makefile b/scripts/build/Makefile -index b24fc80ea..2c006ad87 100644 ---- a/scripts/build/Makefile -+++ b/scripts/build/Makefile -@@ -1,7 +1,7 @@ - ARCHES := x86_64 fedora-asan fedora-rawhide centos7 armv7hf centos8 - STABLE_CROSS_ARCHES := armv7-stable-cross aarch64-stable-cross ppc64-stable-cross mips64el-stable-cross --TESTING_CROSS_ARCHES := armv7-testing-cross aarch64-testing-cross ppc64-testing-cross mips64el-testing-cross --NON_CLANG := $(TESTING_CROSS_ARCHES) $(STABLE_CROSS_ARCHES) -+UNSTABLE_CROSS_ARCHES := armv7-unstable-cross aarch64-unstable-cross ppc64-unstable-cross mips64el-unstable-cross -+NON_CLANG := $(UNSTABLE_CROSS_ARCHES) $(STABLE_CROSS_ARCHES) - CREATE_DOCKERFILES := $(ARCHES) $(NON_CLANG) - TARGETS := $(ARCHES) alpine archlinux - TARGETS_CLANG := $(addsuffix $(TARGETS),-clang) --- -2.35.1 - diff --git a/0073-ci-disable-glibc-rseq-support.patch b/0073-ci-disable-glibc-rseq-support.patch deleted file mode 100644 index fb1232f..0000000 --- a/0073-ci-disable-glibc-rseq-support.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 23ad9ca9074fdf8adc6d155c665853bee0e2190b Mon Sep 17 00:00:00 2001 -From: Radostin Stoyanov -Date: Fri, 17 Dec 2021 03:01:49 +0000 -Subject: [PATCH 073/249] ci: disable glibc rseq support - -This patch sets the glibc.pthread.rseq tunable [1] to disable rseq -support in glibc as a temporary solution for the problem described in -[2]. This would allow us to run CI tests until CRIU has rseq support. - -This commit also disables the rpc tests as they fail even -when GLIBC_TUNABLES is set. - -[1] https://sourceware.org/git/?p=glibc.git;a=commit;h=e3e589829d16af9f7e73c7b70f74f3c5d5003e45 -[2] https://github.com/checkpoint-restore/criu/issues/1696 - -Signed-off-by: Radostin Stoyanov ---- - scripts/build/Dockerfile.fedora.tmpl | 3 +++ - scripts/ci/run-ci-tests.sh | 7 ++++++- - 2 files changed, 9 insertions(+), 1 deletion(-) - -diff --git a/scripts/build/Dockerfile.fedora.tmpl b/scripts/build/Dockerfile.fedora.tmpl -index 9d3bb0f87..fd4ba4aef 100644 ---- a/scripts/build/Dockerfile.fedora.tmpl -+++ b/scripts/build/Dockerfile.fedora.tmpl -@@ -1,5 +1,8 @@ - ARG CC=gcc - -+# FIXME: Temporary solution for https://github.com/checkpoint-restore/criu/issues/1696 -+ENV GLIBC_TUNABLES=glibc.pthread.rseq=0 -+ - COPY scripts/ci/prepare-for-fedora-rawhide.sh /bin/prepare-for-fedora-rawhide.sh - RUN /bin/prepare-for-fedora-rawhide.sh - -diff --git a/scripts/ci/run-ci-tests.sh b/scripts/ci/run-ci-tests.sh -index 096f907fb..bf7331142 100755 ---- a/scripts/ci/run-ci-tests.sh -+++ b/scripts/ci/run-ci-tests.sh -@@ -235,7 +235,12 @@ if [ -n "$TRAVIS" ] || [ -n "$CIRCLECI" ]; then - # Error (criu/tty.c:1014): tty: Don't have tty to inherit session from, aborting - make -C test/others/shell-job/ run - fi --make -C test/others/rpc/ run -+ -+# FIXME: rpc tests fail even with set glibc tunable -+# https://github.com/checkpoint-restore/criu/issues/1696 -+if [ "$GLIBC_TUNABLES" != "glibc.pthread.rseq=0" ]; then -+ make -C test/others/rpc/ run -+fi - - ./test/zdtm.py run -t zdtm/static/env00 --sibling - --- -2.35.1 - diff --git a/0074-libcriu-add-single-pre-dump-support.patch b/0074-libcriu-add-single-pre-dump-support.patch deleted file mode 100644 index e3eb5ac..0000000 --- a/0074-libcriu-add-single-pre-dump-support.patch +++ /dev/null @@ -1,185 +0,0 @@ -From 3c27c8d7a494bcf59b08f9fe203d1e408d1b6a1f Mon Sep 17 00:00:00 2001 -From: Adrian Reber -Date: Fri, 3 Dec 2021 14:32:33 +0000 -Subject: [PATCH 074/249] libcriu: add single pre-dump support - -In contrast to the CLI it is not possible to do a single pre-dump via -RPC and thus libcriu. In cr-service.c pre-dump always goes into a -pre-dump loop followed by a final dump. runc already works around this -to only do a single pre-dump by killing the CRIU process waiting for the -message for the final dump. - -Trying to implement pre-dump in crun via libcriu it is not as easy to -work around CRIU's pre-dump loop expectations as with runc that directly -talks to CRIU via RPC. - -We know that LXC/LXD also does single pre-dumps using the CLI and runc -also only does single pre-dumps by misusing the pre-dump loop interface. - -With this commit it is possible to trigger a single pre-dump via RPC and -libcriu without misusing the interface provided via cr-service.c. So -this commit basically updates CRIU to the existing use cases. - -The existing pre-dump loop still sounds like a very good idea, but so -far most tools have decided to implement the pre-dump loop themselves. - -With this change we can implement pre-dump in crun to match what is -currently implemented in runc. - -Signed-off-by: Adrian Reber ---- - criu/cr-service.c | 13 ++++++++----- - images/rpc.proto | 2 ++ - lib/c/criu.c | 21 ++++++++++++++++++--- - lib/c/criu.h | 2 ++ - 4 files changed, 30 insertions(+), 8 deletions(-) - -diff --git a/criu/cr-service.c b/criu/cr-service.c -index 0f8bc4cc1..80d12c7b0 100644 ---- a/criu/cr-service.c -+++ b/criu/cr-service.c -@@ -169,11 +169,11 @@ int send_criu_dump_resp(int socket_fd, bool success, bool restored) - return send_criu_msg(socket_fd, &msg); - } - --static int send_criu_pre_dump_resp(int socket_fd, bool success) -+static int send_criu_pre_dump_resp(int socket_fd, bool success, bool single) - { - CriuResp msg = CRIU_RESP__INIT; - -- msg.type = CRIU_REQ_TYPE__PRE_DUMP; -+ msg.type = single ? CRIU_REQ_TYPE__SINGLE_PRE_DUMP : CRIU_REQ_TYPE__PRE_DUMP; - msg.success = success; - set_resp_err(&msg); - -@@ -845,7 +845,7 @@ out: - return send_criu_msg(sk, &resp); - } - --static int pre_dump_using_req(int sk, CriuOpts *req) -+static int pre_dump_using_req(int sk, CriuOpts *req, bool single) - { - int pid, status; - bool success = false; -@@ -886,7 +886,7 @@ static int pre_dump_using_req(int sk, CriuOpts *req) - - success = true; - out: -- if (send_criu_pre_dump_resp(sk, success) == -1) { -+ if (send_criu_pre_dump_resp(sk, success, single) == -1) { - pr_perror("Can't send pre-dump resp"); - success = false; - } -@@ -899,7 +899,7 @@ static int pre_dump_loop(int sk, CriuReq *msg) - int ret; - - do { -- ret = pre_dump_using_req(sk, msg->opts); -+ ret = pre_dump_using_req(sk, msg->opts, false); - if (ret < 0) - return ret; - -@@ -1271,6 +1271,9 @@ more: - case CRIU_REQ_TYPE__VERSION: - ret = handle_version(sk, msg); - break; -+ case CRIU_REQ_TYPE__SINGLE_PRE_DUMP: -+ ret = pre_dump_using_req(sk, msg->opts, true); -+ break; - - default: - send_criu_err(sk, "Invalid req"); -diff --git a/images/rpc.proto b/images/rpc.proto -index a9f51ac4b..1d3befd23 100644 ---- a/images/rpc.proto -+++ b/images/rpc.proto -@@ -172,6 +172,8 @@ enum criu_req_type { - - WAIT_PID = 11; - PAGE_SERVER_CHLD = 12; -+ -+ SINGLE_PRE_DUMP = 13; - } - - /* -diff --git a/lib/c/criu.c b/lib/c/criu.c -index 4ee189aca..500574e33 100644 ---- a/lib/c/criu.c -+++ b/lib/c/criu.c -@@ -1527,7 +1527,7 @@ int criu_check(void) - return criu_local_check(global_opts); - } - --int criu_local_dump(criu_opts *opts) -+static int dump(bool pre_dump, criu_opts *opts) - { - int ret = -1; - CriuReq req = CRIU_REQ__INIT; -@@ -1535,7 +1535,7 @@ int criu_local_dump(criu_opts *opts) - - saved_errno = 0; - -- req.type = CRIU_REQ_TYPE__DUMP; -+ req.type = pre_dump ? CRIU_REQ_TYPE__SINGLE_PRE_DUMP : CRIU_REQ_TYPE__DUMP; - req.opts = opts->rpc; - - ret = send_req_and_recv_resp(opts, &req, &resp); -@@ -1543,7 +1543,7 @@ int criu_local_dump(criu_opts *opts) - goto exit; - - if (resp->success) { -- if (resp->dump->has_restored && resp->dump->restored) -+ if (!pre_dump && resp->dump->has_restored && resp->dump->restored) - ret = 1; - else - ret = 0; -@@ -1561,11 +1561,26 @@ exit: - return ret; - } - -+int criu_local_dump(criu_opts *opts) -+{ -+ return dump(false, opts); -+} -+ - int criu_dump(void) - { - return criu_local_dump(global_opts); - } - -+int criu_local_pre_dump(criu_opts *opts) -+{ -+ return dump(true, opts); -+} -+ -+int criu_pre_dump(void) -+{ -+ return criu_local_pre_dump(global_opts); -+} -+ - int criu_local_dump_iters(criu_opts *opts, int (*more)(criu_predump_info pi)) - { - int ret = -1, fd = -1, uret; -diff --git a/lib/c/criu.h b/lib/c/criu.h -index a374b37f8..c6d4f50a8 100644 ---- a/lib/c/criu.h -+++ b/lib/c/criu.h -@@ -161,6 +161,7 @@ int criu_get_orphan_pts_master_fd(void); - */ - int criu_check(void); - int criu_dump(void); -+int criu_pre_dump(void); - int criu_restore(void); - int criu_restore_child(void); - -@@ -279,6 +280,7 @@ void criu_local_set_notify_cb(criu_opts *opts, int (*cb)(char *action, criu_noti - - int criu_local_check(criu_opts *opts); - int criu_local_dump(criu_opts *opts); -+int criu_local_pre_dump(criu_opts *opts); - int criu_local_restore(criu_opts *opts); - int criu_local_restore_child(criu_opts *opts); - int criu_local_dump_iters(criu_opts *opts, int (*more)(criu_predump_info pi)); --- -2.35.1 - diff --git a/0075-tests-added-test-for-single-pre-dump-support.patch b/0075-tests-added-test-for-single-pre-dump-support.patch deleted file mode 100644 index d0106e7..0000000 --- a/0075-tests-added-test-for-single-pre-dump-support.patch +++ /dev/null @@ -1,262 +0,0 @@ -From 871feecbc5f200ddf7c9c18e0dc8eaa0544d0688 Mon Sep 17 00:00:00 2001 -From: Adrian Reber -Date: Tue, 14 Dec 2021 13:09:19 +0000 -Subject: [PATCH 075/249] tests: added test for single pre-dump support - -Signed-off-by: Adrian Reber ---- - test/others/libcriu/.gitignore | 1 + - test/others/libcriu/Makefile | 1 + - test/others/libcriu/lib.h | 2 + - test/others/libcriu/run.sh | 1 + - test/others/libcriu/test_iters.c | 2 - - test/others/libcriu/test_notify.c | 2 - - test/others/libcriu/test_pre_dump.c | 151 ++++++++++++++++++++++++++++ - test/others/libcriu/test_sub.c | 2 - - 8 files changed, 156 insertions(+), 6 deletions(-) - create mode 100644 test/others/libcriu/test_pre_dump.c - -diff --git a/test/others/libcriu/.gitignore b/test/others/libcriu/.gitignore -index cf1342de2..15abf07ac 100644 ---- a/test/others/libcriu/.gitignore -+++ b/test/others/libcriu/.gitignore -@@ -4,5 +4,6 @@ test_notify - test_self - test_sub - test_join_ns -+test_pre_dump - output/ - libcriu.so.* -diff --git a/test/others/libcriu/Makefile b/test/others/libcriu/Makefile -index 734e66c1a..581574da0 100644 ---- a/test/others/libcriu/Makefile -+++ b/test/others/libcriu/Makefile -@@ -6,6 +6,7 @@ TESTS += test_notify - TESTS += test_iters - TESTS += test_errno - TESTS += test_join_ns -+TESTS += test_pre_dump - - all: $(TESTS) - .PHONY: all -diff --git a/test/others/libcriu/lib.h b/test/others/libcriu/lib.h -index 6fdf8aef2..59372fca5 100644 ---- a/test/others/libcriu/lib.h -+++ b/test/others/libcriu/lib.h -@@ -1,3 +1,5 @@ - void what_err_ret_mean(int ret); - int chk_exit(int status, int want); - int get_version(void); -+ -+#define SUCC_ECODE 42 -diff --git a/test/others/libcriu/run.sh b/test/others/libcriu/run.sh -index 48f25a5f6..1b6c73448 100755 ---- a/test/others/libcriu/run.sh -+++ b/test/others/libcriu/run.sh -@@ -58,6 +58,7 @@ run_test test_notify - if [ "$(uname -m)" = "x86_64" ]; then - # Skip this on aarch64 as aarch64 has no dirty page tracking - run_test test_iters -+ run_test test_pre_dump - fi - run_test test_errno - run_test test_join_ns -diff --git a/test/others/libcriu/test_iters.c b/test/others/libcriu/test_iters.c -index b7e325abb..edbaf87f6 100644 ---- a/test/others/libcriu/test_iters.c -+++ b/test/others/libcriu/test_iters.c -@@ -46,8 +46,6 @@ static int next_iter(criu_predump_info pi) - return cur_iter < MAX_ITERS; - } - --#define SUCC_ECODE 42 -- - int main(int argc, char **argv) - { - int pid, ret, p[2]; -diff --git a/test/others/libcriu/test_notify.c b/test/others/libcriu/test_notify.c -index 9a54b812a..80ad3ffdc 100644 ---- a/test/others/libcriu/test_notify.c -+++ b/test/others/libcriu/test_notify.c -@@ -10,8 +10,6 @@ - - #include "lib.h" - --#define SUCC_ECODE 42 -- - static int actions_called = 0; - static int notify(char *action, criu_notify_arg_t na) - { -diff --git a/test/others/libcriu/test_pre_dump.c b/test/others/libcriu/test_pre_dump.c -new file mode 100644 -index 000000000..ed9cd2125 ---- /dev/null -+++ b/test/others/libcriu/test_pre_dump.c -@@ -0,0 +1,151 @@ -+#include "criu.h" -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include "lib.h" -+ -+static int wdir_fd, cur_imgdir = -1; -+ -+static int stop = 0; -+static void sh(int sig) -+{ -+ stop = 1; -+} -+ -+static void open_imgdir(void) -+{ -+ char p[10]; -+ static int id = 0; -+ -+ if (id > 0) { -+ sprintf(p, "../dir-%d", id); -+ criu_set_parent_images(p); -+ } -+ if (cur_imgdir != -1) -+ close(cur_imgdir); -+ sprintf(p, "dir-%d", ++id); -+ mkdirat(wdir_fd, p, 0700); -+ cur_imgdir = openat(wdir_fd, p, O_DIRECTORY); -+ criu_set_images_dir_fd(cur_imgdir); -+} -+ -+int main(int argc, char **argv) -+{ -+ int pid, ret, p[2]; -+ -+ wdir_fd = open(argv[2], O_DIRECTORY); -+ if (wdir_fd < 0) { -+ perror("Can't open wdir"); -+ return 1; -+ } -+ -+ printf("--- Start loop ---\n"); -+ pipe(p); -+ pid = fork(); -+ if (pid < 0) { -+ perror("Can't"); -+ return -1; -+ } -+ -+ if (!pid) { -+ printf(" `- loop: initializing\n"); -+ if (setsid() < 0) -+ exit(1); -+ if (signal(SIGUSR1, sh) == SIG_ERR) -+ exit(1); -+ -+ close(0); -+ close(1); -+ close(2); -+ close(p[0]); -+ -+ ret = SUCC_ECODE; -+ write(p[1], &ret, sizeof(ret)); -+ close(p[1]); -+ -+ while (!stop) -+ sleep(1); -+ exit(SUCC_ECODE); -+ } -+ -+ close(p[1]); -+ -+ /* Wait for kid to start */ -+ ret = -1; -+ read(p[0], &ret, sizeof(ret)); -+ if (ret != SUCC_ECODE) { -+ printf("Error starting loop\n"); -+ goto err; -+ } -+ -+ /* Wait for pipe to get closed, then dump */ -+ read(p[0], &ret, 1); -+ close(p[0]); -+ -+ printf("--- Dump loop ---\n"); -+ criu_init_opts(); -+ criu_set_service_binary(argv[1]); -+ criu_set_pid(pid); -+ criu_set_log_file("dump.log"); -+ criu_set_log_level(CRIU_LOG_DEBUG); -+ criu_set_track_mem(true); -+ -+ open_imgdir(); -+ ret = criu_pre_dump(); -+ if (ret < 0) { -+ what_err_ret_mean(ret); -+ kill(pid, SIGKILL); -+ goto err; -+ } -+ -+ printf(" `- Pre Dump 1 succeeded\n"); -+ -+ open_imgdir(); -+ ret = criu_pre_dump(); -+ if (ret < 0) { -+ what_err_ret_mean(ret); -+ kill(pid, SIGKILL); -+ goto err; -+ } -+ -+ printf(" `- Pre Dump 2 succeeded\n"); -+ -+ open_imgdir(); -+ ret = criu_dump(); -+ if (ret < 0) { -+ what_err_ret_mean(ret); -+ kill(pid, SIGKILL); -+ goto err; -+ } -+ -+ printf(" `- Final Dump succeeded\n"); -+ waitpid(pid, NULL, 0); -+ -+ printf("--- Restore ---\n"); -+ criu_init_opts(); -+ criu_set_log_level(CRIU_LOG_DEBUG); -+ criu_set_log_file("restore.log"); -+ criu_set_images_dir_fd(cur_imgdir); -+ -+ pid = criu_restore_child(); -+ if (pid <= 0) { -+ what_err_ret_mean(pid); -+ return -1; -+ } -+ -+ printf(" `- Restore returned pid %d\n", pid); -+ kill(pid, SIGUSR1); -+err: -+ if (waitpid(pid, &ret, 0) < 0) { -+ perror(" Can't wait kid"); -+ return -1; -+ } -+ -+ return chk_exit(ret, SUCC_ECODE); -+} -diff --git a/test/others/libcriu/test_sub.c b/test/others/libcriu/test_sub.c -index 697abf5d5..af1e09408 100644 ---- a/test/others/libcriu/test_sub.c -+++ b/test/others/libcriu/test_sub.c -@@ -15,8 +15,6 @@ static void sh(int sig) - stop = 1; - } - --#define SUCC_ECODE 42 -- - int main(int argc, char **argv) - { - int pid, ret, fd, p[2]; --- -2.35.1 - diff --git a/0076-zdtm.py-clean-up-MAKEFLAGS-env-variable-before-runni.patch b/0076-zdtm.py-clean-up-MAKEFLAGS-env-variable-before-runni.patch deleted file mode 100644 index 3474866..0000000 --- a/0076-zdtm.py-clean-up-MAKEFLAGS-env-variable-before-runni.patch +++ /dev/null @@ -1,56 +0,0 @@ -From 05b155f1f46eb98e38ad1a0d8a332ab3326323ff Mon Sep 17 00:00:00 2001 -From: Alexander Mikhalitsyn -Date: Sat, 18 Dec 2021 10:40:11 +0300 -Subject: [PATCH 076/249] zdtm.py: clean up MAKEFLAGS env variable before - running make instance - -In most cases we run tests as: -./test/zdtm.py run -a - -But it's also possible to run tests from root makefile: -make test - -In this case, if criu tree have no ./test/umount2 binary -built we get the error like: -make[3]: *** No rule to make target 'umount2'. Stop. - -It's worth to mention this "3". That's because we have -build process tree like this: -make -> make -> make -> zdtm.py -> make umount2 -and also we have MAKEFLAGS variable set to: -build=-r -R -f ... - -And that's bad because "-r" option means no builtin -rules and -R means no builtin variables. That makes -`make umount2` not working. Let's just cleanup this -variable to make things work properly. - -Fixes: #1699 -https://github.com/checkpoint-restore/criu/issues/1699 - -Signed-off-by: Alexander Mikhalitsyn ---- - test/zdtm.py | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - -diff --git a/test/zdtm.py b/test/zdtm.py -index b98770079..086ae0285 100755 ---- a/test/zdtm.py -+++ b/test/zdtm.py -@@ -607,9 +607,11 @@ class zdtm_test: - @staticmethod - def available(): - if not os.access("umount2", os.X_OK): -- subprocess.check_call(["make", "umount2"]) -+ subprocess.check_call( -+ ["make", "umount2"], env=dict(os.environ, MAKEFLAGS="")) - if not os.access("zdtm_ct", os.X_OK): -- subprocess.check_call(["make", "zdtm_ct"]) -+ subprocess.check_call( -+ ["make", "zdtm_ct"], env=dict(os.environ, MAKEFLAGS="")) - if not os.access("zdtm/lib/libzdtmtst.a", os.F_OK): - subprocess.check_call(["make", "-C", "zdtm/"]) - subprocess.check_call( --- -2.35.1 - diff --git a/0077-zdtm-zdtm_ct-fix-compilation-error-with-strict-proto.patch b/0077-zdtm-zdtm_ct-fix-compilation-error-with-strict-proto.patch deleted file mode 100644 index bc7426b..0000000 --- a/0077-zdtm-zdtm_ct-fix-compilation-error-with-strict-proto.patch +++ /dev/null @@ -1,33 +0,0 @@ -From ffb3cfd38ccc307a8c8171220cd744578a679195 Mon Sep 17 00:00:00 2001 -From: Alexander Mikhalitsyn -Date: Sat, 18 Dec 2021 11:03:53 +0300 -Subject: [PATCH 077/249] zdtm: zdtm_ct fix compilation error with - strict-prototypes on -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -zdtm_ct.c:44:12: error: function declaration isn’t a prototype [-Werror=strict-prototypes] - 44 | static int create_timens() - -Signed-off-by: Alexander Mikhalitsyn ---- - test/zdtm_ct.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/test/zdtm_ct.c b/test/zdtm_ct.c -index e4b17a512..0e8eeff8a 100644 ---- a/test/zdtm_ct.c -+++ b/test/zdtm_ct.c -@@ -41,7 +41,7 @@ static inline int _settime(clockid_t clk_id, time_t offset) - return 0; - } - --static int create_timens() -+static int create_timens(void) - { - struct utsname buf; - unsigned major, minor; --- -2.35.1 - diff --git a/0078-zdtm-remove-mntns-deleted-dst-test-leftover-from-git.patch b/0078-zdtm-remove-mntns-deleted-dst-test-leftover-from-git.patch deleted file mode 100644 index 66585f1..0000000 --- a/0078-zdtm-remove-mntns-deleted-dst-test-leftover-from-git.patch +++ /dev/null @@ -1,21 +0,0 @@ -From 6bb67ad114a16bcabe3fe349309093f00c6f39da Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Fri, 17 Dec 2021 15:33:55 +0300 -Subject: [PATCH 078/249] zdtm: remove mntns-deleted-dst test leftover from git - -Looks like in commit [1] we've non-intentionally added this tmp file to -git, let's remove it. - -Fixes: 01ee29702 ("s390:zdtm: Enable zdtm for s390") [1] -Signed-off-by: Pavel Tikhomirov ---- - test/zdtm/static/mntns-deleted-dst | 0 - 1 file changed, 0 insertions(+), 0 deletions(-) - delete mode 100644 test/zdtm/static/mntns-deleted-dst - -diff --git a/test/zdtm/static/mntns-deleted-dst b/test/zdtm/static/mntns-deleted-dst -deleted file mode 100644 -index e69de29bb..000000000 --- -2.35.1 - diff --git a/0079-crtools-remove-excess-always-true-condition.patch b/0079-crtools-remove-excess-always-true-condition.patch deleted file mode 100644 index 9c391f2..0000000 --- a/0079-crtools-remove-excess-always-true-condition.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 8950d844260c91535ce1bbfc670ee547ca7c3b85 Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Fri, 10 Dec 2021 15:34:19 +0300 -Subject: [PATCH 079/249] crtools: remove excess always true condition - -Several lines above if (optind >= argc) we go to usage label and fail, -thus we don't need to check (optind < argc) here as it is always true. - -Signed-off-by: Pavel Tikhomirov ---- - criu/crtools.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/criu/crtools.c b/criu/crtools.c -index da47bd684..3adfb190f 100644 ---- a/criu/crtools.c -+++ b/criu/crtools.c -@@ -124,7 +124,7 @@ int main(int argc, char *argv[], char *envp[]) - return 1; - } - -- if (optind < argc && !strcmp(argv[optind], "swrk")) { -+ if (!strcmp(argv[optind], "swrk")) { - if (argc != optind + 2) { - fprintf(stderr, "Usage: criu swrk \n"); - return 1; --- -2.35.1 - diff --git a/0080-crtools-rpc-export-current-criu-mode-to-opts.mode.patch b/0080-crtools-rpc-export-current-criu-mode-to-opts.mode.patch deleted file mode 100644 index 944e23f..0000000 --- a/0080-crtools-rpc-export-current-criu-mode-to-opts.mode.patch +++ /dev/null @@ -1,309 +0,0 @@ -From 9192d6b38b6ed5ddd9c2a89bd384e25f93bb13d6 Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Fri, 10 Dec 2021 12:13:06 +0300 -Subject: [PATCH 080/249] crtools/rpc: export current criu mode to opts.mode - -We have multiple options which are valid only on restore or only on dump -or in any other specific criu mode, so it would be useful to have info -about current mode in opts so that we can validate other options against -current mode. - -Plan is to use it for mount-v2 option as it is only valid on restore, -and this would make handling of different types mountpoints much easier. - -Realization is a bit different for general code and rpc: - -- When criu mode is set from main() we just parse mode from argv[optind] -just after parse_options() found optind of the command. Note that -opts.mode is available before check_options(). - -- For rpc service we reset opts.mode to CR_SWRK each time we restart -cr_service_work(), in the original service process we still have -CR_SERVICE to differentiate between them, and each request handling -function which does setup_opts_from_req sets opts.mode in accordance -with the processed request type. And it is also available before -check_options(). - -Now in check_options we can add filters on one mode only options. - -Signed-off-by: Pavel Tikhomirov ---- - criu/cr-service.c | 8 +++++ - criu/crtools.c | 73 +++++++++++++++++++++++++++++---------- - criu/include/cr_options.h | 19 ++++++++++ - 3 files changed, 82 insertions(+), 18 deletions(-) - -diff --git a/criu/cr-service.c b/criu/cr-service.c -index 80d12c7b0..59f46b320 100644 ---- a/criu/cr-service.c -+++ b/criu/cr-service.c -@@ -735,6 +735,7 @@ static int dump_using_req(int sk, CriuOpts *req) - bool success = false; - bool self_dump = !req->pid; - -+ opts.mode = CR_DUMP; - if (setup_opts_from_req(sk, req)) - goto exit; - -@@ -777,6 +778,7 @@ static int restore_using_req(int sk, CriuOpts *req) - - opts.restore_detach = true; - -+ opts.mode = CR_RESTORE; - if (setup_opts_from_req(sk, req)) - goto exit; - -@@ -828,6 +830,7 @@ static int check(int sk, CriuOpts *req) - if (pid == 0) { - setproctitle("check --rpc"); - -+ opts.mode = CR_CHECK; - if (setup_opts_from_req(sk, req)) - exit(1); - -@@ -859,6 +862,7 @@ static int pre_dump_using_req(int sk, CriuOpts *req, bool single) - if (pid == 0) { - int ret = 1; - -+ opts.mode = CR_PRE_DUMP; - if (setup_opts_from_req(sk, req)) - goto cout; - -@@ -936,6 +940,7 @@ static int start_page_server_req(int sk, CriuOpts *req, bool daemon_mode) - if (pid == 0) { - close(start_pipe[0]); - -+ opts.mode = CR_PAGE_SERVER; - if (setup_opts_from_req(sk, req)) - goto out_ch; - -@@ -1182,6 +1187,7 @@ static int handle_cpuinfo(int sk, CriuReq *msg) - if (pid == 0) { - int ret = 1; - -+ opts.mode = CR_CPUINFO; - if (setup_opts_from_req(sk, msg->opts)) - goto cout; - -@@ -1231,6 +1237,8 @@ int cr_service_work(int sk) - CriuReq *msg = 0; - - more: -+ opts.mode = CR_SWRK; -+ - if (recv_criu_msg(sk, &msg) != 0) { - pr_perror("Can't recv request"); - goto err; -diff --git a/criu/crtools.c b/criu/crtools.c -index 3adfb190f..d10d7f7d0 100644 ---- a/criu/crtools.c -+++ b/criu/crtools.c -@@ -67,6 +67,38 @@ static int image_dir_mode(char *argv[], int optind) - return -1; - } - -+static int parse_criu_mode(char *mode) -+{ -+ if (!strcmp(mode, "dump")) -+ opts.mode = CR_DUMP; -+ else if (!strcmp(mode, "pre-dump")) -+ opts.mode = CR_PRE_DUMP; -+ else if (!strcmp(mode, "restore")) -+ opts.mode = CR_RESTORE; -+ else if (!strcmp(mode, "lazy-pages")) -+ opts.mode = CR_LAZY_PAGES; -+ else if (!strcmp(mode, "check")) -+ opts.mode = CR_CHECK; -+ else if (!strcmp(mode, "page-server")) -+ opts.mode = CR_PAGE_SERVER; -+ else if (!strcmp(mode, "service")) -+ opts.mode = CR_SERVICE; -+ else if (!strcmp(mode, "swrk")) -+ opts.mode = CR_SWRK; -+ else if (!strcmp(mode, "dedup")) -+ opts.mode = CR_DEDUP; -+ else if (!strcmp(mode, "cpuinfo")) -+ opts.mode = CR_CPUINFO; -+ else if (!strcmp(mode, "exec")) -+ opts.mode = CR_EXEC_DEPRECATED; -+ else if (!strcmp(mode, "show")) -+ opts.mode = CR_SHOW_DEPRECATED; -+ else -+ return -1; -+ -+ return 0; -+} -+ - int main(int argc, char *argv[], char *envp[]) - { - int ret = -1; -@@ -124,7 +156,12 @@ int main(int argc, char *argv[], char *envp[]) - return 1; - } - -- if (!strcmp(argv[optind], "swrk")) { -+ if (parse_criu_mode(argv[optind])) { -+ pr_err("unknown command: %s\n", argv[optind]); -+ goto usage; -+ } -+ -+ if (opts.mode == CR_SWRK) { - if (argc != optind + 2) { - fprintf(stderr, "Usage: criu swrk \n"); - return 1; -@@ -156,7 +193,7 @@ int main(int argc, char *argv[], char *envp[]) - goto usage; - } - -- if (strcmp(argv[optind], "restore")) { -+ if (opts.mode != CR_RESTORE) { - pr_err("--exec-cmd is available for the restore command only\n"); - goto usage; - } -@@ -173,7 +210,7 @@ int main(int argc, char *argv[], char *envp[]) - opts.exec_cmd[argc - optind - 1] = NULL; - } else { - /* No subcommands except for cpuinfo and restore --exec-cmd */ -- if (strcmp(argv[optind], "cpuinfo") && has_sub_command) { -+ if (opts.mode != CR_CPUINFO && has_sub_command) { - pr_err("excessive parameter%s for command %s\n", (argc - optind) > 2 ? "s" : "", argv[optind]); - goto usage; - } -@@ -185,7 +222,7 @@ int main(int argc, char *argv[], char *envp[]) - } - - /* We must not open imgs dir, if service is called */ -- if (strcmp(argv[optind], "service")) { -+ if (opts.mode != CR_SERVICE) { - ret = open_image_dir(opts.imgs_dir, image_dir_mode(argv, optind)); - if (ret < 0) { - pr_err("Couldn't open image dir %s\n", opts.imgs_dir); -@@ -197,8 +234,7 @@ int main(int argc, char *argv[], char *envp[]) - * When a process group becomes an orphan, - * its processes are sent a SIGHUP signal - */ -- if (!strcmp(argv[optind], "restore") && opts.restore_detach && opts.final_state == TASK_STOPPED && -- opts.shell_job) -+ if (opts.mode == CR_RESTORE && opts.restore_detach && opts.final_state == TASK_STOPPED && opts.shell_job) - pr_warn("Stopped and detached shell job will get SIGHUP from OS.\n"); - - if (chdir(opts.work_dir)) { -@@ -218,7 +254,7 @@ int main(int argc, char *argv[], char *envp[]) - kdat.can_map_vdso = 0; - - if (!list_empty(&opts.inherit_fds)) { -- if (strcmp(argv[optind], "restore")) { -+ if (opts.mode != CR_RESTORE) { - pr_err("--inherit-fd is restore-only option\n"); - return 1; - } -@@ -229,13 +265,14 @@ int main(int argc, char *argv[], char *envp[]) - if (opts.img_parent) - pr_info("Will do snapshot from %s\n", opts.img_parent); - -- if (!strcmp(argv[optind], "dump")) { -+ if (opts.mode == CR_DUMP) { - if (!opts.tree_id) - goto opt_pid_missing; -+ - return cr_dump_tasks(opts.tree_id); - } - -- if (!strcmp(argv[optind], "pre-dump")) { -+ if (opts.mode == CR_PRE_DUMP) { - if (!opts.tree_id) - goto opt_pid_missing; - -@@ -247,7 +284,7 @@ int main(int argc, char *argv[], char *envp[]) - return cr_pre_dump_tasks(opts.tree_id) != 0; - } - -- if (!strcmp(argv[optind], "restore")) { -+ if (opts.mode == CR_RESTORE) { - if (opts.tree_id) - pr_warn("Using -t with criu restore is obsoleted\n"); - -@@ -262,22 +299,22 @@ int main(int argc, char *argv[], char *envp[]) - return ret != 0; - } - -- if (!strcmp(argv[optind], "lazy-pages")) -+ if (opts.mode == CR_LAZY_PAGES) - return cr_lazy_pages(opts.daemon_mode) != 0; - -- if (!strcmp(argv[optind], "check")) -+ if (opts.mode == CR_CHECK) - return cr_check() != 0; - -- if (!strcmp(argv[optind], "page-server")) -+ if (opts.mode == CR_PAGE_SERVER) - return cr_page_server(opts.daemon_mode, false, -1) != 0; - -- if (!strcmp(argv[optind], "service")) -+ if (opts.mode == CR_SERVICE) - return cr_service(opts.daemon_mode); - -- if (!strcmp(argv[optind], "dedup")) -+ if (opts.mode == CR_DEDUP) - return cr_dedup() != 0; - -- if (!strcmp(argv[optind], "cpuinfo")) { -+ if (opts.mode == CR_CPUINFO) { - if (!argv[optind + 1]) { - pr_err("cpuinfo requires an action: dump or check\n"); - goto usage; -@@ -288,12 +325,12 @@ int main(int argc, char *argv[], char *envp[]) - return cpuinfo_check(); - } - -- if (!strcmp(argv[optind], "exec")) { -+ if (opts.mode == CR_EXEC_DEPRECATED) { - pr_err("The \"exec\" action is deprecated by the Compel library.\n"); - return -1; - } - -- if (!strcmp(argv[optind], "show")) { -+ if (opts.mode == CR_SHOW_DEPRECATED) { - pr_err("The \"show\" action is deprecated by the CRIT utility.\n"); - pr_err("To view an image use the \"crit decode -i $name --pretty\" command.\n"); - return -1; -diff --git a/criu/include/cr_options.h b/criu/include/cr_options.h -index a34f8dbbf..85648bf1c 100644 ---- a/criu/include/cr_options.h -+++ b/criu/include/cr_options.h -@@ -100,6 +100,22 @@ struct irmap_path_opt { - struct irmap *ir; - }; - -+enum criu_mode { -+ CR_UNSET = 0, -+ CR_DUMP, -+ CR_PRE_DUMP, -+ CR_RESTORE, -+ CR_LAZY_PAGES, -+ CR_CHECK, -+ CR_PAGE_SERVER, -+ CR_SERVICE, -+ CR_SWRK, -+ CR_DEDUP, -+ CR_CPUINFO, -+ CR_EXEC_DEPRECATED, -+ CR_SHOW_DEPRECATED, -+}; -+ - struct cr_options { - int final_state; - int check_extra_features; -@@ -188,6 +204,9 @@ struct cr_options { - - /* This stores which method to use for file validation. */ - int file_validation_method; -+ -+ /* Shows the mode criu is running at the moment: dump/pre-dump/restore/... */ -+ enum criu_mode mode; - }; - - extern struct cr_options opts; --- -2.35.1 - diff --git a/0081-crtools-use-new-opts.mode-in-image_dir_mode.patch b/0081-crtools-use-new-opts.mode-in-image_dir_mode.patch deleted file mode 100644 index 7503d23..0000000 --- a/0081-crtools-use-new-opts.mode-in-image_dir_mode.patch +++ /dev/null @@ -1,48 +0,0 @@ -From f8250a1c0f62abe60c727d90e39cf6c26fe357f4 Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Wed, 15 Dec 2021 10:49:42 +0300 -Subject: [PATCH 081/249] crtools: use new opts.mode in image_dir_mode - -Also while on it there is no "cpuinfo restore", let's remove it. - -Signed-off-by: Pavel Tikhomirov ---- - criu/crtools.c | 19 ++++++++++++++----- - 1 file changed, 14 insertions(+), 5 deletions(-) - -diff --git a/criu/crtools.c b/criu/crtools.c -index d10d7f7d0..7bf92ffd0 100644 ---- a/criu/crtools.c -+++ b/criu/crtools.c -@@ -56,14 +56,23 @@ void flush_early_log_to_stderr(void) - - static int image_dir_mode(char *argv[], int optind) - { -- if (!strcmp(argv[optind], "dump") || !strcmp(argv[optind], "pre-dump") || -- (!strcmp(argv[optind], "cpuinfo") && !strcmp(argv[optind + 1], "dump"))) -+ switch (opts.mode) { -+ case CR_DUMP: -+ /* fallthrough */ -+ case CR_PRE_DUMP: - return O_DUMP; -- -- if (!strcmp(argv[optind], "restore") || -- (!strcmp(argv[optind], "cpuinfo") && !strcmp(argv[optind + 1], "restore"))) -+ case CR_RESTORE: - return O_RSTR; -+ case CR_CPUINFO: -+ if (!strcmp(argv[optind + 1], "dump")) -+ return O_DUMP; -+ /* fallthrough */ -+ default: -+ return -1; -+ } - -+ /* never reached */ -+ BUG(); - return -1; - } - --- -2.35.1 - diff --git a/0082-crtools-check-that-cpuinfo-command-has-sub-command.patch b/0082-crtools-check-that-cpuinfo-command-has-sub-command.patch deleted file mode 100644 index 4772f44..0000000 --- a/0082-crtools-check-that-cpuinfo-command-has-sub-command.patch +++ /dev/null @@ -1,29 +0,0 @@ -From f67fb6cf09c1a38f5f7c0bd86fee572bb6cf7bf9 Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Thu, 16 Dec 2021 18:05:01 +0300 -Subject: [PATCH 082/249] crtools: check that cpuinfo command has sub-command - -This fixes segfault on empty sub-command for cpuinfo. - -Signed-off-by: Pavel Tikhomirov ---- - criu/crtools.c | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/criu/crtools.c b/criu/crtools.c -index 7bf92ffd0..0752800f6 100644 ---- a/criu/crtools.c -+++ b/criu/crtools.c -@@ -222,6 +222,9 @@ int main(int argc, char *argv[], char *envp[]) - if (opts.mode != CR_CPUINFO && has_sub_command) { - pr_err("excessive parameter%s for command %s\n", (argc - optind) > 2 ? "s" : "", argv[optind]); - goto usage; -+ } else if (opts.mode == CR_CPUINFO && !has_sub_command) { -+ pr_err("cpuinfo requires an action: dump or check\n"); -+ goto usage; - } - } - --- -2.35.1 - diff --git a/0083-sk-unix-Add-support-for-SOCK_SEQPACKET-unix-sockets.patch b/0083-sk-unix-Add-support-for-SOCK_SEQPACKET-unix-sockets.patch deleted file mode 100644 index d39be75..0000000 --- a/0083-sk-unix-Add-support-for-SOCK_SEQPACKET-unix-sockets.patch +++ /dev/null @@ -1,53 +0,0 @@ -From ac48b975f6d4c03d0ea2a9f99ed88d03333f7ad3 Mon Sep 17 00:00:00 2001 -From: Bui Quang Minh -Date: Tue, 14 Dec 2021 22:28:27 +0700 -Subject: [PATCH 083/249] sk-unix: Add support for SOCK_SEQPACKET unix sockets - -Adjust some SOCK_STREAM cases to handle SOCK_SEQPACKET too. - -Signed-off-by: Bui Quang Minh ---- - criu/sk-unix.c | 10 +++++----- - 1 file changed, 5 insertions(+), 5 deletions(-) - -diff --git a/criu/sk-unix.c b/criu/sk-unix.c -index d3402c3ac..194193dff 100644 ---- a/criu/sk-unix.c -+++ b/criu/sk-unix.c -@@ -402,12 +402,12 @@ static int dump_one_unix_fd(int lfd, uint32_t id, const struct fd_parms *p) - sk_encode_shutdown(ue, sk->shutdown); - - /* -- * If a stream listening socket has non-zero rqueue, this -- * means there are in-flight connections waiting to get -+ * If a stream/seqpacket listening socket has non-zero rqueue, -+ * this means there are in-flight connections waiting to get - * accept()-ed. We handle them separately with the "icons" - * (i stands for in-flight, cons -- for connections) things. - */ -- if (sk->rqlen != 0 && !(sk->type == SOCK_STREAM && sk->state == TCP_LISTEN)) { -+ if (sk->rqlen != 0 && sk->state != TCP_LISTEN) { - if (dump_sk_queue(lfd, id)) - goto err; - } -@@ -1610,7 +1610,7 @@ static int bind_unix_sk(int sk, struct unix_sk_info *ui) - if (ui->ue->name.len == 0) - return 0; - -- if ((ui->ue->type == SOCK_STREAM) && (ui->ue->state == TCP_ESTABLISHED)) { -+ if ((ui->ue->type != SOCK_DGRAM) && (ui->ue->state == TCP_ESTABLISHED)) { - /* - * FIXME this can be done, but for doing this properly we - * need to bind socket to its name, then rename one to -@@ -1851,7 +1851,7 @@ static int open_unixsk_standalone(struct unix_sk_info *ui, int *new_fd) - - close(sks[1]); - sk = sks[0]; -- } else if ((ui->ue->state == TCP_ESTABLISHED && ui->ue->type == SOCK_STREAM) && queuer && -+ } else if ((ui->ue->state == TCP_ESTABLISHED && ui->ue->type != SOCK_DGRAM) && queuer && - queuer->ue->ino == FAKE_INO) { - int ret, sks[2]; - --- -2.35.1 - diff --git a/0084-zdtm-Add-SOCK_SEQPACKET-variants-to-unix-socket-test.patch b/0084-zdtm-Add-SOCK_SEQPACKET-variants-to-unix-socket-test.patch deleted file mode 100644 index bedc6fd..0000000 --- a/0084-zdtm-Add-SOCK_SEQPACKET-variants-to-unix-socket-test.patch +++ /dev/null @@ -1,574 +0,0 @@ -From c68b20e449d8dac653b1a9f6a893416d2d38cc07 Mon Sep 17 00:00:00 2001 -From: Bui Quang Minh -Date: Thu, 16 Dec 2021 09:35:25 +0700 -Subject: [PATCH 084/249] zdtm: Add SOCK_SEQPACKET variants to unix socket - tests - -This commit simply makes copies of SOCK_STREAM unix socket tests and uses -SOCK_SEQPACKET instead. - -Signed-off-by: Bui Quang Minh ---- - test/zdtm/static/Makefile | 23 +++++++++++++++++++ - test/zdtm/static/del_standalone_un.c | 8 ++++++- - .../zdtm/static/del_standalone_un_seqpacket.c | 1 + - test/zdtm/static/scm03-seqpacket.c | 1 + - test/zdtm/static/scm03.c | 8 ++++++- - test/zdtm/static/sk-unix-rel-seqpacket.c | 1 + - test/zdtm/static/sk-unix-rel.c | 10 ++++++-- - test/zdtm/static/sk-unix-unconn-seqpacket.c | 1 + - test/zdtm/static/sk-unix-unconn.c | 10 ++++++-- - test/zdtm/static/sk-unix01-seqpacket.c | 1 + - test/zdtm/static/sk-unix01-seqpacket.desc | 1 + - test/zdtm/static/sk-unix01.c | 12 +++++++--- - test/zdtm/static/socket_queues.c | 8 ++++++- - test/zdtm/static/socket_queues_seqpacket.c | 1 + - test/zdtm/static/sockets00-seqpacket.c | 1 + - test/zdtm/static/sockets00-seqpacket.desc | 1 + - test/zdtm/static/sockets00.c | 12 +++++++--- - test/zdtm/static/sockets01-seqpacket.c | 1 + - test/zdtm/static/sockets01.c | 10 ++++++-- - test/zdtm/static/sockets02-seqpacket.c | 1 + - test/zdtm/static/sockets02.c | 8 ++++++- - test/zdtm/static/sockets03-seqpacket.c | 1 + - test/zdtm/static/sockets03-seqpacket.desc | 1 + - test/zdtm/static/sockets03.c | 10 ++++++-- - test/zdtm/static/sockets_spair.c | 8 ++++++- - test/zdtm/static/sockets_spair_seqpacket.c | 1 + - 26 files changed, 122 insertions(+), 19 deletions(-) - create mode 120000 test/zdtm/static/del_standalone_un_seqpacket.c - create mode 120000 test/zdtm/static/scm03-seqpacket.c - create mode 120000 test/zdtm/static/sk-unix-rel-seqpacket.c - create mode 120000 test/zdtm/static/sk-unix-unconn-seqpacket.c - create mode 120000 test/zdtm/static/sk-unix01-seqpacket.c - create mode 120000 test/zdtm/static/sk-unix01-seqpacket.desc - create mode 120000 test/zdtm/static/socket_queues_seqpacket.c - create mode 120000 test/zdtm/static/sockets00-seqpacket.c - create mode 120000 test/zdtm/static/sockets00-seqpacket.desc - create mode 120000 test/zdtm/static/sockets01-seqpacket.c - create mode 120000 test/zdtm/static/sockets02-seqpacket.c - create mode 120000 test/zdtm/static/sockets03-seqpacket.c - create mode 120000 test/zdtm/static/sockets03-seqpacket.desc - create mode 120000 test/zdtm/static/sockets_spair_seqpacket.c - -diff --git a/test/zdtm/static/Makefile b/test/zdtm/static/Makefile -index 3e1e0a498..4a21978b5 100644 ---- a/test/zdtm/static/Makefile -+++ b/test/zdtm/static/Makefile -@@ -68,9 +68,13 @@ TST_NOFILE := \ - utsname \ - pstree \ - sockets01 \ -+ sockets01-seqpacket \ - sockets02 \ -+ sockets02-seqpacket \ - sockets_spair \ -+ sockets_spair_seqpacket \ - socket_queues \ -+ socket_queues_seqpacket \ - socket-raw \ - socket-tcp \ - socket-tcp-listen \ -@@ -119,6 +123,7 @@ TST_NOFILE := \ - sock_opts01 \ - sock_opts02 \ - sk-unix-unconn \ -+ sk-unix-unconn-seqpacket \ - ipc_namespace \ - selfexe00 \ - sem \ -@@ -187,6 +192,7 @@ TST_NOFILE := \ - scm01 \ - scm02 \ - scm03 \ -+ scm03-seqpacket \ - scm04 \ - scm05 \ - scm06 \ -@@ -284,6 +290,7 @@ TST_FILE = \ - file_attr \ - deleted_unix_sock \ - sk-unix-rel \ -+ sk-unix-rel-seqpacket \ - deleted_dev \ - unlink_fstat00 \ - unlink_fstat01 \ -@@ -311,7 +318,9 @@ TST_FILE = \ - cow01 \ - fdt_shared \ - sockets00 \ -+ sockets00-seqpacket \ - sockets03 \ -+ sockets03-seqpacket \ - sockets_dgram \ - file_lease00 \ - file_lease01 \ -@@ -394,8 +403,10 @@ TST_DIR = \ - mnt_enablefs \ - autofs \ - del_standalone_un \ -+ del_standalone_un_seqpacket \ - sk-unix-mntns \ - sk-unix01 \ -+ sk-unix01-seqpacket \ - sk-unix-dgram-ghost \ - unsupported_children_collision \ - shared_slave_mount_children \ -@@ -607,6 +618,18 @@ socket-tcp6-unconn: CFLAGS += -D ZDTM_IPV6 - socket-tcp4v6-last-ack: CFLAGS += -D ZDTM_TCP_LAST_ACK -D ZDTM_IPV4V6 - socket-tcp4v6-closing: CFLAGS += -D ZDTM_IPV4V6 - -+sockets00-seqpacket: CFLAGS += -D ZDTM_UNIX_SEQPACKET -+sockets01-seqpacket: CFLAGS += -D ZDTM_UNIX_SEQPACKET -+sockets02-seqpacket: CFLAGS += -D ZDTM_UNIX_SEQPACKET -+sockets03-seqpacket: CFLAGS += -D ZDTM_UNIX_SEQPACKET -+sk-unix01-seqpacket: CFLAGS += -D ZDTM_UNIX_SEQPACKET -+sk-unix-rel-seqpacket: CFLAGS += -D ZDTM_UNIX_SEQPACKET -+sockets_spair_seqpacket: CFLAGS += -D ZDTM_UNIX_SEQPACKET -+socket_queues_seqpacket: CFLAGS += -D ZDTM_UNIX_SEQPACKET -+del_standalone_un_seqpacket: CFLAGS += -D ZDTM_UNIX_SEQPACKET -+sk-unix-unconn-seqpacket: CFLAGS += -D ZDTM_UNIX_SEQPACKET -+scm03-seqpacket: CFLAGS += -D ZDTM_UNIX_SEQPACKET -+ - pty-console: CFLAGS += -D ZDTM_DEV_CONSOLE - - shm-unaligned: CFLAGS += -DZDTM_SHM_UNALIGNED -diff --git a/test/zdtm/static/del_standalone_un.c b/test/zdtm/static/del_standalone_un.c -index c9fa84870..b4f99e260 100644 ---- a/test/zdtm/static/del_standalone_un.c -+++ b/test/zdtm/static/del_standalone_un.c -@@ -16,11 +16,17 @@ const char *test_author = "Tycho Andersen "; - char *dirname; - TEST_OPTION(dirname, string, "directory name", 1); - -+#ifdef ZDTM_UNIX_SEQPACKET -+#define SOCK_TYPE SOCK_SEQPACKET -+#else -+#define SOCK_TYPE SOCK_STREAM -+#endif -+ - static int bind_and_listen(struct sockaddr_un *addr) - { - int sk; - -- sk = socket(PF_UNIX, SOCK_STREAM, 0); -+ sk = socket(PF_UNIX, SOCK_TYPE, 0); - if (sk < 0) { - fail("socket"); - return -1; -diff --git a/test/zdtm/static/del_standalone_un_seqpacket.c b/test/zdtm/static/del_standalone_un_seqpacket.c -new file mode 120000 -index 000000000..d88fcbad8 ---- /dev/null -+++ b/test/zdtm/static/del_standalone_un_seqpacket.c -@@ -0,0 +1 @@ -+del_standalone_un.c -\ No newline at end of file -diff --git a/test/zdtm/static/scm03-seqpacket.c b/test/zdtm/static/scm03-seqpacket.c -new file mode 120000 -index 000000000..f1f86dd8b ---- /dev/null -+++ b/test/zdtm/static/scm03-seqpacket.c -@@ -0,0 +1 @@ -+scm03.c -\ No newline at end of file -diff --git a/test/zdtm/static/scm03.c b/test/zdtm/static/scm03.c -index a40fc0101..4453f7e93 100644 ---- a/test/zdtm/static/scm03.c -+++ b/test/zdtm/static/scm03.c -@@ -9,6 +9,12 @@ - const char *test_doc = "Check that SCM_RIGHTS are preserved"; - const char *test_author = "Pavel Emelyanov "; - -+#ifdef ZDTM_UNIX_SEQPACKET -+#define SOCK_TYPE SOCK_SEQPACKET -+#else -+#define SOCK_TYPE SOCK_DGRAM -+#endif -+ - static int send_fd(int via, int fd1, int fd2) - { - struct msghdr h = {}; -@@ -105,7 +111,7 @@ int main(int argc, char **argv) - - test_init(argc, argv); - -- if (socketpair(PF_UNIX, SOCK_DGRAM, 0, sk) < 0) { -+ if (socketpair(PF_UNIX, SOCK_TYPE, 0, sk) < 0) { - pr_perror("Can't make unix pair"); - exit(1); - } -diff --git a/test/zdtm/static/sk-unix-rel-seqpacket.c b/test/zdtm/static/sk-unix-rel-seqpacket.c -new file mode 120000 -index 000000000..1f98e3845 ---- /dev/null -+++ b/test/zdtm/static/sk-unix-rel-seqpacket.c -@@ -0,0 +1 @@ -+sk-unix-rel.c -\ No newline at end of file -diff --git a/test/zdtm/static/sk-unix-rel.c b/test/zdtm/static/sk-unix-rel.c -index 10c19080a..7e4aeafe6 100644 ---- a/test/zdtm/static/sk-unix-rel.c -+++ b/test/zdtm/static/sk-unix-rel.c -@@ -25,6 +25,12 @@ TEST_OPTION(filename, string, "socket file name", 1); - - #define TEST_MODE 0640 - -+#ifdef ZDTM_UNIX_SEQPACKET -+#define SOCK_TYPE SOCK_SEQPACKET -+#else -+#define SOCK_TYPE SOCK_STREAM -+#endif -+ - int main(int argc, char *argv[]) - { - struct sockaddr_un addr; -@@ -54,8 +60,8 @@ int main(int argc, char *argv[]) - memcpy(addr.sun_path, filename, addrlen); - addrlen += sizeof(addr.sun_family); - -- sock[0] = socket(AF_UNIX, SOCK_STREAM, 0); -- sock[1] = socket(AF_UNIX, SOCK_STREAM, 0); -+ sock[0] = socket(AF_UNIX, SOCK_TYPE, 0); -+ sock[1] = socket(AF_UNIX, SOCK_TYPE, 0); - if (sock[0] < 0 || sock[1] < 0) { - fail("socket"); - exit(1); -diff --git a/test/zdtm/static/sk-unix-unconn-seqpacket.c b/test/zdtm/static/sk-unix-unconn-seqpacket.c -new file mode 120000 -index 000000000..f5c276186 ---- /dev/null -+++ b/test/zdtm/static/sk-unix-unconn-seqpacket.c -@@ -0,0 +1 @@ -+sk-unix-unconn.c -\ No newline at end of file -diff --git a/test/zdtm/static/sk-unix-unconn.c b/test/zdtm/static/sk-unix-unconn.c -index caad3d315..62e48247f 100644 ---- a/test/zdtm/static/sk-unix-unconn.c -+++ b/test/zdtm/static/sk-unix-unconn.c -@@ -9,6 +9,12 @@ - const char *test_doc = "Check unconnected unix sockets"; - const char *test_author = "Vagin Andrew "; - -+#ifdef ZDTM_UNIX_SEQPACKET -+#define SOCK_TYPE SOCK_SEQPACKET -+#else -+#define SOCK_TYPE SOCK_STREAM -+#endif -+ - int main(int argc, char **argv) - { - int sk, skc; -@@ -19,13 +25,13 @@ int main(int argc, char **argv) - - test_init(argc, argv); - -- sk = socket(AF_UNIX, SOCK_STREAM, 0); -+ sk = socket(AF_UNIX, SOCK_TYPE, 0); - if (sk == -1) { - pr_perror("socket"); - return 1; - } - -- skc = socket(AF_UNIX, SOCK_STREAM, 0); -+ skc = socket(AF_UNIX, SOCK_TYPE, 0); - if (skc == -1) { - pr_perror("socket"); - return 1; -diff --git a/test/zdtm/static/sk-unix01-seqpacket.c b/test/zdtm/static/sk-unix01-seqpacket.c -new file mode 120000 -index 000000000..bef734ed6 ---- /dev/null -+++ b/test/zdtm/static/sk-unix01-seqpacket.c -@@ -0,0 +1 @@ -+sk-unix01.c -\ No newline at end of file -diff --git a/test/zdtm/static/sk-unix01-seqpacket.desc b/test/zdtm/static/sk-unix01-seqpacket.desc -new file mode 120000 -index 000000000..7a30da25c ---- /dev/null -+++ b/test/zdtm/static/sk-unix01-seqpacket.desc -@@ -0,0 +1 @@ -+sk-unix01.desc -\ No newline at end of file -diff --git a/test/zdtm/static/sk-unix01.c b/test/zdtm/static/sk-unix01.c -index c2bb8b9ed..5146c027f 100644 ---- a/test/zdtm/static/sk-unix01.c -+++ b/test/zdtm/static/sk-unix01.c -@@ -24,6 +24,12 @@ const char *test_author = "Cyrill Gorcunov "; - char *dirname; - TEST_OPTION(dirname, string, "directory name", 1); - -+#ifdef ZDTM_UNIX_SEQPACKET -+#define SOCK_TYPE SOCK_SEQPACKET -+#else -+#define SOCK_TYPE SOCK_STREAM -+#endif -+ - static int sk_alloc_bind(int type, struct sockaddr_un *addr) - { - int sk; -@@ -256,7 +262,7 @@ int main(int argc, char **argv) - - unlink(addr.sun_path); - -- sk_st[0] = sk_alloc_bind(SOCK_STREAM, &addr); -+ sk_st[0] = sk_alloc_bind(SOCK_TYPE, &addr); - if (sk_st[0] < 0) - return 1; - test_msg("sk-st: alloc/bind/listen %d\n", sk_st[0]); -@@ -266,7 +272,7 @@ int main(int argc, char **argv) - return 1; - } - -- sk_st[1] = sk_alloc_connect(SOCK_STREAM, &addr); -+ sk_st[1] = sk_alloc_connect(SOCK_TYPE, &addr); - if (sk_st[1] < 0) - return 1; - test_msg("sk-st: alloc/connect %d\n", sk_st[1]); -@@ -279,7 +285,7 @@ int main(int argc, char **argv) - } - test_msg("sk-st: accept %d\n", sk_st[2]); - -- sk_st[3] = sk_alloc_connect(SOCK_STREAM, &addr); -+ sk_st[3] = sk_alloc_connect(SOCK_TYPE, &addr); - if (sk_st[3] < 0) - return 1; - test_msg("sk-st: alloc/connect %d\n", sk_st[3]); -diff --git a/test/zdtm/static/socket_queues.c b/test/zdtm/static/socket_queues.c -index e30bca0e1..44495f06b 100644 ---- a/test/zdtm/static/socket_queues.c -+++ b/test/zdtm/static/socket_queues.c -@@ -24,6 +24,12 @@ const char *test_author = "Stanislav Kinsbursky \n"; - #define SK_DATA_D1 "packet dgram left" - #define SK_DATA_D2 "packet dgram right" - -+#ifdef ZDTM_UNIX_SEQPACKET -+#define SOCK_TYPE SOCK_SEQPACKET -+#else -+#define SOCK_TYPE SOCK_STREAM -+#endif -+ - int main(int argc, char *argv[]) - { - int ssk_pair_d[2]; -@@ -32,7 +38,7 @@ int main(int argc, char *argv[]) - - test_init(argc, argv); - -- if (socketpair(AF_UNIX, SOCK_STREAM, 0, ssk_pair_s) == -1) { -+ if (socketpair(AF_UNIX, SOCK_TYPE, 0, ssk_pair_s) == -1) { - fail("socketpair"); - exit(1); - } -diff --git a/test/zdtm/static/socket_queues_seqpacket.c b/test/zdtm/static/socket_queues_seqpacket.c -new file mode 120000 -index 000000000..0f3f93ea6 ---- /dev/null -+++ b/test/zdtm/static/socket_queues_seqpacket.c -@@ -0,0 +1 @@ -+socket_queues.c -\ No newline at end of file -diff --git a/test/zdtm/static/sockets00-seqpacket.c b/test/zdtm/static/sockets00-seqpacket.c -new file mode 120000 -index 000000000..4bce9fc31 ---- /dev/null -+++ b/test/zdtm/static/sockets00-seqpacket.c -@@ -0,0 +1 @@ -+sockets00.c -\ No newline at end of file -diff --git a/test/zdtm/static/sockets00-seqpacket.desc b/test/zdtm/static/sockets00-seqpacket.desc -new file mode 120000 -index 000000000..4beea2642 ---- /dev/null -+++ b/test/zdtm/static/sockets00-seqpacket.desc -@@ -0,0 +1 @@ -+sockets00.desc -\ No newline at end of file -diff --git a/test/zdtm/static/sockets00.c b/test/zdtm/static/sockets00.c -index 53890077b..ac5d7d6fe 100644 ---- a/test/zdtm/static/sockets00.c -+++ b/test/zdtm/static/sockets00.c -@@ -25,6 +25,12 @@ TEST_OPTION(filename, string, "socket file name", 1); - - #define TEST_MODE 0640 - -+#ifdef ZDTM_UNIX_SEQPACKET -+#define SOCK_TYPE SOCK_SEQPACKET -+#else -+#define SOCK_TYPE SOCK_STREAM -+#endif -+ - int main(int argc, char *argv[]) - { - int ssk_icon[4]; -@@ -58,9 +64,9 @@ int main(int argc, char *argv[]) - memcpy(addr.sun_path, path, addrlen); - addrlen += sizeof(addr.sun_family); - -- ssk_icon[0] = socket(AF_UNIX, SOCK_STREAM, 0); -- ssk_icon[1] = socket(AF_UNIX, SOCK_STREAM, 0); -- ssk_icon[2] = socket(AF_UNIX, SOCK_STREAM, 0); -+ ssk_icon[0] = socket(AF_UNIX, SOCK_TYPE, 0); -+ ssk_icon[1] = socket(AF_UNIX, SOCK_TYPE, 0); -+ ssk_icon[2] = socket(AF_UNIX, SOCK_TYPE, 0); - if (ssk_icon[0] < 0 || ssk_icon[1] < 0 || ssk_icon[2] < 0) { - fail("socket"); - exit(1); -diff --git a/test/zdtm/static/sockets01-seqpacket.c b/test/zdtm/static/sockets01-seqpacket.c -new file mode 120000 -index 000000000..8d51121e1 ---- /dev/null -+++ b/test/zdtm/static/sockets01-seqpacket.c -@@ -0,0 +1 @@ -+sockets01.c -\ No newline at end of file -diff --git a/test/zdtm/static/sockets01.c b/test/zdtm/static/sockets01.c -index e35a31fec..f56cd219e 100644 ---- a/test/zdtm/static/sockets01.c -+++ b/test/zdtm/static/sockets01.c -@@ -30,6 +30,12 @@ const char *test_author = "Pavel Emelyanov "; - #define TEST_MSG "test-message" - static char buf[sizeof(TEST_MSG)]; - -+#ifdef ZDTM_UNIX_SEQPACKET -+#define SOCK_TYPE SOCK_SEQPACKET -+#else -+#define SOCK_TYPE SOCK_STREAM -+#endif -+ - int main(int argc, char *argv[]) - { - int spu[2], spb[2], dpu[2], dpb[2], dpd[2]; -@@ -40,14 +46,14 @@ int main(int argc, char *argv[]) - signal(SIGPIPE, SIG_IGN); - - /* spu -- stream pair, unidirectional shutdown */ -- if (socketpair(PF_UNIX, SOCK_STREAM, 0, spu) < 0) -+ if (socketpair(PF_UNIX, SOCK_TYPE, 0, spu) < 0) - fin("no stream pair 1"); - - if (shutdown(spu[0], SHUT_RD) < 0) - fin("no stream shutdown 1"); - - /* spb -- stream pair, bidirectional shutdown */ -- if (socketpair(PF_UNIX, SOCK_STREAM, 0, spb) < 0) -+ if (socketpair(PF_UNIX, SOCK_TYPE, 0, spb) < 0) - fin("no stream pair 2"); - - if (shutdown(spb[0], SHUT_RDWR) < 0) -diff --git a/test/zdtm/static/sockets02-seqpacket.c b/test/zdtm/static/sockets02-seqpacket.c -new file mode 120000 -index 000000000..b95831599 ---- /dev/null -+++ b/test/zdtm/static/sockets02-seqpacket.c -@@ -0,0 +1 @@ -+sockets02.c -\ No newline at end of file -diff --git a/test/zdtm/static/sockets02.c b/test/zdtm/static/sockets02.c -index 2729ade2c..d7d84d815 100644 ---- a/test/zdtm/static/sockets02.c -+++ b/test/zdtm/static/sockets02.c -@@ -16,6 +16,12 @@ - const char *test_doc = "Test semi-closed unix stream connection\n"; - const char *test_author = "Pavel Emelyanov \n"; - -+#ifdef ZDTM_UNIX_SEQPACKET -+#define SOCK_TYPE SOCK_SEQPACKET -+#else -+#define SOCK_TYPE SOCK_STREAM -+#endif -+ - int main(int argc, char *argv[]) - { - int ssk_pair[2], ret; -@@ -25,7 +31,7 @@ int main(int argc, char *argv[]) - - data = (char)lrand48(); - -- if (socketpair(AF_UNIX, SOCK_STREAM, 0, ssk_pair) == -1) { -+ if (socketpair(AF_UNIX, SOCK_TYPE, 0, ssk_pair) == -1) { - fail("socketpair"); - exit(1); - } -diff --git a/test/zdtm/static/sockets03-seqpacket.c b/test/zdtm/static/sockets03-seqpacket.c -new file mode 120000 -index 000000000..997cce673 ---- /dev/null -+++ b/test/zdtm/static/sockets03-seqpacket.c -@@ -0,0 +1 @@ -+sockets03.c -\ No newline at end of file -diff --git a/test/zdtm/static/sockets03-seqpacket.desc b/test/zdtm/static/sockets03-seqpacket.desc -new file mode 120000 -index 000000000..3798a8242 ---- /dev/null -+++ b/test/zdtm/static/sockets03-seqpacket.desc -@@ -0,0 +1 @@ -+sockets03.desc -\ No newline at end of file -diff --git a/test/zdtm/static/sockets03.c b/test/zdtm/static/sockets03.c -index cd6f60831..6b0915aaa 100644 ---- a/test/zdtm/static/sockets03.c -+++ b/test/zdtm/static/sockets03.c -@@ -22,6 +22,12 @@ const char *test_author = "Andrey Ryabinin "; - char *filename; - TEST_OPTION(filename, string, "socket file name", 1); - -+#ifdef ZDTM_UNIX_SEQPACKET -+#define SOCK_TYPE SOCK_SEQPACKET -+#else -+#define SOCK_TYPE SOCK_STREAM -+#endif -+ - int main(int argc, char *argv[]) - { - int sk[3]; -@@ -52,8 +58,8 @@ int main(int argc, char *argv[]) - memcpy(addr.sun_path, path, addrlen); - addrlen += sizeof(addr.sun_family); - -- sk[0] = socket(AF_UNIX, SOCK_STREAM, 0); -- sk[1] = socket(AF_UNIX, SOCK_STREAM, 0); -+ sk[0] = socket(AF_UNIX, SOCK_TYPE, 0); -+ sk[1] = socket(AF_UNIX, SOCK_TYPE, 0); - if (sk[0] < 0 || sk[1] < 0) { - fail("socket"); - exit(1); -diff --git a/test/zdtm/static/sockets_spair.c b/test/zdtm/static/sockets_spair.c -index 2dbb132aa..202c2e790 100644 ---- a/test/zdtm/static/sockets_spair.c -+++ b/test/zdtm/static/sockets_spair.c -@@ -18,6 +18,12 @@ const char *test_author = "Cyrill Gorcunov -Date: Tue, 7 Dec 2021 21:29:44 +0000 -Subject: [PATCH 085/249] tls: fix typo - -Signed-off-by: Radostin Stoyanov ---- - criu/tls.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/criu/tls.c b/criu/tls.c -index 60bd105bc..6a7b523ac 100644 ---- a/criu/tls.c -+++ b/criu/tls.c -@@ -8,7 +8,7 @@ - #include "cr_options.h" - #include "xmalloc.h" - --/* Compatability with GnuTLS verson <3.5 */ -+/* Compatability with GnuTLS version < 3.5 */ - #ifndef GNUTLS_E_CERTIFICATE_VERIFICATION_ERROR - #define GNUTLS_E_CERTIFICATE_VERIFICATION_ERROR GNUTLS_E_CERTIFICATE_ERROR - #endif --- -2.35.1 - diff --git a/0086-tls-use-ssize_t-for-return-value.patch b/0086-tls-use-ssize_t-for-return-value.patch deleted file mode 100644 index 316c23e..0000000 --- a/0086-tls-use-ssize_t-for-return-value.patch +++ /dev/null @@ -1,71 +0,0 @@ -From 3b96f978beb40ebbd1b9b1610d1a2df5181d4bce Mon Sep 17 00:00:00 2001 -From: Radostin Stoyanov -Date: Tue, 7 Dec 2021 22:32:54 +0000 -Subject: [PATCH 086/249] tls: use ssize_t for return value - -Signed-off-by: Radostin Stoyanov ---- - criu/tls.c | 12 ++++++------ - 1 file changed, 6 insertions(+), 6 deletions(-) - -diff --git a/criu/tls.c b/criu/tls.c -index 6a7b523ac..626e529f8 100644 ---- a/criu/tls.c -+++ b/criu/tls.c -@@ -53,7 +53,7 @@ void tls_terminate_session(void) - - ssize_t tls_send(const void *buf, size_t len, int flags) - { -- int ret; -+ ssize_t ret; - - tls_sk_flags = flags; - ret = gnutls_record_send(session, buf, len); -@@ -95,7 +95,7 @@ int tls_send_data_from_fd(int fd, unsigned long len) - return -1; - - while (len > 0) { -- int ret, sent; -+ ssize_t ret, sent; - - copied = read(fd, buf, min(len, buf_size)); - if (copied <= 0) { -@@ -119,7 +119,7 @@ err: - - ssize_t tls_recv(void *buf, size_t len, int flags) - { -- int ret; -+ ssize_t ret; - - tls_sk_flags = flags; - ret = gnutls_record_recv(session, buf, len); -@@ -163,7 +163,7 @@ int tls_recv_data_to_fd(int fd, unsigned long len) - gnutls_packet_t packet; - - while (len > 0) { -- int ret, w; -+ ssize_t ret, w; - gnutls_datum_t pdata; - - ret = gnutls_record_recv_packet(session, &packet); -@@ -301,7 +301,7 @@ static int tls_x509_setup_creds(void) - static ssize_t _tls_push_cb(void *p, const void *data, size_t sz) - { - int fd = *(int *)(p); -- int ret = send(fd, data, sz, tls_sk_flags); -+ ssize_t ret = send(fd, data, sz, tls_sk_flags); - if (ret < 0 && errno != EAGAIN) { - int _errno = errno; - pr_perror("Push callback send failed"); -@@ -313,7 +313,7 @@ static ssize_t _tls_push_cb(void *p, const void *data, size_t sz) - static ssize_t _tls_pull_cb(void *p, void *data, size_t sz) - { - int fd = *(int *)(p); -- int ret = recv(fd, data, sz, tls_sk_flags); -+ ssize_t ret = recv(fd, data, sz, tls_sk_flags); - if (ret < 0 && errno != EAGAIN) { - int _errno = errno; - pr_perror("Pull callback recv failed"); --- -2.35.1 - diff --git a/0087-tls-add-more-comments.patch b/0087-tls-add-more-comments.patch deleted file mode 100644 index 93d3dc7..0000000 --- a/0087-tls-add-more-comments.patch +++ /dev/null @@ -1,111 +0,0 @@ -From f6760b9a2e3b714c63e838e7cb0262223a8d501e Mon Sep 17 00:00:00 2001 -From: Radostin Stoyanov -Date: Thu, 16 Dec 2021 14:26:53 +0000 -Subject: [PATCH 087/249] tls: add more comments - -Signed-off-by: Radostin Stoyanov ---- - criu/tls.c | 26 +++++++++++++++++++++++++- - 1 file changed, 25 insertions(+), 1 deletion(-) - -diff --git a/criu/tls.c b/criu/tls.c -index 626e529f8..9985b037d 100644 ---- a/criu/tls.c -+++ b/criu/tls.c -@@ -40,13 +40,19 @@ void tls_terminate_session(void) - - if (session) { - do { -- /* don't wait for peer to close connection */ -+ /* -+ * Initiate a connection shutdown but don't -+ * wait for peer to close connection. -+ */ - ret = gnutls_bye(session, GNUTLS_SHUT_WR); - } while (ret == GNUTLS_E_AGAIN || ret == GNUTLS_E_INTERRUPTED); -+ /* Free the session object */ - gnutls_deinit(session); - } - - tls_sk = -1; -+ -+ /* Free the credentials object */ - if (x509_cred) - gnutls_certificate_free_credentials(x509_cred); - } -@@ -229,6 +235,7 @@ static int tls_handshake(void) - { - int ret = -1; - while (ret != GNUTLS_E_SUCCESS) { -+ /* Establish TLS session */ - ret = gnutls_handshake(session); - if (gnutls_error_is_fatal(ret)) { - tls_perror("TLS handshake failed", ret); -@@ -257,6 +264,7 @@ static int tls_x509_setup_creds(void) - if (opts.tls_key) - key = opts.tls_key; - -+ /* Load the trusted CA certificates */ - ret = gnutls_certificate_allocate_credentials(&x509_cred); - if (ret != GNUTLS_E_SUCCESS) { - tls_perror("Failed to allocate x509 credentials", ret); -@@ -298,6 +306,10 @@ static int tls_x509_setup_creds(void) - return 0; - } - -+/** -+ * A function used by gnutls to send data. It returns a positive -+ * number indicating the bytes sent, and -1 on error. -+ */ - static ssize_t _tls_push_cb(void *p, const void *data, size_t sz) - { - int fd = *(int *)(p); -@@ -310,6 +322,11 @@ static ssize_t _tls_push_cb(void *p, const void *data, size_t sz) - return ret; - } - -+/** -+ * A callback function used by gnutls to receive data. -+ * It returns 0 on connection termination, a positive number -+ * indicating the number of bytes received, and -1 on error. -+ */ - static ssize_t _tls_pull_cb(void *p, void *data, size_t sz) - { - int fd = *(int *)(p); -@@ -326,26 +343,33 @@ static int tls_x509_setup_session(unsigned int flags) - { - int ret; - -+ /* Create the session object */ - ret = gnutls_init(&session, flags); - if (ret != GNUTLS_E_SUCCESS) { - tls_perror("Failed to initialize session", ret); - return -1; - } - -+ /* Install the trusted certificates */ - ret = gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE, x509_cred); - if (ret != GNUTLS_E_SUCCESS) { - tls_perror("Failed to set session credentials", ret); - return -1; - } - -+ /* Configure the cipher preferences */ - ret = gnutls_set_default_priority(session); - if (ret != GNUTLS_E_SUCCESS) { - tls_perror("Failed to set priority", ret); - return -1; - } - -+ /* Associate the socket with the session object */ - gnutls_transport_set_ptr(session, &tls_sk); -+ -+ /* Set a push function for gnutls to use to send data */ - gnutls_transport_set_push_function(session, _tls_push_cb); -+ /* set a pull function for gnutls to use to receive data */ - gnutls_transport_set_pull_function(session, _tls_pull_cb); - - if (flags == GNUTLS_SERVER) { --- -2.35.1 - diff --git a/0088-uffd-call-disconnect_from_page_server-to-shutdown-a-.patch b/0088-uffd-call-disconnect_from_page_server-to-shutdown-a-.patch deleted file mode 100644 index eb40201..0000000 --- a/0088-uffd-call-disconnect_from_page_server-to-shutdown-a-.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 10199579ab5e5d95465d5e28fa5c72b5d782eebe Mon Sep 17 00:00:00 2001 -From: Andrei Vagin -Date: Tue, 21 Dec 2021 21:59:13 -0800 -Subject: [PATCH 088/249] uffd: call disconnect_from_page_server to shutdown a - page-server connection - -We need to be sure that page-server doesn't wait for a new command when we -call gnutls_bye() that sends an alert containing a close request. - -Signed-off-by: Andrei Vagin ---- - criu/uffd.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/criu/uffd.c b/criu/uffd.c -index f01e6999b..45ac8ba77 100644 ---- a/criu/uffd.c -+++ b/criu/uffd.c -@@ -1468,7 +1468,7 @@ int cr_lazy_pages(bool daemon) - - ret = handle_requests(epollfd, &events, nr_fds); - -- tls_terminate_session(); -+ disconnect_from_page_server(); - - xfree(events); - return ret; --- -2.35.1 - diff --git a/0089-tls-allow-to-terminate-connections-synchronously.patch b/0089-tls-allow-to-terminate-connections-synchronously.patch deleted file mode 100644 index d9bdbf0..0000000 --- a/0089-tls-allow-to-terminate-connections-synchronously.patch +++ /dev/null @@ -1,100 +0,0 @@ -From 8333e9dd1562b46fd0cb43ab22c9ac28e46ac66f Mon Sep 17 00:00:00 2001 -From: Andrei Vagin -Date: Wed, 22 Dec 2021 09:36:09 -0800 -Subject: [PATCH 089/249] tls: allow to terminate connections synchronously - -GNUTLS_SHUT_RDWR sends an alert containing a close request and waits for -the peer to reply with the same message. - -Signed-off-by: Andrei Vagin ---- - criu/include/tls.h | 4 ++-- - criu/page-xfer.c | 5 +++-- - criu/tls.c | 6 +++--- - 3 files changed, 8 insertions(+), 7 deletions(-) - -diff --git a/criu/include/tls.h b/criu/include/tls.h -index 26f9976fd..f563c092c 100644 ---- a/criu/include/tls.h -+++ b/criu/include/tls.h -@@ -4,7 +4,7 @@ - #ifdef CONFIG_GNUTLS - - int tls_x509_init(int sockfd, bool is_server); --void tls_terminate_session(void); -+void tls_terminate_session(bool async); - - ssize_t tls_send(const void *buf, size_t len, int flags); - ssize_t tls_recv(void *buf, size_t len, int flags); -@@ -19,7 +19,7 @@ int tls_recv_data_to_fd(int fd, unsigned long len); - #define tls_recv(buf, len, flags) (-1) - #define tls_send_data_from_fd(fd, len) (-1) - #define tls_recv_data_to_fd(fd, len) (-1) --#define tls_terminate_session() -+#define tls_terminate_session(async) - - #endif /* CONFIG_HAS_GNUTLS */ - -diff --git a/criu/page-xfer.c b/criu/page-xfer.c -index 9adf2c8b2..7ff07680f 100644 ---- a/criu/page-xfer.c -+++ b/criu/page-xfer.c -@@ -1259,6 +1259,8 @@ static int page_server_serve(int sk) - ret = -1; - } - -+ tls_terminate_session(ret != 0); -+ - if (ret == 0 && opts.ps_socket == -1) { - char c; - -@@ -1272,7 +1274,6 @@ static int page_server_serve(int sk) - } - } - -- tls_terminate_session(); - page_server_close(); - - pr_info("Session over\n"); -@@ -1504,7 +1505,7 @@ int disconnect_from_page_server(void) - - ret = 0; - out: -- tls_terminate_session(); -+ tls_terminate_session(ret != 0); - close_safe(&page_server_sk); - - return ret ?: status; -diff --git a/criu/tls.c b/criu/tls.c -index 9985b037d..4feaf613b 100644 ---- a/criu/tls.c -+++ b/criu/tls.c -@@ -31,7 +31,7 @@ static gnutls_certificate_credentials_t x509_cred; - static int tls_sk = -1; - static int tls_sk_flags = 0; - --void tls_terminate_session(void) -+void tls_terminate_session(bool async) - { - int ret; - -@@ -44,7 +44,7 @@ void tls_terminate_session(void) - * Initiate a connection shutdown but don't - * wait for peer to close connection. - */ -- ret = gnutls_bye(session, GNUTLS_SHUT_WR); -+ ret = gnutls_bye(session, async ? GNUTLS_SHUT_WR : GNUTLS_SHUT_RDWR); - } while (ret == GNUTLS_E_AGAIN || ret == GNUTLS_E_INTERRUPTED); - /* Free the session object */ - gnutls_deinit(session); -@@ -399,6 +399,6 @@ int tls_x509_init(int sockfd, bool is_server) - - return 0; - err: -- tls_terminate_session(); -+ tls_terminate_session(true); - return -1; - } --- -2.35.1 - diff --git a/0090-page-xfer-stop-waiting-for-a-new-command-after-a-clo.patch b/0090-page-xfer-stop-waiting-for-a-new-command-after-a-clo.patch deleted file mode 100644 index 0dedf81..0000000 --- a/0090-page-xfer-stop-waiting-for-a-new-command-after-a-clo.patch +++ /dev/null @@ -1,66 +0,0 @@ -From 613839c7f2bd851abe9414849320ec2a4241eeb4 Mon Sep 17 00:00:00 2001 -From: Andrei Vagin -Date: Wed, 22 Dec 2021 09:59:11 -0800 -Subject: [PATCH 090/249] page-xfer: stop waiting for a new command after a - close command - -There is no reason to do that and in case of tls, __recv returns EAGAIN -instead of 0. - -Signed-off-by: Andrei Vagin ---- - criu/page-xfer.c | 16 +++++++++------- - 1 file changed, 9 insertions(+), 7 deletions(-) - -diff --git a/criu/page-xfer.c b/criu/page-xfer.c -index 7ff07680f..60c793009 100644 ---- a/criu/page-xfer.c -+++ b/criu/page-xfer.c -@@ -50,8 +50,8 @@ static void psi2iovec(struct page_server_iov *ps, struct iovec *iov) - #define PS_IOV_ADD_F 6 - #define PS_IOV_GET 7 - --#define PS_IOV_FLUSH 0x1023 --#define PS_IOV_FLUSH_N_CLOSE 0x1024 -+#define PS_IOV_CLOSE 0x1023 -+#define PS_IOV_FORCE_CLOSE 0x1024 - - #define PS_CMD_BITS 16 - #define PS_CMD_MASK ((1 << PS_CMD_BITS) - 1) -@@ -1223,8 +1223,8 @@ static int page_server_serve(int sk) - ret = page_server_add(sk, &pi, flags); - break; - } -- case PS_IOV_FLUSH: -- case PS_IOV_FLUSH_N_CLOSE: { -+ case PS_IOV_CLOSE: -+ case PS_IOV_FORCE_CLOSE: { - int32_t status = 0; - - ret = 0; -@@ -1250,7 +1250,9 @@ static int page_server_serve(int sk) - break; - } - -- if (ret || (pi.cmd == PS_IOV_FLUSH_N_CLOSE)) -+ if (ret) -+ break; -+ if (pi.cmd == PS_IOV_CLOSE || pi.cmd == PS_IOV_FORCE_CLOSE) - break; - } - -@@ -1491,9 +1493,9 @@ int disconnect_from_page_server(void) - * the parent process) so we must order the - * page-server to terminate itself. - */ -- pi.cmd = PS_IOV_FLUSH_N_CLOSE; -+ pi.cmd = PS_IOV_FORCE_CLOSE; - else -- pi.cmd = PS_IOV_FLUSH; -+ pi.cmd = PS_IOV_CLOSE; - - if (send_psi(page_server_sk, &pi)) - goto out; --- -2.35.1 - diff --git a/0091-ci-reenable-the-lazy-thp-test-in-the-lazy-remote-mod.patch b/0091-ci-reenable-the-lazy-thp-test-in-the-lazy-remote-mod.patch deleted file mode 100644 index 4dbff09..0000000 --- a/0091-ci-reenable-the-lazy-thp-test-in-the-lazy-remote-mod.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 9f50a9fb2a88db3d2853f514cddda84c3ff0d683 Mon Sep 17 00:00:00 2001 -From: Andrei Vagin -Date: Wed, 22 Dec 2021 17:03:04 -0800 -Subject: [PATCH 091/249] ci: reenable the lazy-thp test in the lazy-remote - mode - -Signed-off-by: Andrei Vagin ---- - scripts/ci/run-ci-tests.sh | 4 +--- - 1 file changed, 1 insertion(+), 3 deletions(-) - -diff --git a/scripts/ci/run-ci-tests.sh b/scripts/ci/run-ci-tests.sh -index bf7331142..7eab9f2dc 100755 ---- a/scripts/ci/run-ci-tests.sh -+++ b/scripts/ci/run-ci-tests.sh -@@ -212,10 +212,8 @@ LAZY_OPTS="-p 2 -T $LAZY_TESTS $LAZY_EXCLUDE $ZDTM_OPTS" - ./test/zdtm.py run $LAZY_OPTS --lazy-pages - # shellcheck disable=SC2086 - ./test/zdtm.py run $LAZY_OPTS --remote-lazy-pages --# FIXME: post-copy migration of THP over TLS (sometimes) fails with: --# Error (criu/tls.c:321): tls: Pull callback recv failed: Connection reset by peer - # shellcheck disable=SC2086 --./test/zdtm.py run $LAZY_OPTS --remote-lazy-pages --tls -x lazy-thp -+./test/zdtm.py run $LAZY_OPTS --remote-lazy-pages --tls - - bash -x ./test/jenkins/criu-fault.sh - if [ "$UNAME_M" == "x86_64" ]; then --- -2.35.1 - diff --git a/0092-test-log-testname.out.inprogress-if-a-test-has-faile.patch b/0092-test-log-testname.out.inprogress-if-a-test-has-faile.patch deleted file mode 100644 index 7526386..0000000 --- a/0092-test-log-testname.out.inprogress-if-a-test-has-faile.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 18fa29e4cb67ffc395930c829809cb36921dac35 Mon Sep 17 00:00:00 2001 -From: Andrei Vagin -Date: Wed, 22 Dec 2021 17:06:21 -0800 -Subject: [PATCH 092/249] test: log testname.out.inprogress if a test has - failed - -This is required if the test failed by timeout. - -Signed-off-by: Andrei Vagin ---- - test/zdtm.py | 11 ++++++----- - 1 file changed, 6 insertions(+), 5 deletions(-) - -diff --git a/test/zdtm.py b/test/zdtm.py -index 086ae0285..c0e24a41a 100755 ---- a/test/zdtm.py -+++ b/test/zdtm.py -@@ -589,11 +589,12 @@ class zdtm_test: - os.unlink(self.__pidfile()) - - def print_output(self): -- if os.access(self.__name + '.out', os.R_OK): -- print("Test output: " + "=" * 32) -- with open(self.__name + '.out') as output: -- print(output.read()) -- print(" <<< " + "=" * 32) -+ for postfix in ['.out', '.out.inprogress']: -+ if os.access(self.__name + postfix, os.R_OK): -+ print("Test output: " + "=" * 32) -+ with open(self.__name + postfix) as output: -+ print(output.read()) -+ print(" <<< " + "=" * 32) - - def static(self): - return self.__name.split('/')[1] == 'static' --- -2.35.1 - diff --git a/0093-zdtm-print-tails-of-all-logs-if-a-test-has-failed.patch b/0093-zdtm-print-tails-of-all-logs-if-a-test-has-failed.patch deleted file mode 100644 index f595cd1..0000000 --- a/0093-zdtm-print-tails-of-all-logs-if-a-test-has-failed.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 6618fa96f8af67826b69bb49cb446579ce860693 Mon Sep 17 00:00:00 2001 -From: Andrei Vagin -Date: Wed, 22 Dec 2021 17:08:16 -0800 -Subject: [PATCH 093/249] zdtm: print tails of all logs if a test has failed - -Signed-off-by: Andrei Vagin ---- - test/zdtm.py | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/test/zdtm.py b/test/zdtm.py -index c0e24a41a..14e6aa1b0 100755 ---- a/test/zdtm.py -+++ b/test/zdtm.py -@@ -1475,17 +1475,17 @@ class criu: - self.__lazy_pages_p.terminate() - print("criu lazy-pages exited with %s" % - self.__lazy_pages_p.wait()) -- grep_errors(os.path.join(self.__ddir(), "lazy-pages.log")) -+ grep_errors(os.path.join(self.__ddir(), "lazy-pages.log"), err=True) - self.__lazy_pages_p = None - if self.__page_server_p: - self.__page_server_p.terminate() - print("criu page-server exited with %s" % - self.__page_server_p.wait()) -- grep_errors(os.path.join(self.__ddir(), "page-server.log")) -+ grep_errors(os.path.join(self.__ddir(), "page-server.log"), err=True) - self.__page_server_p = None - if self.__dump_process: - self.__dump_process.terminate() -- print("criu dump exited with %s" % self.__dump_process.wait()) -+ print("criu dump exited with %s" % self.__dump_process.wait(), err=True) - grep_errors(os.path.join(self.__ddir(), "dump.log")) - self.__dump_process = None - if self.__img_streamer_process: --- -2.35.1 - diff --git a/0094-zdtm-static-uffd-events-add-more-log-messages.patch b/0094-zdtm-static-uffd-events-add-more-log-messages.patch deleted file mode 100644 index 70282a6..0000000 --- a/0094-zdtm-static-uffd-events-add-more-log-messages.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 9ca813c3237c4c3d5e0e09ed2358f5f1a1d43c1d Mon Sep 17 00:00:00 2001 -From: Andrei Vagin -Date: Wed, 22 Dec 2021 17:08:42 -0800 -Subject: [PATCH 094/249] zdtm/static/uffd-events: add more log messages - -Signed-off-by: Andrei Vagin ---- - test/zdtm/static/uffd-events.c | 12 +++++++----- - 1 file changed, 7 insertions(+), 5 deletions(-) - -diff --git a/test/zdtm/static/uffd-events.c b/test/zdtm/static/uffd-events.c -index c811bcf4c..edd6c09ca 100644 ---- a/test/zdtm/static/uffd-events.c -+++ b/test/zdtm/static/uffd-events.c -@@ -153,28 +153,30 @@ int main(int argc, char **argv) - return 1; - } - -+ test_msg("For a child process\n"); - pid = fork(); - if (pid < 0) { - fail("Can't fork"); - return 1; - } - -- /* check madvise(MADV_DONTNEED) */ -+ test_msg("Check madvise(MADV_DONTNEED)\n"); - if (check_madv_dn(1)) - return 1; - -- /* check growing mremap */ -+ test_msg("Check growing mremap\n"); - if (check_mremap_grow(2)) - return 1; - -- /* check swapped mappings */ -+ test_msg("Check swapped mappings\n"); - if (check_swapped_mappings(3)) - return 1; - - if (pid) { -- int status; -+ int status = -1; - -- waitpid(-1, &status, 0); -+ test_msg("Wait for the child %d\n", pid); -+ waitpid(pid, &status, 0); - if (status) { - fail("child failed"); - return status; --- -2.35.1 - diff --git a/0095-mount-split-check_mountpoint_fd-from-__open_mountpoi.patch b/0095-mount-split-check_mountpoint_fd-from-__open_mountpoi.patch deleted file mode 100644 index 902ea84..0000000 --- a/0095-mount-split-check_mountpoint_fd-from-__open_mountpoi.patch +++ /dev/null @@ -1,120 +0,0 @@ -From e88e3a0cf79d6625ed4f5e4ffd07a3ee6405fda4 Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Fri, 17 Dec 2021 14:58:47 +0300 -Subject: [PATCH 095/249] mount: split check_mountpoint_fd from - __open_mountpoint - -Now we can reuse "check" part separately in other places. - -Signed-off-by: Pavel Tikhomirov ---- - criu/include/mount.h | 1 + - criu/mount.c | 60 ++++++++++++++++++++++++-------------------- - 2 files changed, 34 insertions(+), 27 deletions(-) - -diff --git a/criu/include/mount.h b/criu/include/mount.h -index 7705279e4..23448d5fc 100644 ---- a/criu/include/mount.h -+++ b/criu/include/mount.h -@@ -109,6 +109,7 @@ extern int mntns_get_root_by_mnt_id(int mnt_id); - extern struct ns_id *lookup_nsid_by_mnt_id(int mnt_id); - - extern int open_mount(unsigned int s_dev); -+extern int check_mountpoint_fd(struct mount_info *pm, int mnt_fd); - extern int __open_mountpoint(struct mount_info *pm, int mnt_fd); - extern int mnt_is_dir(struct mount_info *pm); - extern int open_mountpoint(struct mount_info *pm); -diff --git a/criu/mount.c b/criu/mount.c -index d75ca5598..f6347fd9d 100644 ---- a/criu/mount.c -+++ b/criu/mount.c -@@ -1018,39 +1018,20 @@ int mnt_is_dir(struct mount_info *pm) - return 0; - } - --/* -- * mnt_fd is a file descriptor on the mountpoint, which is closed in an error case. -- * If mnt_fd is -1, the mountpoint will be opened by this function. -- */ --int __open_mountpoint(struct mount_info *pm, int mnt_fd) -+int check_mountpoint_fd(struct mount_info *pm, int mnt_fd) - { - struct stat st; -- int dev; -- int ret; -- -- if (mnt_fd == -1) { -- int mntns_root; -- -- mntns_root = mntns_get_root_fd(pm->nsid); -- if (mntns_root < 0) -- return -1; -- -- mnt_fd = openat(mntns_root, pm->ns_mountpoint, O_RDONLY); -- if (mnt_fd < 0) { -- pr_perror("Can't open %s", pm->ns_mountpoint); -- return -1; -- } -- } -+ int ret, dev; - - ret = fstat(mnt_fd, &st); - if (ret < 0) { - pr_perror("fstat(%s) failed", pm->ns_mountpoint); -- goto err; -+ return -1; - } - - if (pm->s_dev_rt == MOUNT_INVALID_DEV) { - pr_err("Resolving over invalid device for %#x %s %s\n", pm->s_dev, pm->fstype->name, pm->ns_mountpoint); -- goto err; -+ return -1; - } - - dev = MKKDEV(major(st.st_dev), minor(st.st_dev)); -@@ -1063,13 +1044,38 @@ int __open_mountpoint(struct mount_info *pm, int mnt_fd) - if (dev != pm->s_dev_rt) { - pr_err("The file system %#x %#x (%#x) %s %s is inaccessible\n", pm->s_dev, pm->s_dev_rt, dev, - pm->fstype->name, pm->ns_mountpoint); -- goto err; -+ return -1; -+ } -+ -+ return 0; -+} -+ -+/* -+ * mnt_fd is a file descriptor on the mountpoint, which is closed in an error case. -+ * If mnt_fd is -1, the mountpoint will be opened by this function. -+ */ -+int __open_mountpoint(struct mount_info *pm, int mnt_fd) -+{ -+ if (mnt_fd == -1) { -+ int mntns_root; -+ -+ mntns_root = mntns_get_root_fd(pm->nsid); -+ if (mntns_root < 0) -+ return -1; -+ -+ mnt_fd = openat(mntns_root, pm->ns_mountpoint, O_RDONLY); -+ if (mnt_fd < 0) { -+ pr_perror("Can't open %s", pm->ns_mountpoint); -+ return -1; -+ } -+ } -+ -+ if (check_mountpoint_fd(pm, mnt_fd)) { -+ close(mnt_fd); -+ return -1; - } - - return mnt_fd; --err: -- close(mnt_fd); -- return -1; - } - - int open_mount(unsigned int s_dev) --- -2.35.1 - diff --git a/0096-mount-remove-mnt_fd-argument-of-__open_mountpoint.patch b/0096-mount-remove-mnt_fd-argument-of-__open_mountpoint.patch deleted file mode 100644 index 427d870..0000000 --- a/0096-mount-remove-mnt_fd-argument-of-__open_mountpoint.patch +++ /dev/null @@ -1,116 +0,0 @@ -From 5258c8a15e46c2bf6614c6bd3cfb79463e640abe Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Fri, 17 Dec 2021 15:13:35 +0300 -Subject: [PATCH 096/249] mount: remove mnt_fd argument of __open_mountpoint - -Only place where we used __open_mountpoint with non -1 mnt_fd is -open_mountpoint. Let's use check_mountpoint_fd for this case, so that we -now can remove mnt_id argument. Also now __open_mountpoint actually -always does open. - -Signed-off-by: Pavel Tikhomirov ---- - criu/fsnotify.c | 4 ++-- - criu/include/mount.h | 2 +- - criu/mount.c | 26 ++++++++++++-------------- - 3 files changed, 15 insertions(+), 17 deletions(-) - -diff --git a/criu/fsnotify.c b/criu/fsnotify.c -index b5dd15dd8..22fb74973 100644 ---- a/criu/fsnotify.c -+++ b/criu/fsnotify.c -@@ -132,7 +132,7 @@ static char *alloc_openable(unsigned int s_dev, unsigned long i_ino, FhEntry *f_ - if (!mnt_is_dir(m)) - continue; - -- mntfd = __open_mountpoint(m, -1); -+ mntfd = __open_mountpoint(m); - pr_debug("\t\tTrying via mntid %d root %s ns_mountpoint @%s (%d)\n", m->mnt_id, m->root, - m->ns_mountpoint, mntfd); - if (mntfd < 0) -@@ -206,7 +206,7 @@ static int open_handle(unsigned int s_dev, unsigned long i_ino, FhEntry *f_handl - if (m->s_dev != s_dev || !mnt_is_dir(m)) - continue; - -- mntfd = __open_mountpoint(m, -1); -+ mntfd = __open_mountpoint(m); - if (mntfd < 0) { - pr_warn("Can't open mount for s_dev %x, continue\n", s_dev); - continue; -diff --git a/criu/include/mount.h b/criu/include/mount.h -index 23448d5fc..3f3a67afa 100644 ---- a/criu/include/mount.h -+++ b/criu/include/mount.h -@@ -110,7 +110,7 @@ extern struct ns_id *lookup_nsid_by_mnt_id(int mnt_id); - - extern int open_mount(unsigned int s_dev); - extern int check_mountpoint_fd(struct mount_info *pm, int mnt_fd); --extern int __open_mountpoint(struct mount_info *pm, int mnt_fd); -+extern int __open_mountpoint(struct mount_info *pm); - extern int mnt_is_dir(struct mount_info *pm); - extern int open_mountpoint(struct mount_info *pm); - -diff --git a/criu/mount.c b/criu/mount.c -index f6347fd9d..ab6d3ed10 100644 ---- a/criu/mount.c -+++ b/criu/mount.c -@@ -1054,20 +1054,18 @@ int check_mountpoint_fd(struct mount_info *pm, int mnt_fd) - * mnt_fd is a file descriptor on the mountpoint, which is closed in an error case. - * If mnt_fd is -1, the mountpoint will be opened by this function. - */ --int __open_mountpoint(struct mount_info *pm, int mnt_fd) -+int __open_mountpoint(struct mount_info *pm) - { -- if (mnt_fd == -1) { -- int mntns_root; -+ int mntns_root, mnt_fd; - -- mntns_root = mntns_get_root_fd(pm->nsid); -- if (mntns_root < 0) -- return -1; -+ mntns_root = mntns_get_root_fd(pm->nsid); -+ if (mntns_root < 0) -+ return -1; - -- mnt_fd = openat(mntns_root, pm->ns_mountpoint, O_RDONLY); -- if (mnt_fd < 0) { -- pr_perror("Can't open %s", pm->ns_mountpoint); -- return -1; -- } -+ mnt_fd = openat(mntns_root, pm->ns_mountpoint, O_RDONLY); -+ if (mnt_fd < 0) { -+ pr_perror("Can't open %s", pm->ns_mountpoint); -+ return -1; - } - - if (check_mountpoint_fd(pm, mnt_fd)) { -@@ -1086,7 +1084,7 @@ int open_mount(unsigned int s_dev) - if (!m) - return -ENOENT; - -- return __open_mountpoint(m, -1); -+ return __open_mountpoint(m); - } - - /* Bind-mount a mount point in a temporary place without children */ -@@ -1350,7 +1348,7 @@ int open_mountpoint(struct mount_info *pm) - - /* No overmounts and children - the entire mount is visible */ - if (list_empty(&pm->children) && !mnt_is_overmounted(pm)) -- return __open_mountpoint(pm, -1); -+ return __open_mountpoint(pm); - - pr_info("Mount is not fully visible %s\n", pm->mountpoint); - -@@ -1413,7 +1411,7 @@ int open_mountpoint(struct mount_info *pm) - goto err; - } - -- return __open_mountpoint(pm, fd); -+ return fd < 0 ? __open_mountpoint(pm) : check_mountpoint_fd(pm, fd); - err: - if (ns_old >= 0) - /* coverity[check_return] */ --- -2.35.1 - diff --git a/0097-proc_parse-add-helper-to-resolve-sdev-from-fd.patch b/0097-proc_parse-add-helper-to-resolve-sdev-from-fd.patch deleted file mode 100644 index 4627133..0000000 --- a/0097-proc_parse-add-helper-to-resolve-sdev-from-fd.patch +++ /dev/null @@ -1,101 +0,0 @@ -From 8b981b4b416781f6d1803a45eb2fc806cf0a9bab Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Thu, 16 Dec 2021 16:14:41 +0300 -Subject: [PATCH 097/249] proc_parse: add helper to resolve sdev from fd - -New get_sdev_from_fd helper first gets mnt_id from fd using fdinfo and -then converts mnt_id to sdev using mountinfo. - -By default mnt_id to sdev conversion only works for mounts in mntinfo. - -If parse_mountinfo argument is true, will also parse current process -mountinfo when looking for mount sdev, this should be used only with -temporary mounts just created by criu in current mntns. - -v3: add argument to parse self mountinfo for auxiliary mounts - -Signed-off-by: Pavel Tikhomirov ---- - criu/include/mount.h | 1 + - criu/proc_parse.c | 53 ++++++++++++++++++++++++++++++++++++++++++++ - 2 files changed, 54 insertions(+) - -diff --git a/criu/include/mount.h b/criu/include/mount.h -index 3f3a67afa..9c0d7c010 100644 ---- a/criu/include/mount.h -+++ b/criu/include/mount.h -@@ -140,6 +140,7 @@ extern void clean_cr_time_mounts(void); - - extern bool add_skip_mount(const char *mountpoint); - struct ns_id; -+extern int get_sdev_from_fd(int fd, unsigned int *sdev, bool parse_mountinfo); - extern struct mount_info *parse_mountinfo(pid_t pid, struct ns_id *nsid, bool for_dump); - - extern int check_mnt_id(void); -diff --git a/criu/proc_parse.c b/criu/proc_parse.c -index c734fc24a..eb3efc877 100644 ---- a/criu/proc_parse.c -+++ b/criu/proc_parse.c -@@ -1492,6 +1492,59 @@ out: - return exit_code; - } - -+static int get_mountinfo_sdev_from_mntid(int mnt_id, unsigned int *sdev) -+{ -+ int exit_code = -1; -+ FILE *f; -+ -+ f = fopen_proc(PROC_SELF, "mountinfo"); -+ if (!f) -+ return -1; -+ -+ while (fgets(buf, BUF_SIZE, f)) { -+ unsigned int kmaj, kmin; -+ int id; -+ -+ if (sscanf(buf, "%i %*i %u:%u", &id, &kmaj, &kmin) != 3) { -+ pr_err("Failed to parse mountinfo line %s\n", buf); -+ goto err; -+ } -+ -+ if (id == mnt_id) { -+ *sdev = MKKDEV(kmaj, kmin); -+ exit_code = 0; -+ break; -+ } -+ } -+err: -+ fclose(f); -+ return exit_code; -+} -+ -+/* This works even on btrfs where stat does not show right sdev */ -+int get_sdev_from_fd(int fd, unsigned int *sdev, bool parse_mountinfo) -+{ -+ struct mount_info *mi; -+ int ret, mnt_id; -+ -+ ret = get_fd_mntid(fd, &mnt_id); -+ if (ret < 0) -+ return -1; -+ -+ /* Simple case mnt_id is in dumped mntns */ -+ mi = lookup_mnt_id(mnt_id); -+ if (mi) { -+ *sdev = mi->s_dev_rt; -+ return 0; -+ } -+ -+ if (!parse_mountinfo) -+ return -1; -+ -+ /* Complex case mnt_id is in mntns created by criu */ -+ return get_mountinfo_sdev_from_mntid(mnt_id, sdev); -+} -+ - struct mount_info *parse_mountinfo(pid_t pid, struct ns_id *nsid, bool for_dump) - { - struct mount_info *list = NULL; --- -2.35.1 - diff --git a/0098-mount-btrfs-make-check_mountpoint_fd-fallback-to-get.patch b/0098-mount-btrfs-make-check_mountpoint_fd-fallback-to-get.patch deleted file mode 100644 index 439c89a..0000000 --- a/0098-mount-btrfs-make-check_mountpoint_fd-fallback-to-get.patch +++ /dev/null @@ -1,140 +0,0 @@ -From 1b1dc9023d1d169b75d19cc6770407b40589ee13 Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Thu, 16 Dec 2021 12:57:23 +0300 -Subject: [PATCH 098/249] mount/btrfs: make check_mountpoint_fd fallback to - get_sdev_from_fd - -We face that btrfs returns anonymous device in stat instead of real -superblock dev for volumes, thus all btrfs volume mounts does not pass -check_mountpoint_fd due to dev missmatch between stat and mountinfo. We -can use special helper get_sdev_from_fd instead of stat to try to get -real dev of fd for btrfs. - -We move check_mountpoint_fd from open_mountpoint into get_clean_fd and -ns_open_mountpoint to the point where temporary mount we open fd to is -still in mountinfo, thus get_sdev_from_fd would be able to find tmp -mount in mountinfo. - -Signed-off-by: Pavel Tikhomirov ---- - criu/include/mount.h | 1 + - criu/mount.c | 49 ++++++++++++++++++++++++++++++++++++++++---- - 2 files changed, 46 insertions(+), 4 deletions(-) - -diff --git a/criu/include/mount.h b/criu/include/mount.h -index 9c0d7c010..b959d131c 100644 ---- a/criu/include/mount.h -+++ b/criu/include/mount.h -@@ -109,6 +109,7 @@ extern int mntns_get_root_by_mnt_id(int mnt_id); - extern struct ns_id *lookup_nsid_by_mnt_id(int mnt_id); - - extern int open_mount(unsigned int s_dev); -+extern int __check_mountpoint_fd(struct mount_info *pm, int mnt_fd, bool parse_mountinfo); - extern int check_mountpoint_fd(struct mount_info *pm, int mnt_fd); - extern int __open_mountpoint(struct mount_info *pm); - extern int mnt_is_dir(struct mount_info *pm); -diff --git a/criu/mount.c b/criu/mount.c -index ab6d3ed10..4b57ac703 100644 ---- a/criu/mount.c -+++ b/criu/mount.c -@@ -1018,10 +1018,11 @@ int mnt_is_dir(struct mount_info *pm) - return 0; - } - --int check_mountpoint_fd(struct mount_info *pm, int mnt_fd) -+int __check_mountpoint_fd(struct mount_info *pm, int mnt_fd, bool parse_mountinfo) - { - struct stat st; -- int ret, dev; -+ unsigned int dev; -+ int ret; - - ret = fstat(mnt_fd, &st); - if (ret < 0) { -@@ -1042,6 +1043,14 @@ int check_mountpoint_fd(struct mount_info *pm, int mnt_fd) - * allocates new device ID). - */ - if (dev != pm->s_dev_rt) { -+ /* -+ * For btrfs device numbers in stat and mountinfo can be -+ * different, fallback to get_sdev_from_fd to get right dev. -+ */ -+ if (!strcmp(pm->fstype->name, "btrfs") && !get_sdev_from_fd(mnt_fd, &dev, parse_mountinfo) && -+ dev == pm->s_dev_rt) -+ return 0; -+ - pr_err("The file system %#x %#x (%#x) %s %s is inaccessible\n", pm->s_dev, pm->s_dev_rt, dev, - pm->fstype->name, pm->ns_mountpoint); - return -1; -@@ -1050,6 +1059,11 @@ int check_mountpoint_fd(struct mount_info *pm, int mnt_fd) - return 0; - } - -+int check_mountpoint_fd(struct mount_info *pm, int mnt_fd) -+{ -+ return __check_mountpoint_fd(pm, mnt_fd, false); -+} -+ - /* - * mnt_fd is a file descriptor on the mountpoint, which is closed in an error case. - * If mnt_fd is -1, the mountpoint will be opened by this function. -@@ -1114,12 +1128,34 @@ static int get_clean_fd(struct mount_info *mi) - char *mnt_path = NULL; - char mnt_path_tmp[] = "/tmp/cr-tmpfs.XXXXXX"; - char mnt_path_root[] = "/cr-tmpfs.XXXXXX"; -+ int fd; - - mnt_path = get_clean_mnt(mi, mnt_path_tmp, mnt_path_root); - if (!mnt_path) - return -1; - -- return open_detach_mount(mnt_path); -+ fd = open(mnt_path, O_RDONLY | O_DIRECTORY, 0); -+ if (fd < 0) { -+ pr_perror("Can't open directory %s", mnt_path); -+ } else { -+ if (__check_mountpoint_fd(mi, fd, true)) -+ goto err_close; -+ } -+ -+ if (umount2(mnt_path, MNT_DETACH)) { -+ pr_perror("Can't detach mount %s", mnt_path); -+ goto err_close; -+ } -+ -+ if (rmdir(mnt_path)) { -+ pr_perror("Can't remove tmp dir %s", mnt_path); -+ goto err_close; -+ } -+ -+ return fd; -+err_close: -+ close_safe(&fd); -+ return -1; - } - - /* -@@ -1337,6 +1373,11 @@ int ns_open_mountpoint(void *arg) - goto err; - } - -+ if (__check_mountpoint_fd(mi, *fd, true)) { -+ close(*fd); -+ goto err; -+ } -+ - return 0; - err: - return 1; -@@ -1411,7 +1452,7 @@ int open_mountpoint(struct mount_info *pm) - goto err; - } - -- return fd < 0 ? __open_mountpoint(pm) : check_mountpoint_fd(pm, fd); -+ return fd < 0 ? __open_mountpoint(pm) : fd; - err: - if (ns_old >= 0) - /* coverity[check_return] */ --- -2.35.1 - diff --git a/0099-ci-test-criu-image-streamer-with-all-tests.patch b/0099-ci-test-criu-image-streamer-with-all-tests.patch deleted file mode 100644 index f1d50ea..0000000 --- a/0099-ci-test-criu-image-streamer-with-all-tests.patch +++ /dev/null @@ -1,33 +0,0 @@ -From d5b49695c55387f14748a8543aaba29c7aeacf0f Mon Sep 17 00:00:00 2001 -From: Nicolas Viennot -Date: Tue, 28 Dec 2021 19:30:09 +0000 -Subject: [PATCH 099/249] ci: test criu-image-streamer with all tests - -All the bugs that were in the way got fixed. We can enable all tests. - -Signed-off-by: Nicolas Viennot ---- - scripts/ci/run-ci-tests.sh | 6 ++---- - 1 file changed, 2 insertions(+), 4 deletions(-) - -diff --git a/scripts/ci/run-ci-tests.sh b/scripts/ci/run-ci-tests.sh -index 7eab9f2dc..d0cd55f7c 100755 ---- a/scripts/ci/run-ci-tests.sh -+++ b/scripts/ci/run-ci-tests.sh -@@ -62,11 +62,9 @@ ci_prep () { - } - - test_stream() { -- # We must test CRIU features that dump content into an image file to ensure -- # streaming compatibility. -- STREAM_TEST_PATTERN='.*(ghost|fifo|unlink|memfd|shmem|socket_queue).*' -+ # Testing CRIU streaming to criu-image-streamer - # shellcheck disable=SC2086 -- ./test/zdtm.py run --stream -p 2 --keep-going -T "$STREAM_TEST_PATTERN" $ZDTM_OPTS -+ ./test/zdtm.py run --stream -p 2 --keep-going -a $ZDTM_OPTS - } - - print_header() { --- -2.35.1 - diff --git a/0100-readme-add-docker-test-badge.patch b/0100-readme-add-docker-test-badge.patch deleted file mode 100644 index 16bbd29..0000000 --- a/0100-readme-add-docker-test-badge.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 46b0679060e62da822f43b4a7fe061f03d5d6274 Mon Sep 17 00:00:00 2001 -From: Radostin Stoyanov -Date: Mon, 10 Jan 2022 10:37:19 +0000 -Subject: [PATCH 100/249] readme: add docker test badge - -Signed-off-by: Radostin Stoyanov ---- - README.md | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/README.md b/README.md -index fd86b2c15..6b86cac9e 100644 ---- a/README.md -+++ b/README.md -@@ -1,5 +1,6 @@ - ![X86_64 GCC Test](https://github.com/checkpoint-restore/criu/workflows/X86_64%20GCC%20Test/badge.svg) --![Podman Test](https://github.com/checkpoint-restore/criu/workflows/Podman%20Test/badge.svg) -+![Docker Test](https://github.com/checkpoint-restore/criu/actions/workflows/docker-test.yml/badge.svg) -+![Podman Test](https://github.com/checkpoint-restore/criu/actions/workflows/podman-test.yml/badge.svg) - [![CircleCI](https://circleci.com/gh/checkpoint-restore/criu.svg?style=svg)](https://circleci.com/gh/checkpoint-restore/criu) - -

--- -2.35.1 - diff --git a/0101-contributing-remove-old-badges-and-logo.patch b/0101-contributing-remove-old-badges-and-logo.patch deleted file mode 100644 index f390b60..0000000 --- a/0101-contributing-remove-old-badges-and-logo.patch +++ /dev/null @@ -1,28 +0,0 @@ -From b09d362e4f2c4fe9fd8f1085285762a40bc70627 Mon Sep 17 00:00:00 2001 -From: Radostin Stoyanov -Date: Mon, 10 Jan 2022 10:37:52 +0000 -Subject: [PATCH 101/249] contributing: remove old badges and logo - -CI badges and logo are already present in the readme file. - -Signed-off-by: Radostin Stoyanov ---- - CONTRIBUTING.md | 5 ----- - 1 file changed, 5 deletions(-) - -diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md -index 96972296e..864caf93e 100644 ---- a/CONTRIBUTING.md -+++ b/CONTRIBUTING.md -@@ -1,8 +1,3 @@ --[![master](https://travis-ci.org/checkpoint-restore/criu.svg?branch=master)](https://travis-ci.org/checkpoint-restore/criu) --[![development](https://travis-ci.org/checkpoint-restore/criu.svg?branch=criu-dev)](https://travis-ci.org/checkpoint-restore/criu) --[![Codacy Badge](https://api.codacy.com/project/badge/Grade/55251ec7db28421da4481fc7c1cb0cee)](https://www.codacy.com/app/xemul/criu?utm_source=github.com&utm_medium=referral&utm_content=xemul/criu&utm_campaign=Badge_Grade) --

-- - ## How to contribute to CRIU - - CRIU project is (almost) the never-ending story, because we have to always keep up with the --- -2.35.1 - diff --git a/0102-ci-update-to-latest-Vagrant-and-Fedora-images.patch b/0102-ci-update-to-latest-Vagrant-and-Fedora-images.patch deleted file mode 100644 index 6f687c4..0000000 --- a/0102-ci-update-to-latest-Vagrant-and-Fedora-images.patch +++ /dev/null @@ -1,37 +0,0 @@ -From eb6062eef811fe062a7d2ce5745405b867559b05 Mon Sep 17 00:00:00 2001 -From: Adrian Reber -Date: Fri, 3 Dec 2021 17:13:27 +0000 -Subject: [PATCH 102/249] ci: update to latest Vagrant and Fedora images - -Signed-off-by: Adrian Reber ---- - scripts/ci/vagrant.sh | 10 +++++----- - 1 file changed, 5 insertions(+), 5 deletions(-) - -diff --git a/scripts/ci/vagrant.sh b/scripts/ci/vagrant.sh -index 40c8416e1..4a4a16445 100755 ---- a/scripts/ci/vagrant.sh -+++ b/scripts/ci/vagrant.sh -@@ -1,14 +1,14 @@ - #!/bin/bash - --# This script is used to run vagrant based tests on Travis. --# This script is started via sudo from .travis.yml -+# This script is used to run vagrant based tests on Cirrus CI. -+# This script is started via .cirrus.yml - - set -e - set -x - --VAGRANT_VERSION=2.2.16 --FEDORA_VERSION=34 --FEDORA_BOX_VERSION=34.20210423.0 -+VAGRANT_VERSION=2.2.19 -+FEDORA_VERSION=35 -+FEDORA_BOX_VERSION=35.20211026.0 - - setup() { - if [ -n "$TRAVIS" ]; then --- -2.35.1 - diff --git a/0103-ci-added-.lgtm.yml-file.patch b/0103-ci-added-.lgtm.yml-file.patch deleted file mode 100644 index fdd9801..0000000 --- a/0103-ci-added-.lgtm.yml-file.patch +++ /dev/null @@ -1,56 +0,0 @@ -From c465ad91379d1b33c5ee17cac4153865a152a67b Mon Sep 17 00:00:00 2001 -From: Adrian Reber -Date: Sun, 16 Jan 2022 11:17:33 +0000 -Subject: [PATCH 103/249] ci: added .lgtm.yml file - -A couple of months (or years) ago I looked into lgtm.com for CRIU. Today -on a pull request I saw result from lgtm.com for the first time and it -failed. Not sure what triggered the lgtm.com message into the CRIU -repository, but with the .lgtm.yml file in this commit lgtm.com can -actually build CRIU. - -Signed-off-by: Adrian Reber ---- - .lgtm.yml | 30 ++++++++++++++++++++++++++++++ - 1 file changed, 30 insertions(+) - create mode 100644 .lgtm.yml - -diff --git a/.lgtm.yml b/.lgtm.yml -new file mode 100644 -index 000000000..a28c35de0 ---- /dev/null -+++ b/.lgtm.yml -@@ -0,0 +1,30 @@ -+extraction: -+ cpp: -+ prepare: -+ packages: -+ - "protobuf-c-compiler" -+ - "libprotobuf-c-dev" -+ - "libprotobuf-dev" -+ - "build-essential" -+ - "libprotobuf-dev" -+ - "libprotobuf-c-dev" -+ - "protobuf-c-compiler" -+ - "protobuf-compiler" -+ - "python3-protobuf" -+ - "libnet-dev" -+ - "pkg-config" -+ - "libnl-3-dev" -+ - "libbsd0" -+ - "libbsd-dev" -+ - "iproute2" -+ - "libcap-dev" -+ - "libaio-dev" -+ - "python3-yaml" -+ - "libnl-route-3-dev" -+ - "python-future" -+ - "gnutls-dev" -+ configure: -+ command: -+ - "ls -laR images/google" -+ - "ln -s /usr/include/google/protobuf/descriptor.proto images/google/protobuf/descriptor.proto" -+ - "ls -laR images/google" --- -2.35.1 - diff --git a/0104-lib-introduce-feature-check-in-libcriu.patch b/0104-lib-introduce-feature-check-in-libcriu.patch deleted file mode 100644 index f0e3264..0000000 --- a/0104-lib-introduce-feature-check-in-libcriu.patch +++ /dev/null @@ -1,144 +0,0 @@ -From c37c8a4ad0effe51f9b182f18bf2e761eaed1ebf Mon Sep 17 00:00:00 2001 -From: Adrian Reber -Date: Mon, 6 Dec 2021 16:51:21 +0000 -Subject: [PATCH 104/249] lib: introduce feature check in libcriu - -This commit adds feature check support to libcriu. It already exists in -the CLI and RPC and this just extends it to libcriu. - -This commit provides one function to do all possible feature checks in -one call. The parameter to the feature check function is a structure and -the user can enable which features should be checked. - -Using a structure makes the function extensible without the need to -break the API/ABI in the future. - -Signed-off-by: Adrian Reber ---- - lib/c/criu.c | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++ - lib/c/criu.h | 29 +++++++++++++++++++++ - 2 files changed, 101 insertions(+) - -diff --git a/lib/c/criu.c b/lib/c/criu.c -index 500574e33..dea5896f7 100644 ---- a/lib/c/criu.c -+++ b/lib/c/criu.c -@@ -1925,3 +1925,75 @@ int criu_join_ns_add(const char *ns, const char *ns_file, const char *extra_opt) - { - return criu_local_join_ns_add(global_opts, ns, ns_file, extra_opt); - } -+ -+int criu_local_feature_check(criu_opts *opts, struct criu_feature_check *features, size_t size) -+{ -+ CriuFeatures criu_features = CRIU_FEATURES__INIT; -+ struct criu_feature_check features_copy = { 0 }; -+ CriuReq req = CRIU_REQ__INIT; -+ CriuResp *resp = NULL; -+ int ret = -1; -+ -+ saved_errno = 0; -+ -+ if (!features) -+ goto exit; -+ -+ if (size > sizeof(struct criu_feature_check)) -+ goto exit; -+ -+ memcpy(&features_copy, features, size); -+ -+ req.type = CRIU_REQ_TYPE__FEATURE_CHECK; -+ req.opts = opts->rpc; -+ -+ if (features_copy.mem_track) { -+ criu_features.has_mem_track = true; -+ criu_features.mem_track = true; -+ } -+ if (features_copy.lazy_pages) { -+ criu_features.has_lazy_pages = true; -+ criu_features.lazy_pages = true; -+ } -+ if (features_copy.pidfd_store) { -+ criu_features.has_pidfd_store = true; -+ criu_features.pidfd_store = true; -+ } -+ req.features = &criu_features; -+ -+ ret = send_req_and_recv_resp(opts, &req, &resp); -+ if (ret) -+ goto exit; -+ -+ memset(&features_copy, 0, sizeof(struct criu_feature_check)); -+ -+ if (resp->success) { -+ if (resp->features->has_mem_track) { -+ features_copy.mem_track = resp->features->mem_track; -+ } -+ if (resp->features->has_lazy_pages) { -+ features_copy.lazy_pages = resp->features->lazy_pages; -+ } -+ if (resp->features->has_pidfd_store) { -+ features_copy.pidfd_store = resp->features->pidfd_store; -+ } -+ memcpy(features, &features_copy, size); -+ } else { -+ ret = -EBADE; -+ } -+ -+exit: -+ if (resp) -+ criu_resp__free_unpacked(resp, NULL); -+ -+ swrk_wait(opts); -+ -+ errno = saved_errno; -+ -+ return ret; -+} -+ -+int criu_feature_check(struct criu_feature_check *features, size_t size) -+{ -+ return criu_local_feature_check(global_opts, features, size); -+} -diff --git a/lib/c/criu.h b/lib/c/criu.h -index c6d4f50a8..aed2c3481 100644 ---- a/lib/c/criu.h -+++ b/lib/c/criu.h -@@ -288,6 +288,35 @@ int criu_local_dump_iters(criu_opts *opts, int (*more)(criu_predump_info pi)); - int criu_local_get_version(criu_opts *opts); - int criu_local_check_version(criu_opts *opts, int minimum); - -+/* -+ * Feature checking allows the user to check if CRIU supports -+ * certain features. There are CRIU features which do not depend -+ * on the version of CRIU but on kernel features or architecture. -+ * -+ * One example is memory tracking. Memory tracking can be disabled -+ * in the kernel or there are architectures which do not support -+ * it (aarch64 for example). By using the feature check a libcriu -+ * user can easily query CRIU if a certain feature is available. -+ * -+ * The features which should be checked can be marked in the -+ * structure 'struct criu_feature_check'. Each structure member -+ * that is set to true will result in CRIU checking for the -+ * availability of that feature in the current combination of -+ * CRIU/kernel/architecture. -+ * -+ * Available features will be set to true when the function -+ * returns successfully. Missing features will be set to false. -+ */ -+ -+struct criu_feature_check { -+ bool mem_track; -+ bool lazy_pages; -+ bool pidfd_store; -+}; -+ -+int criu_feature_check(struct criu_feature_check *features, size_t size); -+int criu_local_feature_check(criu_opts *opts, struct criu_feature_check *features, size_t size); -+ - #ifdef __GNUG__ - } - #endif --- -2.35.1 - diff --git a/0105-lib-added-tests-for-feature-check-in-libcriu.patch b/0105-lib-added-tests-for-feature-check-in-libcriu.patch deleted file mode 100644 index 653224e..0000000 --- a/0105-lib-added-tests-for-feature-check-in-libcriu.patch +++ /dev/null @@ -1,132 +0,0 @@ -From 2805df0ace12c0b92221a4644b48a95281300bae Mon Sep 17 00:00:00 2001 -From: Adrian Reber -Date: Mon, 6 Dec 2021 16:51:21 +0000 -Subject: [PATCH 105/249] lib: added tests for feature check in libcriu - -Signed-off-by: Adrian Reber ---- - test/others/libcriu/.gitignore | 1 + - test/others/libcriu/Makefile | 1 + - test/others/libcriu/run.sh | 10 ++++ - test/others/libcriu/test_feature_check.c | 65 ++++++++++++++++++++++++ - 4 files changed, 77 insertions(+) - create mode 100644 test/others/libcriu/test_feature_check.c - -diff --git a/test/others/libcriu/.gitignore b/test/others/libcriu/.gitignore -index 15abf07ac..0f6e52bb4 100644 ---- a/test/others/libcriu/.gitignore -+++ b/test/others/libcriu/.gitignore -@@ -5,5 +5,6 @@ test_self - test_sub - test_join_ns - test_pre_dump -+test_feature_check - output/ - libcriu.so.* -diff --git a/test/others/libcriu/Makefile b/test/others/libcriu/Makefile -index 581574da0..ae7330533 100644 ---- a/test/others/libcriu/Makefile -+++ b/test/others/libcriu/Makefile -@@ -7,6 +7,7 @@ TESTS += test_iters - TESTS += test_errno - TESTS += test_join_ns - TESTS += test_pre_dump -+TESTS += test_feature_check - - all: $(TESTS) - .PHONY: all -diff --git a/test/others/libcriu/run.sh b/test/others/libcriu/run.sh -index 1b6c73448..77bdfb87e 100755 ---- a/test/others/libcriu/run.sh -+++ b/test/others/libcriu/run.sh -@@ -62,6 +62,16 @@ if [ "$(uname -m)" = "x86_64" ]; then - fi - run_test test_errno - run_test test_join_ns -+if criu check --feature mem_dirty_track > /dev/null; then -+ export CRIU_FEATURE_MEM_TRACK=1 -+fi -+if criu check --feature uffd-noncoop > /dev/null; then -+ export CRIU_FEATURE_LAZY_PAGES=1 -+fi -+if criu check --feature pidfd_store > /dev/null; then -+ export CRIU_FEATURE_PIDFD_STORE=1 -+fi -+run_test test_feature_check - - echo "== Tests done" - make libcriu_clean -diff --git a/test/others/libcriu/test_feature_check.c b/test/others/libcriu/test_feature_check.c -new file mode 100644 -index 000000000..d88e0de23 ---- /dev/null -+++ b/test/others/libcriu/test_feature_check.c -@@ -0,0 +1,65 @@ -+#include "criu.h" -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "lib.h" -+ -+int main(int argc, char **argv) -+{ -+ int ret; -+ char *env; -+ bool mem_track = 0; -+ bool lazy_pages = 0; -+ bool pidfd_store = 0; -+ struct criu_feature_check features = { -+ .mem_track = true, -+ .lazy_pages = true, -+ .pidfd_store = true, -+ }; -+ -+ printf("--- Start feature check ---\n"); -+ criu_init_opts(); -+ criu_set_service_binary(argv[1]); -+ -+ env = getenv("CRIU_FEATURE_MEM_TRACK"); -+ if (env) { -+ mem_track = true; -+ } -+ env = getenv("CRIU_FEATURE_LAZY_PAGES"); -+ if (env) { -+ lazy_pages = true; -+ } -+ env = getenv("CRIU_FEATURE_PIDFD_STORE"); -+ if (env) { -+ pidfd_store = true; -+ } -+ -+ ret = criu_feature_check(&features, sizeof(features) + 1); -+ printf(" `- passing too large structure to libcriu should return -1: %d\n", ret); -+ if (ret != -1) -+ return -1; -+ -+ ret = criu_feature_check(&features, sizeof(features)); -+ if (ret < 0) { -+ what_err_ret_mean(ret); -+ return ret; -+ } -+ -+ printf(" `- mem_track : %d - expected : %d\n", features.mem_track, mem_track); -+ if (features.mem_track != mem_track) -+ return -1; -+ printf(" `- lazy_pages : %d - expected : %d\n", features.lazy_pages, lazy_pages); -+ if (features.lazy_pages != lazy_pages) -+ return -1; -+ printf(" `- pidfd_store: %d - expected : %d\n", features.pidfd_store, pidfd_store); -+ if (features.pidfd_store != pidfd_store) -+ return -1; -+ -+ return 0; -+} --- -2.35.1 - diff --git a/0106-pagemap-tiny-fix-on-truncating-memory-image.patch b/0106-pagemap-tiny-fix-on-truncating-memory-image.patch deleted file mode 100644 index 427f177..0000000 --- a/0106-pagemap-tiny-fix-on-truncating-memory-image.patch +++ /dev/null @@ -1,64 +0,0 @@ -From 5fbbd66aed7aa0b1d68614ec67aeefe49b8a0b36 Mon Sep 17 00:00:00 2001 -From: Liu Hua -Date: Thu, 6 Jan 2022 20:44:21 +0800 -Subject: [PATCH 106/249] pagemap: tiny fix on truncating memory image - -When requested iovs are huge, criu needs to invoke more then one -preadv()s. In this situation criu truncates memory image with -offset of first preadv() and length of last one, which leads -to leakage of memory image. This patch fixs truncating with right -offset and length. - -Signed-off-by: Liu Hua ---- - criu/pagemap.c | 19 +++++++++---------- - 1 file changed, 9 insertions(+), 10 deletions(-) - -diff --git a/criu/pagemap.c b/criu/pagemap.c -index d996db7fc..83f69bba3 100644 ---- a/criu/pagemap.c -+++ b/criu/pagemap.c -@@ -535,7 +535,6 @@ static int process_async_reads(struct page_read *pr) - fd = img_raw_fd(pr->pi); - list_for_each_entry_safe(piov, n, &pr->async, l) { - ssize_t ret; -- off_t start = piov->from; - struct iovec *iovs = piov->to; - - pr_debug("Read piov iovs %d, from %ju, len %ju, first %p:%zu\n", piov->nr, piov->from, -@@ -554,13 +553,16 @@ static int process_async_reads(struct page_read *pr) - } - } - -- if (ret != piov->end - piov->from) { -- if (ret < 0) { -- pr_err("Can't read async pr bytes (%zd / %ju read, %ju off, %d iovs)\n", ret, -- piov->end - piov->from, piov->from, piov->nr); -- return -1; -- } -+ if (ret < 0) { -+ pr_err("Can't read async pr bytes (%zd / %ju read, %ju off, %d iovs)\n", ret, -+ piov->end - piov->from, piov->from, piov->nr); -+ return -1; -+ } - -+ if (opts.auto_dedup && punch_hole(pr, piov->from, ret, false)) -+ return -1; -+ -+ if (ret != piov->end - piov->from) { - /* - * The preadv() can return less than requested. It's - * valid and doesn't mean error or EOF. We should advance -@@ -574,9 +576,6 @@ static int process_async_reads(struct page_read *pr) - goto more; - } - -- if (opts.auto_dedup && punch_hole(pr, start, ret, false)) -- return -1; -- - BUG_ON(pr->io_complete); /* FIXME -- implement once needed */ - - list_del(&piov->l); --- -2.35.1 - diff --git a/0107-zdtm-fix-zdtm-static-maps00-case-in-arm64.patch b/0107-zdtm-fix-zdtm-static-maps00-case-in-arm64.patch deleted file mode 100644 index 88aee4a..0000000 --- a/0107-zdtm-fix-zdtm-static-maps00-case-in-arm64.patch +++ /dev/null @@ -1,43 +0,0 @@ -From db82b08f0ab85161dbca45569f62a1a63218e48c Mon Sep 17 00:00:00 2001 -From: "fu.lin" -Date: Sun, 16 Jan 2022 18:37:09 +0800 -Subject: [PATCH 107/249] zdtm: fix zdtm/static/maps00 case in arm64 - -This case sometimes will cause SIGILL signal in arm64 platform. - -<> notes: - The ARM architecture does not require the hardware to ensure coherency - between instruction caches and memory, even for locations of shared - memory. - -Therefore, we need flush dcache and icache for self-modifying code. - -- https://developer.arm.com/documentation/den0024/a/Caches/Point-of-coherency-and-unification - -Signed-off-by: fu.lin ---- - test/zdtm/static/maps00.c | 8 +++++++- - 1 file changed, 7 insertions(+), 1 deletion(-) - -diff --git a/test/zdtm/static/maps00.c b/test/zdtm/static/maps00.c -index 10a4cac79..b1e55e861 100644 ---- a/test/zdtm/static/maps00.c -+++ b/test/zdtm/static/maps00.c -@@ -158,7 +158,13 @@ static int check_map(struct map *map) - - if (!sigsetjmp(segv_ret, 1)) { - if (map->prot & PROT_WRITE) { -- memcpy(map->ptr, test_func, getpagesize()); -+ memcpy(map->ptr, test_func, ONE_MAP_SIZE); -+ /* The ARM ARM architecture does not require the -+ * hardware to ensure coherency between instruction -+ * caches and memory, flushing dcache and icache is -+ * necessory to prevent SIGILL signal. -+ */ -+ __builtin___clear_cache(map->ptr, map->ptr + ONE_MAP_SIZE); - } else { - if (!(map->flag & MAP_ANONYMOUS)) { - uint8_t funlen = (uint8_t *)check_map - (uint8_t *)test_func; --- -2.35.1 - diff --git a/0108-compel-fix-GCC-12-failure-out-of-bounds.patch b/0108-compel-fix-GCC-12-failure-out-of-bounds.patch deleted file mode 100644 index 21aa580..0000000 --- a/0108-compel-fix-GCC-12-failure-out-of-bounds.patch +++ /dev/null @@ -1,74 +0,0 @@ -From 415071fa73e78ad7dd5162a57da84599f6267f13 Mon Sep 17 00:00:00 2001 -From: Adrian Reber -Date: Tue, 18 Jan 2022 16:49:40 +0000 -Subject: [PATCH 108/249] compel: fix GCC 12 failure (out of bounds) -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This is a confusing change as it seems the original code was just wrong. -GCC 12 complains with: - -In function ‘__conv_val’, - inlined from ‘std_strtoul’ at compel/plugins/std/string.c:202:7: -compel/plugins/std/string.c:154:24: error: array subscript 97 is above array bounds of ‘const char[37]’ [-Werror=array-bounds] - 154 | return &conv_tab[__tolower(c)] - conv_tab; - | ^~~~~~~~~~~~~~~~~~~~~~~ -compel/plugins/std/string.c: In function ‘std_strtoul’: -compel/plugins/std/string.c:10:19: note: while referencing ‘conv_tab’ - 10 | static const char conv_tab[] = "0123456789abcdefghijklmnopqrstuvwxyz"; - | ^~~~~~~~ -cc1: all warnings being treated as errors - -Which sounds correct. The array conv_tab has just 37 elements. - -If I understand the code correctly we are trying to convert anything -that is character between a-z and A-Z to a number for cases where -the base is larger than 10. For a base 11 conversion b|B should return 11. -For a base 35 conversion z|Z should return 35. This is all for a strtoul() -implementation. - -The original code was: - - static const char conv_tab[] = "0123456789abcdefghijklmnopqrstuvwxyz"; - - return &conv_tab[__tolower(c)] - conv_tab; - -and that seems wrong. If conv_tab would have been some kind of hash it could -have worked, but '__tolower()' will always return something larger than -97 ('a') which will always overflow the array. - -But maybe I just don't get that part of the code. - -I replaced it with - - return __tolower(c) - 'a' + 10; - -which does the right thing: 'A' = 10, 'B' = 11 ... 'Z' = 35 - -Signed-off-by: Adrian Reber ---- - compel/plugins/std/string.c | 7 ++++++- - 1 file changed, 6 insertions(+), 1 deletion(-) - -diff --git a/compel/plugins/std/string.c b/compel/plugins/std/string.c -index bde1bc68b..d67e0d1a9 100644 ---- a/compel/plugins/std/string.c -+++ b/compel/plugins/std/string.c -@@ -151,7 +151,12 @@ static unsigned int __conv_val(unsigned char c) - if (__isdigit(c)) - return c - '0'; - else if (__isalpha(c)) -- return &conv_tab[__tolower(c)] - conv_tab; -+ /** -+ * If we want the value of something which __isalpha() == true -+ * it has to be base > 10. 'A' = 10, 'B' = 11 ... 'Z' = 35 -+ */ -+ return __tolower(c) - 'a' + 10; -+ - return -1u; - } - --- -2.35.1 - diff --git a/0109-criu-fix-configuration-file-scanner-with-GCC-12.patch b/0109-criu-fix-configuration-file-scanner-with-GCC-12.patch deleted file mode 100644 index 67b4bee..0000000 --- a/0109-criu-fix-configuration-file-scanner-with-GCC-12.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 1a33a445c9b2b705f850f7a7c90279c160a663e7 Mon Sep 17 00:00:00 2001 -From: Adrian Reber -Date: Tue, 18 Jan 2022 17:20:35 +0000 -Subject: [PATCH 109/249] criu: fix configuration file scanner with GCC 12 -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This fixes: - -criu/config.c: In function ‘parse_statement’: -criu/config.c:232:43: error: the comparison will always evaluate as ‘true’ for the pointer operand in ‘*(configuration + (sizetype)((long unsigned int)i * 8)) + ((sizetype)offset + 1)’ must not be NULL [-Werror=address] - 232 | if (configuration[i] + offset + 1 != 0 && strchr(configuration[i] + offset, ' ')) { - | ^~ - -Signed-off-by: Adrian Reber ---- - criu/config.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/criu/config.c b/criu/config.c -index 91fb0b64d..33f2820a1 100644 ---- a/criu/config.c -+++ b/criu/config.c -@@ -229,7 +229,7 @@ out: - tmp_string[0] = 0; - - /* Check for unsupported configuration file entries */ -- if (configuration[i] + offset + 1 != 0 && strchr(configuration[i] + offset, ' ')) { -+ if (strchr(configuration[i] + offset, ' ')) { - int j; - len = strlen(configuration[i] + offset); - for (j = 0; j < len - 1; j++) { --- -2.35.1 - diff --git a/0110-compel-fix-parasite-with-GCC-12.patch b/0110-compel-fix-parasite-with-GCC-12.patch deleted file mode 100644 index 316ec00..0000000 --- a/0110-compel-fix-parasite-with-GCC-12.patch +++ /dev/null @@ -1,43 +0,0 @@ -From f43400faacbe2faaca8e873646aa163bae334372 Mon Sep 17 00:00:00 2001 -From: Adrian Reber -Date: Tue, 18 Jan 2022 17:22:46 +0000 -Subject: [PATCH 110/249] compel: fix parasite with GCC 12 - -Parasite creation started to fail with GCC 12: - -On x86_64 with: - ./compel/compel-host hgen -f criu/pie/restorer.built-in.o -o criu/pie/restorer-blob.h - Error (compel/src/lib/handle-elf-host.c:337): Unexpected undefined symbol: `strlen'. External symbol in PIE? - -On aarch64 with: - ld: criu/pie/restorer.o: in function `lsm_set_label': - /drone/src/criu/pie/restorer.c:174: undefined reference to `strlen' - -Line 174 is: "for (len = 0; label[len]; len++)" - -Adding '-ffreestanding' to parasite compilation fixes these errors -because, according to GCC developers: - -"strlen is a standard C function, so I don't see any bug in that being used -unless you do a freestanding compilation (-nostdlib isn't that)." - -Signed-off-by: Adrian Reber ---- - compel/src/main.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/compel/src/main.c b/compel/src/main.c -index a9a50959f..f461ff04d 100644 ---- a/compel/src/main.c -+++ b/compel/src/main.c -@@ -19,6 +19,7 @@ - - #define CFLAGS_DEFAULT_SET \ - "-Wstrict-prototypes " \ -+ "-ffreestanding " \ - "-fno-stack-protector -nostdlib -fomit-frame-pointer " - - #define COMPEL_CFLAGS_PIE CFLAGS_DEFAULT_SET "-fpie" --- -2.35.1 - diff --git a/0111-ci-set-continue-on-error-for-cross-compile.patch b/0111-ci-set-continue-on-error-for-cross-compile.patch deleted file mode 100644 index feb577b..0000000 --- a/0111-ci-set-continue-on-error-for-cross-compile.patch +++ /dev/null @@ -1,51 +0,0 @@ -From c9836c658bb8ac32dec823b629396475e76e5582 Mon Sep 17 00:00:00 2001 -From: Radostin Stoyanov -Date: Thu, 27 Jan 2022 22:13:33 +0000 -Subject: [PATCH 111/249] ci: set continue-on-error for cross-compile - -Running cross compile tests with Debian unstable sometimes -fails due to missing or outdated packages. - -Signed-off-by: Radostin Stoyanov ---- - .github/workflows/cross-compile.yml | 16 ++++++++++++---- - 1 file changed, 12 insertions(+), 4 deletions(-) - -diff --git a/.github/workflows/cross-compile.yml b/.github/workflows/cross-compile.yml -index 461a6e618..be8e7f09c 100644 ---- a/.github/workflows/cross-compile.yml -+++ b/.github/workflows/cross-compile.yml -@@ -6,18 +6,26 @@ jobs: - build: - - runs-on: ubuntu-latest -+ continue-on-error: ${{ matrix.experimental }} - strategy: -+ fail-fast: false - matrix: -+ experimental: [false] - target: [ - armv7-stable-cross, -- armv7-unstable-cross, - aarch64-stable-cross, -- aarch64-unstable-cross, - ppc64-stable-cross, -- ppc64-unstable-cross, - mips64el-stable-cross, -- mips64el-unstable-cross - ] -+ include: -+ - experimental: true -+ target: armv7-unstable-cross -+ - experimental: true -+ target: aarch64-unstable-cross -+ - experimental: true -+ target: ppc64-unstable-cross -+ - experimental: true -+ target: mips64el-unstable-cross - - steps: - - uses: actions/checkout@v2 --- -2.35.1 - diff --git a/0112-test-autofs-fix-use-after-free.patch b/0112-test-autofs-fix-use-after-free.patch deleted file mode 100644 index 798728a..0000000 --- a/0112-test-autofs-fix-use-after-free.patch +++ /dev/null @@ -1,67 +0,0 @@ -From a1a736f3e01f078565586535e5ef66777a4f2ffb Mon Sep 17 00:00:00 2001 -From: Radostin Stoyanov -Date: Thu, 27 Jan 2022 14:49:41 +0000 -Subject: [PATCH 112/249] test/autofs: fix use-after-free - -autofs.c:66:17: error: pointer 'str' may be used after 'realloc' [-Werror=use-after-free] - -autofs.c: In function 'check_automount': -../lib/zdtmtst.h:131:9: error: pointer 'mountpoint' may be used after 'free' [-Werror=use-after-free] - 131 | test_msg("ERR: %s:%d: " format " (errno = %d (%s))\n", __FILE__, __LINE__, ##arg, errno, strerror(errno)) - | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -autofs.c:277:17: note: in expansion of macro 'pr_perror' - 277 | pr_perror("%s: failed to close fd %d", mountpoint, p->fd); - | ^~~~~~~~~ -autofs.c:268:9: note: call to 'free' here - 268 | free(mountpoint); - | ^~~~~~~~~~~~~~~~ - -Fixes: #1731 - -v2: (@Snorch) always update `str` after successful realloc() - -Signed-off-by: Radostin Stoyanov ---- - test/zdtm/static/autofs.c | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -diff --git a/test/zdtm/static/autofs.c b/test/zdtm/static/autofs.c -index 2d6078627..ad1795842 100644 ---- a/test/zdtm/static/autofs.c -+++ b/test/zdtm/static/autofs.c -@@ -47,6 +47,7 @@ static char *xvstrcat(char *str, const char *fmt, va_list args) - ret = -ENOMEM; - new = realloc(str, offset + delta); - if (new) { -+ str = new; - va_copy(tmp, args); - ret = vsnprintf(new + offset, delta, fmt, tmp); - va_end(tmp); -@@ -54,7 +55,6 @@ static char *xvstrcat(char *str, const char *fmt, va_list args) - /* NOTE: vsnprintf returns the amount of bytes - * * to allocate. */ - delta = ret + 1; -- str = new; - ret = 0; - } - } -@@ -266,6 +266,7 @@ static int check_automount(struct autofs_params *p) - return err; - - free(mountpoint); -+ mountpoint = NULL; - - err = p->setup(p); - if (err) { -@@ -274,7 +275,7 @@ static int check_automount(struct autofs_params *p) - } - - if (close(p->fd)) { -- pr_perror("%s: failed to close fd %d", mountpoint, p->fd); -+ pr_perror("mountpoint failed to close fd %d", p->fd); - return -errno; - } - --- -2.35.1 - diff --git a/0113-Fix-formatting-in-criu-documentation.patch b/0113-Fix-formatting-in-criu-documentation.patch deleted file mode 100644 index f40c762..0000000 --- a/0113-Fix-formatting-in-criu-documentation.patch +++ /dev/null @@ -1,44 +0,0 @@ -From ff22fbede563a983d28422d149d0cbb5a2db0fe6 Mon Sep 17 00:00:00 2001 -From: Ashutosh Mehra -Date: Wed, 26 Jan 2022 14:14:38 -0500 -Subject: [PATCH 113/249] Fix formatting in criu documentation - -Signed-off-by: Ashutosh Mehra ---- - Documentation/criu.txt | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/Documentation/criu.txt b/Documentation/criu.txt -index f41b1898c..57b791138 100644 ---- a/Documentation/criu.txt -+++ b/Documentation/criu.txt -@@ -419,7 +419,7 @@ By default the option is set to *fpu* and *ins*. - Set the method to be used to validate open files. Validation is done - to ensure that the version of the file being restored is the same - version when it was dumped. -- -++ - The 'mode' may be one of the following: - - *filesize*::: -@@ -532,7 +532,7 @@ usually need to be escaped from shell. - Restore cgroups configuration associated with a task from the image. - Controllers are always restored in an optimistic way -- if already present - in system, *criu* reuses it, otherwise it will be created. -- -++ - The 'mode' may be one of the following: - - *none*::: Do not restore cgroup properties but require cgroup to -@@ -656,7 +656,7 @@ are not adequate, but this can be suppressed by using *--cpu-cap=none*. - Set the method to be used to validate open files. Validation is done - to ensure that the version of the file being restored is the same - version when it was dumped. -- -++ - The 'mode' may be one of the following: - - *filesize*::: --- -2.35.1 - diff --git a/0114-ci-install-libbsd-dependency.patch b/0114-ci-install-libbsd-dependency.patch deleted file mode 100644 index da15286..0000000 --- a/0114-ci-install-libbsd-dependency.patch +++ /dev/null @@ -1,78 +0,0 @@ -From c1eca4505f709e32c0ead1ca42246fb1a844dc72 Mon Sep 17 00:00:00 2001 -From: Radostin Stoyanov -Date: Tue, 1 Feb 2022 15:59:14 +0000 -Subject: [PATCH 114/249] ci: install libbsd dependency - -The libbsd dependency is used to enable support for `setproctitle()` -and `strlcpy()`. - -Signed-off-by: Radostin Stoyanov ---- - .cirrus.yml | 4 ++-- - .lgtm.yml | 1 + - scripts/ci/prepare-for-fedora-rawhide.sh | 1 + - scripts/ci/vagrant.sh | 2 +- - 4 files changed, 5 insertions(+), 3 deletions(-) - -diff --git a/.cirrus.yml b/.cirrus.yml -index ef0de54e9..588cf3e82 100644 ---- a/.cirrus.yml -+++ b/.cirrus.yml -@@ -36,7 +36,7 @@ task: - ln -sf /usr/include/google/protobuf/descriptor.proto images/google/protobuf/descriptor.proto - yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm dnf-plugins-core - yum config-manager --set-enabled powertools -- yum install -y --allowerasing asciidoc gcc git gnutls-devel libaio-devel libasan libcap-devel libnet-devel libnl3-devel libselinux-devel make protobuf-c-devel protobuf-devel python3-devel python3-flake8 python3-PyYAML python3-future python3-protobuf xmlto -+ yum install -y --allowerasing asciidoc gcc git gnutls-devel libaio-devel libasan libcap-devel libnet-devel libnl3-devel libbsd-devel libselinux-devel make protobuf-c-devel protobuf-devel python3-devel python3-flake8 python3-PyYAML python3-future python3-protobuf xmlto - alternatives --set python /usr/bin/python3 - systemctl stop sssd - # Even with selinux in permissive mode the selinux tests will be executed -@@ -64,7 +64,7 @@ task: - - setup_script: | - ln -sf /usr/include/google/protobuf/descriptor.proto images/google/protobuf/descriptor.proto -- yum install -y findutils gcc git gnutls-devel iproute iptables libaio-devel libasan libcap-devel libnet-devel libnl3-devel make procps-ng protobuf-c-devel protobuf-devel protobuf-python python python-flake8 python-ipaddress python2-future python2-junit_xml python-yaml python-six sudo tar which e2fsprogs python2-pip rubygem-asciidoctor libselinux-devel -+ yum install -y findutils gcc git gnutls-devel iproute iptables libaio-devel libasan libcap-devel libnet-devel libnl3-devel libbsd-devel make procps-ng protobuf-c-devel protobuf-devel protobuf-python python python-flake8 python-ipaddress python2-future python2-junit_xml python-yaml python-six sudo tar which e2fsprogs python2-pip rubygem-asciidoctor libselinux-devel - # Even with selinux in permissive mode the selinux tests will be executed - # The Cirrus CI user runs as a service from selinux point of view and is - # much more restricted than a normal shell (system_u:system_r:unconfined_service_t:s0) -diff --git a/.lgtm.yml b/.lgtm.yml -index a28c35de0..a884a53ef 100644 ---- a/.lgtm.yml -+++ b/.lgtm.yml -@@ -19,6 +19,7 @@ extraction: - - "iproute2" - - "libcap-dev" - - "libaio-dev" -+ - "libbsd-dev" - - "python3-yaml" - - "libnl-route-3-dev" - - "python-future" -diff --git a/scripts/ci/prepare-for-fedora-rawhide.sh b/scripts/ci/prepare-for-fedora-rawhide.sh -index e5900e563..f4d3155f9 100755 ---- a/scripts/ci/prepare-for-fedora-rawhide.sh -+++ b/scripts/ci/prepare-for-fedora-rawhide.sh -@@ -17,6 +17,7 @@ dnf install -y \ - libcap-devel \ - libnet-devel \ - libnl3-devel \ -+ libbsd-devel \ - make \ - procps-ng \ - protobuf-c-devel \ -diff --git a/scripts/ci/vagrant.sh b/scripts/ci/vagrant.sh -index 4a4a16445..0440193bc 100755 ---- a/scripts/ci/vagrant.sh -+++ b/scripts/ci/vagrant.sh -@@ -37,7 +37,7 @@ setup() { - vagrant ssh-config >> /root/.ssh/config - ssh default sudo dnf upgrade -y - ssh default sudo dnf install -y gcc git gnutls-devel nftables-devel libaio-devel \ -- libasan libcap-devel libnet-devel libnl3-devel make protobuf-c-devel \ -+ libasan libcap-devel libnet-devel libnl3-devel libbsd-devel make protobuf-c-devel \ - protobuf-devel python3-flake8 python3-future python3-protobuf \ - python3-junit_xml rubygem-asciidoctor iptables libselinux-devel libbpf-devel - # Disable sssd to avoid zdtm test failures in pty04 due to sssd socket --- -2.35.1 - diff --git a/0115-pstree-when-updating-sid-for-shell-job-also-update-m.patch b/0115-pstree-when-updating-sid-for-shell-job-also-update-m.patch deleted file mode 100644 index 0edcffc..0000000 --- a/0115-pstree-when-updating-sid-for-shell-job-also-update-m.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 0aace1a0b90f67356876c6d3fcdf023d6cefcaf3 Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Thu, 27 Jan 2022 10:28:29 +0300 -Subject: [PATCH 115/249] pstree: when updating sid for shell job also update - matching pgid - -If we replace old_sid with current_sid we should also do same -replacement for matching pgid (=old_sid). - -Reported in CRIU gitter by Younes Manton (@ymanton) - -Signed-off-by: Pavel Tikhomirov ---- - criu/pstree.c | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/criu/pstree.c b/criu/pstree.c -index d5080e515..d29de730a 100644 ---- a/criu/pstree.c -+++ b/criu/pstree.c -@@ -382,6 +382,9 @@ static int prepare_pstree_for_shell_job(pid_t pid) - for_each_pstree_item(pi) { - if (pi->sid == old_sid) - pi->sid = current_sid; -+ -+ if (pi->pgid == old_sid) -+ pi->pgid = current_sid; - } - - if (lookup_create_item(current_sid) == NULL) --- -2.35.1 - diff --git a/0116-criu-ns-fix-exit-code-o-for-criu-dump.patch b/0116-criu-ns-fix-exit-code-o-for-criu-dump.patch deleted file mode 100644 index 2884595..0000000 --- a/0116-criu-ns-fix-exit-code-o-for-criu-dump.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 2944fe4e6e8ec6472cf13caf680c44a763639c62 Mon Sep 17 00:00:00 2001 -From: Radostin Stoyanov -Date: Tue, 1 Feb 2022 13:44:42 +0000 -Subject: [PATCH 116/249] criu-ns: fix exit code o for criu dump - -Fixes: #1739 - -Reported-by: @PavloMykhailyshyn -Signed-off-by: Radostin Stoyanov ---- - scripts/criu-ns | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/scripts/criu-ns b/scripts/criu-ns -index 72c0753e5..6aa618218 100755 ---- a/scripts/criu-ns -+++ b/scripts/criu-ns -@@ -203,7 +203,7 @@ def wrap_dump(): - criu_pid = os.fork() - if criu_pid == 0: - run_criu(sys.argv[1:]) -- return _wait_for_process_status(pid) -+ return _wait_for_process_status(criu_pid) - - - def show_usage(): --- -2.35.1 - diff --git a/0117-criu-ns-use-os.waitstatus_to_exitcode.patch b/0117-criu-ns-use-os.waitstatus_to_exitcode.patch deleted file mode 100644 index 3ebf491..0000000 --- a/0117-criu-ns-use-os.waitstatus_to_exitcode.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 0a6ba0915b606dbb70e6d16fcf8be56edb63dedf Mon Sep 17 00:00:00 2001 -From: Radostin Stoyanov -Date: Fri, 4 Feb 2022 20:41:07 +0000 -Subject: [PATCH 117/249] criu-ns: use os.waitstatus_to_exitcode() - -os.WEXITSTATUS() returns the process exit status and it should be used -only if WIFEXITED() is true, i.e., the process terminated normally. - -os.waitstatus_to_exitcode() does the same as os.WEXITSTATUS() but it -also handles the case when the process has been terminated by a signal. - -Suggested-by: Andrei Vagin -Signed-off-by: Radostin Stoyanov ---- - scripts/criu-ns | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/scripts/criu-ns b/scripts/criu-ns -index 6aa618218..930d20c80 100755 ---- a/scripts/criu-ns -+++ b/scripts/criu-ns -@@ -68,7 +68,7 @@ def _wait_for_process_status(criu_pid): - try: - (pid, status) = os.wait() - if pid == criu_pid: -- return os.WEXITSTATUS(status) -+ return os.waitstatus_to_exitcode(status) - except OSError: - return -251 - --- -2.35.1 - diff --git a/0118-restorer-Fix-sys_mmap-s-returned-value-check.patch b/0118-restorer-Fix-sys_mmap-s-returned-value-check.patch deleted file mode 100644 index a6da412..0000000 --- a/0118-restorer-Fix-sys_mmap-s-returned-value-check.patch +++ /dev/null @@ -1,30 +0,0 @@ -From fee94641cfb63d7387e3d396e055192b68f97223 Mon Sep 17 00:00:00 2001 -From: Bui Quang Minh -Date: Sat, 5 Feb 2022 14:23:38 +0700 -Subject: [PATCH 118/249] restorer: Fix sys_mmap's returned value check - -As we call mmap syscall directly, the returned value in error case is the error -number not -1 like in libc wrapper. Use IS_ERR for correct checking in error -case. - -Signed-off-by: Bui Quang Minh ---- - criu/pie/restorer.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/criu/pie/restorer.c b/criu/pie/restorer.c -index 0051452e4..7aa788181 100644 ---- a/criu/pie/restorer.c -+++ b/criu/pie/restorer.c -@@ -952,7 +952,7 @@ static int vma_remap(VmaEntry *vma_entry, int uffd) - - /* Move src to non-overlapping place (step 3) */ - addr = sys_mmap(NULL, len, PROT_NONE, MAP_PRIVATE | MAP_ANONYMOUS, 0, 0); -- if (addr == (unsigned long)MAP_FAILED) { -+ if (IS_ERR((void *)addr)) { - pr_err("Unable to reserve memory (%lx)\n", addr); - return -1; - } --- -2.35.1 - diff --git a/0119-compel-fix-how-PTRACE_GET_THREAD_AREA-errors-are-han.patch b/0119-compel-fix-how-PTRACE_GET_THREAD_AREA-errors-are-han.patch deleted file mode 100644 index 539567b..0000000 --- a/0119-compel-fix-how-PTRACE_GET_THREAD_AREA-errors-are-han.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 5b03917d55de4d6ae0dbd95ef669eea68d89d76d Mon Sep 17 00:00:00 2001 -From: Mike Rapoport -Date: Sun, 13 Feb 2022 08:48:07 +0200 -Subject: [PATCH 119/249] compel: fix how PTRACE_GET_THREAD_AREA errors are - handled - -When PTRACE_GET_THREAD_AREA errors on kernels with -!CONFIG_IA32_EMULATION beacuse of missing support (-EIO), compel should -ignore uch errors in native mode. - -However the check for error type uses return value of ptrace rather than -errno, which will always result in error propagation. - -Use errno to detect type of error to fix this. - -Signed-off-by: Mike Rapoport ---- - compel/arch/x86/src/lib/thread_area.c | 17 +++++++++-------- - 1 file changed, 9 insertions(+), 8 deletions(-) - -diff --git a/compel/arch/x86/src/lib/thread_area.c b/compel/arch/x86/src/lib/thread_area.c -index 4750c6cdd..271d89dcd 100644 ---- a/compel/arch/x86/src/lib/thread_area.c -+++ b/compel/arch/x86/src/lib/thread_area.c -@@ -53,15 +53,16 @@ int __compel_arch_fetch_thread_area(int tid, struct thread_ctx *th) - user_desc_t *d = &ptls->desc[i]; - - err = ptrace(PTRACE_GET_THREAD_AREA, tid, GDT_ENTRY_TLS_MIN + i, d); -- /* -- * Ignoring absent syscall on !CONFIG_IA32_EMULATION -- * where such mixed code can't run. -- * XXX: Add compile CONFIG_X86_IGNORE_64BIT_TLS -- * (for x86_64 systems with CONFIG_IA32_EMULATION) -- */ -- if (err == -EIO && native_mode) -- return 0; - if (err) { -+ /* -+ * Ignoring absent syscall on !CONFIG_IA32_EMULATION -+ * where such mixed code can't run. -+ * XXX: Add compile CONFIG_X86_IGNORE_64BIT_TLS -+ * (for x86_64 systems with CONFIG_IA32_EMULATION) -+ */ -+ if (errno == EIO && native_mode) -+ return 0; -+ - pr_perror("get_thread_area failed for %d", tid); - return err; - } --- -2.35.1 - diff --git a/0120-util-add-an-unique-ID-of-the-current-criu-run.patch b/0120-util-add-an-unique-ID-of-the-current-criu-run.patch deleted file mode 100644 index a7d24ae..0000000 --- a/0120-util-add-an-unique-ID-of-the-current-criu-run.patch +++ /dev/null @@ -1,72 +0,0 @@ -From 967129b32f8169a899b57312594b4dd876af4cfd Mon Sep 17 00:00:00 2001 -From: Andrei Vagin -Date: Sat, 12 Feb 2022 17:17:27 -0800 -Subject: [PATCH 120/249] util: add an unique ID of the current criu run - -This ID will be used to generate resource ID-s that can conflicts with -other CRIU processes. - -Signed-off-by: Andrei Vagin ---- - criu/crtools.c | 2 ++ - criu/include/util.h | 6 ++++++ - criu/util.c | 11 +++++++++++ - 3 files changed, 19 insertions(+) - -diff --git a/criu/crtools.c b/criu/crtools.c -index 0752800f6..3c3491603 100644 ---- a/criu/crtools.c -+++ b/criu/crtools.c -@@ -254,6 +254,8 @@ int main(int argc, char *argv[], char *envp[]) - return 1; - } - -+ util_init(); -+ - if (log_init(opts.output)) - return 1; - -diff --git a/criu/include/util.h b/criu/include/util.h -index 19d378fc5..ca934dea0 100644 ---- a/criu/include/util.h -+++ b/criu/include/util.h -@@ -393,4 +393,10 @@ static inline void cleanup_freep(void *p) - - extern int run_command(char *buf, size_t buf_size, int (*child_fn)(void *), void *args); - -+/* -+ * criu_run_id is a unique value of the current run. It can be used to -+ * generate resource ID-s to avoid conflicts with other CRIU processes. -+ */ -+extern uint64_t criu_run_id; -+extern void util_init(void); - #endif /* __CR_UTIL_H__ */ -diff --git a/criu/util.c b/criu/util.c -index 822822186..d83be0c0d 100644 ---- a/criu/util.c -+++ b/criu/util.c -@@ -27,6 +27,7 @@ - #include - #include - #include -+#include - - #include "linux/mount.h" - -@@ -1804,3 +1805,13 @@ int run_command(char *buf, size_t buf_size, int (*child_fn)(void *), void *args) - - return fret; - } -+ -+uint64_t criu_run_id; -+ -+void util_init() -+{ -+ struct timespec tp; -+ -+ clock_gettime(CLOCK_MONOTONIC, &tp); -+ criu_run_id = ((uint64_t)getpid() << 32) + tp.tv_sec + tp.tv_nsec; -+} --- -2.35.1 - diff --git a/0121-files-generate-unique-transport-socket-names.patch b/0121-files-generate-unique-transport-socket-names.patch deleted file mode 100644 index 8da243d..0000000 --- a/0121-files-generate-unique-transport-socket-names.patch +++ /dev/null @@ -1,30 +0,0 @@ -From f036fdad44b63668cae8f90b2e427768d8f0ac91 Mon Sep 17 00:00:00 2001 -From: Andrei Vagin -Date: Sat, 12 Feb 2022 17:24:07 -0800 -Subject: [PATCH 121/249] files: generate unique transport socket names - -Transport socket names have to be unique for each criu run. - -Fixes #1735 #1720 - -Signed-off-by: Andrei Vagin ---- - criu/files.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/criu/files.c b/criu/files.c -index 69ebc2e82..429493ccb 100644 ---- a/criu/files.c -+++ b/criu/files.c -@@ -957,7 +957,7 @@ static int receive_fd(struct fdinfo_list_entry *fle); - static void transport_name_gen(struct sockaddr_un *addr, int *len, int pid) - { - addr->sun_family = AF_UNIX; -- snprintf(addr->sun_path, UNIX_PATH_MAX, "x/crtools-fd-%d", pid); -+ snprintf(addr->sun_path, UNIX_PATH_MAX, "x/crtools-fd-%d-%" PRIx64, pid, criu_run_id); - *len = SUN_LEN(addr); - *addr->sun_path = '\0'; - } --- -2.35.1 - diff --git a/0122-check-Add-a-check-for-using-memfd-with-hugetlb.patch b/0122-check-Add-a-check-for-using-memfd-with-hugetlb.patch deleted file mode 100644 index 0d9685d..0000000 --- a/0122-check-Add-a-check-for-using-memfd-with-hugetlb.patch +++ /dev/null @@ -1,107 +0,0 @@ -From af22ba3014dfcfd7f8955496886ebc243375d864 Mon Sep 17 00:00:00 2001 -From: Bui Quang Minh -Date: Wed, 15 Dec 2021 22:15:21 +0700 -Subject: [PATCH 122/249] check: Add a check for using memfd with hugetlb - -Signed-off-by: Bui Quang Minh ---- - criu/cr-check.c | 10 ++++++++++ - criu/include/kerndat.h | 1 + - criu/kerndat.c | 27 +++++++++++++++++++++++++++ - 3 files changed, 38 insertions(+) - -diff --git a/criu/cr-check.c b/criu/cr-check.c -index 0320b445a..ced084df2 100644 ---- a/criu/cr-check.c -+++ b/criu/cr-check.c -@@ -1368,6 +1368,14 @@ static int check_ns_pid(void) - return 0; - } - -+static int check_memfd_hugetlb(void) -+{ -+ if (!kdat.has_memfd_hugetlb) -+ return -1; -+ -+ return 0; -+} -+ - static int check_network_lock_nftables(void) - { - if (!kdat.has_nftables_concat) { -@@ -1505,6 +1513,7 @@ int cr_check(void) - ret |= check_apparmor_stacking(); - ret |= check_network_lock_nftables(); - ret |= check_sockopt_buf_lock(); -+ ret |= check_memfd_hugetlb(); - } - - /* -@@ -1618,6 +1627,7 @@ static struct feature_list feature_list[] = { - { "apparmor_stacking", check_apparmor_stacking }, - { "network_lock_nftables", check_network_lock_nftables }, - { "sockopt_buf_lock", check_sockopt_buf_lock }, -+ { "memfd_hugetlb", check_memfd_hugetlb }, - { NULL, NULL }, - }; - -diff --git a/criu/include/kerndat.h b/criu/include/kerndat.h -index a28a95802..0de5eb778 100644 ---- a/criu/include/kerndat.h -+++ b/criu/include/kerndat.h -@@ -36,6 +36,7 @@ struct kerndat_s { - u64 zero_page_pfn; - bool has_dirty_track; - bool has_memfd; -+ bool has_memfd_hugetlb; - bool has_fdinfo_lock; - unsigned long task_size; - bool ipv6; -diff --git a/criu/kerndat.c b/criu/kerndat.c -index 9f6a6ec42..b13ebee81 100644 ---- a/criu/kerndat.c -+++ b/criu/kerndat.c -@@ -420,6 +420,29 @@ static bool kerndat_has_memfd_create(void) - return 0; - } - -+static bool kerndat_has_memfd_hugetlb(void) -+{ -+ int ret; -+ -+ if (!kdat.has_memfd) { -+ kdat.has_memfd_hugetlb = false; -+ return 0; -+ } -+ -+ ret = memfd_create("", MFD_HUGETLB); -+ if (ret >= 0) { -+ kdat.has_memfd_hugetlb = true; -+ close(ret); -+ } else if (ret == -1 && errno == EINVAL) { -+ kdat.has_memfd_hugetlb = false; -+ } else { -+ pr_perror("Unexpected error from memfd_create(\"\", MFD_HUGETLB)"); -+ return -1; -+ } -+ -+ return 0; -+} -+ - static int get_task_size(void) - { - kdat.task_size = compel_task_size(); -@@ -1320,6 +1343,10 @@ int kerndat_init(void) - pr_err("kerndat_has_memfd_create failed when initializing kerndat.\n"); - ret = -1; - } -+ if (!ret && kerndat_has_memfd_hugetlb()) { -+ pr_err("kerndat_has_memfd_hugetlb failed when initializing kerndat.\n"); -+ ret = -1; -+ } - if (!ret && kerndat_detect_stack_guard_gap()) { - pr_err("kerndat_detect_stack_guard_gap failed when initializing kerndat.\n"); - ret = -1; --- -2.35.1 - diff --git a/0123-kerndat-Collect-hugetlb-device-numbers.patch b/0123-kerndat-Collect-hugetlb-device-numbers.patch deleted file mode 100644 index 333933a..0000000 --- a/0123-kerndat-Collect-hugetlb-device-numbers.patch +++ /dev/null @@ -1,414 +0,0 @@ -From c2dbc30f7e141389494a6b3c2e4000add5019bf2 Mon Sep 17 00:00:00 2001 -From: Bui Quang Minh -Date: Wed, 15 Dec 2021 22:26:08 +0700 -Subject: [PATCH 123/249] kerndat: Collect hugetlb device numbers - -These numbers are used to determine whether a memory mapping is backed by -hugetlb and its page size. - -As the hugepage can be allocated more after the first time we collect kerndat, -we need to collect the missing device numbers every time we load the kerndat -cache. - -Signed-off-by: Bui Quang Minh ---- - criu/Makefile.crtools | 1 + - criu/hugetlb.c | 47 +++++++++++++++ - criu/include/hugetlb.h | 55 +++++++++++++++++ - criu/include/kerndat.h | 2 + - criu/include/sizes.h | 50 ++++++++++++++++ - criu/kerndat.c | 130 ++++++++++++++++++++++++++++++++++++----- - 6 files changed, 269 insertions(+), 16 deletions(-) - create mode 100644 criu/hugetlb.c - create mode 100644 criu/include/hugetlb.h - create mode 100644 criu/include/sizes.h - -diff --git a/criu/Makefile.crtools b/criu/Makefile.crtools -index 50a2fa9c5..46d7fd424 100644 ---- a/criu/Makefile.crtools -+++ b/criu/Makefile.crtools -@@ -96,6 +96,7 @@ CFLAGS_pie-util-vdso-elf32.o += -DCONFIG_VDSO_32 - obj-$(CONFIG_COMPAT) += vdso-compat.o - CFLAGS_REMOVE_vdso-compat.o += $(CFLAGS-ASAN) $(CFLAGS-GCOV) - obj-y += pidfd-store.o -+obj-y += hugetlb.o - - PROTOBUF_GEN := scripts/protobuf-gen.sh - -diff --git a/criu/hugetlb.c b/criu/hugetlb.c -new file mode 100644 -index 000000000..aa98662d8 ---- /dev/null -+++ b/criu/hugetlb.c -@@ -0,0 +1,47 @@ -+#include "hugetlb.h" -+#include "kerndat.h" -+#include "sizes.h" -+ -+// clang-format off -+struct htlb_info hugetlb_info[HUGETLB_MAX] = { -+ [HUGETLB_16KB] = { SZ_16K, MAP_HUGETLB_16KB }, -+ [HUGETLB_64KB] = { SZ_64K, MAP_HUGETLB_64KB }, -+ [HUGETLB_512KB] = { SZ_512K, MAP_HUGETLB_512KB }, -+ [HUGETLB_1MB] = { SZ_1M, MAP_HUGETLB_1MB }, -+ [HUGETLB_2MB] = { SZ_2M, MAP_HUGETLB_2MB }, -+ [HUGETLB_8MB] = { SZ_8M, MAP_HUGETLB_8MB }, -+ [HUGETLB_16MB] = { SZ_16M, MAP_HUGETLB_16MB }, -+ [HUGETLB_32MB] = { SZ_32M, MAP_HUGETLB_32MB }, -+ [HUGETLB_256MB] = { SZ_256M, MAP_HUGETLB_256MB }, -+ [HUGETLB_512MB] = { SZ_512M, MAP_HUGETLB_512MB }, -+ [HUGETLB_1GB] = { SZ_1G, MAP_HUGETLB_1GB }, -+ [HUGETLB_2GB] = { SZ_2G, MAP_HUGETLB_2GB }, -+ [HUGETLB_16GB] = { SZ_16G, MAP_HUGETLB_16GB }, -+}; -+// clang-format on -+ -+int is_hugetlb_dev(dev_t dev, int *hugetlb_size_flag) -+{ -+ int i; -+ -+ for (i = 0; i < HUGETLB_MAX; i++) { -+ if (kdat.hugetlb_dev[i] == dev) { -+ if (hugetlb_size_flag) -+ *hugetlb_size_flag = hugetlb_info[i].flag; -+ return 1; -+ } -+ } -+ -+ return 0; -+} -+ -+unsigned long get_size_from_hugetlb_flag(int flag) -+{ -+ int i; -+ -+ for (i = 0; i < HUGETLB_MAX; i++) -+ if (flag == hugetlb_info[i].flag) -+ return hugetlb_info[i].size; -+ -+ return -1; -+} -diff --git a/criu/include/hugetlb.h b/criu/include/hugetlb.h -new file mode 100644 -index 000000000..c0e83652b ---- /dev/null -+++ b/criu/include/hugetlb.h -@@ -0,0 +1,55 @@ -+#ifndef __CR_HUGETLB_H_ -+#define __CR_HUGETLB_H_ -+ -+#include -+#include -+ -+enum hugepage_size { -+ HUGETLB_16KB, -+ HUGETLB_64KB, -+ HUGETLB_512KB, -+ HUGETLB_1MB, -+ HUGETLB_2MB, -+ HUGETLB_8MB, -+ HUGETLB_16MB, -+ HUGETLB_32MB, -+ HUGETLB_256MB, -+ HUGETLB_512MB, -+ HUGETLB_1GB, -+ HUGETLB_2GB, -+ HUGETLB_16GB, -+ HUGETLB_MAX -+}; -+ -+#define MAP_HUGETLB_SHIFT 26 -+#define MAP_HUGETLB_SIZE_MASK (0x3f << MAP_HUGETLB_SHIFT) -+ -+#define MAP_HUGETLB_16KB (14 << MAP_HUGETLB_SHIFT) -+#define MAP_HUGETLB_64KB (16 << MAP_HUGETLB_SHIFT) -+#define MAP_HUGETLB_512KB (19 << MAP_HUGETLB_SHIFT) -+#define MAP_HUGETLB_1MB (20 << MAP_HUGETLB_SHIFT) -+#define MAP_HUGETLB_2MB (21 << MAP_HUGETLB_SHIFT) -+#define MAP_HUGETLB_8MB (23 << MAP_HUGETLB_SHIFT) -+#define MAP_HUGETLB_16MB (24 << MAP_HUGETLB_SHIFT) -+#define MAP_HUGETLB_32MB (25 << MAP_HUGETLB_SHIFT) -+#define MAP_HUGETLB_256MB (28 << MAP_HUGETLB_SHIFT) -+#define MAP_HUGETLB_512MB (29 << MAP_HUGETLB_SHIFT) -+#define MAP_HUGETLB_1GB (30 << MAP_HUGETLB_SHIFT) -+#define MAP_HUGETLB_2GB (31 << MAP_HUGETLB_SHIFT) -+#define MAP_HUGETLB_16GB (34 << MAP_HUGETLB_SHIFT) -+ -+struct htlb_info { -+ unsigned long long size; -+ int flag; -+}; -+ -+extern struct htlb_info hugetlb_info[HUGETLB_MAX]; -+ -+int is_hugetlb_dev(dev_t dev, int *hugetlb_size_flag); -+unsigned long get_size_from_hugetlb_flag(int flag); -+ -+#ifndef MFD_HUGETLB -+#define MFD_HUGETLB 4 -+#endif -+ -+#endif -diff --git a/criu/include/kerndat.h b/criu/include/kerndat.h -index 0de5eb778..25825ee51 100644 ---- a/criu/include/kerndat.h -+++ b/criu/include/kerndat.h -@@ -6,6 +6,7 @@ - #include "common/config.h" - #include "asm/kerndat.h" - #include "util-vdso.h" -+#include "hugetlb.h" - - struct stat; - -@@ -76,6 +77,7 @@ struct kerndat_s { - bool has_nspid; - bool has_nftables_concat; - bool has_sockopt_buf_lock; -+ dev_t hugetlb_dev[HUGETLB_MAX]; - }; - - extern struct kerndat_s kdat; -diff --git a/criu/include/sizes.h b/criu/include/sizes.h -new file mode 100644 -index 000000000..0ec977fc0 ---- /dev/null -+++ b/criu/include/sizes.h -@@ -0,0 +1,50 @@ -+#ifndef __CR_SIZES_H__ -+#define __CR_SIZES_H__ -+ -+/* -+ * Copied from the Linux kernel header include/linux/sizes.h -+ */ -+ -+#define SZ_1 0x00000001 -+#define SZ_2 0x00000002 -+#define SZ_4 0x00000004 -+#define SZ_8 0x00000008 -+#define SZ_16 0x00000010 -+#define SZ_32 0x00000020 -+#define SZ_64 0x00000040 -+#define SZ_128 0x00000080 -+#define SZ_256 0x00000100 -+#define SZ_512 0x00000200 -+ -+#define SZ_1K 0x00000400 -+#define SZ_2K 0x00000800 -+#define SZ_4K 0x00001000 -+#define SZ_8K 0x00002000 -+#define SZ_16K 0x00004000 -+#define SZ_32K 0x00008000 -+#define SZ_64K 0x00010000 -+#define SZ_128K 0x00020000 -+#define SZ_256K 0x00040000 -+#define SZ_512K 0x00080000 -+ -+#define SZ_1M 0x00100000 -+#define SZ_2M 0x00200000 -+#define SZ_4M 0x00400000 -+#define SZ_8M 0x00800000 -+#define SZ_16M 0x01000000 -+#define SZ_32M 0x02000000 -+#define SZ_64M 0x04000000 -+#define SZ_128M 0x08000000 -+#define SZ_256M 0x10000000 -+#define SZ_512M 0x20000000 -+ -+#define SZ_1G 0x40000000 -+#define SZ_2G 0x80000000 -+ -+#define SZ_4G 0x100000000ULL -+#define SZ_8G 0x200000000ULL -+#define SZ_16G 0x400000000ULL -+#define SZ_32G 0x800000000ULL -+#define SZ_64T 0x400000000000ULL -+ -+#endif /* __CR_SIZES_H__ */ -diff --git a/criu/kerndat.c b/criu/kerndat.c -index b13ebee81..da1fb5511 100644 ---- a/criu/kerndat.c -+++ b/criu/kerndat.c -@@ -183,20 +183,12 @@ static int kerndat_files_stat(void) - return 0; - } - --static int kerndat_get_shmemdev(void) -+static int kerndat_get_dev(dev_t *dev, char *map, size_t size) - { -- void *map; - char maps[128]; - struct stat buf; -- dev_t dev; -- -- map = mmap(NULL, PAGE_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, 0, 0); -- if (map == MAP_FAILED) { -- pr_perror("Can't mmap memory for shmemdev test"); -- return -1; -- } - -- sprintf(maps, "/proc/self/map_files/%lx-%lx", (unsigned long)map, (unsigned long)map + page_size()); -+ sprintf(maps, "/proc/self/map_files/%lx-%lx", (unsigned long)map, (unsigned long)map + size); - if (stat(maps, &buf) < 0) { - int e = errno; - if (errno == EPERM) { -@@ -205,16 +197,34 @@ static int kerndat_get_shmemdev(void) - * OK, let's go the slower route. - */ - -- if (parse_self_maps((unsigned long)map, &dev) < 0) { -+ if (parse_self_maps((unsigned long)map, dev) < 0) { - pr_err("Can't read self maps\n"); -- goto err; -+ return -1; - } - } else { - pr_perror("Can't stat self map_files %d", e); -- goto err; -+ return -1; - } -- } else -- dev = buf.st_dev; -+ } else { -+ *dev = buf.st_dev; -+ } -+ -+ return 0; -+} -+ -+static int kerndat_get_shmemdev(void) -+{ -+ void *map; -+ dev_t dev; -+ -+ map = mmap(NULL, PAGE_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, 0, 0); -+ if (map == MAP_FAILED) { -+ pr_perror("Can't mmap memory for shmemdev test"); -+ return -1; -+ } -+ -+ if (kerndat_get_dev(&dev, map, PAGE_SIZE)) -+ goto err; - - munmap(map, PAGE_SIZE); - kdat.shmem_dev = dev; -@@ -226,6 +236,60 @@ err: - return -1; - } - -+/* Return -1 -- error -+ * Return 0 -- successful but can't get any new device's numbers -+ * Return 1 -- successful and get new device's numbers -+ * -+ * At first, all kdat.hugetlb_dev elements are initialized to 0. -+ * When the function finishes, -+ * kdat.hugetlb_dev[i] == -1 -- this hugetlb page size is not supported -+ * kdat.hugetlb_dev[i] == 0 -- this hugetlb page size is supported but can't collect device's number -+ * Otherwise, kdat.hugetlb_dev[i] contains the corresponding device's number -+ * -+ * Next time the function is called, it only tries to collect the device's number of hugetlb page size -+ * that is supported but can't be collected in the previous call (kdat.hugetlb_dev[i] == 0) -+ */ -+static int kerndat_get_hugetlb_dev(void) -+{ -+ void *map; -+ int i, flag, ret = 0; -+ unsigned long long size; -+ dev_t dev; -+ -+ for (i = 0; i < HUGETLB_MAX; i++) { -+ /* Skip if this hugetlb size is not supported or the device's number has been collected */ -+ if (kdat.hugetlb_dev[i]) -+ continue; -+ -+ size = hugetlb_info[i].size; -+ flag = hugetlb_info[i].flag; -+ map = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_HUGETLB | flag, 0, 0); -+ if (map == MAP_FAILED) { -+ if (errno == EINVAL) { -+ kdat.hugetlb_dev[i] = (dev_t)-1; -+ continue; -+ } else if (errno == ENOMEM) { -+ pr_info("Hugetlb size %llu Mb is supported but cannot get dev's number\n", size >> 20); -+ continue; -+ } else { -+ pr_perror("Unexpected result when get hugetlb dev"); -+ return -1; -+ } -+ } -+ -+ if (kerndat_get_dev(&dev, map, size)) { -+ munmap(map, size); -+ return -1; -+ } -+ -+ munmap(map, size); -+ kdat.hugetlb_dev[i] = dev; -+ ret = 1; -+ pr_info("Found hugetlb device at %" PRIx64 "\n", kdat.hugetlb_dev[i]); -+ } -+ return ret; -+} -+ - static dev_t get_host_dev(unsigned int which) - { - static struct kst { -@@ -1260,13 +1324,43 @@ static int kerndat_has_nftables_concat(void) - #endif - } - -+/* -+ * Some features depend on resource that can be dynamically changed -+ * at the OS runtime. There are cases that we cannot determine the -+ * availability of those features at the first time we run kerndat -+ * check. So in later kerndat checks, we need to retry to get those -+ * information. This function contains calls to those kerndat checks. -+ * -+ * Those kerndat checks must -+ * Return -1 on error -+ * Return 0 when the check is successful but no new information -+ * Return 1 when the check is successful and there is new information -+ */ -+int kerndat_try_load_new(void) -+{ -+ int ret; -+ -+ ret = kerndat_get_hugetlb_dev(); -+ if (ret < 0) -+ return ret; -+ -+ /* New information is found, we need to save to the cache */ -+ if (ret) -+ kerndat_save_cache(); -+ return 0; -+} -+ - int kerndat_init(void) - { - int ret; - - ret = kerndat_try_load_cache(); -- if (ret <= 0) -+ if (ret < 0) - return ret; -+ -+ if (ret == 0) -+ return kerndat_try_load_new(); -+ - ret = 0; - - /* kerndat_try_load_cache can leave some trash in kdat */ -@@ -1283,6 +1377,10 @@ int kerndat_init(void) - pr_err("kerndat_get_shmemdev failed when initializing kerndat.\n"); - ret = -1; - } -+ if (!ret && kerndat_get_hugetlb_dev() < 0) { -+ pr_err("kerndat_get_hugetlb_dev failed when initializing kerndat.\n"); -+ ret = -1; -+ } - if (!ret && kerndat_get_dirty_track()) { - pr_err("kerndat_get_dirty_track failed when initializing kerndat.\n"); - ret = -1; --- -2.35.1 - diff --git a/0124-ipc-Add-support-for-checkpoint-restore-hugetlb-Syste.patch b/0124-ipc-Add-support-for-checkpoint-restore-hugetlb-Syste.patch deleted file mode 100644 index 26274ca..0000000 --- a/0124-ipc-Add-support-for-checkpoint-restore-hugetlb-Syste.patch +++ /dev/null @@ -1,116 +0,0 @@ -From 8398b233488b6e08cf69054cf25274b1ad815a00 Mon Sep 17 00:00:00 2001 -From: Bui Quang Minh -Date: Wed, 15 Dec 2021 22:53:09 +0700 -Subject: [PATCH 124/249] ipc: Add support for checkpoint/restore hugetlb - System V shared memory - -Attach the System V shared memory segments to the address space via shmat() to -determine if they are backed by hugetlb and their page size. Use these -information for setting the correct flags on restore. - -Signed-off-by: Bui Quang Minh ---- - criu/ipc_ns.c | 48 ++++++++++++++++++++++++++++++++++++++++++-- - images/ipc-shm.proto | 1 + - 2 files changed, 47 insertions(+), 2 deletions(-) - -diff --git a/criu/ipc_ns.c b/criu/ipc_ns.c -index a2eb72f28..4fe082fbb 100644 ---- a/criu/ipc_ns.c -+++ b/criu/ipc_ns.c -@@ -15,6 +15,7 @@ - #include "sysctl.h" - #include "ipc_ns.h" - #include "shmem.h" -+#include "types.h" - - #include "protobuf.h" - #include "images/ipc-var.pb-c.h" -@@ -354,6 +355,42 @@ static int dump_ipc_shm_pages(const IpcShmEntry *shm) - return ret; - } - -+static int dump_shm_hugetlb_flag(IpcShmEntry *shm, int id, unsigned long size) -+{ -+ void *addr; -+ int ret, hugetlb_flag, exit_code = -1; -+ struct stat st; -+ char path[64]; -+ -+ addr = shmat(id, NULL, SHM_RDONLY); -+ if (addr == (void *)-1) { -+ pr_perror("Failed to attach shm"); -+ return -1; -+ } -+ -+ /* The shm segment size may not be aligned, -+ * we need to align it up to next page size -+ */ -+ size = (size + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1); -+ snprintf(path, sizeof(path), "/proc/self/map_files/%lx-%lx", (unsigned long)addr, (unsigned long)addr + size); -+ -+ ret = stat(path, &st); -+ if (ret < 0) { -+ pr_perror("Can't stat map_files"); -+ goto detach; -+ } -+ -+ if (is_hugetlb_dev(st.st_dev, &hugetlb_flag)) { -+ shm->has_hugetlb_flag = true; -+ shm->hugetlb_flag = hugetlb_flag | SHM_HUGETLB; -+ } -+ -+ exit_code = 0; -+detach: -+ shmdt(addr); -+ return exit_code; -+} -+ - static int dump_ipc_shm_seg(struct cr_img *img, int id, const struct shmid_ds *ds) - { - IpcShmEntry shm = IPC_SHM_ENTRY__INIT; -@@ -364,6 +401,10 @@ static int dump_ipc_shm_seg(struct cr_img *img, int id, const struct shmid_ds *d - shm.size = ds->shm_segsz; - shm.has_in_pagemaps = true; - shm.in_pagemaps = true; -+ -+ if (dump_shm_hugetlb_flag(&shm, id, ds->shm_segsz)) -+ return -1; -+ - fill_ipc_desc(id, shm.desc, &ds->shm_perm); - pr_info_ipc_shm(&shm); - -@@ -798,7 +839,7 @@ static int prepare_ipc_shm_pages(struct cr_img *img, const IpcShmEntry *shm) - - static int prepare_ipc_shm_seg(struct cr_img *img, const IpcShmEntry *shm) - { -- int ret, id; -+ int ret, id, hugetlb_flag = 0; - struct sysctl_req req[] = { - { "kernel/shm_next_id", &shm->desc->id, CTL_U32 }, - }; -@@ -813,7 +854,10 @@ static int prepare_ipc_shm_seg(struct cr_img *img, const IpcShmEntry *shm) - return ret; - } - -- id = shmget(shm->desc->key, shm->size, shm->desc->mode | IPC_CREAT | IPC_EXCL); -+ if (shm->has_hugetlb_flag) -+ hugetlb_flag = shm->hugetlb_flag; -+ -+ id = shmget(shm->desc->key, shm->size, hugetlb_flag | shm->desc->mode | IPC_CREAT | IPC_EXCL); - if (id == -1) { - pr_perror("Failed to create shm set"); - return -errno; -diff --git a/images/ipc-shm.proto b/images/ipc-shm.proto -index 7865dad8d..c5feebac0 100644 ---- a/images/ipc-shm.proto -+++ b/images/ipc-shm.proto -@@ -8,4 +8,5 @@ message ipc_shm_entry { - required ipc_desc_entry desc = 1; - required uint64 size = 2; - optional bool in_pagemaps = 3; -+ optional uint32 hugetlb_flag = 4; - } --- -2.35.1 - diff --git a/0125-memfd-shmem-Add-support-for-checkpoint-restore-memfd.patch b/0125-memfd-shmem-Add-support-for-checkpoint-restore-memfd.patch deleted file mode 100644 index 31cbf6d..0000000 --- a/0125-memfd-shmem-Add-support-for-checkpoint-restore-memfd.patch +++ /dev/null @@ -1,151 +0,0 @@ -From 796f33af1f755e0d45b3e49920156e2d535c4d65 Mon Sep 17 00:00:00 2001 -From: Bui Quang Minh -Date: Wed, 15 Dec 2021 23:01:29 +0700 -Subject: [PATCH 125/249] memfd, shmem: Add support for checkpoint/restore - memfd and anon shared memory - -Co-developed-by: Andrei Vagin -Signed-off-by: Bui Quang Minh ---- - criu/memfd.c | 15 +++++++++------ - criu/shmem.c | 32 ++++++++++++++++++++++++++++---- - images/memfd.proto | 1 + - 3 files changed, 38 insertions(+), 10 deletions(-) - -diff --git a/criu/memfd.c b/criu/memfd.c -index cb3704499..84ea00c95 100644 ---- a/criu/memfd.c -+++ b/criu/memfd.c -@@ -18,6 +18,7 @@ - #include "file-ids.h" - #include "namespaces.h" - #include "shmem.h" -+#include "hugetlb.h" - - #include "protobuf.h" - #include "images/memfd.pb-c.h" -@@ -57,18 +58,13 @@ static u32 memfd_inode_ids = 1; - - int is_memfd(dev_t dev) - { -- /* -- * TODO When MAP_HUGETLB is used, the file device is not shmem_dev, -- * Note that other parts of CRIU have similar issues, see -- * is_anon_shmem_map(). -- */ - return dev == kdat.shmem_dev; - } - - static int dump_memfd_inode(int fd, struct memfd_dump_inode *inode, const char *name, const struct stat *st) - { - MemfdInodeEntry mie = MEMFD_INODE_ENTRY__INIT; -- int ret = -1; -+ int ret = -1, flag; - u32 shmid; - - /* -@@ -91,6 +87,10 @@ static int dump_memfd_inode(int fd, struct memfd_dump_inode *inode, const char * - mie.name = (char *)name; - mie.size = st->st_size; - mie.shmid = shmid; -+ if (is_hugetlb_dev(inode->dev, &flag)) { -+ mie.has_hugetlb_flag = true; -+ mie.hugetlb_flag = flag | MFD_HUGETLB; -+ } - - mie.seals = fcntl(fd, F_GET_SEALS); - if (mie.seals == -1) -@@ -258,6 +258,9 @@ static int memfd_open_inode_nocache(struct memfd_restore_inode *inode) - flags = MFD_ALLOW_SEALING; - } - -+ if (mie->has_hugetlb_flag) -+ flags |= mie->hugetlb_flag; -+ - fd = memfd_create(mie->name, flags); - if (fd < 0) { - pr_perror("Can't create memfd:%s", mie->name); -diff --git a/criu/shmem.c b/criu/shmem.c -index a9ee8d7eb..81e701586 100644 ---- a/criu/shmem.c -+++ b/criu/shmem.c -@@ -26,6 +26,7 @@ - #include "memfd.h" - #include "protobuf.h" - #include "images/pagemap.pb-c.h" -+#include "namespaces.h" - - #ifndef SEEK_DATA - #define SEEK_DATA 3 -@@ -534,13 +535,24 @@ out: - return ret; - } - -+struct open_map_file_args { -+ unsigned long addr, size; -+}; -+ -+static int open_map_file(void *args, int fd, pid_t pid) -+{ -+ struct open_map_file_args *vma = args; -+ -+ return open_proc_rw(pid, "map_files/%lx-%lx", vma->addr, vma->addr + vma->size); -+} -+ - static int open_shmem(int pid, struct vma_area *vma) - { - VmaEntry *vi = vma->e; - struct shmem_info *si; - void *addr = MAP_FAILED; - int f = -1; -- int flags; -+ int flags, is_hugetlb, memfd_flag = 0; - - si = shmem_find(vi->shmid); - pr_info("Search for %#016" PRIx64 " shmem 0x%" PRIx64 " %p/%d\n", vi->start, vi->shmid, si, si ? si->pid : -1); -@@ -564,9 +576,17 @@ static int open_shmem(int pid, struct vma_area *vma) - goto out; - } - -+ is_hugetlb = vi->flags & MAP_HUGETLB; -+ - flags = MAP_SHARED; -- if (kdat.has_memfd) { -- f = memfd_create("", 0); -+ if (is_hugetlb) { -+ int size_flag = vi->flags & MAP_HUGETLB_SIZE_MASK; -+ flags |= MAP_HUGETLB | size_flag; -+ memfd_flag |= MFD_HUGETLB | size_flag; -+ } -+ -+ if (kdat.has_memfd && (!is_hugetlb || kdat.has_memfd_hugetlb)) { -+ f = memfd_create("", memfd_flag); - if (f < 0) { - pr_perror("Unable to create memfd"); - goto err; -@@ -599,7 +619,11 @@ static int open_shmem(int pid, struct vma_area *vma) - } - - if (f == -1) { -- f = open_proc_rw(getpid(), "map_files/%lx-%lx", (unsigned long)addr, (unsigned long)addr + si->size); -+ struct open_map_file_args args = { -+ .addr = (unsigned long)addr, -+ .size = si->size, -+ }; -+ f = userns_call(open_map_file, UNS_FDOUT, &args, sizeof(args), -1); - if (f < 0) - goto err; - } -diff --git a/images/memfd.proto b/images/memfd.proto -index a944f145d..0e625416a 100644 ---- a/images/memfd.proto -+++ b/images/memfd.proto -@@ -21,4 +21,5 @@ message memfd_inode_entry { - required uint32 shmid = 5; - required uint32 seals = 6 [(criu).flags = "seals.flags"]; - required uint64 inode_id = 7; -+ optional uint32 hugetlb_flag = 8; - }; --- -2.35.1 - diff --git a/0126-proc_parse-files-Add-support-for-hugetlb-memory-mapp.patch b/0126-proc_parse-files-Add-support-for-hugetlb-memory-mapp.patch deleted file mode 100644 index e5dd7ec..0000000 --- a/0126-proc_parse-files-Add-support-for-hugetlb-memory-mapp.patch +++ /dev/null @@ -1,127 +0,0 @@ -From 0cba2304c4796cda832d6e0b16ef2dc305fb6a13 Mon Sep 17 00:00:00 2001 -From: Bui Quang Minh -Date: Wed, 15 Dec 2021 23:03:29 +0700 -Subject: [PATCH 126/249] proc_parse, files: Add support for hugetlb memory - mapping - -When memfd can be used with hugetlb, we use memfd for checkpoint/restore -anonymous shared memory. Otherwise, map_files symlinks is used for -checkpoint/restore anonymous shared memory. - -Signed-off-by: Bui Quang Minh ---- - criu/files.c | 3 ++- - criu/proc_parse.c | 38 +++++++++++++++++++++++++++++++------- - 2 files changed, 33 insertions(+), 8 deletions(-) - -diff --git a/criu/files.c b/criu/files.c -index 429493ccb..7f4b90086 100644 ---- a/criu/files.c -+++ b/criu/files.c -@@ -548,7 +548,8 @@ static int dump_one_file(struct pid *pid, int fd, int lfd, struct fd_opts *opts, - - p.link = &link; - -- if (is_memfd(p.stat.st_dev)) -+ /* TODO: Dump for hugetlb fd when memfd hugetlb is not supported */ -+ if (is_memfd(p.stat.st_dev) || (kdat.has_memfd_hugetlb && is_hugetlb_dev(p.stat.st_dev, NULL))) - ops = &memfd_dump_ops; - else if (link.name[1] == '/') - ops = ®file_dump_ops; -diff --git a/criu/proc_parse.c b/criu/proc_parse.c -index eb3efc877..9009b96f7 100644 ---- a/criu/proc_parse.c -+++ b/criu/proc_parse.c -@@ -41,6 +41,7 @@ - #include "path.h" - #include "fault-injection.h" - #include "memfd.h" -+#include "hugetlb.h" - - #include "protobuf.h" - #include "images/fdinfo.pb-c.h" -@@ -259,7 +260,7 @@ static int vma_stat(struct vma_area *vma, int fd) - static int vma_get_mapfile_user(const char *fname, struct vma_area *vma, struct vma_file_info *vfi, int *vm_file_fd, - const char *path) - { -- int fd; -+ int fd, hugetlb_flag = 0; - dev_t vfi_dev; - - /* -@@ -316,17 +317,19 @@ static int vma_get_mapfile_user(const char *fname, struct vma_area *vma, struct - return -1; - } - -- if (is_anon_shmem_map(vfi_dev)) { -+ if (is_hugetlb_dev(vfi_dev, &hugetlb_flag) || is_anon_shmem_map(vfi_dev)) { - if (!(vma->e->flags & MAP_SHARED)) -- return -1; -+ vma->e->status |= VMA_ANON_PRIVATE; -+ else -+ vma->e->status |= VMA_ANON_SHARED; - - vma->e->flags |= MAP_ANONYMOUS; -- vma->e->status |= VMA_ANON_SHARED; - vma->e->shmid = vfi->ino; -+ vma->e->flags |= hugetlb_flag; - - if (!strncmp(fname, "/SYSV", 5)) { - vma->e->status |= VMA_AREA_SYSVIPC; -- } else { -+ } else if (vma->e->flags & MAP_SHARED) { - if (fault_injected(FI_HUGE_ANON_SHMEM_ID)) - vma->e->shmid += FI_HUGE_ANON_SHMEM_ID_BASE; - } -@@ -576,6 +579,7 @@ static int handle_vma(pid_t pid, struct vma_area *vma_area, const char *file_pat - } - } else if (*vm_file_fd >= 0) { - struct stat *st_buf = vma_area->vmst; -+ int hugetlb_flag = 0; - - if (S_ISREG(st_buf->st_mode)) - /* regular file mapping -- supported */; -@@ -586,7 +590,8 @@ static int handle_vma(pid_t pid, struct vma_area *vma_area, const char *file_pat - goto err; - } - -- if (is_anon_shmem_map(st_buf->st_dev) && !strncmp(file_path, "/SYSV", 5)) { -+ if ((is_anon_shmem_map(st_buf->st_dev) || is_hugetlb_dev(st_buf->st_dev, NULL)) && -+ !strncmp(file_path, "/SYSV", 5)) { - vma_area->e->flags |= MAP_ANONYMOUS; - vma_area->e->status |= VMA_ANON_SHARED; - vma_area->e->shmid = st_buf->st_ino; -@@ -595,10 +600,29 @@ static int handle_vma(pid_t pid, struct vma_area *vma_area, const char *file_pat - pr_info("path: %s\n", file_path); - vma_area->e->status |= VMA_AREA_SYSVIPC; - } else { -- if (is_anon_shmem_map(st_buf->st_dev)) { -+ /* Dump shmem dev, hugetlb dev (private and share) mappings the same way as memfd -+ * when possible. -+ */ -+ if (is_memfd(st_buf->st_dev) || is_anon_shmem_map(st_buf->st_dev) || -+ (kdat.has_memfd_hugetlb && is_hugetlb_dev(st_buf->st_dev, &hugetlb_flag))) { - vma_area->e->status |= VMA_AREA_MEMFD; -+ vma_area->e->flags |= hugetlb_flag; - if (fault_injected(FI_HUGE_ANON_SHMEM_ID)) - vma_area->e->shmid += FI_HUGE_ANON_SHMEM_ID_BASE; -+ } else if (is_hugetlb_dev(st_buf->st_dev, &hugetlb_flag)) { -+ /* hugetlb mapping but memfd does not support HUGETLB */ -+ vma_area->e->flags |= hugetlb_flag; -+ vma_area->e->flags |= MAP_ANONYMOUS; -+ -+ if (vma_area->e->flags & MAP_SHARED) { -+ vma_area->e->status |= VMA_ANON_SHARED; -+ vma_area->e->shmid = st_buf->st_ino; -+ } else { -+ vma_area->e->status |= VMA_ANON_PRIVATE; -+ } -+ -+ close_safe(vm_file_fd); -+ return 0; - } - - if (vma_area->e->flags & MAP_PRIVATE) --- -2.35.1 - diff --git a/0127-mem-Skip-premapping-hugetlb-mapping.patch b/0127-mem-Skip-premapping-hugetlb-mapping.patch deleted file mode 100644 index 3e67c32..0000000 --- a/0127-mem-Skip-premapping-hugetlb-mapping.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 307299bea57d25a41f5fba7b057d3926f4f1231b Mon Sep 17 00:00:00 2001 -From: Bui Quang Minh -Date: Wed, 9 Feb 2022 22:11:51 +0700 -Subject: [PATCH 127/249] mem: Skip premapping hugetlb mapping - -As we cannot use mremap() to move the hugetlb mapping around until Linux kernel -version 5.16, we need to skip premapping hugetlb mapping. - -Signed-off-by: Bui Quang Minh ---- - criu/mem.c | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/criu/mem.c b/criu/mem.c -index ca74bfbb6..6b7e4be4b 100644 ---- a/criu/mem.c -+++ b/criu/mem.c -@@ -733,6 +733,9 @@ static inline bool check_cow_vmas(struct vma_area *vma, struct vma_area *pvma) - return false; - if (!vma_area_is_private(pvma, kdat.task_size)) - return false; -+ /* ... but not hugetlb mappings */ -+ if (vma->e->flags & MAP_HUGETLB || pvma->e->flags & MAP_HUGETLB) -+ return false; - /* ... have growsdown and anon flags coincide */ - if ((vma->e->flags ^ pvma->e->flags) & (MAP_GROWSDOWN | MAP_ANONYMOUS)) - return false; -@@ -971,6 +974,9 @@ static int premap_priv_vmas(struct pstree_item *t, struct vm_area_list *vmas, vo - if (!vma_area_is_private(vma, kdat.task_size)) - continue; - -+ if (vma->e->flags & MAP_HUGETLB) -+ continue; -+ - if (vma->pvma == NULL && pr->pieok && !vma_force_premap(vma, &vmas->h)) { - /* - * VMA in question is not shared with anyone. We'll --- -2.35.1 - diff --git a/0128-uffd-Skip-lazy-mode-restore-on-hugetlb-mappings.patch b/0128-uffd-Skip-lazy-mode-restore-on-hugetlb-mappings.patch deleted file mode 100644 index 140313d..0000000 --- a/0128-uffd-Skip-lazy-mode-restore-on-hugetlb-mappings.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 5372cb96363fed0dbd4a7f1ea5da7979e4846466 Mon Sep 17 00:00:00 2001 -From: Bui Quang Minh -Date: Wed, 9 Feb 2022 22:12:53 +0700 -Subject: [PATCH 128/249] uffd: Skip lazy-mode restore on hugetlb mappings - -As hugetlb mappings are not premapped, they are not registered to uffd service -in restorer code. We must not mark these mappings as PPB_LAZY in generate_iovs() -otherwise when restoring content of these mappings, we will keep looking for in -uffd and get ENOENT because they are not registered. - -Signed-off-by: Bui Quang Minh ---- - criu/include/vma.h | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/criu/include/vma.h b/criu/include/vma.h -index 541d6d6fd..106c56af2 100644 ---- a/criu/include/vma.h -+++ b/criu/include/vma.h -@@ -122,7 +122,8 @@ static inline struct vma_area *vma_next(struct vma_area *vma) - static inline bool vma_entry_can_be_lazy(VmaEntry *e) - { - return ((e->flags & MAP_ANONYMOUS) && (e->flags & MAP_PRIVATE) && !(e->flags & MAP_LOCKED) && -- !(vma_entry_is(e, VMA_AREA_VDSO)) && !(vma_entry_is(e, VMA_AREA_VSYSCALL))); -+ !(vma_entry_is(e, VMA_AREA_VDSO)) && !(vma_entry_is(e, VMA_AREA_VSYSCALL)) && -+ !(e->flags & MAP_HUGETLB)); - } - - #endif /* __CR_VMA_H__ */ --- -2.35.1 - diff --git a/0129-zdtm-Add-MAP_HUGETLB-memory-mapping-test.patch b/0129-zdtm-Add-MAP_HUGETLB-memory-mapping-test.patch deleted file mode 100644 index 0d6149c..0000000 --- a/0129-zdtm-Add-MAP_HUGETLB-memory-mapping-test.patch +++ /dev/null @@ -1,228 +0,0 @@ -From f2793fea9c36f1102186f34d47534287efda63f5 Mon Sep 17 00:00:00 2001 -From: Bui Quang Minh -Date: Tue, 26 Oct 2021 22:22:08 +0700 -Subject: [PATCH 129/249] zdtm: Add MAP_HUGETLB memory mapping test - -This commit add a test for checkpoint/restore MAP_HUGETLB memory mappings. -A new zdtm helper get_mapping_dev() is added to get the device number of -the memory mapping. - -Signed-off-by: Bui Quang Minh ---- - test/zdtm.py | 15 +++++++ - test/zdtm/lib/Makefile | 2 +- - test/zdtm/lib/mem.c | 32 ++++++++++++++ - test/zdtm/lib/zdtmtst.h | 1 + - test/zdtm/static/Makefile | 1 + - test/zdtm/static/maps09.c | 89 +++++++++++++++++++++++++++++++++++++++ - 6 files changed, 139 insertions(+), 1 deletion(-) - create mode 100644 test/zdtm/lib/mem.c - create mode 100644 test/zdtm/static/maps09.c - -diff --git a/test/zdtm.py b/test/zdtm.py -index 14e6aa1b0..cf73a17ae 100755 ---- a/test/zdtm.py -+++ b/test/zdtm.py -@@ -2566,6 +2566,17 @@ def clean_stuff(opts): - f.clean() - - -+def set_nr_hugepages(nr): -+ orig_hugepages = 0 -+ with open("/proc/sys/vm/nr_hugepages", "r") as f: -+ orig_hugepages = int(f.read()) -+ -+ with open("/proc/sys/vm/nr_hugepages", "w") as f: -+ f.write("{}\n".format(nr)) -+ -+ return orig_hugepages -+ -+ - # - # main() starts here - # -@@ -2738,7 +2749,11 @@ if opts['action'] == 'run': - for tst in test_classes.values(): - tst.available() - -+orig_hugepages = set_nr_hugepages(20) -+ - opts['action'](opts) - -+set_nr_hugepages(orig_hugepages) -+ - for tst in test_classes.values(): - tst.cleanup() -diff --git a/test/zdtm/lib/Makefile b/test/zdtm/lib/Makefile -index ceec2b878..3ec58dfaf 100644 ---- a/test/zdtm/lib/Makefile -+++ b/test/zdtm/lib/Makefile -@@ -4,7 +4,7 @@ CFLAGS += $(USERCFLAGS) - - LIB := libzdtmtst.a - --LIBSRC := datagen.c msg.c parseargs.c test.c streamutil.c lock.c ns.c tcp.c unix.c fs.c sysctl.c -+LIBSRC := datagen.c msg.c parseargs.c test.c streamutil.c lock.c ns.c tcp.c unix.c fs.c sysctl.c mem.c - - PKG_CONFIG ?= pkg-config - pkg-config-check = $(shell sh -c '$(PKG_CONFIG) $(1) && echo y') -diff --git a/test/zdtm/lib/mem.c b/test/zdtm/lib/mem.c -new file mode 100644 -index 000000000..f612e7a15 ---- /dev/null -+++ b/test/zdtm/lib/mem.c -@@ -0,0 +1,32 @@ -+#include -+#include -+#include -+ -+#include "zdtmtst.h" -+ -+dev_t get_mapping_dev(void *addr) -+{ -+ char buf[1024]; -+ FILE *f; -+ unsigned int major, minor; -+ int ret; -+ -+ f = fopen("/proc/self/maps", "r"); -+ if (f == NULL) { -+ pr_perror("Failed to open maps file"); -+ return (dev_t)-1; -+ } -+ -+ while (fgets(buf, sizeof(buf), f)) { -+ if ((unsigned long)addr == strtoul(buf, NULL, 16)) { -+ ret = sscanf(buf, "%*x-%*x %*c%*c%*c%*c %*x %x:%x", &major, &minor); -+ if (ret != 2) { -+ pr_err("Can't parse /proc/self/maps\n"); -+ return (dev_t)-1; -+ } -+ return makedev(major, minor); -+ } -+ } -+ -+ return (dev_t)-1; -+} -diff --git a/test/zdtm/lib/zdtmtst.h b/test/zdtm/lib/zdtmtst.h -index c6d77011d..803d33e3d 100644 ---- a/test/zdtm/lib/zdtmtst.h -+++ b/test/zdtm/lib/zdtmtst.h -@@ -164,6 +164,7 @@ extern const char *test_doc; - extern int tcp_init_server_with_opts(int family, int *port, struct zdtm_tcp_opts *opts); - extern pid_t sys_clone_unified(unsigned long flags, void *child_stack, void *parent_tid, void *child_tid, - unsigned long newtls); -+extern dev_t get_mapping_dev(void *addr); - - #define ssprintf(s, fmt, ...) \ - ({ \ -diff --git a/test/zdtm/static/Makefile b/test/zdtm/static/Makefile -index 4a21978b5..0e5f096fa 100644 ---- a/test/zdtm/static/Makefile -+++ b/test/zdtm/static/Makefile -@@ -131,6 +131,7 @@ TST_NOFILE := \ - maps02 \ - maps04 \ - maps05 \ -+ maps09 \ - mlock_setuid \ - xids00 \ - groups \ -diff --git a/test/zdtm/static/maps09.c b/test/zdtm/static/maps09.c -new file mode 100644 -index 000000000..216263b4c ---- /dev/null -+++ b/test/zdtm/static/maps09.c -@@ -0,0 +1,89 @@ -+#include -+ -+#include "zdtmtst.h" -+ -+#define MEM_SIZE (4UL * (1UL << 20)) /* 4MB */ -+#define MEM_OFFSET (MEM_SIZE - PAGE_SIZE) -+ -+const char *test_doc = "Test MAP_HUGETLB mapping"; -+const char *test_author = "Bui Quang Minh "; -+ -+int main(int argc, char **argv) -+{ -+ void *m1, *m2; -+ dev_t dev1, dev2; -+ uint32_t crc; -+ -+ test_init(argc, argv); -+ m1 = mmap(NULL, MEM_SIZE, PROT_READ | PROT_WRITE, MAP_HUGETLB | MAP_SHARED | MAP_ANONYMOUS, 0, 0); -+ if (m1 == MAP_FAILED) { -+ pr_perror("Failed to mmap %lu Mb anonymous shared memory", MEM_SIZE >> 20); -+ return 1; -+ } -+ -+ dev1 = get_mapping_dev(m1); -+ if (dev1 == (dev_t)-1) { -+ fail("Can't get mapping dev"); -+ return 1; -+ } -+ -+ m2 = mmap(NULL, MEM_SIZE, PROT_READ | PROT_WRITE, MAP_HUGETLB | MAP_PRIVATE | MAP_ANONYMOUS, 0, 0); -+ if (m2 == MAP_FAILED) { -+ pr_perror("Failed to mmap %lu Mb anonymous private memory", MEM_SIZE >> 20); -+ return 1; -+ } -+ -+ dev2 = get_mapping_dev(m2); -+ if (dev2 == (dev_t)-1) { -+ fail("Can't get mapping dev"); -+ return 1; -+ } -+ -+ crc = ~0; -+ datagen(m1, PAGE_SIZE, &crc); -+ crc = ~0; -+ datagen(m1 + MEM_OFFSET, PAGE_SIZE, &crc); -+ crc = ~0; -+ datagen(m2, PAGE_SIZE, &crc); -+ crc = ~0; -+ datagen(m2 + MEM_OFFSET, PAGE_SIZE, &crc); -+ crc = ~0; -+ -+ test_daemon(); -+ test_waitsig(); -+ -+ crc = ~0; -+ if (datachk(m1, PAGE_SIZE, &crc)) { -+ fail("Data mismatch"); -+ return 1; -+ } -+ crc = ~0; -+ if (datachk(m1 + MEM_OFFSET, PAGE_SIZE, &crc)) { -+ fail("Data mismatch"); -+ return 1; -+ } -+ crc = ~0; -+ if (datachk(m2, PAGE_SIZE, &crc)) { -+ fail("Data mismatch"); -+ return 1; -+ } -+ crc = ~0; -+ if (datachk(m2 + MEM_OFFSET, PAGE_SIZE, &crc)) { -+ fail("Data mismatch"); -+ return 1; -+ } -+ -+ if (dev1 != get_mapping_dev(m1)) { -+ fail("Mapping dev mismatch"); -+ return 1; -+ } -+ -+ if (dev2 != get_mapping_dev(m2)) { -+ fail("Mapping dev mismatch"); -+ return 1; -+ } -+ -+ pass(); -+ -+ return 0; -+} --- -2.35.1 - diff --git a/0130-zdtm-Add-memfd-hugetlb-test.patch b/0130-zdtm-Add-memfd-hugetlb-test.patch deleted file mode 100644 index a3a7f4a..0000000 --- a/0130-zdtm-Add-memfd-hugetlb-test.patch +++ /dev/null @@ -1,166 +0,0 @@ -From be3340e0cc7dc4c77d3656f54d3be48b533a177d Mon Sep 17 00:00:00 2001 -From: Bui Quang Minh -Date: Tue, 26 Oct 2021 22:31:44 +0700 -Subject: [PATCH 130/249] zdtm: Add memfd hugetlb test - -Signed-off-by: Bui Quang Minh ---- - test/zdtm/static/Makefile | 2 ++ - test/zdtm/static/memfd02-hugetlb.c | 1 + - test/zdtm/static/memfd02-hugetlb.desc | 1 + - test/zdtm/static/memfd02.c | 52 +++++++++++++++++++++++---- - 4 files changed, 50 insertions(+), 6 deletions(-) - create mode 120000 test/zdtm/static/memfd02-hugetlb.c - create mode 100644 test/zdtm/static/memfd02-hugetlb.desc - -diff --git a/test/zdtm/static/Makefile b/test/zdtm/static/Makefile -index 0e5f096fa..3b244e52d 100644 ---- a/test/zdtm/static/Makefile -+++ b/test/zdtm/static/Makefile -@@ -248,6 +248,7 @@ TST_NOFILE := \ - memfd00 \ - memfd01 \ - memfd02 \ -+ memfd02-hugetlb \ - memfd03 \ - shmemfd \ - shmemfd-priv \ -@@ -618,6 +619,7 @@ socket-tcp6-closing: CFLAGS += -D ZDTM_IPV6 - socket-tcp6-unconn: CFLAGS += -D ZDTM_IPV6 - socket-tcp4v6-last-ack: CFLAGS += -D ZDTM_TCP_LAST_ACK -D ZDTM_IPV4V6 - socket-tcp4v6-closing: CFLAGS += -D ZDTM_IPV4V6 -+memfd02-hugetlb: CFLAGS += -D ZDTM_HUGETLB - - sockets00-seqpacket: CFLAGS += -D ZDTM_UNIX_SEQPACKET - sockets01-seqpacket: CFLAGS += -D ZDTM_UNIX_SEQPACKET -diff --git a/test/zdtm/static/memfd02-hugetlb.c b/test/zdtm/static/memfd02-hugetlb.c -new file mode 120000 -index 000000000..db0820633 ---- /dev/null -+++ b/test/zdtm/static/memfd02-hugetlb.c -@@ -0,0 +1 @@ -+memfd02.c -\ No newline at end of file -diff --git a/test/zdtm/static/memfd02-hugetlb.desc b/test/zdtm/static/memfd02-hugetlb.desc -new file mode 100644 -index 000000000..f88ad828b ---- /dev/null -+++ b/test/zdtm/static/memfd02-hugetlb.desc -@@ -0,0 +1 @@ -+{'feature': 'memfd_hugetlb'} -diff --git a/test/zdtm/static/memfd02.c b/test/zdtm/static/memfd02.c -index 12e294921..8950e38e2 100644 ---- a/test/zdtm/static/memfd02.c -+++ b/test/zdtm/static/memfd02.c -@@ -13,6 +13,10 @@ - - #include "zdtmtst.h" - -+#ifndef MFD_HUGETLB -+#define MFD_HUGETLB 4 -+#endif -+ - const char *test_doc = "memfd mmap"; - const char *test_author = "Nicolas Viennot "; - -@@ -29,14 +33,24 @@ static int _memfd_create(const char *name, unsigned int flags) - - int main(int argc, char *argv[]) - { -+#ifdef ZDTM_HUGETLB -+#define LEN (2 * (1 << 20)) /* 2MB */ -+#else - #define LEN 6 -- int fd; -+#endif -+ -+ int fd, flag = 0; - void *addr_shared, *addr_private; - char buf[LEN]; -+ dev_t dev1, dev2; - - test_init(argc, argv); - -- fd = _memfd_create("somename", MFD_CLOEXEC); -+#ifdef ZDTM_HUGETLB -+ flag = MFD_HUGETLB; -+#endif -+ -+ fd = _memfd_create("somename", MFD_CLOEXEC | flag); - if (fd < 0) - err(1, "Can't call memfd_create"); - -@@ -47,16 +61,32 @@ int main(int argc, char *argv[]) - if (addr_shared == MAP_FAILED) - err(1, "Can't mmap"); - -+ dev1 = get_mapping_dev(addr_shared); -+ if (dev1 == (dev_t)-1) { -+ fail("Can't get mapping dev"); -+ return 1; -+ } -+ -+#ifdef ZDTM_HUGETLB -+ strcpy(addr_shared, "write1"); -+#else - write(fd, "write1", LEN); -+#endif - - addr_private = mmap(NULL, LEN, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0); - if (addr_private == MAP_FAILED) - err(1, "Can't mmap"); - -+ dev2 = get_mapping_dev(addr_private); -+ if (dev2 == (dev_t)-1) { -+ fail("Can't get mapping dev"); -+ return 1; -+ } -+ - test_daemon(); - test_waitsig(); - -- if (memcmp(addr_shared, "write1", LEN)) { -+ if (strncmp(addr_shared, "write1", LEN)) { - fail("content mismatch (shared)"); - return 1; - } -@@ -68,23 +98,33 @@ int main(int argc, char *argv[]) - return 1; - } - -- if (memcmp(buf, "write2", LEN)) { -+ if (strncmp(buf, "write2", LEN)) { - fail("content mismatch (shared)"); - return 1; - } - -- if (memcmp(addr_private, "write2", LEN)) { -+ if (strncmp(addr_private, "write2", LEN)) { - fail("content mismatch (private)"); - return 1; - } - - strcpy(addr_private, "write3"); - -- if (memcmp(addr_shared, "write2", LEN)) { -+ if (strncmp(addr_shared, "write2", LEN)) { - fail("content mismatch (shared)"); - return 1; - } - -+ if (dev1 != get_mapping_dev(addr_shared)) { -+ fail("Mapping dev mismatch"); -+ return 1; -+ } -+ -+ if (dev2 != get_mapping_dev(addr_private)) { -+ fail("Mapping dev mismatch"); -+ return 1; -+ } -+ - pass(); - - return 0; --- -2.35.1 - diff --git a/0131-zdtm-Add-shm-hugetlb-test.patch b/0131-zdtm-Add-shm-hugetlb-test.patch deleted file mode 100644 index da27eac..0000000 --- a/0131-zdtm-Add-shm-hugetlb-test.patch +++ /dev/null @@ -1,121 +0,0 @@ -From dd448857444438c34793662ef472c76c2810e69d Mon Sep 17 00:00:00 2001 -From: Bui Quang Minh -Date: Tue, 26 Oct 2021 22:34:22 +0700 -Subject: [PATCH 131/249] zdtm: Add shm hugetlb test - -Signed-off-by: Bui Quang Minh ---- - test/zdtm/static/Makefile | 5 +++++ - test/zdtm/static/shm-hugetlb.c | 1 + - test/zdtm/static/shm-hugetlb.desc | 1 + - test/zdtm/static/shm.c | 22 +++++++++++++++++++--- - 4 files changed, 26 insertions(+), 3 deletions(-) - create mode 120000 test/zdtm/static/shm-hugetlb.c - create mode 100644 test/zdtm/static/shm-hugetlb.desc - -diff --git a/test/zdtm/static/Makefile b/test/zdtm/static/Makefile -index 3b244e52d..48aa8587d 100644 ---- a/test/zdtm/static/Makefile -+++ b/test/zdtm/static/Makefile -@@ -436,6 +436,7 @@ TST = \ - umask00 \ - cmdlinenv00 \ - shm-unaligned \ -+ shm-hugetlb \ - - TST_STATE = \ - conntracks \ -@@ -475,6 +476,9 @@ cmdlinenv00.pid: cmdlinenv00 - shm-unaligned.pid: shm-unaligned - $( -Date: Fri, 31 Dec 2021 17:15:18 +0700 -Subject: [PATCH 132/249] zdtm: Add MAP_HUGETLB mappings test for parent-child - relationship processes - -Signed-off-by: Bui Quang Minh ---- - test/zdtm/static/Makefile | 1 + - test/zdtm/static/maps10.c | 136 ++++++++++++++++++++++++++++++++++++++ - 2 files changed, 137 insertions(+) - create mode 100644 test/zdtm/static/maps10.c - -diff --git a/test/zdtm/static/Makefile b/test/zdtm/static/Makefile -index 48aa8587d..1b057c70c 100644 ---- a/test/zdtm/static/Makefile -+++ b/test/zdtm/static/Makefile -@@ -132,6 +132,7 @@ TST_NOFILE := \ - maps04 \ - maps05 \ - maps09 \ -+ maps10 \ - mlock_setuid \ - xids00 \ - groups \ -diff --git a/test/zdtm/static/maps10.c b/test/zdtm/static/maps10.c -new file mode 100644 -index 000000000..51e37863b ---- /dev/null -+++ b/test/zdtm/static/maps10.c -@@ -0,0 +1,136 @@ -+#include -+#include -+#include -+#include -+#include -+#include "zdtmtst.h" -+ -+const char *test_doc = "Test MAP_HUGETLB mapping in parent-child relationship processes"; -+const char *test_author = "Bui Quang Minh "; -+ -+#define MEM_SIZE (2UL * (1UL << 20)) /* 2MB */ -+ -+int main(int argc, char **argv) -+{ -+ void *p1, *p2, *s1; -+ task_waiter_t t; -+ pid_t pid; -+ uint32_t crc, tmp_crc; -+ int status; -+ -+ test_init(argc, argv); -+ task_waiter_init(&t); -+ -+ p1 = mmap(NULL, MEM_SIZE, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_HUGETLB, 0, 0); -+ if (p1 == MAP_FAILED) { -+ pr_perror("Map failed"); -+ return 1; -+ } -+ -+ p2 = mmap(NULL, MEM_SIZE, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_HUGETLB, 0, 0); -+ if (p2 == MAP_FAILED) { -+ pr_perror("Map failed"); -+ return 1; -+ } -+ -+ s1 = mmap(NULL, MEM_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS | MAP_HUGETLB, 0, 0); -+ if (s1 == MAP_FAILED) { -+ pr_perror("Map failed"); -+ return 1; -+ } -+ -+ crc = ~0; -+ datagen(p1, MEM_SIZE, &crc); -+ crc = ~0; -+ datagen(p2, MEM_SIZE, &crc); -+ tmp_crc = crc; -+ -+ pid = test_fork(); -+ if (pid < 0) { -+ pr_perror("fork failed"); -+ return 1; -+ } -+ -+ if (pid == 0) { -+ crc = ~0; -+ datagen(p2, MEM_SIZE, &crc); -+ tmp_crc = crc; -+ crc = ~0; -+ datagen(s1, MEM_SIZE, &crc); -+ -+ task_waiter_complete(&t, 1); -+ test_waitsig(); -+ -+ crc = ~0; -+ if (datachk(p1, MEM_SIZE, &crc)) { -+ fail("Data mismatch"); -+ return 1; -+ } -+ -+ crc = ~0; -+ if (datachk(p2, MEM_SIZE, &crc)) { -+ fail("Data mismatch"); -+ return 1; -+ } -+ -+ if (crc != tmp_crc) { -+ fail("Data mismatch"); -+ return 1; -+ } -+ -+ crc = ~0; -+ if (datachk(s1, MEM_SIZE, &crc)) { -+ fail("Data mismatch"); -+ return 1; -+ } -+ -+ return 0; -+ } -+ -+ task_waiter_wait4(&t, 1); -+ -+ test_daemon(); -+ test_waitsig(); -+ -+ kill(pid, SIGTERM); -+ wait(&status); -+ if (WIFEXITED(status)) { -+ if (WEXITSTATUS(status)) -+ goto err; -+ } else { -+ goto err; -+ } -+ -+ crc = ~0; -+ if (datachk(p1, MEM_SIZE, &crc)) { -+ fail("Data mismatch"); -+ return 1; -+ } -+ -+ crc = ~0; -+ if (datachk(p2, MEM_SIZE, &crc)) { -+ fail("Data mismatch"); -+ return 1; -+ } -+ -+ if (crc != tmp_crc) { -+ fail("Data mismatch"); -+ return 1; -+ } -+ -+ crc = ~0; -+ if (datachk(s1, MEM_SIZE, &crc)) { -+ fail("Data mismatch"); -+ return 1; -+ } -+ -+ pass(); -+ -+ return 0; -+err: -+ if (waitpid(-1, NULL, WNOHANG) == 0) { -+ kill(pid, SIGTERM); -+ wait(NULL); -+ } -+ return 1; -+} -\ No newline at end of file --- -2.35.1 - diff --git a/0133-ci-skip-MAP_HUGETLB-tests-in-stream-test.patch b/0133-ci-skip-MAP_HUGETLB-tests-in-stream-test.patch deleted file mode 100644 index f96fb73..0000000 --- a/0133-ci-skip-MAP_HUGETLB-tests-in-stream-test.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 9ac3812ec97c4b8d5d9ae0d27585a2319337a0f0 Mon Sep 17 00:00:00 2001 -From: Bui Quang Minh -Date: Sat, 12 Feb 2022 16:00:39 +0700 -Subject: [PATCH 133/249] ci: skip MAP_HUGETLB tests in stream test - -Currently, hugetlb mappings is not premapped so in the restore content phase, we -skip page read these pages, enqueue the iovec for later reading in restorer and -eventually close the page read. However, image-streamer expects the whole image -to be read and the image is not re-opened, sent twice. These MAP_HUGETLB test -cases will result in EPIPE error. Temporarily disable these test cases for now. - -Signed-off-by: Bui Quang Minh ---- - scripts/ci/run-ci-tests.sh | 9 ++++++++- - 1 file changed, 8 insertions(+), 1 deletion(-) - -diff --git a/scripts/ci/run-ci-tests.sh b/scripts/ci/run-ci-tests.sh -index d0cd55f7c..50216634e 100755 ---- a/scripts/ci/run-ci-tests.sh -+++ b/scripts/ci/run-ci-tests.sh -@@ -63,8 +63,15 @@ ci_prep () { - - test_stream() { - # Testing CRIU streaming to criu-image-streamer -+ -+ # FIXME: Currently, hugetlb mappings is not premapped, so in the restore content -+ # phase, we skip page read these pages, enqueue the iovec for later reading in -+ # restorer and eventually close the page read. However, image-streamer expects the -+ # whole image to be read and the image is not reopened, sent twice. These MAP_HUGETLB -+ # test cases will result in EPIPE error at the moment. -+ STREAM_TEST_EXCLUDE="-x maps09 -x maps10" - # shellcheck disable=SC2086 -- ./test/zdtm.py run --stream -p 2 --keep-going -a $ZDTM_OPTS -+ ./test/zdtm.py run --stream -p 2 --keep-going -a $STREAM_TEST_EXCLUDE $ZDTM_OPTS - } - - print_header() { --- -2.35.1 - diff --git a/0134-bpfmap-handle-new-field-in-fdinfo.patch b/0134-bpfmap-handle-new-field-in-fdinfo.patch deleted file mode 100644 index faf064f..0000000 --- a/0134-bpfmap-handle-new-field-in-fdinfo.patch +++ /dev/null @@ -1,124 +0,0 @@ -From fda874bd37f1dabb6756bf1b2cbc8b06ceeecae9 Mon Sep 17 00:00:00 2001 -From: Adrian Reber -Date: Tue, 15 Feb 2022 16:55:45 +0000 -Subject: [PATCH 134/249] bpfmap: handle new field in fdinfo - -Starting with Linux Kernel release 5.16 the fdinfo proc entry contains -a map_extra field which breaks CRIU parsing of bpfmap entries. - -This commit adds the map_extra as a possible field to CRIU. The value of -map_extra is not passed to the kernel on restore as it does not seem to -be evaluated in the code paths CRIU restore is using for BPF. - -This fixes CRIU CI using Fedora with 5.16. - -See Linux commit 9330986c03006ab1d33d243b7cfe598a7a3c1baa - "bpf: Add bloom filter map implementation" - -Signed-off-by: Adrian Reber ---- - criu/bpfmap.c | 3 +++ - criu/proc_parse.c | 36 +++++++++++++++++++++++++++--------- - images/bpfmap-file.proto | 1 + - 3 files changed, 31 insertions(+), 9 deletions(-) - -diff --git a/criu/bpfmap.c b/criu/bpfmap.c -index 55b381c18..64071d382 100644 ---- a/criu/bpfmap.c -+++ b/criu/bpfmap.c -@@ -292,6 +292,9 @@ static int bpfmap_open(struct file_desc *d, int *new_fd) - return -1; - } - -+ if (bpfe->has_map_extra && bpfe->map_extra) -+ pr_warn("bpfmap map_extra has non-zero value. This will not be restored.\n"); -+ - if (restore_bpfmap_data(bpfmap_fd, bpfe->map_id, bpfmap_data_hash_table)) - return -1; - -diff --git a/criu/proc_parse.c b/criu/proc_parse.c -index 9009b96f7..13ec76e3b 100644 ---- a/criu/proc_parse.c -+++ b/criu/proc_parse.c -@@ -1737,6 +1737,12 @@ nodata: - typedef struct bpfmap_fmt { - char *fmt; - void *value; -+ /* -+ * If newer kernels are adding additional entries, these entries need -+ * to be marked as optional in the protobuf definition and the parsing -+ * must be able to ignore it if running on an older kernel. -+ */ -+ protobuf_c_boolean *optional; - } bpfmap_fmt; - - static int parse_bpfmap(struct bfd *f, char *str, BpfmapFileEntry *bpf) -@@ -1749,27 +1755,36 @@ static int parse_bpfmap(struct bfd *f, char *str, BpfmapFileEntry *bpf) - * uint32_t value_size - * uint32_t max_entries - * uint32_t map_flags -+ * uint64_t map_extra - * uint64_t memlock - * uint32_t map_id - * boolean frozen - */ - -+ /* This needs to be in the same order as in the fdinfo entry. */ - bpfmap_fmt map[] = { -- { "map_type: %u", &bpf->map_type }, -- { "key_size: %u", &bpf->key_size }, -- { "value_size: %u", &bpf->value_size }, -- { "max_entries: %u", &bpf->max_entries }, -- { "map_flags: %" PRIx32 "", &bpf->map_flags }, -- { "memlock: %" PRIu64 "", &bpf->memlock }, -- { "map_id: %u", &bpf->map_id }, -- { "frozen: %d", &bpf->frozen }, -+ { "map_type: %u", &bpf->map_type, NULL }, -+ { "key_size: %u", &bpf->key_size, NULL }, -+ { "value_size: %u", &bpf->value_size, NULL }, -+ { "max_entries: %u", &bpf->max_entries, NULL }, -+ { "map_flags: %" PRIx32 "", &bpf->map_flags, NULL }, -+ { "map_extra: %" PRIx64 "", &bpf->map_extra, &bpf->has_map_extra }, -+ { "memlock: %" PRIu64 "", &bpf->memlock, NULL }, -+ { "map_id: %u", &bpf->map_id, NULL }, -+ { "frozen: %d", &bpf->frozen, NULL }, - }; - - size_t n = sizeof(map) / sizeof(bpfmap_fmt); - int i; - - for (i = 0; i < n; i++) { -- if (sscanf(str, map[i].fmt, map[i].value) != 1) -+ bool parsing_failed = false; -+ if (sscanf(str, map[i].fmt, map[i].value) != 1) { -+ parsing_failed = true; -+ } -+ if (map[i].optional && !parsing_failed) -+ *map[i].optional = true; -+ if (!map[i].optional && parsing_failed) - return -1; - - if (i == n - 1) -@@ -1782,6 +1797,9 @@ static int parse_bpfmap(struct bfd *f, char *str, BpfmapFileEntry *bpf) - } - } - -+ if (bpf->has_map_extra && bpf->map_extra) -+ pr_warn("Non-zero value for fdinfo map_extra entry found. This will not be restored.\n"); -+ - return 0; - } - -diff --git a/images/bpfmap-file.proto b/images/bpfmap-file.proto -index 34a6c1dd2..895321e13 100644 ---- a/images/bpfmap-file.proto -+++ b/images/bpfmap-file.proto -@@ -21,4 +21,5 @@ message bpfmap_file_entry { - required string map_name = 13; - required uint32 ifindex = 14 [default = 0]; - optional sint32 mnt_id = 15 [default = -1]; -+ optional uint64 map_extra = 16; - } --- -2.35.1 - diff --git a/0135-test-remove-test-for-LOCK_MAND-flock.patch b/0135-test-remove-test-for-LOCK_MAND-flock.patch deleted file mode 100644 index dde8a75..0000000 --- a/0135-test-remove-test-for-LOCK_MAND-flock.patch +++ /dev/null @@ -1,49 +0,0 @@ -From d87e53b6721e76839218791a8a2af87d1add7911 Mon Sep 17 00:00:00 2001 -From: Adrian Reber -Date: Tue, 15 Feb 2022 17:01:32 +0000 -Subject: [PATCH 135/249] test: remove test for LOCK_MAND flock - -Linux Kernel release 5.16 removed support for LOCK_MAND flock and so the -test to verify if LOCK_MAND works started to fail with 5.16. - -The kernel also logs following message: - - Attempt to set a LOCK_MAND lock via flock(2). This support has been removed and the request ignored. - -This fixes CRIU CI using Fedora with 5.16. - -See Linux Kernel commit 90f7d7a0d0d68623b5f7df5621a8d54d9518fcc4 - "locks: remove LOCK_MAND flock lock support" - -Signed-off-by: Adrian Reber ---- - test/zdtm/static/file_locks01.c | 6 ------ - 1 file changed, 6 deletions(-) - -diff --git a/test/zdtm/static/file_locks01.c b/test/zdtm/static/file_locks01.c -index 6c2e54ff4..beea171f5 100644 ---- a/test/zdtm/static/file_locks01.c -+++ b/test/zdtm/static/file_locks01.c -@@ -159,7 +159,6 @@ int main(int argc, char **argv) - - flock(fd_0, LOCK_SH); - flock(fd_1, LOCK_EX); -- flock(fd_2, LOCK_MAND | LOCK_READ); - - test_daemon(); - test_waitsig(); -@@ -172,11 +171,6 @@ int main(int argc, char **argv) - fail("Failed on fd %d", fd_1); - ret |= 1; - } -- if (check_file_lock(fd_2, "MSNFS", "READ", dev, inodes[2])) { -- fail("Failed on fd %d", fd_2); -- ret |= 1; -- } -- - if (!ret) - pass(); - --- -2.35.1 - diff --git a/0136-test-disable-rseq-also-on-Archlinux.patch b/0136-test-disable-rseq-also-on-Archlinux.patch deleted file mode 100644 index 56bddac..0000000 --- a/0136-test-disable-rseq-also-on-Archlinux.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 171e7e8badc051a6375dfb091da1f4f5777457d2 Mon Sep 17 00:00:00 2001 -From: Adrian Reber -Date: Tue, 15 Feb 2022 18:09:27 +0000 -Subject: [PATCH 136/249] test: disable rseq also on Archlinux - -Seems like Archlinux also uses rseq now and that breaks CRIU. -Also disable rseq on Archlinux. - -Signed-off-by: Adrian Reber ---- - scripts/build/Dockerfile.archlinux | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/scripts/build/Dockerfile.archlinux b/scripts/build/Dockerfile.archlinux -index d226244ee..b226d5701 100644 ---- a/scripts/build/Dockerfile.archlinux -+++ b/scripts/build/Dockerfile.archlinux -@@ -1,5 +1,8 @@ - FROM docker.io/library/archlinux:latest - -+# FIXME: Temporary solution for https://github.com/checkpoint-restore/criu/issues/1696 -+ENV GLIBC_TUNABLES=glibc.pthread.rseq=0 -+ - ARG CC=gcc - - RUN pacman -Syu --noconfirm \ --- -2.35.1 - diff --git a/0137-zdtm-fix-missplacement-of-err-True.patch b/0137-zdtm-fix-missplacement-of-err-True.patch deleted file mode 100644 index bad17f6..0000000 --- a/0137-zdtm-fix-missplacement-of-err-True.patch +++ /dev/null @@ -1,32 +0,0 @@ -From bc3ff0b0253ad5f8c1ab1b75707ee5bc397950e7 Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Fri, 18 Feb 2022 18:13:14 +0300 -Subject: [PATCH 137/249] zdtm: fix missplacement of err=True - -There is no 'err' argument for print(), it should be in grep_errors() in -line below. - -Fixes: bed670f62 ("zdtm: print tails of all logs if a test has failed") -Signed-off-by: Pavel Tikhomirov ---- - test/zdtm.py | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/test/zdtm.py b/test/zdtm.py -index cf73a17ae..daad1b687 100755 ---- a/test/zdtm.py -+++ b/test/zdtm.py -@@ -1485,8 +1485,8 @@ class criu: - self.__page_server_p = None - if self.__dump_process: - self.__dump_process.terminate() -- print("criu dump exited with %s" % self.__dump_process.wait(), err=True) -- grep_errors(os.path.join(self.__ddir(), "dump.log")) -+ print("criu dump exited with %s" % self.__dump_process.wait()) -+ grep_errors(os.path.join(self.__ddir(), "dump.log"), err=True) - self.__dump_process = None - if self.__img_streamer_process: - self.__img_streamer_process.terminate() --- -2.35.1 - diff --git a/0138-compel-set-mxcsr-during-error-injection-to-zero.patch b/0138-compel-set-mxcsr-during-error-injection-to-zero.patch deleted file mode 100644 index e32caf1..0000000 --- a/0138-compel-set-mxcsr-during-error-injection-to-zero.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 4070d001c35654364a7af5d757e91e1db638970e Mon Sep 17 00:00:00 2001 -From: Adrian Reber -Date: Wed, 9 Mar 2022 08:40:35 +0000 -Subject: [PATCH 138/249] compel: set mxcsr during error injection to zero - -During error injection tests there are random values loaded in some of -the registers. The kernel, however, has the following check: - - if (mxcsr[0] & ~mxcsr_feature_mask) - return -EINVAL; - -So depending on the random values loaded mxcsr might have values that -the kernel rejects with EINVAL. Setting mxcsr to zero during the tests -lets the error injection test pass. - -Signed-off-by: Adrian Reber ---- - compel/arch/x86/src/lib/infect.c | 11 +++++++++++ - 1 file changed, 11 insertions(+) - -diff --git a/compel/arch/x86/src/lib/infect.c b/compel/arch/x86/src/lib/infect.c -index de9013c27..0d3e9e9a0 100644 ---- a/compel/arch/x86/src/lib/infect.c -+++ b/compel/arch/x86/src/lib/infect.c -@@ -272,6 +272,17 @@ static void validate_random_xstate(struct xsave_struct *xsave) - - /* No reserved bits may be set */ - memset(&hdr->reserved, 0, sizeof(hdr->reserved)); -+ -+ /* -+ * While using PTRACE_SETREGSET the kernel checks that -+ * "Reserved bits in MXCSR must be zero." -+ * if (mxcsr[0] & ~mxcsr_feature_mask) -+ * return -EINVAL; -+ * -+ * As the mxcsr_feature_mask depends on the CPU the easiest solution for -+ * this error injection test is to set mxcsr just to zero. -+ */ -+ xsave->i387.mxcsr = 0; - } - - /* --- -2.35.1 - diff --git a/0139-proc_smaps-remove-useless-nonlinear-check.patch b/0139-proc_smaps-remove-useless-nonlinear-check.patch deleted file mode 100644 index 9c5c980..0000000 --- a/0139-proc_smaps-remove-useless-nonlinear-check.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 7f32e5fc410a6295a7ddbbf6eda62a577d7b940b Mon Sep 17 00:00:00 2001 -From: anatasluo -Date: Tue, 8 Mar 2022 08:34:14 +0000 -Subject: [PATCH 139/249] proc_smaps: remove useless nonlinear check - -nonlinear information has been removed since commit -1da4b35b001481df99 in kernel. - -Signed-off-by: anatasluo ---- - criu/proc_parse.c | 12 +----------- - 1 file changed, 1 insertion(+), 11 deletions(-) - -diff --git a/criu/proc_parse.c b/criu/proc_parse.c -index 13ec76e3b..5cd5e6db8 100644 ---- a/criu/proc_parse.c -+++ b/criu/proc_parse.c -@@ -754,17 +754,7 @@ int parse_smaps(pid_t pid, struct vm_area_list *vma_area_list, dump_filemap_t du - eof = (str == NULL); - - if (!eof && !__is_vma_range_fmt(str)) { -- if (!strncmp(str, "Nonlinear", 9)) { -- BUG_ON(!vma_area); -- pr_err("Nonlinear mapping found %016" PRIx64 "-%016" PRIx64 "\n", vma_area->e->start, -- vma_area->e->end); -- /* -- * VMA is already on list and will be -- * freed later as list get destroyed. -- */ -- vma_area = NULL; -- goto err; -- } else if (!strncmp(str, "VmFlags: ", 9)) { -+ if (!strncmp(str, "VmFlags: ", 9)) { - BUG_ON(!vma_area); - parse_vma_vmflags(&str[9], vma_area); - continue; --- -2.35.1 - diff --git a/0140-mount-fix-e_str-leak-in-ext_mount_add.patch b/0140-mount-fix-e_str-leak-in-ext_mount_add.patch deleted file mode 100644 index 8e81bb4..0000000 --- a/0140-mount-fix-e_str-leak-in-ext_mount_add.patch +++ /dev/null @@ -1,52 +0,0 @@ -From adb3b690cb4b2c46a38a780520fbec1afec3f464 Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Wed, 9 Mar 2022 14:32:25 +0300 -Subject: [PATCH 140/249] mount: fix e_str leak in ext_mount_add - -coverity CID 389202: -54int ext_mount_add(char *key, char *val) - 55{ - 56 char *e_str; - 57 - 1. alloc_fn: Storage is returned from allocation function malloc. - 2. var_assign: Assigning: ___p = storage returned from malloc(strlen(key) + strlen(val) + 8UL). - 3. Condition !___p, taking false branch. - 4. leaked_storage: Variable ___p going out of scope leaks the storage it points to. - 5. var_assign: Assigning: e_str = ({...; ___p;}). - 58 e_str = xmalloc(strlen(key) + strlen(val) + 8); - 6. Condition !e_str, taking false branch. - 59 if (!e_str) - 60 return -1; -... - 7. noescape: Resource e_str is not freed or pointed-to in sprintf. - 73 sprintf(e_str, "mnt[%s]:%s", key, val); - 8. noescape: Resource e_str is not freed or pointed-to in add_external. [show details] - CID 389202 (#1 of 1): Resource leak (RESOURCE_LEAK)9. leaked_storage: Variable e_str going out of scope leaks the storage it points to. - 74 return add_external(e_str); - 75} - -We need to free e_str after add_external used it. - -v2: use cleanup_free attribute (@adrianreber) - -Signed-off-by: Pavel Tikhomirov ---- - criu/mount.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/criu/mount.c b/criu/mount.c -index 4b57ac703..c301aaeeb 100644 ---- a/criu/mount.c -+++ b/criu/mount.c -@@ -55,7 +55,7 @@ static LIST_HEAD(delayed_unbindable); - - int ext_mount_add(char *key, char *val) - { -- char *e_str; -+ cleanup_free char *e_str = NULL; - - e_str = xmalloc(strlen(key) + strlen(val) + 8); - if (!e_str) --- -2.35.1 - diff --git a/0141-cr-dump-fix-cr_imgset-leak-in-dump_one_task.patch b/0141-cr-dump-fix-cr_imgset-leak-in-dump_one_task.patch deleted file mode 100644 index a71f590..0000000 --- a/0141-cr-dump-fix-cr_imgset-leak-in-dump_one_task.patch +++ /dev/null @@ -1,124 +0,0 @@ -From 127c80e070b650958793fd9967d18fca3aa93594 Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Wed, 9 Mar 2022 15:14:50 +0300 -Subject: [PATCH 141/249] cr-dump: fix cr_imgset leak in dump_one_task - -coverity CID 389194: - -1238static int dump_one_task(struct pstree_item *item, InventoryEntry *parent_ie) -1239{ -... -1245 struct cr_imgset *cr_imgset = NULL; -... - 11. alloc_fn: Storage is returned from allocation function cr_task_imgset_open. [show details] - 12. var_assign: Assigning: cr_imgset = storage returned from cr_task_imgset_open(vpid(item), 577). -1355 cr_imgset = cr_task_imgset_open(vpid(item), O_DUMP); - 13. Condition !cr_imgset, taking false branch. -1356 if (!cr_imgset) -1357 goto err_cure; -1358 -... - 25. Condition opts.lazy_pages, taking false branch. -1427 if (opts.lazy_pages) -1428 ret = compel_cure_remote(parasite_ctl); -1429 else -1430 ret = compel_cure(parasite_ctl); - 26. Condition ret, taking true branch. -1431 if (ret) { -1432 pr_err("Can't cure (pid: %d) from parasite\n", pid); - 27. Jumping to label err. -1433 goto err; -1434 } -... -1448 close_cr_imgset(&cr_imgset); -1449 exit_code = 0; -1450err: -1451 close_pid_proc(); -1452 free_mappings(&vmas); -1453 xfree(dfds); - CID 389194 (#1 of 1): Resource leak (RESOURCE_LEAK)28. leaked_storage: Variable cr_imgset going out of scope leaks the storage it points to. -1454 return exit_code; -1455 -1456err_cure: -1457 close_cr_imgset(&cr_imgset); -1458err_cure_imgset: -1459 ret = compel_cure(parasite_ctl); -1460 if (ret) -1461 pr_err("Can't cure (pid: %d) from parasite\n", pid); -1462 goto err; -1463} - -On compel_cure() error path we do not do close_cr_imgset() thich leads -to leaked cr_imgset, let's move corresponding close_cr_imgset below err -label. Also now we can merge remove close_cr_imgset() in err_cure label -as it goes to err label later anyway. Separate err_cure_imgset label is -not needed as close_cr_imgset() is ready for cr_imgset == NULL. - -v2: remove excess close_cr_imgset() in label err_cure (@adrianreber) - -Signed-off-by: Pavel Tikhomirov ---- - criu/cr-dump.c | 14 ++++++-------- - 1 file changed, 6 insertions(+), 8 deletions(-) - -diff --git a/criu/cr-dump.c b/criu/cr-dump.c -index c972e343a..eb1fb5e9a 100644 ---- a/criu/cr-dump.c -+++ b/criu/cr-dump.c -@@ -1315,29 +1315,29 @@ static int dump_one_task(struct pstree_item *item, InventoryEntry *parent_ie) - pfd = parasite_get_proc_fd_seized(parasite_ctl); - if (pfd < 0) { - pr_err("Can't get proc fd (pid: %d)\n", pid); -- goto err_cure_imgset; -+ goto err_cure; - } - - if (install_service_fd(CR_PROC_FD_OFF, pfd) < 0) -- goto err_cure_imgset; -+ goto err_cure; - } - - ret = parasite_fixup_vdso(parasite_ctl, pid, &vmas); - if (ret) { - pr_err("Can't fixup vdso VMAs (pid: %d)\n", pid); -- goto err_cure_imgset; -+ goto err_cure; - } - - ret = parasite_collect_aios(parasite_ctl, &vmas); /* FIXME -- merge with above */ - if (ret) { - pr_err("Failed to check aio rings (pid: %d)\n", pid); -- goto err_cure_imgset; -+ goto err_cure; - } - - ret = parasite_dump_misc_seized(parasite_ctl, &misc); - if (ret) { - pr_err("Can't dump misc (pid: %d)\n", pid); -- goto err_cure_imgset; -+ goto err_cure; - } - - item->pid->ns[0].virt = misc.pid; -@@ -1445,17 +1445,15 @@ static int dump_one_task(struct pstree_item *item, InventoryEntry *parent_ie) - goto err; - } - -- close_cr_imgset(&cr_imgset); - exit_code = 0; - err: -+ close_cr_imgset(&cr_imgset); - close_pid_proc(); - free_mappings(&vmas); - xfree(dfds); - return exit_code; - - err_cure: -- close_cr_imgset(&cr_imgset); --err_cure_imgset: - ret = compel_cure(parasite_ctl); - if (ret) - pr_err("Can't cure (pid: %d) from parasite\n", pid); --- -2.35.1 - diff --git a/0142-tun-fix-tun_link-leak-in-dump_tun_link.patch b/0142-tun-fix-tun_link-leak-in-dump_tun_link.patch deleted file mode 100644 index 282ca0a..0000000 --- a/0142-tun-fix-tun_link-leak-in-dump_tun_link.patch +++ /dev/null @@ -1,66 +0,0 @@ -From 1b75d6dc2c1bf12bc9fdbb6093f8e6a6e469fea4 Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Wed, 9 Mar 2022 13:52:00 +0300 -Subject: [PATCH 142/249] tun: fix tun_link leak in dump_tun_link - -coverity CID 389205: - -452int dump_tun_link(NetDeviceEntry *nde, struct cr_imgset *fds, struct nlattr **info) -453{ -... -458 struct tun_link *tl; -... - 2. alloc_fn: Storage is returned from allocation function get_tun_link_fd. [show details] - 3. var_assign: Assigning: tl = storage returned from get_tun_link_fd(nde->name, nde->peer_nsid, tle.flags). -475 tl = get_tun_link_fd(nde->name, nde->peer_nsid, tle.flags); - 4. Condition !tl, taking false branch. -476 if (!tl) -477 return ret; -478 -479 tle.vnethdr = tl->dmp.vnethdr; -480 tle.sndbuf = tl->dmp.sndbuf; -481 -482 nde->tun = &tle; - CID 389205 (#1 of 1): Resource leak (RESOURCE_LEAK)5. leaked_storage: Variable tl going out of scope leaks the storage it points to. -483 return write_netdev_img(nde, fds, info); -484} - -Function get_tun_link_fd() can both return tun_link entry from tun_links -list and a newly allocated one. So we should not free entry if it is -from list and should free it when it is a new one to fix leak. - -Signed-off-by: Pavel Tikhomirov ---- - criu/tun.c | 9 +++++++++ - 1 file changed, 9 insertions(+) - -diff --git a/criu/tun.c b/criu/tun.c -index 2a2f950da..bc84604b3 100644 ---- a/criu/tun.c -+++ b/criu/tun.c -@@ -155,6 +155,7 @@ static struct tun_link *__dump_tun_link_fd(int fd, char *name, unsigned ns_id, u - goto err; - strlcpy(tl->name, name, sizeof(tl->name)); - tl->ns_id = ns_id; -+ INIT_LIST_HEAD(&tl->l); - - if (ioctl(fd, TUNGETVNETHDRSZ, &tl->dmp.vnethdr) < 0) { - pr_perror("Can't dump vnethdr size for %s", name); -@@ -479,6 +480,14 @@ int dump_tun_link(NetDeviceEntry *nde, struct cr_imgset *fds, struct nlattr **in - tle.vnethdr = tl->dmp.vnethdr; - tle.sndbuf = tl->dmp.sndbuf; - -+ /* -+ * Function get_tun_link_fd() can return either entry -+ * from tun_links list or a newly allocated one, need to -+ * free it only if not in list. -+ */ -+ if (list_empty(&tl->l)) -+ xfree(tl); -+ - nde->tun = &tle; - return write_netdev_img(nde, fds, info); - } --- -2.35.1 - diff --git a/0143-sk-unix-fix-uint32_t-id-variable-printf-format-speci.patch b/0143-sk-unix-fix-uint32_t-id-variable-printf-format-speci.patch deleted file mode 100644 index 89a1035..0000000 --- a/0143-sk-unix-fix-uint32_t-id-variable-printf-format-speci.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 7606fae91db532ba535799764a04de75598a4e59 Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Thu, 10 Mar 2022 13:35:50 +0300 -Subject: [PATCH 143/249] sk-unix: fix uint32_t id variable printf format - specifier - -coverity CID 389193: -CID 389193 (#1 of 1): Printf format string issue (PW.BAD_PRINTF_FORMAT_STRING) -1. bad_printf_format_string: invalid format string conversion -598 pr_warn("Can't stat socket %#x(%s), skipping: %m (err %d)\n", id, rpath, errno); - -Specifier "%#x" is wrong for id as it is of type uint32_t, let's change -it to "%#" PRIx32 "" to fix the problem. - -Signed-off-by: Pavel Tikhomirov ---- - criu/sk-unix.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/criu/sk-unix.c b/criu/sk-unix.c -index 194193dff..90c9eb11b 100644 ---- a/criu/sk-unix.c -+++ b/criu/sk-unix.c -@@ -595,7 +595,7 @@ static int unix_resolve_name_old(int lfd, uint32_t id, struct unix_sk_desc *d, U - snprintf(rpath, sizeof(rpath), ".%s", name); - if (fstatat(mntns_root, rpath, &st, 0)) { - if (errno != ENOENT) { -- pr_warn("Can't stat socket %#x(%s), skipping: %m (err %d)\n", id, rpath, errno); -+ pr_warn("Can't stat socket %#" PRIx32 "(%s), skipping: %m (err %d)\n", id, rpath, errno); - goto skip; - } - --- -2.35.1 - diff --git a/0144-zdtm-refactor-main.patch b/0144-zdtm-refactor-main.patch deleted file mode 100644 index f7e3886..0000000 --- a/0144-zdtm-refactor-main.patch +++ /dev/null @@ -1,459 +0,0 @@ -From e2ddf69cb3dd07c084a6f62f26638cbe4b29d6ae Mon Sep 17 00:00:00 2001 -From: Radostin Stoyanov -Date: Sat, 24 Jul 2021 12:19:22 +0100 -Subject: [PATCH 144/249] zdtm: refactor main - -This patch improves the readability of zdtm by refactoring the top-level -code into a main function. - -https://docs.python.org/3/library/__main__.html - -Signed-off-by: Radostin Stoyanov ---- - test/zdtm.py | 390 ++++++++++++++++++++++++++------------------------- - 1 file changed, 199 insertions(+), 191 deletions(-) - -diff --git a/test/zdtm.py b/test/zdtm.py -index daad1b687..9ad9ab24e 100755 ---- a/test/zdtm.py -+++ b/test/zdtm.py -@@ -28,8 +28,6 @@ import pycriu as crpc - - import yaml - --os.chdir(os.path.dirname(os.path.abspath(__file__))) -- - # File to store content of streamed images - STREAMED_IMG_FILE_NAME = "img.criu" - -@@ -40,9 +38,6 @@ def alarm(*args): - print("==== ALARM ====") - - --signal.signal(signal.SIGALRM, alarm) -- -- - def traceit(f, e, a): - if e == "line": - lineno = f.f_lineno -@@ -2511,19 +2506,19 @@ class group: - self.__dump_meta(fname, '.hook') - - --def group_tests(opts): -+def group_tests(cli_opts): - excl = None - groups = [] - pend_groups = [] -- maxs = int(opts['max_size']) -+ maxs = int(cli_opts['max_size']) - - if not os.access("groups", os.F_OK): - os.mkdir("groups") - -- tlist = all_tests(opts) -+ tlist = all_tests(cli_opts) - random.shuffle(tlist) -- if opts['exclude']: -- excl = re.compile(".*(" + "|".join(opts['exclude']) + ")") -+ if cli_opts['exclude']: -+ excl = re.compile(".*(" + "|".join(cli_opts['exclude']) + ")") - print("Compiled exclusion list") - - for t in tlist: -@@ -2545,7 +2540,7 @@ def group_tests(opts): - groups += pend_groups - - nr = 0 -- suf = opts['name'] or 'group' -+ suf = cli_opts['name'] or 'group' - - for g in groups: - if maxs > 1 and g.size() == 1: # Not much point in group test for this -@@ -2570,190 +2565,203 @@ def set_nr_hugepages(nr): - orig_hugepages = 0 - with open("/proc/sys/vm/nr_hugepages", "r") as f: - orig_hugepages = int(f.read()) -- - with open("/proc/sys/vm/nr_hugepages", "w") as f: - f.write("{}\n".format(nr)) -- - return orig_hugepages - - --# --# main() starts here --# -+def get_cli_args(): -+ """ -+ Parse command-line arguments -+ """ -+ p = argparse.ArgumentParser("CRIU test suite") -+ p.add_argument("--debug", -+ help="Print what's being executed", -+ action='store_true') -+ p.add_argument("--set", help="Which set of tests to use", default='zdtm') -+ -+ sp = p.add_subparsers(help="Use --help for list of actions") -+ -+ rp = sp.add_parser("run", help="Run test(s)") -+ rp.set_defaults(action=run_tests) -+ rp.add_argument("-a", "--all", action='store_true') -+ rp.add_argument("-t", "--test", help="Test name", action='append') -+ rp.add_argument("-T", "--tests", help="Regexp") -+ rp.add_argument("-F", "--from", help="From file") -+ rp.add_argument("-f", "--flavor", help="Flavor to run") -+ rp.add_argument("-x", -+ "--exclude", -+ help="Exclude tests from --all run", -+ action='append') -+ -+ rp.add_argument("--sibling", -+ help="Restore tests as siblings", -+ action='store_true') -+ rp.add_argument("--join-ns", -+ help="Restore tests and join existing namespace", -+ action='store_true') -+ rp.add_argument("--empty-ns", -+ help="Restore tests in empty net namespace", -+ action='store_true') -+ rp.add_argument("--pre", help="Do some pre-dumps before dump (n[:pause])") -+ rp.add_argument("--snaps", -+ help="Instead of pre-dumps do full dumps", -+ action='store_true') -+ rp.add_argument("--dedup", -+ help="Auto-deduplicate images on iterations", -+ action='store_true') -+ rp.add_argument("--noauto-dedup", -+ help="Manual deduplicate images on iterations", -+ action='store_true') -+ rp.add_argument("--nocr", -+ help="Do not CR anything, just check test works", -+ action='store_true') -+ rp.add_argument("--norst", -+ help="Don't restore tasks, leave them running after dump", -+ action='store_true') -+ rp.add_argument("--stop", -+ help="Check that --leave-stopped option stops ps tree.", -+ action='store_true') -+ rp.add_argument("--iters", -+ help="Do CR cycle several times before check (n[:pause])") -+ rp.add_argument("--fault", help="Test fault injection") -+ rp.add_argument( -+ "--sat", -+ help="Generate criu strace-s for sat tool (restore is fake, images are kept)", -+ action='store_true') -+ rp.add_argument( -+ "--sbs", -+ help="Do step-by-step execution, asking user for keypress to continue", -+ action='store_true') -+ rp.add_argument("--freezecg", help="Use freeze cgroup (path:state)") -+ rp.add_argument("--user", help="Run CRIU as regular user", -+ action='store_true') -+ rp.add_argument("--rpc", -+ help="Run CRIU via RPC rather than CLI", -+ action='store_true') -+ -+ rp.add_argument("--page-server", -+ help="Use page server dump", -+ action='store_true') -+ rp.add_argument("--stream", -+ help="Use criu-image-streamer", -+ action='store_true') -+ rp.add_argument("-p", "--parallel", help="Run test in parallel") -+ rp.add_argument("--dry-run", -+ help="Don't run tests, just pretend to", -+ action='store_true') -+ rp.add_argument("--script", help="Add script to get notified by criu") -+ rp.add_argument("-k", -+ "--keep-img", -+ help="Whether or not to keep images after test", -+ choices=['always', 'never', 'failed'], -+ default='failed') -+ rp.add_argument("--report", help="Generate summary report in directory") -+ rp.add_argument("--keep-going", -+ help="Keep running tests in spite of failures", -+ action='store_true') -+ rp.add_argument("--ignore-taint", -+ help="Don't care about a non-zero kernel taint flag", -+ action='store_true') -+ rp.add_argument("--lazy-pages", -+ help="restore pages on demand", -+ action='store_true') -+ rp.add_argument("--lazy-migrate", -+ help="restore pages on demand", -+ action='store_true') -+ rp.add_argument("--remote-lazy-pages", -+ help="simulate lazy migration", -+ action='store_true') -+ rp.add_argument("--tls", help="use TLS for migration", action='store_true') -+ rp.add_argument("--title", help="A test suite title", default="criu") -+ rp.add_argument("--show-stats", -+ help="Show criu statistics", -+ action='store_true') -+ rp.add_argument("--criu-bin", -+ help="Path to criu binary", -+ default='../criu/criu') -+ rp.add_argument("--crit-bin", -+ help="Path to crit binary", -+ default='../crit/crit') -+ rp.add_argument("--criu-image-streamer-dir", -+ help="Directory where the criu-image-streamer binary is located", -+ default="../../criu-image-streamer") -+ rp.add_argument("--pre-dump-mode", -+ help="Use splice or read mode of pre-dumping", -+ choices=['splice', 'read'], -+ default='splice') -+ -+ lp = sp.add_parser("list", help="List tests") -+ lp.set_defaults(action=list_tests) -+ lp.add_argument('-i', -+ '--info', -+ help="Show more info about tests", -+ action='store_true') -+ -+ gp = sp.add_parser("group", help="Generate groups") -+ gp.set_defaults(action=group_tests) -+ gp.add_argument("-m", "--max-size", -+ help="Maximum number of tests in group") -+ gp.add_argument("-n", "--name", help="Common name for group tests") -+ gp.add_argument("-x", -+ "--exclude", -+ help="Exclude tests from --all run", -+ action='append') -+ -+ cp = sp.add_parser("clean", help="Clean something") -+ cp.set_defaults(action=clean_stuff) -+ cp.add_argument("what", choices=['nsroot']) -+ -+ return vars(p.parse_args()) -+ -+ -+def waitpid_and_rip_zombies(pid): -+ """ -+ Collect this namespace's zombies -+ """ -+ while True: -+ wpid, status = os.wait() -+ if wpid == pid: -+ if os.WIFEXITED(status): -+ return os.WEXITSTATUS(status) -+ return 1 -+ -+ -+def fork_zdtm(): -+ """ -+ Fork here, since we're new pidns init and are supposed to -+ collect this namespace's zombies -+ """ -+ if 'CR_CT_TEST_INFO' in os.environ: -+ status = 0 -+ pid = os.fork() -+ if pid == 0: -+ tinfo = eval(os.environ['CR_CT_TEST_INFO']) -+ do_run_test(tinfo[0], tinfo[1], tinfo[2], tinfo[3]) -+ else: -+ status = waitpid_and_rip_zombies(pid) -+ sys.exit(status) - --if 'CR_CT_TEST_INFO' in os.environ: -- # Fork here, since we're new pidns init and are supposed to -- # collect this namespace's zombies -- status = 0 -- pid = os.fork() -- if pid == 0: -- tinfo = eval(os.environ['CR_CT_TEST_INFO']) -- do_run_test(tinfo[0], tinfo[1], tinfo[2], tinfo[3]) -- else: -- while True: -- wpid, status = os.wait() -- if wpid == pid: -- if os.WIFEXITED(status): -- status = os.WEXITSTATUS(status) -- else: -- status = 1 -- break - -- sys.exit(status) -- --p = argparse.ArgumentParser("CRIU test suite") --p.add_argument("--debug", -- help="Print what's being executed", -- action='store_true') --p.add_argument("--set", help="Which set of tests to use", default='zdtm') -- --sp = p.add_subparsers(help="Use --help for list of actions") -- --rp = sp.add_parser("run", help="Run test(s)") --rp.set_defaults(action=run_tests) --rp.add_argument("-a", "--all", action='store_true') --rp.add_argument("-t", "--test", help="Test name", action='append') --rp.add_argument("-T", "--tests", help="Regexp") --rp.add_argument("-F", "--from", help="From file") --rp.add_argument("-f", "--flavor", help="Flavor to run") --rp.add_argument("-x", -- "--exclude", -- help="Exclude tests from --all run", -- action='append') -- --rp.add_argument("--sibling", -- help="Restore tests as siblings", -- action='store_true') --rp.add_argument("--join-ns", -- help="Restore tests and join existing namespace", -- action='store_true') --rp.add_argument("--empty-ns", -- help="Restore tests in empty net namespace", -- action='store_true') --rp.add_argument("--pre", help="Do some pre-dumps before dump (n[:pause])") --rp.add_argument("--snaps", -- help="Instead of pre-dumps do full dumps", -- action='store_true') --rp.add_argument("--dedup", -- help="Auto-deduplicate images on iterations", -- action='store_true') --rp.add_argument("--noauto-dedup", -- help="Manual deduplicate images on iterations", -- action='store_true') --rp.add_argument("--nocr", -- help="Do not CR anything, just check test works", -- action='store_true') --rp.add_argument("--norst", -- help="Don't restore tasks, leave them running after dump", -- action='store_true') --rp.add_argument("--stop", -- help="Check that --leave-stopped option stops ps tree.", -- action='store_true') --rp.add_argument("--iters", -- help="Do CR cycle several times before check (n[:pause])") --rp.add_argument("--fault", help="Test fault injection") --rp.add_argument( -- "--sat", -- help="Generate criu strace-s for sat tool (restore is fake, images are kept)", -- action='store_true') --rp.add_argument( -- "--sbs", -- help="Do step-by-step execution, asking user for keypress to continue", -- action='store_true') --rp.add_argument("--freezecg", help="Use freeze cgroup (path:state)") --rp.add_argument("--user", help="Run CRIU as regular user", action='store_true') --rp.add_argument("--rpc", -- help="Run CRIU via RPC rather than CLI", -- action='store_true') -- --rp.add_argument("--page-server", -- help="Use page server dump", -- action='store_true') --rp.add_argument("--stream", -- help="Use criu-image-streamer", -- action='store_true') --rp.add_argument("-p", "--parallel", help="Run test in parallel") --rp.add_argument("--dry-run", -- help="Don't run tests, just pretend to", -- action='store_true') --rp.add_argument("--script", help="Add script to get notified by criu") --rp.add_argument("-k", -- "--keep-img", -- help="Whether or not to keep images after test", -- choices=['always', 'never', 'failed'], -- default='failed') --rp.add_argument("--report", help="Generate summary report in directory") --rp.add_argument("--keep-going", -- help="Keep running tests in spite of failures", -- action='store_true') --rp.add_argument("--ignore-taint", -- help="Don't care about a non-zero kernel taint flag", -- action='store_true') --rp.add_argument("--lazy-pages", -- help="restore pages on demand", -- action='store_true') --rp.add_argument("--lazy-migrate", -- help="restore pages on demand", -- action='store_true') --rp.add_argument("--remote-lazy-pages", -- help="simulate lazy migration", -- action='store_true') --rp.add_argument("--tls", help="use TLS for migration", action='store_true') --rp.add_argument("--title", help="A test suite title", default="criu") --rp.add_argument("--show-stats", -- help="Show criu statistics", -- action='store_true') --rp.add_argument("--criu-bin", -- help="Path to criu binary", -- default='../criu/criu') --rp.add_argument("--crit-bin", -- help="Path to crit binary", -- default='../crit/crit') --rp.add_argument("--criu-image-streamer-dir", -- help="Directory where the criu-image-streamer binary is located", -- default="../../criu-image-streamer") --rp.add_argument("--pre-dump-mode", -- help="Use splice or read mode of pre-dumping", -- choices=['splice', 'read'], -- default='splice') -- --lp = sp.add_parser("list", help="List tests") --lp.set_defaults(action=list_tests) --lp.add_argument('-i', -- '--info', -- help="Show more info about tests", -- action='store_true') -- --gp = sp.add_parser("group", help="Generate groups") --gp.set_defaults(action=group_tests) --gp.add_argument("-m", "--max-size", help="Maximum number of tests in group") --gp.add_argument("-n", "--name", help="Common name for group tests") --gp.add_argument("-x", -- "--exclude", -- help="Exclude tests from --all run", -- action='append') -- --cp = sp.add_parser("clean", help="Clean something") --cp.set_defaults(action=clean_stuff) --cp.add_argument("what", choices=['nsroot']) -- --opts = vars(p.parse_args()) --if opts.get('sat', False): -- opts['keep_img'] = 'always' -- --if opts['debug']: -- sys.settrace(traceit) -- --if opts['action'] == 'run': -- criu.available() --for tst in test_classes.values(): -- tst.available() -- --orig_hugepages = set_nr_hugepages(20) -- --opts['action'](opts) -- --set_nr_hugepages(orig_hugepages) -- --for tst in test_classes.values(): -- tst.cleanup() -+if __name__ == '__main__': -+ os.chdir(os.path.dirname(os.path.abspath(__file__))) -+ signal.signal(signal.SIGALRM, alarm) -+ fork_zdtm() -+ opts = get_cli_args() -+ if opts.get('sat', False): -+ opts['keep_img'] = 'always' -+ -+ if opts['debug']: -+ sys.settrace(traceit) -+ -+ if opts['action'] == 'run': -+ criu.available() -+ for tst in test_classes.values(): -+ tst.available() -+ -+ orig_hugepages = set_nr_hugepages(20) -+ opts['action'](opts) -+ set_nr_hugepages(orig_hugepages) -+ -+ for tst in test_classes.values(): -+ tst.cleanup() --- -2.35.1 - diff --git a/0145-zdtm-sort-import-lines.patch b/0145-zdtm-sort-import-lines.patch deleted file mode 100644 index ff900fa..0000000 --- a/0145-zdtm-sort-import-lines.patch +++ /dev/null @@ -1,70 +0,0 @@ -From d96e617d0374ea0b660b9b97ef5f81adeac29b3e Mon Sep 17 00:00:00 2001 -From: Radostin Stoyanov -Date: Sun, 15 Aug 2021 10:27:37 +0100 -Subject: [PATCH 145/249] zdtm: sort import lines - -These changes have been auto-generated with: - - pip3 install isort autoflake - isort -rc -sl zdtm.py - autoflake --remove-all-unused-imports -i zdtm.py - isort -rc -m 3 zdtm.py - -Signed-off-by: Radostin Stoyanov ---- - test/zdtm.py | 17 +++++++++++------ - 1 file changed, 11 insertions(+), 6 deletions(-) - -diff --git a/test/zdtm.py b/test/zdtm.py -index 9ad9ab24e..bb4a4c3b9 100755 ---- a/test/zdtm.py -+++ b/test/zdtm.py -@@ -1,5 +1,10 @@ - #!/usr/bin/env python --from __future__ import absolute_import, division, print_function, unicode_literals -+from __future__ import ( -+ absolute_import, -+ division, -+ print_function, -+ unicode_literals -+) - - import argparse - import atexit -@@ -14,6 +19,7 @@ import random - import re - import shutil - import signal -+import socket - import stat - import string - import struct -@@ -21,13 +27,12 @@ import subprocess - import sys - import tempfile - import time --import socket --from builtins import (input, int, open, range, str, zip) -- --import pycriu as crpc -+from builtins import input, int, open, range, str, zip - - import yaml - -+import pycriu as crpc -+ - # File to store content of streamed images - STREAMED_IMG_FILE_NAME = "img.criu" - -@@ -1933,7 +1938,7 @@ class Launcher: - - if opts['report'] and (opts['keep_going'] or self.__total == 1): - global TestSuite, TestCase -- from junit_xml import TestSuite, TestCase -+ from junit_xml import TestCase, TestSuite - now = datetime.datetime.now() - att = 0 - reportname = os.path.join(report_dir, "criu-testreport.tap") --- -2.35.1 - diff --git a/0146-zdtm-use-long-form-cli-options.patch b/0146-zdtm-use-long-form-cli-options.patch deleted file mode 100644 index b1f53e5..0000000 --- a/0146-zdtm-use-long-form-cli-options.patch +++ /dev/null @@ -1,77 +0,0 @@ -From 3ca5c1a6d43be4e21c2db457ed6963049b56b594 Mon Sep 17 00:00:00 2001 -From: Radostin Stoyanov -Date: Sun, 15 Aug 2021 10:53:29 +0100 -Subject: [PATCH 146/249] zdtm: use long form cli options - -Using long-form command-line options would allows us to provide -them via config file to CRIU. - -Signed-off-by: Radostin Stoyanov ---- - test/zdtm.py | 18 ++++++++++-------- - 1 file changed, 10 insertions(+), 8 deletions(-) - -diff --git a/test/zdtm.py b/test/zdtm.py -index bb4a4c3b9..d02b42814 100755 ---- a/test/zdtm.py -+++ b/test/zdtm.py -@@ -560,7 +560,7 @@ class zdtm_test: - opts += ["--root", self.__flavor.root] - if test_flag(self.__desc, 'crlib'): - opts += [ -- "-L", -+ "--libdir", - os.path.dirname(os.path.realpath(self.__name)) + '/lib' - ] - return opts -@@ -899,14 +899,14 @@ class criu_rpc: - def __set_opts(criu, args, ctx): - while len(args) != 0: - arg = args.pop(0) -- if "-v4" == arg: -+ if "--verbosity=4" == arg: - criu.opts.log_level = 4 -- elif "-o" == arg: -+ elif "--log-file" == arg: - criu.opts.log_file = args.pop(0) -- elif "-D" == arg: -+ elif "--images-dir" == arg: - criu.opts.images_dir_fd = os.open(args.pop(0), os.O_DIRECTORY) - ctx['imgd'] = criu.opts.images_dir_fd -- elif "-t" == arg: -+ elif "--tree" == arg: - criu.opts.pid = int(args.pop(0)) - elif "--pidfile" == arg: - ctx['pidf'] = args.pop(0) -@@ -1118,7 +1118,8 @@ class criu: - if not log: - log = action + ".log" - -- s_args = ["-o", log, "-D", self.__ddir(), "-v4"] + opts -+ s_args = ["--log-file", log, "--images-dir", self.__ddir(), -+ "--verbosity=4"] + opts - - with open(os.path.join(self.__ddir(), action + '.cropt'), 'w') as f: - f.write(' '.join(s_args) + '\n') -@@ -1316,7 +1317,7 @@ class criu: - os.mkdir(self.__ddir()) - os.chmod(self.__ddir(), 0o777) - -- a_opts = ["-t", self.__test.getpid()] -+ a_opts = ["--tree", self.__test.getpid()] - if self.__prev_dump_iter: - a_opts += [ - "--prev-images-dir", -@@ -1461,7 +1462,8 @@ class criu: - return False - - return criu_cli.run( -- "check", ["--no-default-config", "-v0", "--feature", feature], -+ "check", -+ ["--no-default-config", "--verbosity=0", "--feature", feature], - opts['criu_bin']) == 0 - - @staticmethod --- -2.35.1 - diff --git a/0147-zdtm-add-criu-config-option.patch b/0147-zdtm-add-criu-config-option.patch deleted file mode 100644 index ea8f054..0000000 --- a/0147-zdtm-add-criu-config-option.patch +++ /dev/null @@ -1,127 +0,0 @@ -From 37f9d07f8d4dd955d0cc4bf8d08adcff01ba5001 Mon Sep 17 00:00:00 2001 -From: Radostin Stoyanov -Date: Sun, 15 Aug 2021 10:58:32 +0100 -Subject: [PATCH 147/249] zdtm: add --criu-config option - -The --criu-config option allows to run test with CRIU options provided -via configuration files instead of command-line arguments. - -Suggested-by: Andrei Vagin -Signed-off-by: Radostin Stoyanov ---- - test/zdtm.py | 16 ++++++++++++--- - test/zdtm/__init__.py | 0 - test/zdtm/criu_config.py | 42 ++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 55 insertions(+), 3 deletions(-) - create mode 100644 test/zdtm/__init__.py - create mode 100644 test/zdtm/criu_config.py - -diff --git a/test/zdtm.py b/test/zdtm.py -index d02b42814..3fbdb8a18 100755 ---- a/test/zdtm.py -+++ b/test/zdtm.py -@@ -32,6 +32,7 @@ from builtins import input, int, open, range, str, zip - import yaml - - import pycriu as crpc -+from zdtm.criu_config import criu_config - - # File to store content of streamed images - STREAMED_IMG_FILE_NAME = "img.criu" -@@ -1036,7 +1037,6 @@ class criu: - self.__user = bool(opts['user']) - self.__leave_stopped = bool(opts['stop']) - self.__stream = bool(opts['stream']) -- self.__criu = (opts['rpc'] and criu_rpc or criu_cli) - self.__show_stats = bool(opts['show_stats']) - self.__lazy_pages_p = None - self.__page_server_p = None -@@ -1047,6 +1047,13 @@ class criu: - self.__crit_bin = opts['crit_bin'] - self.__pre_dump_mode = opts['pre_dump_mode'] - -+ if opts['rpc']: -+ self.__criu = criu_rpc -+ elif opts['criu_config']: -+ self.__criu = criu_config -+ else: -+ self.__criu = criu_cli -+ - def fini(self): - if self.__lazy_migrate: - ret = self.__dump_process.wait() -@@ -2024,8 +2031,8 @@ class Launcher: - - nd = ('nocr', 'norst', 'pre', 'iters', 'page_server', 'sibling', - 'stop', 'empty_ns', 'fault', 'keep_img', 'report', 'snaps', -- 'sat', 'script', 'rpc', 'lazy_pages', 'join_ns', 'dedup', 'sbs', -- 'freezecg', 'user', 'dry_run', 'noauto_dedup', -+ 'sat', 'script', 'rpc', 'criu_config', 'lazy_pages', 'join_ns', -+ 'dedup', 'sbs', 'freezecg', 'user', 'dry_run', 'noauto_dedup', - 'remote_lazy_pages', 'show_stats', 'lazy_migrate', 'stream', - 'tls', 'criu_bin', 'crit_bin', 'pre_dump_mode') - arg = repr((name, desc, flavor, {d: self.__opts[d] for d in nd})) -@@ -2647,6 +2654,9 @@ def get_cli_args(): - help="Run CRIU via RPC rather than CLI", - action='store_true') - -+ rp.add_argument("--criu-config", -+ help="Use config file to set CRIU options", -+ action='store_true') - rp.add_argument("--page-server", - help="Use page server dump", - action='store_true') -diff --git a/test/zdtm/__init__.py b/test/zdtm/__init__.py -new file mode 100644 -index 000000000..e69de29bb -diff --git a/test/zdtm/criu_config.py b/test/zdtm/criu_config.py -new file mode 100644 -index 000000000..487becfb4 ---- /dev/null -+++ b/test/zdtm/criu_config.py -@@ -0,0 +1,42 @@ -+import os -+import tempfile -+import subprocess -+ -+ -+class criu_config: -+ @staticmethod -+ def run(action, -+ args, -+ criu_bin, -+ fault=None, -+ strace=[], -+ preexec=None, -+ nowait=False): -+ -+ config_path = tempfile.mktemp(".conf", "criu-%s-" % action) -+ with open(config_path, "w") as config_fd: -+ for arg in args: -+ if arg.startswith("--"): -+ config_fd.write("\n") -+ arg = arg.strip("-") -+ config_fd.write("%s " % arg) -+ -+ env = dict( -+ os.environ, -+ ASAN_OPTIONS="log_path=asan.log:disable_coredump=0:detect_leaks=0" -+ ) -+ -+ if fault: -+ print("Forcing %s fault" % fault) -+ env['CRIU_FAULT'] = fault -+ -+ cr = subprocess.Popen( -+ strace + -+ [criu_bin, action, "--no-default-config", "--config", config_path], -+ env=env, -+ close_fds=False, -+ preexec_fn=preexec -+ ) -+ if nowait: -+ return cr -+ return cr.wait() --- -2.35.1 - diff --git a/0148-zdtm-drop-redundant-config_inotify_irmap-test.patch b/0148-zdtm-drop-redundant-config_inotify_irmap-test.patch deleted file mode 100644 index d96aa88..0000000 --- a/0148-zdtm-drop-redundant-config_inotify_irmap-test.patch +++ /dev/null @@ -1,174 +0,0 @@ -From 29a1d9868d8e0f1de630cb31e3687db24636118f Mon Sep 17 00:00:00 2001 -From: Radostin Stoyanov -Date: Sun, 15 Aug 2021 11:16:28 +0100 -Subject: [PATCH 148/249] zdtm: drop redundant config_inotify_irmap test - -The config_inotify_irmap test duplicates inotify_irmap with slight -change to add the --force-irmap and --irmap-scan-path options in -a configuration file. - -The --criu-config option of ZDTM provides more general solution -for testing CRIU options provided in configuration files. - -Signed-off-by: Radostin Stoyanov ---- - scripts/ci/Makefile | 2 +- - test/Makefile | 2 +- - test/zdtm/static/Makefile | 1 - - test/zdtm/static/config_inotify_irmap.c | 95 ---------------------- - test/zdtm/static/config_inotify_irmap.desc | 3 - - 5 files changed, 2 insertions(+), 101 deletions(-) - delete mode 100644 test/zdtm/static/config_inotify_irmap.c - delete mode 100644 test/zdtm/static/config_inotify_irmap.desc - -diff --git a/scripts/ci/Makefile b/scripts/ci/Makefile -index 02b4d871c..3e4d59430 100644 ---- a/scripts/ci/Makefile -+++ b/scripts/ci/Makefile -@@ -18,7 +18,7 @@ export UNAME - CONTAINER_RUNTIME := docker - export CONTAINER_RUNTIME - --alpine: ZDTM_OPTIONS=-x zdtm/static/binfmt_misc -x zdtm/static/netns-nf -x zdtm/static/sched_policy00 -x zdtm/static/seccomp_strict -x zdtm/static/sigaltstack -x zdtm/static/signalfd00 -x zdtm/static/config_inotify_irmap -+alpine: ZDTM_OPTIONS=-x zdtm/static/binfmt_misc -x zdtm/static/netns-nf -x zdtm/static/sched_policy00 -x zdtm/static/seccomp_strict -x zdtm/static/sigaltstack -x zdtm/static/signalfd00 - - define DOCKER_JSON - { -diff --git a/test/Makefile b/test/Makefile -index cf7dacac4..9938015e0 100644 ---- a/test/Makefile -+++ b/test/Makefile -@@ -51,7 +51,7 @@ clean_root: - .PHONY: clean_root - - clean: clean_root -- $(RM) zdtm_ct zdtm-tst-list umount2 zdtm_test_config.conf -+ $(RM) zdtm_ct zdtm-tst-list umount2 - $(Q) $(RM) *.log - $(Q) $(RM) -r ./dump/ - $(Q) $(MAKE) -C zdtm cleandep clean cleanout -diff --git a/test/zdtm/static/Makefile b/test/zdtm/static/Makefile -index 1b057c70c..33e15f85a 100644 ---- a/test/zdtm/static/Makefile -+++ b/test/zdtm/static/Makefile -@@ -237,7 +237,6 @@ TST_NOFILE := \ - netns_sub_veth \ - netns_sub_sysctl \ - unlink_multiple_largefiles \ -- config_inotify_irmap \ - thp_disable \ - pid_file \ - selinux00 \ -diff --git a/test/zdtm/static/config_inotify_irmap.c b/test/zdtm/static/config_inotify_irmap.c -deleted file mode 100644 -index 94585491a..000000000 ---- a/test/zdtm/static/config_inotify_irmap.c -+++ /dev/null -@@ -1,95 +0,0 @@ --#include --#include -- --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include -- --#include "zdtmtst.h" -- --/* -- * This test reuses inotify_irmap test for testing configuration files -- * functionality. For parts not related to configuration files, please -- * refer to the original test case and it's author. -- */ -- --const char *test_doc = "Default configuration files usage"; --const char *test_author = "Veronika Kabatova "; -- --#define TDIR "/etc" --char test_files[2][128] = { -- TDIR "/zdtm-test", -- TDIR "/zdtm-test1", --}; --#define CONFIG_PATH "../../zdtm_test_config.conf" -- --#define BUFF_SIZE ((sizeof(struct inotify_event) + PATH_MAX)) -- --int main(int argc, char *argv[]) --{ -- FILE *configfile; -- char buf[BUFF_SIZE]; -- int fd, wd, i; -- -- test_init(argc, argv); -- -- for (i = 0; i < 2; i++) { -- unlink(test_files[i]); -- if (creat(test_files[i], 0600) < 0) { -- pr_perror("Can't make test file"); -- exit(1); -- } -- } -- fd = inotify_init1(IN_NONBLOCK); -- if (fd < 0) { -- pr_perror("inotify_init failed"); -- goto err; -- } -- for (i = 0; i < 2; i++) { -- wd = inotify_add_watch(fd, test_files[i], IN_OPEN); -- if (wd < 0) { -- pr_perror("inotify_add_watch failed"); -- goto err; -- } -- } -- -- configfile = fopen(CONFIG_PATH, "w"); -- if (configfile == NULL) { -- pr_perror("Unable to create configuration file %s", CONFIG_PATH); -- goto err; -- } -- fprintf(configfile, "force-irmap\t\nirmap-scan-path /zdtm/static\n"); -- fclose(configfile); -- -- test_daemon(); -- test_waitsig(); -- -- for (i = 0; i < 2; i++) { -- memset(buf, 0, sizeof(buf)); -- wd = open(test_files[i], O_RDONLY); -- if (read(fd, buf, sizeof(buf)) <= 0) { -- fail("No events in queue"); -- unlink(CONFIG_PATH); -- goto err; -- } -- } -- -- close(wd); -- close(fd); -- for (i = 0; i < 2; i++) -- unlink(test_files[i]); -- unlink(CONFIG_PATH); -- pass(); -- return 0; --err: -- for (i = 0; i < 2; i++) -- unlink(test_files[i]); -- return 1; --} -diff --git a/test/zdtm/static/config_inotify_irmap.desc b/test/zdtm/static/config_inotify_irmap.desc -deleted file mode 100644 -index 591ae7191..000000000 ---- a/test/zdtm/static/config_inotify_irmap.desc -+++ /dev/null -@@ -1,3 +0,0 @@ --(lambda confpath: --{'flags': 'suid', 'opts': '--config %s' % (confpath) --}) (os.path.abspath('./zdtm_test_config.conf')) --- -2.35.1 - diff --git a/0149-ci-run-criu-config-tests.patch b/0149-ci-run-criu-config-tests.patch deleted file mode 100644 index fa4863a..0000000 --- a/0149-ci-run-criu-config-tests.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 8ae1b00522e779c332145d3d6f33980c3b91aa4d Mon Sep 17 00:00:00 2001 -From: Radostin Stoyanov -Date: Sun, 15 Aug 2021 11:29:22 +0100 -Subject: [PATCH 149/249] ci: run criu-config tests - -Signed-off-by: Radostin Stoyanov ---- - scripts/ci/run-ci-tests.sh | 3 +++ - test/Makefile | 5 +++++ - 2 files changed, 8 insertions(+) - -diff --git a/scripts/ci/run-ci-tests.sh b/scripts/ci/run-ci-tests.sh -index 50216634e..5ef3965db 100755 ---- a/scripts/ci/run-ci-tests.sh -+++ b/scripts/ci/run-ci-tests.sh -@@ -202,6 +202,9 @@ fi - # shellcheck disable=SC2086 - ./test/zdtm.py run -a -p 2 --keep-going $ZDTM_OPTS - -+# shellcheck disable=SC2086 -+./test/zdtm.py run -a -p 2 --keep-going --criu-config $ZDTM_OPTS -+ - # Newer kernels are blocking access to userfaultfd: - # uffd: Set unprivileged_userfaultfd sysctl knob to 1 if kernel faults must be handled without obtaining CAP_SYS_PTRACE capability - if [ -e /proc/sys/vm/unprivileged_userfaultfd ]; then -diff --git a/test/Makefile b/test/Makefile -index 9938015e0..8416b1961 100644 ---- a/test/Makefile -+++ b/test/Makefile -@@ -5,6 +5,7 @@ export ZDTM_ARGS - - all: - $(MAKE) zdtm -+ $(MAKE) zdtm-config - $(MAKE) zdtm-pre-dump - $(MAKE) zdtm-snapshot - $(MAKE) zdtm-iter -@@ -23,6 +24,10 @@ zdtm: - ./zdtm.py run -a --parallel 2 - .PHONY: zdtm - -+zdtm-config: -+ ./zdtm.py run -a --parallel 2 --criu-config -+.PHONY: zdtm-config -+ - zdtm-pre-dump: - ./zdtm.py run --pre 2:1 -t zdtm/transition/fork -f uns - .PHONY: zdtm-pre-dump --- -2.35.1 - diff --git a/0150-config-fix-ns-leak-in-parse_join_ns.patch b/0150-config-fix-ns-leak-in-parse_join_ns.patch deleted file mode 100644 index e23bcc2..0000000 --- a/0150-config-fix-ns-leak-in-parse_join_ns.patch +++ /dev/null @@ -1,53 +0,0 @@ -From b34fb0f1945c771a2d7d5e472d63bb763a0991f5 Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Thu, 10 Mar 2022 14:15:23 +0300 -Subject: [PATCH 150/249] config: fix ns leak in parse_join_ns - -coverity CID 389192: - -550static int parse_join_ns(const char *ptr) -551{ -... -553 char *ns; -554 - 1. alloc_fn: Storage is returned from allocation function strdup. - 2. var_assign: Assigning: ___p = storage returned from strdup(ptr). - 3. Condition !___p, taking false branch. - 4. leaked_storage: Variable ___p going out of scope leaks the storage it points to. - 5. var_assign: Assigning: ns = ({...; ___p;}). -555 ns = xstrdup(ptr); - 6. Condition ns == NULL, taking false branch. -556 if (ns == NULL) -557 return -1; -558 - 7. noescape: Resource ns is not freed or pointed-to in strchr. -559 aux = strchr(ns, ':'); - 8. Condition aux == NULL, taking true branch. -560 if (aux == NULL) - CID 389192 (#1 of 1): Resource leak (RESOURCE_LEAK)9. leaked_storage: Variable ns going out of scope leaks the storage it points to. -561 return -1; - -We should free ns string after we finish it's use in parse_join_ns, -easiest way to do it is to use cleanup_free attribute. - -Signed-off-by: Pavel Tikhomirov ---- - criu/config.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/criu/config.c b/criu/config.c -index 33f2820a1..4a8338423 100644 ---- a/criu/config.c -+++ b/criu/config.c -@@ -549,7 +549,7 @@ static size_t parse_size(char *optarg) - static int parse_join_ns(const char *ptr) - { - char *aux, *ns_file, *extra_opts = NULL; -- char *ns; -+ cleanup_free char *ns = NULL; - - ns = xstrdup(ptr); - if (ns == NULL) --- -2.35.1 - diff --git a/0151-net-fix-e_str-leak-in-veth_pair_add.patch b/0151-net-fix-e_str-leak-in-veth_pair_add.patch deleted file mode 100644 index 3536d94..0000000 --- a/0151-net-fix-e_str-leak-in-veth_pair_add.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 31fc58737e0ee24bb2438d76ab37311e52d4b2a3 Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Fri, 11 Mar 2022 19:57:06 +0300 -Subject: [PATCH 151/249] net: fix e_str leak in veth_pair_add - -coverity CID 389187: - -3193int veth_pair_add(char *in, char *out) -3194{ -3195 char *e_str; -3196 - 1. alloc_fn: Storage is returned from allocation function malloc. - 2. var_assign: Assigning: ___p = storage returned from malloc(200UL). - 3. Condition !___p, taking false branch. - 4. leaked_storage: Variable ___p going out of scope leaks the storage it points to. - 5. var_assign: Assigning: e_str = ({...; ___p;}). -3197 e_str = xmalloc(200); /* For 3 IFNAMSIZ + 8 service characters */ - 6. Condition !e_str, taking false branch. -3198 if (!e_str) -3199 return -1; - 7. noescape: Resource e_str is not freed or pointed-to in snprintf. -3200 snprintf(e_str, 200, "veth[%s]:%s", in, out); - 8. noescape: Resource e_str is not freed or pointed-to in add_external. [show details] - CID 389187 (#1 of 1): Resource leak (RESOURCE_LEAK)9. leaked_storage: Variable e_str going out of scope leaks the storage it points to. -3201 return add_external(e_str); -3202} - -We should free e_str string after we finish it's use in veth_pair_add, -easiest way to do it is to use cleanup_free attribute. - -Signed-off-by: Pavel Tikhomirov ---- - criu/net.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/criu/net.c b/criu/net.c -index 50655559d..c82054037 100644 ---- a/criu/net.c -+++ b/criu/net.c -@@ -3192,7 +3192,7 @@ void network_unlock(void) - - int veth_pair_add(char *in, char *out) - { -- char *e_str; -+ cleanup_free char *e_str = NULL; - - e_str = xmalloc(200); /* For 3 IFNAMSIZ + 8 service characters */ - if (!e_str) --- -2.35.1 - diff --git a/0152-files-fix-inh-leak-in-inherit_fd_add.patch b/0152-files-fix-inh-leak-in-inherit_fd_add.patch deleted file mode 100644 index 7212043..0000000 --- a/0152-files-fix-inh-leak-in-inherit_fd_add.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 8b4b1107d3aa7ca0286da93b2a1c17b0d2031dfa Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Fri, 11 Mar 2022 18:45:37 +0300 -Subject: [PATCH 152/249] files: fix inh leak in inherit_fd_add - -coverity CID 389190: - -1538int inherit_fd_add(int fd, char *key) -1539{ -1540 struct inherit_fd *inh; -... - 2. alloc_fn: Storage is returned from allocation function malloc. - 3. var_assign: Assigning: ___p = storage returned from malloc(32UL). - 4. Condition !___p, taking false branch. - 5. leaked_storage: Variable ___p going out of scope leaks the storage it points to. - 6. var_assign: Assigning: inh = ({...; ___p;}). -1548 inh = xmalloc(sizeof *inh); - 7. Condition inh == NULL, taking false branch. -1549 if (inh == NULL) -1550 return -1; -1551 -... - 9. Condition !___p, taking true branch. -1555 inh->inh_id = xstrdup(key); - 10. Condition inh->inh_id == NULL, taking true branch. -1556 if (inh->inh_id == NULL) - CID 389190 (#1 of 1): Resource leak (RESOURCE_LEAK)11. leaked_storage: Variable inh going out of scope leaks the storage it points to. -1557 return -1; - -We should free inh on inh_id allocation error path in inherit_fd_add. - -Signed-off-by: Pavel Tikhomirov ---- - criu/files.c | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/criu/files.c b/criu/files.c -index 7f4b90086..d317bc9ab 100644 ---- a/criu/files.c -+++ b/criu/files.c -@@ -1553,8 +1553,10 @@ int inherit_fd_add(int fd, char *key) - inh_fd_max = fd; - - inh->inh_id = xstrdup(key); -- if (inh->inh_id == NULL) -+ if (inh->inh_id == NULL) { -+ xfree(inh); - return -1; -+ } - - inh->inh_fd = fd; - list_add_tail(&inh->inh_list, &opts.inherit_fds); --- -2.35.1 - diff --git a/0153-sk-unix-fix-e_str-leak-in-unix_sk_id_add.patch b/0153-sk-unix-fix-e_str-leak-in-unix_sk_id_add.patch deleted file mode 100644 index f7f9980..0000000 --- a/0153-sk-unix-fix-e_str-leak-in-unix_sk_id_add.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 2dea9c7e8bf225a132999c4ab7117ebc6ab4ec40 Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Fri, 11 Mar 2022 18:36:55 +0300 -Subject: [PATCH 153/249] sk-unix: fix e_str leak in unix_sk_id_add - -coverity CID 389191: - -int unix_sk_id_add(unsigned int ino) -2327{ -2328 char *e_str; -2329 - 1. alloc_fn: Storage is returned from allocation function malloc. - 2. var_assign: Assigning: ___p = storage returned from malloc(20UL). - 3. Condition !___p, taking false branch. - 4. leaked_storage: Variable ___p going out of scope leaks the storage it points to. - 5. var_assign: Assigning: e_str = ({...; ___p;}). -2330 e_str = xmalloc(20); - 6. Condition !e_str, taking false branch. -2331 if (!e_str) -2332 return -1; - 7. noescape: Resource e_str is not freed or pointed-to in snprintf. -2333 snprintf(e_str, 20, "unix[%u]", ino); - 8. noescape: Resource e_str is not freed or pointed-to in add_external. [show details] - CID 389191 (#1 of 1): Resource leak (RESOURCE_LEAK)9. leaked_storage: Variable e_str going out of scope leaks the storage it points to. -2334 return add_external(e_str); -2335} - -We should free e_str string after we finish it's use in unix_sk_id_add, -easiest way to do it is to use cleanup_free attribute. - -Signed-off-by: Pavel Tikhomirov ---- - criu/sk-unix.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/criu/sk-unix.c b/criu/sk-unix.c -index 90c9eb11b..b2c2aaca0 100644 ---- a/criu/sk-unix.c -+++ b/criu/sk-unix.c -@@ -2325,7 +2325,7 @@ static void try_resolve_unix_peer(struct unix_sk_info *ui) - - int unix_sk_id_add(unsigned int ino) - { -- char *e_str; -+ cleanup_free char *e_str = NULL; - - e_str = xmalloc(20); - if (!e_str) --- -2.35.1 - diff --git a/0154-uffd-fix-__u64-print-format-specifier.patch b/0154-uffd-fix-__u64-print-format-specifier.patch deleted file mode 100644 index e1e06cb..0000000 --- a/0154-uffd-fix-__u64-print-format-specifier.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 22c0a189c600b774b832d25958775b503179aa20 Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Fri, 11 Mar 2022 17:31:07 +0300 -Subject: [PATCH 154/249] uffd: fix __u64 print format specifier - -coverity CID 389197: - -CID 389197 (#1 of 1): Invalid printf format string (PRINTF_ARGS) -format_error: Length modifier L not applicable to conversion specifier in %Lu. [show details] -284 pr_err("Incompatible uffd API: expected %Lu, got %Lu\n", UFFD_API, uffdio_api.api); - -Looking on C11 standard it seems that "%Lu" is undefined, we better not -use this, see: - -"L Specifies that a following a, A, e, E, f, F, g, or G conversion -specifier applies to a long double argument." -http://port70.net/~nsz/c/c11/n1570.html#7.21.6.1p7 - -Signed-off-by: Pavel Tikhomirov ---- - criu/uffd.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/criu/uffd.c b/criu/uffd.c -index 45ac8ba77..b551698f8 100644 ---- a/criu/uffd.c -+++ b/criu/uffd.c -@@ -281,7 +281,7 @@ int uffd_open(int flags, unsigned long *features, int *err) - } - - if (uffdio_api.api != UFFD_API) { -- pr_err("Incompatible uffd API: expected %Lu, got %Lu\n", UFFD_API, uffdio_api.api); -+ pr_err("Incompatible uffd API: expected %llu, got %llu\n", UFFD_API, uffdio_api.api); - goto close; - } - --- -2.35.1 - diff --git a/0155-zdtm-fix-mnt_ext_master-test-to-correspond-to-it-s-n.patch b/0155-zdtm-fix-mnt_ext_master-test-to-correspond-to-it-s-n.patch deleted file mode 100644 index 54f4a99..0000000 --- a/0155-zdtm-fix-mnt_ext_master-test-to-correspond-to-it-s-n.patch +++ /dev/null @@ -1,54 +0,0 @@ -From d243470ea0e02c7fbdce4504c89b616fe995aaf4 Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Mon, 30 Dec 2019 16:17:54 +0300 -Subject: [PATCH 155/249] zdtm: fix mnt_ext_master test to correspond to it's - name - -Before these change the on-host-"zdtm_auto_ext_mnt" mount with -mountpoint "/tmp/zdtm_ext_auto.XXXXXX" was private/shared depending on -it's parent mount "/tmp". And e.g. on my setup the parent mount on -"/tmp" is private and our "host" mount becomes private too. So -in-container-"zdtm_auto_ext_mnt" external mount is also private but test -name hints it should be slave. - -E.g. If I ran mnt_ext_master before this patch, in mnt_ext_master -process mntns we see that our "external" mount is private but not slave: - -[root@fedora criu]# grep zdtm_auto_ext_mnt /proc/167077/mountinfo -1239 1238 0:138 /test /ext_mounts rw,relatime - tmpfs zdtm_auto_ext_mnt rw,seclabel,inode64 - -After this patch: - -[root@fedora criu]# grep zdtm_auto_ext_mnt /proc/166385/mountinfo -1239 1238 0:138 /test /ext_mounts rw,relatime master:413 - tmpfs zdtm_auto_ext_mnt rw,seclabel,inode64 - ^^^^^^^^^^ - -So we just explicitly make on-host-"zdtm_auto_ext_mnt" shared, and this -makes in-container-"zdtm_auto_ext_mnt" external mount slave. - -Cherry-picked from Virtuozzo criu: -https://src.openvz.org/projects/OVZ/repos/criu/commits/a1a221fe9 - -Signed-off-by: Pavel Tikhomirov ---- - test/zdtm/static/mnt_ext_master.c | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/test/zdtm/static/mnt_ext_master.c b/test/zdtm/static/mnt_ext_master.c -index 5fd8fa8b2..dbadef0b8 100644 ---- a/test/zdtm/static/mnt_ext_master.c -+++ b/test/zdtm/static/mnt_ext_master.c -@@ -39,6 +39,10 @@ int main(int argc, char **argv) - pr_perror("mount"); - return 1; - } -+ if (mount(NULL, dname, NULL, MS_SHARED, NULL)) { -+ pr_perror("shared"); -+ return 1; -+ } - - mkdir(src, 755); - mkdir(dst, 755); --- -2.35.1 - diff --git a/0156-mount-add-mntinfo_add_list_before-helper-for-adding-.patch b/0156-mount-add-mntinfo_add_list_before-helper-for-adding-.patch deleted file mode 100644 index 01e77f3..0000000 --- a/0156-mount-add-mntinfo_add_list_before-helper-for-adding-.patch +++ /dev/null @@ -1,98 +0,0 @@ -From d3dae3d5e2ec2ab1532bfaf7cc3b11654ec155a2 Mon Sep 17 00:00:00 2001 -From: Alexander Mikhalitsyn -Date: Sun, 12 Apr 2020 20:53:54 +0300 -Subject: [PATCH 156/249] mount: add mntinfo_add_list_before helper for adding - to mntinfo list - -Use this helper everywhere instead of manually adding mounts to the head -of the list, this way it is much easier to track all places where we do -add to mntinfo list. - -Signed-off-by: Alexander Mikhalitsyn (Virtuozzo) - -Cherry-picked from Virtuozzo criu: -https://src.openvz.org/projects/OVZ/repos/criu/commits/7bca9397b - -Changes: skip hunk adding root_yard_mp to the list because root yard has -not fully initialized mountinfo structure (can break code which uses -mntinfo fallback in lookup_nsid_by_mnt_id), let's only have real mounts -in mntinfo list. Also skip cr_time mount from mntinfo list for the same -reason. - -Signed-off-by: Pavel Tikhomirov ---- - criu/include/mount.h | 3 +++ - criu/mount.c | 11 +++++++---- - criu/proc_parse.c | 6 ++---- - 3 files changed, 12 insertions(+), 8 deletions(-) - -diff --git a/criu/include/mount.h b/criu/include/mount.h -index b959d131c..f180fe58d 100644 ---- a/criu/include/mount.h -+++ b/criu/include/mount.h -@@ -90,6 +90,9 @@ struct mount_info { - }; - - extern struct mount_info *mntinfo; -+ -+extern void mntinfo_add_list_before(struct mount_info **head, struct mount_info *new); -+ - extern struct ns_desc mnt_ns_desc; - #ifdef CONFIG_BINFMT_MISC_VIRTUALIZED - extern int collect_binfmt_misc(void); -diff --git a/criu/mount.c b/criu/mount.c -index c301aaeeb..7035d992a 100644 ---- a/criu/mount.c -+++ b/criu/mount.c -@@ -127,6 +127,12 @@ static void mntinfo_add_list(struct mount_info *new) - } - } - -+void mntinfo_add_list_before(struct mount_info **head, struct mount_info *new) -+{ -+ new->next = *head; -+ *head = new; -+} -+ - static struct mount_info *__lookup_overlayfs(struct mount_info *list, char *rpath, unsigned int st_dev, - unsigned int st_ino, unsigned int mnt_id) - { -@@ -1527,8 +1533,6 @@ static __maybe_unused int add_cr_time_mount(struct mount_info *root, char *fsnam - mi->nsid = parent->nsid; - mi->parent = parent; - mi->parent_mnt_id = parent->mnt_id; -- mi->next = parent->next; -- parent->next = mi; - list_add(&mi->siblings, &parent->children); - pr_info("Add cr-time mountpoint %s with parent %s(%u)\n", mi->mountpoint, parent->mountpoint, parent->mnt_id); - return 0; -@@ -3015,8 +3019,7 @@ static int collect_mnt_from_image(struct mount_info **head, struct mount_info ** - goto err; - - pm->nsid = nsid; -- pm->next = *head; -- *head = pm; -+ mntinfo_add_list_before(head, pm); - if (!*tail) - *tail = pm; - -diff --git a/criu/proc_parse.c b/criu/proc_parse.c -index 5cd5e6db8..260d3669c 100644 ---- a/criu/proc_parse.c -+++ b/criu/proc_parse.c -@@ -1621,10 +1621,8 @@ struct mount_info *parse_mountinfo(pid_t pid, struct ns_id *nsid, bool for_dump) - if (fsname) - free(fsname); - -- if (new) { -- new->next = list; -- list = new; -- } -+ if (new) -+ mntinfo_add_list_before(&list, new); - - if (ret) - goto err; --- -2.35.1 - diff --git a/0157-mount-do-not-detect-non-fsroot-mounts-as-device-exte.patch b/0157-mount-do-not-detect-non-fsroot-mounts-as-device-exte.patch deleted file mode 100644 index 99a36ee..0000000 --- a/0157-mount-do-not-detect-non-fsroot-mounts-as-device-exte.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 6990d6a53df2464094ff35210936827d529bbf0c Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Thu, 16 Jan 2020 12:36:08 +0300 -Subject: [PATCH 157/249] mount: do not detect non-fsroot mounts as - device-external - -Device-external mounts are restored via do_new_mount(), but function -do_new_mount only allows creating mounts with root "/", as it does -simple mount (not bind) without any later root change. Restoring -non-root mounts via do_new_mount is just imposible. - -So let's detect mounts as device-external only when they have fsroot -root, all other non-fsroot binds of this device would be restored as -bindmounts of fsroot ones. - -This is a cosmetic change as though non-root mounts were detected as -device-external before this patch they anyway would not be created with -do_new_mount() because of fsroot/bind check in can_mount_now orders them -to be restored as binds. - -Cherry-picked one hunk from Virtuozzo criu: -https://src.openvz.org/projects/OVZ/repos/criu/commits/afd899539 - -Signed-off-by: Pavel Tikhomirov ---- - criu/mount.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/criu/mount.c b/criu/mount.c -index 7035d992a..7c42c1fc9 100644 ---- a/criu/mount.c -+++ b/criu/mount.c -@@ -476,7 +476,7 @@ static int try_resolve_ext_mount(struct mount_info *info) - - snprintf(devstr, sizeof(devstr), "dev[%d/%d]", kdev_major(info->s_dev), kdev_minor(info->s_dev)); - -- if (info->fstype->code == FSTYPE__UNSUPPORTED) { -+ if (info->fstype->code == FSTYPE__UNSUPPORTED && fsroot_mounted(info)) { - char *val; - - val = external_lookup_by_key(devstr); --- -2.35.1 - diff --git a/0158-mount-mark-mounts-of-external-devices-external.patch b/0158-mount-mark-mounts-of-external-devices-external.patch deleted file mode 100644 index 39059f0..0000000 --- a/0158-mount-mark-mounts-of-external-devices-external.patch +++ /dev/null @@ -1,178 +0,0 @@ -From fc17357c0215e15ce5e00e6fd7cf70f0245ce805 Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Mon, 16 Sep 2019 18:07:32 +0300 -Subject: [PATCH 158/249] mount: mark mounts of external devices external - -Previously only autodetected and mountpoint external mounts had -mount_info->external field set, let's fix this injustice so that we can -operate all external mounts in a similar manner. - -Also: - -Print info message when device external mount is detected similar to -mountpoint external mounts detection. - -Add helper mnt_is_nodev_external to let do_mount_one, can_mount_now and -do_bind_mount handle device external mounts separately as it was before. - -Handle device external mount right in get_mp_root to set ->external on -restore. (note: calling ext_mount_lookup is only meaningfull for -mountpoint external mounts) - -Add helper mnt_is_dev_external to use in resolve_source to make it more -clear that it is a device external mount restore path. - -All other "if (mi->external)" checks now also handle device external -mounts, but they all look safe to do so and could've done it initially, -here is a list: fusectl_dump, mnt_is_external, dump_one_mountpoint, -propagate_mount. - -Cherry-picked from Virtuozzo criu: -https://src.openvz.org/projects/OVZ/repos/criu/commits/afd899539 - -Changes: cleanup commit message, add some helpers. - -Signed-off-by: Pavel Tikhomirov ---- - criu/include/mount.h | 19 +++++++++++++++++++ - criu/mount.c | 42 ++++++++++++++++++++++++++---------------- - 2 files changed, 45 insertions(+), 16 deletions(-) - -diff --git a/criu/include/mount.h b/criu/include/mount.h -index f180fe58d..b49b55f3f 100644 ---- a/criu/include/mount.h -+++ b/criu/include/mount.h -@@ -93,6 +93,25 @@ extern struct mount_info *mntinfo; - - extern void mntinfo_add_list_before(struct mount_info **head, struct mount_info *new); - -+/* -+ * Put a : in here since those are invalid on -+ * the cli, so we know it's autogenerated in -+ * debugging. -+ */ -+#define AUTODETECTED_MOUNT "CRIU:AUTOGENERATED" -+#define EXTERNAL_DEV_MOUNT "CRIU:EXTERNAL_DEV" -+#define NO_ROOT_MOUNT "CRIU:NO_ROOT" -+ -+static inline bool mnt_is_dev_external(struct mount_info *mi) -+{ -+ return mi->external && !strcmp(mi->external, EXTERNAL_DEV_MOUNT); -+} -+ -+static inline bool mnt_is_nodev_external(struct mount_info *mi) -+{ -+ return mi->external && strcmp(mi->external, EXTERNAL_DEV_MOUNT); -+} -+ - extern struct ns_desc mnt_ns_desc; - #ifdef CONFIG_BINFMT_MISC_VIRTUALIZED - extern int collect_binfmt_misc(void); -diff --git a/criu/mount.c b/criu/mount.c -index 7c42c1fc9..9fea5f395 100644 ---- a/criu/mount.c -+++ b/criu/mount.c -@@ -31,14 +31,7 @@ - - #include "images/mnt.pb-c.h" - --/* -- * Put a : in here since those are invalid on -- * the cli, so we know it's autogenerated in -- * debugging. -- */ --#define AUTODETECTED_MOUNT "CRIU:AUTOGENERATED" --#define NO_ROOT_MOUNT "CRIU:NO_ROOT" --#define MS_PROPAGATE (MS_SHARED | MS_PRIVATE | MS_UNBINDABLE | MS_SLAVE) -+#define MS_PROPAGATE (MS_SHARED | MS_PRIVATE | MS_UNBINDABLE | MS_SLAVE) - - #undef LOG_PREFIX - #define LOG_PREFIX "mnt: " -@@ -484,6 +477,9 @@ static int try_resolve_ext_mount(struct mount_info *info) - char *source; - int len; - -+ pr_info("Found %s dev-mapping for %s(%d) mountpoint\n", val, info->ns_mountpoint, info->mnt_id); -+ info->external = EXTERNAL_DEV_MOUNT; -+ - len = strlen(val) + sizeof("dev[]"); - source = xrealloc(info->source, len); - if (source == NULL) -@@ -1827,7 +1823,11 @@ static char *resolve_source(struct mount_info *mi) - */ - return mi->source; - -- if (mi->fstype->code == FSTYPE__AUTO) { -+ /* -+ * FSTYPE__AUTO check is a fallback for old images which do not have -+ * explicit EXTERNAL_DEV_MOUNT mark, but still have "dev[key]" in source. -+ */ -+ if (mnt_is_dev_external(mi) || mi->fstype->code == FSTYPE__AUTO) { - struct stat st; - char *val; - -@@ -2217,7 +2217,7 @@ static int do_bind_mount(struct mount_info *mi) - goto out; - } - -- if (mi->external) { -+ if (mnt_is_nodev_external(mi)) { - /* - * We have / pointing to criu's ns root still, - * so just use the mapping's path. The mountpoint -@@ -2376,7 +2376,7 @@ static bool can_mount_now(struct mount_info *mi) - /* Parent should be mounted already, that's how mnt_tree_for_each works */ - BUG_ON(mi->parent && !mi->parent->mounted); - -- if (mi->external) -+ if (mnt_is_nodev_external(mi)) - goto shared; - - /* -@@ -2551,10 +2551,11 @@ static int do_mount_one(struct mount_info *mi) - return -1; - mi->mounted = true; - ret = 0; -- } else if (!mi->bind && !mi->need_plugin && !mi->external) -+ } else if (!mi->bind && !mi->need_plugin && !mnt_is_nodev_external(mi)) { - ret = do_new_mount(mi); -- else -+ } else { - ret = do_bind_mount(mi); -+ } - - if (ret == 0 && fetch_rt_stat(mi, mi->mountpoint)) - return -1; -@@ -2882,10 +2883,11 @@ static int get_mp_root(MntEntry *me, struct mount_info *mi) - * from the command line and put into root's place - */ - -- ext = ext_mount_lookup(me->ext_key); -- if (!ext) { -+ if (!strcmp(me->ext_key, AUTODETECTED_MOUNT)) { - if (!opts.autodetect_ext_mounts) { -- pr_err("No mapping for %s mountpoint\n", me->mountpoint); -+ pr_err("Mount %d:%s is autodetected external mount. " -+ "Try \"--ext-mount-map auto\" to allow them.\n", -+ mi->mnt_id, mi->mountpoint); - return -1; - } - -@@ -2899,6 +2901,14 @@ static int get_mp_root(MntEntry *me, struct mount_info *mi) - */ - - ext = mi->source; -+ } else if (!strcmp(me->ext_key, EXTERNAL_DEV_MOUNT)) { -+ ext = EXTERNAL_DEV_MOUNT; -+ } else { -+ ext = ext_mount_lookup(me->ext_key); -+ if (!ext) { -+ pr_err("No mapping for %d:%s mountpoint\n", mi->mnt_id, mi->mountpoint); -+ return -1; -+ } - } - - mi->external = ext; --- -2.35.1 - diff --git a/0159-mount-skip-fstype-and-source-checks-for-external-mou.patch b/0159-mount-skip-fstype-and-source-checks-for-external-mou.patch deleted file mode 100644 index b9decea..0000000 --- a/0159-mount-skip-fstype-and-source-checks-for-external-mou.patch +++ /dev/null @@ -1,77 +0,0 @@ -From 602bbfea26532b8f7787a6e084231a25afe1b3c7 Mon Sep 17 00:00:00 2001 -From: Alexander Mikhalitsyn -Date: Tue, 21 Apr 2020 18:12:00 +0300 -Subject: [PATCH 159/249] mount: skip fstype and source checks for external - mounts in mounts_sb_equal - -Fstype and source fields can be changed by resolve_external_mounts() or -by try_resolve_ext_mount() for external mounts, but we can have other -mounts from same superblock which are not detected as external, for -instance bind of subdirectory from device-external or bind of -mountpoint-external mount to other mountpoint. So we need to still be -able to find bindmounts between mounts with changed fstype or source and -unchanged mounts. - -So let's make fstype/source checks in mounts_sb_equal ignored for -external mounts. Leave only fstype->sb_equal checks if have them. - -Signed-off-by: Alexander Mikhalitsyn (Virtuozzo) - -Cherry-picked from Virtuozzo criu: -https://src.openvz.org/projects/OVZ/repos/criu/commits/fadc38d84 -Cherry-picked from Virtuozzo criu: -https://src.openvz.org/projects/OVZ/repos/criu/commits/f9700cb12 - -Changes: merge two commits in one and rework, remove ":)", reword -commit-message to make patch self-sufficient. - -Signed-off-by: Pavel Tikhomirov ---- - criu/mount.c | 27 ++++++++++++++++++++------- - 1 file changed, 20 insertions(+), 7 deletions(-) - -diff --git a/criu/mount.c b/criu/mount.c -index 9fea5f395..9d560a0b2 100644 ---- a/criu/mount.c -+++ b/criu/mount.c -@@ -294,17 +294,30 @@ bool phys_stat_dev_match(dev_t st_dev, dev_t phys_dev, struct ns_id *ns, const c - */ - static bool mounts_sb_equal(struct mount_info *a, struct mount_info *b) - { -- if (a->fstype != b->fstype) -- return false; -- - if (a->s_dev != b->s_dev) - return false; - -- if (strcmp(a->source, b->source) != 0) -- return false; -+ /* -+ * If one of compared mounts is external its mount info can have fstype -+ * and source fields changed by resolve_external_mounts() or -+ * try_resolve_ext_mount(), but we still want to detect bindmounts of -+ * this external mount, so let's skip source and fstype checks for it. -+ */ -+ if (!a->external && !b->external) { -+ if (strcmp(a->source, b->source) != 0) -+ return false; -+ -+ if (a->fstype != b->fstype) -+ return false; - -- if (a->fstype->sb_equal) /* :) */ -- return b->fstype->sb_equal(a, b); -+ if (a->fstype->sb_equal) -+ return a->fstype->sb_equal(a, b); -+ } else { -+ if (a->fstype->sb_equal) -+ return a->fstype->sb_equal(a, b); -+ else if (b->fstype->sb_equal) -+ return b->fstype->sb_equal(a, b); -+ } - - if (strcmp(a->options, b->options)) - return false; --- -2.35.1 - diff --git a/0160-mount-setup-mnt_bind-list-before-using-it-in-mnt_is_.patch b/0160-mount-setup-mnt_bind-list-before-using-it-in-mnt_is_.patch deleted file mode 100644 index e7878e5..0000000 --- a/0160-mount-setup-mnt_bind-list-before-using-it-in-mnt_is_.patch +++ /dev/null @@ -1,164 +0,0 @@ -From 9cc10e89aa8d1b54f71c2e51c203fcab34bc8b65 Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Fri, 20 Dec 2019 17:26:07 +0300 -Subject: [PATCH 160/249] mount: setup mnt_bind list before using it in - mnt_is_external - -Before this patch mnt_is_external() used non-populated mnt_bind list -when called from resolve_shared_mounts(), thus it could work not as -intended. - -Let's add separate helper search_bindmounts() for populating mnt_bind -list, and add mnt_bind_is_populated to differentiate between -non-populated list and just empty populated list. This way we can add a -BUG_ON to mnt_is_external to catch such order problems in future. - -Cherry-picked from Virtuozzo criu: -https://src.openvz.org/projects/OVZ/repos/criu/commits/e464c1c6d -Cherry-picked from Virtuozzo criu: -https://src.openvz.org/projects/OVZ/repos/criu/commits/8b22b30d5 -Cherry-picked one hunk from Virtuozzo criu: -https://src.openvz.org/projects/OVZ/repos/criu/commits/ca9de41e3 - -Changes: simplify commit message, merge fixups: search bindmounts -earlier so that we have bindmounts info as early as possible, rename -mnt_no_bind to mnt_bind_is_populated and simplify it's logic a bit. - -Signed-off-by: Pavel Tikhomirov ---- - criu/include/mount.h | 1 + - criu/mount.c | 64 +++++++++++++++++++++++++++++++++----------- - 2 files changed, 50 insertions(+), 15 deletions(-) - -diff --git a/criu/include/mount.h b/criu/include/mount.h -index b49b55f3f..03959e1b0 100644 ---- a/criu/include/mount.h -+++ b/criu/include/mount.h -@@ -73,6 +73,7 @@ struct mount_info { - struct list_head siblings; - - struct list_head mnt_bind; /* circular list of derivatives of one real mount */ -+ bool mnt_bind_is_populated; /* indicate that mnt_bind list is ready to use */ - struct list_head mnt_share; /* circular list of shared mounts */ - struct list_head mnt_slave_list; /* list of slave mounts */ - struct list_head mnt_slave; /* slave list entry */ -diff --git a/criu/mount.c b/criu/mount.c -index 9d560a0b2..de6722e69 100644 ---- a/criu/mount.c -+++ b/criu/mount.c -@@ -571,6 +571,11 @@ static bool mnt_is_external(struct mount_info *m) - if (t->external) - return 1; - -+ /* -+ * Shouldn't use mnt_bind list before it was populated in search_bindmounts -+ */ -+ BUG_ON(!m->mnt_bind_is_populated); -+ - if (m->master_id <= 0 && !list_empty(&m->mnt_bind)) - list_for_each_entry(t, &m->mnt_bind, mnt_bind) - if (issubpath(m->root, t->root) && t->external) -@@ -892,6 +897,43 @@ static int same_propagation_group(struct mount_info *a, struct mount_info *b) - return 0; - } - -+/* -+ * Note: Only valid if called consequently on all mounts in mntinfo list. -+ * -+ * Note: We may want to iterate over all bindmounts of some mount, and we would -+ * use ->mnt_bind list for this, but iterating over ->mnt_bind list is -+ * obviously meaningless before search_bindmounts had actually put bindmounts -+ * in it. That's why we have ->mnt_bind_is_populated to protect from misuse of -+ * ->mnt_bind. (As ->mnt_bind list can validly be empty when mount has no -+ * bindmounts we need separate field to indicate population.) -+ */ -+static void __search_bindmounts(struct mount_info *mi) -+{ -+ struct mount_info *t; -+ -+ if (mi->mnt_bind_is_populated) -+ return; -+ -+ for (t = mi->next; t; t = t->next) { -+ if (mounts_sb_equal(mi, t)) { -+ list_add(&t->mnt_bind, &mi->mnt_bind); -+ t->mnt_bind_is_populated = true; -+ pr_debug("\tThe mount %3d is bind for %3d (@%s -> @%s)\n", t->mnt_id, mi->mnt_id, t->mountpoint, -+ mi->mountpoint); -+ } -+ } -+ -+ mi->mnt_bind_is_populated = true; -+} -+ -+static void search_bindmounts(void) -+{ -+ struct mount_info *mi; -+ -+ for (mi = mntinfo; mi; mi = mi->next) -+ __search_bindmounts(mi); -+} -+ - static int resolve_shared_mounts(struct mount_info *info, int root_master_id) - { - struct mount_info *m, *t; -@@ -944,21 +986,6 @@ static int resolve_shared_mounts(struct mount_info *info, int root_master_id) - m->mnt_id, m->mountpoint, m->master_id, m->shared_id); - return -1; - } -- -- /* Search bind-mounts */ -- if (list_empty(&m->mnt_bind)) { -- /* -- * A first mounted point will be set up as a source point -- * for others. Look at propagate_mount() -- */ -- for (t = m->next; t; t = t->next) { -- if (mounts_sb_equal(m, t)) { -- list_add(&t->mnt_bind, &m->mnt_bind); -- pr_debug("\tThe mount %3d is bind for %3d (@%s -> @%s)\n", t->mnt_id, m->mnt_id, -- t->mountpoint, m->mountpoint); -- } -- } -- } - } - - /* Search propagation groups */ -@@ -1539,6 +1566,7 @@ static __maybe_unused int add_cr_time_mount(struct mount_info *root, char *fsnam - break; - } - -+ mi->mnt_bind_is_populated = true; - mi->nsid = parent->nsid; - mi->parent = parent; - mi->parent_mnt_id = parent->mnt_id; -@@ -3143,6 +3171,9 @@ int read_mnt_ns_img(void) - } - - mntinfo = pms; -+ -+ search_bindmounts(); -+ - return 0; - } - -@@ -3320,6 +3351,7 @@ static int populate_mnt_ns(void) - - root_yard_mp->mountpoint = mnt_roots; - root_yard_mp->mounted = true; -+ root_yard_mp->mnt_bind_is_populated = true; - - if (merge_mount_trees(root_yard_mp)) - return -1; -@@ -3756,6 +3788,8 @@ int collect_mnt_namespaces(bool for_dump) - if (ret) - goto err; - -+ search_bindmounts(); -+ - #ifdef CONFIG_BINFMT_MISC_VIRTUALIZED - if (for_dump && !opts.has_binfmt_misc) { - unsigned int s_dev = 0; --- -2.35.1 - diff --git a/0161-util-add-get_relative_path-helper.patch b/0161-util-add-get_relative_path-helper.patch deleted file mode 100644 index 5b4a914..0000000 --- a/0161-util-add-get_relative_path-helper.patch +++ /dev/null @@ -1,142 +0,0 @@ -From 0cffe29ffba7f1363bdaf550347396eb90c6c1e9 Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Thu, 14 May 2020 13:50:20 +0300 -Subject: [PATCH 161/249] util: add get_relative_path helper - -This is a smart way of getting relative paths: - -1) Always returns relative path, no unexpected starting '/'; -2) Detects subpath even if path formats are different, only real directory -and file names matter; -3) No path modiffication/allocation, returns shifted pointer to the -orignal path. - -We have many places where we need to cut subpath from path. Different code -blocks doing this job spread widely across the codebase for instance see: -cut_root_for_bind and root_path_from_parent. But those implementations rely on -the fact that subpath's and path's formats are the same. - -When we modify or concatenate paths we can accidentally get strange -path formats, paths given by user can have strange format, and the job -to manually maintain all paths in "simple" format everywhere is too -hard. So let's just add a tool to compare "strange" paths. - -E.g.: - -get_relative_path("./a////.///./b//././c", "///./a/b") == "c" - -Note: ".." in path is not supported, and we just can't support it right -without full filesystem tree information to resolve paths like -"../../a", so we just treat ".." as a directory name which should work -in simple cases. - -Cherry-picked from Virtuozzo criu: -https://src.openvz.org/projects/OVZ/repos/criu/commits/73a771348 - -Changes: add other useful robust path comparison helpers is_sub_path and -is_same_path based on get_relative_path, fix clang-format. - -Signed-off-by: Pavel Tikhomirov ---- - criu/include/util.h | 4 +++ - criu/util.c | 72 +++++++++++++++++++++++++++++++++++++++++++++ - 2 files changed, 76 insertions(+) - -diff --git a/criu/include/util.h b/criu/include/util.h -index ca934dea0..0df1fe266 100644 ---- a/criu/include/util.h -+++ b/criu/include/util.h -@@ -241,6 +241,10 @@ static inline bool issubpath(const char *path, const char *sub_path) - return strstartswith2(path, sub_path, &end) && (end == '/' || end == '\0'); - } - -+extern char *get_relative_path(char *path, char *sub_path); -+extern bool is_sub_path(char *path, char *sub_path); -+extern bool is_same_path(char *path1, char *path2); -+ - int strip_deleted(char *path, int len); - int cut_path_ending(char *path, char *sub_path); - -diff --git a/criu/util.c b/criu/util.c -index d83be0c0d..f14e6467f 100644 ---- a/criu/util.c -+++ b/criu/util.c -@@ -1815,3 +1815,75 @@ void util_init() - clock_gettime(CLOCK_MONOTONIC, &tp); - criu_run_id = ((uint64_t)getpid() << 32) + tp.tv_sec + tp.tv_nsec; - } -+ -+/* -+ * This function cuts sub_path from the path. -+ * 1) It asumes all relative paths given are relative to "/": -+ * /a/b/c is the same as a/b/c -+ * 2) It can handle paths with multiple consequent slashes: -+ * ///a///b///c is the same as /a/b/c -+ * 3) It always returns relative path, with no leading slash: -+ * get_relative_path("/a/b/c", "/") would be "a/b/c" -+ * get_relative_path("/a/b/c", "/a/b") would be "c" -+ * get_relative_path("/", "/") would be "" -+ * 4) It can handle paths with single dots: -+ * get_relative_path("./a/b", "a/") would be "b" -+ * 5) Note ".." in paths are not supported and handled as normal directory name -+ */ -+char *get_relative_path(char *path, char *sub_path) -+{ -+ bool skip_slashes = true; -+ -+ while (1) { -+ if ((*path == '/' || *path == '\0') && (*sub_path == '/' || *sub_path == '\0')) -+ skip_slashes = true; -+ -+ if (skip_slashes) { -+ while (*path == '/' || (path[0] == '.' && (path[1] == '/' || path[1] == '\0'))) -+ path++; -+ while (*sub_path == '/' || (sub_path[0] == '.' && (sub_path[1] == '/' || sub_path[1] == '\0'))) -+ sub_path++; -+ } -+ -+ if (*sub_path == '\0') { -+ if (skip_slashes) -+ return path; -+ return NULL; -+ } -+ skip_slashes = false; -+ -+ if (*path == '\0') -+ return NULL; -+ -+ if (*path != *sub_path) -+ return NULL; -+ -+ path++; -+ sub_path++; -+ } -+ -+ /* will never get here */ -+ return NULL; -+} -+ -+bool is_sub_path(char *path, char *sub_path) -+{ -+ char *rel_path; -+ -+ rel_path = get_relative_path(path, sub_path); -+ if (!rel_path) -+ return false; -+ -+ return true; -+} -+ -+bool is_same_path(char *path1, char *path2) -+{ -+ char *rel_path; -+ -+ rel_path = get_relative_path(path1, path2); -+ if (!rel_path || *rel_path != '\0') -+ return false; -+ -+ return true; -+} --- -2.35.1 - diff --git a/0162-unittest-add-some-tests-for-get_relative_path-helper.patch b/0162-unittest-add-some-tests-for-get_relative_path-helper.patch deleted file mode 100644 index f8fff5b..0000000 --- a/0162-unittest-add-some-tests-for-get_relative_path-helper.patch +++ /dev/null @@ -1,138 +0,0 @@ -From b3ddb46a0f5d91320f0901cd47e26e3c89a2bcc4 Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Wed, 19 Jan 2022 12:34:51 +0300 -Subject: [PATCH 162/249] unittest: add some tests for get_relative_path helper - -v2: let's also mock kerndat_s.sysctl_nr_open field, to make aarch64 -clang ci happy - -Signed-off-by: Pavel Tikhomirov ---- - criu/Makefile | 1 + - criu/unittest/mock.c | 39 +++++++++++++++++++++++++++++++++++++++ - criu/unittest/unit.c | 43 +++++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 83 insertions(+) - -diff --git a/criu/Makefile b/criu/Makefile -index db4e9d81f..55bdb1b7a 100644 ---- a/criu/Makefile -+++ b/criu/Makefile -@@ -87,6 +87,7 @@ $(obj)/criu: $(PROGRAM-BUILTINS) - $(call msg-link, $@) - $(Q) $(CC) $(CFLAGS) $^ $(LIBS) $(WRAPFLAGS) $(LDFLAGS) $(GMONLDOPT) -rdynamic -o $@ - -+UNIT-BUILTINS += $(obj)/util.o - UNIT-BUILTINS += $(obj)/config.o - UNIT-BUILTINS += $(obj)/log.o - UNIT-BUILTINS += $(obj)/string.o -diff --git a/criu/unittest/mock.c b/criu/unittest/mock.c -index fb9d38494..127cc7498 100644 ---- a/criu/unittest/mock.c -+++ b/criu/unittest/mock.c -@@ -97,3 +97,42 @@ int close_service_fd(int type) - void compel_log_init(int log_fn, unsigned int level) - { - } -+ -+void set_cr_errno(int new_err) -+{ -+} -+ -+struct ns_desc { -+}; -+struct ns_desc user_ns_desc; -+int switch_ns(int pid, struct ns_desc *nd, int *rst) -+{ -+ return -1; -+} -+ -+enum script_actions { ACT_FAKE }; -+int run_scripts(enum script_actions act) -+{ -+ return -1; -+} -+ -+typedef struct VmaEntry VmaEntry; -+struct VmaEntry { -+}; -+void vma_entry__init(VmaEntry *message) -+{ -+} -+ -+int clone_noasan(int (*fn)(void *), int flags, void *arg) -+{ -+ return -1; -+} -+ -+struct kerndat_s { -+ unsigned int sysctl_nr_open; -+}; -+struct kerndat_s kdat = {}; -+ -+int service_fd_rlim_cur; -+ -+unsigned __page_size; -diff --git a/criu/unittest/unit.c b/criu/unittest/unit.c -index 3ee141e25..54769e6f2 100644 ---- a/criu/unittest/unit.c -+++ b/criu/unittest/unit.c -@@ -3,6 +3,7 @@ - #include - - #include "log.h" -+#include "util.h" - #include "criu-log.h" - - int parse_statement(int i, char *line, char **configuration); -@@ -100,6 +101,48 @@ int main(int argc, char *argv[], char *envp[]) - i = parse_statement(0, "a b c d e f g h i\n", configuration); - assert(i == -1); - -+ /* get_relative_path */ -+ /* different kinds of representation of "/" */ -+ assert(!strcmp(get_relative_path("/", "/"), "")); -+ assert(!strcmp(get_relative_path("/", ""), "")); -+ assert(!strcmp(get_relative_path("", "/"), "")); -+ assert(!strcmp(get_relative_path(".", "/"), "")); -+ assert(!strcmp(get_relative_path("/", "."), "")); -+ assert(!strcmp(get_relative_path("/", "./"), "")); -+ assert(!strcmp(get_relative_path("./", "/"), "")); -+ assert(!strcmp(get_relative_path("/.", "./"), "")); -+ assert(!strcmp(get_relative_path("./", "/."), "")); -+ assert(!strcmp(get_relative_path(".//////.", ""), "")); -+ assert(!strcmp(get_relative_path("/./", ""), "")); -+ -+ /* all relative paths given are assumed relative to "/" */ -+ assert(!strcmp(get_relative_path("/a/b/c", "a/b/c"), "")); -+ -+ /* multiple slashes are ignored, only directory names matter */ -+ assert(!strcmp(get_relative_path("///alfa///beta///gamma///", "//alfa//beta//gamma//"), "")); -+ -+ /* returned path is always relative */ -+ assert(!strcmp(get_relative_path("/a/b/c", "/"), "a/b/c")); -+ assert(!strcmp(get_relative_path("/a/b/c", "/a/b"), "c")); -+ -+ /* single dots supported */ -+ assert(!strcmp(get_relative_path("./a/b", "a/"), "b")); -+ -+ /* double dots are partially supported */ -+ assert(!strcmp(get_relative_path("a/../b", "a"), "../b")); -+ assert(!strcmp(get_relative_path("a/../b", "a/.."), "b")); -+ assert(!get_relative_path("a/../b/c", "b")); -+ -+ /* if second path is not subpath - NULL returned */ -+ assert(!get_relative_path("/a/b/c", "/a/b/d")); -+ assert(!get_relative_path("/a/b", "/a/b/c")); -+ assert(!get_relative_path("/a/b/c/d", "b/c/d")); -+ -+ assert(!strcmp(get_relative_path("./a////.///./b//././c", "///./a/b"), "c")); -+ -+ /* leaves punctuation in returned string as is */ -+ assert(!strcmp(get_relative_path("./a////.///./b//././c", "a"), "b//././c")); -+ - pr_msg("OK\n"); - return 0; - } --- -2.35.1 - diff --git a/0163-mount-add-mnt_bind_pick-helper-to-pick-the-desired-b.patch b/0163-mount-add-mnt_bind_pick-helper-to-pick-the-desired-b.patch deleted file mode 100644 index 9acf5fe..0000000 --- a/0163-mount-add-mnt_bind_pick-helper-to-pick-the-desired-b.patch +++ /dev/null @@ -1,62 +0,0 @@ -From 043054396886bf7c1fc85a4e51bbf35aad6a47fb Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Mon, 29 Nov 2021 12:54:51 +0300 -Subject: [PATCH 163/249] mount: add mnt_bind_pick helper to pick the desired - bind - -Adding different pick functions we would be able to search different -things like mounted bind with wider root, or external bind, or external -bind with same sharing group and so on and so forth. - -Signed-off-by: Pavel Tikhomirov ---- - criu/include/mount.h | 2 ++ - criu/mount.c | 21 +++++++++++++++++++++ - 2 files changed, 23 insertions(+) - -diff --git a/criu/include/mount.h b/criu/include/mount.h -index 03959e1b0..c782d84bb 100644 ---- a/criu/include/mount.h -+++ b/criu/include/mount.h -@@ -173,4 +173,6 @@ extern int remount_readonly_mounts(void); - extern int try_remount_writable(struct mount_info *mi, bool ns); - extern bool mnt_is_overmounted(struct mount_info *mi); - -+extern struct mount_info *mnt_bind_pick(struct mount_info *mi, -+ bool (*pick)(struct mount_info *mi, struct mount_info *bind)); - #endif /* __CR_MOUNT_H__ */ -diff --git a/criu/mount.c b/criu/mount.c -index de6722e69..fcdf06d50 100644 ---- a/criu/mount.c -+++ b/criu/mount.c -@@ -934,6 +934,27 @@ static void search_bindmounts(void) - __search_bindmounts(mi); - } - -+struct mount_info *mnt_bind_pick(struct mount_info *mi, bool (*pick)(struct mount_info *mi, struct mount_info *bind)) -+{ -+ struct mount_info *bind; -+ -+ BUG_ON(!mi); -+ -+ if (pick(mi, mi)) -+ return mi; -+ -+ /* -+ * Shouldn't use mnt_bind list before it was populated in search_bindmounts -+ */ -+ BUG_ON(!mi->mnt_bind_is_populated); -+ -+ list_for_each_entry(bind, &mi->mnt_bind, mnt_bind) -+ if (pick(mi, bind)) -+ return bind; -+ -+ return NULL; -+} -+ - static int resolve_shared_mounts(struct mount_info *info, int root_master_id) - { - struct mount_info *m, *t; --- -2.35.1 - diff --git a/0164-mount-split-mnt_is_external-_bind-and-can_receive_ma.patch b/0164-mount-split-mnt_is_external-_bind-and-can_receive_ma.patch deleted file mode 100644 index f957c86..0000000 --- a/0164-mount-split-mnt_is_external-_bind-and-can_receive_ma.patch +++ /dev/null @@ -1,160 +0,0 @@ -From 0279af775209d9c77cac457deaf927e2a14be126 Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Wed, 18 Dec 2019 13:45:22 +0300 -Subject: [PATCH 164/249] mount: split mnt_is_external(_bind) and - can_receive_master_from_external - -We use mnt_is_external(): - -1) In validate_mounts() to skip fsroot existence check for mounts which -will be bind-mounted from external mounts. - -2) In resolve_shared_mounts() to skip error on slave mounts without -master mount, if they can receive these master_id through external -mount. - -3) In dump_one_fs to skip dump of mounts which will be bind-mounted from -external mounts. - -Cases (1) and (3) are the same, but case (2) is quiet different. Lets -split these cases thus making things simplier. - -Effectively these patch does not change criu's behaviour at all. While -I can't say that old mnt_is_external was wrong, it was too complex and -hard for understanding, so it's worth to switch to lookup across -bindmounts list via general mnt_bind_pick() helper. And now when it is -obvious that mnt_is_external looks for external bindmount, let's also -change it's name to mnt_is_external_bind. - -Cherry-picked from Virtuozzo criu: -https://src.openvz.org/projects/OVZ/repos/criu/commits/494b52ba8 - -Changes: use mnt_bind_pick helper, use is_sub_path helper to be more -robust, rename mnt_is_external to mnt_is_external_bind, fix -clang-format, export to mount.h, use mnt_is_nodev_external as we can not -inherit master from device-external mounts. - -Signed-off-by: Pavel Tikhomirov ---- - criu/include/mount.h | 2 ++ - criu/mount.c | 57 ++++++++++++++++++++------------------------ - 2 files changed, 28 insertions(+), 31 deletions(-) - -diff --git a/criu/include/mount.h b/criu/include/mount.h -index c782d84bb..b21c23975 100644 ---- a/criu/include/mount.h -+++ b/criu/include/mount.h -@@ -173,6 +173,8 @@ extern int remount_readonly_mounts(void); - extern int try_remount_writable(struct mount_info *mi, bool ns); - extern bool mnt_is_overmounted(struct mount_info *mi); - -+extern bool mnt_is_external_bind(struct mount_info *mi); -+ - extern struct mount_info *mnt_bind_pick(struct mount_info *mi, - bool (*pick)(struct mount_info *mi, struct mount_info *bind)); - #endif /* __CR_MOUNT_H__ */ -diff --git a/criu/mount.c b/criu/mount.c -index fcdf06d50..ef50d0fa2 100644 ---- a/criu/mount.c -+++ b/criu/mount.c -@@ -552,39 +552,34 @@ static bool mnt_needs_remap(struct mount_info *m) - return false; - } - --/* -- * Say mount is external if it was explicitly specified as an -- * external or it will be bind from such an explicit external -- * mount, we set bind in propagate_mount and propagate_siblings -- */ -- --static bool mnt_is_external(struct mount_info *m) -+static bool __mnt_is_external_bind(struct mount_info *mi, struct mount_info *bind) - { -- struct mount_info *t; -- -- while (m) { -- if (m->external) -- return 1; -+ if (bind->external && is_sub_path(mi->root, bind->root)) -+ return true; - -- if (!list_empty(&m->mnt_share)) -- list_for_each_entry(t, &m->mnt_share, mnt_share) -- if (t->external) -- return 1; -+ return false; -+} - -- /* -- * Shouldn't use mnt_bind list before it was populated in search_bindmounts -- */ -- BUG_ON(!m->mnt_bind_is_populated); -+/* -+ * Say mount is external if it was explicitly specified as an external or it -+ * can be bind-mounted from such an explicit external mount. -+ */ -+bool mnt_is_external_bind(struct mount_info *mi) -+{ -+ return mnt_bind_pick(mi, __mnt_is_external_bind); -+} - -- if (m->master_id <= 0 && !list_empty(&m->mnt_bind)) -- list_for_each_entry(t, &m->mnt_bind, mnt_bind) -- if (issubpath(m->root, t->root) && t->external) -- return 1; -+static bool __can_receive_master_from_external(struct mount_info *mi, struct mount_info *bind) -+{ -+ if (mnt_is_nodev_external(bind) && bind->master_id == mi->master_id && is_sub_path(mi->root, bind->root)) -+ return true; - -- m = m->mnt_master; -- } -+ return false; -+} - -- return 0; -+static struct mount_info *can_receive_master_from_external(struct mount_info *mi) -+{ -+ return mnt_bind_pick(mi, __can_receive_master_from_external); - } - - /* -@@ -627,7 +622,7 @@ static int validate_mounts(struct mount_info *info, bool for_dump) - if (validate_children_collision(m)) - return -1; - -- if (mnt_is_external(m)) -+ if (mnt_is_external_bind(m)) - continue; - - /* -@@ -1001,7 +996,7 @@ static int resolve_shared_mounts(struct mount_info *info, int root_master_id) - * If we haven't already determined this mount is external, - * or bind of external, then we don't know where it came from. - */ -- if (need_master && m->parent && !mnt_is_external(m)) { -+ if (need_master && m->parent && !can_receive_master_from_external(m)) { - pr_err("Mount %d %s (master_id: %d shared_id: %d) " - "has unreachable sharing. Try --enable-external-masters.\n", - m->mnt_id, m->mountpoint, m->master_id, m->shared_id); -@@ -1640,7 +1635,7 @@ static int dump_one_fs(struct mount_info *mi) - struct mount_info *t; - bool first = true; - -- if (mi->is_ns_root || mi->need_plugin || mnt_is_external(mi) || !mi->fstype->dump) -+ if (mi->is_ns_root || mi->need_plugin || mnt_is_external_bind(mi) || !mi->fstype->dump) - return 0; - - /* mnt_bind is a cycled list, so list_for_each can't be used here. */ -@@ -2925,7 +2920,7 @@ static int get_mp_root(MntEntry *me, struct mount_info *mi) - me->ext_key = me->root; - /* - * Putting the id of external mount which is provided by user, -- * to ->root can confuse mnt_is_external and other functions -+ * to ->root can confuse mnt_is_external_bind and other functions - * which expect to see the path in the file system to the root - * of these mount (mounts_equal, mnt_build_ids_tree, - * find_fsroot_mount_for, find_best_external_match, etc.) --- -2.35.1 - diff --git a/0165-mount-rework-skipping-external-mounts-in-dump_one_mo.patch b/0165-mount-rework-skipping-external-mounts-in-dump_one_mo.patch deleted file mode 100644 index 0b6f898..0000000 --- a/0165-mount-rework-skipping-external-mounts-in-dump_one_mo.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 144368adc5472f96fa8f5e9209e56db23a6f5dc5 Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Wed, 12 Jan 2022 13:34:39 +0300 -Subject: [PATCH 165/249] mount: rework skipping external mounts in - dump_one_mountpoint - -Function dump_one_fs already has mnt_is_external_bind check inside, so -there is no point to check pm->external one more time. - -Function check_bindmount is intended to check devpts bindmount's master -was opened in right mount namespace, but if bindmount is external mount -there is no point to check this. Let's also skip check for bindmounts of -external mounts. - -Signed-off-by: Pavel Tikhomirov ---- - criu/mount.c | 11 +++++------ - 1 file changed, 5 insertions(+), 6 deletions(-) - -diff --git a/criu/mount.c b/criu/mount.c -index ef50d0fa2..844f52e4d 100644 ---- a/criu/mount.c -+++ b/criu/mount.c -@@ -1674,13 +1674,12 @@ static int dump_one_mountpoint(struct mount_info *pm, struct cr_img *img) - if (me.fstype == FSTYPE__AUTO) - me.fsname = pm->fsname; - -- if (!pm->external) { -- if (!pm->dumped && dump_one_fs(pm)) -- return -1; -+ if (!pm->dumped && dump_one_fs(pm)) -+ return -1; - -- if (!fsroot_mounted(pm) && pm->fstype->check_bindmount && pm->fstype->check_bindmount(pm)) -- return -1; -- } -+ if (!mnt_is_external_bind(pm) && !fsroot_mounted(pm) && pm->fstype->check_bindmount && -+ pm->fstype->check_bindmount(pm)) -+ return -1; - - if (pm->mnt_id == CRTIME_MNT_ID) { - pr_info("Skip dumping cr-time mountpoint: %s\n", pm->mountpoint); --- -2.35.1 - diff --git a/0166-mount-show-more-info-about-why-we-can-t-mount.patch b/0166-mount-show-more-info-about-why-we-can-t-mount.patch deleted file mode 100644 index 2abffc0..0000000 --- a/0166-mount-show-more-info-about-why-we-can-t-mount.patch +++ /dev/null @@ -1,108 +0,0 @@ -From d97b7cce246e7c5615ffac0f4df6b509f13bf66e Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Thu, 12 Sep 2019 10:10:37 +0300 -Subject: [PATCH 166/249] mount: show more info about why we can't mount - -Currently if we have mount deadlock it is hard to understand which -mounts lock each other, these makes it easier. - -Cherry-picked from Virtuozzo criu: -https://src.openvz.org/projects/OVZ/repos/criu/commits/8ba8499e2 -Cherry-picked from Virtuozzo criu: -https://src.openvz.org/projects/OVZ/repos/criu/commits/48d044ae11 - -Changes: merge newline fixup. - -Signed-off-by: Pavel Tikhomirov ---- - criu/mount.c | 42 ++++++++++++++++++++++++++++++++---------- - 1 file changed, 32 insertions(+), 10 deletions(-) - -diff --git a/criu/mount.c b/criu/mount.c -index 844f52e4d..f1c970da6 100644 ---- a/criu/mount.c -+++ b/criu/mount.c -@@ -2426,8 +2426,10 @@ static bool rst_mnt_is_root(struct mount_info *m) - - static bool can_mount_now(struct mount_info *mi) - { -- if (rst_mnt_is_root(mi)) -+ if (rst_mnt_is_root(mi)) { -+ pr_debug("%s: true as %d is mntns root\n", __func__, mi->mnt_id); - return true; -+ } - - /* Parent should be mounted already, that's how mnt_tree_for_each works */ - BUG_ON(mi->parent && !mi->parent->mounted); -@@ -2444,21 +2446,35 @@ static bool can_mount_now(struct mount_info *mi) - if (mi->mnt_master) { - struct mount_info *c, *s; - -- if (mi->bind == NULL) -+ if (mi->bind == NULL) { -+ pr_debug("%s: false as %d is slave with unmounted master %d\n", __func__, mi->mnt_id, -+ mi->mnt_master->mnt_id); - return false; -+ } - -- list_for_each_entry(c, &mi->mnt_master->children, siblings) -- if (!c->mounted) -+ list_for_each_entry(c, &mi->mnt_master->children, siblings) { -+ if (!c->mounted) { -+ pr_debug("%s: false as %d is slave with unmounted master's children %d\n", __func__, -+ mi->mnt_id, c->mnt_id); - return false; -+ } -+ } - -- list_for_each_entry(s, &mi->mnt_master->mnt_share, mnt_share) -- list_for_each_entry(c, &s->children, siblings) -- if (!c->mounted) -+ list_for_each_entry(s, &mi->mnt_master->mnt_share, mnt_share) { -+ list_for_each_entry(c, &s->children, siblings) { -+ if (!c->mounted) { -+ pr_debug("%s: false as %d is slave with unmounted children of master's share\n", -+ __func__, mi->mnt_id); - return false; -+ } -+ } -+ } - } - -- if (!fsroot_mounted(mi) && (mi->bind == NULL && !mi->need_plugin)) -+ if (!fsroot_mounted(mi) && (mi->bind == NULL && !mi->need_plugin)) { -+ pr_debug("%s: false as %d is non-root without bind or plugin\n", __func__, mi->mnt_id); - return false; -+ } - - shared: - /* Mount only after all parents of our propagation group mounted */ -@@ -2467,8 +2483,11 @@ shared: - - list_for_each_entry(p, &mi->mnt_propagate, mnt_propagate) { - BUG_ON(!p->parent); -- if (!p->parent->mounted) -+ if (!p->parent->mounted) { -+ pr_debug("%s: false as %d has unmounted parent %d of its propagation group\n", __func__, -+ mi->mnt_id, p->parent->mnt_id); - return false; -+ } - } - } - -@@ -2515,8 +2534,11 @@ shared: - - /* Check not propagated mounts mounted and cleanup list */ - list_for_each_entry_safe(p, t, &mi_notprop, mnt_notprop) { -- if (!p->mounted) -+ if (!p->mounted) { -+ pr_debug("%s: false as %d has unmounted 'anti'-propagation mount %d\n", __func__, -+ mi->mnt_id, p->mnt_id); - can = false; -+ } - list_del_init(&p->mnt_notprop); - } - --- -2.35.1 - diff --git a/0167-mount-mount-external-mount-before-mounting-it-s-bind.patch b/0167-mount-mount-external-mount-before-mounting-it-s-bind.patch deleted file mode 100644 index 79067a3..0000000 --- a/0167-mount-mount-external-mount-before-mounting-it-s-bind.patch +++ /dev/null @@ -1,103 +0,0 @@ -From 69deac23b1eaf0809aed65d991985b06324e0bd1 Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Mon, 17 Feb 2020 11:58:41 +0300 -Subject: [PATCH 167/249] mount: mount external mount before mounting it's - binds - -The problem when we don't order these mounts we can get to mounting -non-external bind first via do_new_mount and fail c/r. For instance for -tmpfs we would fail on no image to get contents from. See the test -mnt_ext_root for more info. - -Cherry-picked from Virtuozzo criu: -https://src.openvz.org/projects/OVZ/repos/criu/commits/baf3f8db8 - -Changes: switch to mnt_bind_pick helper, export to mount.h, make check -in can_mount_now skip mounts with ->bind set. - -Signed-off-by: Pavel Tikhomirov ---- - criu/include/mount.h | 2 ++ - criu/mount.c | 27 ++++++++++++++++++++++++++- - 2 files changed, 28 insertions(+), 1 deletion(-) - -diff --git a/criu/include/mount.h b/criu/include/mount.h -index b21c23975..7dffe5b2c 100644 ---- a/criu/include/mount.h -+++ b/criu/include/mount.h -@@ -173,7 +173,9 @@ extern int remount_readonly_mounts(void); - extern int try_remount_writable(struct mount_info *mi, bool ns); - extern bool mnt_is_overmounted(struct mount_info *mi); - -+extern struct mount_info *mnt_get_external_bind(struct mount_info *mi); - extern bool mnt_is_external_bind(struct mount_info *mi); -+extern bool has_mounted_external_bind(struct mount_info *mi); - - extern struct mount_info *mnt_bind_pick(struct mount_info *mi, - bool (*pick)(struct mount_info *mi, struct mount_info *bind)); -diff --git a/criu/mount.c b/criu/mount.c -index f1c970da6..968b6dc03 100644 ---- a/criu/mount.c -+++ b/criu/mount.c -@@ -564,11 +564,16 @@ static bool __mnt_is_external_bind(struct mount_info *mi, struct mount_info *bin - * Say mount is external if it was explicitly specified as an external or it - * can be bind-mounted from such an explicit external mount. - */ --bool mnt_is_external_bind(struct mount_info *mi) -+struct mount_info *mnt_get_external_bind(struct mount_info *mi) - { - return mnt_bind_pick(mi, __mnt_is_external_bind); - } - -+bool mnt_is_external_bind(struct mount_info *mi) -+{ -+ return mnt_get_external_bind(mi); -+} -+ - static bool __can_receive_master_from_external(struct mount_info *mi, struct mount_info *bind) - { - if (mnt_is_nodev_external(bind) && bind->master_id == mi->master_id && is_sub_path(mi->root, bind->root)) -@@ -582,6 +587,19 @@ static struct mount_info *can_receive_master_from_external(struct mount_info *mi - return mnt_bind_pick(mi, __can_receive_master_from_external); - } - -+static bool __has_mounted_external_bind(struct mount_info *mi, struct mount_info *bind) -+{ -+ if (bind->external && bind->mounted && is_sub_path(mi->root, bind->root)) -+ return true; -+ -+ return false; -+} -+ -+bool has_mounted_external_bind(struct mount_info *mi) -+{ -+ return mnt_bind_pick(mi, __has_mounted_external_bind); -+} -+ - /* - * Having two children with same mountpoint is unsupported. That can happen in - * case of mount propagation inside of shared mounts, in that case it is hard -@@ -2426,6 +2444,8 @@ static bool rst_mnt_is_root(struct mount_info *m) - - static bool can_mount_now(struct mount_info *mi) - { -+ struct mount_info *ext; -+ - if (rst_mnt_is_root(mi)) { - pr_debug("%s: true as %d is mntns root\n", __func__, mi->mnt_id); - return true; -@@ -2437,6 +2457,11 @@ static bool can_mount_now(struct mount_info *mi) - if (mnt_is_nodev_external(mi)) - goto shared; - -+ if (!mi->bind && !mi->external && (ext = mnt_get_external_bind(mi)) && !has_mounted_external_bind(mi)) { -+ pr_debug("%s: false as %d's external %d is not mounted\n", __func__, mi->mnt_id, ext->mnt_id); -+ return false; -+ } -+ - /* - * We're the slave peer: - * - Make sure the master peer is already mounted --- -2.35.1 - diff --git a/0168-zdtm-add-new-mnt_ext_root-test.patch b/0168-zdtm-add-new-mnt_ext_root-test.patch deleted file mode 100644 index e6a6db3..0000000 --- a/0168-zdtm-add-new-mnt_ext_root-test.patch +++ /dev/null @@ -1,162 +0,0 @@ -From 3568904e11811e3ff8831810e5013fe3e925322e Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Tue, 18 Feb 2020 13:41:18 +0300 -Subject: [PATCH 168/249] zdtm: add new mnt_ext_root test - -This test simply creates a) root external mount and b) "deeper" -bindmount for it (deeper in terms of mnt_depth). Our mount restore code -tries to mount (b) first and fails (without previous patch ordering -external mounts before their binds). - -Cherry-picked from Virtuozzo criu: -https://src.openvz.org/projects/OVZ/repos/criu/commits/d31954669 - -Signed-off-by: Pavel Tikhomirov ---- - test/zdtm/static/Makefile | 1 + - test/zdtm/static/mnt_ext_root.c | 88 ++++++++++++++++++++++++++++++ - test/zdtm/static/mnt_ext_root.desc | 5 ++ - test/zdtm/static/mnt_ext_root.hook | 12 ++++ - 4 files changed, 106 insertions(+) - create mode 100644 test/zdtm/static/mnt_ext_root.c - create mode 100644 test/zdtm/static/mnt_ext_root.desc - create mode 100755 test/zdtm/static/mnt_ext_root.hook - -diff --git a/test/zdtm/static/Makefile b/test/zdtm/static/Makefile -index 33e15f85a..a64c51cd0 100644 ---- a/test/zdtm/static/Makefile -+++ b/test/zdtm/static/Makefile -@@ -399,6 +399,7 @@ TST_DIR = \ - mnt_ext_auto \ - mnt_ext_master \ - mnt_ext_dev \ -+ mnt_ext_root \ - mnt_tracefs \ - mntns_deleted \ - unlink_regular00 \ -diff --git a/test/zdtm/static/mnt_ext_root.c b/test/zdtm/static/mnt_ext_root.c -new file mode 100644 -index 000000000..9f9554d51 ---- /dev/null -+++ b/test/zdtm/static/mnt_ext_root.c -@@ -0,0 +1,88 @@ -+#include -+#include -+#include -+#include -+ -+#include "zdtmtst.h" -+ -+const char *test_doc = "Check root external mount with \"deepper\" bind"; -+const char *test_author = "Pavel Tikhomirov "; -+ -+char *source = "zdtm_ext_root"; -+char *dirname = "mnt_ext_root.test"; -+TEST_OPTION(dirname, string, "directory name", 1); -+ -+#define BUF_SIZE 4096 -+ -+int main(int argc, char **argv) -+{ -+ char *root, testdir[PATH_MAX]; -+ char dst[PATH_MAX], deep_bind[PATH_MAX]; -+ char *tmp = "/tmp/zdtm_ext_root.tmp"; -+ char *zdtm_newns = getenv("ZDTM_NEWNS"); -+ -+ root = getenv("ZDTM_ROOT"); -+ if (root == NULL) { -+ pr_perror("root"); -+ return 1; -+ } -+ -+ if (!zdtm_newns) { -+ pr_perror("ZDTM_NEWNS is not set"); -+ return 1; -+ } else if (strcmp(zdtm_newns, "1")) { -+ goto test; -+ } -+ -+ /* Prepare directories in test root */ -+ sprintf(testdir, "%s/%s", root, dirname); -+ mkdir(testdir, 0755); -+ -+ sprintf(dst, "%s/%s/dst", root, dirname); -+ mkdir(dst, 0755); -+ sprintf(deep_bind, "%s/%s/deep", root, dirname); -+ mkdir(deep_bind, 0755); -+ sprintf(deep_bind, "%s/%s/deep/bind", root, dirname); -+ mkdir(deep_bind, 0755); -+ -+ /* Prepare mount in criu root */ -+ mkdir(tmp, 0755); -+ if (mount(source, tmp, "tmpfs", 0, NULL)) { -+ pr_perror("mount tmpfs"); -+ return 1; -+ } -+ if (mount(NULL, tmp, NULL, MS_PRIVATE, NULL)) { -+ pr_perror("make private"); -+ return 1; -+ } -+ -+ /* -+ * Create temporary mntns, next mounts will not show up in criu mntns -+ */ -+ if (unshare(CLONE_NEWNS)) { -+ pr_perror("unshare"); -+ return 1; -+ } -+ -+ /* -+ * Populate to the tests mntns root mounts -+ */ -+ if (mount(tmp, dst, NULL, MS_BIND, NULL)) { -+ pr_perror("bind"); -+ return 1; -+ } -+ -+ if (mount(tmp, deep_bind, NULL, MS_BIND, NULL)) { -+ pr_perror("bind"); -+ return 1; -+ } -+ -+test: -+ test_init(argc, argv); -+ -+ test_daemon(); -+ test_waitsig(); -+ -+ pass(); -+ return 0; -+} -diff --git a/test/zdtm/static/mnt_ext_root.desc b/test/zdtm/static/mnt_ext_root.desc -new file mode 100644 -index 000000000..121dbb0a7 ---- /dev/null -+++ b/test/zdtm/static/mnt_ext_root.desc -@@ -0,0 +1,5 @@ -+{ 'dopts': '--external mnt[/mnt_ext_root.test/dst]:ZDTM', -+ 'feature': 'mnt_id', -+ 'flavor': 'ns uns', -+ 'flags': 'suid', -+ 'ropts': '--external mnt[ZDTM]:/tmp/zdtm_ext_root.tmp'} -diff --git a/test/zdtm/static/mnt_ext_root.hook b/test/zdtm/static/mnt_ext_root.hook -new file mode 100755 -index 000000000..c022f91ad ---- /dev/null -+++ b/test/zdtm/static/mnt_ext_root.hook -@@ -0,0 +1,12 @@ -+#!/bin/bash -+ -+[ "$1" == "--clean" ] || exit 0 -+ -+TMP="/tmp/zdtm_ext_root.tmp" -+echo "Cleanup mnt_ext_sharing" -+umount "$TMP" -+rm -rf $TMP -+ -+rm -rf "mnt_ext_root.test" -+ -+exit 0 --- -2.35.1 - diff --git a/0169-mount-restrict-mp-external-mount-map-to-init-contain.patch b/0169-mount-restrict-mp-external-mount-map-to-init-contain.patch deleted file mode 100644 index f07e1db..0000000 --- a/0169-mount-restrict-mp-external-mount-map-to-init-contain.patch +++ /dev/null @@ -1,66 +0,0 @@ -From 23fecb92464ed85436b60fe2fc484bb02d0a7674 Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Fri, 26 Nov 2021 12:53:41 +0300 -Subject: [PATCH 169/249] mount: restrict mp-external mount map to init - container mntns only - -We resolve mountpoint-external mounts on dump by mountpoint comparison, -so if we have other mount (other superblock e.g. in nested mntns) with -same mountpoint we would also resolve this mount as external and restore -it as external: replacing it completely with different mount... That's -wrong, so to make this interface more robust let's only resolve -mountpoint-external mounts in root mntns of container, not in all -mntnses as it was before. - -Note: if actual external mount (bind of external) gets to nested mntns -it's ok not to resolve it as external as criu would bind it from the -resolved mount in root mntns. So external mounts in nested mntns are -still supported after this patch. - -Cherry-picked one hunk from Virtuozzo criu: -https://src.openvz.org/projects/OVZ/repos/criu/commits/034498b28 - -Changes: apply mntns check only to mountpoint-external mounts. - -Signed-off-by: Pavel Tikhomirov ---- - criu/mount.c | 21 +++++++++++++++------ - 1 file changed, 15 insertions(+), 6 deletions(-) - -diff --git a/criu/mount.c b/criu/mount.c -index 968b6dc03..ff9b9b591 100644 ---- a/criu/mount.c -+++ b/criu/mount.c -@@ -470,14 +470,23 @@ static void mnt_tree_show(struct mount_info *tree, int off) - /* Returns -1 on error, 1 if external mount resolved, 0 otherwise */ - static int try_resolve_ext_mount(struct mount_info *info) - { -- char *ext; - char devstr[64]; - -- ext = ext_mount_lookup(info->mountpoint + 1 /* trim the . */); -- if (ext) { -- pr_info("Found %s mapping for %s mountpoint\n", ext, info->mountpoint); -- info->external = ext; -- return 1; -+ /* -+ * Only allow mountpoint-external mounts in root mntns. Their lookup is -+ * based on mountpoint path, but in nested mntns we can have completely -+ * different mount tree and at same mountpoint we can have completely -+ * different mount. -+ */ -+ if (info->nsid->type == NS_ROOT) { -+ char *ext; -+ -+ ext = ext_mount_lookup(info->mountpoint + 1 /* trim the . */); -+ if (ext) { -+ pr_info("Found %s mapping for %s mountpoint\n", ext, info->mountpoint); -+ info->external = ext; -+ return 1; -+ } - } - - snprintf(devstr, sizeof(devstr), "dev[%d/%d]", kdev_major(info->s_dev), kdev_minor(info->s_dev)); --- -2.35.1 - diff --git a/0170-zdtm-add-mnt_ext_collision-test.patch b/0170-zdtm-add-mnt_ext_collision-test.patch deleted file mode 100644 index e4ac88f..0000000 --- a/0170-zdtm-add-mnt_ext_collision-test.patch +++ /dev/null @@ -1,273 +0,0 @@ -From 528a9ee1e4999063f0837f0096dcb22b22e7ad79 Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Wed, 12 Jan 2022 16:00:56 +0300 -Subject: [PATCH 170/249] zdtm: add mnt_ext_collision test - -This test creates two mount namespaces, one "root" with external mount -at /mnt_ext_collision.test/dst and one "nested" with different internal -mount at /mnt_ext_collision.test/dst instead. - -This case is important for nested containers, if we dump a container -with some external mount in /mnt we should not also replace mounts in -/mnt for nested containers with the external one. (One example is docker -containers inside Virtuozzo containers.) - -Without previous patch which restricts external mounts resolution to -only root mntns of container this test fails as internal mount is -replaced by external one after migration. - -Signed-off-by: Pavel Tikhomirov ---- - test/zdtm/static/Makefile | 1 + - test/zdtm/static/mnt_ext_collision.c | 194 ++++++++++++++++++++++++ - test/zdtm/static/mnt_ext_collision.desc | 5 + - test/zdtm/static/mnt_ext_collision.hook | 12 ++ - 4 files changed, 212 insertions(+) - create mode 100644 test/zdtm/static/mnt_ext_collision.c - create mode 100644 test/zdtm/static/mnt_ext_collision.desc - create mode 100755 test/zdtm/static/mnt_ext_collision.hook - -diff --git a/test/zdtm/static/Makefile b/test/zdtm/static/Makefile -index a64c51cd0..565b32400 100644 ---- a/test/zdtm/static/Makefile -+++ b/test/zdtm/static/Makefile -@@ -400,6 +400,7 @@ TST_DIR = \ - mnt_ext_master \ - mnt_ext_dev \ - mnt_ext_root \ -+ mnt_ext_collision \ - mnt_tracefs \ - mntns_deleted \ - unlink_regular00 \ -diff --git a/test/zdtm/static/mnt_ext_collision.c b/test/zdtm/static/mnt_ext_collision.c -new file mode 100644 -index 000000000..324a3484c ---- /dev/null -+++ b/test/zdtm/static/mnt_ext_collision.c -@@ -0,0 +1,194 @@ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "zdtmtst.h" -+#include "lock.h" -+ -+const char *test_doc = "Check external mount mountpoint collide with different mount in nested mntns"; -+const char *test_author = "Pavel Tikhomirov "; -+ -+char *dirname = "mnt_ext_collision.test"; -+TEST_OPTION(dirname, string, "directory name", 1); -+ -+char *source = "zdtm_ext_collision"; -+char *source2 = "zdtm_ext_collision_2"; -+ -+enum { -+ TEST_INIT = 0, -+ TEST_CHILD, -+ TEST_CHECK, -+ TEST_EXIT, -+ EMERGENCY_ABORT, -+}; -+ -+futex_t *futex; -+ -+#define BUF_SIZE 4096 -+ -+static int child(void) -+{ -+ char dst[PATH_MAX], dst_file[PATH_MAX]; -+ int fd; -+ -+ if (unshare(CLONE_NEWNS)) { -+ pr_perror("unshare"); -+ goto err; -+ } -+ -+ /* -+ * Umount external mount copy -+ */ -+ sprintf(dst, "/%s/dst", dirname); -+ if (umount(dst)) { -+ pr_perror("umount"); -+ goto err; -+ } -+ -+ /* -+ * Mount tmpfs in its place -+ */ -+ if (mount(source2, dst, "tmpfs", 0, NULL)) { -+ pr_perror("mount tmpfs"); -+ goto err; -+ } -+ -+ sprintf(dst_file, "/%s/dst/file", dirname); -+ fd = open(dst_file, O_RDWR | O_CREAT | O_EXCL, 0666); -+ if (fd < 0) { -+ pr_perror("open"); -+ goto err; -+ } -+ close(fd); -+ -+ futex_set_and_wake(futex, TEST_CHILD); -+ futex_wait_while_lt(futex, TEST_CHECK); -+ -+ if (access(dst_file, F_OK)) { -+ pr_perror("access"); -+ goto err; -+ } -+ -+ futex_set_and_wake(futex, TEST_EXIT); -+ return 0; -+err: -+ futex_set_and_wake(futex, EMERGENCY_ABORT); -+ return 1; -+} -+ -+int main(int argc, char **argv) -+{ -+ char *root, testdir[PATH_MAX]; -+ char lckd[PATH_MAX], dst[PATH_MAX]; -+ char *tmp = "/tmp/zdtm_ext_collision.tmp"; -+ char *zdtm_newns = getenv("ZDTM_NEWNS"); -+ int pid; -+ -+ root = getenv("ZDTM_ROOT"); -+ if (root == NULL) { -+ pr_perror("root"); -+ return 1; -+ } -+ -+ if (!zdtm_newns) { -+ pr_perror("ZDTM_NEWNS is not set"); -+ return 1; -+ } else if (strcmp(zdtm_newns, "1")) { -+ goto test; -+ } -+ -+ /* Prepare directories in test root */ -+ sprintf(testdir, "%s/%s", root, dirname); -+ mkdir(testdir, 0755); -+ -+ sprintf(lckd, "%s/%s/lckd", root, dirname); -+ mkdir(lckd, 0755); -+ sprintf(dst, "%s/%s/dst", root, dirname); -+ mkdir(dst, 0755); -+ -+ /* Prepare mount in criu root */ -+ mkdir(tmp, 0755); -+ if (mount(source, tmp, "tmpfs", 0, NULL)) { -+ pr_perror("mount tmpfs"); -+ return 1; -+ } -+ if (mount(NULL, tmp, NULL, MS_PRIVATE, NULL)) { -+ pr_perror("make private"); -+ return 1; -+ } -+ -+ /* -+ * Create temporary mntns, next mounts will not show up in criu mntns -+ */ -+ if (unshare(CLONE_NEWNS)) { -+ pr_perror("unshare"); -+ return 1; -+ } -+ -+ /* -+ * Populate external mount to the tests mntns root -+ * (in uns flavour this would become locked) -+ */ -+ if (mount(tmp, lckd, NULL, MS_BIND, NULL)) { -+ pr_perror("bind"); -+ return 1; -+ } -+test: -+ test_init(argc, argv); -+ -+ /* -+ * Hack to create unlocked external mount without pivot_root+bind thing -+ */ -+ sprintf(lckd, "/%s/lckd", dirname); -+ sprintf(dst, "/%s/dst", dirname); -+ if (mount(lckd, dst, NULL, MS_BIND, NULL)) { -+ pr_perror("bind"); -+ return 1; -+ } -+ -+ /* -+ * Setup futex for processes syncronization -+ */ -+ futex = mmap(NULL, sizeof(futex), PROT_WRITE | PROT_READ, MAP_SHARED | MAP_ANONYMOUS, -1, 0); -+ if (futex == MAP_FAILED) { -+ pr_perror("mmap"); -+ return 1; -+ } -+ futex_init(futex); -+ -+ /* -+ * Fork child which would have nested mntns -+ */ -+ pid = fork(); -+ if (pid < 0) { -+ pr_perror("fork"); -+ return 1; -+ } else if (pid == 0) { -+ exit(child()); -+ } -+ -+ futex_wait_while_lt(futex, TEST_CHILD); -+ if (futex_get(futex) == EMERGENCY_ABORT) { -+ pr_err("Fail in child\n"); -+ return 1; -+ } -+ -+ test_daemon(); -+ test_waitsig(); -+ -+ futex_set_and_wake(futex, TEST_CHECK); -+ futex_wait_while_lt(futex, TEST_EXIT); -+ if (futex_get(futex) == EMERGENCY_ABORT) { -+ fail("Fail in child on check stage"); -+ return 1; -+ } -+ -+ waitpid(pid, NULL, 0); -+ pass(); -+ return 0; -+} -diff --git a/test/zdtm/static/mnt_ext_collision.desc b/test/zdtm/static/mnt_ext_collision.desc -new file mode 100644 -index 000000000..9b68a4ae0 ---- /dev/null -+++ b/test/zdtm/static/mnt_ext_collision.desc -@@ -0,0 +1,5 @@ -+{ 'dopts': '--external mnt[/mnt_ext_collision.test/dst]:ZDTM', -+ 'feature': 'mnt_id', -+ 'flavor': 'ns uns', -+ 'flags': 'suid', -+ 'ropts': '--external mnt[ZDTM]:/tmp/zdtm_ext_collision.tmp'} -diff --git a/test/zdtm/static/mnt_ext_collision.hook b/test/zdtm/static/mnt_ext_collision.hook -new file mode 100755 -index 000000000..31c908d67 ---- /dev/null -+++ b/test/zdtm/static/mnt_ext_collision.hook -@@ -0,0 +1,12 @@ -+#!/bin/bash -+ -+[ "$1" == "--clean" ] || exit 0 -+ -+TMP="/tmp/zdtm_ext_collision.tmp" -+echo "Cleanup mnt_ext_collision" -+umount "$TMP" -+rm -rf $TMP -+ -+rm -rf "mnt_ext_collision.test" -+ -+exit 0 --- -2.35.1 - diff --git a/0171-mount-add-mnt_is_root_bind-helper.patch b/0171-mount-add-mnt_is_root_bind-helper.patch deleted file mode 100644 index 11a1f20..0000000 --- a/0171-mount-add-mnt_is_root_bind-helper.patch +++ /dev/null @@ -1,119 +0,0 @@ -From dc0bb734ffe7878140a3ba73aa08c522ec145997 Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Fri, 8 May 2020 14:33:13 +0300 -Subject: [PATCH 171/249] mount: add mnt_is_root_bind helper - -Helper mnt_is_root_bind indicates that mount can be bind-mounted from -the root mount (which in it's turn from opts.root). - -Use it in validate_mounts: we should skip unsupported mount from fsroot check -if we know it will be bindmounted from root mount, is_ns_root check was wrong. - -Also fix root mount check in dump_one_fs, root mounts in non root mntns should -be dumped normally if they are not bind-mounts of root mount. - -Cherry-picked from Virtuozzo criu: -https://src.openvz.org/projects/OVZ/repos/criu/commits/25d078971 - -Changes: switch to mnt_bind_pick helper, export to mount.h, also add -mnt_get_root_bind helper for future use in mount-v2, remove excess root -yard hunk. - -Signed-off-by: Pavel Tikhomirov ---- - criu/include/mount.h | 3 +++ - criu/mount.c | 37 +++++++++++++++++++++++++++---------- - 2 files changed, 30 insertions(+), 10 deletions(-) - -diff --git a/criu/include/mount.h b/criu/include/mount.h -index 7dffe5b2c..1ceb394b6 100644 ---- a/criu/include/mount.h -+++ b/criu/include/mount.h -@@ -176,6 +176,9 @@ extern bool mnt_is_overmounted(struct mount_info *mi); - extern struct mount_info *mnt_get_external_bind(struct mount_info *mi); - extern bool mnt_is_external_bind(struct mount_info *mi); - extern bool has_mounted_external_bind(struct mount_info *mi); -+extern bool rst_mnt_is_root(struct mount_info *mi); -+extern struct mount_info *mnt_get_root_bind(struct mount_info *mi); -+extern bool mnt_is_root_bind(struct mount_info *mi); - - extern struct mount_info *mnt_bind_pick(struct mount_info *mi, - bool (*pick)(struct mount_info *mi, struct mount_info *bind)); -diff --git a/criu/mount.c b/criu/mount.c -index ff9b9b591..5591bb67c 100644 ---- a/criu/mount.c -+++ b/criu/mount.c -@@ -609,6 +609,29 @@ bool has_mounted_external_bind(struct mount_info *mi) - return mnt_bind_pick(mi, __has_mounted_external_bind); - } - -+bool rst_mnt_is_root(struct mount_info *mi) -+{ -+ return (mi->is_ns_root && mi->nsid->id == root_item->ids->mnt_ns_id); -+} -+ -+static bool __mnt_is_root_bind(struct mount_info *mi, struct mount_info *bind) -+{ -+ if (rst_mnt_is_root(bind) && is_sub_path(mi->root, bind->root)) -+ return true; -+ -+ return false; -+} -+ -+struct mount_info *mnt_get_root_bind(struct mount_info *mi) -+{ -+ return mnt_bind_pick(mi, __mnt_is_root_bind); -+} -+ -+bool mnt_is_root_bind(struct mount_info *mi) -+{ -+ return mnt_get_root_bind(mi); -+} -+ - /* - * Having two children with same mountpoint is unsupported. That can happen in - * case of mount propagation inside of shared mounts, in that case it is hard -@@ -642,16 +665,15 @@ static int validate_mounts(struct mount_info *info, bool for_dump) - struct mount_info *m, *t; - - for (m = info; m; m = m->next) { -- if (m->parent == NULL || m->is_ns_root) -- /* root mount can be any */ -- continue; -- - if (validate_children_collision(m)) - return -1; - - if (mnt_is_external_bind(m)) - continue; - -+ if (mnt_is_root_bind(m)) -+ continue; -+ - /* - * Mountpoint can point to / of an FS. In that case this FS - * should be of some known type so that we can just mount one. -@@ -1662,7 +1684,7 @@ static int dump_one_fs(struct mount_info *mi) - struct mount_info *t; - bool first = true; - -- if (mi->is_ns_root || mi->need_plugin || mnt_is_external_bind(mi) || !mi->fstype->dump) -+ if (mnt_is_root_bind(mi) || mi->need_plugin || mnt_is_external_bind(mi) || !mi->fstype->dump) - return 0; - - /* mnt_bind is a cycled list, so list_for_each can't be used here. */ -@@ -2446,11 +2468,6 @@ err: - return exit_code; - } - --static bool rst_mnt_is_root(struct mount_info *m) --{ -- return (m->is_ns_root && m->nsid->id == root_item->ids->mnt_ns_id); --} -- - static bool can_mount_now(struct mount_info *mi) - { - struct mount_info *ext; --- -2.35.1 - diff --git a/0172-mount-allow-nested-mount-namespaces-with-different-r.patch b/0172-mount-allow-nested-mount-namespaces-with-different-r.patch deleted file mode 100644 index 0bf7085..0000000 --- a/0172-mount-allow-nested-mount-namespaces-with-different-r.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 7dcab4878092b309bb3a4447e582be031bc0eedd Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Mon, 27 Apr 2020 18:24:54 +0300 -Subject: [PATCH 172/249] mount: allow nested mount namespaces with different - roots - -Only root in root-mntns is special (see rst_mnt_is_root) all other -mounts are mounted regulary there is no difference between ns root and -any other mount or bind-mount. - -Cherry-picked from Virtuozzo criu: -https://src.openvz.org/projects/OVZ/repos/criu/commits/f41e41dd5 - -Signed-off-by: Pavel Tikhomirov ---- - criu/mount.c | 11 ----------- - 1 file changed, 11 deletions(-) - -diff --git a/criu/mount.c b/criu/mount.c -index 5591bb67c..97a903934 100644 ---- a/criu/mount.c -+++ b/criu/mount.c -@@ -3362,7 +3362,6 @@ void fini_restore_mntns(void) - - static int merge_mount_trees(struct mount_info *root_yard) - { -- struct mount_info *first = NULL; - struct ns_id *nsid; - - /* Merge mount trees together under root_yard */ -@@ -3374,16 +3373,6 @@ static int merge_mount_trees(struct mount_info *root_yard) - - root = nsid->mnt.mntinfo_tree; - -- if (!first) -- first = root; -- else if (!mounts_sb_equal(root, first) || strcmp(root->root, first->root)) { -- pr_err("Nested mount namespaces with different " -- "roots %d (@%s %s) %d (@%s %s) are not supported yet\n", -- root->mnt_id, root->mountpoint, root->root, first->mnt_id, first->mountpoint, -- first->root); -- return -1; -- } -- - pr_debug("Mountpoint %d (@%s) moved to the root yard\n", root->mnt_id, root->mountpoint); - root->parent = root_yard; - list_add(&root->siblings, &root_yard->children); --- -2.35.1 - diff --git a/0173-zdtm-add-mntns_pivot_root-test.patch b/0173-zdtm-add-mntns_pivot_root-test.patch deleted file mode 100644 index c56fa1d..0000000 --- a/0173-zdtm-add-mntns_pivot_root-test.patch +++ /dev/null @@ -1,198 +0,0 @@ -From 7de207a821b7c3e5aec9defb4c912a09557fe499 Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Wed, 12 Jan 2022 19:30:07 +0300 -Subject: [PATCH 173/249] zdtm: add mntns_pivot_root test - -This creates nested mntns and does pivot_root to tmpfs mount, so that -roots of original test mntns and in nested mntns are different. - -Before allowing nested mntnses with different roots in previous patch -this would fail. - -Signed-off-by: Pavel Tikhomirov ---- - test/zdtm/static/Makefile | 1 + - test/zdtm/static/mntns_pivot_root.c | 150 +++++++++++++++++++++++++ - test/zdtm/static/mntns_pivot_root.desc | 1 + - 3 files changed, 152 insertions(+) - create mode 100644 test/zdtm/static/mntns_pivot_root.c - create mode 100644 test/zdtm/static/mntns_pivot_root.desc - -diff --git a/test/zdtm/static/Makefile b/test/zdtm/static/Makefile -index 565b32400..a22a0540f 100644 ---- a/test/zdtm/static/Makefile -+++ b/test/zdtm/static/Makefile -@@ -401,6 +401,7 @@ TST_DIR = \ - mnt_ext_dev \ - mnt_ext_root \ - mnt_ext_collision \ -+ mntns_pivot_root \ - mnt_tracefs \ - mntns_deleted \ - unlink_regular00 \ -diff --git a/test/zdtm/static/mntns_pivot_root.c b/test/zdtm/static/mntns_pivot_root.c -new file mode 100644 -index 000000000..987b0da3b ---- /dev/null -+++ b/test/zdtm/static/mntns_pivot_root.c -@@ -0,0 +1,150 @@ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "zdtmtst.h" -+#include "lock.h" -+ -+const char *test_doc = "Check nested mntns with different root"; -+const char *test_author = "Pavel Tikhomirov "; -+ -+char *dirname = "mntns_pivot_root.test"; -+TEST_OPTION(dirname, string, "directory name", 1); -+ -+char *source = "mntns_pivot_root"; -+ -+enum { -+ TEST_INIT = 0, -+ TEST_CHILD, -+ TEST_CHECK, -+ TEST_EXIT, -+ EMERGENCY_ABORT, -+}; -+ -+futex_t *futex; -+ -+static int sys_pivot_root(const char *new_root, const char *put_old) -+{ -+ return syscall(SYS_pivot_root, new_root, put_old); -+} -+ -+#define BUF_SIZE 4096 -+ -+static int child(void) -+{ -+ char *put_root = "put_root"; -+ char *testfile = "testfile"; -+ int fd; -+ -+ if (unshare(CLONE_NEWNS)) { -+ pr_perror("unshare"); -+ goto err; -+ } -+ /* -+ * Setup new root -+ */ -+ mkdir(dirname, 0755); -+ -+ if (mount(source, dirname, "tmpfs", 0, NULL)) { -+ pr_perror("mount tmpfs"); -+ goto err; -+ } -+ -+ if (mount(NULL, dirname, NULL, MS_PRIVATE, NULL)) { -+ pr_perror("make private"); -+ goto err; -+ } -+ -+ if (chdir(dirname)) { -+ pr_perror("chdir"); -+ goto err; -+ } -+ -+ mkdir(put_root, 0755); -+ -+ if (sys_pivot_root(".", put_root)) { -+ pr_perror("pivot_root"); -+ goto err; -+ } -+ -+ if (umount2(put_root, MNT_DETACH)) { -+ pr_perror("umount2"); -+ goto err; -+ } -+ -+ fd = open(testfile, O_RDWR | O_CREAT | O_EXCL, 0666); -+ if (fd < 0) { -+ pr_perror("open"); -+ goto err; -+ } -+ close(fd); -+ -+ futex_set_and_wake(futex, TEST_CHILD); -+ futex_wait_while_lt(futex, TEST_CHECK); -+ -+ if (access(testfile, F_OK)) { -+ pr_perror("access"); -+ goto err; -+ } -+ -+ futex_set_and_wake(futex, TEST_EXIT); -+ return 0; -+err: -+ futex_set_and_wake(futex, EMERGENCY_ABORT); -+ return 1; -+} -+ -+int main(int argc, char **argv) -+{ -+ int pid; -+ -+ test_init(argc, argv); -+ -+ /* -+ * Setup futex for processes syncronization -+ */ -+ futex = mmap(NULL, sizeof(futex), PROT_WRITE | PROT_READ, MAP_SHARED | MAP_ANONYMOUS, -1, 0); -+ if (futex == MAP_FAILED) { -+ pr_perror("mmap"); -+ return 1; -+ } -+ futex_init(futex); -+ -+ /* -+ * Fork child which would have nested mntns -+ */ -+ pid = fork(); -+ if (pid < 0) { -+ pr_perror("fork"); -+ return 1; -+ } else if (pid == 0) { -+ exit(child()); -+ } -+ -+ futex_wait_while_lt(futex, TEST_CHILD); -+ if (futex_get(futex) == EMERGENCY_ABORT) { -+ pr_err("Fail in child\n"); -+ return 1; -+ } -+ -+ test_daemon(); -+ test_waitsig(); -+ -+ futex_set_and_wake(futex, TEST_CHECK); -+ futex_wait_while_lt(futex, TEST_EXIT); -+ if (futex_get(futex) == EMERGENCY_ABORT) { -+ fail("Fail in child on check stage"); -+ return 1; -+ } -+ -+ waitpid(pid, NULL, 0); -+ pass(); -+ return 0; -+} -diff --git a/test/zdtm/static/mntns_pivot_root.desc b/test/zdtm/static/mntns_pivot_root.desc -new file mode 100644 -index 000000000..7657ba45c ---- /dev/null -+++ b/test/zdtm/static/mntns_pivot_root.desc -@@ -0,0 +1 @@ -+{'flavor': 'ns uns', 'flags': 'suid'} --- -2.35.1 - diff --git a/0174-mount-apply-superblock-flags-to-nested-ns-roots.patch b/0174-mount-apply-superblock-flags-to-nested-ns-roots.patch deleted file mode 100644 index 2b39d6e..0000000 --- a/0174-mount-apply-superblock-flags-to-nested-ns-roots.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 9c142576cc1d3a399696e65ffeac4d89768aea3f Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Wed, 27 May 2020 13:43:49 +0300 -Subject: [PATCH 174/249] mount: apply superblock flags to nested ns roots - -Before this change we didn't apply sb-flags if we mount the root mount of -non-root mntns. There is no point in it, if we got to do_new_mount this root -mount is not external bind, so we won't change sb-flags on host if we change it -for this mount. So we just loose sb-flags on some regular container mount for -no reason. Fix it. - -Cherry-picked from Virtuozzo criu: -https://src.openvz.org/projects/OVZ/repos/criu/commits/e7ffe4c60 - -Signed-off-by: Pavel Tikhomirov ---- - criu/mount.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/criu/mount.c b/criu/mount.c -index 97a903934..dc846a68e 100644 ---- a/criu/mount.c -+++ b/criu/mount.c -@@ -2213,7 +2213,7 @@ static int do_new_mount(struct mount_info *mi) - goto out; - } - -- if (!mi->is_ns_root && remount_ro) { -+ if (remount_ro) { - int fd; - - fd = open(mi->mountpoint, O_PATH); --- -2.35.1 - diff --git a/0175-zdtm-add-mntns_pivot_root_ro-test.patch b/0175-zdtm-add-mntns_pivot_root_ro-test.patch deleted file mode 100644 index 732db5d..0000000 --- a/0175-zdtm-add-mntns_pivot_root_ro-test.patch +++ /dev/null @@ -1,113 +0,0 @@ -From dbf28040db2c4b956bdc5352f8cf62d8d1ddd53d Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Thu, 13 Jan 2022 10:46:44 +0300 -Subject: [PATCH 175/249] zdtm: add mntns_pivot_root_ro test - -This checks that superblock readonly flag is applied to nested mntns -roots on restore. - -Signed-off-by: Pavel Tikhomirov ---- - test/zdtm/static/Makefile | 2 ++ - test/zdtm/static/mntns_pivot_root.c | 31 +++++++++++++++++++++++ - test/zdtm/static/mntns_pivot_root_ro.c | 1 + - test/zdtm/static/mntns_pivot_root_ro.desc | 1 + - 4 files changed, 35 insertions(+) - create mode 120000 test/zdtm/static/mntns_pivot_root_ro.c - create mode 120000 test/zdtm/static/mntns_pivot_root_ro.desc - -diff --git a/test/zdtm/static/Makefile b/test/zdtm/static/Makefile -index a22a0540f..bf7462756 100644 ---- a/test/zdtm/static/Makefile -+++ b/test/zdtm/static/Makefile -@@ -402,6 +402,7 @@ TST_DIR = \ - mnt_ext_root \ - mnt_ext_collision \ - mntns_pivot_root \ -+ mntns_pivot_root_ro \ - mnt_tracefs \ - mntns_deleted \ - unlink_regular00 \ -@@ -580,6 +581,7 @@ socket-tcp-closed-last-ack: CFLAGS += -D ZDTM_TCP_LAST_ACK - socket-tcp-skip-in-flight: CFLAGS += -D ZDTM_IPV4V6 - tun_ns: CFLAGS += -DTUN_NS - mnt_ext_manual: CFLAGS += -D ZDTM_EXTMAP_MANUAL -+mntns_pivot_root_ro: CFLAGS += -DMNTNS_PIVOT_ROOT_RO - sigpending: LDLIBS += -lrt - vdso01: LDLIBS += -lrt - scm01: CFLAGS += -DKEEP_SENT_FD -diff --git a/test/zdtm/static/mntns_pivot_root.c b/test/zdtm/static/mntns_pivot_root.c -index 987b0da3b..9826efde4 100644 ---- a/test/zdtm/static/mntns_pivot_root.c -+++ b/test/zdtm/static/mntns_pivot_root.c -@@ -8,6 +8,7 @@ - #include - #include - #include -+#include - - #include "zdtmtst.h" - #include "lock.h" -@@ -86,6 +87,21 @@ static int child(void) - } - close(fd); - -+#ifdef MNTNS_PIVOT_ROOT_RO -+ /* -+ * Hack to make cr_pivot_root work on readonly mntns root, -+ * normally nested containers have /tmp directory -+ */ -+ mkdir("tmp", 0755); -+ /* -+ * Make superblock readonly -+ */ -+ if (mount(NULL, "/", NULL, MS_REMOUNT | MS_RDONLY, NULL)) { -+ pr_perror("remount_ro"); -+ goto err; -+ } -+#endif -+ - futex_set_and_wake(futex, TEST_CHILD); - futex_wait_while_lt(futex, TEST_CHECK); - -@@ -94,6 +110,21 @@ static int child(void) - goto err; - } - -+#ifdef MNTNS_PIVOT_ROOT_RO -+ /* -+ * Check superblock readonly -+ */ -+ fd = open(testfile, O_WRONLY); -+ if (fd >= 0) { -+ pr_err("Open on readonly superblock should fail\n"); -+ close(fd); -+ goto err; -+ } else if (errno != EROFS) { -+ pr_perror("open write"); -+ goto err; -+ } -+#endif -+ - futex_set_and_wake(futex, TEST_EXIT); - return 0; - err: -diff --git a/test/zdtm/static/mntns_pivot_root_ro.c b/test/zdtm/static/mntns_pivot_root_ro.c -new file mode 120000 -index 000000000..d352a6369 ---- /dev/null -+++ b/test/zdtm/static/mntns_pivot_root_ro.c -@@ -0,0 +1 @@ -+mntns_pivot_root.c -\ No newline at end of file -diff --git a/test/zdtm/static/mntns_pivot_root_ro.desc b/test/zdtm/static/mntns_pivot_root_ro.desc -new file mode 120000 -index 000000000..8708421ed ---- /dev/null -+++ b/test/zdtm/static/mntns_pivot_root_ro.desc -@@ -0,0 +1 @@ -+mntns_pivot_root.desc -\ No newline at end of file --- -2.35.1 - diff --git a/0176-mount-restore-create-auxiliary-binfmt_misc-mount-in-.patch b/0176-mount-restore-create-auxiliary-binfmt_misc-mount-in-.patch deleted file mode 100644 index e0ee71f..0000000 --- a/0176-mount-restore-create-auxiliary-binfmt_misc-mount-in-.patch +++ /dev/null @@ -1,176 +0,0 @@ -From c84fda15593f2f7ebb2a2796906e5b4081738b24 Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Tue, 23 Jul 2019 18:33:59 +0300 -Subject: [PATCH 176/249] mount/restore: create auxiliary binfmt_misc mount in - the root yard - -Put our auxiliary binfmt_misc mount in "/binfmt_misc" instead -of "//proc/sys/fs/binfmt_misc". Thus we can restore -binfmt_misc without altering actual mount tree, which looks much more -safe. - -For that we need to remove "fake top mount_info" handling from -add_cr_time_mount as now we intentionally add binfmt_misc mount as a -child of ("fake") root yard. On dump this does not change anything. -Also we need to create mountpoint for binfmt_misc in root yard. - -As now mount is out of restored mount tree we don't need to umount it, -so remove corresponding CRTIME_MNT_ID umount hunk in do_new_mount. - -Note: to make binfmt_misc c/r work criu should be compiled with -CONFIG_BINFMT_MISC_VIRTUALIZED and binfmt_misc should be actually -virtualized and this is only done in Virtuozzo kernel per ve. - -Cherry-picked from Virtuozzo criu: -https://src.openvz.org/projects/OVZ/repos/criu/commits/2eb535843 -Cherry-picked from Virtuozzo criu: -https://src.openvz.org/projects/OVZ/repos/criu/commits/d79c7f441 -Cherry-picked from Virtuozzo criu: -https://src.openvz.org/projects/OVZ/repos/criu/commits/34002bef4 -Cherry-picked one hunk from Virtuozzo criu: -https://src.openvz.org/projects/OVZ/repos/criu/commits/45bf6f0ee - -Changes: merge all fixups together to one consistent patch. - -Signed-off-by: Pavel Tikhomirov ---- - criu/mount.c | 52 ++++++++++++++++++---------------------------------- - 1 file changed, 18 insertions(+), 34 deletions(-) - -diff --git a/criu/mount.c b/criu/mount.c -index dc846a68e..72b17bc1b 100644 ---- a/criu/mount.c -+++ b/criu/mount.c -@@ -1568,29 +1568,16 @@ err: - return -1; - } - --static __maybe_unused int add_cr_time_mount(struct mount_info *root, char *fsname, const char *path, unsigned int s_dev, -- bool rst) -+static __maybe_unused struct mount_info *add_cr_time_mount(struct mount_info *root, char *fsname, const char *path, -+ unsigned int s_dev, bool rst) - { - struct mount_info *mi, *t, *parent; - bool add_slash = false; - int len; - -- if (!root->nsid) { -- /* On restore we have fake top mount_info. Find real NS_ROOT */ -- list_for_each_entry(t, &root->children, siblings) -- if (t->nsid->type == NS_ROOT) { -- root = t; -- break; -- } -- if (!root->nsid) { -- pr_err("Can't find NS_ROOT\n"); -- return -1; -- } -- } -- - mi = mnt_entry_alloc(rst); - if (!mi) -- return -1; -+ return NULL; - - len = strlen(root->mountpoint); - /* It may be "./" or "./path/to/dir" */ -@@ -1637,11 +1624,11 @@ static __maybe_unused int add_cr_time_mount(struct mount_info *root, char *fsnam - mi->parent_mnt_id = parent->mnt_id; - list_add(&mi->siblings, &parent->children); - pr_info("Add cr-time mountpoint %s with parent %s(%u)\n", mi->mountpoint, parent->mountpoint, parent->mnt_id); -- return 0; -+ return mi; - - err: - mnt_entry_free(mi); -- return -1; -+ return NULL; - } - - /* Returns 1 in case of success, -errno in case of mount fail, and 0 on other errors */ -@@ -2204,15 +2191,6 @@ static int do_new_mount(struct mount_info *mi) - if (tp->restore && tp->restore(mi)) - return -1; - -- if (mi->mnt_id == CRTIME_MNT_ID) { -- /* C-r time mountpoint, umount it */ -- if (umount(mi->mountpoint) < 0) { -- pr_perror("Can't umount %s", mi->mountpoint); -- return -1; -- } -- goto out; -- } -- - if (remount_ro) { - int fd; - -@@ -2242,7 +2220,7 @@ static int do_new_mount(struct mount_info *mi) - BUG_ON(mi->master_id); - if (restore_shared_options(mi, !mi->shared_id, mi->shared_id, 0)) - return -1; --out: -+ - mi->mounted = true; - - return 0; -@@ -3384,7 +3362,7 @@ static int merge_mount_trees(struct mount_info *root_yard) - /* - * All nested mount namespaces are restore as sub-trees of the root namespace. - */ --static int populate_roots_yard(void) -+static int populate_roots_yard(struct mount_info *cr_time) - { - struct mnt_remap_entry *r; - char path[PATH_MAX]; -@@ -3415,11 +3393,17 @@ static int populate_roots_yard(void) - } - } - -+ if (cr_time && mkdirpat(AT_FDCWD, cr_time->mountpoint, 0755)) { -+ pr_perror("Unable to create %s", cr_time->mountpoint); -+ return -1; -+ } -+ - return 0; - } - - static int populate_mnt_ns(void) - { -+ struct mount_info *cr_time = NULL; - int ret; - - root_yard_mp = mnt_entry_alloc(true); -@@ -3436,8 +3420,8 @@ static int populate_mnt_ns(void) - #ifdef CONFIG_BINFMT_MISC_VIRTUALIZED - if (!opts.has_binfmt_misc && !list_empty(&binfmt_misc_list)) { - /* Add to mount tree. Generic code will mount it later */ -- ret = add_cr_time_mount(root_yard_mp, "binfmt_misc", BINFMT_MISC_HOME, 0, true); -- if (ret) -+ cr_time = add_cr_time_mount(root_yard_mp, "binfmt_misc", "binfmt_misc", 0, true); -+ if (!cr_time) - return -1; - } - #endif -@@ -3453,7 +3437,7 @@ static int populate_mnt_ns(void) - if (find_remap_mounts(root_yard_mp)) - return -1; - -- if (populate_roots_yard()) -+ if (populate_roots_yard(cr_time)) - return -1; - - if (mount_clean_path()) -@@ -3887,8 +3871,8 @@ int collect_mnt_namespaces(bool for_dump) - } else if (ret == 0) { - ret = -1; - goto err; -- } else if (ret > 0 && add_cr_time_mount(ns->mnt.mntinfo_tree, "binfmt_misc", BINFMT_MISC_HOME, -- s_dev, false) < 0) { -+ } else if (ret > 0 && !add_cr_time_mount(ns->mnt.mntinfo_tree, "binfmt_misc", BINFMT_MISC_HOME, -+ s_dev, false)) { - ret = -1; - goto err; - } --- -2.35.1 - diff --git a/0177-mount-restore-leave-ns_mountpoint-NULL-for-aux-binfm.patch b/0177-mount-restore-leave-ns_mountpoint-NULL-for-aux-binfm.patch deleted file mode 100644 index f2526ee..0000000 --- a/0177-mount-restore-leave-ns_mountpoint-NULL-for-aux-binfm.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 7c0606edbb177b4f704f3abeb03f0de81f4cbbb6 Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Thu, 13 Jan 2022 17:45:46 +0300 -Subject: [PATCH 177/249] mount/restore: leave ns_mountpoint NULL for aux - binfmt_misc mount - -On dump, yes, mountpoint and ns_mountpoint are the same, but on restore -they don't and puting something like "/binfmt_misc" to -ns_mountpoint is wrong, let's leave ns_mountpoint NULL, this mount -should not be compared by ns_mountpoint with other mounts anyway. - -Signed-off-by: Pavel Tikhomirov ---- - criu/mount.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/criu/mount.c b/criu/mount.c -index 72b17bc1b..3b57622b6 100644 ---- a/criu/mount.c -+++ b/criu/mount.c -@@ -1589,7 +1589,8 @@ static __maybe_unused struct mount_info *add_cr_time_mount(struct mount_info *ro - mi->mountpoint = xmalloc(len + strlen(path) + 1); - if (!mi->mountpoint) - goto err; -- mi->ns_mountpoint = mi->mountpoint; -+ if (!rst) -+ mi->ns_mountpoint = mi->mountpoint; - if (!add_slash) - sprintf(mi->mountpoint, "%s%s", root->mountpoint, path); - else --- -2.35.1 - diff --git a/0178-mount-replace-CRTIME_MNT_ID-with-HELPER_MNT_ID.patch b/0178-mount-replace-CRTIME_MNT_ID-with-HELPER_MNT_ID.patch deleted file mode 100644 index d06528e..0000000 --- a/0178-mount-replace-CRTIME_MNT_ID-with-HELPER_MNT_ID.patch +++ /dev/null @@ -1,77 +0,0 @@ -From f19d829e45a67ee5a8a8465ba0e92b291f6059b9 Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Thu, 7 May 2020 16:13:02 +0300 -Subject: [PATCH 178/249] mount: replace CRTIME_MNT_ID with HELPER_MNT_ID - -Root yard mount also has mnt_id == 0 so it will look better with a new -name. Let's explicitly initialize root yard mnt_id to HELPER_MNT_ID -for the sake of code readability. - -Also in near future we might want to create additional mount helpers to support -mounts in CT with no fsroot mounted. - -Cherry-picked from Virtuozzo criu: -https://src.openvz.org/projects/OVZ/repos/criu/commits/45bf6f0ee - -Changes: split umount hunk to previous patch, set HELPER_MNT_ID for root -yard. - -Signed-off-by: Pavel Tikhomirov ---- - criu/mount.c | 12 +++++++----- - 1 file changed, 7 insertions(+), 5 deletions(-) - -diff --git a/criu/mount.c b/criu/mount.c -index 3b57622b6..1bdd69478 100644 ---- a/criu/mount.c -+++ b/criu/mount.c -@@ -37,7 +37,8 @@ - #define LOG_PREFIX "mnt: " - - #define BINFMT_MISC_HOME "proc/sys/fs/binfmt_misc" --#define CRTIME_MNT_ID 0 -+ -+#define HELPER_MNT_ID 0 - - #define CONTEXT_OPT "context=" - -@@ -1595,7 +1596,7 @@ static __maybe_unused struct mount_info *add_cr_time_mount(struct mount_info *ro - sprintf(mi->mountpoint, "%s%s", root->mountpoint, path); - else - sprintf(mi->mountpoint, "%s/%s", root->mountpoint, path); -- mi->mnt_id = CRTIME_MNT_ID; -+ mi->mnt_id = HELPER_MNT_ID; - mi->flags = mi->sb_flags = 0; - mi->root = xstrdup("/"); - mi->fsname = xstrdup(fsname); -@@ -1718,8 +1719,8 @@ static int dump_one_mountpoint(struct mount_info *pm, struct cr_img *img) - pm->fstype->check_bindmount(pm)) - return -1; - -- if (pm->mnt_id == CRTIME_MNT_ID) { -- pr_info("Skip dumping cr-time mountpoint: %s\n", pm->mountpoint); -+ if (pm->mnt_id == HELPER_MNT_ID) { -+ pr_info("Skip dumping helper mountpoint: %s\n", pm->mountpoint); - return 0; - } - -@@ -3414,6 +3415,7 @@ static int populate_mnt_ns(void) - root_yard_mp->mountpoint = mnt_roots; - root_yard_mp->mounted = true; - root_yard_mp->mnt_bind_is_populated = true; -+ root_yard_mp->mnt_id = HELPER_MNT_ID; - - if (merge_mount_trees(root_yard_mp)) - return -1; -@@ -3931,7 +3933,7 @@ void clean_cr_time_mounts(void) - for (mi = mntinfo; mi; mi = mi->next) { - int cwd_fd; - -- if (mi->mnt_id != CRTIME_MNT_ID) -+ if (mi->mnt_id != HELPER_MNT_ID) - continue; - ret = switch_mnt_ns(mi->nsid->ns_pid, &ns_old, &cwd_fd); - if (ret) { --- -2.35.1 - diff --git a/0179-mount-add-can_receive_master_from_root-helper.patch b/0179-mount-add-can_receive_master_from_root-helper.patch deleted file mode 100644 index 0ffb625..0000000 --- a/0179-mount-add-can_receive_master_from_root-helper.patch +++ /dev/null @@ -1,62 +0,0 @@ -From eb6198c4c7ed22665c0013874fe6b4615f88f3d0 Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Thu, 30 Dec 2021 15:24:30 +0300 -Subject: [PATCH 179/249] mount: add can_receive_master_from_root helper - -If mount has external master_id it can inherit it as a bind of external -mount, but also it can inherit it as a bind of container root mount, so -let's add similar condition to allow such mounts. - -Note: need_master is false for binds of root mount which can inherit -master_id from root mounts yet, this would change in next patch. - -Signed-off-by: Pavel Tikhomirov ---- - criu/mount.c | 23 ++++++++++++++++++++--- - 1 file changed, 20 insertions(+), 3 deletions(-) - -diff --git a/criu/mount.c b/criu/mount.c -index 1bdd69478..03d0e6da1 100644 ---- a/criu/mount.c -+++ b/criu/mount.c -@@ -633,6 +633,19 @@ bool mnt_is_root_bind(struct mount_info *mi) - return mnt_get_root_bind(mi); - } - -+static bool __can_receive_master_from_root(struct mount_info *mi, struct mount_info *bind) -+{ -+ if (rst_mnt_is_root(bind) && bind->master_id == mi->master_id && is_sub_path(mi->root, bind->root)) -+ return true; -+ -+ return false; -+} -+ -+static struct mount_info *can_receive_master_from_root(struct mount_info *mi) -+{ -+ return mnt_bind_pick(mi, __can_receive_master_from_root); -+} -+ - /* - * Having two children with same mountpoint is unsupported. That can happen in - * case of mount propagation inside of shared mounts, in that case it is hard -@@ -1043,10 +1056,14 @@ static int resolve_shared_mounts(struct mount_info *info, int root_master_id) - } - - /* -- * If we haven't already determined this mount is external, -- * or bind of external, then we don't know where it came from. -+ * External master detected - */ -- if (need_master && m->parent && !can_receive_master_from_external(m)) { -+ if (need_master) { -+ if (can_receive_master_from_external(m)) -+ continue; -+ if (can_receive_master_from_root(m)) -+ continue; -+ - pr_err("Mount %d %s (master_id: %d shared_id: %d) " - "has unreachable sharing. Try --enable-external-masters.\n", - m->mnt_id, m->mountpoint, m->master_id, m->shared_id); --- -2.35.1 - diff --git a/0180-mount-put-external-slavery-mounts-to-separate-mnt_ex.patch b/0180-mount-put-external-slavery-mounts-to-separate-mnt_ex.patch deleted file mode 100644 index 22ee608..0000000 --- a/0180-mount-put-external-slavery-mounts-to-separate-mnt_ex.patch +++ /dev/null @@ -1,77 +0,0 @@ -From d797005a68cec3b4a87fc60735441715682a42a4 Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Thu, 20 Feb 2020 10:50:42 +0300 -Subject: [PATCH 180/249] mount: put external slavery mounts to separate - mnt_ext_slave list - -We need to put mounts which need to inherit master_id from external -mounts or from root mount into separate list, so that we can set ->bind -on them right in propagate_siblings. - -Cherry-picked from Virtuozzo criu: -https://src.openvz.org/projects/OVZ/repos/criu/commits/ea592cf6e - -Signed-off-by: Pavel Tikhomirov ---- - criu/include/mount.h | 1 + - criu/mount.c | 17 ++++++++++++++--- - 2 files changed, 15 insertions(+), 3 deletions(-) - -diff --git a/criu/include/mount.h b/criu/include/mount.h -index 1ceb394b6..071c0246e 100644 ---- a/criu/include/mount.h -+++ b/criu/include/mount.h -@@ -77,6 +77,7 @@ struct mount_info { - struct list_head mnt_share; /* circular list of shared mounts */ - struct list_head mnt_slave_list; /* list of slave mounts */ - struct list_head mnt_slave; /* slave list entry */ -+ struct list_head mnt_ext_slave; /* external slave list entry */ - struct mount_info *mnt_master; /* slave is on master->mnt_slave_list */ - struct list_head mnt_propagate; /* circular list of mounts which propagate from each other */ - struct list_head mnt_notprop; /* temporary list used in can_mount_now */ -diff --git a/criu/mount.c b/criu/mount.c -index 03d0e6da1..22c062e36 100644 ---- a/criu/mount.c -+++ b/criu/mount.c -@@ -1059,10 +1059,12 @@ static int resolve_shared_mounts(struct mount_info *info, int root_master_id) - * External master detected - */ - if (need_master) { -- if (can_receive_master_from_external(m)) -- continue; -- if (can_receive_master_from_root(m)) -+ if ((t = can_receive_master_from_external(m)) || (t = can_receive_master_from_root(m))) { -+ pr_debug("Detected external slavery for %d via %d\n", m->mnt_id, t->mnt_id); -+ if (m != t) -+ list_add(&m->mnt_ext_slave, &t->mnt_ext_slave); - continue; -+ } - - pr_err("Mount %d %s (master_id: %d shared_id: %d) " - "has unreachable sharing. Try --enable-external-masters.\n", -@@ -2056,6 +2058,14 @@ static int propagate_siblings(struct mount_info *mi) - t->s_dev_rt = mi->s_dev_rt; - } - -+ list_for_each_entry(t, &mi->mnt_ext_slave, mnt_ext_slave) { -+ if (t->mounted || t->bind) -+ continue; -+ pr_debug("\t\tBind ext-slave %s(%d)\n", t->ns_mountpoint, t->mnt_id); -+ t->bind = mi; -+ t->s_dev_rt = mi->s_dev_rt; -+ } -+ - return 0; - } - -@@ -2924,6 +2934,7 @@ struct mount_info *mnt_entry_alloc(bool rst) - INIT_LIST_HEAD(&new->children); - INIT_LIST_HEAD(&new->siblings); - INIT_LIST_HEAD(&new->mnt_slave_list); -+ INIT_LIST_HEAD(&new->mnt_ext_slave); - INIT_LIST_HEAD(&new->mnt_share); - INIT_LIST_HEAD(&new->mnt_bind); - INIT_LIST_HEAD(&new->mnt_propagate); --- -2.35.1 - diff --git a/0181-mount-do-not-override-master_id-to-1-for-root-binds.patch b/0181-mount-do-not-override-master_id-to-1-for-root-binds.patch deleted file mode 100644 index 95e28b6..0000000 --- a/0181-mount-do-not-override-master_id-to-1-for-root-binds.patch +++ /dev/null @@ -1,100 +0,0 @@ -From dc8b6c98040d863aeda2c548ca3991827c341c72 Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Fri, 14 Jan 2022 14:33:30 +0300 -Subject: [PATCH 181/249] mount: do not override master_id to -1 for root binds - -There is no point to lose this information, having -1 everywhere in -mount images instead of acutall master id can be confusing. - -Note that now need_master is true for bindmounts of root mounts with -same master_id as root mount, so now they are handled with a common -code, we've added can_receive_master_from_root check specially to handle -this case right. Also note that in propagate_mount we no more set ->bind -for this case, this is handled by mnt_ext_slave list related code. - -Cherry-picked from Virtuozzo criu: -https://src.openvz.org/projects/OVZ/repos/criu/commits/b3c9dc05e - -Stripped only master_id relative part of original patch, add -preparational patches before this one. - -Signed-off-by: Pavel Tikhomirov ---- - criu/mount.c | 18 +++++------------- - 1 file changed, 5 insertions(+), 13 deletions(-) - -diff --git a/criu/mount.c b/criu/mount.c -index 22c062e36..8d0a17d96 100644 ---- a/criu/mount.c -+++ b/criu/mount.c -@@ -1013,7 +1013,7 @@ struct mount_info *mnt_bind_pick(struct mount_info *mi, bool (*pick)(struct moun - return NULL; - } - --static int resolve_shared_mounts(struct mount_info *info, int root_master_id) -+static int resolve_shared_mounts(struct mount_info *info) - { - struct mount_info *m, *t; - -@@ -1026,12 +1026,8 @@ static int resolve_shared_mounts(struct mount_info *info, int root_master_id) - for (m = info; m; m = m->next) { - bool need_share, need_master; - -- /* the root master_id can be ignored, because it's already created */ -- if (root_master_id && root_master_id == m->master_id) -- m->master_id = -1; -- - need_share = m->shared_id && list_empty(&m->mnt_share); -- need_master = m->master_id > 0; -+ need_master = m->master_id; - - pr_debug("Inspecting sharing on %2d shared_id %d master_id %d (@%s)\n", m->mnt_id, m->shared_id, - m->master_id, m->mountpoint); -@@ -2110,7 +2106,7 @@ skip_parent: - continue; - if (t->bind) - continue; -- if (t->master_id > 0) -+ if (t->master_id) - continue; - if (!issubpath(t->root, mi->root)) - continue; -@@ -3457,7 +3453,7 @@ static int populate_mnt_ns(void) - } - #endif - -- if (resolve_shared_mounts(mntinfo, 0)) -+ if (resolve_shared_mounts(mntinfo)) - return -1; - - if (validate_mounts(mntinfo, false)) -@@ -3845,7 +3841,6 @@ int mntns_get_root_by_mnt_id(int mnt_id) - struct collect_mntns_arg { - bool need_to_validate; - bool for_dump; -- int root_master_id; - }; - - static int collect_mntns(struct ns_id *ns, void *__arg) -@@ -3862,9 +3857,6 @@ static int collect_mntns(struct ns_id *ns, void *__arg) - - mntinfo_add_list(pms); - -- if (arg->need_to_validate && ns->id == root_item->ids->mnt_ns_id) -- arg->root_master_id = ns->mnt.mntinfo_tree->master_id; -- - return 0; - } - -@@ -3918,7 +3910,7 @@ int collect_mnt_namespaces(bool for_dump) - if (arg.need_to_validate) { - ret = -1; - -- if (resolve_shared_mounts(mntinfo, arg.root_master_id)) -+ if (resolve_shared_mounts(mntinfo)) - goto err; - if (validate_mounts(mntinfo, true)) - goto err; --- -2.35.1 - diff --git a/0182-mount-add-helper-mnt_get_external_bind_nodev.patch b/0182-mount-add-helper-mnt_get_external_bind_nodev.patch deleted file mode 100644 index 4ee928b..0000000 --- a/0182-mount-add-helper-mnt_get_external_bind_nodev.patch +++ /dev/null @@ -1,58 +0,0 @@ -From dd6be1a5f66bd7c605ada4fbd997e36c3cba65e0 Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Wed, 27 May 2020 11:50:34 +0300 -Subject: [PATCH 182/249] mount: add helper mnt_get_external_bind_nodev - -Will use it to find shared mount we can bind from and also can inherit -external slavery. Device-external can't give us external slavery. - -Cherry-picked from Virtuozzo criu: -https://src.openvz.org/projects/OVZ/repos/criu/commits/dcd952c4c - -Changes: switch to mnt_bind_pick helper. - -Signed-off-by: Pavel Tikhomirov ---- - criu/include/mount.h | 1 + - criu/mount.c | 13 +++++++++++++ - 2 files changed, 14 insertions(+) - -diff --git a/criu/include/mount.h b/criu/include/mount.h -index 071c0246e..050141058 100644 ---- a/criu/include/mount.h -+++ b/criu/include/mount.h -@@ -180,6 +180,7 @@ extern bool has_mounted_external_bind(struct mount_info *mi); - extern bool rst_mnt_is_root(struct mount_info *mi); - extern struct mount_info *mnt_get_root_bind(struct mount_info *mi); - extern bool mnt_is_root_bind(struct mount_info *mi); -+extern struct mount_info *mnt_get_external_bind_nodev(struct mount_info *mi); - - extern struct mount_info *mnt_bind_pick(struct mount_info *mi, - bool (*pick)(struct mount_info *mi, struct mount_info *bind)); -diff --git a/criu/mount.c b/criu/mount.c -index 8d0a17d96..632da6f5c 100644 ---- a/criu/mount.c -+++ b/criu/mount.c -@@ -646,6 +646,19 @@ static struct mount_info *can_receive_master_from_root(struct mount_info *mi) - return mnt_bind_pick(mi, __can_receive_master_from_root); - } - -+static bool __mnt_is_external_bind_nodev(struct mount_info *mi, struct mount_info *bind) -+{ -+ if (bind->external && !mnt_is_dev_external(bind) && is_sub_path(mi->root, bind->root)) -+ return true; -+ -+ return false; -+} -+ -+struct mount_info *mnt_get_external_bind_nodev(struct mount_info *mi) -+{ -+ return mnt_bind_pick(mi, __mnt_is_external_bind_nodev); -+} -+ - /* - * Having two children with same mountpoint is unsupported. That can happen in - * case of mount propagation inside of shared mounts, in that case it is hard --- -2.35.1 - diff --git a/0183-mount-prepare-is_overmounted-as-early-as-possible.patch b/0183-mount-prepare-is_overmounted-as-early-as-possible.patch deleted file mode 100644 index 752f04c..0000000 --- a/0183-mount-prepare-is_overmounted-as-early-as-possible.patch +++ /dev/null @@ -1,123 +0,0 @@ -From d17e33e918bb9e3fffc18a0b1af532841bdb3d69 Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Fri, 29 May 2020 10:27:05 +0300 -Subject: [PATCH 183/249] mount: prepare is_overmounted as early as possible - -Function mnt_is_overmounted is designed to detect if mount is overmounted in -current tree using comparison of mountpoints of neighbour mounts for detection. -We want to get actual overmounts in dumped tree, we don't expect that helper -mounts we add or merging will introduce new overmounts. So let's do overmount -detection earlier before adding helpers. - -Set is_overmounted = false for root yard and binfmt helper mounts. - -Cherry-picked from Virtuozzo criu: -https://src.openvz.org/projects/OVZ/repos/criu/commits/e98e1456d - -Changes: rename set_is_overmounted to prepare_is_overmounted, move it -just after collecting mounts from images to mount tree, handle helper -mounts. - -Signed-off-by: Pavel Tikhomirov ---- - criu/include/mount.h | 2 ++ - criu/mount.c | 31 +++++++++++++++++++++++++++---- - 2 files changed, 29 insertions(+), 4 deletions(-) - -diff --git a/criu/include/mount.h b/criu/include/mount.h -index 050141058..519a34d2a 100644 ---- a/criu/include/mount.h -+++ b/criu/include/mount.h -@@ -184,4 +184,6 @@ extern struct mount_info *mnt_get_external_bind_nodev(struct mount_info *mi); - - extern struct mount_info *mnt_bind_pick(struct mount_info *mi, - bool (*pick)(struct mount_info *mi, struct mount_info *bind)); -+ -+extern int mnt_tree_for_each(struct mount_info *start, int (*fn)(struct mount_info *)); - #endif /* __CR_MOUNT_H__ */ -diff --git a/criu/mount.c b/criu/mount.c -index 632da6f5c..30872f1ce 100644 ---- a/criu/mount.c -+++ b/criu/mount.c -@@ -1347,13 +1347,35 @@ exit: - return mi->is_overmounted; - } - --static int set_is_overmounted(struct mount_info *mi) -+static int __set_is_overmounted(struct mount_info *mi) - { - /* coverity[check_return] */ - mnt_is_overmounted(mi); - return 0; - } - -+/* -+ * mnt_is_overmounted is intended to detect overmounts in original dumped mount -+ * tree, so we pre-save it just after loading mount tree from images, so that -+ * it does not mess up with any helper mounts or tree changes we can do. -+ */ -+static void prepare_is_overmounted(void) -+{ -+ struct ns_id *nsid; -+ -+ for (nsid = ns_ids; nsid; nsid = nsid->next) { -+ struct mount_info *root; -+ -+ if (nsid->nd != &mnt_ns_desc) -+ continue; -+ -+ root = nsid->mnt.mntinfo_tree; -+ -+ BUG_ON(root->parent); -+ mnt_tree_for_each(root, __set_is_overmounted); -+ } -+} -+ - /* - * __umount_children_overmounts() assumes that the mountpoint and - * it's ancestors have no sibling-overmounts, so we can see children -@@ -1649,6 +1671,7 @@ static __maybe_unused struct mount_info *add_cr_time_mount(struct mount_info *ro - } - - mi->mnt_bind_is_populated = true; -+ mi->is_overmounted = false; - mi->nsid = parent->nsid; - mi->parent = parent; - mi->parent_mnt_id = parent->mnt_id; -@@ -1893,7 +1916,7 @@ err: - - #define MNT_WALK_NONE 0 && - --static int mnt_tree_for_each(struct mount_info *start, int (*fn)(struct mount_info *)) -+int mnt_tree_for_each(struct mount_info *start, int (*fn)(struct mount_info *)) - { - struct mount_info *tmp; - LIST_HEAD(postpone); -@@ -3278,6 +3301,7 @@ int read_mnt_ns_img(void) - mntinfo = pms; - - search_bindmounts(); -+ prepare_is_overmounted(); - - return 0; - } -@@ -3452,6 +3476,7 @@ static int populate_mnt_ns(void) - root_yard_mp->mountpoint = mnt_roots; - root_yard_mp->mounted = true; - root_yard_mp->mnt_bind_is_populated = true; -+ root_yard_mp->is_overmounted = false; - root_yard_mp->mnt_id = HELPER_MNT_ID; - - if (merge_mount_trees(root_yard_mp)) -@@ -3472,8 +3497,6 @@ static int populate_mnt_ns(void) - if (validate_mounts(mntinfo, false)) - return -1; - -- mnt_tree_for_each(root_yard_mp, set_is_overmounted); -- - if (find_remap_mounts(root_yard_mp)) - return -1; - --- -2.35.1 - diff --git a/0184-mount-move-root-yard-tree-merge-as-early-as-possible.patch b/0184-mount-move-root-yard-tree-merge-as-early-as-possible.patch deleted file mode 100644 index c336198..0000000 --- a/0184-mount-move-root-yard-tree-merge-as-early-as-possible.patch +++ /dev/null @@ -1,121 +0,0 @@ -From 784d5274c7a09d452c78a771e4a43476dde35dca Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Mon, 29 Jun 2020 18:04:41 +0300 -Subject: [PATCH 184/249] mount: move root yard tree merge as early as possible - -Let's merge mount trees under root_yard just after reading from image. - -Cherry-picked from Virtuozzo criu: -https://src.openvz.org/projects/OVZ/repos/criu/commits/8e8ecdfdc - -Changes: split only root yard part as a separate patch, and put root -yard alloc into merge_mount_trees. - -Signed-off-by: Pavel Tikhomirov ---- - criu/mount.c | 68 ++++++++++++++++++++++++++-------------------------- - 1 file changed, 34 insertions(+), 34 deletions(-) - -diff --git a/criu/mount.c b/criu/mount.c -index 30872f1ce..b2810b7a5 100644 ---- a/criu/mount.c -+++ b/criu/mount.c -@@ -3271,6 +3271,37 @@ err: - return -1; - } - -+static int merge_mount_trees(void) -+{ -+ struct ns_id *nsid; -+ -+ root_yard_mp = mnt_entry_alloc(true); -+ if (!root_yard_mp) -+ return -1; -+ -+ root_yard_mp->mountpoint = mnt_roots; -+ root_yard_mp->mounted = true; -+ root_yard_mp->mnt_bind_is_populated = true; -+ root_yard_mp->is_overmounted = false; -+ root_yard_mp->mnt_id = HELPER_MNT_ID; -+ -+ /* Merge mount trees together under root_yard_mp */ -+ for (nsid = ns_ids; nsid; nsid = nsid->next) { -+ struct mount_info *root; -+ -+ if (nsid->nd != &mnt_ns_desc) -+ continue; -+ -+ root = nsid->mnt.mntinfo_tree; -+ -+ pr_debug("Mountpoint %d (@%s) moved to the root yard\n", root->mnt_id, root->mountpoint); -+ root->parent = root_yard_mp; -+ list_add(&root->siblings, &root_yard_mp->children); -+ } -+ -+ return 0; -+} -+ - int read_mnt_ns_img(void) - { - struct mount_info *pms = NULL; -@@ -3303,6 +3334,9 @@ int read_mnt_ns_img(void) - search_bindmounts(); - prepare_is_overmounted(); - -+ if (merge_mount_trees()) -+ return -1; -+ - return 0; - } - -@@ -3401,27 +3435,6 @@ void fini_restore_mntns(void) - } - } - --static int merge_mount_trees(struct mount_info *root_yard) --{ -- struct ns_id *nsid; -- -- /* Merge mount trees together under root_yard */ -- for (nsid = ns_ids; nsid; nsid = nsid->next) { -- struct mount_info *root; -- -- if (nsid->nd != &mnt_ns_desc) -- continue; -- -- root = nsid->mnt.mntinfo_tree; -- -- pr_debug("Mountpoint %d (@%s) moved to the root yard\n", root->mnt_id, root->mountpoint); -- root->parent = root_yard; -- list_add(&root->siblings, &root_yard->children); -- } -- -- return 0; --} -- - /* - * All nested mount namespaces are restore as sub-trees of the root namespace. - */ -@@ -3469,19 +3482,6 @@ static int populate_mnt_ns(void) - struct mount_info *cr_time = NULL; - int ret; - -- root_yard_mp = mnt_entry_alloc(true); -- if (!root_yard_mp) -- return -1; -- -- root_yard_mp->mountpoint = mnt_roots; -- root_yard_mp->mounted = true; -- root_yard_mp->mnt_bind_is_populated = true; -- root_yard_mp->is_overmounted = false; -- root_yard_mp->mnt_id = HELPER_MNT_ID; -- -- if (merge_mount_trees(root_yard_mp)) -- return -1; -- - #ifdef CONFIG_BINFMT_MISC_VIRTUALIZED - if (!opts.has_binfmt_misc && !list_empty(&binfmt_misc_list)) { - /* Add to mount tree. Generic code will mount it later */ --- -2.35.1 - diff --git a/0185-mount-fix-broken-remounted_rw-check.patch b/0185-mount-fix-broken-remounted_rw-check.patch deleted file mode 100644 index adc1673..0000000 --- a/0185-mount-fix-broken-remounted_rw-check.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 06d7b3ea53c1896e3bc453ba47b47fd7fb77db97 Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Wed, 8 Jul 2020 09:57:33 +0300 -Subject: [PATCH 185/249] mount: fix broken remounted_rw check - -Expression (x && REMOUNTED_RW) is always same as just (x). - -It should've been (x & REMOUNTED_RW) to check if mount is marked as -temporary remounted writable and requires to be switched back. - -By fixing this check we eliminate excess readonly remounts. - -Cherry-picked from Virtuozzo criu: -https://src.openvz.org/projects/OVZ/repos/criu/commits/167f8ac67 - -Signed-off-by: Pavel Tikhomirov ---- - criu/mount.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/criu/mount.c b/criu/mount.c -index b2810b7a5..3421ef491 100644 ---- a/criu/mount.c -+++ b/criu/mount.c -@@ -4113,7 +4113,7 @@ static int __remount_readonly_mounts(struct ns_id *ns) - if (ns && mi->nsid != ns) - continue; - -- if (!(*mi->remounted_rw && REMOUNTED_RW)) -+ if (!(*mi->remounted_rw & REMOUNTED_RW)) - continue; - - /* --- -2.35.1 - diff --git a/0186-mount-make-general-place-for-shared-variables-on-mou.patch b/0186-mount-make-general-place-for-shared-variables-on-mou.patch deleted file mode 100644 index 6a18781..0000000 --- a/0186-mount-make-general-place-for-shared-variables-on-mou.patch +++ /dev/null @@ -1,101 +0,0 @@ -From bcf8e4276323b1e999d355399fc24dc748bdc316 Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Tue, 16 Jun 2020 16:19:42 +0300 -Subject: [PATCH 186/249] mount: make general place for shared variables on - mount-info on restore - -Put remounted_rw to it. This allows us to easily add some more of such -variables without allocating each one of them separately. - -Due to existance of shfree_last shmalloc'ed region can be inherited from -the previous caller so it needs to be explicitly zero initialized. - -Fixes: 0a2d380e6 ("ghost/mount: allocate remounted_rw in shmem to get -info from other processes") - -Cherry-picked from Virtuozzo criu: -https://src.openvz.org/projects/OVZ/repos/criu/commits/6750e5793 - -Signed-off-by: Pavel Tikhomirov ---- - criu/include/mount.h | 7 ++++++- - criu/mount.c | 13 +++++++------ - 2 files changed, 13 insertions(+), 7 deletions(-) - -diff --git a/criu/include/mount.h b/criu/include/mount.h -index 519a34d2a..3067e4088 100644 ---- a/criu/include/mount.h -+++ b/criu/include/mount.h -@@ -26,6 +26,10 @@ struct ns_id; - */ - #define REMOUNTED_RW_SERVICE 2 - -+struct rst_mount_info { -+ int remounted_rw; -+}; -+ - struct mount_info { - int mnt_id; - int parent_mnt_id; -@@ -86,7 +90,8 @@ struct mount_info { - struct list_head postpone; - - int is_overmounted; -- int *remounted_rw; -+ -+ struct rst_mount_info *rmi; - - void *private; /* associated filesystem data */ - }; -diff --git a/criu/mount.c b/criu/mount.c -index 3421ef491..5fdd60cda 100644 ---- a/criu/mount.c -+++ b/criu/mount.c -@@ -2955,11 +2955,12 @@ struct mount_info *mnt_entry_alloc(bool rst) - new = xzalloc(sizeof(struct mount_info)); - if (new) { - if (rst) { -- new->remounted_rw = shmalloc(sizeof(int)); -- if (!new->remounted_rw) { -+ new->rmi = shmalloc(sizeof(struct rst_mount_info)); -+ if (!new->rmi) { - xfree(new); - return NULL; - } -+ memset(new->rmi, 0, sizeof(struct rst_mount_info)); - } - new->fd = -1; - new->is_overmounted = -1; -@@ -4073,9 +4074,9 @@ int try_remount_writable(struct mount_info *mi, bool ns) - remounted = REMOUNTED_RW_SERVICE; - - /* All mounts in mntinfo list should have it on restore */ -- BUG_ON(mi->remounted_rw == NULL); -+ BUG_ON(mi->rmi == NULL); - -- if (mi->flags & MS_RDONLY && !(*mi->remounted_rw & remounted)) { -+ if (mi->flags & MS_RDONLY && !(mi->rmi->remounted_rw & remounted)) { - if (mnt_is_overmounted(mi)) { - pr_err("The mount %d is overmounted so paths are invisible\n", mi->mnt_id); - return -1; -@@ -4098,7 +4099,7 @@ int try_remount_writable(struct mount_info *mi, bool ns) - if (call_helper_process(ns_remount_writable, mi)) - return -1; - } -- *mi->remounted_rw |= remounted; -+ mi->rmi->remounted_rw |= remounted; - } - - return 0; -@@ -4113,7 +4114,7 @@ static int __remount_readonly_mounts(struct ns_id *ns) - if (ns && mi->nsid != ns) - continue; - -- if (!(*mi->remounted_rw & REMOUNTED_RW)) -+ if (!(mi->rmi->remounted_rw & REMOUNTED_RW)) - continue; - - /* --- -2.35.1 - diff --git a/0187-autofs-use-ns_mountpoint-in-autofs_create_dentries.patch b/0187-autofs-use-ns_mountpoint-in-autofs_create_dentries.patch deleted file mode 100644 index 775ed1c..0000000 --- a/0187-autofs-use-ns_mountpoint-in-autofs_create_dentries.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 88e851616d9f576f38630e0725ebc275f12f4ecb Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Tue, 26 May 2020 16:40:57 +0300 -Subject: [PATCH 187/249] autofs: use ns_mountpoint in autofs_create_dentries - -Replace ->mountpoint with ->ns_mountpoint for determining relations -between mounts. - -Also let's use get_relative_path in autofs_create_dentries as it is more -robust, before that we've missed the case where mountpoint of child of -autofs mount is multilevel subdirectory of parent mountpoint, and always -created them as single level subdirectory. - -Cherry-picked from Virtuozzo criu: -https://src.openvz.org/projects/OVZ/repos/criu/commits/5d5462202 - -Changes: skip children overmount as it does not need a subdirectory. - -Signed-off-by: Pavel Tikhomirov ---- - criu/autofs.c | 15 ++++++++++----- - 1 file changed, 10 insertions(+), 5 deletions(-) - -diff --git a/criu/autofs.c b/criu/autofs.c -index 71edc7bce..9d146b92b 100644 ---- a/criu/autofs.c -+++ b/criu/autofs.c -@@ -725,14 +725,19 @@ static int autofs_create_dentries(const struct mount_info *mi, char *mnt_path) - struct mount_info *c; - - list_for_each_entry(c, &mi->children, siblings) { -- char *path, *basename; -+ char *path, *rel_path; - -- basename = strrchr(c->mountpoint, '/'); -- if (!basename) { -- pr_info("%s: mount path \"%s\" doesn't have '/'\n", __func__, c->mountpoint); -+ rel_path = get_relative_path(c->ns_mountpoint, mi->ns_mountpoint); -+ if (!rel_path) { -+ pr_err("Can't get path %s relative to %s\n", c->ns_mountpoint, mi->ns_mountpoint); - return -1; - } -- path = xsprintf("%s%s", mnt_path, basename); -+ -+ /* Skip children-overmount */ -+ if (*rel_path == '\0') -+ continue; -+ -+ path = xsprintf("%s/%s", mnt_path, rel_path); - if (!path) - return -1; - if (mkdir(path, 0555) < 0) { --- -2.35.1 - diff --git a/0188-mount-use-ns_mountpoint-in-mnt_is_overmounted.patch b/0188-mount-use-ns_mountpoint-in-mnt_is_overmounted.patch deleted file mode 100644 index 3de0ec6..0000000 --- a/0188-mount-use-ns_mountpoint-in-mnt_is_overmounted.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 99273ed7906b0e88879166e95538ec9b3358cb8e Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Tue, 30 Nov 2021 12:11:02 +0300 -Subject: [PATCH 188/249] mount: use ns_mountpoint in mnt_is_overmounted - -Let's use ->ns_mountpoint in comparison as ->mountpoint can change (e.g. -see how we add ns root in get_mp_mountpoint and in do_remap_mount we can -change it again). We plan to get rid of ->mountpoint everywhere where we -can use unchanged ->ns_mountpoint. - -Cherry-picked hunks from Virtuozzo criu: -https://src.openvz.org/projects/OVZ/repos/criu/commits/e98e1456d - -Signed-off-by: Pavel Tikhomirov ---- - criu/mount.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/criu/mount.c b/criu/mount.c -index 5fdd60cda..83baef4f3 100644 ---- a/criu/mount.c -+++ b/criu/mount.c -@@ -1322,7 +1322,7 @@ bool mnt_is_overmounted(struct mount_info *mi) - list_for_each_entry(t, &m->parent->children, siblings) { - if (m == t) - continue; -- if (issubpath(m->mountpoint, t->mountpoint)) { -+ if (issubpath(m->ns_mountpoint, t->ns_mountpoint)) { - mi->is_overmounted = 1; - goto exit; - } -@@ -1338,7 +1338,7 @@ bool mnt_is_overmounted(struct mount_info *mi) - - /* Check there is no children-overmount */ - list_for_each_entry(c, &mi->children, siblings) -- if (!strcmp(c->mountpoint, mi->mountpoint)) { -+ if (!strcmp(c->ns_mountpoint, mi->ns_mountpoint)) { - mi->is_overmounted = 1; - goto exit; - } --- -2.35.1 - diff --git a/0189-mount-skip-root-yard-children-from-mnt_needs_remap-c.patch b/0189-mount-skip-root-yard-children-from-mnt_needs_remap-c.patch deleted file mode 100644 index c8f7df1..0000000 --- a/0189-mount-skip-root-yard-children-from-mnt_needs_remap-c.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 246f80532a80d73c8bb6fabc58d91549155b53ac Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Fri, 29 May 2020 12:40:52 +0300 -Subject: [PATCH 189/249] mount: skip root yard children from mnt_needs_remap - check - -There is no point of remaping ns root mounts they can't overmount anybody. - -This also allows us to switch mnt_needs_remap from ->mountpoint to -->ns_mountpoint for mount comparison in overmount detection. - -Cherry-picked from Virtuozzo criu: -https://src.openvz.org/projects/OVZ/repos/criu/commits/9475bf843 - -Signed-off-by: Pavel Tikhomirov ---- - criu/mount.c | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/criu/mount.c b/criu/mount.c -index 83baef4f3..fffebe801 100644 ---- a/criu/mount.c -+++ b/criu/mount.c -@@ -541,13 +541,13 @@ static bool mnt_needs_remap(struct mount_info *m) - { - struct mount_info *t; - -- if (!m->parent) -+ if (!m->parent || m->parent == root_yard_mp) - return false; - - list_for_each_entry(t, &m->parent->children, siblings) { - if (m == t) - continue; -- if (issubpath(t->mountpoint, m->mountpoint)) -+ if (issubpath(t->ns_mountpoint, m->ns_mountpoint)) - return true; - } - -@@ -556,7 +556,7 @@ static bool mnt_needs_remap(struct mount_info *m) - * remapped too, else fixup_remap_mounts() won't be able to move parent - * to it's real place, it will move child instead. - */ -- if (!strcmp(m->parent->mountpoint, m->mountpoint)) -+ if (!strcmp(m->parent->ns_mountpoint, m->ns_mountpoint)) - return mnt_needs_remap(m->parent); - - return false; --- -2.35.1 - diff --git a/0190-mount-use-ns_mountpoint-in-validate_children_collisi.patch b/0190-mount-use-ns_mountpoint-in-validate_children_collisi.patch deleted file mode 100644 index becba86..0000000 --- a/0190-mount-use-ns_mountpoint-in-validate_children_collisi.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 876abe5b5fd08fb1e23e2f1ae1e157d9ed9ba57e Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Fri, 29 May 2020 13:00:48 +0300 -Subject: [PATCH 190/249] mount: use ns_mountpoint in - validate_children_collision - -Function validate_children_collision is both called on dump and on -restore. On dump mountpoint and ns_mountpoint are the same. On restore -as we never call validate_children_collision on helper mounts -(root_yard_mp and cr_time are not in mntinfo list), for all other mounts -strcmp results would be the same with mountpoint and ns_mountpoint. - -Cherry-picked from Virtuozzo criu: -https://src.openvz.org/projects/OVZ/repos/criu/commits/8f4fda5ac - -Signed-off-by: Pavel Tikhomirov ---- - criu/mount.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/criu/mount.c b/criu/mount.c -index fffebe801..3e907172d 100644 ---- a/criu/mount.c -+++ b/criu/mount.c -@@ -676,7 +676,7 @@ static int validate_children_collision(struct mount_info *mnt) - list_for_each_entry(chj, &mnt->children, siblings) { - if (chj == chi) - break; -- if (!strcmp(chj->mountpoint, chi->mountpoint)) { -+ if (!strcmp(chj->ns_mountpoint, chi->ns_mountpoint)) { - pr_err("Mount %d has two children with same " - "mountpoint: %d %d\n", - mnt->mnt_id, chj->mnt_id, chi->mnt_id); --- -2.35.1 - diff --git a/0191-mount-use-ns_mountpoint-in-root_path_from_parent.patch b/0191-mount-use-ns_mountpoint-in-root_path_from_parent.patch deleted file mode 100644 index b9f16aa..0000000 --- a/0191-mount-use-ns_mountpoint-in-root_path_from_parent.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 042dd19537f68f3412e642858c620a2ccc111337 Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Fri, 29 May 2020 13:39:10 +0300 -Subject: [PATCH 191/249] mount: use ns_mountpoint in root_path_from_parent - -Fail root_path_from_parent if parent is root_yard, we want to only -lookup root path in real parent mounts. - -Now it is safe to use ns_mountpoint instead of mountpoint as both -children and parent have it and they are relative. - -Cherry-picked from Virtuozzo criu: -https://src.openvz.org/projects/OVZ/repos/criu/commits/e58a91883 - -Signed-off-by: Pavel Tikhomirov ---- - criu/mount.c | 10 +++++----- - 1 file changed, 5 insertions(+), 5 deletions(-) - -diff --git a/criu/mount.c b/criu/mount.c -index 3e907172d..516752a98 100644 ---- a/criu/mount.c -+++ b/criu/mount.c -@@ -905,11 +905,11 @@ static int root_path_from_parent(struct mount_info *m, char *buf, int size) - bool head_slash = false, tail_slash = false; - int p_len, m_len, len; - -- if (!m->parent) -+ if (!m->parent || m->parent == root_yard_mp) - return -1; - -- p_len = strlen(m->parent->mountpoint); -- m_len = strlen(m->mountpoint); -+ p_len = strlen(m->parent->ns_mountpoint); -+ m_len = strlen(m->ns_mountpoint); - - len = snprintf(buf, size, "%s", m->parent->root); - if (len >= size) -@@ -925,11 +925,11 @@ static int root_path_from_parent(struct mount_info *m, char *buf, int size) - len = m_len - p_len; - BUG_ON(len < 0); - if (len) { -- if (m->mountpoint[p_len] == '/') -+ if (m->ns_mountpoint[p_len] == '/') - head_slash = true; - - len = snprintf(buf, size, "%s%s", (!tail_slash && !head_slash) ? "/" : "", -- m->mountpoint + p_len + (tail_slash && head_slash)); -+ m->ns_mountpoint + p_len + (tail_slash && head_slash)); - if (len >= size) - return -1; - } --- -2.35.1 - diff --git a/0192-mount-use-ns_mountpoint-for-children-overmount-check.patch b/0192-mount-use-ns_mountpoint-for-children-overmount-check.patch deleted file mode 100644 index f05e491..0000000 --- a/0192-mount-use-ns_mountpoint-for-children-overmount-check.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 103bb35c39c07c01b03a557486b9e550ed80311b Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Fri, 29 May 2020 13:52:45 +0300 -Subject: [PATCH 192/249] mount: use ns_mountpoint for children-overmount check - -We need to skip root_yard_mp parent as it has no ns_mountpoint, it also -has no children overmounts so we are safe, all others can be compared by -ns_mountpoints. - -Cherry-picked from Virtuozzo criu: -https://src.openvz.org/projects/OVZ/repos/criu/commits/e5665c976 - -Changes: add mi->parent pre-check, reword commit message. - -Signed-off-by: Pavel Tikhomirov ---- - criu/mount.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/criu/mount.c b/criu/mount.c -index 516752a98..b0c43e3ca 100644 ---- a/criu/mount.c -+++ b/criu/mount.c -@@ -2675,7 +2675,7 @@ static int do_mount_one(struct mount_info *mi) - return 1; - } - -- if (!strcmp(mi->parent->mountpoint, mi->mountpoint)) { -+ if ((mi->parent && mi->parent != root_yard_mp) && !strcmp(mi->parent->ns_mountpoint, mi->ns_mountpoint)) { - mi->parent->fd = open(mi->parent->mountpoint, O_PATH); - if (mi->parent->fd < 0) { - pr_perror("Unable to open %s", mi->mountpoint); --- -2.35.1 - diff --git a/0193-path-simplify-mnt_get_sibling_path-via-get_relative_.patch b/0193-path-simplify-mnt_get_sibling_path-via-get_relative_.patch deleted file mode 100644 index 1ec16b8..0000000 --- a/0193-path-simplify-mnt_get_sibling_path-via-get_relative_.patch +++ /dev/null @@ -1,155 +0,0 @@ -From 21e9d5515d154da3b7a5b9894ce99654d3c74511 Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Wed, 1 Dec 2021 12:52:27 +0300 -Subject: [PATCH 193/249] path: simplify mnt_get_sibling_path via - get_relative_path - -Previous code did: - -1) get rpath: mount's mountpoint relative to it's parent mountpoint -2) get cut_root: parent's root relative to parent's slave root or vice -versa (will be "-" if parents root is wider of "+" if thicker) -3) return parent's slave mountpoint +/- cut_root + rpath - -It can be done more robust with get_relative_path: - -1) get rpath: mount's mountpoint relative to it's parent mountpoint -2) get fsrpath: add rpath to parent's root (path relative to fs root) -3) get rpath: fsrpath relative to parent's slave root -4) return parent's slave mountpoint + rpath - -In the latter approach we do not need to open code workarounds for -consequent slashes in paths (get_relative_path would do this for us), -and we also do not need to have complex logic with +/-. - -While on it let's also switch ->mountpoint to ->ns_mountpoint where -possible, as mountpoint can have unexpected prefixes. - -Cherry-picked from Virtuozzo criu: -https://src.openvz.org/projects/OVZ/repos/criu/commits/0fd09f8571 - -Changes: rework mnt_get_sibling_path more. - -Signed-off-by: Pavel Tikhomirov ---- - criu/mount.c | 4 +++- - criu/path.c | 65 +++++++++++++--------------------------------------- - 2 files changed, 19 insertions(+), 50 deletions(-) - -diff --git a/criu/mount.c b/criu/mount.c -index b0c43e3ca..1ffd3da8d 100644 ---- a/criu/mount.c -+++ b/criu/mount.c -@@ -2040,6 +2040,8 @@ static int umount_from_slaves(struct mount_info *mi) - struct mount_info *t; - char *mpath, buf[PATH_MAX]; - -+ BUG_ON(mi->parent == root_yard_mp); -+ - list_for_each_entry(t, &mi->parent->mnt_slave_list, mnt_slave) { - if (!t->mounted) - continue; -@@ -2107,7 +2109,7 @@ static int propagate_mount(struct mount_info *mi) - - propagate_siblings(mi); - -- if (!mi->parent) -+ if (!mi->parent || mi->parent == root_yard_mp) - goto skip_parent; - - umount_from_slaves(mi); -diff --git a/criu/path.c b/criu/path.c -index 1b71c4cb1..54f5483b9 100644 ---- a/criu/path.c -+++ b/criu/path.c -@@ -6,6 +6,7 @@ - #include "mount.h" - #include "path.h" - #include "log.h" -+#include "util.h" - #include "common/bug.h" - - char *cut_root_for_bind(char *target_root, char *source_root) -@@ -41,64 +42,30 @@ out: - char *mnt_get_sibling_path(struct mount_info *m, struct mount_info *p, char *buf, int len) - { - struct mount_info *pa = m->parent; -- char *rpath, *cut_root, *path = buf; -- int off = 0; -+ char *rpath, fsrpath[PATH_MAX]; - - if (pa == NULL) - return NULL; - -- rpath = m->mountpoint + strlen(pa->mountpoint); -- if (rpath[0] == '/') -- rpath++; -- -- /* -- * Get a path to a sibling of "m" with parent "p", -- * return NULL is p can't have a sibling of m. -- * -- * Here are two cases: -- * When a parent of "m" has longer root than "p": -- * / pm->root / rpath -- * | cut_root | -- * / p->root / -- * In this case, a sibling path is a sum of p->mountpoint, -- * cut_root and rpath. -- * -- * When a parent of m has shorter root than "p": -- * / pm->root / rpath -- * | cut_root | -- * / p->root / rpath +strlen(cut_root) -- * In this case, a sibling path is a sum of p->mountpoint and -- * rpath - strlen(cut_root). -- */ -- -- cut_root = cut_root_for_bind(pa->root, p->root); -- if (cut_root == NULL) -+ rpath = get_relative_path(m->ns_mountpoint, pa->ns_mountpoint); -+ if (!rpath) { -+ pr_warn("child - parent mountpoint missmatch %s - %s\n", m->ns_mountpoint, pa->ns_mountpoint); - return NULL; -- if (p->mountpoint[1] != 0) /* not "/" */ { -- off = snprintf(path, len, "%s", p->mountpoint); -- if (path[off - 1] == '/') /* p->mountpoint = "./" */ -- off--; - } -- len -= off; -- path += off; - -- if (strlen(pa->root) > strlen(p->root)) { -- off = snprintf(path, len, "/%s", cut_root); -- len -= off; -- path += off; -- } else { -- int length = strlen(cut_root); -- if (strncmp(rpath, cut_root, length)) -- return NULL; -- rpath += strlen(cut_root); -- if (length > 0 && (rpath[0] && rpath[0] != '/')) -- return NULL; -+ if (snprintf(fsrpath, sizeof(fsrpath), "%s/%s", pa->root, rpath) >= sizeof(fsrpath)) { -+ pr_warn("snrptintf truncation \"%s / %s\"\n", pa->root, rpath); -+ return NULL; - } -- if (rpath[0] == '/') -- rpath++; - -- if (rpath[0] != '\0') -- snprintf(path, len, "/%s", rpath); -+ rpath = get_relative_path(fsrpath, p->root); -+ if (!rpath) -+ return NULL; -+ -+ if (snprintf(buf, len, "%s/%s", p->ns_mountpoint, rpath) >= sizeof(fsrpath)) { -+ pr_warn("snrptintf truncation \"%s / %s\"\n", p->ns_mountpoint, rpath); -+ return NULL; -+ } - - return buf; - } --- -2.35.1 - diff --git a/0194-mount-use-ns_mountpoint-in-collect_mntinfo.patch b/0194-mount-use-ns_mountpoint-in-collect_mntinfo.patch deleted file mode 100644 index 7657eb0..0000000 --- a/0194-mount-use-ns_mountpoint-in-collect_mntinfo.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 29899d64c171443c6d456d122bf564e2c259ca20 Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Fri, 29 May 2020 14:34:03 +0300 -Subject: [PATCH 194/249] mount: use ns_mountpoint in collect_mntinfo - -At this point ns_mountpoint is equal to mountpoint. - -More over let's use robust is_same_path helper in should_skip_mount so -that we don't need to rely on ->mountpoint + 1 hacks. - -Cherry-picked from Virtuozzo criu: -https://src.openvz.org/projects/OVZ/repos/criu/commits/d4c4271a0 - -Changes: use is_same_path helper. - -Signed-off-by: Pavel Tikhomirov ---- - criu/proc_parse.c | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/criu/proc_parse.c b/criu/proc_parse.c -index 260d3669c..fd859a5c0 100644 ---- a/criu/proc_parse.c -+++ b/criu/proc_parse.c -@@ -1456,12 +1456,12 @@ bool add_skip_mount(const char *mountpoint) - return true; - } - --static bool should_skip_mount(const char *mountpoint) -+static bool should_skip_mount(char *mountpoint) - { - struct str_node *pos; - - list_for_each_entry(pos, &skip_mount_list, node) { -- if (strcmp(mountpoint, pos->string) == 0) -+ if (is_same_path(mountpoint, pos->string)) - return true; - } - -@@ -1590,8 +1590,8 @@ struct mount_info *parse_mountinfo(pid_t pid, struct ns_id *nsid, bool for_dump) - * fail loudly at "dump" stage if an opened file or another mnt - * depends on this one. - */ -- if (for_dump && should_skip_mount(new->mountpoint + 1)) { -- pr_info("\tskip %s @ %s\n", fsname, new->mountpoint); -+ if (for_dump && should_skip_mount(new->ns_mountpoint)) { -+ pr_info("\tskip %s @ %s\n", fsname, new->ns_mountpoint); - mnt_entry_free(new); - new = NULL; - goto end; --- -2.35.1 - diff --git a/0195-mount-use-ns_mountpoint-in-aufs_parse.patch b/0195-mount-use-ns_mountpoint-in-aufs_parse.patch deleted file mode 100644 index f07e4a6..0000000 --- a/0195-mount-use-ns_mountpoint-in-aufs_parse.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 5ffda01cf26e5cd13c33c2c6ea35f6624073a69b Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Fri, 29 May 2020 14:40:01 +0300 -Subject: [PATCH 195/249] mount: use ns_mountpoint in aufs_parse - -At this point ns_mountpoint is equal to mountpoint. - -Cherry-picked from Virtuozzo criu: -https://src.openvz.org/projects/OVZ/repos/criu/commits/c70bd7de0 - -Signed-off-by: Pavel Tikhomirov ---- - criu/proc_parse.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/criu/proc_parse.c b/criu/proc_parse.c -index fd859a5c0..413596fbb 100644 ---- a/criu/proc_parse.c -+++ b/criu/proc_parse.c -@@ -2707,7 +2707,7 @@ int aufs_parse(struct mount_info *new) - { - int ret = 0; - -- if (!strcmp(new->mountpoint, "./")) { -+ if (!strcmp(new->ns_mountpoint, "./")) { - opts.aufs = true; - ret = parse_aufs_branches(new); - } --- -2.35.1 - diff --git a/0196-mount-use-ns_mountpoint-in-mnt_depth.patch b/0196-mount-use-ns_mountpoint-in-mnt_depth.patch deleted file mode 100644 index 5ffc19c..0000000 --- a/0196-mount-use-ns_mountpoint-in-mnt_depth.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 45dba8dd206c5bda0c682de1ee31a99ae5c50f49 Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Fri, 29 May 2020 15:18:10 +0300 -Subject: [PATCH 196/249] mount: use ns_mountpoint in mnt_depth - -Function mnt_depth is only used on real mounts when building mount tree for -single namespace, thats why we can compare those mounts with ns_mountpoint -safely. - -Cherry-picked from Virtuozzo criu: -https://src.openvz.org/projects/OVZ/repos/criu/commits/2be0ff276 - -Signed-off-by: Pavel Tikhomirov ---- - criu/mount.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/criu/mount.c b/criu/mount.c -index 1ffd3da8d..0c1a67aab 100644 ---- a/criu/mount.c -+++ b/criu/mount.c -@@ -392,7 +392,7 @@ static unsigned int mnt_depth(struct mount_info *m) - unsigned int depth = 0; - char *c; - -- for (c = m->mountpoint; *c != '\0'; c++) -+ for (c = m->ns_mountpoint; *c != '\0'; c++) - if (*c == '/') - depth++; - --- -2.35.1 - diff --git a/0197-mount-use-ns_mountpoint-instead-of-mountpoint-where-.patch b/0197-mount-use-ns_mountpoint-instead-of-mountpoint-where-.patch deleted file mode 100644 index 9c4d221..0000000 --- a/0197-mount-use-ns_mountpoint-instead-of-mountpoint-where-.patch +++ /dev/null @@ -1,567 +0,0 @@ -From 259b1d228857158dea54ccd36e59c712b87b9bc4 Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Fri, 29 May 2020 12:02:16 +0300 -Subject: [PATCH 197/249] mount: use ns_mountpoint instead of mountpoint where - possible - -On dump ->mountpoint and ->ns_mountpoint is the same, but on restore -->mountpoint can be changed by mount tree yard setup and remap (and who -knows what else =) ). It is not good to use ->mountpoint for path -comparison between mounts if we are not explictly need to compare -"changed" paths. Imagine the remap change will make two mounts have -different prefixes in ->mountpoint and we won't be able so understand -that those mounts originally were subpaths. - -This patch handles 2 simple cases: - -a) These functions called ONLY ON DUMP so for them there is no effective -change: fixup_overlayfs, fusectl_dump, check_one_mark, __lookup_overlayfs, -mount_resolve_path, try_resolve_ext_mount, validate_mounts (first and third), -resolve_external_mounts, get_clean_mnt, __umount_children_overmounts, -__umount_overmounts, ns_open_mountpoint, open_mountpoint, dump_one_fs, -dump_one_mountpoint, clean_cr_time_mounts, collect_unix_bindmounts. - -b) In these functions ONLY LOGS changed, so no algorithm change: -always_fail, mnt_build_ids_tree, mnt_tree_show, unsupported_nfs_bindmounts, -unsupported_nfs_mount, unsupported_mount, validate_mounts (second), -__search_bindmounts, resolve_shared_mounts, mnt_tree_for_each, resolve_source, -propagate_siblings, propagate_mount, do_mount_one, get_mp_root, -collect_mnt_from_image, merge_mount_trees, ns_remount_writable, -__remount_readonly_mounts, parse_mountinfo. - -All complex cases are handled in separate patches. - -Cherry-picked from Virtuozzo criu: -https://src.openvz.org/projects/OVZ/repos/criu/commits/4972888dd - -Signed-off-by: Pavel Tikhomirov ---- - criu/files.c | 4 +- - criu/filesystems.c | 4 +- - criu/fsnotify.c | 2 +- - criu/mount.c | 119 +++++++++++++++++++++++---------------------- - criu/proc_parse.c | 2 +- - 5 files changed, 67 insertions(+), 64 deletions(-) - -diff --git a/criu/files.c b/criu/files.c -index d317bc9ab..be31692e5 100644 ---- a/criu/files.c -+++ b/criu/files.c -@@ -286,12 +286,12 @@ static int fixup_overlayfs(struct fd_parms *p, struct fd_link *link) - * If the bug is present, the file path from /proc//fd - * does not include the mountpoint, so we prepend it ourselves. - */ -- if (strcmp("./", m->mountpoint) != 0) { -+ if (strcmp("./", m->ns_mountpoint) != 0) { - char buf[PATH_MAX]; - int n; - - strlcpy(buf, link->name, PATH_MAX); -- n = snprintf(link->name, PATH_MAX, "%s/%s", m->mountpoint, buf + 2); -+ n = snprintf(link->name, PATH_MAX, "%s/%s", m->ns_mountpoint, buf + 2); - if (n >= PATH_MAX) { - pr_err("Not enough space to replace %s\n", buf); - return -1; -diff --git a/criu/filesystems.c b/criu/filesystems.c -index 3e0ec2eb3..439735204 100644 ---- a/criu/filesystems.c -+++ b/criu/filesystems.c -@@ -548,7 +548,7 @@ static int fusectl_dump(struct mount_info *pm) - - for (it = mntinfo; it; it = it->next) { - if (it->fstype->code == FSTYPE__FUSE && id == kdev_minor(it->s_dev) && !it->external) { -- pr_err("%s is a fuse mount but not external\n", it->mountpoint); -+ pr_err("%s is a fuse mount but not external\n", it->ns_mountpoint); - goto out; - } - } -@@ -659,7 +659,7 @@ static int dump_empty_fs(struct mount_info *pm) - */ - static int always_fail(struct mount_info *pm) - { -- pr_err("failed to dump fs %s (%s): always fail\n", pm->mountpoint, pm->fstype->name); -+ pr_err("failed to dump fs %s (%s): always fail\n", pm->ns_mountpoint, pm->fstype->name); - return -1; - } - -diff --git a/criu/fsnotify.c b/criu/fsnotify.c -index 22fb74973..fd2e8d84e 100644 ---- a/criu/fsnotify.c -+++ b/criu/fsnotify.c -@@ -404,7 +404,7 @@ static int check_one_mark(FanotifyMarkEntry *fme) - return -1; - } - if (!(root_ns_mask & CLONE_NEWNS)) -- fme->me->path = m->mountpoint + 1; -+ fme->me->path = m->ns_mountpoint + 1; - fme->s_dev = m->s_dev; - - pr_info("mark: s_dev %#08x mnt_id %#08x mask %#08x\n", fme->s_dev, fme->me->mnt_id, fme->mask); -diff --git a/criu/mount.c b/criu/mount.c -index 0c1a67aab..980288818 100644 ---- a/criu/mount.c -+++ b/criu/mount.c -@@ -159,15 +159,18 @@ static struct mount_info *__lookup_overlayfs(struct mount_info *list, char *rpat - } - } - -- /* Concatenates m->mountpoint with rpath and attempts to stat the resulting path */ -+ /* -+ * Concatenates m->ns_mountpoint with rpath and attempts -+ * to stat the resulting path at mntns_root -+ */ - if (is_root_mount(m)) { - ret_stat = fstatat(mntns_root, rpath, &f_stat, 0); - } else { - char _full_path[PATH_MAX]; -- int n = snprintf(_full_path, PATH_MAX, "%s/%s", m->mountpoint, rpath); -+ int n = snprintf(_full_path, PATH_MAX, "%s/%s", m->ns_mountpoint, rpath); - - if (n >= PATH_MAX) { -- pr_err("Not enough space to concatenate %s and %s\n", m->mountpoint, rpath); -+ pr_err("Not enough space to concatenate %s and %s\n", m->ns_mountpoint, rpath); - return ERR_PTR(-ENOSPC); - } - ret_stat = fstatat(mntns_root, _full_path, &f_stat, 0); -@@ -249,11 +252,11 @@ static struct mount_info *mount_resolve_path(struct mount_info *mntinfo_tree, co - list_for_each_entry(c, &m->children, siblings) { - size_t n; - -- n = strlen(c->mountpoint + 1); -+ n = strlen(c->ns_mountpoint + 1); - if (n > pathlen) - continue; - -- if (strncmp(c->mountpoint + 1, path, min(n, pathlen))) -+ if (strncmp(c->ns_mountpoint + 1, path, min(n, pathlen))) - continue; - if (n < pathlen && path[n] != '/') - continue; -@@ -265,7 +268,7 @@ static struct mount_info *mount_resolve_path(struct mount_info *mntinfo_tree, co - break; - } - -- pr_debug("Path `%s' resolved to `%s' mountpoint\n", path, m->mountpoint); -+ pr_debug("Path `%s' resolved to `%s' mountpoint\n", path, m->ns_mountpoint); - return m; - } - -@@ -371,7 +374,7 @@ static struct mount_info *mnt_build_ids_tree(struct mount_info *list) - continue; - } - -- pr_err("No parent found for mountpoint %d (@%s)\n", m->mnt_id, m->mountpoint); -+ pr_err("No parent found for mountpoint %d (@%s)\n", m->mnt_id, m->ns_mountpoint); - return NULL; - } - -@@ -460,7 +463,7 @@ static void mnt_tree_show(struct mount_info *tree, int off) - { - struct mount_info *m; - -- pr_info("%*s[%s](%d->%d)\n", off, "", tree->mountpoint, tree->mnt_id, tree->parent_mnt_id); -+ pr_info("%*s[%s](%d->%d)\n", off, "", tree->ns_mountpoint, tree->mnt_id, tree->parent_mnt_id); - - list_for_each_entry(m, &tree->children, siblings) - mnt_tree_show(m, off + 1); -@@ -482,9 +485,9 @@ static int try_resolve_ext_mount(struct mount_info *info) - if (info->nsid->type == NS_ROOT) { - char *ext; - -- ext = ext_mount_lookup(info->mountpoint + 1 /* trim the . */); -+ ext = ext_mount_lookup(info->ns_mountpoint + 1 /* trim the . */); - if (ext) { -- pr_info("Found %s mapping for %s mountpoint\n", ext, info->mountpoint); -+ pr_info("Found %s mapping for %s mountpoint\n", ext, info->ns_mountpoint); - info->external = ext; - return 1; - } -@@ -714,7 +717,7 @@ static int validate_mounts(struct mount_info *info, bool for_dump) - - if (fsroot_mounted(m)) { - if (m->fstype->code == FSTYPE__UNSUPPORTED) { -- pr_err("FS mnt %s dev %#x root %s unsupported id %d\n", m->mountpoint, m->s_dev, -+ pr_err("FS mnt %s dev %#x root %s unsupported id %d\n", m->ns_mountpoint, m->s_dev, - m->root, m->mnt_id); - return -1; - } -@@ -730,7 +733,7 @@ static int validate_mounts(struct mount_info *info, bool for_dump) - */ - - if (for_dump) { -- ret = run_plugins(DUMP_EXT_MOUNT, m->mountpoint, m->mnt_id); -+ ret = run_plugins(DUMP_EXT_MOUNT, m->ns_mountpoint, m->mnt_id); - if (ret == 0) - m->need_plugin = true; - } else -@@ -744,7 +747,7 @@ static int validate_mounts(struct mount_info *info, bool for_dump) - if (ret < 0) { - if (ret == -ENOTSUP) - pr_err("%d:%s doesn't have a proper root mount\n", m->mnt_id, -- m->mountpoint); -+ m->ns_mountpoint); - return -1; - } - } -@@ -881,7 +884,7 @@ static int resolve_external_mounts(struct mount_info *info) - - cut_root = cut_root_for_bind(m->root, match->root); - -- p = xsprintf("%s/%s", match->mountpoint + 1, cut_root); -+ p = xsprintf("%s/%s", match->ns_mountpoint + 1, cut_root); - if (!p) - return -1; - -@@ -894,7 +897,7 @@ static int resolve_external_mounts(struct mount_info *info) - xfree(m->source); - m->source = p; - -- pr_info("autodetected external mount %s for %s\n", p, m->mountpoint); -+ pr_info("autodetected external mount %s for %s(%d)\n", p, m->ns_mountpoint, m->mnt_id); - } - - return 0; -@@ -989,8 +992,8 @@ static void __search_bindmounts(struct mount_info *mi) - if (mounts_sb_equal(mi, t)) { - list_add(&t->mnt_bind, &mi->mnt_bind); - t->mnt_bind_is_populated = true; -- pr_debug("\tThe mount %3d is bind for %3d (@%s -> @%s)\n", t->mnt_id, mi->mnt_id, t->mountpoint, -- mi->mountpoint); -+ pr_debug("\tThe mount %3d is bind for %3d (@%s -> @%s)\n", t->mnt_id, mi->mnt_id, -+ t->ns_mountpoint, mi->ns_mountpoint); - } - } - -@@ -1043,14 +1046,14 @@ static int resolve_shared_mounts(struct mount_info *info) - need_master = m->master_id; - - pr_debug("Inspecting sharing on %2d shared_id %d master_id %d (@%s)\n", m->mnt_id, m->shared_id, -- m->master_id, m->mountpoint); -+ m->master_id, m->ns_mountpoint); - - for (t = info; t && (need_share || need_master); t = t->next) { - if (t == m) - continue; - if (need_master && t->shared_id == m->master_id) { - pr_debug("\tThe mount %3d is slave for %3d (@%s -> @%s)\n", m->mnt_id, t->mnt_id, -- m->mountpoint, t->mountpoint); -+ m->ns_mountpoint, t->ns_mountpoint); - list_add(&m->mnt_slave, &t->mnt_slave_list); - m->mnt_master = t; - need_master = false; -@@ -1059,7 +1062,7 @@ static int resolve_shared_mounts(struct mount_info *info) - /* Collect all mounts from this group */ - if (need_share && t->shared_id == m->shared_id) { - pr_debug("\tMount %3d is shared with %3d group %3d (@%s -> @%s)\n", m->mnt_id, -- t->mnt_id, m->shared_id, t->mountpoint, m->mountpoint); -+ t->mnt_id, m->shared_id, t->ns_mountpoint, m->ns_mountpoint); - list_add(&t->mnt_share, &m->mnt_share); - } - } -@@ -1077,7 +1080,7 @@ static int resolve_shared_mounts(struct mount_info *info) - - pr_err("Mount %d %s (master_id: %d shared_id: %d) " - "has unreachable sharing. Try --enable-external-masters.\n", -- m->mnt_id, m->mountpoint, m->master_id, m->shared_id); -+ m->mnt_id, m->ns_mountpoint, m->master_id, m->shared_id); - return -1; - } - } -@@ -1104,7 +1107,7 @@ static int resolve_shared_mounts(struct mount_info *info) - else if (ret) { - BUG_ON(!mounts_equal(m, schild)); - pr_debug("\tMount %3d is in same propagation group with %3d (@%s ~ @%s)\n", -- m->mnt_id, schild->mnt_id, m->mountpoint, schild->mountpoint); -+ m->mnt_id, schild->mnt_id, m->ns_mountpoint, schild->ns_mountpoint); - list_add(&schild->mnt_propagate, &m->mnt_propagate); - } - } -@@ -1250,8 +1253,8 @@ static char *get_clean_mnt(struct mount_info *mi, char *mnt_path_tmp, char *mnt_ - return NULL; - } - -- if (mount(mi->mountpoint, mnt_path, NULL, MS_BIND, NULL)) { -- pr_warn("Can't bind-mount %d:%s to %s: %s\n", mi->mnt_id, mi->mountpoint, mnt_path, strerror(errno)); -+ if (mount(mi->ns_mountpoint, mnt_path, NULL, MS_BIND, NULL)) { -+ pr_perror("Can't bind-mount %d:%s to %s", mi->mnt_id, mi->ns_mountpoint, mnt_path); - rmdir(mnt_path); - return NULL; - } -@@ -1392,7 +1395,7 @@ static int __umount_children_overmounts(struct mount_info *mi) - */ - again: - list_for_each_entry(c, &m->children, siblings) { -- if (!strcmp(c->mountpoint, m->mountpoint)) { -+ if (!strcmp(c->ns_mountpoint, m->ns_mountpoint)) { - m = c; - goto again; - } -@@ -1400,8 +1403,8 @@ again: - - /* Unmout children-overmounts in the order of visibility */ - while (m != mi) { -- if (umount2(m->mountpoint, MNT_DETACH)) { -- pr_perror("Unable to umount child-overmount %s", m->mountpoint); -+ if (umount2(m->ns_mountpoint, MNT_DETACH)) { -+ pr_perror("Unable to umount child-overmount %s", m->ns_mountpoint); - return -1; - } - BUG_ON(!m->parent); -@@ -1431,12 +1434,12 @@ static int __umount_overmounts(struct mount_info *m) - /* Unmount sibling-overmounts in visibility order */ - next: - ovm = NULL; -- ovm_len = strlen(m->mountpoint) + 1; -+ ovm_len = strlen(m->ns_mountpoint) + 1; - list_for_each_entry(t, &m->parent->children, siblings) { - if (m == t) - continue; -- if (issubpath(m->mountpoint, t->mountpoint)) { -- int t_len = strlen(t->mountpoint); -+ if (issubpath(m->ns_mountpoint, t->ns_mountpoint)) { -+ int t_len = strlen(t->ns_mountpoint); - - if (t_len < ovm_len && t_len > ovm_len_min) { - ovm = t; -@@ -1452,8 +1455,8 @@ next: - if (__umount_children_overmounts(ovm)) - return -1; - -- if (umount2(ovm->mountpoint, MNT_DETACH)) { -- pr_perror("Unable to umount %s", ovm->mountpoint); -+ if (umount2(ovm->ns_mountpoint, MNT_DETACH)) { -+ pr_perror("Unable to umount %s", ovm->ns_mountpoint + 1); - return -1; - } - -@@ -1525,9 +1528,9 @@ int ns_open_mountpoint(void *arg) - * explicitly as when last process exits mntns all mounts in it are - * cleaned from their children, and we are exactly the last process. - */ -- *fd = open(mi->mountpoint, O_DIRECTORY | O_RDONLY); -+ *fd = open(mi->ns_mountpoint, O_DIRECTORY | O_RDONLY); - if (*fd < 0) { -- pr_perror("Unable to open %s", mi->mountpoint); -+ pr_perror("Unable to open %s(%d)", mi->ns_mountpoint, mi->mnt_id); - goto err; - } - -@@ -1549,7 +1552,7 @@ int open_mountpoint(struct mount_info *pm) - if (list_empty(&pm->children) && !mnt_is_overmounted(pm)) - return __open_mountpoint(pm); - -- pr_info("Mount is not fully visible %s\n", pm->mountpoint); -+ pr_info("Mount is not fully visible %s(%d)\n", pm->ns_mountpoint, pm->mnt_id); - - /* - * We do two things below: -@@ -1567,7 +1570,7 @@ int open_mountpoint(struct mount_info *pm) - goto err; - - if (!mnt_is_overmounted(pm)) { -- pr_info("\tmount has children %s\n", pm->mountpoint); -+ pr_info("\tmount has children %s(%d)\n", pm->ns_mountpoint, pm->mnt_id); - fd = get_clean_fd(pm); - } - -@@ -1579,7 +1582,7 @@ int open_mountpoint(struct mount_info *pm) - int pid, status; - struct clone_arg ca = { .mi = pm, .fd = &fd }; - -- pr_info("\tmount is overmounted or has children %s\n", pm->mountpoint); -+ pr_info("\tmount is overmounted or has children %s(%d)\n", pm->ns_mountpoint, pm->mnt_id); - - /* - * We are overmounted - not accessible in a regular way. We -@@ -1748,7 +1751,7 @@ static int dump_one_fs(struct mount_info *mi) - return 0; - } - -- pr_err("Unable to dump a file system for %d:%s\n", mi->mnt_id, mi->mountpoint); -+ pr_err("Unable to dump a file system for %d:%s\n", mi->mnt_id, mi->ns_mountpoint); - return -1; - } - -@@ -1756,7 +1759,7 @@ static int dump_one_mountpoint(struct mount_info *pm, struct cr_img *img) - { - MntEntry me = MNT_ENTRY__INIT; - -- pr_info("\t%d: %x:%s @ %s\n", pm->mnt_id, pm->s_dev, pm->root, pm->mountpoint); -+ pr_info("\t%d: %x:%s @ %s\n", pm->mnt_id, pm->s_dev, pm->root, pm->ns_mountpoint); - - me.fstype = pm->fstype->code; - -@@ -1771,7 +1774,7 @@ static int dump_one_mountpoint(struct mount_info *pm, struct cr_img *img) - return -1; - - if (pm->mnt_id == HELPER_MNT_ID) { -- pr_info("Skip dumping helper mountpoint: %s\n", pm->mountpoint); -+ pr_info("Skip dumping helper mountpoint: %s\n", pm->ns_mountpoint); - return 0; - } - -@@ -1781,7 +1784,7 @@ static int dump_one_mountpoint(struct mount_info *pm, struct cr_img *img) - me.flags = pm->flags; - me.sb_flags = pm->sb_flags; - me.has_sb_flags = true; -- me.mountpoint = pm->mountpoint + 1; -+ me.mountpoint = pm->ns_mountpoint + 1; - me.source = pm->source; - me.options = pm->options; - me.shared_id = pm->shared_id; -@@ -1923,7 +1926,7 @@ int mnt_tree_for_each(struct mount_info *start, int (*fn)(struct mount_info *)) - LIST_HEAD(postpone2); - int progress; - -- pr_debug("Start with %d:%s\n", start->mnt_id, start->mountpoint); -+ pr_debug("Start with %d:%s\n", start->mnt_id, start->ns_mountpoint); - list_add(&start->postpone, &postpone); - - again: -@@ -1937,7 +1940,7 @@ again: - - pr_err("A few mount points can't be mounted\n"); - list_for_each_entry(m, &postpone2, postpone) { -- pr_err("%d:%d %s %s %s\n", m->mnt_id, m->parent_mnt_id, m->root, m->mountpoint, m->source); -+ pr_err("%d:%d %s %s %s\n", m->mnt_id, m->parent_mnt_id, m->root, m->ns_mountpoint, m->source); - } - return -1; - } -@@ -1985,7 +1988,7 @@ static char *resolve_source(struct mount_info *mi) - return mi->source; - } - -- pr_err("No device for %s mount\n", mi->mountpoint); -+ pr_err("No device for %s(%d) mount\n", mi->ns_mountpoint, mi->mnt_id); - return NULL; - } - -@@ -2079,7 +2082,7 @@ static int propagate_siblings(struct mount_info *mi) - continue; - if (t->bind && t->bind->shared_id == t->shared_id) - continue; -- pr_debug("\t\tBind share %s\n", t->mountpoint); -+ pr_debug("\t\tBind share %s(%d)\n", t->ns_mountpoint, t->mnt_id); - t->bind = mi; - t->s_dev_rt = mi->s_dev_rt; - } -@@ -2087,7 +2090,7 @@ static int propagate_siblings(struct mount_info *mi) - list_for_each_entry(t, &mi->mnt_slave_list, mnt_slave) { - if (t->mounted || t->bind) - continue; -- pr_debug("\t\tBind slave %s\n", t->mountpoint); -+ pr_debug("\t\tBind slave %s(%d)\n", t->ns_mountpoint, t->mnt_id); - t->bind = mi; - t->s_dev_rt = mi->s_dev_rt; - } -@@ -2118,7 +2121,7 @@ static int propagate_mount(struct mount_info *mi) - list_for_each_entry(p, &mi->mnt_propagate, mnt_propagate) { - /* Should not propagate the same mount twice */ - BUG_ON(p->mounted); -- pr_debug("\t\tPropagate %s\n", p->mountpoint); -+ pr_debug("\t\tPropagate %s(%d)\n", p->ns_mountpoint, p->mnt_id); - - /* - * When a mount is propagated, the result mount -@@ -2148,7 +2151,7 @@ skip_parent: - continue; - if (!issubpath(t->root, mi->root)) - continue; -- pr_debug("\t\tBind private %s\n", t->mountpoint); -+ pr_debug("\t\tBind private %s(%d)\n", t->ns_mountpoint, t->mnt_id); - t->bind = mi; - t->s_dev_rt = mi->s_dev_rt; - } -@@ -2673,7 +2676,7 @@ static int do_mount_one(struct mount_info *mi) - return 0; - - if (!can_mount_now(mi)) { -- pr_debug("Postpone slave %s\n", mi->mountpoint); -+ pr_debug("Postpone mount %s(%d)\n", mi->ns_mountpoint, mi->mnt_id); - return 1; - } - -@@ -3059,7 +3062,7 @@ static int get_mp_root(MntEntry *me, struct mount_info *mi) - if (!opts.autodetect_ext_mounts) { - pr_err("Mount %d:%s is autodetected external mount. " - "Try \"--ext-mount-map auto\" to allow them.\n", -- mi->mnt_id, mi->mountpoint); -+ mi->mnt_id, mi->ns_mountpoint); - return -1; - } - -@@ -3078,7 +3081,7 @@ static int get_mp_root(MntEntry *me, struct mount_info *mi) - } else { - ext = ext_mount_lookup(me->ext_key); - if (!ext) { -- pr_err("No mapping for %d:%s mountpoint\n", mi->mnt_id, mi->mountpoint); -+ pr_err("No mapping for %d:%s mountpoint\n", mi->mnt_id, mi->ns_mountpoint); - return -1; - } - } -@@ -3260,7 +3263,7 @@ static int collect_mnt_from_image(struct mount_info **head, struct mount_info ** - if (get_mp_mountpoint(me->mountpoint, pm, root, root_len)) - goto err; - -- pr_debug("\tRead %d mp @ %s\n", pm->mnt_id, pm->mountpoint); -+ pr_debug("\tRead %d mp @ %s\n", pm->mnt_id, pm->ns_mountpoint); - } - - if (me) -@@ -3297,7 +3300,7 @@ static int merge_mount_trees(void) - - root = nsid->mnt.mntinfo_tree; - -- pr_debug("Mountpoint %d (@%s) moved to the root yard\n", root->mnt_id, root->mountpoint); -+ pr_debug("Mountpoint %d (@%s) moved to the root yard\n", root->mnt_id, root->ns_mountpoint); - root->parent = root_yard_mp; - list_add(&root->siblings, &root_yard_mp->children); - } -@@ -4000,8 +4003,8 @@ void clean_cr_time_mounts(void) - continue; - } - -- if (umount(mi->mountpoint) < 0) -- pr_perror("Can't umount forced mount %s", mi->mountpoint); -+ if (umount(mi->ns_mountpoint) < 0) -+ pr_perror("Can't umount forced mount %s", mi->ns_mountpoint); - - if (restore_mnt_ns(ns_old, &cwd_fd)) { - pr_err("cleanup_forced_mounts exiting with wrong mnt_ns\n"); -@@ -4058,7 +4061,7 @@ static int ns_remount_writable(void *arg) - - if (mount(NULL, mi->ns_mountpoint, NULL, MS_REMOUNT | MS_BIND | (mi->flags & ~(MS_PROPAGATE | MS_RDONLY)), - NULL) == -1) { -- pr_perror("Failed to remount %d:%s writable", mi->mnt_id, mi->mountpoint); -+ pr_perror("Failed to remount %d:%s writable", mi->mnt_id, mi->ns_mountpoint); - return 1; - } - return 0; -@@ -4131,9 +4134,9 @@ static int __remount_readonly_mounts(struct ns_id *ns) - pr_debug("Switched to mntns %u:%u\n", ns->id, ns->kid); - } - -- pr_info("Remount %d:%s back to readonly\n", mi->mnt_id, mi->mountpoint); -+ pr_info("Remount %d:%s back to readonly\n", mi->mnt_id, mi->ns_mountpoint); - if (mount(NULL, mi->ns_mountpoint, NULL, MS_REMOUNT | MS_BIND | (mi->flags & ~MS_PROPAGATE), NULL)) { -- pr_perror("Failed to restore %d:%s mount flags %x", mi->mnt_id, mi->mountpoint, mi->flags); -+ pr_perror("Failed to restore %d:%s mount flags %x", mi->mnt_id, mi->ns_mountpoint, mi->flags); - return -1; - } - } -diff --git a/criu/proc_parse.c b/criu/proc_parse.c -index 413596fbb..0fbc440a2 100644 ---- a/criu/proc_parse.c -+++ b/criu/proc_parse.c -@@ -1598,7 +1598,7 @@ struct mount_info *parse_mountinfo(pid_t pid, struct ns_id *nsid, bool for_dump) - } - - pr_info("\ttype %s source %s mnt_id %d s_dev %#x %s @ %s flags %#x options %s\n", fsname, new->source, -- new->mnt_id, new->s_dev, new->root, new->mountpoint, new->flags, new->options); -+ new->mnt_id, new->s_dev, new->root, new->ns_mountpoint, new->flags, new->options); - - if (new->fstype->parse) { - ret = new->fstype->parse(new); --- -2.35.1 - diff --git a/0198-mount-add-service_mountpoint-getter-for-mountpoint.patch b/0198-mount-add-service_mountpoint-getter-for-mountpoint.patch deleted file mode 100644 index 3b78573..0000000 --- a/0198-mount-add-service_mountpoint-getter-for-mountpoint.patch +++ /dev/null @@ -1,535 +0,0 @@ -From 183c77f7c56eb6bb5f7ac8cedfbef912a2883d5a Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Thu, 28 May 2020 11:14:39 +0300 -Subject: [PATCH 198/249] mount: add service_mountpoint getter for ->mountpoint - -This getter should be used when we wan't to access the mount on the filesystem. -In next patches we want to be able to change the location of the mount on -restore in service mount namespace, while not changing ->mountpoint string. -All places where we don't want to access the mount but instead want to -determine relations between mounts in the initial mount tree or just print path -should use ns_mountpoint. - -This change effectively brings no change of behaviour everything is the same -for now. - -Still leave ->mountpoint references for remap, cr_time and initialization which -need to work with exact variable. - -Cherry-picked from Virtuozzo criu: -https://src.openvz.org/projects/OVZ/repos/criu/commits/235c761e0 - -Signed-off-by: Pavel Tikhomirov ---- - criu/autofs.c | 22 ++++---- - criu/filesystems.c | 4 +- - criu/include/mount.h | 2 + - criu/mount.c | 121 +++++++++++++++++++++++-------------------- - criu/proc_parse.c | 4 +- - criu/tty.c | 4 +- - 6 files changed, 83 insertions(+), 74 deletions(-) - -diff --git a/criu/autofs.c b/criu/autofs.c -index 9d146b92b..c662bea60 100644 ---- a/criu/autofs.c -+++ b/criu/autofs.c -@@ -388,7 +388,7 @@ free_str: - */ - static int access_autofs_mount(struct mount_info *pm) - { -- const char *mnt_path = pm->mountpoint + 1; -+ const char *mnt_path = service_mountpoint(pm) + 1; - dev_t dev_id = pm->s_dev; - int new_pid_ns = -1, old_pid_ns = -1; - int old_mnt_ns, old_cwd_fd; -@@ -498,7 +498,7 @@ static int autofs_create_entry(struct mount_info *pm, AutofsEntry *entry) - * options, then we can read them again and dump it. - */ - if (access_autofs_mount(pm)) { -- pr_err("failed to access autofs %s\n", pm->mountpoint + 1); -+ pr_err("failed to access autofs %s\n", service_mountpoint(pm) + 1); - return -1; - } - if (parse_options(pm->options, entry, &pipe_ino)) -@@ -755,7 +755,7 @@ static int autofs_populate_mount(const struct mount_info *mi, const AutofsEntry - if (entry->mode != AUTOFS_MODE_INDIRECT) - return 0; - -- return autofs_create_dentries(mi, mi->mountpoint); -+ return autofs_create_dentries(mi, service_mountpoint(mi)); - } - - static int autofs_post_mount(const char *mnt_path, dev_t mnt_dev, time_t timeout) -@@ -1031,10 +1031,10 @@ int autofs_mount(struct mount_info *mi, const char *source, const char *filesyst - goto close_pipe; - } - -- pr_info("autofs: mounting to %s with options: \"%s\"\n", mi->mountpoint, opts); -+ pr_info("autofs: mounting to %s with options: \"%s\"\n", service_mountpoint(mi), opts); - -- if (mount(source, mi->mountpoint, filesystemtype, mountflags, opts) < 0) { -- pr_perror("Failed to mount autofs to %s", mi->mountpoint); -+ if (mount(source, service_mountpoint(mi), filesystemtype, mountflags, opts) < 0) { -+ pr_perror("Failed to mount autofs to %s", service_mountpoint(mi)); - goto free_opts; - } - -@@ -1049,8 +1049,8 @@ int autofs_mount(struct mount_info *mi, const char *source, const char *filesyst - * data is not ready yet. So, let's put in on mi->private and copy to - * shared data in autofs_add_mount_info(). - */ -- if (stat(mi->mountpoint, &buf) < 0) { -- pr_perror("Failed to stat %s", mi->mountpoint); -+ if (stat(service_mountpoint(mi), &buf) < 0) { -+ pr_perror("Failed to stat %s", service_mountpoint(mi)); - goto free_info; - } - info->mnt_dev = buf.st_dev; -@@ -1061,7 +1061,7 @@ int autofs_mount(struct mount_info *mi, const char *source, const char *filesyst - goto free_info; - - /* In case of catatonic mounts all we need as the function call below */ -- ret = autofs_post_mount(mi->mountpoint, buf.st_dev, entry->timeout); -+ ret = autofs_post_mount(service_mountpoint(mi), buf.st_dev, entry->timeout); - if (ret < 0) - goto free_info; - -@@ -1084,7 +1084,7 @@ close_pipe: - free_info: - free(info); - umount: -- if (umount(mi->mountpoint) < 0) -- pr_perror("Failed to umount %s", mi->mountpoint); -+ if (umount(service_mountpoint(mi)) < 0) -+ pr_perror("Failed to umount %s", service_mountpoint(mi)); - goto close_pipe; - } -diff --git a/criu/filesystems.c b/criu/filesystems.c -index 439735204..890d5d06d 100644 ---- a/criu/filesystems.c -+++ b/criu/filesystems.c -@@ -290,7 +290,7 @@ static int binfmt_misc_restore_bme(struct mount_info *mi, BinfmtMiscEntry *bme, - goto bad_dump; - - pr_debug("binfmt_misc_pattern=%s\n", buf); -- ret = write_binfmt_misc_entry(mi->mountpoint, buf, bme); -+ ret = write_binfmt_misc_entry(service_mountpoint(mi), buf, bme); - - return ret; - -@@ -452,7 +452,7 @@ static int tmpfs_restore(struct mount_info *pm) - - ret = cr_system(img_raw_fd(img), -1, -1, "tar", - (char *[]){ "tar", "--extract", "--gzip", "--no-unquote", "--no-wildcards", "--directory", -- pm->mountpoint, NULL }, -+ service_mountpoint(pm), NULL }, - 0); - close_image(img); - -diff --git a/criu/include/mount.h b/criu/include/mount.h -index 3067e4088..8eb4ddf9b 100644 ---- a/criu/include/mount.h -+++ b/criu/include/mount.h -@@ -191,4 +191,6 @@ extern struct mount_info *mnt_bind_pick(struct mount_info *mi, - bool (*pick)(struct mount_info *mi, struct mount_info *bind)); - - extern int mnt_tree_for_each(struct mount_info *start, int (*fn)(struct mount_info *)); -+ -+extern char *service_mountpoint(const struct mount_info *mi); - #endif /* __CR_MOUNT_H__ */ -diff --git a/criu/mount.c b/criu/mount.c -index 980288818..bddfe2e7f 100644 ---- a/criu/mount.c -+++ b/criu/mount.c -@@ -47,6 +47,11 @@ static struct mount_info *root_yard_mp = NULL; - - static LIST_HEAD(delayed_unbindable); - -+char *service_mountpoint(const struct mount_info *mi) -+{ -+ return mi->mountpoint; -+} -+ - int ext_mount_add(char *key, char *val) - { - cleanup_free char *e_str = NULL; -@@ -1664,7 +1669,7 @@ static __maybe_unused struct mount_info *add_cr_time_mount(struct mount_info *ro - parent = root; - while (1) { - list_for_each_entry(t, &parent->children, siblings) { -- if (strstartswith(mi->mountpoint, t->mountpoint)) { -+ if (strstartswith(service_mountpoint(mi), service_mountpoint(t))) { - parent = t; - break; - } -@@ -1679,7 +1684,8 @@ static __maybe_unused struct mount_info *add_cr_time_mount(struct mount_info *ro - mi->parent = parent; - mi->parent_mnt_id = parent->mnt_id; - list_add(&mi->siblings, &parent->children); -- pr_info("Add cr-time mountpoint %s with parent %s(%u)\n", mi->mountpoint, parent->mountpoint, parent->mnt_id); -+ pr_info("Add cr-time mountpoint %s with parent %s(%u)\n", service_mountpoint(mi), service_mountpoint(parent), -+ parent->mnt_id); - return mi; - - err: -@@ -1994,23 +2000,23 @@ static char *resolve_source(struct mount_info *mi) - - static int restore_shared_options(struct mount_info *mi, bool private, bool shared, bool slave) - { -- pr_debug("%d:%s private %d shared %d slave %d\n", mi->mnt_id, mi->mountpoint, private, shared, slave); -+ pr_debug("%d:%s private %d shared %d slave %d\n", mi->mnt_id, service_mountpoint(mi), private, shared, slave); - - if (mi->flags & MS_UNBINDABLE) { - if (shared || slave) { -- pr_warn("%s has both unbindable and sharing, ignoring unbindable\n", mi->mountpoint); -+ pr_warn("%s has both unbindable and sharing, ignoring unbindable\n", service_mountpoint(mi)); - } else { - if (!mnt_is_overmounted(mi)) { - /* Someone may still want to bind from us, let them do it. */ -- pr_debug("Temporary leave unbindable mount %s as private\n", mi->mountpoint); -- if (mount(NULL, mi->mountpoint, NULL, MS_PRIVATE, NULL)) { -+ pr_debug("Temporary leave unbindable mount %s as private\n", service_mountpoint(mi)); -+ if (mount(NULL, service_mountpoint(mi), NULL, MS_PRIVATE, NULL)) { - pr_perror("Unable to make %d private", mi->mnt_id); - return -1; - } - list_add(&mi->mnt_unbindable, &delayed_unbindable); - return 0; - } -- if (mount(NULL, mi->mountpoint, NULL, MS_UNBINDABLE, NULL)) { -+ if (mount(NULL, service_mountpoint(mi), NULL, MS_UNBINDABLE, NULL)) { - pr_perror("Unable to make %d unbindable", mi->mnt_id); - return -1; - } -@@ -2018,15 +2024,15 @@ static int restore_shared_options(struct mount_info *mi, bool private, bool shar - } - } - -- if (private && mount(NULL, mi->mountpoint, NULL, MS_PRIVATE, NULL)) { -+ if (private && mount(NULL, service_mountpoint(mi), NULL, MS_PRIVATE, NULL)) { - pr_perror("Unable to make %d private", mi->mnt_id); - return -1; - } -- if (slave && mount(NULL, mi->mountpoint, NULL, MS_SLAVE, NULL)) { -+ if (slave && mount(NULL, service_mountpoint(mi), NULL, MS_SLAVE, NULL)) { - pr_perror("Unable to make %d slave", mi->mnt_id); - return -1; - } -- if (shared && mount(NULL, mi->mountpoint, NULL, MS_SHARED, NULL)) { -+ if (shared && mount(NULL, service_mountpoint(mi), NULL, MS_SHARED, NULL)) { - pr_perror("Unable to make %d shared", mi->mnt_id); - return -1; - } -@@ -2183,9 +2189,9 @@ static int fetch_rt_stat(struct mount_info *m, const char *where) - - static int do_simple_mount(struct mount_info *mi, const char *src, const char *fstype, unsigned long mountflags) - { -- int ret = mount(src, mi->mountpoint, fstype, mountflags, mi->options); -+ int ret = mount(src, service_mountpoint(mi), fstype, mountflags, mi->options); - if (ret) -- pr_perror("Unable to mount %s %s (id=%d)", src, mi->mountpoint, mi->mnt_id); -+ pr_perror("Unable to mount %s %s (id=%d)", src, service_mountpoint(mi), mi->mnt_id); - return ret; - } - -@@ -2250,7 +2256,7 @@ static int do_new_mount(struct mount_info *mi) - sflags &= ~MS_RDONLY; - - if (do_mount(mi, src, mnt_fsname(mi), sflags) < 0) { -- pr_perror("Can't mount at %s", mi->mountpoint); -+ pr_perror("Can't mount at %s", service_mountpoint(mi)); - return -1; - } - -@@ -2260,21 +2266,21 @@ static int do_new_mount(struct mount_info *mi) - if (remount_ro) { - int fd; - -- fd = open(mi->mountpoint, O_PATH); -+ fd = open(service_mountpoint(mi), O_PATH); - if (fd < 0) { -- pr_perror("Unable to open %s", mi->mountpoint); -+ pr_perror("Unable to open %s", service_mountpoint(mi)); - return -1; - } - sflags |= MS_RDONLY | MS_REMOUNT; - if (userns_call(apply_sb_flags, 0, &sflags, sizeof(sflags), fd)) { -- pr_err("Unable to apply mount flags %d for %s\n", mi->sb_flags, mi->mountpoint); -+ pr_err("Unable to apply mount flags %d for %s\n", mi->sb_flags, service_mountpoint(mi)); - close(fd); - return -1; - } - close(fd); - } - -- if (mflags && mount(NULL, mi->mountpoint, NULL, MS_REMOUNT | MS_BIND | mflags, NULL)) { -+ if (mflags && mount(NULL, service_mountpoint(mi), NULL, MS_REMOUNT | MS_BIND | mflags, NULL)) { - pr_perror("Unable to apply bind-mount options"); - return -1; - } -@@ -2296,8 +2302,8 @@ static int restore_ext_mount(struct mount_info *mi) - { - int ret; - -- pr_debug("Restoring external bind mount %s\n", mi->mountpoint); -- ret = run_plugins(RESTORE_EXT_MOUNT, mi->mnt_id, mi->mountpoint, "/", NULL); -+ pr_debug("Restoring external bind mount %s\n", service_mountpoint(mi)); -+ ret = run_plugins(RESTORE_EXT_MOUNT, mi->mnt_id, service_mountpoint(mi), "/", NULL); - if (ret) - pr_err("Can't restore ext mount (%d)\n", ret); - return ret; -@@ -2390,9 +2396,9 @@ static int do_bind_mount(struct mount_info *mi) - */ - mi->private = mi->bind->private; - -- mnt_path = mi->bind->mountpoint; -+ mnt_path = service_mountpoint(mi->bind); - -- /* Access a mount by fd if mi->bind->mountpoint is overmounted */ -+ /* Access a mount by fd if service_mountpoint(mi->bind) is overmounted */ - if (mi->bind->fd >= 0) { - snprintf(mnt_fd_path, sizeof(mnt_fd_path), "/proc/self/fd/%d", mi->bind->fd); - mnt_path = mnt_fd_path; -@@ -2405,14 +2411,14 @@ static int do_bind_mount(struct mount_info *mi) - * The target path may be over-mounted by one of child mounts - * and we need to create a new bind-mount to get access to the path. - */ -- mp_len = strlen(mi->bind->mountpoint); -- if (mp_len > 1) /* skip a joining / if mi->bind->mountpoint isn't "/" */ -+ mp_len = strlen(service_mountpoint(mi->bind)); -+ if (mp_len > 1) /* skip a joining / if service_mountpoint(mi->bind) isn't "/" */ - mp_len++; - - list_for_each_entry(c, &mi->bind->children, siblings) { - if (!c->mounted) - continue; -- if (issubpath(cut_root, c->mountpoint + mp_len)) -+ if (issubpath(cut_root, service_mountpoint(c) + mp_len)) - break; /* a source path is overmounted */ - } - -@@ -2433,11 +2439,11 @@ skip_overmount_check: - snprintf(rpath, sizeof(rpath), "%s/%s", mnt_path, cut_root); - root = rpath; - do_bind: -- pr_info("\tBind %s to %s\n", root, mi->mountpoint); -+ pr_info("\tBind %s to %s\n", root, service_mountpoint(mi)); - - if (unlikely(mi->deleted)) { -- if (stat(mi->mountpoint, &st)) { -- pr_perror("Can't fetch stat on %s", mi->mountpoint); -+ if (stat(service_mountpoint(mi), &st)) { -+ pr_perror("Can't fetch stat on %s", service_mountpoint(mi)); - goto err; - } - -@@ -2459,15 +2465,15 @@ do_bind: - } - } - -- if (mount(root, mi->mountpoint, NULL, MS_BIND | (mi->flags & MS_REC), NULL) < 0) { -- pr_perror("Can't mount at %s", mi->mountpoint); -+ if (mount(root, service_mountpoint(mi), NULL, MS_BIND | (mi->flags & MS_REC), NULL) < 0) { -+ pr_perror("Can't mount at %s", service_mountpoint(mi)); - goto err; - } - - mflags = mi->flags & (~MS_PROPAGATE); - if (!mi->bind || mflags != (mi->bind->flags & (~MS_PROPAGATE))) -- if (mount(NULL, mi->mountpoint, NULL, MS_BIND | MS_REMOUNT | mflags, NULL)) { -- pr_perror("Can't mount at %s", mi->mountpoint); -+ if (mount(NULL, service_mountpoint(mi), NULL, MS_BIND | MS_REMOUNT | mflags, NULL)) { -+ pr_perror("Can't mount at %s", service_mountpoint(mi)); - goto err; - } - -@@ -2649,7 +2655,7 @@ static int do_mount_root(struct mount_info *mi) - if (restore_shared_options(mi, !mi->shared_id && !mi->master_id, mi->shared_id, mi->master_id)) - return -1; - -- return fetch_rt_stat(mi, mi->mountpoint); -+ return fetch_rt_stat(mi, service_mountpoint(mi)); - } - - static int do_close_one(struct mount_info *mi) -@@ -2660,7 +2666,7 @@ static int do_close_one(struct mount_info *mi) - - static int set_unbindable(struct mount_info *mi) - { -- if (mount(NULL, mi->mountpoint, NULL, MS_UNBINDABLE, NULL)) { -+ if (mount(NULL, service_mountpoint(mi), NULL, MS_UNBINDABLE, NULL)) { - pr_perror("Failed setting unbindable flag on %d", mi->mnt_id); - return -1; - } -@@ -2681,14 +2687,14 @@ static int do_mount_one(struct mount_info *mi) - } - - if ((mi->parent && mi->parent != root_yard_mp) && !strcmp(mi->parent->ns_mountpoint, mi->ns_mountpoint)) { -- mi->parent->fd = open(mi->parent->mountpoint, O_PATH); -+ mi->parent->fd = open(service_mountpoint(mi->parent), O_PATH); - if (mi->parent->fd < 0) { -- pr_perror("Unable to open %s", mi->mountpoint); -+ pr_perror("Unable to open %s", service_mountpoint(mi)); - return -1; - } - } - -- pr_debug("\tMounting %s @%s (%d)\n", mi->fstype->name, mi->mountpoint, mi->need_plugin); -+ pr_debug("\tMounting %s %d@%s (%d)\n", mi->fstype->name, mi->mnt_id, service_mountpoint(mi), mi->need_plugin); - - if (rst_mnt_is_root(mi)) { - int fd; -@@ -2701,21 +2707,22 @@ static int do_mount_one(struct mount_info *mi) - - /* do_mount_root() is called from populate_mnt_ns() */ - if (root_ns_mask & CLONE_NEWUSER) { -- fd = open(mi->mountpoint, O_PATH); -+ fd = open(service_mountpoint(mi), O_PATH); - if (fd < 0) { -- pr_perror("Unable to open %s", mi->mountpoint); -+ pr_perror("Unable to open %s", service_mountpoint(mi)); - return -1; - } - - if (userns_call(mount_root, 0, &flags, sizeof(flags), fd)) { -- pr_err("Unable to mount %s\n", mi->mountpoint); -+ pr_err("Unable to mount %s\n", service_mountpoint(mi)); - close(fd); - return -1; - } - close(fd); - } else { -- if (mount(opts.root, mi->mountpoint, NULL, flags, NULL)) { -- pr_perror("Unable to mount %s %s (id=%d)", opts.root, mi->mountpoint, mi->mnt_id); -+ if (mount(opts.root, service_mountpoint(mi), NULL, flags, NULL)) { -+ pr_perror("Unable to mount %s %s (id=%d)", opts.root, service_mountpoint(mi), -+ mi->mnt_id); - return -1; - } - } -@@ -2730,7 +2737,7 @@ static int do_mount_one(struct mount_info *mi) - ret = do_bind_mount(mi); - } - -- if (ret == 0 && fetch_rt_stat(mi, mi->mountpoint)) -+ if (ret == 0 && fetch_rt_stat(mi, service_mountpoint(mi))) - return -1; - - if (ret == 0 && propagate_mount(mi)) -@@ -2739,8 +2746,8 @@ static int do_mount_one(struct mount_info *mi) - if (mi->fstype->code == FSTYPE__UNSUPPORTED) { - struct statfs st; - -- if (statfs(mi->mountpoint, &st)) { -- pr_perror("Unable to statfs %s", mi->mountpoint); -+ if (statfs(service_mountpoint(mi), &st)) { -+ pr_perror("Unable to statfs %s", service_mountpoint(mi)); - return -1; - } - if (st.f_type == BTRFS_SUPER_MAGIC) -@@ -2755,17 +2762,17 @@ static int do_umount_one(struct mount_info *mi) - if (!mi->parent) - return 0; - -- if (mount("none", mi->parent->mountpoint, "none", MS_REC | MS_PRIVATE, NULL)) { -- pr_perror("Can't mark %s as private", mi->parent->mountpoint); -+ if (mount("none", service_mountpoint(mi->parent), "none", MS_REC | MS_PRIVATE, NULL)) { -+ pr_perror("Can't mark %s as private", service_mountpoint(mi->parent)); - return -1; - } - -- if (umount(mi->mountpoint)) { -- pr_perror("Can't umount at %s", mi->mountpoint); -+ if (umount(service_mountpoint(mi))) { -+ pr_perror("Can't umount at %s", service_mountpoint(mi)); - return -1; - } - -- pr_info("Umounted at %s\n", mi->mountpoint); -+ pr_info("Umounted at %s\n", service_mountpoint(mi)); - return 0; - } - -@@ -3113,7 +3120,7 @@ static int get_mp_mountpoint(char *mountpoint, struct mount_info *mi, char *root - - mi->ns_mountpoint = mi->mountpoint + root_len; - -- pr_debug("\t\tWill mount %d @ %s\n", mi->mnt_id, mi->mountpoint); -+ pr_debug("\t\tWill mount %d @ %s %s\n", mi->mnt_id, service_mountpoint(mi), mi->ns_mountpoint); - return 0; - } - -@@ -3469,14 +3476,14 @@ static int populate_roots_yard(struct mount_info *cr_time) - * contains mounts which has to be restored separately - */ - list_for_each_entry(r, &mnt_remap_list, node) { -- if (mkdirpat(AT_FDCWD, r->mi->mountpoint, 0755)) { -- pr_perror("Unable to create %s", r->mi->mountpoint); -+ if (mkdirpat(AT_FDCWD, service_mountpoint(r->mi), 0755)) { -+ pr_perror("Unable to create %s", service_mountpoint(r->mi)); - return -1; - } - } - -- if (cr_time && mkdirpat(AT_FDCWD, cr_time->mountpoint, 0755)) { -- pr_perror("Unable to create %s", cr_time->mountpoint); -+ if (cr_time && mkdirpat(AT_FDCWD, service_mountpoint(cr_time), 0755)) { -+ pr_perror("Unable to create %s", service_mountpoint(cr_time)); - return -1; - } - -@@ -4093,11 +4100,11 @@ int try_remount_writable(struct mount_info *mi, bool ns) - return -1; - } - -- pr_info("Remount %d:%s writable\n", mi->mnt_id, mi->mountpoint); -+ pr_info("Remount %d:%s writable\n", mi->mnt_id, service_mountpoint(mi)); - if (!ns) { -- if (mount(NULL, mi->mountpoint, NULL, -+ if (mount(NULL, service_mountpoint(mi), NULL, - MS_REMOUNT | MS_BIND | (mi->flags & ~(MS_PROPAGATE | MS_RDONLY)), NULL) == -1) { -- pr_perror("Failed to remount %d:%s writable", mi->mnt_id, mi->mountpoint); -+ pr_perror("Failed to remount %d:%s writable", mi->mnt_id, service_mountpoint(mi)); - return -1; - } - } else { -diff --git a/criu/proc_parse.c b/criu/proc_parse.c -index 0fbc440a2..338b42f4b 100644 ---- a/criu/proc_parse.c -+++ b/criu/proc_parse.c -@@ -1603,14 +1603,14 @@ struct mount_info *parse_mountinfo(pid_t pid, struct ns_id *nsid, bool for_dump) - if (new->fstype->parse) { - ret = new->fstype->parse(new); - if (ret < 0) { -- pr_err("Failed to parse FS specific data on %s\n", new->mountpoint); -+ pr_err("Failed to parse FS specific data on %s\n", service_mountpoint(new)); - mnt_entry_free(new); - new = NULL; - goto end; - } - - if (ret > 0) { -- pr_info("\tskipping fs mounted at %s\n", new->mountpoint + 1); -+ pr_info("\tskipping fs mounted at %s\n", service_mountpoint(new) + 1); - mnt_entry_free(new); - new = NULL; - ret = 0; -diff --git a/criu/tty.c b/criu/tty.c -index 1462193c5..0430dbff7 100644 ---- a/criu/tty.c -+++ b/criu/tty.c -@@ -2406,9 +2406,9 @@ int devpts_restore(struct mount_info *pm) - struct mount_info *bm; - int dfd, exit_code = -1; - -- dfd = open(pm->mountpoint, O_RDONLY); -+ dfd = open(service_mountpoint(pm), O_RDONLY); - if (dfd < 0) { -- pr_perror("Unable to open %s", pm->mountpoint); -+ pr_perror("Unable to open %s", service_mountpoint(pm)); - return -1; - } - --- -2.35.1 - diff --git a/0199-files-reg-split-create_ghost_dentry-out-of-create_gh.patch b/0199-files-reg-split-create_ghost_dentry-out-of-create_gh.patch deleted file mode 100644 index 07f8d91..0000000 --- a/0199-files-reg-split-create_ghost_dentry-out-of-create_gh.patch +++ /dev/null @@ -1,120 +0,0 @@ -From e0118aee0fdecd9c267c1f23df73ce909827f9bc Mon Sep 17 00:00:00 2001 -From: Stanislav Kinsburskiy -Date: Mon, 11 Jul 2016 14:14:15 +0300 -Subject: [PATCH 199/249] files-reg: split create_ghost_dentry out of - create_ghost - -Will use it to make create_ghost work with mount-v2. - -Signed-off-by: Stanislav Kinsburskiy -Signed-off-by: Cyrill Gorcunov -Signed-off-by: Pavel Tikhomirov - -Cherry-picked from Virtuozzo criu: -https://src.openvz.org/projects/OVZ/repos/criu/commits/156fa4877 -Cherry-picked from Virtuozzo criu: -https://src.openvz.org/projects/OVZ/repos/criu/commits/069bba0ad - -Changes: merge fixup. - -Signed-off-by: Pavel Tikhomirov ---- - criu/files-reg.c | 68 +++++++++++++++++++++++++++--------------------- - 1 file changed, 39 insertions(+), 29 deletions(-) - -diff --git a/criu/files-reg.c b/criu/files-reg.c -index 141843a7a..309ecf77c 100644 ---- a/criu/files-reg.c -+++ b/criu/files-reg.c -@@ -355,32 +355,11 @@ err: - return ret; - } - --static int create_ghost(struct ghost_file *gf, GhostFileEntry *gfe, struct cr_img *img) -+static int create_ghost_dentry(char *path, GhostFileEntry *gfe, struct cr_img *img) - { -- struct mount_info *mi; -- char path[PATH_MAX]; -- int ret, root_len; -+ int ret = -1; - char *msg; - -- root_len = ret = rst_get_mnt_root(gf->remap.rmnt_id, path, sizeof(path)); -- if (ret < 0) { -- pr_err("The %d mount is not found for ghost\n", gf->remap.rmnt_id); -- goto err; -- } -- -- /* Add a '/' only if we have no at the end */ -- if (path[root_len - 1] != '/') { -- path[root_len++] = '/'; -- path[root_len] = '\0'; -- } -- -- snprintf(path + root_len, sizeof(path) - root_len, "%s", gf->remap.rpath); -- ret = -1; -- -- mi = lookup_mnt_id(gf->remap.rmnt_id); -- /* We get here while in service mntns */ -- if (mi && try_remount_writable(mi, false)) -- goto err; - again: - if (S_ISFIFO(gfe->mode)) { - if ((ret = mknod(path, gfe->mode, 0)) < 0) -@@ -417,16 +396,47 @@ again: - goto err; - } - -- strcpy(gf->remap.rpath, path + root_len); -- pr_debug("Remap rpath is %s\n", gf->remap.rpath); -+ ret = 0; -+err: -+ return ret; -+} -+ -+static int create_ghost(struct ghost_file *gf, GhostFileEntry *gfe, struct cr_img *img) -+{ -+ struct mount_info *mi; -+ char path[PATH_MAX]; -+ int ret, root_len; -+ -+ root_len = ret = rst_get_mnt_root(gf->remap.rmnt_id, path, sizeof(path)); -+ if (ret < 0) { -+ pr_err("The %d mount is not found for ghost\n", gf->remap.rmnt_id); -+ return -1; -+ } - -+ /* Add a '/' only if we have no at the end */ -+ if (path[root_len - 1] != '/') { -+ path[root_len++] = '/'; -+ path[root_len] = '\0'; -+ } -+ -+ snprintf(path + root_len, sizeof(path) - root_len, "%s", gf->remap.rpath); - ret = -1; -+ -+ mi = lookup_mnt_id(gf->remap.rmnt_id); -+ /* We get here while in service mntns */ -+ if (mi && try_remount_writable(mi, false)) -+ return -1; -+ -+ ret = create_ghost_dentry(path, gfe, img); -+ if (ret) -+ return -1; -+ - if (ghost_apply_metadata(path, gfe)) -- goto err; -+ return -1; - -- ret = 0; --err: -- return ret; -+ strcpy(gf->remap.rpath, path + root_len); -+ pr_debug("Remap rpath is %s\n", gf->remap.rpath); -+ return 0; - } - - static inline void ghost_path(char *path, int plen, struct reg_file_info *rfi, RemapFilePathEntry *rpe) --- -2.35.1 - diff --git a/0200-files-reg-teach-create_ghost-to-work-with-mount-v2.patch b/0200-files-reg-teach-create_ghost-to-work-with-mount-v2.patch deleted file mode 100644 index 01b92ab..0000000 --- a/0200-files-reg-teach-create_ghost-to-work-with-mount-v2.patch +++ /dev/null @@ -1,129 +0,0 @@ -From 45a06d6b9b34f0484ca3dad560e53914db05fff6 Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Thu, 14 May 2020 14:11:47 +0300 -Subject: [PATCH 200/249] files-reg: teach create_ghost to work with mount-v2 - -While mounts-v2 would mount all mounts plain without tree in service -mntns we can't just use path relative to mntns to find remap. Make it -mount related, it is also compatible with current mount engine. - -Also handle no-mntns case separately in nomntns_create_ghost. - -Cherry-picked from Virtuozzo criu: -https://src.openvz.org/projects/OVZ/repos/criu/commits/9cdf0b3e4 - -Changes: make gf->remap.rpath always relative else we get: -Error (criu/files-reg.c:779): Couldn't unlink remap -/tmp/.criu.mntns.BCurDL/13-0000000000 /zdtm/static/cwd02.test: -No such file or directory - -Signed-off-by: Pavel Tikhomirov ---- - criu/files-reg.c | 65 +++++++++++++++++++++++++++++++++++++----------- - 1 file changed, 50 insertions(+), 15 deletions(-) - -diff --git a/criu/files-reg.c b/criu/files-reg.c -index 309ecf77c..66e2c2c39 100644 ---- a/criu/files-reg.c -+++ b/criu/files-reg.c -@@ -53,6 +53,7 @@ - - #include "files-reg.h" - #include "plugin.h" -+#include "string.h" - - int setfsuid(uid_t fsuid); - int setfsgid(gid_t fsuid); -@@ -401,40 +402,74 @@ err: - return ret; - } - -+static int nomntns_create_ghost(struct ghost_file *gf, GhostFileEntry *gfe, struct cr_img *img) -+{ -+ char path[PATH_MAX]; -+ -+ snprintf(path, sizeof(path), "/%s", gf->remap.rpath); -+ -+ if (create_ghost_dentry(path, gfe, img)) -+ return -1; -+ -+ if (ghost_apply_metadata(path, gfe)) -+ return -1; -+ -+ strlcpy(gf->remap.rpath, path + 1, PATH_MAX); -+ pr_debug("Remap rpath is %s\n", gf->remap.rpath); -+ return 0; -+} -+ - static int create_ghost(struct ghost_file *gf, GhostFileEntry *gfe, struct cr_img *img) - { - struct mount_info *mi; -- char path[PATH_MAX]; -- int ret, root_len; -+ char path[PATH_MAX], *rel_path, *rel_mp; - -- root_len = ret = rst_get_mnt_root(gf->remap.rmnt_id, path, sizeof(path)); -- if (ret < 0) { -+ if (!(root_ns_mask & CLONE_NEWNS)) -+ return nomntns_create_ghost(gf, gfe, img); -+ -+ mi = lookup_mnt_id(gf->remap.rmnt_id); -+ if (!mi) { - pr_err("The %d mount is not found for ghost\n", gf->remap.rmnt_id); - return -1; - } - -- /* Add a '/' only if we have no at the end */ -- if (path[root_len - 1] != '/') { -- path[root_len++] = '/'; -- path[root_len] = '\0'; -+ /* Get path relative to mountpoint from path relative to mntns */ -+ rel_path = get_relative_path(gf->remap.rpath, mi->ns_mountpoint); -+ if (!rel_path) { -+ pr_err("Can't get path %s relative to %s\n", gf->remap.rpath, mi->ns_mountpoint); -+ return -1; - } - -- snprintf(path + root_len, sizeof(path) - root_len, "%s", gf->remap.rpath); -- ret = -1; -+ snprintf(path, sizeof(path), "%s%s%s", service_mountpoint(mi), rel_path[0] ? "/" : "", rel_path); -+ pr_debug("Trying to create ghost on path %s\n", path); - -- mi = lookup_mnt_id(gf->remap.rmnt_id); - /* We get here while in service mntns */ -- if (mi && try_remount_writable(mi, false)) -+ if (try_remount_writable(mi, false)) - return -1; - -- ret = create_ghost_dentry(path, gfe, img); -- if (ret) -+ if (create_ghost_dentry(path, gfe, img)) - return -1; - - if (ghost_apply_metadata(path, gfe)) - return -1; - -- strcpy(gf->remap.rpath, path + root_len); -+ /* -+ * Convert the path back to mntns relative, as create_ghost_dentry -+ * might have changed it. -+ */ -+ rel_path = get_relative_path(path, service_mountpoint(mi)); -+ if (!rel_path) { -+ pr_err("Can't get path %s relative to %s\n", path, service_mountpoint(mi)); -+ return -1; -+ } -+ -+ rel_mp = get_relative_path(mi->ns_mountpoint, "/"); -+ if (!rel_mp) { -+ pr_err("Can't get path %s relative to %s\n", mi->ns_mountpoint, "/"); -+ return -1; -+ } -+ -+ snprintf(gf->remap.rpath, PATH_MAX, "%s%s%s", rel_mp, (rel_mp[0] && rel_path[0]) ? "/" : "", rel_path); - pr_debug("Remap rpath is %s\n", gf->remap.rpath); - return 0; - } --- -2.35.1 - diff --git a/0201-files-reg-teach-clean_one_remap-to-work-with-mount-v.patch b/0201-files-reg-teach-clean_one_remap-to-work-with-mount-v.patch deleted file mode 100644 index 600b589..0000000 --- a/0201-files-reg-teach-clean_one_remap-to-work-with-mount-v.patch +++ /dev/null @@ -1,101 +0,0 @@ -From bfe17cdd6fda1519870eb89c231d4965f276dc4e Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Thu, 14 May 2020 16:36:57 +0300 -Subject: [PATCH 201/249] files-reg: teach clean_one_remap to work with - mount-v2 - -While mounts-v2 mounts all mounts plain without tree in service mntns we can't -just use path relative to mntns to find remap. Make it mount related, it is -also compatible with mounts-v1. - -Also we don't need openat and unlinkat here as we've opened rmntns_root -just before that, lets switch to "non-at" variants. - -Cherry-picked from Virtuozzo criu: -https://src.openvz.org/projects/OVZ/repos/criu/commits/dc9ac0c80 - -Changes: rework to skip vz-specific hunks. - -Signed-off-by: Pavel Tikhomirov ---- - criu/files-reg.c | 46 ++++++++++++++++++++++++++-------------------- - 1 file changed, 26 insertions(+), 20 deletions(-) - -diff --git a/criu/files-reg.c b/criu/files-reg.c -index 66e2c2c39..636853ac8 100644 ---- a/criu/files-reg.c -+++ b/criu/files-reg.c -@@ -748,44 +748,50 @@ int prepare_remaps(void) - static int clean_one_remap(struct remap_info *ri) - { - struct file_remap *remap = ri->rfi->remap; -- int mnt_id, ret, rmntns_root; -+ int mnt_id, ret; - struct mount_info *mi; -- char path[PATH_MAX]; -+ char path[PATH_MAX], *rel_path; - - if (remap->rpath[0] == 0) - return 0; - -+ if (!(root_ns_mask & CLONE_NEWNS)) { -+ snprintf(path, sizeof(path), "/%s", remap->rpath); -+ goto nomntns; -+ } -+ - mnt_id = ri->rfi->rfe->mnt_id; /* rirfirfe %) */ -- ret = rst_get_mnt_root(mnt_id, path, sizeof(path)); -- if (ret < 0) -- return -1; -- if (ret >= sizeof(path) - 1) { -- pr_err("The path buffer is too small\n"); -+ mi = lookup_mnt_id(mnt_id); -+ if (!mi) { -+ pr_err("The %d mount is not found for ghost\n", mnt_id); - return -1; - } - -- rmntns_root = open(path, O_RDONLY); -- if (rmntns_root < 0) { -- pr_perror("Unable to open %s", path); -+ rel_path = get_relative_path(remap->rpath, mi->ns_mountpoint); -+ if (!rel_path) { -+ pr_err("Can't get path %s relative to %s\n", remap->rpath, mi->ns_mountpoint); - return -1; - } - -- mi = lookup_mnt_id(mnt_id); -+ snprintf(path, sizeof(path), "%s%s%s", service_mountpoint(mi), strlen(rel_path) ? "/" : "", rel_path); -+ - /* We get here while in service mntns */ -- if (mi && try_remount_writable(mi, false)) { -- close(rmntns_root); -+ if (try_remount_writable(mi, false)) - return -1; -- } - -- pr_info("Unlink remap %s\n", remap->rpath); -+nomntns: -+ pr_info("Unlink remap %s\n", path); - -- ret = unlinkat(rmntns_root, remap->rpath, remap->is_dir ? AT_REMOVEDIR : 0); -- if (ret < 0) { -- close(rmntns_root); -- pr_perror("Couldn't unlink remap %s %s", path, remap->rpath); -+ if (remap->is_dir) -+ ret = rmdir(path); -+ else -+ ret = unlink(path); -+ -+ if (ret) { -+ pr_perror("Couldn't unlink remap %s", path); - return -1; - } -- close(rmntns_root); -+ - remap->rpath[0] = 0; - - return 0; --- -2.35.1 - diff --git a/0202-kerndat-Check-for-MOVE_MOUNT_SET_GROUP-availability.patch b/0202-kerndat-Check-for-MOVE_MOUNT_SET_GROUP-availability.patch deleted file mode 100644 index ab8c038..0000000 --- a/0202-kerndat-Check-for-MOVE_MOUNT_SET_GROUP-availability.patch +++ /dev/null @@ -1,285 +0,0 @@ -From 32a5f0844aa34d3d1ea463f634098b6acc64b56b Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Thu, 25 Mar 2021 13:37:55 +0300 -Subject: [PATCH 202/249] kerndat: Check for MOVE_MOUNT_SET_GROUP availability - -Mounts-v2 requires new kernel feature MOVE_MOUNT_SET_GROUP to be able to -restore propagation between mounts right. - -Cherry-picked from Virtuozzo criu: -https://src.openvz.org/projects/OVZ/repos/criu/commits/7da7f9a17 - -Changes: define move_mount syscall, check mainstream kernel -MOVE_MOUNT_SET_GROUP feature, use our "linux/mount.h" to overcome -possible problems of non-existing header on older kernels. - -v3: coverity CID 389201: check ret of umount2 and rmdir at cleanup stage - -Signed-off-by: Pavel Tikhomirov ---- - .../arch/arm/plugins/std/syscalls/syscall.def | 1 + - .../mips/plugins/std/syscalls/syscall_64.tbl | 1 + - .../plugins/std/syscalls/syscall-ppc64.tbl | 1 + - .../plugins/std/syscalls/syscall-s390.tbl | 1 + - .../x86/plugins/std/syscalls/syscall_32.tbl | 1 + - .../x86/plugins/std/syscalls/syscall_64.tbl | 1 + - criu/cr-check.c | 10 +++ - criu/include/kerndat.h | 1 + - criu/include/mount-v2.h | 24 +++++++ - criu/kerndat.c | 69 +++++++++++++++++++ - 10 files changed, 110 insertions(+) - create mode 100644 criu/include/mount-v2.h - -diff --git a/compel/arch/arm/plugins/std/syscalls/syscall.def b/compel/arch/arm/plugins/std/syscalls/syscall.def -index e6508ed9f..6b9cd8b8e 100644 ---- a/compel/arch/arm/plugins/std/syscalls/syscall.def -+++ b/compel/arch/arm/plugins/std/syscalls/syscall.def -@@ -112,6 +112,7 @@ userfaultfd 282 388 (int flags) - fallocate 47 352 (int fd, int mode, loff_t offset, loff_t len) - cacheflush ! 983042 (void *start, void *end, int flags) - ppoll 73 336 (struct pollfd *fds, unsigned int nfds, const struct timespec *tmo, const sigset_t *sigmask, size_t sigsetsize) -+move_mount 429 429 (int from_dfd, const char *from_pathname, int to_dfd, const char *to_pathname, int flags) - fsopen 430 430 (char *fsname, unsigned int flags) - fsconfig 431 431 (int fd, unsigned int cmd, const char *key, const char *value, int aux) - fsmount 432 432 (int fd, unsigned int flags, unsigned int attr_flags) -diff --git a/compel/arch/mips/plugins/std/syscalls/syscall_64.tbl b/compel/arch/mips/plugins/std/syscalls/syscall_64.tbl -index 7a6db192c..430df1824 100644 ---- a/compel/arch/mips/plugins/std/syscalls/syscall_64.tbl -+++ b/compel/arch/mips/plugins/std/syscalls/syscall_64.tbl -@@ -109,6 +109,7 @@ __NR_memfd_create 5314 sys_memfd_create (const char *name, unsigned int flags) - __NR_userfaultfd 5317 sys_userfaultfd (int flags) - - ##TODO for kernel -+__NR_move_mount 5429 sys_move_mount (int from_dfd, const char *from_pathname, int to_dfd, const char *to_pathname, int flags) - __NR_fsopen 5430 sys_fsopen (char *fsname, unsigned int flags) - __NR_fsconfig 5431 sys_fsconfig (int fd, unsigned int cmd, const char *key, const char *value, int aux) - __NR_fsmount 5432 sys_fsmount (int fd, unsigned int flags, unsigned int attr_flags) -diff --git a/compel/arch/ppc64/plugins/std/syscalls/syscall-ppc64.tbl b/compel/arch/ppc64/plugins/std/syscalls/syscall-ppc64.tbl -index 1bb626bc5..138eec2af 100644 ---- a/compel/arch/ppc64/plugins/std/syscalls/syscall-ppc64.tbl -+++ b/compel/arch/ppc64/plugins/std/syscalls/syscall-ppc64.tbl -@@ -108,6 +108,7 @@ __NR_gettimeofday 78 sys_gettimeofday (struct timeval *tv, struct timezone *tz) - __NR_preadv 320 sys_preadv_raw (int fd, struct iovec *iov, unsigned long nr, unsigned long pos_l, unsigned long pos_h) - __NR_userfaultfd 364 sys_userfaultfd (int flags) - __NR_ppoll 281 sys_ppoll (struct pollfd *fds, unsigned int nfds, const struct timespec *tmo, const sigset_t *sigmask, size_t sigsetsize) -+__NR_move_mount 429 sys_move_mount (int from_dfd, const char *from_pathname, int to_dfd, const char *to_pathname, int flags) - __NR_fsopen 430 sys_fsopen (char *fsname, unsigned int flags) - __NR_fsconfig 431 sys_fsconfig (int fd, unsigned int cmd, const char *key, const char *value, int aux) - __NR_fsmount 432 sys_fsmount (int fd, unsigned int flags, unsigned int attr_flags) -diff --git a/compel/arch/s390/plugins/std/syscalls/syscall-s390.tbl b/compel/arch/s390/plugins/std/syscalls/syscall-s390.tbl -index 7178bf483..ae54afa17 100644 ---- a/compel/arch/s390/plugins/std/syscalls/syscall-s390.tbl -+++ b/compel/arch/s390/plugins/std/syscalls/syscall-s390.tbl -@@ -108,6 +108,7 @@ __NR_userfaultfd 355 sys_userfaultfd (int flags) - __NR_preadv 328 sys_preadv_raw (int fd, struct iovec *iov, unsigned long nr, unsigned long pos_l, unsigned long pos_h) - __NR_gettimeofday 78 sys_gettimeofday (struct timeval *tv, struct timezone *tz) - __NR_ppoll 302 sys_ppoll (struct pollfd *fds, unsigned int nfds, const struct timespec *tmo, const sigset_t *sigmask, size_t sigsetsize) -+__NR_move_mount 429 sys_move_mount (int from_dfd, const char *from_pathname, int to_dfd, const char *to_pathname, int flags) - __NR_fsopen 430 sys_fsopen (char *fsname, unsigned int flags) - __NR_fsconfig 431 sys_fsconfig (int fd, unsigned int cmd, const char *key, const char *value, int aux) - __NR_fsmount 432 sys_fsmount (int fd, unsigned int flags, unsigned int attr_flags) -diff --git a/compel/arch/x86/plugins/std/syscalls/syscall_32.tbl b/compel/arch/x86/plugins/std/syscalls/syscall_32.tbl -index 7e456cdb7..e4133f8f9 100644 ---- a/compel/arch/x86/plugins/std/syscalls/syscall_32.tbl -+++ b/compel/arch/x86/plugins/std/syscalls/syscall_32.tbl -@@ -96,6 +96,7 @@ __NR_seccomp 354 sys_seccomp (unsigned int op, unsigned int flags, const char - __NR_memfd_create 356 sys_memfd_create (const char *name, unsigned int flags) - __NR_userfaultfd 374 sys_userfaultfd (int flags) - __NR_ppoll 309 sys_ppoll (struct pollfd *fds, unsigned int nfds, const struct timespec *tmo, const sigset_t *sigmask, size_t sigsetsize) -+__NR_move_mount 429 sys_move_mount (int from_dfd, const char *from_pathname, int to_dfd, const char *to_pathname, int flags) - __NR_fsopen 430 sys_fsopen (char *fsname, unsigned int flags) - __NR_fsconfig 431 sys_fsconfig (int fd, unsigned int cmd, const char *key, const char *value, int aux) - __NR_fsmount 432 sys_fsmount (int fd, unsigned int flags, unsigned int attr_flags) -diff --git a/compel/arch/x86/plugins/std/syscalls/syscall_64.tbl b/compel/arch/x86/plugins/std/syscalls/syscall_64.tbl -index 2dfcc6eee..4c9461473 100644 ---- a/compel/arch/x86/plugins/std/syscalls/syscall_64.tbl -+++ b/compel/arch/x86/plugins/std/syscalls/syscall_64.tbl -@@ -107,6 +107,7 @@ __NR_kcmp 312 sys_kcmp (pid_t pid1, pid_t pid2, int type, unsigned long idx1 - __NR_memfd_create 319 sys_memfd_create (const char *name, unsigned int flags) - __NR_userfaultfd 323 sys_userfaultfd (int flags) - __NR_ppoll 271 sys_ppoll (struct pollfd *fds, unsigned int nfds, const struct timespec *tmo, const sigset_t *sigmask, size_t sigsetsize) -+__NR_move_mount 429 sys_move_mount (int from_dfd, const char *from_pathname, int to_dfd, const char *to_pathname, int flags) - __NR_fsopen 430 sys_fsopen (char *fsname, unsigned int flags) - __NR_fsconfig 431 sys_fsconfig (int fd, unsigned int cmd, const char *key, const char *value, int aux) - __NR_fsmount 432 sys_fsmount (int fd, unsigned int flags, unsigned int attr_flags) -diff --git a/criu/cr-check.c b/criu/cr-check.c -index ced084df2..10d433650 100644 ---- a/criu/cr-check.c -+++ b/criu/cr-check.c -@@ -1394,6 +1394,14 @@ static int check_sockopt_buf_lock(void) - return 0; - } - -+static int check_move_mount_set_group(void) -+{ -+ if (!kdat.has_move_mount_set_group) -+ return -1; -+ -+ return 0; -+} -+ - static int (*chk_feature)(void); - - /* -@@ -1514,6 +1522,7 @@ int cr_check(void) - ret |= check_network_lock_nftables(); - ret |= check_sockopt_buf_lock(); - ret |= check_memfd_hugetlb(); -+ ret |= check_move_mount_set_group(); - } - - /* -@@ -1628,6 +1637,7 @@ static struct feature_list feature_list[] = { - { "network_lock_nftables", check_network_lock_nftables }, - { "sockopt_buf_lock", check_sockopt_buf_lock }, - { "memfd_hugetlb", check_memfd_hugetlb }, -+ { "move_mount_set_group", check_move_mount_set_group }, - { NULL, NULL }, - }; - -diff --git a/criu/include/kerndat.h b/criu/include/kerndat.h -index 25825ee51..f6e3b6133 100644 ---- a/criu/include/kerndat.h -+++ b/criu/include/kerndat.h -@@ -78,6 +78,7 @@ struct kerndat_s { - bool has_nftables_concat; - bool has_sockopt_buf_lock; - dev_t hugetlb_dev[HUGETLB_MAX]; -+ bool has_move_mount_set_group; - }; - - extern struct kerndat_s kdat; -diff --git a/criu/include/mount-v2.h b/criu/include/mount-v2.h -new file mode 100644 -index 000000000..8a4e46b1a ---- /dev/null -+++ b/criu/include/mount-v2.h -@@ -0,0 +1,24 @@ -+#ifndef __CR_MOUNT_V2_H__ -+#define __CR_MOUNT_V2_H__ -+ -+#include "linux/mount.h" -+ -+#include -+ -+#ifndef MOVE_MOUNT_SET_GROUP -+#define MOVE_MOUNT_SET_GROUP 0x00000100 /* Set sharing group instead */ -+#endif -+#ifndef MOVE_MOUNT_F_EMPTY_PATH -+#define MOVE_MOUNT_F_EMPTY_PATH 0x00000004 /* Empty from path permitted */ -+#endif -+#ifndef MOVE_MOUNT_T_EMPTY_PATH -+#define MOVE_MOUNT_T_EMPTY_PATH 0x00000040 /* Empty to path permitted */ -+#endif -+ -+static inline int sys_move_mount(int from_dirfd, const char *from_pathname, int to_dirfd, const char *to_pathname, -+ unsigned int flags) -+{ -+ return syscall(__NR_move_mount, from_dirfd, from_pathname, to_dirfd, to_pathname, flags); -+} -+ -+#endif /* __CR_MOUNT_V2_H__ */ -diff --git a/criu/kerndat.c b/criu/kerndat.c -index da1fb5511..5e49fc116 100644 ---- a/criu/kerndat.c -+++ b/criu/kerndat.c -@@ -14,6 +14,7 @@ - #include - #include - #include -+#include - - #if defined(CONFIG_HAS_NFTABLES_LIB_API_0) || defined(CONFIG_HAS_NFTABLES_LIB_API_1) - #include -@@ -46,6 +47,7 @@ - #include "kcmp.h" - #include "sched.h" - #include "memfd.h" -+#include "mount-v2.h" - - struct kerndat_s kdat = {}; - -@@ -932,6 +934,69 @@ err: - return exit_code; - } - -+static int kerndat_has_move_mount_set_group(void) -+{ -+ char tmpdir[] = "/tmp/.criu.move_mount_set_group.XXXXXX"; -+ char subdir[64]; -+ int exit_code = -1; -+ -+ if (mkdtemp(tmpdir) == NULL) { -+ pr_perror("Fail to make dir %s", tmpdir); -+ return -1; -+ } -+ -+ if (mount("criu.move_mount_set_group", tmpdir, "tmpfs", 0, NULL)) { -+ pr_perror("Fail to mount tmfps to %s", tmpdir); -+ rmdir(tmpdir); -+ return -1; -+ } -+ -+ if (mount(NULL, tmpdir, NULL, MS_PRIVATE, NULL)) { -+ pr_perror("Fail to make %s private", tmpdir); -+ goto out; -+ } -+ -+ if (snprintf(subdir, sizeof(subdir), "%s/subdir", tmpdir) >= sizeof(subdir)) { -+ pr_err("Fail to snprintf subdir\n"); -+ goto out; -+ } -+ -+ if (mkdir(subdir, 0700)) { -+ pr_perror("Fail to make dir %s", subdir); -+ goto out; -+ } -+ -+ if (mount(subdir, subdir, NULL, MS_BIND, NULL)) { -+ pr_perror("Fail to make bind-mount %s", subdir); -+ goto out; -+ } -+ -+ if (mount(NULL, tmpdir, NULL, MS_SHARED, NULL)) { -+ pr_perror("Fail to make %s private", tmpdir); -+ goto out; -+ } -+ -+ if (sys_move_mount(AT_FDCWD, tmpdir, AT_FDCWD, subdir, MOVE_MOUNT_SET_GROUP)) { -+ if (errno == EINVAL || errno == ENOSYS) { -+ pr_debug("No MOVE_MOUNT_SET_GROUP kernel feature\n"); -+ kdat.has_move_mount_set_group = false; -+ exit_code = 0; -+ goto out; -+ } -+ pr_perror("Fail to MOVE_MOUNT_SET_GROUP"); -+ goto out; -+ } -+ -+ kdat.has_move_mount_set_group = true; -+ exit_code = 0; -+out: -+ if (umount2(tmpdir, MNT_DETACH)) -+ pr_warn("Fail to umount2 %s: %m\n", tmpdir); -+ if (rmdir(tmpdir)) -+ pr_warn("Fail to rmdir %s: %m\n", tmpdir); -+ return exit_code; -+} -+ - #define KERNDAT_CACHE_FILE KDAT_RUNDIR "/criu.kdat" - #define KERNDAT_CACHE_FILE_TMP KDAT_RUNDIR "/.criu.kdat" - -@@ -1517,6 +1582,10 @@ int kerndat_init(void) - pr_err("kerndat_sockopt_buf_lock failed when initializing kerndat.\n"); - ret = -1; - } -+ if (!ret && kerndat_has_move_mount_set_group()) { -+ pr_err("kerndat_has_move_mount_set_group failed when initializing kerndat.\n"); -+ ret = -1; -+ } - - kerndat_lsm(); - kerndat_mmap_min_addr(); --- -2.35.1 - diff --git a/0203-compel-add-open_tree-syscall.patch b/0203-compel-add-open_tree-syscall.patch deleted file mode 100644 index 21afacf..0000000 --- a/0203-compel-add-open_tree-syscall.patch +++ /dev/null @@ -1,129 +0,0 @@ -From 86215f7cd94cb9d8705527cddebcbb2c13d0588d Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Fri, 24 Dec 2021 13:23:29 +0300 -Subject: [PATCH 203/249] compel: add open_tree syscall - -Will use this for cross mount namespace bindmounts. - -Note: don't need separate kdat for mount-v2, as MOVE_MOUNT_SET_GROUP -were added much later than open_tree and all related fixups. - -Signed-off-by: Pavel Tikhomirov ---- - .../arch/arm/plugins/std/syscalls/syscall.def | 1 + - .../mips/plugins/std/syscalls/syscall_64.tbl | 1 + - .../plugins/std/syscalls/syscall-ppc64.tbl | 1 + - .../plugins/std/syscalls/syscall-s390.tbl | 1 + - .../x86/plugins/std/syscalls/syscall_32.tbl | 1 + - .../x86/plugins/std/syscalls/syscall_64.tbl | 1 + - criu/include/mount-v2.h | 24 +++++++++++++++++++ - 7 files changed, 30 insertions(+) - -diff --git a/compel/arch/arm/plugins/std/syscalls/syscall.def b/compel/arch/arm/plugins/std/syscalls/syscall.def -index 6b9cd8b8e..a422b4905 100644 ---- a/compel/arch/arm/plugins/std/syscalls/syscall.def -+++ b/compel/arch/arm/plugins/std/syscalls/syscall.def -@@ -112,6 +112,7 @@ userfaultfd 282 388 (int flags) - fallocate 47 352 (int fd, int mode, loff_t offset, loff_t len) - cacheflush ! 983042 (void *start, void *end, int flags) - ppoll 73 336 (struct pollfd *fds, unsigned int nfds, const struct timespec *tmo, const sigset_t *sigmask, size_t sigsetsize) -+open_tree 428 428 (int dirfd, const char *pathname, unsigned int flags) - move_mount 429 429 (int from_dfd, const char *from_pathname, int to_dfd, const char *to_pathname, int flags) - fsopen 430 430 (char *fsname, unsigned int flags) - fsconfig 431 431 (int fd, unsigned int cmd, const char *key, const char *value, int aux) -diff --git a/compel/arch/mips/plugins/std/syscalls/syscall_64.tbl b/compel/arch/mips/plugins/std/syscalls/syscall_64.tbl -index 430df1824..745782285 100644 ---- a/compel/arch/mips/plugins/std/syscalls/syscall_64.tbl -+++ b/compel/arch/mips/plugins/std/syscalls/syscall_64.tbl -@@ -109,6 +109,7 @@ __NR_memfd_create 5314 sys_memfd_create (const char *name, unsigned int flags) - __NR_userfaultfd 5317 sys_userfaultfd (int flags) - - ##TODO for kernel -+__NR_open_tree 5428 sys_open_tree (int dirfd, const char *pathname, unsigned int flags) - __NR_move_mount 5429 sys_move_mount (int from_dfd, const char *from_pathname, int to_dfd, const char *to_pathname, int flags) - __NR_fsopen 5430 sys_fsopen (char *fsname, unsigned int flags) - __NR_fsconfig 5431 sys_fsconfig (int fd, unsigned int cmd, const char *key, const char *value, int aux) -diff --git a/compel/arch/ppc64/plugins/std/syscalls/syscall-ppc64.tbl b/compel/arch/ppc64/plugins/std/syscalls/syscall-ppc64.tbl -index 138eec2af..0eceebe22 100644 ---- a/compel/arch/ppc64/plugins/std/syscalls/syscall-ppc64.tbl -+++ b/compel/arch/ppc64/plugins/std/syscalls/syscall-ppc64.tbl -@@ -108,6 +108,7 @@ __NR_gettimeofday 78 sys_gettimeofday (struct timeval *tv, struct timezone *tz) - __NR_preadv 320 sys_preadv_raw (int fd, struct iovec *iov, unsigned long nr, unsigned long pos_l, unsigned long pos_h) - __NR_userfaultfd 364 sys_userfaultfd (int flags) - __NR_ppoll 281 sys_ppoll (struct pollfd *fds, unsigned int nfds, const struct timespec *tmo, const sigset_t *sigmask, size_t sigsetsize) -+__NR_open_tree 428 sys_open_tree (int dirfd, const char *pathname, unsigned int flags) - __NR_move_mount 429 sys_move_mount (int from_dfd, const char *from_pathname, int to_dfd, const char *to_pathname, int flags) - __NR_fsopen 430 sys_fsopen (char *fsname, unsigned int flags) - __NR_fsconfig 431 sys_fsconfig (int fd, unsigned int cmd, const char *key, const char *value, int aux) -diff --git a/compel/arch/s390/plugins/std/syscalls/syscall-s390.tbl b/compel/arch/s390/plugins/std/syscalls/syscall-s390.tbl -index ae54afa17..93a8f34d3 100644 ---- a/compel/arch/s390/plugins/std/syscalls/syscall-s390.tbl -+++ b/compel/arch/s390/plugins/std/syscalls/syscall-s390.tbl -@@ -108,6 +108,7 @@ __NR_userfaultfd 355 sys_userfaultfd (int flags) - __NR_preadv 328 sys_preadv_raw (int fd, struct iovec *iov, unsigned long nr, unsigned long pos_l, unsigned long pos_h) - __NR_gettimeofday 78 sys_gettimeofday (struct timeval *tv, struct timezone *tz) - __NR_ppoll 302 sys_ppoll (struct pollfd *fds, unsigned int nfds, const struct timespec *tmo, const sigset_t *sigmask, size_t sigsetsize) -+__NR_open_tree 428 sys_open_tree (int dirfd, const char *pathname, unsigned int flags) - __NR_move_mount 429 sys_move_mount (int from_dfd, const char *from_pathname, int to_dfd, const char *to_pathname, int flags) - __NR_fsopen 430 sys_fsopen (char *fsname, unsigned int flags) - __NR_fsconfig 431 sys_fsconfig (int fd, unsigned int cmd, const char *key, const char *value, int aux) -diff --git a/compel/arch/x86/plugins/std/syscalls/syscall_32.tbl b/compel/arch/x86/plugins/std/syscalls/syscall_32.tbl -index e4133f8f9..14d2e0581 100644 ---- a/compel/arch/x86/plugins/std/syscalls/syscall_32.tbl -+++ b/compel/arch/x86/plugins/std/syscalls/syscall_32.tbl -@@ -96,6 +96,7 @@ __NR_seccomp 354 sys_seccomp (unsigned int op, unsigned int flags, const char - __NR_memfd_create 356 sys_memfd_create (const char *name, unsigned int flags) - __NR_userfaultfd 374 sys_userfaultfd (int flags) - __NR_ppoll 309 sys_ppoll (struct pollfd *fds, unsigned int nfds, const struct timespec *tmo, const sigset_t *sigmask, size_t sigsetsize) -+__NR_open_tree 428 sys_open_tree (int dirfd, const char *pathname, unsigned int flags) - __NR_move_mount 429 sys_move_mount (int from_dfd, const char *from_pathname, int to_dfd, const char *to_pathname, int flags) - __NR_fsopen 430 sys_fsopen (char *fsname, unsigned int flags) - __NR_fsconfig 431 sys_fsconfig (int fd, unsigned int cmd, const char *key, const char *value, int aux) -diff --git a/compel/arch/x86/plugins/std/syscalls/syscall_64.tbl b/compel/arch/x86/plugins/std/syscalls/syscall_64.tbl -index 4c9461473..2f690f48f 100644 ---- a/compel/arch/x86/plugins/std/syscalls/syscall_64.tbl -+++ b/compel/arch/x86/plugins/std/syscalls/syscall_64.tbl -@@ -107,6 +107,7 @@ __NR_kcmp 312 sys_kcmp (pid_t pid1, pid_t pid2, int type, unsigned long idx1 - __NR_memfd_create 319 sys_memfd_create (const char *name, unsigned int flags) - __NR_userfaultfd 323 sys_userfaultfd (int flags) - __NR_ppoll 271 sys_ppoll (struct pollfd *fds, unsigned int nfds, const struct timespec *tmo, const sigset_t *sigmask, size_t sigsetsize) -+__NR_open_tree 428 sys_open_tree (int dirfd, const char *pathname, unsigned int flags) - __NR_move_mount 429 sys_move_mount (int from_dfd, const char *from_pathname, int to_dfd, const char *to_pathname, int flags) - __NR_fsopen 430 sys_fsopen (char *fsname, unsigned int flags) - __NR_fsconfig 431 sys_fsconfig (int fd, unsigned int cmd, const char *key, const char *value, int aux) -diff --git a/criu/include/mount-v2.h b/criu/include/mount-v2.h -index 8a4e46b1a..396ed9594 100644 ---- a/criu/include/mount-v2.h -+++ b/criu/include/mount-v2.h -@@ -21,4 +21,28 @@ static inline int sys_move_mount(int from_dirfd, const char *from_pathname, int - return syscall(__NR_move_mount, from_dirfd, from_pathname, to_dirfd, to_pathname, flags); - } - -+#ifndef OPEN_TREE_CLONE -+#define OPEN_TREE_CLONE 1 /* Clone the target tree and attach the clone */ -+#endif -+#ifndef OPEN_TREE_CLOEXEC -+#define OPEN_TREE_CLOEXEC O_CLOEXEC /* Close the file on execve() */ -+#endif -+#ifndef AT_SYMLINK_NOFOLLOW -+#define AT_SYMLINK_NOFOLLOW 0x100 /* Do not follow symbolic links. */ -+#endif -+#ifndef AT_NO_AUTOMOUNT -+#define AT_NO_AUTOMOUNT 0x800 /* Suppress terminal automount traversal */ -+#endif -+#ifndef AT_EMPTY_PATH -+#define AT_EMPTY_PATH 0x1000 /* Allow empty relative pathname */ -+#endif -+#ifndef AT_RECURSIVE -+#define AT_RECURSIVE 0x8000 /* Apply to the entire subtree */ -+#endif -+ -+static inline int sys_open_tree(int dfd, const char *filename, unsigned int flags) -+{ -+ return syscall(__NR_open_tree, dfd, filename, flags); -+} -+ - #endif /* __CR_MOUNT_V2_H__ */ --- -2.35.1 - diff --git a/0204-kerndat-check-whether-the-openat2-syscall-is-support.patch b/0204-kerndat-check-whether-the-openat2-syscall-is-support.patch deleted file mode 100644 index e4ac068..0000000 --- a/0204-kerndat-check-whether-the-openat2-syscall-is-support.patch +++ /dev/null @@ -1,270 +0,0 @@ -From ea5a4abe92218cdcd3de77f04f4571585d79167c Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Wed, 22 Dec 2021 11:07:24 +0300 -Subject: [PATCH 204/249] kerndat: check whether the openat2 syscall is - supported - -Will use openat2 + RESOLVE_NO_XDEV to detect mountpoints. - -Signed-off-by: Pavel Tikhomirov ---- - Makefile.config | 2 +- - .../arch/arm/plugins/std/syscalls/syscall.def | 1 + - .../mips/plugins/std/syscalls/syscall_64.tbl | 1 + - .../plugins/std/syscalls/syscall-ppc64.tbl | 1 + - .../plugins/std/syscalls/syscall-s390.tbl | 1 + - .../x86/plugins/std/syscalls/syscall_32.tbl | 1 + - .../x86/plugins/std/syscalls/syscall_64.tbl | 1 + - .../plugins/include/uapi/std/syscall-types.h | 1 + - criu/cr-check.c | 10 ++++++++++ - criu/include/kerndat.h | 1 + - criu/include/linux/openat2.h | 18 +++++++++++++++++ - criu/include/mount-v2.h | 10 ++++++++++ - criu/kerndat.c | 20 +++++++++++++++++++ - scripts/feature-tests.mak | 12 +++++++++++ - 14 files changed, 79 insertions(+), 1 deletion(-) - create mode 100644 criu/include/linux/openat2.h - -diff --git a/Makefile.config b/Makefile.config -index 6e3e1b062..14599ae8e 100644 ---- a/Makefile.config -+++ b/Makefile.config -@@ -70,7 +70,7 @@ export DEFINES += $(FEATURE_DEFINES) - export CFLAGS += $(FEATURE_DEFINES) - - FEATURES_LIST := TCP_REPAIR STRLCPY STRLCAT PTRACE_PEEKSIGINFO \ -- SETPROCTITLE_INIT MEMFD TCP_REPAIR_WINDOW FSCONFIG MEMFD_CREATE -+ SETPROCTITLE_INIT MEMFD TCP_REPAIR_WINDOW FSCONFIG MEMFD_CREATE OPENAT2 - - # $1 - config name - define gen-feature-test -diff --git a/compel/arch/arm/plugins/std/syscalls/syscall.def b/compel/arch/arm/plugins/std/syscalls/syscall.def -index a422b4905..c9bccc386 100644 ---- a/compel/arch/arm/plugins/std/syscalls/syscall.def -+++ b/compel/arch/arm/plugins/std/syscalls/syscall.def -@@ -119,4 +119,5 @@ fsconfig 431 431 (int fd, unsigned int cmd, const char *key, const char *value - fsmount 432 432 (int fd, unsigned int flags, unsigned int attr_flags) - clone3 435 435 (struct clone_args *uargs, size_t size) - pidfd_open 434 434 (pid_t pid, unsigned int flags) -+openat2 437 437 (int dirfd, char *pathname, struct open_how *how, size_t size) - pidfd_getfd 438 438 (int pidfd, int targetfd, unsigned int flags) -diff --git a/compel/arch/mips/plugins/std/syscalls/syscall_64.tbl b/compel/arch/mips/plugins/std/syscalls/syscall_64.tbl -index 745782285..a74e694e2 100644 ---- a/compel/arch/mips/plugins/std/syscalls/syscall_64.tbl -+++ b/compel/arch/mips/plugins/std/syscalls/syscall_64.tbl -@@ -116,4 +116,5 @@ __NR_fsconfig 5431 sys_fsconfig (int fd, unsigned int cmd, const char *key, - __NR_fsmount 5432 sys_fsmount (int fd, unsigned int flags, unsigned int attr_flags) - __NR_clone3 5435 sys_clone3 (struct clone_args *uargs, size_t size) - __NR_pidfd_open 5434 sys_pidfd_open (pid_t pid, unsigned int flags) -+__NR_openat2 5437 sys_openat2 (int dirfd, char *pathname, struct open_how *how, size_t size) - __NR_pidfd_getfd 5438 sys_pidfd_getfd (int pidfd, int targetfd, unsigned int flags) -diff --git a/compel/arch/ppc64/plugins/std/syscalls/syscall-ppc64.tbl b/compel/arch/ppc64/plugins/std/syscalls/syscall-ppc64.tbl -index 0eceebe22..648239182 100644 ---- a/compel/arch/ppc64/plugins/std/syscalls/syscall-ppc64.tbl -+++ b/compel/arch/ppc64/plugins/std/syscalls/syscall-ppc64.tbl -@@ -115,4 +115,5 @@ __NR_fsconfig 431 sys_fsconfig (int fd, unsigned int cmd, const char *key, co - __NR_fsmount 432 sys_fsmount (int fd, unsigned int flags, unsigned int attr_flags) - __NR_clone3 435 sys_clone3 (struct clone_args *uargs, size_t size) - __NR_pidfd_open 434 sys_pidfd_open (pid_t pid, unsigned int flags) -+__NR_openat2 437 sys_openat2 (int dirfd, char *pathname, struct open_how *how, size_t size) - __NR_pidfd_getfd 438 sys_pidfd_getfd (int pidfd, int targetfd, unsigned int flags) -diff --git a/compel/arch/s390/plugins/std/syscalls/syscall-s390.tbl b/compel/arch/s390/plugins/std/syscalls/syscall-s390.tbl -index 93a8f34d3..169458296 100644 ---- a/compel/arch/s390/plugins/std/syscalls/syscall-s390.tbl -+++ b/compel/arch/s390/plugins/std/syscalls/syscall-s390.tbl -@@ -115,4 +115,5 @@ __NR_fsconfig 431 sys_fsconfig (int fd, unsigned int cmd, const char *key, co - __NR_fsmount 432 sys_fsmount (int fd, unsigned int flags, unsigned int attr_flags) - __NR_clone3 435 sys_clone3 (struct clone_args *uargs, size_t size) - __NR_pidfd_open 434 sys_pidfd_open (pid_t pid, unsigned int flags) -+__NR_openat2 437 sys_openat2 (int dirfd, char *pathname, struct open_how *how, size_t size) - __NR_pidfd_getfd 438 sys_pidfd_getfd (int pidfd, int targetfd, unsigned int flags) -diff --git a/compel/arch/x86/plugins/std/syscalls/syscall_32.tbl b/compel/arch/x86/plugins/std/syscalls/syscall_32.tbl -index 14d2e0581..4179a7f5b 100644 ---- a/compel/arch/x86/plugins/std/syscalls/syscall_32.tbl -+++ b/compel/arch/x86/plugins/std/syscalls/syscall_32.tbl -@@ -103,4 +103,5 @@ __NR_fsconfig 431 sys_fsconfig (int fd, unsigned int cmd, const char *key, co - __NR_fsmount 432 sys_fsmount (int fd, unsigned int flags, unsigned int attr_flags) - __NR_clone3 435 sys_clone3 (struct clone_args *uargs, size_t size) - __NR_pidfd_open 434 sys_pidfd_open (pid_t pid, unsigned int flags) -+__NR_openat2 437 sys_openat2 (int dirfd, char *pathname, struct open_how *how, size_t size) - __NR_pidfd_getfd 438 sys_pidfd_getfd (int pidfd, int targetfd, unsigned int flags) -diff --git a/compel/arch/x86/plugins/std/syscalls/syscall_64.tbl b/compel/arch/x86/plugins/std/syscalls/syscall_64.tbl -index 2f690f48f..9c27ab8b5 100644 ---- a/compel/arch/x86/plugins/std/syscalls/syscall_64.tbl -+++ b/compel/arch/x86/plugins/std/syscalls/syscall_64.tbl -@@ -114,4 +114,5 @@ __NR_fsconfig 431 sys_fsconfig (int fd, unsigned int cmd, const char *key, c - __NR_fsmount 432 sys_fsmount (int fd, unsigned int flags, unsigned int attr_flags) - __NR_clone3 435 sys_clone3 (struct clone_args *uargs, size_t size) - __NR_pidfd_open 434 sys_pidfd_open (pid_t pid, unsigned int flags) -+__NR_openat2 437 sys_openat2 (int dirfd, char *pathname, struct open_how *how, size_t size) - __NR_pidfd_getfd 438 sys_pidfd_getfd (int pidfd, int targetfd, unsigned int flags) -diff --git a/compel/plugins/include/uapi/std/syscall-types.h b/compel/plugins/include/uapi/std/syscall-types.h -index cc1969c01..1eea99daa 100644 ---- a/compel/plugins/include/uapi/std/syscall-types.h -+++ b/compel/plugins/include/uapi/std/syscall-types.h -@@ -40,6 +40,7 @@ struct rusage; - struct iocb; - struct pollfd; - struct clone_args; -+struct open_how; - - typedef unsigned long aio_context_t; - -diff --git a/criu/cr-check.c b/criu/cr-check.c -index 10d433650..52393cc8b 100644 ---- a/criu/cr-check.c -+++ b/criu/cr-check.c -@@ -1402,6 +1402,14 @@ static int check_move_mount_set_group(void) - return 0; - } - -+static int check_openat2(void) -+{ -+ if (!kdat.has_openat2) -+ return -1; -+ -+ return 0; -+} -+ - static int (*chk_feature)(void); - - /* -@@ -1523,6 +1531,7 @@ int cr_check(void) - ret |= check_sockopt_buf_lock(); - ret |= check_memfd_hugetlb(); - ret |= check_move_mount_set_group(); -+ ret |= check_openat2(); - } - - /* -@@ -1638,6 +1647,7 @@ static struct feature_list feature_list[] = { - { "sockopt_buf_lock", check_sockopt_buf_lock }, - { "memfd_hugetlb", check_memfd_hugetlb }, - { "move_mount_set_group", check_move_mount_set_group }, -+ { "openat2", check_openat2 }, - { NULL, NULL }, - }; - -diff --git a/criu/include/kerndat.h b/criu/include/kerndat.h -index f6e3b6133..de14028f5 100644 ---- a/criu/include/kerndat.h -+++ b/criu/include/kerndat.h -@@ -79,6 +79,7 @@ struct kerndat_s { - bool has_sockopt_buf_lock; - dev_t hugetlb_dev[HUGETLB_MAX]; - bool has_move_mount_set_group; -+ bool has_openat2; - }; - - extern struct kerndat_s kdat; -diff --git a/criu/include/linux/openat2.h b/criu/include/linux/openat2.h -new file mode 100644 -index 000000000..1e9ccff05 ---- /dev/null -+++ b/criu/include/linux/openat2.h -@@ -0,0 +1,18 @@ -+#ifndef _CRIU_LINUX_OPENAT2_H -+#define _CRIU_LINUX_OPENAT2_H -+ -+#include -+ -+#include "common/config.h" -+ -+#ifdef CONFIG_HAS_OPENAT2 -+#include -+#else -+struct open_how { -+ __u64 flags; -+ __u64 mode; -+ __u64 resolve; -+}; -+#endif -+ -+#endif -diff --git a/criu/include/mount-v2.h b/criu/include/mount-v2.h -index 396ed9594..a2e2fa1c8 100644 ---- a/criu/include/mount-v2.h -+++ b/criu/include/mount-v2.h -@@ -2,6 +2,7 @@ - #define __CR_MOUNT_V2_H__ - - #include "linux/mount.h" -+#include "linux/openat2.h" - - #include - -@@ -45,4 +46,13 @@ static inline int sys_open_tree(int dfd, const char *filename, unsigned int flag - return syscall(__NR_open_tree, dfd, filename, flags); - } - -+#ifndef RESOLVE_NO_XDEV -+#define RESOLVE_NO_XDEV 0x01 /* Block mount-point crossings (includes bind-mounts). */ -+#endif -+ -+static inline long sys_openat2(int dirfd, const char *pathname, struct open_how *how, size_t size) -+{ -+ return syscall(__NR_openat2, dirfd, pathname, how, size); -+} -+ - #endif /* __CR_MOUNT_V2_H__ */ -diff --git a/criu/kerndat.c b/criu/kerndat.c -index 5e49fc116..93617012a 100644 ---- a/criu/kerndat.c -+++ b/criu/kerndat.c -@@ -997,6 +997,22 @@ out: - return exit_code; - } - -+static int kerndat_has_openat2(void) -+{ -+ if (sys_openat2(AT_FDCWD, ".", NULL, 0) != -1) { -+ pr_err("openat2 should fail\n"); -+ return -1; -+ } -+ if (errno == ENOSYS) { -+ pr_debug("No openat2 syscall support\n"); -+ kdat.has_openat2 = false; -+ } else { -+ kdat.has_openat2 = true; -+ } -+ -+ return 0; -+} -+ - #define KERNDAT_CACHE_FILE KDAT_RUNDIR "/criu.kdat" - #define KERNDAT_CACHE_FILE_TMP KDAT_RUNDIR "/.criu.kdat" - -@@ -1586,6 +1602,10 @@ int kerndat_init(void) - pr_err("kerndat_has_move_mount_set_group failed when initializing kerndat.\n"); - ret = -1; - } -+ if (!ret && kerndat_has_openat2()) { -+ pr_err("kerndat_has_openat2 failed when initializing kerndat.\n"); -+ ret = -1; -+ } - - kerndat_lsm(); - kerndat_mmap_min_addr(); -diff --git a/scripts/feature-tests.mak b/scripts/feature-tests.mak -index 8df20afb7..592552cb8 100644 ---- a/scripts/feature-tests.mak -+++ b/scripts/feature-tests.mak -@@ -184,3 +184,15 @@ int main(void) - return memfd_create(NULL, 0); - } - endef -+ -+define FEATURE_TEST_OPENAT2 -+ -+#include -+ -+int main(void) -+{ -+ if (RESOLVE_NO_XDEV > 0) -+ return 0; -+ return 0; -+} -+endef --- -2.35.1 - diff --git a/0205-util-add-resolve_mountpoint-helper.patch b/0205-util-add-resolve_mountpoint-helper.patch deleted file mode 100644 index c071106..0000000 --- a/0205-util-add-resolve_mountpoint-helper.patch +++ /dev/null @@ -1,159 +0,0 @@ -From b3fbad7fd38554a9de9f49374847ed8ce8f9415e Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Wed, 22 Dec 2021 19:26:32 +0300 -Subject: [PATCH 205/249] util: add resolve_mountpoint helper - -This helper would be useful to get mountpoints of source path of -external mounts without parsing host mountinfo. When we restore -mountpoint-external mount and we need to copy sharing from source via -MOVE_MOUNT_SET_GROUP, it would require from us to give it real -mountpoint of source path to be able to copy sharing group. - -This uses openat2 RESOLVE_NO_XDEV feature which detects crossing -mountpoint boundary instead of potentially slow mountinfo parsing. - -v3: coverity CID 389209: close fd only when it was opened - -Signed-off-by: Pavel Tikhomirov ---- - criu/include/util.h | 3 ++ - criu/util.c | 100 ++++++++++++++++++++++++++++++++++++++++++++ - 2 files changed, 103 insertions(+) - -diff --git a/criu/include/util.h b/criu/include/util.h -index 0df1fe266..5ccd24722 100644 ---- a/criu/include/util.h -+++ b/criu/include/util.h -@@ -403,4 +403,7 @@ extern int run_command(char *buf, size_t buf_size, int (*child_fn)(void *), void - */ - extern uint64_t criu_run_id; - extern void util_init(void); -+ -+extern char *resolve_mountpoint(char *path); -+ - #endif /* __CR_UTIL_H__ */ -diff --git a/criu/util.c b/criu/util.c -index f14e6467f..f8da4ac5c 100644 ---- a/criu/util.c -+++ b/criu/util.c -@@ -28,6 +28,7 @@ - #include - #include - #include -+#include - - #include "linux/mount.h" - -@@ -46,6 +47,7 @@ - #include "files.h" - #include "pstree.h" - #include "sched.h" -+#include "mount-v2.h" - - #include "cr-errno.h" - #include "action-scripts.h" -@@ -1887,3 +1889,101 @@ bool is_same_path(char *path1, char *path2) - - return true; - } -+ -+/* -+ * Checks if path is a mountpoint -+ * (path should be visible - no overmounts) -+ */ -+static int path_is_mountpoint(char *path, bool *is_mountpoint) -+{ -+ char *dname, *bname, *free_name; -+ struct open_how how = { -+ .flags = O_PATH, -+ .resolve = RESOLVE_NO_XDEV, -+ }; -+ int exit_code = -1; -+ int dfd, fd; -+ -+ dname = free_name = xstrdup(path); -+ if (!dname) -+ return -1; -+ dname = dirname(dname); -+ -+ bname = get_relative_path(path, dname); -+ if (!bname || *bname == '\0') { -+ pr_err("Failed to get bname for %s\n", path); -+ goto err_free; -+ } -+ -+ dfd = open(dname, O_PATH); -+ if (dfd < 0) { -+ pr_perror("Failed to open dir %s", dname); -+ goto err_free; -+ } -+ -+ fd = sys_openat2(dfd, bname, &how, sizeof(how)); -+ if (fd < 0) { -+ if (errno != EXDEV) { -+ pr_perror("Failed to open %s at %s", bname, dname); -+ goto err_close; -+ } -+ -+ /* -+ * EXDEV means that dfd and bname are from different -+ * mounts, meaning that bname is a mountpoint -+ */ -+ *is_mountpoint = true; -+ } else { -+ /* -+ * No error means that dfd and bname are from same mount, -+ * meaning that bname is not a mountpoint -+ */ -+ *is_mountpoint = false; -+ close(fd); -+ } -+ -+ exit_code = 0; -+err_close: -+ close(dfd); -+err_free: -+ xfree(free_name); -+ return exit_code; -+} -+ -+/* -+ * Resolves real mountpoint path by any path on it -+ * (path should be visible - no overmountes) -+ */ -+char *resolve_mountpoint(char *path) -+{ -+ char *mp_path, *free_path; -+ bool is_mountpoint; -+ -+ mp_path = free_path = xstrdup(path); -+ if (!mp_path) -+ return NULL; -+ -+ while (1) { -+ /* -+ * If we see "/" or "." we can't check if they are mountpoints -+ * by openat2 RESOLVE_NO_XDEV, let's just assume they are. -+ */ -+ if (is_same_path(mp_path, "/")) -+ return mp_path; -+ -+ if (path_is_mountpoint(mp_path, &is_mountpoint) == -1) { -+ xfree(free_path); -+ return NULL; -+ } -+ -+ if (is_mountpoint) -+ return mp_path; -+ -+ /* Try parent directory */ -+ mp_path = dirname(mp_path); -+ } -+ -+ /* never get here */ -+ xfree(free_path); -+ return NULL; -+} --- -2.35.1 - diff --git a/0206-crtools-move-check_options-after-kerndat_init-and-lo.patch b/0206-crtools-move-check_options-after-kerndat_init-and-lo.patch deleted file mode 100644 index 2537dde..0000000 --- a/0206-crtools-move-check_options-after-kerndat_init-and-lo.patch +++ /dev/null @@ -1,41 +0,0 @@ -From c0c592f09b30f2c3cc99aa13ada2cc45dcfb72a1 Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Thu, 23 Dec 2021 17:19:49 +0300 -Subject: [PATCH 206/249] crtools: move check_options after kerndat_init and - log_init - -This can be useful to check options which depend on some kernel features -listed in kdat. - -Signed-off-by: Pavel Tikhomirov ---- - criu/crtools.c | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/criu/crtools.c b/criu/crtools.c -index 3c3491603..86aeb4d2b 100644 ---- a/criu/crtools.c -+++ b/criu/crtools.c -@@ -185,9 +185,6 @@ int main(int argc, char *argv[], char *envp[]) - return cr_service_work(atoi(argv[optind + 1])); - } - -- if (check_options()) -- return 1; -- - if (opts.imgs_dir == NULL) - SET_CHAR_OPTS(imgs_dir, "."); - -@@ -264,6 +261,9 @@ int main(int argc, char *argv[], char *envp[]) - return 1; - } - -+ if (check_options()) -+ return 1; -+ - if (fault_injected(FI_CANNOT_MAP_VDSO)) - kdat.can_map_vdso = 0; - --- -2.35.1 - diff --git a/0207-config-rpc-add-new-option-mntns-compat-mode-for-old-.patch b/0207-config-rpc-add-new-option-mntns-compat-mode-for-old-.patch deleted file mode 100644 index c92ad32..0000000 --- a/0207-config-rpc-add-new-option-mntns-compat-mode-for-old-.patch +++ /dev/null @@ -1,230 +0,0 @@ -From 34cba22d4eabb34a8f1588d4ce5571492c3f2ef3 Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Mon, 25 May 2020 17:43:48 +0300 -Subject: [PATCH 207/249] config/rpc: add new option --mntns-compat-mode for - old mount engine - -We plan to switch to Mounts-v2 engine for restoring mounts by default, -this options is to allow switching to old engine. This patch only adds -an option, no engine behind it yet. - -Cherry-picked from Virtuozzo criu: -https://src.openvz.org/projects/OVZ/repos/criu/commits/503f9ad2c - -Changes: allow --mntns-compat-mode option only on restore and only if -MOVE_MOUNT_SET_GROUP is supported (this also requires change in -unittest/mock.c), change id in rpc criu_opts. - -Signed-off-by: Pavel Tikhomirov ---- - criu/Makefile.crtools | 1 + - criu/config.c | 12 ++++++++++++ - criu/cr-service.c | 3 +++ - criu/crtools.c | 3 +++ - criu/include/cr_options.h | 2 ++ - criu/include/mount-v2.h | 2 ++ - criu/mount-v2.c | 20 ++++++++++++++++++++ - criu/unittest/mock.c | 5 +++++ - images/rpc.proto | 1 + - lib/c/criu.c | 11 +++++++++++ - lib/c/criu.h | 2 ++ - 11 files changed, 62 insertions(+) - create mode 100644 criu/mount-v2.c - -diff --git a/criu/Makefile.crtools b/criu/Makefile.crtools -index 46d7fd424..22108cce0 100644 ---- a/criu/Makefile.crtools -+++ b/criu/Makefile.crtools -@@ -41,6 +41,7 @@ obj-y += lsm.o - obj-y += mem.o - obj-y += memfd.o - obj-y += mount.o -+obj-y += mount-v2.o - obj-y += filesystems.o - obj-y += namespaces.o - obj-y += netfilter.o -diff --git a/criu/config.c b/criu/config.c -index 4a8338423..8b6d105ae 100644 ---- a/criu/config.c -+++ b/criu/config.c -@@ -20,6 +20,7 @@ - #include "file-lock.h" - #include "irmap.h" - #include "mount.h" -+#include "mount-v2.h" - #include "namespaces.h" - #include "net.h" - #include "sk-inet.h" -@@ -697,6 +698,7 @@ int parse_options(int argc, char **argv, bool *usage_error, bool *has_exec_cmd, - { "file-validation", required_argument, 0, 1098 }, - { "lsm-mount-context", required_argument, 0, 1099 }, - { "network-lock", required_argument, 0, 1100 }, -+ BOOL_OPT("mntns-compat-mode", &opts.mntns_compat_mode), - {}, - }; - -@@ -1103,6 +1105,16 @@ int check_options(void) - } - #endif - -+ if (opts.mntns_compat_mode && opts.mode != CR_RESTORE) { -+ pr_err("Option --mntns-compat-mode is only valid on restore\n"); -+ return 1; -+ } else if (!opts.mntns_compat_mode && opts.mode == CR_RESTORE) { -+ if (check_mount_v2()) { -+ pr_warn("Mount engine fallback to --mntns-compat-mode mode\n"); -+ opts.mntns_compat_mode = true; -+ } -+ } -+ - if (check_namespace_opts()) { - pr_err("Error: namespace flags conflict\n"); - return 1; -diff --git a/criu/cr-service.c b/criu/cr-service.c -index 59f46b320..a6eb9ebd3 100644 ---- a/criu/cr-service.c -+++ b/criu/cr-service.c -@@ -719,6 +719,9 @@ static int setup_opts_from_req(int sk, CriuOpts *req) - goto err; - } - -+ if (req->mntns_compat_mode) -+ opts.mntns_compat_mode = true; -+ - log_set_loglevel(opts.log_level); - if (check_options()) - goto err; -diff --git a/criu/crtools.c b/criu/crtools.c -index 86aeb4d2b..cc8d9179f 100644 ---- a/criu/crtools.c -+++ b/criu/crtools.c -@@ -408,6 +408,9 @@ usage: - " in lazy-pages mode: 'criu lazy-pages -D DIR'\n" - " --lazy-pages and lazy-pages mode require userfaultfd\n" - " --stream dump/restore images using criu-image-streamer\n" -+ " --mntns-compat-mode Use mount engine in compatibility mode. By default criu\n" -+ " tries to use mount-v2 mode with more reliable algorithm\n" -+ " based on MOVE_MOUNT_SET_GROUP kernel feature\n" - " --network-lock METHOD\n" - " network locking/unlocking method; argument\n" - " can be 'nftables' or 'iptables' (default).\n" -diff --git a/criu/include/cr_options.h b/criu/include/cr_options.h -index 85648bf1c..bf1a762cc 100644 ---- a/criu/include/cr_options.h -+++ b/criu/include/cr_options.h -@@ -207,6 +207,8 @@ struct cr_options { - - /* Shows the mode criu is running at the moment: dump/pre-dump/restore/... */ - enum criu_mode mode; -+ -+ int mntns_compat_mode; - }; - - extern struct cr_options opts; -diff --git a/criu/include/mount-v2.h b/criu/include/mount-v2.h -index a2e2fa1c8..61f62966d 100644 ---- a/criu/include/mount-v2.h -+++ b/criu/include/mount-v2.h -@@ -55,4 +55,6 @@ static inline long sys_openat2(int dirfd, const char *pathname, struct open_how - return syscall(__NR_openat2, dirfd, pathname, how, size); - } - -+extern int check_mount_v2(void); -+ - #endif /* __CR_MOUNT_V2_H__ */ -diff --git a/criu/mount-v2.c b/criu/mount-v2.c -new file mode 100644 -index 000000000..801ade748 ---- /dev/null -+++ b/criu/mount-v2.c -@@ -0,0 +1,20 @@ -+#include "kerndat.h" -+#include "log.h" -+ -+#undef LOG_PREFIX -+#define LOG_PREFIX "mnt-v2: " -+ -+int check_mount_v2(void) -+{ -+ if (!kdat.has_move_mount_set_group) { -+ pr_warn("Mounts-v2 requires MOVE_MOUNT_SET_GROUP support\n"); -+ return -1; -+ } -+ -+ if (!kdat.has_openat2) { -+ pr_warn("Mounts-v2 requires openat2 support\n"); -+ return -1; -+ } -+ -+ return 0; -+} -diff --git a/criu/unittest/mock.c b/criu/unittest/mock.c -index 127cc7498..dc5b627f7 100644 ---- a/criu/unittest/mock.c -+++ b/criu/unittest/mock.c -@@ -136,3 +136,8 @@ struct kerndat_s kdat = {}; - int service_fd_rlim_cur; - - unsigned __page_size; -+ -+int check_mount_v2(void) -+{ -+ return 0; -+} -diff --git a/images/rpc.proto b/images/rpc.proto -index 1d3befd23..a6cc5da48 100644 ---- a/images/rpc.proto -+++ b/images/rpc.proto -@@ -137,6 +137,7 @@ message criu_opts { - optional int32 pidfd_store_sk = 62; - optional string lsm_mount_context = 63; - optional criu_network_lock_method network_lock = 64 [default = IPTABLES]; -+ optional bool mntns_compat_mode = 65; - /* optional bool check_mounts = 128; */ - } - -diff --git a/lib/c/criu.c b/lib/c/criu.c -index dea5896f7..7807d7bc5 100644 ---- a/lib/c/criu.c -+++ b/lib/c/criu.c -@@ -1170,6 +1170,17 @@ int criu_set_page_server_address_port(const char *address, int port) - return criu_local_set_page_server_address_port(global_opts, address, port); - } - -+void criu_local_set_mntns_compat_mode(criu_opts *opts, bool val) -+{ -+ opts->rpc->has_mntns_compat_mode = true; -+ opts->rpc->mntns_compat_mode = val; -+} -+ -+void criu_set_mntns_compat_mode(bool val) -+{ -+ criu_local_set_mntns_compat_mode(global_opts, val); -+} -+ - static CriuResp *recv_resp(int socket_fd) - { - struct msghdr msg_hdr = { 0 }; -diff --git a/lib/c/criu.h b/lib/c/criu.h -index aed2c3481..40e3106fc 100644 ---- a/lib/c/criu.h -+++ b/lib/c/criu.h -@@ -112,6 +112,7 @@ int criu_set_pre_dump_mode(enum criu_pre_dump_mode mode); - void criu_set_pidfd_store_sk(int sk); - int criu_set_network_lock(enum criu_network_lock_method method); - int criu_join_ns_add(const char *ns, const char *ns_file, const char *extra_opt); -+void criu_set_mntns_compat_mode(bool val); - - /* - * The criu_notify_arg_t na argument is an opaque -@@ -275,6 +276,7 @@ int criu_local_set_pre_dump_mode(criu_opts *opts, enum criu_pre_dump_mode mode); - void criu_local_set_pidfd_store_sk(criu_opts *opts, int sk); - int criu_local_set_network_lock(criu_opts *opts, enum criu_network_lock_method method); - int criu_local_join_ns_add(criu_opts *opts, const char *ns, const char *ns_file, const char *extra_opt); -+void criu_local_set_mntns_compat_mode(criu_opts *opts, bool val); - - void criu_local_set_notify_cb(criu_opts *opts, int (*cb)(char *action, criu_notify_arg_t na)); - --- -2.35.1 - diff --git a/0208-mount-add-plain-mountpoints.patch b/0208-mount-add-plain-mountpoints.patch deleted file mode 100644 index 2d8376d..0000000 --- a/0208-mount-add-plain-mountpoints.patch +++ /dev/null @@ -1,131 +0,0 @@ -From a14336dbfb6efbf81069bd772ef4860970480c8c Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Thu, 28 May 2020 11:30:16 +0300 -Subject: [PATCH 208/249] mount: add plain mountpoints - -This is a preparation of mounts-v2 new algorithm for mount restore, we -add an alternative mountpoints to each mount, so that if we mount mounts -in these mountpoints they will be "plain": each mount in separate -sub-directory of root_yard, mounts will be mounted without tree. Tree -reconstruction will be done in separate step. - -Cherry-picked from Virtuozzo criu: -https://src.openvz.org/projects/OVZ/repos/criu/commits/5e6de171a - -Changes: improve get_plain_mountpoint(). - -Signed-off-by: Pavel Tikhomirov ---- - criu/include/mount.h | 3 +++ - criu/mount.c | 39 +++++++++++++++++++++++++++++++++++++++ - 2 files changed, 42 insertions(+) - -diff --git a/criu/include/mount.h b/criu/include/mount.h -index 8eb4ddf9b..588aedf99 100644 ---- a/criu/include/mount.h -+++ b/criu/include/mount.h -@@ -48,6 +48,7 @@ struct mount_info { - */ - char *mountpoint; - char *ns_mountpoint; -+ char *plain_mountpoint; - int fd; - unsigned flags; - unsigned sb_flags; -@@ -168,6 +169,8 @@ extern int read_mnt_ns_img(void); - extern void cleanup_mnt_ns(void); - extern void clean_cr_time_mounts(void); - -+extern char *get_plain_mountpoint(int mnt_id, char *name); -+ - extern bool add_skip_mount(const char *mountpoint); - struct ns_id; - extern int get_sdev_from_fd(int fd, unsigned int *sdev, bool parse_mountinfo); -diff --git a/criu/mount.c b/criu/mount.c -index bddfe2e7f..64ef2f233 100644 ---- a/criu/mount.c -+++ b/criu/mount.c -@@ -49,6 +49,10 @@ static LIST_HEAD(delayed_unbindable); - - char *service_mountpoint(const struct mount_info *mi) - { -+ if (!opts.mntns_compat_mode && opts.mode == CR_RESTORE) { -+ BUG_ON(!mi->plain_mountpoint); -+ return mi->plain_mountpoint; -+ } - return mi->mountpoint; - } - -@@ -1627,6 +1631,28 @@ err: - return -1; - } - -+/* -+ * Helper for getting a path to mount's plain mountpoint -+ */ -+char *get_plain_mountpoint(int mnt_id, char *name) -+{ -+ static char tmp[PATH_MAX]; -+ int ret; -+ -+ if (!mnt_roots) -+ return NULL; -+ -+ if (name) -+ ret = snprintf(tmp, sizeof(tmp), "%s/mnt-%s", mnt_roots, name); -+ else -+ ret = snprintf(tmp, sizeof(tmp), "%s/mnt-%010d", mnt_roots, mnt_id); -+ -+ if (ret >= sizeof(tmp)) -+ return NULL; -+ -+ return xstrdup(tmp); -+} -+ - static __maybe_unused struct mount_info *add_cr_time_mount(struct mount_info *root, char *fsname, const char *path, - unsigned int s_dev, bool rst) - { -@@ -1654,6 +1680,11 @@ static __maybe_unused struct mount_info *add_cr_time_mount(struct mount_info *ro - sprintf(mi->mountpoint, "%s%s", root->mountpoint, path); - else - sprintf(mi->mountpoint, "%s/%s", root->mountpoint, path); -+ if (rst) { -+ mi->plain_mountpoint = get_plain_mountpoint(-1, "crtime"); -+ if (!mi->plain_mountpoint) -+ goto err; -+ } - mi->mnt_id = HELPER_MNT_ID; - mi->flags = mi->sb_flags = 0; - mi->root = xstrdup("/"); -@@ -2995,6 +3026,7 @@ void mnt_entry_free(struct mount_info *mi) - if (mi) { - xfree(mi->root); - xfree(mi->mountpoint); -+ xfree(mi->plain_mountpoint); - xfree(mi->source); - xfree(mi->options); - xfree(mi->fsname); -@@ -3120,6 +3152,10 @@ static int get_mp_mountpoint(char *mountpoint, struct mount_info *mi, char *root - - mi->ns_mountpoint = mi->mountpoint + root_len; - -+ mi->plain_mountpoint = get_plain_mountpoint(mi->mnt_id, NULL); -+ if (!mi->plain_mountpoint) -+ return -1; -+ - pr_debug("\t\tWill mount %d @ %s %s\n", mi->mnt_id, service_mountpoint(mi), mi->ns_mountpoint); - return 0; - } -@@ -3293,6 +3329,9 @@ static int merge_mount_trees(void) - return -1; - - root_yard_mp->mountpoint = mnt_roots; -+ root_yard_mp->plain_mountpoint = xstrdup(mnt_roots); -+ if (!root_yard_mp->plain_mountpoint) -+ return -1; - root_yard_mp->mounted = true; - root_yard_mp->mnt_bind_is_populated = true; - root_yard_mp->is_overmounted = false; --- -2.35.1 - diff --git a/0209-files-reg-export-parent-dirs-helpers-for-mount-v2.patch b/0209-files-reg-export-parent-dirs-helpers-for-mount-v2.patch deleted file mode 100644 index 68575ed..0000000 --- a/0209-files-reg-export-parent-dirs-helpers-for-mount-v2.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 247e677678fdc049d6e827315976a04527f5d84d Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Tue, 21 Dec 2021 12:14:23 +0300 -Subject: [PATCH 209/249] files-reg: export parent dirs helpers for mount-v2 - -Signed-off-by: Pavel Tikhomirov ---- - criu/files-reg.c | 4 ++-- - criu/include/files-reg.h | 3 +++ - 2 files changed, 5 insertions(+), 2 deletions(-) - -diff --git a/criu/files-reg.c b/criu/files-reg.c -index 636853ac8..e998b3040 100644 ---- a/criu/files-reg.c -+++ b/criu/files-reg.c -@@ -1873,7 +1873,7 @@ out: - return ret; - } - --static int rm_parent_dirs(int mntns_root, char *path, int count) -+int rm_parent_dirs(int mntns_root, char *path, int count) - { - char *p, *prev = NULL; - int ret = -1; -@@ -1912,7 +1912,7 @@ err: - } - - /* Construct parent dir name and mkdir parent/grandparents if they're not exist */ --static int make_parent_dirs_if_need(int mntns_root, char *path) -+int make_parent_dirs_if_need(int mntns_root, char *path) - { - char *p, *last_delim; - int err, count = 0; -diff --git a/criu/include/files-reg.h b/criu/include/files-reg.h -index 953d50288..d4934c4ae 100644 ---- a/criu/include/files-reg.h -+++ b/criu/include/files-reg.h -@@ -58,4 +58,7 @@ static inline int link_strip_deleted(struct fd_link *link) - - extern int dead_pid_conflict(void); - -+extern int rm_parent_dirs(int mntns_root, char *path, int count); -+extern int make_parent_dirs_if_need(int mntns_root, char *path); -+ - #endif /* __CR_FILES_REG_H__ */ --- -2.35.1 - diff --git a/0210-mount-remove-double-ns_id-declaration.patch b/0210-mount-remove-double-ns_id-declaration.patch deleted file mode 100644 index 737f94e..0000000 --- a/0210-mount-remove-double-ns_id-declaration.patch +++ /dev/null @@ -1,27 +0,0 @@ -From b7843ffd30c66d4e375f733b6930bb54d42d77f8 Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Tue, 21 Dec 2021 12:43:42 +0300 -Subject: [PATCH 210/249] mount: remove double ns_id declaration - -Fixes: d0d117986 ("mount: move functions about mounts from proc_parse.h") - -Signed-off-by: Pavel Tikhomirov ---- - criu/include/mount.h | 1 - - 1 file changed, 1 deletion(-) - -diff --git a/criu/include/mount.h b/criu/include/mount.h -index 588aedf99..562b0cd9b 100644 ---- a/criu/include/mount.h -+++ b/criu/include/mount.h -@@ -172,7 +172,6 @@ extern void clean_cr_time_mounts(void); - extern char *get_plain_mountpoint(int mnt_id, char *name); - - extern bool add_skip_mount(const char *mountpoint); --struct ns_id; - extern int get_sdev_from_fd(int fd, unsigned int *sdev, bool parse_mountinfo); - extern struct mount_info *parse_mountinfo(pid_t pid, struct ns_id *nsid, bool for_dump); - --- -2.35.1 - diff --git a/0211-mount-export-common-defines-for-mount-v2.patch b/0211-mount-export-common-defines-for-mount-v2.patch deleted file mode 100644 index 68c5de9..0000000 --- a/0211-mount-export-common-defines-for-mount-v2.patch +++ /dev/null @@ -1,74 +0,0 @@ -From 294b4e67037e2e49cae1c4b795cfc68256902bbe Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Tue, 21 Dec 2021 12:46:57 +0300 -Subject: [PATCH 211/249] mount: export common defines for mount-v2 - -Signed-off-by: Pavel Tikhomirov ---- - criu/include/mount.h | 14 ++++++++++++++ - criu/mount.c | 14 -------------- - 2 files changed, 14 insertions(+), 14 deletions(-) - -diff --git a/criu/include/mount.h b/criu/include/mount.h -index 562b0cd9b..dfb9989c0 100644 ---- a/criu/include/mount.h -+++ b/criu/include/mount.h -@@ -10,6 +10,20 @@ struct pstree_item; - struct fstype; - struct ns_id; - -+#define MS_PROPAGATE (MS_SHARED | MS_PRIVATE | MS_UNBINDABLE | MS_SLAVE) -+ -+/* -+ * Here are a set of flags which we know how to handle for the one mount call. -+ * All of them except MS_RDONLY are set only as mnt flags. -+ * MS_RDONLY is set for both mnt ans sb flags, so we can restore it for one -+ * mount call only if it set for both masks. -+ */ -+#define MS_MNT_KNOWN_FLAGS (MS_NOSUID | MS_NOEXEC | MS_NODEV | MS_NOATIME | MS_NODIRATIME | MS_RELATIME | MS_RDONLY) -+ -+#define BINFMT_MISC_HOME "proc/sys/fs/binfmt_misc" -+ -+#define HELPER_MNT_ID 0 -+ - #define MOUNT_INVALID_DEV (0) - - #define MNT_UNREACHABLE INT_MIN -diff --git a/criu/mount.c b/criu/mount.c -index 64ef2f233..d796c9341 100644 ---- a/criu/mount.c -+++ b/criu/mount.c -@@ -31,15 +31,9 @@ - - #include "images/mnt.pb-c.h" - --#define MS_PROPAGATE (MS_SHARED | MS_PRIVATE | MS_UNBINDABLE | MS_SLAVE) -- - #undef LOG_PREFIX - #define LOG_PREFIX "mnt: " - --#define BINFMT_MISC_HOME "proc/sys/fs/binfmt_misc" -- --#define HELPER_MNT_ID 0 -- - #define CONTEXT_OPT "context=" - - /* A helper mount_info entry for the roots yard */ -@@ -2210,14 +2204,6 @@ static int fetch_rt_stat(struct mount_info *m, const char *where) - return 0; - } - --/* -- * Here are a set of flags which we know how to handle for the one mount call. -- * All of them except MS_RDONLY are set only as mnt flags. -- * MS_RDONLY is set for both mnt ans sb flags, so we can restore it for one -- * mount call only if it set for both masks. -- */ --#define MS_MNT_KNOWN_FLAGS (MS_NOSUID | MS_NOEXEC | MS_NODEV | MS_NOATIME | MS_NODIRATIME | MS_RELATIME | MS_RDONLY) -- - static int do_simple_mount(struct mount_info *mi, const char *src, const char *fstype, unsigned long mountflags) - { - int ret = mount(src, service_mountpoint(mi), fstype, mountflags, mi->options); --- -2.35.1 - diff --git a/0212-mount-export-several-functions-for-mount-v2.patch b/0212-mount-export-several-functions-for-mount-v2.patch deleted file mode 100644 index 671f90f..0000000 --- a/0212-mount-export-several-functions-for-mount-v2.patch +++ /dev/null @@ -1,150 +0,0 @@ -From d88668190e0254e51a4d16a3ae7c1d1ef8baaefe Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Tue, 21 Dec 2021 13:29:52 +0300 -Subject: [PATCH 212/249] mount: export several functions for mount-v2 - -Signed-off-by: Pavel Tikhomirov ---- - criu/include/mount.h | 14 ++++++++++++++ - criu/mount.c | 28 ++++++++++++---------------- - 2 files changed, 26 insertions(+), 16 deletions(-) - -diff --git a/criu/include/mount.h b/criu/include/mount.h -index dfb9989c0..914024544 100644 ---- a/criu/include/mount.h -+++ b/criu/include/mount.h -@@ -209,4 +209,18 @@ extern struct mount_info *mnt_bind_pick(struct mount_info *mi, - extern int mnt_tree_for_each(struct mount_info *start, int (*fn)(struct mount_info *)); - - extern char *service_mountpoint(const struct mount_info *mi); -+ -+extern int validate_mounts(struct mount_info *info, bool for_dump); -+extern __maybe_unused struct mount_info *add_cr_time_mount(struct mount_info *root, char *fsname, const char *path, -+ unsigned int s_dev, bool rst); -+extern char *resolve_source(struct mount_info *mi); -+extern int fetch_rt_stat(struct mount_info *m, const char *where); -+extern int do_simple_mount(struct mount_info *mi, const char *src, const char *fstype, unsigned long mountflags); -+extern char *mnt_fsname(struct mount_info *mi); -+extern int apply_sb_flags(void *args, int fd, pid_t pid); -+extern int mount_root(void *args, int fd, pid_t pid); -+extern int restore_ext_mount(struct mount_info *mi); -+extern int cr_pivot_root(char *root); -+extern int print_ns_root(struct ns_id *ns, int remap_id, char *buf, int bs); -+ - #endif /* __CR_MOUNT_H__ */ -diff --git a/criu/mount.c b/criu/mount.c -index d796c9341..7549284d9 100644 ---- a/criu/mount.c -+++ b/criu/mount.c -@@ -693,7 +693,7 @@ static int validate_children_collision(struct mount_info *mnt) - return 0; - } - --static int validate_mounts(struct mount_info *info, bool for_dump) -+int validate_mounts(struct mount_info *info, bool for_dump) - { - struct mount_info *m, *t; - -@@ -1647,8 +1647,8 @@ char *get_plain_mountpoint(int mnt_id, char *name) - return xstrdup(tmp); - } - --static __maybe_unused struct mount_info *add_cr_time_mount(struct mount_info *root, char *fsname, const char *path, -- unsigned int s_dev, bool rst) -+struct mount_info __maybe_unused *add_cr_time_mount(struct mount_info *root, char *fsname, const char *path, -+ unsigned int s_dev, bool rst) - { - struct mount_info *mi, *t, *parent; - bool add_slash = false; -@@ -1993,7 +1993,7 @@ static int mnt_tree_for_each_reverse(struct mount_info *m, int (*fn)(struct moun - return 0; - } - --static char *resolve_source(struct mount_info *mi) -+char *resolve_source(struct mount_info *mi) - { - if (kdev_major(mi->s_dev) == 0) - /* -@@ -2191,7 +2191,7 @@ skip_parent: - return 0; - } - --static int fetch_rt_stat(struct mount_info *m, const char *where) -+int fetch_rt_stat(struct mount_info *m, const char *where) - { - struct stat st; - -@@ -2204,7 +2204,7 @@ static int fetch_rt_stat(struct mount_info *m, const char *where) - return 0; - } - --static int do_simple_mount(struct mount_info *mi, const char *src, const char *fstype, unsigned long mountflags) -+int do_simple_mount(struct mount_info *mi, const char *src, const char *fstype, unsigned long mountflags) - { - int ret = mount(src, service_mountpoint(mi), fstype, mountflags, mi->options); - if (ret) -@@ -2212,7 +2212,7 @@ static int do_simple_mount(struct mount_info *mi, const char *src, const char *f - return ret; - } - --static char *mnt_fsname(struct mount_info *mi) -+char *mnt_fsname(struct mount_info *mi) - { - if (mi->fstype->code == FSTYPE__AUTO) - return mi->fsname; -@@ -2240,12 +2240,12 @@ static int userns_mount(char *src, void *args, int fd, pid_t pid) - return err; - } - --static int apply_sb_flags(void *args, int fd, pid_t pid) -+int apply_sb_flags(void *args, int fd, pid_t pid) - { - return userns_mount(NULL, args, fd, pid); - } - --static int mount_root(void *args, int fd, pid_t pid) -+int mount_root(void *args, int fd, pid_t pid) - { - return userns_mount(opts.root, args, fd, pid); - } -@@ -2315,7 +2315,7 @@ static int do_new_mount(struct mount_info *mi) - return 0; - } - --static int restore_ext_mount(struct mount_info *mi) -+int restore_ext_mount(struct mount_info *mi) - { - int ret; - -@@ -2802,10 +2802,6 @@ static int do_umount_one(struct mount_info *mi) - * roots_yard where it will be restored. The remapped mount will be - * moved to the right places after restoring all mounts. - */ -- --static inline int print_ns_root(struct ns_id *ns, int remap_id, char *buf, int bs); --static int get_mp_mountpoint(char *mountpoint, struct mount_info *mi, char *root, int root_len); -- - static LIST_HEAD(mnt_remap_list); - static int remap_id; - -@@ -2904,7 +2900,7 @@ static int fixup_remap_mounts(void) - return 0; - } - --static int cr_pivot_root(char *root) -+int cr_pivot_root(char *root) - { - char tmp_dir_tmpl[] = "crtools-put-root.XXXXXX"; - bool tmp_dir = false; -@@ -3024,7 +3020,7 @@ void mnt_entry_free(struct mount_info *mi) - * Helper for getting a path to where the namespace's root - * is re-constructed. - */ --static inline int print_ns_root(struct ns_id *ns, int remap_id, char *buf, int bs) -+int print_ns_root(struct ns_id *ns, int remap_id, char *buf, int bs) - { - return snprintf(buf, bs, "%s/%d-%010d", mnt_roots, ns->id, remap_id); - } --- -2.35.1 - diff --git a/0213-mount-export-global-variables-for-mount-v2.patch b/0213-mount-export-global-variables-for-mount-v2.patch deleted file mode 100644 index d61ea43..0000000 --- a/0213-mount-export-global-variables-for-mount-v2.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 036a0d6bb99929b836323ec59d851cda5a87cd2c Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Tue, 21 Dec 2021 14:04:19 +0300 -Subject: [PATCH 213/249] mount: export global variables for mount-v2 - -Export root_yard_mp and it's mntns_roots. - -Signed-off-by: Pavel Tikhomirov ---- - criu/include/mount.h | 3 +++ - criu/mount.c | 4 ++-- - 2 files changed, 5 insertions(+), 2 deletions(-) - -diff --git a/criu/include/mount.h b/criu/include/mount.h -index 914024544..c16a5c293 100644 ---- a/criu/include/mount.h -+++ b/criu/include/mount.h -@@ -223,4 +223,7 @@ extern int restore_ext_mount(struct mount_info *mi); - extern int cr_pivot_root(char *root); - extern int print_ns_root(struct ns_id *ns, int remap_id, char *buf, int bs); - -+extern struct mount_info *root_yard_mp; -+extern char *mnt_roots; -+ - #endif /* __CR_MOUNT_H__ */ -diff --git a/criu/mount.c b/criu/mount.c -index 7549284d9..c39b44ac6 100644 ---- a/criu/mount.c -+++ b/criu/mount.c -@@ -37,7 +37,7 @@ - #define CONTEXT_OPT "context=" - - /* A helper mount_info entry for the roots yard */ --static struct mount_info *root_yard_mp = NULL; -+struct mount_info *root_yard_mp = NULL; - - static LIST_HEAD(delayed_unbindable); - -@@ -349,7 +349,7 @@ static bool mounts_equal(struct mount_info *a, struct mount_info *b) - * mnt_roots is a temporary directory for restoring sub-trees of - * non-root namespaces. - */ --static char *mnt_roots; -+char *mnt_roots; - - static struct mount_info *mnt_build_ids_tree(struct mount_info *list) - { --- -2.35.1 - diff --git a/0214-mount-add-new-mounts-v2-engine.patch b/0214-mount-add-new-mounts-v2-engine.patch deleted file mode 100644 index 9f5c3ec..0000000 --- a/0214-mount-add-new-mounts-v2-engine.patch +++ /dev/null @@ -1,1495 +0,0 @@ -From 8127682e59641682e185e05f17b770fbe05d9087 Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Mon, 25 May 2020 18:12:49 +0300 -Subject: [PATCH 214/249] mount: add new mounts-v2 engine - -Design of mounts-v2: - - As a preparation step we classify mounts in groups by (shared_id, - master_id) in new resolve_shared_mounts_v2 (just after reading images). - - New function prepare_mnt_ns_v2 is our main entry point when switching - from old mount engine to new one actually happens. - - First we pre-create each mount namespace nearly empty, only with root - yard in place (pre_create_mount_namespaces). - - We walk the mount tree and mount each mount similar to old mount - engine but not in mount tree but as a sub-directory of root yard - (plain mountpoint) in service (criu) mount namespace. Also we - bind this mount from service mntns to real mntns just after creation. - (do_mount_in_right_mntns) - - Note: this way we initially have the final mount which would be - visible to restored container user with right mnt_id for the sake of - e.g. creating unix sockets on it (for unix socket bindmounts), and - both have copy of the mount in service mntns so that old code which - accesses files on mounts through service mntns still can acces them. - - New can_mount_now_v2 is now free from heuristics we had for restoring - shared groups, we will restore them later via MOVE_MOUNT_SET_GROUP, - for now everything is private. - - Now when all plain mount are created in real mount namespaces, we can - move them to the tree for each namespace. Also we open fds on the - mountpoint: one mp_fd_id before moving and another mnt_fd_id after, - so that we can access each file later from final mntns via those fds. - (assemble_mount_namespaces) - - New restore_mount_sharing_options walks each root sharing group and - their descendants with dfs tree walk. It creates sharing for the first - mount in the sharing group and then sets the same sharing on all other - mounts in this group. - - Sharing creation for fist mount is two step: - - a) If mount has master_id we either copy shared_id from parent sharing - group or from external source and then make mount slave thus - converting it to right master_id. - b) Next if mount has shared_id we just make us shared, creating right - shared_id. - -Cherry-picked from Virtuozzo criu: -https://src.openvz.org/projects/OVZ/repos/criu/commits/596651d02 - -Changes: -- Split all "exporting" to separate preparational patches -- Rework cr_time -- Switch to MOVE_MOUNT_SET_GROUP -- Use resolve_mountpoint for external mounts (for MOVE_MOUNT_SET_GROUP) -- Mounting plain mounts both in service and in restored-final mntns -- Call MOVE_MOUNT_SET_GROUP from usernsd -- Rework can_mount_now_v2 to handle bind of both root and external. -- Use sys_move_mount for mount assembling. - -Signed-off-by: Pavel Tikhomirov ---- - criu/include/mount-v2.h | 35 ++ - criu/include/mount.h | 10 + - criu/mount-v2.c | 1246 +++++++++++++++++++++++++++++++++++++++ - criu/mount.c | 16 + - 4 files changed, 1307 insertions(+) - -diff --git a/criu/include/mount-v2.h b/criu/include/mount-v2.h -index 61f62966d..2f2812221 100644 ---- a/criu/include/mount-v2.h -+++ b/criu/include/mount-v2.h -@@ -4,6 +4,8 @@ - #include "linux/mount.h" - #include "linux/openat2.h" - -+#include "common/list.h" -+ - #include - - #ifndef MOVE_MOUNT_SET_GROUP -@@ -57,4 +59,37 @@ static inline long sys_openat2(int dirfd, const char *pathname, struct open_how - - extern int check_mount_v2(void); - -+struct sharing_group { -+ /* This pair identifies the group */ -+ int shared_id; -+ int master_id; -+ -+ /* List of shared groups */ -+ struct list_head list; -+ -+ /* List of mounts in this group */ -+ struct list_head mnt_list; -+ -+ /* -+ * List of dependant shared groups: -+ * - all siblings have equal master_id -+ * - the parent has shared_id equal to children's master_id -+ * -+ * This is a bit tricky: parent pointer indicates if there is one -+ * parent sharing_group in list or only siblings. -+ * So for traversal if parent pointer is set we can do: -+ * list_for_each_entry(t, &sg->parent->children, siblings) -+ * and overvise we can do: -+ * list_for_each_entry(t, &sg->siblings, siblings) -+ */ -+ struct list_head children; -+ struct list_head siblings; -+ struct sharing_group *parent; -+ -+ char *source; -+}; -+ -+extern int resolve_shared_mounts_v2(void); -+extern int prepare_mnt_ns_v2(void); -+ - #endif /* __CR_MOUNT_V2_H__ */ -diff --git a/criu/include/mount.h b/criu/include/mount.h -index c16a5c293..4d2d64470 100644 ---- a/criu/include/mount.h -+++ b/criu/include/mount.h -@@ -62,7 +62,15 @@ struct mount_info { - */ - char *mountpoint; - char *ns_mountpoint; -+ -+ /* Mount-v2 specific */ - char *plain_mountpoint; -+ int is_dir; -+ int mp_fd_id; -+ int mnt_fd_id; -+ struct sharing_group *sg; -+ struct list_head mnt_sharing; -+ - int fd; - unsigned flags; - unsigned sb_flags; -@@ -79,6 +87,8 @@ struct mount_info { - bool need_plugin; - bool is_ns_root; - bool deleted; -+ int deleted_level; -+ struct list_head deleted_list; - struct mount_info *next; - struct ns_id *nsid; - -diff --git a/criu/mount-v2.c b/criu/mount-v2.c -index 801ade748..ec3965140 100644 ---- a/criu/mount-v2.c -+++ b/criu/mount-v2.c -@@ -1,9 +1,35 @@ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ - #include "kerndat.h" - #include "log.h" -+#include "cr_options.h" -+#include "xmalloc.h" -+#include "util.h" -+#include "filesystems.h" -+#include "mount.h" -+#include "mount-v2.h" -+#include "namespaces.h" -+#include "fs-magic.h" -+#include "path.h" -+#include "files-reg.h" -+#include "fdstore.h" -+#include "common/list.h" -+#include "common/bug.h" -+#include "common/compiler.h" -+ -+#include "images/mnt.pb-c.h" - - #undef LOG_PREFIX - #define LOG_PREFIX "mnt-v2: " - -+LIST_HEAD(sharing_groups); -+ - int check_mount_v2(void) - { - if (!kdat.has_move_mount_set_group) { -@@ -18,3 +44,1223 @@ int check_mount_v2(void) - - return 0; - } -+ -+static struct sharing_group *get_sharing_group(int shared_id, int master_id) -+{ -+ struct sharing_group *sg; -+ -+ list_for_each_entry(sg, &sharing_groups, list) { -+ if (sg->shared_id == shared_id && sg->master_id == master_id) -+ return sg; -+ } -+ -+ return NULL; -+} -+ -+static struct sharing_group *alloc_sharing_group(int shared_id, int master_id) -+{ -+ struct sharing_group *sg; -+ -+ sg = xzalloc(sizeof(struct sharing_group)); -+ if (!sg) -+ return NULL; -+ -+ sg->shared_id = shared_id; -+ sg->master_id = master_id; -+ -+ INIT_LIST_HEAD(&sg->list); -+ INIT_LIST_HEAD(&sg->mnt_list); -+ INIT_LIST_HEAD(&sg->children); -+ INIT_LIST_HEAD(&sg->siblings); -+ -+ list_add(&sg->list, &sharing_groups); -+ -+ return sg; -+} -+ -+int resolve_shared_mounts_v2(void) -+{ -+ struct sharing_group *sg; -+ struct mount_info *mi; -+ -+ /* -+ * Create sharing groups for each unique shared_id+master_id pair and -+ * link each mount to the corresponding sharing group. -+ */ -+ for (mi = mntinfo; mi; mi = mi->next) { -+ if (!mi->shared_id && !mi->master_id) -+ continue; -+ -+ pr_debug("Inspecting sharing on %2d shared_id %d master_id %d (@%s)\n", mi->mnt_id, mi->shared_id, -+ mi->master_id, mi->ns_mountpoint); -+ -+ sg = get_sharing_group(mi->shared_id, mi->master_id); -+ if (!sg) { -+ sg = alloc_sharing_group(mi->shared_id, mi->master_id); -+ if (!sg) -+ return -1; -+ } -+ -+ list_add(&mi->mnt_sharing, &sg->mnt_list); -+ mi->sg = sg; -+ } -+ -+ /* -+ * Collect sharing groups tree. Mount propagation between sharing -+ * groups only goes down this tree, meaning that only mounts of same or -+ * descendant sharing groups recieve mount propagation. -+ */ -+ list_for_each_entry(sg, &sharing_groups, list) { -+ if (sg->master_id) { -+ struct sharing_group *p; -+ -+ /* -+ * Lookup parent sharing group. If one sharing group -+ * has master_id equal to shared_id of another sharing -+ * group than the former is a child (slave) of the -+ * latter. Also sharing groups should not have two -+ * parents so we check this here too. -+ */ -+ list_for_each_entry(p, &sharing_groups, list) { -+ if (p->shared_id != sg->master_id) -+ continue; -+ -+ if (sg->parent) { -+ pr_err("Sharing group (%d, %d) parent collision (%d, %d) (%d, %d)\n", -+ sg->shared_id, sg->master_id, p->shared_id, p->master_id, -+ sg->parent->shared_id, sg->parent->master_id); -+ return -1; -+ } -+ sg->parent = p; -+ -+ if (!list_empty(&sg->siblings)) { -+ pr_err("External slavery sharing group (%d, %d) has parent (%d, %d)\n", -+ sg->shared_id, sg->master_id, p->shared_id, p->master_id); -+ return -1; -+ } -+ list_add(&sg->siblings, &p->children); -+ /* Don't break to check for parent collision */ -+ } -+ -+ /* -+ * If sharing group has master_id but we did't find -+ * parent for it inside the dumped container yet, this -+ * means that the master_id is external and a mount on -+ * host should exist with corresponding shared_id. -+ */ -+ if (!sg->parent && list_empty(&sg->siblings)) { -+ struct mount_info *ext; -+ struct sharing_group *s; -+ char *source = NULL; -+ -+ /* -+ * Though we don't have parent sharing group -+ * (inaccessible sharing), we can still have -+ * siblings, sharing groups with same master_id -+ * but different shared_id, let's collect them -+ * to the list. -+ */ -+ list_for_each_entry(s, &sharing_groups, list) { -+ if (s->master_id != sg->master_id) -+ continue; -+ -+ if (s->parent) { -+ pr_err("External slavery sharing group (%d, %d) has parent (%d, %d)\n", -+ sg->shared_id, sg->master_id, s->parent->shared_id, -+ s->parent->master_id); -+ return -1; -+ } -+ -+ if (!list_empty(&s->siblings)) { -+ pr_err("External slavery sharing group collision (%d, %d) (%d, %d)\n", -+ sg->shared_id, sg->master_id, s->shared_id, s->master_id); -+ return -1; -+ } -+ list_add(&s->siblings, &sg->siblings); -+ } -+ -+ BUG_ON(list_empty(&sg->mnt_list)); -+ mi = list_entry(sg->mnt_list.next, struct mount_info, mnt_sharing); -+ -+ /* -+ * We need to know from which mount on host we -+ * can get this external master_id. There are -+ * two options: mountpoint external mount or -+ * root mount of container. -+ */ -+ if ((ext = mnt_get_external_bind_nodev(mi))) -+ source = ext->external; -+ else if (mnt_is_root_bind(mi)) -+ source = opts.root; -+ -+ if (!source) { -+ pr_err("Sharing group (%d, %d) " -+ "has unreachable sharing. Try --enable-external-masters.\n", -+ sg->shared_id, sg->master_id); -+ return -1; -+ } -+ -+ sg->source = source; -+ list_for_each_entry(s, &sg->siblings, siblings) -+ s->source = sg->source; -+ -+ pr_debug("Detected external slavery for shared group (%d, %d) with source %s\n", -+ sg->shared_id, sg->master_id, source); -+ } -+ } -+ } -+ -+ return 0; -+} -+ -+/* -+ * When first mount from superblock is mounted, give other mounts -+ * a hint that they can now just bindmount from the first one. -+ */ -+static int propagate_mount_v2(struct mount_info *mi) -+{ -+ struct mount_info *t; -+ -+ list_for_each_entry(t, &mi->mnt_bind, mnt_bind) { -+ if (t->mounted) -+ continue; -+ if (t->bind) -+ continue; -+ if (!issubpath(t->root, mi->root)) -+ continue; -+ pr_debug("\t\tPropagate %d to %d\n", mi->mnt_id, t->mnt_id); -+ t->bind = mi; -+ t->s_dev_rt = mi->s_dev_rt; -+ } -+ -+ return 0; -+} -+ -+/* -+ * Mounts first mount of superblock -+ */ -+static int do_new_mount_v2(struct mount_info *mi) -+{ -+ unsigned long sflags = mi->sb_flags; -+ unsigned long mflags = mi->flags & (~MS_PROPAGATE); -+ char *src; -+ struct fstype *tp = mi->fstype; -+ bool remount_ro = (tp->restore && mi->sb_flags & MS_RDONLY); -+ mount_fn_t do_mount = (tp->mount) ? tp->mount : do_simple_mount; -+ -+ src = resolve_source(mi); -+ if (!src) -+ return -1; -+ -+ /* Merge superblock and mount flags if it's possible */ -+ if (!(mflags & ~MS_MNT_KNOWN_FLAGS) && !((sflags ^ mflags) & MS_RDONLY)) { -+ sflags |= mflags; -+ mflags = 0; -+ } -+ -+ if (remount_ro) -+ sflags &= ~MS_RDONLY; -+ -+ if (do_mount(mi, src, mnt_fsname(mi), sflags) < 0) { -+ pr_perror("Can't mount at %s", mi->plain_mountpoint); -+ return -1; -+ } -+ -+ /* -+ * Mount-v2 relies that before mount tree is constructed all mounts -+ * should remain private. Newly created mounts can become non-private -+ * initially depending on parent/source sharing, let's be as explicit -+ * as posible here and make it obvious that mount becomes private. -+ */ -+ if (mount(NULL, mi->plain_mountpoint, NULL, MS_PRIVATE, NULL)) { -+ pr_perror("Can't remount %s with MS_PRIVATE", mi->plain_mountpoint); -+ return -1; -+ } -+ -+ if (tp->restore && tp->restore(mi)) -+ return -1; -+ -+ if (remount_ro) { -+ int fd; -+ -+ fd = open(mi->plain_mountpoint, O_PATH); -+ if (fd < 0) { -+ pr_perror("Unable to open %s", mi->plain_mountpoint); -+ return -1; -+ } -+ sflags |= MS_RDONLY | MS_REMOUNT; -+ if (userns_call(apply_sb_flags, 0, &sflags, sizeof(sflags), fd)) { -+ pr_perror("Unable to apply mount flags %d for %s", mi->sb_flags, mi->plain_mountpoint); -+ close(fd); -+ return -1; -+ } -+ close(fd); -+ } -+ -+ if (mflags && mount(NULL, mi->plain_mountpoint, NULL, MS_REMOUNT | MS_BIND | mflags, NULL)) { -+ pr_perror("Unable to apply bind-mount options"); -+ return -1; -+ } -+ -+ mi->mounted = true; -+ return 0; -+} -+ -+/* -+ * Does simple bindmount, but via new kernel mount api, -+ * which also handles autofs and symlink without resolving. -+ */ -+static int __do_bind_mount_v2(char *from, char *to) -+{ -+ int detached_fd; -+ -+ detached_fd = sys_open_tree(AT_FDCWD, from, AT_NO_AUTOMOUNT | AT_SYMLINK_NOFOLLOW | OPEN_TREE_CLONE); -+ if (detached_fd == -1) { -+ pr_perror("Failed to open_tree %s", from); -+ return -1; -+ } -+ -+ if (sys_move_mount(detached_fd, "", AT_FDCWD, to, MOVE_MOUNT_F_EMPTY_PATH)) { -+ pr_perror("Failed to move_mount from %s to %s", from, to); -+ close(detached_fd); -+ return -1; -+ } -+ close(detached_fd); -+ -+ return 0; -+} -+ -+LIST_HEAD(deleted_mounts); -+ -+/* -+ * Bind-mounts all later mounts of superblock from first one, -+ * also handles first mounts of mountpoint external mounts. -+ */ -+static int do_bind_mount_v2(struct mount_info *mi) -+{ -+ char *root = NULL, *cut_root, rpath[PATH_MAX]; -+ unsigned long mflags; -+ int exit_code = -1; -+ char *mnt_path = NULL; -+ int level = 0; -+ -+ if (mi->need_plugin) { -+ if (restore_ext_mount(mi)) -+ return -1; -+ goto out; -+ } -+ -+ if (mnt_is_nodev_external(mi)) { -+ root = mi->external; -+ goto do_bind; -+ } -+ -+ cut_root = get_relative_path(mi->root, mi->bind->root); -+ if (!cut_root) { -+ pr_err("Failed to find root for %d in our supposed bind %d\n", mi->mnt_id, mi->bind->mnt_id); -+ return -1; -+ } -+ -+ /* -+ * Mount ->private can be initialized on fstype->mount() callback, -+ * which is called for first mount of superblock in do_new_mount(). -+ * Also ->private have to be copied to all other mounts of superblock -+ * to provide users of it with actual data. -+ */ -+ mi->private = mi->bind->private; -+ -+ mnt_path = mi->bind->plain_mountpoint; -+ -+ if (cut_root[0]) { -+ snprintf(rpath, sizeof(rpath), "%s/%s", mnt_path, cut_root); -+ root = rpath; -+ } else { -+ root = mnt_path; -+ } -+do_bind: -+ pr_info("\tBind %s to %s\n", root, mi->plain_mountpoint); -+ -+ if (unlikely(mi->deleted)) { -+ level = make_parent_dirs_if_need(-1, root); -+ if (level < 0) -+ goto err; -+ -+ if (mi->is_dir) { -+ if (mkdir(root, 0600)) { -+ pr_perror("Can't re-create deleted directory %s", root); -+ goto err; -+ } -+ } else { -+ int fd = open(root, O_WRONLY | O_CREAT | O_EXCL, 0600); -+ if (fd < 0) { -+ pr_perror("Can't re-create deleted file %s", root); -+ goto err; -+ } -+ close(fd); -+ } -+ } -+ -+ if (__do_bind_mount_v2(root, mi->plain_mountpoint)) -+ goto err; -+ -+ /* -+ * Mount-v2 relies that before mount tree is constructed all mounts -+ * should remain private. Newly created mounts can become non-private -+ * initially depending on parent/source sharing, let's be as explicit -+ * as posible here and make it obvious that mount becomes private. -+ */ -+ if (mount(NULL, mi->plain_mountpoint, NULL, MS_PRIVATE, NULL)) { -+ pr_perror("Can't remount %s with MS_PRIVATE", mi->plain_mountpoint); -+ goto err; -+ } -+ -+ mflags = mi->flags & (~MS_PROPAGATE); -+ if (!mi->bind || mflags != (mi->bind->flags & (~MS_PROPAGATE))) -+ if (mount(NULL, mi->plain_mountpoint, NULL, MS_BIND | MS_REMOUNT | mflags, NULL)) { -+ pr_perror("Can't bind remount 0x%lx at %s", mflags, mi->plain_mountpoint); -+ goto err; -+ } -+ -+ if (mi->deleted) { -+ /* -+ * Deleted mounts can't be moved, will delete source after -+ * moving to proper position in the mount tree FIXME. -+ */ -+ mi->deleted_level = level; -+ level = 0; -+ list_add(&mi->deleted_list, &deleted_mounts); -+ } -+out: -+ mi->mounted = true; -+ exit_code = 0; -+err: -+ if (level) -+ rm_parent_dirs(-1, root, level); -+ -+ return exit_code; -+} -+ -+/* Mounts root container mount. */ -+static int do_mount_root_v2(struct mount_info *mi) -+{ -+ unsigned long flags = MS_BIND; -+ int fd; -+ -+ if (root_ns_mask & CLONE_NEWUSER) { -+ fd = open(mi->plain_mountpoint, O_PATH); -+ if (fd < 0) { -+ pr_perror("Unable to open %s", mi->plain_mountpoint); -+ return -1; -+ } -+ -+ if (userns_call(mount_root, 0, &flags, sizeof(flags), fd)) { -+ pr_err("Unable to mount %s\n", mi->plain_mountpoint); -+ close(fd); -+ return -1; -+ } -+ close(fd); -+ } else { -+ if (mount(opts.root, mi->plain_mountpoint, NULL, flags, NULL)) { -+ pr_perror("Unable to mount %s %s (id=%d)", opts.root, mi->plain_mountpoint, mi->mnt_id); -+ return -1; -+ } -+ } -+ -+ /* -+ * Mount-v2 relies that before mount tree is constructed all mounts -+ * should remain private. Newly created mounts can become non-private -+ * initially depending on parent/source sharing, let's be as explicit -+ * as posible here and make it obvious that mount becomes private. -+ */ -+ if (mount(NULL, mi->plain_mountpoint, NULL, MS_PRIVATE, NULL)) { -+ pr_perror("Can't remount %s with MS_PRIVATE", mi->plain_mountpoint); -+ return -1; -+ } -+ -+ mi->mounted = true; -+ -+ return 0; -+} -+ -+/* Check if mount is ready to be mounted. */ -+static bool can_mount_now_v2(struct mount_info *mi) -+{ -+ struct mount_info *root, *ext; -+ -+ /* Parent should be mounted already, that's how mnt_tree_for_each works */ -+ BUG_ON(mi->parent && !mi->parent->mounted); -+ -+ /* Root mounts can be mounted at any moment */ -+ if (rst_mnt_is_root(mi)) { -+ pr_debug("%s: true as %d is global root\n", __func__, mi->mnt_id); -+ return true; -+ } -+ -+ /* External mounts can be mounted at any moment */ -+ if (mi->external) { -+ pr_debug("%s: true as %d is external\n", __func__, mi->mnt_id); -+ return true; -+ } -+ -+ /* -+ * Container root and external mounts should go before -+ * anything which should be bindmounted from them. -+ */ -+ if (!mi->bind) { -+ root = mnt_get_root_bind(mi); -+ if (root) { -+ pr_debug("%s: false as %d is bind of not mounted global root %d\n", __func__, mi->mnt_id, -+ root->mnt_id); -+ return false; -+ } -+ -+ ext = mnt_get_external_bind(mi); -+ if (ext) { -+ pr_debug("%s: false as %d is a bind of not mounted external %d\n", __func__, mi->mnt_id, -+ ext->mnt_id); -+ return false; -+ } -+ } -+ -+ /* Non fsroot mounts can not be mounted without bind-mount */ -+ if (!fsroot_mounted(mi) && !mi->bind && !mi->need_plugin) { -+ pr_debug("%s: false as %d is non-root without bind or plugin\n", __func__, mi->mnt_id); -+ return false; -+ } -+ -+ return true; -+} -+ -+static int __set_unbindable_v2(struct mount_info *mi) -+{ -+ if (mi->flags & MS_UNBINDABLE) { -+ if (mount(NULL, service_mountpoint(mi), NULL, MS_UNBINDABLE, NULL)) { -+ pr_perror("Failed to set mount %d unbindable", mi->mnt_id); -+ return -1; -+ } -+ } -+ return 0; -+} -+ -+/* -+ * Setting MS_UNBINDABLE flag is slightly delayed, -+ * obviousely until we finish bind-mounting everything. -+ */ -+static int set_unbindable_v2(void) -+{ -+ int orig_nsfd = -1, nsfd = -1, exit_code = -1; -+ struct mount_info *mi; -+ struct ns_id *nsid; -+ -+ for (nsid = ns_ids; nsid != NULL; nsid = nsid->next) { -+ bool ns_has_unbindable = false; -+ -+ if (nsid->nd != &mnt_ns_desc) -+ continue; -+ -+ for (mi = mntinfo; mi != NULL; mi = mi->next) -+ if (mi->nsid == nsid && mi->flags & MS_UNBINDABLE) -+ ns_has_unbindable = true; -+ -+ if (!ns_has_unbindable) -+ continue; -+ -+ nsfd = fdstore_get(nsid->mnt.nsfd_id); -+ if (nsfd < 0) -+ goto err; -+ -+ if (switch_ns_by_fd(nsfd, &mnt_ns_desc, orig_nsfd == -1 ? &orig_nsfd : NULL)) -+ goto err; -+ close_safe(&nsfd); -+ -+ if (mnt_tree_for_each(nsid->mnt.mntinfo_tree, __set_unbindable_v2)) -+ goto err; -+ } -+ -+ exit_code = 0; -+err: -+ if (orig_nsfd >= 0 && restore_ns(orig_nsfd, &mnt_ns_desc)) -+ exit_code = -1; -+ close_safe(&nsfd); -+ return exit_code; -+} -+ -+/* -+ * Detects if mount is a directory mount or file mount based on stat on -+ * its mountpoint inside already mounted parent mount. This is deeply -+ * integrated in plain mount creation process because before mounting -+ * something plain we need to create right type of mountpoint for it. -+ */ -+static int detect_is_dir(struct mount_info *mi) -+{ -+ static char mountpoint[PATH_MAX]; -+ char *rel_path; -+ struct stat st; -+ -+ if (mi->is_dir != -1) -+ return 0; -+ -+ if (mi->mnt_id == HELPER_MNT_ID) { -+ pr_err("Helper %s should have is_dir pre-set\n", mi->ns_mountpoint); -+ return -1; -+ } -+ -+ if (!mi->parent || mi->parent == root_yard_mp) { -+ pr_err("Mount namespace root mount %d should have is_dir pre-set\n", mi->mnt_id); -+ return -1; -+ } -+ -+ if (!mi->parent->mounted) { -+ pr_err("Parent mount %d of %d should be mounted\n", mi->parent->mnt_id, mi->mnt_id); -+ return -1; -+ } -+ -+ rel_path = get_relative_path(mi->ns_mountpoint, mi->parent->ns_mountpoint); -+ if (!rel_path) { -+ pr_err("Child-parent mountpoint missmatch %d:%s %d:%s\n", mi->mnt_id, mi->ns_mountpoint, -+ mi->parent->mnt_id, mi->parent->ns_mountpoint); -+ return -1; -+ } -+ -+ snprintf(mountpoint, sizeof(mountpoint), "%s%s%s", mi->parent->plain_mountpoint, rel_path[0] ? "/" : "", -+ rel_path); -+ if (stat(mountpoint, &st)) { -+ pr_perror("Can't stat mountpoint %s", mountpoint); -+ return -1; -+ } -+ -+ if (S_ISDIR(st.st_mode)) -+ mi->is_dir = true; -+ else -+ mi->is_dir = false; -+ -+ pr_debug("Mount %d is detected as %s-mount\n", mi->mnt_id, mi->is_dir ? "dir" : "file"); -+ return 0; -+} -+ -+static int create_plain_mountpoint(struct mount_info *mi) -+{ -+ BUG_ON(mi->is_dir == -1); -+ -+ pr_debug("Create plain mountpoint %s for %d\n", mi->plain_mountpoint, mi->mnt_id); -+ if (mi->is_dir) { -+ if (mkdir(mi->plain_mountpoint, 0600)) { -+ pr_perror("Unable to mkdir mountpoint %s", mi->plain_mountpoint); -+ return -1; -+ } -+ } else { -+ int fd; -+ -+ fd = creat(mi->plain_mountpoint, 0600); -+ if (fd < 0) { -+ pr_perror("Unable to create mountpoint %s", mi->plain_mountpoint); -+ return -1; -+ } -+ close(fd); -+ } -+ -+ return 0; -+} -+ -+/* -+ * At this point we already have a mount in service mount namespace now we -+ * bind-mount it to the final restored mount namespace via new kernel mount -+ * API. -+ */ -+static int do_mount_in_right_mntns(struct mount_info *mi) -+{ -+ int nsfd = -1, orig_nsfd = -1, detached_fd = -1, exit_code = -1; -+ -+ if (!mi->nsid) -+ return 0; -+ -+ detached_fd = -+ sys_open_tree(AT_FDCWD, mi->plain_mountpoint, AT_NO_AUTOMOUNT | AT_SYMLINK_NOFOLLOW | OPEN_TREE_CLONE); -+ if (detached_fd == -1) { -+ pr_perror("Failed to open_tree %s", mi->plain_mountpoint); -+ goto err; -+ } -+ -+ nsfd = fdstore_get(mi->nsid->mnt.nsfd_id); -+ if (nsfd < 0) -+ goto err; -+ -+ if (switch_ns_by_fd(nsfd, &mnt_ns_desc, &orig_nsfd)) -+ goto err; -+ -+ if (create_plain_mountpoint(mi)) -+ goto err; -+ -+ if (sys_move_mount(detached_fd, "", AT_FDCWD, mi->plain_mountpoint, MOVE_MOUNT_F_EMPTY_PATH)) { -+ pr_perror("Failed to cross-mntns move_mount plain mount %d", mi->mnt_id); -+ goto err; -+ } -+ -+ exit_code = 0; -+err: -+ if (orig_nsfd >= 0 && restore_ns(orig_nsfd, &mnt_ns_desc)) -+ exit_code = -1; -+ close_safe(&nsfd); -+ close_safe(&detached_fd); -+ return exit_code; -+} -+ -+static int do_mount_one_v2(struct mount_info *mi) -+{ -+ int ret; -+ -+ if (mi->mounted) -+ return 0; -+ -+ if (!can_mount_now_v2(mi)) { -+ pr_debug("Postpone mount %d\n", mi->mnt_id); -+ return 1; -+ } -+ -+ if (detect_is_dir(mi)) -+ return -1; -+ -+ if (create_plain_mountpoint(mi)) -+ return -1; -+ -+ pr_debug("\tMounting %s @%d (%d)\n", mi->fstype->name, mi->mnt_id, mi->need_plugin); -+ -+ if (rst_mnt_is_root(mi)) { -+ if (opts.root == NULL) { -+ pr_err("The --root option is required to restore a mount namespace\n"); -+ return -1; -+ } -+ ret = do_mount_root_v2(mi); -+ } else if (!mi->bind && !mi->need_plugin && (!mi->external || !strcmp(mi->external, EXTERNAL_DEV_MOUNT))) { -+ ret = do_new_mount_v2(mi); -+ } else { -+ ret = do_bind_mount_v2(mi); -+ } -+ -+ if (ret == 0 && fetch_rt_stat(mi, mi->plain_mountpoint)) -+ return -1; -+ -+ if (ret == 0 && propagate_mount_v2(mi)) -+ return -1; -+ -+ if (mi->fstype->code == FSTYPE__UNSUPPORTED) { -+ struct statfs st; -+ -+ if (statfs(mi->plain_mountpoint, &st)) { -+ pr_perror("Unable to statfs %s", mi->plain_mountpoint); -+ return -1; -+ } -+ if (st.f_type == BTRFS_SUPER_MAGIC) -+ mi->fstype = find_fstype_by_name("btrfs"); -+ } -+ -+ if (ret == 0 && do_mount_in_right_mntns(mi)) -+ return -1; -+ -+ return ret; -+} -+ -+static int populate_mnt_ns_v2(void) -+{ -+ if (make_yard(mnt_roots)) -+ return -1; -+ -+ if (mnt_tree_for_each(root_yard_mp, do_mount_one_v2)) -+ return -1; -+ -+ return set_unbindable_v2(); -+} -+ -+/* -+ * This function moves plain mounts into actual mount tree. -+ * -+ * Mounts in children list are sorted the way that sibling overmount goes after -+ * all siblings which it overmounts (see __mnt_resort_children). The function -+ * mnt_tree_for_each is effectively DFS (in case we don't postpone), thus all -+ * descendants of all mounts which we sibling-overmount are mounted before us. -+ * Be carefull, we can't postpone (return >0) from this function because of it. -+ */ -+static int move_mount_to_tree(struct mount_info *mi) -+{ -+ int fd; -+ -+ fd = open(mi->mountpoint, O_PATH); -+ if (fd < 0) { -+ pr_perror("Failed to open real mountpoint of %d", mi->mnt_id); -+ return -1; -+ } -+ -+ mi->mp_fd_id = fdstore_add(fd); -+ close(fd); -+ if (mi->mp_fd_id < 0) { -+ pr_err("Can't add mountpoint of mount %d to fdstore\n", mi->mnt_id); -+ return -1; -+ } -+ -+ pr_info("Move mount %d from %s to %s\n", mi->mnt_id, mi->plain_mountpoint, mi->mountpoint); -+ if (sys_move_mount(AT_FDCWD, mi->plain_mountpoint, AT_FDCWD, mi->mountpoint, 0)) { -+ pr_perror("Failed to move mount %d from %s to %s", mi->mnt_id, mi->plain_mountpoint, mi->mountpoint); -+ return -1; -+ } -+ -+ fd = open(mi->mountpoint, O_PATH); -+ if (fd < 0) { -+ pr_perror("Failed to open real mountpoint of %d", mi->mnt_id); -+ return -1; -+ } -+ -+ mi->mnt_fd_id = fdstore_add(fd); -+ close(fd); -+ if (mi->mnt_fd_id < 0) { -+ pr_err("Can't add mount %d fd to fdstore\n", mi->mnt_id); -+ return -1; -+ } -+ -+ return 0; -+} -+ -+static int assemble_tree_from_plain_mounts(struct ns_id *nsid) -+{ -+ return mnt_tree_for_each(nsid->mnt.mntinfo_tree, move_mount_to_tree); -+} -+ -+/* -+ * With MOVE_MOUNT_SET_GROUP source mount should have wider root than -+ * destination, thus let's choose widest mount from group as first. -+ */ -+static struct mount_info *get_first_mount(struct sharing_group *sg) -+{ -+ struct mount_info *first = NULL, *tmp; -+ int min_len = 0; -+ -+ list_for_each_entry(tmp, &sg->mnt_list, mnt_sharing) { -+ int len = strlen(tmp->root); -+ -+ if (!first || len < min_len) { -+ first = tmp; -+ min_len = len; -+ } -+ } -+ -+ return first; -+} -+ -+struct set_group_arg { -+ int src_id; -+ char source[PATH_MAX]; -+ int dst_id; -+}; -+ -+static int __move_mount_set_group(void *arg, int dfd, int pid) -+{ -+ struct set_group_arg *sga = (struct set_group_arg *)arg; -+ int src_fd, dst_fd, exit_code = -1; -+ -+ if (sga->src_id != -1) { -+ src_fd = fdstore_get(sga->src_id); -+ BUG_ON(src_fd < 0); -+ } else { -+ char *source_mp; -+ -+ BUG_ON(sga->source[0] == '\0'); -+ /* -+ * Source path should not always be a mountpoint as we -+ * automatically resolve it to mountpoint below. -+ */ -+ source_mp = resolve_mountpoint(sga->source); -+ if (!source_mp) { -+ pr_err("Failed to find %s mountpoint\n", sga->source); -+ return -1; -+ } -+ -+ src_fd = open(source_mp, O_PATH); -+ if (src_fd < 0) { -+ pr_perror("Failed to open %s mountpoint", source_mp); -+ xfree(source_mp); -+ return -1; -+ } -+ xfree(source_mp); -+ } -+ -+ dst_fd = fdstore_get(sga->dst_id); -+ BUG_ON(dst_fd < 0); -+ -+ /* Copy shared_id of the source */ -+ if (sys_move_mount(src_fd, "", dst_fd, "", -+ MOVE_MOUNT_SET_GROUP | MOVE_MOUNT_F_EMPTY_PATH | MOVE_MOUNT_T_EMPTY_PATH)) { -+ pr_perror("Failed to copy sharing from %d:%s to %d", sga->src_id, sga->source ?: "", sga->dst_id); -+ goto err; -+ } -+ -+ exit_code = 0; -+err: -+ close(src_fd); -+ close(dst_fd); -+ return exit_code; -+} -+ -+/* -+ * Copy sharing between mounts passing mountpoint fds via fdstore ids. Also it -+ * is possible (for external mounts) to pass path on mountpoint via source path, -+ * it would resolve to mountpoint automatically. -+ */ -+static int move_mount_set_group(int src_id, char *source, int dst_id) -+{ -+ struct set_group_arg sga = { -+ .src_id = src_id, -+ .dst_id = dst_id, -+ }; -+ -+ sga.source[0] = '\0'; -+ if (source) { -+ if (snprintf(sga.source, sizeof(sga.source), "%s", source) >= sizeof(sga.source)) { -+ pr_err("Source %s is too long\n", source); -+ return -1; -+ } -+ } -+ -+ if (userns_call(__move_mount_set_group, 0, &sga, sizeof(sga), -1)) -+ return -1; -+ -+ return 0; -+} -+ -+static int restore_one_sharing_group(struct sharing_group *sg) -+{ -+ struct mount_info *first, *other; -+ char first_path[PATH_MAX]; -+ int first_fd; -+ -+ first = get_first_mount(sg); -+ first_fd = fdstore_get(first->mnt_fd_id); -+ BUG_ON(first_fd < 0); -+ snprintf(first_path, sizeof(first_path), "/proc/self/fd/%d", first_fd); -+ -+ /* Restore first's master_id from shared_id of the source */ -+ if (sg->master_id) { -+ if (sg->parent) { -+ struct mount_info *p; -+ -+ /* Get shared_id from parent sharing group */ -+ p = get_first_mount(sg->parent); -+ if (move_mount_set_group(p->mnt_fd_id, NULL, first->mnt_fd_id)) { -+ pr_err("Failed to copy sharing from %d to %d\n", p->mnt_id, first->mnt_id); -+ close(first_fd); -+ return -1; -+ } -+ } else { -+ /* -+ * External slavery. We rely on the user to give us the -+ * right source for external mount with all proper -+ * sharing optioins setup (it should be either shared -+ * or non-shared slave). If source is a private mount -+ * we would fail. -+ */ -+ if (move_mount_set_group(-1, sg->source, first->mnt_fd_id)) { -+ pr_err("Failed to copy sharing from source %s to %d\n", sg->source, first->mnt_id); -+ close(first_fd); -+ return -1; -+ } -+ } -+ -+ /* Convert shared_id to master_id */ -+ if (mount(NULL, first_path, NULL, MS_SLAVE, NULL)) { -+ pr_perror("Failed to make mount %d slave", first->mnt_id); -+ close(first_fd); -+ return -1; -+ } -+ } -+ -+ /* Restore first's shared_id */ -+ if (sg->shared_id) { -+ if (mount(NULL, first_path, NULL, MS_SHARED, NULL)) { -+ pr_perror("Failed to make mount %d shared", first->mnt_id); -+ close(first_fd); -+ return -1; -+ } -+ } -+ close(first_fd); -+ -+ /* Restore sharing for other mounts from the sharing group */ -+ list_for_each_entry(other, &sg->mnt_list, mnt_sharing) { -+ if (other == first) -+ continue; -+ -+ if (move_mount_set_group(first->mnt_fd_id, NULL, other->mnt_fd_id)) { -+ pr_err("Failed to copy sharing from %d to %d\n", first->mnt_id, other->mnt_id); -+ return -1; -+ } -+ } -+ -+ return 0; -+} -+ -+static struct sharing_group *sharing_group_next(struct sharing_group *sg) -+{ -+ if (!list_empty(&sg->children)) -+ return list_entry(sg->children.next, struct sharing_group, siblings); -+ -+ while (sg->parent) { -+ if (sg->siblings.next == &sg->parent->children) -+ sg = sg->parent; -+ else -+ return list_entry(sg->siblings.next, struct sharing_group, siblings); -+ } -+ -+ return NULL; -+} -+ -+static int restore_mount_sharing_options(void) -+{ -+ struct sharing_group *sg; -+ -+ list_for_each_entry(sg, &sharing_groups, list) { -+ struct sharing_group *t; -+ -+ if (sg->parent) -+ continue; -+ -+ /* Handle dependant sharing groups in tree order */ -+ for (t = sg; t != NULL; t = sharing_group_next(t)) { -+ if (restore_one_sharing_group(t)) -+ return -1; -+ } -+ } -+ -+ return 0; -+} -+ -+static int remove_source_of_deleted_mount(struct mount_info *mi) -+{ -+ char *cut_root, path[PATH_MAX], *root; -+ -+ BUG_ON(!mi->deleted || !mi->bind); -+ -+ cut_root = get_relative_path(mi->root, mi->bind->root); -+ if (!cut_root) { -+ pr_err("Failed to find root for %d in our supposed bind %d\n", mi->mnt_id, mi->bind->mnt_id); -+ return -1; -+ } -+ -+ if (cut_root[0]) { -+ snprintf(path, sizeof(path), "%s/%s", mi->bind->plain_mountpoint, cut_root); -+ root = path; -+ } else { -+ root = mi->bind->plain_mountpoint; -+ } -+ -+ if (mi->is_dir) { -+ if (rmdir(root)) { -+ pr_perror("Can't remove deleted directory %s", root); -+ return -1; -+ } -+ } else { -+ if (unlink(root)) { -+ pr_perror("Can't unlink deleted file %s", root); -+ return -1; -+ } -+ } -+ -+ if (mi->deleted_level) -+ rm_parent_dirs(-1, root, mi->deleted_level); -+ -+ return 0; -+} -+ -+/* Delay making mounts deleted until we've restored sharing groups */ -+static int remove_sources_of_deleted_mounts(void) -+{ -+ struct mount_info *mi; -+ int ret = 0; -+ -+ list_for_each_entry(mi, &deleted_mounts, deleted_list) { -+ if (remove_source_of_deleted_mount(mi)) -+ ret = -1; -+ } -+ -+ return ret; -+} -+ -+static int get_empty_mntns(void) -+{ -+ int orig_nsfd, nsfd = -1; -+ -+ orig_nsfd = open_proc(PROC_SELF, "ns/mnt"); -+ if (orig_nsfd < 0) -+ return -1; -+ -+ /* Create the new mount namespace */ -+ if (unshare(CLONE_NEWNS)) { -+ pr_perror("Unable to create a new mntns"); -+ close(orig_nsfd); -+ return -1; -+ } -+ -+ if (mount("none", "/", NULL, MS_REC | MS_PRIVATE, NULL)) { -+ pr_perror("Can't remount \"/\" with MS_PRIVATE"); -+ goto err; -+ } -+ -+ if (make_yard(mnt_roots)) -+ goto err; -+ -+ if (cr_pivot_root(mnt_roots)) -+ goto err; -+ -+ if (mkdirpat(AT_FDCWD, mnt_roots, 0777)) { -+ pr_err("Failed to setup root yard in empty mntns\n"); -+ goto err; -+ } -+ -+ nsfd = open_proc(PROC_SELF, "ns/mnt"); -+err: -+ if (restore_ns(orig_nsfd, &mnt_ns_desc)) -+ close_safe(&nsfd); -+ return nsfd; -+} -+ -+/* Create almost empty mount namespaces only with root yard precreated */ -+static int pre_create_mount_namespaces(void) -+{ -+ int orig_nsfd = -1, nsfd = -1, empty_mntns, exit_code = -1; -+ char path[PATH_MAX]; -+ struct ns_id *nsid; -+ -+ empty_mntns = get_empty_mntns(); -+ if (empty_mntns == -1) { -+ pr_err("Failed to create empty mntns\n"); -+ goto err; -+ } -+ -+ /* restore mount namespaces */ -+ for (nsid = ns_ids; nsid != NULL; nsid = nsid->next) { -+ if (nsid->nd != &mnt_ns_desc) -+ continue; -+ -+ if (switch_ns_by_fd(empty_mntns, &mnt_ns_desc, orig_nsfd == -1 ? &orig_nsfd : NULL)) -+ goto err; -+ -+ /* Create the new mount namespace */ -+ if (unshare(CLONE_NEWNS)) { -+ pr_perror("Unable to create a new mntns"); -+ goto err; -+ } -+ -+ nsfd = open_proc(PROC_SELF, "ns/mnt"); -+ if (nsfd < 0) -+ goto err; -+ -+ /* Pin new mntns with a file descriptor */ -+ nsid->mnt.nsfd_id = fdstore_add(nsfd); -+ close(nsfd); -+ if (nsid->mnt.nsfd_id < 0) { -+ pr_err("Can't add mntns fd to fdstore\n"); -+ goto err; -+ } -+ -+ if (make_yard(mnt_roots)) -+ goto err; -+ -+ print_ns_root(nsid, 0, path, sizeof(path)); -+ if (mkdir(path, 0600)) { -+ pr_perror("Unable to create %s", path); -+ goto err; -+ } -+ } -+ -+ exit_code = 0; -+err: -+ if (orig_nsfd >= 0 && restore_ns(orig_nsfd, &mnt_ns_desc)) -+ exit_code = -1; -+ close_safe(&empty_mntns); -+ return exit_code; -+} -+ -+/* -+ * Assemble the mount tree for each restored mount namespace -+ * from pre-created plain mounts. -+ */ -+static int assemble_mount_namespaces(void) -+{ -+ int orig_nsfd = -1, nsfd = -1, rootfd = -1, exit_code = -1; -+ char path[PATH_MAX]; -+ struct ns_id *nsid; -+ -+ for (nsid = ns_ids; nsid != NULL; nsid = nsid->next) { -+ if (nsid->nd != &mnt_ns_desc) -+ continue; -+ -+ nsfd = fdstore_get(nsid->mnt.nsfd_id); -+ if (nsfd < 0) -+ goto err; -+ -+ if (switch_ns_by_fd(nsfd, &mnt_ns_desc, orig_nsfd == -1 ? &orig_nsfd : NULL)) { -+ close(nsfd); -+ goto err; -+ } -+ close(nsfd); -+ -+ if (assemble_tree_from_plain_mounts(nsid)) -+ goto err; -+ -+ /* Set its root */ -+ print_ns_root(nsid, 0, path, sizeof(path) - 1); -+ if (cr_pivot_root(path)) -+ goto err; -+ -+ /* root fd is used to restore file mappings */ -+ rootfd = open_proc(PROC_SELF, "root"); -+ if (rootfd < 0) -+ goto err; -+ nsid->mnt.root_fd_id = fdstore_add(rootfd); -+ if (nsid->mnt.root_fd_id < 0) { -+ pr_err("Can't add root fd to fdstore\n"); -+ close(rootfd); -+ goto err; -+ } -+ close(rootfd); -+ } -+ -+ exit_code = 0; -+err: -+ if (orig_nsfd >= 0 && restore_ns(orig_nsfd, &mnt_ns_desc)) -+ exit_code = -1; -+ return exit_code; -+} -+ -+/* The main entry point of mount-v2 for creating mounts */ -+int prepare_mnt_ns_v2(void) -+{ -+ if (!(root_ns_mask & CLONE_NEWNS)) -+ return 0; -+ -+#ifdef CONFIG_BINFMT_MISC_VIRTUALIZED -+ if (!opts.has_binfmt_misc && !list_empty(&binfmt_misc_list)) { -+ /* -+ * Add to root yard along with other plain mounts and mntns -+ * directories. This mount would be created and restored by -+ * generic mount creation code, but it would never be moved to -+ * any restored mount namespaces. -+ */ -+ if (!add_cr_time_mount(root_yard_mp, "binfmt_misc", "binfmt_misc", 0, true)) -+ return -1; -+ } -+#endif -+ -+ if (validate_mounts(mntinfo, false)) -+ return -1; -+ -+ if (pre_create_mount_namespaces()) -+ return -1; -+ -+ if (populate_mnt_ns_v2()) -+ return -1; -+ -+ if (assemble_mount_namespaces()) -+ return -1; -+ -+ if (restore_mount_sharing_options()) -+ return -1; -+ -+ return remove_sources_of_deleted_mounts(); -+} -diff --git a/criu/mount.c b/criu/mount.c -index c39b44ac6..85fcb8843 100644 ---- a/criu/mount.c -+++ b/criu/mount.c -@@ -17,6 +17,7 @@ - #include "plugin.h" - #include "filesystems.h" - #include "mount.h" -+#include "mount-v2.h" - #include "pstree.h" - #include "image.h" - #include "namespaces.h" -@@ -1680,6 +1681,7 @@ struct mount_info __maybe_unused *add_cr_time_mount(struct mount_info *root, cha - goto err; - } - mi->mnt_id = HELPER_MNT_ID; -+ mi->is_dir = true; - mi->flags = mi->sb_flags = 0; - mi->root = xstrdup("/"); - mi->fsname = xstrdup(fsname); -@@ -2987,6 +2989,9 @@ struct mount_info *mnt_entry_alloc(bool rst) - } - memset(new->rmi, 0, sizeof(struct rst_mount_info)); - } -+ new->mp_fd_id = -1; -+ new->mnt_fd_id = -1; -+ new->is_dir = -1; - new->fd = -1; - new->is_overmounted = -1; - INIT_LIST_HEAD(&new->children); -@@ -2999,6 +3004,7 @@ struct mount_info *mnt_entry_alloc(bool rst) - INIT_LIST_HEAD(&new->mnt_notprop); - INIT_LIST_HEAD(&new->mnt_unbindable); - INIT_LIST_HEAD(&new->postpone); -+ INIT_LIST_HEAD(&new->deleted_list); - } - return new; - } -@@ -3314,6 +3320,7 @@ static int merge_mount_trees(void) - root_yard_mp->plain_mountpoint = xstrdup(mnt_roots); - if (!root_yard_mp->plain_mountpoint) - return -1; -+ root_yard_mp->is_dir = true; - root_yard_mp->mounted = true; - root_yard_mp->mnt_bind_is_populated = true; - root_yard_mp->is_overmounted = false; -@@ -3359,6 +3366,9 @@ int read_mnt_ns_img(void) - if (!nsid->mnt.mntinfo_tree) - return -1; - -+ /* mntns root mounts are always directories */ -+ nsid->mnt.mntinfo_tree->is_dir = true; -+ - tail->next = pms; - pms = head; - } -@@ -3368,6 +3378,9 @@ int read_mnt_ns_img(void) - search_bindmounts(); - prepare_is_overmounted(); - -+ if (!opts.mntns_compat_mode && resolve_shared_mounts_v2()) -+ return -1; -+ - if (merge_mount_trees()) - return -1; - -@@ -3691,6 +3704,9 @@ int prepare_mnt_ns(void) - free_mntinfo(old); - } - -+ if (!opts.mntns_compat_mode) -+ return prepare_mnt_ns_v2(); -+ - ret = populate_mnt_ns(); - if (ret) - return -1; --- -2.35.1 - diff --git a/0215-zdtm-enable-mounts-compat-mode-on-restore-with-mntns.patch b/0215-zdtm-enable-mounts-compat-mode-on-restore-with-mntns.patch deleted file mode 100644 index 82334db..0000000 --- a/0215-zdtm-enable-mounts-compat-mode-on-restore-with-mntns.patch +++ /dev/null @@ -1,71 +0,0 @@ -From 7361b54e7aa213e2c9dda84eba39ff934183b759 Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Wed, 27 May 2020 16:11:20 +0300 -Subject: [PATCH 215/249] zdtm: enable mounts compat mode on restore with - --mntns-compat-mode option - -Cherry-picked from Virtuozzo criu: -https://src.openvz.org/projects/OVZ/repos/criu/commits/e4a430e1f - -Changes: prepend --mntns-compat-mode to r_opts in zdtm.py so that we -can disable this option with --no-mntns-compat-mode from test desc -files. - -Signed-off-by: Pavel Tikhomirov ---- - test/zdtm.py | 11 ++++++++++- - 1 file changed, 10 insertions(+), 1 deletion(-) - -diff --git a/test/zdtm.py b/test/zdtm.py -index 3fbdb8a18..f15420a65 100755 ---- a/test/zdtm.py -+++ b/test/zdtm.py -@@ -953,6 +953,8 @@ class criu_rpc: - if criu_rpc.pidfd_store_socket is None: - criu_rpc.pidfd_store_socket = socket.socket(socket.AF_UNIX, socket.SOCK_DGRAM) - criu.opts.pidfd_store_sk = criu_rpc.pidfd_store_socket.fileno() -+ elif "--mntns-compat-mode" == arg: -+ criu.opts.mntns_compat_mode = True - else: - raise test_fail_exc('RPC for %s(%s) required' % (arg, args.pop(0))) - -@@ -1046,6 +1048,7 @@ class criu: - self.__criu_bin = opts['criu_bin'] - self.__crit_bin = opts['crit_bin'] - self.__pre_dump_mode = opts['pre_dump_mode'] -+ self.__mntns_compat_mode = bool(opts['mntns_compat_mode']) - - if opts['rpc']: - self.__criu = criu_rpc -@@ -1444,6 +1447,9 @@ class criu: - nowait=True) - r_opts += ["--lazy-pages"] - -+ if self.__mntns_compat_mode: -+ r_opts = ['--mntns-compat-mode'] + r_opts -+ - if self.__leave_stopped: - r_opts += ['--leave-stopped'] - -@@ -2034,7 +2040,7 @@ class Launcher: - 'sat', 'script', 'rpc', 'criu_config', 'lazy_pages', 'join_ns', - 'dedup', 'sbs', 'freezecg', 'user', 'dry_run', 'noauto_dedup', - 'remote_lazy_pages', 'show_stats', 'lazy_migrate', 'stream', -- 'tls', 'criu_bin', 'crit_bin', 'pre_dump_mode') -+ 'tls', 'criu_bin', 'crit_bin', 'pre_dump_mode', 'mntns_compat_mode') - arg = repr((name, desc, flavor, {d: self.__opts[d] for d in nd})) - - if self.__use_log: -@@ -2707,6 +2713,9 @@ def get_cli_args(): - help="Use splice or read mode of pre-dumping", - choices=['splice', 'read'], - default='splice') -+ rp.add_argument("--mntns-compat-mode", -+ help="Use old compat mounts restore engine", -+ action='store_true') - - lp = sp.add_parser("list", help="List tests") - lp.set_defaults(action=list_tests) --- -2.35.1 - diff --git a/0216-ci-run-tests-for-old-mount-engine.patch b/0216-ci-run-tests-for-old-mount-engine.patch deleted file mode 100644 index ae01403..0000000 --- a/0216-ci-run-tests-for-old-mount-engine.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 555e118d60688230e1eddc5c8e5117c49cdcc3aa Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Fri, 14 Jan 2022 12:12:12 +0300 -Subject: [PATCH 216/249] ci: run tests for old mount engine - -Now when we switched to mount-v2 by default to check old mount engine we -need to explicitly run with --mntns-compat-mode option. - -Note that if the feature move_mount_set_group is not supported then -regular run will just fallback to old mount engine and then we don't -need separate run with --mntns-compat-mode. - -Signed-off-by: Pavel Tikhomirov ---- - scripts/ci/run-ci-tests.sh | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/scripts/ci/run-ci-tests.sh b/scripts/ci/run-ci-tests.sh -index 5ef3965db..dd7c49d63 100755 ---- a/scripts/ci/run-ci-tests.sh -+++ b/scripts/ci/run-ci-tests.sh -@@ -201,6 +201,10 @@ fi - - # shellcheck disable=SC2086 - ./test/zdtm.py run -a -p 2 --keep-going $ZDTM_OPTS -+if criu/criu check --feature move_mount_set_group; then -+ # shellcheck disable=SC2086 -+ ./test/zdtm.py run -a -p 2 --mntns-compat-mode --keep-going $ZDTM_OPTS -+fi - - # shellcheck disable=SC2086 - ./test/zdtm.py run -a -p 2 --keep-going --criu-config $ZDTM_OPTS --- -2.35.1 - diff --git a/0217-zdtm-add-new-mnt_ext_sharing-test-for-mount-v2.patch b/0217-zdtm-add-new-mnt_ext_sharing-test-for-mount-v2.patch deleted file mode 100644 index 9bac868..0000000 --- a/0217-zdtm-add-new-mnt_ext_sharing-test-for-mount-v2.patch +++ /dev/null @@ -1,328 +0,0 @@ -From 8909926e8c1c72a55a18e2e00793069fbe5fe445 Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Tue, 31 Dec 2019 15:56:44 +0300 -Subject: [PATCH 217/249] zdtm: add new mnt_ext_sharing test for mount-v2 - -These test simply checks that sharing between two mounts in container: -1) external mount and 2) it's bind persists (case when bind has the same -mountpoint). - -Note: on old mount engine mounts inside container become also shared -with mount in criu mount namespace (outside container) after c/r which -is not right. - -Cherry-picked from Virtuozzo criu: -https://src.openvz.org/projects/OVZ/repos/criu/commits/76a09e850 - -Signed-off-by: Pavel Tikhomirov ---- - test/zdtm/static/Makefile | 1 + - test/zdtm/static/mnt_ext_sharing.c | 236 ++++++++++++++++++++++++++ - test/zdtm/static/mnt_ext_sharing.desc | 5 + - test/zdtm/static/mnt_ext_sharing.hook | 27 +++ - 4 files changed, 269 insertions(+) - create mode 100644 test/zdtm/static/mnt_ext_sharing.c - create mode 100644 test/zdtm/static/mnt_ext_sharing.desc - create mode 100755 test/zdtm/static/mnt_ext_sharing.hook - -diff --git a/test/zdtm/static/Makefile b/test/zdtm/static/Makefile -index bf7462756..9183e7131 100644 ---- a/test/zdtm/static/Makefile -+++ b/test/zdtm/static/Makefile -@@ -403,6 +403,7 @@ TST_DIR = \ - mnt_ext_collision \ - mntns_pivot_root \ - mntns_pivot_root_ro \ -+ mnt_ext_sharing \ - mnt_tracefs \ - mntns_deleted \ - unlink_regular00 \ -diff --git a/test/zdtm/static/mnt_ext_sharing.c b/test/zdtm/static/mnt_ext_sharing.c -new file mode 100644 -index 000000000..b562b5716 ---- /dev/null -+++ b/test/zdtm/static/mnt_ext_sharing.c -@@ -0,0 +1,236 @@ -+#include -+#include -+#include -+#include -+#include -+ -+#include "zdtmtst.h" -+#include "lock.h" -+ -+const char *test_doc = "Check sharing vs external mounts vs mntns"; -+const char *test_author = "Pavel Tikhomirov "; -+ -+char *dirname = "mnt_ext_sharing.test"; -+char *source = "zdtm_ext_sharing"; -+char *internal_source = "zdtm_ext_sharing.internal"; -+#define SUBDIR "subdir" -+TEST_OPTION(dirname, string, "directory name", 1); -+ -+enum { -+ TEST_START, -+ TEST_STARTED, -+ TEST_EXIT, -+ TEST_EXITED, -+}; -+ -+struct shared { -+ futex_t fstate; -+ int ret; -+}; -+ -+struct shared *sh; -+ -+#define BUF_SIZE 4096 -+ -+int pid_mntinfo_get_shid(char *pid, char *source) -+{ -+ char path[PATH_MAX], line[BUF_SIZE]; -+ FILE *mountinfo; -+ char *hyphen, *shared; -+ int ret = -1; -+ -+ sprintf(path, "/proc/%s/mountinfo", pid); -+ mountinfo = fopen(path, "r"); -+ if (!mountinfo) { -+ pr_perror("fopen"); -+ return ret; -+ } -+ -+ while (fgets(line, sizeof(line), mountinfo)) { -+ hyphen = strchr(line, '-'); -+ if (!hyphen) { -+ pr_perror("no hyphen in mountinfo"); -+ break; -+ } -+ -+ if (!strstr(hyphen + 1, source)) -+ continue; -+ -+ shared = strstr(line, "shared:"); -+ if (!shared) { -+ pr_err("no shared id\n"); -+ break; -+ } -+ -+ ret = atoi(shared + 7); -+ break; -+ } -+ -+ fclose(mountinfo); -+ return ret; -+} -+ -+int secondary_mntns_child(void) -+{ -+ if (unshare(CLONE_NEWNS)) { -+ pr_perror("unshare"); -+ sh->ret = 1; -+ futex_abort_and_wake(&sh->fstate); -+ return 1; -+ } -+ futex_set_and_wake(&sh->fstate, TEST_STARTED); -+ futex_wait_until(&sh->fstate, TEST_EXIT); -+ /* These task is just holding the reference to secondary mntns */ -+ futex_set_and_wake(&sh->fstate, TEST_EXITED); -+ return 0; -+} -+ -+int main(int argc, char **argv) -+{ -+ char *root, testdir[PATH_MAX], spid[BUF_SIZE]; -+ char internal_dst[PATH_MAX], internal_src[PATH_MAX], internal_nsdst[PATH_MAX]; -+ int internal_shid_self = -1, internal_shid_pid = -1; -+ char *tmp = "/tmp/zdtm_ext_sharing.tmp"; -+ char *zdtm_newns = getenv("ZDTM_NEWNS"); -+ int pid, status; -+ -+ root = getenv("ZDTM_ROOT"); -+ if (root == NULL) { -+ pr_perror("root"); -+ return 1; -+ } -+ -+ if (!zdtm_newns) { -+ pr_perror("ZDTM_NEWNS is not set"); -+ return 1; -+ } else if (strcmp(zdtm_newns, "1")) { -+ goto test; -+ } -+ -+ /* Prepare directories in test root */ -+ sprintf(testdir, "%s/%s", root, dirname); -+ mkdir(testdir, 0755); -+ -+ sprintf(internal_dst, "%s/%s/internal", root, dirname); -+ mkdir(internal_dst, 0755); -+ -+ /* Prepare directories in criu root */ -+ mkdir(tmp, 0755); -+ if (mount(source, tmp, "tmpfs", 0, NULL)) { -+ pr_perror("mount tmpfs"); -+ return 1; -+ } -+ if (mount(NULL, tmp, NULL, MS_PRIVATE, NULL)) { -+ pr_perror("make private"); -+ return 1; -+ } -+ -+ sprintf(internal_src, "%s/internal", tmp); -+ mkdir(internal_src, 0755); -+ -+ /* Create a shared mount in criu mntns */ -+ if (mount(internal_source, internal_src, "tmpfs", 0, NULL)) { -+ pr_perror("mount tmpfs"); -+ return 1; -+ } -+ if (mount(NULL, internal_src, NULL, MS_PRIVATE, NULL)) { -+ pr_perror("make private"); -+ return 1; -+ } -+ -+ if (mount(NULL, internal_src, NULL, MS_SHARED, NULL)) { -+ pr_perror("make shared"); -+ return 1; -+ } -+ -+ /* -+ * Create temporary mntns, next mounts will not show up in criu mntns -+ */ -+ if (unshare(CLONE_NEWNS)) { -+ pr_perror("unshare"); -+ return 1; -+ } -+ -+ /* -+ * Populate to the tests root only a subdirectory of the internal_src -+ * mount to ensure that it will be restored as an external mount. -+ */ -+ sprintf(internal_src, "%s/internal/%s", tmp, SUBDIR); -+ mkdir(internal_src, 0755); -+ if (mount(internal_src, internal_dst, NULL, MS_BIND, NULL)) { -+ pr_perror("bind"); -+ return 1; -+ } -+ -+test: -+ test_init(argc, argv); -+ -+ sh = mmap(NULL, sizeof(struct shared), PROT_WRITE | PROT_READ, MAP_SHARED | MAP_ANONYMOUS, -1, 0); -+ if (sh == MAP_FAILED) { -+ pr_perror("Failed to alloc shared region"); -+ exit(1); -+ } -+ -+ futex_set(&sh->fstate, TEST_START); -+ sh->ret = 0; -+ -+ sprintf(internal_nsdst, "/%s/internal", dirname); -+ /* Make "external" mount to have internal sharing */ -+ if (mount(NULL, internal_nsdst, NULL, MS_PRIVATE, NULL)) { -+ pr_perror("make shared"); -+ return 1; -+ } -+ -+ if (mount(NULL, internal_nsdst, NULL, MS_SHARED, NULL)) { -+ pr_perror("make shared"); -+ return 1; -+ } -+ -+ /* Create secondary mntns copying all mounts */ -+ pid = fork(); -+ if (pid < 0) { -+ pr_perror("fork"); -+ return 1; -+ } else if (pid == 0) { -+ exit(secondary_mntns_child()); -+ } -+ -+ futex_wait_until(&sh->fstate, TEST_STARTED); -+ if (sh->ret != 0) { -+ pr_err("error in child\n"); -+ return 1; -+ } -+ -+ test_daemon(); -+ test_waitsig(); -+ -+ /* -+ * Check mounts in primary and secondary -+ * mntnses are shared to each other. -+ */ -+ sprintf(spid, "%d", pid); -+ internal_shid_pid = pid_mntinfo_get_shid(spid, internal_source); -+ internal_shid_self = pid_mntinfo_get_shid("self", internal_source); -+ -+ /* Cleanup */ -+ futex_set_and_wake(&sh->fstate, TEST_EXIT); -+ futex_wait_until(&sh->fstate, TEST_EXITED); -+ -+ while (wait(&status) > 0) { -+ if (!WIFEXITED(status) || WEXITSTATUS(status)) { -+ fail("Wrong exit status: %d", status); -+ return 1; -+ } -+ } -+ -+ if (internal_shid_pid == -1 || internal_shid_self == -1 || internal_shid_pid != internal_shid_self) { -+ fail("Shared ids does not match (internal)"); -+ return 1; -+ } -+ -+ /* Print shared id so that it can be checked in cleanup hook */ -+ test_msg("internal_shared_id = %d\n", internal_shid_pid); -+ pass(); -+ -+ return 0; -+} -diff --git a/test/zdtm/static/mnt_ext_sharing.desc b/test/zdtm/static/mnt_ext_sharing.desc -new file mode 100644 -index 000000000..d72505837 ---- /dev/null -+++ b/test/zdtm/static/mnt_ext_sharing.desc -@@ -0,0 +1,5 @@ -+{ 'dopts': '--external mnt[/mnt_ext_sharing.test/internal]:ZDTM', -+ 'feature': 'mnt_id move_mount_set_group', -+ 'flavor': 'ns uns', -+ 'flags': 'suid', -+ 'ropts': '--external mnt[ZDTM]:/tmp/zdtm_ext_sharing.tmp/internal/subdir --no-mntns-compat-mode'} -diff --git a/test/zdtm/static/mnt_ext_sharing.hook b/test/zdtm/static/mnt_ext_sharing.hook -new file mode 100755 -index 000000000..82443b632 ---- /dev/null -+++ b/test/zdtm/static/mnt_ext_sharing.hook -@@ -0,0 +1,27 @@ -+#!/bin/bash -+ -+[ "$1" == "--clean" ] || exit 0 -+ -+function err { -+ echo "$1" -+ exit 1 -+} -+ -+# Check shared ids don't match in criu mntns and test mntns -+OUT="zdtm/static/mnt_ext_sharing.out" -+[ -f "$OUT" ] || err "No $OUT file" -+ -+SHID=$(cat $OUT | grep internal_shared_id | awk '{print $5}') -+[ -z "$SHID" ] && err "Failed to get shared id from file" -+MATCH=$(cat /proc/self/mountinfo | grep "\.* - tmpfs zdtm_ext_sharing.internal") -+[ -z "$MATCH" ] || err "Can lookup internal shared id $SHID in criu mntns" -+ -+TMP="/tmp/zdtm_ext_sharing.tmp" -+echo "Cleanup mnt_ext_sharing" -+umount "$TMP/internal" -+umount "$TMP" -+rm -rf $TMP -+ -+rm -rf "mnt_ext_sharing.test" -+ -+exit 0 --- -2.35.1 - diff --git a/0218-zdtm-add-mount_complex_sharing-test.patch b/0218-zdtm-add-mount_complex_sharing-test.patch deleted file mode 100644 index 34390c6..0000000 --- a/0218-zdtm-add-mount_complex_sharing-test.patch +++ /dev/null @@ -1,293 +0,0 @@ -From 3d674889edc31c439a42e5c01226359a56dd533c Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Tue, 28 Jul 2020 11:49:45 +0300 -Subject: [PATCH 218/249] zdtm: add mount_complex_sharing test - -Mounts-v2 engine should fix multiple problems of old engine relative to -sharing options, lets add a test for such problems. - -Add all four types of shared groups: 1) private, 2) shared, 3) slave -and 4) slave+shared for mounts. Propagate them into sharing and after -propagation change sharing with four ways: 1) don't change, 2) make -private, 3) make slave and 4) make private + make shared. - -This brings 16 cases of different sharing options for mount propagation, -lets check that they all are restored fine. - -Lets create mounts from description to make it easier to improve this -test in future. - -Cherry-picked from Virtuozzo criu: -https://src.openvz.org/projects/OVZ/repos/criu/commits/8bcd0034d - -FIXME: need to check options restored right as we don't have ---check-mounts to do this job for us. - -Signed-off-by: Pavel Tikhomirov ---- - test/zdtm/static/Makefile | 1 + - test/zdtm/static/mount_complex_sharing.c | 228 ++++++++++++++++++++ - test/zdtm/static/mount_complex_sharing.desc | 4 + - 3 files changed, 233 insertions(+) - create mode 100644 test/zdtm/static/mount_complex_sharing.c - create mode 100644 test/zdtm/static/mount_complex_sharing.desc - -diff --git a/test/zdtm/static/Makefile b/test/zdtm/static/Makefile -index 9183e7131..717306dbb 100644 ---- a/test/zdtm/static/Makefile -+++ b/test/zdtm/static/Makefile -@@ -404,6 +404,7 @@ TST_DIR = \ - mntns_pivot_root \ - mntns_pivot_root_ro \ - mnt_ext_sharing \ -+ mount_complex_sharing \ - mnt_tracefs \ - mntns_deleted \ - unlink_regular00 \ -diff --git a/test/zdtm/static/mount_complex_sharing.c b/test/zdtm/static/mount_complex_sharing.c -new file mode 100644 -index 000000000..efc1b14aa ---- /dev/null -+++ b/test/zdtm/static/mount_complex_sharing.c -@@ -0,0 +1,228 @@ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "zdtmtst.h" -+ -+const char *test_doc = "Check complex sharing options for mounts"; -+const char *test_author = "Pavel Tikhomirov "; -+ -+char *dirname = "mount_complex_sharing"; -+TEST_OPTION(dirname, string, "directory name", 1); -+ -+/* -+ * Description for creating a single file: -+ * path - path to create file in (relative to mount) -+ * dir - true if file is a directory -+ * content - if file is not a directory, this string is written into the file -+ */ -+struct file { -+ char *path; -+ bool dir; -+ char *content; -+}; -+ -+/* -+ * Description for creating a single mount: -+ * mountpoint - path to create mount on (relative to dirname) -+ * bind - id of bind source if any or -1 -+ * bind_root - root offset from bind source -+ * fstype - needed for non-binds, always tmpfs -+ * source - source for mounting -+ * shflags - array of sharing options applied after mounting (ending with -1) -+ * mounted - identifies implicitly propagated mounts -+ * files - array of files we need to create on mount (ending with zeroed file) -+ */ -+struct mountinfo { -+ char *mountpoint; -+ int bind; -+ char *bind_root; -+ char *fstype; -+ char *source; -+ int shflags[3]; -+ bool mounted; -+ struct file files[10]; -+}; -+ -+/* clang-format off */ -+struct mountinfo mounts[] = { -+ {"", -1, "", "tmpfs", "tmpfs-dirname", {MS_PRIVATE, -1}, false, -+ { -+ {"shared-bind-1", true}, -+ {"shared-bind-2", true}, -+ {"shared-bind-3", true}, -+ {"shared-bind-4", true}, -+ {"private-mnt", true}, -+ {"shared-mnt", true}, -+ {"slave-mnt", true}, -+ {"slave-shared-mnt", true}, -+ {"testfile", false, "TESTFILE"}, -+ {NULL} -+ } -+ }, -+ -+ {"shared-bind-1", -1, "", "tmpfs", "tmpfs-shared-bind", {MS_SHARED, -1}, false, -+ { -+ {"prop-private", true}, -+ {"prop-shared", true}, -+ {"prop-slave", true}, -+ {"prop-slave-shared", true}, -+ {NULL} -+ } -+ }, -+ {"shared-bind-2", 1, "", NULL, NULL, {-1}, false}, -+ {"shared-bind-3", 1, "", NULL, NULL, {-1}, false}, -+ {"shared-bind-4", 1, "", NULL, NULL, {-1}, false}, -+ -+ {"private-mnt", -1, "", "tmpfs", "tmpfs-mnt", {MS_PRIVATE, -1}, false, -+ { -+ {"subdir", true}, -+ {NULL} -+ } -+ }, -+ {"shared-mnt", 5, "", NULL, NULL, {MS_SHARED, -1}, false}, -+ {"slave-mnt", 6, "", NULL, NULL, {MS_SLAVE, -1}, false}, -+ {"slave-shared-mnt", 7, "", NULL, NULL, {MS_SHARED, -1}, false}, -+ -+ {"shared-bind-1/prop-private", 5, "subdir", NULL, NULL, {-1}, false}, -+ {"shared-bind-1/prop-shared", 6, "subdir", NULL, NULL, {-1}, false}, -+ {"shared-bind-1/prop-slave", 7, "subdir", NULL, NULL, {-1}, false}, -+ {"shared-bind-1/prop-slave-shared", 8, "subdir", NULL, NULL, {-1}, false}, -+ -+ {"shared-bind-2/prop-private", -1, NULL, NULL, NULL, {MS_PRIVATE, -1}, true}, -+ {"shared-bind-2/prop-shared", -1, NULL, NULL, NULL, {MS_PRIVATE, -1}, true}, -+ {"shared-bind-2/prop-slave", -1, NULL, NULL, NULL, {MS_PRIVATE, -1}, true}, -+ {"shared-bind-2/prop-slave-shared", -1, NULL, NULL, NULL, {MS_PRIVATE, -1}, true}, -+ -+ {"shared-bind-3/prop-private", -1, NULL, NULL, NULL, {MS_SLAVE, -1}, true}, -+ {"shared-bind-3/prop-shared", -1, NULL, NULL, NULL, {MS_SLAVE, -1}, true}, -+ {"shared-bind-3/prop-slave", -1, NULL, NULL, NULL, {MS_SLAVE, -1}, true}, -+ {"shared-bind-3/prop-slave-shared", -1, NULL, NULL, NULL, {MS_SLAVE, -1}, true}, -+ -+ {"shared-bind-4/prop-private", -1, NULL, NULL, NULL, {MS_PRIVATE, MS_SHARED, -1}, true}, -+ {"shared-bind-4/prop-shared", -1, NULL, NULL, NULL, {MS_PRIVATE, MS_SHARED, -1}, true}, -+ {"shared-bind-4/prop-slave", -1, NULL, NULL, NULL, {MS_PRIVATE, MS_SHARED, -1}, true}, -+ {"shared-bind-4/prop-slave-shared", -1, NULL, NULL, NULL, {MS_PRIVATE, MS_SHARED, -1}, true}, -+}; -+/* clang-format on */ -+ -+static int fill_content(struct mountinfo *mi) -+{ -+ struct file *file = &mi->files[0]; -+ char path[PATH_MAX]; -+ -+ while (file->path != NULL) { -+ snprintf(path, sizeof(path), "%s/%s/%s", dirname, mi->mountpoint, file->path); -+ -+ if (file->dir) { -+ test_msg("Mkdir %s\n", path); -+ if (mkdir(path, 0700)) { -+ pr_perror("Failed to create dir %s", path); -+ return -1; -+ } -+ } else { -+ int fd, len = strlen(file->content); -+ -+ test_msg("Create file %s with content %s\n", path, file->content); -+ fd = open(path, O_WRONLY | O_CREAT, 0777); -+ if (fd < 0) { -+ pr_perror("Failed to create file %s", path); -+ return -1; -+ } -+ -+ if (write(fd, file->content, len) != len) { -+ pr_perror("Failed to write %s to file %s", file->content, path); -+ close(fd); -+ return -1; -+ } -+ close(fd); -+ } -+ -+ file++; -+ } -+ -+ return 0; -+} -+ -+static int mount_one(struct mountinfo *mi) -+{ -+ char source[PATH_MAX], target[PATH_MAX]; -+ int *shflags = mi->shflags, mflags = 0; -+ char *fstype = NULL; -+ -+ test_msg("Mounting %s %d %s %s %d\n", mi->mountpoint, mi->bind, mi->fstype, mi->source, mi->mounted); -+ -+ snprintf(target, sizeof(target), "%s/%s", dirname, mi->mountpoint); -+ -+ if (mi->mounted) -+ goto sharing; -+ -+ if (mi->bind != -1) { -+ snprintf(source, sizeof(source), "%s/%s/%s", dirname, mounts[mi->bind].mountpoint, mi->bind_root); -+ fstype = NULL; -+ mflags = MS_BIND; -+ } else { -+ snprintf(source, sizeof(source), "%s", mi->source); -+ fstype = mi->fstype; -+ } -+ -+ if (mount(source, target, fstype, mflags, NULL)) { -+ pr_perror("Failed to mount %s %s %s", source, target, fstype); -+ return -1; -+ } -+ -+ if (fill_content(mi)) -+ return -1; -+ -+sharing: -+ while (shflags[0] != -1) { -+ test_msg("Making mount %s 0x%x\n", target, shflags[0]); -+ if (mount(NULL, target, NULL, shflags[0], NULL)) { -+ pr_perror("Failed to make mount %s 0x%x", target, shflags[0]); -+ return -1; -+ } -+ shflags++; -+ } -+ -+ return 0; -+} -+ -+static int mount_loop(void) -+{ -+ int i; -+ -+ for (i = 0; i < ARRAY_SIZE(mounts); i++) { -+ if (mount_one(&mounts[i])) -+ return 1; -+ } -+ -+ return 0; -+} -+ -+int main(int argc, char **argv) -+{ -+ int ret = 1; -+ -+ test_init(argc, argv); -+ -+ if (mkdir(dirname, 0700) && errno != EEXIST) { -+ pr_perror("Failed to create %s", dirname); -+ goto err; -+ } -+ -+ if (mount_loop()) -+ goto err; -+ -+ test_daemon(); -+ test_waitsig(); -+ -+ pass(); -+ ret = 0; -+err: -+ if (ret) -+ fail(); -+ return ret; -+} -diff --git a/test/zdtm/static/mount_complex_sharing.desc b/test/zdtm/static/mount_complex_sharing.desc -new file mode 100644 -index 000000000..8910f4684 ---- /dev/null -+++ b/test/zdtm/static/mount_complex_sharing.desc -@@ -0,0 +1,4 @@ -+{ 'flavor': 'ns uns', -+ 'flags': 'suid', -+ 'feature': 'move_mount_set_group', -+ 'ropts': '--no-mntns-compat-mode'} --- -2.35.1 - diff --git a/0219-zdtm-add-propagation-group-with-mount-flags-to-mount.patch b/0219-zdtm-add-propagation-group-with-mount-flags-to-mount.patch deleted file mode 100644 index 8d02972..0000000 --- a/0219-zdtm-add-propagation-group-with-mount-flags-to-mount.patch +++ /dev/null @@ -1,112 +0,0 @@ -From 2a5d445efc68e76fef4f7141c2b07c2f16c7fef3 Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Wed, 14 Oct 2020 15:56:52 +0300 -Subject: [PATCH 219/249] zdtm: add propagation group with mount flags to - mount_complex_sharing - -Before mounts-v2 we have seen mounts loosing their mount readonly flags -when they were in a propagation group, because CRIU "forgot" to set -them, with new mount engine it should work now as all propagations are -now created on the same path there all other normal mounts are created, -and all mount flags are restored. - -This test actually mounts only one mount, other three are propagations, -lets set mount ro flag for half of them. - -Cherry-picked from Virtuozzo criu: -https://src.openvz.org/projects/OVZ/repos/criu/commits/22584993d - -FIXME: need to check options restored right as we don't have ---check-mounts to do this job for us. - -Reviewed-by: Alexander Mikhalitsyn (Virtuozzo) -Signed-off-by: Pavel Tikhomirov ---- - test/zdtm/static/mount_complex_sharing.c | 27 +++++++++++++++--------- - 1 file changed, 17 insertions(+), 10 deletions(-) - -diff --git a/test/zdtm/static/mount_complex_sharing.c b/test/zdtm/static/mount_complex_sharing.c -index efc1b14aa..b4463c41a 100644 ---- a/test/zdtm/static/mount_complex_sharing.c -+++ b/test/zdtm/static/mount_complex_sharing.c -@@ -32,7 +32,8 @@ struct file { - * bind_root - root offset from bind source - * fstype - needed for non-binds, always tmpfs - * source - source for mounting -- * shflags - array of sharing options applied after mounting (ending with -1) -+ * flags - array of sharing options or mount flags applied after -+ * mounting (ending with -1) - * mounted - identifies implicitly propagated mounts - * files - array of files we need to create on mount (ending with zeroed file) - */ -@@ -42,7 +43,7 @@ struct mountinfo { - char *bind_root; - char *fstype; - char *source; -- int shflags[3]; -+ int flags[3]; - bool mounted; - struct file files[10]; - }; -@@ -70,6 +71,7 @@ struct mountinfo mounts[] = { - {"prop-shared", true}, - {"prop-slave", true}, - {"prop-slave-shared", true}, -+ {"prop-mount-flags", true}, - {NULL} - } - }, -@@ -106,6 +108,11 @@ struct mountinfo mounts[] = { - {"shared-bind-4/prop-shared", -1, NULL, NULL, NULL, {MS_PRIVATE, MS_SHARED, -1}, true}, - {"shared-bind-4/prop-slave", -1, NULL, NULL, NULL, {MS_PRIVATE, MS_SHARED, -1}, true}, - {"shared-bind-4/prop-slave-shared", -1, NULL, NULL, NULL, {MS_PRIVATE, MS_SHARED, -1}, true}, -+ -+ {"shared-bind-1/prop-mount-flags", 5, "subdir", NULL, NULL, {MS_RDONLY|MS_REMOUNT|MS_BIND, -1}, false}, -+ {"shared-bind-2/prop-mount-flags", -1, NULL, NULL, NULL, {MS_RDONLY|MS_REMOUNT|MS_BIND, -1}, true}, -+ {"shared-bind-3/prop-mount-flags", -1, NULL, NULL, NULL, {-1}, true}, -+ {"shared-bind-4/prop-mount-flags", -1, NULL, NULL, NULL, {-1}, true}, - }; - /* clang-format on */ - -@@ -150,7 +157,7 @@ static int fill_content(struct mountinfo *mi) - static int mount_one(struct mountinfo *mi) - { - char source[PATH_MAX], target[PATH_MAX]; -- int *shflags = mi->shflags, mflags = 0; -+ int *flags = mi->flags, mflags = 0; - char *fstype = NULL; - - test_msg("Mounting %s %d %s %s %d\n", mi->mountpoint, mi->bind, mi->fstype, mi->source, mi->mounted); -@@ -158,7 +165,7 @@ static int mount_one(struct mountinfo *mi) - snprintf(target, sizeof(target), "%s/%s", dirname, mi->mountpoint); - - if (mi->mounted) -- goto sharing; -+ goto apply_flags; - - if (mi->bind != -1) { - snprintf(source, sizeof(source), "%s/%s/%s", dirname, mounts[mi->bind].mountpoint, mi->bind_root); -@@ -177,14 +184,14 @@ static int mount_one(struct mountinfo *mi) - if (fill_content(mi)) - return -1; - --sharing: -- while (shflags[0] != -1) { -- test_msg("Making mount %s 0x%x\n", target, shflags[0]); -- if (mount(NULL, target, NULL, shflags[0], NULL)) { -- pr_perror("Failed to make mount %s 0x%x", target, shflags[0]); -+apply_flags: -+ while (flags[0] != -1) { -+ test_msg("Making mount %s 0x%x\n", target, flags[0]); -+ if (mount(NULL, target, NULL, flags[0], NULL)) { -+ pr_perror("Failed to make mount %s 0x%x", target, flags[0]); - return -1; - } -- shflags++; -+ flags++; - } - - return 0; --- -2.35.1 - diff --git a/0220-zdtm-mount-v2-disable-mnt_tracefs-test.patch b/0220-zdtm-mount-v2-disable-mnt_tracefs-test.patch deleted file mode 100644 index 0230977..0000000 --- a/0220-zdtm-mount-v2-disable-mnt_tracefs-test.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 551fe1a3cbf8b5e4b4f34d85c1bb807917e5d8c9 Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Tue, 1 Dec 2020 16:07:16 +0300 -Subject: [PATCH 220/249] zdtm/mount-v2: disable mnt_tracefs test - -We can have tracefs separate mount from debugfs and that's why the -/sys/kernel/debug external mount now has children and this thing is not -supported to be bind in container with children, because we don't wan't -external mounts to introduce some unexpected extra external mounts so we -bind them without MS_REC in mount-v2 unlike in old mount engine. - -We can either bind without MS_REC when constructing test or provide all -children mount as separate external mounts to criu, let's just disable -for now. - -Cherry-picked from Virtuozzo criu: -https://src.openvz.org/projects/OVZ/repos/criu/commits/87875c023 - -Signed-off-by: Pavel Tikhomirov ---- - test/zdtm/static/mnt_tracefs.desc | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/test/zdtm/static/mnt_tracefs.desc b/test/zdtm/static/mnt_tracefs.desc -index e90ea9415..7cf98034a 100644 ---- a/test/zdtm/static/mnt_tracefs.desc -+++ b/test/zdtm/static/mnt_tracefs.desc -@@ -1,3 +1,4 @@ - { 'feature': 'mnt_id', - 'flavor': 'uns', -- 'opts': '--ext-mount-map auto --enable-external-masters'} -+ 'opts': '--ext-mount-map auto --enable-external-masters', -+ 'ropts': '--mntns-compat-mode'} --- -2.35.1 - diff --git a/0221-ci-make-others-mnt_ext_dev-also-run-for-old-mount-en.patch b/0221-ci-make-others-mnt_ext_dev-also-run-for-old-mount-en.patch deleted file mode 100644 index c581116..0000000 --- a/0221-ci-make-others-mnt_ext_dev-also-run-for-old-mount-en.patch +++ /dev/null @@ -1,45 +0,0 @@ -From ba38f2e6086831518fc3595c4566c0ed9cc736e5 Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Fri, 14 Jan 2022 19:29:08 +0300 -Subject: [PATCH 221/249] ci: make others/mnt_ext_dev also run for old mount - engine - -Now when we switched to mount-v2 by default to check old mount engine we -need to explicitly run with --mntns-compat-mode option. - -Signed-off-by: Pavel Tikhomirov ---- - scripts/ci/run-ci-tests.sh | 3 +++ - test/others/mnt-ext-dev/run.sh | 2 +- - 2 files changed, 4 insertions(+), 1 deletion(-) - -diff --git a/scripts/ci/run-ci-tests.sh b/scripts/ci/run-ci-tests.sh -index dd7c49d63..22420b922 100755 ---- a/scripts/ci/run-ci-tests.sh -+++ b/scripts/ci/run-ci-tests.sh -@@ -237,6 +237,9 @@ bash -x ./test/jenkins/criu-inhfd.sh - - if [ -z "$SKIP_EXT_DEV_TEST" ]; then - make -C test/others/mnt-ext-dev/ run -+ if criu/criu check --feature move_mount_set_group; then -+ EXTRA_OPTS=--mntns-compat-mode make -C test/others/mnt-ext-dev/ run -+ fi - fi - - make -C test/others/make/ run CC="$CC" -diff --git a/test/others/mnt-ext-dev/run.sh b/test/others/mnt-ext-dev/run.sh -index 9803a8f77..5a1f44450 100755 ---- a/test/others/mnt-ext-dev/run.sh -+++ b/test/others/mnt-ext-dev/run.sh -@@ -11,7 +11,7 @@ dev=`losetup --find --show zdtm.loop` - mkdir -p ../../dev - cp -ap $dev ../../dev - export ZDTM_MNT_EXT_DEV=$dev --python ../../zdtm.py run -t zdtm/static/mnt_ext_dev || ret=$? -+python ../../zdtm.py run $EXTRA_OPTS -t zdtm/static/mnt_ext_dev || ret=$? - losetup -d $dev - unlink zdtm.loop - exit $ret --- -2.35.1 - diff --git a/0222-test-jenkins-test-for-old-mount-engine.patch b/0222-test-jenkins-test-for-old-mount-engine.patch deleted file mode 100644 index ae59352..0000000 --- a/0222-test-jenkins-test-for-old-mount-engine.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 2e69fff789bf285853f96ef27f836773a933754b Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Mon, 31 Jan 2022 11:02:36 +0300 -Subject: [PATCH 222/249] test/jenkins: test for old mount engine - -Let's run zdtm in jenkins with --mntns-compat-mode option and same for -device-external mount test from others. - -Signed-off-by: Pavel Tikhomirov ---- - test/jenkins/criu-compat-mounts.sh | 15 +++++++++++++++ - 1 file changed, 15 insertions(+) - create mode 100755 test/jenkins/criu-compat-mounts.sh - -diff --git a/test/jenkins/criu-compat-mounts.sh b/test/jenkins/criu-compat-mounts.sh -new file mode 100755 -index 000000000..cc68035f3 ---- /dev/null -+++ b/test/jenkins/criu-compat-mounts.sh -@@ -0,0 +1,15 @@ -+#!/bin/bash -+ -+# Make one regular C/R cycle with mount-v2 disabled -+set -e -+source `dirname $0`/criu-lib.sh -+prep -+FAIL=0 -+./test/zdtm.py run --all --mntns-compat-mode --keep-going --report report --parallel 4 || FAIL=$? -+ -+# Make device-external mounts test -+EXTRA_OPTS=--mntns-compat-mode make -C test/others/mnt-ext-dev/ run || FAIL=$? -+ -+if [ $FAIL -ne 0 ]; then -+ fail -+fi --- -2.35.1 - diff --git a/0223-zdtm-mount-v2-disable-pty-console-test.patch b/0223-zdtm-mount-v2-disable-pty-console-test.patch deleted file mode 100644 index b10fb40..0000000 --- a/0223-zdtm-mount-v2-disable-pty-console-test.patch +++ /dev/null @@ -1,63 +0,0 @@ -From 03f00584fc3428f2f1fa1485ecead7e74842fb4e Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Mon, 14 Mar 2022 12:01:10 +0300 -Subject: [PATCH 223/249] zdtm/mount-v2: disable pty-console test - - [root@fedora criu]# ./test/zdtm.py run -t zdtm/static/pty-console --iters 2 --keep-going --ignore-taint - [WARNING] Option --keep-going is more useful when running multiple tests - userns is supported - === Run 1/1 ================ zdtm/static/pty-console - ====================== Run zdtm/static/pty-console in uns ====================== - Start test - Test is SUID - ./pty-console --pidfile=pty-console.pid --outfile=pty-console.out - Run criu dump - Run criu restore - Run criu dump - =[log]=> dump/zdtm/static/pty-console/62/2/dump.log - ------------------------ grep Error ------------------------ - b'(00.009325) 101 fdinfo 3: pos: 0 flags: 100000/0' - b'(00.009332) Dumping path for 3 fd via self 19 [/zdtm/static]' - b'(00.009345) 101 fdinfo 4: pos: 0 flags: 100002/0' - b'(00.009352) tty: Dumping tty 20 with id 0xc' - b"(00.009358) Error (criu/files-reg.c:1710): Can't lookup mount=1647 for fd=4 path=/ptmx" - b'(00.009361) ----------------------------------------' - b'(00.009369) Error (criu/cr-dump.c:1368): Dump files (pid: 101) failed with -1' - b'(00.009696) Running network-unlock scripts' - b'(00.012401) Unfreezing tasks into 1' - b'(00.012410) \tUnseizing 86 into 1' - b'(00.012415) \tUnseizing 101 into 1' - b'(00.012428) Error (criu/cr-dump.c:1788): Dumping FAILED.' - ------------------------ ERROR OVER ------------------------ - ################ Test zdtm/static/pty-console FAIL at CRIU dump ################ - Test output: ================================ - - <<< ================================ - Send the 9 signal to 86 - Wait for zdtm/static/pty-console(86) to die for 0.100000 - ##################################### FAIL ##################################### - -Restore on second iteration with mount-v2 fails, that is because -devpts_restore which is called from do_new_mount_v2 via fstype->restore -opens ptmx file in service mntns and saves it to fdstore for later use. -So after first c/r open ptmx fd changes mnt_id in fdinfo to a detached -mount. Let's just disable mount-v2 for this test for now. - -FIXME: We should create separate fstype hook to do_mount_in_right_mntns, -so that we can open files from this hook in actual restored mntns. - -Signed-off-by: Pavel Tikhomirov ---- - test/zdtm/static/pty-console.desc | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/test/zdtm/static/pty-console.desc b/test/zdtm/static/pty-console.desc -index fba5e8749..3b3e3f73d 100644 ---- a/test/zdtm/static/pty-console.desc -+++ b/test/zdtm/static/pty-console.desc -@@ -1 +1 @@ --{'flags': 'suid', 'flavor' : 'ns uns'} -+{'flags': 'suid', 'flavor' : 'ns uns', 'ropts': '--mntns-compat-mode'} --- -2.35.1 - diff --git a/0224-mount-v2-make-mount-engine-fallback-messages-logleve.patch b/0224-mount-v2-make-mount-engine-fallback-messages-logleve.patch deleted file mode 100644 index f533982..0000000 --- a/0224-mount-v2-make-mount-engine-fallback-messages-logleve.patch +++ /dev/null @@ -1,51 +0,0 @@ -From b578f95f21e1cec4961948dddce1fd201907302a Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Sun, 20 Mar 2022 19:38:34 +0300 -Subject: [PATCH 224/249] mount-v2: make mount engine fallback messages - loglevel debug - -On pre v5.15 kernel we don't have MOVE_MOUNT_SET_GROUP support and thus -all our ci logs are filled with "fallback" messages. Let's decrease log -level to debug, so that we don't see it in ci logs. - -Signed-off-by: Pavel Tikhomirov ---- - criu/config.c | 2 +- - criu/mount-v2.c | 4 ++-- - 2 files changed, 3 insertions(+), 3 deletions(-) - -diff --git a/criu/config.c b/criu/config.c -index 8b6d105ae..28641cf0c 100644 ---- a/criu/config.c -+++ b/criu/config.c -@@ -1110,7 +1110,7 @@ int check_options(void) - return 1; - } else if (!opts.mntns_compat_mode && opts.mode == CR_RESTORE) { - if (check_mount_v2()) { -- pr_warn("Mount engine fallback to --mntns-compat-mode mode\n"); -+ pr_debug("Mount engine fallback to --mntns-compat-mode mode\n"); - opts.mntns_compat_mode = true; - } - } -diff --git a/criu/mount-v2.c b/criu/mount-v2.c -index ec3965140..6772072de 100644 ---- a/criu/mount-v2.c -+++ b/criu/mount-v2.c -@@ -33,12 +33,12 @@ LIST_HEAD(sharing_groups); - int check_mount_v2(void) - { - if (!kdat.has_move_mount_set_group) { -- pr_warn("Mounts-v2 requires MOVE_MOUNT_SET_GROUP support\n"); -+ pr_debug("Mounts-v2 requires MOVE_MOUNT_SET_GROUP support\n"); - return -1; - } - - if (!kdat.has_openat2) { -- pr_warn("Mounts-v2 requires openat2 support\n"); -+ pr_debug("Mounts-v2 requires openat2 support\n"); - return -1; - } - --- -2.35.1 - diff --git a/0225-mount-make-error-messages-differ-in-different-places.patch b/0225-mount-make-error-messages-differ-in-different-places.patch deleted file mode 100644 index 369be7f..0000000 --- a/0225-mount-make-error-messages-differ-in-different-places.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 3ce0742b084ce45cc2170c0f92d24190231f54e1 Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Mon, 21 Mar 2022 10:19:29 +0300 -Subject: [PATCH 225/249] mount: make error messages differ in different places - -We have three of "Can't mount at %s", let's distinguish simple mount -from bind-mount and re-mount to make log reading easier. - -Signed-off-by: Pavel Tikhomirov ---- - criu/mount.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/criu/mount.c b/criu/mount.c -index 85fcb8843..8b6cdaf45 100644 ---- a/criu/mount.c -+++ b/criu/mount.c -@@ -2485,14 +2485,14 @@ do_bind: - } - - if (mount(root, service_mountpoint(mi), NULL, MS_BIND | (mi->flags & MS_REC), NULL) < 0) { -- pr_perror("Can't mount at %s", service_mountpoint(mi)); -+ pr_perror("Can't bind-mount at %s", service_mountpoint(mi)); - goto err; - } - - mflags = mi->flags & (~MS_PROPAGATE); - if (!mi->bind || mflags != (mi->bind->flags & (~MS_PROPAGATE))) - if (mount(NULL, service_mountpoint(mi), NULL, MS_BIND | MS_REMOUNT | mflags, NULL)) { -- pr_perror("Can't mount at %s", service_mountpoint(mi)); -+ pr_perror("Can't re-mount at %s", service_mountpoint(mi)); - goto err; - } - --- -2.35.1 - diff --git a/0226-zdtm-use-unique-holder-for-cgroups.patch b/0226-zdtm-use-unique-holder-for-cgroups.patch deleted file mode 100644 index 3f5442c..0000000 --- a/0226-zdtm-use-unique-holder-for-cgroups.patch +++ /dev/null @@ -1,96 +0,0 @@ -From 019adba82026f710cd776b424468fc635a649d2c Mon Sep 17 00:00:00 2001 -From: Andrei Vagin -Date: Sun, 20 Mar 2022 22:11:19 -0700 -Subject: [PATCH 226/249] zdtm: use unique holder for cgroups - -The idea that each zdtm.py should have own helder, so that two zdtm.py that are -running on the same host don't effect each other. - -Fixes: #1774 -Signed-off-by: Andrei Vagin ---- - test/zdtm.py | 6 ++++-- - test/zdtm_mount_cgroups | 4 +++- - test/zdtm_umount_cgroups | 6 ++++-- - 3 files changed, 11 insertions(+), 5 deletions(-) - -diff --git a/test/zdtm.py b/test/zdtm.py -index f15420a65..a8704b3d7 100755 ---- a/test/zdtm.py -+++ b/test/zdtm.py -@@ -27,6 +27,7 @@ import subprocess - import sys - import tempfile - import time -+import uuid - from builtins import input, int, open, range, str, zip - - import yaml -@@ -38,6 +39,7 @@ from zdtm.criu_config import criu_config - STREAMED_IMG_FILE_NAME = "img.criu" - - prev_line = None -+uuid = uuid.uuid4() - - - def alarm(*args): -@@ -617,12 +619,12 @@ class zdtm_test: - if not os.access("zdtm/lib/libzdtmtst.a", os.F_OK): - subprocess.check_call(["make", "-C", "zdtm/"]) - subprocess.check_call( -- ["flock", "zdtm_mount_cgroups.lock", "./zdtm_mount_cgroups"]) -+ ["flock", "zdtm_mount_cgroups.lock", "./zdtm_mount_cgroups", str(uuid)]) - - @staticmethod - def cleanup(): - subprocess.check_call( -- ["flock", "zdtm_mount_cgroups.lock", "./zdtm_umount_cgroups"]) -+ ["flock", "zdtm_mount_cgroups.lock", "./zdtm_umount_cgroups", str(uuid)]) - - - def load_module_from_file(name, path): -diff --git a/test/zdtm_mount_cgroups b/test/zdtm_mount_cgroups -index 34e0e85ca..a99e16361 100755 ---- a/test/zdtm_mount_cgroups -+++ b/test/zdtm_mount_cgroups -@@ -4,13 +4,15 @@ - # Error (cgroup.c:768): cg: Set 3 is not subset of 2 - # so lets create all test controllers before executing tests. - -+uuid=$1 -+ - cat /proc/self/cgroup | grep -q zdtmtst.defaultroot && exit - - tdir=`mktemp -d zdtm.XXXXXX` - for i in "zdtmtst" "zdtmtst.defaultroot"; do - mount -t cgroup -o none,name=$i zdtm $tdir && - # a fake group prevents destroying of a controller -- mkdir -p $tdir/holder && -+ mkdir -p $tdir/holder.$uuid && - umount -l $tdir || exit 1 - done - rmdir $tdir -diff --git a/test/zdtm_umount_cgroups b/test/zdtm_umount_cgroups -index 75a8ea28f..decd70ff0 100755 ---- a/test/zdtm_umount_cgroups -+++ b/test/zdtm_umount_cgroups -@@ -4,12 +4,14 @@ - - cat /proc/self/cgroup | grep -q zdtmtst.defaultroot || exit 0 - -+uuid=$1 -+ - tdir=`mktemp -d zdtm.XXXXXX` - for i in "zdtmtst" "zdtmtst.defaultroot"; do - mount -t cgroup -o none,name=$i zdtm $tdir || { rmdir $tdir; exit 1; } - # remove a fake group if exists -- if [ -d "$tdir/holder" ]; then -- rmdir $tdir/holder || { umount -l $tdir && rmdir $tdir; exit 1; } -+ if [ -d "$tdir/holder.$uuid" ]; then -+ rmdir $tdir/holder.$uuid || { umount -l $tdir && rmdir $tdir; exit 1; } - fi - umount -l $tdir || exit 1; - done --- -2.35.1 - diff --git a/0227-scripts-ci-mount-test-cgroups-once.patch b/0227-scripts-ci-mount-test-cgroups-once.patch deleted file mode 100644 index c1bd7bd..0000000 --- a/0227-scripts-ci-mount-test-cgroups-once.patch +++ /dev/null @@ -1,35 +0,0 @@ -From becbcd27e09030cc1032e013ff08c726acae79bf Mon Sep 17 00:00:00 2001 -From: Andrei Vagin -Date: Sun, 20 Mar 2022 22:13:45 -0700 -Subject: [PATCH 227/249] scripts/ci: mount test cgroups once - -zdtm.py mounts two named controllers for tests. In CI, we run zdtm.py a few -times, so we can mount (create) these controllers once to avoid any unwanted -effects. - -Signed-off-by: Andrei Vagin ---- - scripts/ci/run-ci-tests.sh | 7 +++++++ - 1 file changed, 7 insertions(+) - -diff --git a/scripts/ci/run-ci-tests.sh b/scripts/ci/run-ci-tests.sh -index 22420b922..14e6b1224 100755 ---- a/scripts/ci/run-ci-tests.sh -+++ b/scripts/ci/run-ci-tests.sh -@@ -139,6 +139,13 @@ time make unittest - - ulimit -c unlimited - -+cgid=$$ -+cleanup_cgroup() { -+ ./test/zdtm_umount_cgroups $cgid -+} -+trap cleanup_cgroup EXIT -+./test/zdtm_mount_cgroups $cgid -+ - echo "|$(pwd)/test/abrt.sh %P %p %s %e" > /proc/sys/kernel/core_pattern - - if [ "${COMPAT_TEST}x" = "yx" ] ; then --- -2.35.1 - diff --git a/0228-criu-ns-add-a-helper-to-hold-a-pid-namespace.patch b/0228-criu-ns-add-a-helper-to-hold-a-pid-namespace.patch deleted file mode 100644 index dfef187..0000000 --- a/0228-criu-ns-add-a-helper-to-hold-a-pid-namespace.patch +++ /dev/null @@ -1,62 +0,0 @@ -From 3a33f672a6de175d5ff8d5440f44898da6fa08ef Mon Sep 17 00:00:00 2001 -From: Andrei Vagin -Date: Sun, 20 Mar 2022 00:43:45 -0700 -Subject: [PATCH 228/249] criu-ns: add a helper to hold a pid namespace - -The init process can exit if it doesn't have any child processes and its -pidns is destroyed in this case. CRIU dump is running in the target pid -namespace and it kills dumped processes at the end. We need to create a -holder process to be sure that the pid namespace will not be destroy -before criu exits. - -Fixes: #1775 - -Signed-off-by: Andrei Vagin ---- - scripts/criu-ns | 23 +++++++++++++++++++++++ - 1 file changed, 23 insertions(+) - -diff --git a/scripts/criu-ns b/scripts/criu-ns -index 930d20c80..9fc58b640 100755 ---- a/scripts/criu-ns -+++ b/scripts/criu-ns -@@ -82,6 +82,27 @@ def run_criu(args): - raise OSError(errno.ENOENT, "No such command") - - -+# pidns_holder creates a process that is reparented to the init. -+# -+# The init process can exit if it doesn't have any child processes and its -+# pidns is destroyed in this case. CRIU dump is running in the target pid -+# namespace and it kills dumped processes at the end. We need to create a -+# holder process to be sure that the pid namespace will not be destroy before -+# criu exits. -+def pidns_holder(): -+ r, w = os.pipe() -+ pid = os.fork() -+ if pid == 0: -+ pid = os.fork() -+ if pid == 0: -+ os.close(w) -+ # The write end is owned by the parent process and it is closed by -+ # kernel when the parent process exits. -+ os.read(r, 1) -+ sys.exit(0) -+ os.waitpid(pid, 0) -+ -+ - def wrap_restore(): - restore_args = sys.argv[1:] - if '--restore-sibling' in restore_args: -@@ -200,6 +221,8 @@ def wrap_dump(): - set_pidns(pid, pid_idx) - set_mntns(pid) - -+ pidns_holder() -+ - criu_pid = os.fork() - if criu_pid == 0: - run_criu(sys.argv[1:]) --- -2.35.1 - diff --git a/0229-apparmor-Fix-Wfortify-source-for-Clang.patch b/0229-apparmor-Fix-Wfortify-source-for-Clang.patch deleted file mode 100644 index db3238f..0000000 --- a/0229-apparmor-Fix-Wfortify-source-for-Clang.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 32135702ea15c977485ca66cfedd1410896c895c Mon Sep 17 00:00:00 2001 -From: Fangrui Song -Date: Fri, 25 Mar 2022 17:18:30 -0700 -Subject: [PATCH 229/249] apparmor: Fix -Wfortify-source for Clang - -``` -criu/apparmor.c:679:26: error: 'fscanf' may overflow; destination buffer in argument 3 has size 48, but the corresponding specifier may require size 49 [-Werror,-Wfortify-source] - ret = fscanf(f, "%48s", contents); -``` -The buffer size should be at least one larger than the fscanf maximum -field width. - -Fixes: 8d992a680ef3 ("lsm: support checkpoint/restore of stacked apparmor profiles") -Signed-off-by: Fangrui Song ---- - criu/apparmor.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/criu/apparmor.c b/criu/apparmor.c -index f9ad79619..cc9e7ac2a 100644 ---- a/criu/apparmor.c -+++ b/criu/apparmor.c -@@ -668,7 +668,7 @@ int dump_aa_namespaces(void) - - bool check_aa_ns_dumping(void) - { -- char contents[48]; -+ char contents[49]; - int major, minor, ret; - FILE *f; - --- -2.35.1 - diff --git a/0230-style-delete-some-redundant-code.patch b/0230-style-delete-some-redundant-code.patch deleted file mode 100644 index 0723e1d..0000000 --- a/0230-style-delete-some-redundant-code.patch +++ /dev/null @@ -1,49 +0,0 @@ -From e974a40c0a6055d102bad608d8b1364b9a32fcfe Mon Sep 17 00:00:00 2001 -From: jiang wei -Date: Wed, 23 Mar 2022 21:48:16 +0800 -Subject: [PATCH 230/249] style: delete some redundant code - -There is some redundant in compel/src/main.c, making it better - -Signed-off-by: jiang wei ---- - compel/src/main.c | 6 +----- - 1 file changed, 1 insertion(+), 5 deletions(-) - -diff --git a/compel/src/main.c b/compel/src/main.c -index f461ff04d..632354582 100644 ---- a/compel/src/main.c -+++ b/compel/src/main.c -@@ -94,7 +94,6 @@ static int piegen(void) - } - - if (handle_binary(mem, st.st_size)) { -- close(fd), fd = -1; - unlink(opts.output_filename); - goto err; - } -@@ -102,8 +101,7 @@ static int piegen(void) - ret = 0; - - err: -- if (fd >= 0) -- close(fd); -+ close(fd); - if (opts.fout) - fclose(opts.fout); - if (!ret) -@@ -347,11 +345,9 @@ int main(int argc, char *argv[]) - printf("Version: %d.%d.%d\n", COMPEL_SO_VERSION_MAJOR, COMPEL_SO_VERSION_MINOR, - COMPEL_SO_VERSION_SUBLEVEL); - exit(0); -- break; - default: // '?' - // error message already printed by getopt_long() - return usage(1); -- break; - } - } - --- -2.35.1 - diff --git a/0231-mount-fix-Wunused-but-set-variable-for-Clang-15.patch b/0231-mount-fix-Wunused-but-set-variable-for-Clang-15.patch deleted file mode 100644 index 9b8d5bf..0000000 --- a/0231-mount-fix-Wunused-but-set-variable-for-Clang-15.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 1789a6e25730769e1297632e2059c68c40859aec Mon Sep 17 00:00:00 2001 -From: Fangrui Song -Date: Fri, 25 Mar 2022 17:27:11 -0700 -Subject: [PATCH 231/249] mount: fix -Wunused-but-set-variable for Clang 15 - -Since https://reviews.llvm.org/D122271, Clang -Wset-but-unused-variable -gets smarter to warn about unused post-increments. - -Signed-off-by: Fangrui Song ---- - criu/mount.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/criu/mount.c b/criu/mount.c -index 8b6cdaf45..65e186af9 100644 ---- a/criu/mount.c -+++ b/criu/mount.c -@@ -1991,6 +1991,7 @@ static int mnt_tree_for_each_reverse(struct mount_info *m, int (*fn)(struct moun - int progress = 0; - - MNT_TREE_WALK(m, prev, MNT_WALK_NONE, fn, (struct list_head *)NULL, progress); -+ (void)progress; // Suppress -Wused-but-unset-variable for clang>=15 - - return 0; - } --- -2.35.1 - diff --git a/0232-compel-add-rseq-syscall-into-compel-std-plugin-sysca.patch b/0232-compel-add-rseq-syscall-into-compel-std-plugin-sysca.patch deleted file mode 100644 index 10e0ff5..0000000 --- a/0232-compel-add-rseq-syscall-into-compel-std-plugin-sysca.patch +++ /dev/null @@ -1,76 +0,0 @@ -From 83d4d8a4f22e7820687439afe7622cb5be7bed67 Mon Sep 17 00:00:00 2001 -From: Alexander Mikhalitsyn -Date: Tue, 21 Dec 2021 17:38:25 +0300 -Subject: [PATCH 232/249] compel: add rseq syscall into compel std plugin - syscall tables - -Add rseq syscall numbers for: -arm/aarch64, mips64, ppc64le, s390, x86_64/x86 - -Signed-off-by: Alexander Mikhalitsyn ---- - compel/arch/arm/plugins/std/syscalls/syscall.def | 1 + - compel/arch/mips/plugins/std/syscalls/syscall_64.tbl | 1 + - compel/arch/ppc64/plugins/std/syscalls/syscall-ppc64.tbl | 1 + - compel/arch/s390/plugins/std/syscalls/syscall-s390.tbl | 1 + - compel/arch/x86/plugins/std/syscalls/syscall_32.tbl | 1 + - compel/arch/x86/plugins/std/syscalls/syscall_64.tbl | 1 + - 6 files changed, 6 insertions(+) - -diff --git a/compel/arch/arm/plugins/std/syscalls/syscall.def b/compel/arch/arm/plugins/std/syscalls/syscall.def -index c9bccc386..8bcc3cc50 100644 ---- a/compel/arch/arm/plugins/std/syscalls/syscall.def -+++ b/compel/arch/arm/plugins/std/syscalls/syscall.def -@@ -121,3 +121,4 @@ clone3 435 435 (struct clone_args *uargs, size_t size) - pidfd_open 434 434 (pid_t pid, unsigned int flags) - openat2 437 437 (int dirfd, char *pathname, struct open_how *how, size_t size) - pidfd_getfd 438 438 (int pidfd, int targetfd, unsigned int flags) -+rseq 293 398 (void *rseq, uint32_t rseq_len, int flags, uint32_t sig) -diff --git a/compel/arch/mips/plugins/std/syscalls/syscall_64.tbl b/compel/arch/mips/plugins/std/syscalls/syscall_64.tbl -index a74e694e2..505ec849d 100644 ---- a/compel/arch/mips/plugins/std/syscalls/syscall_64.tbl -+++ b/compel/arch/mips/plugins/std/syscalls/syscall_64.tbl -@@ -118,3 +118,4 @@ __NR_clone3 5435 sys_clone3 (struct clone_args *uargs, size_t size) - __NR_pidfd_open 5434 sys_pidfd_open (pid_t pid, unsigned int flags) - __NR_openat2 5437 sys_openat2 (int dirfd, char *pathname, struct open_how *how, size_t size) - __NR_pidfd_getfd 5438 sys_pidfd_getfd (int pidfd, int targetfd, unsigned int flags) -+__NR_rseq 5327 sys_rseq (void *rseq, uint32_t rseq_len, int flags, uint32_t sig) -diff --git a/compel/arch/ppc64/plugins/std/syscalls/syscall-ppc64.tbl b/compel/arch/ppc64/plugins/std/syscalls/syscall-ppc64.tbl -index 648239182..af40d7104 100644 ---- a/compel/arch/ppc64/plugins/std/syscalls/syscall-ppc64.tbl -+++ b/compel/arch/ppc64/plugins/std/syscalls/syscall-ppc64.tbl -@@ -117,3 +117,4 @@ __NR_clone3 435 sys_clone3 (struct clone_args *uargs, size_t size) - __NR_pidfd_open 434 sys_pidfd_open (pid_t pid, unsigned int flags) - __NR_openat2 437 sys_openat2 (int dirfd, char *pathname, struct open_how *how, size_t size) - __NR_pidfd_getfd 438 sys_pidfd_getfd (int pidfd, int targetfd, unsigned int flags) -+__NR_rseq 387 sys_rseq (void *rseq, uint32_t rseq_len, int flags, uint32_t sig) -diff --git a/compel/arch/s390/plugins/std/syscalls/syscall-s390.tbl b/compel/arch/s390/plugins/std/syscalls/syscall-s390.tbl -index 169458296..6a349e1cb 100644 ---- a/compel/arch/s390/plugins/std/syscalls/syscall-s390.tbl -+++ b/compel/arch/s390/plugins/std/syscalls/syscall-s390.tbl -@@ -117,3 +117,4 @@ __NR_clone3 435 sys_clone3 (struct clone_args *uargs, size_t size) - __NR_pidfd_open 434 sys_pidfd_open (pid_t pid, unsigned int flags) - __NR_openat2 437 sys_openat2 (int dirfd, char *pathname, struct open_how *how, size_t size) - __NR_pidfd_getfd 438 sys_pidfd_getfd (int pidfd, int targetfd, unsigned int flags) -+__NR_rseq 383 sys_rseq (void *rseq, uint32_t rseq_len, int flags, uint32_t sig) -diff --git a/compel/arch/x86/plugins/std/syscalls/syscall_32.tbl b/compel/arch/x86/plugins/std/syscalls/syscall_32.tbl -index 4179a7f5b..a119a59b2 100644 ---- a/compel/arch/x86/plugins/std/syscalls/syscall_32.tbl -+++ b/compel/arch/x86/plugins/std/syscalls/syscall_32.tbl -@@ -105,3 +105,4 @@ __NR_clone3 435 sys_clone3 (struct clone_args *uargs, size_t size) - __NR_pidfd_open 434 sys_pidfd_open (pid_t pid, unsigned int flags) - __NR_openat2 437 sys_openat2 (int dirfd, char *pathname, struct open_how *how, size_t size) - __NR_pidfd_getfd 438 sys_pidfd_getfd (int pidfd, int targetfd, unsigned int flags) -+__NR_rseq 386 sys_rseq (void *rseq, uint32_t rseq_len, int flags, uint32_t sig) -diff --git a/compel/arch/x86/plugins/std/syscalls/syscall_64.tbl b/compel/arch/x86/plugins/std/syscalls/syscall_64.tbl -index 9c27ab8b5..16dd86e79 100644 ---- a/compel/arch/x86/plugins/std/syscalls/syscall_64.tbl -+++ b/compel/arch/x86/plugins/std/syscalls/syscall_64.tbl -@@ -116,3 +116,4 @@ __NR_clone3 435 sys_clone3 (struct clone_args *uargs, size_t size) - __NR_pidfd_open 434 sys_pidfd_open (pid_t pid, unsigned int flags) - __NR_openat2 437 sys_openat2 (int dirfd, char *pathname, struct open_how *how, size_t size) - __NR_pidfd_getfd 438 sys_pidfd_getfd (int pidfd, int targetfd, unsigned int flags) -+__NR_rseq 334 sys_rseq (void *rseq, uint32_t rseq_len, int flags, uint32_t sig) --- -2.35.1 - diff --git a/0233-kerndat-check-for-rseq-syscall-support.patch b/0233-kerndat-check-for-rseq-syscall-support.patch deleted file mode 100644 index cfda6e6..0000000 --- a/0233-kerndat-check-for-rseq-syscall-support.patch +++ /dev/null @@ -1,62 +0,0 @@ -From a01c8c82a0bdb066cdc59f96184740b6bbe366b6 Mon Sep 17 00:00:00 2001 -From: Alexander Mikhalitsyn -Date: Tue, 21 Dec 2021 18:27:52 +0300 -Subject: [PATCH 233/249] kerndat: check for rseq syscall support - -Signed-off-by: Alexander Mikhalitsyn ---- - criu/include/kerndat.h | 1 + - criu/kerndat.c | 18 ++++++++++++++++++ - 2 files changed, 19 insertions(+) - -diff --git a/criu/include/kerndat.h b/criu/include/kerndat.h -index de14028f5..986dcdc09 100644 ---- a/criu/include/kerndat.h -+++ b/criu/include/kerndat.h -@@ -80,6 +80,7 @@ struct kerndat_s { - dev_t hugetlb_dev[HUGETLB_MAX]; - bool has_move_mount_set_group; - bool has_openat2; -+ bool has_rseq; - }; - - extern struct kerndat_s kdat; -diff --git a/criu/kerndat.c b/criu/kerndat.c -index 93617012a..05cc5293b 100644 ---- a/criu/kerndat.c -+++ b/criu/kerndat.c -@@ -905,6 +905,20 @@ static int kerndat_x86_has_ptrace_fpu_xsave_bug(void) - return 0; - } - -+static int kerndat_has_rseq(void) -+{ -+ if (syscall(__NR_rseq, NULL, 0, 0, 0) != -1) { -+ pr_err("rseq should fail\n"); -+ return -1; -+ } -+ if (errno == ENOSYS) -+ pr_info("rseq syscall isn't supported\n"); -+ else -+ kdat.has_rseq = true; -+ -+ return 0; -+} -+ - int kerndat_sockopt_buf_lock(void) - { - int exit_code = -1; -@@ -1606,6 +1620,10 @@ int kerndat_init(void) - pr_err("kerndat_has_openat2 failed when initializing kerndat.\n"); - ret = -1; - } -+ if (!ret && kerndat_has_rseq()) { -+ pr_err("kerndat_has_rseq failed when initializing kerndat.\n"); -+ ret = -1; -+ } - - kerndat_lsm(); - kerndat_mmap_min_addr(); --- -2.35.1 - diff --git a/0234-util-move-fork_and_ptrace_attach-helper-from-cr-chec.patch b/0234-util-move-fork_and_ptrace_attach-helper-from-cr-chec.patch deleted file mode 100644 index 102239a..0000000 --- a/0234-util-move-fork_and_ptrace_attach-helper-from-cr-chec.patch +++ /dev/null @@ -1,164 +0,0 @@ -From 322699312bc16316473f3760eb1548982412979a Mon Sep 17 00:00:00 2001 -From: Alexander Mikhalitsyn -Date: Tue, 21 Dec 2021 21:17:16 +0300 -Subject: [PATCH 234/249] util: move fork_and_ptrace_attach helper from - cr-check - -Signed-off-by: Alexander Mikhalitsyn ---- - criu/cr-check.c | 57 --------------------------------------------- - criu/include/util.h | 1 + - criu/util.c | 57 +++++++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 58 insertions(+), 57 deletions(-) - -diff --git a/criu/cr-check.c b/criu/cr-check.c -index 52393cc8b..381184374 100644 ---- a/criu/cr-check.c -+++ b/criu/cr-check.c -@@ -537,63 +537,6 @@ static int check_sigqueuinfo(void) - return 0; - } - --static pid_t fork_and_ptrace_attach(int (*child_setup)(void)) --{ -- pid_t pid; -- int sk_pair[2], sk; -- char c = 0; -- -- if (socketpair(PF_LOCAL, SOCK_SEQPACKET, 0, sk_pair)) { -- pr_perror("socketpair"); -- return -1; -- } -- -- pid = fork(); -- if (pid < 0) { -- pr_perror("fork"); -- return -1; -- } else if (pid == 0) { -- sk = sk_pair[1]; -- close(sk_pair[0]); -- -- if (child_setup && child_setup() != 0) -- exit(1); -- -- if (write(sk, &c, 1) != 1) { -- pr_perror("write"); -- exit(1); -- } -- -- while (1) -- sleep(1000); -- exit(1); -- } -- -- sk = sk_pair[0]; -- close(sk_pair[1]); -- -- if (read(sk, &c, 1) != 1) { -- close(sk); -- kill(pid, SIGKILL); -- waitpid(pid, NULL, 0); -- pr_perror("read"); -- return -1; -- } -- -- close(sk); -- -- if (ptrace(PTRACE_ATTACH, pid, NULL, NULL) == -1) { -- pr_perror("Unable to ptrace the child"); -- kill(pid, SIGKILL); -- waitpid(pid, NULL, 0); -- return -1; -- } -- -- waitpid(pid, NULL, 0); -- -- return pid; --} -- - static int check_ptrace_peeksiginfo(void) - { - struct ptrace_peeksiginfo_args arg; -diff --git a/criu/include/util.h b/criu/include/util.h -index 5ccd24722..4e29c079e 100644 ---- a/criu/include/util.h -+++ b/criu/include/util.h -@@ -166,6 +166,7 @@ extern int is_anon_link_type(char *link, char *type); - - extern int cr_system(int in, int out, int err, char *cmd, char *const argv[], unsigned flags); - extern int cr_system_userns(int in, int out, int err, char *cmd, char *const argv[], unsigned flags, int userns_pid); -+extern pid_t fork_and_ptrace_attach(int (*child_setup)(void)); - extern int cr_daemon(int nochdir, int noclose, int close_fd); - extern int status_ready(void); - extern int is_root_user(void); -diff --git a/criu/util.c b/criu/util.c -index f8da4ac5c..4f871f594 100644 ---- a/criu/util.c -+++ b/criu/util.c -@@ -658,6 +658,63 @@ out: - return ret; - } - -+pid_t fork_and_ptrace_attach(int (*child_setup)(void)) -+{ -+ pid_t pid; -+ int sk_pair[2], sk; -+ char c = 0; -+ -+ if (socketpair(PF_LOCAL, SOCK_SEQPACKET, 0, sk_pair)) { -+ pr_perror("socketpair"); -+ return -1; -+ } -+ -+ pid = fork(); -+ if (pid < 0) { -+ pr_perror("fork"); -+ return -1; -+ } else if (pid == 0) { -+ sk = sk_pair[1]; -+ close(sk_pair[0]); -+ -+ if (child_setup && child_setup() != 0) -+ exit(1); -+ -+ if (write(sk, &c, 1) != 1) { -+ pr_perror("write"); -+ exit(1); -+ } -+ -+ while (1) -+ sleep(1000); -+ exit(1); -+ } -+ -+ sk = sk_pair[0]; -+ close(sk_pair[1]); -+ -+ if (read(sk, &c, 1) != 1) { -+ close(sk); -+ kill(pid, SIGKILL); -+ waitpid(pid, NULL, 0); -+ pr_perror("read"); -+ return -1; -+ } -+ -+ close(sk); -+ -+ if (ptrace(PTRACE_ATTACH, pid, NULL, NULL) == -1) { -+ pr_perror("Unable to ptrace the child"); -+ kill(pid, SIGKILL); -+ waitpid(pid, NULL, 0); -+ return -1; -+ } -+ -+ waitpid(pid, NULL, 0); -+ -+ return pid; -+} -+ - int status_ready(void) - { - char c = 0; --- -2.35.1 - diff --git a/0235-cr-check-Add-ptrace-rseq-conf-dump-feature.patch b/0235-cr-check-Add-ptrace-rseq-conf-dump-feature.patch deleted file mode 100644 index 7b17fb3..0000000 --- a/0235-cr-check-Add-ptrace-rseq-conf-dump-feature.patch +++ /dev/null @@ -1,163 +0,0 @@ -From 0c0bc3dedcf68e59baa6544d2e0a9b3275559376 Mon Sep 17 00:00:00 2001 -From: Alexander Mikhalitsyn -Date: Tue, 21 Dec 2021 18:29:14 +0300 -Subject: [PATCH 235/249] cr-check: Add ptrace rseq conf dump feature - -Add "get_rseq_conf" feature corresponding to the -ptrace(PTRACE_GET_RSEQ_CONFIGURATION) support. - -Signed-off-by: Alexander Mikhalitsyn ---- - compel/include/uapi/ptrace.h | 12 +++++++++++ - criu/cr-check.c | 11 ++++++++++ - criu/include/kerndat.h | 1 + - criu/kerndat.c | 41 ++++++++++++++++++++++++++++++++++++ - 4 files changed, 65 insertions(+) - -diff --git a/compel/include/uapi/ptrace.h b/compel/include/uapi/ptrace.h -index 533e0569f..63dfee97f 100644 ---- a/compel/include/uapi/ptrace.h -+++ b/compel/include/uapi/ptrace.h -@@ -65,6 +65,18 @@ typedef struct { - uint64_t flags; /* Output: filter's flags */ - } seccomp_metadata_t; - -+#ifndef PTRACE_GET_RSEQ_CONFIGURATION -+#define PTRACE_GET_RSEQ_CONFIGURATION 0x420f -+ -+struct __ptrace_rseq_configuration { -+ uint64_t rseq_abi_pointer; -+ uint32_t rseq_abi_size; -+ uint32_t signature; -+ uint32_t flags; -+ uint32_t pad; -+}; -+#endif -+ - #ifdef PTRACE_EVENT_STOP - #if PTRACE_EVENT_STOP == 7 /* Bad value from Linux 3.1-3.3, fixed in 3.4 */ - #undef PTRACE_EVENT_STOP -diff --git a/criu/cr-check.c b/criu/cr-check.c -index 381184374..a172806f5 100644 ---- a/criu/cr-check.c -+++ b/criu/cr-check.c -@@ -798,6 +798,15 @@ static int check_ptrace_dump_seccomp_filters(void) - return ret; - } - -+static int check_ptrace_get_rseq_conf(void) -+{ -+ if (!kdat.has_ptrace_get_rseq_conf) { -+ pr_warn("ptrace(PTRACE_GET_RSEQ_CONFIGURATION) isn't supported. C/R of processes which are using rseq() won't work.\n"); -+ return -1; -+ } -+ return 0; -+} -+ - static int check_mem_dirty_track(void) - { - if (!kdat.has_dirty_track) { -@@ -1475,6 +1484,7 @@ int cr_check(void) - ret |= check_memfd_hugetlb(); - ret |= check_move_mount_set_group(); - ret |= check_openat2(); -+ ret |= check_ptrace_get_rseq_conf(); - } - - /* -@@ -1591,6 +1601,7 @@ static struct feature_list feature_list[] = { - { "memfd_hugetlb", check_memfd_hugetlb }, - { "move_mount_set_group", check_move_mount_set_group }, - { "openat2", check_openat2 }, -+ { "get_rseq_conf", check_ptrace_get_rseq_conf }, - { NULL, NULL }, - }; - -diff --git a/criu/include/kerndat.h b/criu/include/kerndat.h -index 986dcdc09..83d867e75 100644 ---- a/criu/include/kerndat.h -+++ b/criu/include/kerndat.h -@@ -81,6 +81,7 @@ struct kerndat_s { - bool has_move_mount_set_group; - bool has_openat2; - bool has_rseq; -+ bool has_ptrace_get_rseq_conf; - }; - - extern struct kerndat_s kdat; -diff --git a/criu/kerndat.c b/criu/kerndat.c -index 05cc5293b..04067ab57 100644 ---- a/criu/kerndat.c -+++ b/criu/kerndat.c -@@ -4,6 +4,8 @@ - #include - #include - #include -+#include -+#include - #include - #include - #include -@@ -37,6 +39,7 @@ - #include "sockets.h" - #include "net.h" - #include "tun.h" -+#include - #include - #include "netfilter.h" - #include "fsnotify.h" -@@ -919,6 +922,40 @@ static int kerndat_has_rseq(void) - return 0; - } - -+static int kerndat_has_ptrace_get_rseq_conf(void) -+{ -+ pid_t pid; -+ int len; -+ struct __ptrace_rseq_configuration rseq; -+ -+ pid = fork_and_ptrace_attach(NULL); -+ if (pid < 0) -+ return -1; -+ -+ len = ptrace(PTRACE_GET_RSEQ_CONFIGURATION, pid, sizeof(rseq), &rseq); -+ if (len != sizeof(rseq)) { -+ kdat.has_ptrace_get_rseq_conf = false; -+ pr_info("ptrace(PTRACE_GET_RSEQ_CONFIGURATION) is not supported\n"); -+ goto out; -+ } -+ -+ /* -+ * flags is always zero from the kernel side, if it will be changed -+ * we need to pay attention to that and, possibly, make changes on the CRIU side. -+ */ -+ if (rseq.flags != 0) { -+ kdat.has_ptrace_get_rseq_conf = false; -+ pr_err("ptrace(PTRACE_GET_RSEQ_CONFIGURATION): rseq.flags != 0\n"); -+ } else { -+ kdat.has_ptrace_get_rseq_conf = true; -+ } -+ -+out: -+ kill(pid, SIGKILL); -+ waitpid(pid, NULL, 0); -+ return 0; -+} -+ - int kerndat_sockopt_buf_lock(void) - { - int exit_code = -1; -@@ -1624,6 +1661,10 @@ int kerndat_init(void) - pr_err("kerndat_has_rseq failed when initializing kerndat.\n"); - ret = -1; - } -+ if (!ret && kerndat_has_ptrace_get_rseq_conf()) { -+ pr_err("kerndat_has_ptrace_get_rseq_conf failed when initializing kerndat.\n"); -+ ret = -1; -+ } - - kerndat_lsm(); - kerndat_mmap_min_addr(); --- -2.35.1 - diff --git a/0236-rseq-initial-support.patch b/0236-rseq-initial-support.patch deleted file mode 100644 index 388f442..0000000 --- a/0236-rseq-initial-support.patch +++ /dev/null @@ -1,664 +0,0 @@ -From f8b1b85be77e48477e3449a9c2c70080799444b2 Mon Sep 17 00:00:00 2001 -From: Alexander Mikhalitsyn -Date: Tue, 21 Dec 2021 23:27:26 +0300 -Subject: [PATCH 236/249] rseq: initial support - -TODO: -1. properly handle case when the kernel has rseq() -support but has no ptrace(PTRACE_GET_RSEQ_CONFIGURATION) -support and user processes haven't used rseq(). -2. properly handle "transient" states, when CRIU -comes during rseq was executed. We need test for this -case with some "heavy" rseq + we need to properly handle -RSEQ_CS_* flags. - -Fixes: https://github.com/checkpoint-restore/criu/issues/1696 - -Reported-by: Radostin Stoyanov -Suggested-by: Florian Weimer -Signed-off-by: Alexander Mikhalitsyn ---- - criu/cr-dump.c | 99 +++++++++++++++++++++++++++ - criu/cr-restore.c | 22 ++++++ - criu/include/linux/rseq.h | 137 ++++++++++++++++++++++++++++++++++++++ - criu/include/parasite.h | 7 ++ - criu/include/restorer.h | 7 ++ - criu/parasite-syscall.c | 11 +++ - criu/pie/parasite.c | 100 ++++++++++++++++++++++++++++ - criu/pie/restorer.c | 25 +++++++ - images/Makefile | 1 + - images/core.proto | 2 + - images/rseq.proto | 9 +++ - 11 files changed, 420 insertions(+) - create mode 100644 criu/include/linux/rseq.h - create mode 100644 images/rseq.proto - -diff --git a/criu/cr-dump.c b/criu/cr-dump.c -index eb1fb5e9a..eb645a597 100644 ---- a/criu/cr-dump.c -+++ b/criu/cr-dump.c -@@ -45,6 +45,7 @@ - #include "proc_parse.h" - #include "parasite.h" - #include "parasite-syscall.h" -+#include "compel/ptrace.h" - #include "files.h" - #include "files-reg.h" - #include "shmem.h" -@@ -187,6 +188,25 @@ static int dump_sched_info(int pid, ThreadCoreEntry *tc) - return 0; - } - -+static int check_thread_rseq(pid_t tid, const struct parasite_check_rseq *ti_rseq, bool has_tc_rseq_entry) -+{ -+ if (!kdat.has_rseq || kdat.has_ptrace_get_rseq_conf) -+ return 0; -+ -+ pr_debug("%d has rseq_inited = %d\n", tid, ti_rseq->rseq_inited); -+ -+ /* -+ * We have no kdat.has_ptrace_get_rseq_conf and user -+ * process has rseq() used, let's fail dump. -+ */ -+ if (ti_rseq->rseq_inited) { -+ pr_err("%d has rseq but kernel lacks get_rseq_conf feature\n", tid); -+ return -1; -+ } -+ -+ return 0; -+} -+ - struct cr_imgset *glob_imgset; - - static int collect_fds(pid_t pid, struct parasite_drain_fd **dfds) -@@ -717,6 +737,17 @@ int dump_thread_core(int pid, CoreEntry *core, const struct parasite_dump_thread - if (!ret) - ret = seccomp_dump_thread(pid, tc); - -+ /* -+ * We are dumping rseq() in the dump_thread_rseq() function, -+ * *before* processes gets infected (because of ptrace requests -+ * API restriction). At this point, if the kernel lacks -+ * kdat.has_ptrace_get_rseq_conf support we have to ensure -+ * that dumpable processes haven't initialized rseq() or -+ * fail dump if rseq() was used. -+ */ -+ if (!ret) -+ ret = check_thread_rseq(pid, &ti->rseq, !!tc->rseq_entry); -+ - return ret; - } - -@@ -1003,6 +1034,68 @@ static int dump_task_signals(pid_t pid, struct pstree_item *item) - return 0; - } - -+static int dump_thread_rseq(pid_t tid, RseqEntry **rseqep) -+{ -+ struct __ptrace_rseq_configuration rseq; -+ RseqEntry *rseqe = NULL; -+ int ret; -+ -+ /* -+ * If we are here it means that rseq() syscall is supported, -+ * but ptrace(PTRACE_GET_RSEQ_CONFIGURATION) isn't supported, -+ * we can just fail dump here. But this is bad idea, IMHO. -+ * -+ * So, we will try to detect if victim process was used rseq(). -+ * See check_rseq() and check_thread_rseq() functions. -+ */ -+ if (!kdat.has_ptrace_get_rseq_conf) -+ return 0; -+ -+ ret = ptrace(PTRACE_GET_RSEQ_CONFIGURATION, tid, sizeof(rseq), &rseq); -+ if (ret != sizeof(rseq)) { -+ pr_perror("ptrace(PTRACE_GET_RSEQ_CONFIGURATION, %d) = %d", tid, ret); -+ return -1; -+ } -+ -+ if (rseq.flags != 0) { -+ pr_err("something wrong with ptrace(PTRACE_GET_RSEQ_CONFIGURATION, %d) flags = 0x%x\n", tid, -+ rseq.flags); -+ return -1; -+ } -+ -+ pr_err("Dump rseq of %d: ptr = 0x%lx sign = 0x%x\n", tid, (unsigned long)rseq.rseq_abi_pointer, rseq.signature); -+ -+ rseqe = xmalloc(sizeof(*rseqe)); -+ if (!rseqe) -+ return -1; -+ -+ rseq_entry__init(rseqe); -+ -+ rseqe->rseq_abi_pointer = rseq.rseq_abi_pointer; -+ rseqe->rseq_abi_size = rseq.rseq_abi_size; -+ rseqe->signature = rseq.signature; -+ -+ *rseqep = rseqe; -+ -+ return 0; -+} -+ -+static int dump_task_rseq(pid_t pid, struct pstree_item *item) -+{ -+ int i; -+ -+ /* if rseq() syscall isn't supported then nothing to dump */ -+ if (!kdat.has_rseq) -+ return 0; -+ -+ for (i = 0; i < item->nr_threads; i++) { -+ if (dump_thread_rseq(item->threads[i].real, &item->core[i]->thread_core->rseq_entry)) -+ return -1; -+ } -+ -+ return 0; -+} -+ - static struct proc_pid_stat pps_buf; - - static int dump_task_threads(struct parasite_ctl *parasite_ctl, const struct pstree_item *item) -@@ -1298,6 +1391,12 @@ static int dump_one_task(struct pstree_item *item, InventoryEntry *parent_ie) - goto err; - } - -+ ret = dump_task_rseq(pid, item); -+ if (ret) { -+ pr_err("Dump %d rseq failed %d\n", pid, ret); -+ goto err; -+ } -+ - parasite_ctl = parasite_infect_seized(pid, item, &vmas); - if (!parasite_ctl) { - pr_err("Can't infect (pid: %d) with parasite\n", pid); -diff --git a/criu/cr-restore.c b/criu/cr-restore.c -index 9d2d957f8..8bfa3ef8c 100644 ---- a/criu/cr-restore.c -+++ b/criu/cr-restore.c -@@ -2971,6 +2971,24 @@ static int prep_sched_info(struct rst_sched_param *sp, ThreadCoreEntry *tc) - return 0; - } - -+static int prep_rseq(struct rst_rseq_param *rseq, ThreadCoreEntry *tc) -+{ -+ /* compatibility with older CRIU versions */ -+ if (!tc->rseq_entry) -+ return 0; -+ -+ rseq->rseq_abi_pointer = tc->rseq_entry->rseq_abi_pointer; -+ rseq->rseq_abi_size = tc->rseq_entry->rseq_abi_size; -+ rseq->signature = tc->rseq_entry->signature; -+ -+ if (rseq->rseq_abi_pointer && !kdat.has_rseq) { -+ pr_err("rseq: can't restore as kernel doesn't support it\n"); -+ return -1; -+ } -+ -+ return 0; -+} -+ - static rlim_t decode_rlim(rlim_t ival) - { - return ival == -1 ? RLIM_INFINITY : ival; -@@ -3681,6 +3699,10 @@ static int sigreturn_restore(pid_t pid, struct task_restore_args *task_args, uns - thread_args[i].clear_tid_addr = CORE_THREAD_ARCH_INFO(tcore)->clear_tid_addr; - core_get_tls(tcore, &thread_args[i].tls); - -+ ret = prep_rseq(&thread_args[i].rseq, tcore->thread_core); -+ if (ret) -+ goto err; -+ - rst_reloc_creds(&thread_args[i], &creds_pos_next); - - thread_args[i].futex_rla = tcore->thread_core->futex_rla; -diff --git a/criu/include/linux/rseq.h b/criu/include/linux/rseq.h -new file mode 100644 -index 000000000..b227aefdf ---- /dev/null -+++ b/criu/include/linux/rseq.h -@@ -0,0 +1,137 @@ -+/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ -+#ifndef _UAPI_LINUX_RSEQ_H -+#define _UAPI_LINUX_RSEQ_H -+ -+/* -+ * linux/rseq.h -+ * -+ * Restartable sequences system call API -+ * -+ * Copyright (c) 2015-2018 Mathieu Desnoyers -+ */ -+ -+#include -+#include -+ -+enum rseq_cpu_id_state { -+ RSEQ_CPU_ID_UNINITIALIZED = -1, -+ RSEQ_CPU_ID_REGISTRATION_FAILED = -2, -+}; -+ -+enum rseq_flags { -+ RSEQ_FLAG_UNREGISTER = (1 << 0), -+}; -+ -+enum rseq_cs_flags_bit { -+ RSEQ_CS_FLAG_NO_RESTART_ON_PREEMPT_BIT = 0, -+ RSEQ_CS_FLAG_NO_RESTART_ON_SIGNAL_BIT = 1, -+ RSEQ_CS_FLAG_NO_RESTART_ON_MIGRATE_BIT = 2, -+}; -+ -+enum rseq_cs_flags { -+ RSEQ_CS_FLAG_NO_RESTART_ON_PREEMPT = (1U << RSEQ_CS_FLAG_NO_RESTART_ON_PREEMPT_BIT), -+ RSEQ_CS_FLAG_NO_RESTART_ON_SIGNAL = (1U << RSEQ_CS_FLAG_NO_RESTART_ON_SIGNAL_BIT), -+ RSEQ_CS_FLAG_NO_RESTART_ON_MIGRATE = (1U << RSEQ_CS_FLAG_NO_RESTART_ON_MIGRATE_BIT), -+}; -+ -+/* -+ * struct rseq_cs is aligned on 4 * 8 bytes to ensure it is always -+ * contained within a single cache-line. It is usually declared as -+ * link-time constant data. -+ */ -+struct rseq_cs { -+ /* Version of this structure. */ -+ __u32 version; -+ /* enum rseq_cs_flags */ -+ __u32 flags; -+ __u64 start_ip; -+ /* Offset from start_ip. */ -+ __u64 post_commit_offset; -+ __u64 abort_ip; -+} __attribute__((aligned(4 * sizeof(__u64)))); -+ -+/* -+ * We have to have our own copy of struct rseq definition because -+ * of breaking UAPI change: -+ * https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/commit/?id=bfdf4e6208051ed7165b2e92035b4bf11f43eb63 -+ */ -+/* -+ * struct rseq is aligned on 4 * 8 bytes to ensure it is always -+ * contained within a single cache-line. -+ * -+ * A single struct rseq per thread is allowed. -+ */ -+struct criu_rseq { -+ /* -+ * Restartable sequences cpu_id_start field. Updated by the -+ * kernel. Read by user-space with single-copy atomicity -+ * semantics. This field should only be read by the thread which -+ * registered this data structure. Aligned on 32-bit. Always -+ * contains a value in the range of possible CPUs, although the -+ * value may not be the actual current CPU (e.g. if rseq is not -+ * initialized). This CPU number value should always be compared -+ * against the value of the cpu_id field before performing a rseq -+ * commit or returning a value read from a data structure indexed -+ * using the cpu_id_start value. -+ */ -+ __u32 cpu_id_start; -+ /* -+ * Restartable sequences cpu_id field. Updated by the kernel. -+ * Read by user-space with single-copy atomicity semantics. This -+ * field should only be read by the thread which registered this -+ * data structure. Aligned on 32-bit. Values -+ * RSEQ_CPU_ID_UNINITIALIZED and RSEQ_CPU_ID_REGISTRATION_FAILED -+ * have a special semantic: the former means "rseq uninitialized", -+ * and latter means "rseq initialization failed". This value is -+ * meant to be read within rseq critical sections and compared -+ * with the cpu_id_start value previously read, before performing -+ * the commit instruction, or read and compared with the -+ * cpu_id_start value before returning a value loaded from a data -+ * structure indexed using the cpu_id_start value. -+ */ -+ __u32 cpu_id; -+ /* -+ * Restartable sequences rseq_cs field. -+ * -+ * Contains NULL when no critical section is active for the current -+ * thread, or holds a pointer to the currently active struct rseq_cs. -+ * -+ * Updated by user-space, which sets the address of the currently -+ * active rseq_cs at the beginning of assembly instruction sequence -+ * block, and set to NULL by the kernel when it restarts an assembly -+ * instruction sequence block, as well as when the kernel detects that -+ * it is preempting or delivering a signal outside of the range -+ * targeted by the rseq_cs. Also needs to be set to NULL by user-space -+ * before reclaiming memory that contains the targeted struct rseq_cs. -+ * -+ * Read and set by the kernel. Set by user-space with single-copy -+ * atomicity semantics. This field should only be updated by the -+ * thread which registered this data structure. Aligned on 64-bit. -+ * -+ * 32-bit architectures should update the low order bits of the -+ * rseq_cs field, leaving the high order bits initialized to 0. -+ */ -+ __u64 rseq_cs; -+ -+ /* -+ * Restartable sequences flags field. -+ * -+ * This field should only be updated by the thread which -+ * registered this data structure. Read by the kernel. -+ * Mainly used for single-stepping through rseq critical sections -+ * with debuggers. -+ * -+ * - RSEQ_CS_FLAG_NO_RESTART_ON_PREEMPT -+ * Inhibit instruction sequence block restart on preemption -+ * for this thread. -+ * - RSEQ_CS_FLAG_NO_RESTART_ON_SIGNAL -+ * Inhibit instruction sequence block restart on signal -+ * delivery for this thread. -+ * - RSEQ_CS_FLAG_NO_RESTART_ON_MIGRATE -+ * Inhibit instruction sequence block restart on migration for -+ * this thread. -+ */ -+ __u32 flags; -+} __attribute__((aligned(4 * sizeof(__u64)))); -+ -+#endif /* _UAPI_LINUX_RSEQ_H */ -diff --git a/criu/include/parasite.h b/criu/include/parasite.h -index 8107aa49d..5fde80996 100644 ---- a/criu/include/parasite.h -+++ b/criu/include/parasite.h -@@ -164,10 +164,17 @@ struct parasite_dump_creds { - unsigned int groups[0]; - }; - -+struct parasite_check_rseq { -+ bool has_rseq; -+ bool has_ptrace_get_rseq_conf; /* no need to check if supported */ -+ bool rseq_inited; -+}; -+ - struct parasite_dump_thread { - unsigned int *tid_addr; - pid_t tid; - tls_t tls; -+ struct parasite_check_rseq rseq; - stack_t sas; - int pdeath_sig; - char comm[TASK_COMM_LEN]; -diff --git a/criu/include/restorer.h b/criu/include/restorer.h -index 308a0b79b..2e21da522 100644 ---- a/criu/include/restorer.h -+++ b/criu/include/restorer.h -@@ -44,6 +44,12 @@ struct rst_sched_param { - int prio; - }; - -+struct rst_rseq_param { -+ u64 rseq_abi_pointer; -+ u32 rseq_abi_size; -+ u32 signature; -+}; -+ - struct restore_posix_timer { - struct str_posix_timer spt; - struct itimerspec val; -@@ -98,6 +104,7 @@ struct thread_restore_args { - struct task_restore_args *ta; - - tls_t tls; -+ struct rst_rseq_param rseq; - - siginfo_t *siginfo; - unsigned int siginfo_n; -diff --git a/criu/parasite-syscall.c b/criu/parasite-syscall.c -index 7175adee1..ee4fa86f4 100644 ---- a/criu/parasite-syscall.c -+++ b/criu/parasite-syscall.c -@@ -132,6 +132,13 @@ static int alloc_groups_copy_creds(CredsEntry *ce, struct parasite_dump_creds *c - return ce->groups ? 0 : -ENOMEM; - } - -+static void init_parasite_rseq_arg(struct parasite_check_rseq *rseq) -+{ -+ rseq->has_rseq = kdat.has_rseq; -+ rseq->has_ptrace_get_rseq_conf = kdat.has_ptrace_get_rseq_conf; -+ rseq->rseq_inited = false; -+} -+ - int parasite_dump_thread_leader_seized(struct parasite_ctl *ctl, int pid, CoreEntry *core) - { - ThreadCoreEntry *tc = core->thread_core; -@@ -144,6 +151,8 @@ int parasite_dump_thread_leader_seized(struct parasite_ctl *ctl, int pid, CoreEn - pc = args->creds; - pc->cap_last_cap = kdat.last_cap; - -+ init_parasite_rseq_arg(&args->rseq); -+ - ret = compel_rpc_call_sync(PARASITE_CMD_DUMP_THREAD, ctl); - if (ret < 0) - return ret; -@@ -197,6 +206,8 @@ int parasite_dump_thread_seized(struct parasite_thread_ctl *tctl, struct parasit - - compel_arch_get_tls_thread(tctl, &args->tls); - -+ init_parasite_rseq_arg(&args->rseq); -+ - ret = compel_run_in_thread(tctl, PARASITE_CMD_DUMP_THREAD); - if (ret) { - pr_err("Can't init thread in parasite %d\n", pid); -diff --git a/criu/pie/parasite.c b/criu/pie/parasite.c -index bc0a33cd4..a74c7721a 100644 ---- a/criu/pie/parasite.c -+++ b/criu/pie/parasite.c -@@ -8,6 +8,8 @@ - #include - #include - -+#include "linux/rseq.h" -+ - #include "common/config.h" - #include "int.h" - #include "types.h" -@@ -167,6 +169,7 @@ static int dump_posix_timers(struct parasite_dump_posix_timers_args *args) - } - - static int dump_creds(struct parasite_dump_creds *args); -+static int check_rseq(struct parasite_check_rseq *rseq); - - static int dump_thread_common(struct parasite_dump_thread *ti) - { -@@ -197,6 +200,12 @@ static int dump_thread_common(struct parasite_dump_thread *ti) - goto out; - } - -+ ret = check_rseq(&ti->rseq); -+ if (ret) { -+ pr_err("Unable to check if rseq() is initialized: %d\n", ret); -+ goto out; -+ } -+ - ret = dump_creds(ti->creds); - out: - return ret; -@@ -313,6 +322,97 @@ grps_err: - return -1; - } - -+static int check_rseq(struct parasite_check_rseq *rseq) -+{ -+ int ret; -+ unsigned long rseq_abi_pointer; -+ unsigned long rseq_abi_size; -+ uint32_t rseq_signature; -+ void *addr; -+ -+ /* no need to do hacky check if we can get all info from ptrace() */ -+ if (!rseq->has_rseq || rseq->has_ptrace_get_rseq_conf) -+ return 0; -+ -+ /* -+ * We need to determine if victim process has rseq() -+ * initialized, but we have no *any* proper kernel interface -+ * supported at this point. -+ * Our plan: -+ * 1. We know that if we call rseq() syscall and process already -+ * has current->rseq filled, then we get: -+ * -EINVAL if current->rseq != rseq || rseq_len != sizeof(*rseq), -+ * -EPERM if current->rseq_sig != sig), -+ * -EBUSY if current->rseq == rseq && rseq_len == sizeof(*rseq) && -+ * current->rseq_sig != sig -+ * if current->rseq == NULL (rseq() wasn't used) then we go to: -+ * IS_ALIGNED(rseq ...) check, if we fail it we get -EINVAL and it -+ * will be hard to distinguish case when rseq() was initialized or not. -+ * Let's construct arguments payload -+ * with: -+ * 1. correct rseq_abi_size -+ * 2. aligned and correct rseq_abi_pointer -+ * And see what rseq() return to us. -+ * If ret value is: -+ * 0: it means that rseq *wasn't* used and we successfuly registered it, -+ * -EINVAL or : it means that rseq is already initialized, -+ * so we *have* to dump it. But as we have has_ptrace_get_rseq_conf = false, -+ * we should just fail dump as it's unsafe to skip rseq() dump for processes -+ * with rseq() initialized. -+ * -EPERM or -EBUSY: should not happen as we take a fresh memory area for rseq -+ */ -+ addr = (void *)sys_mmap(NULL, sizeof(struct criu_rseq), PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, -+ 0); -+ if (addr == MAP_FAILED) { -+ pr_err("mmap() failed for struct rseq ret = %lx\n", (unsigned long)addr); -+ return -1; -+ } -+ -+ memset(addr, 0, sizeof(struct criu_rseq)); -+ -+ /* sys_mmap returns page aligned addresses */ -+ rseq_abi_pointer = (unsigned long)addr; -+ rseq_abi_size = (unsigned long)sizeof(struct criu_rseq); -+ /* it's not so important to have unique signature for us, -+ * because rseq_abi_pointer is guaranteed to be unique -+ */ -+ rseq_signature = 0x12345612; -+ -+ pr_info("\ttrying sys_rseq(%lx, %lx, %x, %x)\n", rseq_abi_pointer, rseq_abi_size, 0, rseq_signature); -+ ret = sys_rseq((void *)rseq_abi_pointer, rseq_abi_size, 0, rseq_signature); -+ if (ret) { -+ if (ret == -EINVAL) { -+ pr_info("\trseq is initialized in the victim\n"); -+ rseq->rseq_inited = true; -+ -+ ret = 0; -+ } else { -+ pr_err("\tunexpected failure of sys_rseq(%lx, %lx, %x, %x) = %d\n", rseq_abi_pointer, -+ rseq_abi_size, 0, rseq_signature, ret); -+ -+ ret = -1; -+ } -+ } else { -+ ret = sys_rseq((void *)rseq_abi_pointer, sizeof(struct criu_rseq), RSEQ_FLAG_UNREGISTER, -+ rseq_signature); -+ if (ret) { -+ pr_err("\tfailed to unregister sys_rseq(%lx, %lx, %x, %x) = %d\n", rseq_abi_pointer, -+ rseq_abi_size, RSEQ_FLAG_UNREGISTER, rseq_signature, ret); -+ -+ ret = -1; -+ /* we can't do munmap() because rseq is registered and we failed to unregister it */ -+ goto out_nounmap; -+ } -+ -+ rseq->rseq_inited = false; -+ ret = 0; -+ } -+ -+ sys_munmap(addr, sizeof(struct criu_rseq)); -+out_nounmap: -+ return ret; -+} -+ - static int fill_fds_fown(int fd, struct fd_opts *p) - { - int flags, ret; -diff --git a/criu/pie/restorer.c b/criu/pie/restorer.c -index 7aa788181..48acc8cf4 100644 ---- a/criu/pie/restorer.c -+++ b/criu/pie/restorer.c -@@ -425,6 +425,28 @@ static int restore_signals(siginfo_t *ptr, int nr, bool group) - return 0; - } - -+static int restore_rseq(struct rst_rseq_param *rseq) -+{ -+ int ret; -+ -+ if (!rseq->rseq_abi_pointer) { -+ pr_debug("rseq: nothing to restore\n"); -+ return 0; -+ } -+ -+ pr_debug("rseq: rseq_abi_pointer = %lx signature = %x\n", (unsigned long)rseq->rseq_abi_pointer, -+ rseq->signature); -+ -+ ret = sys_rseq(decode_pointer(rseq->rseq_abi_pointer), rseq->rseq_abi_size, 0, rseq->signature); -+ if (ret) { -+ pr_err("failed sys_rseq(%lx, %lx, %x, %x) = %d\n", (unsigned long)rseq->rseq_abi_pointer, -+ (unsigned long)rseq->rseq_abi_size, 0, rseq->signature, ret); -+ return -1; -+ } -+ -+ return 0; -+} -+ - static int restore_seccomp_filter(pid_t tid, struct thread_restore_args *args) - { - unsigned int flags = args->seccomp_force_tsync ? SECCOMP_FILTER_FLAG_TSYNC : 0; -@@ -549,6 +571,9 @@ static int restore_thread_common(struct thread_restore_args *args) - - restore_tls(&args->tls); - -+ if (restore_rseq(&args->rseq)) -+ return -1; -+ - return 0; - } - -diff --git a/images/Makefile b/images/Makefile -index 2eaeb7cad..004e22ec3 100644 ---- a/images/Makefile -+++ b/images/Makefile -@@ -71,6 +71,7 @@ proto-obj-y += img-streamer.o - proto-obj-y += bpfmap-file.o - proto-obj-y += bpfmap-data.o - proto-obj-y += apparmor.o -+proto-obj-y += rseq.o - - CFLAGS += -iquote $(obj)/ - -diff --git a/images/core.proto b/images/core.proto -index b713119f2..35079f366 100644 ---- a/images/core.proto -+++ b/images/core.proto -@@ -14,6 +14,7 @@ import "timer.proto"; - import "creds.proto"; - import "sa.proto"; - import "siginfo.proto"; -+import "rseq.proto"; - - import "opts.proto"; - -@@ -101,6 +102,7 @@ message thread_core_entry { - - optional string comm = 13; - optional uint64 blk_sigset_extended = 14; -+ optional rseq_entry rseq_entry = 15; - } - - message task_rlimits_entry { -diff --git a/images/rseq.proto b/images/rseq.proto -new file mode 100644 -index 000000000..be2800468 ---- /dev/null -+++ b/images/rseq.proto -@@ -0,0 +1,9 @@ -+// SPDX-License-Identifier: MIT -+ -+syntax = "proto2"; -+ -+message rseq_entry { -+ required uint64 rseq_abi_pointer = 1; -+ required uint32 rseq_abi_size = 2; -+ required uint32 signature = 3; -+} --- -2.35.1 - diff --git a/0237-zdtm-add-basic-static-rseq00-test-for-rseq-C-R.patch b/0237-zdtm-add-basic-static-rseq00-test-for-rseq-C-R.patch deleted file mode 100644 index 1b4c2ad..0000000 --- a/0237-zdtm-add-basic-static-rseq00-test-for-rseq-C-R.patch +++ /dev/null @@ -1,223 +0,0 @@ -From 909f410fde00cf70419915344012a8074f59b3ec Mon Sep 17 00:00:00 2001 -From: Alexander Mikhalitsyn -Date: Tue, 21 Dec 2021 23:40:01 +0300 -Subject: [PATCH 237/249] zdtm: add basic static/rseq00 test for rseq C/R - -Signed-off-by: Alexander Mikhalitsyn ---- - test/zdtm/static/Makefile | 1 + - test/zdtm/static/rseq00.c | 180 +++++++++++++++++++++++++++++++++++ - test/zdtm/static/rseq00.desc | 1 + - 3 files changed, 182 insertions(+) - create mode 100644 test/zdtm/static/rseq00.c - create mode 100644 test/zdtm/static/rseq00.desc - -diff --git a/test/zdtm/static/Makefile b/test/zdtm/static/Makefile -index 717306dbb..568886d60 100644 ---- a/test/zdtm/static/Makefile -+++ b/test/zdtm/static/Makefile -@@ -61,6 +61,7 @@ TST_NOFILE := \ - pthread02 \ - pthread_timers \ - pthread_timers_h \ -+ rseq00 \ - vdso00 \ - vdso01 \ - vdso02 \ -diff --git a/test/zdtm/static/rseq00.c b/test/zdtm/static/rseq00.c -new file mode 100644 -index 000000000..b1cffb16e ---- /dev/null -+++ b/test/zdtm/static/rseq00.c -@@ -0,0 +1,180 @@ -+/* -+ * test for rseq() syscall -+ * See also https://www.efficios.com/blog/2019/02/08/linux-restartable-sequences/ -+ * https://github.com/torvalds/linux/commit/d7822b1e24f2df5df98c76f0e94a5416349ff759 -+ */ -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "zdtmtst.h" -+ -+#if defined(__x86_64__) -+ -+const char *test_doc = "Check that rseq() basic C/R works"; -+const char *test_author = "Alexander Mikhalitsyn "; -+/* parts of code borrowed from https://www.efficios.com/blog/2019/02/08/linux-restartable-sequences/ */ -+ -+/* some useful definitions from kernel uapi */ -+enum rseq_flags { -+ RSEQ_FLAG_UNREGISTER = (1 << 0), -+}; -+ -+struct rseq { -+ uint32_t cpu_id_start; -+ uint32_t cpu_id; -+ uint64_t rseq_cs; -+ uint32_t flags; -+} __attribute__((aligned(4 * sizeof(uint64_t)))); -+ -+#ifndef __NR_rseq -+#define __NR_rseq 334 -+#endif -+/* EOF */ -+ -+static __thread volatile struct rseq __rseq_abi; -+ -+#define RSEQ_SIG 0x53053053 -+ -+static int sys_rseq(volatile struct rseq *rseq_abi, uint32_t rseq_len, int flags, uint32_t sig) -+{ -+ return syscall(__NR_rseq, rseq_abi, rseq_len, flags, sig); -+} -+ -+static void register_thread(void) -+{ -+ int rc; -+ rc = sys_rseq(&__rseq_abi, sizeof(struct rseq), 0, RSEQ_SIG); -+ if (rc) { -+ fail("Failed to register rseq"); -+ exit(1); -+ } -+} -+ -+static void unregister_thread(void) -+{ -+ int rc; -+ rc = sys_rseq(&__rseq_abi, sizeof(struct rseq), RSEQ_FLAG_UNREGISTER, RSEQ_SIG); -+ if (rc) { -+ fail("Failed to unregister rseq"); -+ exit(1); -+ } -+} -+ -+static void check_thread(void) -+{ -+ int rc; -+ rc = sys_rseq(&__rseq_abi, sizeof(struct rseq), 0, RSEQ_SIG); -+ if (!(rc && errno == EBUSY)) { -+ fail("Failed to check rseq %d", rc); -+ exit(1); -+ } -+} -+ -+#define RSEQ_ACCESS_ONCE(x) (*(__volatile__ __typeof__(x) *)&(x)) -+ -+#define rseq_after_asm_goto() asm volatile("" : : : "memory") -+ -+static int rseq_addv(intptr_t *v, intptr_t count, int cpu) -+{ -+ /* clang-format off */ -+ __asm__ __volatile__ goto( -+ ".pushsection __rseq_table, \"aw\"\n\t" -+ ".balign 32\n\t" -+ "cs_obj:\n\t" -+ /* version, flags */ -+ ".long 0, 0\n\t" -+ /* start_ip, post_commit_offset, abort_ip */ -+ ".quad 1f, (2f-1f), 4f\n\t" -+ ".popsection\n\t" -+ "1:\n\t" -+ "leaq cs_obj(%%rip), %%rax\n\t" -+ "movq %%rax, %[rseq_cs]\n\t" -+ "cmpl %[cpu_id], %[current_cpu_id]\n\t" -+ "jnz 4f\n\t" -+ "addq %[count], %[v]\n\t" /* final store */ -+ "2:\n\t" -+ ".pushsection __rseq_failure, \"ax\"\n\t" -+ /* Disassembler-friendly signature: nopl (%rip). */ -+ ".byte 0x0f, 0x1f, 0x05\n\t" -+ ".long 0x53053053\n\t" /* RSEQ_FLAGS */ -+ "4:\n\t" -+ "jmp abort\n\t" -+ ".popsection\n\t" -+ : /* gcc asm goto does not allow outputs */ -+ : [cpu_id] "r" (cpu), -+ [current_cpu_id] "m" (__rseq_abi.cpu_id), -+ [rseq_cs] "m" (__rseq_abi.rseq_cs), -+ /* final store input */ -+ [v] "m" (*v), -+ [count] "er" (count) -+ : "memory", "cc", "rax" -+ : abort -+ ); -+ /* clang-format on */ -+ rseq_after_asm_goto(); -+ return 0; -+abort: -+ rseq_after_asm_goto(); -+ return -1; -+} -+ -+int main(int argc, char *argv[]) -+{ -+ int cpu, ret; -+ intptr_t *cpu_data; -+ long nr_cpus = sysconf(_SC_NPROCESSORS_ONLN); -+ -+ test_init(argc, argv); -+ -+ cpu_data = calloc(nr_cpus, sizeof(*cpu_data)); -+ if (!cpu_data) { -+ fail("calloc"); -+ exit(EXIT_FAILURE); -+ } -+ -+ register_thread(); -+ -+ test_daemon(); -+ test_waitsig(); -+ -+ check_thread(); -+ -+ cpu = RSEQ_ACCESS_ONCE(__rseq_abi.cpu_id_start); -+ ret = rseq_addv(&cpu_data[cpu], 2, cpu); -+ if (ret) -+ fail("Failed to increment per-cpu counter"); -+ else -+ test_msg("cpu_data[%d] == %ld\n", cpu, (long int)cpu_data[cpu]); -+ -+ if (cpu_data[cpu] == 2) -+ pass(); -+ else -+ fail(); -+ -+ return 0; -+} -+ -+#else /* #if defined(__x86_64__) */ -+ -+int main(int argc, char *argv[]) -+{ -+ test_init(argc, argv); -+ skip("Unsupported arch"); -+ test_daemon(); -+ test_waitsig(); -+ pass(); -+ return 0; -+} -+ -+#endif /* #if defined(__x86_64__) */ -\ No newline at end of file -diff --git a/test/zdtm/static/rseq00.desc b/test/zdtm/static/rseq00.desc -new file mode 100644 -index 000000000..0324fa39c ---- /dev/null -+++ b/test/zdtm/static/rseq00.desc -@@ -0,0 +1 @@ -+{'flavor': 'h', 'arch': 'x86_64', 'feature': 'get_rseq_conf'} --- -2.35.1 - diff --git a/0238-Revert-ci-disable-glibc-rseq-support.patch b/0238-Revert-ci-disable-glibc-rseq-support.patch deleted file mode 100644 index 5742963..0000000 --- a/0238-Revert-ci-disable-glibc-rseq-support.patch +++ /dev/null @@ -1,49 +0,0 @@ -From aff15d704012b630b41b4bf6e871a6cf16ab18ec Mon Sep 17 00:00:00 2001 -From: Alexander Mikhalitsyn -Date: Tue, 21 Dec 2021 23:42:26 +0300 -Subject: [PATCH 238/249] Revert "ci: disable glibc rseq support" - -Let's see how rseq() C/R feature works - -This reverts commit d99def7dcfa938918368c91021f72a77f738bc61. - -Signed-off-by: Alexander Mikhalitsyn ---- - scripts/build/Dockerfile.fedora.tmpl | 3 --- - scripts/ci/run-ci-tests.sh | 7 +------ - 2 files changed, 1 insertion(+), 9 deletions(-) - -diff --git a/scripts/build/Dockerfile.fedora.tmpl b/scripts/build/Dockerfile.fedora.tmpl -index fd4ba4aef..9d3bb0f87 100644 ---- a/scripts/build/Dockerfile.fedora.tmpl -+++ b/scripts/build/Dockerfile.fedora.tmpl -@@ -1,8 +1,5 @@ - ARG CC=gcc - --# FIXME: Temporary solution for https://github.com/checkpoint-restore/criu/issues/1696 --ENV GLIBC_TUNABLES=glibc.pthread.rseq=0 -- - COPY scripts/ci/prepare-for-fedora-rawhide.sh /bin/prepare-for-fedora-rawhide.sh - RUN /bin/prepare-for-fedora-rawhide.sh - -diff --git a/scripts/ci/run-ci-tests.sh b/scripts/ci/run-ci-tests.sh -index 14e6b1224..f89783630 100755 ---- a/scripts/ci/run-ci-tests.sh -+++ b/scripts/ci/run-ci-tests.sh -@@ -255,12 +255,7 @@ if [ -n "$TRAVIS" ] || [ -n "$CIRCLECI" ]; then - # Error (criu/tty.c:1014): tty: Don't have tty to inherit session from, aborting - make -C test/others/shell-job/ run - fi -- --# FIXME: rpc tests fail even with set glibc tunable --# https://github.com/checkpoint-restore/criu/issues/1696 --if [ "$GLIBC_TUNABLES" != "glibc.pthread.rseq=0" ]; then -- make -C test/others/rpc/ run --fi -+make -C test/others/rpc/ run - - ./test/zdtm.py run -t zdtm/static/env00 --sibling - --- -2.35.1 - diff --git a/0239-ci-add-Fedora-Rawhide-based-test-on-Cirrus.patch b/0239-ci-add-Fedora-Rawhide-based-test-on-Cirrus.patch deleted file mode 100644 index 5049dac..0000000 --- a/0239-ci-add-Fedora-Rawhide-based-test-on-Cirrus.patch +++ /dev/null @@ -1,98 +0,0 @@ -From e1d607f73e2d0b0618bfb3cd35e0633b0ed49222 Mon Sep 17 00:00:00 2001 -From: Alexander Mikhalitsyn -Date: Thu, 23 Dec 2021 14:57:43 +0300 -Subject: [PATCH 239/249] ci: add Fedora Rawhide based test on Cirrus - -We have ability to use nested virtualization on -Cirrus, and already have "Vagrant Fedora based test (no VDSO)" -test, let's do analogical for Fedora Rawhide to get fresh kernel. - -Suggested-by: Adrian Reber -Signed-off-by: Alexander Mikhalitsyn ---- - .cirrus.yml | 21 +++++++++++++++++++++ - scripts/ci/Makefile | 7 +++++-- - scripts/ci/vagrant.sh | 12 ++++++++++++ - 3 files changed, 38 insertions(+), 2 deletions(-) - -diff --git a/.cirrus.yml b/.cirrus.yml -index 588cf3e82..2b6903ddc 100644 ---- a/.cirrus.yml -+++ b/.cirrus.yml -@@ -19,6 +19,27 @@ task: - build_script: | - make -C scripts/ci vagrant-fedora-no-vdso - -+task: -+ name: Vagrant Fedora Rawhide based test -+ environment: -+ HOME: "/root" -+ CIRRUS_WORKING_DIR: "/tmp/criu" -+ -+ compute_engine_instance: -+ image_project: cirrus-images -+ image: family/docker-kvm -+ platform: linux -+ cpu: 4 -+ memory: 16G -+ nested_virtualization: true -+ -+ setup_script: | -+ scripts/ci/apt-install make gcc pkg-config git perl-modules iproute2 kmod wget cpu-checker -+ sudo kvm-ok -+ ln -sf /usr/include/google/protobuf/descriptor.proto images/google/protobuf/descriptor.proto -+ build_script: | -+ make -C scripts/ci vagrant-fedora-rawhide -+ - task: - name: CentOS 8 based test - environment: -diff --git a/scripts/ci/Makefile b/scripts/ci/Makefile -index 3e4d59430..eaab2f201 100644 ---- a/scripts/ci/Makefile -+++ b/scripts/ci/Makefile -@@ -41,7 +41,7 @@ export CONTAINER_TERMINAL - ifeq ($(UNAME),x86_64) - # On anything besides x86_64 Travis is running unprivileged LXD - # containers which do not support running docker with '--privileged'. -- CONTAINER_OPTS := --rm $(CONTAINER_TERMINAL) --privileged -v /lib/modules:/lib/modules --tmpfs /run -+ CONTAINER_OPTS := --rm $(CONTAINER_TERMINAL) --privileged --userns=host --cgroupns=host -v /lib/modules:/lib/modules --tmpfs /run - else - CONTAINER_OPTS := --rm -v /lib/modules:/lib/modules --tmpfs /run - endif -@@ -92,7 +92,10 @@ setup-vagrant: - vagrant-fedora-no-vdso: setup-vagrant - ./vagrant.sh fedora-no-vdso - --.PHONY: setup-vagrant vagrant-fedora-no-vdso -+vagrant-fedora-rawhide: setup-vagrant -+ ./vagrant.sh fedora-rawhide -+ -+.PHONY: setup-vagrant vagrant-fedora-no-vdso vagrant-fedora-rawhide - - %: - $(MAKE) -C ../build $@$(target-suffix) -diff --git a/scripts/ci/vagrant.sh b/scripts/ci/vagrant.sh -index 0440193bc..af0f7335a 100755 ---- a/scripts/ci/vagrant.sh -+++ b/scripts/ci/vagrant.sh -@@ -56,4 +56,16 @@ fedora-no-vdso() { - ssh default 'cd /vagrant/criu/test; sudo ./zdtm.py run -t zdtm/transition/pidfd_store_sk --rpc --pre 2' - } - -+fedora-rawhide() { -+ # -+ # Workaround the problem: -+ # error running container: error from /usr/bin/crun creating container for [...]: sd-bus call: Transport endpoint is not connected -+ # Let's just use runc instead of crun -+ # see also https://github.com/kata-containers/tests/issues/4283 -+ # -+ ssh default 'sudo dnf remove -y crun || true' -+ ssh default sudo dnf install -y podman runc -+ ssh default 'cd /vagrant; tar xf criu.tar; cd criu; sudo -E make -C scripts/ci fedora-rawhide CONTAINER_RUNTIME=podman BUILD_OPTIONS="--security-opt seccomp=unconfined"' -+} -+ - $1 --- -2.35.1 - diff --git a/0240-include-add-thread_pointer.h-from-Glibc.patch b/0240-include-add-thread_pointer.h-from-Glibc.patch deleted file mode 100644 index ac36940..0000000 --- a/0240-include-add-thread_pointer.h-from-Glibc.patch +++ /dev/null @@ -1,245 +0,0 @@ -From deb22c02824133457ba84201a2340625352ddf0f Mon Sep 17 00:00:00 2001 -From: Alexander Mikhalitsyn -Date: Tue, 22 Feb 2022 14:58:10 +0300 -Subject: [PATCH 240/249] include: add thread_pointer.h from Glibc - -Implementation was taken from the Glibc. - -https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=8dbeb0561eeb876f557ac9eef5721912ec074ea5 -https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=cb976fba4c51ede7bf8cee5035888527c308dfbc - -Signed-off-by: Alexander Mikhalitsyn ---- - .../arch/aarch64/include/asm/thread_pointer.h | 27 ++++++++++++++ - criu/arch/arm/include/asm/thread_pointer.h | 27 ++++++++++++++ - criu/arch/mips/include/asm/thread_pointer.h | 27 ++++++++++++++ - criu/arch/ppc64/include/asm/thread_pointer.h | 33 +++++++++++++++++ - criu/arch/s390/include/asm/thread_pointer.h | 27 ++++++++++++++ - criu/arch/x86/include/asm/thread_pointer.h | 37 +++++++++++++++++++ - 6 files changed, 178 insertions(+) - create mode 100644 criu/arch/aarch64/include/asm/thread_pointer.h - create mode 100644 criu/arch/arm/include/asm/thread_pointer.h - create mode 100644 criu/arch/mips/include/asm/thread_pointer.h - create mode 100644 criu/arch/ppc64/include/asm/thread_pointer.h - create mode 100644 criu/arch/s390/include/asm/thread_pointer.h - create mode 100644 criu/arch/x86/include/asm/thread_pointer.h - -diff --git a/criu/arch/aarch64/include/asm/thread_pointer.h b/criu/arch/aarch64/include/asm/thread_pointer.h -new file mode 100644 -index 000000000..f7e07066a ---- /dev/null -+++ b/criu/arch/aarch64/include/asm/thread_pointer.h -@@ -0,0 +1,27 @@ -+/* __thread_pointer definition. Generic version. -+ Copyright (C) 2021 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library. If not, see -+ . */ -+ -+#ifndef _SYS_THREAD_POINTER_H -+#define _SYS_THREAD_POINTER_H -+ -+static inline void *__criu_thread_pointer(void) -+{ -+ return __builtin_thread_pointer(); -+} -+ -+#endif /* _SYS_THREAD_POINTER_H */ -diff --git a/criu/arch/arm/include/asm/thread_pointer.h b/criu/arch/arm/include/asm/thread_pointer.h -new file mode 100644 -index 000000000..f7e07066a ---- /dev/null -+++ b/criu/arch/arm/include/asm/thread_pointer.h -@@ -0,0 +1,27 @@ -+/* __thread_pointer definition. Generic version. -+ Copyright (C) 2021 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library. If not, see -+ . */ -+ -+#ifndef _SYS_THREAD_POINTER_H -+#define _SYS_THREAD_POINTER_H -+ -+static inline void *__criu_thread_pointer(void) -+{ -+ return __builtin_thread_pointer(); -+} -+ -+#endif /* _SYS_THREAD_POINTER_H */ -diff --git a/criu/arch/mips/include/asm/thread_pointer.h b/criu/arch/mips/include/asm/thread_pointer.h -new file mode 100644 -index 000000000..f7e07066a ---- /dev/null -+++ b/criu/arch/mips/include/asm/thread_pointer.h -@@ -0,0 +1,27 @@ -+/* __thread_pointer definition. Generic version. -+ Copyright (C) 2021 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library. If not, see -+ . */ -+ -+#ifndef _SYS_THREAD_POINTER_H -+#define _SYS_THREAD_POINTER_H -+ -+static inline void *__criu_thread_pointer(void) -+{ -+ return __builtin_thread_pointer(); -+} -+ -+#endif /* _SYS_THREAD_POINTER_H */ -diff --git a/criu/arch/ppc64/include/asm/thread_pointer.h b/criu/arch/ppc64/include/asm/thread_pointer.h -new file mode 100644 -index 000000000..304516fbe ---- /dev/null -+++ b/criu/arch/ppc64/include/asm/thread_pointer.h -@@ -0,0 +1,33 @@ -+/* __thread_pointer definition. powerpc version. -+ Copyright (C) 2021 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library. If not, see -+ . */ -+ -+#ifndef _SYS_THREAD_POINTER_H -+#define _SYS_THREAD_POINTER_H -+ -+#ifdef __powerpc64__ -+register void *__thread_register asm("r13"); -+#else -+register void *__thread_register asm("r2"); -+#endif -+ -+static inline void *__criu_thread_pointer(void) -+{ -+ return __thread_register; -+} -+ -+#endif /* _SYS_THREAD_POINTER_H */ -\ No newline at end of file -diff --git a/criu/arch/s390/include/asm/thread_pointer.h b/criu/arch/s390/include/asm/thread_pointer.h -new file mode 100644 -index 000000000..f7e07066a ---- /dev/null -+++ b/criu/arch/s390/include/asm/thread_pointer.h -@@ -0,0 +1,27 @@ -+/* __thread_pointer definition. Generic version. -+ Copyright (C) 2021 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library. If not, see -+ . */ -+ -+#ifndef _SYS_THREAD_POINTER_H -+#define _SYS_THREAD_POINTER_H -+ -+static inline void *__criu_thread_pointer(void) -+{ -+ return __builtin_thread_pointer(); -+} -+ -+#endif /* _SYS_THREAD_POINTER_H */ -diff --git a/criu/arch/x86/include/asm/thread_pointer.h b/criu/arch/x86/include/asm/thread_pointer.h -new file mode 100644 -index 000000000..08603aed4 ---- /dev/null -+++ b/criu/arch/x86/include/asm/thread_pointer.h -@@ -0,0 +1,37 @@ -+/* __thread_pointer definition. x86 version. -+ Copyright (C) 2021 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library. If not, see -+ . */ -+ -+#ifndef _SYS_THREAD_POINTER_H -+#define _SYS_THREAD_POINTER_H -+ -+static inline void *__criu_thread_pointer(void) -+{ -+#if __GNUC_PREREQ(11, 1) -+ return __builtin_thread_pointer(); -+#else -+ void *__result; -+#ifdef __x86_64__ -+ __asm__("mov %%fs:0, %0" : "=r"(__result)); -+#else -+ __asm__("mov %%gs:0, %0" : "=r"(__result)); -+#endif -+ return __result; -+#endif /* !GCC 11 */ -+} -+ -+#endif /* _SYS_THREAD_POINTER_H */ -\ No newline at end of file --- -2.35.1 - diff --git a/0241-clone-noasan-unregister-rseq-at-the-thread-start-for.patch b/0241-clone-noasan-unregister-rseq-at-the-thread-start-for.patch deleted file mode 100644 index 6f31a24..0000000 --- a/0241-clone-noasan-unregister-rseq-at-the-thread-start-for.patch +++ /dev/null @@ -1,144 +0,0 @@ -From 8444d7085e64d63d0b08b52947affb6361a865a6 Mon Sep 17 00:00:00 2001 -From: Alexander Mikhalitsyn -Date: Fri, 24 Dec 2021 18:57:54 +0300 -Subject: [PATCH 241/249] clone-noasan: unregister rseq at the thread start for - new glibc - -Fresh glibc does rseq registration by default during start_thread(). -[ see https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=95e114a0919d844d8fe07839cb6538b7f5ee920e ] - -This cause process crashes during memory restore procedure, because -memory which corresponds to the struct rseq will be overwritten. - -See also -("nptl: Add public rseq symbols and ") -https://sourceware.org/git?p=glibc.git;a=commit;h=c901c3e764d7c7079f006b4e21e877d5036eb4f5 -("nptl: Add for defining __thread_pointer") -https://sourceware.org/git?p=glibc.git;a=commit;h=8dbeb0561eeb876f557ac9eef5721912ec074ea5 - -Signed-off-by: Alexander Mikhalitsyn ---- - criu/clone-noasan.c | 21 ++++++++++++++++++++- - criu/cr-restore.c | 4 ++++ - criu/include/clone-noasan.h | 14 ++++++++++++++ - criu/include/linux/rseq.h | 9 +++++++++ - 4 files changed, 47 insertions(+), 1 deletion(-) - -diff --git a/criu/clone-noasan.c b/criu/clone-noasan.c -index d657ea2e8..6d2170dfb 100644 ---- a/criu/clone-noasan.c -+++ b/criu/clone-noasan.c -@@ -9,6 +9,8 @@ - #include "log.h" - #include "common/bug.h" - -+#include "clone-noasan.h" -+ - /* - * ASan doesn't play nicely with clone if we use current stack for - * child task. ASan puts local variables on the fake stack -@@ -34,16 +36,33 @@ - * ... wait for process to finish ... - * unlock_last_pid - */ -+ -+struct call_fn_args { -+ int (*fn)(void *); -+ void *arg; -+}; -+ -+int call_fn(void *arg) -+{ -+ struct call_fn_args *cargs = arg; -+ unregister_glibc_rseq(); -+ return cargs->fn(cargs->arg); -+} -+ - int clone_noasan(int (*fn)(void *), int flags, void *arg) - { - void *stack_ptr = (void *)round_down((unsigned long)&stack_ptr - 1024, 16); -+ struct call_fn_args fn_args = { -+ .fn = fn, -+ .arg = arg, -+ }; - - BUG_ON((flags & CLONE_VM) && !(flags & CLONE_VFORK)); - /* - * Reserve some bytes for clone() internal needs - * and use as stack the address above this area. - */ -- return clone(fn, stack_ptr, flags, arg); -+ return clone(call_fn, stack_ptr, flags, (void *)&fn_args); - } - - int clone3_with_pid_noasan(int (*fn)(void *), void *arg, int flags, int exit_signal, pid_t pid) -diff --git a/criu/cr-restore.c b/criu/cr-restore.c -index 8bfa3ef8c..b2ddc8db0 100644 ---- a/criu/cr-restore.c -+++ b/criu/cr-restore.c -@@ -1424,6 +1424,10 @@ static inline int fork_with_pid(struct pstree_item *item) - } - } - -+ /* disable rseq to prevent it's inheritance */ -+ if (item == root_item) -+ unregister_glibc_rseq(); -+ - if (kdat.has_clone3_set_tid) { - ret = clone3_with_pid_noasan(restore_task_with_children, &ca, - (ca.clone_flags & ~(CLONE_NEWNET | CLONE_NEWCGROUP | CLONE_NEWTIME)), -diff --git a/criu/include/clone-noasan.h b/criu/include/clone-noasan.h -index aff773296..6d6e51259 100644 ---- a/criu/include/clone-noasan.h -+++ b/criu/include/clone-noasan.h -@@ -1,6 +1,20 @@ - #ifndef __CR_CLONE_NOASAN_H__ - #define __CR_CLONE_NOASAN_H__ - -+#include "linux/rseq.h" -+ -+#if defined(RSEQ_SIG) -+static inline void unregister_glibc_rseq(void) -+{ -+ /* unregister rseq */ -+ syscall(__NR_rseq, (void *)((char *)__criu_thread_pointer() + __rseq_offset), __rseq_size, 1, RSEQ_SIG); -+} -+#else -+static inline void unregister_glibc_rseq(void) -+{ -+} -+#endif -+ - int clone_noasan(int (*fn)(void *), int flags, void *arg); - int clone3_with_pid_noasan(int (*fn)(void *), void *arg, int flags, int exit_signal, pid_t pid); - -diff --git a/criu/include/linux/rseq.h b/criu/include/linux/rseq.h -index b227aefdf..a47876e66 100644 ---- a/criu/include/linux/rseq.h -+++ b/criu/include/linux/rseq.h -@@ -2,6 +2,14 @@ - #ifndef _UAPI_LINUX_RSEQ_H - #define _UAPI_LINUX_RSEQ_H - -+#ifdef __has_include -+#if __has_include("sys/rseq.h") -+#include -+#include "asm/thread_pointer.h" -+#endif -+#endif -+ -+#ifndef __GLIBC_HAVE_KERNEL_RSEQ - /* - * linux/rseq.h - * -@@ -49,6 +57,7 @@ struct rseq_cs { - __u64 post_commit_offset; - __u64 abort_ip; - } __attribute__((aligned(4 * sizeof(__u64)))); -+#endif /* __GLIBC_HAVE_KERNEL_RSEQ */ - - /* - * We have to have our own copy of struct rseq definition because --- -2.35.1 - diff --git a/0242-zdtm-static-rseq00-fix-rseq-test-when-linking-with-a.patch b/0242-zdtm-static-rseq00-fix-rseq-test-when-linking-with-a.patch deleted file mode 100644 index 323bccd..0000000 --- a/0242-zdtm-static-rseq00-fix-rseq-test-when-linking-with-a.patch +++ /dev/null @@ -1,152 +0,0 @@ -From 1af69a81c53cd23dda7d82ab434c22fbf4ed8959 Mon Sep 17 00:00:00 2001 -From: Alexander Mikhalitsyn -Date: Fri, 24 Dec 2021 22:56:56 +0300 -Subject: [PATCH 242/249] zdtm/static/rseq00: fix rseq test when linking with a - fresh Glibc - -Fresh Glibc does rseq() register by default. We need to unregister -rseq before registering our own. - -Signed-off-by: Alexander Mikhalitsyn ---- - test/zdtm/static/rseq00.c | 66 +++++++++++++++++++++++++++++---------- - 1 file changed, 49 insertions(+), 17 deletions(-) - -diff --git a/test/zdtm/static/rseq00.c b/test/zdtm/static/rseq00.c -index b1cffb16e..a50c8a48e 100644 ---- a/test/zdtm/static/rseq00.c -+++ b/test/zdtm/static/rseq00.c -@@ -19,13 +19,48 @@ - - #include "zdtmtst.h" - -+#ifdef __has_include -+#if __has_include("sys/rseq.h") -+#include -+#endif -+#endif -+ - #if defined(__x86_64__) - -+#if defined(RSEQ_SIG) -+static inline void *__criu_thread_pointer(void) -+{ -+#if __GNUC_PREREQ(11, 1) -+ return __builtin_thread_pointer(); -+#else -+ void *__result; -+#ifdef __x86_64__ -+ __asm__("mov %%fs:0, %0" : "=r"(__result)); -+#else -+ __asm__("mov %%gs:0, %0" : "=r"(__result)); -+#endif -+ return __result; -+#endif /* !GCC 11 */ -+} -+ -+static inline void unregister_glibc_rseq(void) -+{ -+ /* unregister rseq */ -+ syscall(__NR_rseq, (void *)((char *)__criu_thread_pointer() + __rseq_offset), __rseq_size, 1, RSEQ_SIG); -+} -+#else -+static inline void unregister_glibc_rseq(void) -+{ -+} -+#endif -+ - const char *test_doc = "Check that rseq() basic C/R works"; - const char *test_author = "Alexander Mikhalitsyn "; - /* parts of code borrowed from https://www.efficios.com/blog/2019/02/08/linux-restartable-sequences/ */ - - /* some useful definitions from kernel uapi */ -+#ifndef RSEQ_SIG -+ - enum rseq_flags { - RSEQ_FLAG_UNREGISTER = (1 << 0), - }; -@@ -37,15 +72,18 @@ struct rseq { - uint32_t flags; - } __attribute__((aligned(4 * sizeof(uint64_t)))); - -+#define RSEQ_SIG 0x53053053 -+ -+#endif -+ - #ifndef __NR_rseq - #define __NR_rseq 334 - #endif - /* EOF */ - -+static volatile struct rseq *rseq_ptr; - static __thread volatile struct rseq __rseq_abi; - --#define RSEQ_SIG 0x53053053 -- - static int sys_rseq(volatile struct rseq *rseq_abi, uint32_t rseq_len, int flags, uint32_t sig) - { - return syscall(__NR_rseq, rseq_abi, rseq_len, flags, sig); -@@ -54,27 +92,18 @@ static int sys_rseq(volatile struct rseq *rseq_abi, uint32_t rseq_len, int flags - static void register_thread(void) - { - int rc; -- rc = sys_rseq(&__rseq_abi, sizeof(struct rseq), 0, RSEQ_SIG); -+ unregister_glibc_rseq(); -+ rc = sys_rseq(rseq_ptr, sizeof(struct rseq), 0, RSEQ_SIG); - if (rc) { - fail("Failed to register rseq"); - exit(1); - } - } - --static void unregister_thread(void) --{ -- int rc; -- rc = sys_rseq(&__rseq_abi, sizeof(struct rseq), RSEQ_FLAG_UNREGISTER, RSEQ_SIG); -- if (rc) { -- fail("Failed to unregister rseq"); -- exit(1); -- } --} -- - static void check_thread(void) - { - int rc; -- rc = sys_rseq(&__rseq_abi, sizeof(struct rseq), 0, RSEQ_SIG); -+ rc = sys_rseq(rseq_ptr, sizeof(struct rseq), 0, RSEQ_SIG); - if (!(rc && errno == EBUSY)) { - fail("Failed to check rseq %d", rc); - exit(1); -@@ -113,8 +142,8 @@ static int rseq_addv(intptr_t *v, intptr_t count, int cpu) - ".popsection\n\t" - : /* gcc asm goto does not allow outputs */ - : [cpu_id] "r" (cpu), -- [current_cpu_id] "m" (__rseq_abi.cpu_id), -- [rseq_cs] "m" (__rseq_abi.rseq_cs), -+ [current_cpu_id] "m" (rseq_ptr->cpu_id), -+ [rseq_cs] "m" (rseq_ptr->rseq_cs), - /* final store input */ - [v] "m" (*v), - [count] "er" (count) -@@ -135,6 +164,9 @@ int main(int argc, char *argv[]) - intptr_t *cpu_data; - long nr_cpus = sysconf(_SC_NPROCESSORS_ONLN); - -+ rseq_ptr = &__rseq_abi; -+ memset((void *)rseq_ptr, 0, sizeof(struct rseq)); -+ - test_init(argc, argv); - - cpu_data = calloc(nr_cpus, sizeof(*cpu_data)); -@@ -150,7 +182,7 @@ int main(int argc, char *argv[]) - - check_thread(); - -- cpu = RSEQ_ACCESS_ONCE(__rseq_abi.cpu_id_start); -+ cpu = RSEQ_ACCESS_ONCE(rseq_ptr->cpu_id_start); - ret = rseq_addv(&cpu_data[cpu], 2, cpu); - if (ret) - fail("Failed to increment per-cpu counter"); --- -2.35.1 - diff --git a/0243-compel-add-helpers-to-get-set-instruction-pointer.patch b/0243-compel-add-helpers-to-get-set-instruction-pointer.patch deleted file mode 100644 index 5832781..0000000 --- a/0243-compel-add-helpers-to-get-set-instruction-pointer.patch +++ /dev/null @@ -1,265 +0,0 @@ -From 508e66a3eb46a9cc57a9ea115a0ca85417a9b015 Mon Sep 17 00:00:00 2001 -From: Alexander Mikhalitsyn -Date: Mon, 21 Feb 2022 15:15:52 +0300 -Subject: [PATCH 243/249] compel: add helpers to get/set instruction pointer - -Signed-off-by: Alexander Mikhalitsyn ---- - .../src/lib/include/uapi/asm/infect-types.h | 9 +++++---- - .../src/lib/include/uapi/asm/infect-types.h | 9 +++++---- - .../src/lib/include/uapi/asm/infect-types.h | 9 +++++---- - .../src/lib/include/uapi/asm/infect-types.h | 9 +++++---- - .../src/lib/include/uapi/asm/infect-types.h | 7 ++++--- - .../src/lib/include/uapi/asm/infect-types.h | 9 +++++---- - compel/include/uapi/infect.h | 6 ++++++ - compel/src/lib/infect.c | 20 +++++++++++++++++++ - criu/arch/aarch64/include/asm/types.h | 2 ++ - criu/arch/arm/include/asm/types.h | 2 ++ - criu/arch/mips/include/asm/types.h | 2 ++ - criu/arch/ppc64/include/asm/types.h | 2 ++ - criu/arch/s390/include/asm/types.h | 2 ++ - criu/arch/x86/include/asm/types.h | 2 ++ - 14 files changed, 67 insertions(+), 23 deletions(-) - -diff --git a/compel/arch/aarch64/src/lib/include/uapi/asm/infect-types.h b/compel/arch/aarch64/src/lib/include/uapi/asm/infect-types.h -index f91e73dc4..9d4ce7e2e 100644 ---- a/compel/arch/aarch64/src/lib/include/uapi/asm/infect-types.h -+++ b/compel/arch/aarch64/src/lib/include/uapi/asm/infect-types.h -@@ -23,10 +23,11 @@ typedef struct user_fpsimd_state user_fpregs_struct_t; - #define compel_arch_get_tls_task(ctl, tls) - #define compel_arch_get_tls_thread(tctl, tls) - --#define REG_RES(r) ((uint64_t)(r).regs[0]) --#define REG_IP(r) ((uint64_t)(r).pc) --#define REG_SP(r) ((uint64_t)((r).sp)) --#define REG_SYSCALL_NR(r) ((uint64_t)(r).regs[8]) -+#define REG_RES(r) ((uint64_t)(r).regs[0]) -+#define REG_IP(r) ((uint64_t)(r).pc) -+#define SET_REG_IP(r, val) ((r).pc = (val)) -+#define REG_SP(r) ((uint64_t)((r).sp)) -+#define REG_SYSCALL_NR(r) ((uint64_t)(r).regs[8]) - - #define user_regs_native(pregs) true - -diff --git a/compel/arch/arm/src/lib/include/uapi/asm/infect-types.h b/compel/arch/arm/src/lib/include/uapi/asm/infect-types.h -index 159b6a9fb..8d328252e 100644 ---- a/compel/arch/arm/src/lib/include/uapi/asm/infect-types.h -+++ b/compel/arch/arm/src/lib/include/uapi/asm/infect-types.h -@@ -56,10 +56,11 @@ struct user_vfp_exc { - unsigned long fpinst2; - }; - --#define REG_RES(regs) ((regs).ARM_r0) --#define REG_IP(regs) ((regs).ARM_pc) --#define REG_SP(regs) ((regs).ARM_sp) --#define REG_SYSCALL_NR(regs) ((regs).ARM_r7) -+#define REG_RES(regs) ((regs).ARM_r0) -+#define REG_IP(regs) ((regs).ARM_pc) -+#define SET_REG_IP(regs, val) ((regs).ARM_pc = (val)) -+#define REG_SP(regs) ((regs).ARM_sp) -+#define REG_SYSCALL_NR(regs) ((regs).ARM_r7) - - #define user_regs_native(pregs) true - -diff --git a/compel/arch/mips/src/lib/include/uapi/asm/infect-types.h b/compel/arch/mips/src/lib/include/uapi/asm/infect-types.h -index 70b3f85a5..481566a12 100644 ---- a/compel/arch/mips/src/lib/include/uapi/asm/infect-types.h -+++ b/compel/arch/mips/src/lib/include/uapi/asm/infect-types.h -@@ -56,10 +56,11 @@ static inline bool user_regs_native(user_regs_struct_t *pregs) - #define compel_arch_get_tls_task(ctl, tls) - #define compel_arch_get_tls_thread(tctl, tls) - --#define REG_RES(regs) ((regs).MIPS_v0) --#define REG_IP(regs) ((regs).cp0_epc) --#define REG_SP(regs) ((regs).MIPS_sp) --#define REG_SYSCALL_NR(regs) ((regs).MIPS_v0) -+#define REG_RES(regs) ((regs).MIPS_v0) -+#define REG_IP(regs) ((regs).cp0_epc) -+#define SET_REG_IP(regs, val) ((regs).cp0_epc = (val)) -+#define REG_SP(regs) ((regs).MIPS_sp) -+#define REG_SYSCALL_NR(regs) ((regs).MIPS_v0) - - //#define __NR(syscall, compat) ((compat) ? __NR32_##syscall : __NR_##syscall) - #define __NR(syscall, compat) __NR_##syscall -diff --git a/compel/arch/ppc64/src/lib/include/uapi/asm/infect-types.h b/compel/arch/ppc64/src/lib/include/uapi/asm/infect-types.h -index 8cf8a135f..25fc747e2 100644 ---- a/compel/arch/ppc64/src/lib/include/uapi/asm/infect-types.h -+++ b/compel/arch/ppc64/src/lib/include/uapi/asm/infect-types.h -@@ -72,10 +72,11 @@ typedef struct { - } tm; - } user_fpregs_struct_t; - --#define REG_RES(regs) ((uint64_t)(regs).gpr[3]) --#define REG_IP(regs) ((uint64_t)(regs).nip) --#define REG_SP(regs) ((uint64_t)(regs).gpr[1]) --#define REG_SYSCALL_NR(regs) ((uint64_t)(regs).gpr[0]) -+#define REG_RES(regs) ((uint64_t)(regs).gpr[3]) -+#define REG_IP(regs) ((uint64_t)(regs).nip) -+#define SET_REG_IP(regs, val) ((regs).nip = (val)) -+#define REG_SP(regs) ((uint64_t)(regs).gpr[1]) -+#define REG_SYSCALL_NR(regs) ((uint64_t)(regs).gpr[0]) - - #define user_regs_native(pregs) true - -diff --git a/compel/arch/s390/src/lib/include/uapi/asm/infect-types.h b/compel/arch/s390/src/lib/include/uapi/asm/infect-types.h -index 896d70ed1..87283bc6b 100644 ---- a/compel/arch/s390/src/lib/include/uapi/asm/infect-types.h -+++ b/compel/arch/s390/src/lib/include/uapi/asm/infect-types.h -@@ -62,9 +62,10 @@ typedef struct { - uint32_t system_call; - } user_regs_struct_t; - --#define REG_RES(r) ((uint64_t)(r).prstatus.gprs[2]) --#define REG_IP(r) ((uint64_t)(r).prstatus.psw.addr) --#define REG_SP(r) ((uint64_t)(r).prstatus.gprs[15]) -+#define REG_RES(r) ((uint64_t)(r).prstatus.gprs[2]) -+#define REG_IP(r) ((uint64_t)(r).prstatus.psw.addr) -+#define SET_REG_IP(r, val) ((r).prstatus.psw.addr = (val)) -+#define REG_SP(r) ((uint64_t)(r).prstatus.gprs[15]) - /* - * We assume that REG_SYSCALL_NR() is only used for pie code where we - * always use svc 0 with opcode in %r1. -diff --git a/compel/arch/x86/src/lib/include/uapi/asm/infect-types.h b/compel/arch/x86/src/lib/include/uapi/asm/infect-types.h -index 34b3ad061..b35504ff8 100644 ---- a/compel/arch/x86/src/lib/include/uapi/asm/infect-types.h -+++ b/compel/arch/x86/src/lib/include/uapi/asm/infect-types.h -@@ -127,10 +127,11 @@ typedef struct { - - typedef struct xsave_struct user_fpregs_struct_t; - --#define REG_RES(regs) get_user_reg(®s, ax) --#define REG_IP(regs) get_user_reg(®s, ip) --#define REG_SP(regs) get_user_reg(®s, sp) --#define REG_SYSCALL_NR(regs) get_user_reg(®s, orig_ax) -+#define REG_RES(regs) get_user_reg(®s, ax) -+#define REG_IP(regs) get_user_reg(®s, ip) -+#define SET_REG_IP(regs, val) set_user_reg(®s, ip, val) -+#define REG_SP(regs) get_user_reg(®s, sp) -+#define REG_SYSCALL_NR(regs) get_user_reg(®s, orig_ax) - - #define __NR(syscall, compat) ((compat) ? __NR32_##syscall : __NR_##syscall) - -diff --git a/compel/include/uapi/infect.h b/compel/include/uapi/infect.h -index 7fa0bd8a0..e01b3a22c 100644 ---- a/compel/include/uapi/infect.h -+++ b/compel/include/uapi/infect.h -@@ -168,4 +168,10 @@ extern unsigned long compel_task_size(void); - extern uint64_t compel_get_leader_sp(struct parasite_ctl *ctl); - extern uint64_t compel_get_thread_sp(struct parasite_thread_ctl *tctl); - -+extern uint64_t compel_get_leader_ip(struct parasite_ctl *ctl); -+extern uint64_t compel_get_thread_ip(struct parasite_thread_ctl *tctl); -+ -+void compel_set_leader_ip(struct parasite_ctl *ctl, uint64_t v); -+void compel_set_thread_ip(struct parasite_thread_ctl *tctl, uint64_t v); -+ - #endif -diff --git a/compel/src/lib/infect.c b/compel/src/lib/infect.c -index 0fb9e715c..6a13cc1b4 100644 ---- a/compel/src/lib/infect.c -+++ b/compel/src/lib/infect.c -@@ -1686,3 +1686,23 @@ uint64_t compel_get_thread_sp(struct parasite_thread_ctl *tctl) - { - return REG_SP(tctl->th.regs); - } -+ -+uint64_t compel_get_leader_ip(struct parasite_ctl *ctl) -+{ -+ return REG_IP(ctl->orig.regs); -+} -+ -+uint64_t compel_get_thread_ip(struct parasite_thread_ctl *tctl) -+{ -+ return REG_IP(tctl->th.regs); -+} -+ -+void compel_set_leader_ip(struct parasite_ctl *ctl, uint64_t v) -+{ -+ SET_REG_IP(ctl->orig.regs, v); -+} -+ -+void compel_set_thread_ip(struct parasite_thread_ctl *tctl, uint64_t v) -+{ -+ SET_REG_IP(tctl->th.regs, v); -+} -diff --git a/criu/arch/aarch64/include/asm/types.h b/criu/arch/aarch64/include/asm/types.h -index c860af1cf..363c1cae2 100644 ---- a/criu/arch/aarch64/include/asm/types.h -+++ b/criu/arch/aarch64/include/asm/types.h -@@ -22,6 +22,8 @@ typedef UserAarch64RegsEntry UserRegsEntry; - - #define TI_SP(core) ((core)->ti_aarch64->gpregs->sp) - -+#define TI_IP(core) ((core)->ti_aarch64->gpregs->pc) -+ - static inline void *decode_pointer(uint64_t v) - { - return (void *)v; -diff --git a/criu/arch/arm/include/asm/types.h b/criu/arch/arm/include/asm/types.h -index cfcb8a136..93d2dc23d 100644 ---- a/criu/arch/arm/include/asm/types.h -+++ b/criu/arch/arm/include/asm/types.h -@@ -21,6 +21,8 @@ typedef UserArmRegsEntry UserRegsEntry; - - #define TI_SP(core) ((core)->ti_arm->gpregs->sp) - -+#define TI_IP(core) ((core)->ti_arm->gpregs->ip) -+ - static inline void *decode_pointer(u64 v) - { - return (void *)(u32)v; -diff --git a/criu/arch/mips/include/asm/types.h b/criu/arch/mips/include/asm/types.h -index 237471f3c..2c75b6a92 100644 ---- a/criu/arch/mips/include/asm/types.h -+++ b/criu/arch/mips/include/asm/types.h -@@ -18,6 +18,8 @@ - - #define CORE_THREAD_ARCH_INFO(core) core->ti_mips - -+#define TI_IP(core) ((core)->ti_mips->gpregs->cp0_epc) -+ - typedef UserMipsRegsEntry UserRegsEntry; - - static inline u64 encode_pointer(void *p) -diff --git a/criu/arch/ppc64/include/asm/types.h b/criu/arch/ppc64/include/asm/types.h -index fedeff22a..d60aadde5 100644 ---- a/criu/arch/ppc64/include/asm/types.h -+++ b/criu/arch/ppc64/include/asm/types.h -@@ -19,6 +19,8 @@ typedef UserPpc64RegsEntry UserRegsEntry; - - #define CORE_THREAD_ARCH_INFO(core) core->ti_ppc64 - -+#define TI_IP(core) ((core)->ti_ppc64->gpregs->nip) -+ - static inline void *decode_pointer(uint64_t v) - { - return (void *)v; -diff --git a/criu/arch/s390/include/asm/types.h b/criu/arch/s390/include/asm/types.h -index 7522cf2cd..abf12dec0 100644 ---- a/criu/arch/s390/include/asm/types.h -+++ b/criu/arch/s390/include/asm/types.h -@@ -19,6 +19,8 @@ typedef UserS390RegsEntry UserRegsEntry; - - #define CORE_THREAD_ARCH_INFO(core) core->ti_s390 - -+#define TI_IP(core) ((core)->ti_s390->gpregs->psw_addr) -+ - static inline u64 encode_pointer(void *p) - { - return (u64)p; -diff --git a/criu/arch/x86/include/asm/types.h b/criu/arch/x86/include/asm/types.h -index a0a8ed987..8919d0ae6 100644 ---- a/criu/arch/x86/include/asm/types.h -+++ b/criu/arch/x86/include/asm/types.h -@@ -28,6 +28,8 @@ static inline int core_is_compat(CoreEntry *c) - - #define CORE_THREAD_ARCH_INFO(core) core->thread_info - -+#define TI_IP(core) ((core)->thread_info->gpregs->ip) -+ - typedef UserX86RegsEntry UserRegsEntry; - - static inline u64 encode_pointer(void *p) --- -2.35.1 - diff --git a/0244-cr-dump-fixup-thread-IP-when-inside-rseq-cs.patch b/0244-cr-dump-fixup-thread-IP-when-inside-rseq-cs.patch deleted file mode 100644 index 6330e03..0000000 --- a/0244-cr-dump-fixup-thread-IP-when-inside-rseq-cs.patch +++ /dev/null @@ -1,249 +0,0 @@ -From dcb3bec96b15682d296387a36350f694ab043e5e Mon Sep 17 00:00:00 2001 -From: Alexander Mikhalitsyn -Date: Mon, 21 Feb 2022 15:25:21 +0300 -Subject: [PATCH 244/249] cr-dump: fixup thread IP when inside rseq cs - -Signed-off-by: Alexander Mikhalitsyn ---- - criu/cr-dump.c | 156 ++++++++++++++++++++++++++++++++++++++-- - criu/include/parasite.h | 2 + - criu/include/pstree.h | 1 + - 3 files changed, 155 insertions(+), 4 deletions(-) - -diff --git a/criu/cr-dump.c b/criu/cr-dump.c -index eb645a597..1992991a2 100644 ---- a/criu/cr-dump.c -+++ b/criu/cr-dump.c -@@ -1034,11 +1034,59 @@ static int dump_task_signals(pid_t pid, struct pstree_item *item) - return 0; - } - --static int dump_thread_rseq(pid_t tid, RseqEntry **rseqep) -+static int read_rseq_cs(pid_t tid, struct __ptrace_rseq_configuration *rseq, struct rseq_cs *rseq_cs) -+{ -+ int ret; -+ uint64_t addr; -+ -+ /* rseq is not registered */ -+ if (!rseq->rseq_abi_pointer) -+ return 0; -+ -+ /* -+ * We need to cover the case when victim process was inside rseq critical section -+ * at the moment when CRIU comes and seized it. We need to determine the borders -+ * of rseq critical section at first. To achieve that we need to access thread -+ * memory and read pointer to struct rseq_cs. -+ * -+ * We have two ways to access thread memory: from the parasite and using ptrace(). -+ * But it this case we can't use parasite, because if victim process returns to the -+ * execution, on the kernel side __rseq_handle_notify_resume hook will be called, -+ * then rseq_ip_fixup() -> clear_rseq_cs() and user space memory with struct rseq -+ * will be cleared. So, let's use ptrace(PTRACE_PEEKDATA). -+ */ -+ ret = ptrace_peek_area(tid, &addr, decode_pointer(rseq->rseq_abi_pointer + offsetof(struct rseq, rseq_cs)), -+ sizeof(uint64_t)); -+ if (ret) { -+ pr_err("ptrace_peek_area(%d, %lx, %lx, %lx): fail to read rseq_cs addr\n", tid, (unsigned long)&addr, -+ (unsigned long)(rseq->rseq_abi_pointer + offsetof(struct rseq, rseq_cs)), -+ (unsigned long)sizeof(uint64_t)); -+ return -1; -+ } -+ -+ /* (struct rseq)->rseq_cs is NULL */ -+ if (!addr) -+ return 0; -+ -+ ret = ptrace_peek_area(tid, rseq_cs, decode_pointer(addr), sizeof(struct rseq_cs)); -+ if (ret) { -+ pr_err("ptrace_peek_area(%d, %lx, %lx, %lx): fail to read rseq_cs struct\n", tid, -+ (unsigned long)rseq_cs, (unsigned long)addr, (unsigned long)sizeof(struct rseq_cs)); -+ return -1; -+ } -+ -+ return 0; -+} -+ -+static int dump_thread_rseq(struct pstree_item *item, int i) - { - struct __ptrace_rseq_configuration rseq; - RseqEntry *rseqe = NULL; - int ret; -+ CoreEntry *core = item->core[i]; -+ RseqEntry **rseqep = &core->thread_core->rseq_entry; -+ struct rseq_cs *rseq_cs = &dmpi(item)->thread_rseq_cs[i]; -+ pid_t tid = item->threads[i].real; - - /* - * If we are here it means that rseq() syscall is supported, -@@ -1063,7 +1111,8 @@ static int dump_thread_rseq(pid_t tid, RseqEntry **rseqep) - return -1; - } - -- pr_err("Dump rseq of %d: ptr = 0x%lx sign = 0x%x\n", tid, (unsigned long)rseq.rseq_abi_pointer, rseq.signature); -+ pr_info("Dump rseq of %d: ptr = 0x%lx sign = 0x%x\n", tid, (unsigned long)rseq.rseq_abi_pointer, -+ rseq.signature); - - rseqe = xmalloc(sizeof(*rseqe)); - if (!rseqe) -@@ -1075,25 +1124,118 @@ static int dump_thread_rseq(pid_t tid, RseqEntry **rseqep) - rseqe->rseq_abi_size = rseq.rseq_abi_size; - rseqe->signature = rseq.signature; - -+ if (read_rseq_cs(tid, &rseq, rseq_cs)) -+ goto err; -+ -+ /* save rseq entry to the image */ - *rseqep = rseqe; - - return 0; -+ -+err: -+ xfree(rseqe); -+ return -1; - } - - static int dump_task_rseq(pid_t pid, struct pstree_item *item) - { - int i; -+ struct rseq_cs *thread_rseq_cs; - - /* if rseq() syscall isn't supported then nothing to dump */ - if (!kdat.has_rseq) - return 0; - -+ thread_rseq_cs = xzalloc(sizeof(*thread_rseq_cs) * item->nr_threads); -+ if (!thread_rseq_cs) -+ return -1; -+ -+ dmpi(item)->thread_rseq_cs = thread_rseq_cs; -+ - for (i = 0; i < item->nr_threads; i++) { -- if (dump_thread_rseq(item->threads[i].real, &item->core[i]->thread_core->rseq_entry)) -- return -1; -+ if (dump_thread_rseq(item, i)) -+ goto free_rseq; - } - - return 0; -+ -+free_rseq: -+ xfree(thread_rseq_cs); -+ dmpi(item)->thread_rseq_cs = NULL; -+ return -1; -+} -+ -+static bool task_in_rseq(struct rseq_cs *rseq_cs, uint64_t addr) -+{ -+ return addr >= rseq_cs->start_ip && addr < rseq_cs->start_ip + rseq_cs->post_commit_offset; -+} -+ -+static int fixup_thread_rseq(struct pstree_item *item, int i) -+{ -+ CoreEntry *core = item->core[i]; -+ struct rseq_cs *rseq_cs = &dmpi(item)->thread_rseq_cs[i]; -+ pid_t tid = item->threads[i].real; -+ -+ /* (struct rseq)->rseq_cs is NULL */ -+ if (!rseq_cs->start_ip) -+ return 0; -+ -+ pr_info("fixup_thread_rseq for %d: rseq_cs start_ip = %llx abort_ip = %llx post_commit_offset = %llx flags = %x version = %x; IP = %lx\n", -+ tid, rseq_cs->start_ip, rseq_cs->abort_ip, rseq_cs->post_commit_offset, rseq_cs->flags, -+ rseq_cs->version, (unsigned long)TI_IP(core)); -+ -+ if (rseq_cs->version != 0) { -+ pr_err("unsupported RSEQ ABI version = %d\n", rseq_cs->version); -+ return -1; -+ } -+ -+ if (task_in_rseq(rseq_cs, TI_IP(core))) { -+ struct pid *tid = &item->threads[i]; -+ -+ pr_info("The %d task is in rseq critical section. IP will be set to rseq abort handler addr\n", -+ tid->real); -+ -+ /* -+ * We need to fixup task instruction pointer from -+ * the original one (which lays inside rseq critical section) -+ * to rseq abort handler address. -+ * -+ * It's worth to mention that we need to fixup IP in CoreEntry -+ * (used when full dump/restore is performed) and also in -+ * the parasite regs storage (used if --leave-running option is used, -+ * or if dump error occured and process execution is resumed). -+ */ -+ TI_IP(core) = rseq_cs->abort_ip; -+ -+ if (item->pid->real == tid->real) { -+ compel_set_leader_ip(dmpi(item)->parasite_ctl, rseq_cs->abort_ip); -+ } else { -+ compel_set_thread_ip(dmpi(item)->thread_ctls[i], rseq_cs->abort_ip); -+ } -+ } -+ -+ return 0; -+} -+ -+static int fixup_task_rseq(pid_t pid, struct pstree_item *item) -+{ -+ int ret = 0; -+ int i; -+ -+ if (!kdat.has_ptrace_get_rseq_conf) -+ return 0; -+ -+ for (i = 0; i < item->nr_threads; i++) { -+ if (fixup_thread_rseq(item, i)) { -+ ret = -1; -+ goto exit; -+ } -+ } -+ -+exit: -+ xfree(dmpi(item)->thread_rseq_cs); -+ dmpi(item)->thread_rseq_cs = NULL; -+ return ret; - } - - static struct proc_pid_stat pps_buf; -@@ -1403,6 +1545,12 @@ static int dump_one_task(struct pstree_item *item, InventoryEntry *parent_ie) - goto err; - } - -+ ret = fixup_task_rseq(pid, item); -+ if (ret) { -+ pr_err("Fixup rseq for %d failed %d\n", pid, ret); -+ goto err; -+ } -+ - if (fault_injected(FI_DUMP_EARLY)) { - pr_info("fault: CRIU sudden detach\n"); - kill(getpid(), SIGKILL); -diff --git a/criu/include/parasite.h b/criu/include/parasite.h -index 5fde80996..d2a06889f 100644 ---- a/criu/include/parasite.h -+++ b/criu/include/parasite.h -@@ -10,6 +10,8 @@ - #include - #include - -+#include "linux/rseq.h" -+ - #include "image.h" - #include "util-pie.h" - #include "common/lock.h" -diff --git a/criu/include/pstree.h b/criu/include/pstree.h -index c1c79867b..8ae750e1a 100644 ---- a/criu/include/pstree.h -+++ b/criu/include/pstree.h -@@ -63,6 +63,7 @@ struct dmp_info { - struct parasite_ctl *parasite_ctl; - struct parasite_thread_ctl **thread_ctls; - uint64_t *thread_sp; -+ struct rseq_cs *thread_rseq_cs; - - /* - * Although we don't support dumping different struct creds in general, --- -2.35.1 - diff --git a/0245-zdtm-add-transition-rseq01-test-for-amd64.patch b/0245-zdtm-add-transition-rseq01-test-for-amd64.patch deleted file mode 100644 index b51c1ea..0000000 --- a/0245-zdtm-add-transition-rseq01-test-for-amd64.patch +++ /dev/null @@ -1,254 +0,0 @@ -From c4a4013816b036f9fed123d3b51f5e83cfce3469 Mon Sep 17 00:00:00 2001 -From: Alexander Mikhalitsyn -Date: Mon, 21 Feb 2022 15:45:40 +0300 -Subject: [PATCH 245/249] zdtm: add transition/rseq01 test for amd64 - -Signed-off-by: Alexander Mikhalitsyn ---- - test/zdtm/transition/Makefile | 1 + - test/zdtm/transition/rseq01.c | 212 +++++++++++++++++++++++++++++++ - test/zdtm/transition/rseq01.desc | 1 + - 3 files changed, 214 insertions(+) - create mode 100644 test/zdtm/transition/rseq01.c - create mode 100644 test/zdtm/transition/rseq01.desc - -diff --git a/test/zdtm/transition/Makefile b/test/zdtm/transition/Makefile -index 9388157e8..fae4e27b3 100644 ---- a/test/zdtm/transition/Makefile -+++ b/test/zdtm/transition/Makefile -@@ -23,6 +23,7 @@ TST_NOFILE = \ - lazy-thp \ - pid_reuse \ - pidfd_store_sk \ -+ rseq01 \ - - - TST_FILE = \ -diff --git a/test/zdtm/transition/rseq01.c b/test/zdtm/transition/rseq01.c -new file mode 100644 -index 000000000..cc8ecfdcd ---- /dev/null -+++ b/test/zdtm/transition/rseq01.c -@@ -0,0 +1,212 @@ -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "zdtmtst.h" -+ -+#ifdef __has_include -+#if __has_include("sys/rseq.h") -+#include -+#endif -+#endif -+ -+#if defined(__x86_64__) -+ -+#if defined(__x86_64__) && defined(RSEQ_SIG) -+static inline void *thread_pointer(void) -+{ -+ void *result; -+ asm("mov %%fs:0, %0" : "=r"(result)); -+ return result; -+} -+ -+static inline void unregister_old_rseq(void) -+{ -+ /* unregister rseq */ -+ syscall(__NR_rseq, (void *)((char *)thread_pointer() + __rseq_offset), __rseq_size, 1, RSEQ_SIG); -+} -+#else -+static inline void unregister_old_rseq(void) -+{ -+} -+#endif -+ -+const char *test_doc = "rseq() transition test"; -+const char *test_author = "Alexander Mikhalitsyn "; -+ -+/* parts of code borrowed from https://www.efficios.com/blog/2019/02/08/linux-restartable-sequences/ */ -+ -+/* some useful definitions from kernel uapi */ -+#ifndef RSEQ_SIG -+ -+enum rseq_flags { -+ RSEQ_FLAG_UNREGISTER = (1 << 0), -+}; -+ -+struct rseq { -+ uint32_t cpu_id_start; -+ uint32_t cpu_id; -+ uint64_t rseq_cs; -+ uint32_t flags; -+} __attribute__((aligned(4 * sizeof(uint64_t)))); -+ -+#define RSEQ_SIG 0x53053053 -+ -+#endif -+ -+#ifndef __NR_rseq -+#define __NR_rseq 334 -+#endif -+/* EOF */ -+ -+static volatile struct rseq *rseq_ptr; -+static __thread volatile struct rseq __rseq_abi; -+ -+static int sys_rseq(volatile struct rseq *rseq_abi, uint32_t rseq_len, int flags, uint32_t sig) -+{ -+ return syscall(__NR_rseq, rseq_abi, rseq_len, flags, sig); -+} -+ -+static void register_thread(void) -+{ -+ int rc; -+ unregister_old_rseq(); -+ rc = sys_rseq(rseq_ptr, sizeof(struct rseq), 0, RSEQ_SIG); -+ if (rc) { -+ fail("Failed to register rseq"); -+ exit(1); -+ } -+} -+ -+static void check_thread(void) -+{ -+ int rc; -+ rc = sys_rseq(rseq_ptr, sizeof(struct rseq), 0, RSEQ_SIG); -+ if (!(rc && errno == EBUSY)) { -+ fail("Failed to check rseq %d", rc); -+ exit(1); -+ } -+} -+ -+#define RSEQ_ACCESS_ONCE(x) (*(__volatile__ __typeof__(x) *)&(x)) -+ -+#define rseq_after_asm_goto() asm volatile("" : : : "memory") -+ -+static int rseq_addv(intptr_t *v, intptr_t count, int cpu) -+{ -+ double a = 10000000000000000.0; -+ double b = -1; -+ -+ /* clang-format off */ -+ __asm__ __volatile__ goto( -+ ".pushsection __rseq_table, \"aw\"\n\t" -+ ".balign 32\n\t" -+ "cs_obj:\n\t" -+ /* version, flags */ -+ ".long 0, 0\n\t" -+ /* start_ip, post_commit_offset, abort_ip */ -+ ".quad 1f, (2f-1f), 4f\n\t" -+ ".popsection\n\t" -+ "1:\n\t" -+ "leaq cs_obj(%%rip), %%rax\n\t" -+ "movq %%rax, %[rseq_cs]\n\t" -+ "cmpl %[cpu_id], %[current_cpu_id]\n\t" -+ "jnz 4f\n\t" -+ "addq %[count], %[v]\n\t" /* final store */ -+ "mov $10000000, %%rcx\n\t" -+ "fldl %[x]\n\t" /* we have st clobbered */ -+ "5:\n\t" -+ "fsqrt\n\t" /* heavy instruction */ -+ "dec %%rcx\n\t" -+ "jnz 5b\n\t" -+ "fstpl %[y]\n\t" -+ "2:\n\t" -+ ".pushsection __rseq_failure, \"ax\"\n\t" -+ /* Disassembler-friendly signature: nopl (%rip). */ -+ ".byte 0x0f, 0xb9, 0x3d\n\t" -+ ".long 0x53053053\n\t" /* RSEQ_FLAGS */ -+ "4:\n\t" -+ /*"fstpl %[y]\n\t"*/ -+ "jmp %l[abort]\n\t" -+ /*"jmp 1b\n\t"*/ -+ ".popsection\n\t" -+ : /* gcc asm goto does not allow outputs */ -+ : [cpu_id] "r" (cpu), -+ [current_cpu_id] "m" (rseq_ptr->cpu_id), -+ [rseq_cs] "m" (rseq_ptr->rseq_cs), -+ /* final store input */ -+ [v] "m" (*v), -+ [count] "er" (count), -+ [x] "m" (a), -+ [y] "m" (b) -+ : "memory", "cc", "rax", "rcx", "st" -+ : abort -+ ); -+ /* clang-format on */ -+ rseq_after_asm_goto(); -+ return 0; -+abort: -+ rseq_after_asm_goto(); -+ return -1; -+} -+ -+int main(int argc, char *argv[]) -+{ -+ int cpu = 0; -+ int ret; -+ intptr_t *cpu_data; -+ long nr_cpus; -+ -+ rseq_ptr = &__rseq_abi; -+ memset((void *)rseq_ptr, 0, sizeof(struct rseq)); -+ -+ test_init(argc, argv); -+ nr_cpus = sysconf(_SC_NPROCESSORS_ONLN); -+ -+ cpu_data = calloc(nr_cpus, sizeof(*cpu_data)); -+ if (!cpu_data) { -+ fail("calloc"); -+ exit(EXIT_FAILURE); -+ } -+ register_thread(); -+ -+ test_daemon(); -+ -+ while (test_go()) { -+ cpu = RSEQ_ACCESS_ONCE(rseq_ptr->cpu_id_start); -+ ret = rseq_addv(&cpu_data[cpu], 2, cpu); -+ if (ret) -+ fail("Failed to increment per-cpu counter"); -+ } -+ -+ test_waitsig(); -+ -+ check_thread(); -+ pass(); -+ -+ return 0; -+} -+ -+#else /* #if defined(__x86_64__) */ -+ -+int main(int argc, char *argv[]) -+{ -+ test_init(argc, argv); -+ skip("Unsupported arch"); -+ test_daemon(); -+ test_waitsig(); -+ pass(); -+ return 0; -+} -+ -+#endif /* #if defined(__x86_64__) */ -diff --git a/test/zdtm/transition/rseq01.desc b/test/zdtm/transition/rseq01.desc -new file mode 100644 -index 000000000..0324fa39c ---- /dev/null -+++ b/test/zdtm/transition/rseq01.desc -@@ -0,0 +1 @@ -+{'flavor': 'h', 'arch': 'x86_64', 'feature': 'get_rseq_conf'} --- -2.35.1 - diff --git a/0246-Revert-test-disable-rseq-also-on-Archlinux.patch b/0246-Revert-test-disable-rseq-also-on-Archlinux.patch deleted file mode 100644 index 17269e4..0000000 --- a/0246-Revert-test-disable-rseq-also-on-Archlinux.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 49ecd6d864df8cf0951d3c5eeea94d30585c0897 Mon Sep 17 00:00:00 2001 -From: Alexander Mikhalitsyn -Date: Tue, 22 Feb 2022 15:25:37 +0300 -Subject: [PATCH 246/249] Revert "test: disable rseq also on Archlinux" - -This reverts commit f008f740411156b7309219c7e052cb8bc24d5aae. - -Signed-off-by: Alexander Mikhalitsyn ---- - scripts/build/Dockerfile.archlinux | 3 --- - 1 file changed, 3 deletions(-) - -diff --git a/scripts/build/Dockerfile.archlinux b/scripts/build/Dockerfile.archlinux -index b226d5701..d226244ee 100644 ---- a/scripts/build/Dockerfile.archlinux -+++ b/scripts/build/Dockerfile.archlinux -@@ -1,8 +1,5 @@ - FROM docker.io/library/archlinux:latest - --# FIXME: Temporary solution for https://github.com/checkpoint-restore/criu/issues/1696 --ENV GLIBC_TUNABLES=glibc.pthread.rseq=0 -- - ARG CC=gcc - - RUN pacman -Syu --noconfirm \ --- -2.35.1 - diff --git a/0247-cr-dump-handle-rseq-flags-field.patch b/0247-cr-dump-handle-rseq-flags-field.patch deleted file mode 100644 index 4569751..0000000 --- a/0247-cr-dump-handle-rseq-flags-field.patch +++ /dev/null @@ -1,385 +0,0 @@ -From e07f53a1d700aa2552ac6fb137f45b9a9bce72db Mon Sep 17 00:00:00 2001 -From: Alexander Mikhalitsyn -Date: Tue, 22 Feb 2022 18:22:45 +0300 -Subject: [PATCH 247/249] cr-dump: handle rseq flags field - -Userspace may configure rseq critical section by def - -Signed-off-by: Alexander Mikhalitsyn ---- - criu/cr-dump.c | 86 +++++++++++++++++++++++++---------------- - criu/cr-restore.c | 58 +++++++++++++++++++++++++++ - criu/include/rst_info.h | 8 ++++ - criu/pstree.c | 36 +++++++++++++++++ - images/rseq.proto | 1 + - 5 files changed, 155 insertions(+), 34 deletions(-) - -diff --git a/criu/cr-dump.c b/criu/cr-dump.c -index 1992991a2..c708a6599 100644 ---- a/criu/cr-dump.c -+++ b/criu/cr-dump.c -@@ -1034,13 +1034,13 @@ static int dump_task_signals(pid_t pid, struct pstree_item *item) - return 0; - } - --static int read_rseq_cs(pid_t tid, struct __ptrace_rseq_configuration *rseq, struct rseq_cs *rseq_cs) -+static int read_rseq_cs(pid_t tid, struct __ptrace_rseq_configuration *rseqc, struct rseq_cs *rseq_cs, -+ struct criu_rseq *rseq) - { - int ret; -- uint64_t addr; - - /* rseq is not registered */ -- if (!rseq->rseq_abi_pointer) -+ if (!rseqc->rseq_abi_pointer) - return 0; - - /* -@@ -1055,23 +1055,20 @@ static int read_rseq_cs(pid_t tid, struct __ptrace_rseq_configuration *rseq, str - * then rseq_ip_fixup() -> clear_rseq_cs() and user space memory with struct rseq - * will be cleared. So, let's use ptrace(PTRACE_PEEKDATA). - */ -- ret = ptrace_peek_area(tid, &addr, decode_pointer(rseq->rseq_abi_pointer + offsetof(struct rseq, rseq_cs)), -- sizeof(uint64_t)); -+ ret = ptrace_peek_area(tid, rseq, decode_pointer(rseqc->rseq_abi_pointer), sizeof(struct criu_rseq)); - if (ret) { -- pr_err("ptrace_peek_area(%d, %lx, %lx, %lx): fail to read rseq_cs addr\n", tid, (unsigned long)&addr, -- (unsigned long)(rseq->rseq_abi_pointer + offsetof(struct rseq, rseq_cs)), -- (unsigned long)sizeof(uint64_t)); -+ pr_err("ptrace_peek_area(%d, %lx, %lx, %lx): fail to read rseq struct\n", tid, (unsigned long)rseq, -+ (unsigned long)(rseqc->rseq_abi_pointer), (unsigned long)sizeof(uint64_t)); - return -1; - } - -- /* (struct rseq)->rseq_cs is NULL */ -- if (!addr) -+ if (!rseq->rseq_cs) - return 0; - -- ret = ptrace_peek_area(tid, rseq_cs, decode_pointer(addr), sizeof(struct rseq_cs)); -+ ret = ptrace_peek_area(tid, rseq_cs, decode_pointer(rseq->rseq_cs), sizeof(struct rseq_cs)); - if (ret) { - pr_err("ptrace_peek_area(%d, %lx, %lx, %lx): fail to read rseq_cs struct\n", tid, -- (unsigned long)rseq_cs, (unsigned long)addr, (unsigned long)sizeof(struct rseq_cs)); -+ (unsigned long)rseq_cs, (unsigned long)rseq->rseq_cs, (unsigned long)sizeof(struct rseq_cs)); - return -1; - } - -@@ -1080,11 +1077,12 @@ static int read_rseq_cs(pid_t tid, struct __ptrace_rseq_configuration *rseq, str - - static int dump_thread_rseq(struct pstree_item *item, int i) - { -- struct __ptrace_rseq_configuration rseq; -+ struct __ptrace_rseq_configuration rseqc; - RseqEntry *rseqe = NULL; - int ret; - CoreEntry *core = item->core[i]; - RseqEntry **rseqep = &core->thread_core->rseq_entry; -+ struct criu_rseq rseq = {}; - struct rseq_cs *rseq_cs = &dmpi(item)->thread_rseq_cs[i]; - pid_t tid = item->threads[i].real; - -@@ -1099,20 +1097,20 @@ static int dump_thread_rseq(struct pstree_item *item, int i) - if (!kdat.has_ptrace_get_rseq_conf) - return 0; - -- ret = ptrace(PTRACE_GET_RSEQ_CONFIGURATION, tid, sizeof(rseq), &rseq); -- if (ret != sizeof(rseq)) { -+ ret = ptrace(PTRACE_GET_RSEQ_CONFIGURATION, tid, sizeof(rseqc), &rseqc); -+ if (ret != sizeof(rseqc)) { - pr_perror("ptrace(PTRACE_GET_RSEQ_CONFIGURATION, %d) = %d", tid, ret); - return -1; - } - -- if (rseq.flags != 0) { -+ if (rseqc.flags != 0) { - pr_err("something wrong with ptrace(PTRACE_GET_RSEQ_CONFIGURATION, %d) flags = 0x%x\n", tid, -- rseq.flags); -+ rseqc.flags); - return -1; - } - -- pr_info("Dump rseq of %d: ptr = 0x%lx sign = 0x%x\n", tid, (unsigned long)rseq.rseq_abi_pointer, -- rseq.signature); -+ pr_info("Dump rseq of %d: ptr = 0x%lx sign = 0x%x\n", tid, (unsigned long)rseqc.rseq_abi_pointer, -+ rseqc.signature); - - rseqe = xmalloc(sizeof(*rseqe)); - if (!rseqe) -@@ -1120,13 +1118,22 @@ static int dump_thread_rseq(struct pstree_item *item, int i) - - rseq_entry__init(rseqe); - -- rseqe->rseq_abi_pointer = rseq.rseq_abi_pointer; -- rseqe->rseq_abi_size = rseq.rseq_abi_size; -- rseqe->signature = rseq.signature; -+ rseqe->rseq_abi_pointer = rseqc.rseq_abi_pointer; -+ rseqe->rseq_abi_size = rseqc.rseq_abi_size; -+ rseqe->signature = rseqc.signature; - -- if (read_rseq_cs(tid, &rseq, rseq_cs)) -+ if (read_rseq_cs(tid, &rseqc, rseq_cs, &rseq)) - goto err; - -+ rseqe->has_rseq_cs_pointer = true; -+ rseqe->rseq_cs_pointer = rseq.rseq_cs; -+ -+ /* we won't save rseq_cs to the image (only pointer), -+ * so let's combine flags from both struct rseq and struct rseq_cs -+ * (kernel does the same when interpreting RSEQ_CS_FLAG_*) -+ */ -+ rseq_cs->flags |= rseq.flags; -+ - /* save rseq entry to the image */ - *rseqep = rseqe; - -@@ -1176,11 +1183,12 @@ static int fixup_thread_rseq(struct pstree_item *item, int i) - struct rseq_cs *rseq_cs = &dmpi(item)->thread_rseq_cs[i]; - pid_t tid = item->threads[i].real; - -- /* (struct rseq)->rseq_cs is NULL */ -+ /* equivalent to (struct rseq)->rseq_cs is NULL */ - if (!rseq_cs->start_ip) - return 0; - -- pr_info("fixup_thread_rseq for %d: rseq_cs start_ip = %llx abort_ip = %llx post_commit_offset = %llx flags = %x version = %x; IP = %lx\n", -+ pr_debug( -+ "fixup_thread_rseq for %d: rseq_cs start_ip = %llx abort_ip = %llx post_commit_offset = %llx flags = %x version = %x; IP = %lx\n", - tid, rseq_cs->start_ip, rseq_cs->abort_ip, rseq_cs->post_commit_offset, rseq_cs->flags, - rseq_cs->version, (unsigned long)TI_IP(core)); - -@@ -1192,25 +1200,35 @@ static int fixup_thread_rseq(struct pstree_item *item, int i) - if (task_in_rseq(rseq_cs, TI_IP(core))) { - struct pid *tid = &item->threads[i]; - -- pr_info("The %d task is in rseq critical section. IP will be set to rseq abort handler addr\n", -- tid->real); -- - /* - * We need to fixup task instruction pointer from - * the original one (which lays inside rseq critical section) -- * to rseq abort handler address. -+ * to rseq abort handler address. But we need to look on rseq_cs->flags -+ * (please refer to struct rseq -> flags field description). -+ * Naive idea of flags support may be like... let's change instruction pointer (IP) -+ * to rseq_cs->abort_ip if !(rseq_cs->flags & RSEQ_CS_FLAG_NO_RESTART_ON_SIGNAL). -+ * But unfortunately, it doesn't work properly, because the kernel does -+ * clean up of rseq_cs field in the struct rseq (modifies userspace memory). -+ * So, we need to preserve original value of (struct rseq)->rseq_cs field in the -+ * image and restore it's value before releasing threads (see restore_rseq_cs()). - * - * It's worth to mention that we need to fixup IP in CoreEntry - * (used when full dump/restore is performed) and also in - * the parasite regs storage (used if --leave-running option is used, - * or if dump error occured and process execution is resumed). - */ -- TI_IP(core) = rseq_cs->abort_ip; - -- if (item->pid->real == tid->real) { -- compel_set_leader_ip(dmpi(item)->parasite_ctl, rseq_cs->abort_ip); -- } else { -- compel_set_thread_ip(dmpi(item)->thread_ctls[i], rseq_cs->abort_ip); -+ if (!(rseq_cs->flags & RSEQ_CS_FLAG_NO_RESTART_ON_SIGNAL)) { -+ pr_warn("The %d task is in rseq critical section. IP will be set to rseq abort handler addr\n", -+ tid->real); -+ -+ TI_IP(core) = rseq_cs->abort_ip; -+ -+ if (item->pid->real == tid->real) { -+ compel_set_leader_ip(dmpi(item)->parasite_ctl, rseq_cs->abort_ip); -+ } else { -+ compel_set_thread_ip(dmpi(item)->thread_ctls[i], rseq_cs->abort_ip); -+ } - } - } - -diff --git a/criu/cr-restore.c b/criu/cr-restore.c -index b2ddc8db0..e3770f853 100644 ---- a/criu/cr-restore.c -+++ b/criu/cr-restore.c -@@ -23,6 +23,7 @@ - #include "common/compiler.h" - - #include "linux/mount.h" -+#include "linux/rseq.h" - - #include "clone-noasan.h" - #include "cr_options.h" -@@ -811,6 +812,18 @@ static int open_cores(int pid, CoreEntry *leader_core) - } - } - -+ for (i = 0; i < current->nr_threads; i++) { -+ ThreadCoreEntry *tc = cores[i]->thread_core; -+ struct rst_rseq *rseqs = rsti(current)->rseqe; -+ -+ /* compatibility with older CRIU versions */ -+ if (!tc->rseq_entry) -+ continue; -+ -+ rseqs[i].rseq_abi_pointer = tc->rseq_entry->rseq_abi_pointer; -+ rseqs[i].rseq_cs_pointer = tc->rseq_entry->rseq_cs_pointer; -+ } -+ - return 0; - err: - xfree(cores); -@@ -1966,6 +1979,48 @@ static int attach_to_tasks(bool root_seized) - return 0; - } - -+static int restore_rseq_cs(void) -+{ -+ struct pstree_item *item; -+ -+ for_each_pstree_item(item) { -+ int i; -+ -+ if (!task_alive(item)) -+ continue; -+ -+ if (item->nr_threads == 1) { -+ item->threads[0].real = item->pid->real; -+ } else { -+ if (parse_threads(item->pid->real, &item->threads, &item->nr_threads)) { -+ pr_err("restore_rseq_cs: parse_threads failed\n"); -+ return -1; -+ } -+ } -+ -+ for (i = 0; i < item->nr_threads; i++) { -+ pid_t pid = item->threads[i].real; -+ struct rst_rseq *rseqe = rsti(item)->rseqe; -+ -+ if (!rseqe) -+ return -1; -+ -+ if (!rseqe[i].rseq_cs_pointer || !rseqe[i].rseq_abi_pointer) -+ continue; -+ -+ if (ptrace_poke_area( -+ pid, &rseqe[i].rseq_cs_pointer, -+ decode_pointer(rseqe[i].rseq_abi_pointer + offsetof(struct criu_rseq, rseq_cs)), -+ sizeof(uint64_t))) { -+ pr_err("Can't restore rseq_cs pointer (pid: %d)\n", pid); -+ return -1; -+ } -+ } -+ } -+ -+ return 0; -+} -+ - static int catch_tasks(bool root_seized, enum trace_flags *flag) - { - struct pstree_item *item; -@@ -2400,6 +2455,9 @@ skip_ns_bouncing: - if (restore_freezer_state()) - pr_err("Unable to restore freezer state\n"); - -+ /* just before releasing threads we have to restore rseq_cs */ -+ restore_rseq_cs(); -+ - /* Detaches from processes and they continue run through sigreturn. */ - if (finalize_restore_detach()) - goto out_kill_network_unlocked; -diff --git a/criu/include/rst_info.h b/criu/include/rst_info.h -index 9664e0a1c..d0a3db6c5 100644 ---- a/criu/include/rst_info.h -+++ b/criu/include/rst_info.h -@@ -6,6 +6,7 @@ - #include "vma.h" - #include "kerndat.h" - #include "images/mm.pb-c.h" -+#include "images/core.pb-c.h" - - struct task_entries { - int nr_threads, nr_tasks, nr_helpers; -@@ -26,6 +27,11 @@ struct fdt { - futex_t fdt_lock; - }; - -+struct rst_rseq { -+ uint64_t rseq_abi_pointer; -+ uint64_t rseq_cs_pointer; -+}; -+ - struct rst_info { - struct list_head fds; - -@@ -69,6 +75,8 @@ struct rst_info { - - bool has_thp_enabled; - -+ struct rst_rseq *rseqe; -+ - void *breakpoint; - }; - -diff --git a/criu/pstree.c b/criu/pstree.c -index d29de730a..d299f41c0 100644 ---- a/criu/pstree.c -+++ b/criu/pstree.c -@@ -954,6 +954,31 @@ static int prepare_pstree_kobj_ids(void) - return 0; - } - -+static int prepare_pstree_rseqs(void) -+{ -+ struct pstree_item *item; -+ -+ for_each_pstree_item(item) { -+ struct rst_rseq *rseqs; -+ size_t sz = sizeof(*rseqs) * item->nr_threads; -+ -+ if (!task_alive(item)) -+ continue; -+ -+ rseqs = shmalloc(sz); -+ if (!rseqs) { -+ pr_err("prepare_pstree_rseqs shmalloc(%lu) failed\n", (unsigned long)sz); -+ return -1; -+ } -+ -+ memset(rseqs, 0, sz); -+ -+ rsti(item)->rseqe = rseqs; -+ } -+ -+ return 0; -+} -+ - int prepare_pstree(void) - { - int ret; -@@ -1011,6 +1036,17 @@ int prepare_pstree(void) - * pstree with properly injected helper tasks. - */ - ret = prepare_pstree_ids(pid); -+ if (!ret) -+ /* -+ * We need to alloc shared buffers for RseqEntry'es -+ * arrays (one RseqEntry per pstree item thread). -+ * -+ * We need shared memory because we perform -+ * open_core() on the late stage inside -+ * restore_one_alive_task(), so that's the only -+ * way to transfer that data to the main CRIU process. -+ */ -+ ret = prepare_pstree_rseqs(); - - return ret; - } -diff --git a/images/rseq.proto b/images/rseq.proto -index be2800468..45cb8476d 100644 ---- a/images/rseq.proto -+++ b/images/rseq.proto -@@ -6,4 +6,5 @@ message rseq_entry { - required uint64 rseq_abi_pointer = 1; - required uint32 rseq_abi_size = 2; - required uint32 signature = 3; -+ optional uint64 rseq_cs_pointer = 4; - } --- -2.35.1 - diff --git a/0248-zdtm-add-rseq02-transition-test-with-NO_RESTART-CS-f.patch b/0248-zdtm-add-rseq02-transition-test-with-NO_RESTART-CS-f.patch deleted file mode 100644 index 37e3d61..0000000 --- a/0248-zdtm-add-rseq02-transition-test-with-NO_RESTART-CS-f.patch +++ /dev/null @@ -1,176 +0,0 @@ -From 354fcbb88018261832360d3d07290c2913021328 Mon Sep 17 00:00:00 2001 -From: Alexander Mikhalitsyn -Date: Wed, 23 Feb 2022 23:20:29 +0300 -Subject: [PATCH 248/249] zdtm: add rseq02 transition test with NO_RESTART CS - flag - -Signed-off-by: Alexander Mikhalitsyn ---- - test/zdtm/transition/Makefile | 2 ++ - test/zdtm/transition/rseq01.c | 59 ++++++++++++++++++++++++++++++-- - test/zdtm/transition/rseq02.c | 1 + - test/zdtm/transition/rseq02.desc | 1 + - 4 files changed, 61 insertions(+), 2 deletions(-) - create mode 120000 test/zdtm/transition/rseq02.c - create mode 120000 test/zdtm/transition/rseq02.desc - -diff --git a/test/zdtm/transition/Makefile b/test/zdtm/transition/Makefile -index fae4e27b3..378a4fc75 100644 ---- a/test/zdtm/transition/Makefile -+++ b/test/zdtm/transition/Makefile -@@ -24,6 +24,7 @@ TST_NOFILE = \ - pid_reuse \ - pidfd_store_sk \ - rseq01 \ -+ rseq02 \ - - - TST_FILE = \ -@@ -82,6 +83,7 @@ ptrace: LDFLAGS += -pthread - fork2: CFLAGS += -D FORK2 - thread-bomb.o: CFLAGS += -pthread - thread-bomb: LDFLAGS += -pthread -+rseq02: CFLAGS += -D NOABORT - - %: %.sh - cp $< $@ -diff --git a/test/zdtm/transition/rseq01.c b/test/zdtm/transition/rseq01.c -index cc8ecfdcd..1356cb5ed 100644 ---- a/test/zdtm/transition/rseq01.c -+++ b/test/zdtm/transition/rseq01.c -@@ -53,6 +53,18 @@ enum rseq_flags { - RSEQ_FLAG_UNREGISTER = (1 << 0), - }; - -+enum rseq_cs_flags_bit { -+ RSEQ_CS_FLAG_NO_RESTART_ON_PREEMPT_BIT = 0, -+ RSEQ_CS_FLAG_NO_RESTART_ON_SIGNAL_BIT = 1, -+ RSEQ_CS_FLAG_NO_RESTART_ON_MIGRATE_BIT = 2, -+}; -+ -+enum rseq_cs_flags { -+ RSEQ_CS_FLAG_NO_RESTART_ON_PREEMPT = (1U << RSEQ_CS_FLAG_NO_RESTART_ON_PREEMPT_BIT), -+ RSEQ_CS_FLAG_NO_RESTART_ON_SIGNAL = (1U << RSEQ_CS_FLAG_NO_RESTART_ON_SIGNAL_BIT), -+ RSEQ_CS_FLAG_NO_RESTART_ON_MIGRATE = (1U << RSEQ_CS_FLAG_NO_RESTART_ON_MIGRATE_BIT), -+}; -+ - struct rseq { - uint32_t cpu_id_start; - uint32_t cpu_id; -@@ -106,6 +118,7 @@ static int rseq_addv(intptr_t *v, intptr_t count, int cpu) - { - double a = 10000000000000000.0; - double b = -1; -+ uint64_t rseq_cs1 = 0, rseq_cs2 = 0; - - /* clang-format off */ - __asm__ __volatile__ goto( -@@ -130,6 +143,9 @@ static int rseq_addv(intptr_t *v, intptr_t count, int cpu) - "dec %%rcx\n\t" - "jnz 5b\n\t" - "fstpl %[y]\n\t" -+ "movq %%rax, %[rseq_cs_check2]\n\t" -+ "movq %[rseq_cs], %%rax\n\t" -+ "movq %%rax, %[rseq_cs_check1]\n\t" - "2:\n\t" - ".pushsection __rseq_failure, \"ax\"\n\t" - /* Disassembler-friendly signature: nopl (%rip). */ -@@ -144,6 +160,8 @@ static int rseq_addv(intptr_t *v, intptr_t count, int cpu) - : [cpu_id] "r" (cpu), - [current_cpu_id] "m" (rseq_ptr->cpu_id), - [rseq_cs] "m" (rseq_ptr->rseq_cs), -+ [rseq_cs_check1] "m" (rseq_cs1), -+ [rseq_cs_check2] "m" (rseq_cs2), - /* final store input */ - [v] "m" (*v), - [count] "er" (count), -@@ -154,9 +172,22 @@ static int rseq_addv(intptr_t *v, intptr_t count, int cpu) - ); - /* clang-format on */ - rseq_after_asm_goto(); -+ test_msg("exit %lx %lx %f %f\n", rseq_cs1, rseq_cs2, a, b); -+ if (rseq_cs1 != rseq_cs2) { -+ /* -+ * It means that we finished critical section -+ * *normally* (haven't jumped to abort) but the kernel had cleaned up -+ * rseq_ptr->rseq_cs before we left critical section -+ * and CRIU wasn't restored it correctly. -+ * That's a bug picture. -+ */ -+ return -1; -+ } -+ - return 0; - abort: - rseq_after_asm_goto(); -+ test_msg("abort %lx %lx %f %f\n", rseq_cs1, rseq_cs2, a, b); - return -1; - } - -@@ -178,21 +209,45 @@ int main(int argc, char *argv[]) - fail("calloc"); - exit(EXIT_FAILURE); - } -+ - register_thread(); - -+ /* -+ * We want to test that RSEQ_CS_FLAG_NO_RESTART_ON_SIGNAL -+ * is handled properly by CRIU, but that flag can be used -+ * only with all another flags set. -+ * Please, refer to -+ * https://github.com/torvalds/linux/blob/master/kernel/rseq.c#L192 -+ */ -+#ifdef NOABORT -+ rseq_ptr->flags = RSEQ_CS_FLAG_NO_RESTART_ON_PREEMPT | RSEQ_CS_FLAG_NO_RESTART_ON_SIGNAL | -+ RSEQ_CS_FLAG_NO_RESTART_ON_MIGRATE; -+#endif -+ - test_daemon(); - - while (test_go()) { - cpu = RSEQ_ACCESS_ONCE(rseq_ptr->cpu_id_start); - ret = rseq_addv(&cpu_data[cpu], 2, cpu); -- if (ret) -+#ifndef NOABORT -+ /* just ignore abort */ -+ ret = 0; -+#else -+ if (ret) { - fail("Failed to increment per-cpu counter"); -+ break; -+ } -+#endif - } - - test_waitsig(); - - check_thread(); -- pass(); -+ -+ if (ret) -+ fail(); -+ else -+ pass(); - - return 0; - } -diff --git a/test/zdtm/transition/rseq02.c b/test/zdtm/transition/rseq02.c -new file mode 120000 -index 000000000..d56491719 ---- /dev/null -+++ b/test/zdtm/transition/rseq02.c -@@ -0,0 +1 @@ -+rseq01.c -\ No newline at end of file -diff --git a/test/zdtm/transition/rseq02.desc b/test/zdtm/transition/rseq02.desc -new file mode 120000 -index 000000000..b888f0da7 ---- /dev/null -+++ b/test/zdtm/transition/rseq02.desc -@@ -0,0 +1 @@ -+rseq01.desc -\ No newline at end of file --- -2.35.1 - diff --git a/0249-zdtm-temporary-disable-rseq02-test.patch b/0249-zdtm-temporary-disable-rseq02-test.patch deleted file mode 100644 index a66f6bb..0000000 --- a/0249-zdtm-temporary-disable-rseq02-test.patch +++ /dev/null @@ -1,41 +0,0 @@ -From dd656e5565b9bb77b5a66d80302301f9dfebfa8a Mon Sep 17 00:00:00 2001 -From: Alexander Mikhalitsyn -Date: Tue, 5 Apr 2022 12:27:07 +0300 -Subject: [PATCH 249/249] zdtm: temporary disable rseq02 test - -That's strange but rseq02 test fails with: -09:06:16.222: 51: exit 555f52082120 555f52082120 -09:06:16.282: 51: exit 555f52082120 555f52082120 -09:06:16.340: 51: exit 555f52082120 555f52082120 -09:06:16.397: 51: exit 555f52082120 555f52082120 -09:06:16.503: 51: exit 0 555f52082120 -09:06:16.503: 51: FAIL: rseq02.c:235: Failed to increment per-cpu counter (errno = 2 (No such file or directory)) -09:06:16.503: 51: FAIL: rseq02.c:246: (errno = 16 (Device or resource busy)) - -It means that rseq_cs pointer was cleaned up by the kernel despite of -NO_RESTART* flags. That's a hardly reproducible and I will investigate that. - -Signed-off-by: Alexander Mikhalitsyn ---- - test/zdtm/transition/rseq02.desc | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - mode change 120000 => 100644 test/zdtm/transition/rseq02.desc - -diff --git a/test/zdtm/transition/rseq02.desc b/test/zdtm/transition/rseq02.desc -deleted file mode 120000 -index b888f0da7..000000000 ---- a/test/zdtm/transition/rseq02.desc -+++ /dev/null -@@ -1 +0,0 @@ --rseq01.desc -\ No newline at end of file -diff --git a/test/zdtm/transition/rseq02.desc b/test/zdtm/transition/rseq02.desc -new file mode 100644 -index 000000000..1ce7f240f ---- /dev/null -+++ b/test/zdtm/transition/rseq02.desc -@@ -0,0 +1 @@ -+{'flavor': 'h', 'arch': 'x86_64', 'feature': 'get_rseq_conf', 'flags': 'noauto'} --- -2.35.1 - diff --git a/criu.spec b/criu.spec index 8f8eb15..31413ad 100644 --- a/criu.spec +++ b/criu.spec @@ -16,267 +16,17 @@ %undefine _auto_set_build_flags Name: criu -Version: 3.16.1 -Release: 12%{?dist} +Version: 3.17 +Release: 1%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPLv2 URL: http://criu.org/ Source0: https://github.com/checkpoint-restore/criu/archive/v%{version}/criu-%{version}.tar.gz -Patch1: 0001-criu-8-add-external-net-option.patch -Patch2: 0002-tcp-Skip-restoring-TCP-state-when-dumping-with-tcp-c.patch -Patch3: 0003-zdtm-Dumping-restoring-with-tcp-close-on-TCP_CLOSE-s.patch -Patch4: 0004-criu-8-Add-more-detailed-description-about-tcp-close.patch -Patch5: 0005-Add-support-for-python3-in-criu-coredump.patch -Patch6: 0006-Add-new-files-for-running-criu-coredump-via-python-2.patch -Patch7: 0007-coredump-remove-unused-import.patch -Patch8: 0008-coredump-sort-imports.patch -Patch9: 0009-coredump-convert-indentation-to-spaces.patch -Patch10: 0010-python-replace-equality-with-identity-test.patch -Patch11: 0011-coredump-drop-unused-variable.patch -Patch12: 0012-coredump-drop-exec-permission.patch -Patch13: 0013-coredump-lint-fix-for-block-comments.patch -Patch14: 0014-coredump-fix-missing-whitespace-around-operator.patch -Patch15: 0015-coredump-fix-too-many-blank-lines.patch -Patch16: 0016-coredump-fix-comparison-to-true.patch -Patch17: 0017-coredump-lint-fix-visually-indented-line.patch -Patch18: 0018-test-coredump-fix-shellcheck-errors.patch -Patch19: 0019-make-enable-lint-for-coredump.patch -Patch20: 0020-ci-enable-coredump-tests.patch -Patch21: 0021-pie-restorer-remove-excess-hash-printf-specifier.patch -Patch22: 0022-tty-fix-the-null-pointer-of-get_tty_driver.patch -Patch23: 0023-util-use-nftw-in-rmrf-helper.patch -Patch24: 0024-criu-ns-make-pidns-init-first-do-setsid.patch -Patch25: 0025-net-optimize-restore_rule-to-not-open-the-CR_FD_RULE.patch -Patch26: 0026-ci-replace-deprecated-codecov-bash-uploader.patch -Patch27: 0027-ci-fix-userfaultfd-test-failures.patch -Patch28: 0028-ci-use-Fedora-34-for-lint-CI-runs.patch -Patch29: 0029-tests-improve-the-image-streamer-process-control.patch -Patch30: 0030-sockets-don-t-call-sk_setbufs-asyncronously.patch -Patch31: 0031-kerndat-check-for-set-getsockopt-SO_BUF_LOCK-availab.patch -Patch32: 0032-sockets-c-r-bufer-size-locks.patch -Patch33: 0033-zdtm-add-test-for-socket-buffer-size-locks.patch -Patch34: 0034-zdtm-make-sock_opts02-also-check-lock-change-by-SO_-.patch -Patch35: 0035-clang-format-enable-AlignTrailingComments.patch -Patch36: 0036-clang-format-do-several-manual-comment-fixups.patch -Patch37: 0037-clang-format-do-automatic-comment-fixups.patch -Patch38: 0038-cr-dump-fail-dumping-when-zombie-process-with-sid-0.patch -Patch39: 0039-clang-format-make-x86_ins_capability_mask-human-read.patch -Patch40: 0040-ci-disable-socket-raw-test-on-centos8.patch -Patch41: 0041-zdtm.py-make-tests-with-link_remap-exclusive.patch -Patch42: 0042-tests-improve-the-deterministic-behavior-of-the-test.patch -Patch43: 0043-clang-format-zdtm-fix-clang-complains-about-strange-.patch -Patch44: 0044-seize-restore-cgroup-freezer-to-right-state.patch -Patch45: 0045-ci-Use-latest-Fedora-for-lint-ci-runs-again.patch -Patch46: 0046-crtools-ignore-SIGPIPE-in-swrk-mode.patch -Patch47: 0047-ci-switch-to-centos-stream-8.patch -Patch48: 0048-check-cleanup-child-processes.patch -Patch49: 0049-files-reg-fix-error-handling-in-open_path.patch -Patch50: 0050-files-reg-fix-error-handling-of-rm_parent_dirs.patch -Patch51: 0051-ghost-mount-allocate-remounted_rw-in-shmem-to-get-in.patch -Patch52: 0052-files-reg-temporary-remount-writable-the-mount-we-do.patch -Patch53: 0053-zdtm-add-ro-mount-check-after-c-r-to-mntns_ghost01.patch -Patch54: 0054-clang-format-disable-wrong-struct-pointer-declaratio.patch -Patch55: 0055-ci-Run-cross-compile-on-debian-stable.patch -Patch56: 0056-ci-Run-cross-compile-with-debian-testing.patch -Patch57: 0057-make-Explicitly-enable-FPU-on-ARMv7-builds.patch -Patch58: 0058-ci-disable-broken-tests-until-fixed.patch -Patch59: 0059-test-do-not-use-keep-going-for-single-zdtm-tests.patch -Patch60: 0060-files-reg-try-dump_ghost_remap-if-link-remap-failed-.patch -Patch61: 0061-util-make-page-server-IPv6-safe.patch -Patch62: 0062-sk-unix-Fix-TCP_ESTABLISHED-checks-in-unix-sockets.patch -Patch63: 0063-ci-Enable-disabled-unix-socket-related-tests.patch -Patch64: 0064-ci-install-procps-in-Alpine.patch -Patch65: 0065-test-another-try-to-correctly-fix-the-kernel-version.patch -Patch66: 0066-x86-compel-fault-inject-bound-xsave-features-set.patch -Patch67: 0067-x86-compel-fault-inject-print-the-initial-seed.patch -Patch68: 0068-ci-enable-x86-xsave-fault-injection-tests-back.patch -Patch69: 0069-Add-documentation-for-timeout-option.patch -Patch70: 0070-usernsd-UNS_FDOUT-should-not-require-an-input-descri.patch -Patch71: 0071-libcriu-add-setting-lsm-mount-context-to-libcriu.patch -Patch72: 0072-ci-use-unstable-release-for-cross-compile.patch -Patch73: 0073-ci-disable-glibc-rseq-support.patch -Patch74: 0074-libcriu-add-single-pre-dump-support.patch -Patch75: 0075-tests-added-test-for-single-pre-dump-support.patch -Patch76: 0076-zdtm.py-clean-up-MAKEFLAGS-env-variable-before-runni.patch -Patch77: 0077-zdtm-zdtm_ct-fix-compilation-error-with-strict-proto.patch -Patch78: 0078-zdtm-remove-mntns-deleted-dst-test-leftover-from-git.patch -Patch79: 0079-crtools-remove-excess-always-true-condition.patch -Patch80: 0080-crtools-rpc-export-current-criu-mode-to-opts.mode.patch -Patch81: 0081-crtools-use-new-opts.mode-in-image_dir_mode.patch -Patch82: 0082-crtools-check-that-cpuinfo-command-has-sub-command.patch -Patch83: 0083-sk-unix-Add-support-for-SOCK_SEQPACKET-unix-sockets.patch -Patch84: 0084-zdtm-Add-SOCK_SEQPACKET-variants-to-unix-socket-test.patch -Patch85: 0085-tls-fix-typo.patch -Patch86: 0086-tls-use-ssize_t-for-return-value.patch -Patch87: 0087-tls-add-more-comments.patch -Patch88: 0088-uffd-call-disconnect_from_page_server-to-shutdown-a-.patch -Patch89: 0089-tls-allow-to-terminate-connections-synchronously.patch -Patch90: 0090-page-xfer-stop-waiting-for-a-new-command-after-a-clo.patch -Patch91: 0091-ci-reenable-the-lazy-thp-test-in-the-lazy-remote-mod.patch -Patch92: 0092-test-log-testname.out.inprogress-if-a-test-has-faile.patch -Patch93: 0093-zdtm-print-tails-of-all-logs-if-a-test-has-failed.patch -Patch94: 0094-zdtm-static-uffd-events-add-more-log-messages.patch -Patch95: 0095-mount-split-check_mountpoint_fd-from-__open_mountpoi.patch -Patch96: 0096-mount-remove-mnt_fd-argument-of-__open_mountpoint.patch -Patch97: 0097-proc_parse-add-helper-to-resolve-sdev-from-fd.patch -Patch98: 0098-mount-btrfs-make-check_mountpoint_fd-fallback-to-get.patch -Patch99: 0099-ci-test-criu-image-streamer-with-all-tests.patch -Patch100: 0100-readme-add-docker-test-badge.patch -Patch101: 0101-contributing-remove-old-badges-and-logo.patch -Patch102: 0102-ci-update-to-latest-Vagrant-and-Fedora-images.patch -Patch103: 0103-ci-added-.lgtm.yml-file.patch -Patch104: 0104-lib-introduce-feature-check-in-libcriu.patch -Patch105: 0105-lib-added-tests-for-feature-check-in-libcriu.patch -Patch106: 0106-pagemap-tiny-fix-on-truncating-memory-image.patch -Patch107: 0107-zdtm-fix-zdtm-static-maps00-case-in-arm64.patch -Patch108: 0108-compel-fix-GCC-12-failure-out-of-bounds.patch -Patch109: 0109-criu-fix-configuration-file-scanner-with-GCC-12.patch -Patch110: 0110-compel-fix-parasite-with-GCC-12.patch -Patch111: 0111-ci-set-continue-on-error-for-cross-compile.patch -Patch112: 0112-test-autofs-fix-use-after-free.patch -Patch113: 0113-Fix-formatting-in-criu-documentation.patch -Patch114: 0114-ci-install-libbsd-dependency.patch -Patch115: 0115-pstree-when-updating-sid-for-shell-job-also-update-m.patch -Patch116: 0116-criu-ns-fix-exit-code-o-for-criu-dump.patch -Patch117: 0117-criu-ns-use-os.waitstatus_to_exitcode.patch -Patch118: 0118-restorer-Fix-sys_mmap-s-returned-value-check.patch -Patch119: 0119-compel-fix-how-PTRACE_GET_THREAD_AREA-errors-are-han.patch -Patch120: 0120-util-add-an-unique-ID-of-the-current-criu-run.patch -Patch121: 0121-files-generate-unique-transport-socket-names.patch -Patch122: 0122-check-Add-a-check-for-using-memfd-with-hugetlb.patch -Patch123: 0123-kerndat-Collect-hugetlb-device-numbers.patch -Patch124: 0124-ipc-Add-support-for-checkpoint-restore-hugetlb-Syste.patch -Patch125: 0125-memfd-shmem-Add-support-for-checkpoint-restore-memfd.patch -Patch126: 0126-proc_parse-files-Add-support-for-hugetlb-memory-mapp.patch -Patch127: 0127-mem-Skip-premapping-hugetlb-mapping.patch -Patch128: 0128-uffd-Skip-lazy-mode-restore-on-hugetlb-mappings.patch -Patch129: 0129-zdtm-Add-MAP_HUGETLB-memory-mapping-test.patch -Patch130: 0130-zdtm-Add-memfd-hugetlb-test.patch -Patch131: 0131-zdtm-Add-shm-hugetlb-test.patch -Patch132: 0132-zdtm-Add-MAP_HUGETLB-mappings-test-for-parent-child-.patch -Patch133: 0133-ci-skip-MAP_HUGETLB-tests-in-stream-test.patch -Patch134: 0134-bpfmap-handle-new-field-in-fdinfo.patch -Patch135: 0135-test-remove-test-for-LOCK_MAND-flock.patch -Patch136: 0136-test-disable-rseq-also-on-Archlinux.patch -Patch137: 0137-zdtm-fix-missplacement-of-err-True.patch -Patch138: 0138-compel-set-mxcsr-during-error-injection-to-zero.patch -Patch139: 0139-proc_smaps-remove-useless-nonlinear-check.patch -Patch140: 0140-mount-fix-e_str-leak-in-ext_mount_add.patch -Patch141: 0141-cr-dump-fix-cr_imgset-leak-in-dump_one_task.patch -Patch142: 0142-tun-fix-tun_link-leak-in-dump_tun_link.patch -Patch143: 0143-sk-unix-fix-uint32_t-id-variable-printf-format-speci.patch -Patch144: 0144-zdtm-refactor-main.patch -Patch145: 0145-zdtm-sort-import-lines.patch -Patch146: 0146-zdtm-use-long-form-cli-options.patch -Patch147: 0147-zdtm-add-criu-config-option.patch -Patch148: 0148-zdtm-drop-redundant-config_inotify_irmap-test.patch -Patch149: 0149-ci-run-criu-config-tests.patch -Patch150: 0150-config-fix-ns-leak-in-parse_join_ns.patch -Patch151: 0151-net-fix-e_str-leak-in-veth_pair_add.patch -Patch152: 0152-files-fix-inh-leak-in-inherit_fd_add.patch -Patch153: 0153-sk-unix-fix-e_str-leak-in-unix_sk_id_add.patch -Patch154: 0154-uffd-fix-__u64-print-format-specifier.patch -Patch155: 0155-zdtm-fix-mnt_ext_master-test-to-correspond-to-it-s-n.patch -Patch156: 0156-mount-add-mntinfo_add_list_before-helper-for-adding-.patch -Patch157: 0157-mount-do-not-detect-non-fsroot-mounts-as-device-exte.patch -Patch158: 0158-mount-mark-mounts-of-external-devices-external.patch -Patch159: 0159-mount-skip-fstype-and-source-checks-for-external-mou.patch -Patch160: 0160-mount-setup-mnt_bind-list-before-using-it-in-mnt_is_.patch -Patch161: 0161-util-add-get_relative_path-helper.patch -Patch162: 0162-unittest-add-some-tests-for-get_relative_path-helper.patch -Patch163: 0163-mount-add-mnt_bind_pick-helper-to-pick-the-desired-b.patch -Patch164: 0164-mount-split-mnt_is_external-_bind-and-can_receive_ma.patch -Patch165: 0165-mount-rework-skipping-external-mounts-in-dump_one_mo.patch -Patch166: 0166-mount-show-more-info-about-why-we-can-t-mount.patch -Patch167: 0167-mount-mount-external-mount-before-mounting-it-s-bind.patch -Patch168: 0168-zdtm-add-new-mnt_ext_root-test.patch -Patch169: 0169-mount-restrict-mp-external-mount-map-to-init-contain.patch -Patch170: 0170-zdtm-add-mnt_ext_collision-test.patch -Patch171: 0171-mount-add-mnt_is_root_bind-helper.patch -Patch172: 0172-mount-allow-nested-mount-namespaces-with-different-r.patch -Patch173: 0173-zdtm-add-mntns_pivot_root-test.patch -Patch174: 0174-mount-apply-superblock-flags-to-nested-ns-roots.patch -Patch175: 0175-zdtm-add-mntns_pivot_root_ro-test.patch -Patch176: 0176-mount-restore-create-auxiliary-binfmt_misc-mount-in-.patch -Patch177: 0177-mount-restore-leave-ns_mountpoint-NULL-for-aux-binfm.patch -Patch178: 0178-mount-replace-CRTIME_MNT_ID-with-HELPER_MNT_ID.patch -Patch179: 0179-mount-add-can_receive_master_from_root-helper.patch -Patch180: 0180-mount-put-external-slavery-mounts-to-separate-mnt_ex.patch -Patch181: 0181-mount-do-not-override-master_id-to-1-for-root-binds.patch -Patch182: 0182-mount-add-helper-mnt_get_external_bind_nodev.patch -Patch183: 0183-mount-prepare-is_overmounted-as-early-as-possible.patch -Patch184: 0184-mount-move-root-yard-tree-merge-as-early-as-possible.patch -Patch185: 0185-mount-fix-broken-remounted_rw-check.patch -Patch186: 0186-mount-make-general-place-for-shared-variables-on-mou.patch -Patch187: 0187-autofs-use-ns_mountpoint-in-autofs_create_dentries.patch -Patch188: 0188-mount-use-ns_mountpoint-in-mnt_is_overmounted.patch -Patch189: 0189-mount-skip-root-yard-children-from-mnt_needs_remap-c.patch -Patch190: 0190-mount-use-ns_mountpoint-in-validate_children_collisi.patch -Patch191: 0191-mount-use-ns_mountpoint-in-root_path_from_parent.patch -Patch192: 0192-mount-use-ns_mountpoint-for-children-overmount-check.patch -Patch193: 0193-path-simplify-mnt_get_sibling_path-via-get_relative_.patch -Patch194: 0194-mount-use-ns_mountpoint-in-collect_mntinfo.patch -Patch195: 0195-mount-use-ns_mountpoint-in-aufs_parse.patch -Patch196: 0196-mount-use-ns_mountpoint-in-mnt_depth.patch -Patch197: 0197-mount-use-ns_mountpoint-instead-of-mountpoint-where-.patch -Patch198: 0198-mount-add-service_mountpoint-getter-for-mountpoint.patch -Patch199: 0199-files-reg-split-create_ghost_dentry-out-of-create_gh.patch -Patch200: 0200-files-reg-teach-create_ghost-to-work-with-mount-v2.patch -Patch201: 0201-files-reg-teach-clean_one_remap-to-work-with-mount-v.patch -Patch202: 0202-kerndat-Check-for-MOVE_MOUNT_SET_GROUP-availability.patch -Patch203: 0203-compel-add-open_tree-syscall.patch -Patch204: 0204-kerndat-check-whether-the-openat2-syscall-is-support.patch -Patch205: 0205-util-add-resolve_mountpoint-helper.patch -Patch206: 0206-crtools-move-check_options-after-kerndat_init-and-lo.patch -Patch207: 0207-config-rpc-add-new-option-mntns-compat-mode-for-old-.patch -Patch208: 0208-mount-add-plain-mountpoints.patch -Patch209: 0209-files-reg-export-parent-dirs-helpers-for-mount-v2.patch -Patch210: 0210-mount-remove-double-ns_id-declaration.patch -Patch211: 0211-mount-export-common-defines-for-mount-v2.patch -Patch212: 0212-mount-export-several-functions-for-mount-v2.patch -Patch213: 0213-mount-export-global-variables-for-mount-v2.patch -Patch214: 0214-mount-add-new-mounts-v2-engine.patch -Patch215: 0215-zdtm-enable-mounts-compat-mode-on-restore-with-mntns.patch -Patch216: 0216-ci-run-tests-for-old-mount-engine.patch -Patch217: 0217-zdtm-add-new-mnt_ext_sharing-test-for-mount-v2.patch -Patch218: 0218-zdtm-add-mount_complex_sharing-test.patch -Patch219: 0219-zdtm-add-propagation-group-with-mount-flags-to-mount.patch -Patch220: 0220-zdtm-mount-v2-disable-mnt_tracefs-test.patch -Patch221: 0221-ci-make-others-mnt_ext_dev-also-run-for-old-mount-en.patch -Patch222: 0222-test-jenkins-test-for-old-mount-engine.patch -Patch223: 0223-zdtm-mount-v2-disable-pty-console-test.patch -Patch224: 0224-mount-v2-make-mount-engine-fallback-messages-logleve.patch -Patch225: 0225-mount-make-error-messages-differ-in-different-places.patch -Patch226: 0226-zdtm-use-unique-holder-for-cgroups.patch -Patch227: 0227-scripts-ci-mount-test-cgroups-once.patch -Patch228: 0228-criu-ns-add-a-helper-to-hold-a-pid-namespace.patch -Patch229: 0229-apparmor-Fix-Wfortify-source-for-Clang.patch -Patch230: 0230-style-delete-some-redundant-code.patch -Patch231: 0231-mount-fix-Wunused-but-set-variable-for-Clang-15.patch -Patch232: 0232-compel-add-rseq-syscall-into-compel-std-plugin-sysca.patch -Patch233: 0233-kerndat-check-for-rseq-syscall-support.patch -Patch234: 0234-util-move-fork_and_ptrace_attach-helper-from-cr-chec.patch -Patch235: 0235-cr-check-Add-ptrace-rseq-conf-dump-feature.patch -Patch236: 0236-rseq-initial-support.patch -Patch237: 0237-zdtm-add-basic-static-rseq00-test-for-rseq-C-R.patch -Patch238: 0238-Revert-ci-disable-glibc-rseq-support.patch -Patch239: 0239-ci-add-Fedora-Rawhide-based-test-on-Cirrus.patch -Patch240: 0240-include-add-thread_pointer.h-from-Glibc.patch -Patch241: 0241-clone-noasan-unregister-rseq-at-the-thread-start-for.patch -Patch242: 0242-zdtm-static-rseq00-fix-rseq-test-when-linking-with-a.patch -Patch243: 0243-compel-add-helpers-to-get-set-instruction-pointer.patch -Patch244: 0244-cr-dump-fixup-thread-IP-when-inside-rseq-cs.patch -Patch245: 0245-zdtm-add-transition-rseq01-test-for-amd64.patch -Patch246: 0246-Revert-test-disable-rseq-also-on-Archlinux.patch -Patch247: 0247-cr-dump-handle-rseq-flags-field.patch -Patch248: 0248-zdtm-add-rseq02-transition-test-with-NO_RESTART-CS-f.patch -Patch249: 0249-zdtm-temporary-disable-rseq02-test.patch - # Add protobuf-c as a dependency. # We use this patch because the protobuf-c package name # in RPM and DEB is different. -Patch299: criu.pc.patch +Patch99: criu.pc.patch %if 0%{?rhel} && 0%{?rhel} <= 7 BuildRequires: perl @@ -284,12 +34,11 @@ BuildRequires: perl # zcat /usr/share/man/man8/criu.8.gz > criu.8 Source1: criu.8 Source2: crit.1 -Source3: compel.1 -Source4: criu-ns.1 +Source3: criu-ns.1 # The patch aio-fix.patch is needed as RHEL7 # doesn't do "nr_events *= 2" in ioctx_alloc(). -Patch300: aio-fix.patch +Patch100: aio-fix.patch %endif Source5: criu-tmpfiles.conf @@ -372,260 +121,10 @@ This script can help to workaround the so called "PID mismatch" problem. %prep %setup -q -%patch1 -p1 -%patch2 -p1 -%patch3 -p1 -%patch4 -p1 -%patch5 -p1 -%patch6 -p1 -%patch7 -p1 -%patch8 -p1 -%patch9 -p1 -%patch10 -p1 -%patch11 -p1 -%patch12 -p1 -%patch13 -p1 -%patch14 -p1 -%patch15 -p1 -%patch16 -p1 -%patch17 -p1 -%patch18 -p1 -%patch19 -p1 -%patch20 -p1 -%patch21 -p1 -%patch22 -p1 -%patch23 -p1 -%patch24 -p1 -%patch25 -p1 -%patch26 -p1 -%patch27 -p1 -%patch28 -p1 -%patch29 -p1 -%patch30 -p1 -%patch31 -p1 -%patch32 -p1 -%patch33 -p1 -%patch34 -p1 -%patch35 -p1 -%patch36 -p1 -%patch37 -p1 -%patch38 -p1 -%patch39 -p1 -%patch40 -p1 -%patch41 -p1 -%patch42 -p1 -%patch43 -p1 -%patch44 -p1 -%patch45 -p1 -%patch46 -p1 -%patch47 -p1 -%patch48 -p1 -%patch49 -p1 -%patch50 -p1 -%patch51 -p1 -%patch52 -p1 -%patch53 -p1 -%patch54 -p1 -%patch55 -p1 -%patch56 -p1 -%patch57 -p1 -%patch58 -p1 -%patch59 -p1 -%patch60 -p1 -%patch61 -p1 -%patch62 -p1 -%patch63 -p1 -%patch64 -p1 -%patch65 -p1 -%patch66 -p1 -%patch67 -p1 -%patch68 -p1 -%patch69 -p1 -%patch70 -p1 -%patch71 -p1 -%patch72 -p1 -%patch73 -p1 -%patch74 -p1 -%patch75 -p1 -%patch76 -p1 -%patch77 -p1 -%patch78 -p1 -%patch79 -p1 -%patch80 -p1 -%patch81 -p1 -%patch82 -p1 -%patch83 -p1 -%patch84 -p1 -%patch85 -p1 -%patch86 -p1 -%patch87 -p1 -%patch88 -p1 -%patch89 -p1 -%patch90 -p1 -%patch91 -p1 -%patch92 -p1 -%patch93 -p1 -%patch94 -p1 -%patch95 -p1 -%patch96 -p1 -%patch97 -p1 -%patch98 -p1 %patch99 -p1 -%patch100 -p1 -%patch101 -p1 -%patch102 -p1 -%patch103 -p1 -%patch104 -p1 -%patch105 -p1 -%patch106 -p1 -%patch107 -p1 -%patch108 -p1 -%patch109 -p1 -%patch110 -p1 -%patch111 -p1 -%patch112 -p1 -%patch113 -p1 -%patch114 -p1 -%patch115 -p1 -%patch116 -p1 -%patch117 -p1 -%patch118 -p1 -%patch119 -p1 -%patch120 -p1 -%patch121 -p1 -%patch122 -p1 -%patch123 -p1 -%patch124 -p1 -%patch125 -p1 -%patch126 -p1 -%patch127 -p1 -%patch128 -p1 -%patch129 -p1 -%patch130 -p1 -%patch131 -p1 -%patch132 -p1 -%patch133 -p1 -%patch134 -p1 -%patch135 -p1 -%patch136 -p1 -%patch137 -p1 -%patch138 -p1 -%patch139 -p1 -%patch140 -p1 -%patch141 -p1 -%patch142 -p1 -%patch143 -p1 -%patch144 -p1 -%patch145 -p1 -%patch146 -p1 -%patch147 -p1 -%patch148 -p1 -%patch149 -p1 -%patch150 -p1 -%patch151 -p1 -%patch152 -p1 -%patch153 -p1 -%patch154 -p1 -%patch155 -p1 -%patch156 -p1 -%patch157 -p1 -%patch158 -p1 -%patch159 -p1 -%patch160 -p1 -%patch161 -p1 -%patch162 -p1 -%patch163 -p1 -%patch164 -p1 -%patch165 -p1 -%patch166 -p1 -%patch167 -p1 -%patch168 -p1 -%patch169 -p1 -%patch170 -p1 -%patch171 -p1 -%patch172 -p1 -%patch173 -p1 -%patch174 -p1 -%patch175 -p1 -%patch176 -p1 -%patch177 -p1 -%patch178 -p1 -%patch179 -p1 -%patch180 -p1 -%patch181 -p1 -%patch182 -p1 -%patch183 -p1 -%patch184 -p1 -%patch185 -p1 -%patch186 -p1 -%patch187 -p1 -%patch188 -p1 -%patch189 -p1 -%patch190 -p1 -%patch191 -p1 -%patch192 -p1 -%patch193 -p1 -%patch194 -p1 -%patch195 -p1 -%patch196 -p1 -%patch197 -p1 -%patch198 -p1 -%patch199 -p1 -%patch200 -p1 -%patch201 -p1 -%patch202 -p1 -%patch203 -p1 -%patch204 -p1 -%patch205 -p1 -%patch206 -p1 -%patch207 -p1 -%patch208 -p1 -%patch209 -p1 -%patch210 -p1 -%patch211 -p1 -%patch212 -p1 -%patch213 -p1 -%patch214 -p1 -%patch215 -p1 -%patch216 -p1 -%patch217 -p1 -%patch218 -p1 -%patch219 -p1 -%patch220 -p1 -%patch221 -p1 -%patch222 -p1 -%patch223 -p1 -%patch224 -p1 -%patch225 -p1 -%patch226 -p1 -%patch227 -p1 -%patch228 -p1 -%patch229 -p1 -%patch230 -p1 -%patch231 -p1 -%patch232 -p1 -%patch233 -p1 -%patch234 -p1 -%patch235 -p1 -%patch236 -p1 -%patch237 -p1 -%patch238 -p1 -%patch239 -p1 -%patch240 -p1 -%patch241 -p1 -%patch242 -p1 -%patch243 -p1 -%patch244 -p1 -%patch245 -p1 -%patch246 -p1 -%patch247 -p1 -%patch248 -p1 -%patch249 -p1 - -%patch299 -p1 %if 0%{?rhel} && 0%{?rhel} <= 7 -%patch300 -p1 +%patch100 -p1 %endif %build @@ -648,11 +147,13 @@ make install-lib DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} PYT # only install documentation on Fedora as it requires asciidoc, # which is not available on RHEL7 make install-man DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} +rm -f $RPM_BUILD_ROOT%{_mandir}/man1/compel.1 +rm -f $RPM_BUILD_ROOT%{_mandir}/man1/amdgpu_plugin.1 %else install -p -m 644 -D %{SOURCE1} $RPM_BUILD_ROOT%{_mandir}/man8/%{name}.8 install -p -m 644 -D %{SOURCE2} $RPM_BUILD_ROOT%{_mandir}/man1/crit.1 -install -p -m 644 -D %{SOURCE3} $RPM_BUILD_ROOT%{_mandir}/man1/compel.1 -install -p -m 644 -D %{SOURCE4} $RPM_BUILD_ROOT%{_mandir}/man1/criu-ns.1 +install -p -m 644 -D %{SOURCE3} $RPM_BUILD_ROOT%{_mandir}/man1/criu-ns.1 +rm -f compel.1 amdgpu_plugin.1 %endif mkdir -p %{buildroot}%{_tmpfilesdir} @@ -673,7 +174,6 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %files %{_sbindir}/%{name} %doc %{_mandir}/man8/criu.8* -%doc %{_mandir}/man1/compel.1* %if 0%{?fedora} || 0%{?rhel} > 7 %{_libexecdir}/%{name} %endif @@ -709,6 +209,10 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %doc %{_mandir}/man1/criu-ns.1* %changelog +* Fri May 6 2022 Radostin Stoyanov - 3.17-1 +- Update to release version 3.17 +- Don not install compel and amdgpu_plugin man pages + * Tue Apr 5 2022 Radostin Stoyanov - 3.16.1-12 - Update rseq patches diff --git a/sources b/sources index fdcc0ac..1e3c0ae 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (criu-3.16.1.tar.gz) = a558af41f1927a1b1d87f8d11163a5f3d2e4f83a74aba00619b45a6d464d5477a6a0aac3c1b9d9a17e3343a4bf21a3fd6b279b51fa0c347c86c307381a4d0739 +SHA512 (criu-3.17.tar.gz) = febae66a7820345c0f335f4a49e64c0af5c8ae5d3a394cc0770881b64eab11ca03ad5872f06b0c4ccd1da844c519268dad3b4f8b260267e6d3f582e80d80f804 From 094b0ffec989de94498d428911be34c1bd285054 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Thu, 19 May 2022 09:06:20 +0100 Subject: [PATCH 046/109] Use mntns-compat-mode as a temporary fix for runc Signed-off-by: Radostin Stoyanov --- config-always-use-mntns-compat-mode.patch | 31 +++++++++++++++++++++++ criu.spec | 12 +++++++-- 2 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 config-always-use-mntns-compat-mode.patch diff --git a/config-always-use-mntns-compat-mode.patch b/config-always-use-mntns-compat-mode.patch new file mode 100644 index 0000000..60b99cd --- /dev/null +++ b/config-always-use-mntns-compat-mode.patch @@ -0,0 +1,31 @@ +From 9086891f2e524f9630ee474b87e8b1530ff03c7a Mon Sep 17 00:00:00 2001 +From: Radostin Stoyanov +Date: Thu, 19 May 2022 08:45:46 +0100 +Subject: [PATCH] config: Always use mntns-compat-mode + +Signed-off-by: Radostin Stoyanov +--- + criu/config.c | 7 +++---- + 1 file changed, 3 insertions(+), 4 deletions(-) + +diff --git a/criu/config.c b/criu/config.c +index 14a11f9c3..f4a7f57c3 100644 +--- a/criu/config.c ++++ b/criu/config.c +@@ -1105,10 +1105,9 @@ int check_options(void) + } + #endif + +- if (opts.mntns_compat_mode && opts.mode != CR_RESTORE) { +- pr_err("Option --mntns-compat-mode is only valid on restore\n"); +- return 1; +- } else if (!opts.mntns_compat_mode && opts.mode == CR_RESTORE) { ++ // FIXME: Always use mntns-compat-mode until we have a proper fix for ++ // https://github.com/opencontainers/runc/pull/3442 ++ if (opts.mode == CR_RESTORE) { + if (check_mount_v2()) { + pr_debug("Mount engine fallback to --mntns-compat-mode mode\n"); + opts.mntns_compat_mode = true; +-- +2.35.3 + diff --git a/criu.spec b/criu.spec index 31413ad..7a6645a 100644 --- a/criu.spec +++ b/criu.spec @@ -17,12 +17,16 @@ Name: criu Version: 3.17 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPLv2 URL: http://criu.org/ Source0: https://github.com/checkpoint-restore/criu/archive/v%{version}/criu-%{version}.tar.gz +# FIXME: Always use mntns-compat-mode until we have a proper fix for +# https://github.com/opencontainers/runc/pull/3442 +Patch98: config-always-use-mntns-compat-mode.patch + # Add protobuf-c as a dependency. # We use this patch because the protobuf-c package name # in RPM and DEB is different. @@ -121,6 +125,7 @@ This script can help to workaround the so called "PID mismatch" problem. %prep %setup -q +%patch98 -p1 %patch99 -p1 %if 0%{?rhel} && 0%{?rhel} <= 7 @@ -209,9 +214,12 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %doc %{_mandir}/man1/criu-ns.1* %changelog +* Thu May 19 2022 Radostin Stoyanov - 3.17-2 +- Use mntns-compat-mode as a temporary fix for runc + * Fri May 6 2022 Radostin Stoyanov - 3.17-1 - Update to release version 3.17 -- Don not install compel and amdgpu_plugin man pages +- Do not install compel and amdgpu_plugin man pages * Tue Apr 5 2022 Radostin Stoyanov - 3.16.1-12 - Update rseq patches From 9432743274047dea6825a886b837934a2e8d5675 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Fri, 20 May 2022 13:20:51 -0700 Subject: [PATCH 047/109] spec: make criu-devel require criu-libs This should fix rpmdeps failures (like [1]). [1] https://osci-jenkins-1.ci.fedoraproject.org/job/fedora-ci/job/rpminspect-pipeline/job/master/101653/testReport/(root)/tests/_rpmdeps/ Signed-off-by: Kir Kolyshkin --- criu.spec | 1 + 1 file changed, 1 insertion(+) diff --git a/criu.spec b/criu.spec index 7a6645a..8ad17e4 100644 --- a/criu.spec +++ b/criu.spec @@ -79,6 +79,7 @@ Linux in user-space. %package devel Summary: Header files and libraries for %{name} Requires: %{name} = %{version}-%{release} +Requires: %{name}-libs = %{version}-%{release} %description devel This package contains header files and libraries for %{name}. From 2b4c4b415223c6e883398ce53dfd9d9c1ebcacf1 Mon Sep 17 00:00:00 2001 From: Python Maint Date: Mon, 13 Jun 2022 17:10:15 +0200 Subject: [PATCH 048/109] Rebuilt for Python 3.11 --- criu.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/criu.spec b/criu.spec index 8ad17e4..c667f97 100644 --- a/criu.spec +++ b/criu.spec @@ -17,7 +17,7 @@ Name: criu Version: 3.17 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPLv2 URL: http://criu.org/ @@ -215,6 +215,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %doc %{_mandir}/man1/criu-ns.1* %changelog +* Mon Jun 13 2022 Python Maint - 3.17-3 +- Rebuilt for Python 3.11 + * Thu May 19 2022 Radostin Stoyanov - 3.17-2 - Use mntns-compat-mode as a temporary fix for runc From f42bf1185aed9c07e5d7492a240b1c3edf011e1b Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Mon, 20 Jun 2022 16:06:16 +0200 Subject: [PATCH 049/109] Apply upstream patch to fix mount v2 errors Signed-off-by: Adrian Reber --- 1898.patch | 349 ++++++++++++++++++++++ config-always-use-mntns-compat-mode.patch | 31 -- criu.spec | 9 +- 3 files changed, 355 insertions(+), 34 deletions(-) create mode 100644 1898.patch delete mode 100644 config-always-use-mntns-compat-mode.patch diff --git a/1898.patch b/1898.patch new file mode 100644 index 0000000..41c102b --- /dev/null +++ b/1898.patch @@ -0,0 +1,349 @@ +From 16fc8f1c4a745d35a2957cb0a17ae9fab3ef2a7f Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Wed, 18 May 2022 18:25:43 +0300 +Subject: [PATCH 1/3] mount-v2: split out restore_one_sharing helper + +This helper restores master_id and shared_id of first mount in the +sharing group. It first copies sharing from either external source or +internal parent sharing group and makes master_id from shared_id. Next +it creates new shared_id when needed. + +All other mounts except first are just copied from the first one. + +Signed-off-by: Pavel Tikhomirov +--- + criu/mount-v2.c | 60 ++++++++++++++++++++++++++++--------------------- + 1 file changed, 35 insertions(+), 25 deletions(-) + +diff --git a/criu/mount-v2.c b/criu/mount-v2.c +index 623016d428..1d188114f7 100644 +--- a/criu/mount-v2.c ++++ b/criu/mount-v2.c +@@ -925,27 +925,25 @@ static int move_mount_set_group(int src_id, char *source, int dst_id) + return 0; + } + +-static int restore_one_sharing_group(struct sharing_group *sg) ++static int restore_one_sharing(struct sharing_group *sg, struct mount_info *target) + { +- struct mount_info *first, *other; +- char first_path[PATH_MAX]; +- int first_fd; ++ char target_path[PATH_MAX]; ++ int target_fd; + +- first = get_first_mount(sg); +- first_fd = fdstore_get(first->mnt_fd_id); +- BUG_ON(first_fd < 0); +- snprintf(first_path, sizeof(first_path), "/proc/self/fd/%d", first_fd); ++ target_fd = fdstore_get(target->mnt_fd_id); ++ BUG_ON(target_fd < 0); ++ snprintf(target_path, sizeof(target_path), "/proc/self/fd/%d", target_fd); + +- /* Restore first's master_id from shared_id of the source */ ++ /* Restore target's master_id from shared_id of the source */ + if (sg->master_id) { + if (sg->parent) { +- struct mount_info *p; ++ struct mount_info *first; + + /* Get shared_id from parent sharing group */ +- p = get_first_mount(sg->parent); +- if (move_mount_set_group(p->mnt_fd_id, NULL, first->mnt_fd_id)) { +- pr_err("Failed to copy sharing from %d to %d\n", p->mnt_id, first->mnt_id); +- close(first_fd); ++ first = get_first_mount(sg->parent); ++ if (move_mount_set_group(first->mnt_fd_id, NULL, target->mnt_fd_id)) { ++ pr_err("Failed to copy sharing from %d to %d\n", first->mnt_id, target->mnt_id); ++ close(target_fd); + return -1; + } + } else { +@@ -956,30 +954,42 @@ static int restore_one_sharing_group(struct sharing_group *sg) + * or non-shared slave). If source is a private mount + * we would fail. + */ +- if (move_mount_set_group(-1, sg->source, first->mnt_fd_id)) { +- pr_err("Failed to copy sharing from source %s to %d\n", sg->source, first->mnt_id); +- close(first_fd); ++ if (move_mount_set_group(-1, sg->source, target->mnt_fd_id)) { ++ pr_err("Failed to copy sharing from source %s to %d\n", sg->source, target->mnt_id); ++ close(target_fd); + return -1; + } + } + + /* Convert shared_id to master_id */ +- if (mount(NULL, first_path, NULL, MS_SLAVE, NULL)) { +- pr_perror("Failed to make mount %d slave", first->mnt_id); +- close(first_fd); ++ if (mount(NULL, target_path, NULL, MS_SLAVE, NULL)) { ++ pr_perror("Failed to make mount %d slave", target->mnt_id); ++ close(target_fd); + return -1; + } + } + +- /* Restore first's shared_id */ ++ /* Restore target's shared_id */ + if (sg->shared_id) { +- if (mount(NULL, first_path, NULL, MS_SHARED, NULL)) { +- pr_perror("Failed to make mount %d shared", first->mnt_id); +- close(first_fd); ++ if (mount(NULL, target_path, NULL, MS_SHARED, NULL)) { ++ pr_perror("Failed to make mount %d shared", target->mnt_id); ++ close(target_fd); + return -1; + } + } +- close(first_fd); ++ close(target_fd); ++ ++ return 0; ++} ++ ++static int restore_one_sharing_group(struct sharing_group *sg) ++{ ++ struct mount_info *first, *other; ++ ++ first = get_first_mount(sg); ++ ++ if (restore_one_sharing(sg, first)) ++ return -1; + + /* Restore sharing for other mounts from the sharing group */ + list_for_each_entry(other, &sg->mnt_list, mnt_sharing) { + +From 061ab0d785465747a44174ad034d38c7080842be Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Wed, 18 May 2022 18:25:43 +0300 +Subject: [PATCH 2/3] mount-v2: workaround for multiple external bindmounts + with no common root + +It's a problem when while restoring sharing group we need to copy +sharing between two mounts with non-intersecting roots, because kernel +does not allow it. + +We have a case https://github.com/opencontainers/runc/pull/3442, where +runc adds different devtmpfs file-bindmounts to container and there is +no fsroot mount in container for this devtmpfs, thus mount-v2 faces the +above problem. + +Luckily for the case of external mounts which are in one sharing group +and which have non-intersecting roots, these mounts likely only have +external master with no sharing, so we can just copy sharing from +external source and make it slave as a workaround. + +https://github.com/checkpoint-restore/criu/issues/1886 + +Signed-off-by: Pavel Tikhomirov +--- + criu/mount-v2.c | 32 +++++++++++++++++++++++++++++--- + 1 file changed, 29 insertions(+), 3 deletions(-) + +diff --git a/criu/mount-v2.c b/criu/mount-v2.c +index 1d188114f7..5d53e9a226 100644 +--- a/criu/mount-v2.c ++++ b/criu/mount-v2.c +@@ -996,9 +996,35 @@ static int restore_one_sharing_group(struct sharing_group *sg) + if (other == first) + continue; + +- if (move_mount_set_group(first->mnt_fd_id, NULL, other->mnt_fd_id)) { +- pr_err("Failed to copy sharing from %d to %d\n", first->mnt_id, other->mnt_id); +- return -1; ++ if (is_sub_path(other->root, first->root)) { ++ if (move_mount_set_group(first->mnt_fd_id, NULL, other->mnt_fd_id)) { ++ pr_err("Failed to copy sharing from %d to %d\n", first->mnt_id, other->mnt_id); ++ return -1; ++ } ++ } else { ++ /* ++ * Case where mounts of this sharing group don't have common root. ++ * For instance we can create two sub-directories .a and .b in some ++ * shared mount, bindmount them separately somethere and umount the ++ * original mount. Now we have both bindmounts shared between each ++ * other. Kernel only allows to copy sharing between mounts when ++ * source root contains destination root, which is not true for ++ * these two, so we can't just copy from first to other. ++ * ++ * For external sharing (!sg->parent) with only master_id (shared_id ++ * == 0) we can workaround this by copying from their external source ++ * instead (same as we did for a first mount). ++ * ++ * This is a w/a runc usecase, see https://github.com/opencontainers/runc/pull/3442 ++ */ ++ if (!sg->parent && !sg->shared_id) { ++ if (restore_one_sharing(sg, other)) ++ return -1; ++ } else { ++ pr_err("Can't copy sharing from %d[%s] to %d[%s]\n", first->mnt_id, first->root, ++ other->mnt_id, other->root); ++ return -1; ++ } + } + } + + +From 24bf471d5ba2b8c2c291bfceac2b1218aa0750c1 Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Fri, 20 May 2022 12:11:49 +0300 +Subject: [PATCH 3/3] zdtm: test multiple ext bindmounts with no common root + and same master + +Signed-off-by: Pavel Tikhomirov +--- + test/zdtm/static/Makefile | 1 + + test/zdtm/static/mnt_ext_multiple.c | 118 +++++++++++++++++++++++++ + test/zdtm/static/mnt_ext_multiple.desc | 5 ++ + 3 files changed, 124 insertions(+) + create mode 100644 test/zdtm/static/mnt_ext_multiple.c + create mode 100644 test/zdtm/static/mnt_ext_multiple.desc + +diff --git a/test/zdtm/static/Makefile b/test/zdtm/static/Makefile +index 9dc02d4a58..761bf0f6c6 100644 +--- a/test/zdtm/static/Makefile ++++ b/test/zdtm/static/Makefile +@@ -406,6 +406,7 @@ TST_DIR = \ + mntns_pivot_root \ + mntns_pivot_root_ro \ + mnt_ext_sharing \ ++ mnt_ext_multiple \ + mount_complex_sharing \ + mnt_tracefs \ + mntns_deleted \ +diff --git a/test/zdtm/static/mnt_ext_multiple.c b/test/zdtm/static/mnt_ext_multiple.c +new file mode 100644 +index 0000000000..7014927ac3 +--- /dev/null ++++ b/test/zdtm/static/mnt_ext_multiple.c +@@ -0,0 +1,118 @@ ++#include ++#include ++#include ++#include ++ ++#include "zdtmtst.h" ++ ++const char *test_doc = "Check multiple non-common root external mounts with same external master"; ++const char *test_author = "Pavel Tikhomirov "; ++ ++char *dirname = "mnt_ext_multiple.test"; ++char *source = "zdtm_ext_multiple"; ++char *ext_source = "zdtm_ext_multiple.ext"; ++TEST_OPTION(dirname, string, "directory name", 1); ++ ++int main(int argc, char **argv) ++{ ++ char *root, testdir[PATH_MAX]; ++ char dst_a[PATH_MAX], dst_b[PATH_MAX]; ++ char src[PATH_MAX], src_a[PATH_MAX], src_b[PATH_MAX]; ++ char nsdst_a[PATH_MAX], nsdst_b[PATH_MAX]; ++ char *tmp = "/tmp/zdtm_ext_multiple.tmp"; ++ char *zdtm_newns = getenv("ZDTM_NEWNS"); ++ ++ root = getenv("ZDTM_ROOT"); ++ if (root == NULL) { ++ pr_perror("root"); ++ return 1; ++ } ++ ++ if (!zdtm_newns) { ++ pr_perror("ZDTM_NEWNS is not set"); ++ return 1; ++ } else if (strcmp(zdtm_newns, "1")) { ++ goto test; ++ } ++ ++ /* Prepare directories in test root */ ++ sprintf(testdir, "%s/%s", root, dirname); ++ mkdir(testdir, 0755); ++ sprintf(dst_a, "%s/%s/dst_a", root, dirname); ++ mkdir(dst_a, 0755); ++ sprintf(dst_b, "%s/%s/dst_b", root, dirname); ++ mkdir(dst_b, 0755); ++ ++ /* Prepare directories in criu root */ ++ mkdir(tmp, 0755); ++ if (mount(source, tmp, "tmpfs", 0, NULL)) { ++ pr_perror("mount tmpfs"); ++ return 1; ++ } ++ if (mount(NULL, tmp, NULL, MS_PRIVATE, NULL)) { ++ pr_perror("make private"); ++ return 1; ++ } ++ sprintf(src, "%s/src", tmp); ++ mkdir(src, 0755); ++ ++ /* Create a shared mount in criu mntns */ ++ if (mount(ext_source, src, "tmpfs", 0, NULL)) { ++ pr_perror("mount tmpfs"); ++ return 1; ++ } ++ if (mount(NULL, src, NULL, MS_PRIVATE, NULL)) { ++ pr_perror("make private"); ++ return 1; ++ } ++ if (mount(NULL, src, NULL, MS_SHARED, NULL)) { ++ pr_perror("make shared"); ++ return 1; ++ } ++ ++ /* ++ * Create temporary mntns, next mounts will not show up in criu mntns ++ */ ++ if (unshare(CLONE_NEWNS)) { ++ pr_perror("unshare"); ++ return 1; ++ } ++ ++ /* ++ * Populate to the tests root subdirectories of the src mount ++ */ ++ sprintf(src_a, "%s/src/a", tmp); ++ mkdir(src_a, 0755); ++ if (mount(src_a, dst_a, NULL, MS_BIND, NULL)) { ++ pr_perror("bind"); ++ return 1; ++ } ++ sprintf(src_b, "%s/src/b", tmp); ++ mkdir(src_b, 0755); ++ if (mount(src_b, dst_b, NULL, MS_BIND, NULL)) { ++ pr_perror("bind"); ++ return 1; ++ } ++ ++test: ++ test_init(argc, argv); ++ ++ /* Make "external" mounts to have external master */ ++ sprintf(nsdst_a, "/%s/dst_a", dirname); ++ if (mount(NULL, nsdst_a, NULL, MS_SLAVE, NULL)) { ++ pr_perror("make slave"); ++ return 1; ++ } ++ sprintf(nsdst_b, "/%s/dst_b", dirname); ++ if (mount(NULL, nsdst_b, NULL, MS_SLAVE, NULL)) { ++ pr_perror("make slave"); ++ return 1; ++ } ++ ++ test_daemon(); ++ test_waitsig(); ++ ++ pass(); ++ ++ return 0; ++} +diff --git a/test/zdtm/static/mnt_ext_multiple.desc b/test/zdtm/static/mnt_ext_multiple.desc +new file mode 100644 +index 0000000000..fd413ed15c +--- /dev/null ++++ b/test/zdtm/static/mnt_ext_multiple.desc +@@ -0,0 +1,5 @@ ++{ 'dopts': '--external mnt[/mnt_ext_multiple.test/dst_a]:MNT_A --external mnt[/mnt_ext_multiple.test/dst_b]:MNT_B', ++ 'feature': 'mnt_id move_mount_set_group', ++ 'flavor': 'ns uns', ++ 'flags': 'suid', ++ 'ropts': '--external mnt[MNT_A]:/tmp/zdtm_ext_multiple.tmp/src/a --external mnt[MNT_B]:/tmp/zdtm_ext_multiple.tmp/src/b --no-mntns-compat-mode'} diff --git a/config-always-use-mntns-compat-mode.patch b/config-always-use-mntns-compat-mode.patch deleted file mode 100644 index 60b99cd..0000000 --- a/config-always-use-mntns-compat-mode.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 9086891f2e524f9630ee474b87e8b1530ff03c7a Mon Sep 17 00:00:00 2001 -From: Radostin Stoyanov -Date: Thu, 19 May 2022 08:45:46 +0100 -Subject: [PATCH] config: Always use mntns-compat-mode - -Signed-off-by: Radostin Stoyanov ---- - criu/config.c | 7 +++---- - 1 file changed, 3 insertions(+), 4 deletions(-) - -diff --git a/criu/config.c b/criu/config.c -index 14a11f9c3..f4a7f57c3 100644 ---- a/criu/config.c -+++ b/criu/config.c -@@ -1105,10 +1105,9 @@ int check_options(void) - } - #endif - -- if (opts.mntns_compat_mode && opts.mode != CR_RESTORE) { -- pr_err("Option --mntns-compat-mode is only valid on restore\n"); -- return 1; -- } else if (!opts.mntns_compat_mode && opts.mode == CR_RESTORE) { -+ // FIXME: Always use mntns-compat-mode until we have a proper fix for -+ // https://github.com/opencontainers/runc/pull/3442 -+ if (opts.mode == CR_RESTORE) { - if (check_mount_v2()) { - pr_debug("Mount engine fallback to --mntns-compat-mode mode\n"); - opts.mntns_compat_mode = true; --- -2.35.3 - diff --git a/criu.spec b/criu.spec index c667f97..7713224 100644 --- a/criu.spec +++ b/criu.spec @@ -17,15 +17,15 @@ Name: criu Version: 3.17 -Release: 3%{?dist} +Release: 4%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPLv2 URL: http://criu.org/ Source0: https://github.com/checkpoint-restore/criu/archive/v%{version}/criu-%{version}.tar.gz -# FIXME: Always use mntns-compat-mode until we have a proper fix for +# Fix for mount-v2 problems # https://github.com/opencontainers/runc/pull/3442 -Patch98: config-always-use-mntns-compat-mode.patch +Patch98: https://patch-diff.githubusercontent.com/raw/checkpoint-restore/criu/pull/1898.patch # Add protobuf-c as a dependency. # We use this patch because the protobuf-c package name @@ -215,6 +215,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %doc %{_mandir}/man1/criu-ns.1* %changelog +* Mon Jun 20 2022 Adrian Reber - 3.17-4 +- Apply upstream patch to fix mount v2 errors + * Mon Jun 13 2022 Python Maint - 3.17-3 - Rebuilt for Python 3.11 From 2ef0d409dc8a92b269564eea98c110394087f167 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Mon, 27 Jun 2022 09:46:27 +0100 Subject: [PATCH 050/109] Update to release version 3.17.1 Signed-off-by: Radostin Stoyanov --- .gitignore | 1 + 1898.patch | 349 ----------------------------------------------------- criu.spec | 12 +- sources | 2 +- 4 files changed, 7 insertions(+), 357 deletions(-) delete mode 100644 1898.patch diff --git a/.gitignore b/.gitignore index 19692ad..277658b 100644 --- a/.gitignore +++ b/.gitignore @@ -53,3 +53,4 @@ /criu-3.16.tar.gz /criu-3.16.1.tar.gz /criu-3.17.tar.gz +/criu-3.17.1.tar.gz diff --git a/1898.patch b/1898.patch deleted file mode 100644 index 41c102b..0000000 --- a/1898.patch +++ /dev/null @@ -1,349 +0,0 @@ -From 16fc8f1c4a745d35a2957cb0a17ae9fab3ef2a7f Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Wed, 18 May 2022 18:25:43 +0300 -Subject: [PATCH 1/3] mount-v2: split out restore_one_sharing helper - -This helper restores master_id and shared_id of first mount in the -sharing group. It first copies sharing from either external source or -internal parent sharing group and makes master_id from shared_id. Next -it creates new shared_id when needed. - -All other mounts except first are just copied from the first one. - -Signed-off-by: Pavel Tikhomirov ---- - criu/mount-v2.c | 60 ++++++++++++++++++++++++++++--------------------- - 1 file changed, 35 insertions(+), 25 deletions(-) - -diff --git a/criu/mount-v2.c b/criu/mount-v2.c -index 623016d428..1d188114f7 100644 ---- a/criu/mount-v2.c -+++ b/criu/mount-v2.c -@@ -925,27 +925,25 @@ static int move_mount_set_group(int src_id, char *source, int dst_id) - return 0; - } - --static int restore_one_sharing_group(struct sharing_group *sg) -+static int restore_one_sharing(struct sharing_group *sg, struct mount_info *target) - { -- struct mount_info *first, *other; -- char first_path[PATH_MAX]; -- int first_fd; -+ char target_path[PATH_MAX]; -+ int target_fd; - -- first = get_first_mount(sg); -- first_fd = fdstore_get(first->mnt_fd_id); -- BUG_ON(first_fd < 0); -- snprintf(first_path, sizeof(first_path), "/proc/self/fd/%d", first_fd); -+ target_fd = fdstore_get(target->mnt_fd_id); -+ BUG_ON(target_fd < 0); -+ snprintf(target_path, sizeof(target_path), "/proc/self/fd/%d", target_fd); - -- /* Restore first's master_id from shared_id of the source */ -+ /* Restore target's master_id from shared_id of the source */ - if (sg->master_id) { - if (sg->parent) { -- struct mount_info *p; -+ struct mount_info *first; - - /* Get shared_id from parent sharing group */ -- p = get_first_mount(sg->parent); -- if (move_mount_set_group(p->mnt_fd_id, NULL, first->mnt_fd_id)) { -- pr_err("Failed to copy sharing from %d to %d\n", p->mnt_id, first->mnt_id); -- close(first_fd); -+ first = get_first_mount(sg->parent); -+ if (move_mount_set_group(first->mnt_fd_id, NULL, target->mnt_fd_id)) { -+ pr_err("Failed to copy sharing from %d to %d\n", first->mnt_id, target->mnt_id); -+ close(target_fd); - return -1; - } - } else { -@@ -956,30 +954,42 @@ static int restore_one_sharing_group(struct sharing_group *sg) - * or non-shared slave). If source is a private mount - * we would fail. - */ -- if (move_mount_set_group(-1, sg->source, first->mnt_fd_id)) { -- pr_err("Failed to copy sharing from source %s to %d\n", sg->source, first->mnt_id); -- close(first_fd); -+ if (move_mount_set_group(-1, sg->source, target->mnt_fd_id)) { -+ pr_err("Failed to copy sharing from source %s to %d\n", sg->source, target->mnt_id); -+ close(target_fd); - return -1; - } - } - - /* Convert shared_id to master_id */ -- if (mount(NULL, first_path, NULL, MS_SLAVE, NULL)) { -- pr_perror("Failed to make mount %d slave", first->mnt_id); -- close(first_fd); -+ if (mount(NULL, target_path, NULL, MS_SLAVE, NULL)) { -+ pr_perror("Failed to make mount %d slave", target->mnt_id); -+ close(target_fd); - return -1; - } - } - -- /* Restore first's shared_id */ -+ /* Restore target's shared_id */ - if (sg->shared_id) { -- if (mount(NULL, first_path, NULL, MS_SHARED, NULL)) { -- pr_perror("Failed to make mount %d shared", first->mnt_id); -- close(first_fd); -+ if (mount(NULL, target_path, NULL, MS_SHARED, NULL)) { -+ pr_perror("Failed to make mount %d shared", target->mnt_id); -+ close(target_fd); - return -1; - } - } -- close(first_fd); -+ close(target_fd); -+ -+ return 0; -+} -+ -+static int restore_one_sharing_group(struct sharing_group *sg) -+{ -+ struct mount_info *first, *other; -+ -+ first = get_first_mount(sg); -+ -+ if (restore_one_sharing(sg, first)) -+ return -1; - - /* Restore sharing for other mounts from the sharing group */ - list_for_each_entry(other, &sg->mnt_list, mnt_sharing) { - -From 061ab0d785465747a44174ad034d38c7080842be Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Wed, 18 May 2022 18:25:43 +0300 -Subject: [PATCH 2/3] mount-v2: workaround for multiple external bindmounts - with no common root - -It's a problem when while restoring sharing group we need to copy -sharing between two mounts with non-intersecting roots, because kernel -does not allow it. - -We have a case https://github.com/opencontainers/runc/pull/3442, where -runc adds different devtmpfs file-bindmounts to container and there is -no fsroot mount in container for this devtmpfs, thus mount-v2 faces the -above problem. - -Luckily for the case of external mounts which are in one sharing group -and which have non-intersecting roots, these mounts likely only have -external master with no sharing, so we can just copy sharing from -external source and make it slave as a workaround. - -https://github.com/checkpoint-restore/criu/issues/1886 - -Signed-off-by: Pavel Tikhomirov ---- - criu/mount-v2.c | 32 +++++++++++++++++++++++++++++--- - 1 file changed, 29 insertions(+), 3 deletions(-) - -diff --git a/criu/mount-v2.c b/criu/mount-v2.c -index 1d188114f7..5d53e9a226 100644 ---- a/criu/mount-v2.c -+++ b/criu/mount-v2.c -@@ -996,9 +996,35 @@ static int restore_one_sharing_group(struct sharing_group *sg) - if (other == first) - continue; - -- if (move_mount_set_group(first->mnt_fd_id, NULL, other->mnt_fd_id)) { -- pr_err("Failed to copy sharing from %d to %d\n", first->mnt_id, other->mnt_id); -- return -1; -+ if (is_sub_path(other->root, first->root)) { -+ if (move_mount_set_group(first->mnt_fd_id, NULL, other->mnt_fd_id)) { -+ pr_err("Failed to copy sharing from %d to %d\n", first->mnt_id, other->mnt_id); -+ return -1; -+ } -+ } else { -+ /* -+ * Case where mounts of this sharing group don't have common root. -+ * For instance we can create two sub-directories .a and .b in some -+ * shared mount, bindmount them separately somethere and umount the -+ * original mount. Now we have both bindmounts shared between each -+ * other. Kernel only allows to copy sharing between mounts when -+ * source root contains destination root, which is not true for -+ * these two, so we can't just copy from first to other. -+ * -+ * For external sharing (!sg->parent) with only master_id (shared_id -+ * == 0) we can workaround this by copying from their external source -+ * instead (same as we did for a first mount). -+ * -+ * This is a w/a runc usecase, see https://github.com/opencontainers/runc/pull/3442 -+ */ -+ if (!sg->parent && !sg->shared_id) { -+ if (restore_one_sharing(sg, other)) -+ return -1; -+ } else { -+ pr_err("Can't copy sharing from %d[%s] to %d[%s]\n", first->mnt_id, first->root, -+ other->mnt_id, other->root); -+ return -1; -+ } - } - } - - -From 24bf471d5ba2b8c2c291bfceac2b1218aa0750c1 Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Fri, 20 May 2022 12:11:49 +0300 -Subject: [PATCH 3/3] zdtm: test multiple ext bindmounts with no common root - and same master - -Signed-off-by: Pavel Tikhomirov ---- - test/zdtm/static/Makefile | 1 + - test/zdtm/static/mnt_ext_multiple.c | 118 +++++++++++++++++++++++++ - test/zdtm/static/mnt_ext_multiple.desc | 5 ++ - 3 files changed, 124 insertions(+) - create mode 100644 test/zdtm/static/mnt_ext_multiple.c - create mode 100644 test/zdtm/static/mnt_ext_multiple.desc - -diff --git a/test/zdtm/static/Makefile b/test/zdtm/static/Makefile -index 9dc02d4a58..761bf0f6c6 100644 ---- a/test/zdtm/static/Makefile -+++ b/test/zdtm/static/Makefile -@@ -406,6 +406,7 @@ TST_DIR = \ - mntns_pivot_root \ - mntns_pivot_root_ro \ - mnt_ext_sharing \ -+ mnt_ext_multiple \ - mount_complex_sharing \ - mnt_tracefs \ - mntns_deleted \ -diff --git a/test/zdtm/static/mnt_ext_multiple.c b/test/zdtm/static/mnt_ext_multiple.c -new file mode 100644 -index 0000000000..7014927ac3 ---- /dev/null -+++ b/test/zdtm/static/mnt_ext_multiple.c -@@ -0,0 +1,118 @@ -+#include -+#include -+#include -+#include -+ -+#include "zdtmtst.h" -+ -+const char *test_doc = "Check multiple non-common root external mounts with same external master"; -+const char *test_author = "Pavel Tikhomirov "; -+ -+char *dirname = "mnt_ext_multiple.test"; -+char *source = "zdtm_ext_multiple"; -+char *ext_source = "zdtm_ext_multiple.ext"; -+TEST_OPTION(dirname, string, "directory name", 1); -+ -+int main(int argc, char **argv) -+{ -+ char *root, testdir[PATH_MAX]; -+ char dst_a[PATH_MAX], dst_b[PATH_MAX]; -+ char src[PATH_MAX], src_a[PATH_MAX], src_b[PATH_MAX]; -+ char nsdst_a[PATH_MAX], nsdst_b[PATH_MAX]; -+ char *tmp = "/tmp/zdtm_ext_multiple.tmp"; -+ char *zdtm_newns = getenv("ZDTM_NEWNS"); -+ -+ root = getenv("ZDTM_ROOT"); -+ if (root == NULL) { -+ pr_perror("root"); -+ return 1; -+ } -+ -+ if (!zdtm_newns) { -+ pr_perror("ZDTM_NEWNS is not set"); -+ return 1; -+ } else if (strcmp(zdtm_newns, "1")) { -+ goto test; -+ } -+ -+ /* Prepare directories in test root */ -+ sprintf(testdir, "%s/%s", root, dirname); -+ mkdir(testdir, 0755); -+ sprintf(dst_a, "%s/%s/dst_a", root, dirname); -+ mkdir(dst_a, 0755); -+ sprintf(dst_b, "%s/%s/dst_b", root, dirname); -+ mkdir(dst_b, 0755); -+ -+ /* Prepare directories in criu root */ -+ mkdir(tmp, 0755); -+ if (mount(source, tmp, "tmpfs", 0, NULL)) { -+ pr_perror("mount tmpfs"); -+ return 1; -+ } -+ if (mount(NULL, tmp, NULL, MS_PRIVATE, NULL)) { -+ pr_perror("make private"); -+ return 1; -+ } -+ sprintf(src, "%s/src", tmp); -+ mkdir(src, 0755); -+ -+ /* Create a shared mount in criu mntns */ -+ if (mount(ext_source, src, "tmpfs", 0, NULL)) { -+ pr_perror("mount tmpfs"); -+ return 1; -+ } -+ if (mount(NULL, src, NULL, MS_PRIVATE, NULL)) { -+ pr_perror("make private"); -+ return 1; -+ } -+ if (mount(NULL, src, NULL, MS_SHARED, NULL)) { -+ pr_perror("make shared"); -+ return 1; -+ } -+ -+ /* -+ * Create temporary mntns, next mounts will not show up in criu mntns -+ */ -+ if (unshare(CLONE_NEWNS)) { -+ pr_perror("unshare"); -+ return 1; -+ } -+ -+ /* -+ * Populate to the tests root subdirectories of the src mount -+ */ -+ sprintf(src_a, "%s/src/a", tmp); -+ mkdir(src_a, 0755); -+ if (mount(src_a, dst_a, NULL, MS_BIND, NULL)) { -+ pr_perror("bind"); -+ return 1; -+ } -+ sprintf(src_b, "%s/src/b", tmp); -+ mkdir(src_b, 0755); -+ if (mount(src_b, dst_b, NULL, MS_BIND, NULL)) { -+ pr_perror("bind"); -+ return 1; -+ } -+ -+test: -+ test_init(argc, argv); -+ -+ /* Make "external" mounts to have external master */ -+ sprintf(nsdst_a, "/%s/dst_a", dirname); -+ if (mount(NULL, nsdst_a, NULL, MS_SLAVE, NULL)) { -+ pr_perror("make slave"); -+ return 1; -+ } -+ sprintf(nsdst_b, "/%s/dst_b", dirname); -+ if (mount(NULL, nsdst_b, NULL, MS_SLAVE, NULL)) { -+ pr_perror("make slave"); -+ return 1; -+ } -+ -+ test_daemon(); -+ test_waitsig(); -+ -+ pass(); -+ -+ return 0; -+} -diff --git a/test/zdtm/static/mnt_ext_multiple.desc b/test/zdtm/static/mnt_ext_multiple.desc -new file mode 100644 -index 0000000000..fd413ed15c ---- /dev/null -+++ b/test/zdtm/static/mnt_ext_multiple.desc -@@ -0,0 +1,5 @@ -+{ 'dopts': '--external mnt[/mnt_ext_multiple.test/dst_a]:MNT_A --external mnt[/mnt_ext_multiple.test/dst_b]:MNT_B', -+ 'feature': 'mnt_id move_mount_set_group', -+ 'flavor': 'ns uns', -+ 'flags': 'suid', -+ 'ropts': '--external mnt[MNT_A]:/tmp/zdtm_ext_multiple.tmp/src/a --external mnt[MNT_B]:/tmp/zdtm_ext_multiple.tmp/src/b --no-mntns-compat-mode'} diff --git a/criu.spec b/criu.spec index 7713224..c8aef68 100644 --- a/criu.spec +++ b/criu.spec @@ -16,17 +16,13 @@ %undefine _auto_set_build_flags Name: criu -Version: 3.17 -Release: 4%{?dist} +Version: 3.17.1 +Release: 1%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPLv2 URL: http://criu.org/ Source0: https://github.com/checkpoint-restore/criu/archive/v%{version}/criu-%{version}.tar.gz -# Fix for mount-v2 problems -# https://github.com/opencontainers/runc/pull/3442 -Patch98: https://patch-diff.githubusercontent.com/raw/checkpoint-restore/criu/pull/1898.patch - # Add protobuf-c as a dependency. # We use this patch because the protobuf-c package name # in RPM and DEB is different. @@ -126,7 +122,6 @@ This script can help to workaround the so called "PID mismatch" problem. %prep %setup -q -%patch98 -p1 %patch99 -p1 %if 0%{?rhel} && 0%{?rhel} <= 7 @@ -215,6 +210,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %doc %{_mandir}/man1/criu-ns.1* %changelog +* Mon Jun 27 2022 Radostin Stoyanov - 3.17.1-1 +- Update to release version 3.17.1 + * Mon Jun 20 2022 Adrian Reber - 3.17-4 - Apply upstream patch to fix mount v2 errors diff --git a/sources b/sources index 1e3c0ae..7a3abcc 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (criu-3.17.tar.gz) = febae66a7820345c0f335f4a49e64c0af5c8ae5d3a394cc0770881b64eab11ca03ad5872f06b0c4ccd1da844c519268dad3b4f8b260267e6d3f582e80d80f804 +SHA512 (criu-3.17.1.tar.gz) = cd093fad266ad29f1d8001b38762acb46d975b3fb94a19cd40c00a6c62d4a9cbc9ababddfc7b3cfed14e4d7ffbbd982eca05932ef4884c2c3ad4deb330bcccd0 From aeefff6c84e8abbbf10451496c131dcdcb7957c7 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Fri, 8 Jul 2022 09:55:26 +0200 Subject: [PATCH 051/109] Rebuilt to pick up glibc rseq() changes Signed-off-by: Adrian Reber --- criu.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/criu.spec b/criu.spec index c8aef68..5fa3a59 100644 --- a/criu.spec +++ b/criu.spec @@ -17,7 +17,7 @@ Name: criu Version: 3.17.1 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPLv2 URL: http://criu.org/ @@ -210,6 +210,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %doc %{_mandir}/man1/criu-ns.1* %changelog +* Fri Jul 08 2022 Adrian Reber - 3.17.1-2 +- Rebuilt to pick up glibc rseq() changes + * Mon Jun 27 2022 Radostin Stoyanov - 3.17.1-1 - Update to release version 3.17.1 From 6a23aad1a3c2dc4a5ee0fa22788e457448613b25 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 20 Jul 2022 23:45:14 +0000 Subject: [PATCH 052/109] Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- criu.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/criu.spec b/criu.spec index 5fa3a59..c49dd3a 100644 --- a/criu.spec +++ b/criu.spec @@ -17,7 +17,7 @@ Name: criu Version: 3.17.1 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPLv2 URL: http://criu.org/ @@ -210,6 +210,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %doc %{_mandir}/man1/criu-ns.1* %changelog +* Wed Jul 20 2022 Fedora Release Engineering - 3.17.1-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild + * Fri Jul 08 2022 Adrian Reber - 3.17.1-2 - Rebuilt to pick up glibc rseq() changes From 2a16ebb074de725a806bb51afed90584a0c3dadb Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Fri, 2 Dec 2022 07:57:27 +0100 Subject: [PATCH 053/109] Fix FTBFS due to glibc 2.36 header changes There is an implicit function declaration in the compiler errors, which is why this is related to: --- criu-glibc-2.36-1.patch | 206 +++++++++++++++++++++++++++++++ criu-glibc-2.36-2.patch | 264 ++++++++++++++++++++++++++++++++++++++++ criu-glibc-2.36-3.patch | 101 +++++++++++++++ criu.spec | 15 ++- 4 files changed, 583 insertions(+), 3 deletions(-) create mode 100644 criu-glibc-2.36-1.patch create mode 100644 criu-glibc-2.36-2.patch create mode 100644 criu-glibc-2.36-3.patch diff --git a/criu-glibc-2.36-1.patch b/criu-glibc-2.36-1.patch new file mode 100644 index 0000000..a56d5e5 --- /dev/null +++ b/criu-glibc-2.36-1.patch @@ -0,0 +1,206 @@ +commit 1e6e826ffb7ac05f33fa123051c2fc2ddf0f68ea +Author: Alexander Mikhalitsyn +Date: Fri Jul 8 12:36:57 2022 +0000 + + rseq: fix headers conflict on Mariner GNU/Linux + + 1. For some reason, Marier distribution headers + not correctly define __GLIBC_HAVE_KERNEL_RSEQ + compile-time constant. It remains undefined, + but in fact header files provides corresponding + rseq types declaration which leads to conflict. + + 2. Another issue, is that they use uint*_t types + instead of __u* types as in original rseq.h. + + This leads to compile time issues like this: + format '%llx' expects argument of type 'long long unsigned int', but argument 5 has type 'uint64_t' {aka 'long unsigned int'} + + and we can't even replace %llx to %PRIx64 because it will break + compilation on other distros (like Fedora) with analogical error: + + error: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 6 has type ‘__u64’ {aka ‘long long unsigned int’} + + Let's use our-own struct rseq copy fully equal to the kernel one, + it's safe because this structure is a part of Linux Kernel ABI. + + Fixes #1934 + + Reported-by: Nikola Bojanic + Signed-off-by: Alexander Mikhalitsyn + +diff --git a/Makefile.config b/Makefile.config +index d46d84f2de72ea35..d113e2246b785fda 100644 +--- a/Makefile.config ++++ b/Makefile.config +@@ -78,7 +78,8 @@ export DEFINES += $(FEATURE_DEFINES) + export CFLAGS += $(FEATURE_DEFINES) + + FEATURES_LIST := TCP_REPAIR STRLCPY STRLCAT PTRACE_PEEKSIGINFO \ +- SETPROCTITLE_INIT MEMFD TCP_REPAIR_WINDOW FSCONFIG MEMFD_CREATE OPENAT2 ++ SETPROCTITLE_INIT MEMFD TCP_REPAIR_WINDOW FSCONFIG MEMFD_CREATE \ ++ OPENAT2 NO_LIBC_RSEQ_DEFS + + # $1 - config name + define gen-feature-test +diff --git a/criu/cr-dump.c b/criu/cr-dump.c +index f58701e5c5e5f975..1bd62bbe3534c92e 100644 +--- a/criu/cr-dump.c ++++ b/criu/cr-dump.c +@@ -1034,7 +1034,7 @@ static int dump_task_signals(pid_t pid, struct pstree_item *item) + return 0; + } + +-static int read_rseq_cs(pid_t tid, struct __ptrace_rseq_configuration *rseqc, struct rseq_cs *rseq_cs, ++static int read_rseq_cs(pid_t tid, struct __ptrace_rseq_configuration *rseqc, struct criu_rseq_cs *rseq_cs, + struct criu_rseq *rseq) + { + int ret; +@@ -1065,10 +1065,11 @@ static int read_rseq_cs(pid_t tid, struct __ptrace_rseq_configuration *rseqc, st + if (!rseq->rseq_cs) + return 0; + +- ret = ptrace_peek_area(tid, rseq_cs, decode_pointer(rseq->rseq_cs), sizeof(struct rseq_cs)); ++ ret = ptrace_peek_area(tid, rseq_cs, decode_pointer(rseq->rseq_cs), sizeof(struct criu_rseq_cs)); + if (ret) { + pr_err("ptrace_peek_area(%d, %lx, %lx, %lx): fail to read rseq_cs struct\n", tid, +- (unsigned long)rseq_cs, (unsigned long)rseq->rseq_cs, (unsigned long)sizeof(struct rseq_cs)); ++ (unsigned long)rseq_cs, (unsigned long)rseq->rseq_cs, ++ (unsigned long)sizeof(struct criu_rseq_cs)); + return -1; + } + +@@ -1083,7 +1084,7 @@ static int dump_thread_rseq(struct pstree_item *item, int i) + CoreEntry *core = item->core[i]; + RseqEntry **rseqep = &core->thread_core->rseq_entry; + struct criu_rseq rseq = {}; +- struct rseq_cs *rseq_cs = &dmpi(item)->thread_rseq_cs[i]; ++ struct criu_rseq_cs *rseq_cs = &dmpi(item)->thread_rseq_cs[i]; + pid_t tid = item->threads[i].real; + + /* +@@ -1149,7 +1150,7 @@ err: + static int dump_task_rseq(pid_t pid, struct pstree_item *item) + { + int i; +- struct rseq_cs *thread_rseq_cs; ++ struct criu_rseq_cs *thread_rseq_cs; + + /* if rseq() syscall isn't supported then nothing to dump */ + if (!kdat.has_rseq) +@@ -1174,7 +1175,7 @@ free_rseq: + return -1; + } + +-static bool task_in_rseq(struct rseq_cs *rseq_cs, uint64_t addr) ++static bool task_in_rseq(struct criu_rseq_cs *rseq_cs, uint64_t addr) + { + return addr >= rseq_cs->start_ip && addr < rseq_cs->start_ip + rseq_cs->post_commit_offset; + } +@@ -1182,7 +1183,7 @@ static bool task_in_rseq(struct rseq_cs *rseq_cs, uint64_t addr) + static int fixup_thread_rseq(struct pstree_item *item, int i) + { + CoreEntry *core = item->core[i]; +- struct rseq_cs *rseq_cs = &dmpi(item)->thread_rseq_cs[i]; ++ struct criu_rseq_cs *rseq_cs = &dmpi(item)->thread_rseq_cs[i]; + pid_t tid = item->threads[i].real; + + /* equivalent to (struct rseq)->rseq_cs is NULL */ +diff --git a/criu/include/linux/rseq.h b/criu/include/linux/rseq.h +index a47876e6695f16a4..5ceefbf8e1b59846 100644 +--- a/criu/include/linux/rseq.h ++++ b/criu/include/linux/rseq.h +@@ -9,7 +9,12 @@ + #endif + #endif + +-#ifndef __GLIBC_HAVE_KERNEL_RSEQ ++#include ++#include ++ ++#include "common/config.h" ++ ++#ifdef CONFIG_HAS_NO_LIBC_RSEQ_DEFS + /* + * linux/rseq.h + * +@@ -18,9 +23,6 @@ + * Copyright (c) 2015-2018 Mathieu Desnoyers + */ + +-#include +-#include +- + enum rseq_cpu_id_state { + RSEQ_CPU_ID_UNINITIALIZED = -1, + RSEQ_CPU_ID_REGISTRATION_FAILED = -2, +@@ -41,13 +43,20 @@ enum rseq_cs_flags { + RSEQ_CS_FLAG_NO_RESTART_ON_SIGNAL = (1U << RSEQ_CS_FLAG_NO_RESTART_ON_SIGNAL_BIT), + RSEQ_CS_FLAG_NO_RESTART_ON_MIGRATE = (1U << RSEQ_CS_FLAG_NO_RESTART_ON_MIGRATE_BIT), + }; ++#endif /* CONFIG_HAS_NO_LIBC_RSEQ_DEFS */ + ++/* ++ * Let's use our own definition of struct rseq_cs because some distros ++ * (for example Mariner GNU/Linux) declares this structure their-own way. ++ * This makes trouble with inconsistency between printf formatters and ++ * struct rseq_cs field types. ++ */ + /* + * struct rseq_cs is aligned on 4 * 8 bytes to ensure it is always + * contained within a single cache-line. It is usually declared as + * link-time constant data. + */ +-struct rseq_cs { ++struct criu_rseq_cs { + /* Version of this structure. */ + __u32 version; + /* enum rseq_cs_flags */ +@@ -57,7 +66,6 @@ struct rseq_cs { + __u64 post_commit_offset; + __u64 abort_ip; + } __attribute__((aligned(4 * sizeof(__u64)))); +-#endif /* __GLIBC_HAVE_KERNEL_RSEQ */ + + /* + * We have to have our own copy of struct rseq definition because +diff --git a/criu/include/pstree.h b/criu/include/pstree.h +index 8ae750e1af897d02..1137046d43fc0c1d 100644 +--- a/criu/include/pstree.h ++++ b/criu/include/pstree.h +@@ -63,7 +63,7 @@ struct dmp_info { + struct parasite_ctl *parasite_ctl; + struct parasite_thread_ctl **thread_ctls; + uint64_t *thread_sp; +- struct rseq_cs *thread_rseq_cs; ++ struct criu_rseq_cs *thread_rseq_cs; + + /* + * Although we don't support dumping different struct creds in general, +diff --git a/scripts/feature-tests.mak b/scripts/feature-tests.mak +index 592552cb8e065861..014e893a84a280ce 100644 +--- a/scripts/feature-tests.mak ++++ b/scripts/feature-tests.mak +@@ -196,3 +196,22 @@ int main(void) + return 0; + } + endef ++ ++define FEATURE_TEST_NO_LIBC_RSEQ_DEFS ++ ++#ifdef __has_include ++#if __has_include(\"sys/rseq.h\") ++#include ++#endif ++#endif ++ ++enum rseq_cpu_id_state { ++ RSEQ_CPU_ID_UNINITIALIZED = -1, ++ RSEQ_CPU_ID_REGISTRATION_FAILED = -2, ++}; ++ ++int main(void) ++{ ++ return 0; ++} ++endef diff --git a/criu-glibc-2.36-2.patch b/criu-glibc-2.36-2.patch new file mode 100644 index 0000000..9edc45d --- /dev/null +++ b/criu-glibc-2.36-2.patch @@ -0,0 +1,264 @@ +commit 4c86d6a7d54abb64fc5a15131f3351224e8c071b +Author: Radostin Stoyanov +Date: Sun Jul 31 16:07:30 2022 +0000 + + criu: fix conflicting headers + + There are several changes in glibc 2.36 that make sys/mount.h header + incompatible with kernel headers: + + https://sourceware.org/glibc/wiki/Release/2.36#Usage_of_.3Clinux.2Fmount.h.3E_and_.3Csys.2Fmount.h.3E + + This patch removes conflicting includes for `` and + updates the content of `criu/include/linux/mount.h` to match + `/usr/include/sys/mount.h`. In addition, inline definitions sys_*() + functions have been moved from "linux/mount.h" to "syscall.h" to + avoid conflicts with `uapi/compel/plugins/std/syscall.h` and + ``. The include for `` has been replaced + with local include to avoid conflicts with ``. + + Fixes: #1949 + + Signed-off-by: Radostin Stoyanov + +diff --git a/Makefile.config b/Makefile.config +index d113e2246b785fda..270ec61c0f35d462 100644 +--- a/Makefile.config ++++ b/Makefile.config +@@ -78,7 +78,7 @@ export DEFINES += $(FEATURE_DEFINES) + export CFLAGS += $(FEATURE_DEFINES) + + FEATURES_LIST := TCP_REPAIR STRLCPY STRLCAT PTRACE_PEEKSIGINFO \ +- SETPROCTITLE_INIT MEMFD TCP_REPAIR_WINDOW FSCONFIG MEMFD_CREATE \ ++ SETPROCTITLE_INIT MEMFD TCP_REPAIR_WINDOW MEMFD_CREATE \ + OPENAT2 NO_LIBC_RSEQ_DEFS + + # $1 - config name +diff --git a/criu/cgroup.c b/criu/cgroup.c +index e05b0832eddfd25c..325df6a1db27a79f 100644 +--- a/criu/cgroup.c ++++ b/criu/cgroup.c +@@ -27,6 +27,7 @@ + #include "images/cgroup.pb-c.h" + #include "kerndat.h" + #include "linux/mount.h" ++#include "syscall.h" + + /* + * This structure describes set of controller groups +diff --git a/criu/cr-check.c b/criu/cr-check.c +index f589a91da1da8243..0ca80192ce4dea6c 100644 +--- a/criu/cr-check.c ++++ b/criu/cr-check.c +@@ -21,7 +21,6 @@ + #include + #include + #include +-#include + + #include "../soccr/soccr.h" + +@@ -52,6 +51,7 @@ + #include "net.h" + #include "restorer.h" + #include "uffd.h" ++#include "linux/aio_abi.h" + + #include "images/inventory.pb-c.h" + +diff --git a/criu/cr-restore.c b/criu/cr-restore.c +index 9853c05854ac373f..9bbc9ea893f1a755 100644 +--- a/criu/cr-restore.c ++++ b/criu/cr-restore.c +@@ -22,7 +22,6 @@ + #include + #include "common/compiler.h" + +-#include "linux/mount.h" + #include "linux/rseq.h" + + #include "clone-noasan.h" +@@ -86,6 +85,8 @@ + #include + #include "compel/include/asm/syscall.h" + ++#include "linux/mount.h" ++ + #include "protobuf.h" + #include "images/sa.pb-c.h" + #include "images/timer.pb-c.h" +diff --git a/criu/include/aio.h b/criu/include/aio.h +index d1655739d9683156..38e70402093fb663 100644 +--- a/criu/include/aio.h ++++ b/criu/include/aio.h +@@ -1,7 +1,7 @@ + #ifndef __CR_AIO_H__ + #define __CR_AIO_H__ + +-#include ++#include "linux/aio_abi.h" + #include "images/mm.pb-c.h" + unsigned int aio_estimate_nr_reqs(unsigned int size); + int dump_aio_ring(MmEntry *mme, struct vma_area *vma); +diff --git a/criu/include/linux/aio_abi.h b/criu/include/linux/aio_abi.h +new file mode 100644 +index 0000000000000000..d9ce787203aeceb7 +--- /dev/null ++++ b/criu/include/linux/aio_abi.h +@@ -0,0 +1,14 @@ ++#ifndef __LINUX__AIO_ABI_H ++#define __LINUX__AIO_ABI_H ++ ++typedef __kernel_ulong_t aio_context_t; ++ ++/* read() from /dev/aio returns these structures. */ ++struct io_event { ++ __u64 data; /* the data field from the iocb */ ++ __u64 obj; /* what iocb this event came from */ ++ __s64 res; /* result code for this event */ ++ __s64 res2; /* secondary result */ ++}; ++ ++#endif /* __LINUX__AIO_ABI_H */ +diff --git a/criu/include/linux/mount.h b/criu/include/linux/mount.h +index 9a3a28b1003103e9..0d55a588cb9a87fa 100644 +--- a/criu/include/linux/mount.h ++++ b/criu/include/linux/mount.h +@@ -4,32 +4,34 @@ + #include "common/config.h" + #include "compel/plugins/std/syscall-codes.h" + +-#ifdef CONFIG_HAS_FSCONFIG +-#include +-#else ++/* Copied from /usr/include/sys/mount.h */ ++ ++#ifndef FSCONFIG_CMD_CREATE ++/* The type of fsconfig call made. */ + enum fsconfig_command { +- FSCONFIG_SET_FLAG = 0, /* Set parameter, supplying no value */ +- FSCONFIG_SET_STRING = 1, /* Set parameter, supplying a string value */ +- FSCONFIG_SET_BINARY = 2, /* Set parameter, supplying a binary blob value */ +- FSCONFIG_SET_PATH = 3, /* Set parameter, supplying an object by path */ +- FSCONFIG_SET_PATH_EMPTY = 4, /* Set parameter, supplying an object by (empty) path */ +- FSCONFIG_SET_FD = 5, /* Set parameter, supplying an object by fd */ +- FSCONFIG_CMD_CREATE = 6, /* Invoke superblock creation */ ++ FSCONFIG_SET_FLAG = 0, /* Set parameter, supplying no value */ ++#define FSCONFIG_SET_FLAG FSCONFIG_SET_FLAG ++ FSCONFIG_SET_STRING = 1, /* Set parameter, supplying a string value */ ++#define FSCONFIG_SET_STRING FSCONFIG_SET_STRING ++ FSCONFIG_SET_BINARY = 2, /* Set parameter, supplying a binary blob value */ ++#define FSCONFIG_SET_BINARY FSCONFIG_SET_BINARY ++ FSCONFIG_SET_PATH = 3, /* Set parameter, supplying an object by path */ ++#define FSCONFIG_SET_PATH FSCONFIG_SET_PATH ++ FSCONFIG_SET_PATH_EMPTY = 4, /* Set parameter, supplying an object by (empty) path */ ++#define FSCONFIG_SET_PATH_EMPTY FSCONFIG_SET_PATH_EMPTY ++ FSCONFIG_SET_FD = 5, /* Set parameter, supplying an object by fd */ ++#define FSCONFIG_SET_FD FSCONFIG_SET_FD ++ FSCONFIG_CMD_CREATE = 6, /* Invoke superblock creation */ ++#define FSCONFIG_CMD_CREATE FSCONFIG_CMD_CREATE + FSCONFIG_CMD_RECONFIGURE = 7, /* Invoke superblock reconfiguration */ ++#define FSCONFIG_CMD_RECONFIGURE FSCONFIG_CMD_RECONFIGURE + }; +-#endif ++#endif // FSCONFIG_CMD_CREATE + +-static inline int sys_fsopen(const char *fsname, unsigned int flags) +-{ +- return syscall(__NR_fsopen, fsname, flags); +-} +-static inline int sys_fsconfig(int fd, unsigned int cmd, const char *key, const char *value, int aux) +-{ +- return syscall(__NR_fsconfig, fd, cmd, key, value, aux); +-} +-static inline int sys_fsmount(int fd, unsigned int flags, unsigned int attr_flags) +-{ +- return syscall(__NR_fsmount, fd, flags, attr_flags); +-} ++#ifndef MS_MGC_VAL ++/* Magic mount flag number. Has to be or-ed to the flag values. */ ++#define MS_MGC_VAL 0xc0ed0000 /* Magic flag number to indicate "new" flags */ ++#define MS_MGC_MSK 0xffff0000 /* Magic flag number mask */ ++#endif + + #endif +diff --git a/criu/include/syscall.h b/criu/include/syscall.h +new file mode 100644 +index 0000000000000000..c38d6d971b12e825 +--- /dev/null ++++ b/criu/include/syscall.h +@@ -0,0 +1,17 @@ ++#ifndef __CR_SYSCALL_H__ ++#define __CR_SYSCALL_H__ ++ ++static inline int sys_fsopen(const char *fsname, unsigned int flags) ++{ ++ return syscall(__NR_fsopen, fsname, flags); ++} ++static inline int sys_fsconfig(int fd, unsigned int cmd, const char *key, const char *value, int aux) ++{ ++ return syscall(__NR_fsconfig, fd, cmd, key, value, aux); ++} ++static inline int sys_fsmount(int fd, unsigned int flags, unsigned int attr_flags) ++{ ++ return syscall(__NR_fsmount, fd, flags, attr_flags); ++} ++ ++#endif /* __CR_SYSCALL_H__ */ +\ No newline at end of file +diff --git a/criu/pie/parasite.c b/criu/pie/parasite.c +index e7eb1fcb60bdfc60..f75fe13bb6b6283e 100644 +--- a/criu/pie/parasite.c ++++ b/criu/pie/parasite.c +@@ -3,7 +3,6 @@ + #include + #include + #include +-#include + #include + #include + #include +@@ -14,6 +13,7 @@ + #include "int.h" + #include "types.h" + #include ++#include "linux/mount.h" + #include "parasite.h" + #include "fcntl.h" + #include "prctl.h" +diff --git a/criu/util.c b/criu/util.c +index 5f69465b44ee4b9b..060ca3bd44707ca2 100644 +--- a/criu/util.c ++++ b/criu/util.c +@@ -40,6 +40,7 @@ + #include "mem.h" + #include "namespaces.h" + #include "criu-log.h" ++#include "syscall.h" + + #include "clone-noasan.h" + #include "cr_options.h" +diff --git a/scripts/feature-tests.mak b/scripts/feature-tests.mak +index 014e893a84a280ce..fb5d2ef7ad95ab7e 100644 +--- a/scripts/feature-tests.mak ++++ b/scripts/feature-tests.mak +@@ -137,19 +137,6 @@ ENTRY(main) + END(main) + endef + +-define FEATURE_TEST_FSCONFIG +- +-#include +- +-int main(void) +-{ +- if (FSCONFIG_CMD_CREATE > 0) +- return 0; +- return 0; +-} +- +-endef +- + define FEATURE_TEST_NFTABLES_LIB_API_0 + + #include diff --git a/criu-glibc-2.36-3.patch b/criu-glibc-2.36-3.patch new file mode 100644 index 0000000..278f38d --- /dev/null +++ b/criu-glibc-2.36-3.patch @@ -0,0 +1,101 @@ +commit 517c0947050e63aac72f63a3bf373d76264723b9 +Author: Radostin Stoyanov +Date: Wed Aug 24 21:20:30 2022 +0200 + + mount: add definition for FSOPEN_CLOEXEC + + A recent change in glibc introduced `enum fsconfig_command` [1] and as a + result the compilation of criu fails with the following errors + + In file included from criu/pie/util.c:3: + /usr/include/sys/mount.h:240:6: error: redeclaration of 'enum fsconfig_command' + 240 | enum fsconfig_command + | ^~~~~~~~~~~~~~~~ + In file included from /usr/include/sys/mount.h:32: + criu/include/linux/mount.h:11:6: note: originally defined here + 11 | enum fsconfig_command { + | ^~~~~~~~~~~~~~~~ + /usr/include/sys/mount.h:242:3: error: redeclaration of enumerator 'FSCONFIG_SET_FLAG' + 242 | FSCONFIG_SET_FLAG = 0, /* Set parameter, supplying no value */ + | ^~~~~~~~~~~~~~~~~ + criu/include/linux/mount.h:12:9: note: previous definition of 'FSCONFIG_SET_FLAG' with type 'enum fsconfig_command' + 12 | FSCONFIG_SET_FLAG = 0, /* Set parameter, supplying no value */ + | ^~~~~~~~~~~~~~~~~ + /usr/include/sys/mount.h:244:3: error: redeclaration of enumerator 'FSCONFIG_SET_STRING' + 244 | FSCONFIG_SET_STRING = 1, /* Set parameter, supplying a string value */ + | ^~~~~~~~~~~~~~~~~~~ + criu/include/linux/mount.h:14:9: note: previous definition of 'FSCONFIG_SET_STRING' with type 'enum fsconfig_command' + 14 | FSCONFIG_SET_STRING = 1, /* Set parameter, supplying a string value */ + | ^~~~~~~~~~~~~~~~~~~ + /usr/include/sys/mount.h:246:3: error: redeclaration of enumerator 'FSCONFIG_SET_BINARY' + 246 | FSCONFIG_SET_BINARY = 2, /* Set parameter, supplying a binary blob value */ + | ^~~~~~~~~~~~~~~~~~~ + criu/include/linux/mount.h:16:9: note: previous definition of 'FSCONFIG_SET_BINARY' with type 'enum fsconfig_command' + 16 | FSCONFIG_SET_BINARY = 2, /* Set parameter, supplying a binary blob value */ + | ^~~~~~~~~~~~~~~~~~~ + /usr/include/sys/mount.h:248:3: error: redeclaration of enumerator 'FSCONFIG_SET_PATH' + 248 | FSCONFIG_SET_PATH = 3, /* Set parameter, supplying an object by path */ + | ^~~~~~~~~~~~~~~~~ + criu/include/linux/mount.h:18:9: note: previous definition of 'FSCONFIG_SET_PATH' with type 'enum fsconfig_command' + 18 | FSCONFIG_SET_PATH = 3, /* Set parameter, supplying an object by path */ + | ^~~~~~~~~~~~~~~~~ + /usr/include/sys/mount.h:250:3: error: redeclaration of enumerator 'FSCONFIG_SET_PATH_EMPTY' + 250 | FSCONFIG_SET_PATH_EMPTY = 4, /* Set parameter, supplying an object by (empty) path */ + | ^~~~~~~~~~~~~~~~~~~~~~~ + criu/include/linux/mount.h:20:9: note: previous definition of 'FSCONFIG_SET_PATH_EMPTY' with type 'enum fsconfig_command' + 20 | FSCONFIG_SET_PATH_EMPTY = 4, /* Set parameter, supplying an object by (empty) path */ + | ^~~~~~~~~~~~~~~~~~~~~~~ + /usr/include/sys/mount.h:252:3: error: redeclaration of enumerator 'FSCONFIG_SET_FD' + 252 | FSCONFIG_SET_FD = 5, /* Set parameter, supplying an object by fd */ + | ^~~~~~~~~~~~~~~ + criu/include/linux/mount.h:22:9: note: previous definition of 'FSCONFIG_SET_FD' with type 'enum fsconfig_command' + 22 | FSCONFIG_SET_FD = 5, /* Set parameter, supplying an object by fd */ + | ^~~~~~~~~~~~~~~ + /usr/include/sys/mount.h:254:3: error: redeclaration of enumerator 'FSCONFIG_CMD_CREATE' + 254 | FSCONFIG_CMD_CREATE = 6, /* Invoke superblock creation */ + | ^~~~~~~~~~~~~~~~~~~ + criu/include/linux/mount.h:24:9: note: previous definition of 'FSCONFIG_CMD_CREATE' with type 'enum fsconfig_command' + 24 | FSCONFIG_CMD_CREATE = 6, /* Invoke superblock creation */ + | ^~~~~~~~~~~~~~~~~~~ + /usr/include/sys/mount.h:256:3: error: redeclaration of enumerator 'FSCONFIG_CMD_RECONFIGURE' + 256 | FSCONFIG_CMD_RECONFIGURE = 7, /* Invoke superblock reconfiguration */ + | ^~~~~~~~~~~~~~~~~~~~~~~~ + criu/include/linux/mount.h:26:9: note: previous definition of 'FSCONFIG_CMD_RECONFIGURE' with type 'enum fsconfig_command' + 26 | FSCONFIG_CMD_RECONFIGURE = 7, /* Invoke superblock reconfiguration */ + + This patch adds definition for FSOPEN_CLOEXEC to solve this problem. In particular, + sys/mount.h includes ifndef check for FSOPEN_CLOEXEC surrounding `enum fsconfig_command`. + + [1] https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=7eae6a91e9b1670330c9f15730082c91c0b1d570 + + Reported-by: Younes Manton (@ymanton) + Signed-off-by: Radostin Stoyanov + +diff --git a/criu/include/linux/mount.h b/criu/include/linux/mount.h +index 0d55a588cb9a87fa..fefafa89e14ddab2 100644 +--- a/criu/include/linux/mount.h ++++ b/criu/include/linux/mount.h +@@ -6,7 +6,7 @@ + + /* Copied from /usr/include/sys/mount.h */ + +-#ifndef FSCONFIG_CMD_CREATE ++#ifndef FSOPEN_CLOEXEC + /* The type of fsconfig call made. */ + enum fsconfig_command { + FSCONFIG_SET_FLAG = 0, /* Set parameter, supplying no value */ +@@ -26,7 +26,13 @@ enum fsconfig_command { + FSCONFIG_CMD_RECONFIGURE = 7, /* Invoke superblock reconfiguration */ + #define FSCONFIG_CMD_RECONFIGURE FSCONFIG_CMD_RECONFIGURE + }; +-#endif // FSCONFIG_CMD_CREATE ++ ++#endif // FSOPEN_CLOEXEC ++ ++/* fsopen flags. With the redundant definition, we check if the kernel, ++ * glibc value and our value still match. ++ */ ++#define FSOPEN_CLOEXEC 0x00000001 + + #ifndef MS_MGC_VAL + /* Magic mount flag number. Has to be or-ed to the flag values. */ diff --git a/criu.spec b/criu.spec index c49dd3a..9dc3977 100644 --- a/criu.spec +++ b/criu.spec @@ -17,7 +17,7 @@ Name: criu Version: 3.17.1 -Release: 3%{?dist} +Release: 4%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPLv2 URL: http://criu.org/ @@ -27,6 +27,9 @@ Source0: https://github.com/checkpoint-restore/criu/archive/v%{version}/criu-%{v # We use this patch because the protobuf-c package name # in RPM and DEB is different. Patch99: criu.pc.patch +Patch100: criu-glibc-2.36-1.patch +Patch101: criu-glibc-2.36-2.patch +Patch102: criu-glibc-2.36-3.patch %if 0%{?rhel} && 0%{?rhel} <= 7 BuildRequires: perl @@ -38,7 +41,7 @@ Source3: criu-ns.1 # The patch aio-fix.patch is needed as RHEL7 # doesn't do "nr_events *= 2" in ioctx_alloc(). -Patch100: aio-fix.patch +Patch199: aio-fix.patch %endif Source5: criu-tmpfiles.conf @@ -123,9 +126,12 @@ This script can help to workaround the so called "PID mismatch" problem. %setup -q %patch99 -p1 +%patch100 -p1 +%patch101 -p1 +%patch102 -p1 %if 0%{?rhel} && 0%{?rhel} <= 7 -%patch100 -p1 +%patch199 -p1 %endif %build @@ -210,6 +216,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %doc %{_mandir}/man1/criu-ns.1* %changelog +* Fri Dec 2 2022 Florian Weimer - 3.17.1-4 +- Fix FTBFS with glibc 2.36 + * Wed Jul 20 2022 Fedora Release Engineering - 3.17.1-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild From a0f83f20c805532a4a83039fb54c450f8d367127 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 19 Jan 2023 00:40:36 +0000 Subject: [PATCH 054/109] Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- criu.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/criu.spec b/criu.spec index 9dc3977..38f9d7e 100644 --- a/criu.spec +++ b/criu.spec @@ -17,7 +17,7 @@ Name: criu Version: 3.17.1 -Release: 4%{?dist} +Release: 5%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPLv2 URL: http://criu.org/ @@ -216,6 +216,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %doc %{_mandir}/man1/criu-ns.1* %changelog +* Thu Jan 19 2023 Fedora Release Engineering - 3.17.1-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild + * Fri Dec 2 2022 Florian Weimer - 3.17.1-4 - Fix FTBFS with glibc 2.36 From c2792a75f9aa97f9b60812df618534acf4965ca1 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Tue, 25 Apr 2023 10:13:14 +0200 Subject: [PATCH 055/109] Update to 3.18 - Apply patch from upstream to support newer CPUs Signed-off-by: Adrian Reber --- .gitignore | 1 + criu-glibc-2.36-1.patch | 206 -------------- criu-glibc-2.36-2.patch | 264 ------------------ criu-glibc-2.36-3.patch | 101 ------- criu.spec | 27 +- ...260c57576c636759afb312340fa3827312f6.patch | 74 +++++ sources | 2 +- 7 files changed, 90 insertions(+), 585 deletions(-) delete mode 100644 criu-glibc-2.36-1.patch delete mode 100644 criu-glibc-2.36-2.patch delete mode 100644 criu-glibc-2.36-3.patch create mode 100644 d739260c57576c636759afb312340fa3827312f6.patch diff --git a/.gitignore b/.gitignore index 277658b..5993df3 100644 --- a/.gitignore +++ b/.gitignore @@ -54,3 +54,4 @@ /criu-3.16.1.tar.gz /criu-3.17.tar.gz /criu-3.17.1.tar.gz +/criu-3.18.tar.gz diff --git a/criu-glibc-2.36-1.patch b/criu-glibc-2.36-1.patch deleted file mode 100644 index a56d5e5..0000000 --- a/criu-glibc-2.36-1.patch +++ /dev/null @@ -1,206 +0,0 @@ -commit 1e6e826ffb7ac05f33fa123051c2fc2ddf0f68ea -Author: Alexander Mikhalitsyn -Date: Fri Jul 8 12:36:57 2022 +0000 - - rseq: fix headers conflict on Mariner GNU/Linux - - 1. For some reason, Marier distribution headers - not correctly define __GLIBC_HAVE_KERNEL_RSEQ - compile-time constant. It remains undefined, - but in fact header files provides corresponding - rseq types declaration which leads to conflict. - - 2. Another issue, is that they use uint*_t types - instead of __u* types as in original rseq.h. - - This leads to compile time issues like this: - format '%llx' expects argument of type 'long long unsigned int', but argument 5 has type 'uint64_t' {aka 'long unsigned int'} - - and we can't even replace %llx to %PRIx64 because it will break - compilation on other distros (like Fedora) with analogical error: - - error: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 6 has type ‘__u64’ {aka ‘long long unsigned int’} - - Let's use our-own struct rseq copy fully equal to the kernel one, - it's safe because this structure is a part of Linux Kernel ABI. - - Fixes #1934 - - Reported-by: Nikola Bojanic - Signed-off-by: Alexander Mikhalitsyn - -diff --git a/Makefile.config b/Makefile.config -index d46d84f2de72ea35..d113e2246b785fda 100644 ---- a/Makefile.config -+++ b/Makefile.config -@@ -78,7 +78,8 @@ export DEFINES += $(FEATURE_DEFINES) - export CFLAGS += $(FEATURE_DEFINES) - - FEATURES_LIST := TCP_REPAIR STRLCPY STRLCAT PTRACE_PEEKSIGINFO \ -- SETPROCTITLE_INIT MEMFD TCP_REPAIR_WINDOW FSCONFIG MEMFD_CREATE OPENAT2 -+ SETPROCTITLE_INIT MEMFD TCP_REPAIR_WINDOW FSCONFIG MEMFD_CREATE \ -+ OPENAT2 NO_LIBC_RSEQ_DEFS - - # $1 - config name - define gen-feature-test -diff --git a/criu/cr-dump.c b/criu/cr-dump.c -index f58701e5c5e5f975..1bd62bbe3534c92e 100644 ---- a/criu/cr-dump.c -+++ b/criu/cr-dump.c -@@ -1034,7 +1034,7 @@ static int dump_task_signals(pid_t pid, struct pstree_item *item) - return 0; - } - --static int read_rseq_cs(pid_t tid, struct __ptrace_rseq_configuration *rseqc, struct rseq_cs *rseq_cs, -+static int read_rseq_cs(pid_t tid, struct __ptrace_rseq_configuration *rseqc, struct criu_rseq_cs *rseq_cs, - struct criu_rseq *rseq) - { - int ret; -@@ -1065,10 +1065,11 @@ static int read_rseq_cs(pid_t tid, struct __ptrace_rseq_configuration *rseqc, st - if (!rseq->rseq_cs) - return 0; - -- ret = ptrace_peek_area(tid, rseq_cs, decode_pointer(rseq->rseq_cs), sizeof(struct rseq_cs)); -+ ret = ptrace_peek_area(tid, rseq_cs, decode_pointer(rseq->rseq_cs), sizeof(struct criu_rseq_cs)); - if (ret) { - pr_err("ptrace_peek_area(%d, %lx, %lx, %lx): fail to read rseq_cs struct\n", tid, -- (unsigned long)rseq_cs, (unsigned long)rseq->rseq_cs, (unsigned long)sizeof(struct rseq_cs)); -+ (unsigned long)rseq_cs, (unsigned long)rseq->rseq_cs, -+ (unsigned long)sizeof(struct criu_rseq_cs)); - return -1; - } - -@@ -1083,7 +1084,7 @@ static int dump_thread_rseq(struct pstree_item *item, int i) - CoreEntry *core = item->core[i]; - RseqEntry **rseqep = &core->thread_core->rseq_entry; - struct criu_rseq rseq = {}; -- struct rseq_cs *rseq_cs = &dmpi(item)->thread_rseq_cs[i]; -+ struct criu_rseq_cs *rseq_cs = &dmpi(item)->thread_rseq_cs[i]; - pid_t tid = item->threads[i].real; - - /* -@@ -1149,7 +1150,7 @@ err: - static int dump_task_rseq(pid_t pid, struct pstree_item *item) - { - int i; -- struct rseq_cs *thread_rseq_cs; -+ struct criu_rseq_cs *thread_rseq_cs; - - /* if rseq() syscall isn't supported then nothing to dump */ - if (!kdat.has_rseq) -@@ -1174,7 +1175,7 @@ free_rseq: - return -1; - } - --static bool task_in_rseq(struct rseq_cs *rseq_cs, uint64_t addr) -+static bool task_in_rseq(struct criu_rseq_cs *rseq_cs, uint64_t addr) - { - return addr >= rseq_cs->start_ip && addr < rseq_cs->start_ip + rseq_cs->post_commit_offset; - } -@@ -1182,7 +1183,7 @@ static bool task_in_rseq(struct rseq_cs *rseq_cs, uint64_t addr) - static int fixup_thread_rseq(struct pstree_item *item, int i) - { - CoreEntry *core = item->core[i]; -- struct rseq_cs *rseq_cs = &dmpi(item)->thread_rseq_cs[i]; -+ struct criu_rseq_cs *rseq_cs = &dmpi(item)->thread_rseq_cs[i]; - pid_t tid = item->threads[i].real; - - /* equivalent to (struct rseq)->rseq_cs is NULL */ -diff --git a/criu/include/linux/rseq.h b/criu/include/linux/rseq.h -index a47876e6695f16a4..5ceefbf8e1b59846 100644 ---- a/criu/include/linux/rseq.h -+++ b/criu/include/linux/rseq.h -@@ -9,7 +9,12 @@ - #endif - #endif - --#ifndef __GLIBC_HAVE_KERNEL_RSEQ -+#include -+#include -+ -+#include "common/config.h" -+ -+#ifdef CONFIG_HAS_NO_LIBC_RSEQ_DEFS - /* - * linux/rseq.h - * -@@ -18,9 +23,6 @@ - * Copyright (c) 2015-2018 Mathieu Desnoyers - */ - --#include --#include -- - enum rseq_cpu_id_state { - RSEQ_CPU_ID_UNINITIALIZED = -1, - RSEQ_CPU_ID_REGISTRATION_FAILED = -2, -@@ -41,13 +43,20 @@ enum rseq_cs_flags { - RSEQ_CS_FLAG_NO_RESTART_ON_SIGNAL = (1U << RSEQ_CS_FLAG_NO_RESTART_ON_SIGNAL_BIT), - RSEQ_CS_FLAG_NO_RESTART_ON_MIGRATE = (1U << RSEQ_CS_FLAG_NO_RESTART_ON_MIGRATE_BIT), - }; -+#endif /* CONFIG_HAS_NO_LIBC_RSEQ_DEFS */ - -+/* -+ * Let's use our own definition of struct rseq_cs because some distros -+ * (for example Mariner GNU/Linux) declares this structure their-own way. -+ * This makes trouble with inconsistency between printf formatters and -+ * struct rseq_cs field types. -+ */ - /* - * struct rseq_cs is aligned on 4 * 8 bytes to ensure it is always - * contained within a single cache-line. It is usually declared as - * link-time constant data. - */ --struct rseq_cs { -+struct criu_rseq_cs { - /* Version of this structure. */ - __u32 version; - /* enum rseq_cs_flags */ -@@ -57,7 +66,6 @@ struct rseq_cs { - __u64 post_commit_offset; - __u64 abort_ip; - } __attribute__((aligned(4 * sizeof(__u64)))); --#endif /* __GLIBC_HAVE_KERNEL_RSEQ */ - - /* - * We have to have our own copy of struct rseq definition because -diff --git a/criu/include/pstree.h b/criu/include/pstree.h -index 8ae750e1af897d02..1137046d43fc0c1d 100644 ---- a/criu/include/pstree.h -+++ b/criu/include/pstree.h -@@ -63,7 +63,7 @@ struct dmp_info { - struct parasite_ctl *parasite_ctl; - struct parasite_thread_ctl **thread_ctls; - uint64_t *thread_sp; -- struct rseq_cs *thread_rseq_cs; -+ struct criu_rseq_cs *thread_rseq_cs; - - /* - * Although we don't support dumping different struct creds in general, -diff --git a/scripts/feature-tests.mak b/scripts/feature-tests.mak -index 592552cb8e065861..014e893a84a280ce 100644 ---- a/scripts/feature-tests.mak -+++ b/scripts/feature-tests.mak -@@ -196,3 +196,22 @@ int main(void) - return 0; - } - endef -+ -+define FEATURE_TEST_NO_LIBC_RSEQ_DEFS -+ -+#ifdef __has_include -+#if __has_include(\"sys/rseq.h\") -+#include -+#endif -+#endif -+ -+enum rseq_cpu_id_state { -+ RSEQ_CPU_ID_UNINITIALIZED = -1, -+ RSEQ_CPU_ID_REGISTRATION_FAILED = -2, -+}; -+ -+int main(void) -+{ -+ return 0; -+} -+endef diff --git a/criu-glibc-2.36-2.patch b/criu-glibc-2.36-2.patch deleted file mode 100644 index 9edc45d..0000000 --- a/criu-glibc-2.36-2.patch +++ /dev/null @@ -1,264 +0,0 @@ -commit 4c86d6a7d54abb64fc5a15131f3351224e8c071b -Author: Radostin Stoyanov -Date: Sun Jul 31 16:07:30 2022 +0000 - - criu: fix conflicting headers - - There are several changes in glibc 2.36 that make sys/mount.h header - incompatible with kernel headers: - - https://sourceware.org/glibc/wiki/Release/2.36#Usage_of_.3Clinux.2Fmount.h.3E_and_.3Csys.2Fmount.h.3E - - This patch removes conflicting includes for `` and - updates the content of `criu/include/linux/mount.h` to match - `/usr/include/sys/mount.h`. In addition, inline definitions sys_*() - functions have been moved from "linux/mount.h" to "syscall.h" to - avoid conflicts with `uapi/compel/plugins/std/syscall.h` and - ``. The include for `` has been replaced - with local include to avoid conflicts with ``. - - Fixes: #1949 - - Signed-off-by: Radostin Stoyanov - -diff --git a/Makefile.config b/Makefile.config -index d113e2246b785fda..270ec61c0f35d462 100644 ---- a/Makefile.config -+++ b/Makefile.config -@@ -78,7 +78,7 @@ export DEFINES += $(FEATURE_DEFINES) - export CFLAGS += $(FEATURE_DEFINES) - - FEATURES_LIST := TCP_REPAIR STRLCPY STRLCAT PTRACE_PEEKSIGINFO \ -- SETPROCTITLE_INIT MEMFD TCP_REPAIR_WINDOW FSCONFIG MEMFD_CREATE \ -+ SETPROCTITLE_INIT MEMFD TCP_REPAIR_WINDOW MEMFD_CREATE \ - OPENAT2 NO_LIBC_RSEQ_DEFS - - # $1 - config name -diff --git a/criu/cgroup.c b/criu/cgroup.c -index e05b0832eddfd25c..325df6a1db27a79f 100644 ---- a/criu/cgroup.c -+++ b/criu/cgroup.c -@@ -27,6 +27,7 @@ - #include "images/cgroup.pb-c.h" - #include "kerndat.h" - #include "linux/mount.h" -+#include "syscall.h" - - /* - * This structure describes set of controller groups -diff --git a/criu/cr-check.c b/criu/cr-check.c -index f589a91da1da8243..0ca80192ce4dea6c 100644 ---- a/criu/cr-check.c -+++ b/criu/cr-check.c -@@ -21,7 +21,6 @@ - #include - #include - #include --#include - - #include "../soccr/soccr.h" - -@@ -52,6 +51,7 @@ - #include "net.h" - #include "restorer.h" - #include "uffd.h" -+#include "linux/aio_abi.h" - - #include "images/inventory.pb-c.h" - -diff --git a/criu/cr-restore.c b/criu/cr-restore.c -index 9853c05854ac373f..9bbc9ea893f1a755 100644 ---- a/criu/cr-restore.c -+++ b/criu/cr-restore.c -@@ -22,7 +22,6 @@ - #include - #include "common/compiler.h" - --#include "linux/mount.h" - #include "linux/rseq.h" - - #include "clone-noasan.h" -@@ -86,6 +85,8 @@ - #include - #include "compel/include/asm/syscall.h" - -+#include "linux/mount.h" -+ - #include "protobuf.h" - #include "images/sa.pb-c.h" - #include "images/timer.pb-c.h" -diff --git a/criu/include/aio.h b/criu/include/aio.h -index d1655739d9683156..38e70402093fb663 100644 ---- a/criu/include/aio.h -+++ b/criu/include/aio.h -@@ -1,7 +1,7 @@ - #ifndef __CR_AIO_H__ - #define __CR_AIO_H__ - --#include -+#include "linux/aio_abi.h" - #include "images/mm.pb-c.h" - unsigned int aio_estimate_nr_reqs(unsigned int size); - int dump_aio_ring(MmEntry *mme, struct vma_area *vma); -diff --git a/criu/include/linux/aio_abi.h b/criu/include/linux/aio_abi.h -new file mode 100644 -index 0000000000000000..d9ce787203aeceb7 ---- /dev/null -+++ b/criu/include/linux/aio_abi.h -@@ -0,0 +1,14 @@ -+#ifndef __LINUX__AIO_ABI_H -+#define __LINUX__AIO_ABI_H -+ -+typedef __kernel_ulong_t aio_context_t; -+ -+/* read() from /dev/aio returns these structures. */ -+struct io_event { -+ __u64 data; /* the data field from the iocb */ -+ __u64 obj; /* what iocb this event came from */ -+ __s64 res; /* result code for this event */ -+ __s64 res2; /* secondary result */ -+}; -+ -+#endif /* __LINUX__AIO_ABI_H */ -diff --git a/criu/include/linux/mount.h b/criu/include/linux/mount.h -index 9a3a28b1003103e9..0d55a588cb9a87fa 100644 ---- a/criu/include/linux/mount.h -+++ b/criu/include/linux/mount.h -@@ -4,32 +4,34 @@ - #include "common/config.h" - #include "compel/plugins/std/syscall-codes.h" - --#ifdef CONFIG_HAS_FSCONFIG --#include --#else -+/* Copied from /usr/include/sys/mount.h */ -+ -+#ifndef FSCONFIG_CMD_CREATE -+/* The type of fsconfig call made. */ - enum fsconfig_command { -- FSCONFIG_SET_FLAG = 0, /* Set parameter, supplying no value */ -- FSCONFIG_SET_STRING = 1, /* Set parameter, supplying a string value */ -- FSCONFIG_SET_BINARY = 2, /* Set parameter, supplying a binary blob value */ -- FSCONFIG_SET_PATH = 3, /* Set parameter, supplying an object by path */ -- FSCONFIG_SET_PATH_EMPTY = 4, /* Set parameter, supplying an object by (empty) path */ -- FSCONFIG_SET_FD = 5, /* Set parameter, supplying an object by fd */ -- FSCONFIG_CMD_CREATE = 6, /* Invoke superblock creation */ -+ FSCONFIG_SET_FLAG = 0, /* Set parameter, supplying no value */ -+#define FSCONFIG_SET_FLAG FSCONFIG_SET_FLAG -+ FSCONFIG_SET_STRING = 1, /* Set parameter, supplying a string value */ -+#define FSCONFIG_SET_STRING FSCONFIG_SET_STRING -+ FSCONFIG_SET_BINARY = 2, /* Set parameter, supplying a binary blob value */ -+#define FSCONFIG_SET_BINARY FSCONFIG_SET_BINARY -+ FSCONFIG_SET_PATH = 3, /* Set parameter, supplying an object by path */ -+#define FSCONFIG_SET_PATH FSCONFIG_SET_PATH -+ FSCONFIG_SET_PATH_EMPTY = 4, /* Set parameter, supplying an object by (empty) path */ -+#define FSCONFIG_SET_PATH_EMPTY FSCONFIG_SET_PATH_EMPTY -+ FSCONFIG_SET_FD = 5, /* Set parameter, supplying an object by fd */ -+#define FSCONFIG_SET_FD FSCONFIG_SET_FD -+ FSCONFIG_CMD_CREATE = 6, /* Invoke superblock creation */ -+#define FSCONFIG_CMD_CREATE FSCONFIG_CMD_CREATE - FSCONFIG_CMD_RECONFIGURE = 7, /* Invoke superblock reconfiguration */ -+#define FSCONFIG_CMD_RECONFIGURE FSCONFIG_CMD_RECONFIGURE - }; --#endif -+#endif // FSCONFIG_CMD_CREATE - --static inline int sys_fsopen(const char *fsname, unsigned int flags) --{ -- return syscall(__NR_fsopen, fsname, flags); --} --static inline int sys_fsconfig(int fd, unsigned int cmd, const char *key, const char *value, int aux) --{ -- return syscall(__NR_fsconfig, fd, cmd, key, value, aux); --} --static inline int sys_fsmount(int fd, unsigned int flags, unsigned int attr_flags) --{ -- return syscall(__NR_fsmount, fd, flags, attr_flags); --} -+#ifndef MS_MGC_VAL -+/* Magic mount flag number. Has to be or-ed to the flag values. */ -+#define MS_MGC_VAL 0xc0ed0000 /* Magic flag number to indicate "new" flags */ -+#define MS_MGC_MSK 0xffff0000 /* Magic flag number mask */ -+#endif - - #endif -diff --git a/criu/include/syscall.h b/criu/include/syscall.h -new file mode 100644 -index 0000000000000000..c38d6d971b12e825 ---- /dev/null -+++ b/criu/include/syscall.h -@@ -0,0 +1,17 @@ -+#ifndef __CR_SYSCALL_H__ -+#define __CR_SYSCALL_H__ -+ -+static inline int sys_fsopen(const char *fsname, unsigned int flags) -+{ -+ return syscall(__NR_fsopen, fsname, flags); -+} -+static inline int sys_fsconfig(int fd, unsigned int cmd, const char *key, const char *value, int aux) -+{ -+ return syscall(__NR_fsconfig, fd, cmd, key, value, aux); -+} -+static inline int sys_fsmount(int fd, unsigned int flags, unsigned int attr_flags) -+{ -+ return syscall(__NR_fsmount, fd, flags, attr_flags); -+} -+ -+#endif /* __CR_SYSCALL_H__ */ -\ No newline at end of file -diff --git a/criu/pie/parasite.c b/criu/pie/parasite.c -index e7eb1fcb60bdfc60..f75fe13bb6b6283e 100644 ---- a/criu/pie/parasite.c -+++ b/criu/pie/parasite.c -@@ -3,7 +3,6 @@ - #include - #include - #include --#include - #include - #include - #include -@@ -14,6 +13,7 @@ - #include "int.h" - #include "types.h" - #include -+#include "linux/mount.h" - #include "parasite.h" - #include "fcntl.h" - #include "prctl.h" -diff --git a/criu/util.c b/criu/util.c -index 5f69465b44ee4b9b..060ca3bd44707ca2 100644 ---- a/criu/util.c -+++ b/criu/util.c -@@ -40,6 +40,7 @@ - #include "mem.h" - #include "namespaces.h" - #include "criu-log.h" -+#include "syscall.h" - - #include "clone-noasan.h" - #include "cr_options.h" -diff --git a/scripts/feature-tests.mak b/scripts/feature-tests.mak -index 014e893a84a280ce..fb5d2ef7ad95ab7e 100644 ---- a/scripts/feature-tests.mak -+++ b/scripts/feature-tests.mak -@@ -137,19 +137,6 @@ ENTRY(main) - END(main) - endef - --define FEATURE_TEST_FSCONFIG -- --#include -- --int main(void) --{ -- if (FSCONFIG_CMD_CREATE > 0) -- return 0; -- return 0; --} -- --endef -- - define FEATURE_TEST_NFTABLES_LIB_API_0 - - #include diff --git a/criu-glibc-2.36-3.patch b/criu-glibc-2.36-3.patch deleted file mode 100644 index 278f38d..0000000 --- a/criu-glibc-2.36-3.patch +++ /dev/null @@ -1,101 +0,0 @@ -commit 517c0947050e63aac72f63a3bf373d76264723b9 -Author: Radostin Stoyanov -Date: Wed Aug 24 21:20:30 2022 +0200 - - mount: add definition for FSOPEN_CLOEXEC - - A recent change in glibc introduced `enum fsconfig_command` [1] and as a - result the compilation of criu fails with the following errors - - In file included from criu/pie/util.c:3: - /usr/include/sys/mount.h:240:6: error: redeclaration of 'enum fsconfig_command' - 240 | enum fsconfig_command - | ^~~~~~~~~~~~~~~~ - In file included from /usr/include/sys/mount.h:32: - criu/include/linux/mount.h:11:6: note: originally defined here - 11 | enum fsconfig_command { - | ^~~~~~~~~~~~~~~~ - /usr/include/sys/mount.h:242:3: error: redeclaration of enumerator 'FSCONFIG_SET_FLAG' - 242 | FSCONFIG_SET_FLAG = 0, /* Set parameter, supplying no value */ - | ^~~~~~~~~~~~~~~~~ - criu/include/linux/mount.h:12:9: note: previous definition of 'FSCONFIG_SET_FLAG' with type 'enum fsconfig_command' - 12 | FSCONFIG_SET_FLAG = 0, /* Set parameter, supplying no value */ - | ^~~~~~~~~~~~~~~~~ - /usr/include/sys/mount.h:244:3: error: redeclaration of enumerator 'FSCONFIG_SET_STRING' - 244 | FSCONFIG_SET_STRING = 1, /* Set parameter, supplying a string value */ - | ^~~~~~~~~~~~~~~~~~~ - criu/include/linux/mount.h:14:9: note: previous definition of 'FSCONFIG_SET_STRING' with type 'enum fsconfig_command' - 14 | FSCONFIG_SET_STRING = 1, /* Set parameter, supplying a string value */ - | ^~~~~~~~~~~~~~~~~~~ - /usr/include/sys/mount.h:246:3: error: redeclaration of enumerator 'FSCONFIG_SET_BINARY' - 246 | FSCONFIG_SET_BINARY = 2, /* Set parameter, supplying a binary blob value */ - | ^~~~~~~~~~~~~~~~~~~ - criu/include/linux/mount.h:16:9: note: previous definition of 'FSCONFIG_SET_BINARY' with type 'enum fsconfig_command' - 16 | FSCONFIG_SET_BINARY = 2, /* Set parameter, supplying a binary blob value */ - | ^~~~~~~~~~~~~~~~~~~ - /usr/include/sys/mount.h:248:3: error: redeclaration of enumerator 'FSCONFIG_SET_PATH' - 248 | FSCONFIG_SET_PATH = 3, /* Set parameter, supplying an object by path */ - | ^~~~~~~~~~~~~~~~~ - criu/include/linux/mount.h:18:9: note: previous definition of 'FSCONFIG_SET_PATH' with type 'enum fsconfig_command' - 18 | FSCONFIG_SET_PATH = 3, /* Set parameter, supplying an object by path */ - | ^~~~~~~~~~~~~~~~~ - /usr/include/sys/mount.h:250:3: error: redeclaration of enumerator 'FSCONFIG_SET_PATH_EMPTY' - 250 | FSCONFIG_SET_PATH_EMPTY = 4, /* Set parameter, supplying an object by (empty) path */ - | ^~~~~~~~~~~~~~~~~~~~~~~ - criu/include/linux/mount.h:20:9: note: previous definition of 'FSCONFIG_SET_PATH_EMPTY' with type 'enum fsconfig_command' - 20 | FSCONFIG_SET_PATH_EMPTY = 4, /* Set parameter, supplying an object by (empty) path */ - | ^~~~~~~~~~~~~~~~~~~~~~~ - /usr/include/sys/mount.h:252:3: error: redeclaration of enumerator 'FSCONFIG_SET_FD' - 252 | FSCONFIG_SET_FD = 5, /* Set parameter, supplying an object by fd */ - | ^~~~~~~~~~~~~~~ - criu/include/linux/mount.h:22:9: note: previous definition of 'FSCONFIG_SET_FD' with type 'enum fsconfig_command' - 22 | FSCONFIG_SET_FD = 5, /* Set parameter, supplying an object by fd */ - | ^~~~~~~~~~~~~~~ - /usr/include/sys/mount.h:254:3: error: redeclaration of enumerator 'FSCONFIG_CMD_CREATE' - 254 | FSCONFIG_CMD_CREATE = 6, /* Invoke superblock creation */ - | ^~~~~~~~~~~~~~~~~~~ - criu/include/linux/mount.h:24:9: note: previous definition of 'FSCONFIG_CMD_CREATE' with type 'enum fsconfig_command' - 24 | FSCONFIG_CMD_CREATE = 6, /* Invoke superblock creation */ - | ^~~~~~~~~~~~~~~~~~~ - /usr/include/sys/mount.h:256:3: error: redeclaration of enumerator 'FSCONFIG_CMD_RECONFIGURE' - 256 | FSCONFIG_CMD_RECONFIGURE = 7, /* Invoke superblock reconfiguration */ - | ^~~~~~~~~~~~~~~~~~~~~~~~ - criu/include/linux/mount.h:26:9: note: previous definition of 'FSCONFIG_CMD_RECONFIGURE' with type 'enum fsconfig_command' - 26 | FSCONFIG_CMD_RECONFIGURE = 7, /* Invoke superblock reconfiguration */ - - This patch adds definition for FSOPEN_CLOEXEC to solve this problem. In particular, - sys/mount.h includes ifndef check for FSOPEN_CLOEXEC surrounding `enum fsconfig_command`. - - [1] https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=7eae6a91e9b1670330c9f15730082c91c0b1d570 - - Reported-by: Younes Manton (@ymanton) - Signed-off-by: Radostin Stoyanov - -diff --git a/criu/include/linux/mount.h b/criu/include/linux/mount.h -index 0d55a588cb9a87fa..fefafa89e14ddab2 100644 ---- a/criu/include/linux/mount.h -+++ b/criu/include/linux/mount.h -@@ -6,7 +6,7 @@ - - /* Copied from /usr/include/sys/mount.h */ - --#ifndef FSCONFIG_CMD_CREATE -+#ifndef FSOPEN_CLOEXEC - /* The type of fsconfig call made. */ - enum fsconfig_command { - FSCONFIG_SET_FLAG = 0, /* Set parameter, supplying no value */ -@@ -26,7 +26,13 @@ enum fsconfig_command { - FSCONFIG_CMD_RECONFIGURE = 7, /* Invoke superblock reconfiguration */ - #define FSCONFIG_CMD_RECONFIGURE FSCONFIG_CMD_RECONFIGURE - }; --#endif // FSCONFIG_CMD_CREATE -+ -+#endif // FSOPEN_CLOEXEC -+ -+/* fsopen flags. With the redundant definition, we check if the kernel, -+ * glibc value and our value still match. -+ */ -+#define FSOPEN_CLOEXEC 0x00000001 - - #ifndef MS_MGC_VAL - /* Magic mount flag number. Has to be or-ed to the flag values. */ diff --git a/criu.spec b/criu.spec index 38f9d7e..122db0b 100644 --- a/criu.spec +++ b/criu.spec @@ -16,20 +16,20 @@ %undefine _auto_set_build_flags Name: criu -Version: 3.17.1 -Release: 5%{?dist} +Version: 3.18 +Release: 1%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPLv2 URL: http://criu.org/ Source0: https://github.com/checkpoint-restore/criu/archive/v%{version}/criu-%{version}.tar.gz +# Fix to work on CPUs with larger XSAVE area (Sapphire Rapids) +Patch0: https://github.com/checkpoint-restore/criu/commit/d739260c57576c636759afb312340fa3827312f6.patch + # Add protobuf-c as a dependency. # We use this patch because the protobuf-c package name # in RPM and DEB is different. Patch99: criu.pc.patch -Patch100: criu-glibc-2.36-1.patch -Patch101: criu-glibc-2.36-2.patch -Patch102: criu-glibc-2.36-3.patch %if 0%{?rhel} && 0%{?rhel} <= 7 BuildRequires: perl @@ -41,7 +41,7 @@ Source3: criu-ns.1 # The patch aio-fix.patch is needed as RHEL7 # doesn't do "nr_events *= 2" in ioctx_alloc(). -Patch199: aio-fix.patch +Patch100: aio-fix.patch %endif Source5: criu-tmpfiles.conf @@ -124,14 +124,11 @@ This script can help to workaround the so called "PID mismatch" problem. %prep %setup -q - -%patch99 -p1 -%patch100 -p1 -%patch101 -p1 -%patch102 -p1 +%patch -P 0 -p1 +%patch -P 99 -p1 %if 0%{?rhel} && 0%{?rhel} <= 7 -%patch199 -p1 +%patch -P 100 -p1 %endif %build @@ -204,18 +201,22 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %{python2_sitelib}/*egg-info %else %{python3_sitelib}/pycriu/* -%{python3_sitelib}/*egg-info %endif %files -n crit %{_bindir}/crit %doc %{_mandir}/man1/crit.1* +%{python3_sitelib}/crit-%{version}.dist-info/ %files -n criu-ns %{_sbindir}/criu-ns %doc %{_mandir}/man1/criu-ns.1* %changelog +* Tue Apr 25 2034 Adrian Reber - 3.18-1 +- Update to 3.18 +- Apply patch from upstream to support newer CPUs + * Thu Jan 19 2023 Fedora Release Engineering - 3.17.1-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild diff --git a/d739260c57576c636759afb312340fa3827312f6.patch b/d739260c57576c636759afb312340fa3827312f6.patch new file mode 100644 index 0000000..7847bb5 --- /dev/null +++ b/d739260c57576c636759afb312340fa3827312f6.patch @@ -0,0 +1,74 @@ +From d739260c57576c636759afb312340fa3827312f6 Mon Sep 17 00:00:00 2001 +From: Adrian Reber +Date: Mon, 24 Apr 2023 09:28:19 +0200 +Subject: [PATCH] compel: support XSAVE on newer Intel CPUs + +Newer Intel CPUs (Sapphire Rapids) have a much larger xsave area than +before. Looking at older CPUs I see 2440 bytes. + + # cpuid -1 -l 0xd -s 0 + ... + bytes required by XSAVE/XRSTOR area = 0x00000988 (2440) + +On newer CPUs (Sapphire Rapids) it grows to 11008 bytes. + + # cpuid -1 -l 0xd -s 0 + ... + bytes required by XSAVE/XRSTOR area = 0x00002b00 (11008) + +This increase the xsave area from one page to four pages. + +Without this patch the fpu03 test fails, with this patch it works again. + +Signed-off-by: Adrian Reber +--- + .../arch/x86/src/lib/include/uapi/asm/fpu.h | 28 +++++++++++++++++-- + 1 file changed, 26 insertions(+), 2 deletions(-) + +diff --git a/compel/arch/x86/src/lib/include/uapi/asm/fpu.h b/compel/arch/x86/src/lib/include/uapi/asm/fpu.h +index bd3b0cbd5c..8c83dd9ae4 100644 +--- a/compel/arch/x86/src/lib/include/uapi/asm/fpu.h ++++ b/compel/arch/x86/src/lib/include/uapi/asm/fpu.h +@@ -21,7 +21,28 @@ + #define XSTATE_YMM 0x4 + + #define FXSAVE_SIZE 512 +-#define XSAVE_SIZE 4096 ++/* ++ * This used to be 4096 (one page). There is a comment below concerning ++ * this size: ++ * "One page should be enough for the whole xsave state ;-)" ++ * Which is kind of funny as it is no longer enough ;-) ++ * ++ * Older CPUs: ++ * # cpuid -1 -l 0xd -s 0 ++ * ... ++ * bytes required by XSAVE/XRSTOR area = 0x00000988 (2440) ++ * ++ * Newer CPUs (Sapphire Rapids): ++ * # cpuid -1 -l 0xd -s 0 ++ * ... ++ * bytes required by XSAVE/XRSTOR area = 0x00002b00 (11008) ++ * ++ * So one page is no longer enough... But: ++ * ++ * Four pages should be enough for the whole xsave state ;-) ++ */ ++ ++#define XSAVE_SIZE 4*4096 + + #define XSAVE_HDR_SIZE 64 + #define XSAVE_HDR_OFFSET FXSAVE_SIZE +@@ -235,8 +256,11 @@ struct pkru_state { + * + * + * One page should be enough for the whole xsave state ;-) ++ * ++ * Of course it was not ;-) Now using four pages... ++ * + */ +-#define EXTENDED_STATE_AREA_SIZE (4096 - sizeof(struct i387_fxsave_struct) - sizeof(struct xsave_hdr_struct)) ++#define EXTENDED_STATE_AREA_SIZE (XSAVE_SIZE - sizeof(struct i387_fxsave_struct) - sizeof(struct xsave_hdr_struct)) + + /* + * cpu requires it to be 64 byte aligned diff --git a/sources b/sources index 7a3abcc..045b206 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (criu-3.17.1.tar.gz) = cd093fad266ad29f1d8001b38762acb46d975b3fb94a19cd40c00a6c62d4a9cbc9ababddfc7b3cfed14e4d7ffbbd982eca05932ef4884c2c3ad4deb330bcccd0 +SHA512 (criu-3.18.tar.gz) = 3d15554ebd2d08c8904c23b0aba00d505891c14caa4790c2fd12ad6b20bf4058fd210f1d03fd63aacc5ad8bc47e341396b48abbeb474f1fd43c3023fd1ff9171 From c440c2fc73a3ba2689c3f9306148586a02c60084 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Tue, 25 Apr 2023 15:31:21 +0200 Subject: [PATCH 056/109] Fix build of python sub-packages Signed-off-by: Adrian Reber --- criu.spec | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/criu.spec b/criu.spec index 122db0b..682b7de 100644 --- a/criu.spec +++ b/criu.spec @@ -51,6 +51,8 @@ BuildRequires: systemd BuildRequires: libnet-devel BuildRequires: protobuf-devel protobuf-c-devel %{py_prefix}-devel libnl3-devel libcap-devel %if 0%{?fedora} || 0%{?rhel} > 7 +BuildRequires: %{py_prefix}-pip +BuildRequires: %{py_prefix}-setuptools BuildRequires: asciidoctor BuildRequires: perl-interpreter BuildRequires: libselinux-devel @@ -145,6 +147,8 @@ make docs V=1 %install +sed -e "s,--upgrade --force-reinstall,--disable-pip-version-check --progress-bar off --verbose,g" -i lib/Makefile +rm -f crit/pyproject.toml make install-criu DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} make install-lib DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} PYTHON=%{py_binary} %if 0%{?fedora} || 0%{?rhel} > 7 @@ -205,8 +209,8 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %files -n crit %{_bindir}/crit +%{python3_sitelib}/crit-%{version}*egg-info %doc %{_mandir}/man1/crit.1* -%{python3_sitelib}/crit-%{version}.dist-info/ %files -n criu-ns %{_sbindir}/criu-ns From 0f561fedffdd63c737ad3bd2a6aee23e3bad170d Mon Sep 17 00:00:00 2001 From: Python Maint Date: Tue, 13 Jun 2023 21:33:56 +0200 Subject: [PATCH 057/109] Rebuilt for Python 3.12 --- criu.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/criu.spec b/criu.spec index 682b7de..a121569 100644 --- a/criu.spec +++ b/criu.spec @@ -17,7 +17,7 @@ Name: criu Version: 3.18 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPLv2 URL: http://criu.org/ @@ -217,6 +217,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %doc %{_mandir}/man1/criu-ns.1* %changelog +* Tue Jun 13 2023 Python Maint - 3.18-2 +- Rebuilt for Python 3.12 + * Tue Apr 25 2034 Adrian Reber - 3.18-1 - Update to 3.18 - Apply patch from upstream to support newer CPUs From f637ae8c275561fc633449f46de2ac384fa8f310 Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Tue, 4 Jul 2023 22:32:12 -0400 Subject: [PATCH 058/109] Fix build with latest pip pip now uses wheel in certain circumstances, which results in a .dist-info directory instead of an .egg-info one. --- criu.spec | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/criu.spec b/criu.spec index a121569..5d9315d 100644 --- a/criu.spec +++ b/criu.spec @@ -53,6 +53,7 @@ BuildRequires: protobuf-devel protobuf-c-devel %{py_prefix}-devel libnl3-devel l %if 0%{?fedora} || 0%{?rhel} > 7 BuildRequires: %{py_prefix}-pip BuildRequires: %{py_prefix}-setuptools +BuildRequires: %{py_prefix}-wheel BuildRequires: asciidoctor BuildRequires: perl-interpreter BuildRequires: libselinux-devel @@ -209,7 +210,7 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %files -n crit %{_bindir}/crit -%{python3_sitelib}/crit-%{version}*egg-info +%{python3_sitelib}/crit-%{version}.dist-info/ %doc %{_mandir}/man1/crit.1* %files -n criu-ns From 451a795464bc9899297912acab6bc0d8795d591d Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Thu, 6 Jul 2023 08:44:54 +0200 Subject: [PATCH 059/109] migrated to SPDX license remove RHEL 7 conditionals Signed-off-by: Adrian Reber --- aio-fix.patch | 11 - compel.1 | 373 ------------- crit.1 | 235 --------- criu-ns.1 | 194 ------- criu.8 | 1403 ------------------------------------------------- criu.spec | 70 +-- 6 files changed, 7 insertions(+), 2279 deletions(-) delete mode 100644 aio-fix.patch delete mode 100644 compel.1 delete mode 100644 crit.1 delete mode 100644 criu-ns.1 delete mode 100644 criu.8 diff --git a/aio-fix.patch b/aio-fix.patch deleted file mode 100644 index 8589d55..0000000 --- a/aio-fix.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/criu/aio.c 2015-07-01 11:02:50.360004543 -0400 -+++ b/criu/aio.c 2015-07-01 11:03:33.099757812 -0400 -@@ -74,7 +74,7 @@ - * up back to the k_max_reqs. - */ - -- return (k_max_reqs - 2) / 2; -+ return (k_max_reqs - 2); - } - - unsigned long aio_rings_args_size(struct vm_area_list *vmas) diff --git a/compel.1 b/compel.1 deleted file mode 100644 index 7ed58b9..0000000 --- a/compel.1 +++ /dev/null @@ -1,373 +0,0 @@ -'\" t -.\" Title: compel -.\" Author: [see the "AUTHOR" section] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 09/12/2019 -.\" Manual: CRIU Manual -.\" Source: criu 3.13 -.\" Language: English -.\" -.TH "COMPEL" "1" "09/12/2019" "criu 3\&.13" "CRIU Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * (re)Define some macros -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" toupper - uppercase a string (locale-aware) -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.de toupper -.tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ -\\$* -.tr aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz -.. -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" SH-xref - format a cross-reference to an SH section -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.de SH-xref -.ie n \{\ -.\} -.toupper \\$* -.el \{\ -\\$* -.\} -.. -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" SH - level-one heading that works better for non-TTY output -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.de1 SH -.\" put an extra blank line of space above the head in non-TTY output -.if t \{\ -.sp 1 -.\} -.sp \\n[PD]u -.nr an-level 1 -.set-an-margin -.nr an-prevailing-indent \\n[IN] -.fi -.in \\n[an-margin]u -.ti 0 -.HTML-TAG ".NH \\n[an-level]" -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -\." make the size of the head bigger -.ps +3 -.ft B -.ne (2v + 1u) -.ie n \{\ -.\" if n (TTY output), use uppercase -.toupper \\$* -.\} -.el \{\ -.nr an-break-flag 0 -.\" if not n (not TTY), use normal case (not uppercase) -\\$1 -.in \\n[an-margin]u -.ti 0 -.\" if not n (not TTY), put a border/line under subheading -.sp -.6 -\l'\n(.lu' -.\} -.. -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" SS - level-two heading that works better for non-TTY output -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.de1 SS -.sp \\n[PD]u -.nr an-level 1 -.set-an-margin -.nr an-prevailing-indent \\n[IN] -.fi -.in \\n[IN]u -.ti \\n[SN]u -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.ps \\n[PS-SS]u -\." make the size of the head bigger -.ps +2 -.ft B -.ne (2v + 1u) -.if \\n[.$] \&\\$* -.. -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" BB/EB - put background/screen (filled box) around block of text -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.de BB -.if t \{\ -.sp -.5 -.br -.in +2n -.ll -2n -.gcolor red -.di BX -.\} -.. -.de EB -.if t \{\ -.if "\\$2"adjust-for-leading-newline" \{\ -.sp -1 -.\} -.br -.di -.in -.ll -.gcolor -.nr BW \\n(.lu-\\n(.i -.nr BH \\n(dn+.5v -.ne \\n(BHu+.5v -.ie "\\$2"adjust-for-leading-newline" \{\ -\M[\\$1]\h'1n'\v'+.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[] -.\} -.el \{\ -\M[\\$1]\h'1n'\v'-.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[] -.\} -.in 0 -.sp -.5v -.nf -.BX -.in -.sp .5v -.fi -.\} -.. -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" BM/EM - put colored marker in margin next to block of text -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.de BM -.if t \{\ -.br -.ll -2n -.gcolor red -.di BX -.\} -.. -.de EM -.if t \{\ -.br -.di -.ll -.gcolor -.nr BH \\n(dn -.ne \\n(BHu -\M[\\$1]\D'P -.75n 0 0 \\n(BHu -(\\n[.i]u - \\n(INu - .75n) 0 0 -\\n(BHu'\M[] -.in 0 -.nf -.BX -.in -.fi -.\} -.. -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "Name" -compel \- Execute parasitic code within another process\&. -.SH "Synopsis" -.sp -\fBcompel\fR \fIhgen\fR [\fIoption\fR \&...] -.sp -\fBcompel\fR \fIplugins\fR [\fIPLUGIN_NAME\fR \&...] -.sp -\fBcompel\fR [\fI\-\-compat\fR] \fIincludes\fR | \fIcflags\fR | \fIldflags\fR -.sp -\fBcompel\fR [\fI\-\-compat\fR] [\fI\-\-static\fR] \fIlibs\fR -.SH "DESCRIPTION" -.sp -\fBcompel\fR is a utility to execute arbitrary code, also called parasite code, in the context of a foreign process\&. The parasitic code, once compiled with compel flags and packed, can be executed in the context of other tasks\&. Currently there is only one way to load the parasitic blob into victim task using libcompel\&.a, called c\-header\&. -.SH "ARGUMENTS" -.SS "Positional Arguments" -.PP -\fBhgen\fR -.RS 4 -create a header from the \&.po file, which is the parasite binary\&. -.RE -.PP -\fBplugins\fR -.RS 4 -prints the plugins available\&. -.RE -.PP -\fBldflags\fR -.RS 4 -prints the ldflags available to compel during linking of parasite code\&. -.RE -.PP -\fBcflags\fR -.RS 4 -prints the compel cflags to be used during compilation of parasitic code\&. -.RE -.PP -\fBincludes\fR -.RS 4 -prints list of standard include directories\&. -.RE -.PP -\fBlibs\fR -.RS 4 -prints list of static or dynamic libraries that compel can link with\&. -.RE -.SH "OPTIONS" -.PP -\fB\-f\fR, \fB\-\-file\fR \fIFILE\fR -.RS 4 -Path to the binary file, -\fIFILE\fR, which -\fBcompel\fR -must turn into a header -.RE -.PP -\fB\-o\fR, \fB\-\-output\fR \fIFILE\fR -.RS 4 -Path to the header file, -\fIFILE\fR, where compel must write the resulting header\&. -.RE -.PP -\fB\-p\fR, \fB\-\-prefix\fR \fINAME\fR -.RS 4 -Specify prefix for var names -.RE -.PP -\fB\-l\fR, \fB\-\-log\-level\fR \fINUM\fR -.RS 4 -Default log level of compel\&. -.RE -.PP -\fB\-h\fR, \fB\-\-help\fR -.RS 4 -Prints usage and exits\&. -.RE -.PP -\fB\-V\fR, \fB\-\-version\fR -.RS 4 -Prints version number of compel\&. -.RE -.SH "SOURCE EXAMPLES" -.SS "Parasitic Code" -.sp -\fB#include \fR -.sp -\fBint parasite_trap_cmd(int cmd, void *args);\fR //gets called by compel_run_in_thread() -.sp -\fBint parasite_daemon_cmd(int cmd, void *arg);\fR // gets called by compel_rpc_call() and compel_rpc_call_sync() -.sp -\fBvoid parasite_cleanup(void);\fR //gets called on parasite unload by compel_cure() -.SS "Infecting code" -.sp -The parasitic code is compiled and converted to a header using \fBcompel\fR, and included here\&. -.sp -\fB#include \fR -.sp -\fB#include "parasite\&.h"\fR -.sp -Following steps are perfomed to infect the victim process: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -stop the task: -\fBint compel_stop_task(int pid);\fR -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -prepare infection handler: -\fBstruct parasite_ctl *compel_prepare(int pid);\fR -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -execute system call: -\fBint compel_syscall(ctl, int syscall_nr, long *ret, int arg \&...);\fR -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -infect victim: -\fBint compel_infect(ctl, nr_thread, size_of_args_area);\fR -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -cure the victim: -\fBint compel_cure(ctl);\fR -//ctl pointer is freed by this call -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Resume victim: -\fBint compel_resume_task(pid, orig_state, state);\fR -.RE -.sp -\fBctl\fR must be configured with blob information by calling \fBPREFIX_setup_c_header()\fR, with ctl as its argument\&. \fBPREFIX\fR is the argument given to \fB\-p\fR when calling hgen, else it is deduced from file name\&. -.SH "EXAMPLES" -.sp -To generate a header file(\&.h) from a parasite binary file(\&.po) use: -.sp -.if n \{\ -.RS 4 -.\} -.fam C -.ps -1 -.nf -.BB lightgray - compel hgen \-f parasite\&.po \-o parasite\&.h -.EB lightgray -.fi -.fam -.ps +1 -.if n \{\ -.RE -.\} -.sp -\fIparasite\&.po\fR file is obtained by compiling the parasite source with compel flags and linking it with the compel plugins\&. -.SH "AUTHOR" -.sp -The CRIU team\&. diff --git a/crit.1 b/crit.1 deleted file mode 100644 index ab8398e..0000000 --- a/crit.1 +++ /dev/null @@ -1,235 +0,0 @@ -'\" t -.\" Title: crit -.\" Author: [see the "AUTHOR" section] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/23/2019 -.\" Manual: CRIU Manual -.\" Source: criu 3.12 -.\" Language: English -.\" -.TH "CRIT" "1" "04/23/2019" "criu 3\&.12" "CRIU Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * (re)Define some macros -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" toupper - uppercase a string (locale-aware) -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.de toupper -.tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ -\\$* -.tr aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz -.. -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" SH-xref - format a cross-reference to an SH section -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.de SH-xref -.ie n \{\ -.\} -.toupper \\$* -.el \{\ -\\$* -.\} -.. -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" SH - level-one heading that works better for non-TTY output -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.de1 SH -.\" put an extra blank line of space above the head in non-TTY output -.if t \{\ -.sp 1 -.\} -.sp \\n[PD]u -.nr an-level 1 -.set-an-margin -.nr an-prevailing-indent \\n[IN] -.fi -.in \\n[an-margin]u -.ti 0 -.HTML-TAG ".NH \\n[an-level]" -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -\." make the size of the head bigger -.ps +3 -.ft B -.ne (2v + 1u) -.ie n \{\ -.\" if n (TTY output), use uppercase -.toupper \\$* -.\} -.el \{\ -.nr an-break-flag 0 -.\" if not n (not TTY), use normal case (not uppercase) -\\$1 -.in \\n[an-margin]u -.ti 0 -.\" if not n (not TTY), put a border/line under subheading -.sp -.6 -\l'\n(.lu' -.\} -.. -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" SS - level-two heading that works better for non-TTY output -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.de1 SS -.sp \\n[PD]u -.nr an-level 1 -.set-an-margin -.nr an-prevailing-indent \\n[IN] -.fi -.in \\n[IN]u -.ti \\n[SN]u -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.ps \\n[PS-SS]u -\." make the size of the head bigger -.ps +2 -.ft B -.ne (2v + 1u) -.if \\n[.$] \&\\$* -.. -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" BB/EB - put background/screen (filled box) around block of text -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.de BB -.if t \{\ -.sp -.5 -.br -.in +2n -.ll -2n -.gcolor red -.di BX -.\} -.. -.de EB -.if t \{\ -.if "\\$2"adjust-for-leading-newline" \{\ -.sp -1 -.\} -.br -.di -.in -.ll -.gcolor -.nr BW \\n(.lu-\\n(.i -.nr BH \\n(dn+.5v -.ne \\n(BHu+.5v -.ie "\\$2"adjust-for-leading-newline" \{\ -\M[\\$1]\h'1n'\v'+.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[] -.\} -.el \{\ -\M[\\$1]\h'1n'\v'-.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[] -.\} -.in 0 -.sp -.5v -.nf -.BX -.in -.sp .5v -.fi -.\} -.. -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" BM/EM - put colored marker in margin next to block of text -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.de BM -.if t \{\ -.br -.ll -2n -.gcolor red -.di BX -.\} -.. -.de EM -.if t \{\ -.br -.di -.ll -.gcolor -.nr BH \\n(dn -.ne \\n(BHu -\M[\\$1]\D'P -.75n 0 0 \\n(BHu -(\\n[.i]u - \\n(INu - .75n) 0 0 -\\n(BHu'\M[] -.in 0 -.nf -.BX -.in -.fi -.\} -.. -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "Name" -crit \- CRiu Image Tool -.SH "Synopsis" -.sp -\fBcrit\fR \fIdecode\fR [\-h] [\-i IN] [\-o OUT] [\-\-pretty] -.sp -\fBcrit\fR \fIencode\fR [\-h] [\-i IN] [\-o OUT] -.sp -\fBcrit\fR \fIinfo\fR [\-h] in -.sp -\fBcrit\fR \fIx\fR [\-h] dir {ps,fds,mems} -.sp -\fBcrit\fR \fIshow\fR [\-h] in -.SH "DESCRIPTION" -.sp -\fBcrit\fR is a feature\-rich replacement for existing \fBcriu\fR show\&. -.SH "ARGUMENTS" -.SS "Positional Arguments" -.PP -\fBdecode\fR -.RS 4 -convert -\fBcriu\fR -image from binary type JSON -.RE -.PP -\fBencode\fR -.RS 4 -convert -\fBcriu\fR -image from JSON type to binary -.RE -.PP -\fBinfo\fR -.RS 4 -show info about image -.RE -.PP -\fBx\fR -.RS 4 -explore image directory -.RE -.PP -\fBshow\fR -.RS 4 -convert -\fBcriu\fR -image from binary to human\-readable JSON -.RE -.SS "Optional Arguments" -.PP -\fB\-h\fR, \fB\-\-help\fR -.RS 4 -Print some help and exit -.RE -.SH "SEE ALSO" -.sp -criu(8) -.SH "AUTHOR" -.sp -The CRIU team diff --git a/criu-ns.1 b/criu-ns.1 deleted file mode 100644 index 3ad79bd..0000000 --- a/criu-ns.1 +++ /dev/null @@ -1,194 +0,0 @@ -'\" t -.\" Title: criu-ns -.\" Author: [see the "AUTHOR" section] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 09/22/2021 -.\" Manual: CRIU Manual -.\" Source: criu 3.16 -.\" Language: English -.\" -.TH "CRIU\-NS" "1" "09/22/2021" "criu 3\&.16" "CRIU Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * (re)Define some macros -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" toupper - uppercase a string (locale-aware) -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.de toupper -.tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ -\\$* -.tr aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz -.. -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" SH-xref - format a cross-reference to an SH section -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.de SH-xref -.ie n \{\ -.\} -.toupper \\$* -.el \{\ -\\$* -.\} -.. -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" SH - level-one heading that works better for non-TTY output -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.de1 SH -.\" put an extra blank line of space above the head in non-TTY output -.if t \{\ -.sp 1 -.\} -.sp \\n[PD]u -.nr an-level 1 -.set-an-margin -.nr an-prevailing-indent \\n[IN] -.fi -.in \\n[an-margin]u -.ti 0 -.HTML-TAG ".NH \\n[an-level]" -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -\." make the size of the head bigger -.ps +3 -.ft B -.ne (2v + 1u) -.ie n \{\ -.\" if n (TTY output), use uppercase -.toupper \\$* -.\} -.el \{\ -.nr an-break-flag 0 -.\" if not n (not TTY), use normal case (not uppercase) -\\$1 -.in \\n[an-margin]u -.ti 0 -.\" if not n (not TTY), put a border/line under subheading -.sp -.6 -\l'\n(.lu' -.\} -.. -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" SS - level-two heading that works better for non-TTY output -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.de1 SS -.sp \\n[PD]u -.nr an-level 1 -.set-an-margin -.nr an-prevailing-indent \\n[IN] -.fi -.in \\n[IN]u -.ti \\n[SN]u -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.ps \\n[PS-SS]u -\." make the size of the head bigger -.ps +2 -.ft B -.ne (2v + 1u) -.if \\n[.$] \&\\$* -.. -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" BB/EB - put background/screen (filled box) around block of text -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.de BB -.if t \{\ -.sp -.5 -.br -.in +2n -.ll -2n -.gcolor red -.di BX -.\} -.. -.de EB -.if t \{\ -.if "\\$2"adjust-for-leading-newline" \{\ -.sp -1 -.\} -.br -.di -.in -.ll -.gcolor -.nr BW \\n(.lu-\\n(.i -.nr BH \\n(dn+.5v -.ne \\n(BHu+.5v -.ie "\\$2"adjust-for-leading-newline" \{\ -\M[\\$1]\h'1n'\v'+.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[] -.\} -.el \{\ -\M[\\$1]\h'1n'\v'-.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[] -.\} -.in 0 -.sp -.5v -.nf -.BX -.in -.sp .5v -.fi -.\} -.. -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" BM/EM - put colored marker in margin next to block of text -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.de BM -.if t \{\ -.br -.ll -2n -.gcolor red -.di BX -.\} -.. -.de EM -.if t \{\ -.br -.di -.ll -.gcolor -.nr BH \\n(dn -.ne \\n(BHu -\M[\\$1]\D'P -.75n 0 0 \\n(BHu -(\\n[.i]u - \\n(INu - .75n) 0 0 -\\n(BHu'\M[] -.in 0 -.nf -.BX -.in -.fi -.\} -.. -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "Name" -criu-ns \- run criu in different namespaces -.SH "Synopsis" -.sp -\fBcriu\-ns\fR \fIdump\fR \-t PID [] -.sp -\fBcriu\-ns\fR \fIpre\-dump\fR \-t PID [] -.sp -\fBcriu\-ns\fR \fIrestore\fR [] -.sp -\fBcriu\-ns\fR \fIcheck\fR [] -.SH "DESCRIPTION" -.sp -The \fBcriu\-ns\fR command executes \fIcriu\fR in a new PID and mount namespace\&. The purpose of this wrapper script is to enable restoring a process tree that might require a specific PID that is already used on the system; so called "PID mismatch" problem\&. -.SH "SEE ALSO" -.sp -nsenter(1) namespaces(7) criu(8) -.SH "AUTHOR" -.sp -The CRIU team diff --git a/criu.8 b/criu.8 deleted file mode 100644 index eea1e76..0000000 --- a/criu.8 +++ /dev/null @@ -1,1403 +0,0 @@ -'\" t -.\" Title: criu -.\" Author: [see the "AUTHOR" section] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/23/2019 -.\" Manual: CRIU Manual -.\" Source: criu 3.12 -.\" Language: English -.\" -.TH "CRIU" "8" "04/23/2019" "criu 3\&.12" "CRIU Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * (re)Define some macros -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" toupper - uppercase a string (locale-aware) -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.de toupper -.tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ -\\$* -.tr aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz -.. -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" SH-xref - format a cross-reference to an SH section -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.de SH-xref -.ie n \{\ -.\} -.toupper \\$* -.el \{\ -\\$* -.\} -.. -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" SH - level-one heading that works better for non-TTY output -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.de1 SH -.\" put an extra blank line of space above the head in non-TTY output -.if t \{\ -.sp 1 -.\} -.sp \\n[PD]u -.nr an-level 1 -.set-an-margin -.nr an-prevailing-indent \\n[IN] -.fi -.in \\n[an-margin]u -.ti 0 -.HTML-TAG ".NH \\n[an-level]" -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -\." make the size of the head bigger -.ps +3 -.ft B -.ne (2v + 1u) -.ie n \{\ -.\" if n (TTY output), use uppercase -.toupper \\$* -.\} -.el \{\ -.nr an-break-flag 0 -.\" if not n (not TTY), use normal case (not uppercase) -\\$1 -.in \\n[an-margin]u -.ti 0 -.\" if not n (not TTY), put a border/line under subheading -.sp -.6 -\l'\n(.lu' -.\} -.. -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" SS - level-two heading that works better for non-TTY output -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.de1 SS -.sp \\n[PD]u -.nr an-level 1 -.set-an-margin -.nr an-prevailing-indent \\n[IN] -.fi -.in \\n[IN]u -.ti \\n[SN]u -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.ps \\n[PS-SS]u -\." make the size of the head bigger -.ps +2 -.ft B -.ne (2v + 1u) -.if \\n[.$] \&\\$* -.. -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" BB/EB - put background/screen (filled box) around block of text -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.de BB -.if t \{\ -.sp -.5 -.br -.in +2n -.ll -2n -.gcolor red -.di BX -.\} -.. -.de EB -.if t \{\ -.if "\\$2"adjust-for-leading-newline" \{\ -.sp -1 -.\} -.br -.di -.in -.ll -.gcolor -.nr BW \\n(.lu-\\n(.i -.nr BH \\n(dn+.5v -.ne \\n(BHu+.5v -.ie "\\$2"adjust-for-leading-newline" \{\ -\M[\\$1]\h'1n'\v'+.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[] -.\} -.el \{\ -\M[\\$1]\h'1n'\v'-.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[] -.\} -.in 0 -.sp -.5v -.nf -.BX -.in -.sp .5v -.fi -.\} -.. -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" BM/EM - put colored marker in margin next to block of text -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.de BM -.if t \{\ -.br -.ll -2n -.gcolor red -.di BX -.\} -.. -.de EM -.if t \{\ -.br -.di -.ll -.gcolor -.nr BH \\n(dn -.ne \\n(BHu -\M[\\$1]\D'P -.75n 0 0 \\n(BHu -(\\n[.i]u - \\n(INu - .75n) 0 0 -\\n(BHu'\M[] -.in 0 -.nf -.BX -.in -.fi -.\} -.. -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "Name" -criu \- checkpoint/restore in userspace -.SH "Synopsis" -.sp -\fBcriu\fR \fIcommand\fR [\fIoption\fR \&...] -.SH "DESCRIPTION" -.sp -\fBcriu\fR is a tool for checkpointing and restoring running applications\&. It does this by saving their state as a collection of files (see the \fBdump\fR command) and creating equivalent processes from those files (see the \fBrestore\fR command)\&. The restore operation can be performed at a later time, on a different system, or both\&. -.SH "OPTIONS" -.sp -Most of the true / false long options (the ones without arguments) can be prefixed with \fB\-\-no\-\fR to negate the option (example: \fB\-\-display\-stats\fR and \fB\-\-no\-display\-stats\fR)\&. -.SS "Common options" -.sp -Common options are applicable to any \fIcommand\fR\&. -.PP -\fB\-v\fR[\fBv\fR\&...], \fB\-\-verbosity\fR -.RS 4 -Increase verbosity up from the default level\&. Multiple -\fBv\fR -can be used, each increasing verbosity by one level\&. Using long option without argument increases verbosity by one level\&. -.RE -.PP -\fB\-v\fR\fInum\fR, \fB\-\-verbosity\fR=\fInum\fR -.RS 4 -Set verbosity level to -\fInum\fR\&. The higher the level, the more output is produced\&. - -The following levels are available: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fB\-v0\fR -no output; -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fB\-v1\fR -only errors; -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fB\-v2\fR -above plus warnings (this is the default level); -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fB\-v3\fR -above plus information messages and timestamps; -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fB\-v4\fR -above plus lots of debug\&. -.RE -.RE -.PP -\fB\-\-config\fR \fIfile\fR -.RS 4 -Pass a specific configuration file to criu\&. -.RE -.PP -\fB\-\-no\-default\-config\fR -.RS 4 -Forbid parsing of default configuration files\&. -.RE -.PP -\fB\-\-pidfile\fR \fIfile\fR -.RS 4 -Write root task, service or page\-server pid into a -\fIfile\fR\&. -.RE -.PP -\fB\-o\fR, \fB\-\-log\-file\fR \fIfile\fR -.RS 4 -Write logging messages to -\fIfile\fR\&. -.RE -.PP -\fB\-\-display\-stats\fR -.RS 4 -During dump as well as during restore -\fBcriu\fR -collects information like the time required to dump or restore the process or the number of pages dumped or restored\&. This information is always written to the files -\fIstats\-dump\fR -and -\fIstats\-restore\fR -and can be easily displayed using -\fBcrit\fR\&. The option -\fB\-\-display\-stats\fR -additionally prints out this information on the console at the end of a dump or a restore\&. -.RE -.PP -\fB\-D\fR, \fB\-\-images\-dir\fR \fIpath\fR -.RS 4 -Use -\fIpath\fR -as a base directory where to look for sets of image files\&. -.RE -.PP -\fB\-\-prev\-images\-dir\fR \fIpath\fR -.RS 4 -Use -\fIpath\fR -as a parent directory where to look for sets of image files\&. This option makes sense in case of incremental dumps\&. -.RE -.PP -\fB\-W\fR, \fB\-\-work\-dir\fR \fIdir\fR -.RS 4 -Use directory -\fIdir\fR -for putting logs, pidfiles and statistics\&. If not specified, -\fIpath\fR -from -\fB\-D\fR -option is taken\&. -.RE -.PP -\fB\-\-close\fR \fIfd\fR -.RS 4 -Close file descriptor -\fIfd\fR -before performing any actions\&. -.RE -.PP -\fB\-L\fR, \fB\-\-libdir\fR \fIpath\fR -.RS 4 -Path to plugins directory\&. -.RE -.PP -\fB\-\-action\-script\fR \fIscript\fR -.RS 4 -Add an external action script to be executed at certain stages\&. The environment variable -\fBCRTOOLS_SCRIPT_ACTION\fR -is available to the script to find out which action is being executed, and its value can be one of the following: -.PP -\fBpre\-dump\fR -.RS 4 -run prior to beginning a -\fBdump\fR -.RE -.PP -\fBpost\-dump\fR -.RS 4 -run upon -\fBdump\fR -completion -.RE -.PP -\fBpre\-restore\fR -.RS 4 -run prior to beginning a -\fBrestore\fR -.RE -.PP -\fBpost\-restore\fR -.RS 4 -run upon -\fBrestore\fR -completion -.RE -.PP -\fBpre\-resume\fR -.RS 4 -run when all processes and resources are restored but tasks are stopped waiting for final kick to run\&. Must not fail\&. -.RE -.PP -\fBpost\-resume\fR -.RS 4 -called at the very end, when everything is restored and processes were resumed -.RE -.PP -\fBnetwork\-lock\fR -.RS 4 -run to lock network in a target network namespace -.RE -.PP -\fBnetwork\-unlock\fR -.RS 4 -run to unlock network in a target network namespace -.RE -.PP -\fBsetup\-namespaces\fR -.RS 4 -run once root task has just been created with required namespaces\&. Note it is an early stage of restore, when nothing is restored yet, except for namespaces themselves -.RE -.PP -\fBpost\-setup\-namespaces\fR -.RS 4 -called after the namespaces are configured -.RE -.PP -\fBorphan\-pts\-master\fR -.RS 4 -called after master pty is opened and unlocked\&. This hook can be used only in the RPC mode, and the notification message contains a file descriptor for the master pty -.RE -.RE -.PP -\fB\-V\fR, \fB\-\-version\fR -.RS 4 -Print program version and exit\&. -.RE -.PP -\fB\-h\fR, \fB\-\-help\fR -.RS 4 -Print some help and exit\&. -.RE -.SS "pre\-dump" -.sp -Performs the pre\-dump procedure, during which \fBcriu\fR creates a snapshot of memory changes since the previous \fBpre\-dump\fR\&. Note that during this \fBcriu\fR also creates the fsnotify cache which speeds up the \fBrestore\fR procedure\&. \fBpre\-dump\fR requires at least \fB\-t\fR option (see \fBdump\fR below)\&. In addition, \fBpage\-server\fR options may be specified\&. -.PP -\fB\-\-track\-mem\fR -.RS 4 -Turn on memory changes tracker in the kernel\&. If the option is not passed the memory tracker get turned on implicitly\&. -.RE -.SS "dump" -.sp -Performs a checkpoint procedure\&. -.PP -\fB\-t\fR, \fB\-\-tree\fR \fIpid\fR -.RS 4 -Checkpoint the whole process tree starting from -\fIpid\fR\&. -.RE -.PP -\fB\-R\fR, \fB\-\-leave\-running\fR -.RS 4 -Leave tasks in running state after checkpoint, instead of killing\&. This option is pretty dangerous and should be used only if you understand what you are doing\&. -.sp -Note if task is about to run after been checkpointed, it can modify TCP connections, delete files and do other dangerous actions\&. Therefore, -\fBcriu\fR -can not guarantee that the next -\fBrestore\fR -action will succeed\&. Most likely if this option is used, at least the file system snapshot must be made with the help of -\fBpost\-dump\fR -action script\&. -.sp -In other words, do not use it unless really needed\&. -.RE -.PP -\fB\-s\fR, \fB\-\-leave\-stopped\fR -.RS 4 -Leave tasks in stopped state after checkpoint, instead of killing\&. -.RE -.PP -\fB\-\-external\fR \fItype\fR\fB[\fR\fIid\fR\fB]:\fR\fIvalue\fR -.RS 4 -Dump an instance of an external resource\&. The generic syntax is -\fItype\fR -of resource, followed by resource -\fIid\fR -(enclosed in literal square brackets), and optional -\fIvalue\fR -(prepended by a literal colon)\&. The following resource types are currently supported: -\fBmnt\fR, -\fBdev\fR, -\fBfile\fR, -\fBtty\fR, -\fBunix\fR\&. Syntax depends on type\&. Note to restore external resources, either -\fB\-\-external\fR -or -\fB\-\-inherit\-fd\fR -is used, depending on resource type\&. -.RE -.PP -\fB\-\-external mnt[\fR\fImountpoint\fR\fB]:\fR\fIname\fR -.RS 4 -Dump an external bind mount referenced by -\fImountpoint\fR, saving it to image under the identifier -\fIname\fR\&. -.RE -.PP -\fB\-\-external mnt[]:\fR\fIflags\fR -.RS 4 -Dump all external bind mounts, autodetecting those\&. Optional -\fIflags\fR -can contain -\fBm\fR -to also dump external master mounts, -\fBs\fR -to also dump external shared mounts (default behavior is to abort dumping if such mounts are found)\&. If -\fIflags\fR -are not provided, colon is optional\&. -.RE -.PP -\fB\-\-external dev[\fR\fImajor\fR\fB/\fR\fIminor\fR\fB]:\fR\fIname\fR -.RS 4 -Allow to dump a mount namespace having a real block device mounted\&. A block device is identified by its -\fImajor\fR -and -\fIminor\fR -numbers, and -\fBcriu\fR -saves its information to image under the identifier -\fIname\fR\&. -.RE -.PP -\fB\-\-external file[\fR\fImnt_id\fR\fB:\fR\fIinode\fR\fB]\fR -.RS 4 -Dump an external file, i\&.e\&. an opened file that is can not be resolved from the current mount namespace, which can not be dumped without using this option\&. The file is identified by -\fImnt_id\fR -(a field obtained from -\fB/proc/\fR\fIpid\fR\fB/fdinfo/\fR\fIN\fR) and -\fIinode\fR -(as returned by -\fBstat\fR(2))\&. -.RE -.PP -\fB\-\-external tty[\fR\fIrdev\fR\fB:\fR\fIdev\fR\fB]\fR -.RS 4 -Dump an external TTY, identified by -\fBst_rdev\fR -and -\fBst_dev\fR -fields returned by -\fBstat\fR(2)\&. -.RE -.PP -\fB\-\-external unix[\fR\fIid\fR\fB]\fR -.RS 4 -Tell -\fBcriu\fR -that one end of a pair of UNIX sockets (created by -\fBsocketpair\fR(2)) with -\fIid\fR -is OK to be disconnected\&. -.RE -.PP -\fB\-\-freeze\-cgroup\fR -.RS 4 -Use cgroup freezer to collect processes\&. -.RE -.PP -\fB\-\-manage\-cgroups\fR -.RS 4 -Collect cgroups into the image thus they gonna be restored then\&. Without this option, -\fBcriu\fR -will not save cgroups configuration associated with a task\&. -.RE -.PP -\fB\-\-cgroup\-props\fR \fIspec\fR -.RS 4 -Specify controllers and their properties to be saved into the image file\&. -\fBcriu\fR -predefines specifications for common controllers, but since the kernel can add new controllers and modify their properties, there should be a way to specify ones matched the kernel\&. -.sp -\fIspec\fR -argument describes the controller and properties specification in a simplified YAML form: -.sp -.if n \{\ -.RS 4 -.\} -.fam C -.ps -1 -.nf -.BB lightgray -"c1": - \- "strategy": "merge" - \- "properties": ["a", "b"] -"c2": - \- "strategy": "replace" - \- "properties": ["c", "d"] -.EB lightgray -.fi -.fam -.ps +1 -.if n \{\ -.RE -.\} -.sp -where -\fIc1\fR -and -\fIc2\fR -are controllers names, and -\fIa\fR, -\fIb\fR, -\fIc\fR, -\fId\fR -are their properties\&. -.sp -Note the format: double quotes, spaces and new lines are required\&. The -\fIstrategy\fR -specifies what to do if a controller specified already exists as a built\-in one: -\fBcriu\fR -can either -\fBmerge\fR -or -\fBreplace\fR -such\&. -.sp -For example, the command line for the above example should look like this: -.sp -.if n \{\ -.RS 4 -.\} -.fam C -.ps -1 -.nf -.BB lightgray -\-\-cgroup\-props "\e"c1\e":\en \- \e"strategy\e": \e"merge\e"\en \- \e"properties\e": [\e"a\e", \e"b\e"]\en \e"c2\e":\en \- \e"strategy\e": \e"replace\e"\en \- \e"properties\e": [\e"c\e", \e"d\e"]" -.EB lightgray -.fi -.fam -.ps +1 -.if n \{\ -.RE -.\} -.RE -.PP -\fB\-\-cgroup\-props\-file\fR \fIfile\fR -.RS 4 -Same as -\fB\-\-cgroup\-props\fR, except the specification is read from the -\fIfile\fR\&. -.RE -.PP -\fB\-\-cgroup\-dump\-controller\fR \fIname\fR -.RS 4 -Dump a controller with -\fIname\fR -only, skipping anything else that was discovered automatically (usually via -\fB/proc\fR)\&. This option is useful when one needs -\fBcriu\fR -to skip some controllers\&. -.RE -.PP -\fB\-\-cgroup\-props\-ignore\-default\fR -.RS 4 -When combined with -\fB\-\-cgroup\-props\fR, makes -\fBcriu\fR -substitute a predefined controller property with the new one shipped\&. If the option is not used, the predefined properties are merged with the provided ones\&. -.RE -.PP -\fB\-\-tcp\-established\fR -.RS 4 -Checkpoint established TCP connections\&. -.RE -.PP -\fB\-\-skip\-in\-flight\fR -.RS 4 -This option skips in\-flight TCP connections\&. If any TCP connections that are not yet completely established are found, -\fBcriu\fR -ignores these connections, rather than errors out\&. The TCP stack on the client side is expected to handle the re\-connect gracefully\&. -.RE -.PP -\fB\-\-evasive\-devices\fR -.RS 4 -Use any path to a device file if the original one is inaccessible\&. -.RE -.PP -\fB\-\-page\-server\fR -.RS 4 -Send pages to a page server (see the -\fBpage\-server\fR -command)\&. -.RE -.PP -\fB\-\-force\-irmap\fR -.RS 4 -Force resolving names for inotify and fsnotify watches\&. -.RE -.PP -\fB\-\-auto\-dedup\fR -.RS 4 -Deduplicate "old" data in pages images of previous -\fBdump\fR\&. This option implies incremental -\fBdump\fR -mode (see the -\fBpre\-dump\fR -command)\&. -.RE -.PP -\fB\-l\fR, \fB\-\-file\-locks\fR -.RS 4 -Dump file locks\&. It is necessary to make sure that all file lock users are taken into dump, so it is only safe to use this for enclosed containers where locks are not held by any processes outside of dumped process tree\&. -.RE -.PP -\fB\-\-link\-remap\fR -.RS 4 -Allows to link unlinked files back, if possible (modifies filesystem during -\fBrestore\fR)\&. -.RE -.PP -\fB\-\-ghost\-limit\fR \fIsize\fR -.RS 4 -Set the maximum size of deleted file to be carried inside image\&. By default, up to 1M file is allowed\&. Using this option allows to not put big deleted files inside images\&. Argument -\fIsize\fR -may be postfixed with a -\fBK\fR, -\fBM\fR -or -\fBG\fR, which stands for kilo\-, mega, and gigabytes, accordingly\&. -.RE -.PP -\fB\-j\fR, \fB\-\-shell\-job\fR -.RS 4 -Allow one to dump shell jobs\&. This implies the restored task will inherit session and process group ID from the -\fBcriu\fR -itself\&. This option also allows to migrate a single external tty connection, to migrate applications like -\fBtop\fR\&. If used with -\fBdump\fR -command, it must be specified with -\fBrestore\fR -as well\&. -.RE -.PP -\fB\-\-cpu\-cap\fR [\fIcap\fR[,\fIcap\fR\&...]] -.RS 4 -Specify CPU capabilities to write to an image file\&. The argument is a comma\-separated list of: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBnone\fR -to ignore capabilities at all; the image will not be produced on dump, neither any check performed on restore; -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBfpu\fR -to check if FPU module is compatible; -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBins\fR -to check if CPU supports all instructions required; -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBcpu\fR -to check if CPU capabilities are exactly matching; -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBall\fR -for all above set\&. -.RE -.sp -By default the option is set to -\fBfpu\fR -and -\fBins\fR\&. -.RE -.PP -\fB\-\-cgroup\-root\fR [\fIcontroller\fR:]/\fInewroot\fR -.RS 4 -Change the root for the controller that will be dumped\&. By default, -\fBcriu\fR -simply dumps everything below where any of the tasks live\&. However, if a container moves all of its tasks into a cgroup directory below the container engine\(cqs default directory for tasks, permissions will not be preserved on the upper directories with no tasks in them, which may cause problems\&. -.RE -.PP -\fB\-\-lazy\-pages\fR -.RS 4 -Perform the dump procedure without writing memory pages into the image files and prepare to service page requests over the network\&. When -\fBdump\fR -runs in this mode it presumes that -\fBlazy\-pages\fR -daemon will connect to it and fetch memory pages to lazily inject them into the restored process address space\&. This option is intended for post\-copy (lazy) migration and should be used in conjunction with -\fBrestore\fR -with appropriate options\&. -.RE -.SS "restore" -.sp -Restores previously checkpointed processes\&. -.PP -\fB\-\-inherit\-fd\fR \fBfd[\fR\fIN\fR\fB]:\fR\fIresource\fR -.RS 4 -Inherit a file descriptor\&. This option lets -\fBcriu\fR -use an already opened file descriptor -\fIN\fR -for restoring a file identified by -\fIresource\fR\&. This option can be used to restore an external resource dumped with the help of -\fB\-\-external\fR -\fBfile\fR, -\fBtty\fR, and -\fBunix\fR -options\&. -.sp -The -\fIresource\fR -argument can be one of the following: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBtty[\fR\fIrdev\fR\fB:\fR\fIdev\fR\fB]\fR -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBpipe[\fR\fIinode\fR\fB]\fR -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBsocket[\fR\fIinode\fR\fB]\fR -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBfile[\fR\fImnt_id\fR\fB:\fR\fIinode\fR\fB]\fR -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fIpath/to/file\fR -.RE -.sp -Note that square brackets used in this option arguments are literals and usually need to be escaped from shell\&. -.RE -.PP -\fB\-d\fR, \fB\-\-restore\-detached\fR -.RS 4 -Detach -\fBcriu\fR -itself once restore is complete\&. -.RE -.PP -\fB\-s\fR, \fB\-\-leave\-stopped\fR -.RS 4 -Leave tasks in stopped state after restore (rather than resuming their execution)\&. -.RE -.PP -\fB\-S\fR, \fB\-\-restore\-sibling\fR -.RS 4 -Restore root task as a sibling (makes sense only with -\fB\-\-restore\-detached\fR)\&. -.RE -.PP -\fB\-\-log\-pid\fR -.RS 4 -Write separate logging files per each pid\&. -.RE -.PP -\fB\-r\fR, \fB\-\-root\fR \fIpath\fR -.RS 4 -Change the root filesystem to -\fIpath\fR -(when run in a mount namespace)\&. -.RE -.PP -\fB\-\-external\fR \fItype\fR\fB[\fR\fIid\fR\fB]:\fR\fIvalue\fR -.RS 4 -Restore an instance of an external resource\&. The generic syntax is -\fItype\fR -of resource, followed by resource -\fIid\fR -(enclosed in literal square brackets), and optional -\fIvalue\fR -(prepended by a literal colon)\&. The following resource types are currently supported: -\fBmnt\fR, -\fBdev\fR, -\fBveth\fR, -\fBmacvlan\fR\&. Syntax depends on type\&. Note to restore external resources dealing with opened file descriptors (such as dumped with the help of -\fB\-\-external\fR -\fBfile\fR, -\fBtty\fR, and -\fBunix\fR -options), option -\fB\-\-inherit\-fd\fR -should be used\&. -.RE -.PP -\fB\-\-external mnt[\fR\fIname\fR\fB]:\fR\fImountpoint\fR -.RS 4 -Restore an external bind mount referenced in the image by -\fIname\fR, bind\-mounting it from the host -\fImountpoint\fR -to a proper mount point\&. -.RE -.PP -\fB\-\-external mnt[]\fR -.RS 4 -Restore all external bind mounts (dumped with the help of -\fB\-\-external mnt[]\fR -auto\-detection)\&. -.RE -.PP -\fB\-\-external dev[\fR\fIname\fR\fB]:\fR\fI/dev/path\fR -.RS 4 -Restore an external mount device, identified in the image by -\fIname\fR, using the existing block device -\fI/dev/path\fR\&. -.RE -.PP -\fB\-\-external veth[\fR\fIinner_dev\fR\fB]:\fR\fIouter_dev\fR\fB@\fR\fIbridge\fR -.RS 4 -Set the outer VETH device name (corresponding to -\fIinner_dev\fR -being restored) to -\fIouter_dev\fR\&. If optional -\fB@\fR\fIbridge\fR -is specified, -\fIouter_dev\fR -is added to that bridge\&. If the option is not used, -\fIouter_dev\fR -will be autogenerated by the kernel\&. -.RE -.PP -\fB\-\-external macvlan[\fR\fIinner_dev\fR\fB]:\fR\fIouter_dev\fR -.RS 4 -When restoring an image that have a MacVLAN device in it, this option must be used to specify to which -\fIouter_dev\fR -(an existing network device in CRIU namespace) the restored -\fIinner_dev\fR -should be bound to\&. -.RE -.PP -\fB\-\-manage\-cgroups\fR [\fImode\fR] -.RS 4 -Restore cgroups configuration associated with a task from the image\&. Controllers are always restored in an optimistic way \(em if already present in system, -\fBcriu\fR -reuses it, otherwise it will be created\&. -.RE -.sp -The \fImode\fR may be one of the following: -.PP -\fBnone\fR -.RS 4 -Do not restore cgroup properties but require cgroup to pre\-exist at the moment of -\fBrestore\fR -procedure\&. -.RE -.PP -\fBprops\fR -.RS 4 -Restore cgroup properties and require cgroup to pre\-exist\&. -.RE -.PP -\fBsoft\fR -.RS 4 -Restore cgroup properties if only cgroup has been created by -\fBcriu\fR, otherwise do not restore properties\&. This is the default if mode is unspecified\&. -.RE -.PP -\fBfull\fR -.RS 4 -Always restore all cgroups and their properties\&. -.RE -.PP -\fBstrict\fR -.RS 4 -Restore all cgroups and their properties from the scratch, requiring them to not present in the system\&. -.PP -\fB\-\-cgroup\-root\fR [\fIcontroller\fR\fB:\fR]/\fInewroot\fR -.RS 4 -Change the root cgroup the controller will be installed into\&. No controller means that root is the default for all controllers not specified\&. -.RE -.PP -\fB\-\-tcp\-established\fR -.RS 4 -Restore previously dumped established TCP connections\&. This implies that the network has been locked between -\fBdump\fR -and -\fBrestore\fR -phases so other side of a connection simply notice a kind of lag\&. -.RE -.PP -\fB\-\-tcp\-close\fR -.RS 4 -Restore connected TCP sockets in closed state\&. -.RE -.PP -\fB\-\-veth\-pair\fR \fIIN\fR\fB=\fR\fIOUT\fR -.RS 4 -Correspondence between outside and inside names of veth devices\&. -.RE -.PP -\fB\-l\fR, \fB\-\-file\-locks\fR -.RS 4 -Restore file locks from the image\&. -.RE -.PP -\fB\-\-lsm\-profile\fR \fItype\fR\fB:\fR\fIname\fR -.RS 4 -Specify an LSM profile to be used during restore\&. The -\FCtype\F[] -can be either -\fBapparmor\fR -or -\fBselinux\fR\&. -.RE -.PP -\fB\-\-auto\-dedup\fR -.RS 4 -As soon as a page is restored it get punched out from image\&. -.RE -.PP -\fB\-j\fR, \fB\-\-shell\-job\fR -.RS 4 -Restore shell jobs, in other words inherit session and process group ID from the criu itself\&. -.RE -.PP -\fB\-\-cpu\-cap\fR [\fIcap\fR[,\fIcap\fR\&...]] -.RS 4 -Specify CPU capabilities to be present on the CPU the process is restoring\&. To inverse a capability, prefix it with -\fB^\fR\&. This option implies that -\fB\-\-cpu\-cap\fR -has been passed on -\fBdump\fR -as well, except -\fBfpu\fR -option case\&. The -\fIcap\fR -argument can be the following (or a set of comma\-separated values): -.RE -.RE -.PP -\fBall\fR -.RS 4 -Require all capabilities\&. This is -\fBdefault\fR -mode if -\fB\-\-cpu\-cap\fR -is passed without arguments\&. Most safe mode\&. -.RE -.PP -\fBcpu\fR -.RS 4 -Require the CPU to have all capabilities in image to match runtime CPU\&. -.RE -.PP -\fBfpu\fR -.RS 4 -Require the CPU to have compatible FPU\&. For example the process might be dumped with xsave capability but attempted to restore without it present on target CPU\&. In such case we refuse to proceed\&. This is -\fBdefault\fR -mode if -\fB\-\-cpu\-cap\fR -is not present in command line\&. Note this argument might be passed even if on the -\fBdump\fR -no -\fB\-\-cpu\-cap\fR -have been specified because FPU frames are always encoded into images\&. -.RE -.PP -\fBins\fR -.RS 4 -Require CPU compatibility on instructions level\&. -.RE -.PP -\fBnone\fR -.RS 4 -Ignore capabilities\&. Most dangerous mode\&. The behaviour is implementation dependent\&. Try to not use it until really required\&. -.sp -For example, this option can be used in case -\fB\-\-cpu\-cap=cpu\fR -was used during -\fBdump\fR, and images are migrated to a less capable CPU and are to be restored\&. By default, -\fBcriu\fR -shows an error that CPU capabilities are not adequate, but this can be suppressed by using -\fB\-\-cpu\-cap=none\fR\&. -.PP -\fB\-\-weak\-sysctls\fR -.RS 4 -Silently skip restoring sysctls that are not available\&. This allows to restore on an older kernel, or a kernel configured without some options\&. -.RE -.PP -\fB\-\-lazy\-pages\fR -.RS 4 -Restore the processes without filling out the entire memory contents\&. When this option is used, -\fBrestore\fR -sets up the infrastructure required to fill memory pages either on demand when the process accesses them or in the background without stopping the restored process\&. This option requires running -\fBlazy\-pages\fR -daemon\&. -.RE -.RE -.SS "check" -.sp -Checks whether the kernel supports the features needed by \fBcriu\fR to dump and restore a process tree\&. -.sp -There are three categories of kernel support, as described below\&. \fBcriu check\fR always checks Category 1 features unless \fB\-\-feature\fR is specified which only checks a specified feature\&. -.PP -\fBCategory 1\fR -.RS 4 -Absolutely required\&. These are features like support for -\fB/proc/PID/map_files\fR, -\fBNETLINK_SOCK_DIAG\fR -socket monitoring, -\fB/proc/sys/kernel/ns_last_pid\fR -etc\&. -.RE -.PP -\fBCategory 2\fR -.RS 4 -Required only for specific cases\&. These are features like AIO remap, -\fB/dev/net/tun\fR -and others that are only required if a process being dumped or restored is using those\&. -.RE -.PP -\fBCategory 3\fR -.RS 4 -Experimental\&. These are features like -\fBtask\-diag\fR -that are used for experimental purposes (mostly during development)\&. -.RE -.sp -If there are no errors or warnings, \fBcriu\fR prints "Looks good\&." and its exit code is 0\&. -.sp -A missing Category 1 feature causes \fBcriu\fR to print "Does not look good\&." and its exit code is non\-zero\&. -.sp -Missing Category 2 and 3 features cause \fBcriu\fR to print "Looks good but \&..." and its exit code is be non\-zero\&. -.sp -Without any options, \fBcriu check\fR checks Category 1 features\&. This behavior can be changed by using the following options: -.PP -\fB\-\-extra\fR -.RS 4 -Check kernel support for Category 2 features\&. -.RE -.PP -\fB\-\-experimental\fR -.RS 4 -Check kernel support for Category 3 features\&. -.RE -.PP -\fB\-\-all\fR -.RS 4 -Check kernel support for Category 1, 2, and 3 features\&. -.RE -.PP -\fB\-\-feature\fR \fIname\fR -.RS 4 -Check a specific feature\&. If -\fIname\fR -is -\fBlist\fR, a list of valid kernel feature names that can be checked will be printed\&. -.RE -.SS "page\-server" -.sp -Launches \fBcriu\fR in page server mode\&. -.PP -\fB\-\-daemon\fR -.RS 4 -Runs page server as a daemon (background process)\&. -.RE -.PP -\fB\-\-status\-fd\fR -.RS 4 -Write \e0 to the FD and close it once page\-server is ready to handle requests\&. The status\-fd allows to not daemonize a process and get its exit code at the end\&. It isn\(cqt supposed to use \-\-daemon and \-\-status\-fd together\&. -.RE -.PP -\fB\-\-address\fR \fIaddress\fR -.RS 4 -Page server IP address or hostname\&. -.RE -.PP -\fB\-\-port\fR \fInumber\fR -.RS 4 -Page server port number\&. -.RE -.PP -\fB\-\-ps\-socket\fR \fIfd\fR -.RS 4 -Use provided file descriptor as socket for incoming connection\&. In this case \-\-address and \-\-port are ignored\&. Useful for intercepting page\-server traffic e\&.g\&. to add encryption or authentication\&. -.RE -.PP -\fB\-\-lazy\-pages\fR -.RS 4 -Serve local memory dump to a remote -\fBlazy\-pages\fR -daemon\&. In this mode the -\fBpage\-server\fR -reads local memory dump and allows the remote -\fBlazy\-pages\fR -daemon to request memory pages in random order\&. -.RE -.SS "lazy\-pages" -.sp -Launches \fBcriu\fR in lazy\-pages daemon mode\&. -.sp -The \fBlazy\-pages\fR daemon is responsible for managing user\-level demand paging for the restored processes\&. It gets information required to fill the process memory pages from the \fBrestore\fR and from the checkpoint directory\&. When a restored process access certain memory page for the first time, the \fBlazy\-pages\fR daemon injects its contents into the process address space\&. The memory pages that are not yet requested by the restored processes are injected in the background\&. -.SS "exec" -.sp -Executes a system call inside a destination task\*(Aqs context\&. This functionality is deprecated; please use \fBCompel\fR instead\&. -.SS "service" -.sp -Launches \fBcriu\fR in RPC daemon mode, where \fBcriu\fR is listening for RPC commands over socket to perform\&. This is convenient for a case where daemon itself is running in a privileged (superuser) mode but clients are not\&. -.SS "dedup" -.sp -Starts pagemap data deduplication procedure, where \fBcriu\fR scans over all pagemap files and tries to minimize the number of pagemap entries by obtaining the references from a parent pagemap image\&. -.SS "cpuinfo dump" -.sp -Fetches current CPU features and write them into an image file\&. -.SS "cpuinfo check" -.sp -Fetches current CPU features (i\&.e\&. CPU the \fBcriu\fR is running on) and test if they are compatible with the ones present in an image file\&. -.SH "CONFIGURATION FILES" -.sp -\fBCriu\fR supports usage of configuration files to avoid the need of writing every option on command line, which is useful especially with repeated usage of same options\&. A specific configuration file can be passed with the "\fB\-\-config\fR \fIfile\fR" option\&. If no file is passed, the default configuration files \fI/etc/criu/default\&.conf\fR and \fI$HOME/\&.criu/default\&.conf\fR are parsed (if present on the system)\&. If the environment variable CRIU_CONFIG_FILE is set, it will also be parsed\&. -.sp -The options passed to CRIU via CLI, RPC or configuration file are evaluated in the following order: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -apply_config(/etc/criu/default\&.conf) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -apply_config($HOME/\&.criu/default\&.conf) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -apply_config(CRIU_CONFIG_FILE) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -apply_config(\fB\-\-config\fR -\fIfile\fR) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -apply_config(CLI) or apply_config(RPC) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -apply_config(RPC configuration file) (only for RPC mode) -.RE -.sp -Default configuration file parsing can be deactivated with "\fB\-\-no\-default\-config\fR" if needed\&. Parsed configuration files are merged with command line options, which allows overriding boolean options\&. -.SS "Configuration file syntax" -.sp -Comments are supported using \*(Aq#\*(Aq sign\&. The rest of the line is ignored\&. Options are the same as command line options without the \*(Aq\-\-\*(Aq prefix, use one option per line (with corresponding argument if applicable, divided by whitespaces)\&. If needed, the argument can be provided in double quotes (this should be needed only if the argument contains whitespaces)\&. In case this type of argument contains a literal double quote as well, it can be escaped using the \*(Aq\e\*(Aq sign\&. Usage of commands is disallowed and all other escape sequences are interpreted literally\&. -.sp -Example of configuration file to illustrate syntax: -.sp -.if n \{\ -.RS 4 -.\} -.fam C -.ps -1 -.nf -.BB lightgray -$ cat ~/\&.criu/default\&.conf -tcp\-established -work\-dir "/home/USERNAME/criu/my \e"work\e" directory" -#this is a comment -no\-restore\-sibling # this is another comment -.EB lightgray -.fi -.fam -.ps +1 -.if n \{\ -.RE -.\} -.SS "Configuration files in RPC mode" -.sp -Not only does \fBcriu\fR evaluate configuration files in CLI mode, it also evaluates configuration files in RPC mode\&. Just as in CLI mode the configuration file values are evaluated first\&. This means that any option set via RPC will overwrite the configuration file setting\&. The user can thus change \fBcriu\fR\*(Aqs default behavior but it is not possible to change settings which are explicitly set by the RPC client\&. -.sp -The RPC client can, however, specify an additional configuration file which will be evaluated after the RPC options (see above for option evaluation order)\&. The RPC client can specify this additional configuration file via "req\&.opts\&.config_file = \fI/path/to/file\fR"\&. The values from this configuration file will overwrite all other configuration file settings or RPC options\&. \fBThis can lead to undesired behavior of criu and should only be used carefully\&.\fR -.SH "EXAMPLES" -.sp -To checkpoint a program with pid of \fB1234\fR and write all image files into directory \fBcheckpoint\fR: -.sp -.if n \{\ -.RS 4 -.\} -.fam C -.ps -1 -.nf -.BB lightgray - criu dump \-D checkpoint \-t 1234 -.EB lightgray -.fi -.fam -.ps +1 -.if n \{\ -.RE -.\} -.sp -To restore this program detaching criu itself: -.sp -.if n \{\ -.RS 4 -.\} -.fam C -.ps -1 -.nf -.BB lightgray - criu restore \-d \-D checkpoint -.EB lightgray -.fi -.fam -.ps +1 -.if n \{\ -.RE -.\} -.SH "AUTHOR" -.sp -The CRIU team\&. -.SH "COPYRIGHT" -.sp -Copyright (C) 2011\-2016, Parallels Holdings, Inc\&. diff --git a/criu.spec b/criu.spec index 5d9315d..f0ebb52 100644 --- a/criu.spec +++ b/criu.spec @@ -1,10 +1,5 @@ -%if 0%{?fedora} >= 27 || 0%{?rhel} > 7 %global py_prefix python3 %global py_binary %{py_prefix} -%else -%global py_prefix python -%global py_binary python2 -%endif # With annobin enabled, CRIU does not work anymore. It seems CRIU's # parasite code breaks if annobin is enabled. @@ -17,9 +12,9 @@ Name: criu Version: 3.18 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Tool for Checkpoint/Restore in User-space -License: GPLv2 +License: GPL-2.0-only AND LGPL-2.1-only AND MIT URL: http://criu.org/ Source0: https://github.com/checkpoint-restore/criu/archive/v%{version}/criu-%{version}.tar.gz @@ -31,26 +26,12 @@ Patch0: https://github.com/checkpoint-restore/criu/commit/d739260c57576c636759af # in RPM and DEB is different. Patch99: criu.pc.patch -%if 0%{?rhel} && 0%{?rhel} <= 7 -BuildRequires: perl -# RHEL has no asciidoc; take man-page from Fedora 26 -# zcat /usr/share/man/man8/criu.8.gz > criu.8 -Source1: criu.8 -Source2: crit.1 -Source3: criu-ns.1 - -# The patch aio-fix.patch is needed as RHEL7 -# doesn't do "nr_events *= 2" in ioctx_alloc(). -Patch100: aio-fix.patch -%endif - Source5: criu-tmpfiles.conf BuildRequires: gcc BuildRequires: systemd BuildRequires: libnet-devel BuildRequires: protobuf-devel protobuf-c-devel %{py_prefix}-devel libnl3-devel libcap-devel -%if 0%{?fedora} || 0%{?rhel} > 7 BuildRequires: %{py_prefix}-pip BuildRequires: %{py_prefix}-setuptools BuildRequires: %{py_prefix}-wheel @@ -64,7 +45,6 @@ Recommends: tar BuildRequires: libbsd-devel BuildRequires: nftables-devel %endif -%endif BuildRequires: make # user-space and kernel changes are only available for x86_64, arm, @@ -77,7 +57,6 @@ criu is the user-space part of Checkpoint/Restore in User-space (CRIU), a project to implement checkpoint/restore functionality for Linux in user-space. -%if 0%{?fedora} || 0%{?rhel} > 7 %package devel Summary: Header files and libraries for %{name} Requires: %{name} = %{version}-%{release} @@ -92,18 +71,11 @@ Requires: %{name} = %{version}-%{release} %description libs This package contains the libraries for %{name} -%endif %package -n %{py_prefix}-%{name} %{?python_provide:%python_provide %{py_prefix}-%{name}} Summary: Python bindings for %{name} -%if 0%{?rhel} && 0%{?rhel} <= 7 -Requires: protobuf-python -Requires: %{name} = %{version}-%{release} %{py_prefix}-ipaddr -%else Requires: %{py_prefix}-protobuf -Obsoletes: python2-criu < 3.10-1 -%endif %description -n %{py_prefix}-%{name} %{py_prefix}-%{name} contains Python bindings for %{name}. @@ -130,10 +102,6 @@ This script can help to workaround the so called "PID mismatch" problem. %patch -P 0 -p1 %patch -P 99 -p1 -%if 0%{?rhel} && 0%{?rhel} <= 7 -%patch -P 100 -p1 -%endif - %build # This package calls LD directly without specifying the LTO plugins. Until # that is fixed, disable LTO. @@ -142,9 +110,7 @@ This script can help to workaround the so called "PID mismatch" problem. # %{?_smp_mflags} does not work # -fstack-protector breaks build CFLAGS+=`echo %{optflags} | sed -e 's,-fstack-protector\S*,,g'` make V=1 WERROR=0 PREFIX=%{_prefix} RUNDIR=/run/criu PYTHON=%{py_binary} -%if 0%{?fedora} || 0%{?rhel} > 7 make docs V=1 -%endif %install @@ -152,45 +118,25 @@ sed -e "s,--upgrade --force-reinstall,--disable-pip-version-check --progress-bar rm -f crit/pyproject.toml make install-criu DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} make install-lib DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} PYTHON=%{py_binary} -%if 0%{?fedora} || 0%{?rhel} > 7 -# only install documentation on Fedora as it requires asciidoc, -# which is not available on RHEL7 make install-man DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} rm -f $RPM_BUILD_ROOT%{_mandir}/man1/compel.1 rm -f $RPM_BUILD_ROOT%{_mandir}/man1/amdgpu_plugin.1 -%else -install -p -m 644 -D %{SOURCE1} $RPM_BUILD_ROOT%{_mandir}/man8/%{name}.8 -install -p -m 644 -D %{SOURCE2} $RPM_BUILD_ROOT%{_mandir}/man1/crit.1 -install -p -m 644 -D %{SOURCE3} $RPM_BUILD_ROOT%{_mandir}/man1/criu-ns.1 -rm -f compel.1 amdgpu_plugin.1 -%endif mkdir -p %{buildroot}%{_tmpfilesdir} install -m 0644 %{SOURCE5} %{buildroot}%{_tmpfilesdir}/%{name}.conf install -d -m 0755 %{buildroot}/run/%{name}/ -%if 0%{?rhel} && 0%{?rhel} <= 7 -# remove devel and libs packages -rm -rf $RPM_BUILD_ROOT%{_includedir}/criu -rm $RPM_BUILD_ROOT%{_libdir}/*.so* -rm -rf $RPM_BUILD_ROOT%{_libdir}/pkgconfig -rm -rf $RPM_BUILD_ROOT%{_libexecdir}/%{name} -%endif - # remove static lib rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %files %{_sbindir}/%{name} %doc %{_mandir}/man8/criu.8* -%if 0%{?fedora} || 0%{?rhel} > 7 %{_libexecdir}/%{name} -%endif %dir /run/%{name} %{_tmpfilesdir}/%{name}.conf %doc README.md COPYING -%if 0%{?fedora} || 0%{?rhel} > 7 %files devel %{_includedir}/criu %{_libdir}/*.so @@ -198,15 +144,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %files libs %{_libdir}/*.so.* -%endif %files -n %{py_prefix}-%{name} -%if 0%{?rhel} && 0%{?rhel} <= 7 -%{python2_sitelib}/pycriu/* -%{python2_sitelib}/*egg-info -%else %{python3_sitelib}/pycriu/* -%endif %files -n crit %{_bindir}/crit @@ -218,10 +158,14 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %doc %{_mandir}/man1/criu-ns.1* %changelog +* Thu Jul 06 2023 Adrian Reber - 3.18-3 +- migrated to SPDX license +- remove RHEL 7 conditionals + * Tue Jun 13 2023 Python Maint - 3.18-2 - Rebuilt for Python 3.12 -* Tue Apr 25 2034 Adrian Reber - 3.18-1 +* Tue Apr 25 2023 Adrian Reber - 3.18-1 - Update to 3.18 - Apply patch from upstream to support newer CPUs From 43f41b62463c2e119db6f3c613429ac13bbc8b7b Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 19 Jul 2023 16:35:48 +0000 Subject: [PATCH 060/109] Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- criu.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/criu.spec b/criu.spec index f0ebb52..1e42c5b 100644 --- a/criu.spec +++ b/criu.spec @@ -12,7 +12,7 @@ Name: criu Version: 3.18 -Release: 3%{?dist} +Release: 4%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPL-2.0-only AND LGPL-2.1-only AND MIT URL: http://criu.org/ @@ -158,6 +158,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %doc %{_mandir}/man1/criu-ns.1* %changelog +* Wed Jul 19 2023 Fedora Release Engineering - 3.18-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild + * Thu Jul 06 2023 Adrian Reber - 3.18-3 - migrated to SPDX license - remove RHEL 7 conditionals From 23b38e9056e520e668ddd01506e210d0a630507d Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Mon, 31 Jul 2023 13:41:29 -0400 Subject: [PATCH 061/109] Fix s390x build with kernel 6.5 Resolves: rhbz#2225745 --- criu.spec | 3 +++ kernel65-s390x.patch | 26 ++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 kernel65-s390x.patch diff --git a/criu.spec b/criu.spec index 1e42c5b..33bb54e 100644 --- a/criu.spec +++ b/criu.spec @@ -20,6 +20,8 @@ Source0: https://github.com/checkpoint-restore/criu/archive/v%{version}/criu-%{v # Fix to work on CPUs with larger XSAVE area (Sapphire Rapids) Patch0: https://github.com/checkpoint-restore/criu/commit/d739260c57576c636759afb312340fa3827312f6.patch +# https://github.com/checkpoint-restore/criu/pull/2232 +Patch1: kernel65-s390x.patch # Add protobuf-c as a dependency. # We use this patch because the protobuf-c package name @@ -100,6 +102,7 @@ This script can help to workaround the so called "PID mismatch" problem. %prep %setup -q %patch -P 0 -p1 +%patch -P 1 -p1 %patch -P 99 -p1 %build diff --git a/kernel65-s390x.patch b/kernel65-s390x.patch new file mode 100644 index 0000000..9aaad77 --- /dev/null +++ b/kernel65-s390x.patch @@ -0,0 +1,26 @@ +https://github.com/checkpoint-restore/criu/pull/2232 + +diff --git a/compel/arch/s390/src/lib/include/uapi/asm/infect-types.h b/compel/arch/s390/src/lib/include/uapi/asm/infect-types.h +index 87283bc6b..6d55a015f 100644 +--- a/compel/arch/s390/src/lib/include/uapi/asm/infect-types.h ++++ b/compel/arch/s390/src/lib/include/uapi/asm/infect-types.h +@@ -4,6 +4,7 @@ + #include + #include + #include ++#include + #include + #include "common/page.h" + +diff --git a/criu/arch/s390/include/asm/restorer.h b/criu/arch/s390/include/asm/restorer.h +index b8472afc8..1a6469837 100644 +--- a/criu/arch/s390/include/asm/restorer.h ++++ b/criu/arch/s390/include/asm/restorer.h +@@ -1,6 +1,7 @@ + #ifndef __CR_ASM_RESTORER_H__ + #define __CR_ASM_RESTORER_H__ + ++#include + #include + #include + From f6c7edf74c13ca3aee0edefab7b6e8577a172839 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Tue, 28 Nov 2023 14:15:12 +0100 Subject: [PATCH 062/109] Update to 3.19 Signed-off-by: Adrian Reber --- .gitignore | 1 + criu.spec | 20 +++-- ...260c57576c636759afb312340fa3827312f6.patch | 74 ------------------- kernel65-s390x.patch | 26 ------- sources | 2 +- 5 files changed, 11 insertions(+), 112 deletions(-) delete mode 100644 d739260c57576c636759afb312340fa3827312f6.patch delete mode 100644 kernel65-s390x.patch diff --git a/.gitignore b/.gitignore index 5993df3..0d113cc 100644 --- a/.gitignore +++ b/.gitignore @@ -55,3 +55,4 @@ /criu-3.17.tar.gz /criu-3.17.1.tar.gz /criu-3.18.tar.gz +/criu-3.19.tar.gz diff --git a/criu.spec b/criu.spec index 33bb54e..f7383e2 100644 --- a/criu.spec +++ b/criu.spec @@ -11,18 +11,13 @@ %undefine _auto_set_build_flags Name: criu -Version: 3.18 -Release: 4%{?dist} +Version: 3.19 +Release: 1%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPL-2.0-only AND LGPL-2.1-only AND MIT URL: http://criu.org/ Source0: https://github.com/checkpoint-restore/criu/archive/v%{version}/criu-%{version}.tar.gz -# Fix to work on CPUs with larger XSAVE area (Sapphire Rapids) -Patch0: https://github.com/checkpoint-restore/criu/commit/d739260c57576c636759afb312340fa3827312f6.patch -# https://github.com/checkpoint-restore/criu/pull/2232 -Patch1: kernel65-s390x.patch - # Add protobuf-c as a dependency. # We use this patch because the protobuf-c package name # in RPM and DEB is different. @@ -101,8 +96,6 @@ This script can help to workaround the so called "PID mismatch" problem. %prep %setup -q -%patch -P 0 -p1 -%patch -P 1 -p1 %patch -P 99 -p1 %build @@ -121,9 +114,10 @@ sed -e "s,--upgrade --force-reinstall,--disable-pip-version-check --progress-bar rm -f crit/pyproject.toml make install-criu DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} make install-lib DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} PYTHON=%{py_binary} +make install-crit DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} PYTHON=%{py_binary} make install-man DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} rm -f $RPM_BUILD_ROOT%{_mandir}/man1/compel.1 -rm -f $RPM_BUILD_ROOT%{_mandir}/man1/amdgpu_plugin.1 +rm -f $RPM_BUILD_ROOT%{_mandir}/man1/criu-amdgpu-plugin.1 mkdir -p %{buildroot}%{_tmpfilesdir} install -m 0644 %{SOURCE5} %{buildroot}%{_tmpfilesdir}/%{name}.conf @@ -149,11 +143,12 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %{_libdir}/*.so.* %files -n %{py_prefix}-%{name} -%{python3_sitelib}/pycriu/* +%{python3_sitelib}/pycriu* %files -n crit %{_bindir}/crit %{python3_sitelib}/crit-%{version}.dist-info/ +%{python3_sitelib}/crit %doc %{_mandir}/man1/crit.1* %files -n criu-ns @@ -161,6 +156,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %doc %{_mandir}/man1/criu-ns.1* %changelog +* Tue Nov 28 2023 Adrian Reber - 3.19-1 +- Update to 3.19 + * Wed Jul 19 2023 Fedora Release Engineering - 3.18-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild diff --git a/d739260c57576c636759afb312340fa3827312f6.patch b/d739260c57576c636759afb312340fa3827312f6.patch deleted file mode 100644 index 7847bb5..0000000 --- a/d739260c57576c636759afb312340fa3827312f6.patch +++ /dev/null @@ -1,74 +0,0 @@ -From d739260c57576c636759afb312340fa3827312f6 Mon Sep 17 00:00:00 2001 -From: Adrian Reber -Date: Mon, 24 Apr 2023 09:28:19 +0200 -Subject: [PATCH] compel: support XSAVE on newer Intel CPUs - -Newer Intel CPUs (Sapphire Rapids) have a much larger xsave area than -before. Looking at older CPUs I see 2440 bytes. - - # cpuid -1 -l 0xd -s 0 - ... - bytes required by XSAVE/XRSTOR area = 0x00000988 (2440) - -On newer CPUs (Sapphire Rapids) it grows to 11008 bytes. - - # cpuid -1 -l 0xd -s 0 - ... - bytes required by XSAVE/XRSTOR area = 0x00002b00 (11008) - -This increase the xsave area from one page to four pages. - -Without this patch the fpu03 test fails, with this patch it works again. - -Signed-off-by: Adrian Reber ---- - .../arch/x86/src/lib/include/uapi/asm/fpu.h | 28 +++++++++++++++++-- - 1 file changed, 26 insertions(+), 2 deletions(-) - -diff --git a/compel/arch/x86/src/lib/include/uapi/asm/fpu.h b/compel/arch/x86/src/lib/include/uapi/asm/fpu.h -index bd3b0cbd5c..8c83dd9ae4 100644 ---- a/compel/arch/x86/src/lib/include/uapi/asm/fpu.h -+++ b/compel/arch/x86/src/lib/include/uapi/asm/fpu.h -@@ -21,7 +21,28 @@ - #define XSTATE_YMM 0x4 - - #define FXSAVE_SIZE 512 --#define XSAVE_SIZE 4096 -+/* -+ * This used to be 4096 (one page). There is a comment below concerning -+ * this size: -+ * "One page should be enough for the whole xsave state ;-)" -+ * Which is kind of funny as it is no longer enough ;-) -+ * -+ * Older CPUs: -+ * # cpuid -1 -l 0xd -s 0 -+ * ... -+ * bytes required by XSAVE/XRSTOR area = 0x00000988 (2440) -+ * -+ * Newer CPUs (Sapphire Rapids): -+ * # cpuid -1 -l 0xd -s 0 -+ * ... -+ * bytes required by XSAVE/XRSTOR area = 0x00002b00 (11008) -+ * -+ * So one page is no longer enough... But: -+ * -+ * Four pages should be enough for the whole xsave state ;-) -+ */ -+ -+#define XSAVE_SIZE 4*4096 - - #define XSAVE_HDR_SIZE 64 - #define XSAVE_HDR_OFFSET FXSAVE_SIZE -@@ -235,8 +256,11 @@ struct pkru_state { - * - * - * One page should be enough for the whole xsave state ;-) -+ * -+ * Of course it was not ;-) Now using four pages... -+ * - */ --#define EXTENDED_STATE_AREA_SIZE (4096 - sizeof(struct i387_fxsave_struct) - sizeof(struct xsave_hdr_struct)) -+#define EXTENDED_STATE_AREA_SIZE (XSAVE_SIZE - sizeof(struct i387_fxsave_struct) - sizeof(struct xsave_hdr_struct)) - - /* - * cpu requires it to be 64 byte aligned diff --git a/kernel65-s390x.patch b/kernel65-s390x.patch deleted file mode 100644 index 9aaad77..0000000 --- a/kernel65-s390x.patch +++ /dev/null @@ -1,26 +0,0 @@ -https://github.com/checkpoint-restore/criu/pull/2232 - -diff --git a/compel/arch/s390/src/lib/include/uapi/asm/infect-types.h b/compel/arch/s390/src/lib/include/uapi/asm/infect-types.h -index 87283bc6b..6d55a015f 100644 ---- a/compel/arch/s390/src/lib/include/uapi/asm/infect-types.h -+++ b/compel/arch/s390/src/lib/include/uapi/asm/infect-types.h -@@ -4,6 +4,7 @@ - #include - #include - #include -+#include - #include - #include "common/page.h" - -diff --git a/criu/arch/s390/include/asm/restorer.h b/criu/arch/s390/include/asm/restorer.h -index b8472afc8..1a6469837 100644 ---- a/criu/arch/s390/include/asm/restorer.h -+++ b/criu/arch/s390/include/asm/restorer.h -@@ -1,6 +1,7 @@ - #ifndef __CR_ASM_RESTORER_H__ - #define __CR_ASM_RESTORER_H__ - -+#include - #include - #include - diff --git a/sources b/sources index 045b206..bb80cdd 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (criu-3.18.tar.gz) = 3d15554ebd2d08c8904c23b0aba00d505891c14caa4790c2fd12ad6b20bf4058fd210f1d03fd63aacc5ad8bc47e341396b48abbeb474f1fd43c3023fd1ff9171 +SHA512 (criu-3.19.tar.gz) = d243818cdac51580c952a80e9164786a67ce5e294c0faa6dc700f5e8da8e36495f0b64f5c27b345ede7d6697ed7a69fa4e9a85cef451f32e3ffeb78564884571 From 1143b7ede1d22c91272da77022d2d79096a0f49f Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Tue, 28 Nov 2023 15:15:37 +0100 Subject: [PATCH 063/109] Fix Python libraries Signed-off-by: Adrian Reber --- criu.spec | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/criu.spec b/criu.spec index f7383e2..903f916 100644 --- a/criu.spec +++ b/criu.spec @@ -110,8 +110,7 @@ make docs V=1 %install -sed -e "s,--upgrade --force-reinstall,--disable-pip-version-check --progress-bar off --verbose,g" -i lib/Makefile -rm -f crit/pyproject.toml +sed -e "s,--upgrade --ignore-installed,--no-index --no-deps -v --no-build-isolation,g" -i lib/Makefile -i crit/Makefile make install-criu DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} make install-lib DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} PYTHON=%{py_binary} make install-crit DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} PYTHON=%{py_binary} From 49bf9133bf83873b4ba2218ea1d4fb22cead960c Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Tue, 28 Nov 2023 15:28:04 +0100 Subject: [PATCH 064/109] python3-protobuf is now also required during build-time Signed-off-by: Adrian Reber --- criu.spec | 1 + 1 file changed, 1 insertion(+) diff --git a/criu.spec b/criu.spec index 903f916..96b53cd 100644 --- a/criu.spec +++ b/criu.spec @@ -32,6 +32,7 @@ BuildRequires: protobuf-devel protobuf-c-devel %{py_prefix}-devel libnl3-devel l BuildRequires: %{py_prefix}-pip BuildRequires: %{py_prefix}-setuptools BuildRequires: %{py_prefix}-wheel +BuildRequires: %{py_prefix}-protobuf BuildRequires: asciidoctor BuildRequires: perl-interpreter BuildRequires: libselinux-devel From e6dcdedc24310b44377ba4ddfebf4d1d98b16254 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Tue, 28 Nov 2023 17:07:58 +0100 Subject: [PATCH 065/109] Fix test setup Signed-off-by: Adrian Reber --- criu.spec | 5 ++++- tests/run-zdtm.sh | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/criu.spec b/criu.spec index 96b53cd..fc7c466 100644 --- a/criu.spec +++ b/criu.spec @@ -12,7 +12,7 @@ Name: criu Version: 3.19 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPL-2.0-only AND LGPL-2.1-only AND MIT URL: http://criu.org/ @@ -156,6 +156,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %doc %{_mandir}/man1/criu-ns.1* %changelog +* Tue Nov 28 2023 Adrian Reber - 3.19-2 +- Fix test setup + * Tue Nov 28 2023 Adrian Reber - 3.19-1 - Update to 3.19 diff --git a/tests/run-zdtm.sh b/tests/run-zdtm.sh index 58a1143..56fc8ec 100755 --- a/tests/run-zdtm.sh +++ b/tests/run-zdtm.sh @@ -18,6 +18,9 @@ EXCLUDES=" \ -x zdtm/static/netns_sub \ -x zdtm/static/netns_sub_veth \ -x zdtm/static/file_locks01 \ + -x zdtm/static/mntns_link_remap \ + -x zdtm/static/unlink_fstat03 \ + -x zdtm/static/unlink_regular00 \ -x zdtm/static/cgroup02 " run_test() { From b9573a9dde28eb242d05d72e1ef0d21077d1b7f2 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 19 Jan 2024 16:22:09 +0000 Subject: [PATCH 066/109] Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild --- criu.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/criu.spec b/criu.spec index fc7c466..069313d 100644 --- a/criu.spec +++ b/criu.spec @@ -12,7 +12,7 @@ Name: criu Version: 3.19 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPL-2.0-only AND LGPL-2.1-only AND MIT URL: http://criu.org/ @@ -156,6 +156,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %doc %{_mandir}/man1/criu-ns.1* %changelog +* Fri Jan 19 2024 Fedora Release Engineering - 3.19-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + * Tue Nov 28 2023 Adrian Reber - 3.19-2 - Fix test setup From 9c81549f7c39102b9c14f7e2890fe237413aadc4 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 24 Jan 2024 08:25:54 +0000 Subject: [PATCH 067/109] Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild --- criu.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/criu.spec b/criu.spec index 069313d..124125c 100644 --- a/criu.spec +++ b/criu.spec @@ -12,7 +12,7 @@ Name: criu Version: 3.19 -Release: 3%{?dist} +Release: 4%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPL-2.0-only AND LGPL-2.1-only AND MIT URL: http://criu.org/ @@ -156,6 +156,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %doc %{_mandir}/man1/criu-ns.1* %changelog +* Wed Jan 24 2024 Fedora Release Engineering - 3.19-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + * Fri Jan 19 2024 Fedora Release Engineering - 3.19-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild From 050d3e5ab64f466429248ddcdc6a49cd76e3829f Mon Sep 17 00:00:00 2001 From: Python Maint Date: Sat, 8 Jun 2024 10:28:10 +0200 Subject: [PATCH 068/109] Rebuilt for Python 3.13 --- criu.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/criu.spec b/criu.spec index 124125c..bded088 100644 --- a/criu.spec +++ b/criu.spec @@ -12,7 +12,7 @@ Name: criu Version: 3.19 -Release: 4%{?dist} +Release: 5%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPL-2.0-only AND LGPL-2.1-only AND MIT URL: http://criu.org/ @@ -156,6 +156,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %doc %{_mandir}/man1/criu-ns.1* %changelog +* Sat Jun 08 2024 Python Maint - 3.19-5 +- Rebuilt for Python 3.13 + * Wed Jan 24 2024 Fedora Release Engineering - 3.19-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild From dc9cdd23f3453af3ec7e77d0d8ab33cb06f2c32d Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Fri, 12 Jul 2024 18:57:41 +0100 Subject: [PATCH 069/109] test: fix run-zdtm.sh Signed-off-by: Radostin Stoyanov --- tests/run-zdtm.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/run-zdtm.sh b/tests/run-zdtm.sh index 56fc8ec..aed8136 100755 --- a/tests/run-zdtm.sh +++ b/tests/run-zdtm.sh @@ -40,7 +40,7 @@ python -V # this socket brakes CRIU's test cases rm -f /var/lib/sss/pipes/nss -cd source +cd "source/criu-$(crit --version)/" echo "Build CRIU" make From c9cb1e293f99e90ec55c50676a20ec4d465d0c45 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Fri, 12 Jul 2024 18:59:24 +0100 Subject: [PATCH 070/109] test/run-zdtm: exit immediately on non-zero status Signed-off-by: Radostin Stoyanov --- tests/run-zdtm.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/run-zdtm.sh b/tests/run-zdtm.sh index aed8136..9368312 100755 --- a/tests/run-zdtm.sh +++ b/tests/run-zdtm.sh @@ -1,6 +1,6 @@ #!/bin/bash -set -x +set -xe uname -a From 5086e04ef3df865f31c516a196d790303c57ffb7 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Fri, 12 Jul 2024 19:00:41 +0100 Subject: [PATCH 071/109] test/run-zdtm: drop compatibility with python2 Signed-off-by: Radostin Stoyanov --- tests/run-zdtm.sh | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/tests/run-zdtm.sh b/tests/run-zdtm.sh index 9368312..ee4cc97 100755 --- a/tests/run-zdtm.sh +++ b/tests/run-zdtm.sh @@ -24,7 +24,7 @@ EXCLUDES=" \ -x zdtm/static/cgroup02 " run_test() { - ./zdtm.py run --criu-bin /usr/sbin/criu ${EXCLUDES} \ + python3 ./zdtm.py run --criu-bin /usr/sbin/criu ${EXCLUDES} \ -a --ignore-taint --keep-going RESULT=$? @@ -33,10 +33,6 @@ run_test() { RESULT=42 -# F30, F29 do not provide python -> python3 symlink -test -e /usr/bin/python || ln -sf /usr/bin/python3 /usr/bin/python -python -V - # this socket brakes CRIU's test cases rm -f /var/lib/sss/pipes/nss From e7c93aa9e29eec657f5b6191a45f9cf816fe356e Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Fri, 12 Jul 2024 19:02:08 +0100 Subject: [PATCH 072/109] test/run-zdtm: run make with parallel jobs Signed-off-by: Radostin Stoyanov --- tests/run-zdtm.sh | 2 +- tests/tests.yml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/run-zdtm.sh b/tests/run-zdtm.sh index ee4cc97..460d090 100755 --- a/tests/run-zdtm.sh +++ b/tests/run-zdtm.sh @@ -39,7 +39,7 @@ rm -f /var/lib/sss/pipes/nss cd "source/criu-$(crit --version)/" echo "Build CRIU" -make +make -j"$(nproc)" cd test diff --git a/tests/tests.yml b/tests/tests.yml index 6e498e2..995fd2d 100644 --- a/tests/tests.yml +++ b/tests/tests.yml @@ -16,6 +16,7 @@ - make - gcc - python3 + - coreutils - libnet-devel - protobuf-devel - protobuf-c-devel From 48cbddd4fb7a3b4e5c3c9632445aa9f5428bdf98 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Tue, 9 Jul 2024 12:18:37 +0100 Subject: [PATCH 073/109] Add package for amdgpu-plugin Signed-off-by: Radostin Stoyanov --- criu.spec | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/criu.spec b/criu.spec index bded088..cd2f2e4 100644 --- a/criu.spec +++ b/criu.spec @@ -12,7 +12,7 @@ Name: criu Version: 3.19 -Release: 5%{?dist} +Release: 6%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPL-2.0-only AND LGPL-2.1-only AND MIT URL: http://criu.org/ @@ -37,6 +37,7 @@ BuildRequires: asciidoctor BuildRequires: perl-interpreter BuildRequires: libselinux-devel BuildRequires: gnutls-devel +BuildRequires: libdrm-devel # Checkpointing containers with a tmpfs requires tar Recommends: tar %if 0%{?fedora} @@ -70,6 +71,13 @@ Requires: %{name} = %{version}-%{release} %description libs This package contains the libraries for %{name} +%package amdgpu-plugin +Summary: AMD GPU plugin for %{name} +Requires: %{name} = %{version}-%{release} + +%description amdgpu-plugin +This package contains the AMD GPU plugin for %{name} + %package -n %{py_prefix}-%{name} %{?python_provide:%python_provide %{py_prefix}-%{name}} Summary: Python bindings for %{name} @@ -106,7 +114,8 @@ This script can help to workaround the so called "PID mismatch" problem. # %{?_smp_mflags} does not work # -fstack-protector breaks build -CFLAGS+=`echo %{optflags} | sed -e 's,-fstack-protector\S*,,g'` make V=1 WERROR=0 PREFIX=%{_prefix} RUNDIR=/run/criu PYTHON=%{py_binary} +CFLAGS+=`echo %{optflags} | sed -e 's,-fstack-protector\S*,,g'` make V=1 WERROR=0 PREFIX=%{_prefix} RUNDIR=/run/criu PYTHON=%{py_binary} PLUGINDIR=%{_libdir}/criu +make V=1 WERROR=0 PREFIX=%{_prefix} PLUGINDIR=%{_libdir}/criu amdgpu_plugin make docs V=1 @@ -114,15 +123,18 @@ make docs V=1 sed -e "s,--upgrade --ignore-installed,--no-index --no-deps -v --no-build-isolation,g" -i lib/Makefile -i crit/Makefile make install-criu DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} make install-lib DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} PYTHON=%{py_binary} +make install-amdgpu_plugin DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} PLUGINDIR=%{_libdir}/criu make install-crit DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} PYTHON=%{py_binary} make install-man DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} rm -f $RPM_BUILD_ROOT%{_mandir}/man1/compel.1 -rm -f $RPM_BUILD_ROOT%{_mandir}/man1/criu-amdgpu-plugin.1 mkdir -p %{buildroot}%{_tmpfilesdir} install -m 0644 %{SOURCE5} %{buildroot}%{_tmpfilesdir}/%{name}.conf install -d -m 0755 %{buildroot}/run/%{name}/ +# Fix rpmlint W: unstripped-binary-or-object /usr/lib64/criu/amdgpu_plugin.so +chmod 755 $RPM_BUILD_ROOT%{_libdir}/%{name}/amdgpu_plugin.so + # remove static lib rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a @@ -142,6 +154,10 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %files libs %{_libdir}/*.so.* +%files amdgpu-plugin +%{_libdir}/%{name}/amdgpu_plugin.so +%doc %{_mandir}/man1/criu-amdgpu-plugin.1* + %files -n %{py_prefix}-%{name} %{python3_sitelib}/pycriu* @@ -156,6 +172,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %doc %{_mandir}/man1/criu-ns.1* %changelog +* Tue Jul 09 2024 Radostin Stoyanov - 3.19-6 +- Add package for amdgpu-plugin + * Sat Jun 08 2024 Python Maint - 3.19-5 - Rebuilt for Python 3.13 From 83547af2bd965532be883aaffac2891fdf9ea01b Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Tue, 9 Jul 2024 19:06:48 +0100 Subject: [PATCH 074/109] Apply docs-update-amdgpu-plugin-man-page patch Signed-off-by: Radostin Stoyanov --- criu.spec | 2 ++ docs-update-amdgpu-plugin-man-page.patch | 38 ++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 docs-update-amdgpu-plugin-man-page.patch diff --git a/criu.spec b/criu.spec index cd2f2e4..df677d2 100644 --- a/criu.spec +++ b/criu.spec @@ -22,6 +22,7 @@ Source0: https://github.com/checkpoint-restore/criu/archive/v%{version}/criu-%{v # We use this patch because the protobuf-c package name # in RPM and DEB is different. Patch99: criu.pc.patch +Patch100: docs-update-amdgpu-plugin-man-page.patch Source5: criu-tmpfiles.conf @@ -106,6 +107,7 @@ This script can help to workaround the so called "PID mismatch" problem. %prep %setup -q %patch -P 99 -p1 +%patch -P 100 -p1 %build # This package calls LD directly without specifying the LTO plugins. Until diff --git a/docs-update-amdgpu-plugin-man-page.patch b/docs-update-amdgpu-plugin-man-page.patch new file mode 100644 index 0000000..35a7abc --- /dev/null +++ b/docs-update-amdgpu-plugin-man-page.patch @@ -0,0 +1,38 @@ +From eb4e68e5df4ce1ae4e362af012b1f464ecc63422 Mon Sep 17 00:00:00 2001 +From: Radostin Stoyanov +Date: Tue, 9 Jul 2024 12:22:25 +0100 +Subject: [PATCH] docs: update amdgpu-plugin man page + +This patch updates the dependencies section of the AMDGPU plugin man +page to reflect that the plugin has been merged upstream and to fix a +formatting issue. + +Signed-off-by: Radostin Stoyanov +--- + Documentation/criu-amdgpu-plugin.txt | 8 ++------ + 1 file changed, 2 insertions(+), 6 deletions(-) + +diff --git a/Documentation/criu-amdgpu-plugin.txt b/Documentation/criu-amdgpu-plugin.txt +index 35321a915..68803f3db 100644 +--- a/Documentation/criu-amdgpu-plugin.txt ++++ b/Documentation/criu-amdgpu-plugin.txt +@@ -27,14 +27,10 @@ to criu to allow Checkpoint / Restore with ROCm. + + + Dependencies +-~~~~~~~~~~~~~~ ++------------ + *amdkfd support*:: + In order to snapshot the *VRAM* and other *GPU* device states, we require +- an updated version of amdkfd(amdgpu) driver. The kernel patches are under +- review currently. +- +-*criu 3.16*:: +- This work is rebased on latest criu release available at this time. ++ an updated version of amdkfd(amdgpu) driver. + + OPTIONS + ------- +-- +2.45.2 + From 3a4a2b89bc53d1a5f0ea090c6b89996b82deaa93 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Thu, 11 Jul 2024 17:11:55 +0100 Subject: [PATCH 075/109] Apply plugins-amdgpu-don-t-print-error-for-no-such-process patch Signed-off-by: Radostin Stoyanov --- criu.spec | 2 ++ ...n-t-print-error-for-no-such-process-.patch | 35 +++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 plugins-amdgpu-don-t-print-error-for-no-such-process-.patch diff --git a/criu.spec b/criu.spec index df677d2..3d1b519 100644 --- a/criu.spec +++ b/criu.spec @@ -23,6 +23,7 @@ Source0: https://github.com/checkpoint-restore/criu/archive/v%{version}/criu-%{v # in RPM and DEB is different. Patch99: criu.pc.patch Patch100: docs-update-amdgpu-plugin-man-page.patch +Patch101: plugins-amdgpu-don-t-print-error-for-no-such-process-.patch Source5: criu-tmpfiles.conf @@ -108,6 +109,7 @@ This script can help to workaround the so called "PID mismatch" problem. %setup -q %patch -P 99 -p1 %patch -P 100 -p1 +%patch -P 101 -p1 %build # This package calls LD directly without specifying the LTO plugins. Until diff --git a/plugins-amdgpu-don-t-print-error-for-no-such-process-.patch b/plugins-amdgpu-don-t-print-error-for-no-such-process-.patch new file mode 100644 index 0000000..eaa03fa --- /dev/null +++ b/plugins-amdgpu-don-t-print-error-for-no-such-process-.patch @@ -0,0 +1,35 @@ +From a9cbdad76fa6daf95ea38bd1d5f912d260a84aed Mon Sep 17 00:00:00 2001 +From: David Francis +Date: Tue, 30 Jan 2024 14:59:48 -0500 +Subject: [PATCH] plugin/amdgpu: Don't print error for "No such process" during + resume + +During the late stages of restore, each process being resumed gets +an ioctl call to KFD_CRIU_OP_RESUME. If the process has no kfd +process info, this call with fail with -ESRCH. This is normal +behaviour, so we shouldn't print an error message for it. + +Signed-off-by: David Francis +--- + plugins/amdgpu/amdgpu_plugin.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/plugins/amdgpu/amdgpu_plugin.c b/plugins/amdgpu/amdgpu_plugin.c +index 32ff8f936..3675353a7 100644 +--- a/plugins/amdgpu/amdgpu_plugin.c ++++ b/plugins/amdgpu/amdgpu_plugin.c +@@ -1999,7 +1999,10 @@ int amdgpu_plugin_resume_devices_late(int target_pid) + args.op = KFD_CRIU_OP_RESUME; + pr_info("Calling IOCTL to start notifiers and queues\n"); + if (kmtIoctl(fd, AMDKFD_IOC_CRIU_OP, &args) == -1) { +- pr_perror("restore late ioctl failed"); ++ if (errno == ESRCH) ++ pr_info("Pid %d has no kfd process info\n", target_pid); ++ else ++ pr_perror("restore late ioctl failed"); + ret = -1; + } + +-- +2.45.1 + From 56dd1e4573eb2b1bb827831f832faee72e2b012a Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Thu, 11 Jul 2024 17:13:18 +0100 Subject: [PATCH 076/109] Apply plugins-amdgpu-also-don-t-print-plugin-failed-in-criu patch Signed-off-by: Radostin Stoyanov --- criu.spec | 2 + ...so-don-t-print-plugin-failed-in-criu.patch | 54 +++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 plugins-amdgpu-also-don-t-print-plugin-failed-in-criu.patch diff --git a/criu.spec b/criu.spec index 3d1b519..e3e9daa 100644 --- a/criu.spec +++ b/criu.spec @@ -24,6 +24,7 @@ Source0: https://github.com/checkpoint-restore/criu/archive/v%{version}/criu-%{v Patch99: criu.pc.patch Patch100: docs-update-amdgpu-plugin-man-page.patch Patch101: plugins-amdgpu-don-t-print-error-for-no-such-process-.patch +Patch102: plugins-amdgpu-also-don-t-print-plugin-failed-in-criu.patch Source5: criu-tmpfiles.conf @@ -110,6 +111,7 @@ This script can help to workaround the so called "PID mismatch" problem. %patch -P 99 -p1 %patch -P 100 -p1 %patch -P 101 -p1 +%patch -P 102 -p1 %build # This package calls LD directly without specifying the LTO plugins. Until diff --git a/plugins-amdgpu-also-don-t-print-plugin-failed-in-criu.patch b/plugins-amdgpu-also-don-t-print-plugin-failed-in-criu.patch new file mode 100644 index 0000000..232fd1d --- /dev/null +++ b/plugins-amdgpu-also-don-t-print-plugin-failed-in-criu.patch @@ -0,0 +1,54 @@ +From 639068ecab26096092d460d6bbed10bedb5da0c4 Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Mon, 5 Feb 2024 11:17:40 +0800 +Subject: [PATCH] plugin/amdgpu: Also don't print 'plugin failed' in criu + +We already don't treat it as error in the plugin itself, but after +returning -1 from RESUME_DEVICES_LATE hook we print debug message in +criu about failed plugin, let's return 0 instead. + +While on it let's replace ret to exit_code. + +Fixes: a9cbdad76 ("plugin/amdgpu: Don't print error for "No such process" during resume") +Signed-off-by: Pavel Tikhomirov +--- + plugins/amdgpu/amdgpu_plugin.c | 11 ++++++----- + 1 file changed, 6 insertions(+), 5 deletions(-) + +diff --git a/plugins/amdgpu/amdgpu_plugin.c b/plugins/amdgpu/amdgpu_plugin.c +index 3675353a7..23253632d 100644 +--- a/plugins/amdgpu/amdgpu_plugin.c ++++ b/plugins/amdgpu/amdgpu_plugin.c +@@ -1985,7 +1985,7 @@ CR_PLUGIN_REGISTER_HOOK(CR_PLUGIN_HOOK__UPDATE_VMA_MAP, amdgpu_plugin_update_vma + int amdgpu_plugin_resume_devices_late(int target_pid) + { + struct kfd_ioctl_criu_args args = { 0 }; +- int fd, ret = 0; ++ int fd, exit_code = 0; + + pr_info("Inside %s for target pid = %d\n", __func__, target_pid); + +@@ -1999,15 +1999,16 @@ int amdgpu_plugin_resume_devices_late(int target_pid) + args.op = KFD_CRIU_OP_RESUME; + pr_info("Calling IOCTL to start notifiers and queues\n"); + if (kmtIoctl(fd, AMDKFD_IOC_CRIU_OP, &args) == -1) { +- if (errno == ESRCH) ++ if (errno == ESRCH) { + pr_info("Pid %d has no kfd process info\n", target_pid); +- else ++ } else { + pr_perror("restore late ioctl failed"); +- ret = -1; ++ exit_code = -1; ++ } + } + + close(fd); +- return ret; ++ return exit_code; + } + + CR_PLUGIN_REGISTER_HOOK(CR_PLUGIN_HOOK__RESUME_DEVICES_LATE, amdgpu_plugin_resume_devices_late) +-- +2.45.1 + From 11ad4992a4d524af6c1b332f3bcaa3220a21fbd3 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Thu, 11 Jul 2024 16:59:20 +0100 Subject: [PATCH 077/109] Apply plugins-amdgpu-refactor-code-in-preparation-to-suppor patch Signed-off-by: Radostin Stoyanov --- criu.spec | 4 + ...factor-code-in-preparation-to-suppor.patch | 1013 +++++++++++++++++ 2 files changed, 1017 insertions(+) create mode 100644 plugins-amdgpu-refactor-code-in-preparation-to-suppor.patch diff --git a/criu.spec b/criu.spec index e3e9daa..2b17422 100644 --- a/criu.spec +++ b/criu.spec @@ -25,6 +25,8 @@ Patch99: criu.pc.patch Patch100: docs-update-amdgpu-plugin-man-page.patch Patch101: plugins-amdgpu-don-t-print-error-for-no-such-process-.patch Patch102: plugins-amdgpu-also-don-t-print-plugin-failed-in-criu.patch +Patch103: plugins-amdgpu-refactor-code-in-preparation-to-suppor.patch +Patch104: plugins-amdgpu-refactor-code-used-to-implement-checkp.patch Source5: criu-tmpfiles.conf @@ -112,6 +114,8 @@ This script can help to workaround the so called "PID mismatch" problem. %patch -P 100 -p1 %patch -P 101 -p1 %patch -P 102 -p1 +%patch -P 103 -p1 +%patch -P 104 -p1 %build # This package calls LD directly without specifying the LTO plugins. Until diff --git a/plugins-amdgpu-refactor-code-in-preparation-to-suppor.patch b/plugins-amdgpu-refactor-code-in-preparation-to-suppor.patch new file mode 100644 index 0000000..c83be02 --- /dev/null +++ b/plugins-amdgpu-refactor-code-in-preparation-to-suppor.patch @@ -0,0 +1,1013 @@ +From 81f2c41df6ffee7e4962b1facb17c327676285cc Mon Sep 17 00:00:00 2001 +From: Ramesh Errabolu +Date: Fri, 10 Nov 2023 11:36:34 -0600 +Subject: [PATCH] amdgpu_plugin: Refactor code in preparation to support C&R + for DRM devices + +Add a new compilation unit to host symbols and methods that will be +needed to C&R DRM devices. Refactor code that indicates support for +C&R and checkpoints KFD and DRM devices + +Signed-off-by: Ramesh Errabolu +--- + plugins/amdgpu/Makefile | 2 +- + plugins/amdgpu/amdgpu_plugin.c | 245 ++++-------------------- + plugins/amdgpu/amdgpu_plugin_drm.c | 63 ++++++ + plugins/amdgpu/amdgpu_plugin_drm.h | 22 +++ + plugins/amdgpu/amdgpu_plugin_topology.c | 41 ++-- + plugins/amdgpu/amdgpu_plugin_topology.h | 2 + + plugins/amdgpu/amdgpu_plugin_util.c | 208 ++++++++++++++++++++ + plugins/amdgpu/amdgpu_plugin_util.h | 106 ++++++++++ + plugins/amdgpu/criu-amdgpu.proto | 18 +- + 9 files changed, 460 insertions(+), 247 deletions(-) + create mode 100644 plugins/amdgpu/amdgpu_plugin_drm.c + create mode 100644 plugins/amdgpu/amdgpu_plugin_drm.h + create mode 100755 plugins/amdgpu/amdgpu_plugin_util.c + create mode 100755 plugins/amdgpu/amdgpu_plugin_util.h + +diff --git a/plugins/amdgpu/Makefile b/plugins/amdgpu/Makefile +index 64a923d38..5efa8fb0b 100644 +--- a/plugins/amdgpu/Makefile ++++ b/plugins/amdgpu/Makefile +@@ -28,7 +28,7 @@ endif + criu-amdgpu.pb-c.c: criu-amdgpu.proto + protoc-c --proto_path=. --c_out=. criu-amdgpu.proto + +-amdgpu_plugin.so: amdgpu_plugin.c amdgpu_plugin_topology.c criu-amdgpu.pb-c.c ++amdgpu_plugin.so: amdgpu_plugin.c amdgpu_plugin_drm.c amdgpu_plugin_topology.c amdgpu_plugin_util.c criu-amdgpu.pb-c.c + $(CC) $(PLUGIN_CFLAGS) $(shell $(COMPEL) includes) $^ -o $@ $(PLUGIN_INCLUDE) $(PLUGIN_LDFLAGS) $(LIBDRM_INC) + + amdgpu_plugin_clean: +diff --git a/plugins/amdgpu/amdgpu_plugin.c b/plugins/amdgpu/amdgpu_plugin.c +index 23253632d..60e04f973 100644 +--- a/plugins/amdgpu/amdgpu_plugin.c ++++ b/plugins/amdgpu/amdgpu_plugin.c +@@ -30,55 +30,14 @@ + #include "files.h" + + #include "common/list.h" ++#include "amdgpu_plugin_drm.h" ++#include "amdgpu_plugin_util.h" + #include "amdgpu_plugin_topology.h" + + #include "img-streamer.h" + #include "image.h" + #include "cr_options.h" + +-#define AMDGPU_KFD_DEVICE "/dev/kfd" +-#define PROCPIDMEM "/proc/%d/mem" +-#define HSAKMT_SHM_PATH "/dev/shm/hsakmt_shared_mem" +-#define HSAKMT_SHM "/hsakmt_shared_mem" +-#define HSAKMT_SEM_PATH "/dev/shm/sem.hsakmt_semaphore" +-#define HSAKMT_SEM "hsakmt_semaphore" +- +-#define KFD_IOCTL_MAJOR_VERSION 1 +-#define MIN_KFD_IOCTL_MINOR_VERSION 8 +- +-#define IMG_KFD_FILE "amdgpu-kfd-%d.img" +-#define IMG_RENDERD_FILE "amdgpu-renderD-%d.img" +-#define IMG_PAGES_FILE "amdgpu-pages-%d-%04x.img" +- +-#ifndef _GNU_SOURCE +-#define _GNU_SOURCE 1 +-#endif +- +-#ifdef LOG_PREFIX +-#undef LOG_PREFIX +-#endif +-#define LOG_PREFIX "amdgpu_plugin: " +- +-#ifdef DEBUG +-#define plugin_log_msg(fmt, ...) pr_debug(fmt, ##__VA_ARGS__) +-#else +-#define plugin_log_msg(fmt, ...) \ +- { \ +- } +-#endif +- +-#define SDMA_PACKET(op, sub_op, e) ((((e)&0xFFFF) << 16) | (((sub_op)&0xFF) << 8) | (((op)&0xFF) << 0)) +- +-#define SDMA_OPCODE_COPY 1 +-#define SDMA_COPY_SUB_OPCODE_LINEAR 0 +-#define SDMA_NOP 0 +-#define SDMA_LINEAR_COPY_MAX_SIZE (1ULL << 21) +- +-enum sdma_op_type { +- SDMA_OP_VRAM_READ, +- SDMA_OP_VRAM_WRITE, +-}; +- + struct vma_metadata { + struct list_head list; + uint64_t old_pgoff; +@@ -89,143 +48,13 @@ struct vma_metadata { + }; + + /************************************ Global Variables ********************************************/ +-struct tp_system src_topology; +-struct tp_system dest_topology; +- +-struct device_maps checkpoint_maps; +-struct device_maps restore_maps; +- +-extern int fd_next; + + static LIST_HEAD(update_vma_info_list); + +-extern bool kfd_fw_version_check; +-extern bool kfd_sdma_fw_version_check; +-extern bool kfd_caches_count_check; +-extern bool kfd_num_gws_check; +-extern bool kfd_vram_size_check; +-extern bool kfd_numa_check; +-extern bool kfd_capability_check; +- + size_t kfd_max_buffer_size; + + /**************************************************************************************************/ + +-int write_fp(FILE *fp, const void *buf, const size_t buf_len) +-{ +- size_t len_write; +- +- len_write = fwrite(buf, 1, buf_len, fp); +- if (len_write != buf_len) { +- pr_perror("Unable to write file (wrote:%ld buf_len:%ld)", len_write, buf_len); +- return -EIO; +- } +- return 0; +-} +- +-int read_fp(FILE *fp, void *buf, const size_t buf_len) +-{ +- size_t len_read; +- +- len_read = fread(buf, 1, buf_len, fp); +- if (len_read != buf_len) { +- pr_perror("Unable to read file (read:%ld buf_len:%ld)", len_read, buf_len); +- return -EIO; +- } +- return 0; +-} +- +-/** +- * @brief Open an image file +- * +- * We store the size of the actual contents in the first 8-bytes of the file. This allows us to +- * determine the file size when using criu_image_streamer when fseek and fstat are not available. +- * The FILE * returned is already at the location of the first actual contents. +- * +- * @param path The file path +- * @param write False for read, true for write +- * @param size Size of actual contents +- * @return FILE *if successful, NULL if failed +- */ +-FILE *open_img_file(char *path, bool write, size_t *size) +-{ +- FILE *fp = NULL; +- int fd, ret; +- +- if (opts.stream) +- fd = img_streamer_open(path, write ? O_DUMP : O_RSTR); +- else +- fd = openat(criu_get_image_dir(), path, write ? (O_WRONLY | O_CREAT) : O_RDONLY, 0600); +- +- if (fd < 0) { +- pr_perror("%s: Failed to open for %s", path, write ? "write" : "read"); +- return NULL; +- } +- +- fp = fdopen(fd, write ? "w" : "r"); +- if (!fp) { +- pr_perror("%s: Failed get pointer for %s", path, write ? "write" : "read"); +- close(fd); +- return NULL; +- } +- +- if (write) +- ret = write_fp(fp, size, sizeof(*size)); +- else +- ret = read_fp(fp, size, sizeof(*size)); +- +- if (ret) { +- pr_perror("%s:Failed to access file size", path); +- fclose(fp); +- return NULL; +- } +- +- pr_debug("%s:Opened file for %s with size:%ld\n", path, write ? "write" : "read", *size); +- return fp; +-} +- +-/** +- * @brief Write an image file +- * +- * We store the size of the actual contents in the first 8-bytes of the file. This allows us to +- * determine the file size when using criu_image_streamer when fseek and fstat are not available. +- * +- * @param path The file path +- * @param buf pointer to data to be written +- * @param buf_len size of buf +- * @return 0 if successful. -errno on failure +- */ +-int write_img_file(char *path, const void *buf, const size_t buf_len) +-{ +- int ret; +- FILE *fp; +- size_t len = buf_len; +- +- fp = open_img_file(path, true, &len); +- if (!fp) +- return -errno; +- +- ret = write_fp(fp, buf, buf_len); +- fclose(fp); /* this will also close fd */ +- return ret; +-} +- +-int read_file(const char *file_path, void *buf, const size_t buf_len) +-{ +- int ret; +- FILE *fp; +- +- fp = fopen(file_path, "r"); +- if (!fp) { +- pr_perror("Cannot fopen %s", file_path); +- return -errno; +- } +- +- ret = read_fp(fp, buf, buf_len); +- fclose(fp); /* this will also close fd */ +- return ret; +-} +- + /* Call ioctl, restarting if it is interrupted */ + int kmtIoctl(int fd, unsigned long request, void *arg) + { +@@ -263,21 +92,21 @@ static void free_e(CriuKfd *e) + + static int allocate_device_entries(CriuKfd *e, int num_of_devices) + { +- e->device_entries = xmalloc(sizeof(DeviceEntry *) * num_of_devices); ++ e->device_entries = xmalloc(sizeof(KfdDeviceEntry *) * num_of_devices); + if (!e->device_entries) { + pr_err("Failed to allocate device_entries\n"); + return -ENOMEM; + } + + for (int i = 0; i < num_of_devices; i++) { +- DeviceEntry *entry = xzalloc(sizeof(*entry)); ++ KfdDeviceEntry *entry = xzalloc(sizeof(*entry)); + + if (!entry) { + pr_err("Failed to allocate entry\n"); + return -ENOMEM; + } + +- device_entry__init(entry); ++ kfd_device_entry__init(entry); + + e->device_entries[i] = entry; + e->n_device_entries++; +@@ -287,21 +116,21 @@ static int allocate_device_entries(CriuKfd *e, int num_of_devices) + + static int allocate_bo_entries(CriuKfd *e, int num_bos, struct kfd_criu_bo_bucket *bo_bucket_ptr) + { +- e->bo_entries = xmalloc(sizeof(BoEntry *) * num_bos); ++ e->bo_entries = xmalloc(sizeof(KfdBoEntry *) * num_bos); + if (!e->bo_entries) { + pr_err("Failed to allocate bo_info\n"); + return -ENOMEM; + } + + for (int i = 0; i < num_bos; i++) { +- BoEntry *entry = xzalloc(sizeof(*entry)); ++ KfdBoEntry *entry = xzalloc(sizeof(*entry)); + + if (!entry) { + pr_err("Failed to allocate botest\n"); + return -ENOMEM; + } + +- bo_entry__init(entry); ++ kfd_bo_entry__init(entry); + + e->bo_entries[i] = entry; + e->n_bo_entries++; +@@ -309,13 +138,13 @@ static int allocate_bo_entries(CriuKfd *e, int num_bos, struct kfd_criu_bo_bucke + return 0; + } + +-int topology_to_devinfo(struct tp_system *sys, struct device_maps *maps, DeviceEntry **deviceEntries) ++int topology_to_devinfo(struct tp_system *sys, struct device_maps *maps, KfdDeviceEntry **deviceEntries) + { + uint32_t devinfo_index = 0; + struct tp_node *node; + + list_for_each_entry(node, &sys->nodes, listm_system) { +- DeviceEntry *devinfo = deviceEntries[devinfo_index++]; ++ KfdDeviceEntry *devinfo = deviceEntries[devinfo_index++]; + + devinfo->node_id = node->id; + +@@ -383,11 +212,11 @@ int topology_to_devinfo(struct tp_system *sys, struct device_maps *maps, DeviceE + return 0; + } + +-int devinfo_to_topology(DeviceEntry *devinfos[], uint32_t num_devices, struct tp_system *sys) ++int devinfo_to_topology(KfdDeviceEntry *devinfos[], uint32_t num_devices, struct tp_system *sys) + { + for (int i = 0; i < num_devices; i++) { + struct tp_node *node; +- DeviceEntry *devinfo = devinfos[i]; ++ KfdDeviceEntry *devinfo = devinfos[i]; + + node = sys_add_node(sys, devinfo->node_id, devinfo->gpu_id); + if (!node) +@@ -549,7 +378,7 @@ struct thread_data { + uint32_t gpu_id; + pid_t pid; + struct kfd_criu_bo_bucket *bo_buckets; +- BoEntry **bo_entries; ++ KfdBoEntry **bo_entries; + int drm_fd; + int ret; + int id; /* File ID used by CRIU to identify KFD image for this process */ +@@ -557,8 +386,7 @@ struct thread_data { + + int amdgpu_plugin_handle_device_vma(int fd, const struct stat *st_buf) + { +- struct stat st_kfd, st_dri_min; +- char img_path[128]; ++ struct stat st_kfd; + int ret = 0; + + pr_debug("Enter %s\n", __func__); +@@ -568,27 +396,18 @@ int amdgpu_plugin_handle_device_vma(int fd, const struct stat *st_buf) + return ret; + } + +- snprintf(img_path, sizeof(img_path), "/dev/dri/renderD%d", DRM_FIRST_RENDER_NODE); +- +- ret = stat(img_path, &st_dri_min); +- if (ret == -1) { +- pr_perror("stat error for %s", img_path); +- return ret; +- } +- +- if (major(st_buf->st_rdev) == major(st_kfd.st_rdev) || ((major(st_buf->st_rdev) == major(st_dri_min.st_rdev)) && +- (minor(st_buf->st_rdev) >= minor(st_dri_min.st_rdev) && +- minor(st_buf->st_rdev) >= DRM_FIRST_RENDER_NODE))) { ++ /* If input device is KFD return device as supported */ ++ if (major(st_buf->st_rdev) == major(st_kfd.st_rdev)) { + pr_debug("Known non-regular mapping, kfd-renderD%d -> OK\n", minor(st_buf->st_rdev)); +- pr_debug("AMD KFD(maj) = %d, DRI(maj,min) = %d:%d VMA Device fd(maj,min) = %d:%d\n", +- major(st_kfd.st_rdev), major(st_dri_min.st_rdev), minor(st_dri_min.st_rdev), +- major(st_buf->st_rdev), minor(st_buf->st_rdev)); +- /* VMA belongs to kfd */ + return 0; + } + +- pr_perror("Can't handle the VMA mapping"); +- return -ENOTSUP; ++ /* Determine if input is a DRM device and therefore is supported */ ++ ret = amdgpu_plugin_drm_handle_device_vma(fd, st_buf); ++ if (ret) ++ pr_perror("%s(), Can't handle VMAs of input device\n", __func__); ++ ++ return ret; + } + CR_PLUGIN_REGISTER_HOOK(CR_PLUGIN_HOOK__HANDLE_DEVICE_VMA, amdgpu_plugin_handle_device_vma) + +@@ -655,8 +474,9 @@ void free_and_unmap(uint64_t size, amdgpu_bo_handle h_bo, amdgpu_va_handle h_va, + amdgpu_bo_free(h_bo); + } + +-int sdma_copy_bo(struct kfd_criu_bo_bucket bo_bucket, FILE *storage_fp, void *buffer, size_t buffer_size, +- amdgpu_device_handle h_dev, uint64_t max_copy_size, enum sdma_op_type type) ++static int sdma_copy_bo(struct kfd_criu_bo_bucket bo_bucket, FILE *storage_fp, ++ void *buffer, size_t buffer_size, amdgpu_device_handle h_dev, ++ uint64_t max_copy_size, enum sdma_op_type type) + { + uint64_t size, src_bo_size, dst_bo_size, buffer_bo_size, bytes_remain, buffer_space_remain; + uint64_t gpu_addr_src, gpu_addr_dst, gpu_addr_ib, copy_src, copy_dst, copy_size; +@@ -954,7 +774,7 @@ void *dump_bo_contents(void *_thread_data) + goto exit; + } + +- snprintf(img_path, sizeof(img_path), IMG_PAGES_FILE, thread_data->id, thread_data->gpu_id); ++ snprintf(img_path, sizeof(img_path), IMG_KFD_PAGES_FILE, thread_data->id, thread_data->gpu_id); + bo_contents_fp = open_img_file(img_path, true, &image_size); + if (!bo_contents_fp) { + pr_perror("Cannot fopen %s", img_path); +@@ -1027,7 +847,7 @@ void *restore_bo_contents(void *_thread_data) + max_copy_size = (gpu_info.family_id >= AMDGPU_FAMILY_AI) ? SDMA_LINEAR_COPY_MAX_SIZE : + SDMA_LINEAR_COPY_MAX_SIZE - 1; + +- snprintf(img_path, sizeof(img_path), IMG_PAGES_FILE, thread_data->id, thread_data->gpu_id); ++ snprintf(img_path, sizeof(img_path), IMG_KFD_PAGES_FILE, thread_data->id, thread_data->gpu_id); + bo_contents_fp = open_img_file(img_path, false, &image_size); + if (!bo_contents_fp) { + pr_perror("Cannot fopen %s", img_path); +@@ -1234,7 +1054,7 @@ static int save_bos(int id, int fd, struct kfd_ioctl_criu_args *args, struct kfd + + for (i = 0; i < e->num_of_bos; i++) { + struct kfd_criu_bo_bucket *bo_bucket = &bo_buckets[i]; +- BoEntry *boinfo = e->bo_entries[i]; ++ KfdBoEntry *boinfo = e->bo_entries[i]; + + boinfo->gpu_id = bo_bucket->gpu_id; + boinfo->addr = bo_bucket->addr; +@@ -1391,7 +1211,7 @@ int amdgpu_plugin_dump_file(int fd, int id) + + criu_render_node__pack(&rd, buf); + +- snprintf(img_path, sizeof(img_path), IMG_RENDERD_FILE, id); ++ snprintf(img_path, sizeof(img_path), IMG_DRM_FILE, id); + ret = write_img_file(img_path, buf, len); + if (ret) { + xfree(buf); +@@ -1399,6 +1219,7 @@ int amdgpu_plugin_dump_file(int fd, int id) + } + + xfree(buf); ++ + /* Need to return success here so that criu can call plugins for renderD nodes */ + return ret; + } +@@ -1531,7 +1352,7 @@ static int restore_devices(struct kfd_ioctl_criu_args *args, CriuKfd *e) + + for (int entries_i = 0; entries_i < e->num_of_cpus + e->num_of_gpus; entries_i++) { + struct kfd_criu_device_bucket *device_bucket; +- DeviceEntry *devinfo = e->device_entries[entries_i]; ++ KfdDeviceEntry *devinfo = e->device_entries[entries_i]; + struct tp_node *tp_node; + + if (!devinfo->gpu_id) +@@ -1581,7 +1402,7 @@ static int restore_bos(struct kfd_ioctl_criu_args *args, CriuKfd *e) + + for (int i = 0; i < args->num_bos; i++) { + struct kfd_criu_bo_bucket *bo_bucket = &bo_buckets[i]; +- BoEntry *bo_entry = e->bo_entries[i]; ++ KfdBoEntry *bo_entry = e->bo_entries[i]; + + bo_bucket->gpu_id = bo_entry->gpu_id; + bo_bucket->addr = bo_entry->addr; +@@ -1736,7 +1557,7 @@ int amdgpu_plugin_restore_file(int id) + * TODO: Currently, this code will only work if this function is called for /dev/kfd + * first as we assume restore_maps is already filled. Need to fix this later. + */ +- snprintf(img_path, sizeof(img_path), IMG_RENDERD_FILE, id); ++ snprintf(img_path, sizeof(img_path), IMG_DRM_FILE, id); + pr_info("Restoring RenderD %s\n", img_path); + + img_fp = open_img_file(img_path, false, &img_size); +diff --git a/plugins/amdgpu/amdgpu_plugin_drm.c b/plugins/amdgpu/amdgpu_plugin_drm.c +new file mode 100644 +index 000000000..a48dc68f0 +--- /dev/null ++++ b/plugins/amdgpu/amdgpu_plugin_drm.c +@@ -0,0 +1,63 @@ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include "common/list.h" ++ ++#include "criu-amdgpu.pb-c.h" ++ ++#include ++#include ++ ++#include "xmalloc.h" ++#include "criu-log.h" ++#include "kfd_ioctl.h" ++#include "amdgpu_plugin_drm.h" ++#include "amdgpu_plugin_util.h" ++#include "amdgpu_plugin_topology.h" ++ ++ ++int amdgpu_plugin_drm_handle_device_vma(int fd, const struct stat *st) ++{ ++ char path[PATH_MAX]; ++ struct stat drm; ++ int ret = 0; ++ ++ snprintf(path, sizeof(path), AMDGPU_DRM_DEVICE, DRM_FIRST_RENDER_NODE); ++ ret = stat(path, &drm); ++ if (ret == -1) { ++ pr_err("Error in getting stat for: %s", path); ++ return ret; ++ } ++ ++ if ((major(st->st_rdev) != major(drm.st_rdev)) || ++ (minor(st->st_rdev) < minor(drm.st_rdev)) || ++ (minor(st->st_rdev) > DRM_LAST_RENDER_NODE)) { ++ pr_err("Can't handle VMA mapping of input device\n"); ++ return -ENOTSUP; ++ } ++ ++ pr_debug("AMD DRI(maj,min) = %d:%d VMA Device FD(maj,min) = %d:%d\n", ++ major(drm.st_rdev), minor(drm.st_rdev), ++ major(st->st_rdev), minor(st->st_rdev)); ++ ++ return 0; ++} ++ ++ +diff --git a/plugins/amdgpu/amdgpu_plugin_drm.h b/plugins/amdgpu/amdgpu_plugin_drm.h +new file mode 100644 +index 000000000..37009c8ba +--- /dev/null ++++ b/plugins/amdgpu/amdgpu_plugin_drm.h +@@ -0,0 +1,22 @@ ++#ifndef __AMDGPU_PLUGIN_DRM_H__ ++#define __AMDGPU_PLUGIN_DRM_H__ ++ ++#include ++#include "common/list.h" ++ ++#include "xmalloc.h" ++#include "criu-log.h" ++#include "kfd_ioctl.h" ++#include "amdgpu_plugin_util.h" ++#include "amdgpu_plugin_topology.h" ++ ++ ++/** ++ * Determines if VMA's of input file descriptor belong to amdgpu's ++ * DRM device and are therefore supported ++ */ ++int amdgpu_plugin_drm_handle_device_vma(int fd, const struct stat *drm); ++ ++ ++#endif /* __AMDGPU_PLUGIN_DRM_H__ */ ++ +diff --git a/plugins/amdgpu/amdgpu_plugin_topology.c b/plugins/amdgpu/amdgpu_plugin_topology.c +index ef79e5ef4..c5fa51fda 100644 +--- a/plugins/amdgpu/amdgpu_plugin_topology.c ++++ b/plugins/amdgpu/amdgpu_plugin_topology.c +@@ -16,35 +16,11 @@ + + #include "xmalloc.h" + #include "kfd_ioctl.h" ++#include "amdgpu_plugin_util.h" + #include "amdgpu_plugin_topology.h" + + #define TOPOLOGY_PATH "/sys/class/kfd/kfd/topology/nodes/" + +-#ifndef _GNU_SOURCE +-#define _GNU_SOURCE 1 +-#endif +- +-#ifdef COMPILE_TESTS +-#undef pr_err +-#define pr_err(format, arg...) fprintf(stdout, "%s:%d ERROR:" format, __FILE__, __LINE__, ##arg) +-#undef pr_info +-#define pr_info(format, arg...) fprintf(stdout, "%s:%d INFO:" format, __FILE__, __LINE__, ##arg) +-#undef pr_debug +-#define pr_debug(format, arg...) fprintf(stdout, "%s:%d DBG:" format, __FILE__, __LINE__, ##arg) +- +-#undef pr_perror +-#define pr_perror(format, arg...) \ +- fprintf(stdout, "%s:%d: " format " (errno = %d (%s))\n", __FILE__, __LINE__, ##arg, errno, strerror(errno)) +-#endif +- +-#ifdef DEBUG +-#define plugin_log_msg(fmt, ...) pr_debug(fmt, ##__VA_ARGS__) +-#else +-#define plugin_log_msg(fmt, ...) \ +- { \ +- } +-#endif +- + /* User override options */ + /* Skip firmware version check */ + bool kfd_fw_version_check = true; +@@ -840,6 +816,9 @@ void topology_free(struct tp_system *sys) + list_del(&p2pgroup->listm_system); + xfree(p2pgroup); + } ++ ++ /* Update Topology as being freed */ ++ sys->parsed = false; + } + + /** +@@ -1461,3 +1440,15 @@ int set_restore_gpu_maps(struct tp_system *src_sys, struct tp_system *dest_sys, + + return ret; + } ++ ++int topology_gpu_count(struct tp_system *sys) ++{ ++ struct tp_node *node; ++ int count = 0; ++ ++ list_for_each_entry(node, &sys->nodes, listm_system) ++ if (NODE_IS_GPU(node)) ++ count++; ++ return count; ++} ++ +diff --git a/plugins/amdgpu/amdgpu_plugin_topology.h b/plugins/amdgpu/amdgpu_plugin_topology.h +index 9d99cda1c..c890e3dda 100644 +--- a/plugins/amdgpu/amdgpu_plugin_topology.h ++++ b/plugins/amdgpu/amdgpu_plugin_topology.h +@@ -107,6 +107,8 @@ int topology_parse(struct tp_system *topology, const char *msg); + int topology_determine_iolinks(struct tp_system *sys); + void topology_print(const struct tp_system *sys, const char *msg); + ++int topology_gpu_count(struct tp_system *topology); ++ + struct id_map *maps_add_gpu_entry(struct device_maps *maps, const uint32_t src_id, const uint32_t dest_id); + + struct tp_node *sys_add_node(struct tp_system *sys, uint32_t id, uint32_t gpu_id); +diff --git a/plugins/amdgpu/amdgpu_plugin_util.c b/plugins/amdgpu/amdgpu_plugin_util.c +new file mode 100755 +index 000000000..48ff70555 +--- /dev/null ++++ b/plugins/amdgpu/amdgpu_plugin_util.c +@@ -0,0 +1,208 @@ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include "common/list.h" ++ ++#include ++#include ++ ++#include "criu-plugin.h" ++#include "plugin.h" ++#include "criu-amdgpu.pb-c.h" ++ ++#include "img-streamer.h" ++#include "image.h" ++#include "cr_options.h" ++ ++#include "xmalloc.h" ++#include "criu-log.h" ++#include "kfd_ioctl.h" ++#include "amdgpu_drm.h" ++#include "amdgpu_plugin_util.h" ++#include "amdgpu_plugin_topology.h" ++ ++/* Tracks number of device files that need to be checkpointed */ ++static int dev_file_cnt = 0; ++ ++/* Helper structures to encode device topology of SRC and DEST platforms */ ++struct tp_system src_topology; ++struct tp_system dest_topology; ++ ++/* Helper structures to encode device maps during Checkpoint and Restore operations */ ++struct device_maps checkpoint_maps; ++struct device_maps restore_maps; ++ ++bool checkpoint_is_complete() ++{ ++ return (dev_file_cnt == 0); ++} ++ ++void decrement_checkpoint_count() ++{ ++ dev_file_cnt--; ++} ++ ++void init_gpu_count(struct tp_system *topo) ++{ ++ if (dev_file_cnt != 0) ++ return; ++ ++ /* We add ONE to include checkpointing of KFD device */ ++ dev_file_cnt = 1 + topology_gpu_count(topo); ++} ++ ++int read_fp(FILE *fp, void *buf, const size_t buf_len) ++{ ++ size_t len_read; ++ ++ len_read = fread(buf, 1, buf_len, fp); ++ if (len_read != buf_len) { ++ pr_err("Unable to read file (read:%ld buf_len:%ld)", len_read, buf_len); ++ return -EIO; ++ } ++ return 0; ++} ++ ++int write_fp(FILE *fp, const void *buf, const size_t buf_len) ++{ ++ size_t len_write; ++ ++ len_write = fwrite(buf, 1, buf_len, fp); ++ if (len_write != buf_len) { ++ pr_err("Unable to write file (wrote:%ld buf_len:%ld)", len_write, buf_len); ++ return -EIO; ++ } ++ return 0; ++} ++ ++/** ++ * @brief Open an image file ++ * ++ * We store the size of the actual contents in the first 8-bytes of ++ * the file. This allows us to determine the file size when using ++ * criu_image_streamer when fseek and fstat are not available. The ++ * FILE * returned is already at the location of the first actual ++ * contents. ++ * ++ * @param path The file path ++ * @param write False for read, true for write ++ * @param size Size of actual contents ++ * @return FILE *if successful, NULL if failed ++ */ ++FILE *open_img_file(char *path, bool write, size_t *size) ++{ ++ FILE *fp = NULL; ++ int fd, ret; ++ ++ if (opts.stream) ++ fd = img_streamer_open(path, write ? O_DUMP : O_RSTR); ++ else ++ fd = openat(criu_get_image_dir(), path, write ? (O_WRONLY | O_CREAT) : O_RDONLY, 0600); ++ ++ if (fd < 0) { ++ pr_err("%s: Failed to open for %s", path, write ? "write" : "read"); ++ return NULL; ++ } ++ ++ fp = fdopen(fd, write ? "w" : "r"); ++ if (!fp) { ++ pr_err("%s: Failed get pointer for %s", path, write ? "write" : "read"); ++ return NULL; ++ } ++ ++ if (write) ++ ret = write_fp(fp, size, sizeof(*size)); ++ else ++ ret = read_fp(fp, size, sizeof(*size)); ++ ++ if (ret) { ++ pr_err("%s:Failed to access file size", path); ++ fclose(fp); ++ return NULL; ++ } ++ ++ pr_debug("%s:Opened file for %s with size:%ld\n", path, write ? "write" : "read", *size); ++ return fp; ++} ++ ++int read_file(const char *file_path, void *buf, const size_t buf_len) ++{ ++ int ret; ++ FILE *fp; ++ ++ fp = fopen(file_path, "r"); ++ if (!fp) { ++ pr_err("Cannot fopen %s", file_path); ++ return -errno; ++ } ++ ++ ret = read_fp(fp, buf, buf_len); ++ fclose(fp); /* this will also close fd */ ++ return ret; ++} ++ ++ ++/** ++ * @brief Write an image file ++ * ++ * We store the size of the actual contents in the first 8-bytes of the file. This allows us to ++ * determine the file size when using criu_image_streamer when fseek and fstat are not available. ++ * ++ * @param path The file path ++ * @param buf pointer to data to be written ++ * @param buf_len size of buf ++ * @return 0 if successful. -errno on failure ++ */ ++int write_img_file(char *path, const void *buf, const size_t buf_len) ++{ ++ int ret; ++ FILE *fp; ++ size_t len = buf_len; ++ ++ fp = open_img_file(path, true, &len); ++ if (!fp) ++ return -errno; ++ ++ ret = write_fp(fp, buf, buf_len); ++ fclose(fp); /* this will also close fd */ ++ return ret; ++} ++ ++void print_kfd_bo_stat(int bo_cnt, struct kfd_criu_bo_bucket *bo_list) ++{ ++ struct kfd_criu_bo_bucket *bo; ++ ++ pr_info("\n"); ++ for (int idx = 0; idx < bo_cnt; idx++) { ++ bo = &bo_list[idx]; ++ pr_info("\n"); ++ pr_info("%s(), %d. KFD BO Addr: %llx \n", __func__, idx, bo->addr); ++ pr_info("%s(), %d. KFD BO Size: %llx \n", __func__, idx, bo->size); ++ pr_info("%s(), %d. KFD BO Offset: %llx \n", __func__, idx, bo->offset); ++ pr_info("%s(), %d. KFD BO Restored Offset: %llx \n", __func__, idx, bo->restored_offset); ++ pr_info("%s(), %d. KFD BO Alloc Flags: %x \n", __func__, idx, bo->alloc_flags); ++ pr_info("%s(), %d. KFD BO Gpu ID: %x \n", __func__, idx, bo->gpu_id); ++ pr_info("%s(), %d. KFD BO Dmabuf FD: %x \n", __func__, idx, bo->dmabuf_fd); ++ pr_info("\n"); ++ } ++ pr_info("\n"); ++} ++ ++ +diff --git a/plugins/amdgpu/amdgpu_plugin_util.h b/plugins/amdgpu/amdgpu_plugin_util.h +new file mode 100755 +index 000000000..aacca3a28 +--- /dev/null ++++ b/plugins/amdgpu/amdgpu_plugin_util.h +@@ -0,0 +1,106 @@ ++#ifndef __AMDGPU_PLUGIN_UTIL_H__ ++#define __AMDGPU_PLUGIN_UTIL_H__ ++ ++#ifndef _GNU_SOURCE ++#define _GNU_SOURCE 1 ++#endif ++ ++#ifdef COMPILE_TESTS ++#undef pr_err ++#define pr_err(format, arg...) fprintf(stdout, "%s:%d ERROR:" format, __FILE__, __LINE__, ##arg) ++#undef pr_info ++#define pr_info(format, arg...) fprintf(stdout, "%s:%d INFO:" format, __FILE__, __LINE__, ##arg) ++#undef pr_debug ++#define pr_debug(format, arg...) fprintf(stdout, "%s:%d DBG:" format, __FILE__, __LINE__, ##arg) ++ ++#undef pr_perror ++#define pr_perror(format, arg...) \ ++ fprintf(stdout, "%s:%d: " format " (errno = %d (%s))\n", __FILE__, __LINE__, ##arg, errno, strerror(errno)) ++#endif ++ ++#ifdef LOG_PREFIX ++#undef LOG_PREFIX ++#endif ++#define LOG_PREFIX "amdgpu_plugin: " ++ ++#ifdef DEBUG ++#define plugin_log_msg(fmt, ...) pr_debug(fmt, ##__VA_ARGS__) ++#else ++#define plugin_log_msg(fmt, ...) \ ++ { \ ++ } ++#endif ++ ++ ++/* Path where KFD device is surfaced */ ++#define AMDGPU_KFD_DEVICE "/dev/kfd" ++ ++/* Path where DRM devices are surfaced */ ++#define AMDGPU_DRM_DEVICE "/dev/dri/renderD%d" ++ ++/* Minimum version of KFD IOCTL's that supports C&R */ ++#define KFD_IOCTL_MAJOR_VERSION 1 ++#define MIN_KFD_IOCTL_MINOR_VERSION 8 ++ ++/* Name of file having serialized data of KFD device */ ++#define IMG_KFD_FILE "amdgpu-kfd-%d.img" ++ ++/* Name of file having serialized data of KFD buffer objects (BOs) */ ++#define IMG_KFD_PAGES_FILE "amdgpu-pages-%d-%04x.img" ++ ++/* Name of file having serialized data of DRM device */ ++#define IMG_DRM_FILE "amdgpu-renderD-%d.img" ++ ++/* Name of file having serialized data of DRM device buffer objects (BOs) */ ++#define IMG_DRM_PAGES_FILE "amdgpu-drm-pages-%d-%04x.img" ++ ++/* Helper macros to Checkpoint and Restore a ROCm file */ ++#define HSAKMT_SHM_PATH "/dev/shm/hsakmt_shared_mem" ++#define HSAKMT_SHM "/hsakmt_shared_mem" ++#define HSAKMT_SEM_PATH "/dev/shm/sem.hsakmt_semaphore" ++#define HSAKMT_SEM "hsakmt_semaphore" ++ ++/* Help macros to build sDMA command packets */ ++#define SDMA_PACKET(op, sub_op, e) ((((e)&0xFFFF) << 16) | (((sub_op)&0xFF) << 8) | (((op)&0xFF) << 0)) ++ ++#define SDMA_OPCODE_COPY 1 ++#define SDMA_COPY_SUB_OPCODE_LINEAR 0 ++#define SDMA_NOP 0 ++#define SDMA_LINEAR_COPY_MAX_SIZE (1ULL << 21) ++ ++enum sdma_op_type { ++ SDMA_OP_VRAM_READ, ++ SDMA_OP_VRAM_WRITE, ++}; ++ ++/* Helper structures to encode device topology of SRC and DEST platforms */ ++extern struct tp_system src_topology; ++extern struct tp_system dest_topology; ++ ++/* Helper structures to encode device maps during Checkpoint and Restore operations */ ++extern struct device_maps checkpoint_maps; ++extern struct device_maps restore_maps; ++ ++extern int fd_next; ++ ++extern bool kfd_fw_version_check; ++extern bool kfd_sdma_fw_version_check; ++extern bool kfd_caches_count_check; ++extern bool kfd_num_gws_check; ++extern bool kfd_vram_size_check; ++extern bool kfd_numa_check; ++extern bool kfd_capability_check; ++ ++int read_fp(FILE *fp, void *buf, const size_t buf_len); ++int write_fp(FILE *fp, const void *buf, const size_t buf_len); ++int read_file(const char *file_path, void *buf, const size_t buf_len); ++int write_img_file(char *path, const void *buf, const size_t buf_len); ++FILE *open_img_file(char *path, bool write, size_t *size); ++ ++bool checkpoint_is_complete(); ++void decrement_checkpoint_count(); ++void init_gpu_count(struct tp_system *topology); ++ ++void print_kfd_bo_stat(int bo_cnt, struct kfd_criu_bo_bucket *bo_list); ++ ++#endif /* __AMDGPU_PLUGIN_UTIL_H__ */ +diff --git a/plugins/amdgpu/criu-amdgpu.proto b/plugins/amdgpu/criu-amdgpu.proto +index 81d00d3ff..078b67650 100644 +--- a/plugins/amdgpu/criu-amdgpu.proto ++++ b/plugins/amdgpu/criu-amdgpu.proto +@@ -5,7 +5,7 @@ message dev_iolink { + required uint32 node_to_id = 2; + } + +-message device_entry { ++message kfd_device_entry { + required uint32 node_id = 1; + required uint32 gpu_id = 2; + required uint32 cpu_cores_count = 3; +@@ -40,10 +40,10 @@ message device_entry { + repeated dev_iolink iolinks = 32; + } + +-message bo_entry { +- required uint64 addr = 1; +- required uint64 size = 2; +- required uint64 offset = 3; ++message kfd_bo_entry { ++ required uint64 addr = 1; ++ required uint64 size = 2; ++ required uint64 offset = 3; + required uint32 alloc_flags = 4; + required uint32 gpu_id = 5; + } +@@ -52,10 +52,10 @@ message criu_kfd { + required uint32 pid = 1; + required uint32 num_of_gpus = 2; + required uint32 num_of_cpus = 3; +- repeated device_entry device_entries = 4; +- required uint64 num_of_bos = 5; +- repeated bo_entry bo_entries = 6; +- required uint32 num_of_objects = 7; ++ repeated kfd_device_entry device_entries = 4; ++ required uint64 num_of_bos = 5; ++ repeated kfd_bo_entry bo_entries = 6; ++ required uint32 num_of_objects = 7; + required uint64 shared_mem_size = 8; + required uint32 shared_mem_magic = 9; + required bytes priv_data = 10; +-- +2.45.1 + From 789549861fac073e5bdc3798f9638aba4643937c Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Thu, 11 Jul 2024 17:05:10 +0100 Subject: [PATCH 078/109] Apply plugins-amdgpu-refactor-code-used-to-implement-checkp patch Signed-off-by: Radostin Stoyanov --- ...factor-code-used-to-implement-checkp.patch | 186 ++++++++++++++++++ 1 file changed, 186 insertions(+) create mode 100644 plugins-amdgpu-refactor-code-used-to-implement-checkp.patch diff --git a/plugins-amdgpu-refactor-code-used-to-implement-checkp.patch b/plugins-amdgpu-refactor-code-used-to-implement-checkp.patch new file mode 100644 index 0000000..213f609 --- /dev/null +++ b/plugins-amdgpu-refactor-code-used-to-implement-checkp.patch @@ -0,0 +1,186 @@ +From 9d9ae2954d3f1758ea659ed8e614dd28e8a368dd Mon Sep 17 00:00:00 2001 +From: Ramesh Errabolu +Date: Fri, 10 Nov 2023 13:02:49 -0600 +Subject: [PATCH] amdgpu_plugin: Refactor code used to implement Checkpoint + +Refactor code used to Checkpoint DRM devices. Code is moved +into amdgpu_plugin_drm.c file which hosts various methods to +checkpoint and restore a workload. + +Signed-off-by: Ramesh Errabolu +--- + plugins/amdgpu/amdgpu_plugin.c | 62 ++++++++++++++---------------- + plugins/amdgpu/amdgpu_plugin_drm.c | 38 ++++++++++++++++++ + plugins/amdgpu/amdgpu_plugin_drm.h | 6 +++ + 3 files changed, 73 insertions(+), 33 deletions(-) + +diff --git a/plugins/amdgpu/amdgpu_plugin.c b/plugins/amdgpu/amdgpu_plugin.c +index 60e04f973..a579158d0 100644 +--- a/plugins/amdgpu/amdgpu_plugin.c ++++ b/plugins/amdgpu/amdgpu_plugin.c +@@ -49,6 +49,13 @@ struct vma_metadata { + + /************************************ Global Variables ********************************************/ + ++/** ++ * FD of KFD device used to checkpoint. On a multi-process ++ * tree the order of checkpointing goes from parent to child ++ * and so on - so saving the FD will not be overwritten ++ */ ++static int kfd_checkpoint_fd; ++ + static LIST_HEAD(update_vma_info_list); + + size_t kfd_max_buffer_size; +@@ -990,6 +997,10 @@ static int unpause_process(int fd) + goto exit; + } + ++ // Reset the KFD FD ++ kfd_checkpoint_fd = -1; ++ sys_close_drm_render_devices(&src_topology); ++ + exit: + pr_info("Process unpaused %s (ret:%d)\n", ret ? "Failed" : "Ok", ret); + +@@ -1181,44 +1192,25 @@ int amdgpu_plugin_dump_file(int fd, int id) + return -1; + } + ++ /* Initialize number of device files that will be checkpointed */ ++ init_gpu_count(&src_topology); ++ + /* Check whether this plugin was called for kfd or render nodes */ + if (major(st.st_rdev) != major(st_kfd.st_rdev) || minor(st.st_rdev) != 0) { ++ + /* This is RenderD dumper plugin, for now just save renderD + * minor number to be used during restore. In later phases this + * needs to save more data for video decode etc. + */ +- +- CriuRenderNode rd = CRIU_RENDER_NODE__INIT; +- struct tp_node *tp_node; +- +- pr_info("Dumper called for /dev/dri/renderD%d, FD = %d, ID = %d\n", minor(st.st_rdev), fd, id); +- +- tp_node = sys_get_node_by_render_minor(&src_topology, minor(st.st_rdev)); +- if (!tp_node) { +- pr_err("Failed to find a device with minor number = %d\n", minor(st.st_rdev)); +- +- return -ENODEV; +- } +- +- rd.gpu_id = maps_get_dest_gpu(&checkpoint_maps, tp_node->gpu_id); +- if (!rd.gpu_id) +- return -ENODEV; +- +- len = criu_render_node__get_packed_size(&rd); +- buf = xmalloc(len); +- if (!buf) +- return -ENOMEM; +- +- criu_render_node__pack(&rd, buf); +- +- snprintf(img_path, sizeof(img_path), IMG_DRM_FILE, id); +- ret = write_img_file(img_path, buf, len); +- if (ret) { +- xfree(buf); ++ ret = amdgpu_plugin_drm_dump_file(fd, id, &st); ++ if (ret) + return ret; +- } + +- xfree(buf); ++ /* Invoke unpause process if needed */ ++ decrement_checkpoint_count(); ++ if (checkpoint_is_complete()) { ++ ret = unpause_process(kfd_checkpoint_fd); ++ } + + /* Need to return success here so that criu can call plugins for renderD nodes */ + return ret; +@@ -1315,11 +1307,15 @@ int amdgpu_plugin_dump_file(int fd, int id) + ret = write_img_file(img_path, buf, len); + + xfree(buf); ++ + exit: +- /* Restore all queues */ +- unpause_process(fd); ++ /* Restore all queues if conditions permit */ ++ kfd_checkpoint_fd = fd; ++ decrement_checkpoint_count(); ++ if (checkpoint_is_complete()) { ++ ret = unpause_process(fd); ++ } + +- sys_close_drm_render_devices(&src_topology); + xfree((void *)args.devices); + xfree((void *)args.bos); + xfree((void *)args.priv_data); +diff --git a/plugins/amdgpu/amdgpu_plugin_drm.c b/plugins/amdgpu/amdgpu_plugin_drm.c +index a48dc68f0..689d62072 100644 +--- a/plugins/amdgpu/amdgpu_plugin_drm.c ++++ b/plugins/amdgpu/amdgpu_plugin_drm.c +@@ -61,3 +61,41 @@ int amdgpu_plugin_drm_handle_device_vma(int fd, const struct stat *st) + } + + ++int amdgpu_plugin_drm_dump_file(int fd, int id, struct stat *drm) ++{ ++ CriuRenderNode rd = CRIU_RENDER_NODE__INIT; ++ struct tp_node *tp_node; ++ char path[PATH_MAX]; ++ unsigned char *buf; ++ int minor; ++ int len; ++ int ret; ++ ++ /* Get the topology node of the DRM device */ ++ minor = minor(drm->st_rdev); ++ tp_node = sys_get_node_by_render_minor(&src_topology, minor); ++ if (!tp_node) { ++ pr_err("Failed to find a device with minor number = %d\n", minor); ++ return -ENODEV; ++ } ++ ++ /* Get the GPU_ID of the DRM device */ ++ rd.gpu_id = maps_get_dest_gpu(&checkpoint_maps, tp_node->gpu_id); ++ if (!rd.gpu_id) { ++ pr_err("Failed to find valid gpu_id for the device = %d\n", rd.gpu_id); ++ return -ENODEV; ++ } ++ ++ len = criu_render_node__get_packed_size(&rd); ++ buf = xmalloc(len); ++ if (!buf) ++ return -ENOMEM; ++ ++ criu_render_node__pack(&rd, buf); ++ ++ snprintf(path, sizeof(path), IMG_DRM_FILE, id); ++ ret = write_img_file(path, buf, len); ++ xfree(buf); ++ return ret; ++} ++ +diff --git a/plugins/amdgpu/amdgpu_plugin_drm.h b/plugins/amdgpu/amdgpu_plugin_drm.h +index 37009c8ba..6f0c1a9a6 100644 +--- a/plugins/amdgpu/amdgpu_plugin_drm.h ++++ b/plugins/amdgpu/amdgpu_plugin_drm.h +@@ -17,6 +17,12 @@ + */ + int amdgpu_plugin_drm_handle_device_vma(int fd, const struct stat *drm); + ++/** ++ * Serialize meta-data about a particular DRM device, its number of BOs, ++ * etc into a file. The serialized filename has in it the value ID that ++ * is passed in as a parameter ++ */ ++int amdgpu_plugin_drm_dump_file(int fd, int id, struct stat *drm); + + #endif /* __AMDGPU_PLUGIN_DRM_H__ */ + +-- +2.45.1 + From a3667e4ffa08516ba69c3f7739f6f38a5ea9938d Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Thu, 11 Jul 2024 16:54:06 +0100 Subject: [PATCH 079/109] Apply plugins-amdgpu-fix-lint-errors patch Signed-off-by: Radostin Stoyanov --- criu.spec | 2 + plugins-amdgpu-fix-lint-errors.patch | 134 +++++++++++++++++++++++++++ 2 files changed, 136 insertions(+) create mode 100644 plugins-amdgpu-fix-lint-errors.patch diff --git a/criu.spec b/criu.spec index 2b17422..3b0ab27 100644 --- a/criu.spec +++ b/criu.spec @@ -27,6 +27,7 @@ Patch101: plugins-amdgpu-don-t-print-error-for-no-such-process-.patch Patch102: plugins-amdgpu-also-don-t-print-plugin-failed-in-criu.patch Patch103: plugins-amdgpu-refactor-code-in-preparation-to-suppor.patch Patch104: plugins-amdgpu-refactor-code-used-to-implement-checkp.patch +Patch105: plugins-amdgpu-fix-lint-errors.patch Source5: criu-tmpfiles.conf @@ -116,6 +117,7 @@ This script can help to workaround the so called "PID mismatch" problem. %patch -P 102 -p1 %patch -P 103 -p1 %patch -P 104 -p1 +%patch -P 105 -p1 %build # This package calls LD directly without specifying the LTO plugins. Until diff --git a/plugins-amdgpu-fix-lint-errors.patch b/plugins-amdgpu-fix-lint-errors.patch new file mode 100644 index 0000000..1cb40ab --- /dev/null +++ b/plugins-amdgpu-fix-lint-errors.patch @@ -0,0 +1,134 @@ +From 6d37f9a4df8727e5beb7a9f5e0dc5165bcc33cea Mon Sep 17 00:00:00 2001 +From: Radostin Stoyanov +Date: Fri, 9 Feb 2024 14:14:10 +0000 +Subject: [PATCH] amdgpu_plugin: fix lint errors + +$ make lint + ... + # Do not append \n to pr_perror, pr_pwarn or fail + ! git --no-pager grep -E '^\s*\<(pr_perror|pr_pwarn|fail)\>.*\\n"' + plugins/amdgpu/amdgpu_plugin.c: pr_perror("%s(), Can't handle VMAs of input device\n", __func__); + + ! git --no-pager grep -En '^\s*\.*);$' | grep -v '\\n' + plugins/amdgpu/amdgpu_plugin_drm.c:45: pr_err("Error in getting stat for: %s", path); + plugins/amdgpu/amdgpu_plugin_util.c:77: pr_err("Unable to read file (read:%ld buf_len:%ld)", len_read, buf_len); + plugins/amdgpu/amdgpu_plugin_util.c:89: pr_err("Unable to write file (wrote:%ld buf_len:%ld)", len_write, buf_len); + plugins/amdgpu/amdgpu_plugin_util.c:120: pr_err("%s: Failed to open for %s", path, write ? "write" : "read"); + plugins/amdgpu/amdgpu_plugin_util.c:126: pr_err("%s: Failed get pointer for %s", path, write ? "write" : "read"); + plugins/amdgpu/amdgpu_plugin_util.c:136: pr_err("%s:Failed to access file size", path); + plugins/amdgpu/amdgpu_plugin_util.c:152: pr_err("Cannot fopen %s", file_path); + + make: *** [Makefile:470: lint] Error 1 + +Signed-off-by: Radostin Stoyanov +--- + plugins/amdgpu/amdgpu_plugin.c | 2 +- + plugins/amdgpu/amdgpu_plugin_drm.c | 3 +-- + plugins/amdgpu/amdgpu_plugin_util.c | 16 +++++++--------- + 3 files changed, 9 insertions(+), 12 deletions(-) + +diff --git a/plugins/amdgpu/amdgpu_plugin.c b/plugins/amdgpu/amdgpu_plugin.c +index a579158d0..a41469a50 100644 +--- a/plugins/amdgpu/amdgpu_plugin.c ++++ b/plugins/amdgpu/amdgpu_plugin.c +@@ -412,7 +412,7 @@ int amdgpu_plugin_handle_device_vma(int fd, const struct stat *st_buf) + /* Determine if input is a DRM device and therefore is supported */ + ret = amdgpu_plugin_drm_handle_device_vma(fd, st_buf); + if (ret) +- pr_perror("%s(), Can't handle VMAs of input device\n", __func__); ++ pr_perror("%s(), Can't handle VMAs of input device", __func__); + + return ret; + } +diff --git a/plugins/amdgpu/amdgpu_plugin_drm.c b/plugins/amdgpu/amdgpu_plugin_drm.c +index 689d62072..d54cd937d 100644 +--- a/plugins/amdgpu/amdgpu_plugin_drm.c ++++ b/plugins/amdgpu/amdgpu_plugin_drm.c +@@ -42,7 +42,7 @@ int amdgpu_plugin_drm_handle_device_vma(int fd, const struct stat *st) + snprintf(path, sizeof(path), AMDGPU_DRM_DEVICE, DRM_FIRST_RENDER_NODE); + ret = stat(path, &drm); + if (ret == -1) { +- pr_err("Error in getting stat for: %s", path); ++ pr_err("Error in getting stat for: %s\n", path); + return ret; + } + +@@ -98,4 +98,3 @@ int amdgpu_plugin_drm_dump_file(int fd, int id, struct stat *drm) + xfree(buf); + return ret; + } +- +diff --git a/plugins/amdgpu/amdgpu_plugin_util.c b/plugins/amdgpu/amdgpu_plugin_util.c +index 48ff70555..62e569fc8 100755 +--- a/plugins/amdgpu/amdgpu_plugin_util.c ++++ b/plugins/amdgpu/amdgpu_plugin_util.c +@@ -65,7 +65,7 @@ void init_gpu_count(struct tp_system *topo) + return; + + /* We add ONE to include checkpointing of KFD device */ +- dev_file_cnt = 1 + topology_gpu_count(topo); ++ dev_file_cnt = 1 + topology_gpu_count(topo); + } + + int read_fp(FILE *fp, void *buf, const size_t buf_len) +@@ -74,7 +74,7 @@ int read_fp(FILE *fp, void *buf, const size_t buf_len) + + len_read = fread(buf, 1, buf_len, fp); + if (len_read != buf_len) { +- pr_err("Unable to read file (read:%ld buf_len:%ld)", len_read, buf_len); ++ pr_err("Unable to read file (read:%ld buf_len:%ld)\n", len_read, buf_len); + return -EIO; + } + return 0; +@@ -86,7 +86,7 @@ int write_fp(FILE *fp, const void *buf, const size_t buf_len) + + len_write = fwrite(buf, 1, buf_len, fp); + if (len_write != buf_len) { +- pr_err("Unable to write file (wrote:%ld buf_len:%ld)", len_write, buf_len); ++ pr_err("Unable to write file (wrote:%ld buf_len:%ld)\n", len_write, buf_len); + return -EIO; + } + return 0; +@@ -117,13 +117,13 @@ FILE *open_img_file(char *path, bool write, size_t *size) + fd = openat(criu_get_image_dir(), path, write ? (O_WRONLY | O_CREAT) : O_RDONLY, 0600); + + if (fd < 0) { +- pr_err("%s: Failed to open for %s", path, write ? "write" : "read"); ++ pr_err("%s: Failed to open for %s\n", path, write ? "write" : "read"); + return NULL; + } + + fp = fdopen(fd, write ? "w" : "r"); + if (!fp) { +- pr_err("%s: Failed get pointer for %s", path, write ? "write" : "read"); ++ pr_err("%s: Failed get pointer for %s\n", path, write ? "write" : "read"); + return NULL; + } + +@@ -133,7 +133,7 @@ FILE *open_img_file(char *path, bool write, size_t *size) + ret = read_fp(fp, size, sizeof(*size)); + + if (ret) { +- pr_err("%s:Failed to access file size", path); ++ pr_err("%s:Failed to access file size\n", path); + fclose(fp); + return NULL; + } +@@ -149,7 +149,7 @@ int read_file(const char *file_path, void *buf, const size_t buf_len) + + fp = fopen(file_path, "r"); + if (!fp) { +- pr_err("Cannot fopen %s", file_path); ++ pr_err("Cannot fopen %s\n", file_path); + return -errno; + } + +@@ -204,5 +204,3 @@ void print_kfd_bo_stat(int bo_cnt, struct kfd_criu_bo_bucket *bo_list) + } + pr_info("\n"); + } +- +- +-- +2.45.1 + From f57234b73af11ec037b171eaa27c98cf659d68ab Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Thu, 11 Jul 2024 16:41:26 +0100 Subject: [PATCH 080/109] Apply plugins-amdgpu-fix-cross-compilation patch Signed-off-by: Radostin Stoyanov --- criu.spec | 2 ++ plugins-amdgpu-fix-cross-compilation.patch | 30 ++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 plugins-amdgpu-fix-cross-compilation.patch diff --git a/criu.spec b/criu.spec index 3b0ab27..36acc33 100644 --- a/criu.spec +++ b/criu.spec @@ -28,6 +28,7 @@ Patch102: plugins-amdgpu-also-don-t-print-plugin-failed-in-criu.patch Patch103: plugins-amdgpu-refactor-code-in-preparation-to-suppor.patch Patch104: plugins-amdgpu-refactor-code-used-to-implement-checkp.patch Patch105: plugins-amdgpu-fix-lint-errors.patch +Patch106: plugins-amdgpu-fix-cross-compilation.patch Source5: criu-tmpfiles.conf @@ -118,6 +119,7 @@ This script can help to workaround the so called "PID mismatch" problem. %patch -P 103 -p1 %patch -P 104 -p1 %patch -P 105 -p1 +%patch -P 106 -p1 %build # This package calls LD directly without specifying the LTO plugins. Until diff --git a/plugins-amdgpu-fix-cross-compilation.patch b/plugins-amdgpu-fix-cross-compilation.patch new file mode 100644 index 0000000..4e2b130 --- /dev/null +++ b/plugins-amdgpu-fix-cross-compilation.patch @@ -0,0 +1,30 @@ +From 28331d51935eba559c0bcd55f27abdd4983901a2 Mon Sep 17 00:00:00 2001 +From: Radostin Stoyanov +Date: Tue, 9 Jul 2024 13:07:03 +0100 +Subject: [PATCH 1/3] plugins/amdgpu: fix cross-compilation + +To enable cross-compile we need to use the CC definition from +criu/scripts/nmk/scripts/tools.mk: + +CC := $(CROSS_COMPILE)$(HOSTCC) + +Signed-off-by: Radostin Stoyanov +--- + plugins/amdgpu/Makefile | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/plugins/amdgpu/Makefile b/plugins/amdgpu/Makefile +index 5efa8fb0b..d9f0da1eb 100644 +--- a/plugins/amdgpu/Makefile ++++ b/plugins/amdgpu/Makefile +@@ -15,7 +15,6 @@ DEPS_NOK := ; + __nmk_dir ?= ../../scripts/nmk/scripts/ + include $(__nmk_dir)msg.mk + +-CC := gcc + PLUGIN_CFLAGS := -g -Wall -Werror -D _GNU_SOURCE -shared -nostartfiles -fPIC -DCR_PLUGIN_DEFAULT="$(PLUGINDIR)" + PLUGIN_LDFLAGS := -lpthread -lrt -ldrm -ldrm_amdgpu + +-- +2.45.1 + From 6b6494641d59167c177ac6e82e457a862b8dd6e3 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Thu, 11 Jul 2024 16:42:23 +0100 Subject: [PATCH 081/109] Apply plugins-amdgpu-fix-printf-format-specifiers patch Signed-off-by: Radostin Stoyanov --- criu.spec | 2 + ...-amdgpu-fix-printf-format-specifiers.patch | 119 ++++++++++++++++++ 2 files changed, 121 insertions(+) create mode 100644 plugins-amdgpu-fix-printf-format-specifiers.patch diff --git a/criu.spec b/criu.spec index 36acc33..f196ae7 100644 --- a/criu.spec +++ b/criu.spec @@ -29,6 +29,7 @@ Patch103: plugins-amdgpu-refactor-code-in-preparation-to-suppor.patch Patch104: plugins-amdgpu-refactor-code-used-to-implement-checkp.patch Patch105: plugins-amdgpu-fix-lint-errors.patch Patch106: plugins-amdgpu-fix-cross-compilation.patch +Patch107: plugins-amdgpu-fix-printf-format-specifiers.patch Source5: criu-tmpfiles.conf @@ -120,6 +121,7 @@ This script can help to workaround the so called "PID mismatch" problem. %patch -P 104 -p1 %patch -P 105 -p1 %patch -P 106 -p1 +%patch -P 107 -p1 %build # This package calls LD directly without specifying the LTO plugins. Until diff --git a/plugins-amdgpu-fix-printf-format-specifiers.patch b/plugins-amdgpu-fix-printf-format-specifiers.patch new file mode 100644 index 0000000..dd15ba3 --- /dev/null +++ b/plugins-amdgpu-fix-printf-format-specifiers.patch @@ -0,0 +1,119 @@ +From f216ddcc9d4266daff5d75fff0d5c84c6000f7c7 Mon Sep 17 00:00:00 2001 +From: Radostin Stoyanov +Date: Wed, 10 Jul 2024 04:36:18 +0100 +Subject: [PATCH 3/3] plugins/amdgpu: fix printf format specifiers + +Errors on aarch64: + + In file included from amdgpu_plugin_drm.h:10, + from amdgpu_plugin.c:33: + amdgpu_plugin.c: In function 'amdgpu_plugin_dump_file': + amdgpu_plugin_util.h:24:20: error: format '%lld' expects argument of type 'long long int', but argument 6 has type '__u64' {aka 'long unsigned int'} [-Werror=format=] + 24 | #define LOG_PREFIX "amdgpu_plugin: " + | ^~~~~~~~~~~~~~~~~ + ../../criu/include/log.h:47:52: note: in expansion of macro 'LOG_PREFIX' + 47 | #define pr_info(fmt, ...) print_on_level(LOG_INFO, LOG_PREFIX fmt, ##__VA_ARGS__) + | ^~~~~~~~~~ + amdgpu_plugin.c:1236:9: note: in expansion of macro 'pr_info' + 1236 | pr_info("devices:%d bos:%d objects:%d priv_data:%lld\n", args.num_devices, args.num_bos, args.num_objects, + | ^~~~~~~ + cc1: all warnings being treated as errors + +Errors on ppc64: + + In file included from amdgpu_plugin_drm.h:10, + from amdgpu_plugin.c:33: + amdgpu_plugin.c: In function 'amdgpu_plugin_dump_file': + amdgpu_plugin_util.h:24:20: error: format '%llu' expects argument of type 'long long unsigned int', but argument 6 has type '__u64' {aka 'long unsigned int'} [-Werror=format=] + 24 | #define LOG_PREFIX "amdgpu_plugin: " + | ^~~~~~~~~~~~~~~~~ + ../../criu/include/log.h:47:52: note: in expansion of macro 'LOG_PREFIX' + 47 | #define pr_info(fmt, ...) print_on_level(LOG_INFO, LOG_PREFIX fmt, ##__VA_ARGS__) + | ^~~~~~~~~~ + amdgpu_plugin.c:1236:9: note: in expansion of macro 'pr_info' + 1236 | pr_info("devices:%u bos:%u objects:%u priv_data:%llu\n", + | ^~~~~~~ + cc1: all warnings being treated as errors + In file included from amdgpu_plugin_util.c:38: + amdgpu_plugin_util.c: In function 'print_kfd_bo_stat': + amdgpu_plugin_util.h:24:20: error: format '%llx' expects argument of type 'long long unsigned int', but argument 5 has type '__u64' {aka 'long unsigned int'} [-Werror=format=] + 24 | #define LOG_PREFIX "amdgpu_plugin: " + | ^~~~~~~~~~~~~~~~~ + ../../criu/include/log.h:47:52: note: in expansion of macro 'LOG_PREFIX' + 47 | #define pr_info(fmt, ...) print_on_level(LOG_INFO, LOG_PREFIX fmt, ##__VA_ARGS__) + | ^~~~~~~~~~ + amdgpu_plugin_util.c:196:17: note: in expansion of macro 'pr_info' + 196 | pr_info("%s(), %d. KFD BO Addr: %llx \n", __func__, idx, bo->addr); + | ^~~~~~~ + amdgpu_plugin_util.h:24:20: error: format '%llx' expects argument of type 'long long unsigned int', but argument 5 has type '__u64' {aka 'long unsigned int'} [-Werror=format=] + 24 | #define LOG_PREFIX "amdgpu_plugin: " + | ^~~~~~~~~~~~~~~~~ + ../../criu/include/log.h:47:52: note: in expansion of macro 'LOG_PREFIX' + 47 | #define pr_info(fmt, ...) print_on_level(LOG_INFO, LOG_PREFIX fmt, ##__VA_ARGS__) + | ^~~~~~~~~~ + amdgpu_plugin_util.c:197:17: note: in expansion of macro 'pr_info' + 197 | pr_info("%s(), %d. KFD BO Size: %llx \n", __func__, idx, bo->size); + | ^~~~~~~ + amdgpu_plugin_util.h:24:20: error: format '%llx' expects argument of type 'long long unsigned int', but argument 5 has type '__u64' {aka 'long unsigned int'} [-Werror=format=] + 24 | #define LOG_PREFIX "amdgpu_plugin: " + | ^~~~~~~~~~~~~~~~~ + ../../criu/include/log.h:47:52: note: in expansion of macro 'LOG_PREFIX' + 47 | #define pr_info(fmt, ...) print_on_level(LOG_INFO, LOG_PREFIX fmt, ##__VA_ARGS__) + | ^~~~~~~~~~ + amdgpu_plugin_util.c:198:17: note: in expansion of macro 'pr_info' + 198 | pr_info("%s(), %d. KFD BO Offset: %llx \n", __func__, idx, bo->offset); + | ^~~~~~~ + amdgpu_plugin_util.h:24:20: error: format '%llx' expects argument of type 'long long unsigned int', but argument 5 has type '__u64' {aka 'long unsigned int'} [-Werror=format=] + 24 | #define LOG_PREFIX "amdgpu_plugin: " + | ^~~~~~~~~~~~~~~~~ + ../../criu/include/log.h:47:52: note: in expansion of macro 'LOG_PREFIX' + 47 | #define pr_info(fmt, ...) print_on_level(LOG_INFO, LOG_PREFIX fmt, ##__VA_ARGS__) + | ^~~~~~~~~~ + amdgpu_plugin_util.c:199:17: note: in expansion of macro 'pr_info' + 199 | pr_info("%s(), %d. KFD BO Restored Offset: %llx \n", __func__, idx, bo->restored_offset); + | ^~~~~~~ + cc1: all warnings being treated as errors + +Signed-off-by: Radostin Stoyanov +--- + plugins/amdgpu/amdgpu_plugin.c | 4 ++-- + plugins/amdgpu/amdgpu_plugin_util.c | 8 ++++---- + 2 files changed, 6 insertions(+), 6 deletions(-) + +diff --git a/plugins/amdgpu/amdgpu_plugin.c b/plugins/amdgpu/amdgpu_plugin.c +index a41469a50..924bf6c76 100644 +--- a/plugins/amdgpu/amdgpu_plugin.c ++++ b/plugins/amdgpu/amdgpu_plugin.c +@@ -1233,8 +1233,8 @@ int amdgpu_plugin_dump_file(int fd, int id) + goto exit; + } + +- pr_info("devices:%d bos:%d objects:%d priv_data:%lld\n", args.num_devices, args.num_bos, args.num_objects, +- args.priv_data_size); ++ pr_info("devices:%u bos:%u objects:%u priv_data:%llu\n", ++ args.num_devices, args.num_bos, args.num_objects, (unsigned long long)args.priv_data_size); + + e = xmalloc(sizeof(*e)); + if (!e) { +diff --git a/plugins/amdgpu/amdgpu_plugin_util.c b/plugins/amdgpu/amdgpu_plugin_util.c +index 62e569fc8..2ed3a6b82 100755 +--- a/plugins/amdgpu/amdgpu_plugin_util.c ++++ b/plugins/amdgpu/amdgpu_plugin_util.c +@@ -193,10 +193,10 @@ void print_kfd_bo_stat(int bo_cnt, struct kfd_criu_bo_bucket *bo_list) + for (int idx = 0; idx < bo_cnt; idx++) { + bo = &bo_list[idx]; + pr_info("\n"); +- pr_info("%s(), %d. KFD BO Addr: %llx \n", __func__, idx, bo->addr); +- pr_info("%s(), %d. KFD BO Size: %llx \n", __func__, idx, bo->size); +- pr_info("%s(), %d. KFD BO Offset: %llx \n", __func__, idx, bo->offset); +- pr_info("%s(), %d. KFD BO Restored Offset: %llx \n", __func__, idx, bo->restored_offset); ++ pr_info("%s(), %d. KFD BO Addr: %llx \n", __func__, idx, (unsigned long long)bo->addr); ++ pr_info("%s(), %d. KFD BO Size: %llx \n", __func__, idx, (unsigned long long)bo->size); ++ pr_info("%s(), %d. KFD BO Offset: %llx \n", __func__, idx, (unsigned long long)bo->offset); ++ pr_info("%s(), %d. KFD BO Restored Offset: %llx \n", __func__, idx, (unsigned long long)bo->restored_offset); + pr_info("%s(), %d. KFD BO Alloc Flags: %x \n", __func__, idx, bo->alloc_flags); + pr_info("%s(), %d. KFD BO Gpu ID: %x \n", __func__, idx, bo->gpu_id); + pr_info("%s(), %d. KFD BO Dmabuf FD: %x \n", __func__, idx, bo->dmabuf_fd); +-- +2.45.1 + From 84c94b56e395d0a39c0ac13e26228f765a27a350 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 17 Jul 2024 20:12:15 +0000 Subject: [PATCH 082/109] Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild --- criu.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/criu.spec b/criu.spec index f196ae7..c7f095f 100644 --- a/criu.spec +++ b/criu.spec @@ -12,7 +12,7 @@ Name: criu Version: 3.19 -Release: 6%{?dist} +Release: 7%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPL-2.0-only AND LGPL-2.1-only AND MIT URL: http://criu.org/ @@ -188,6 +188,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %doc %{_mandir}/man1/criu-ns.1* %changelog +* Wed Jul 17 2024 Fedora Release Engineering - 3.19-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild + * Tue Jul 09 2024 Radostin Stoyanov - 3.19-6 - Add package for amdgpu-plugin From 973d5b295de535e836275fc194fad9a1e86aa42e Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Thu, 26 Sep 2024 06:50:52 +0100 Subject: [PATCH 083/109] Update to v4.0 Signed-off-by: Radostin Stoyanov --- .gitignore | 1 + ...onfig-set-CR_PLUGIN_DEFAULT-variable.patch | 49 + criu.spec | 41 +- docs-update-amdgpu-plugin-man-page.patch | 38 - ...so-don-t-print-plugin-failed-in-criu.patch | 54 - ...n-t-print-error-for-no-such-process-.patch | 35 - plugins-amdgpu-fix-cross-compilation.patch | 30 - plugins-amdgpu-fix-lint-errors.patch | 134 --- ...-amdgpu-fix-printf-format-specifiers.patch | 119 -- ...factor-code-in-preparation-to-suppor.patch | 1013 ----------------- ...factor-code-used-to-implement-checkp.patch | 186 --- sources | 2 +- 12 files changed, 72 insertions(+), 1630 deletions(-) create mode 100644 Makefile.config-set-CR_PLUGIN_DEFAULT-variable.patch delete mode 100644 docs-update-amdgpu-plugin-man-page.patch delete mode 100644 plugins-amdgpu-also-don-t-print-plugin-failed-in-criu.patch delete mode 100644 plugins-amdgpu-don-t-print-error-for-no-such-process-.patch delete mode 100644 plugins-amdgpu-fix-cross-compilation.patch delete mode 100644 plugins-amdgpu-fix-lint-errors.patch delete mode 100644 plugins-amdgpu-fix-printf-format-specifiers.patch delete mode 100644 plugins-amdgpu-refactor-code-in-preparation-to-suppor.patch delete mode 100644 plugins-amdgpu-refactor-code-used-to-implement-checkp.patch diff --git a/.gitignore b/.gitignore index 0d113cc..d704cea 100644 --- a/.gitignore +++ b/.gitignore @@ -56,3 +56,4 @@ /criu-3.17.1.tar.gz /criu-3.18.tar.gz /criu-3.19.tar.gz +/criu-4.0.tar.gz diff --git a/Makefile.config-set-CR_PLUGIN_DEFAULT-variable.patch b/Makefile.config-set-CR_PLUGIN_DEFAULT-variable.patch new file mode 100644 index 0000000..7f9584d --- /dev/null +++ b/Makefile.config-set-CR_PLUGIN_DEFAULT-variable.patch @@ -0,0 +1,49 @@ +From bb35901e78216917ce8066fa805ce27f273d76a2 Mon Sep 17 00:00:00 2001 +From: Radostin Stoyanov +Date: Thu, 26 Sep 2024 10:59:32 +0100 +Subject: [PATCH] Makefile.config: set CR_PLUGIN_DEFAULT variable + +By default, CRIU uses the path "/usr/lib/criu" to install and load +plugins at runtime. This path is defined by the `PLUGINDIR` variable +in Makefile.install and `CR_PLUGIN_DEFAULT` in `criu/include/plugin.h`. +However, some distribution packages might install the CRIU plugins at +"/usr/lib64/criu" instead. This patch updates the makefile to align +the path defined by `CR_PLUGIN_DEFAULT` with the value of `PLUGINDIR`. + +Signed-off-by: Radostin Stoyanov +--- + Makefile.config | 4 ++++ + plugins/amdgpu/Makefile | 2 +- + 2 files changed, 5 insertions(+), 1 deletion(-) + +diff --git a/Makefile.config b/Makefile.config +index 52c250b21..5ab689d41 100644 +--- a/Makefile.config ++++ b/Makefile.config +@@ -59,6 +59,10 @@ endif + + export LIBS += $(LIBS_FEATURES) + ++ifneq ($(PLUGINDIR),) ++ FEATURE_DEFINES += -DCR_PLUGIN_DEFAULT="\"$(PLUGINDIR)\"" ++endif ++ + CONFIG_FILE = .config + + $(CONFIG_FILE): +diff --git a/plugins/amdgpu/Makefile b/plugins/amdgpu/Makefile +index 7d3388b80..a20d1d163 100644 +--- a/plugins/amdgpu/Makefile ++++ b/plugins/amdgpu/Makefile +@@ -15,7 +15,7 @@ DEPS_NOK := ; + __nmk_dir ?= ../../scripts/nmk/scripts/ + include $(__nmk_dir)msg.mk + +-PLUGIN_CFLAGS := -g -Wall -Werror -D _GNU_SOURCE -shared -nostartfiles -fPIC -DCR_PLUGIN_DEFAULT="$(PLUGINDIR)" ++PLUGIN_CFLAGS := -g -Wall -Werror -D _GNU_SOURCE -shared -nostartfiles -fPIC + PLUGIN_LDFLAGS := -lpthread -lrt -ldrm -ldrm_amdgpu + + ifeq ($(CONFIG_AMDGPU),y) +-- +2.46.1 + diff --git a/criu.spec b/criu.spec index c7f095f..2ec6857 100644 --- a/criu.spec +++ b/criu.spec @@ -11,8 +11,8 @@ %undefine _auto_set_build_flags Name: criu -Version: 3.19 -Release: 7%{?dist} +Version: 4.0 +Release: 1%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPL-2.0-only AND LGPL-2.1-only AND MIT URL: http://criu.org/ @@ -22,14 +22,8 @@ Source0: https://github.com/checkpoint-restore/criu/archive/v%{version}/criu-%{v # We use this patch because the protobuf-c package name # in RPM and DEB is different. Patch99: criu.pc.patch -Patch100: docs-update-amdgpu-plugin-man-page.patch -Patch101: plugins-amdgpu-don-t-print-error-for-no-such-process-.patch -Patch102: plugins-amdgpu-also-don-t-print-plugin-failed-in-criu.patch -Patch103: plugins-amdgpu-refactor-code-in-preparation-to-suppor.patch -Patch104: plugins-amdgpu-refactor-code-used-to-implement-checkp.patch -Patch105: plugins-amdgpu-fix-lint-errors.patch -Patch106: plugins-amdgpu-fix-cross-compilation.patch -Patch107: plugins-amdgpu-fix-printf-format-specifiers.patch + +Patch100: Makefile.config-set-CR_PLUGIN_DEFAULT-variable.patch Source5: criu-tmpfiles.conf @@ -86,6 +80,13 @@ Requires: %{name} = %{version}-%{release} %description amdgpu-plugin This package contains the AMD GPU plugin for %{name} +%package cuda-plugin +Summary: CUDA plugin for %{name} +Requires: %{name} = %{version}-%{release} + +%description cuda-plugin +This package contains the CUDA plugin for %{name} + %package -n %{py_prefix}-%{name} %{?python_provide:%python_provide %{py_prefix}-%{name}} Summary: Python bindings for %{name} @@ -114,14 +115,8 @@ This script can help to workaround the so called "PID mismatch" problem. %prep %setup -q %patch -P 99 -p1 + %patch -P 100 -p1 -%patch -P 101 -p1 -%patch -P 102 -p1 -%patch -P 103 -p1 -%patch -P 104 -p1 -%patch -P 105 -p1 -%patch -P 106 -p1 -%patch -P 107 -p1 %build # This package calls LD directly without specifying the LTO plugins. Until @@ -140,6 +135,7 @@ sed -e "s,--upgrade --ignore-installed,--no-index --no-deps -v --no-build-isolat make install-criu DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} make install-lib DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} PYTHON=%{py_binary} make install-amdgpu_plugin DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} PLUGINDIR=%{_libdir}/criu +make install-cuda_plugin DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} PLUGINDIR=%{_libdir}/criu make install-crit DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} PYTHON=%{py_binary} make install-man DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} rm -f $RPM_BUILD_ROOT%{_mandir}/man1/compel.1 @@ -148,9 +144,6 @@ mkdir -p %{buildroot}%{_tmpfilesdir} install -m 0644 %{SOURCE5} %{buildroot}%{_tmpfilesdir}/%{name}.conf install -d -m 0755 %{buildroot}/run/%{name}/ -# Fix rpmlint W: unstripped-binary-or-object /usr/lib64/criu/amdgpu_plugin.so -chmod 755 $RPM_BUILD_ROOT%{_libdir}/%{name}/amdgpu_plugin.so - # remove static lib rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a @@ -174,6 +167,10 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %{_libdir}/%{name}/amdgpu_plugin.so %doc %{_mandir}/man1/criu-amdgpu-plugin.1* +%files cuda-plugin +%{_libdir}/%{name}/cuda_plugin.so +%doc plugins/cuda/README.md + %files -n %{py_prefix}-%{name} %{python3_sitelib}/pycriu* @@ -188,6 +185,10 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %doc %{_mandir}/man1/criu-ns.1* %changelog +* Thu Sep 26 2024 Radostin Stoyanov - 4.0-1 +- Update to 4.0 +- Add package for cuda-plugin + * Wed Jul 17 2024 Fedora Release Engineering - 3.19-7 - Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild diff --git a/docs-update-amdgpu-plugin-man-page.patch b/docs-update-amdgpu-plugin-man-page.patch deleted file mode 100644 index 35a7abc..0000000 --- a/docs-update-amdgpu-plugin-man-page.patch +++ /dev/null @@ -1,38 +0,0 @@ -From eb4e68e5df4ce1ae4e362af012b1f464ecc63422 Mon Sep 17 00:00:00 2001 -From: Radostin Stoyanov -Date: Tue, 9 Jul 2024 12:22:25 +0100 -Subject: [PATCH] docs: update amdgpu-plugin man page - -This patch updates the dependencies section of the AMDGPU plugin man -page to reflect that the plugin has been merged upstream and to fix a -formatting issue. - -Signed-off-by: Radostin Stoyanov ---- - Documentation/criu-amdgpu-plugin.txt | 8 ++------ - 1 file changed, 2 insertions(+), 6 deletions(-) - -diff --git a/Documentation/criu-amdgpu-plugin.txt b/Documentation/criu-amdgpu-plugin.txt -index 35321a915..68803f3db 100644 ---- a/Documentation/criu-amdgpu-plugin.txt -+++ b/Documentation/criu-amdgpu-plugin.txt -@@ -27,14 +27,10 @@ to criu to allow Checkpoint / Restore with ROCm. - - - Dependencies --~~~~~~~~~~~~~~ -+------------ - *amdkfd support*:: - In order to snapshot the *VRAM* and other *GPU* device states, we require -- an updated version of amdkfd(amdgpu) driver. The kernel patches are under -- review currently. -- --*criu 3.16*:: -- This work is rebased on latest criu release available at this time. -+ an updated version of amdkfd(amdgpu) driver. - - OPTIONS - ------- --- -2.45.2 - diff --git a/plugins-amdgpu-also-don-t-print-plugin-failed-in-criu.patch b/plugins-amdgpu-also-don-t-print-plugin-failed-in-criu.patch deleted file mode 100644 index 232fd1d..0000000 --- a/plugins-amdgpu-also-don-t-print-plugin-failed-in-criu.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 639068ecab26096092d460d6bbed10bedb5da0c4 Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Mon, 5 Feb 2024 11:17:40 +0800 -Subject: [PATCH] plugin/amdgpu: Also don't print 'plugin failed' in criu - -We already don't treat it as error in the plugin itself, but after -returning -1 from RESUME_DEVICES_LATE hook we print debug message in -criu about failed plugin, let's return 0 instead. - -While on it let's replace ret to exit_code. - -Fixes: a9cbdad76 ("plugin/amdgpu: Don't print error for "No such process" during resume") -Signed-off-by: Pavel Tikhomirov ---- - plugins/amdgpu/amdgpu_plugin.c | 11 ++++++----- - 1 file changed, 6 insertions(+), 5 deletions(-) - -diff --git a/plugins/amdgpu/amdgpu_plugin.c b/plugins/amdgpu/amdgpu_plugin.c -index 3675353a7..23253632d 100644 ---- a/plugins/amdgpu/amdgpu_plugin.c -+++ b/plugins/amdgpu/amdgpu_plugin.c -@@ -1985,7 +1985,7 @@ CR_PLUGIN_REGISTER_HOOK(CR_PLUGIN_HOOK__UPDATE_VMA_MAP, amdgpu_plugin_update_vma - int amdgpu_plugin_resume_devices_late(int target_pid) - { - struct kfd_ioctl_criu_args args = { 0 }; -- int fd, ret = 0; -+ int fd, exit_code = 0; - - pr_info("Inside %s for target pid = %d\n", __func__, target_pid); - -@@ -1999,15 +1999,16 @@ int amdgpu_plugin_resume_devices_late(int target_pid) - args.op = KFD_CRIU_OP_RESUME; - pr_info("Calling IOCTL to start notifiers and queues\n"); - if (kmtIoctl(fd, AMDKFD_IOC_CRIU_OP, &args) == -1) { -- if (errno == ESRCH) -+ if (errno == ESRCH) { - pr_info("Pid %d has no kfd process info\n", target_pid); -- else -+ } else { - pr_perror("restore late ioctl failed"); -- ret = -1; -+ exit_code = -1; -+ } - } - - close(fd); -- return ret; -+ return exit_code; - } - - CR_PLUGIN_REGISTER_HOOK(CR_PLUGIN_HOOK__RESUME_DEVICES_LATE, amdgpu_plugin_resume_devices_late) --- -2.45.1 - diff --git a/plugins-amdgpu-don-t-print-error-for-no-such-process-.patch b/plugins-amdgpu-don-t-print-error-for-no-such-process-.patch deleted file mode 100644 index eaa03fa..0000000 --- a/plugins-amdgpu-don-t-print-error-for-no-such-process-.patch +++ /dev/null @@ -1,35 +0,0 @@ -From a9cbdad76fa6daf95ea38bd1d5f912d260a84aed Mon Sep 17 00:00:00 2001 -From: David Francis -Date: Tue, 30 Jan 2024 14:59:48 -0500 -Subject: [PATCH] plugin/amdgpu: Don't print error for "No such process" during - resume - -During the late stages of restore, each process being resumed gets -an ioctl call to KFD_CRIU_OP_RESUME. If the process has no kfd -process info, this call with fail with -ESRCH. This is normal -behaviour, so we shouldn't print an error message for it. - -Signed-off-by: David Francis ---- - plugins/amdgpu/amdgpu_plugin.c | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -diff --git a/plugins/amdgpu/amdgpu_plugin.c b/plugins/amdgpu/amdgpu_plugin.c -index 32ff8f936..3675353a7 100644 ---- a/plugins/amdgpu/amdgpu_plugin.c -+++ b/plugins/amdgpu/amdgpu_plugin.c -@@ -1999,7 +1999,10 @@ int amdgpu_plugin_resume_devices_late(int target_pid) - args.op = KFD_CRIU_OP_RESUME; - pr_info("Calling IOCTL to start notifiers and queues\n"); - if (kmtIoctl(fd, AMDKFD_IOC_CRIU_OP, &args) == -1) { -- pr_perror("restore late ioctl failed"); -+ if (errno == ESRCH) -+ pr_info("Pid %d has no kfd process info\n", target_pid); -+ else -+ pr_perror("restore late ioctl failed"); - ret = -1; - } - --- -2.45.1 - diff --git a/plugins-amdgpu-fix-cross-compilation.patch b/plugins-amdgpu-fix-cross-compilation.patch deleted file mode 100644 index 4e2b130..0000000 --- a/plugins-amdgpu-fix-cross-compilation.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 28331d51935eba559c0bcd55f27abdd4983901a2 Mon Sep 17 00:00:00 2001 -From: Radostin Stoyanov -Date: Tue, 9 Jul 2024 13:07:03 +0100 -Subject: [PATCH 1/3] plugins/amdgpu: fix cross-compilation - -To enable cross-compile we need to use the CC definition from -criu/scripts/nmk/scripts/tools.mk: - -CC := $(CROSS_COMPILE)$(HOSTCC) - -Signed-off-by: Radostin Stoyanov ---- - plugins/amdgpu/Makefile | 1 - - 1 file changed, 1 deletion(-) - -diff --git a/plugins/amdgpu/Makefile b/plugins/amdgpu/Makefile -index 5efa8fb0b..d9f0da1eb 100644 ---- a/plugins/amdgpu/Makefile -+++ b/plugins/amdgpu/Makefile -@@ -15,7 +15,6 @@ DEPS_NOK := ; - __nmk_dir ?= ../../scripts/nmk/scripts/ - include $(__nmk_dir)msg.mk - --CC := gcc - PLUGIN_CFLAGS := -g -Wall -Werror -D _GNU_SOURCE -shared -nostartfiles -fPIC -DCR_PLUGIN_DEFAULT="$(PLUGINDIR)" - PLUGIN_LDFLAGS := -lpthread -lrt -ldrm -ldrm_amdgpu - --- -2.45.1 - diff --git a/plugins-amdgpu-fix-lint-errors.patch b/plugins-amdgpu-fix-lint-errors.patch deleted file mode 100644 index 1cb40ab..0000000 --- a/plugins-amdgpu-fix-lint-errors.patch +++ /dev/null @@ -1,134 +0,0 @@ -From 6d37f9a4df8727e5beb7a9f5e0dc5165bcc33cea Mon Sep 17 00:00:00 2001 -From: Radostin Stoyanov -Date: Fri, 9 Feb 2024 14:14:10 +0000 -Subject: [PATCH] amdgpu_plugin: fix lint errors - -$ make lint - ... - # Do not append \n to pr_perror, pr_pwarn or fail - ! git --no-pager grep -E '^\s*\<(pr_perror|pr_pwarn|fail)\>.*\\n"' - plugins/amdgpu/amdgpu_plugin.c: pr_perror("%s(), Can't handle VMAs of input device\n", __func__); - - ! git --no-pager grep -En '^\s*\.*);$' | grep -v '\\n' - plugins/amdgpu/amdgpu_plugin_drm.c:45: pr_err("Error in getting stat for: %s", path); - plugins/amdgpu/amdgpu_plugin_util.c:77: pr_err("Unable to read file (read:%ld buf_len:%ld)", len_read, buf_len); - plugins/amdgpu/amdgpu_plugin_util.c:89: pr_err("Unable to write file (wrote:%ld buf_len:%ld)", len_write, buf_len); - plugins/amdgpu/amdgpu_plugin_util.c:120: pr_err("%s: Failed to open for %s", path, write ? "write" : "read"); - plugins/amdgpu/amdgpu_plugin_util.c:126: pr_err("%s: Failed get pointer for %s", path, write ? "write" : "read"); - plugins/amdgpu/amdgpu_plugin_util.c:136: pr_err("%s:Failed to access file size", path); - plugins/amdgpu/amdgpu_plugin_util.c:152: pr_err("Cannot fopen %s", file_path); - - make: *** [Makefile:470: lint] Error 1 - -Signed-off-by: Radostin Stoyanov ---- - plugins/amdgpu/amdgpu_plugin.c | 2 +- - plugins/amdgpu/amdgpu_plugin_drm.c | 3 +-- - plugins/amdgpu/amdgpu_plugin_util.c | 16 +++++++--------- - 3 files changed, 9 insertions(+), 12 deletions(-) - -diff --git a/plugins/amdgpu/amdgpu_plugin.c b/plugins/amdgpu/amdgpu_plugin.c -index a579158d0..a41469a50 100644 ---- a/plugins/amdgpu/amdgpu_plugin.c -+++ b/plugins/amdgpu/amdgpu_plugin.c -@@ -412,7 +412,7 @@ int amdgpu_plugin_handle_device_vma(int fd, const struct stat *st_buf) - /* Determine if input is a DRM device and therefore is supported */ - ret = amdgpu_plugin_drm_handle_device_vma(fd, st_buf); - if (ret) -- pr_perror("%s(), Can't handle VMAs of input device\n", __func__); -+ pr_perror("%s(), Can't handle VMAs of input device", __func__); - - return ret; - } -diff --git a/plugins/amdgpu/amdgpu_plugin_drm.c b/plugins/amdgpu/amdgpu_plugin_drm.c -index 689d62072..d54cd937d 100644 ---- a/plugins/amdgpu/amdgpu_plugin_drm.c -+++ b/plugins/amdgpu/amdgpu_plugin_drm.c -@@ -42,7 +42,7 @@ int amdgpu_plugin_drm_handle_device_vma(int fd, const struct stat *st) - snprintf(path, sizeof(path), AMDGPU_DRM_DEVICE, DRM_FIRST_RENDER_NODE); - ret = stat(path, &drm); - if (ret == -1) { -- pr_err("Error in getting stat for: %s", path); -+ pr_err("Error in getting stat for: %s\n", path); - return ret; - } - -@@ -98,4 +98,3 @@ int amdgpu_plugin_drm_dump_file(int fd, int id, struct stat *drm) - xfree(buf); - return ret; - } -- -diff --git a/plugins/amdgpu/amdgpu_plugin_util.c b/plugins/amdgpu/amdgpu_plugin_util.c -index 48ff70555..62e569fc8 100755 ---- a/plugins/amdgpu/amdgpu_plugin_util.c -+++ b/plugins/amdgpu/amdgpu_plugin_util.c -@@ -65,7 +65,7 @@ void init_gpu_count(struct tp_system *topo) - return; - - /* We add ONE to include checkpointing of KFD device */ -- dev_file_cnt = 1 + topology_gpu_count(topo); -+ dev_file_cnt = 1 + topology_gpu_count(topo); - } - - int read_fp(FILE *fp, void *buf, const size_t buf_len) -@@ -74,7 +74,7 @@ int read_fp(FILE *fp, void *buf, const size_t buf_len) - - len_read = fread(buf, 1, buf_len, fp); - if (len_read != buf_len) { -- pr_err("Unable to read file (read:%ld buf_len:%ld)", len_read, buf_len); -+ pr_err("Unable to read file (read:%ld buf_len:%ld)\n", len_read, buf_len); - return -EIO; - } - return 0; -@@ -86,7 +86,7 @@ int write_fp(FILE *fp, const void *buf, const size_t buf_len) - - len_write = fwrite(buf, 1, buf_len, fp); - if (len_write != buf_len) { -- pr_err("Unable to write file (wrote:%ld buf_len:%ld)", len_write, buf_len); -+ pr_err("Unable to write file (wrote:%ld buf_len:%ld)\n", len_write, buf_len); - return -EIO; - } - return 0; -@@ -117,13 +117,13 @@ FILE *open_img_file(char *path, bool write, size_t *size) - fd = openat(criu_get_image_dir(), path, write ? (O_WRONLY | O_CREAT) : O_RDONLY, 0600); - - if (fd < 0) { -- pr_err("%s: Failed to open for %s", path, write ? "write" : "read"); -+ pr_err("%s: Failed to open for %s\n", path, write ? "write" : "read"); - return NULL; - } - - fp = fdopen(fd, write ? "w" : "r"); - if (!fp) { -- pr_err("%s: Failed get pointer for %s", path, write ? "write" : "read"); -+ pr_err("%s: Failed get pointer for %s\n", path, write ? "write" : "read"); - return NULL; - } - -@@ -133,7 +133,7 @@ FILE *open_img_file(char *path, bool write, size_t *size) - ret = read_fp(fp, size, sizeof(*size)); - - if (ret) { -- pr_err("%s:Failed to access file size", path); -+ pr_err("%s:Failed to access file size\n", path); - fclose(fp); - return NULL; - } -@@ -149,7 +149,7 @@ int read_file(const char *file_path, void *buf, const size_t buf_len) - - fp = fopen(file_path, "r"); - if (!fp) { -- pr_err("Cannot fopen %s", file_path); -+ pr_err("Cannot fopen %s\n", file_path); - return -errno; - } - -@@ -204,5 +204,3 @@ void print_kfd_bo_stat(int bo_cnt, struct kfd_criu_bo_bucket *bo_list) - } - pr_info("\n"); - } -- -- --- -2.45.1 - diff --git a/plugins-amdgpu-fix-printf-format-specifiers.patch b/plugins-amdgpu-fix-printf-format-specifiers.patch deleted file mode 100644 index dd15ba3..0000000 --- a/plugins-amdgpu-fix-printf-format-specifiers.patch +++ /dev/null @@ -1,119 +0,0 @@ -From f216ddcc9d4266daff5d75fff0d5c84c6000f7c7 Mon Sep 17 00:00:00 2001 -From: Radostin Stoyanov -Date: Wed, 10 Jul 2024 04:36:18 +0100 -Subject: [PATCH 3/3] plugins/amdgpu: fix printf format specifiers - -Errors on aarch64: - - In file included from amdgpu_plugin_drm.h:10, - from amdgpu_plugin.c:33: - amdgpu_plugin.c: In function 'amdgpu_plugin_dump_file': - amdgpu_plugin_util.h:24:20: error: format '%lld' expects argument of type 'long long int', but argument 6 has type '__u64' {aka 'long unsigned int'} [-Werror=format=] - 24 | #define LOG_PREFIX "amdgpu_plugin: " - | ^~~~~~~~~~~~~~~~~ - ../../criu/include/log.h:47:52: note: in expansion of macro 'LOG_PREFIX' - 47 | #define pr_info(fmt, ...) print_on_level(LOG_INFO, LOG_PREFIX fmt, ##__VA_ARGS__) - | ^~~~~~~~~~ - amdgpu_plugin.c:1236:9: note: in expansion of macro 'pr_info' - 1236 | pr_info("devices:%d bos:%d objects:%d priv_data:%lld\n", args.num_devices, args.num_bos, args.num_objects, - | ^~~~~~~ - cc1: all warnings being treated as errors - -Errors on ppc64: - - In file included from amdgpu_plugin_drm.h:10, - from amdgpu_plugin.c:33: - amdgpu_plugin.c: In function 'amdgpu_plugin_dump_file': - amdgpu_plugin_util.h:24:20: error: format '%llu' expects argument of type 'long long unsigned int', but argument 6 has type '__u64' {aka 'long unsigned int'} [-Werror=format=] - 24 | #define LOG_PREFIX "amdgpu_plugin: " - | ^~~~~~~~~~~~~~~~~ - ../../criu/include/log.h:47:52: note: in expansion of macro 'LOG_PREFIX' - 47 | #define pr_info(fmt, ...) print_on_level(LOG_INFO, LOG_PREFIX fmt, ##__VA_ARGS__) - | ^~~~~~~~~~ - amdgpu_plugin.c:1236:9: note: in expansion of macro 'pr_info' - 1236 | pr_info("devices:%u bos:%u objects:%u priv_data:%llu\n", - | ^~~~~~~ - cc1: all warnings being treated as errors - In file included from amdgpu_plugin_util.c:38: - amdgpu_plugin_util.c: In function 'print_kfd_bo_stat': - amdgpu_plugin_util.h:24:20: error: format '%llx' expects argument of type 'long long unsigned int', but argument 5 has type '__u64' {aka 'long unsigned int'} [-Werror=format=] - 24 | #define LOG_PREFIX "amdgpu_plugin: " - | ^~~~~~~~~~~~~~~~~ - ../../criu/include/log.h:47:52: note: in expansion of macro 'LOG_PREFIX' - 47 | #define pr_info(fmt, ...) print_on_level(LOG_INFO, LOG_PREFIX fmt, ##__VA_ARGS__) - | ^~~~~~~~~~ - amdgpu_plugin_util.c:196:17: note: in expansion of macro 'pr_info' - 196 | pr_info("%s(), %d. KFD BO Addr: %llx \n", __func__, idx, bo->addr); - | ^~~~~~~ - amdgpu_plugin_util.h:24:20: error: format '%llx' expects argument of type 'long long unsigned int', but argument 5 has type '__u64' {aka 'long unsigned int'} [-Werror=format=] - 24 | #define LOG_PREFIX "amdgpu_plugin: " - | ^~~~~~~~~~~~~~~~~ - ../../criu/include/log.h:47:52: note: in expansion of macro 'LOG_PREFIX' - 47 | #define pr_info(fmt, ...) print_on_level(LOG_INFO, LOG_PREFIX fmt, ##__VA_ARGS__) - | ^~~~~~~~~~ - amdgpu_plugin_util.c:197:17: note: in expansion of macro 'pr_info' - 197 | pr_info("%s(), %d. KFD BO Size: %llx \n", __func__, idx, bo->size); - | ^~~~~~~ - amdgpu_plugin_util.h:24:20: error: format '%llx' expects argument of type 'long long unsigned int', but argument 5 has type '__u64' {aka 'long unsigned int'} [-Werror=format=] - 24 | #define LOG_PREFIX "amdgpu_plugin: " - | ^~~~~~~~~~~~~~~~~ - ../../criu/include/log.h:47:52: note: in expansion of macro 'LOG_PREFIX' - 47 | #define pr_info(fmt, ...) print_on_level(LOG_INFO, LOG_PREFIX fmt, ##__VA_ARGS__) - | ^~~~~~~~~~ - amdgpu_plugin_util.c:198:17: note: in expansion of macro 'pr_info' - 198 | pr_info("%s(), %d. KFD BO Offset: %llx \n", __func__, idx, bo->offset); - | ^~~~~~~ - amdgpu_plugin_util.h:24:20: error: format '%llx' expects argument of type 'long long unsigned int', but argument 5 has type '__u64' {aka 'long unsigned int'} [-Werror=format=] - 24 | #define LOG_PREFIX "amdgpu_plugin: " - | ^~~~~~~~~~~~~~~~~ - ../../criu/include/log.h:47:52: note: in expansion of macro 'LOG_PREFIX' - 47 | #define pr_info(fmt, ...) print_on_level(LOG_INFO, LOG_PREFIX fmt, ##__VA_ARGS__) - | ^~~~~~~~~~ - amdgpu_plugin_util.c:199:17: note: in expansion of macro 'pr_info' - 199 | pr_info("%s(), %d. KFD BO Restored Offset: %llx \n", __func__, idx, bo->restored_offset); - | ^~~~~~~ - cc1: all warnings being treated as errors - -Signed-off-by: Radostin Stoyanov ---- - plugins/amdgpu/amdgpu_plugin.c | 4 ++-- - plugins/amdgpu/amdgpu_plugin_util.c | 8 ++++---- - 2 files changed, 6 insertions(+), 6 deletions(-) - -diff --git a/plugins/amdgpu/amdgpu_plugin.c b/plugins/amdgpu/amdgpu_plugin.c -index a41469a50..924bf6c76 100644 ---- a/plugins/amdgpu/amdgpu_plugin.c -+++ b/plugins/amdgpu/amdgpu_plugin.c -@@ -1233,8 +1233,8 @@ int amdgpu_plugin_dump_file(int fd, int id) - goto exit; - } - -- pr_info("devices:%d bos:%d objects:%d priv_data:%lld\n", args.num_devices, args.num_bos, args.num_objects, -- args.priv_data_size); -+ pr_info("devices:%u bos:%u objects:%u priv_data:%llu\n", -+ args.num_devices, args.num_bos, args.num_objects, (unsigned long long)args.priv_data_size); - - e = xmalloc(sizeof(*e)); - if (!e) { -diff --git a/plugins/amdgpu/amdgpu_plugin_util.c b/plugins/amdgpu/amdgpu_plugin_util.c -index 62e569fc8..2ed3a6b82 100755 ---- a/plugins/amdgpu/amdgpu_plugin_util.c -+++ b/plugins/amdgpu/amdgpu_plugin_util.c -@@ -193,10 +193,10 @@ void print_kfd_bo_stat(int bo_cnt, struct kfd_criu_bo_bucket *bo_list) - for (int idx = 0; idx < bo_cnt; idx++) { - bo = &bo_list[idx]; - pr_info("\n"); -- pr_info("%s(), %d. KFD BO Addr: %llx \n", __func__, idx, bo->addr); -- pr_info("%s(), %d. KFD BO Size: %llx \n", __func__, idx, bo->size); -- pr_info("%s(), %d. KFD BO Offset: %llx \n", __func__, idx, bo->offset); -- pr_info("%s(), %d. KFD BO Restored Offset: %llx \n", __func__, idx, bo->restored_offset); -+ pr_info("%s(), %d. KFD BO Addr: %llx \n", __func__, idx, (unsigned long long)bo->addr); -+ pr_info("%s(), %d. KFD BO Size: %llx \n", __func__, idx, (unsigned long long)bo->size); -+ pr_info("%s(), %d. KFD BO Offset: %llx \n", __func__, idx, (unsigned long long)bo->offset); -+ pr_info("%s(), %d. KFD BO Restored Offset: %llx \n", __func__, idx, (unsigned long long)bo->restored_offset); - pr_info("%s(), %d. KFD BO Alloc Flags: %x \n", __func__, idx, bo->alloc_flags); - pr_info("%s(), %d. KFD BO Gpu ID: %x \n", __func__, idx, bo->gpu_id); - pr_info("%s(), %d. KFD BO Dmabuf FD: %x \n", __func__, idx, bo->dmabuf_fd); --- -2.45.1 - diff --git a/plugins-amdgpu-refactor-code-in-preparation-to-suppor.patch b/plugins-amdgpu-refactor-code-in-preparation-to-suppor.patch deleted file mode 100644 index c83be02..0000000 --- a/plugins-amdgpu-refactor-code-in-preparation-to-suppor.patch +++ /dev/null @@ -1,1013 +0,0 @@ -From 81f2c41df6ffee7e4962b1facb17c327676285cc Mon Sep 17 00:00:00 2001 -From: Ramesh Errabolu -Date: Fri, 10 Nov 2023 11:36:34 -0600 -Subject: [PATCH] amdgpu_plugin: Refactor code in preparation to support C&R - for DRM devices - -Add a new compilation unit to host symbols and methods that will be -needed to C&R DRM devices. Refactor code that indicates support for -C&R and checkpoints KFD and DRM devices - -Signed-off-by: Ramesh Errabolu ---- - plugins/amdgpu/Makefile | 2 +- - plugins/amdgpu/amdgpu_plugin.c | 245 ++++-------------------- - plugins/amdgpu/amdgpu_plugin_drm.c | 63 ++++++ - plugins/amdgpu/amdgpu_plugin_drm.h | 22 +++ - plugins/amdgpu/amdgpu_plugin_topology.c | 41 ++-- - plugins/amdgpu/amdgpu_plugin_topology.h | 2 + - plugins/amdgpu/amdgpu_plugin_util.c | 208 ++++++++++++++++++++ - plugins/amdgpu/amdgpu_plugin_util.h | 106 ++++++++++ - plugins/amdgpu/criu-amdgpu.proto | 18 +- - 9 files changed, 460 insertions(+), 247 deletions(-) - create mode 100644 plugins/amdgpu/amdgpu_plugin_drm.c - create mode 100644 plugins/amdgpu/amdgpu_plugin_drm.h - create mode 100755 plugins/amdgpu/amdgpu_plugin_util.c - create mode 100755 plugins/amdgpu/amdgpu_plugin_util.h - -diff --git a/plugins/amdgpu/Makefile b/plugins/amdgpu/Makefile -index 64a923d38..5efa8fb0b 100644 ---- a/plugins/amdgpu/Makefile -+++ b/plugins/amdgpu/Makefile -@@ -28,7 +28,7 @@ endif - criu-amdgpu.pb-c.c: criu-amdgpu.proto - protoc-c --proto_path=. --c_out=. criu-amdgpu.proto - --amdgpu_plugin.so: amdgpu_plugin.c amdgpu_plugin_topology.c criu-amdgpu.pb-c.c -+amdgpu_plugin.so: amdgpu_plugin.c amdgpu_plugin_drm.c amdgpu_plugin_topology.c amdgpu_plugin_util.c criu-amdgpu.pb-c.c - $(CC) $(PLUGIN_CFLAGS) $(shell $(COMPEL) includes) $^ -o $@ $(PLUGIN_INCLUDE) $(PLUGIN_LDFLAGS) $(LIBDRM_INC) - - amdgpu_plugin_clean: -diff --git a/plugins/amdgpu/amdgpu_plugin.c b/plugins/amdgpu/amdgpu_plugin.c -index 23253632d..60e04f973 100644 ---- a/plugins/amdgpu/amdgpu_plugin.c -+++ b/plugins/amdgpu/amdgpu_plugin.c -@@ -30,55 +30,14 @@ - #include "files.h" - - #include "common/list.h" -+#include "amdgpu_plugin_drm.h" -+#include "amdgpu_plugin_util.h" - #include "amdgpu_plugin_topology.h" - - #include "img-streamer.h" - #include "image.h" - #include "cr_options.h" - --#define AMDGPU_KFD_DEVICE "/dev/kfd" --#define PROCPIDMEM "/proc/%d/mem" --#define HSAKMT_SHM_PATH "/dev/shm/hsakmt_shared_mem" --#define HSAKMT_SHM "/hsakmt_shared_mem" --#define HSAKMT_SEM_PATH "/dev/shm/sem.hsakmt_semaphore" --#define HSAKMT_SEM "hsakmt_semaphore" -- --#define KFD_IOCTL_MAJOR_VERSION 1 --#define MIN_KFD_IOCTL_MINOR_VERSION 8 -- --#define IMG_KFD_FILE "amdgpu-kfd-%d.img" --#define IMG_RENDERD_FILE "amdgpu-renderD-%d.img" --#define IMG_PAGES_FILE "amdgpu-pages-%d-%04x.img" -- --#ifndef _GNU_SOURCE --#define _GNU_SOURCE 1 --#endif -- --#ifdef LOG_PREFIX --#undef LOG_PREFIX --#endif --#define LOG_PREFIX "amdgpu_plugin: " -- --#ifdef DEBUG --#define plugin_log_msg(fmt, ...) pr_debug(fmt, ##__VA_ARGS__) --#else --#define plugin_log_msg(fmt, ...) \ -- { \ -- } --#endif -- --#define SDMA_PACKET(op, sub_op, e) ((((e)&0xFFFF) << 16) | (((sub_op)&0xFF) << 8) | (((op)&0xFF) << 0)) -- --#define SDMA_OPCODE_COPY 1 --#define SDMA_COPY_SUB_OPCODE_LINEAR 0 --#define SDMA_NOP 0 --#define SDMA_LINEAR_COPY_MAX_SIZE (1ULL << 21) -- --enum sdma_op_type { -- SDMA_OP_VRAM_READ, -- SDMA_OP_VRAM_WRITE, --}; -- - struct vma_metadata { - struct list_head list; - uint64_t old_pgoff; -@@ -89,143 +48,13 @@ struct vma_metadata { - }; - - /************************************ Global Variables ********************************************/ --struct tp_system src_topology; --struct tp_system dest_topology; -- --struct device_maps checkpoint_maps; --struct device_maps restore_maps; -- --extern int fd_next; - - static LIST_HEAD(update_vma_info_list); - --extern bool kfd_fw_version_check; --extern bool kfd_sdma_fw_version_check; --extern bool kfd_caches_count_check; --extern bool kfd_num_gws_check; --extern bool kfd_vram_size_check; --extern bool kfd_numa_check; --extern bool kfd_capability_check; -- - size_t kfd_max_buffer_size; - - /**************************************************************************************************/ - --int write_fp(FILE *fp, const void *buf, const size_t buf_len) --{ -- size_t len_write; -- -- len_write = fwrite(buf, 1, buf_len, fp); -- if (len_write != buf_len) { -- pr_perror("Unable to write file (wrote:%ld buf_len:%ld)", len_write, buf_len); -- return -EIO; -- } -- return 0; --} -- --int read_fp(FILE *fp, void *buf, const size_t buf_len) --{ -- size_t len_read; -- -- len_read = fread(buf, 1, buf_len, fp); -- if (len_read != buf_len) { -- pr_perror("Unable to read file (read:%ld buf_len:%ld)", len_read, buf_len); -- return -EIO; -- } -- return 0; --} -- --/** -- * @brief Open an image file -- * -- * We store the size of the actual contents in the first 8-bytes of the file. This allows us to -- * determine the file size when using criu_image_streamer when fseek and fstat are not available. -- * The FILE * returned is already at the location of the first actual contents. -- * -- * @param path The file path -- * @param write False for read, true for write -- * @param size Size of actual contents -- * @return FILE *if successful, NULL if failed -- */ --FILE *open_img_file(char *path, bool write, size_t *size) --{ -- FILE *fp = NULL; -- int fd, ret; -- -- if (opts.stream) -- fd = img_streamer_open(path, write ? O_DUMP : O_RSTR); -- else -- fd = openat(criu_get_image_dir(), path, write ? (O_WRONLY | O_CREAT) : O_RDONLY, 0600); -- -- if (fd < 0) { -- pr_perror("%s: Failed to open for %s", path, write ? "write" : "read"); -- return NULL; -- } -- -- fp = fdopen(fd, write ? "w" : "r"); -- if (!fp) { -- pr_perror("%s: Failed get pointer for %s", path, write ? "write" : "read"); -- close(fd); -- return NULL; -- } -- -- if (write) -- ret = write_fp(fp, size, sizeof(*size)); -- else -- ret = read_fp(fp, size, sizeof(*size)); -- -- if (ret) { -- pr_perror("%s:Failed to access file size", path); -- fclose(fp); -- return NULL; -- } -- -- pr_debug("%s:Opened file for %s with size:%ld\n", path, write ? "write" : "read", *size); -- return fp; --} -- --/** -- * @brief Write an image file -- * -- * We store the size of the actual contents in the first 8-bytes of the file. This allows us to -- * determine the file size when using criu_image_streamer when fseek and fstat are not available. -- * -- * @param path The file path -- * @param buf pointer to data to be written -- * @param buf_len size of buf -- * @return 0 if successful. -errno on failure -- */ --int write_img_file(char *path, const void *buf, const size_t buf_len) --{ -- int ret; -- FILE *fp; -- size_t len = buf_len; -- -- fp = open_img_file(path, true, &len); -- if (!fp) -- return -errno; -- -- ret = write_fp(fp, buf, buf_len); -- fclose(fp); /* this will also close fd */ -- return ret; --} -- --int read_file(const char *file_path, void *buf, const size_t buf_len) --{ -- int ret; -- FILE *fp; -- -- fp = fopen(file_path, "r"); -- if (!fp) { -- pr_perror("Cannot fopen %s", file_path); -- return -errno; -- } -- -- ret = read_fp(fp, buf, buf_len); -- fclose(fp); /* this will also close fd */ -- return ret; --} -- - /* Call ioctl, restarting if it is interrupted */ - int kmtIoctl(int fd, unsigned long request, void *arg) - { -@@ -263,21 +92,21 @@ static void free_e(CriuKfd *e) - - static int allocate_device_entries(CriuKfd *e, int num_of_devices) - { -- e->device_entries = xmalloc(sizeof(DeviceEntry *) * num_of_devices); -+ e->device_entries = xmalloc(sizeof(KfdDeviceEntry *) * num_of_devices); - if (!e->device_entries) { - pr_err("Failed to allocate device_entries\n"); - return -ENOMEM; - } - - for (int i = 0; i < num_of_devices; i++) { -- DeviceEntry *entry = xzalloc(sizeof(*entry)); -+ KfdDeviceEntry *entry = xzalloc(sizeof(*entry)); - - if (!entry) { - pr_err("Failed to allocate entry\n"); - return -ENOMEM; - } - -- device_entry__init(entry); -+ kfd_device_entry__init(entry); - - e->device_entries[i] = entry; - e->n_device_entries++; -@@ -287,21 +116,21 @@ static int allocate_device_entries(CriuKfd *e, int num_of_devices) - - static int allocate_bo_entries(CriuKfd *e, int num_bos, struct kfd_criu_bo_bucket *bo_bucket_ptr) - { -- e->bo_entries = xmalloc(sizeof(BoEntry *) * num_bos); -+ e->bo_entries = xmalloc(sizeof(KfdBoEntry *) * num_bos); - if (!e->bo_entries) { - pr_err("Failed to allocate bo_info\n"); - return -ENOMEM; - } - - for (int i = 0; i < num_bos; i++) { -- BoEntry *entry = xzalloc(sizeof(*entry)); -+ KfdBoEntry *entry = xzalloc(sizeof(*entry)); - - if (!entry) { - pr_err("Failed to allocate botest\n"); - return -ENOMEM; - } - -- bo_entry__init(entry); -+ kfd_bo_entry__init(entry); - - e->bo_entries[i] = entry; - e->n_bo_entries++; -@@ -309,13 +138,13 @@ static int allocate_bo_entries(CriuKfd *e, int num_bos, struct kfd_criu_bo_bucke - return 0; - } - --int topology_to_devinfo(struct tp_system *sys, struct device_maps *maps, DeviceEntry **deviceEntries) -+int topology_to_devinfo(struct tp_system *sys, struct device_maps *maps, KfdDeviceEntry **deviceEntries) - { - uint32_t devinfo_index = 0; - struct tp_node *node; - - list_for_each_entry(node, &sys->nodes, listm_system) { -- DeviceEntry *devinfo = deviceEntries[devinfo_index++]; -+ KfdDeviceEntry *devinfo = deviceEntries[devinfo_index++]; - - devinfo->node_id = node->id; - -@@ -383,11 +212,11 @@ int topology_to_devinfo(struct tp_system *sys, struct device_maps *maps, DeviceE - return 0; - } - --int devinfo_to_topology(DeviceEntry *devinfos[], uint32_t num_devices, struct tp_system *sys) -+int devinfo_to_topology(KfdDeviceEntry *devinfos[], uint32_t num_devices, struct tp_system *sys) - { - for (int i = 0; i < num_devices; i++) { - struct tp_node *node; -- DeviceEntry *devinfo = devinfos[i]; -+ KfdDeviceEntry *devinfo = devinfos[i]; - - node = sys_add_node(sys, devinfo->node_id, devinfo->gpu_id); - if (!node) -@@ -549,7 +378,7 @@ struct thread_data { - uint32_t gpu_id; - pid_t pid; - struct kfd_criu_bo_bucket *bo_buckets; -- BoEntry **bo_entries; -+ KfdBoEntry **bo_entries; - int drm_fd; - int ret; - int id; /* File ID used by CRIU to identify KFD image for this process */ -@@ -557,8 +386,7 @@ struct thread_data { - - int amdgpu_plugin_handle_device_vma(int fd, const struct stat *st_buf) - { -- struct stat st_kfd, st_dri_min; -- char img_path[128]; -+ struct stat st_kfd; - int ret = 0; - - pr_debug("Enter %s\n", __func__); -@@ -568,27 +396,18 @@ int amdgpu_plugin_handle_device_vma(int fd, const struct stat *st_buf) - return ret; - } - -- snprintf(img_path, sizeof(img_path), "/dev/dri/renderD%d", DRM_FIRST_RENDER_NODE); -- -- ret = stat(img_path, &st_dri_min); -- if (ret == -1) { -- pr_perror("stat error for %s", img_path); -- return ret; -- } -- -- if (major(st_buf->st_rdev) == major(st_kfd.st_rdev) || ((major(st_buf->st_rdev) == major(st_dri_min.st_rdev)) && -- (minor(st_buf->st_rdev) >= minor(st_dri_min.st_rdev) && -- minor(st_buf->st_rdev) >= DRM_FIRST_RENDER_NODE))) { -+ /* If input device is KFD return device as supported */ -+ if (major(st_buf->st_rdev) == major(st_kfd.st_rdev)) { - pr_debug("Known non-regular mapping, kfd-renderD%d -> OK\n", minor(st_buf->st_rdev)); -- pr_debug("AMD KFD(maj) = %d, DRI(maj,min) = %d:%d VMA Device fd(maj,min) = %d:%d\n", -- major(st_kfd.st_rdev), major(st_dri_min.st_rdev), minor(st_dri_min.st_rdev), -- major(st_buf->st_rdev), minor(st_buf->st_rdev)); -- /* VMA belongs to kfd */ - return 0; - } - -- pr_perror("Can't handle the VMA mapping"); -- return -ENOTSUP; -+ /* Determine if input is a DRM device and therefore is supported */ -+ ret = amdgpu_plugin_drm_handle_device_vma(fd, st_buf); -+ if (ret) -+ pr_perror("%s(), Can't handle VMAs of input device\n", __func__); -+ -+ return ret; - } - CR_PLUGIN_REGISTER_HOOK(CR_PLUGIN_HOOK__HANDLE_DEVICE_VMA, amdgpu_plugin_handle_device_vma) - -@@ -655,8 +474,9 @@ void free_and_unmap(uint64_t size, amdgpu_bo_handle h_bo, amdgpu_va_handle h_va, - amdgpu_bo_free(h_bo); - } - --int sdma_copy_bo(struct kfd_criu_bo_bucket bo_bucket, FILE *storage_fp, void *buffer, size_t buffer_size, -- amdgpu_device_handle h_dev, uint64_t max_copy_size, enum sdma_op_type type) -+static int sdma_copy_bo(struct kfd_criu_bo_bucket bo_bucket, FILE *storage_fp, -+ void *buffer, size_t buffer_size, amdgpu_device_handle h_dev, -+ uint64_t max_copy_size, enum sdma_op_type type) - { - uint64_t size, src_bo_size, dst_bo_size, buffer_bo_size, bytes_remain, buffer_space_remain; - uint64_t gpu_addr_src, gpu_addr_dst, gpu_addr_ib, copy_src, copy_dst, copy_size; -@@ -954,7 +774,7 @@ void *dump_bo_contents(void *_thread_data) - goto exit; - } - -- snprintf(img_path, sizeof(img_path), IMG_PAGES_FILE, thread_data->id, thread_data->gpu_id); -+ snprintf(img_path, sizeof(img_path), IMG_KFD_PAGES_FILE, thread_data->id, thread_data->gpu_id); - bo_contents_fp = open_img_file(img_path, true, &image_size); - if (!bo_contents_fp) { - pr_perror("Cannot fopen %s", img_path); -@@ -1027,7 +847,7 @@ void *restore_bo_contents(void *_thread_data) - max_copy_size = (gpu_info.family_id >= AMDGPU_FAMILY_AI) ? SDMA_LINEAR_COPY_MAX_SIZE : - SDMA_LINEAR_COPY_MAX_SIZE - 1; - -- snprintf(img_path, sizeof(img_path), IMG_PAGES_FILE, thread_data->id, thread_data->gpu_id); -+ snprintf(img_path, sizeof(img_path), IMG_KFD_PAGES_FILE, thread_data->id, thread_data->gpu_id); - bo_contents_fp = open_img_file(img_path, false, &image_size); - if (!bo_contents_fp) { - pr_perror("Cannot fopen %s", img_path); -@@ -1234,7 +1054,7 @@ static int save_bos(int id, int fd, struct kfd_ioctl_criu_args *args, struct kfd - - for (i = 0; i < e->num_of_bos; i++) { - struct kfd_criu_bo_bucket *bo_bucket = &bo_buckets[i]; -- BoEntry *boinfo = e->bo_entries[i]; -+ KfdBoEntry *boinfo = e->bo_entries[i]; - - boinfo->gpu_id = bo_bucket->gpu_id; - boinfo->addr = bo_bucket->addr; -@@ -1391,7 +1211,7 @@ int amdgpu_plugin_dump_file(int fd, int id) - - criu_render_node__pack(&rd, buf); - -- snprintf(img_path, sizeof(img_path), IMG_RENDERD_FILE, id); -+ snprintf(img_path, sizeof(img_path), IMG_DRM_FILE, id); - ret = write_img_file(img_path, buf, len); - if (ret) { - xfree(buf); -@@ -1399,6 +1219,7 @@ int amdgpu_plugin_dump_file(int fd, int id) - } - - xfree(buf); -+ - /* Need to return success here so that criu can call plugins for renderD nodes */ - return ret; - } -@@ -1531,7 +1352,7 @@ static int restore_devices(struct kfd_ioctl_criu_args *args, CriuKfd *e) - - for (int entries_i = 0; entries_i < e->num_of_cpus + e->num_of_gpus; entries_i++) { - struct kfd_criu_device_bucket *device_bucket; -- DeviceEntry *devinfo = e->device_entries[entries_i]; -+ KfdDeviceEntry *devinfo = e->device_entries[entries_i]; - struct tp_node *tp_node; - - if (!devinfo->gpu_id) -@@ -1581,7 +1402,7 @@ static int restore_bos(struct kfd_ioctl_criu_args *args, CriuKfd *e) - - for (int i = 0; i < args->num_bos; i++) { - struct kfd_criu_bo_bucket *bo_bucket = &bo_buckets[i]; -- BoEntry *bo_entry = e->bo_entries[i]; -+ KfdBoEntry *bo_entry = e->bo_entries[i]; - - bo_bucket->gpu_id = bo_entry->gpu_id; - bo_bucket->addr = bo_entry->addr; -@@ -1736,7 +1557,7 @@ int amdgpu_plugin_restore_file(int id) - * TODO: Currently, this code will only work if this function is called for /dev/kfd - * first as we assume restore_maps is already filled. Need to fix this later. - */ -- snprintf(img_path, sizeof(img_path), IMG_RENDERD_FILE, id); -+ snprintf(img_path, sizeof(img_path), IMG_DRM_FILE, id); - pr_info("Restoring RenderD %s\n", img_path); - - img_fp = open_img_file(img_path, false, &img_size); -diff --git a/plugins/amdgpu/amdgpu_plugin_drm.c b/plugins/amdgpu/amdgpu_plugin_drm.c -new file mode 100644 -index 000000000..a48dc68f0 ---- /dev/null -+++ b/plugins/amdgpu/amdgpu_plugin_drm.c -@@ -0,0 +1,63 @@ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include "common/list.h" -+ -+#include "criu-amdgpu.pb-c.h" -+ -+#include -+#include -+ -+#include "xmalloc.h" -+#include "criu-log.h" -+#include "kfd_ioctl.h" -+#include "amdgpu_plugin_drm.h" -+#include "amdgpu_plugin_util.h" -+#include "amdgpu_plugin_topology.h" -+ -+ -+int amdgpu_plugin_drm_handle_device_vma(int fd, const struct stat *st) -+{ -+ char path[PATH_MAX]; -+ struct stat drm; -+ int ret = 0; -+ -+ snprintf(path, sizeof(path), AMDGPU_DRM_DEVICE, DRM_FIRST_RENDER_NODE); -+ ret = stat(path, &drm); -+ if (ret == -1) { -+ pr_err("Error in getting stat for: %s", path); -+ return ret; -+ } -+ -+ if ((major(st->st_rdev) != major(drm.st_rdev)) || -+ (minor(st->st_rdev) < minor(drm.st_rdev)) || -+ (minor(st->st_rdev) > DRM_LAST_RENDER_NODE)) { -+ pr_err("Can't handle VMA mapping of input device\n"); -+ return -ENOTSUP; -+ } -+ -+ pr_debug("AMD DRI(maj,min) = %d:%d VMA Device FD(maj,min) = %d:%d\n", -+ major(drm.st_rdev), minor(drm.st_rdev), -+ major(st->st_rdev), minor(st->st_rdev)); -+ -+ return 0; -+} -+ -+ -diff --git a/plugins/amdgpu/amdgpu_plugin_drm.h b/plugins/amdgpu/amdgpu_plugin_drm.h -new file mode 100644 -index 000000000..37009c8ba ---- /dev/null -+++ b/plugins/amdgpu/amdgpu_plugin_drm.h -@@ -0,0 +1,22 @@ -+#ifndef __AMDGPU_PLUGIN_DRM_H__ -+#define __AMDGPU_PLUGIN_DRM_H__ -+ -+#include -+#include "common/list.h" -+ -+#include "xmalloc.h" -+#include "criu-log.h" -+#include "kfd_ioctl.h" -+#include "amdgpu_plugin_util.h" -+#include "amdgpu_plugin_topology.h" -+ -+ -+/** -+ * Determines if VMA's of input file descriptor belong to amdgpu's -+ * DRM device and are therefore supported -+ */ -+int amdgpu_plugin_drm_handle_device_vma(int fd, const struct stat *drm); -+ -+ -+#endif /* __AMDGPU_PLUGIN_DRM_H__ */ -+ -diff --git a/plugins/amdgpu/amdgpu_plugin_topology.c b/plugins/amdgpu/amdgpu_plugin_topology.c -index ef79e5ef4..c5fa51fda 100644 ---- a/plugins/amdgpu/amdgpu_plugin_topology.c -+++ b/plugins/amdgpu/amdgpu_plugin_topology.c -@@ -16,35 +16,11 @@ - - #include "xmalloc.h" - #include "kfd_ioctl.h" -+#include "amdgpu_plugin_util.h" - #include "amdgpu_plugin_topology.h" - - #define TOPOLOGY_PATH "/sys/class/kfd/kfd/topology/nodes/" - --#ifndef _GNU_SOURCE --#define _GNU_SOURCE 1 --#endif -- --#ifdef COMPILE_TESTS --#undef pr_err --#define pr_err(format, arg...) fprintf(stdout, "%s:%d ERROR:" format, __FILE__, __LINE__, ##arg) --#undef pr_info --#define pr_info(format, arg...) fprintf(stdout, "%s:%d INFO:" format, __FILE__, __LINE__, ##arg) --#undef pr_debug --#define pr_debug(format, arg...) fprintf(stdout, "%s:%d DBG:" format, __FILE__, __LINE__, ##arg) -- --#undef pr_perror --#define pr_perror(format, arg...) \ -- fprintf(stdout, "%s:%d: " format " (errno = %d (%s))\n", __FILE__, __LINE__, ##arg, errno, strerror(errno)) --#endif -- --#ifdef DEBUG --#define plugin_log_msg(fmt, ...) pr_debug(fmt, ##__VA_ARGS__) --#else --#define plugin_log_msg(fmt, ...) \ -- { \ -- } --#endif -- - /* User override options */ - /* Skip firmware version check */ - bool kfd_fw_version_check = true; -@@ -840,6 +816,9 @@ void topology_free(struct tp_system *sys) - list_del(&p2pgroup->listm_system); - xfree(p2pgroup); - } -+ -+ /* Update Topology as being freed */ -+ sys->parsed = false; - } - - /** -@@ -1461,3 +1440,15 @@ int set_restore_gpu_maps(struct tp_system *src_sys, struct tp_system *dest_sys, - - return ret; - } -+ -+int topology_gpu_count(struct tp_system *sys) -+{ -+ struct tp_node *node; -+ int count = 0; -+ -+ list_for_each_entry(node, &sys->nodes, listm_system) -+ if (NODE_IS_GPU(node)) -+ count++; -+ return count; -+} -+ -diff --git a/plugins/amdgpu/amdgpu_plugin_topology.h b/plugins/amdgpu/amdgpu_plugin_topology.h -index 9d99cda1c..c890e3dda 100644 ---- a/plugins/amdgpu/amdgpu_plugin_topology.h -+++ b/plugins/amdgpu/amdgpu_plugin_topology.h -@@ -107,6 +107,8 @@ int topology_parse(struct tp_system *topology, const char *msg); - int topology_determine_iolinks(struct tp_system *sys); - void topology_print(const struct tp_system *sys, const char *msg); - -+int topology_gpu_count(struct tp_system *topology); -+ - struct id_map *maps_add_gpu_entry(struct device_maps *maps, const uint32_t src_id, const uint32_t dest_id); - - struct tp_node *sys_add_node(struct tp_system *sys, uint32_t id, uint32_t gpu_id); -diff --git a/plugins/amdgpu/amdgpu_plugin_util.c b/plugins/amdgpu/amdgpu_plugin_util.c -new file mode 100755 -index 000000000..48ff70555 ---- /dev/null -+++ b/plugins/amdgpu/amdgpu_plugin_util.c -@@ -0,0 +1,208 @@ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include "common/list.h" -+ -+#include -+#include -+ -+#include "criu-plugin.h" -+#include "plugin.h" -+#include "criu-amdgpu.pb-c.h" -+ -+#include "img-streamer.h" -+#include "image.h" -+#include "cr_options.h" -+ -+#include "xmalloc.h" -+#include "criu-log.h" -+#include "kfd_ioctl.h" -+#include "amdgpu_drm.h" -+#include "amdgpu_plugin_util.h" -+#include "amdgpu_plugin_topology.h" -+ -+/* Tracks number of device files that need to be checkpointed */ -+static int dev_file_cnt = 0; -+ -+/* Helper structures to encode device topology of SRC and DEST platforms */ -+struct tp_system src_topology; -+struct tp_system dest_topology; -+ -+/* Helper structures to encode device maps during Checkpoint and Restore operations */ -+struct device_maps checkpoint_maps; -+struct device_maps restore_maps; -+ -+bool checkpoint_is_complete() -+{ -+ return (dev_file_cnt == 0); -+} -+ -+void decrement_checkpoint_count() -+{ -+ dev_file_cnt--; -+} -+ -+void init_gpu_count(struct tp_system *topo) -+{ -+ if (dev_file_cnt != 0) -+ return; -+ -+ /* We add ONE to include checkpointing of KFD device */ -+ dev_file_cnt = 1 + topology_gpu_count(topo); -+} -+ -+int read_fp(FILE *fp, void *buf, const size_t buf_len) -+{ -+ size_t len_read; -+ -+ len_read = fread(buf, 1, buf_len, fp); -+ if (len_read != buf_len) { -+ pr_err("Unable to read file (read:%ld buf_len:%ld)", len_read, buf_len); -+ return -EIO; -+ } -+ return 0; -+} -+ -+int write_fp(FILE *fp, const void *buf, const size_t buf_len) -+{ -+ size_t len_write; -+ -+ len_write = fwrite(buf, 1, buf_len, fp); -+ if (len_write != buf_len) { -+ pr_err("Unable to write file (wrote:%ld buf_len:%ld)", len_write, buf_len); -+ return -EIO; -+ } -+ return 0; -+} -+ -+/** -+ * @brief Open an image file -+ * -+ * We store the size of the actual contents in the first 8-bytes of -+ * the file. This allows us to determine the file size when using -+ * criu_image_streamer when fseek and fstat are not available. The -+ * FILE * returned is already at the location of the first actual -+ * contents. -+ * -+ * @param path The file path -+ * @param write False for read, true for write -+ * @param size Size of actual contents -+ * @return FILE *if successful, NULL if failed -+ */ -+FILE *open_img_file(char *path, bool write, size_t *size) -+{ -+ FILE *fp = NULL; -+ int fd, ret; -+ -+ if (opts.stream) -+ fd = img_streamer_open(path, write ? O_DUMP : O_RSTR); -+ else -+ fd = openat(criu_get_image_dir(), path, write ? (O_WRONLY | O_CREAT) : O_RDONLY, 0600); -+ -+ if (fd < 0) { -+ pr_err("%s: Failed to open for %s", path, write ? "write" : "read"); -+ return NULL; -+ } -+ -+ fp = fdopen(fd, write ? "w" : "r"); -+ if (!fp) { -+ pr_err("%s: Failed get pointer for %s", path, write ? "write" : "read"); -+ return NULL; -+ } -+ -+ if (write) -+ ret = write_fp(fp, size, sizeof(*size)); -+ else -+ ret = read_fp(fp, size, sizeof(*size)); -+ -+ if (ret) { -+ pr_err("%s:Failed to access file size", path); -+ fclose(fp); -+ return NULL; -+ } -+ -+ pr_debug("%s:Opened file for %s with size:%ld\n", path, write ? "write" : "read", *size); -+ return fp; -+} -+ -+int read_file(const char *file_path, void *buf, const size_t buf_len) -+{ -+ int ret; -+ FILE *fp; -+ -+ fp = fopen(file_path, "r"); -+ if (!fp) { -+ pr_err("Cannot fopen %s", file_path); -+ return -errno; -+ } -+ -+ ret = read_fp(fp, buf, buf_len); -+ fclose(fp); /* this will also close fd */ -+ return ret; -+} -+ -+ -+/** -+ * @brief Write an image file -+ * -+ * We store the size of the actual contents in the first 8-bytes of the file. This allows us to -+ * determine the file size when using criu_image_streamer when fseek and fstat are not available. -+ * -+ * @param path The file path -+ * @param buf pointer to data to be written -+ * @param buf_len size of buf -+ * @return 0 if successful. -errno on failure -+ */ -+int write_img_file(char *path, const void *buf, const size_t buf_len) -+{ -+ int ret; -+ FILE *fp; -+ size_t len = buf_len; -+ -+ fp = open_img_file(path, true, &len); -+ if (!fp) -+ return -errno; -+ -+ ret = write_fp(fp, buf, buf_len); -+ fclose(fp); /* this will also close fd */ -+ return ret; -+} -+ -+void print_kfd_bo_stat(int bo_cnt, struct kfd_criu_bo_bucket *bo_list) -+{ -+ struct kfd_criu_bo_bucket *bo; -+ -+ pr_info("\n"); -+ for (int idx = 0; idx < bo_cnt; idx++) { -+ bo = &bo_list[idx]; -+ pr_info("\n"); -+ pr_info("%s(), %d. KFD BO Addr: %llx \n", __func__, idx, bo->addr); -+ pr_info("%s(), %d. KFD BO Size: %llx \n", __func__, idx, bo->size); -+ pr_info("%s(), %d. KFD BO Offset: %llx \n", __func__, idx, bo->offset); -+ pr_info("%s(), %d. KFD BO Restored Offset: %llx \n", __func__, idx, bo->restored_offset); -+ pr_info("%s(), %d. KFD BO Alloc Flags: %x \n", __func__, idx, bo->alloc_flags); -+ pr_info("%s(), %d. KFD BO Gpu ID: %x \n", __func__, idx, bo->gpu_id); -+ pr_info("%s(), %d. KFD BO Dmabuf FD: %x \n", __func__, idx, bo->dmabuf_fd); -+ pr_info("\n"); -+ } -+ pr_info("\n"); -+} -+ -+ -diff --git a/plugins/amdgpu/amdgpu_plugin_util.h b/plugins/amdgpu/amdgpu_plugin_util.h -new file mode 100755 -index 000000000..aacca3a28 ---- /dev/null -+++ b/plugins/amdgpu/amdgpu_plugin_util.h -@@ -0,0 +1,106 @@ -+#ifndef __AMDGPU_PLUGIN_UTIL_H__ -+#define __AMDGPU_PLUGIN_UTIL_H__ -+ -+#ifndef _GNU_SOURCE -+#define _GNU_SOURCE 1 -+#endif -+ -+#ifdef COMPILE_TESTS -+#undef pr_err -+#define pr_err(format, arg...) fprintf(stdout, "%s:%d ERROR:" format, __FILE__, __LINE__, ##arg) -+#undef pr_info -+#define pr_info(format, arg...) fprintf(stdout, "%s:%d INFO:" format, __FILE__, __LINE__, ##arg) -+#undef pr_debug -+#define pr_debug(format, arg...) fprintf(stdout, "%s:%d DBG:" format, __FILE__, __LINE__, ##arg) -+ -+#undef pr_perror -+#define pr_perror(format, arg...) \ -+ fprintf(stdout, "%s:%d: " format " (errno = %d (%s))\n", __FILE__, __LINE__, ##arg, errno, strerror(errno)) -+#endif -+ -+#ifdef LOG_PREFIX -+#undef LOG_PREFIX -+#endif -+#define LOG_PREFIX "amdgpu_plugin: " -+ -+#ifdef DEBUG -+#define plugin_log_msg(fmt, ...) pr_debug(fmt, ##__VA_ARGS__) -+#else -+#define plugin_log_msg(fmt, ...) \ -+ { \ -+ } -+#endif -+ -+ -+/* Path where KFD device is surfaced */ -+#define AMDGPU_KFD_DEVICE "/dev/kfd" -+ -+/* Path where DRM devices are surfaced */ -+#define AMDGPU_DRM_DEVICE "/dev/dri/renderD%d" -+ -+/* Minimum version of KFD IOCTL's that supports C&R */ -+#define KFD_IOCTL_MAJOR_VERSION 1 -+#define MIN_KFD_IOCTL_MINOR_VERSION 8 -+ -+/* Name of file having serialized data of KFD device */ -+#define IMG_KFD_FILE "amdgpu-kfd-%d.img" -+ -+/* Name of file having serialized data of KFD buffer objects (BOs) */ -+#define IMG_KFD_PAGES_FILE "amdgpu-pages-%d-%04x.img" -+ -+/* Name of file having serialized data of DRM device */ -+#define IMG_DRM_FILE "amdgpu-renderD-%d.img" -+ -+/* Name of file having serialized data of DRM device buffer objects (BOs) */ -+#define IMG_DRM_PAGES_FILE "amdgpu-drm-pages-%d-%04x.img" -+ -+/* Helper macros to Checkpoint and Restore a ROCm file */ -+#define HSAKMT_SHM_PATH "/dev/shm/hsakmt_shared_mem" -+#define HSAKMT_SHM "/hsakmt_shared_mem" -+#define HSAKMT_SEM_PATH "/dev/shm/sem.hsakmt_semaphore" -+#define HSAKMT_SEM "hsakmt_semaphore" -+ -+/* Help macros to build sDMA command packets */ -+#define SDMA_PACKET(op, sub_op, e) ((((e)&0xFFFF) << 16) | (((sub_op)&0xFF) << 8) | (((op)&0xFF) << 0)) -+ -+#define SDMA_OPCODE_COPY 1 -+#define SDMA_COPY_SUB_OPCODE_LINEAR 0 -+#define SDMA_NOP 0 -+#define SDMA_LINEAR_COPY_MAX_SIZE (1ULL << 21) -+ -+enum sdma_op_type { -+ SDMA_OP_VRAM_READ, -+ SDMA_OP_VRAM_WRITE, -+}; -+ -+/* Helper structures to encode device topology of SRC and DEST platforms */ -+extern struct tp_system src_topology; -+extern struct tp_system dest_topology; -+ -+/* Helper structures to encode device maps during Checkpoint and Restore operations */ -+extern struct device_maps checkpoint_maps; -+extern struct device_maps restore_maps; -+ -+extern int fd_next; -+ -+extern bool kfd_fw_version_check; -+extern bool kfd_sdma_fw_version_check; -+extern bool kfd_caches_count_check; -+extern bool kfd_num_gws_check; -+extern bool kfd_vram_size_check; -+extern bool kfd_numa_check; -+extern bool kfd_capability_check; -+ -+int read_fp(FILE *fp, void *buf, const size_t buf_len); -+int write_fp(FILE *fp, const void *buf, const size_t buf_len); -+int read_file(const char *file_path, void *buf, const size_t buf_len); -+int write_img_file(char *path, const void *buf, const size_t buf_len); -+FILE *open_img_file(char *path, bool write, size_t *size); -+ -+bool checkpoint_is_complete(); -+void decrement_checkpoint_count(); -+void init_gpu_count(struct tp_system *topology); -+ -+void print_kfd_bo_stat(int bo_cnt, struct kfd_criu_bo_bucket *bo_list); -+ -+#endif /* __AMDGPU_PLUGIN_UTIL_H__ */ -diff --git a/plugins/amdgpu/criu-amdgpu.proto b/plugins/amdgpu/criu-amdgpu.proto -index 81d00d3ff..078b67650 100644 ---- a/plugins/amdgpu/criu-amdgpu.proto -+++ b/plugins/amdgpu/criu-amdgpu.proto -@@ -5,7 +5,7 @@ message dev_iolink { - required uint32 node_to_id = 2; - } - --message device_entry { -+message kfd_device_entry { - required uint32 node_id = 1; - required uint32 gpu_id = 2; - required uint32 cpu_cores_count = 3; -@@ -40,10 +40,10 @@ message device_entry { - repeated dev_iolink iolinks = 32; - } - --message bo_entry { -- required uint64 addr = 1; -- required uint64 size = 2; -- required uint64 offset = 3; -+message kfd_bo_entry { -+ required uint64 addr = 1; -+ required uint64 size = 2; -+ required uint64 offset = 3; - required uint32 alloc_flags = 4; - required uint32 gpu_id = 5; - } -@@ -52,10 +52,10 @@ message criu_kfd { - required uint32 pid = 1; - required uint32 num_of_gpus = 2; - required uint32 num_of_cpus = 3; -- repeated device_entry device_entries = 4; -- required uint64 num_of_bos = 5; -- repeated bo_entry bo_entries = 6; -- required uint32 num_of_objects = 7; -+ repeated kfd_device_entry device_entries = 4; -+ required uint64 num_of_bos = 5; -+ repeated kfd_bo_entry bo_entries = 6; -+ required uint32 num_of_objects = 7; - required uint64 shared_mem_size = 8; - required uint32 shared_mem_magic = 9; - required bytes priv_data = 10; --- -2.45.1 - diff --git a/plugins-amdgpu-refactor-code-used-to-implement-checkp.patch b/plugins-amdgpu-refactor-code-used-to-implement-checkp.patch deleted file mode 100644 index 213f609..0000000 --- a/plugins-amdgpu-refactor-code-used-to-implement-checkp.patch +++ /dev/null @@ -1,186 +0,0 @@ -From 9d9ae2954d3f1758ea659ed8e614dd28e8a368dd Mon Sep 17 00:00:00 2001 -From: Ramesh Errabolu -Date: Fri, 10 Nov 2023 13:02:49 -0600 -Subject: [PATCH] amdgpu_plugin: Refactor code used to implement Checkpoint - -Refactor code used to Checkpoint DRM devices. Code is moved -into amdgpu_plugin_drm.c file which hosts various methods to -checkpoint and restore a workload. - -Signed-off-by: Ramesh Errabolu ---- - plugins/amdgpu/amdgpu_plugin.c | 62 ++++++++++++++---------------- - plugins/amdgpu/amdgpu_plugin_drm.c | 38 ++++++++++++++++++ - plugins/amdgpu/amdgpu_plugin_drm.h | 6 +++ - 3 files changed, 73 insertions(+), 33 deletions(-) - -diff --git a/plugins/amdgpu/amdgpu_plugin.c b/plugins/amdgpu/amdgpu_plugin.c -index 60e04f973..a579158d0 100644 ---- a/plugins/amdgpu/amdgpu_plugin.c -+++ b/plugins/amdgpu/amdgpu_plugin.c -@@ -49,6 +49,13 @@ struct vma_metadata { - - /************************************ Global Variables ********************************************/ - -+/** -+ * FD of KFD device used to checkpoint. On a multi-process -+ * tree the order of checkpointing goes from parent to child -+ * and so on - so saving the FD will not be overwritten -+ */ -+static int kfd_checkpoint_fd; -+ - static LIST_HEAD(update_vma_info_list); - - size_t kfd_max_buffer_size; -@@ -990,6 +997,10 @@ static int unpause_process(int fd) - goto exit; - } - -+ // Reset the KFD FD -+ kfd_checkpoint_fd = -1; -+ sys_close_drm_render_devices(&src_topology); -+ - exit: - pr_info("Process unpaused %s (ret:%d)\n", ret ? "Failed" : "Ok", ret); - -@@ -1181,44 +1192,25 @@ int amdgpu_plugin_dump_file(int fd, int id) - return -1; - } - -+ /* Initialize number of device files that will be checkpointed */ -+ init_gpu_count(&src_topology); -+ - /* Check whether this plugin was called for kfd or render nodes */ - if (major(st.st_rdev) != major(st_kfd.st_rdev) || minor(st.st_rdev) != 0) { -+ - /* This is RenderD dumper plugin, for now just save renderD - * minor number to be used during restore. In later phases this - * needs to save more data for video decode etc. - */ -- -- CriuRenderNode rd = CRIU_RENDER_NODE__INIT; -- struct tp_node *tp_node; -- -- pr_info("Dumper called for /dev/dri/renderD%d, FD = %d, ID = %d\n", minor(st.st_rdev), fd, id); -- -- tp_node = sys_get_node_by_render_minor(&src_topology, minor(st.st_rdev)); -- if (!tp_node) { -- pr_err("Failed to find a device with minor number = %d\n", minor(st.st_rdev)); -- -- return -ENODEV; -- } -- -- rd.gpu_id = maps_get_dest_gpu(&checkpoint_maps, tp_node->gpu_id); -- if (!rd.gpu_id) -- return -ENODEV; -- -- len = criu_render_node__get_packed_size(&rd); -- buf = xmalloc(len); -- if (!buf) -- return -ENOMEM; -- -- criu_render_node__pack(&rd, buf); -- -- snprintf(img_path, sizeof(img_path), IMG_DRM_FILE, id); -- ret = write_img_file(img_path, buf, len); -- if (ret) { -- xfree(buf); -+ ret = amdgpu_plugin_drm_dump_file(fd, id, &st); -+ if (ret) - return ret; -- } - -- xfree(buf); -+ /* Invoke unpause process if needed */ -+ decrement_checkpoint_count(); -+ if (checkpoint_is_complete()) { -+ ret = unpause_process(kfd_checkpoint_fd); -+ } - - /* Need to return success here so that criu can call plugins for renderD nodes */ - return ret; -@@ -1315,11 +1307,15 @@ int amdgpu_plugin_dump_file(int fd, int id) - ret = write_img_file(img_path, buf, len); - - xfree(buf); -+ - exit: -- /* Restore all queues */ -- unpause_process(fd); -+ /* Restore all queues if conditions permit */ -+ kfd_checkpoint_fd = fd; -+ decrement_checkpoint_count(); -+ if (checkpoint_is_complete()) { -+ ret = unpause_process(fd); -+ } - -- sys_close_drm_render_devices(&src_topology); - xfree((void *)args.devices); - xfree((void *)args.bos); - xfree((void *)args.priv_data); -diff --git a/plugins/amdgpu/amdgpu_plugin_drm.c b/plugins/amdgpu/amdgpu_plugin_drm.c -index a48dc68f0..689d62072 100644 ---- a/plugins/amdgpu/amdgpu_plugin_drm.c -+++ b/plugins/amdgpu/amdgpu_plugin_drm.c -@@ -61,3 +61,41 @@ int amdgpu_plugin_drm_handle_device_vma(int fd, const struct stat *st) - } - - -+int amdgpu_plugin_drm_dump_file(int fd, int id, struct stat *drm) -+{ -+ CriuRenderNode rd = CRIU_RENDER_NODE__INIT; -+ struct tp_node *tp_node; -+ char path[PATH_MAX]; -+ unsigned char *buf; -+ int minor; -+ int len; -+ int ret; -+ -+ /* Get the topology node of the DRM device */ -+ minor = minor(drm->st_rdev); -+ tp_node = sys_get_node_by_render_minor(&src_topology, minor); -+ if (!tp_node) { -+ pr_err("Failed to find a device with minor number = %d\n", minor); -+ return -ENODEV; -+ } -+ -+ /* Get the GPU_ID of the DRM device */ -+ rd.gpu_id = maps_get_dest_gpu(&checkpoint_maps, tp_node->gpu_id); -+ if (!rd.gpu_id) { -+ pr_err("Failed to find valid gpu_id for the device = %d\n", rd.gpu_id); -+ return -ENODEV; -+ } -+ -+ len = criu_render_node__get_packed_size(&rd); -+ buf = xmalloc(len); -+ if (!buf) -+ return -ENOMEM; -+ -+ criu_render_node__pack(&rd, buf); -+ -+ snprintf(path, sizeof(path), IMG_DRM_FILE, id); -+ ret = write_img_file(path, buf, len); -+ xfree(buf); -+ return ret; -+} -+ -diff --git a/plugins/amdgpu/amdgpu_plugin_drm.h b/plugins/amdgpu/amdgpu_plugin_drm.h -index 37009c8ba..6f0c1a9a6 100644 ---- a/plugins/amdgpu/amdgpu_plugin_drm.h -+++ b/plugins/amdgpu/amdgpu_plugin_drm.h -@@ -17,6 +17,12 @@ - */ - int amdgpu_plugin_drm_handle_device_vma(int fd, const struct stat *drm); - -+/** -+ * Serialize meta-data about a particular DRM device, its number of BOs, -+ * etc into a file. The serialized filename has in it the value ID that -+ * is passed in as a parameter -+ */ -+int amdgpu_plugin_drm_dump_file(int fd, int id, struct stat *drm); - - #endif /* __AMDGPU_PLUGIN_DRM_H__ */ - --- -2.45.1 - diff --git a/sources b/sources index bb80cdd..8b4fba8 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (criu-3.19.tar.gz) = d243818cdac51580c952a80e9164786a67ce5e294c0faa6dc700f5e8da8e36495f0b64f5c27b345ede7d6697ed7a69fa4e9a85cef451f32e3ffeb78564884571 +SHA512 (criu-4.0.tar.gz) = 38a3ae353385b1cc4e63f9b317af67bea88d67322e549cf87501873d59bdcc50e92f9c2ef85c736973c551520a91f579f80a010871d245b1a43a29f9fc69b1ab From 2feabdb937743ad034b10ba3314abcdc3dbab8ae Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Thu, 26 Sep 2024 12:43:05 +0100 Subject: [PATCH 084/109] spec: add tmpfiles_create This patch fixes the following warning: criu.x86_64: W: post-without-tmpfile-creation /usr/lib/tmpfiles.d/criu.conf Please use the %tmpfiles_create macro in %post for each of your tmpfiles.d files if you expect this file or directory to be available after package installation (and before reboot). Signed-off-by: Radostin Stoyanov --- criu.spec | 3 +++ 1 file changed, 3 insertions(+) diff --git a/criu.spec b/criu.spec index 2ec6857..14f1995 100644 --- a/criu.spec +++ b/criu.spec @@ -184,6 +184,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %{_sbindir}/criu-ns %doc %{_mandir}/man1/criu-ns.1* +%post +%tmpfiles_create %{name}.conf + %changelog * Thu Sep 26 2024 Radostin Stoyanov - 4.0-1 - Update to 4.0 From ec94fa8515afaeef695766249007689cc88a77b2 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Thu, 26 Sep 2024 13:15:26 +0100 Subject: [PATCH 085/109] spec: set PIPFLAGS to run pip without network Signed-off-by: Radostin Stoyanov --- criu.spec | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/criu.spec b/criu.spec index 14f1995..10c8c87 100644 --- a/criu.spec +++ b/criu.spec @@ -133,10 +133,10 @@ make docs V=1 %install sed -e "s,--upgrade --ignore-installed,--no-index --no-deps -v --no-build-isolation,g" -i lib/Makefile -i crit/Makefile make install-criu DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} -make install-lib DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} PYTHON=%{py_binary} +make install-lib DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} PYTHON=%{py_binary} PIPFLAGS="--no-build-isolation --no-index --no-deps --progress-bar off --upgrade --ignore-installed" make install-amdgpu_plugin DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} PLUGINDIR=%{_libdir}/criu make install-cuda_plugin DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} PLUGINDIR=%{_libdir}/criu -make install-crit DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} PYTHON=%{py_binary} +make install-crit DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} PYTHON=%{py_binary} PIPFLAGS="--no-build-isolation --no-index --no-deps --progress-bar off --upgrade --ignore-installed" make install-man DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} rm -f $RPM_BUILD_ROOT%{_mandir}/man1/compel.1 @@ -191,6 +191,7 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a * Thu Sep 26 2024 Radostin Stoyanov - 4.0-1 - Update to 4.0 - Add package for cuda-plugin +- Run pip install without internet access * Wed Jul 17 2024 Fedora Release Engineering - 3.19-7 - Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild From 4684ea74f8cede8a044064bab9f179f9d4e4e58e Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Thu, 17 Oct 2024 12:43:08 +0200 Subject: [PATCH 086/109] Recommends: iptables Signed-off-by: Adrian Reber --- criu.spec | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/criu.spec b/criu.spec index 10c8c87..9228159 100644 --- a/criu.spec +++ b/criu.spec @@ -12,7 +12,7 @@ Name: criu Version: 4.0 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPL-2.0-only AND LGPL-2.1-only AND MIT URL: http://criu.org/ @@ -42,6 +42,8 @@ BuildRequires: gnutls-devel BuildRequires: libdrm-devel # Checkpointing containers with a tmpfs requires tar Recommends: tar +# CRIU requires some version of iptables-restore for network locking +Recommends: iptables %if 0%{?fedora} BuildRequires: libbsd-devel BuildRequires: nftables-devel @@ -188,6 +190,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %tmpfiles_create %{name}.conf %changelog +* Thu Oct 17 2024 Adrian Reber - 4.0-2 +- Recommends: iptables + * Thu Sep 26 2024 Radostin Stoyanov - 4.0-1 - Update to 4.0 - Add package for cuda-plugin From f6e7edaf73e45ffad6f96708917721a9b2f4f492 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Sun, 8 Dec 2024 09:06:12 +0000 Subject: [PATCH 087/109] Apply patch to handle vvar_vclock vma-s in rawhide https://bugzilla.redhat.com/show_bug.cgi?id=2328985 https://github.com/checkpoint-restore/criu/issues/2532 Signed-off-by: Radostin Stoyanov --- criu.spec | 7 +- vdso-handle-vvar_vclock-vma-s.patch | 181 ++++++++++++++++++++++++++++ 2 files changed, 187 insertions(+), 1 deletion(-) create mode 100644 vdso-handle-vvar_vclock-vma-s.patch diff --git a/criu.spec b/criu.spec index 9228159..93d2bff 100644 --- a/criu.spec +++ b/criu.spec @@ -12,7 +12,7 @@ Name: criu Version: 4.0 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPL-2.0-only AND LGPL-2.1-only AND MIT URL: http://criu.org/ @@ -24,6 +24,7 @@ Source0: https://github.com/checkpoint-restore/criu/archive/v%{version}/criu-%{v Patch99: criu.pc.patch Patch100: Makefile.config-set-CR_PLUGIN_DEFAULT-variable.patch +Patch101: vdso-handle-vvar_vclock-vma-s.patch Source5: criu-tmpfiles.conf @@ -119,6 +120,7 @@ This script can help to workaround the so called "PID mismatch" problem. %patch -P 99 -p1 %patch -P 100 -p1 +%patch -P 101 -p1 %build # This package calls LD directly without specifying the LTO plugins. Until @@ -190,6 +192,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %tmpfiles_create %{name}.conf %changelog +* Sun Dec 08 2024 Radostin Stoyanov - 4.0-3 +- Apply patch to handle vvar_vclock vma-s in rawhide + * Thu Oct 17 2024 Adrian Reber - 4.0-2 - Recommends: iptables diff --git a/vdso-handle-vvar_vclock-vma-s.patch b/vdso-handle-vvar_vclock-vma-s.patch new file mode 100644 index 0000000..2dd939b --- /dev/null +++ b/vdso-handle-vvar_vclock-vma-s.patch @@ -0,0 +1,181 @@ +From 058572e91dea1d8ac9c345e69e08a58e8abfacbb Mon Sep 17 00:00:00 2001 +From: Andrei Vagin +Date: Thu, 5 Dec 2024 22:17:38 +0000 +Subject: [PATCH] vdso: handle vvar_vclock vma-s + +The vvar_vclock was introduced by [1]. Basically, the old vvar vma has +been splited on two parts. In term of C/R, these two vma-s can be still +treated as one. + +[1] e93d2521b27f ("x86/vdso: Split virtual clock pages into dedicated mapping") + +Signed-off-by: Andrei Vagin +--- + criu/include/util-vdso.h | 1 + + criu/pie/parasite-vdso.c | 19 ++++++++++++++++++- + criu/proc_parse.c | 23 +++++++++++++++++++---- + criu/vdso.c | 28 +++++++++++++++++++++------- + 4 files changed, 59 insertions(+), 12 deletions(-) + +diff --git a/criu/include/util-vdso.h b/criu/include/util-vdso.h +index c4386cf8e..9fd9a6de4 100644 +--- a/criu/include/util-vdso.h ++++ b/criu/include/util-vdso.h +@@ -30,6 +30,7 @@ struct vdso_symbol { + struct vdso_symtable { + unsigned long vdso_size; + unsigned long vvar_size; ++ unsigned long vvar_vclock_size; + struct vdso_symbol symbols[VDSO_SYMBOL_MAX]; + bool vdso_before_vvar; /* order of vdso/vvar pair */ + }; +diff --git a/criu/pie/parasite-vdso.c b/criu/pie/parasite-vdso.c +index 355007fa9..f3ad3107f 100644 +--- a/criu/pie/parasite-vdso.c ++++ b/criu/pie/parasite-vdso.c +@@ -45,6 +45,7 @@ static int remap_one(char *who, unsigned long *from, unsigned long to, size_t si + static int park_at(struct vdso_maps *rt, unsigned long vdso, unsigned long vvar) + { + unsigned long vvar_size = rt->sym.vvar_size; ++ unsigned long vvar_vclock_size = rt->sym.vvar_vclock_size; + unsigned long vdso_size = rt->sym.vdso_size; + int ret; + +@@ -54,8 +55,24 @@ static int park_at(struct vdso_maps *rt, unsigned long vdso, unsigned long vvar) + + std_log_set_gettimeofday(NULL); /* stop using vdso for timings */ + +- if (vvar) ++ if (vvar) { ++ /* ++ * v6.13-rc1~172^2~9 splits the vvar vma in two parts vvar and ++ * vvar_clock. The last one is mapped right after the first ++ * one. ++ */ ++ if (vvar_vclock_size) { ++ unsigned long from; ++ ++ vvar_size -= vvar_vclock_size; ++ from = rt->vvar_start + vvar_size; ++ ++ ret = remap_one("rt-vvar", &from, vvar + vvar_size, vvar_vclock_size); ++ if (ret) ++ return ret; ++ } + ret = remap_one("rt-vvar", &rt->vvar_start, vvar, vvar_size); ++ } + + if (!ret) + vdso_update_gtod_addr(rt); +diff --git a/criu/proc_parse.c b/criu/proc_parse.c +index 95ebe3a41..6c4303e7d 100644 +--- a/criu/proc_parse.c ++++ b/criu/proc_parse.c +@@ -579,7 +579,8 @@ static int handle_vma(pid_t pid, struct vma_area *vma_area, const char *file_pat + } else if (!strcmp(file_path, "[vdso]")) { + if (handle_vdso_vma(vma_area)) + goto err; +- } else if (!strcmp(file_path, "[vvar]")) { ++ } else if (!strcmp(file_path, "[vvar]") || ++ !strcmp(file_path, "[vvar_vclock]")) { + if (handle_vvar_vma(vma_area)) + goto err; + } else if (!strcmp(file_path, "[heap]")) { +@@ -771,7 +772,7 @@ static int task_size_check(pid_t pid, VmaEntry *entry) + + int parse_smaps(pid_t pid, struct vm_area_list *vma_area_list, dump_filemap_t dump_filemap) + { +- struct vma_area *vma_area = NULL; ++ struct vma_area *vma_area = NULL, *prev_vma_area = NULL; + unsigned long start, end, pgoff, prev_end = 0; + char r, w, x, s; + int ret = -1, vm_file_fd = -1; +@@ -813,8 +814,22 @@ int parse_smaps(pid_t pid, struct vm_area_list *vma_area_list, dump_filemap_t du + continue; + } + +- if (vma_area && vma_list_add(vma_area, vma_area_list, &prev_end, &vfi, &prev_vfi)) +- goto err; ++ if (vma_area && vma_area_is(vma_area, VMA_AREA_VVAR) && ++ prev_vma_area && vma_area_is(prev_vma_area, VMA_AREA_VVAR)) { ++ if (prev_vma_area->e->end != vma_area->e->start) { ++ pr_err("two nonconsecutive vvar vma-s: " ++ "%" PRIx64 "-%" PRIx64 " %" PRIx64 "-%" PRIx64 "\n", ++ prev_vma_area->e->start, prev_vma_area->e->end, ++ vma_area->e->start, vma_area->e->end); ++ goto err; ++ } ++ /* Merge all vvar vma-s into one. */ ++ prev_vma_area->e->end = vma_area->e->end; ++ } else { ++ if (vma_area && vma_list_add(vma_area, vma_area_list, &prev_end, &vfi, &prev_vfi)) ++ goto err; ++ prev_vma_area = vma_area; ++ } + + if (eof) + break; +diff --git a/criu/vdso.c b/criu/vdso.c +index 7de2fae78..d4d351131 100644 +--- a/criu/vdso.c ++++ b/criu/vdso.c +@@ -310,7 +310,7 @@ static int vdso_parse_maps(pid_t pid, struct vdso_maps *s) + + while (1) { + unsigned long start, end; +- char *has_vdso, *has_vvar; ++ char *has_vdso, *has_vvar, *has_vvar_vclock; + + buf = breadline(&f); + if (buf == NULL) +@@ -318,13 +318,19 @@ static int vdso_parse_maps(pid_t pid, struct vdso_maps *s) + if (IS_ERR(buf)) + goto err; + +- has_vdso = strstr(buf, "[vdso]"); +- if (!has_vdso) ++ has_vvar = NULL; ++ has_vvar_vclock = NULL; ++ do { ++ has_vdso = strstr(buf, "[vdso]"); ++ if (has_vdso) ++ break; + has_vvar = strstr(buf, "[vvar]"); +- else +- has_vvar = NULL; ++ if (has_vvar) ++ break; ++ has_vvar_vclock = strstr(buf, "[vvar_vclock]"); ++ } while (0); + +- if (!has_vdso && !has_vvar) ++ if (!has_vdso && !has_vvar && !has_vvar_vclock) + continue; + + if (sscanf(buf, "%lx-%lx", &start, &end) != 2) { +@@ -339,13 +345,21 @@ static int vdso_parse_maps(pid_t pid, struct vdso_maps *s) + } + s->vdso_start = start; + s->sym.vdso_size = end - start; +- } else { ++ } else if (has_vvar) { + if (s->vvar_start != VVAR_BAD_ADDR) { + pr_err("Got second VVAR entry\n"); + goto err; + } + s->vvar_start = start; + s->sym.vvar_size = end - start; ++ } else { ++ if (s->vvar_start == VDSO_BAD_ADDR || ++ s->vvar_start + s->sym.vvar_size != start) { ++ pr_err("VVAR and VVAR_VCLOCK entries are not subsequent\n"); ++ goto err; ++ } ++ s->sym.vvar_vclock_size = end - start; ++ s->sym.vvar_size += s->sym.vvar_vclock_size; + } + } + +-- +2.47.0 + From 5fe5814843c7904ed507db08ede8e3a0e6682c8d Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 16 Jan 2025 14:52:14 +0000 Subject: [PATCH 088/109] Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild --- criu.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/criu.spec b/criu.spec index 93d2bff..4d19f2a 100644 --- a/criu.spec +++ b/criu.spec @@ -12,7 +12,7 @@ Name: criu Version: 4.0 -Release: 3%{?dist} +Release: 4%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPL-2.0-only AND LGPL-2.1-only AND MIT URL: http://criu.org/ @@ -192,6 +192,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %tmpfiles_create %{name}.conf %changelog +* Thu Jan 16 2025 Fedora Release Engineering - 4.0-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild + * Sun Dec 08 2024 Radostin Stoyanov - 4.0-3 - Apply patch to handle vvar_vclock vma-s in rawhide From 0c47d09fe9e057f303d56c63b2ffc43cc4d724e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Mon, 27 Jan 2025 13:45:55 +0100 Subject: [PATCH 089/109] Fix build when sbindir != /usr/sbin ... (rhbz#2340011) --- criu.spec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/criu.spec b/criu.spec index 4d19f2a..ba00bdd 100644 --- a/criu.spec +++ b/criu.spec @@ -136,11 +136,11 @@ make docs V=1 %install sed -e "s,--upgrade --ignore-installed,--no-index --no-deps -v --no-build-isolation,g" -i lib/Makefile -i crit/Makefile -make install-criu DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} +make install-criu DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} BINDIR=%{_bindir} SBINDIR=%{_sbindir} make install-lib DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} PYTHON=%{py_binary} PIPFLAGS="--no-build-isolation --no-index --no-deps --progress-bar off --upgrade --ignore-installed" make install-amdgpu_plugin DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} PLUGINDIR=%{_libdir}/criu make install-cuda_plugin DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} PLUGINDIR=%{_libdir}/criu -make install-crit DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} PYTHON=%{py_binary} PIPFLAGS="--no-build-isolation --no-index --no-deps --progress-bar off --upgrade --ignore-installed" +make install-crit DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} BINDIR=%{_bindir} SBINDIR=%{_sbindir} PYTHON=%{py_binary} PIPFLAGS="--no-build-isolation --no-index --no-deps --progress-bar off --upgrade --ignore-installed" make install-man DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} rm -f $RPM_BUILD_ROOT%{_mandir}/man1/compel.1 From f2a112e667f55fb1ef6c3b00e13e7d9cda3c4bff Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Mon, 7 Apr 2025 13:08:31 +0100 Subject: [PATCH 090/109] Update to 4.1 Signed-off-by: Radostin Stoyanov --- .gitignore | 1 + ...onfig-set-CR_PLUGIN_DEFAULT-variable.patch | 49 ----- criu.spec | 18 +- sources | 2 +- vdso-handle-vvar_vclock-vma-s.patch | 181 ------------------ 5 files changed, 9 insertions(+), 242 deletions(-) delete mode 100644 Makefile.config-set-CR_PLUGIN_DEFAULT-variable.patch delete mode 100644 vdso-handle-vvar_vclock-vma-s.patch diff --git a/.gitignore b/.gitignore index d704cea..7bd1f04 100644 --- a/.gitignore +++ b/.gitignore @@ -57,3 +57,4 @@ /criu-3.18.tar.gz /criu-3.19.tar.gz /criu-4.0.tar.gz +/criu-4.1.tar.gz diff --git a/Makefile.config-set-CR_PLUGIN_DEFAULT-variable.patch b/Makefile.config-set-CR_PLUGIN_DEFAULT-variable.patch deleted file mode 100644 index 7f9584d..0000000 --- a/Makefile.config-set-CR_PLUGIN_DEFAULT-variable.patch +++ /dev/null @@ -1,49 +0,0 @@ -From bb35901e78216917ce8066fa805ce27f273d76a2 Mon Sep 17 00:00:00 2001 -From: Radostin Stoyanov -Date: Thu, 26 Sep 2024 10:59:32 +0100 -Subject: [PATCH] Makefile.config: set CR_PLUGIN_DEFAULT variable - -By default, CRIU uses the path "/usr/lib/criu" to install and load -plugins at runtime. This path is defined by the `PLUGINDIR` variable -in Makefile.install and `CR_PLUGIN_DEFAULT` in `criu/include/plugin.h`. -However, some distribution packages might install the CRIU plugins at -"/usr/lib64/criu" instead. This patch updates the makefile to align -the path defined by `CR_PLUGIN_DEFAULT` with the value of `PLUGINDIR`. - -Signed-off-by: Radostin Stoyanov ---- - Makefile.config | 4 ++++ - plugins/amdgpu/Makefile | 2 +- - 2 files changed, 5 insertions(+), 1 deletion(-) - -diff --git a/Makefile.config b/Makefile.config -index 52c250b21..5ab689d41 100644 ---- a/Makefile.config -+++ b/Makefile.config -@@ -59,6 +59,10 @@ endif - - export LIBS += $(LIBS_FEATURES) - -+ifneq ($(PLUGINDIR),) -+ FEATURE_DEFINES += -DCR_PLUGIN_DEFAULT="\"$(PLUGINDIR)\"" -+endif -+ - CONFIG_FILE = .config - - $(CONFIG_FILE): -diff --git a/plugins/amdgpu/Makefile b/plugins/amdgpu/Makefile -index 7d3388b80..a20d1d163 100644 ---- a/plugins/amdgpu/Makefile -+++ b/plugins/amdgpu/Makefile -@@ -15,7 +15,7 @@ DEPS_NOK := ; - __nmk_dir ?= ../../scripts/nmk/scripts/ - include $(__nmk_dir)msg.mk - --PLUGIN_CFLAGS := -g -Wall -Werror -D _GNU_SOURCE -shared -nostartfiles -fPIC -DCR_PLUGIN_DEFAULT="$(PLUGINDIR)" -+PLUGIN_CFLAGS := -g -Wall -Werror -D _GNU_SOURCE -shared -nostartfiles -fPIC - PLUGIN_LDFLAGS := -lpthread -lrt -ldrm -ldrm_amdgpu - - ifeq ($(CONFIG_AMDGPU),y) --- -2.46.1 - diff --git a/criu.spec b/criu.spec index ba00bdd..26d8efb 100644 --- a/criu.spec +++ b/criu.spec @@ -11,8 +11,8 @@ %undefine _auto_set_build_flags Name: criu -Version: 4.0 -Release: 4%{?dist} +Version: 4.1 +Release: 1%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPL-2.0-only AND LGPL-2.1-only AND MIT URL: http://criu.org/ @@ -23,9 +23,6 @@ Source0: https://github.com/checkpoint-restore/criu/archive/v%{version}/criu-%{v # in RPM and DEB is different. Patch99: criu.pc.patch -Patch100: Makefile.config-set-CR_PLUGIN_DEFAULT-variable.patch -Patch101: vdso-handle-vvar_vclock-vma-s.patch - Source5: criu-tmpfiles.conf BuildRequires: gcc @@ -41,10 +38,9 @@ BuildRequires: perl-interpreter BuildRequires: libselinux-devel BuildRequires: gnutls-devel BuildRequires: libdrm-devel +BuildRequires: libuuid-devel # Checkpointing containers with a tmpfs requires tar Recommends: tar -# CRIU requires some version of iptables-restore for network locking -Recommends: iptables %if 0%{?fedora} BuildRequires: libbsd-devel BuildRequires: nftables-devel @@ -119,9 +115,6 @@ This script can help to workaround the so called "PID mismatch" problem. %setup -q %patch -P 99 -p1 -%patch -P 100 -p1 -%patch -P 101 -p1 - %build # This package calls LD directly without specifying the LTO plugins. Until # that is fixed, disable LTO. @@ -129,7 +122,7 @@ This script can help to workaround the so called "PID mismatch" problem. # %{?_smp_mflags} does not work # -fstack-protector breaks build -CFLAGS+=`echo %{optflags} | sed -e 's,-fstack-protector\S*,,g'` make V=1 WERROR=0 PREFIX=%{_prefix} RUNDIR=/run/criu PYTHON=%{py_binary} PLUGINDIR=%{_libdir}/criu +CFLAGS+=`echo %{optflags} | sed -e 's,-fstack-protector\S*,,g'` make V=1 WERROR=0 PREFIX=%{_prefix} RUNDIR=/run/criu PYTHON=%{py_binary} PLUGINDIR=%{_libdir}/criu NETWORK_LOCK_DEFAULT=NETWORK_LOCK_NFTABLES make V=1 WERROR=0 PREFIX=%{_prefix} PLUGINDIR=%{_libdir}/criu amdgpu_plugin make docs V=1 @@ -192,6 +185,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %tmpfiles_create %{name}.conf %changelog +* Mon Apr 07 2025 Radostin Stoyanov - 4.1-1 +- Update to 4.1 + * Thu Jan 16 2025 Fedora Release Engineering - 4.0-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild diff --git a/sources b/sources index 8b4fba8..79397e1 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (criu-4.0.tar.gz) = 38a3ae353385b1cc4e63f9b317af67bea88d67322e549cf87501873d59bdcc50e92f9c2ef85c736973c551520a91f579f80a010871d245b1a43a29f9fc69b1ab +SHA512 (criu-4.1.tar.gz) = 769001a7e527c129fe73509fd0c7d3fc3b9b1080dc69929032cb84f60f95256f5d145ed4b7ea11f090a7f468f2bb2a0ecf56475eb292966cad26d643f0e46816 diff --git a/vdso-handle-vvar_vclock-vma-s.patch b/vdso-handle-vvar_vclock-vma-s.patch deleted file mode 100644 index 2dd939b..0000000 --- a/vdso-handle-vvar_vclock-vma-s.patch +++ /dev/null @@ -1,181 +0,0 @@ -From 058572e91dea1d8ac9c345e69e08a58e8abfacbb Mon Sep 17 00:00:00 2001 -From: Andrei Vagin -Date: Thu, 5 Dec 2024 22:17:38 +0000 -Subject: [PATCH] vdso: handle vvar_vclock vma-s - -The vvar_vclock was introduced by [1]. Basically, the old vvar vma has -been splited on two parts. In term of C/R, these two vma-s can be still -treated as one. - -[1] e93d2521b27f ("x86/vdso: Split virtual clock pages into dedicated mapping") - -Signed-off-by: Andrei Vagin ---- - criu/include/util-vdso.h | 1 + - criu/pie/parasite-vdso.c | 19 ++++++++++++++++++- - criu/proc_parse.c | 23 +++++++++++++++++++---- - criu/vdso.c | 28 +++++++++++++++++++++------- - 4 files changed, 59 insertions(+), 12 deletions(-) - -diff --git a/criu/include/util-vdso.h b/criu/include/util-vdso.h -index c4386cf8e..9fd9a6de4 100644 ---- a/criu/include/util-vdso.h -+++ b/criu/include/util-vdso.h -@@ -30,6 +30,7 @@ struct vdso_symbol { - struct vdso_symtable { - unsigned long vdso_size; - unsigned long vvar_size; -+ unsigned long vvar_vclock_size; - struct vdso_symbol symbols[VDSO_SYMBOL_MAX]; - bool vdso_before_vvar; /* order of vdso/vvar pair */ - }; -diff --git a/criu/pie/parasite-vdso.c b/criu/pie/parasite-vdso.c -index 355007fa9..f3ad3107f 100644 ---- a/criu/pie/parasite-vdso.c -+++ b/criu/pie/parasite-vdso.c -@@ -45,6 +45,7 @@ static int remap_one(char *who, unsigned long *from, unsigned long to, size_t si - static int park_at(struct vdso_maps *rt, unsigned long vdso, unsigned long vvar) - { - unsigned long vvar_size = rt->sym.vvar_size; -+ unsigned long vvar_vclock_size = rt->sym.vvar_vclock_size; - unsigned long vdso_size = rt->sym.vdso_size; - int ret; - -@@ -54,8 +55,24 @@ static int park_at(struct vdso_maps *rt, unsigned long vdso, unsigned long vvar) - - std_log_set_gettimeofday(NULL); /* stop using vdso for timings */ - -- if (vvar) -+ if (vvar) { -+ /* -+ * v6.13-rc1~172^2~9 splits the vvar vma in two parts vvar and -+ * vvar_clock. The last one is mapped right after the first -+ * one. -+ */ -+ if (vvar_vclock_size) { -+ unsigned long from; -+ -+ vvar_size -= vvar_vclock_size; -+ from = rt->vvar_start + vvar_size; -+ -+ ret = remap_one("rt-vvar", &from, vvar + vvar_size, vvar_vclock_size); -+ if (ret) -+ return ret; -+ } - ret = remap_one("rt-vvar", &rt->vvar_start, vvar, vvar_size); -+ } - - if (!ret) - vdso_update_gtod_addr(rt); -diff --git a/criu/proc_parse.c b/criu/proc_parse.c -index 95ebe3a41..6c4303e7d 100644 ---- a/criu/proc_parse.c -+++ b/criu/proc_parse.c -@@ -579,7 +579,8 @@ static int handle_vma(pid_t pid, struct vma_area *vma_area, const char *file_pat - } else if (!strcmp(file_path, "[vdso]")) { - if (handle_vdso_vma(vma_area)) - goto err; -- } else if (!strcmp(file_path, "[vvar]")) { -+ } else if (!strcmp(file_path, "[vvar]") || -+ !strcmp(file_path, "[vvar_vclock]")) { - if (handle_vvar_vma(vma_area)) - goto err; - } else if (!strcmp(file_path, "[heap]")) { -@@ -771,7 +772,7 @@ static int task_size_check(pid_t pid, VmaEntry *entry) - - int parse_smaps(pid_t pid, struct vm_area_list *vma_area_list, dump_filemap_t dump_filemap) - { -- struct vma_area *vma_area = NULL; -+ struct vma_area *vma_area = NULL, *prev_vma_area = NULL; - unsigned long start, end, pgoff, prev_end = 0; - char r, w, x, s; - int ret = -1, vm_file_fd = -1; -@@ -813,8 +814,22 @@ int parse_smaps(pid_t pid, struct vm_area_list *vma_area_list, dump_filemap_t du - continue; - } - -- if (vma_area && vma_list_add(vma_area, vma_area_list, &prev_end, &vfi, &prev_vfi)) -- goto err; -+ if (vma_area && vma_area_is(vma_area, VMA_AREA_VVAR) && -+ prev_vma_area && vma_area_is(prev_vma_area, VMA_AREA_VVAR)) { -+ if (prev_vma_area->e->end != vma_area->e->start) { -+ pr_err("two nonconsecutive vvar vma-s: " -+ "%" PRIx64 "-%" PRIx64 " %" PRIx64 "-%" PRIx64 "\n", -+ prev_vma_area->e->start, prev_vma_area->e->end, -+ vma_area->e->start, vma_area->e->end); -+ goto err; -+ } -+ /* Merge all vvar vma-s into one. */ -+ prev_vma_area->e->end = vma_area->e->end; -+ } else { -+ if (vma_area && vma_list_add(vma_area, vma_area_list, &prev_end, &vfi, &prev_vfi)) -+ goto err; -+ prev_vma_area = vma_area; -+ } - - if (eof) - break; -diff --git a/criu/vdso.c b/criu/vdso.c -index 7de2fae78..d4d351131 100644 ---- a/criu/vdso.c -+++ b/criu/vdso.c -@@ -310,7 +310,7 @@ static int vdso_parse_maps(pid_t pid, struct vdso_maps *s) - - while (1) { - unsigned long start, end; -- char *has_vdso, *has_vvar; -+ char *has_vdso, *has_vvar, *has_vvar_vclock; - - buf = breadline(&f); - if (buf == NULL) -@@ -318,13 +318,19 @@ static int vdso_parse_maps(pid_t pid, struct vdso_maps *s) - if (IS_ERR(buf)) - goto err; - -- has_vdso = strstr(buf, "[vdso]"); -- if (!has_vdso) -+ has_vvar = NULL; -+ has_vvar_vclock = NULL; -+ do { -+ has_vdso = strstr(buf, "[vdso]"); -+ if (has_vdso) -+ break; - has_vvar = strstr(buf, "[vvar]"); -- else -- has_vvar = NULL; -+ if (has_vvar) -+ break; -+ has_vvar_vclock = strstr(buf, "[vvar_vclock]"); -+ } while (0); - -- if (!has_vdso && !has_vvar) -+ if (!has_vdso && !has_vvar && !has_vvar_vclock) - continue; - - if (sscanf(buf, "%lx-%lx", &start, &end) != 2) { -@@ -339,13 +345,21 @@ static int vdso_parse_maps(pid_t pid, struct vdso_maps *s) - } - s->vdso_start = start; - s->sym.vdso_size = end - start; -- } else { -+ } else if (has_vvar) { - if (s->vvar_start != VVAR_BAD_ADDR) { - pr_err("Got second VVAR entry\n"); - goto err; - } - s->vvar_start = start; - s->sym.vvar_size = end - start; -+ } else { -+ if (s->vvar_start == VDSO_BAD_ADDR || -+ s->vvar_start + s->sym.vvar_size != start) { -+ pr_err("VVAR and VVAR_VCLOCK entries are not subsequent\n"); -+ goto err; -+ } -+ s->sym.vvar_vclock_size = end - start; -+ s->sym.vvar_size += s->sym.vvar_vclock_size; - } - } - --- -2.47.0 - From 323d01daa05d3d402d05114c21904b645ad755ba Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Mon, 21 Apr 2025 20:25:11 +0200 Subject: [PATCH 091/109] Apply upstream patch to fix a runc regression Signed-off-by: Adrian Reber --- 2653.patch | 134 +++++++++++++++++++++++++++++++++++++++++++++++++++++ criu.spec | 8 +++- 2 files changed, 141 insertions(+), 1 deletion(-) create mode 100644 2653.patch diff --git a/2653.patch b/2653.patch new file mode 100644 index 0000000..bcb96fd --- /dev/null +++ b/2653.patch @@ -0,0 +1,134 @@ +From 22fdffbdde9476b27988b3ee0a4013a4453784c9 Mon Sep 17 00:00:00 2001 +From: Andrei Vagin +Date: Mon, 21 Apr 2025 06:33:41 +0000 +Subject: [PATCH] net: nftables: avoid restore failure if the CRIU nft table + already exist + +CRIU locks the network during restore in an "empty" network namespace. +However, "empty" in this context means CRIU isn't restoring the +namespace. This network namespace can be the same namespace where +processes have been dumped and so the network is already locked in it. + +Fixes #2650 + +Signed-off-by: Andrei Vagin +--- + criu/cr-restore.c | 2 +- + criu/include/net.h | 2 +- + criu/net.c | 30 +++++++++++++++++------------- + 3 files changed, 19 insertions(+), 15 deletions(-) + +diff --git a/criu/cr-restore.c b/criu/cr-restore.c +index 583b446e0b..30932f60a2 100644 +--- a/criu/cr-restore.c ++++ b/criu/cr-restore.c +@@ -2119,7 +2119,7 @@ static int restore_root_task(struct pstree_item *init) + * the '--empty-ns net' mode no iptables C/R is done and we + * need to return these rules by hands. + */ +- ret = network_lock_internal(); ++ ret = network_lock_internal(/* restore = */ true); + if (ret) + goto out_kill; + } +diff --git a/criu/include/net.h b/criu/include/net.h +index 5e8a848620..7c5ede21e1 100644 +--- a/criu/include/net.h ++++ b/criu/include/net.h +@@ -31,7 +31,7 @@ extern int collect_net_namespaces(bool for_dump); + + extern int network_lock(void); + extern void network_unlock(void); +-extern int network_lock_internal(void); ++extern int network_lock_internal(bool restore); + + extern struct ns_desc net_ns_desc; + +diff --git a/criu/net.c b/criu/net.c +index ee46f1c495..300df480b0 100644 +--- a/criu/net.c ++++ b/criu/net.c +@@ -3206,12 +3206,12 @@ static inline FILE *redirect_nftables_output(struct nft_ctx *nft) + } + #endif + +-static inline int nftables_lock_network_internal(void) ++static inline int nftables_lock_network_internal(bool restore) + { + #if defined(CONFIG_HAS_NFTABLES_LIB_API_0) || defined(CONFIG_HAS_NFTABLES_LIB_API_1) + cleanup_file FILE *fp = NULL; + struct nft_ctx *nft; +- int ret = 0; ++ int ret = 0, exit_code = -1; + char table[32]; + char buf[128]; + +@@ -3224,11 +3224,16 @@ static inline int nftables_lock_network_internal(void) + + fp = redirect_nftables_output(nft); + if (!fp) +- goto out; ++ goto err2; + + snprintf(buf, sizeof(buf), "create table %s", table); +- if (NFT_RUN_CMD(nft, buf)) ++ ret = NFT_RUN_CMD(nft, buf); ++ if (ret) { ++ /* The network has been locked on dump. */ ++ if (restore && errno == EEXIST) ++ return 0; + goto err2; ++ } + + snprintf(buf, sizeof(buf), "add chain %s output { type filter hook output priority 0; policy drop; }", table); + if (NFT_RUN_CMD(nft, buf)) +@@ -3246,17 +3251,16 @@ static inline int nftables_lock_network_internal(void) + if (NFT_RUN_CMD(nft, buf)) + goto err1; + +- goto out; +- ++ exit_code = 0; ++out: ++ nft_ctx_free(nft); ++ return exit_code; + err1: + snprintf(buf, sizeof(buf), "delete table %s", table); + NFT_RUN_CMD(nft, buf); + err2: +- ret = -1; + pr_err("Locking network failed using nftables\n"); +-out: +- nft_ctx_free(nft); +- return ret; ++ goto out; + #else + pr_err("CRIU was built without libnftables support\n"); + return -1; +@@ -3288,7 +3292,7 @@ static int iptables_network_lock_internal(void) + return ret; + } + +-int network_lock_internal(void) ++int network_lock_internal(bool restore) + { + int ret = 0, nsret; + +@@ -3301,7 +3305,7 @@ int network_lock_internal(void) + if (opts.network_lock_method == NETWORK_LOCK_IPTABLES) + ret = iptables_network_lock_internal(); + else if (opts.network_lock_method == NETWORK_LOCK_NFTABLES) +- ret = nftables_lock_network_internal(); ++ ret = nftables_lock_network_internal(restore); + + if (restore_ns(nsret, &net_ns_desc)) + ret = -1; +@@ -3427,7 +3431,7 @@ int network_lock(void) + if (run_scripts(ACT_NET_LOCK)) + return -1; + +- return network_lock_internal(); ++ return network_lock_internal(false); + } + + void network_unlock(void) diff --git a/criu.spec b/criu.spec index 26d8efb..fb0f551 100644 --- a/criu.spec +++ b/criu.spec @@ -12,12 +12,14 @@ Name: criu Version: 4.1 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPL-2.0-only AND LGPL-2.1-only AND MIT URL: http://criu.org/ Source0: https://github.com/checkpoint-restore/criu/archive/v%{version}/criu-%{version}.tar.gz +Patch0: https://github.com/checkpoint-restore/criu/pull/2653.patch + # Add protobuf-c as a dependency. # We use this patch because the protobuf-c package name # in RPM and DEB is different. @@ -113,6 +115,7 @@ This script can help to workaround the so called "PID mismatch" problem. %prep %setup -q +%patch -P 0 -p1 %patch -P 99 -p1 %build @@ -185,6 +188,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %tmpfiles_create %{name}.conf %changelog +* Mon Apr 21 2025 Adrian Reber - 4.1-2 +- Apply upstream patch to fix a runc regression + * Mon Apr 07 2025 Radostin Stoyanov - 4.1-1 - Update to 4.1 From 649d2f33e59e9942e049148cce54894693a7c506 Mon Sep 17 00:00:00 2001 From: David Abdurachmanov Date: Sun, 20 Apr 2025 07:01:05 +0300 Subject: [PATCH 092/109] Enable for riscv64 Signed-off-by: David Abdurachmanov --- criu.spec | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/criu.spec b/criu.spec index fb0f551..bf0627e 100644 --- a/criu.spec +++ b/criu.spec @@ -12,7 +12,7 @@ Name: criu Version: 4.1 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPL-2.0-only AND LGPL-2.1-only AND MIT URL: http://criu.org/ @@ -52,7 +52,7 @@ BuildRequires: make # user-space and kernel changes are only available for x86_64, arm, # ppc64le, aarch64 and s390x # https://bugzilla.redhat.com/show_bug.cgi?id=902875 -ExclusiveArch: x86_64 %{arm} ppc64le aarch64 s390x +ExclusiveArch: x86_64 %{arm} ppc64le aarch64 s390x riscv64 %description criu is the user-space part of Checkpoint/Restore in User-space @@ -188,6 +188,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %tmpfiles_create %{name}.conf %changelog +* Wed Apr 23 2025 David Abdurachmanov - 4.1-3 +- Enable for riscv64 + * Mon Apr 21 2025 Adrian Reber - 4.1-2 - Apply upstream patch to fix a runc regression From 54afe54e10d7857efed9ea17f938230600c3aa7b Mon Sep 17 00:00:00 2001 From: Python Maint Date: Tue, 17 Jun 2025 21:09:14 +0200 Subject: [PATCH 093/109] Rebuilt for Python 3.14 --- criu.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/criu.spec b/criu.spec index bf0627e..6917a4a 100644 --- a/criu.spec +++ b/criu.spec @@ -12,7 +12,7 @@ Name: criu Version: 4.1 -Release: 3%{?dist} +Release: 4%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPL-2.0-only AND LGPL-2.1-only AND MIT URL: http://criu.org/ @@ -188,6 +188,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %tmpfiles_create %{name}.conf %changelog +* Tue Jun 17 2025 Python Maint - 4.1-4 +- Rebuilt for Python 3.14 + * Wed Apr 23 2025 David Abdurachmanov - 4.1-3 - Enable for riscv64 From dd4a14f00a5b1c38c3e44600c499f3a7dea94f79 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 23 Jul 2025 18:50:01 +0000 Subject: [PATCH 094/109] Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild --- criu.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/criu.spec b/criu.spec index 6917a4a..71cacd4 100644 --- a/criu.spec +++ b/criu.spec @@ -12,7 +12,7 @@ Name: criu Version: 4.1 -Release: 4%{?dist} +Release: 5%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPL-2.0-only AND LGPL-2.1-only AND MIT URL: http://criu.org/ @@ -188,6 +188,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %tmpfiles_create %{name}.conf %changelog +* Wed Jul 23 2025 Fedora Release Engineering - 4.1-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild + * Tue Jun 17 2025 Python Maint - 4.1-4 - Rebuilt for Python 3.14 From 88cce10fd3a90853ff054c84043c41e4b16d0216 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Wed, 30 Jul 2025 08:46:06 +0200 Subject: [PATCH 095/109] Update to 4.1.1 Signed-off-by: Adrian Reber --- .gitignore | 1 + criu.spec | 7 +++++-- sources | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 7bd1f04..5e0f8c8 100644 --- a/.gitignore +++ b/.gitignore @@ -58,3 +58,4 @@ /criu-3.19.tar.gz /criu-4.0.tar.gz /criu-4.1.tar.gz +/criu-4.1.1.tar.gz diff --git a/criu.spec b/criu.spec index 71cacd4..b310da5 100644 --- a/criu.spec +++ b/criu.spec @@ -11,8 +11,8 @@ %undefine _auto_set_build_flags Name: criu -Version: 4.1 -Release: 5%{?dist} +Version: 4.1.1 +Release: 1%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPL-2.0-only AND LGPL-2.1-only AND MIT URL: http://criu.org/ @@ -188,6 +188,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %tmpfiles_create %{name}.conf %changelog +* Wed Jul 30 2025 Adrian Reber - 4.1.1-1 +- Update to 4.1.1 + * Wed Jul 23 2025 Fedora Release Engineering - 4.1-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild diff --git a/sources b/sources index 79397e1..f653226 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (criu-4.1.tar.gz) = 769001a7e527c129fe73509fd0c7d3fc3b9b1080dc69929032cb84f60f95256f5d145ed4b7ea11f090a7f468f2bb2a0ecf56475eb292966cad26d643f0e46816 +SHA512 (criu-4.1.1.tar.gz) = a73c35dbd4ec4d2ead0799c6f1af2f467610c538c3ab4a87f5586aa1d29a8268bbc6c222bb3026a32211b6899a4d39730d61fa453ce2adafa561d92f6c87e228 From 6733bdad08f7eef126fbe911bdefc0f6402af8b1 Mon Sep 17 00:00:00 2001 From: Python Maint Date: Fri, 15 Aug 2025 12:43:17 +0200 Subject: [PATCH 096/109] Rebuilt for Python 3.14.0rc2 bytecode --- criu.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/criu.spec b/criu.spec index b310da5..ab468c5 100644 --- a/criu.spec +++ b/criu.spec @@ -12,7 +12,7 @@ Name: criu Version: 4.1.1 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPL-2.0-only AND LGPL-2.1-only AND MIT URL: http://criu.org/ @@ -188,6 +188,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %tmpfiles_create %{name}.conf %changelog +* Fri Aug 15 2025 Python Maint - 4.1.1-2 +- Rebuilt for Python 3.14.0rc2 bytecode + * Wed Jul 30 2025 Adrian Reber - 4.1.1-1 - Update to 4.1.1 From 678054d8fd9c4280fd093eccd46e2c7c7a7446c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Tue, 29 Jul 2025 23:04:08 +0200 Subject: [PATCH 097/109] Drop unused BuildRequires on python3-wheel See https://github.com/fedora-eln/eln/issues/284 --- criu.spec | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/criu.spec b/criu.spec index ab468c5..98e755c 100644 --- a/criu.spec +++ b/criu.spec @@ -12,7 +12,7 @@ Name: criu Version: 4.1.1 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPL-2.0-only AND LGPL-2.1-only AND MIT URL: http://criu.org/ @@ -33,7 +33,7 @@ BuildRequires: libnet-devel BuildRequires: protobuf-devel protobuf-c-devel %{py_prefix}-devel libnl3-devel libcap-devel BuildRequires: %{py_prefix}-pip BuildRequires: %{py_prefix}-setuptools -BuildRequires: %{py_prefix}-wheel +BuildRequires: (%{py_prefix}-wheel if %{py_prefix}-setuptools < 71) BuildRequires: %{py_prefix}-protobuf BuildRequires: asciidoctor BuildRequires: perl-interpreter @@ -188,6 +188,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %tmpfiles_create %{name}.conf %changelog +* Wed Aug 27 2025 Miro Hrončok - 4.1.1-3 +- Drop unused BuildRequires on python3-wheel + * Fri Aug 15 2025 Python Maint - 4.1.1-2 - Rebuilt for Python 3.14.0rc2 bytecode From ad9dc1a142fcde0ce8cec66ce2432820c5965f69 Mon Sep 17 00:00:00 2001 From: Python Maint Date: Fri, 19 Sep 2025 12:12:32 +0200 Subject: [PATCH 098/109] Rebuilt for Python 3.14.0rc3 bytecode --- criu.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/criu.spec b/criu.spec index 98e755c..a40fa5c 100644 --- a/criu.spec +++ b/criu.spec @@ -12,7 +12,7 @@ Name: criu Version: 4.1.1 -Release: 3%{?dist} +Release: 4%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPL-2.0-only AND LGPL-2.1-only AND MIT URL: http://criu.org/ @@ -188,6 +188,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %tmpfiles_create %{name}.conf %changelog +* Fri Sep 19 2025 Python Maint - 4.1.1-4 +- Rebuilt for Python 3.14.0rc3 bytecode + * Wed Aug 27 2025 Miro Hrončok - 4.1.1-3 - Drop unused BuildRequires on python3-wheel From 5467ca58cd232a1f2cebcc28bd0da60f2386685d Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Mon, 17 Nov 2025 02:45:34 +0100 Subject: [PATCH 099/109] Update to 4.2 Signed-off-by: Adrian Reber --- .gitignore | 1 + 2653.patch | 134 ----------------------------------------------------- criu.spec | 10 ++-- sources | 2 +- 4 files changed, 7 insertions(+), 140 deletions(-) delete mode 100644 2653.patch diff --git a/.gitignore b/.gitignore index 5e0f8c8..e5c1b1b 100644 --- a/.gitignore +++ b/.gitignore @@ -59,3 +59,4 @@ /criu-4.0.tar.gz /criu-4.1.tar.gz /criu-4.1.1.tar.gz +/criu-4.2.tar.gz diff --git a/2653.patch b/2653.patch deleted file mode 100644 index bcb96fd..0000000 --- a/2653.patch +++ /dev/null @@ -1,134 +0,0 @@ -From 22fdffbdde9476b27988b3ee0a4013a4453784c9 Mon Sep 17 00:00:00 2001 -From: Andrei Vagin -Date: Mon, 21 Apr 2025 06:33:41 +0000 -Subject: [PATCH] net: nftables: avoid restore failure if the CRIU nft table - already exist - -CRIU locks the network during restore in an "empty" network namespace. -However, "empty" in this context means CRIU isn't restoring the -namespace. This network namespace can be the same namespace where -processes have been dumped and so the network is already locked in it. - -Fixes #2650 - -Signed-off-by: Andrei Vagin ---- - criu/cr-restore.c | 2 +- - criu/include/net.h | 2 +- - criu/net.c | 30 +++++++++++++++++------------- - 3 files changed, 19 insertions(+), 15 deletions(-) - -diff --git a/criu/cr-restore.c b/criu/cr-restore.c -index 583b446e0b..30932f60a2 100644 ---- a/criu/cr-restore.c -+++ b/criu/cr-restore.c -@@ -2119,7 +2119,7 @@ static int restore_root_task(struct pstree_item *init) - * the '--empty-ns net' mode no iptables C/R is done and we - * need to return these rules by hands. - */ -- ret = network_lock_internal(); -+ ret = network_lock_internal(/* restore = */ true); - if (ret) - goto out_kill; - } -diff --git a/criu/include/net.h b/criu/include/net.h -index 5e8a848620..7c5ede21e1 100644 ---- a/criu/include/net.h -+++ b/criu/include/net.h -@@ -31,7 +31,7 @@ extern int collect_net_namespaces(bool for_dump); - - extern int network_lock(void); - extern void network_unlock(void); --extern int network_lock_internal(void); -+extern int network_lock_internal(bool restore); - - extern struct ns_desc net_ns_desc; - -diff --git a/criu/net.c b/criu/net.c -index ee46f1c495..300df480b0 100644 ---- a/criu/net.c -+++ b/criu/net.c -@@ -3206,12 +3206,12 @@ static inline FILE *redirect_nftables_output(struct nft_ctx *nft) - } - #endif - --static inline int nftables_lock_network_internal(void) -+static inline int nftables_lock_network_internal(bool restore) - { - #if defined(CONFIG_HAS_NFTABLES_LIB_API_0) || defined(CONFIG_HAS_NFTABLES_LIB_API_1) - cleanup_file FILE *fp = NULL; - struct nft_ctx *nft; -- int ret = 0; -+ int ret = 0, exit_code = -1; - char table[32]; - char buf[128]; - -@@ -3224,11 +3224,16 @@ static inline int nftables_lock_network_internal(void) - - fp = redirect_nftables_output(nft); - if (!fp) -- goto out; -+ goto err2; - - snprintf(buf, sizeof(buf), "create table %s", table); -- if (NFT_RUN_CMD(nft, buf)) -+ ret = NFT_RUN_CMD(nft, buf); -+ if (ret) { -+ /* The network has been locked on dump. */ -+ if (restore && errno == EEXIST) -+ return 0; - goto err2; -+ } - - snprintf(buf, sizeof(buf), "add chain %s output { type filter hook output priority 0; policy drop; }", table); - if (NFT_RUN_CMD(nft, buf)) -@@ -3246,17 +3251,16 @@ static inline int nftables_lock_network_internal(void) - if (NFT_RUN_CMD(nft, buf)) - goto err1; - -- goto out; -- -+ exit_code = 0; -+out: -+ nft_ctx_free(nft); -+ return exit_code; - err1: - snprintf(buf, sizeof(buf), "delete table %s", table); - NFT_RUN_CMD(nft, buf); - err2: -- ret = -1; - pr_err("Locking network failed using nftables\n"); --out: -- nft_ctx_free(nft); -- return ret; -+ goto out; - #else - pr_err("CRIU was built without libnftables support\n"); - return -1; -@@ -3288,7 +3292,7 @@ static int iptables_network_lock_internal(void) - return ret; - } - --int network_lock_internal(void) -+int network_lock_internal(bool restore) - { - int ret = 0, nsret; - -@@ -3301,7 +3305,7 @@ int network_lock_internal(void) - if (opts.network_lock_method == NETWORK_LOCK_IPTABLES) - ret = iptables_network_lock_internal(); - else if (opts.network_lock_method == NETWORK_LOCK_NFTABLES) -- ret = nftables_lock_network_internal(); -+ ret = nftables_lock_network_internal(restore); - - if (restore_ns(nsret, &net_ns_desc)) - ret = -1; -@@ -3427,7 +3431,7 @@ int network_lock(void) - if (run_scripts(ACT_NET_LOCK)) - return -1; - -- return network_lock_internal(); -+ return network_lock_internal(false); - } - - void network_unlock(void) diff --git a/criu.spec b/criu.spec index a40fa5c..c20cbea 100644 --- a/criu.spec +++ b/criu.spec @@ -11,15 +11,13 @@ %undefine _auto_set_build_flags Name: criu -Version: 4.1.1 -Release: 4%{?dist} +Version: 4.2 +Release: 1%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPL-2.0-only AND LGPL-2.1-only AND MIT URL: http://criu.org/ Source0: https://github.com/checkpoint-restore/criu/archive/v%{version}/criu-%{version}.tar.gz -Patch0: https://github.com/checkpoint-restore/criu/pull/2653.patch - # Add protobuf-c as a dependency. # We use this patch because the protobuf-c package name # in RPM and DEB is different. @@ -115,7 +113,6 @@ This script can help to workaround the so called "PID mismatch" problem. %prep %setup -q -%patch -P 0 -p1 %patch -P 99 -p1 %build @@ -188,6 +185,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %tmpfiles_create %{name}.conf %changelog +* Mon Nov 17 2025 Adrian Reber - 4.2 +- Update to 4.2 + * Fri Sep 19 2025 Python Maint - 4.1.1-4 - Rebuilt for Python 3.14.0rc3 bytecode diff --git a/sources b/sources index f653226..8f69f50 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (criu-4.1.1.tar.gz) = a73c35dbd4ec4d2ead0799c6f1af2f467610c538c3ab4a87f5586aa1d29a8268bbc6c222bb3026a32211b6899a4d39730d61fa453ce2adafa561d92f6c87e228 +SHA512 (criu-4.2.tar.gz) = f7e0ac17d46dd560bb2439f617a0a3b3933eb86f4b8b9b16852d300e4ffc6a4851d72be9342dfd40792a53fca8b65d26fde4e1b1f02bcd04923a8b6f0e5c8a62 From b18123941d500c38b9d94a3e550f33fb67a53f1c Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Mon, 17 Nov 2025 10:47:51 +0000 Subject: [PATCH 100/109] Update to 4.2 Signed-off-by: Adrian Reber --- criu.spec | 4 ++-- rpminspect.yaml | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 rpminspect.yaml diff --git a/criu.spec b/criu.spec index c20cbea..d67955f 100644 --- a/criu.spec +++ b/criu.spec @@ -12,7 +12,7 @@ Name: criu Version: 4.2 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPL-2.0-only AND LGPL-2.1-only AND MIT URL: http://criu.org/ @@ -185,7 +185,7 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %tmpfiles_create %{name}.conf %changelog -* Mon Nov 17 2025 Adrian Reber - 4.2 +* Mon Nov 17 2025 Adrian Reber - 4.2-2 - Update to 4.2 * Fri Sep 19 2025 Python Maint - 4.1.1-4 diff --git a/rpminspect.yaml b/rpminspect.yaml new file mode 100644 index 0000000..6b8f937 --- /dev/null +++ b/rpminspect.yaml @@ -0,0 +1,4 @@ +--- +annocheck: + jobs: + - hardened: --verbose --skip-dynamic-tags --skip-property-note --skip-bind-now --skip-pie --skip-cf-protection From c4e321b1d78897969078602af077abbbb8327420 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Mon, 17 Nov 2025 14:50:33 +0100 Subject: [PATCH 101/109] Update to 4.2 Signed-off-by: Adrian Reber --- criu.spec | 4 ++-- rpminspect.yaml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/criu.spec b/criu.spec index d67955f..20dbedb 100644 --- a/criu.spec +++ b/criu.spec @@ -12,7 +12,7 @@ Name: criu Version: 4.2 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPL-2.0-only AND LGPL-2.1-only AND MIT URL: http://criu.org/ @@ -185,7 +185,7 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %tmpfiles_create %{name}.conf %changelog -* Mon Nov 17 2025 Adrian Reber - 4.2-2 +* Mon Nov 17 2025 Adrian Reber - 4.2-3 - Update to 4.2 * Fri Sep 19 2025 Python Maint - 4.1.1-4 diff --git a/rpminspect.yaml b/rpminspect.yaml index 6b8f937..56018c6 100644 --- a/rpminspect.yaml +++ b/rpminspect.yaml @@ -1,4 +1,4 @@ --- annocheck: jobs: - - hardened: --verbose --skip-dynamic-tags --skip-property-note --skip-bind-now --skip-pie --skip-cf-protection + - hardened: --verbose --skip-dynamic-tags --skip-property-note --skip-bind-now --skip-pie --skip-cf-protection --skip-notes From 0f4173bc94b03dcc3818ebf16308b1be3cf652b6 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Mon, 17 Nov 2025 17:37:41 +0100 Subject: [PATCH 102/109] Update to 4.2 Signed-off-by: Adrian Reber --- criu.spec | 4 ++-- rpminspect.yaml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/criu.spec b/criu.spec index 20dbedb..9b80e5c 100644 --- a/criu.spec +++ b/criu.spec @@ -12,7 +12,7 @@ Name: criu Version: 4.2 -Release: 3%{?dist} +Release: 4%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPL-2.0-only AND LGPL-2.1-only AND MIT URL: http://criu.org/ @@ -185,7 +185,7 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %tmpfiles_create %{name}.conf %changelog -* Mon Nov 17 2025 Adrian Reber - 4.2-3 +* Mon Nov 17 2025 Adrian Reber - 4.2-4 - Update to 4.2 * Fri Sep 19 2025 Python Maint - 4.1.1-4 diff --git a/rpminspect.yaml b/rpminspect.yaml index 56018c6..3430463 100644 --- a/rpminspect.yaml +++ b/rpminspect.yaml @@ -1,4 +1,4 @@ --- annocheck: jobs: - - hardened: --verbose --skip-dynamic-tags --skip-property-note --skip-bind-now --skip-pie --skip-cf-protection --skip-notes + - hardened: --verbose --skip-dynamic-tags --skip-property-note --skip-bind-now --skip-pie --skip-cf-protection --skip-notes --skip-gaps From 368f367e6924e842f6d426eaefdc274b463b15a5 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Mon, 17 Nov 2025 18:29:29 +0100 Subject: [PATCH 103/109] Update to 4.2 Signed-off-by: Adrian Reber --- criu.spec | 4 ++-- rpminspect.yaml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/criu.spec b/criu.spec index 9b80e5c..ba4379c 100644 --- a/criu.spec +++ b/criu.spec @@ -12,7 +12,7 @@ Name: criu Version: 4.2 -Release: 4%{?dist} +Release: 5%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPL-2.0-only AND LGPL-2.1-only AND MIT URL: http://criu.org/ @@ -185,7 +185,7 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %tmpfiles_create %{name}.conf %changelog -* Mon Nov 17 2025 Adrian Reber - 4.2-4 +* Mon Nov 17 2025 Adrian Reber - 4.2-5 - Update to 4.2 * Fri Sep 19 2025 Python Maint - 4.1.1-4 diff --git a/rpminspect.yaml b/rpminspect.yaml index 3430463..93f2777 100644 --- a/rpminspect.yaml +++ b/rpminspect.yaml @@ -1,4 +1,4 @@ --- annocheck: jobs: - - hardened: --verbose --skip-dynamic-tags --skip-property-note --skip-bind-now --skip-pie --skip-cf-protection --skip-notes --skip-gaps + - hardened: --verbose --skip-dynamic-tags --skip-property-note --skip-bind-now --skip-pie --skip-cf-protection --skip-notes --skip-gaps --skip-optimization --skip-stack-clash --skip-stack-prot From 13061f0076c966f6893e2bb283ffd68b9d3b8d78 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Mon, 17 Nov 2025 21:14:44 +0100 Subject: [PATCH 104/109] Convert STI tests to TMT (rhbz#2382879) Signed-off-by: Adrian Reber --- .fmf/version | 1 + criu.spec | 5 ++++- plans.fmf | 24 ++++++++++++++++++++++++ tests/{tests.yml => main.fmf} | 33 +++++++++++++-------------------- tests/run-zdtm.sh | 2 +- 5 files changed, 43 insertions(+), 22 deletions(-) create mode 100644 .fmf/version create mode 100644 plans.fmf rename tests/{tests.yml => main.fmf} (54%) diff --git a/.fmf/version b/.fmf/version new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/.fmf/version @@ -0,0 +1 @@ +1 diff --git a/criu.spec b/criu.spec index ba4379c..ed21c01 100644 --- a/criu.spec +++ b/criu.spec @@ -12,7 +12,7 @@ Name: criu Version: 4.2 -Release: 5%{?dist} +Release: 6%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPL-2.0-only AND LGPL-2.1-only AND MIT URL: http://criu.org/ @@ -185,6 +185,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %tmpfiles_create %{name}.conf %changelog +* Mon Nov 15 2025 Cristian Le - 4.2-6 +- Convert STI tests to TMT (rhbz#2382879) + * Mon Nov 17 2025 Adrian Reber - 4.2-5 - Update to 4.2 diff --git a/plans.fmf b/plans.fmf new file mode 100644 index 0000000..52b1751 --- /dev/null +++ b/plans.fmf @@ -0,0 +1,24 @@ +summary: Run all tests +discover: + how: fmf +prepare: + - name: Disable installing everything from srpm + how: install + exclude: ".*" + - name: Install the main package + how: install + package: + - criu +execute: + how: tmt + +/zdtm: + # Use the srpm sources + discover+: + dist-git-source: true + dist-git-merge: true + test: /tests/zdtm + +/podman: + discover+: + test: /tests/podman diff --git a/tests/tests.yml b/tests/main.fmf similarity index 54% rename from tests/tests.yml rename to tests/main.fmf index 995fd2d..2062bee 100644 --- a/tests/tests.yml +++ b/tests/main.fmf @@ -1,16 +1,7 @@ ---- -- hosts: localhost - roles: - - role: standard-test-source - tags: - - classic - - role: standard-test-basic - tags: - - classic - required_packages: - - podman - - curl - - jq +/zdtm: + summary: Test zdtm + test: ./run-zdtm.sh + require: - checkpolicy - policycoreutils - make @@ -28,10 +19,12 @@ - python3-pyyaml - python3-protobuf - python-unversioned-command - tests: - - zdtm: - dir: . - run: ./run-zdtm.sh - - podman: - dir: . - run: ./run-podman-checkpoint-restore.sh + - crit + - python3-criu +/podman: + summary: Test podman + test: ./run-podman-checkpoint-restore.sh + require: + - podman + - curl + - jq diff --git a/tests/run-zdtm.sh b/tests/run-zdtm.sh index 460d090..f825928 100755 --- a/tests/run-zdtm.sh +++ b/tests/run-zdtm.sh @@ -36,7 +36,7 @@ RESULT=42 # this socket brakes CRIU's test cases rm -f /var/lib/sss/pipes/nss -cd "source/criu-$(crit --version)/" +cd ../criu-$(crit --version) echo "Build CRIU" make -j"$(nproc)" From ac36de486b2b2514e6fe69a1a0981fdd408590e5 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Mon, 17 Nov 2025 20:33:12 +0000 Subject: [PATCH 105/109] Test debugging Signed-off-by: Adrian Reber --- criu.spec | 4 ++-- tests/main.fmf | 1 + tests/run-podman-checkpoint-restore.sh | 4 +++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/criu.spec b/criu.spec index ed21c01..6e042fb 100644 --- a/criu.spec +++ b/criu.spec @@ -12,7 +12,7 @@ Name: criu Version: 4.2 -Release: 6%{?dist} +Release: 7%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPL-2.0-only AND LGPL-2.1-only AND MIT URL: http://criu.org/ @@ -185,7 +185,7 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %tmpfiles_create %{name}.conf %changelog -* Mon Nov 15 2025 Cristian Le - 4.2-6 +* Mon Nov 15 2025 Cristian Le - 4.2-7 - Convert STI tests to TMT (rhbz#2382879) * Mon Nov 17 2025 Adrian Reber - 4.2-5 diff --git a/tests/main.fmf b/tests/main.fmf index 2062bee..221ef70 100644 --- a/tests/main.fmf +++ b/tests/main.fmf @@ -15,6 +15,7 @@ - libnl3-devel - libcap-devel - libaio-devel + - libuuid-devel - nftables-devel - python3-pyyaml - python3-protobuf diff --git a/tests/run-podman-checkpoint-restore.sh b/tests/run-podman-checkpoint-restore.sh index 845d0b4..0d846ae 100755 --- a/tests/run-podman-checkpoint-restore.sh +++ b/tests/run-podman-checkpoint-restore.sh @@ -1,6 +1,6 @@ #!/bin/bash -set -eux +set -ux ls -la @@ -16,6 +16,8 @@ curl `podman inspect -l | jq -r '.[0].NetworkSettings.IPAddress'`:8088 echo "Checkpoint container" podman --log-level debug container checkpoint -l +cat /var/lib/containers/storage/overlay-containers/*/userdata/dump.log + podman ps -a echo "Restore container" podman --log-level debug container restore -l From 841fd2c85a9af34e6c80b03ae6de322ea6474d62 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Mon, 17 Nov 2025 21:35:38 +0100 Subject: [PATCH 106/109] Fix changelog date Signed-off-by: Adrian Reber --- criu.spec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/criu.spec b/criu.spec index 6e042fb..34e04d6 100644 --- a/criu.spec +++ b/criu.spec @@ -12,7 +12,7 @@ Name: criu Version: 4.2 -Release: 7%{?dist} +Release: 8%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPL-2.0-only AND LGPL-2.1-only AND MIT URL: http://criu.org/ @@ -185,7 +185,7 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %tmpfiles_create %{name}.conf %changelog -* Mon Nov 15 2025 Cristian Le - 4.2-7 +* Mon Nov 17 2025 Cristian Le - 4.2-8 - Convert STI tests to TMT (rhbz#2382879) * Mon Nov 17 2025 Adrian Reber - 4.2-5 From 1b9075566654f51a6e920af7a66bee2df519dbdc Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Mon, 17 Nov 2025 22:23:34 +0100 Subject: [PATCH 107/109] Increase test duration to 30 minutes From the default 5 minutes Signed-off-by: Adrian Reber --- criu.spec | 4 ++-- tests/main.fmf | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/criu.spec b/criu.spec index 34e04d6..fd4208f 100644 --- a/criu.spec +++ b/criu.spec @@ -12,7 +12,7 @@ Name: criu Version: 4.2 -Release: 8%{?dist} +Release: 9%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPL-2.0-only AND LGPL-2.1-only AND MIT URL: http://criu.org/ @@ -185,7 +185,7 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %tmpfiles_create %{name}.conf %changelog -* Mon Nov 17 2025 Cristian Le - 4.2-8 +* Mon Nov 17 2025 Cristian Le - 4.2-9 - Convert STI tests to TMT (rhbz#2382879) * Mon Nov 17 2025 Adrian Reber - 4.2-5 diff --git a/tests/main.fmf b/tests/main.fmf index 221ef70..a743210 100644 --- a/tests/main.fmf +++ b/tests/main.fmf @@ -1,6 +1,7 @@ /zdtm: summary: Test zdtm test: ./run-zdtm.sh + duration: 30m require: - checkpolicy - policycoreutils From 737146110baffdc47cc4b5202119d078d3e6ec5d Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Mon, 17 Nov 2025 22:56:10 +0100 Subject: [PATCH 108/109] Drop "Disable installing everything from srpm" This should fix that the newly build criu RPM is not installed in the test environment. Signed-off-by: Adrian Reber --- criu.spec | 4 ++-- plans.fmf | 3 --- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/criu.spec b/criu.spec index fd4208f..32bf7a8 100644 --- a/criu.spec +++ b/criu.spec @@ -12,7 +12,7 @@ Name: criu Version: 4.2 -Release: 9%{?dist} +Release: 10%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPL-2.0-only AND LGPL-2.1-only AND MIT URL: http://criu.org/ @@ -185,7 +185,7 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %tmpfiles_create %{name}.conf %changelog -* Mon Nov 17 2025 Cristian Le - 4.2-9 +* Mon Nov 17 2025 Cristian Le - 4.2-10 - Convert STI tests to TMT (rhbz#2382879) * Mon Nov 17 2025 Adrian Reber - 4.2-5 diff --git a/plans.fmf b/plans.fmf index 52b1751..946731e 100644 --- a/plans.fmf +++ b/plans.fmf @@ -2,9 +2,6 @@ summary: Run all tests discover: how: fmf prepare: - - name: Disable installing everything from srpm - how: install - exclude: ".*" - name: Install the main package how: install package: From a0a8f6a514976e539722aeb20d6c263686bebfed Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Mon, 17 Nov 2025 23:41:29 +0100 Subject: [PATCH 109/109] Hopefully finally changes to make the tests work Signed-off-by: Adrian Reber --- criu.spec | 4 ++-- tests/run-podman-checkpoint-restore.sh | 7 ++++--- tests/run-zdtm.sh | 17 ++++++++++++++++- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/criu.spec b/criu.spec index 32bf7a8..ec8bb31 100644 --- a/criu.spec +++ b/criu.spec @@ -12,7 +12,7 @@ Name: criu Version: 4.2 -Release: 10%{?dist} +Release: 11%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPL-2.0-only AND LGPL-2.1-only AND MIT URL: http://criu.org/ @@ -185,7 +185,7 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %tmpfiles_create %{name}.conf %changelog -* Mon Nov 17 2025 Cristian Le - 4.2-10 +* Mon Nov 17 2025 Cristian Le - 4.2-11 - Convert STI tests to TMT (rhbz#2382879) * Mon Nov 17 2025 Adrian Reber - 4.2-5 diff --git a/tests/run-podman-checkpoint-restore.sh b/tests/run-podman-checkpoint-restore.sh index 0d846ae..6ed7ad6 100755 --- a/tests/run-podman-checkpoint-restore.sh +++ b/tests/run-podman-checkpoint-restore.sh @@ -1,8 +1,11 @@ #!/bin/bash -set -ux +set -eux ls -la +uname -a +rpm -qi criu || true +criu --version echo "Start container" podman --log-level debug run -d quay.io/adrianreber/counter @@ -16,8 +19,6 @@ curl `podman inspect -l | jq -r '.[0].NetworkSettings.IPAddress'`:8088 echo "Checkpoint container" podman --log-level debug container checkpoint -l -cat /var/lib/containers/storage/overlay-containers/*/userdata/dump.log - podman ps -a echo "Restore container" podman --log-level debug container restore -l diff --git a/tests/run-zdtm.sh b/tests/run-zdtm.sh index f825928..ab046e1 100755 --- a/tests/run-zdtm.sh +++ b/tests/run-zdtm.sh @@ -3,6 +3,8 @@ set -xe uname -a +rpm -qi criu || true +criu --version # These zdtm tests are skipped because they fail only in CI system EXCLUDES=" \ @@ -13,6 +15,19 @@ EXCLUDES=" \ -x zdtm/static/socket-tcp4v6-closed \ -x zdtm/static/maps01 \ -x zdtm/static/maps04 \ + -x zdtm/static/del_standalone_un \ + -x zdtm/static/del_standalone_un_seqpacket \ + -x zdtm/static/deleted_unix_sock \ + -x zdtm/static/fifo_upon_unix_socket00 \ + -x zdtm/static/sk-unix-dgram-ghost \ + -x zdtm/static/sk-unix01 \ + -x zdtm/static/sk-unix01-seqpacket \ + -x zdtm/static/socket-tcpbuf \ + -x zdtm/static/socket-tcpbuf6 \ + -x zdtm/static/sockets00 \ + -x zdtm/static/sockets00-seqpacket \ + -x zdtm/static/sockets03 \ + -x zdtm/static/sockets03-seqpacket \ -x zdtm/static/cgroup04 \ -x zdtm/static/cgroup_ifpriomap \ -x zdtm/static/netns_sub \ @@ -33,7 +48,7 @@ run_test() { RESULT=42 -# this socket brakes CRIU's test cases +# this socket breaks CRIU's test cases rm -f /var/lib/sss/pipes/nss cd ../criu-$(crit --version)