[CRIU] [PATCH 09/13] syscalls: Don't hide sigsetsize inside syscall itself

Cyrill Gorcunov gorcunov at openvz.org
Tue Apr 17 17:55:44 EDT 2012


This brings hardness into syscall trasition to asm code,
pass this constants in callers.

Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 cr-restore.c      |    2 +-
 include/syscall.h |    8 ++++----
 parasite.c        |    6 +++---
 restorer.c        |    6 +++---
 4 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/cr-restore.c b/cr-restore.c
index 2cbd037..2fa36cf 100644
--- a/cr-restore.c
+++ b/cr-restore.c
@@ -484,7 +484,7 @@ static int prepare_sigactions(int pid)
 		 * A pure syscall is used, because glibc
 		 * sigaction overwrites se_restorer.
 		 */
-		ret = sys_sigaction(sig, &act, &oact);
+		ret = sys_sigaction(sig, &act, &oact, sizeof(rt_sigset_t));
 		if (ret == -1) {
 			pr_err("%d: Can't restore sigaction: %m\n", pid);
 			goto err;
diff --git a/include/syscall.h b/include/syscall.h
index 1ad4060..516370f 100644
--- a/include/syscall.h
+++ b/include/syscall.h
@@ -159,9 +159,9 @@ static always_inline long sys_open(const char *filename, unsigned long flags, un
 	return syscall3(__NR_open, (unsigned long)filename, flags, mode);
 }
 
-static always_inline long sys_sigaction(int signum, const rt_sigaction_t *act, rt_sigaction_t *oldact)
+static always_inline long sys_sigaction(int signum, const rt_sigaction_t *act, rt_sigaction_t *oldact, size_t sigsetsize)
 {
-	return syscall4(__NR_rt_sigaction, signum, (unsigned long)act, (unsigned long)oldact, sizeof(rt_sigset_t));
+	return syscall4(__NR_rt_sigaction, signum, (unsigned long)act, (unsigned long)oldact, (unsigned long)sigsetsize);
 }
 
 static always_inline long sys_getitimer(int which, const struct itimerval *val)
@@ -244,10 +244,10 @@ static always_inline long sys_rt_sigreturn(void)
 }
 
 static always_inline long sys_sigprocmask(int how, k_rtsigset_t *set,
-		k_rtsigset_t *old)
+		k_rtsigset_t *old, size_t sigsetsize)
 {
 	return syscall4(__NR_rt_sigprocmask, how, (unsigned long)set,
-			(unsigned long)old, (unsigned long)sizeof(k_rtsigset_t));
+			(unsigned long)old, (unsigned long)sigsetsize);
 }
 
 static always_inline long sys_set_thread_area(user_desc_t *info)
diff --git a/parasite.c b/parasite.c
index e34299e..b000dfe 100644
--- a/parasite.c
+++ b/parasite.c
@@ -255,7 +255,7 @@ static int dump_sigact(parasite_status_t *st)
 		if (sig == SIGKILL || sig == SIGSTOP)
 			continue;
 
-		ret = sys_sigaction(sig, NULL, &act);
+		ret = sys_sigaction(sig, NULL, &act, sizeof(rt_sigset_t));
 		if (ret < 0) {
 			sys_write_msg("sys_sigaction failed\n");
 			SET_PARASITE_RET(st, ret);
@@ -409,7 +409,7 @@ static int init(struct parasite_init_args *args)
 	}
 
 	ksigfillset(&to_block);
-	ret = sys_sigprocmask(SIG_SETMASK, &to_block, &old_blocked);
+	ret = sys_sigprocmask(SIG_SETMASK, &to_block, &old_blocked, sizeof(k_rtsigset_t));
 	if (ret < 0)
 		reset_blocked = ret;
 	else
@@ -436,7 +436,7 @@ static int parasite_set_logfd(parasite_status_t *st)
 static int fini(void)
 {
 	if (reset_blocked == 1)
-		sys_sigprocmask(SIG_SETMASK, &old_blocked, NULL);
+		sys_sigprocmask(SIG_SETMASK, &old_blocked, NULL, sizeof(k_rtsigset_t));
 	sys_close(logfd);
 	sys_close(tsock);
 	brk_fini();
diff --git a/restorer.c b/restorer.c
index 4cf688b..49ba5fe 100644
--- a/restorer.c
+++ b/restorer.c
@@ -349,9 +349,9 @@ long __export_restore_task(struct task_restore_core_args *args)
 	rt_sigaction_t act;
 
 	task_entries = args->task_entries;
-	sys_sigaction(SIGCHLD, NULL, &act);
+	sys_sigaction(SIGCHLD, NULL, &act, sizeof(rt_sigset_t));
 	act.rt_sa_handler = sigchld_handler;
-	sys_sigaction(SIGCHLD, &act, NULL);
+	sys_sigaction(SIGCHLD, &act, NULL, sizeof(rt_sigset_t));
 
 	restorer_set_logfd(args->logfd);
 
@@ -687,7 +687,7 @@ long __export_restore_task(struct task_restore_core_args *args)
 
 	futex_wait_while(&args->task_entries->start, CR_STATE_RESTORE);
 
-	sys_sigaction(SIGCHLD, &args->sigchld_act, NULL);
+	sys_sigaction(SIGCHLD, &args->sigchld_act, NULL, sizeof(rt_sigset_t));
 
 	futex_dec_and_wake(&args->task_entries->nr_in_progress);
 
-- 
1.7.7.6



More information about the CRIU mailing list