From nobody Tue Jan 21 23:03:39 2025
Delivered-To: importer@patchew.org
Authentication-Results: mx.zohomail.com;
	dkim=fail;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=fail(p=none dis=none)  header.from=linaro.org
ARC-Seal: i=1; a=rsa-sha256; t=1601676168; cv=none;
	d=zohomail.com; s=zohoarc;
	b=GxYXNJXE3apq2q1YivKdBaaCvT/cv4DbSbLIE2Us9JxTqRNNIphBJXdXI6bZE0fExwgxU5qq1J4cLjfAwGca71G5n6n9x4pR5dSkkbFOMh4GblsnbaFCs+qhF2YQSvjHMvFb0Cx6gVQuSwRo+r0i0KToE5BsMMdHoQzEUj7eol8=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1601676168;
 h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
	bh=zVLgn+OX/nTD/oUAFauTpXTtA86xiUG6+rSs26rONZM=;
	b=n+unt1wGrYBszr6y8v0Kn+iVs3SDDnW5rmvPLPLRzaYDj09LtzAQcdIqrZ1af02sK5f+/ogCiPSShd1CFXgws5jikVMax6o3wLN8wu1TTkVqAN/zNQCorvDYy0GVYF0dJwTrxL1ame+uYs8Fb3rz6OBxcOhR03PQ+FQODPC0WWE=
ARC-Authentication-Results: i=1; mx.zohomail.com;
	dkim=fail;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=fail header.from=<richard.henderson@linaro.org> (p=none dis=none)
 header.from=<richard.henderson@linaro.org>
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1601676168719942.5121108198667;
 Fri, 2 Oct 2020 15:02:48 -0700 (PDT)
Received: from localhost ([::1]:57400 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces+importer=patchew.org@nongnu.org>)
	id 1kOT8Z-0004pf-DK
	for importer@patchew.org; Fri, 02 Oct 2020 18:02:47 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:34830)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <richard.henderson@linaro.org>)
 id 1kOT5v-0002Ud-Ik
 for qemu-devel@nongnu.org; Fri, 02 Oct 2020 18:00:03 -0400
Received: from mail-oo1-xc41.google.com ([2607:f8b0:4864:20::c41]:43183)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <richard.henderson@linaro.org>)
 id 1kOT5s-0007Lv-Ks
 for qemu-devel@nongnu.org; Fri, 02 Oct 2020 18:00:03 -0400
Received: by mail-oo1-xc41.google.com with SMTP id w25so734987oos.10
 for <qemu-devel@nongnu.org>; Fri, 02 Oct 2020 15:00:00 -0700 (PDT)
Received: from localhost.localdomain (fixed-187-189-51-144.totalplay.net.
 [187.189.51.144])
 by smtp.gmail.com with ESMTPSA id k10sm684268ots.60.2020.10.02.14.59.57
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 02 Oct 2020 14:59:58 -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
 :mime-version:content-transfer-encoding;
 bh=zVLgn+OX/nTD/oUAFauTpXTtA86xiUG6+rSs26rONZM=;
 b=mZf3ei3K0SiIqpW+c5uWCNbm2ueVTT5/vAmHbsu2rR/KjUJHZrOXhkwRax/5I7x3oP
 2Dl9Sq4f1iRROEp8QgfSJRu/U4uv8opg6mRo3zyQEmOhbwMDys6EQ8Ev28eQ/uxCBu0x
 mRjvNGcUgDhRh3e9Fs7J8NaS49+rPfrnWw5DKG19+vLajb+4aOX5SVOLjXLOhbJI++kJ
 V8G6AlBwsILhn3kLOe8ozGtt/3WYwcsjvtleVvnGiKiLNp3nRNcx4V9teyKyHPu/AHhO
 egLqObZdC0c1DJU+oQVQa59HqvYOisS2HkT2AvOb1zjZRHQvPliP57PLHkAF1gZTK0R8
 maZA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=zVLgn+OX/nTD/oUAFauTpXTtA86xiUG6+rSs26rONZM=;
 b=ORwW6NKJtkcvNRg75osZkFJLGKn244V6xVOH9BtTN8h9wCv/vcjTFiJVP4V4KRBFxE
 gd+BI6qcfyYA4rFQaI7IZ5PQxsafGq3BHNWdPRH/qufnCfk73iHAhM7aR2BORwvwhRYx
 TjAPaeZ8iJY4RGm/pKhrcg+jhS6OTJn7ggCZfz2QCuBKxBAVqg6vXTrq+eFNGBagDB/f
 12RUDau5SsVnWvA4uO/+adZyIe/2t1W15ZxwWKH+w4wREbl6/moRxPg+tuPGpyaMIZlx
 sPHpL5bDnRy4KvOBH9Lo5CwKzjYvdVWvZHasHkr7hydyU6ndDyRb/DOfoTazNcHYBlT3
 N5ow==
