From nobody Fri Nov 7 15:32:26 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1548458413127632.7226576381073; Fri, 25 Jan 2019 15:20:13 -0800 (PST) Received: from localhost ([127.0.0.1]:52290 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gnAld-0001ow-Se for importer@patchew.org; Fri, 25 Jan 2019 18:20:09 -0500 Received: from eggs.gnu.org ([209.51.188.92]:36023) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gnAe7-0004QH-Tk for qemu-devel@nongnu.org; Fri, 25 Jan 2019 18:12:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gnAPX-0005HB-SJ for qemu-devel@nongnu.org; Fri, 25 Jan 2019 17:57:20 -0500 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]:34248) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gnAPX-0005Fj-LZ for qemu-devel@nongnu.org; Fri, 25 Jan 2019 17:57:19 -0500 Received: by mail-pg1-x543.google.com with SMTP id j10so4797609pga.1 for ; Fri, 25 Jan 2019 14:57:19 -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.17 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 25 Jan 2019 14:57:17 -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=9CGDXRL9RJ71h8U2OmRVl+QRQuVLerVJq7UGYM/rjbk=; b=SehOq6kZpS2ZJGVppZlEa7HbNHywdMVKCBfC9SusxWUxCm/2+z6wWaBOIs/m9sf4GF Wu1fe5KqanGqdN04jy87zynHbZw6d0tVmqR9GLHJjD03hwBHxg71IlQVr6mUY7xbcdcn cBe3EWCfaDA+Vj3ENcKQri18fIx3jx6wQuH3Y= 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=9CGDXRL9RJ71h8U2OmRVl+QRQuVLerVJq7UGYM/rjbk=; b=LFEOgaLbNj9xj2aREMqqzXn/2XmnNQalHCqj9bW+cQ/opYOGqsZTLPfUzpR7Es7yEP K+sxE2XFv0YvTjolt9Hz9X1YX1oC9iWdPryE6LzxGsmafIoSIITVpnvxuExxjilq3tJq CkhY59KeYIzFybnxtzfgnVUz8w1oHJFUUzH9rTYa+YWF7Z4rs5GT8yQ/HeLpIbJdwVDZ BfBolUx/3bhssHBCDzUIk7zE+Mw4xLtlwmjqSFgF1++IqnSKVqIiYiCDdd2C0YdswLzX XeEdXBc/u7Y/cp9gxpITnucP+BVzLV7mxJl0UPyMwJam/MsNuxMys890GL6qjEG9Lhvd t9xg== X-Gm-Message-State: AJcUukfjR6Ukcjp1K2SFLqJEe0WO6lr3c+syp/gVWOnMpC6VBPHT8jHb waHgPNBvUy6aV8VUZlIxuO75NEdPg9s= X-Google-Smtp-Source: ALg8bN4J5pKV1DustyY+l07Prmd/iPUmhHyPggDyddRvsi9aLrp2pdtyVxk00FAvaLW5tW1a5i7azA== X-Received: by 2002:a62:1484:: with SMTP id 126mr12623237pfu.257.1548457038194; Fri, 25 Jan 2019 14:57:18 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 25 Jan 2019 14:57:08 -0800 Message-Id: <20190125225714.10234-2-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::543 Subject: [Qemu-devel] [PATCH 1/6] target/arm: Always enable pac keys for user-only 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Drop the pac properties. This approach cannot work as written because the properties are applied before arm_cpu_reset, which zeros SCTLR_EL1 (amongst everything else). We can re-introduce the properties if they turn out to be useful. But since linux 5.0 enables all of the keys, they may not be. Fixes: 1ae9cfbd470 Signed-off-by: Richard Henderson --- target/arm/cpu.c | 3 +++ target/arm/cpu64.c | 60 ---------------------------------------------- 2 files changed, 3 insertions(+), 60 deletions(-) diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 7e1f3dd637..1e79b97a9c 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -162,6 +162,9 @@ static void arm_cpu_reset(CPUState *s) env->pstate =3D PSTATE_MODE_EL0t; /* Userspace expects access to DC ZVA, CTL_EL0 and the cache ops */ env->cp15.sctlr_el[1] |=3D SCTLR_UCT | SCTLR_UCI | SCTLR_DZE; + /* Enable all PAC keys. */ + env->cp15.sctlr_el[1] |=3D (SCTLR_EnIA | SCTLR_EnIB | + SCTLR_EnDA | SCTLR_EnDB); /* Enable all PAC instructions */ env->cp15.hcr_el2 |=3D HCR_API; env->cp15.scr_el3 |=3D SCR_API; diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c index e9bc461c36..303d0ef075 100644 --- a/target/arm/cpu64.c +++ b/target/arm/cpu64.c @@ -281,38 +281,6 @@ static void cpu_max_set_sve_vq(Object *obj, Visitor *v= , const char *name, error_propagate(errp, err); } =20 -#ifdef CONFIG_USER_ONLY -static void cpu_max_get_packey(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) -{ - ARMCPU *cpu =3D ARM_CPU(obj); - const uint64_t *bit =3D opaque; - bool enabled =3D (cpu->env.cp15.sctlr_el[1] & *bit) !=3D 0; - - visit_type_bool(v, name, &enabled, errp); -} - -static void cpu_max_set_packey(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) -{ - ARMCPU *cpu =3D ARM_CPU(obj); - Error *err =3D NULL; - const uint64_t *bit =3D opaque; - bool enabled; - - visit_type_bool(v, name, &enabled, errp); - - if (!err) { - if (enabled) { - cpu->env.cp15.sctlr_el[1] |=3D *bit; - } else { - cpu->env.cp15.sctlr_el[1] &=3D ~*bit; - } - } - error_propagate(errp, err); -} -#endif - /* -cpu max: if KVM is enabled, like -cpu host (best possible with this ho= st); * otherwise, a CPU with as many features enabled as our emulation support= s. * The version of '-cpu max' for qemu-system-arm is defined in cpu.c; @@ -388,34 +356,6 @@ static void aarch64_max_initfn(Object *obj) */ cpu->ctr =3D 0x80038003; /* 32 byte I and D cacheline size, VIPT i= cache */ cpu->dcz_blocksize =3D 7; /* 512 bytes */ - - /* - * Note that Linux will enable enable all of the keys at once. - * But doing it this way will allow experimentation beyond that. - */ - { - static const uint64_t apia_bit =3D SCTLR_EnIA; - static const uint64_t apib_bit =3D SCTLR_EnIB; - static const uint64_t apda_bit =3D SCTLR_EnDA; - static const uint64_t apdb_bit =3D SCTLR_EnDB; - - object_property_add(obj, "apia", "bool", cpu_max_get_packey, - cpu_max_set_packey, NULL, - (void *)&apia_bit, &error_fatal); - object_property_add(obj, "apib", "bool", cpu_max_get_packey, - cpu_max_set_packey, NULL, - (void *)&apib_bit, &error_fatal); - object_property_add(obj, "apda", "bool", cpu_max_get_packey, - cpu_max_set_packey, NULL, - (void *)&apda_bit, &error_fatal); - object_property_add(obj, "apdb", "bool", cpu_max_get_packey, - cpu_max_set_packey, NULL, - (void *)&apdb_bit, &error_fatal); - - /* Enable all PAC keys by default. */ - cpu->env.cp15.sctlr_el[1] |=3D SCTLR_EnIA | SCTLR_EnIB; - cpu->env.cp15.sctlr_el[1] |=3D SCTLR_EnDA | SCTLR_EnDB; - } #endif =20 cpu->sve_max_vq =3D ARM_MAX_VQ; --=20 2.17.2 From nobody Fri Nov 7 15:32:26 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1548458205443336.07685553262354; Fri, 25 Jan 2019 15:16:45 -0800 (PST) Received: from localhost ([127.0.0.1]:52268 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gnAiE-000863-Dc for importer@patchew.org; Fri, 25 Jan 2019 18:16:38 -0500 Received: from eggs.gnu.org ([209.51.188.92]:36814) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gnAe7-0004sK-Si 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 1gnAPa-0005Kp-A5 for qemu-devel@nongnu.org; Fri, 25 Jan 2019 17:57:23 -0500 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]:46741) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gnAPa-0005JV-3w for qemu-devel@nongnu.org; Fri, 25 Jan 2019 17:57:22 -0500 Received: by mail-pf1-x442.google.com with SMTP id c73so5375584pfe.13 for ; Fri, 25 Jan 2019 14:57:22 -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.19 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 25 Jan 2019 14:57:19 -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=AoUlIdREfrMcATpC0QkDY6roK/ISjyn5UoiOjFo0G40=; b=aQ8e81iI3C5MyavIsKAqBKfzYJBjQ+UG0JO+NNGVXz5cnqyATzDS2sFqSA7CxUeqmm UYw+qrqQRLSr94OmM86q4/9i+NcNnOJl1tDjk3BPAuzlMW8ELGfG7ldI8YqOzNepiJ2F t1VFTuI2Qbij0CXAblZpf1e4O2XDAkiOa0YfQ= 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=AoUlIdREfrMcATpC0QkDY6roK/ISjyn5UoiOjFo0G40=; b=UlBY/vO+a5WJe6uGLF/xHNBwocaIfatn+A3wySn/brkdvG8Cj72Qs9sj31Alk962Hf M8L6mj/hcsCfXuwbxiVz0MMXRKT6VdPeIDdRCx8/vE4CMPaUL9UHKFJk3p8XBTH5CW/Y uk3bR7maQuzhLloQCs9xrkCxIi5kiKGEjtK8ezQ7im+hVYpvJC3fer9UGuVFWKeL5bX3 YE8LBkAnn17LmYBhNN5srhgp8Jdw/kxf8RW0aaJQtSAHhchYsYrP5UoYKqDT8FBdk41b x5uy3IdkCyI5UdanQPS/u/hO2+TyM3t37zk4VwGuG1wHjG7XlA821wM8p+51/ZeKDfW9 NRvQ== X-Gm-Message-State: AJcUukcZ7zBnkr7GWFf2Uv6H55QswkW4o6+poeIQedd/8X/MghvYISlL 4EHzYy+5Z9iMpT0CwHpUirCHVzj9Le0= X-Google-Smtp-Source: ALg8bN5FOqftkg83VAWW0vCucUWWp6qEQTRptl0UosKm9s1ks7tBVN1R0W+6Q38b6NFZLsKMC0E7aQ== X-Received: by 2002:a62:7f93:: with SMTP id a141mr12901689pfd.96.1548457040665; Fri, 25 Jan 2019 14:57:20 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 25 Jan 2019 14:57:10 -0800 Message-Id: <20190125225714.10234-4-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::442 Subject: [Qemu-devel] [PATCH 2/6] aarch64-linux-user: Update HWCAP bits from linux 5.0-rc1 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Richard Henderson Reviewed-by: Laurent Vivier --- linux-user/elfload.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 4cff9e1a31..3c7a7c2836 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -560,6 +560,15 @@ enum { ARM_HWCAP_A64_ASIMDDP =3D 1 << 20, ARM_HWCAP_A64_SHA512 =3D 1 << 21, ARM_HWCAP_A64_SVE =3D 1 << 22, + ARM_HWCAP_A64_ASIMDFHM =3D 1 << 23, + ARM_HWCAP_A64_DIT =3D 1 << 24, + ARM_HWCAP_A64_USCAT =3D 1 << 25, + ARM_HWCAP_A64_ILRCPC =3D 1 << 26, + ARM_HWCAP_A64_FLAGM =3D 1 << 27, + ARM_HWCAP_A64_SSBS =3D 1 << 28, + ARM_HWCAP_A64_SB =3D 1 << 29, + ARM_HWCAP_A64_PACA =3D 1 << 30, + ARM_HWCAP_A64_PACG =3D 1UL << 31, }; =20 #define ELF_HWCAP get_elf_hwcap() --=20 2.17.2 From nobody Fri Nov 7 15:32:26 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1548458335645646.5517691169505; Fri, 25 Jan 2019 15:18:55 -0800 (PST) Received: from localhost ([127.0.0.1]:52280 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gnAkH-0000sj-4X for importer@patchew.org; Fri, 25 Jan 2019 18:18:45 -0500 Received: from eggs.gnu.org ([209.51.188.92]:36634) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gnAe7-0004qA-SL 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 1gnAPc-0005NG-IS for qemu-devel@nongnu.org; Fri, 25 Jan 2019 17:57:25 -0500 Received: from mail-pl1-x644.google.com ([2607:f8b0:4864:20::644]:47007) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gnAPc-0005LI-6e for qemu-devel@nongnu.org; Fri, 25 Jan 2019 17:57:24 -0500 Received: by mail-pl1-x644.google.com with SMTP id t13so5179947ply.13 for ; Fri, 25 Jan 2019 14:57:23 -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.20 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 25 Jan 2019 14:57:21 -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=WSqdNwycYtBIxGSnyv9o57NPJi26gtDbmBqE0+N3heA=; b=JLuHBpEXPqEqMA8SrHnDb4+4CEVols1gw1q1D1MPca+gWxVlz0bQjKFb8TyXvhzgjV tOW4q6v9Jm6e2OpWcLCGPQ4Njtz4k1u3zL4F1tDJx4/EzpnsbPIF7bOJdDodrLHpde9T 6uehCM30OTgOkoT8C5q82Y5JK7BL4K4WQOeps= 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=WSqdNwycYtBIxGSnyv9o57NPJi26gtDbmBqE0+N3heA=; b=fe2F2B7pDCUYCbx7hdjaaVUg070AngT+SZayr2gXVt4JxZd6iCdsckYbmam34g6KoG /QJS5pawVaAECLkbw3+k1bz63h99zBNBFFTtqquLcX/UOWYT/DgcPIdj9rBGV8AqAOUn EYR14DnhRzJytTn+I2ykq2DNgy1ZiYIg1yc5m1jWh5tANk1N5SqQlUn9tujhvyvfKinR SZlWTD47EaXShlFMEwdeODa9jewZ7cxlzIm6DxDXbzemxLya6BXEp2/iIJEObqxWAwUx yLESJ6bTOUSSKxsTLp9aHMg4ziecYu58UZVa02dJNaaXI8ZnOx1P74HbJHu/7vQ6FkEp PiAw== X-Gm-Message-State: AJcUukekgHoJy1s9qDpVjXMGMGBprz4fc18pa/WBc6mu3wN3yNiWF3Ak df+F6rPyN4Zcr/e4yVrBE0qPBKvXSfc= X-Google-Smtp-Source: ALg8bN4zYxjLGNgU9ud4h3CzfhrX/VBEKuVSWDWsm2iMjwDO5pyDN9yaZhJDB1wHQpOTuO8gk74RvA== X-Received: by 2002:a17:902:7588:: with SMTP id j8mr13038984pll.215.1548457041835; Fri, 25 Jan 2019 14:57:21 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 25 Jan 2019 14:57:11 -0800 Message-Id: <20190125225714.10234-5-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::644 Subject: [Qemu-devel] [PATCH 3/6] aarch64-linux-user: Enable HWCAP bits for PAuth 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Richard Henderson --- linux-user/elfload.c | 1 + 1 file changed, 1 insertion(+) diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 3c7a7c2836..775a36ccdd 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -600,6 +600,7 @@ static uint32_t get_elf_hwcap(void) GET_FEATURE_ID(aa64_dp, ARM_HWCAP_A64_ASIMDDP); GET_FEATURE_ID(aa64_fcma, ARM_HWCAP_A64_FCMA); GET_FEATURE_ID(aa64_sve, ARM_HWCAP_A64_SVE); + GET_FEATURE_ID(aa64_pauth, ARM_HWCAP_A64_PACA | ARM_HWCAP_A64_PACG); =20 #undef GET_FEATURE_ID =20 --=20 2.17.2 From nobody Fri Nov 7 15:32:26 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1548458465413525.9823393824036; Fri, 25 Jan 2019 15:21:05 -0800 (PST) Received: from localhost ([127.0.0.1]:52322 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gnAmT-0002Ow-Ci for importer@patchew.org; Fri, 25 Jan 2019 18:21:01 -0500 Received: from eggs.gnu.org ([209.51.188.92]:37822) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gnAe7-0005QF-Rg 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 1gnAPc-0005NL-Iu for qemu-devel@nongnu.org; Fri, 25 Jan 2019 17:57:25 -0500 Received: from mail-pl1-x644.google.com ([2607:f8b0:4864:20::644]:35029) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gnAPc-0005MS-6r for qemu-devel@nongnu.org; Fri, 25 Jan 2019 17:57:24 -0500 Received: by mail-pl1-x644.google.com with SMTP id p8so5208196plo.2 for ; 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.21 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 25 Jan 2019 14:57:22 -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=FuRe0FUWyPAaj4JfHybaq6PMizO+TXX2VIZzLmK06sE=; b=d0BQnnupPDyXVes3guxFslEsJ+tcEGkPoE4viIOnk20+q1JThQMNjx45+sr8mNNifM ZaXv5Ja0wrfpTlmyf+vltkalWwxkAOgrettFgHrio7wh0h2x975Vh0QUN3OaIMqy3uBB eI+/kWoRm2lNdgngus9QuPXVleKF6zSlhq/aY= 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=FuRe0FUWyPAaj4JfHybaq6PMizO+TXX2VIZzLmK06sE=; b=Fv/LA5H9iW6w0Ppk8T3Yt2W2YPgZLjwLRcSL1nZf2VIBbvolmtC0ebAHc9ax1htLm+ OQatsbMqMXVbpTUa/cTs4A5gfxpxu7+cn/ZWdGQNftonqOmvNkrpZAy5sllYgOmGFIw9 NvRe4js0hfiRa7FWH77d98WrNahd3WKzCEy4tKg+l6NPjb3DGcZi8+UH4XP0AXXPqvzb mnCoLUcH4cBaOz0RApCBAqDochbvu9aFgHejqSB256kZbp+043sxYgHgtzDm/GyiIQwr 4+hLslkp7BdS0fXUH0xMCqTsgl9GggB+Q5EHmz64wiyfvxUdLDys+zGWv6oL/FvS7mRQ 8F+A== X-Gm-Message-State: AJcUukeqoEgPASMsmIFDzUooeG1/+UDI86brvb+APCFyCgtNRk3JLi1k giHFrU2difA4pIpyI7JGduwsoPyQUJc= X-Google-Smtp-Source: ALg8bN5IhybgsOh+8cA9XQI2bSPEgu3Je/5Jv+5pmW8C6LSrrxoTtS/gRfBCPRk1448nlsxyNzXANw== X-Received: by 2002:a17:902:a601:: with SMTP id u1mr12883280plq.77.1548457042891; Fri, 25 Jan 2019 14:57:22 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 25 Jan 2019 14:57:12 -0800 Message-Id: <20190125225714.10234-6-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::644 Subject: [Qemu-devel] [PATCH 4/6] linux-user: Initialize aarch64 pac 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Initialize the keys to a non-zero value on process start. Signed-off-by: Richard Henderson --- linux-user/aarch64/target_syscall.h | 2 ++ linux-user/aarch64/cpu_loop.c | 31 +++++++++++++++++++++++++++-- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/linux-user/aarch64/target_syscall.h b/linux-user/aarch64/targe= t_syscall.h index 205265e619..937fd7989e 100644 --- a/linux-user/aarch64/target_syscall.h +++ b/linux-user/aarch64/target_syscall.h @@ -22,4 +22,6 @@ struct target_pt_regs { #define TARGET_PR_SVE_SET_VL 50 #define TARGET_PR_SVE_GET_VL 51 =20 +void arm_init_pauth_key(ARMPACKey *key); + #endif /* AARCH64_TARGET_SYSCALL_H */ diff --git a/linux-user/aarch64/cpu_loop.c b/linux-user/aarch64/cpu_loop.c index 65d815f030..d75fd9d3e2 100644 --- a/linux-user/aarch64/cpu_loop.c +++ b/linux-user/aarch64/cpu_loop.c @@ -147,10 +147,29 @@ void cpu_loop(CPUARMState *env) } } =20 +static uint64_t arm_rand64(void) +{ + int shift =3D 64 - clz64(RAND_MAX); + int i, n =3D 64 / shift + (64 % shift !=3D 0); + uint64_t ret =3D 0; + + for (i =3D 0; i < n; i++) { + ret =3D (ret << shift) | rand(); + } + return ret; +} + +void arm_init_pauth_key(ARMPACKey *key) +{ + key->lo =3D arm_rand64(); + key->hi =3D arm_rand64(); +} + void target_cpu_copy_regs(CPUArchState *env, struct target_pt_regs *regs) { - CPUState *cpu =3D ENV_GET_CPU(env); - TaskState *ts =3D cpu->opaque; + ARMCPU *cpu =3D arm_env_get_cpu(env); + CPUState *cs =3D CPU(cpu); + TaskState *ts =3D cs->opaque; struct image_info *info =3D ts->info; int i; =20 @@ -172,6 +191,14 @@ void target_cpu_copy_regs(CPUArchState *env, struct ta= rget_pt_regs *regs) } #endif =20 + if (cpu_isar_feature(aa64_pauth, cpu)) { + arm_init_pauth_key(&env->apia_key); + arm_init_pauth_key(&env->apib_key); + arm_init_pauth_key(&env->apda_key); + arm_init_pauth_key(&env->apdb_key); + arm_init_pauth_key(&env->apga_key); + } + ts->stack_base =3D info->start_stack; ts->heap_base =3D info->brk; /* This will be filled in on the first SYS_HEAPINFO call. */ --=20 2.17.2 From nobody Fri Nov 7 15:32:26 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1548458145636325.35761273286346; Fri, 25 Jan 2019 15:15:45 -0800 (PST) Received: from localhost ([127.0.0.1]:52262 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gnAhH-0007X5-LQ for importer@patchew.org; Fri, 25 Jan 2019 18:15:39 -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) 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) 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-Google-Smtp-Source: ALg8bN5fMpiImBJA1B41KO5WGhnHKfvlYarqIFQmifP4zKcoVPiMjMZXFaivG7iEjDiT/VCsaY++9w== X-Received: by 2002:a17:902:e085:: with SMTP id cb5mr12734881plb.24.1548457044128; Fri, 25 Jan 2019 14:57:24 -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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- linux-user/aarch64/target_syscall.h | 7 ++++++ linux-user/syscall.c | 33 +++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/linux-user/aarch64/target_syscall.h b/linux-user/aarch64/targe= t_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 =20 +#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); =20 #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 =3D cpu_env; + ARMCPU *cpu =3D arm_env_get_cpu(env); + + if (cpu_isar_feature(aa64_pauth, cpu)) { + int all =3D (TARGET_PR_PAC_APIAKEY | TARGET_PR_PAC_API= BKEY | + TARGET_PR_PAC_APDAKEY | TARGET_PR_PAC_APDBK= EY | + TARGET_PR_PAC_APGAKEY); + if (arg2 =3D=3D 0) { + arg2 =3D 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: --=20 2.17.2 From nobody Fri Nov 7 15:32:26 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 154845804889298.32748294744681; Fri, 25 Jan 2019 15:14:08 -0800 (PST) Received: from localhost ([127.0.0.1]:52212 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gnAfn-0006Oi-Rw for importer@patchew.org; Fri, 25 Jan 2019 18:14:07 -0500 Received: from eggs.gnu.org ([209.51.188.92]:36788) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gnAe4-0004rv-0G for qemu-devel@nongnu.org; Fri, 25 Jan 2019 18:12:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gnAPf-0005Pd-6C for qemu-devel@nongnu.org; Fri, 25 Jan 2019 17:57:31 -0500 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]:42761) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gnAPe-0005Od-So for qemu-devel@nongnu.org; Fri, 25 Jan 2019 17:57:27 -0500 Received: by mail-pl1-x641.google.com with SMTP id y1so5198329plp.9 for ; Fri, 25 Jan 2019 14:57:26 -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.24 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 25 Jan 2019 14:57:24 -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=eAN8JYVbSnX+ldVfWjGFmsPXa8V/C/8OAJUAV3yGxuM=; b=M3AugaO4W12+MtXOmZlLU5wNlbioeVjxVmMPRfAopP20LfqTx0tbbxZDsIfNJp+DCr kB3UdXFNveoLwJH5c/LckscHBy5nI5OTAq7bel/BWaDU3oPlYlGZKRjy3lwLZmI2BigQ 4gXQzBAchpCX0LVdQFY0vjrmAcVm11gGRHX9A= 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=eAN8JYVbSnX+ldVfWjGFmsPXa8V/C/8OAJUAV3yGxuM=; b=tS8lyEYMO5k3xKuDPlVxOjLQivCUMFcdCiuVXKLV4n6KMAD0JZ1B2IR5HHepIaXxwx rMdGS7iPrnmv4oRQrg3LpuOM57JPi320EGq/tFWOwo8TLCcCcLTpk0d6cBqSo8ETm7r/ kyGVpnf5HMquH89LS2m9qRYi6NUKUpzJH3lltp2uMZoQsnkp2q9gqSmONqa4zj0gw4sT TNn8uK/IE60LNGcNe20Uhyo83cExi622/m8/BxlQuIKOAd3tlEHsow8lcnyrCKD7z9Mw Vc9Oz8CfgoZPqP/FFt6zGeOPpkHsSX943upvh0l/lrHCmAzmp6h0kUikwGTU4aQQxToB MwCg== X-Gm-Message-State: AJcUukdijmalDwV2/XPeMxfV2WU4VTvA76djzFJyTf2FPj1IvHIKvPuv rmxyneGJ0y6J9ff1MevFEPFlnYb4W9I= X-Google-Smtp-Source: ALg8bN7mzWvZuJMgF4OCKB6Ibks4HxYcSWd+nhEtieNRO/5Dgd5yyqsqaoETprgYFEkNq4bNazyJHw== X-Received: by 2002:a17:902:584:: with SMTP id f4mr13271405plf.28.1548457045347; Fri, 25 Jan 2019 14:57:25 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 25 Jan 2019 14:57:14 -0800 Message-Id: <20190125225714.10234-8-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::641 Subject: [Qemu-devel] [PATCH 6/6] tests/tcg/aarch64: Add pauth smoke tests 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Richard Henderson Reviewed-by: Alex Benn=C3=A9e --- tests/tcg/aarch64/pauth-1.c | 23 +++++++++++++++++++++++ tests/tcg/aarch64/Makefile.target | 7 ++++++- 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 tests/tcg/aarch64/pauth-1.c diff --git a/tests/tcg/aarch64/pauth-1.c b/tests/tcg/aarch64/pauth-1.c new file mode 100644 index 0000000000..9bd8d28ede --- /dev/null +++ b/tests/tcg/aarch64/pauth-1.c @@ -0,0 +1,23 @@ +#include +#include + +asm(".arch armv8.4-a"); + +#ifndef PR_PAC_RESET_KEYS +#define PR_PAC_RESET_KEYS 54 +#define PR_PAC_APDAKEY (1 << 2) +#endif + +int main() +{ + int x; + void *p0 =3D &x, *p1, *p2; + + asm volatile("pacdza %0" : "=3Dr"(p1) : "0"(p0)); + prctl(PR_PAC_RESET_KEYS, PR_PAC_APDAKEY); + asm volatile("pacdza %0" : "=3Dr"(p2) : "0"(p0)); + + assert(p1 !=3D p0); + assert(p1 !=3D p2); + return 0; +} diff --git a/tests/tcg/aarch64/Makefile.target b/tests/tcg/aarch64/Makefile= .target index 08c45b8470..e80d07276c 100644 --- a/tests/tcg/aarch64/Makefile.target +++ b/tests/tcg/aarch64/Makefile.target @@ -8,10 +8,15 @@ VPATH +=3D $(AARCH64_SRC) # we don't build any of the ARM tests AARCH64_TESTS=3D$(filter-out $(ARM_TESTS), $(TESTS)) AARCH64_TESTS+=3Dfcvt -TESTS:=3D$(AARCH64_TESTS) =20 fcvt: LDFLAGS+=3D-lm =20 run-fcvt: fcvt $(call run-test,$<,$(QEMU) $<, "$< on $(TARGET_NAME)") $(call diff-out,$<,$(AARCH64_SRC)/fcvt.ref) + +AARCH64_TESTS +=3D pauth-1 +pauth-%: CFLAGS +=3D -O -g +run-pauth-%: QEMU +=3D -cpu max + +TESTS:=3D$(AARCH64_TESTS) --=20 2.17.2 From nobody Fri Nov 7 15:32:26 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1548458281974688.4381710804754; Fri, 25 Jan 2019 15:18:01 -0800 (PST) Received: from localhost ([127.0.0.1]:52278 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gnAjT-0000Na-TZ for importer@patchew.org; Fri, 25 Jan 2019 18:17:55 -0500 Received: from eggs.gnu.org ([209.51.188.92]:36371) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gnAe7-0004fe-U5 for qemu-devel@nongnu.org; Fri, 25 Jan 2019 18:12:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gnAPZ-0005Is-0b for qemu-devel@nongnu.org; Fri, 25 Jan 2019 17:57:21 -0500 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]:35164) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gnAPY-0005Hc-PL for qemu-devel@nongnu.org; Fri, 25 Jan 2019 17:57:20 -0500 Received: by mail-pf1-x443.google.com with SMTP id z9so5401640pfi.2 for ; Fri, 25 Jan 2019 14:57:20 -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.18 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 25 Jan 2019 14:57:18 -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=8IXyEG4W5+YDCC6g8DrMGZK0JKjR2WU+35EBVQQqr7w=; b=d8rvM1wa6S6wutcPD09PqP1uYFitV0rOLsOfZetPh6ZBiWCsiicvrcPKVW6JAnGGn+ nc6oJtKZnKQoLgTITZ1VGcQXkiAXB8PGo7SKdepAcYXGV3E8zv+nhrfz9LZbcedRrXoi 42m4rhKJeXI1NiCPYyjzcbIDYU8hXpWppEj6I= 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=8IXyEG4W5+YDCC6g8DrMGZK0JKjR2WU+35EBVQQqr7w=; b=fEZCz1n6Ef7eUWrLPitQHlUz2RYF6Z7EKhgykYASLjDvKWurqvXHUQgK+5CO2X+YJY Wk4LMEX0j3+uMtnHMQDO+wHjy8k9EEHLQHI3Tu5iYbDzkT+R9lBEGGhxsAidDLbSMTUb t3mF02x3Tku/9io1Q/OGQfaPpDqfeLnLL1JVbGQ8mz7OZqgCFIwlyci3dJ6V5lMZSdCh UCMgxSVPXGYLxAwU8YL4VE0ipL6UPf3tmPHQSjIptFHGjkvsMmHcd25ZSINlPhOxRKZF lpxuRG4Mxrt0iJevkQPHRqHY2mX0bVwxMaoMNIAckpH7n/Sn+Kuvoe40VLKfYjKI2mKB sE+g== X-Gm-Message-State: AJcUukdNRMqGKtn6K2njxgaYs4BCX1WhFhoaQVguFk+fkp6g5SGIPaZo Zx4TesU74I7DdaF0BBFBz+8pZRFlaRI= X-Google-Smtp-Source: ALg8bN7Emofugwo7k6F8fF+xILPrApPsp/o+UPt5KjhQs9GCeLJtl4fPWIX+XxnCMJhN2FoxMekngQ== X-Received: by 2002:a62:104a:: with SMTP id y71mr12622147pfi.34.1548457039443; Fri, 25 Jan 2019 14:57:19 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 25 Jan 2019 14:57:09 -0800 Message-Id: <20190125225714.10234-3-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::443 Subject: [Qemu-devel] [PATCH] target/arm: Fix validation of 32-bit address spaces for aa32 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" When tsz =3D=3D 0, aarch32 selects the address space via exclusion, and there are no "top_bits" remaining that require validation. Fixes: ba97be9f4a4 Reported-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/helper.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/target/arm/helper.c b/target/arm/helper.c index 92666e5208..e24689f767 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -10447,7 +10447,7 @@ static bool get_phys_addr_lpae(CPUARMState *env, ta= rget_ulong address, uint64_t ttbr; hwaddr descaddr, indexmask, indexmask_grainsize; uint32_t tableattrs; - target_ulong page_size, top_bits; + target_ulong page_size; uint32_t attrs; int32_t stride; int addrsize, inputsize; @@ -10487,12 +10487,19 @@ static bool get_phys_addr_lpae(CPUARMState *env, = target_ulong address, * We determined the region when collecting the parameters, but we * have not yet validated that the address is valid for the region. * Extract the top bits and verify that they all match select. + * + * For aa32, if inputsize =3D=3D addrsize, then we have selected the + * region by exclusion in aa32_va_parameters and there is no more + * validation to do here. */ - top_bits =3D sextract64(address, inputsize, addrsize - inputsize); - if (-top_bits !=3D param.select || (param.select && !ttbr1_valid)) { - /* In the gap between the two regions, this is a Translation fault= */ - fault_type =3D ARMFault_Translation; - goto do_fault; + if (inputsize < addrsize) { + target_ulong top_bits =3D sextract64(address, inputsize, + addrsize - inputsize); + if (-top_bits !=3D param.select || (param.select && !ttbr1_valid))= { + /* The gap between the two regions is a Translation fault */ + fault_type =3D ARMFault_Translation; + goto do_fault; + } } =20 if (param.using64k) { --=20 2.17.1