From patchwork Fri Dec 14 05:24:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 153766 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp1685084ljp; Thu, 13 Dec 2018 21:48:35 -0800 (PST) X-Google-Smtp-Source: AFSGD/UBLxG1wDu55sbHzJhwpnle5kJuDGaPDK1NA8vchyGGIcoNzliQel3bLEMQQ1olvfDFSOf8 X-Received: by 2002:a37:2a14:: with SMTP id q20mr1336288qkh.185.1544766515478; Thu, 13 Dec 2018 21:48:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544766515; cv=none; d=google.com; s=arc-20160816; b=WAdbzB3mKhEEMQLl+TYeoENPvWODj8yu8zARJOm5bTnlCbkPAo0yRergJ/fZz1jbnX vjtMjysUjJU6WsnLoUeDiiYN20L//EXP9zu/DGn40DDcfpTVQPwTZrfJ8rA5Z7+eNzas RVhia5qN4oiiqHoZE5L0hbw1gnOwYcEY0kbLxAqDkXZD9WRBvomJAmCw5i4OyIgTgvCT RwhOqbGBqf9dVsTVUXA1/LrNctjdaAQMMlB1jIeh8eSS7408JFbT7rH2+C247/oNjX7X b5GNQ4TvCcVYL12rXelHInD74fO/UNNPPSk5yj1yjnNQt6sAWxBlAFAIxSr1f0dQbn0y 8+Cg== 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=Ukd5Hww0uE7Rkd0I9rxEuSLCu7Rgr66DnlqjrnEw6mc=; b=hY7peGbzOWzu3HBr0LEVcKCNMsmSmutXU/LbNB0d/2IDXLptBfwoPbAJEW4iLD04TE i9ym1har9BYjDTTuhi24RIMchwR3L7BClvQDEYDcD5EYX8qfvV83pSAqOGV/bQpFID+4 NQCNB6FUXNcMq7s/kg11MsSbLCd7ST3spTwcQtQaYdjOAx6fZ4XxTlWAeMgX0mUvrga0 s+M14jmqnP06GkZrk46dpdsMbFCVl7ojUTZGIPNRnG5hiyfiv26NmqaRB9F/N/syHxiw /nLNpSJcB3o3DN/xEcIVrm5M03FrvloZl4TYWQqFs6cXFtFuDWM09vcs3khkojZEdpiw oFpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=cFyvJCkk; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 208.118.235.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. [208.118.235.17]) by mx.google.com with ESMTPS id g14si2429016qti.392.2018.12.13.21.48.35 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 13 Dec 2018 21:48:35 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=cFyvJCkk; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 208.118.235.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]:59548 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gXgKx-0007FA-1g for patch@linaro.org; Fri, 14 Dec 2018 00:48:35 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55887) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gXfxu-0004mf-6W for qemu-devel@nongnu.org; Fri, 14 Dec 2018 00:24:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gXfxo-0005UB-AH for qemu-devel@nongnu.org; Fri, 14 Dec 2018 00:24:46 -0500 Received: from mail-oi1-x243.google.com ([2607:f8b0:4864:20::243]:41519) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gXfxo-0005Sa-2l for qemu-devel@nongnu.org; Fri, 14 Dec 2018 00:24:40 -0500 Received: by mail-oi1-x243.google.com with SMTP id j21so3624865oii.8 for ; Thu, 13 Dec 2018 21:24:36 -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=Ukd5Hww0uE7Rkd0I9rxEuSLCu7Rgr66DnlqjrnEw6mc=; b=cFyvJCkkkbihPbR3F2/fvjzdPF2RBsKVmEPxl/vTZJSRJT7jyffH18A/3xUoLdYwFr sVi1A9Wq22EiwRA3u7a5/zLdQZ5jQF+QGWJ6Z8A895u2oJCPofNkL8v8e9KJuqh0Dvy5 OeQA2ymH7gq3u4RZXJNmQfXU4+0dRkcQQY8NM= 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=Ukd5Hww0uE7Rkd0I9rxEuSLCu7Rgr66DnlqjrnEw6mc=; b=qZp01MVNQ0DO7JrqkE/MGha01VLlQXs0Vpv0jiPgwEwkw6ayy5kK0aWGhb1pR+5uUx pFKl4Rh0k3OlM9pfXakGENJmn5ZRSTKrd7DGOGaFtsDSCJqie7ZRY0kUenICsYrkbTut fUhmmjZctDh53QNjYE8UPapGZglgg8JFN0OMmTttkKArRGOp1ewwWdv5BncBDowTAFOB Wf11mTbFrH6Hqe4uwnG5Xgwez1cZwGKg24E/sVqwgiyrLBzwysdUuBMIlsdgzjoTOgRJ gDWWsxyfCQ6Jmy6yP0TpSQXmdalb3M06lD5TpyYYsqA68qED34wGpI3sPThhIAnfE+WX DnpA== X-Gm-Message-State: AA+aEWYjtBQWE6dEN8vT/wHUirpIZNuN6qrS6JFF7WE+1pueAE7k8WHj MN6rNEPzTOcXfoQIJBUBJSq6L5UiQXB56g== X-Received: by 2002:aca:3092:: with SMTP id w140mr995060oiw.237.1544765075879; Thu, 13 Dec 2018 21:24:35 -0800 (PST) Received: from cloudburst.twiddle.net ([187.217.227.243]) by smtp.gmail.com with ESMTPSA id r1sm1845379oti.44.2018.12.13.21.24.34 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 13 Dec 2018 21:24:35 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 13 Dec 2018 23:24:03 -0600 Message-Id: <20181214052410.11863-21-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181214052410.11863-1-richard.henderson@linaro.org> References: <20181214052410.11863-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::243 Subject: [Qemu-devel] [PATCH v2 20/27] 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. Signed-off-by: Richard Henderson --- target/arm/helper-a64.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) -- 2.17.2 Reviewed-by: Peter Maydell diff --git a/target/arm/helper-a64.c b/target/arm/helper-a64.c index 79cc9cf47b..329af51232 100644 --- a/target/arm/helper-a64.c +++ b/target/arm/helper-a64.c @@ -1069,6 +1069,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) { @@ -1077,7 +1086,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,