From patchwork Mon May 15 14:59:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Milos Stojanovic X-Patchwork-Id: 762557 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3wRP2K0X0jz9s0g for ; Tue, 16 May 2017 01:02:33 +1000 (AEST) Received: from localhost ([::1]:37269 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dAHW2-0000BL-MR for incoming@patchwork.ozlabs.org; Mon, 15 May 2017 11:02:30 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37205) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dAHVP-00007a-8q for qemu-devel@nongnu.org; Mon, 15 May 2017 11:01:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dAHVL-0004df-Db for qemu-devel@nongnu.org; Mon, 15 May 2017 11:01:51 -0400 Received: from mx2.rt-rk.com ([89.216.37.149]:45699 helo=mail.rt-rk.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dAHVL-0004cs-5Q for qemu-devel@nongnu.org; Mon, 15 May 2017 11:01:47 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.rt-rk.com (Postfix) with ESMTP id 95DDC1A2181; Mon, 15 May 2017 17:01:45 +0200 (CEST) X-Virus-Scanned: amavisd-new at rt-rk.com Received: from rtrkw488-lin.domain.local (unknown [10.10.14.90]) by mail.rt-rk.com (Postfix) with ESMTPSA id 530101A2197; Mon, 15 May 2017 17:01:45 +0200 (CEST) From: =?UTF-8?q?Milo=C5=A1=20Stojanovi=C4=87?= To: qemu-devel@nongnu.org, riku.voipio@iki.fi Date: Mon, 15 May 2017 16:59:43 +0200 Message-Id: <1494860396-24930-4-git-send-email-Milos.Stojanovic@rt-rk.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1494860396-24930-1-git-send-email-Milos.Stojanovic@rt-rk.com> References: <1494860396-24930-1-git-send-email-Milos.Stojanovic@rt-rk.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 89.216.37.149 Subject: [Qemu-devel] [PATCH v2 03/16] linux-user: fix ssetmask() system call 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: Miodrag.Dinic@rt-rk.com, laurent@vivier.eu, Petar.Jovanovic@rt-rk.com, Aleksandar.Markovic@rt-rk.com, yongbok.kim@imgtec.com, Milos.Stojanovic@rt-rk.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Fix the ssetmask() system call by removing the invocation of sigorset(). The ssetmask() system call should replace the old signal mask with the new and return the old mask. It shouldn't combine the old and the new mask with sigorset(). Fetching the old mask for sigorset() is also no longer needed. The problem was detected after running LTP test group syscalls for the MIPS EL 32 R2 architecture where the test ssetmask01 failed with exit code 1. The test passes now that the ssetmask() system call is fixed. Signed-off-by: Miloš Stojanović --- linux-user/syscall.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index cec8428..abba3d8 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -8592,17 +8592,9 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, #ifdef TARGET_NR_ssetmask /* not on alpha */ case TARGET_NR_ssetmask: { - sigset_t set, oset, cur_set; + sigset_t set, oset; abi_ulong target_set = arg1; - /* We only have one word of the new mask so we must read - * the rest of it with do_sigprocmask() and OR in this word. - * We are guaranteed that a do_sigprocmask() that only queries - * the signal mask will not fail. - */ - ret = do_sigprocmask(0, NULL, &cur_set); - assert(!ret); target_to_host_old_sigset(&set, &target_set); - sigorset(&set, &set, &cur_set); ret = do_sigprocmask(SIG_SETMASK, &set, &oset); if (!ret) { host_to_target_old_sigset(&target_set, &oset);