adapt crtools to the kernel 3.9

- fix building on ARM
- fix null pointer dereference
- don't try to dump posix timers
This commit is contained in:
Andrey Vagin 2013-07-03 00:02:59 +04:00
parent 717f52abb3
commit 1721ce1547
4 changed files with 107 additions and 1 deletions

View File

@ -0,0 +1,30 @@
From e38617258b1aafd04bce2cc373ea0e551c9da066 Mon Sep 17 00:00:00 2001
From: Alexander Kartashov <alekskartashov@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@parallels.com>
Signed-off-by: Andrey Vagin <avagin@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

View File

@ -0,0 +1,32 @@
From f70859e2fcfe92373aa5f960460f052fff4e1c02 Mon Sep 17 00:00:00 2001
From: Andrey Vagin <avagin@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@lisas.de>
Cc: Pavel Tikhomirov <snorcht@gmail.com>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@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

View File

@ -0,0 +1,34 @@
From 71f5d514ffe5ea2d4a4fe3c9c314043575f35f29 Mon Sep 17 00:00:00 2001
From: Andrey Vagin <avagin@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@lisas.de>
Signed-off-by: Andrey Vagin <avagin@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

View File

@ -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@openvz.org> - 0.6.2
- fix building on ARM
- fix null pointer dereference
* Tue Jul 02 2013 Adrian Reber <adrian@lisas.de> - 0.6-1
- updated to 0.6
- upstream moved binaries to sbin