Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp2429266lqt; Mon, 22 Apr 2024 10:21:01 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCW4KG0H8mPv6xeLnxr8YF2oFWCtLysXvP+4gER06PjS3AkIYPjaFJEOuY+ybEcVsMosSy5vEdCcg9Zz3AESiUbQATXCkgc3bfYGfbjhhQ== X-Google-Smtp-Source: AGHT+IE3zxtg415eUFlRZuZqg5dnFsWuSZQm8Bi9p228vNNvICakuMBxuo7ZT4sSXm7PxbC8x4T7 X-Received: by 2002:a05:6a20:560b:b0:1a9:83f5:2265 with SMTP id ir11-20020a056a20560b00b001a983f52265mr8654950pzc.55.1713806460799; Mon, 22 Apr 2024 10:21:00 -0700 (PDT) Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id w22-20020a656956000000b005dc4190c756si8640882pgq.866.2024.04.22.10.21.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Apr 2024 10:21:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-153793-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=fail (body hash mismatch); spf=pass (google.com: domain of linux-kernel+bounces-153793-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-153793-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 5D3EF284D44 for ; Mon, 22 Apr 2024 17:21:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 96936153BE1; Mon, 22 Apr 2024 17:20:54 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7F71B153BC6 for ; Mon, 22 Apr 2024 17:20:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713806454; cv=none; b=rhzKandtA29EKhhmcJbS/Lluo5ATSkg0G5QnGFts/NboBTTW+Jx2DEH091GyChkrWRkHRyO2lDeJqmQMeP4WKA1tNUbSAXATwbbFQoQcjBD6CVFVD2NGS2c+58kqJtRrUi9AUZxmgNRz9XsqpoWOsNZY2DX0pwLE5yfPKdXmsrU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713806454; c=relaxed/simple; bh=SlBuGJp6e/gb0sFXKn8EphsybjLeLJHUNFFHJmU3Qeo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=aNvqObFsO/obyWge2xx1cRnYQxfchZ6+6/6MZLSuOx5cfH7qa8SnwE2sZR2Us7rofNIEFKovG7nqFnmQCNuQK+IIzAMrXr2Cq/xPheWhwnTgpkCGnWzqwXsWxSp6yoFkxSroarz2zbIuDiyI4hchqLb8yaJ0+kGLYQCY7kbT44c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E5DCD339; Mon, 22 Apr 2024 10:21:19 -0700 (PDT) Received: from FVFF77S0Q05N (unknown [10.57.21.63]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D9CDA3F7BD; Mon, 22 Apr 2024 10:20:49 -0700 (PDT) Date: Mon, 22 Apr 2024 18:20:40 +0100 From: Mark Rutland To: Arnd Bergmann Cc: Naresh Kamboju , open list , Linux ARM , lkft-triage@lists.linaro.org, Linux Regressions , Anders Roxell , Marc Zyngier , joey.gouly@arm.com, Oliver Upton Subject: Re: gcc-8: arm64/kvm/pauth.: Error: unknown architectural extension `pauth' Message-ID: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Mon, Apr 22, 2024 at 02:11:05PM +0200, Arnd Bergmann wrote: > On Mon, Apr 22, 2024, at 11:40, Mark Rutland wrote: > > On Mon, Apr 22, 2024 at 11:25:25AM +0200, Arnd Bergmann wrote: > >> On Mon, Apr 22, 2024, at 11:13, Mark Rutland wrote: > >> > On Mon, Apr 22, 2024 at 02:04:43PM +0530, Naresh Kamboju wrote: > >> > Given the minimum supported toolchain comes with an assembler that doesn't > >> > necessarily support ARMv8.3, I reckon we'll either have to make NV pauth > >> > support depend upon AS_HAS_ARMV8_3, or manually assemble the PACGA instruction. > >> > > >> > I suspect the latter is the better option. > >> > >> The .config linked from the report shows > >> > >> CONFIG_AS_VERSION=23101 > >> CONFIG_ARM64_PTR_AUTH_KERNEL=y > >> CONFIG_AS_HAS_ARMV8_3=y > >> > >> So it gets detected as supporting ARMv8.3. Is this the wrong > >> conditional to check, or does it get misdetected for an unsupported > >> assembler? > > > > I suspect that means the 'pauth' arch extension was added after armv8.3 > > support, and the assembler supports `-march=armv8.3-a` but does not support > > `.arch_extension pauth`. So for this code, it'd be wrong to check for > > AS_HAS_ARMV8_3, unless we used `.march armv8.3-a`, but even then that'd still > > mean configurations where we couldn't support this code. > > > > I reckon manually assembing the PACGA is the best thing to do; that sidesteps > > the need for either `.arch_extension pauth` or `.march armv8.3-a`, and aligns > > with what we do for CONFIG_ARM64_PTR_AUTH=y generally. > > > > Elsewhere in the kernel where we check for CONFIG_AS_HAS_ARMV8_3, we rely on > > ARM64_ASM_PREAMBLE containing `.arch armv8.3-a` or a later version that implies > > the presence of ARMv8.3-A instructions, and so pauth usage elsewhere is fine. > > I tested with the old binutils versions I have here and found > that anything that supports v8.3 also understands pacga, but > '.arch_extension pauth' only works in binutils-2.35 and higher, > presumably because it started out as a v8.3+ feature but was > later turned into an optional extension for all versions. > > Since there is a Kconfig check for armv8.3-a support already, I think > it's safe to just drop the .arch_extension pauth. That'll be safe, but it does mean that we'd need to *not* support pointer auth for nested virt when we have a toolchain for which CONFIG_AS_HAS_ARMV8_3=n, unless our minimum supported AS supports ARMv8.3. If our minimum supported AS *doesn't* support ARMv8.3, then we'd either need a new Kconfig symbol for NV_PAUTH support, or make CONFIG_ARM64_PTR_AUTH depend upon CONFIG_AS_HAS_ARMV8_3. AFAICT our options are: (a) Manually assembly PACGA (b) Change CONFIG_ARM64_PTR_AUTH to depend upon CONFIG_AS_HAS_ARMV8_3=y (c) Add and use new Kconfig symbol for NV PAUTH, dependent upon CONFIG_AS_HAS_ARMV8_3=y (d) Bump the minimum supported version of AS so that we can depend upon ARMv8.3 support, and just open-code the ".arch armv8.3-a" in the NV pauth code. .. and maybe some variations on that. Mark.