OSDN Git Service

linux-user/syscall.c: Enforce pselect6 sigset size restrictions
authorPeter Maydell <peter.maydell@linaro.org>
Tue, 28 Jun 2011 11:21:57 +0000 (12:21 +0100)
committerRiku Voipio <riku.voipio@linaro.org>
Mon, 11 Jul 2011 13:35:41 +0000 (16:35 +0300)
Enforce the same restriction on the size of the sigset passed to
pselect6 as the Linux kernel does. This is both correct and silences
a gcc 4.6 warning about a write-only variable.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
linux-user/syscall.c

index e2f356b..90f6789 100644 (file)
@@ -5699,6 +5699,11 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
 
                 if (arg_sigset) {
                     sig.set = &set;
+                    if (arg_sigsize != sizeof(*target_sigset)) {
+                        /* Like the kernel, we enforce correct size sigsets */
+                        ret = -TARGET_EINVAL;
+                        goto fail;
+                    }
                     target_sigset = lock_user(VERIFY_READ, arg_sigset,
                                               sizeof(*target_sigset), 1);
                     if (!target_sigset) {