From patchwork Tue Feb 5 17:04:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 157487 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp5426708jaa; Tue, 5 Feb 2019 09:24:46 -0800 (PST) X-Google-Smtp-Source: AHgI3IZiJWNl3FP9qEu7A4LJShVlSgGZYrjBUGMINiBR5mnigdRWzfYCvhp/p8yHgunbr8xjFmas X-Received: by 2002:a25:e084:: with SMTP id x126mr5056110ybg.502.1549387486777; Tue, 05 Feb 2019 09:24:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549387486; cv=none; d=google.com; s=arc-20160816; b=xyKbb9AU0BzFlMv4d8/qagZCdZ/uKmZqcJjTiBjKBQrKQ1Ma+yPJ0rzFcNCmR5MLu1 wiQkMcsNuIYTQMCd+V80doofuVYuSOUuqmawFJnEQQpUD7ZtufWKbyB57WF/tNJXPTC1 v224DW4bTDV4ua3uXuNbDDx6f8CuPNE8XM/OZJKHt8WUflZVrfH3jZgURbSCDjwGYZmO UT42oR9ey4IHW75/ABYl/ZkvWEAqPhPEIdiLAtqV7kIklEEYMzDFdSIN0W6VoMyUuQ4i BrkWVVSQBDi84q3tkVpxVMQlDkiQQDZyL4uM2gAEKed1FgXAIzopNLws5xH9s6PKb3J0 1ekQ== 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=oqimmOxhlnAPzvnVXysC1gLndndgMG4dqjEyqUjEd04=; b=Vt9Be045OHC2KlrEjZcr1SHsx7+TJstI7qAaIEf7EnppvAi0X1/fXU/enjbgbQRbW7 7wkgKEBEW2LmXlquNg39BBVTuA4zw80ttBgc66QONL9kjS+cljO4sIVwwE7K6G+pFUhN IwrHTuqZ/tTSq+qMkvYPba0Y/VXyGJPM7KNKYATWX7G54/DHpxfi6gDm0k3djuZU/K9c 9sUEX9XDR70UdLb61UZkqmawwG9uAijRkQZdadglCn5JWik3FrvVWdm4gA7XPxpP0t56 FRdg6yunr/tokZLFn53ltXyIEKUiHpz8vRAyiwmBrTepChasI7w4xczCrZwq8FfK+ZXA PtiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=UBHNBEmM; 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 w16si2426337ybg.267.2019.02.05.09.24.46 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 05 Feb 2019 09:24:46 -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=UBHNBEmM; 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]:35441 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gr4Sk-0000lu-7p for patch@linaro.org; Tue, 05 Feb 2019 12:24:46 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35829) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gr4AQ-0001rl-QI for qemu-devel@nongnu.org; Tue, 05 Feb 2019 12:05:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gr4AK-0000VF-J7 for qemu-devel@nongnu.org; Tue, 05 Feb 2019 12:05:48 -0500 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]:36749) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gr4AC-0000Nv-Sv for qemu-devel@nongnu.org; Tue, 05 Feb 2019 12:05:40 -0500 Received: by mail-wr1-x42b.google.com with SMTP id z3so4483221wrv.3 for ; Tue, 05 Feb 2019 09:05:29 -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=oqimmOxhlnAPzvnVXysC1gLndndgMG4dqjEyqUjEd04=; b=UBHNBEmMuKosrrDJnqktaKKjvMH5ZX79+6tL25oI7/J+Qa70mH1fRhCpPrvfyYILg0 rS5t/wImAIlUQy7bTvJsIQ7QSPy/GH/8LxAio3/wAUnlq6QpV/JpLLxqeOPfO632K/n3 UzD9ZbSIXXzkqoAVttK9sLLWXpOqDr5bbH7vRJ7kFNnrM2upKTWgrK3ziZT4TBOOOMgW f4tS/1N3j3XzBWjVKY05J0qKDrQTwVUa0ak03ElLND6WQ5DOpBa1NNSpXZepaEWp83yw ve6Ip3NSTE/F96T8iNHSYz7g4zhx/feZLKKcsN+n+B2FAvit9AHBXjBlPKVV7OEs1Y0T w5Og== 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=oqimmOxhlnAPzvnVXysC1gLndndgMG4dqjEyqUjEd04=; b=iJsrsVqTN0ON24EqZzTG7gVJzlN9rKfs3VU3LBS2OQ47v+ZUKC2m/r/lIyoDfnZ2O+ 5KIpLQf8Xi3eu522vuwyzHd5kE8y5c2CT2XLiqAsfOoIo4Kwbc6SUDgNEBW4Prd6PT+i NEF80LcseUtWl6Oj0labJvbf29MrkWuDfLLrhBcTdM4QVwBfTzdZGyZ+fTR7m43SFfus pG+RSPG7k1AkRa/25gxu/VQjR4Vg1hIbxtlu7d0iXFBZMnKnjHVZMzocWeCec7PwX1fV ZThrGMCjeBqMuDb8sasPgFg5+wT+VEoNqiHmrmxjmsGsHkzWTAYoxbSBNt6TRoqVEQcP 89BA== X-Gm-Message-State: AHQUAuat4SdmOOsa+EBDjb/UiWK8IKidFlzvgLhYgdEKxFhn3UIwRI0p D8FfdIwbsPNSUCoxmGV4UgDupBzEk7lJhQ== X-Received: by 2002:a5d:43cd:: with SMTP id v13mr4586815wrr.194.1549386327796; Tue, 05 Feb 2019 09:05:27 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id w13sm5583164wmf.5.2019.02.05.09.05.25 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Feb 2019 09:05:26 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Date: Tue, 5 Feb 2019 17:04:58 +0000 Message-Id: <20190205170510.21984-11-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190205170510.21984-1-peter.maydell@linaro.org> References: <20190205170510.21984-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::42b Subject: [Qemu-devel] [PULL 10/22] linux-user: Implement PR_PAC_RESET_KEYS 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 Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20190201195404.30486-2-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- linux-user/aarch64/target_syscall.h | 7 ++++++ linux-user/syscall.c | 36 +++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) -- 2.20.1 diff --git a/linux-user/aarch64/target_syscall.h b/linux-user/aarch64/target_syscall.h index 937fd7989e7..b595e5da820 100644 --- a/linux-user/aarch64/target_syscall.h +++ b/linux-user/aarch64/target_syscall.h @@ -22,6 +22,13 @@ struct target_pt_regs { #define TARGET_PR_SVE_SET_VL 50 #define TARGET_PR_SVE_GET_VL 51 +#define TARGET_PR_PAC_RESET_KEYS 54 +# define TARGET_PR_PAC_APIAKEY (1 << 0) +# define TARGET_PR_PAC_APIBKEY (1 << 1) +# define TARGET_PR_PAC_APDAKEY (1 << 2) +# define TARGET_PR_PAC_APDBKEY (1 << 3) +# define TARGET_PR_PAC_APGAKEY (1 << 4) + void arm_init_pauth_key(ARMPACKey *key); #endif /* AARCH64_TARGET_SYSCALL_H */ diff --git a/linux-user/syscall.c b/linux-user/syscall.c index b5786d4fc1f..bf076cbf8c4 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -9691,6 +9691,42 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, } } return ret; + case TARGET_PR_PAC_RESET_KEYS: + { + CPUARMState *env = cpu_env; + ARMCPU *cpu = arm_env_get_cpu(env); + + if (arg3 || arg4 || arg5) { + return -TARGET_EINVAL; + } + if (cpu_isar_feature(aa64_pauth, cpu)) { + int all = (TARGET_PR_PAC_APIAKEY | TARGET_PR_PAC_APIBKEY | + TARGET_PR_PAC_APDAKEY | TARGET_PR_PAC_APDBKEY | + TARGET_PR_PAC_APGAKEY); + if (arg2 == 0) { + arg2 = all; + } else if (arg2 & ~all) { + return -TARGET_EINVAL; + } + if (arg2 & TARGET_PR_PAC_APIAKEY) { + arm_init_pauth_key(&env->apia_key); + } + if (arg2 & TARGET_PR_PAC_APIBKEY) { + arm_init_pauth_key(&env->apib_key); + } + if (arg2 & TARGET_PR_PAC_APDAKEY) { + arm_init_pauth_key(&env->apda_key); + } + if (arg2 & TARGET_PR_PAC_APDBKEY) { + arm_init_pauth_key(&env->apdb_key); + } + if (arg2 & TARGET_PR_PAC_APGAKEY) { + arm_init_pauth_key(&env->apga_key); + } + return 0; + } + } + return -TARGET_EINVAL; #endif /* AARCH64 */ case PR_GET_SECCOMP: case PR_SET_SECCOMP: