- Update to criu 4.0:

New features:
  * Shadow stack support
  * CUDA plugin: Introduced a plugin to support checkpointing and restoring
    NVIDIA CUDA applications.
  Bugfixes:
  * cgroup: Add support for restoring a thread in a correct v1 cgroup
  * mem: fix some VMAs being incorrectly mapped wtih PROT_WRITE
  * criu: fix a fatal failure if nft doesn't work
  * net: Fix TOCTOU race condition in unix_conf_op
  * pagemap-cache: handle short reads
  * Fixes here and there.
  Improvements:
  * Pagemap cache: Added support for PAGEMAP_SCAN ioctl
  * zdtm: Added tests for IP_TTL restore
  * irmap: hardcode some more interesting paths
  * util: use close_range when it's supported
  * Fixes and improvements in amdgpu-plugin
- Make criu-plugin-cuda subpackage

OBS-URL: https://build.opensuse.org/package/show/devel:tools/criu?expand=0&rev=121
This commit is contained in:
Takashi Iwai 2024-10-31 15:30:45 +00:00 committed by Git OBS Bridge
commit babf377fa1
11 changed files with 1848 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.osc

View File

@ -0,0 +1,42 @@
From 95191250537d1cd872668647da76234241f16661 Mon Sep 17 00:00:00 2001
From: Takashi Iwai <tiwai@suse.de>
Date: Tue, 1 Dec 2020 16:32:19 +0100
Subject: [PATCH] Fix build with nftables installed in different directory
The cflags needs to be passed to the build test.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
Makefile.config | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
--- a/Makefile.config
+++ b/Makefile.config
@@ -42,13 +42,16 @@ else
endif
ifeq ($(call pkg-config-check,libnftables),y)
+ CFLAGS_NFTABLES := $(shell $(PKG_CONFIG) --cflags libnftables)
LIB_NFTABLES := $(shell $(PKG_CONFIG) --libs libnftables)
- ifeq ($(call try-cc,$(FEATURE_TEST_NFTABLES_LIB_API_0),$(LIB_NFTABLES)),true)
+ ifeq ($(call try-cc,$(FEATURE_TEST_NFTABLES_LIB_API_0),$(CFLAGS_NFTABLES) $(LIB_NFTABLES)),true)
LIBS_FEATURES += $(LIB_NFTABLES)
FEATURE_DEFINES += -DCONFIG_HAS_NFTABLES_LIB_API_0
- else ifeq ($(call try-cc,$(FEATURE_TEST_NFTABLES_LIB_API_1),$(LIB_NFTABLES)),true)
+ FEATURE_CFLAGS += $(CFLAGS_NFTABLES)
+ else ifeq ($(call try-cc,$(FEATURE_TEST_NFTABLES_LIB_API_1),$(CFLAGS_NFTABLES) $(LIB_NFTABLES)),true)
LIBS_FEATURES += $(LIB_NFTABLES)
FEATURE_DEFINES += -DCONFIG_HAS_NFTABLES_LIB_API_1
+ FEATURE_CFLAGS += $(CFLAGS_NFTABLES)
else
$(info Warn: Building without nftables support (incompatible API version).)
endif
@@ -78,7 +81,7 @@ endif
endif
export DEFINES += $(FEATURE_DEFINES)
-export CFLAGS += $(FEATURE_DEFINES)
+export CFLAGS += $(FEATURE_DEFINES) $(FEATURE_CFLAGS)
FEATURES_LIST := TCP_REPAIR STRLCPY STRLCAT PTRACE_PEEKSIGINFO \
SETPROCTITLE_INIT TCP_REPAIR_WINDOW MEMFD_CREATE \

8
crit.py Normal file
View File

@ -0,0 +1,8 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import re
import sys
from crit.__main__ import main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(main())

BIN
criu-3.19.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.

3
criu-4.0.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c61bfb4cc8f8ddb56da8be816ad8c951aa53b0f9ac4cd56bc74d3f451be5d3a7
size 1405673

View File

@ -0,0 +1,12 @@
---
scripts/criu-ns | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/scripts/criu-ns
+++ b/scripts/criu-ns
@@ -1,4 +1,4 @@
-#!/usr/bin/env python3
+#!/usr/bin/python3
import ctypes
import ctypes.util
import errno

101
criu-py-install-fix.diff Normal file
View File

