From patchwork Fri Jan 25 22:57:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 156646 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp915141jaa; Fri, 25 Jan 2019 15:14:36 -0800 (PST) X-Google-Smtp-Source: ALg8bN7t1XkexcK1tz/uKr6s8UhSmwqbPBZr2hDny7siBC1aB6ARBUuU9qAsi6s1FxlKjJ3G/nNc X-Received: by 2002:a5d:6684:: with SMTP id l4mr14333451wru.154.1548458076811; Fri, 25 Jan 2019 15:14:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548458076; cv=none; d=google.com; s=arc-20160816; b=QNArwoecVqr6PVp2dzq+GhjH9lkFL8IZFm+t50KZPh4N0bECpMokFRwOx+PplrQ65P lPkLZAEsyGSZGC9BwF9iIY+7zo2JeusOFy6+F7geZNarMK6uxmwlGFJBk7a+8iukIPHI by3SJaG28TTXQr1hExdPJdboLwK615Du/ezyms5DN9UddtBAtP+bPtqvWRAuOdEcljK4 pjtLvQpt4a5Eqg5BmetMewXvMP6c9ZENqWCRH0Vb6K/2PaofoxxHfpE/RyYGuDZ+vn8W GL6mFF7pb5sIOou5Umh+fLquSGvITZBH7+rQhOZiUW9b40HUvm5gvHj6bXwg87mejb3h J51Q== 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=MFFzvq6J7keduIziCQ7XWqSanpF0U6tnyZK3H2sjZ3c=; b=dNbUP4kV6azZAaNGYXCZzGO8ZRZOAT2dVLcUQes5ZsOW+liYn3L/JkXBt+8/uSgNdO rNQOFAR6mxeg5P6l/7vdkQkdIsj9CS2x+crO4oW7lLhKpooQqo0PKoCRN51mHJjAS6qG 8pD56bD8m3QcdZKJdqIUGOV5WD9JdkEmlPniVpXo/7UGpHZUoDG8Vgu/gcxT5EeaNz+X SbtIkHdseEsCZ/okE83nHiebLNR1VN/RsudzcIGZpECdj88qLCPHdhZS8HwHR3qP2NhG //pXVF+59hnyWnizVmMofIcaW2PD/7XDDqSdYoe2XWYr61SMBFSJomBaRw7T0QNShKmT Ztyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=WE1C+9nW; 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 m8si55822688wrx.128.2019.01.25.15.14.36 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 25 Jan 2019 15:14:36 -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=WE1C+9nW; 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]:52227 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gnAgF-0006w7-Pr for patch@linaro.org; Fri, 25 Jan 2019 18:14:35 -0500 Received: from eggs.gnu.org ([209.51.188.92]:36014) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gnAe7-0004QF-RN for qemu-devel@nongnu.org; Fri, 25 Jan 2019 18:12:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gnAPd-0005OT-Oq for qemu-devel@nongnu.org; Fri, 25 Jan 2019 17:57:26 -0500 Received: from mail-pl1-x642.google.com ([2607:f8b0:4864:20::642]:38664) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gnAPd-0005Nm-J7 for qemu-devel@nongnu.org; Fri, 25 Jan 2019 17:57:25 -0500 Received: by mail-pl1-x642.google.com with SMTP id e5so5205419plb.5 for ; Fri, 25 Jan 2019 14:57:25 -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=MFFzvq6J7keduIziCQ7XWqSanpF0U6tnyZK3H2sjZ3c=; b=WE1C+9nWeUUeNUEQoNfGUkbnNvLZmpuT4twkVZSfYr6hx8tXbKhJFsM7n/MNymwRJn ByyxFEL4ZniigfVEZkJ7m2Mq33ZuL1QFEWlOBL50eqGJCOVSx7Nqp2Ck1TbZmLgW5zGC nyTHkvWuHZy9Ckx/BCm9A5DesrxAmie5nY6N4= 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=MFFzvq6J7keduIziCQ7XWqSanpF0U6tnyZK3H2sjZ3c=; b=A5vsAhAXEwj+3wRZHyTSLIfFaicgg/D65kN4qV5ICTMDN5tSSqgc6JxCqUZ0oL4Iy8 6/FMMIMR5hQsj2cWLyBcOn5swuRP8fogeJ7QZE6GUjM/3tAV2+ThOaYDihwuKOomsgDl C2mud+YYAuFGrOIB6oDLtzatRHHWHWaEDSXTMORDlnHchtxFASF/8P+T9QeQQNdj/1Sz g9cRtFFZ7wZILsL2OVEc4FQ4H80cZTtvhp0TMuKnd1KIgTe2FlLF7HOsIAcMbgT+E/p/ gHs7ifj9+eAB3IufNHaq2GXzm0xs8I38uY5s9VbzBphyS3aKxldnKi5lMWn2UOb2mard PAgQ== X-Gm-Message-State: AJcUukdepJHB5x5a7LAlspJes0QuyhlloaOx2e6P/uYRyof5NDwCUKaG ADNj0qLiWseZh3cqTpSwmbWofZ4kWLM= X-Received: by 2002:a17:902:e085:: with SMTP id cb5mr12734881plb.24.1548457044128; Fri, 25 Jan 2019 14:57:24 -0800 (PST) Received: from cloudburst.twiddle.net (97-126-115-157.tukw.qwest.net. [97.126.115.157]) by smtp.gmail.com with ESMTPSA id c7sm39148321pfh.18.2019.01.25.14.57.22 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 25 Jan 2019 14:57:23 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 25 Jan 2019 14:57:13 -0800 Message-Id: <20190125225714.10234-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190125225714.10234-1-richard.henderson@linaro.org> References: <20190125225714.10234-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::642 Subject: [Qemu-devel] [PATCH 5/6] 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: , Cc: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson --- linux-user/aarch64/target_syscall.h | 7 ++++++ linux-user/syscall.c | 33 +++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) -- 2.17.2 Reviewed-by: Peter Maydell diff --git a/linux-user/aarch64/target_syscall.h b/linux-user/aarch64/target_syscall.h index 937fd7989e..b595e5da82 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 b5786d4fc1..3e2949aa2f 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -9691,6 +9691,39 @@ 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 (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: