[CRIU] [PATCH 2/2] restore: compare whole k_rtsigset on inherite check

Dmitry Safonov dsafonov at virtuozzo.com
Tue Jun 21 04:41:01 PDT 2016


k_rtsigset_t has two words on ARM32.
That for-cycle should be optimized to no-op on other archs by compiler
where _KNSIG_WORDS is 1.

So, if a child blocks the signal which number is > 32 in this mask,
and other signals properties are the same - it will not have it blocked
after C/R.

Impact: fix for signals restoring on ARM32.

Cc: Christopher Covington <cov at codeaurora.org>
Cc: Cyrill Gorcunov <gorcunov at openvz.org>
Signed-off-by: Dmitry Safonov <dsafonov at virtuozzo.com>
---
 criu/cr-restore.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/criu/cr-restore.c b/criu/cr-restore.c
index 2d22f9988a4e..d390ea365abc 100644
--- a/criu/cr-restore.c
+++ b/criu/cr-restore.c
@@ -279,15 +279,20 @@ static rt_sigaction_t parent_act[SIGMAX];
 static bool sa_inherited(int sig, rt_sigaction_t *sa)
 {
 	rt_sigaction_t *pa;
+	int i;
 
 	if (current == root_item)
 		return false; /* XXX -- inherit from CRIU? */
 
 	pa = &parent_act[sig];
+
+	for (i = 0; i < _KNSIG_WORDS; i++)
+		if (pa->rt_sa_mask.sig[i] != sa->rt_sa_mask.sig[i])
+			return false;
+
 	return pa->rt_sa_handler == sa->rt_sa_handler &&
 		pa->rt_sa_flags == sa->rt_sa_flags &&
-		pa->rt_sa_restorer == sa->rt_sa_restorer &&
-		pa->rt_sa_mask.sig[0] == sa->rt_sa_mask.sig[0];
+		pa->rt_sa_restorer == sa->rt_sa_restorer;
 }
 
 /* Returns nr of prepared signals -- 1 in success, <= 0 on fault */
-- 
2.9.0



More information about the CRIU mailing list