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: 102353 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id B1445B6F5C for ; Tue, 28 Jun 2011 21:24:17 +1000 (EST) Received: from localhost ([::1]:45009 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QbWOr-0005mM-Qi for incoming@patchwork.ozlabs.org; Tue, 28 Jun 2011 07:24:13 -0400 Received: from eggs.gnu.org ([140.186.70.92]:60457) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QbWMk-0005lu-8r for qemu-devel@nongnu.org; Tue, 28 Jun 2011 07:22:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QbWMi-0005fv-GY for qemu-devel@nongnu.org; Tue, 28 Jun 2011 07:22:01 -0400 Received: from mnementh.archaic.org.uk ([81.2.115.146]:53621) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QbWMi-0005fc-2Z for qemu-devel@nongnu.org; Tue, 28 Jun 2011 07:22:00 -0400 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 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 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 81.2.115.146 Cc: Riku Voipio , Mike Frysinger , patches@linaro.org Subject: [Qemu-devel] [PATCH] linux-user/syscall.c: Enforce pselect6 sigset size restrictions X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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) {