[PATCH 14/21] KVM: arm64: Add newly allocated ID registers to register descriptions

2023-10-26 Thread Mark Brown
The 2023 architecture extensions have allocated some new ID registers, add them to the KVM system register descriptions so that they are visible to guests. Signed-off-by: Mark Brown --- arch/arm64/kvm/sys_regs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch

[PATCH 19/21] kselftest/arm64: Add 2023 DPISA hwcap test coverage

2023-10-26 Thread Mark Brown
Add the hwcaps added for the 2023 DPISA extensions to the hwcaps test program. Signed-off-by: Mark Brown --- tools/testing/selftests/arm64/abi/hwcap.c | 217 ++ 1 file changed, 217 insertions(+) diff --git a/tools/testing/selftests/arm64/abi/hwcap.c b/tools/testing

[PATCH 21/21] KVM: arm64: selftests: Teach get-reg-list about FPMR

2023-10-26 Thread Mark Brown
FEAT_FPMR defines a new register FMPR which is available at all ELs and is discovered via ID_AA64PFR2_EL1.FPMR, add this to the set of registers that get-reg-list knows to check for with the required identification register depdendency. Signed-off-by: Mark Brown --- tools/testing/selftests/kvm

[PATCH 20/21] KVM: arm64: selftests: Document feature registers added in 2023 extensions

2023-10-26 Thread Mark Brown
The 2023 architecture extensions allocated some previously usused feature registers, add comments mapping the names in get-reg-list as we do for the other allocated registers. Signed-off-by: Mark Brown --- tools/testing/selftests/kvm/aarch64/get-reg-list.c | 4 ++-- 1 file changed, 2 insertions

Re: [PATCH RFC RFT 2/5] fork: Add shadow stack support to clone3()

2023-10-26 Thread Mark Brown
On Thu, Oct 26, 2023 at 05:10:47PM +, Edgecombe, Rick P wrote: > On Mon, 2023-10-23 at 19:32 +0100, Mark Brown wrote: > > Right.  We're already adding the cost of the extra map_shadow_stack() > > so > > it doesn't seem that out of scope.  We could also allow

Re: [PATCH RFC RFT 2/5] fork: Add shadow stack support to clone3()

2023-10-27 Thread Mark Brown
On Fri, Oct 27, 2023 at 12:49:59PM +0100, szabolcs.n...@arm.com wrote: > The 10/26/2023 13:40, Deepak Gupta wrote: > > In general, I am assuming such placement requirements emanate because > > regular stack holds data (local args, etc) as well and thus software may > > make assumptions about how s

Re: [PATCH v2 15/24] arm64: add POE signal support

2023-10-30 Thread Mark Brown
On Fri, Oct 27, 2023 at 07:08:41PM +0100, Joey Gouly wrote: > Add PKEY support to signals, by saving and restoring POR_EL0 from the > stackframe. Reviewed-by: Mark Brown signature.asc Description: PGP signature

Re: [PATCH v2 21/24] kselftest/arm64: add HWCAP test for FEAT_S1POE

2023-10-30 Thread Mark Brown
On Fri, Oct 27, 2023 at 07:08:47PM +0100, Joey Gouly wrote: > + { > + .name = "POE", > + .at_hwcap = AT_HWCAP2, > + .hwcap_bit = HWCAP2_POE, > + .cpuinfo = "poe", > + .sigill_fn = poe_sigill, > + }, We should set sigill_reliable

Re: [PATCH v2 22/24] kselftest/arm64: parse POE_MAGIC in a signal frame

2023-10-30 Thread Mark Brown
On Fri, Oct 27, 2023 at 07:08:48PM +0100, Joey Gouly wrote: > Teach the signal frame parsing about the new POE frame, avoids warning when it > is generated. Reviewed-by: Mark Brown signature.asc Description: PGP signature

Re: [PATCH v3 3/3] kselftest: Add new test for detecting unprobed Devicetree devices

2023-11-02 Thread Mark Brown
On Thu, Nov 02, 2023 at 07:15:58PM +0530, Naresh Kamboju wrote: > On Thu, 2 Nov 2023 at 17:41, Aishwarya TCV wrote: > > https://storage.kernelci.org/mainline/master/v6.6-9152-gdeefd5024f07/arm64/defconfig%2Bkselftest/gcc-10/logs/kselftest.log ... > May be due to, A loop of symlinks that are poi

Re: selftests: arm64: fp-stress: Unable to handle kernel paging request at virtual address

2023-11-07 Thread Mark Brown
On Tue, Nov 07, 2023 at 06:43:25PM +0530, Naresh Kamboju wrote: > # # SVE-VL-64-0: Expected > [390439044000390480003904c0003904000139044001390480013904c0013904000239044002390480023904c0023904000339044003390480033904c003] > <> You've elided *lots* of error reports from the actual test which su

Re: [PATCH v3 3/3] kselftest: Add new test for detecting unprobed Devicetree devices

2023-11-07 Thread Mark Brown
On Mon, Nov 06, 2023 at 11:09:44AM -0600, Rob Herring wrote: > A simple solution would be instead of passing the source tree root to > dt-extract-compatibles, pass 'arch', 'drivers', and 'sound' instead. > There shouldn't be compatibles anywhere else. This does seem like a reasonable quick fix th

Re: selftests: arm64: fp-stress: Unable to handle kernel paging request at virtual address

