From patchwork Tue Dec 3 02:29:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 180697 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp962556ile; Mon, 2 Dec 2019 19:03:56 -0800 (PST) X-Google-Smtp-Source: APXvYqx0n8QivXS/At9pZ8sLllQezvsc4ynT/bV/cLmwU7TbniFW2+M2Dn3mr2j2+VAaBsIYKXga X-Received: by 2002:a17:906:80ce:: with SMTP id a14mr3593137ejx.118.1575342236835; Mon, 02 Dec 2019 19:03:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575342236; cv=none; d=google.com; s=arc-20160816; b=tP9vt/CV7ZrlaiFwfWRCenIbkp6BqVhJUfsI4WZ0t6bdhM5Zu78JRgJridNl6lkOPc 0ftS9t09/NnexXAMIzHjmb+fBjleLd6uNcIwR6U7SGX1gQ+rm34ZbuwIlbZF74anmpgx BQlVmPhWWytQRuK52pdN4Zz0Xis0yO5CzGljJxI7FgY4ZIMVd8HJJRiuPw8jjAsinc8u MGgE3fnNAm7u/lHOnyWJZdKZjQ47Pe+/9qDLb42ADdPigNGbkD2NXTAhpPyiJGFrX5hN +WSf+OFdV7xxSZorcRdyjlk8ztupm7JocY445Gp+ePc0Fa8z2YGkAEKbPjMtZpmNdlHt RLfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=xGOB5EQSs+V4ihLVGdiYuoWjXTTUG1ZoRZwPeuW4pjQ=; b=qIIktlX28y5DSABeTQMuEgsUAvMiTXMu9uh2Wqk3L/A4jbinFcmpqdnzP8pD8dRzBe 3UUnFf9Sr+FMKvUA29JpA+Cw+lKpYS1SIYbr2xidngLwcmfV9YJsLdQkdJ0qdAK6lnun G+12UIzgjfEVsu/hLAHht9O8WY88tKZvkWkjiZCLPdME+sXJdBXM4DiMyUE9ElX8vXhb Oipzxd/VQggoL0+jgjUy0iYt38KaXpbKrJYbj867WbgA79c5fGAmXiWv9wZiB/W+uQkC 23lwk+MtXG2X6E3Ooee4GnP1O6gY3x/Nz7RTagMR+qmb4NyyQthlbIobsEmhqUr8h5DV zygQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=yWY8UutO; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id dd6si1269635edb.186.2019.12.02.19.03.56 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 02 Dec 2019 19:03:56 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=yWY8UutO; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:47726 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ibyTi-00022w-M1 for patch@linaro.org; Mon, 02 Dec 2019 22:03:54 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33073) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ibxxL-0003Ox-NU for qemu-devel@nongnu.org; Mon, 02 Dec 2019 21:30:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ibxxJ-0000CT-Rw for qemu-devel@nongnu.org; Mon, 02 Dec 2019 21:30:27 -0500 Received: from mail-pj1-x1043.google.com ([2607:f8b0:4864:20::1043]:36163) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ibxxH-00009T-PR for qemu-devel@nongnu.org; Mon, 02 Dec 2019 21:30:24 -0500 Received: by mail-pj1-x1043.google.com with SMTP id n96so827406pjc.3 for ; Mon, 02 Dec 2019 18:30:22 -0800 (PST) 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=xGOB5EQSs+V4ihLVGdiYuoWjXTTUG1ZoRZwPeuW4pjQ=; b=yWY8UutOM1aWN3UdwO8zmSuevfvz90bKyIvRBwd3shDuVuWKfjCH2V0HzTxsVjUSM8 3cgLtg2yMmrn/RoQUelFUOeKgnADU5662U7JK00wf9Ta1ayanpGkpOEK+c6a2xjBb5xA vUBzgBl2RPPkBM1gbDD+dTpi2tm8ZPurkiawJB9V5K+7D9pQ5/gTIn/F3ZECby+C6mgN NUgzrrFUc9iURDGOVKYqMbyWaGrW92Kg8/8YVB+Qt/mjVF3Mkl2+tJf+AeHCXAaFq8jQ OgD44PIb2G6ebwWfrWdm/XyJRTYQ0yaIdbuwzlrqGeufjxwFKTD7ppvfJlFcy+2JvpJb OV6w== 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=xGOB5EQSs+V4ihLVGdiYuoWjXTTUG1ZoRZwPeuW4pjQ=; b=koDpkUcTXFTEy0zkMJsZiS6y3eExhDU6YdJ+5D039KbFMhYrWOpATID1UsKARVk0sD q1lcia42tyNvA5RdGRcb3/XL7BikDKGXT9v0euJWhpTGC45OLVWUgBpFUtDjhvdicJoF UsxuiGexijnGuD+oVvVYaysx+v554oxzmmLDtnqwnKi8d+fEUss8Z8ni3Nrtjq+chTXd pDkx6rcF7QIj8AIdtdqo1Lu70cOqeRh4av1kz+X1R8lwRhmjc9qAfnakbRwATuoL/4Bp XtqNUA1cbyCsDbsF7yXkAoauLuzzKIGmm9wHZrNtY45eVJ6Q3FFDOQrsIYveojPzS+UM Pmrg== X-Gm-Message-State: APjAAAXns7g6GzBXYUjGqPlEYLBjztLx+ny8gmSgQoNcehOqGDNhtCiz jCHcLYuok2opQmRrscq4VeqSzg1wm30= X-Received: by 2002:a17:902:8508:: with SMTP id bj8mr2625098plb.178.1575340221229; Mon, 02 Dec 2019 18:30:21 -0800 (PST) Received: from localhost.localdomain (97-113-7-119.tukw.qwest.net. [97.113.7.119]) by smtp.gmail.com with ESMTPSA id q22sm873695pfg.170.2019.12.02.18.30.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Dec 2019 18:30:20 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v4 33/40] target/arm: check TGE and E2H flags for EL0 pauth traps Date: Mon, 2 Dec 2019 18:29:30 -0800 Message-Id: <20191203022937.1474-34-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191203022937.1474-1-richard.henderson@linaro.org> References: <20191203022937.1474-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::1043 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, alex.bennee@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Alex Bennée According to ARM ARM we should only trap from the EL1&0 regime. Signed-off-by: Alex Bennée Signed-off-by: Richard Henderson --- target/arm/pauth_helper.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) -- 2.17.1 Reviewed-by: Peter Maydell diff --git a/target/arm/pauth_helper.c b/target/arm/pauth_helper.c index 42c9141bb7..c3cb7c8d52 100644 --- a/target/arm/pauth_helper.c +++ b/target/arm/pauth_helper.c @@ -371,7 +371,10 @@ static void pauth_check_trap(CPUARMState *env, int el, uintptr_t ra) if (el < 2 && arm_feature(env, ARM_FEATURE_EL2)) { uint64_t hcr = arm_hcr_el2_eff(env); bool trap = !(hcr & HCR_API); - /* FIXME: ARMv8.1-VHE: trap only applies to EL1&0 regime. */ + if (el == 0) { + /* Trap only applies to EL1&0 regime. */ + trap &= (hcr & (HCR_E2H | HCR_TGE)) != (HCR_E2H | HCR_TGE); + } /* FIXME: ARMv8.3-NV: HCR_NV trap takes precedence for ERETA[AB]. */ if (trap) { pauth_trap(env, 2, ra);