Added patches to handle unified hierarchy and new glibc

This commit is contained in:
Adrian Reber 2017-06-30 17:44:42 +02:00
parent fcd0e35172
commit 64fa721252
3 changed files with 120 additions and 1 deletions

View File

@ -0,0 +1,62 @@
From 24c74d1add1917685a55f4808243aa5ec9bbaa79 Mon Sep 17 00:00:00 2001
From: Pavel Emelyanov <xemul@virtuozzo.com>
Date: Thu, 29 Jun 2017 13:24:55 +0300
Subject: [PATCH 1/2] cgroup: Skip unified hier controllers (v2)
The unified hierarchy controller doesn't have any name, so criu hangs
while parsing this sort of strings.
Let's skip those for now, until we implement cgroup2 support.
https://github.com/xemul/criu/issues/252
v2: Code comments
Reported-and-tested-by: Adrian Reber <adrian@lisas.de>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
---
criu/proc_parse.c | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/criu/proc_parse.c b/criu/proc_parse.c
index b8881d21..46096336 100644
--- a/criu/proc_parse.c
+++ b/criu/proc_parse.c
@@ -2335,8 +2335,19 @@ int parse_cgroup_file(FILE *f, struct list_head *retl, unsigned int *n)
* 2:name=systemd:/user.slice/user-1000.slice/session-1.scope
*/
name = strchr(buf, ':');
- if (name)
+ if (name) {
path = strchr(++name, ':');
+ if (*name == ':') {
+ /*
+ * It's unified hierarchy. On kernels with legacy
+ * tree this item is added automatically, so we
+ * can just skip one. For those with full unified
+ * support is on ... we need to write new code.
+ */
+ xfree(ncc);
+ continue;
+ }
+ }
if (!name || !path) {
pr_err("Failed parsing cgroup %s\n", buf);
xfree(ncc);
@@ -2500,6 +2511,13 @@ int collect_controllers(struct list_head *cgroups, unsigned int *n_cgroups)
}
controllers++;
+ if (*controllers == ':')
+ /*
+ * Unified hier. See comment in parse_cgroup_file
+ * for more details.
+ */
+ continue;
+
off = strchr(controllers, ':');
if (!off) {
pr_err("Unable to parse \"%s\"\n", buf);
--
2.13.2

View File

@ -0,0 +1,48 @@
From 0448529b75f2a3b90abf92b668ab681ff4490afc Mon Sep 17 00:00:00 2001
From: Adrian Reber <areber@redhat.com>
Date: Thu, 29 Jun 2017 14:15:15 +0000
Subject: [PATCH 2/2] fix building with newer glibc
Newer glibc releases have removed SIGUNUSED from bits/signum.h which
breaks building criu on those systems:
https://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=8082d91e1c449e0cb137468b731004a5e605c8c6
SIGSYS returns the same value as SIGUNUSED and testing has shown
that criu still successfully completes zdtm with this patch.
Signed-off-by: Adrian Reber <areber@redhat.com>
Reviewed-by: Dmitry Safonov <dsafonov@virtuozzo.com>
---
criu/cr-restore.c | 1 -
test/zdtm/static/pthread01.c | 2 +-
2 files changed, 1 insertion(+), 2 deletions(-)
diff --git a/criu/cr-restore.c b/criu/cr-restore.c
index 2c505f6e..eaaed416 100644
--- a/criu/cr-restore.c
+++ b/criu/cr-restore.c
@@ -1062,7 +1062,6 @@ static void zombie_prepare_signals(void)
(1 << SIGPOLL) |\
(1 << SIGIO) |\
(1 << SIGSYS) |\
- (1 << SIGUNUSED)|\
(1 << SIGSTKFLT)|\
(1 << SIGPWR) \
)
diff --git a/test/zdtm/static/pthread01.c b/test/zdtm/static/pthread01.c
index 52f849c0..2520fcfe 100644
--- a/test/zdtm/static/pthread01.c
+++ b/test/zdtm/static/pthread01.c
@@ -43,7 +43,7 @@ static char *decode_signal(const sigset_t *s, char *buf)
COLLECT(SIGTERM); COLLECT(SIGSTKFLT); COLLECT(SIGCHLD); COLLECT(SIGCONT); COLLECT(SIGSTOP);
COLLECT(SIGTSTP); COLLECT(SIGTTIN); COLLECT(SIGTTOU); COLLECT(SIGURG); COLLECT(SIGXCPU);
COLLECT(SIGXFSZ); COLLECT(SIGVTALRM); COLLECT(SIGPROF); COLLECT(SIGWINCH); COLLECT(SIGIO);
- COLLECT(SIGPOLL); COLLECT(SIGPWR); COLLECT(SIGSYS); COLLECT(SIGUNUSED);
+ COLLECT(SIGPOLL); COLLECT(SIGPWR); COLLECT(SIGSYS);
#undef COLLECT
return buf;
--
2.13.2

View File

@ -1,6 +1,6 @@
Name: criu
Version: 3.2.1
Release: 1%{?dist}
Release: 2%{?dist}
Provides: crtools = %{version}-%{release}
Obsoletes: crtools <= 1.0-2
Summary: Tool for Checkpoint/Restore in User-space
@ -9,6 +9,10 @@ License: GPLv2
URL: http://criu.org/
Source0: http://download.openvz.org/criu/criu-%{version}.tar.bz2
# Both patches are already discussed upstream
Patch0: 0001-cgroup-Skip-unified-hier-controllers-v2.patch
Patch1: 0002-fix-building-with-newer-glibc.patch
%if 0%{?rhel}
# RHEL has no asciidoc; take man-page from Fedora 24
# zcat /usr/share/man/man8/criu.8.gz > criu.8
@ -70,6 +74,8 @@ their content in human-readable form.
%prep
%setup -q
%patch0 -p1
%patch1 -p1
%build
# %{?_smp_mflags} does not work
@ -134,6 +140,9 @@ rm -rf $RPM_BUILD_ROOT%{_libdir}/pkgconfig
%changelog
* Fri Jun 30 2017 Adrian Reber <adrian@lisas.de> - 3.2.1-2
- Added patches to handle unified hierarchy and new glibc
* Wed Jun 28 2017 Adrian Reber <adrian@lisas.de> - 3.2.1-1
- Update to 3.2.1-1