From patchwork Fri Jan 25 22:57:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 156649 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp918482jaa; Fri, 25 Jan 2019 15:18:57 -0800 (PST) X-Google-Smtp-Source: ALg8bN4PQ/n22ZOSVPYMn/gD1bTvmyvxIIN6Z9JoMVQb9ZZfk/z/iWAqzepidP9+1UsR12kFs2RA X-Received: by 2002:adf:b243:: with SMTP id y3mr13572565wra.184.1548458337556; Fri, 25 Jan 2019 15:18:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548458337; cv=none; d=google.com; s=arc-20160816; b=NxM6ssSRfTJm7F8Od9TZPPeOmKcLWkqmdANt/uyck+TJ2FRPqlheaeyTQZpTrkl/Qq dx4MQAzdOtcvG5W8vpBq90W8MYpQ4YvPoPGFBxybkUp125D1MdzRTLMHL2RAIAUc4Dmj NB4syu4DcxDqDcipAcjuqowNcIX7PiJJPHhddHAAQnRgSq1b9iDMLVAShbhvEiPjW/Xw J8i0er23GaA3LIBASztFLwx1qzv4TcSASCXvcM2INdaSZRDgP7tiNFQoIYdHWjUeEnWy snxSFkEnGFBGkaLQYIujBfFY3lxBr1Redf194H/fIQrnAUBAdLjarmQdC3E4/nm91cFf mlrg== 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=9CGDXRL9RJ71h8U2OmRVl+QRQuVLerVJq7UGYM/rjbk=; b=qXHwXIy8/gQRJhFdqie1vCnAmXdZSWUMhnfCRslCgCnNh4U7X61mXPPhJg8b7iYRhv cuOhnexpYmnpW3mfyEFiC5LIaYfcNZUPF0RpxhLdKTcr3ZOb5pt37wzsQmgUEc9h8MWg KzzUz3U/LfwXj46FAvQB4JUWhvdJho6DA5wqo9h9BR6JTMAjh8BKsl/kgLamL08aNYY0 O4ZTjePAiNK2DKrupgiAu6nhNkVZ6UBEw/ZXNmQCTDKUODxCqmsFun3dO33TvrOQCzqa dvtmkmRscgxyRT0Gqt7DT+O05PCO0mDeq/ycalHwY8PaeqlYUPUsiTz8wiKUC29PW8y9 y9lA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=SehOq6kZ; 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 d11si73206889wrq.145.2019.01.25.15.18.57 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 25 Jan 2019 15:18:57 -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=SehOq6kZ; 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]:52284 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gnAkS-0000zz-Fe for patch@linaro.org; Fri, 25 Jan 2019 18:18:56 -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) 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-Received: by 2002:a62:1484:: with SMTP id 126mr12623237pfu.257.1548457038194; Fri, 25 Jan 2019 14:57:18 -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) 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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(-) -- 2.17.2 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 = PSTATE_MODE_EL0t; /* Userspace expects access to DC ZVA, CTL_EL0 and the cache ops */ env->cp15.sctlr_el[1] |= SCTLR_UCT | SCTLR_UCI | SCTLR_DZE; + /* Enable all PAC keys. */ + env->cp15.sctlr_el[1] |= (SCTLR_EnIA | SCTLR_EnIB | + SCTLR_EnDA | SCTLR_EnDB); /* Enable all PAC instructions */ env->cp15.hcr_el2 |= HCR_API; env->cp15.scr_el3 |= 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); } -#ifdef CONFIG_USER_ONLY -static void cpu_max_get_packey(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) -{ - ARMCPU *cpu = ARM_CPU(obj); - const uint64_t *bit = opaque; - bool enabled = (cpu->env.cp15.sctlr_el[1] & *bit) != 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 = ARM_CPU(obj); - Error *err = NULL; - const uint64_t *bit = opaque; - bool enabled; - - visit_type_bool(v, name, &enabled, errp); - - if (!err) { - if (enabled) { - cpu->env.cp15.sctlr_el[1] |= *bit; - } else { - cpu->env.cp15.sctlr_el[1] &= ~*bit; - } - } - error_propagate(errp, err); -} -#endif - /* -cpu max: if KVM is enabled, like -cpu host (best possible with this host); * otherwise, a CPU with as many features enabled as our emulation supports. * 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 = 0x80038003; /* 32 byte I and D cacheline size, VIPT icache */ cpu->dcz_blocksize = 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 = SCTLR_EnIA; - static const uint64_t apib_bit = SCTLR_EnIB; - static const uint64_t apda_bit = SCTLR_EnDA; - static const uint64_t apdb_bit = 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] |= SCTLR_EnIA | SCTLR_EnIB; - cpu->env.cp15.sctlr_el[1] |= SCTLR_EnDA | SCTLR_EnDB; - } #endif cpu->sve_max_vq = ARM_MAX_VQ; From patchwork Fri Jan 25 22:57:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 156647 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp915688jaa; Fri, 25 Jan 2019 15:15:22 -0800 (PST) X-Google-Smtp-Source: ALg8bN76TsinjtveGJXbFaedLE9ZUWBJ1D1JWaS5XmxZMkuXZAnyJoFqGkDDPe28vSPRIOSz89Ka X-Received: by 2002:adf:f9cb:: with SMTP id w11mr12941413wrr.201.1548458122245; Fri, 25 Jan 2019 15:15:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548458122; cv=none; d=google.com; s=arc-20160816; b=i6e1v/tDva9uqnYzZIa4UR6o6uPT2auCE/c0cbO+PFFetA49IX0uaibOzgcM75SVSK LiBvKXpKw+cPndRZIKNom12jdsE835WK2YC+OMjN262so0LgscXRRcRtkGIGARjTD8kW Stsj/jCsY8m3hIL8VTbMHlCCCMSGnItHkgosUIrYT/BwlFO4aOXHbFDAUppyEj8f2Q0W CylFaTJVSePhZZaoZAfEm7h6cG3ebxpbuT0wG2ksBkXmlAGHgXwoUwrtpGBoH/UuCsWw xcsk2BmB4z/mk3k534c+Fp0q5Wh4kbA4KPwj2yokrUBkbQG2v+73bd0LPhGqwZWa39vp BKcA== 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=AoUlIdREfrMcATpC0QkDY6roK/ISjyn5UoiOjFo0G40=; b=ZTk/OpLpmKf3xbkzN5i4PGnapeofvRkBF/lq+aENDVmDAeRqHnkgxD4XcK76uS0GfB WFr30A/bBi9jG21IZS9Eu5WPSLPSpulW7VAMmFjsB+NeEIWHuUuL/NfbuDLhII9Z9UEg 2VKwc2lVzw2wsPY/8BCVa/8WpsTATdVffTYud9HA/KKk+k8Meu3H/ylusO7+cwXMeXfB rbWIY6bXwKeMa4S23h+SVOkd8dcf30Fe/tgSiUToTbb7i6hIyEpg0sV3CV+Xdu54/WPi 6whGTu6pK18DKAUtHmrEfRzMcOmLvdST5n82vVQD5NQLEfBpSXD/WGlFSkSEuwveUpcP UkBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=aQ8e81iI; 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 l19si51872527wrf.109.2019.01.25.15.15.22 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 25 Jan 2019 15:15:22 -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=aQ8e81iI; 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]:52247 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gnAgz-0007Rn-7S for patch@linaro.org; Fri, 25 Jan 2019 18:15:21 -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) 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-Received: by 2002:a62:7f93:: with SMTP id a141mr12901689pfd.96.1548457040665; 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.19 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 25 Jan 2019 14:57:19 -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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson --- linux-user/elfload.c | 9 +++++++++ 1 file changed, 9 insertions(+) -- 2.17.2 Reviewed-by: Laurent Vivier 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 = 1 << 20, ARM_HWCAP_A64_SHA512 = 1 << 21, ARM_HWCAP_A64_SVE = 1 << 22, + ARM_HWCAP_A64_ASIMDFHM = 1 << 23, + ARM_HWCAP_A64_DIT = 1 << 24, + ARM_HWCAP_A64_USCAT = 1 << 25, + ARM_HWCAP_A64_ILRCPC = 1 << 26, + ARM_HWCAP_A64_FLAGM = 1 << 27, + ARM_HWCAP_A64_SSBS = 1 << 28, + ARM_HWCAP_A64_SB = 1 << 29, + ARM_HWCAP_A64_PACA = 1 << 30, + ARM_HWCAP_A64_PACG = 1UL << 31, }; #define ELF_HWCAP get_elf_hwcap() From patchwork Fri Jan 25 22:57:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 156650 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp918847jaa; Fri, 25 Jan 2019 15:19:28 -0800 (PST) X-Google-Smtp-Source: ALg8bN5DxdUGkcq9gDgNcNzgJUQt2iaBbYGyJzhwCP8D/TCv+e34PKUG9fONVwu9zeBupdULgWfr X-Received: by 2002:a1c:4955:: with SMTP id w82mr8820441wma.33.1548458368320; Fri, 25 Jan 2019 15:19:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548458368; cv=none; d=google.com; s=arc-20160816; b=LzScRjX7W4wKEkwXdHAqTrATEsYrH3DlRD+uRLUz3QUN8pw6+DIe5w5tDr8PE/AVr2 ZdM2LgeLh8DI7EA++G8EumgXBRUOBCJpsBrbXNCpYhkjmKagH4ewhil0e/g4Z9AAF1zg zEXmNXJFMrvgZ9zRBDf6BBkXjYDHEknSMgCkb+6gi16eX09vAtKPffuPxcsQitEdHuke 6umTu3CMHRKuSsqlo5F65+NwDNNSK4bMru+6g7mWFKynw55o9KZ0VGoOQ9dCO40k5FMi aGP/E7k1dpG6y7YYnEcNZ0VbawE6Yt037bIa0mvWrNj9wpd2Vg9NwkjnZhtJxld43ME7 iNzg== 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=WSqdNwycYtBIxGSnyv9o57NPJi26gtDbmBqE0+N3heA=; b=mlN/7Vkedb3uuBYu6MLDru9jl9cL/H8FdeiIEHIEa/l9V+ltHTfSW4b7SJpkVB503J /be8WoPfCmCEv1qCL42wSAHiitiggAoydOCO0i1gZGcZboIqBOKI8KrKVb03HgsS1bX9 Zj8GInk4xTSkKAartzu+75DGRxC3cWVtSTuhGxg6vGhxVe6v0BpS1A9+vcZwue7duJEK W75a87Xzo5mY2b4naZsmlwcpa/ilppY8wsBhZl4in7E5ouxUMkkoQnpaqdeK2n7qWg6j Dmv+Lw4KDz0crxTwjV3ArDDHiYUP+P/HRcmzM8xSsy+0Yv33FMkrkwXwR0eynVFqE5qB w44Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=JLuHBpEX; 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 f188si2611608wme.198.2019.01.25.15.19.28 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 25 Jan 2019 15:19:28 -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=JLuHBpEX; 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]:52280 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gnAkx-0000sj-BA for patch@linaro.org; Fri, 25 Jan 2019 18:19:27 -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) 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-Received: by 2002:a17:902:7588:: with SMTP id j8mr13038984pll.215.1548457041835; Fri, 25 Jan 2019 14:57:21 -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) 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson --- linux-user/elfload.c | 1 + 1 file changed, 1 insertion(+) -- 2.17.2 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); #undef GET_FEATURE_ID From patchwork Fri Jan 25 22:57:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 156652 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp920439jaa; Fri, 25 Jan 2019 15:21:35 -0800 (PST) X-Google-Smtp-Source: ALg8bN6dRF8ktKnR3uNtl7FLDfMC2hLLzS0/+lto4fNEb7ghp+5gzCPZX91Zj2kvknx08G55FnFp X-Received: by 2002:a1c:7706:: with SMTP id t6mr8025277wmi.57.1548458495540; Fri, 25 Jan 2019 15:21:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548458495; cv=none; d=google.com; s=arc-20160816; b=kD3ZU7tnPMKthFo7YPx092r4k7e1FfY0q/CbKh5LXqu46tRlzqTz15hvNfVVq8/om5 M687SUwAD6UR2NTc5rSBdshbaZW2PL0q/dW4htb5XvtLaIsatZgfwSHuSE8ORLjZT17p JGVUvzwbWnWYMS8W4/f5sxudKNBxs02X0VIqlSK66Pg9L1Jq/VQboxU0AY/Xd2+PkeGV VLNfMjEwd0H0H7QThnCOLUm3IM45IKJfM2xCuE+9cG2tNy2fe8TycxtLsmbwpvrmM4At uX+2z3WmjrlRWs4Ot1GshalopGlB/7SzBP07Vmm6FdXhmsmG9vfWkS5496Toq/IgljxP gwiA== 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=FuRe0FUWyPAaj4JfHybaq6PMizO+TXX2VIZzLmK06sE=; b=vcNbeJ7fSCWeE7oJMPvt0nRl4F/Ge3RAkeOVGwY/0k0INNz9uz+ebV2AK3m19h1Z8k iWX1P+naK8AL03hw2L56J/AAlCtcXkpdvk1+GlP6P9OJ9Q0q66KOUD7laIUh6ppt31wU 0BRQr7B1RKCEYey33R133TWb4DR7MIuyihtLNj1Yx+gkT4l+0J4MQe2qyEmO3GaV0lJl E4ca5PHI2wt+QMYWmMg0bHi8EAUFmInfmUw612M7yMjkroZATTwKiRLDG8NYxhdGJln0 rA043sh46W1wbN96jVOsp1dsPbqtPpGKywWcyOETvQhyLwd+PovaxVntt1laGkZAOX/6 fBxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=d0BQnnup; 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 f196si44252384wme.198.2019.01.25.15.21.35 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 25 Jan 2019 15:21:35 -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=d0BQnnup; 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]:52322 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gnAn0-0002Ow-Hc for patch@linaro.org; Fri, 25 Jan 2019 18:21:34 -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) 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-Received: by 2002:a17:902:a601:: with SMTP id u1mr12883280plq.77.1548457042891; 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.21 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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(-) -- 2.17.2 diff --git a/linux-user/aarch64/target_syscall.h b/linux-user/aarch64/target_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 +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) } } +static uint64_t arm_rand64(void) +{ + int shift = 64 - clz64(RAND_MAX); + int i, n = 64 / shift + (64 % shift != 0); + uint64_t ret = 0; + + for (i = 0; i < n; i++) { + ret = (ret << shift) | rand(); + } + return ret; +} + +void arm_init_pauth_key(ARMPACKey *key) +{ + key->lo = arm_rand64(); + key->hi = arm_rand64(); +} + void target_cpu_copy_regs(CPUArchState *env, struct target_pt_regs *regs) { - CPUState *cpu = ENV_GET_CPU(env); - TaskState *ts = cpu->opaque; + ARMCPU *cpu = arm_env_get_cpu(env); + CPUState *cs = CPU(cpu); + TaskState *ts = cs->opaque; struct image_info *info = ts->info; int i; @@ -172,6 +191,14 @@ void target_cpu_copy_regs(CPUArchState *env, struct target_pt_regs *regs) } #endif + 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 = info->start_stack; ts->heap_base = info->brk; /* This will be filled in on the first SYS_HEAPINFO call. */ 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: From patchwork Fri Jan 25 22:57:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 156645 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp913841jaa; Fri, 25 Jan 2019 15:12:45 -0800 (PST) X-Google-Smtp-Source: ALg8bN6x6hFPMm49PcQXjUwLvNuZpHtC3ikDq9frWyNkZZJZz4R4Eu1rZSdFyNIQz83ef+t/VkOl X-Received: by 2002:adf:e78f:: with SMTP id n15mr13420716wrm.115.1548457965326; Fri, 25 Jan 2019 15:12:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548457965; cv=none; d=google.com; s=arc-20160816; b=OpAfrcnlZ61pTX1EVPmBOcdrGeQrKbgCqKxojNStsjQAbWuwvLqhCzumZiSGTkw6YN F+6jeK7s1+YIwBN48atVrUMdXy/ZlE2jMHfeOVSjH6lFjhhxE9azZxYNk9iA7eY+FE1L l+XvYBshaoWLC9aT2uPnvtZaJ3NeV5dq+EzEuWq6cV5ctew02Jt/BRZTqIEW+nxvGJkv x5F4UUmuSMeWfo45Lv0v1x3XhfKfRyN8tTbpc5yLzlBJnsYIWYw/Go+vtTads/h0XBtA F7OcJEnPN0/+DlJW+w9tC9bSGRIBir2XBpOaR5ZAHnYngSbz1/jqc35f4Cwh6j8CdM1q Phag== 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=eAN8JYVbSnX+ldVfWjGFmsPXa8V/C/8OAJUAV3yGxuM=; b=K+XyHNM4gfeXGMIECKCT1DUnjXcZnKl4s0H4IHEZImIczlGiPIRVtP3247A8yqljEa gwPfDXSNESweJiBOQrL6voQNsrYrkjejsTpKxTHtJutN90fO+ABWBETylqp3hu+PZ9wN UmiYeRjQYGf55b3DDIXWC0C/NQAoQQbhEmYAfxRND3nwXXZ5rnXNsXo/d0/Aa3j5kweT JL2bUk/1ViPUqA/rSPa7O7gRAoy6/zvEpeQw7RTYteVplqNW0euCC0efMqSZAAAp+UU5 +VcoKSCu0Gi18lNNhQuNlwxAmvqsT8Q5Nhp11+NPvofV2l3IsWJppXVZANsrLbjIcYfj ewlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=M3AugaO4; 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 21si34462388wmw.118.2019.01.25.15.12.45 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 25 Jan 2019 15:12:45 -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=M3AugaO4; 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]:52200 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gnAeS-0005W9-7f for patch@linaro.org; Fri, 25 Jan 2019 18:12:44 -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) 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-Received: by 2002:a17:902:584:: with SMTP id f4mr13271405plf.28.1548457045347; 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.24 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 25 Jan 2019 14:57:24 -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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson --- 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 -- 2.17.2 Reviewed-by: Alex Bennée 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 = &x, *p1, *p2; + + asm volatile("pacdza %0" : "=r"(p1) : "0"(p0)); + prctl(PR_PAC_RESET_KEYS, PR_PAC_APDAKEY); + asm volatile("pacdza %0" : "=r"(p2) : "0"(p0)); + + assert(p1 != p0); + assert(p1 != 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 += $(AARCH64_SRC) # we don't build any of the ARM tests AARCH64_TESTS=$(filter-out $(ARM_TESTS), $(TESTS)) AARCH64_TESTS+=fcvt -TESTS:=$(AARCH64_TESTS) fcvt: LDFLAGS+=-lm run-fcvt: fcvt $(call run-test,$<,$(QEMU) $<, "$< on $(TARGET_NAME)") $(call diff-out,$<,$(AARCH64_SRC)/fcvt.ref) + +AARCH64_TESTS += pauth-1 +pauth-%: CFLAGS += -O -g +run-pauth-%: QEMU += -cpu max + +TESTS:=$(AARCH64_TESTS)