From patchwork Thu Sep 22 12:13:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 9345221 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 2212960757 for ; Thu, 22 Sep 2016 12:45:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 11C2B2AA69 for ; Thu, 22 Sep 2016 12:45:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 063FA2AA6D; Thu, 22 Sep 2016 12:45:05 +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=-6.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, 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 EB8302AA69 for ; Thu, 22 Sep 2016 12:45:02 +0000 (UTC) Received: from localhost ([::1]:43216 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bn3N6-0003Vn-Rv for patchwork-qemu-devel@patchwork.kernel.org; Thu, 22 Sep 2016 08:45:00 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53352) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bn2uW-0000Jz-Dr for qemu-devel@nongnu.org; Thu, 22 Sep 2016 08:15:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bn2uQ-0006kD-DW for qemu-devel@nongnu.org; Thu, 22 Sep 2016 08:15:28 -0400 Received: from mail-lf0-f52.google.com ([209.85.215.52]:36646) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bn2uQ-0006k2-5b for qemu-devel@nongnu.org; Thu, 22 Sep 2016 08:15:22 -0400 Received: by mail-lf0-f52.google.com with SMTP id g62so65202811lfe.3 for ; Thu, 22 Sep 2016 05:15:22 -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=u9FUiiAzGcoLdBqnPHP9aeTcdSEK0Xnja7LC/Uc5CEU=; b=dvweumKeSXtIS3wuLnt/NnmIu2qdKZ11FMygjQUBKzudExe7AsMUEZRPUxOrzDjg5L Ho0FpRqzS2zdG8oz+6btZwPFPkIh6gKpiBGAjffXEnnvB7xRLuD152kGty0mYJ+00iof yVeh+9vm6nxef+UnKjChw+mLOvhzf4ZeH5/vw= 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=u9FUiiAzGcoLdBqnPHP9aeTcdSEK0Xnja7LC/Uc5CEU=; b=S5XmPeU4qnye76haLqGZ2tAjblqDqUfLrMw6/6GsyQudfIXBrnXKocf8chwc7O0kaM YxJcustDqcuMxCOhG5kC7PdXRYZ87+LoUYB+Q6w9PHyYkNklehpvWP3JjGTQ/SG431bb I9V2zLhBTnDcqLnV04Ju1jyUx8HVN5dbmWA26AIu8AVrfylkQuEz02FXWy1nsifQMQdn qCKg+R9Uxa+0JzFYrzDjCZ8bFDs2RLSBDbKNaOR+vFtpK8QTZ+t2EQGASGHewyBPd4Wu kdVQ5vEEZMMPwwCwZJaAuYLt5pXeT73ocv8SPk+W70VoXLcaIlOSsfK4oN69LJgI5ZVA aJ1Q== X-Gm-Message-State: AE9vXwMOQ+XRgzYs5mFJqk0km61+RtscC0dZknXm9jOGFeEdJWFqJNMHbA/gFr/otMHSecEP X-Received: by 10.25.214.42 with SMTP id n42mr763671lfg.109.1474546461172; Thu, 22 Sep 2016 05:14:21 -0700 (PDT) Received: from beaming.home (91-157-170-157.elisa-laajakaista.fi. [91.157.170.157]) by smtp.gmail.com with ESMTPSA id u14sm294378lja.11.2016.09.22.05.14.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 22 Sep 2016 05:14:20 -0700 (PDT) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Thu, 22 Sep 2016 15:13:42 +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] [fuzzy] X-Received-From: 209.85.215.52 Subject: [Qemu-devel] [PULL 22/26] linux-user: Implement force_sigsegv() via force_sig() 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 Now that we have a force_sig() with the semantics we need, we can implement force_sigsegv() to call it rather than open-coding the call to queue_signal(). Reviewed-by: Richard Henderson Signed-off-by: Peter Maydell Signed-off-by: Riku Voipio --- linux-user/signal.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/linux-user/signal.c b/linux-user/signal.c index 60fda18..900ee35 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -512,8 +512,7 @@ void signal_init(void) } } -#if !defined(TARGET_OPENRISC) && !defined(TARGET_UNICORE32) && \ - !defined(TARGET_X86_64) +#if !(defined(TARGET_X86_64) || defined(TARGET_UNICORE32)) /* Force a synchronously taken signal. The kernel force_sig() function * also forces the signal to "not blocked, not ignored", but for QEMU * that work is done in process_pending_signals(). @@ -531,9 +530,6 @@ static void force_sig(int sig) info._sifields._kill._uid = 0; queue_signal(env, info.si_signo, QEMU_SI_KILL, &info); } -#endif - -#if !(defined(TARGET_X86_64) || defined(TARGET_UNICORE32)) /* Force a SIGSEGV if we couldn't write to memory trying to set * up the signal frame. oldsig is the signal we were trying to handle @@ -541,22 +537,13 @@ static void force_sig(int sig) */ static void force_sigsegv(int oldsig) { - CPUState *cpu = thread_cpu; - CPUArchState *env = cpu->env_ptr; - target_siginfo_t info; - if (oldsig == SIGSEGV) { /* Make sure we don't try to deliver the signal again; this will * end up with handle_pending_signal() calling dump_core_and_abort(). */ sigact_table[oldsig - 1]._sa_handler = TARGET_SIG_DFL; } - info.si_signo = TARGET_SIGSEGV; - info.si_errno = 0; - info.si_code = TARGET_SI_KERNEL; - info._sifields._kill._pid = 0; - info._sifields._kill._uid = 0; - queue_signal(env, info.si_signo, QEMU_SI_KILL, &info); + force_sig(TARGET_SIGSEGV); } #endif