@ -0,0 +1,101 @@
---
crit/Makefile | 6 +-----
lib/Makefile | 6 +-----
scripts/crit-setup.py | 28 ++++++++++++++++++++++++++++
scripts/pycriu-setup.py | 28 ++++++++++++++++++++++++++++
4 files changed, 58 insertions(+), 10 deletions(-)
--- a/crit/Makefile
+++ b/crit/Makefile
@@ -7,12 +7,8 @@ ${VERSION_FILE}:
$(Q) echo "__version__ = '${CRIU_VERSION}'" > $@
install: ${VERSION_FILE}
-ifeq ($(SKIP_PIP_INSTALL),0)
$(E) " INSTALL " crit
- $(Q) $(PYTHON) -m pip install $(PIPFLAGS) --prefix=$(DESTDIR)$(PREFIX) ./crit
-else
- $(E) " SKIP INSTALL crit"
-endif
+ $(Q) $(PYTHON) scripts/crit-setup.py install --root=$(DESTDIR) --prefix=$(PREFIX)
.PHONY: install
uninstall:
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -54,12 +54,8 @@ install: lib-c lib-a lib-py lib/c/criu.p
$(Q) mkdir -p $(DESTDIR)$(LIBDIR)/pkgconfig
$(Q) sed -e 's,@version@,$(CRIU_VERSION),' -e 's,@libdir@,$(LIBDIR),' -e 's,@includedir@,$(dir $(INCLUDEDIR)/criu/),' lib/c/criu.pc.in > lib/c/criu.pc
$(Q) install -m 644 lib/c/criu.pc $(DESTDIR)$(LIBDIR)/pkgconfig
-ifeq ($(SKIP_PIP_INSTALL),0)
$(E) " INSTALL " pycriu
- $(Q) $(PYTHON) -m pip install $(PIPFLAGS) --prefix=$(DESTDIR)$(PREFIX) ./lib
-else
- $(E) " SKIP INSTALL pycriu"
-endif
+ $(Q) $(PYTHON) scripts/pycriu-setup.py install --root=$(DESTDIR) --prefix=$(PREFIX)
.PHONY: install
uninstall:
--- /dev/null
+++ b/scripts/crit-setup.py
@@ -0,0 +1,28 @@
+import os
+from distutils.core import setup
+
+def get_version():
+ version = '0.0.1'
+ env = os.environ
+ if 'CRIU_VERSION_MAJOR' in env and 'CRIU_VERSION_MINOR' in env:
+ version = '{}.{}'.format(
+ env['CRIU_VERSION_MAJOR'],
+ env['CRIU_VERSION_MINOR']
+ )
+ if 'CRIU_VERSION_SUBLEVEL' in env and env['CRIU_VERSION_SUBLEVEL']:
+ version += '.' + env['CRIU_VERSION_SUBLEVEL']
+ return version
+
+
+setup(
+ name='crit',
+ version=get_version(),
+ description='CRiu Image Tool',
+ author='CRIU team',
+ author_email='criu@openvz.org',
+ license='GPLv2',
+ url='https://github.com/checkpoint-restore/criu',
+ package_dir={'crit': 'crit/crit'},
+ packages=["crit"],
+ install_requires=[],
+)
--- /dev/null
+++ b/scripts/pycriu-setup.py
@@ -0,0 +1,28 @@
+import os
+from distutils.core import setup
+
+def get_version():
+ version = '0.0.1'
+ env = os.environ
+ if 'CRIU_VERSION_MAJOR' in env and 'CRIU_VERSION_MINOR' in env:
+ version = '{}.{}'.format(
+ env['CRIU_VERSION_MAJOR'],
+ env['CRIU_VERSION_MINOR']
+ )
+ if 'CRIU_VERSION_SUBLEVEL' in env and env['CRIU_VERSION_SUBLEVEL']:
+ version += '.' + env['CRIU_VERSION_SUBLEVEL']
+ return version
+
+
+setup(
+ name='pycriu',
+ version=get_version(),
+ description='CRiu Image Tool',
+ author='CRIU team',
+ author_email='criu@openvz.org',
+ license='GPLv2',
+ url='https://github.com/checkpoint-restore/criu',
+ package_dir={'pycriu': 'lib/pycriu'},
+ packages=["pycriu", "pycriu.images"],
+ install_requires=[],
+)

1388
criu.changes Normal file

File diff suppressed because it is too large Load Diff

224
criu.spec Normal file
View File

