diff --git a/.gitignore b/.gitignore index eb75d16..8198dfc 100644 --- a/.gitignore +++ b/.gitignore @@ -43,3 +43,4 @@ /criu-3.8.tar.bz2 /criu-3.8.1.tar.bz2 /criu-3.9.tar.bz2 +/criu-3.10.tar.bz2 diff --git a/1-2-Fix-building-with-4.18.patch b/1-2-Fix-building-with-4.18.patch new file mode 100644 index 0000000..93bbe65 --- /dev/null +++ b/1-2-Fix-building-with-4.18.patch @@ -0,0 +1,241 @@ +From patchwork Mon Jul 9 06:28:26 2018 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Subject: [1/2] Fix building with 4.18 +From: Adrian Reber +X-Patchwork-Id: 8849 +Message-Id: <1531117707-8173-2-git-send-email-adrian@lisas.de> +To: , Andrei Vagin +Cc: Adrian Reber +Date: Mon, 9 Jul 2018 06:28:26 +0000 + +From: Adrian Reber + +Building CRIU against 4.18 fails with multiple re-definition errors. +This has been reported upstream + https://lore.kernel.org/lkml/20180704142116.GM17048@lisas.de/ +but there has not been any answer yet. This tries to workaround those +compile errors by pulling the required aio defines directly into CRIU. + +Signed-off-by: Adrian Reber +--- + criu/cr-check.c | 2 +- + criu/include/aio.h | 73 ++++++++++++++++++++++++++++++++++++++++++++++- + criu/pie/restorer.c | 1 - + test/zdtm/static/aio01.c | 74 ++++++++++++++++++++++++++++++++++++++++++++++-- + 4 files changed, 145 insertions(+), 5 deletions(-) + +diff --git a/criu/cr-check.c b/criu/cr-check.c +index d3393c4..fc53afb 100644 +--- a/criu/cr-check.c ++++ b/criu/cr-check.c +@@ -22,7 +22,6 @@ + #include + #include + #include +-#include + + #include "../soccr/soccr.h" + +@@ -51,6 +50,7 @@ + #include "net.h" + #include "restorer.h" + #include "uffd.h" ++#include "aio.h" + + static char *feature_name(int (*func)()); + +diff --git a/criu/include/aio.h b/criu/include/aio.h +index 9a58089..a749c47 100644 +--- a/criu/include/aio.h ++++ b/criu/include/aio.h +@@ -1,7 +1,6 @@ + #ifndef __CR_AIO_H__ + #define __CR_AIO_H__ + +-#include + #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); +@@ -12,6 +11,78 @@ unsigned long aio_rings_args_size(struct vm_area_list *); + struct task_restore_args; + int prepare_aios(struct pstree_item *t, struct task_restore_args *ta); + ++/* copied from linux/fs.h */ ++typedef int __bitwise __kernel_rwf_t; ++ ++/* copied from linux/aio_abi.h */ ++#ifndef COMPEL_SYSCALL_TYPES_H__ ++/* The ifndef is needed to avoid a clang compiler error */ ++typedef __kernel_ulong_t aio_context_t; ++#endif ++ ++enum { ++ IOCB_CMD_PREAD = 0, ++ IOCB_CMD_PWRITE = 1, ++ IOCB_CMD_FSYNC = 2, ++ IOCB_CMD_FDSYNC = 3, ++ /* These two are experimental. ++ * IOCB_CMD_PREADX = 4, ++ * IOCB_CMD_POLL = 5, ++ */ ++ IOCB_CMD_NOOP = 6, ++ IOCB_CMD_PREADV = 7, ++ IOCB_CMD_PWRITEV = 8, ++}; ++/* 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 */ ++}; ++ ++/* ++ * we always use a 64bit off_t when communicating ++ * with userland. its up to libraries to do the ++ * proper padding and aio_error abstraction ++ */ ++ ++struct iocb { ++ /* these are internal to the kernel/libc. */ ++ __u64 aio_data; /* data to be returned in event's data */ ++ ++#if defined(__BYTE_ORDER) ? __BYTE_ORDER == __LITTLE_ENDIAN : defined(__LITTLE_ENDIAN) ++ __u32 aio_key; /* the kernel sets aio_key to the req # */ ++ __kernel_rwf_t aio_rw_flags; /* RWF_* flags */ ++#elif defined(__BYTE_ORDER) ? __BYTE_ORDER == __BIG_ENDIAN : defined(__BIG_ENDIAN) ++ __kernel_rwf_t aio_rw_flags; /* RWF_* flags */ ++ __u32 aio_key; /* the kernel sets aio_key to the req # */ ++#else ++#error edit for your odd byteorder. ++#endif ++ ++ /* common fields */ ++ __u16 aio_lio_opcode; /* see IOCB_CMD_ above */ ++ __s16 aio_reqprio; ++ __u32 aio_fildes; ++ ++ __u64 aio_buf; ++ __u64 aio_nbytes; ++ __s64 aio_offset; ++ ++ /* extra parameters */ ++ __u64 aio_reserved2; /* TODO: use this for a (struct sigevent *) */ ++ ++ /* flags for the "struct iocb" */ ++ __u32 aio_flags; ++ ++ /* ++ * if the IOCB_FLAG_RESFD flag of "aio_flags" is set, this is an ++ * eventfd to signal AIO readiness to ++ */ ++ __u32 aio_resfd; ++}; /* 64 bytes */ ++ + struct aio_ring { + unsigned id; /* kernel internal index number */ + unsigned nr; /* number of io_events */ +diff --git a/criu/pie/restorer.c b/criu/pie/restorer.c +index 9b7f6dd..f100213 100644 +--- a/criu/pie/restorer.c ++++ b/criu/pie/restorer.c +@@ -3,7 +3,6 @@ + + #include + #include +-#include + #include + #include + #include +diff --git a/test/zdtm/static/aio01.c b/test/zdtm/static/aio01.c +index f84fd35..4ad29a7 100644 +--- a/test/zdtm/static/aio01.c ++++ b/test/zdtm/static/aio01.c +@@ -1,6 +1,5 @@ +-#include ++#include + #include +-#include + #include + #include + #include +@@ -13,6 +12,77 @@ + const char *test_doc = "Check head and tail restore correct"; + const char *test_author = "Kirill Tkhai "; + ++/* copied from linux/fs.h */ ++typedef int __bitwise __kernel_rwf_t; ++ ++/* copied from linux/aio_abi.h */ ++#ifndef COMPEL_SYSCALL_TYPES_H__ ++typedef __kernel_ulong_t aio_context_t; ++#endif ++ ++enum { ++ IOCB_CMD_PREAD = 0, ++ IOCB_CMD_PWRITE = 1, ++ IOCB_CMD_FSYNC = 2, ++ IOCB_CMD_FDSYNC = 3, ++ /* These two are experimental. ++ * IOCB_CMD_PREADX = 4, ++ * IOCB_CMD_POLL = 5, ++ */ ++ IOCB_CMD_NOOP = 6, ++ IOCB_CMD_PREADV = 7, ++ IOCB_CMD_PWRITEV = 8, ++}; ++/* 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 */ ++}; ++ ++/* ++ * we always use a 64bit off_t when communicating ++ * with userland. its up to libraries to do the ++ * proper padding and aio_error abstraction ++ */ ++ ++struct iocb { ++ /* these are internal to the kernel/libc. */ ++ __u64 aio_data; /* data to be returned in event's data */ ++ ++#if defined(__BYTE_ORDER) ? __BYTE_ORDER == __LITTLE_ENDIAN : defined(__LITTLE_ENDIAN) ++ __u32 aio_key; /* the kernel sets aio_key to the req # */ ++ __kernel_rwf_t aio_rw_flags; /* RWF_* flags */ ++#elif defined(__BYTE_ORDER) ? __BYTE_ORDER == __BIG_ENDIAN : defined(__BIG_ENDIAN) ++ __kernel_rwf_t aio_rw_flags; /* RWF_* flags */ ++ __u32 aio_key; /* the kernel sets aio_key to the req # */ ++#else ++#error edit for your odd byteorder. ++#endif ++ ++ /* common fields */ ++ __u16 aio_lio_opcode; /* see IOCB_CMD_ above */ ++ __s16 aio_reqprio; ++ __u32 aio_fildes; ++ ++ __u64 aio_buf; ++ __u64 aio_nbytes; ++ __s64 aio_offset; ++ ++ /* extra parameters */ ++ __u64 aio_reserved2; /* TODO: use this for a (struct sigevent *) */ ++ ++ /* flags for the "struct iocb" */ ++ __u32 aio_flags; ++ ++ /* ++ * if the IOCB_FLAG_RESFD flag of "aio_flags" is set, this is an ++ * eventfd to signal AIO readiness to ++ */ ++ __u32 aio_resfd; ++}; /* 64 bytes */ ++ + struct aio_ring { + unsigned id; /* kernel internal index number */ + unsigned nr; /* number of io_events */ diff --git a/criu.spec b/criu.spec index 73f12c7..6b0ade2 100644 --- a/criu.spec +++ b/criu.spec @@ -1,12 +1,12 @@ %if 0%{?fedora} > 27 || 0%{?rhel} > 7 -%global py2_prefix python2 +%global py_prefix python3 %else -%global py2_prefix python +%global py_prefix python %endif Name: criu -Version: 3.9 -Release: 2%{?dist} +Version: 3.10 +Release: 1%{?dist} Provides: crtools = %{version}-%{release} Obsoletes: crtools <= 1.0-2 Summary: Tool for Checkpoint/Restore in User-space @@ -14,6 +14,8 @@ Group: System Environment/Base License: GPLv2 URL: http://criu.org/ Source0: http://download.openvz.org/criu/criu-%{version}.tar.bz2 +# https://patchwork.criu.org/patch/8849/mbox/ +Patch1: 1-2-Fix-building-with-4.18.patch %if 0%{?rhel} && 0%{?rhel} <= 7 BuildRequires: perl @@ -30,7 +32,7 @@ Source3: criu-tmpfiles.conf BuildRequires: systemd BuildRequires: libnet-devel -BuildRequires: protobuf-devel protobuf-c-devel python2-devel libnl3-devel libcap-devel +BuildRequires: protobuf-devel protobuf-c-devel %{py_prefix}-devel libnl3-devel libcap-devel %if 0%{?fedora} || 0%{?rhel} > 7 BuildRequires: asciidoc xmlto BuildRequires: perl-interpreter @@ -56,23 +58,24 @@ Requires: %{name} = %{version}-%{release} This package contains header files and libraries for %{name}. %endif -%package -n %{py2_prefix}-%{name} -%{?python_provide:%python_provide %{py2_prefix}-%{name}} +%package -n %{py_prefix}-%{name} +%{?python_provide:%python_provide %{py_prefix}-%{name}} Summary: Python bindings for %{name} Group: Development/Languages -Requires: %{name} = %{version}-%{release} %{py2_prefix}-ipaddr -%if 0%{?fedora} || 0%{?rhel} > 7 -Requires: python2-protobuf -%else +%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 %{py2_prefix}-%{name} -python-%{name} contains Python bindings for %{name}. +%description -n %{py_prefix}-%{name} +%{py_prefix}-%{name} contains Python bindings for %{name}. %package -n crit Summary: CRIU image tool -Requires: %{py2_prefix}-%{name} = %{version}-%{release} +Requires: %{py_prefix}-%{name} = %{version}-%{release} %description -n crit crit is a tool designed to decode CRIU binary dump files and show @@ -81,6 +84,7 @@ their content in human-readable form. %prep %setup -q +%patch1 -p1 %if 0%{?rhel} && 0%{?rhel} <= 7 %patch100 -p1 @@ -89,7 +93,7 @@ their content in human-readable form. %build # %{?_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 +CFLAGS+=`echo %{optflags} | sed -e 's,-fstack-protector\S*,,g'` make V=1 WERROR=0 PREFIX=%{_prefix} RUNDIR=/run/criu PYTHON=%{py_prefix} %if 0%{?fedora} || 0%{?rhel} > 7 make docs V=1 %endif @@ -97,7 +101,7 @@ 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} +make install-lib DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} PYTHON=%{py_prefix} %if 0%{?fedora} || 0%{?rhel} > 7 # only install documentation on Fedora as it requires asciidoc, # which is not available on RHEL7 @@ -139,9 +143,14 @@ rm -rf $RPM_BUILD_ROOT%{_libexecdir}/%{name} %{_libdir}/pkgconfig/*.pc %endif -%files -n %{py2_prefix}-%{name} +%files -n %{py_prefix}-%{name} +%if 0%{?rhel} && 0%{?rhel} <= 7 %{python2_sitelib}/pycriu/* %{python2_sitelib}/*egg-info +%else +%{python3_sitelib}/pycriu/* +%{python3_sitelib}/*egg-info +%endif %files -n crit %{_bindir}/crit @@ -149,6 +158,10 @@ rm -rf $RPM_BUILD_ROOT%{_libexecdir}/%{name} %changelog +* Tue Jul 10 2018 Adrian Reber - 3.10-1 +- Update to 3.10 (#1599710) +- Switch to python3 + * Wed Jun 06 2018 Adrian Reber - 3.9-2 - Simplify ExclusiveArch now that there is no more F26 diff --git a/sources b/sources index 648ebc2..7e0a6c8 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (criu-3.9.tar.bz2) = 875a4bfb809d7b479bb6357a4e114f2f5caaaf2940019a41cc6494fd90025d72b5fc4129be89eef1b9f62a5358eb96509fd15a33b64fe2b8f7f805dc8110b994 +SHA512 (criu-3.10.tar.bz2) = af316af54afebd5b8b03869ac35c301b438f5363eb1894c4add9cdc40ca226a3e78433067f88a75a0e7fbdb6c37a2cdde5bb3eef2d24824f6409247ecacec270