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: 69645 Delivered-To: patch@linaro.org Received: by 10.140.106.246 with SMTP id e109csp2504854qgf; Wed, 8 Jun 2016 06:47:00 -0700 (PDT) X-Received: by 10.55.180.133 with SMTP id d127mr4869883qkf.131.1465393620198; Wed, 08 Jun 2016 06:47:00 -0700 (PDT) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id 131si688246qki.193.2016.06.08.06.47.00 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 08 Jun 2016 06:47:00 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:57089 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAdox-0001fV-M1 for patch@linaro.org; Wed, 08 Jun 2016 09:46:59 -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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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(-) -- 2.1.4 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: