From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 21512C25B78 for ; Tue, 28 May 2024 11:30:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A34386B0088; Tue, 28 May 2024 07:30:15 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9BCB46B0092; Tue, 28 May 2024 07:30:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 85DA66B0095; Tue, 28 May 2024 07:30:15 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 640446B0088 for ; Tue, 28 May 2024 07:30:15 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 03809160458 for ; Tue, 28 May 2024 11:30:14 +0000 (UTC) X-FDA: 82167585990.12.052FA90 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf19.hostedemail.com (Postfix) with ESMTP id 5FA8F1A001B for ; Tue, 28 May 2024 11:30:13 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf19.hostedemail.com: domain of joey.gouly@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=joey.gouly@arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1716895813; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1BSnm6Xa9aXt9o4hhpNhcJXIB5VYhTmEVyMfFruoyqs=; b=IJtuVU484hCjQaOH8TLdBiQN0U3CudHPbV60HPildvseqahU4flInPwi+ZFDEMrTKv/pKO Nn+7gvY/MI2xRqp38Zsjd9VUcD3/hkJQB80SDV6I5dvIFQAv688VOgjscGr/Yb30ixv+3m 3IHFSK96V3TKhNVAf7ff/jDMXhA5HXo= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf19.hostedemail.com: domain of joey.gouly@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=joey.gouly@arm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1716895813; a=rsa-sha256; cv=none; b=Ymn66xPxSiclH++6dckjcXkvdmcaphhcIaJKllXkWhZM0sq1Ilb1kTZ0P2gT1hX3cqX6ak ydVH0gRBX/Rno8ZTtd0K+M4GF96wfeZWtDDlqHmj6a4aY6s5oblO3GJsMe09iSjlhEoE9d Hvo2C+4kukESeMmD8AKj/hMRtg9R+Bk= 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 CDA14339; Tue, 28 May 2024 04:30:36 -0700 (PDT) Received: from e124191.cambridge.arm.com (e124191.cambridge.arm.com [10.1.197.45]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C08213F762; Tue, 28 May 2024 04:30:09 -0700 (PDT) Date: Tue, 28 May 2024 12:30:07 +0100 From: Joey Gouly To: linux-arm-kernel@lists.infradead.org Cc: akpm@linux-foundation.org, aneesh.kumar@kernel.org, aneesh.kumar@linux.ibm.com, bp@alien8.de, broonie@kernel.org, catalin.marinas@arm.com, christophe.leroy@csgroup.eu, dave.hansen@linux.intel.com, hpa@zytor.com, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org, maz@kernel.org, mingo@redhat.com, mpe@ellerman.id.au, naveen.n.rao@linux.ibm.com, npiggin@gmail.com, oliver.upton@linux.dev, shuah@kernel.org, szabolcs.nagy@arm.com, tglx@linutronix.de, will@kernel.org, x86@kernel.org, kvmarm@lists.linux.dev Subject: Re: [PATCH v4 00/29] arm64: Permission Overlay Extension Message-ID: <20240528113007.GB1072039@e124191.cambridge.arm.com> References: <20240503130147.1154804-1-joey.gouly@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240503130147.1154804-1-joey.gouly@arm.com> X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 5FA8F1A001B X-Stat-Signature: zikcheuhacqyhgsn5pc4mbqmkfum9ahy X-HE-Tag: 1716895813-312799 X-HE-Meta: U2FsdGVkX19awnMEs5CkmlC5NtM8yV1eii72zsiP9RnUHC18qVopK9r6pmW/D1JpQNve1BL/loOlC0XsAlL4LcYs8tF8wBFO7PUkou5bHUYX2EgEIoauMDK5WoW15hs9FwTgB8JAOzfpX8RhnXFBH3BL+7XNMNlHVNZal/z/9BAg1EPBJWdw+6kKq4L3sITvjSQUawRzjO4eVmndVy7dhfcKeZ6+E3m+HTk74x+m2ygLpXCjkorOy+IxoFGk8QliJhggW7Q74sz3wxs+V8tfcm4b66BZTsiQsNcky5QPjAP7AK1P927MlajWzxrt4ssIG2yK9hgiswI66GrE3rES2HJoonjpwTmiZNaXDW8mIfES5jfhUJq771gshvTCzW700nVSFhX1Wr+og6YrbW4sJjWVx3OYmtnVER/fyd+ttlWjDtNOMrrLst67o3XhvxFkwKUXyAhLh0febj/YKVYnM5QZiG/CBRtu77oLcSO9zBbBQD+4BYggpNCOJ4DclWEiD3saA4J0b2eirXpBW45cyvohP6s2et1+mMlOzn7X8TiiX51gRZWkd70N93nN4zulw6thMJKudrBAAKHidnJZ0M8BC6acBv40CvMt8BzwzZETzs9MJce9JmvwGifuBpBbNJ8LrV7nUqbpUSVjFXQP45P2I99R5OtrktFq0NNo+7vHT3xbh2mi1W7hAS+L0RpDwI1qWofh5qCLVCz7gPXqayWpkFB0A94N0sN7E89nPpF2lpp15kxmhHwp7AE5RmBrV1jwAAhqJbMmxARAQF/sU5AZKFO0THvKdWfNBT4N1TjiqRtH2RkJHE8lYwRSgBGHNoOUofZgFha0gBiftqvwjBMZOatG6RZLBVUEQb4rrh8fYhgbrXiwKv7OrQqYz9Rdg6hf0NlvBwyrhTb5n2napTZxF+KShhYsMs5N8m+bZWIuvOy8yARPSdd+GzF4sqWXzVITmKcD22hN5Ploqc5 HAUS1/bn s5RGYKt0DuBnuHqpAheRTEvf613pF+F2wdaewmNHaD3npfjZspUtL/Ew9fWypL8UAf34PAF0LGbtA6mwGb3kMDW5Lvqu8+zEcwRNYSCJL7ISewfN0m5HDnqf9Kqr7Mg/B4gxBEWE1mypsz8y+a/HgThuDg+ove43DMeoujNudmyQtrG8= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Fri, May 03, 2024 at 02:01:18PM +0100, Joey Gouly wrote: > Hi all, > > This series implements the Permission Overlay Extension introduced in 2022 > VMSA enhancements [1]. It is based on v6.9-rc5. > > One possible issue with this version, I took the last bit of HWCAP2. > > Changes since v3[2]: > - Moved Kconfig to nearer the end of the series > - Reworked MMU Fault path, to check for POE faults earlier, under the mm lock > - Rework VM_FLAGS to use Kconfig option > - Don't check POR_EL0 in MTE sync tags function > - Reworked KVM to fit into VNCR/VM configuration changes > - Use new AT instruction in KVM > - Rebase onto v6.9-rc5 > > The Permission Overlay Extension allows to constrain permissions on memory > regions. This can be used from userspace (EL0) without a system call or TLB > invalidation. > > POE is used to implement the Memory Protection Keys [3] Linux syscall. > > The first few patches add the basic framework, then the PKEYS interface is > implemented, and then the selftests are made to work on arm64. > > I have tested the modified protection_keys test on x86_64, but not PPC. > I haven't build tested the x86/ppc arch changes. > > Thanks, > Joey I found a silly off by one error, so I will be sending a v5 at some point. > > Joey Gouly (29): > powerpc/mm: add ARCH_PKEY_BITS to Kconfig > x86/mm: add ARCH_PKEY_BITS to Kconfig > mm: use ARCH_PKEY_BITS to define VM_PKEY_BITN > arm64: disable trapping of POR_EL0 to EL2 > arm64: cpufeature: add Permission Overlay Extension cpucap > arm64: context switch POR_EL0 register > KVM: arm64: Save/restore POE registers > KVM: arm64: make kvm_at() take an OP_AT_* > KVM: arm64: use `at s1e1a` for POE > arm64: enable the Permission Overlay Extension for EL0 > arm64: re-order MTE VM_ flags > arm64: add POIndex defines > arm64: convert protection key into vm_flags and pgprot values > arm64: mask out POIndex when modifying a PTE > arm64: handle PKEY/POE faults > arm64: add pte_access_permitted_no_overlay() > arm64: implement PKEYS support > arm64: add POE signal support > arm64: enable PKEY support for CPUs with S1POE > arm64: enable POE and PIE to coexist > arm64/ptrace: add support for FEAT_POE > arm64: add Permission Overlay Extension Kconfig > kselftest/arm64: move get_header() > selftests: mm: move fpregs printing > selftests: mm: make protection_keys test work on arm64 > kselftest/arm64: add HWCAP test for FEAT_S1POE > kselftest/arm64: parse POE_MAGIC in a signal frame > kselftest/arm64: Add test case for POR_EL0 signal frame records > KVM: selftests: get-reg-list: add Permission Overlay registers > > Documentation/arch/arm64/elf_hwcaps.rst | 2 + > arch/arm64/Kconfig | 22 +++ > arch/arm64/include/asm/cpufeature.h | 6 + > arch/arm64/include/asm/el2_setup.h | 10 +- > arch/arm64/include/asm/hwcap.h | 1 + > arch/arm64/include/asm/kvm_asm.h | 3 +- > arch/arm64/include/asm/kvm_host.h | 4 + > arch/arm64/include/asm/mman.h | 8 +- > arch/arm64/include/asm/mmu.h | 1 + > arch/arm64/include/asm/mmu_context.h | 51 ++++++- > arch/arm64/include/asm/pgtable-hwdef.h | 10 ++ > arch/arm64/include/asm/pgtable-prot.h | 8 +- > arch/arm64/include/asm/pgtable.h | 34 ++++- > arch/arm64/include/asm/pkeys.h | 110 ++++++++++++++ > arch/arm64/include/asm/por.h | 33 +++++ > arch/arm64/include/asm/processor.h | 1 + > arch/arm64/include/asm/sysreg.h | 3 + > arch/arm64/include/asm/traps.h | 1 + > arch/arm64/include/asm/vncr_mapping.h | 1 + > arch/arm64/include/uapi/asm/hwcap.h | 1 + > arch/arm64/include/uapi/asm/sigcontext.h | 7 + > arch/arm64/kernel/cpufeature.c | 23 +++ > arch/arm64/kernel/cpuinfo.c | 1 + > arch/arm64/kernel/process.c | 28 ++++ > arch/arm64/kernel/ptrace.c | 46 ++++++ > arch/arm64/kernel/signal.c | 52 +++++++ > arch/arm64/kernel/traps.c | 12 +- > arch/arm64/kvm/hyp/include/hyp/fault.h | 5 +- > arch/arm64/kvm/hyp/include/hyp/sysreg-sr.h | 29 ++++ > arch/arm64/kvm/sys_regs.c | 8 +- > arch/arm64/mm/fault.c | 56 ++++++- > arch/arm64/mm/mmap.c | 9 ++ > arch/arm64/mm/mmu.c | 40 +++++ > arch/arm64/tools/cpucaps | 1 + > arch/powerpc/Kconfig | 4 + > arch/x86/Kconfig | 4 + > fs/proc/task_mmu.c | 2 + > include/linux/mm.h | 20 ++- > include/uapi/linux/elf.h | 1 + > tools/testing/selftests/arm64/abi/hwcap.c | 14 ++ > .../testing/selftests/arm64/signal/.gitignore | 1 + > .../arm64/signal/testcases/poe_siginfo.c | 86 +++++++++++ > .../arm64/signal/testcases/testcases.c | 27 +--- > .../arm64/signal/testcases/testcases.h | 28 +++- > .../selftests/kvm/aarch64/get-reg-list.c | 14 ++ > tools/testing/selftests/mm/Makefile | 2 +- > tools/testing/selftests/mm/pkey-arm64.h | 139 ++++++++++++++++++ > tools/testing/selftests/mm/pkey-helpers.h | 8 + > tools/testing/selftests/mm/pkey-powerpc.h | 3 + > tools/testing/selftests/mm/pkey-x86.h | 4 + > tools/testing/selftests/mm/protection_keys.c | 109 ++++++++++++-- > 51 files changed, 1027 insertions(+), 66 deletions(-) > create mode 100644 arch/arm64/include/asm/pkeys.h > create mode 100644 arch/arm64/include/asm/por.h > create mode 100644 tools/testing/selftests/arm64/signal/testcases/poe_siginfo.c > create mode 100644 tools/testing/selftests/mm/pkey-arm64.h > > -- > 2.25.1 > > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel