From patchwork Fri Jan 18 14:57:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 155983 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3391252jaa; Fri, 18 Jan 2019 07:34:50 -0800 (PST) X-Google-Smtp-Source: ALg8bN7gsG5XAjhq1hbv0KmzkU9KmskkTAxAFsQEA58leg0PluBSIe46VufTbNVtNRgGkimOVkrV X-Received: by 2002:adf:91c3:: with SMTP id 61mr16440255wri.324.1547825690176; Fri, 18 Jan 2019 07:34:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547825690; cv=none; d=google.com; s=arc-20160816; b=UNN2PWMhF++cefLfW8XRgqJ6/LFjn3jZ3YIitGBncm1Z5GJIgDtnIZe7doVTBQUd+v 13zTGSvtcvM7yi1/MxKy9a1vkEwXabfEZ4einKKGDG+cbvoZ1DU1BeIJ772fMJGVMQWC JSIvQtqzR41XcoNlNPiv4Dauc3pAR0Aiumn4ecsUtnKPsjesYcVlVbtJMopQBkdlpwWm zoF6smgJquH5pI6wbDIUtMmY+fy7miq9AmNxK/lpOSoE02/9LTF2GmKr9SD9O7bdUnfj 2dxy58t3/HFB/PZxkUTQ+MC8ayNR5CTaL+mkiKIitAQhksAFWqPzZDoltZvIx4YKKhep QCdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=rgYl7iFi/SFzVLdAXpYU+mmUKKF5k+cFQF/xUVCDN+Q=; b=odcOEJE3koQPWrYzug9ueSqkgeyd+u+dZsXZ2QLzCS09S2/ZmLWdXaoh5nsd5MOtOQ KMbom6Huv8EfRyOEDSmJdfuQOrAjzemrhC5gVWw98/3Q7O6y4dIAqd8jI3xzjY+jxSrN xAnguZCCtSXTIA5WE3N0d2cc3NvuHHsTxh0nXRx/NY90DinPGdR3zCGVn2oJIL0nT1yA fDkJeDr9vcumfN1RtrBP1SgwrSydo0xhqF7GG59SAakthURkA2o0n//aoIvnMhaWi+KR 0/tdPifenDam1S7yMJMnnRG1Lps+YVudevdBP8vIHNObP5XNIonipUN7dkYVQY33J9OP Zaug== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=J7b+m9xI; 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 k12si2434955wrr.19.2019.01.18.07.34.49 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 18 Jan 2019 07:34:50 -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=J7b+m9xI; 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 ([127.0.0.1]:41530 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gkWAT-00075v-5x for patch@linaro.org; Fri, 18 Jan 2019 10:34:49 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43115) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gkVbY-0002od-Cq for qemu-devel@nongnu.org; Fri, 18 Jan 2019 09:58:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gkVbV-0007RT-26 for qemu-devel@nongnu.org; Fri, 18 Jan 2019 09:58:44 -0500 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]:38103) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gkVbU-0007QK-Q3 for qemu-devel@nongnu.org; Fri, 18 Jan 2019 09:58:40 -0500 Received: by mail-wm1-x332.google.com with SMTP id m22so4809925wml.3 for ; Fri, 18 Jan 2019 06:58:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=rgYl7iFi/SFzVLdAXpYU+mmUKKF5k+cFQF/xUVCDN+Q=; b=J7b+m9xIUrf596Q3bBT/kDNSi8TIyShjxlChczCby5ve/Ne/XFdt4iOlqpXbwU0jti 9n2evxeaUYb/NSROYckkz9vuLZtCpU9pO25yJ2V/oCx9FAwl0/UeneBGrsVVPGxfDL2W jwX29LQUvztB5VLIlRnNVADZGag94+mSjkWz8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=rgYl7iFi/SFzVLdAXpYU+mmUKKF5k+cFQF/xUVCDN+Q=; b=gXkvFf8+lV6RmwS8BxDjphtGa+AgexISTpObjs+cuTzoCnanlk+4BCv0QAvPzIfM3m pQqMHJ9YC4FA2Y8E9X46IQzA/8QNltd1RbE6PjmmA82j7i6bInFB2d0c1AsbDAYilFen wnpVQPAq0ou9YutI+32mqSnCFJzFoJ8AJtEWNwnCSpWLW1G4ABDFTBIQZQOlWKYau25Q YVUHjnTkBbEgF2Gm9FbNhGKNCA9aDiYcgN9yMxcP+fCmIt4EoiTSOSUKjH5mD0BouKnZ lBhZb3s324695T4wbHLEDX069nhLPvPam8C0SsVn4gtxD2MikmhDk/wcZcK/8vWJQOdb CcjQ== X-Gm-Message-State: AJcUukd16+FPajGPjRoM4S4aHoG+yUSuezP5fQHqeFZKhwiZGONNU1vS MeMm1VwElIOyMcf/f6oKMAgVl888kujgYw== X-Received: by 2002:a1c:e913:: with SMTP id q19mr16353197wmc.55.1547823519319; Fri, 18 Jan 2019 06:58:39 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id e27sm92094561wra.67.2019.01.18.06.58.38 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 18 Jan 2019 06:58:38 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Date: Fri, 18 Jan 2019 14:57:44 +0000 Message-Id: <20190118145805.6852-29-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190118145805.6852-1-peter.maydell@linaro.org> References: <20190118145805.6852-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::332 Subject: [Qemu-devel] [PULL 28/49] target/arm: Implement pauth_strip 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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Stripping out the authentication data does not require any crypto, it merely requires the virtual address parameters. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20190108223129.5570-25-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/pauth_helper.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) -- 2.20.1 diff --git a/target/arm/pauth_helper.c b/target/arm/pauth_helper.c index 902f68a24cc..e02376a2d02 100644 --- a/target/arm/pauth_helper.c +++ b/target/arm/pauth_helper.c @@ -38,6 +38,15 @@ static uint64_t pauth_addpac(CPUARMState *env, uint64_t ptr, uint64_t modifier, g_assert_not_reached(); /* FIXME */ } +static uint64_t pauth_original_ptr(uint64_t ptr, ARMVAParameters param) +{ + uint64_t extfield = -param.select; + int bot_pac_bit = 64 - param.tsz; + int top_pac_bit = 64 - 8 * param.tbi; + + return deposit64(ptr, bot_pac_bit, top_pac_bit - bot_pac_bit, extfield); +} + static uint64_t pauth_auth(CPUARMState *env, uint64_t ptr, uint64_t modifier, ARMPACKey *key, bool data, int keynumber) { @@ -46,7 +55,10 @@ static uint64_t pauth_auth(CPUARMState *env, uint64_t ptr, uint64_t modifier, static uint64_t pauth_strip(CPUARMState *env, uint64_t ptr, bool data) { - g_assert_not_reached(); /* FIXME */ + ARMMMUIdx mmu_idx = arm_stage1_mmu_idx(env); + ARMVAParameters param = aa64_va_parameters(env, ptr, mmu_idx, data); + + return pauth_original_ptr(ptr, param); } static void QEMU_NORETURN pauth_trap(CPUARMState *env, int target_el,