2023-11-07 Thread Mark Brown
On Tue, Nov 07, 2023 at 08:14:59PM +0530, Naresh Kamboju wrote: > On Tue, 7 Nov 2023 at 19:51, Mark Brown wrote: > > This all seems very surprising, especially given that AFAICT there are > > no changes in stable-6.6-rc for arch/arm64. > We do not see on the mainline a

Re: WARNING: CPU: 6 PID: 474 at include/linux/maple_tree.h:712 mmap_region (include/linux/maple_tree.h:556 include/linux/maple_tree.h:731

2023-11-09 Thread Mark Brown
On Thu, Nov 09, 2023 at 06:57:08PM +0530, Naresh Kamboju wrote: > Following kernel panic noticed while running selftests: exec: load_address > on Fastmodels (FVP) running Linux next-20231109. > Copying in Kees and Eric who maintain the exec API. > Reported-by: Linux Kernel Functional Testing >

[PATCH v3] KVM: selftests: Initialise dynamically allocated configuration names

2023-11-13 Thread Mark Brown
oduce vcpu configs") Reviewed-by: Andrew Jones Signed-off-by: Mark Brown --- Changes in v3: - Rebase this bugfix onto v6.7-rc1 - Link to v2: https://lore.kernel.org/r/20231017-kvm-get-reg-list-str-init-v2-1-ee30b1df3...@kernel.org Changes in v2: - Update Fixes: tag. - Link to

[PATCH v2 00/21] arm64: Support for 2023 DPISA extensions

2023-11-14 Thread Mark Brown
ogram that duplicates the boilerplace for tracing a target and doesn't actually run the traced program. Signed-off-by: Mark Brown --- Changes in v2: - Rebase onto v6.7-rc1. - Link to v1: https://lore.kernel.org/r/20231026-arm64-2023-dpisa-v1-0-8470dd989...@kernel.org --- Mark Brown (21): ar

[PATCH v2 01/21] arm64/sysreg: Add definition for ID_AA64PFR2_EL1

2023-11-14 Thread Mark Brown
DDI0601 2023-09 defines a new system register ID_AA64PFR2_EL1 which enumerates FPMR and some new MTE features. Add a definition of this register. Signed-off-by: Mark Brown --- arch/arm64/tools/sysreg | 21 + 1 file changed, 21 insertions(+) diff --git a/arch/arm64/tools

[PATCH v2 03/21] arm64/sysreg: Add definition for ID_AA64ISAR3_EL1

2023-11-14 Thread Mark Brown
DDI0601 2023-09 adds a new system register ID_AA64ISAR3_EL1 enumerating new floating point and TLB invalidation features. Add a defintion for it. Signed-off-by: Mark Brown --- arch/arm64/tools/sysreg | 17 + 1 file changed, 17 insertions(+) diff --git a/arch/arm64/tools/sysreg

[PATCH v2 04/21] arm64/sysreg: Add definition for ID_AA64FPFR0_EL1

2023-11-14 Thread Mark Brown
DDI0601 2023-09 defines a new feature register ID_AA64FPFR0_EL1 which enumerates a number of FP8 related features. Add a definition for it. Signed-off-by: Mark Brown --- arch/arm64/tools/sysreg | 29 + 1 file changed, 29 insertions(+) diff --git a/arch/arm64/tools

[PATCH v2 02/21] arm64/sysreg: Update ID_AA64ISAR2_EL1 defintion for DDI0601 2023-09

2023-11-14 Thread Mark Brown
DDI0601 2023-09 defines some new fields in previously RES0 space in ID_AA64ISAR2_EL1, together with one new enum value. Update the system register definition to reflect this. Signed-off-by: Mark Brown --- arch/arm64/tools/sysreg | 24 ++-- 1 file changed, 22 insertions(+), 2

[PATCH v2 05/21] arm64/sysreg: Update ID_AA64SMFR0_EL1 definition for DDI0601 2023-09

2023-11-14 Thread Mark Brown
The 2023-09 release of DDI0601 defines a number of new feature enumeration fields in ID_AA64SMFR0_EL1. Add these fields. Signed-off-by: Mark Brown --- arch/arm64/tools/sysreg | 30 +++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/arch/arm64/tools

[PATCH v2 06/21] arm64/sysreg: Update SCTLR_EL1 for DDI0601 2023-09

2023-11-14 Thread Mark Brown
DDI0601 2023-09 defines some new fields in SCTLR_EL1 controlling new MTE and floating point features. Update our sysreg definition to reflect these. Signed-off-by: Mark Brown --- arch/arm64/tools/sysreg | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/arm64/tools

[PATCH v2 08/21] arm64/sysreg: Add definition for FPMR

2023-11-14 Thread Mark Brown
DDI0601 2023-09 defines a new sysrem register FPMR (Floating Point Mode Register) which configures the new FP8 features. Add a definition of this register. Signed-off-by: Mark Brown --- arch/arm64/tools/sysreg | 23 +++ 1 file changed, 23 insertions(+) diff --git a/arch

[PATCH v2 07/21] arm64/sysreg: Update HCRX_EL2 definition for DDI0601 2023-09

2023-11-14 Thread Mark Brown
DDI0601 2023-09 defines new fields in HCRX_EL2 controlling access to new system registers, update our definition of HCRX_EL2 to reflect this. Signed-off-by: Mark Brown --- arch/arm64/tools/sysreg | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/arm64/tools/sysreg b

[PATCH v2 09/21] arm64/cpufeature: Hook new identification registers up to cpufeature

2023-11-14 Thread Mark Brown
The 2023 architecture extensions have defined several new ID registers, hook them up to the cpufeature code so we can add feature checks and hwcaps based on their contents. Signed-off-by: Mark Brown --- arch/arm64/include/asm/cpu.h | 3 +++ arch/arm64/kernel/cpufeature.c | 28

[PATCH v2 11/21] arm64/fpsimd: Support FEAT_FPMR

2023-11-14 Thread Mark Brown
means that it is not practical to extend that directly. Signed-off-by: Mark Brown --- arch/arm64/include/asm/cpufeature.h | 5 + arch/arm64/include/asm/fpsimd.h | 2 ++ arch/arm64/include/asm/kvm_host.h | 1 + arch/arm64/include/asm/processor.h | 2 ++ arch/arm64/kernel/cpufeature.c

[PATCH v2 12/21] arm64/signal: Add FPMR signal handling

2023-11-14 Thread Mark Brown
Expose FPMR in the signal context on systems where it is supported. The kernel validates the exact size of the FPSIMD registers so we can't readily add it to fpsimd_context without disruption. Signed-off-by: Mark Brown --- arch/arm64/include/uapi/asm/sigcontext.h | 8 + arch/arm64/k

[PATCH v2 13/21] arm64/ptrace: Expose FPMR via ptrace

2023-11-14 Thread Mark Brown
Add a new regset to expose FPMR via ptrace. It is not added to the FPSIMD registers since that structure is exposed elsewhere without any allowance for extension we don't add there. Signed-off-by: Mark Brown --- arch/arm64/kernel/ptrace.c | 42 ++ in

[PATCH v2 10/21] arm64/fpsimd: Enable host kernel access to FPMR

2023-11-14 Thread Mark Brown
. Signed-off-by: Mark Brown --- arch/arm64/include/asm/kvm_arm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/include/asm/kvm_arm.h b/arch/arm64/include/asm/kvm_arm.h index b85f46a73e21..9f9239d86900 100644 --- a/arch/arm64/include/asm/kvm_arm.h +++ b/arch/arm64/include

[PATCH v2 15/21] KVM: arm64: Support FEAT_FPMR for guests

2023-11-14 Thread Mark Brown
FPMR specific trap and rely on the floating point access trap to detect guest floating point usage. Signed-off-by: Mark Brown --- arch/arm64/include/asm/kvm_arm.h| 2 +- arch/arm64/include/asm/kvm_host.h | 4 +++- arch/arm64/kvm/fpsimd.c | 20

[PATCH v2 14/21] KVM: arm64: Add newly allocated ID registers to register descriptions

2023-11-14 Thread Mark Brown
The 2023 architecture extensions have allocated some new ID registers, add them to the KVM system register descriptions so that they are visible to guests. Signed-off-by: Mark Brown --- arch/arm64/kvm/sys_regs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch

[PATCH v2 18/21] kselftest/arm64: Add basic FPMR test

2023-11-14 Thread Mark Brown
Verify that a FPMR frame is generated on systems that support FPMR and not generated otherwise. Signed-off-by: Mark Brown --- tools/testing/selftests/arm64/signal/.gitignore| 1 + .../arm64/signal/testcases/fpmr_siginfo.c | 82 ++ 2 files changed, 83 insertions

[PATCH v2 17/21] kselftest/arm64: Handle FPMR context in generic signal frame parser

2023-11-14 Thread Mark Brown
Teach the generic signal frame parsing code about the newly added FPMR frame, avoiding warnings every time one is generated. Signed-off-by: Mark Brown --- tools/testing/selftests/arm64/signal/testcases/testcases.c | 8 tools/testing/selftests/arm64/signal/testcases/testcases.h | 1 + 2

[PATCH v2 19/21] kselftest/arm64: Add 2023 DPISA hwcap test coverage

2023-11-14 Thread Mark Brown
Add the hwcaps added for the 2023 DPISA extensions to the hwcaps test program. Signed-off-by: Mark Brown --- tools/testing/selftests/arm64/abi/hwcap.c | 217 ++ 1 file changed, 217 insertions(+) diff --git a/tools/testing/selftests/arm64/abi/hwcap.c b/tools/testing

[PATCH v2 16/21] arm64/hwcap: Define hwcaps for 2023 DPISA features

2023-11-14 Thread Mark Brown
The 2023 architecture extensions include a large number of floating point features, most of which simply add new instructions. Add hwcaps so that userspace can enumerate these features. Signed-off-by: Mark Brown --- Documentation/arch/arm64/elf_hwcaps.rst | 49

[PATCH v2 20/21] KVM: arm64: selftests: Document feature registers added in 2023 extensions

2023-11-14 Thread Mark Brown
The 2023 architecture extensions allocated some previously usused feature registers, add comments mapping the names in get-reg-list as we do for the other allocated registers. Signed-off-by: Mark Brown --- tools/testing/selftests/kvm/aarch64/get-reg-list.c | 4 ++-- 1 file changed, 2 insertions

[PATCH v2 21/21] KVM: arm64: selftests: Teach get-reg-list about FPMR

2023-11-14 Thread Mark Brown
FEAT_FPMR defines a new register FMPR which is available at all ELs and is discovered via ID_AA64PFR2_EL1.FPMR, add this to the set of registers that get-reg-list knows to check for with the required identification register depdendency. Signed-off-by: Mark Brown --- tools/testing/selftests/kvm

[PATCH RFC RFT v2 0/5] fork: Support shadow stacks in clone3()

2023-11-14 Thread Mark Brown
GCS series and since we need to detect if shadow stacks are supported it seemed sensible to roll it in here. [1] https://lore.kernel.org/r/20231009-arm64-gcs-v6-0-78e55deaa...@kernel.org/ Signed-off-by: Mark Brown --- Changes in v2: - Rebase onto v6.7-rc1. - Remove ability to provide preallocated sha

[PATCH RFC RFT v2 1/5] mm: Introduce ARCH_HAS_USER_SHADOW_STACK

2023-11-14 Thread Mark Brown
Since multiple architectures have support for shadow stacks and we need to select support for this feature in several places in the generic code provide a generic config option that the architectures can select. Suggested-by: David Hildenbrand Signed-off-by: Mark Brown --- arch/x86/Kconfig

[PATCH RFC RFT v2 2/5] fork: Add shadow stack support to clone3()

2023-11-14 Thread Mark Brown
that into the shadow stack code rather than individual fields. Signed-off-by: Mark Brown --- arch/x86/include/asm/shstk.h | 11 +++ arch/x86/kernel/process.c| 2 +- arch/x86/kernel/shstk.c | 30 +- include/linux/sched/task.h | 2 ++ include/uapi

[PATCH RFC RFT v2 3/5] selftests/clone3: Factor more of main loop into test_clone3()

2023-11-14 Thread Mark Brown
change. Signed-off-by: Mark Brown --- tools/testing/selftests/clone3/clone3.c | 77 - 1 file changed, 37 insertions(+), 40 deletions(-) diff --git a/tools/testing/selftests/clone3/clone3.c b/tools/testing/selftests/clone3/clone3.c index 3c9bf0cd82a8..1108bd8e36d6

[PATCH RFC RFT v2 4/5] selftests/clone3: Allow tests to flag if -E2BIG is a valid error code

2023-11-14 Thread Mark Brown
lone3() may return -E2BIG due to the use of newer struct versions. Currently no tests need this but it will become an issue for testing clone3() support for shadow stacks, the support for shadow stacks is already present on x86. Signed-off-by: Mark Brown --- tools/testing/selftests/clone3/clone3.

[PATCH RFC RFT v2 5/5] kselftest/clone3: Test shadow stack support

2023-11-14 Thread Mark Brown
map_shadow_stack(). Signed-off-by: Mark Brown --- tools/testing/selftests/clone3/clone3.c | 68 +++ tools/testing/selftests/clone3/clone3_selftests.h | 7 +++ 2 files changed, 75 insertions(+) diff --git a/tools/testing/selftests/clone3/clone3.c b/tools/testing/selftests

Re: [PATCH RFC RFT v2 2/5] fork: Add shadow stack support to clone3()

2023-11-15 Thread Mark Brown
On Wed, Nov 15, 2023 at 12:45:45AM +, Edgecombe, Rick P wrote: > On Tue, 2023-11-14 at 20:05 +0000, Mark Brown wrote: > > +   if (size < 8) > > +   return (unsigned long)ERR_PTR(-EINVAL); > What is the intention here? The check in map_sha

Re: [PATCH RFC RFT v2 5/5] kselftest/clone3: Test shadow stack support

2023-11-15 Thread Mark Brown
On Tue, Nov 14, 2023 at 11:11:58PM +, Edgecombe, Rick P wrote: > On Tue, 2023-11-14 at 20:05 +0000, Mark Brown wrote: > > +   shadow_stack = syscall(__NR_map_shadow_stack, 0, > > getpagesize(), 0); > Hmm, x86 fails this call if user shadow stack is not supported in the

[PATCH] kselftest/clone3: Make test names for set_tid test stable

2023-11-15 Thread Mark Brown
simply not logged at all when skipped and all are logged with different names) but these are less disruptive since the skips are all based on not being run as root, a condition likely to be stable for a given test system. Signed-off-by: Mark Brown --- tools/testing/selftests/clone3/clone3_set_tid.c

