diff --git a/0001-compel-fix-parasite-with-GCC-12.patch b/0001-compel-fix-parasite-with-GCC-12.patch new file mode 100644 index 0000000000000000000000000000000000000000..5812efa49a03d39441a8b7898366eb29c3933b4b --- /dev/null +++ b/0001-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/criu-3.16.1.tar.gz b/criu-3.16.1.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..b4767a39de787397647c9e7cbabfc396a26208f1 Binary files /dev/null and b/criu-3.16.1.tar.gz differ diff --git a/criu-tmpfiles.conf b/criu-tmpfiles.conf new file mode 100644 index 0000000000000000000000000000000000000000..66cc5bf2520d77f6a8a49524df33b4aa5a8079a8 --- /dev/null +++ b/criu-tmpfiles.conf @@ -0,0 +1 @@ +d /run/criu 0755 root root - diff --git a/criu.spec b/criu.spec new file mode 100644 index 0000000000000000000000000000000000000000..4a330ab2ac49d658108792264f329be36d12589a --- /dev/null +++ b/criu.spec @@ -0,0 +1,134 @@ +%define anolis_release 1 + +# With annobin enabled, CRIU does not work anymore. It seems CRIU's +# 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. +%undefine _auto_set_build_flags + +Name: criu +Version: 3.16.1 +Release: %{anolis_release}%{?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 +Source1: criu-tmpfiles.conf + +Patch1: 0001-compel-fix-parasite-with-GCC-12.patch + +BuildRequires: gcc +BuildRequires: systemd +BuildRequires: libnet-devel +BuildRequires: protobuf-devel protobuf-c-devel python3-devel libnl3-devel libcap-devel +BuildRequires: asciidoctor +BuildRequires: perl-interpreter +BuildRequires: libselinux-devel +BuildRequires: gnutls-devel +# Checkpointing containers with a tmpfs requires tar +Recommends: tar +BuildRequires: make + +%description +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. + +%package devel +Summary: Header files and libraries for %{name} +Requires: %{name} = %{version}-%{release} + +%description devel +This package contains header files and libraries for %{name}. + +%package libs +Summary: Libraries for %{name} +Requires: %{name} = %{version}-%{release} + +%description libs +This package contains the libraries for %{name} + +%package -n python3-%{name} +%{?python_provide:%python_provide python3-%{name}} +Summary: Python bindings for %{name} +Requires: python3-protobuf +Obsoletes: python2-criu < 3.10-1 + +%description -n python3-%{name} +python3-%{name} contains Python bindings for %{name}. + +%package -n crit +Summary: CRIU image tool +Requires: python3-%{name} = %{version}-%{release} + +%description -n crit +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 +%patch1 -p1 + +%build +# This package calls LD directly without specifying the LTO plugins. Until +# that is fixed, disable LTO. +%define _lto_cflags %{nil} + +CFLAGS+=`echo %{optflags} | sed -e 's,-fstack-protector\S*,,g'` make V=1 WERROR=0 PREFIX=%{_prefix} RUNDIR=/run/criu PYTHON=python3 +make docs V=1 + +%install +make install-criu DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} +make install-lib DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} PYTHON=python3 +make install-man DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} + +mkdir -p %{buildroot}%{_tmpfilesdir} +install -m 0644 %{SOURCE1} %{buildroot}%{_tmpfilesdir}/%{name}.conf +install -d -m 0755 %{buildroot}/run/%{name}/ + +# remove static lib +rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a + +%files +%{_sbindir}/%{name} +%doc %{_mandir}/man8/criu.8* +%doc %{_mandir}/man1/compel.1* +%{_libexecdir}/%{name} +%dir /run/%{name} +%{_tmpfilesdir}/%{name}.conf +%doc README.md COPYING + +%files devel +%{_includedir}/criu +%{_libdir}/*.so +%{_libdir}/pkgconfig/*.pc + +%files libs +%{_libdir}/*.so.* + +%files -n python3-%{name} +%{python3_sitelib}/pycriu/* +%{python3_sitelib}/*egg-info + +%files -n crit +%{_bindir}/crit +%doc %{_mandir}/man1/crit.1* + +%files -n criu-ns +%{_sbindir}/criu-ns +%doc %{_mandir}/man1/criu-ns.1* + +%changelog +* Thu Mar 10 2022 Yuanhong Peng - 3.16.1-1 +- Init from upstream v3.16.1