aboutsummaryrefslogtreecommitdiff
path: root/linux-user/signal.c
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2022-03-15 01:43:05 -0700
committerLaurent Vivier <laurent@vivier.eu>2022-03-22 13:06:21 +0100
commit0a99f09383a0f08e5b7cd0c187166f7eff6014ad (patch)
tree2abdbdbe06597f322edc415cf59e6a05d45f835c /linux-user/signal.c
parent7fb5ef350bb434644fe1ac8eeb973543e017c932 (diff)
downloadqemu-0a99f09383a0f08e5b7cd0c187166f7eff6014ad.zip
qemu-0a99f09383a0f08e5b7cd0c187166f7eff6014ad.tar.gz
qemu-0a99f09383a0f08e5b7cd0c187166f7eff6014ad.tar.bz2
linux-user: Split out helpers for sigsuspend
Two new functions: process_sigsuspend_mask and finish_sigsuspend_mask. Move the size check and copy-from-user code. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20220315084308.433109-3-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Diffstat (limited to 'linux-user/signal.c')
-rw-r--r--linux-user/signal.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/linux-user/signal.c b/linux-user/signal.c
index 2a3f3cc..092e70b 100644
--- a/linux-user/signal.c
+++ b/linux-user/signal.c
@@ -1199,3 +1199,26 @@ void process_pending_signals(CPUArchState *cpu_env)
}
ts->in_sigsuspend = 0;
}
+
+int process_sigsuspend_mask(sigset_t **pset, target_ulong sigset,
+ target_ulong sigsize)
+{
+ TaskState *ts = (TaskState *)thread_cpu->opaque;
+ sigset_t *host_set = &ts->sigsuspend_mask;
+ target_sigset_t *target_sigset;
+
+ if (sigsize != sizeof(*target_sigset)) {
+ /* Like the kernel, we enforce correct size sigsets */
+ return -TARGET_EINVAL;
+ }
+
+ target_sigset = lock_user(VERIFY_READ, sigset, sigsize, 1);
+ if (!target_sigset) {
+ return -TARGET_EFAULT;
+ }
+ target_to_host_sigset(host_set, target_sigset);
+ unlock_user(target_sigset, sigset, 0);
+
+ *pset = host_set;
+ return 0;
+}