Re: [PATCH RFC RFT v2 1/5] mm: Introduce ARCH_HAS_USER_SHADOW_STACK

2023-11-15 Thread Mark Brown
On Tue, Nov 14, 2023 at 11:22:16PM +, Edgecombe, Rick P wrote: > On Tue, 2023-11-14 at 20:05 +0000, Mark Brown wrote: > > +config ARCH_HAS_USER_SHADOW_STACK > > +   bool > > +   help > > + The architecture has hardware support for userspace shadow >

Re: [PATCH RFC RFT v2 2/5] fork: Add shadow stack support to clone3()

2023-11-15 Thread Mark Brown
On Wed, Nov 15, 2023 at 04:20:12PM +, szabolcs.n...@arm.com wrote: > The 11/15/2023 12:36, Mark Brown wrote: > > On Wed, Nov 15, 2023 at 12:45:45AM +, Edgecombe, Rick P wrote: > > > On Tue, 2023-11-14 at 20:05 +, Mark Brown wrote: > > > >

Re: [PATCH 1/3] MAINTAINERS: Introduce V: field for required tests

2023-11-15 Thread Mark Brown
On Wed, Nov 15, 2023 at 10:31:21AM -0800, Joe Perches wrote: > On Wed, 2023-11-15 at 19:43 +0200, Nikolai Kondrashov wrote: > > Introduce a new 'V:' ("Verify") field to MAINTAINERS. The field accepts > > a name of a test suite which is required to be executed for each > > contribution to the subsys