X-Gm-Message-State: AOAM5324g8F9zii25jXUW1A0Bozii/wi5PV9weSFe1M0st2cTF6s3tt1
 quBEPIoXqaWf7CvXz3uZOi7OSmx5xjy49cUk
X-Google-Smtp-Source: 
 ABdhPJxJAFr0JUaS6cov/1LQ671Bk+7vDG2Ga/BMZ0JmrVqdOhTUGXlMYCYdV/jZkdtiFba6kZf34Q==
X-Received: by 2002:a4a:b40a:: with SMTP id y10mr3402836oon.71.1601675999237;
 Fri, 02 Oct 2020 14:59:59 -0700 (PDT)
From: Richard Henderson <richard.henderson@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PATCH v10 1/8] linux-user/aarch64: Reset btype for signals
Date: Fri,  2 Oct 2020 16:59:48 -0500
Message-Id: <20201002215955.254866-2-richard.henderson@linaro.org>
X-Mailer: git-send-email 2.25.1
In-Reply-To: <20201002215955.254866-1-richard.henderson@linaro.org>
References: <20201002215955.254866-1-richard.henderson@linaro.org>
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17
 as permitted sender) client-ip=209.51.188.17;
 envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org;
 helo=lists.gnu.org;
Received-SPF: pass client-ip=2607:f8b0:4864:20::c41;
 envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc41.google.com
X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache.
 That's all we know.
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no
X-Spam_action: no action
X-BeenThere: qemu-devel@nongnu.org
X-Mailman-Version: 2.1.23
Precedence: list
List-Id: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>
Cc: peter.maydell@linaro.org, qemu-arm@nongnu.org, alex.bennee@linaro.org,
 laurent@vivier.eu
Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org
Sender: "Qemu-devel" <qemu-devel-bounces+importer=patchew.org@nongnu.org>
X-ZohoMail-DKIM: fail (Header signature does not verify)
Content-Type: text/plain; charset="utf-8"

The kernel sets btype for the signal handler as if for a call.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 linux-user/aarch64/signal.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/linux-user/aarch64/signal.c b/linux-user/aarch64/signal.c
index d50c1ae583..b591790c22 100644
--- a/linux-user/aarch64/signal.c
+++ b/linux-user/aarch64/signal.c
@@ -506,10 +506,16 @@ static void target_setup_frame(int usig, struct targe=
t_sigaction *ka,
             + offsetof(struct target_rt_frame_record, tramp);
     }
     env->xregs[0] =3D usig;
-    env->xregs[31] =3D frame_addr;
     env->xregs[29] =3D frame_addr + fr_ofs;
-    env->pc =3D ka->_sa_handler;
     env->xregs[30] =3D return_addr;
+    env->xregs[31] =3D frame_addr;
+    env->pc =3D ka->_sa_handler;
+
+    /* Invoke the signal handler as if by indirect call.  */
+    if (cpu_isar_feature(aa64_bti, env_archcpu(env))) {
+        env->btype =3D 2;
+    }
+
     if (info) {
         tswap_siginfo(&frame->info, info);
         env->xregs[1] =3D frame_addr + offsetof(struct target_rt_sigframe,=
 info);
--=20
2.25.1