From patchwork Wed Jun 8 13:29:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 9164683 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 DF5B360467 for ; Wed, 8 Jun 2016 13:44:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D264820410 for ; Wed, 8 Jun 2016 13:44:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C74F1282DC; Wed, 8 Jun 2016 13:44:23 +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 0A9A920410 for ; Wed, 8 Jun 2016 13:44:23 +0000 (UTC) Received: from localhost ([::1]:57077 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAdmQ-00086c-3T for patchwork-qemu-devel@patchwork.kernel.org; Wed, 08 Jun 2016 09:44:22 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36939) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAdZM-0004F0-TE for qemu-devel@nongnu.org; Wed, 08 Jun 2016 09:30:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bAdZE-0005jP-2C for qemu-devel@nongnu.org; Wed, 08 Jun 2016 09:30:48 -0400 Received: from mail-lf0-x233.google.com ([2a00:1450:4010:c07::233]:33856) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAdZD-0005iI-Mf for qemu-devel@nongnu.org; Wed, 08 Jun 2016 09:30:43 -0400 Received: by mail-lf0-x233.google.com with SMTP id s186so5869732lfs.1 for ; Wed, 08 Jun 2016 06:30:43 -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=XaNAUZcM/XDhO4l5ZSKeScgwIeFMpzs/9ibmRKgWmo8=; b=Pf8VwOa2cmLBoeyj3DkM67NziZZDN/iVDemwoGLhJLr0bOjP2M5xJuMYNXfk591lsO d0ZCtwWxovQ7n80jqYe16cEU2D5a5ikOsyen8vRKKTzKz96Gg7jyqfg7IVl1UL9f72ND xoqlSUegPl+NU7gLzo6EEUyYM12aX/hWAeRGQ= 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=XaNAUZcM/XDhO4l5ZSKeScgwIeFMpzs/9ibmRKgWmo8=; b=kQydXXY9v97IUPs35ISvkubmLQ0Ky2llcbb1DDOL/G9DbCRza1zf+dRUf9jLXPKXjF ACX7aZw2LmK8D9h1JvgKxZsxolKsfK7GF4CG9gDt5wvqbjGuIt97LaJ7uosG1eRL+kZB WSxnfTBLeA28To13gGvmuq+e+xu2IyuMkiJkkhZ538hlIfcsT6unSxbe0oy1L3PBIYOQ N2rYrnId+xeVGm0HYyRXwXz84pLK0rJpmYY2Ku5j/RDOZBE5M06kezPkoJ7vyObp6foE 3SZB+0XnENxD04ybT//TucVrBQtRR+FGXaSBT7Pb0LYiE4tAagdLV9hnvVRzqxQ6u1qO 17FQ== X-Gm-Message-State: ALyK8tLFZZSzR++ufTHtuu8nzrWWMq7sjfEhMAVV1h2WuT2eZZ8Kch49USeeBdCLfTOEdSmD X-Received: by 10.25.19.204 with SMTP id 73mr2021521lft.24.1465392642880; Wed, 08 Jun 2016 06:30:42 -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.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 08 Jun 2016 06:30:42 -0700 (PDT) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Wed, 8 Jun 2016 16:29:54 +0300 Message-Id: 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::233 Subject: [Qemu-devel] [PULL 13/44] linux-user: Remove redundant default action check in queue_signal() 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: Timothy E Baldwin Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Timothy E Baldwin Both queue_signal() and process_pending_signals() did check for default actions of signals, this is redundant and also causes fatal and stopping signals to incorrectly cause guest system calls to be interrupted. The code in queue_signal() is removed. Signed-off-by: Timothy Edward Baldwin Message-id: 1441497448-32489-21-git-send-email-T.E.Baldwin99@members.leeds.ac.uk Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell Signed-off-by: Riku Voipio --- linux-user/signal.c | 37 ------------------------------------- 1 file changed, 37 deletions(-) diff --git a/linux-user/signal.c b/linux-user/signal.c index a89853d..2c6790d 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -525,46 +525,10 @@ int queue_signal(CPUArchState *env, int sig, target_siginfo_t *info) TaskState *ts = cpu->opaque; struct emulated_sigtable *k; struct sigqueue *q, **pq; - abi_ulong handler; - int queue; trace_user_queue_signal(env, sig); k = &ts->sigtab[sig - 1]; - queue = gdb_queuesig (); - handler = sigact_table[sig - 1]._sa_handler; - if (sig == TARGET_SIGSEGV && sigismember(&ts->signal_mask, SIGSEGV)) { - /* Guest has blocked SIGSEGV but we got one anyway. Assume this - * is a forced SIGSEGV (ie one the kernel handles via force_sig_info - * because it got a real MMU fault). A blocked SIGSEGV in that - * situation is treated as if using the default handler. This is - * not correct if some other process has randomly sent us a SIGSEGV - * via kill(), but that is not easy to distinguish at this point, - * so we assume it doesn't happen. - */ - handler = TARGET_SIG_DFL; - } - - if (!queue && handler == TARGET_SIG_DFL) { - if (sig == TARGET_SIGTSTP || sig == TARGET_SIGTTIN || sig == TARGET_SIGTTOU) { - kill(getpid(),SIGSTOP); - return 0; - } else - /* default handler : ignore some signal. The other are fatal */ - if (sig != TARGET_SIGCHLD && - sig != TARGET_SIGURG && - sig != TARGET_SIGWINCH && - sig != TARGET_SIGCONT) { - force_sig(sig); - } else { - return 0; /* indicate ignored */ - } - } else if (!queue && handler == TARGET_SIG_IGN) { - /* ignore signal */ - return 0; - } else if (!queue && handler == TARGET_SIG_ERR) { - force_sig(sig); - } else { pq = &k->first; if (sig < TARGET_SIGRTMIN) { /* if non real time signal, we queue exactly one signal */ @@ -591,7 +555,6 @@ int queue_signal(CPUArchState *env, int sig, target_siginfo_t *info) /* signal that a new signal is pending */ atomic_set(&ts->signal_pending, 1); return 1; /* indicates that the signal was queued */ - } } #ifndef HAVE_SAFE_SYSCALL