From patchwork Tue Jan 8 22:31:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 155033 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp46553jaa; Tue, 8 Jan 2019 14:53:32 -0800 (PST) X-Google-Smtp-Source: ALg8bN6Z+qUDSrdyR/z1U2ireXG37aPGTQrb8vkdIVw2Wn2i9xpU3w6K/5kIkTxPBIVhDoz46er4 X-Received: by 2002:adf:e78f:: with SMTP id n15mr2901346wrm.115.1546988012841; Tue, 08 Jan 2019 14:53:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546988012; cv=none; d=google.com; s=arc-20160816; b=QeQTpfHax+Ni38M3Dy4tuPhtYCaLiBeSTftKG9u4SLN5sAS1BMyvZH1ugyfiMO+m1j YbtA1r4MW85LETJ9Jq33mIdHgvwQ7gdBuBNLfgm7771cShKk/axTTj1k3yGucUEK7HKl J+WZBkptfEidrQm61dcnZlmHVYwoLHe74v456/fY+vtr0tGtpnqmiT7iV8kQS0QLdvJ6 WHiYH87He2CeTNJK80d/mhwOrSSc4PsuWQ5Ww2Os5IAnyGq+ECxc5u/iIJ+G9AKOymEc hvFkh0fQWClj7Dcitf0CcjsHwfhlK+uFYfIZP1cf1gTmWcsNMfnl5GkHz1h4ZLMIh89l avpw== 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:subject:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=Mg19AKP3OnF6DGhhumbtnC9AwmLPjVNrmPOLEIDNGYE=; b=j97XTjCFLbXxu/M2vSn4R8KL1sNXrzsWQnyejrxt8uOZXhzlvYS4dPK4nKTDBXhLk9 HRO1KdpViPL7REm91X426TSSFbicWxBJtYoe4QujI+sWmAoBFJohAZJqoRcokQSJ5yvP qdSsOAWuf3mYV4zf9RxZ3GS6DvHVRVcQP4KyXp5ETnj0qJm8KODaJEcLflWasLD/P4e/ g8quNcIMoO49BJMcYESIra7gF0F+ix/r154o1TNRM6q69LiInqgnihbtu1hxacybLzEP U2LXU2Biv9Jt0QDIUozHCAAVjEGjMwB3SbLUt3cmpeMb2kNofO7Kg7q/x56MErpCUV9S 4HLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="HjSM/PXy"; 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 c24si7362007wmb.197.2019.01.08.14.53.32 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 08 Jan 2019 14:53:32 -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="HjSM/PXy"; 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]:44893 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gh0FX-0002tQ-Q5 for patch@linaro.org; Tue, 08 Jan 2019 17:53:31 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52949) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ggzvM-0000XJ-U7 for qemu-devel@nongnu.org; Tue, 08 Jan 2019 17:32:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ggzvM-00058E-4N for qemu-devel@nongnu.org; Tue, 08 Jan 2019 17:32:40 -0500 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]:43739) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ggzvL-000566-VF for qemu-devel@nongnu.org; Tue, 08 Jan 2019 17:32:40 -0500 Received: by mail-pf1-x441.google.com with SMTP id w73so2598965pfk.10 for ; Tue, 08 Jan 2019 14:32:39 -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; bh=Mg19AKP3OnF6DGhhumbtnC9AwmLPjVNrmPOLEIDNGYE=; b=HjSM/PXym7fby4wIImpBNu78npnJohRW1tov/pyU9JZagm7ZabIiqjLD5xmPTgObnj w49BEGqYRBF4KgdnsJvJTLAXLobB43Yaz6PZzYf1w7Ys8j1WnuO9pP10BeJTmsKEJ1g0 HDTbJxhhbqSYR9kKy+aQle/XJjbzh6jkojPx0= 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; bh=Mg19AKP3OnF6DGhhumbtnC9AwmLPjVNrmPOLEIDNGYE=; b=b4rIPs1DuhSBYiL8bVMXQUlRRnpPFJiH4bz+9eiGeaRHxk1eKVwVTqTPP2LswcnaQR VtG279FVHisFYVbU4Gt1BIJCrUB6aQmhMkBZ0jAE1ZLc4JcXlbPn4NNIwKk/HrDS5cI9 lfiv9Jrkq1r+Qlz5lnQYFQ5QERn8/rsUFOPw54Xo/HNNzg6OxTsXVE39pfRac0yBjx5+ uc5GbsYMfas5X+pgPjUlm8c7zEVpHpRM/6/9cxoZ521F0qEipFo8WBIMJIhdhqYkMJuo vdCTaSPv47GrBT1nyrqxpZ1//kKtEG/Ywd2lM9Tg8yFG63ZxqtGb0CjQQmz+y8TSFiSY wEtw== X-Gm-Message-State: AJcUukc9NLI3/b3qpezxATNGpw37rg+rj06VwUJh+Sw9Z15vrlqb9lQP MSxQxlL27F0huc5nGXy+QplO6JTegGw= X-Received: by 2002:a63:7c6:: with SMTP id 189mr3210108pgh.129.1546986758624; Tue, 08 Jan 2019 14:32:38 -0800 (PST) Received: from cloudburst.lan (2001-44b8-2176-c800-8cc6-2630-7d99-5ef1.static.ipv6.internode.on.net. [2001:44b8:2176:c800:8cc6:2630:7d99:5ef1]) by smtp.gmail.com with ESMTPSA id w128sm100686177pfw.79.2019.01.08.14.32.36 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 08 Jan 2019 14:32:37 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 9 Jan 2019 08:31:22 +1000 Message-Id: <20190108223129.5570-25-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190108223129.5570-1-richard.henderson@linaro.org> References: <20190108223129.5570-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::441 Subject: [Qemu-devel] [PATCH v3 24/31] 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: , Cc: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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 --- target/arm/pauth_helper.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) -- 2.17.2 diff --git a/target/arm/pauth_helper.c b/target/arm/pauth_helper.c index 902f68a24c..e02376a2d0 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,