@ -0,0 +1,224 @@
#
# spec file for package criu
#
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%if 0%{?suse_version} >= 1330
%define use_asciidoctor 1
%define make_options USE_ASCIIDOCTOR=1
%endif
# currently broken with LTO, resulting in segfaults (bsc#1203854)
%define _lto_cflags %{nil}
%ifarch x86_64 aarch64
%define with_amdgpu_plugin 1
%else
%define with_amdgpu_plugin 0
%endif
%define proto_c_ver %(protoc-c --version | head -1 | awk '{print $2}')
Name: criu
Version: 4.0
Release: 0
Summary: Checkpoint/Restore In Userspace Tools
License: GPL-2.0-only
Group: System/Console
URL: https://criu.org/
Source0: http://github.com/checkpoint-restore/criu/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
# To be generated; we keep a static one for building without pip
Source1: crit.py
Patch1: criu-py-install-fix.diff
Patch2: 0002-Fix-build-with-nftables-installed-in-different-direc.patch
Patch4: plugin-dir-path.patch
Patch5: criu-ns-python3-shebang.patch
BuildRequires: libcap-devel
%if %{with_amdgpu_plugin}
BuildRequires: libdrm-devel
%endif
BuildRequires: libgnutls-devel
BuildRequires: libnet-devel
BuildRequires: libnl3-devel
BuildRequires: pkgconfig
BuildRequires: protobuf-c
BuildRequires: protobuf-devel
BuildRequires: python3-devel
%if 0%{?suse_version} >= 1550 || 0%{?sle_version} >= 150300
BuildRequires: nftables-devel
%endif
%if 0%{?use_asciidoctor}
BuildRequires: rubygem(asciidoctor)
%else
BuildRequires: asciidoc
BuildRequires: xmlto
%endif
Requires: python3-ipaddr
Requires: python3-protobuf
ExclusiveArch: x86_64 aarch64 ppc64le armv7l armv7hl s390x
%if 0%{?suse_version} > 1320
BuildRequires: libbsd-devel
%endif
%description
Checkpoint/Restore In Userspace, or CRIU, is a software tool for Linux
operating system. Using this tool, you can freeze a running application
(or part of it) and checkpoint it to a hard drive as a collection of
files. You can then use the files to restore and run the application from
the point it was frozen at.
%if %{with_amdgpu_plugin}
%package plugin-amdgpu
Summary: AMDGPU plugin for CRIU
License: GPL-2.0-only
Group: System/Console
Requires: %{name} = %{version}
%description plugin-amdgpu
This package contains the AMDGPU ROCm support plugin for CRIU.
%endif
%package plugin-cuda
Summary: CUDA plugin for CRIU
License: GPL-2.0-only
Group: System/Console
Requires: %{name} = %{version}
%description plugin-cuda
This package contains the CUDA support plugin for CRIU.
%package -n libcriu2
Summary: Library for CRIU
License: LGPL-2.1-only
Group: System/Libraries
%description -n libcriu2
This package contains the library for CRIU, Checkpoint/Restore In
Userspace Tools.
%package -n libcompel1
Summary: Compel library for CRIU
License: LGPL-2.1-only
Group: System/Libraries
%description -n libcompel1
This package contains the compel library for CRIU to execute a parasite code.
%package devel
Summary: Include Files and Libraries mandatory for Development
License: LGPL-2.1-or-later
Group: Development/Libraries/C and C++
Requires: glibc-devel
Requires: libcompel1 = %{version}
Requires: libcriu2 = %{version}
%description devel
This package contains all necessary include files and libraries needed
to develop applications with CRIU library.
%prep
%autosetup -p1
# workaround for Leap 15.x
%if 0%{?suse_version} < 1600
sed -i -e's/\(^.*-mshstk\)/# \1/' criu/pie/Makefile
%endif
# default off
echo "BINFMT_MISC_VIRTUALIZED" > .config
%build
export CFLAGS="%{optflags}"
%ifarch %arm
export CFLAGS="$CFLAGS -Wno-error=deprecated"
%endif
# WERROR=0 is needed for avoiding warning due to doubly _GNU_SOURCE defines
make V=1 %{?_smp_mflags} %{?make_options} WERROR=0 \
PREFIX=%{_prefix} \
LIBDIR=%{_libdir} \
LIBEXECDIR=%{_libexecdir}
%install
%make_install V=1 %{?make_options} WERROR=0 \
PREFIX=%{_prefix} \
LIBDIR=%{_libdir} \
LIBEXECDIR=%{_libexecdir}
install -c -m 0755 %{SOURCE1} %{buildroot}%{_bindir}/crit
# remove static libs
rm -f %{buildroot}%{_libdir}/lib*.a \
%{buildroot}%{_libexecdir}/compel/*.a
# remove stable files
rm -f %{buildroot}%{_includedir}/compel/plugins/std/asm/.gitignore
# for compatiblity
ln -s criu %{buildroot}%{_sbindir}/crtools
ln -s criu.8 %{buildroot}%{_mandir}/man8/crtools.8
%if ! %{with_amdgpu_plugin}
rm -f %{buildroot}%{_mandir}/man1/criu-amdgpu-plugin.1
%endif
%post -n libcriu2 -p /sbin/ldconfig
%postun -n libcriu2 -p /sbin/ldconfig
%post -n libcompel1 -p /sbin/ldconfig
%postun -n libcompel1 -p /sbin/ldconfig
%files
%license COPYING
%doc README.md
%{_sbindir}/criu
%{_sbindir}/criu-ns
%{_sbindir}/crtools
%{_bindir}/compel
%{_bindir}/crit
%{_mandir}/man1/compel.1%{?ext_man}
%{_mandir}/man1/crit.1%{?ext_man}
%{_mandir}/man1/criu-ns.1%{?ext_man}
%{_mandir}/man8/criu.8%{?ext_man}
%{_mandir}/man8/crtools.8%{?ext_man}
%{_libexecdir}/criu
%{_libexecdir}/compel
%{python3_sitelib}/*.egg-info
%{python3_sitelib}/crit
%{python3_sitelib}/pycriu
%if %{with_amdgpu_plugin}
%files plugin-amdgpu
%doc plugins/amdgpu/README.md
%{_mandir}/man1/criu-amdgpu-plugin.1%{?ext_man}
%dir %{_libdir}/criu
%{_libdir}/criu/amdgpu_plugin.so
%endif
%files plugin-cuda
%doc plugins/cuda/README.md
%dir %{_libdir}/criu
%{_libdir}/criu/cuda_plugin.so
%files -n libcriu2
%{_libdir}/libcriu.so.*
%files -n libcompel1
%{_libdir}/libcompel.so.*
%files devel
%{_includedir}/criu
%{_includedir}/compel
%{_libdir}/libcriu.so
%{_libdir}/libcompel.so
%{_libdir}/pkgconfig/*.pc
%changelog

43
plugin-dir-path.patch Normal file
View File

@ -0,0 +1,43 @@
---
Makefile.install | 3 ++-
criu/Makefile | 3 +++
criu/include/plugin.h | 2 +-
3 files changed, 6 insertions(+), 2 deletions(-)
--- a/Makefile.install
+++ b/Makefile.install
@@ -5,9 +5,10 @@ BINDIR ?= $(PREFIX)/bin
SBINDIR ?= $(PREFIX)/sbin
MANDIR ?= $(PREFIX)/share/man
INCLUDEDIR ?= $(PREFIX)/include
+LIBDIR ?= $(PREFIX)/lib
LIBEXECDIR ?= $(PREFIX)/libexec
RUNDIR ?= /run
-PLUGINDIR ?= $(PREFIX)/lib/criu
+PLUGINDIR ?= $(LIBDIR)/criu
#
# For recent Debian/Ubuntu with multiarch support.
--- a/criu/include/plugin.h
+++ b/criu/include/plugin.h
@@ -6,7 +6,7 @@
#include "common/list.h"
#ifndef CR_PLUGIN_DEFAULT
-#define CR_PLUGIN_DEFAULT "/usr/lib/criu/"
+#define CR_PLUGIN_DEFAULT LIBDIR "/criu/"
#endif
void cr_plugin_fini(int stage, int err);
--- a/criu/Makefile
+++ b/criu/Makefile
@@ -29,6 +29,9 @@ CFLAGS += -iquote $(ARCH_DIR)/include
CFLAGS += -iquote .
CFLAGS += $(shell $(PKG_CONFIG) --cflags libnl-3.0)
CFLAGS += $(CONFIG-DEFINES)
+CFLAGS += -DINCLUDEDIR=\"$(INCLUDEDIR)\"
+CFLAGS += -DLIBEXECDIR=\"$(LIBEXECDIR)\"
+CFLAGS += -DLIBDIR=\"$(LIBDIR)\"
ifeq ($(GMON),1)
CFLAGS += -pg