From patchwork Tue Jun 28 11:21:57 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 2355 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id B3A782404C for ; Tue, 28 Jun 2011 11:22:04 +0000 (UTC) Received: from mail-qw0-f52.google.com (mail-qw0-f52.google.com [209.85.216.52]) by fiordland.canonical.com (Postfix) with ESMTP id 6E391A18570 for ; Tue, 28 Jun 2011 11:22:04 +0000 (UTC) Received: by qwb8 with SMTP id 8so62422qwb.11 for ; Tue, 28 Jun 2011 04:22:03 -0700 (PDT) Received: by 10.224.64.213 with SMTP id f21mr314401qai.159.1309260123699; Tue, 28 Jun 2011 04:22:03 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.229.48.135 with SMTP id r7cs5614qcf; Tue, 28 Jun 2011 04:22:02 -0700 (PDT) Received: by 10.216.68.140 with SMTP id l12mr6207845wed.79.1309260120641; Tue, 28 Jun 2011 04:22:00 -0700 (PDT) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk [81.2.115.146]) by mx.google.com with ESMTPS id n62si209475wed.73.2011.06.28.04.21.58 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 28 Jun 2011 04:21:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 81.2.115.146 as permitted sender) client-ip=81.2.115.146; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 81.2.115.146 as permitted sender) smtp.mail=pm215@archaic.org.uk Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.72) (envelope-from ) id 1QbWMf-0007NR-3v; Tue, 28 Jun 2011 12:21:57 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, Riku Voipio , Mike Frysinger Subject: [PATCH] linux-user/syscall.c: Enforce pselect6 sigset size restrictions Date: Tue, 28 Jun 2011 12:21:57 +0100 Message-Id: <1309260117-28334-1-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.2.5 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 Acked-by: Mike Frysinger --- This really is the last gcc 4.6 warning fix! linux-user/syscall.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) 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) {