[CRIU] [PATCH] signals: Restore 1:1 mapping between records and signal numbers
Cyrill Gorcunov
gorcunov at openvz.org
Thu Dec 6 09:37:24 EST 2012
In commit caf875454f7a15eb23db049e87407990f3c0b6fa we increased
the number of signals to be c/r'ed but unfortunately the mapping
between the signal number and its position in image file got broken.
In particular before we have had the assumption that position of entry
in a file is the signal number, with "sig - 1" trick it is not true
anymore.
Thus simply drop additional @i reference and just use plain @sig
number instead. This brings 1:1 mapping between signal number and
its position back.
Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
CC: Andrey Vagin <avagin at openvz.org>
---
include/parasite.h | 2 +-
parasite-syscall.c | 10 ++++------
pie/parasite.c | 4 +---
3 files changed, 6 insertions(+), 10 deletions(-)
diff --git a/include/parasite.h b/include/parasite.h
index 3a586fc..7205b81 100644
--- a/include/parasite.h
+++ b/include/parasite.h
@@ -62,7 +62,7 @@ struct parasite_dump_pages_args {
};
struct parasite_dump_sa_args {
- rt_sigaction_t sas[SIGMAX];
+ rt_sigaction_t sas[SIGMAX + 1];
};
struct parasite_dump_itimers_args {
diff --git a/parasite-syscall.c b/parasite-syscall.c
index 98d2e86..3cf9725 100644
--- a/parasite-syscall.c
+++ b/parasite-syscall.c
@@ -449,15 +449,13 @@ int parasite_dump_sigacts_seized(struct parasite_ctl *ctl, struct cr_fdset *cr_f
fd = fdset_fd(cr_fdset, CR_FD_SIGACT);
for (sig = 1; sig <= SIGMAX; sig++) {
- int i = sig - 1;
-
if (sig == SIGSTOP || sig == SIGKILL)
continue;
- ASSIGN_TYPED(se.sigaction, args->sas[i].rt_sa_handler);
- ASSIGN_TYPED(se.flags, args->sas[i].rt_sa_flags);
- ASSIGN_TYPED(se.restorer, args->sas[i].rt_sa_restorer);
- ASSIGN_TYPED(se.mask, args->sas[i].rt_sa_mask.sig[0]);
+ ASSIGN_TYPED(se.sigaction, args->sas[sig].rt_sa_handler);
+ ASSIGN_TYPED(se.flags, args->sas[sig].rt_sa_flags);
+ ASSIGN_TYPED(se.restorer, args->sas[sig].rt_sa_restorer);
+ ASSIGN_TYPED(se.mask, args->sas[sig].rt_sa_mask.sig[0]);
if (pb_write_one(fd, &se, PB_SIGACT) < 0)
return -1;
diff --git a/pie/parasite.c b/pie/parasite.c
index d9e2a1d..d03fea8 100644
--- a/pie/parasite.c
+++ b/pie/parasite.c
@@ -248,12 +248,10 @@ static int dump_sigact(struct parasite_dump_sa_args *da)
int sig, ret = 0;
for (sig = 1; sig <= SIGMAX; sig++) {
- int i = sig - 1;
-
if (sig == SIGKILL || sig == SIGSTOP)
continue;
- ret = sys_sigaction(sig, NULL, &da->sas[i], sizeof(rt_sigset_t));
+ ret = sys_sigaction(sig, NULL, &da->sas[sig], sizeof(rt_sigset_t));
if (ret < 0) {
pr_err("sys_sigaction failed\n");
break;
--
1.8.0.1
More information about the CRIU
mailing list