Re: [PATCH 1/3] MAINTAINERS: Introduce V: field for required tests

2023-11-15 Thread Mark Brown
On Wed, Nov 15, 2023 at 07:43:49PM +0200, Nikolai Kondrashov wrote: > Introduce a new tag, 'Tested-with:', documented in the > Documentation/process/submitting-patches.rst file. The tag is expected > to reference the documented test suites, similarly to the 'V:' field, > and to certify that the su

Re: [PATCH RFC RFT v2 2/5] fork: Add shadow stack support to clone3()

2023-11-16 Thread Mark Brown
On Thu, Nov 16, 2023 at 10:32:06AM +, szabolcs.n...@arm.com wrote: > The 11/16/2023 00:52, Edgecombe, Rick P wrote: > > On Wed, 2023-11-15 at 18:43 +0000, Mark Brown wrote: > while CLONE_VFORK allows the child to use the parent shadow > stack (parent and child cannot execute a

[PATCH] kselftest/arm64: Fix output formatting for za-fork

2023-11-16 Thread Mark Brown
The za-fork test does not output a newline when reporting the result of the one test it runs, causing the counts printed by kselftest to be included in the test name. Add the newline. Signed-off-by: Mark Brown --- tools/testing/selftests/arm64/fp/za-fork.c | 2 +- 1 file changed, 1 insertion

Re: [PATCH 1/3] MAINTAINERS: Introduce V: field for required tests

2023-11-16 Thread Mark Brown
On Thu, Nov 16, 2023 at 02:14:24PM +0200, Nikolai Kondrashov wrote: > Yes, that would be better indeed. However, checkpatch.pl doesn't process > cover letters, and so we would have no automated way to advertise and nudge > people towards testing. Back when I used to run checkpatch it seemed to co

Re: [PATCH RFC RFT v2 2/5] fork: Add shadow stack support to clone3()

2023-11-16 Thread Mark Brown
On Thu, Nov 16, 2023 at 01:55:07PM +, szabolcs.n...@arm.com wrote: > The 11/16/2023 12:33, Mark Brown wrote: > > On Thu, Nov 16, 2023 at 10:32:06AM +, szabolcs.n...@arm.com wrote: > > > i guess the tricky case is stack!=0 && shadow_stack_size==0: > > > t

Re: [PATCH RFC RFT v2 2/5] fork: Add shadow stack support to clone3()

2023-11-16 Thread Mark Brown
On Thu, Nov 16, 2023 at 12:52:09AM +, Edgecombe, Rick P wrote: > On Wed, 2023-11-15 at 18:43 +0000, Mark Brown wrote: > > > end marker token (0) needs it i guess. > > x86 doesn't currently have end markers.  Actually, that's a point - > > should we add a

Re: [PATCH RFC RFT v2 2/5] fork: Add shadow stack support to clone3()

2023-11-16 Thread Mark Brown
On Thu, Nov 16, 2023 at 06:11:17PM +, Edgecombe, Rick P wrote: > Now that I've thought about it more, removing the CLONE_VFORK part of > the logic has several downsides. It is a little extra work to create > and unmap a shadow stack for an operation that is supposed to be this > limited fast t

Re: [PATCH 1/3] MAINTAINERS: Introduce V: field for required tests

2023-11-20 Thread Mark Brown
On Mon, Nov 20, 2023 at 12:40:39PM +, Gustavo Padovan wrote: > I also wonder how to make for subsystems that will have different test > suites (eg something in kselftests and an external test suite). Would > an alternative be pointing to a Documentation page with detailed info? Why not just a

Re: [PATCH RFC RFT v2 5/5] kselftest/clone3: Test shadow stack support

2023-11-20 Thread Mark Brown
On Fri, Nov 17, 2023 at 01:12:46PM -0800, Deepak Gupta wrote: > On Tue, Nov 14, 2023 at 11:11:58PM +, Edgecombe, Rick P wrote: > > It seems like there will be a need for some generic method of checking > > if shadow stack is enabled. Maybe a more generic compiler > > intrinsic/builtin or glibc

Re: [PATCH RFC RFT v2 2/5] fork: Add shadow stack support to clone3()

2023-11-20 Thread Mark Brown
On Fri, Nov 17, 2023 at 05:43:26PM +, Edgecombe, Rick P wrote: > Either of those seem fine to me, but it would be nice to get it vetted > by the libc folks before committing. I'd maybe lean towards the one you > suggested without the new flag. I'll go with just taking the stack size as a para

Re: [PATCH 1/3] MAINTAINERS: Introduce V: field for required tests

2023-11-20 Thread Mark Brown
On Mon, Nov 20, 2023 at 03:51:31PM -0500, Theodore Ts'o wrote: > What we have at work is a way to upload the test results summary > (e.g., just KTAP result lines, or the xfstests junit XML) along with > test run metadata (e.g., what was the kernel commit on which the test > was run, and the test h

[PATCH RFT v3 0/5] fork: Support shadow stacks in clone3()

2023-11-20 Thread Mark Brown
eries and since we need to detect if shadow stacks are supported it seemed sensible to roll it in here. [1] https://lore.kernel.org/r/20231009-arm64-gcs-v6-0-78e55deaa...@kernel.org/ Signed-off-by: Mark Brown --- Changes in v3: - Rebase onto v6.7-rc2. - Remove stale shadow_stack in internal kargs

[PATCH RFT v3 1/5] mm: Introduce ARCH_HAS_USER_SHADOW_STACK

2023-11-20 Thread Mark Brown
Since multiple architectures have support for shadow stacks and we need to select support for this feature in several places in the generic code provide a generic config option that the architectures can select. Suggested-by: David Hildenbrand Acked-by: David Hildenbrand Signed-off-by: Mark

[PATCH RFT v3 2/5] fork: Add shadow stack support to clone3()

2023-11-20 Thread Mark Brown
stack code rather than individual fields. Signed-off-by: Mark Brown --- arch/x86/include/asm/shstk.h | 11 ++--- arch/x86/kernel/process.c| 2 +- arch/x86/kernel/shstk.c | 59 ++-- include/linux/sched/task.h | 1 + include/uapi/linux/sched.h

[PATCH RFT v3 3/5] selftests/clone3: Factor more of main loop into test_clone3()

2023-11-20 Thread Mark Brown
change. Signed-off-by: Mark Brown --- tools/testing/selftests/clone3/clone3.c | 77 - 1 file changed, 37 insertions(+), 40 deletions(-) diff --git a/tools/testing/selftests/clone3/clone3.c b/tools/testing/selftests/clone3/clone3.c index 3c9bf0cd82a8..1108bd8e36d6

[PATCH RFT v3 4/5] selftests/clone3: Allow tests to flag if -E2BIG is a valid error code

2023-11-20 Thread Mark Brown
lone3() may return -E2BIG due to the use of newer struct versions. Currently no tests need this but it will become an issue for testing clone3() support for shadow stacks, the support for shadow stacks is already present on x86. Signed-off-by: Mark Brown --- tools/testing/selftests/clone3/clone3.

[PATCH RFT v3 5/5] kselftest/clone3: Test shadow stack support

2023-11-20 Thread Mark Brown
succeeds when the enable failed. Signed-off-by: Mark Brown --- tools/testing/selftests/clone3/clone3.c | 117 ++ tools/testing/selftests/clone3/clone3_selftests.h | 7 ++ 2 files changed, 124 insertions(+) diff --git a/tools/testing/selftests/clone3/clone3.c b

Re: [PATCH 1/3] MAINTAINERS: Introduce V: field for required tests

2023-11-21 Thread Mark Brown
On Tue, Nov 21, 2023 at 01:04:50AM -0500, Theodore Ts'o wrote: > On Mon, Nov 20, 2023 at 10:27:33PM +0000, Mark Brown wrote: > > This is the sort of thing that kcidb (which Nikolai works on) is good at > > ingesting, I actually do push all my CI's test resul

Re: [PATCH RFT v3 0/5] fork: Support shadow stacks in clone3()

2023-11-21 Thread Mark Brown
On Tue, Nov 21, 2023 at 12:21:37PM +, Szabolcs Nagy wrote: > The 11/21/2023 11:17, Christian Brauner wrote: > > I have a few questions that are probably me just not knowing much about > > shadow stacks so hopefully I'm not asking you write a thesis by > > accident: One thing it feels like it'

Re: [PATCH 1/3] MAINTAINERS: Introduce V: field for required tests

2023-11-21 Thread Mark Brown
On Tue, Nov 21, 2023 at 06:36:10PM +0800, David Gow wrote: > The other question is how to handle outdated results when a new patch > revision is sent out. Personally, I think this is something we can > solve similarly to 'Reviewed-by', depending on the extent of the > changes and cost of the tests

[PATCH v7 00/39] arm64/gcs: Provide support for GCS in userspace

2023-11-22 Thread Mark Brown
[1] https://lore.kernel.org/lkml/20230213045351.3945824-1-de...@rivosinc.com/ Signed-off-by: Mark Brown --- Changes in v7: - Rebase onto v6.7-rc2 via the clone3() patch series. - Change the token used to cap the stack during signal handling to be compatible with GCSPOPM. - Fix flags for new

[PATCH v7 01/39] arm64/mm: Restructure arch_validate_flags() for extensibility

2023-11-22 Thread Mark Brown
. Signed-off-by: Mark Brown --- arch/arm64/include/asm/mman.h | 14 ++ 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/arch/arm64/include/asm/mman.h b/arch/arm64/include/asm/mman.h index 5966ee4a6154..c21849ffdd88 100644 --- a/arch/arm64/include/asm/mman.h +++ b/arch/arm64

[PATCH v7 02/39] prctl: arch-agnostic prctl for shadow stack

2023-11-22 Thread Mark Brown
locking interface reworked. The set status prctl() is also reworked to just set flags, if setting/reading the shadow stack pointer is required this could be a separate prctl. Signed-off-by: Mark Brown --- include/linux/mm.h | 4 include/uapi/linux/prctl.h | 22

[PATCH v7 03/39] mman: Add map_shadow_stack() flags

2023-11-22 Thread Mark Brown
stack marker suitable for use by unwinders should be added above that. For arm64 the top of stack marker is all bits 0. Signed-off-by: Mark Brown --- arch/x86/include/uapi/asm/mman.h | 3 --- include/uapi/asm-generic/mman.h | 4 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a

[PATCH v7 04/39] arm64: Document boot requirements for Guarded Control Stacks

2023-11-22 Thread Mark Brown
FEAT_GCS introduces a number of new system registers, we require that access to these registers is not trapped when we identify that the feature is detected. Signed-off-by: Mark Brown --- Documentation/arch/arm64/booting.rst | 22 ++ 1 file changed, 22 insertions(+) diff

[PATCH v7 05/39] arm64/gcs: Document the ABI for Guarded Control Stacks

2023-11-22 Thread Mark Brown
Add some documentation of the userspace ABI for Guarded Control Stacks. Signed-off-by: Mark Brown --- Documentation/arch/arm64/gcs.rst | 233 + Documentation/arch/arm64/index.rst | 1 + 2 files changed, 234 insertions(+) diff --git a/Documentation/arch

[PATCH v7 06/39] arm64/sysreg: Add new system registers for GCS

2023-11-22 Thread Mark Brown
FEAT_GCS introduces a number of new system registers. Add the registers available up to EL2 to sysreg as per DDI0601 2022-12. Signed-off-by: Mark Brown --- arch/arm64/tools/sysreg | 55 + 1 file changed, 55 insertions(+) diff --git a/arch/arm64

[PATCH v7 07/39] arm64/sysreg: Add definitions for architected GCS caps

2023-11-22 Thread Mark Brown
The architecture defines a format for guarded control stack caps, used to mark the top of an unused GCS in order to limit the potential for exploitation via stack switching. Add definitions associated with these. Signed-off-by: Mark Brown --- arch/arm64/include/asm/sysreg.h | 20

[PATCH v7 08/39] arm64/gcs: Add manual encodings of GCS instructions

2023-11-22 Thread Mark Brown
sufficiently fast paths for this to be a problem. Note that GCSSTTR is used to store to EL0. Signed-off-by: Mark Brown --- arch/arm64/include/asm/gcs.h | 51 arch/arm64/include/asm/uaccess.h | 22 + 2 files changed, 73 insertions(+) diff --git

[PATCH v7 09/39] arm64/gcs: Provide put_user_gcs()

2023-11-22 Thread Mark Brown
In order for EL1 to write to an EL0 GCS it must use the GCSSTTR instruction rather than a normal STTR. Provide a put_user_gcs() which does this. Signed-off-by: Mark Brown --- arch/arm64/include/asm/uaccess.h | 18 ++ 1 file changed, 18 insertions(+) diff --git a/arch/arm64

[PATCH v7 10/39] arm64/cpufeature: Runtime detection of Guarded Control Stack (GCS)

2023-11-22 Thread Mark Brown
Add a cpufeature for GCS, allowing other code to conditionally support it at runtime. Signed-off-by: Mark Brown --- arch/arm64/include/asm/cpufeature.h | 6 ++ arch/arm64/kernel/cpufeature.c | 16 arch/arm64/tools/cpucaps| 1 + 3 files changed, 23

[PATCH v7 11/39] arm64/mm: Allocate PIE slots for EL0 guarded control stack

2023-11-22 Thread Mark Brown
to copy. Since the actual effect is defined using PIE the specific bit pattern used does not matter to the hardware but we choose two values which differ only in PTE_WRITE in order to help share code with non-PIE cases. Signed-off-by: Mark Brown --- arch/arm64/include/asm/pgtable-prot.h | 14

[PATCH v7 12/39] mm: Define VM_SHADOW_STACK for arm64 when we support GCS

2023-11-22 Thread Mark Brown
Use VM_HIGH_ARCH_5 for guarded control stack pages. Signed-off-by: Mark Brown --- Documentation/filesystems/proc.rst | 2 +- fs/proc/task_mmu.c | 3 +++ include/linux/mm.h | 12 +++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a

[PATCH v7 13/39] arm64/mm: Map pages for guarded control stack

2023-11-22 Thread Mark Brown
Map pages flagged as being part of a GCS as such rather than using the full set of generic VM flags. This is done using a conditional rather than extending the size of protection_map since that would make for a very sparse array. Signed-off-by: Mark Brown --- arch/arm64/include/asm/mman.h | 9

[PATCH v7 14/39] KVM: arm64: Manage GCS registers for guests

2023-11-22 Thread Mark Brown
GCS introduces a number of system registers for EL1 and EL0, on systems with GCS we need to context switch them and expose them to VMMs to allow guests to use GCS. Traps are already disabled. Signed-off-by: Mark Brown --- arch/arm64/include/asm/kvm_host.h | 12 arch/arm64

[PATCH v7 15/39] arm64/gcs: Allow GCS usage at EL0 and EL1

2023-11-22 Thread Mark Brown
There is a control HCRX_EL2.GCSEn which must be set to allow GCS features to take effect at lower ELs and also fine grained traps for GCS usage at EL0 and EL1. Configure all these to allow GCS usage by EL0 and EL1. Signed-off-by: Mark Brown --- arch/arm64/include/asm/el2_setup.h | 17

[PATCH v7 16/39] arm64/idreg: Add overrride for GCS

2023-11-22 Thread Mark Brown
Hook up an override for GCS, allowing it to be disabled from the command line by specifying arm64.nogcs in case there are problems. Signed-off-by: Mark Brown --- Documentation/admin-guide/kernel-parameters.txt | 6 ++ arch/arm64/kernel/idreg-override.c | 2 ++ 2 files changed

[PATCH v7 17/39] arm64/hwcap: Add hwcap for GCS

2023-11-22 Thread Mark Brown
Provide a hwcap to enable userspace to detect support for GCS. Signed-off-by: Mark Brown --- Documentation/arch/arm64/elf_hwcaps.rst | 3 +++ arch/arm64/include/asm/hwcap.h | 1 + arch/arm64/include/uapi/asm/hwcap.h | 1 + arch/arm64/kernel/cpufeature.c | 3 +++ arch/arm64

[PATCH v7 18/39] arm64/traps: Handle GCS exceptions

2023-11-22 Thread Mark Brown
ating any GCS fault as fatal. Signed-off-by: Mark Brown --- arch/arm64/include/asm/esr.h | 28 +++- arch/arm64/include/asm/exception.h | 2 ++ arch/arm64/kernel/entry-common.c | 23 +++ arch/arm64/kernel/traps.c | 11 +++ 4

[PATCH v7 19/39] arm64/mm: Handle GCS data aborts

2023-11-22 Thread Mark Brown
it attempts to do GCS operations outside a GCS. Signed-off-by: Mark Brown --- arch/arm64/mm/fault.c | 79 +-- 1 file changed, 71 insertions(+), 8 deletions(-) diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c index 460d799e1296

[PATCH v7 20/39] arm64/gcs: Context switch GCS state for EL0

2023-11-22 Thread Mark Brown
been disabled. Signed-off-by: Mark Brown --- arch/arm64/include/asm/gcs.h | 24 arch/arm64/include/asm/processor.h | 6 arch/arm64/kernel/process.c| 56 ++ arch/arm64/mm/Makefile | 1 + arch/arm64/mm/gcs.c

[PATCH v7 21/39] arm64/gcs: Allocate a new GCS for threads with GCS enabled

2023-11-22 Thread Mark Brown
extensively discussed x86 implementation and allocate min(RLIMIT_STACK, 4G). Since the GCS only stores the call stack and not any variables this should be more than sufficient for most applications. GCSs allocated via this mechanism then it will be freed when the thread exits. Signed-off-by: Mark Brown

[PATCH v7 22/39] arm64/gcs: Implement shadow stack prctl() interface

2023-11-22 Thread Mark Brown
fault reporting. Since it is not an expected use case and since it presents some complications in determining what to do with previously initialsed data on the GCS attempts to reenable GCS after this are rejected. This can be revisted if a use case arises. Signed-off-by: Mark Brown --- arch/arm64

[PATCH v7 23/39] arm64/mm: Implement map_shadow_stack()

2023-11-22 Thread Mark Brown
de has not yet been rebased to v6.5-rc1 this includes the architecture neutral parts of Rick Edgecmbe's "x86/shstk: Introduce map_shadow_stack syscall". Signed-off-by: Mark Brown --- arch/arm64/mm/gcs.c | 61 + 1 file changed, 61 in

[PATCH v7 24/39] arm64/signal: Set up and restore the GCS context for signal handlers

2023-11-22 Thread Mark Brown
;t be interpreted as a valid token or address. Signed-off-by: Mark Brown --- arch/arm64/include/asm/gcs.h | 1 + arch/arm64/kernel/signal.c | 129 +-- arch/arm64/mm/gcs.c | 1 + 3 files changed, 126 insertions(+), 5 deletions(-) diff --git a/arch/

[PATCH v7 25/39] arm64/signal: Expose GCS state in signal frames

2023-11-22 Thread Mark Brown
, there is a conflict between specifying GCSPR_EL0 and allocation of a new GCS and this is not an ancticipated use case. We also enforce GCS configuration locking on signal return. Signed-off-by: Mark Brown --- arch/arm64/include/uapi/asm/sigcontext.h | 9 +++ arch/arm64/kernel/signal.c

[PATCH v7 26/39] arm64/ptrace: Expose GCS via ptrace and core files

2023-11-22 Thread Mark Brown
Provide a new register type NT_ARM_GCS reporting the current GCS mode and pointer for EL0. Due to the interactions with allocation and deallocation of Guarded Control Stacks we do not permit any changes to the GCS mode via ptrace, only GCSPR_EL0 may be changed. Signed-off-by: Mark Brown

[PATCH v7 27/39] arm64: Add Kconfig for Guarded Control Stack (GCS)

2023-11-22 Thread Mark Brown
Provide a Kconfig option allowing the user to select if GCS support is built into the kernel. Signed-off-by: Mark Brown --- arch/arm64/Kconfig | 20 1 file changed, 20 insertions(+) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 7b071a00425d..05cffc0f5786

[PATCH v7 28/39] kselftest/arm64: Verify the GCS hwcap

2023-11-22 Thread Mark Brown
Add coverage of the GCS hwcap to the hwcap selftest, using a read of GCSPR_EL0 to generate SIGILL without having to worry about enabling GCS. Signed-off-by: Mark Brown --- tools/testing/selftests/arm64/abi/hwcap.c | 19 +++ 1 file changed, 19 insertions(+) diff --git a/tools

[PATCH v7 29/39] kselftest/arm64: Add GCS as a detected feature in the signal tests

2023-11-22 Thread Mark Brown
In preparation for testing GCS related signal handling add it as a feature we check for in the signal handling support code. Signed-off-by: Mark Brown --- tools/testing/selftests/arm64/signal/test_signals.h | 2 ++ tools/testing/selftests/arm64/signal/test_signals_utils.c | 3 +++ 2 files

[PATCH v7 30/39] kselftest/arm64: Add framework support for GCS to signal handling tests

2023-11-22 Thread Mark Brown
Teach the framework about the GCS signal context, avoiding warnings on the unknown context. Signed-off-by: Mark Brown --- tools/testing/selftests/arm64/signal/testcases/testcases.c | 7 +++ tools/testing/selftests/arm64/signal/testcases/testcases.h | 1 + 2 files changed, 8 insertions

<    1   2   3   4   5   6   7   8   9   >