From nobody Wed Nov 5 10:30:09 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1499394368111531.4822609042277; Thu, 6 Jul 2017 19:26:08 -0700 (PDT) Received: from localhost ([::1]:54120 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dTIy6-0004Fa-KK for importer@patchew.org; Thu, 06 Jul 2017 22:26:06 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34436) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dTIvC-0001om-I0 for qemu-devel@nongnu.org; Thu, 06 Jul 2017 22:23:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dTIv9-00007x-Dq for qemu-devel@nongnu.org; Thu, 06 Jul 2017 22:23:06 -0400 Received: from mail-qt0-x241.google.com ([2607:f8b0:400d:c0d::241]:36526) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dTIv9-00007e-A4 for qemu-devel@nongnu.org; Thu, 06 Jul 2017 22:23:03 -0400 Received: by mail-qt0-x241.google.com with SMTP id v31so2713950qtb.3 for ; Thu, 06 Jul 2017 19:23:03 -0700 (PDT) Received: from bigtime.twiddle.net.com (rrcs-66-91-136-156.west.biz.rr.com. [66.91.136.156]) by smtp.gmail.com with ESMTPSA id i85sm1407176qke.66.2017.07.06.19.22.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Jul 2017 19:23:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=c8K0nihITQzY5H11oh0OJXlrlkc96hFSYMbBIDva34k=; b=NOTSmMDL1ZIqYg7AhHUJcsma7uM2uDeBLJN6i1/cnkORFYoCDmBKN8j/In6U8C5ZlR bgGyppzoNhEgWjHi9W+QSh6zVHVNhukY0vCkEKUx2G/3TeisMpZPDzN3mjgmrb/fNYxB Xsw1T7NZX4YcBEb62NLUGCjGE2i+Wms4XsA/65Ob5C+Oec2NjdXawrNoG2yXIsH3/4ya d8HxrrlPj6azpkoXUOY7ANLINaniAAnva445ch6ZdMFE4dDKj/E/ZPrgWLsV7eAu057F YmXL8TdflazYl4QJcL3AxijdXOFzYMhxX7cIUtGv3mOb5K2rihRczsUhaYliLYA0pF6v FDgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=c8K0nihITQzY5H11oh0OJXlrlkc96hFSYMbBIDva34k=; b=hcdDMSqUi71KgN2wtZyaDkmgk1gXJmbpHaQ2mD6VbMJF6WnaBSY8u8BLnyJIjFgDTV By3IwNjjH1lY9YfhM6U4TtjCqXjcSO3xc3oKZ3KS4qTQD+hoqMWEHKuKqUCtxozgHrr9 4wyQSomPIYt7rcr0CLUVom/NOZvIdfJFzr+chSfnuxUDLyvQ0xfosdPHZEGs/t28tgmW mekpT/bXOdbDmCest43gJLyZXpUVuQWBPn05ltgxn0VQxs/IgeZ7vj3MNGgafG01uYxJ Uy1zGkKe4ziiwLLUaiexvyojAvaGhkrrX8h9ehSIYMSwiFkhX6z08ZzjSISrbUhVhcpt eCxQ== X-Gm-Message-State: AKS2vOzDFcUYjZGUeyTTSxeUhs09KkyqaahtPd2uGawrC5ygfEN2Kl0k 6E32d3QSYwiXPSdWg+A= X-Received: by 10.237.39.33 with SMTP id n30mr67848150qtd.149.1499394182682; Thu, 06 Jul 2017 19:23:02 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 6 Jul 2017 16:20:53 -1000 Message-Id: <20170707022111.21836-10-rth@twiddle.net> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170707022111.21836-1-rth@twiddle.net> References: <20170707022111.21836-1-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c0d::241 Subject: [Qemu-devel] [PATCH v2 09/27] linux-user/sh4: Clean env->flags on signal boundaries 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: bruno@clisp.org, laurent@vivier.eu, aurelien@aurel32.net, glaubitz@debian.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" If a signal is delivered during the execution of a delay slot, or a gUSA region, clear those bits from the environment so that the signal handler does not start in that same state. Cleaning the bits on signal return is paranoid good sense. Signed-off-by: Richard Henderson Reviewed-by: Aurelien Jarno --- linux-user/signal.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/linux-user/signal.c b/linux-user/signal.c index a537778..8c0b851 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -3544,6 +3544,7 @@ static void restore_sigcontext(CPUSH4State *regs, str= uct target_sigcontext *sc) __get_user(regs->fpul, &sc->sc_fpul); =20 regs->tra =3D -1; /* disable syscall checks */ + regs->flags &=3D ~(DELAY_SLOT_MASK | GUSA_MASK); } =20 static void setup_frame(int sig, struct target_sigaction *ka, @@ -3587,6 +3588,7 @@ static void setup_frame(int sig, struct target_sigact= ion *ka, regs->gregs[5] =3D 0; regs->gregs[6] =3D frame_addr +=3D offsetof(typeof(*frame), sc); regs->pc =3D (unsigned long) ka->_sa_handler; + regs->flags &=3D ~(DELAY_SLOT_MASK | GUSA_MASK); =20 unlock_user_struct(frame, frame_addr, 1); return; @@ -3649,6 +3651,7 @@ static void setup_rt_frame(int sig, struct target_sig= action *ka, regs->gregs[5] =3D frame_addr + offsetof(typeof(*frame), info); regs->gregs[6] =3D frame_addr + offsetof(typeof(*frame), uc); regs->pc =3D (unsigned long) ka->_sa_handler; + regs->flags &=3D ~(DELAY_SLOT_MASK | GUSA_MASK); =20 unlock_user_struct(frame, frame_addr, 1); return; --=20 2.9.4