diff mbox

linux-user/syscall.c: Enforce pselect6 sigset size restrictions

Message ID 1309260117-28334-1-git-send-email-peter.maydell@linaro.org
State Accepted
Commit 8f04eeb3c094bf370f131e50b7e3da85d08d518f
Headers show

Commit Message

Peter Maydell June 28, 2011, 11:21 a.m. UTC
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>
---
This really is the last gcc 4.6 warning fix!

 linux-user/syscall.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

Comments

Mike Frysinger June 28, 2011, 4:14 p.m. UTC | #1
Acked-by: Mike Frysinger <vapier@gentoo.org>
-mike
diff mbox

Patch

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index fed7a8f..feb2501 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -5684,6 +5684,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) {