[criu] adapt crtools to the kernel 3.9

Andrey Vagin avagin at fedoraproject.org
Tue Dec 10 16:42:57 UTC 2013


commit 1721ce1547f2cf6f63f46b314abe1aac5fe2f3ff
Author: Andrey Vagin <avagin at openvz.org>
Date:   Wed Jul 3 00:02:59 2013 +0400

    adapt crtools to the kernel 3.9
    
    - fix building on ARM
    - fix null pointer dereference
    - don't try to dump posix timers

 ...-ARM-versions-of-the-POSIX-timer-syscalls.patch |   30 +++++++++++++++++
 0001-posix-timers-don-t-call-ferror-for-NULL.patch |   32 ++++++++++++++++++
 ...es-don-t-fail-if-proc-PID-times-is-absent.patch |   34 ++++++++++++++++++++
 crtools.spec                                       |   12 ++++++-
 4 files changed, 107 insertions(+), 1 deletions(-)
---
diff --git a/0001-arm-added-ARM-versions-of-the-POSIX-timer-syscalls.patch b/0001-arm-added-ARM-versions-of-the-POSIX-timer-syscalls.patch
new file mode 100644
index 0000000..efdd952
--- /dev/null
+++ b/0001-arm-added-ARM-versions-of-the-POSIX-timer-syscalls.patch
@@ -0,0 +1,30 @@
+From e38617258b1aafd04bce2cc373ea0e551c9da066 Mon Sep 17 00:00:00 2001
+From: Alexander Kartashov <alekskartashov at parallels.com>
+Date: Tue, 2 Jul 2013 17:19:52 +0400
+Subject: [PATCH] arm: added ARM versions of the POSIX timer syscalls
+
+Signed-off-by: Pavel Emelyanov <xemul at parallels.com>
+Signed-off-by: Andrey Vagin <avagin at openvz.org>
+---
+ arch/arm/syscall.def | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/arch/arm/syscall.def b/arch/arm/syscall.def
+index 39b578e..ec7301b 100644
+--- a/arch/arm/syscall.def
++++ b/arch/arm/syscall.def
+@@ -73,6 +73,11 @@ gettid				186	224	(void)
+ futex				202	240	(u32 *uaddr, int op, u32 val, struct timespec *utime, u32 *uaddr2, u32 val3)
+ set_tid_address			218	256	(int *tid_addr)
+ restart_syscall			219	0	(void)
++timer_create			222	257	(clockid_t which_clock, struct sigevent *timer_event_spec, timer_t *created_timer_id)
++timer_settime			223	258	(timer_t timer_id, int flags, const struct itimerspec *new_setting, struct itimerspec *old_setting)
++timer_gettime			224	259	(int timer_id, const struct itimerspec *setting)
++timer_getoverrun		225	260	(int timer_id)
++timer_delete			226	261	(timer_t timer_id)
+ exit_group			231	248	(int error_code)
+ set_robust_list			273	338	(struct robust_list_head *head, size_t len)
+ get_robust_list			274	339	(int pid, struct robust_list_head **head_ptr, size_t *len_ptr)
+-- 
+1.8.3.1
+
diff --git a/0001-posix-timers-don-t-call-ferror-for-NULL.patch b/0001-posix-timers-don-t-call-ferror-for-NULL.patch
new file mode 100644
index 0000000..63170aa
--- /dev/null
+++ b/0001-posix-timers-don-t-call-ferror-for-NULL.patch
@@ -0,0 +1,32 @@
+From f70859e2fcfe92373aa5f960460f052fff4e1c02 Mon Sep 17 00:00:00 2001
+From: Andrey Vagin <avagin at openvz.org>
+Date: Tue, 2 Jul 2013 20:25:14 +0400
+Subject: [PATCH] posix-timers: don't call ferror for NULL
+
+parse_posix_timers should not call ferror if fopen returned NULL.
+
+Reported-by: Adrian Reber <adrian at lisas.de>
+Cc: Pavel Tikhomirov <snorcht at gmail.com>
+Signed-off-by: Andrey Vagin <avagin at openvz.org>
+Signed-off-by: Pavel Emelyanov <xemul at parallels.com>
+---
+ proc_parse.c | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/proc_parse.c b/proc_parse.c
+index 7115392..28e2983 100644
+--- a/proc_parse.c
++++ b/proc_parse.c
+@@ -1190,8 +1190,7 @@ int parse_posix_timers(pid_t pid, struct proc_posix_timers_stat *args)
+ 	file = fopen_proc(pid, "timers");
+ 	if (file == NULL) {
+ 		pr_perror("Can't open posix timers file!");
+-		ret = -1;
+-		goto end_posix;
++		return -1;
+ 	}
+ 
+ 	while (1) {
+-- 
+1.8.3.1
+
diff --git a/0001-posix-times-don-t-fail-if-proc-PID-times-is-absent.patch b/0001-posix-times-don-t-fail-if-proc-PID-times-is-absent.patch
new file mode 100644
index 0000000..18b864d
--- /dev/null
+++ b/0001-posix-times-don-t-fail-if-proc-PID-times-is-absent.patch
@@ -0,0 +1,34 @@
+From 71f5d514ffe5ea2d4a4fe3c9c314043575f35f29 Mon Sep 17 00:00:00 2001
+From: Andrey Vagin <avagin at openvz.org>
+Date: Tue, 2 Jul 2013 19:14:01 +0400
+Subject: [PATCH] posix-times: don't fail if /proc/PID/times is absent
+
+/proc/PID/times was added in 3.10, but FC19 relesead with 3.9.
+
+Usually we support only last version of kernel in the project git, so
+we can commit it as an additional patch for the fedora package.
+
+Cc: Adrian Reber <adrian at lisas.de>
+Signed-off-by: Andrey Vagin <avagin at openvz.org>
+---
+ proc_parse.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/proc_parse.c b/proc_parse.c
+index 28e2983..57311ec 100644
+--- a/proc_parse.c
++++ b/proc_parse.c
+@@ -1189,6 +1189,10 @@ int parse_posix_timers(pid_t pid, struct proc_posix_timers_stat *args)
+ 
+ 	file = fopen_proc(pid, "timers");
+ 	if (file == NULL) {
++		if (errno == ENOENT) {
++			pr_warn("Dump of posix timers isn't supported by this kernel\n");
++			return 0;
++		}
+ 		pr_perror("Can't open posix timers file!");
+ 		return -1;
+ 	}
+-- 
+1.8.3.1
+
diff --git a/crtools.spec b/crtools.spec
index ea1f100..2796eca 100644
--- a/crtools.spec
+++ b/crtools.spec
@@ -1,11 +1,14 @@
 Name: crtools	
 Version: 0.6
-Release: 1%{?dist}
+Release: 2%{?dist}
 Summary: Tool for Checkpoint/Restore in User-space
 Group: System Environment/Base
 License: GPLv2
 URL: http://criu.org/
 Source0: http://download.openvz.org/criu/criu-0.6.tar.bz2
+Patch0: 0001-arm-added-ARM-versions-of-the-POSIX-timer-syscalls.patch
+Patch1: 0001-posix-timers-don-t-call-ferror-for-NULL.patch
+Patch2: 0001-posix-times-don-t-fail-if-proc-PID-times-is-absent.patch
 
 BuildRequires: protobuf-c-devel asciidoc xmlto
 
@@ -23,6 +26,9 @@ Linux in user-space.
 
 %prep
 %setup -q -n criu-0.6
+%patch0 -p1
+%patch1 -p1
+%patch2 -p1
 
 %build
 # %{?_smp_mflags} does not work
@@ -44,6 +50,10 @@ ln -s %{_sbindir}/criu $RPM_BUILD_ROOT%{_sbindir}/crtools
 %doc README COPYING
 
 %changelog
+* Tue Jul 03 2013 Andrew Vagin <avagin at openvz.org> - 0.6.2
+- fix building on ARM
+- fix null pointer dereference
+
 * Tue Jul 02 2013 Adrian Reber <adrian at lisas.de> - 0.6-1
 - updated to 0.6
 - upstream moved binaries to sbin


More information about the scm-commits mailing list