From patchwork Wed Jul 13 14:48:46 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 104540 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 1DDA31007D1 for ; Thu, 14 Jul 2011 01:25:00 +1000 (EST) Received: from localhost ([::1]:60750 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qh1J2-0007N0-D8 for incoming@patchwork.ozlabs.org; Wed, 13 Jul 2011 11:24:56 -0400 Received: from eggs.gnu.org ([140.186.70.92]:43898) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qh0kZ-0006d1-Vk for qemu-devel@nongnu.org; Wed, 13 Jul 2011 10:49:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qh0kV-0007sV-Lj for qemu-devel@nongnu.org; Wed, 13 Jul 2011 10:49:19 -0400 Received: from afflict.kos.to ([92.243.29.197]:47341) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qh0kV-0007sJ-7T for qemu-devel@nongnu.org; Wed, 13 Jul 2011 10:49:15 -0400 Received: from kos.to (a88-115-163-181.elisa-laajakaista.fi [88.115.163.181]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by afflict.kos.to (Postfix) with ESMTPSA id 36ACB2669A; Wed, 13 Jul 2011 14:49:13 +0000 (UTC) Received: by kos.to (sSMTP sendmail emulation); Wed, 13 Jul 2011 17:49:12 +0300 From: riku.voipio@iki.fi To: qemu-devel@nongnu.org Date: Wed, 13 Jul 2011 17:48:46 +0300 Message-Id: <8f04eeb3c094bf370f131e50b7e3da85d08d518f.1310568214.git.riku.voipio@linaro.org> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 92.243.29.197 Cc: Peter Maydell Subject: [Qemu-devel] [PATCH 07/15] 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 From: Peter Maydell 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 Signed-off-by: Riku Voipio --- 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 e2f356b..90f6789 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -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) {