From patchwork Wed Jun 8 13:29:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 9164687 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6D12A60467 for ; Wed, 8 Jun 2016 13:45:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5E2EE25D91 for ; Wed, 8 Jun 2016 13:45:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 50BA82824F; Wed, 8 Jun 2016 13:45:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, FSL_HELO_HOME, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6109425D91 for ; Wed, 8 Jun 2016 13:45:09 +0000 (UTC) Received: from localhost ([::1]:57079 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAdn8-0000PY-L0 for patchwork-qemu-devel@patchwork.kernel.org; Wed, 08 Jun 2016 09:45:07 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36897) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAdZK-0004B1-08 for qemu-devel@nongnu.org; Wed, 08 Jun 2016 09:30:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bAdZC-0005hR-40 for qemu-devel@nongnu.org; Wed, 08 Jun 2016 09:30:46 -0400 Received: from mail-lf0-x232.google.com ([2a00:1450:4010:c07::232]:33846) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAdZB-0005gk-FL for qemu-devel@nongnu.org; Wed, 08 Jun 2016 09:30:41 -0400 Received: by mail-lf0-x232.google.com with SMTP id s186so5869070lfs.1 for ; Wed, 08 Jun 2016 06:30:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=k+WBRL5s1BpGUg86c632erYFaNG+OlyyQC9n/DfYtLs=; b=J3/JHQKIZGsYeBVBCxDKvVdR7cddCtY5f0JTqPen+msA6u/kby6CzN0kbXOgGP0+Ll z2LlLbsriu/XNpi0JbaPhQYByxYlcREVMZO1DyV97aHwPfu95MfHaIXGJw+zIAXiF/Sf E4rVu3m80ojHwM6E++N7RqfpjfQrvxvuV9Fx8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=k+WBRL5s1BpGUg86c632erYFaNG+OlyyQC9n/DfYtLs=; b=MkkM5jhkQTyTi6Ptriuzdu2ig/bHQ6jh/wBrmQcoW1xtKlh3pWFHaV/+Bh/YeYKN16 57wrzhJlCPVAUzbpr495wjnZo8qAgqcOrxgW1kDGlPRaxbUwZt+Xy2HowQeJMlTUztTY 3QPRoHz0/rmM3hnDH+W2MQn9Xqj3PHVYB4hQ7AphYzT9TBQnV1u7w35gDQyzzX4JEtXZ rq0Q9d2j/LGwG247CheVOUqsAA9L35GIcCPOb4+xri2utr1vhNtLyjaQi/CYZrb3BCLf 70bC707GXkQ9a+x+7tDpl0Wx2MYHQZMFbTinApRVJcrt6WPZIIHMAr+Yki6Mbjt/ldVs Zo/w== X-Gm-Message-State: ALyK8tLgi2mGtKG2vy8N48tPyyy3oLkiBytgNwwPywOrQpCrbxUrNWJ8g/GXzI1aUX4Wkv8Z X-Received: by 10.25.126.5 with SMTP id z5mr4726986lfc.199.1465392640667; Wed, 08 Jun 2016 06:30:40 -0700 (PDT) Received: from beaming.home (91-157-170-157.elisa-laajakaista.fi. [91.157.170.157]) by smtp.gmail.com with ESMTPSA id 2sm139854lja.37.2016.06.08.06.30.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 08 Jun 2016 06:30:39 -0700 (PDT) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Wed, 8 Jun 2016 16:29:52 +0300 Message-Id: <2fe4fba115b5b9f7e6722720c57810e0fc64b9b5.1465392530.git.riku.voipio@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:4010:c07::232 Subject: [Qemu-devel] [PULL 11/44] linux-user: Use safe_syscall for sigsuspend syscalls X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Peter Maydell Use the safe_syscall wrapper for sigsuspend syscalls. This means that we will definitely deliver a signal that arrives before we do the sigsuspend call, rather than blocking first and delivering afterwards. Signed-off-by: Peter Maydell Reviewed-by: Laurent Vivier Signed-off-by: Riku Voipio --- linux-user/syscall.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index d2749a6..5bdfe2a 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -716,6 +716,7 @@ safe_syscall6(int, pselect6, int, nfds, fd_set *, readfds, fd_set *, writefds, \ fd_set *, exceptfds, struct timespec *, timeout, void *, sig) safe_syscall6(int,futex,int *,uaddr,int,op,int,val, \ const struct timespec *,timeout,int *,uaddr2,int,val3) +safe_syscall2(int, rt_sigsuspend, sigset_t *, newset, size_t, sigsetsize) static inline int host_to_target_sock_type(int host_type) { @@ -7648,7 +7649,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, target_to_host_old_sigset(&set, p); unlock_user(p, arg1, 0); #endif - ret = get_errno(sigsuspend(&set)); + ret = get_errno(safe_rt_sigsuspend(&set, SIGSET_T_SIZE)); } break; #endif @@ -7659,7 +7660,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, goto efault; target_to_host_sigset(&set, p); unlock_user(p, arg1, 0); - ret = get_errno(sigsuspend(&set)); + ret = get_errno(safe_rt_sigsuspend(&set, SIGSET_T_SIZE)); } break; case TARGET_NR_rt_sigtimedwait: