Re: [PATCH v2 2/2] selftests: Add a test mangling with uc_sigmask

2024-06-11 Thread Mark Brown
On Tue, Jun 11, 2024 at 01:26:50PM +0530, Dev Jain wrote: > + * A signal is said to be delivered, when the program takes action on the > + * signal: such action may involve termination of the process, ignoring the > + * signal, terminating with core dump, stopping the process, or continuing > the

Re: [PATCH] selftests: mm: Make map_fixed_noreplace test names stable

2024-06-12 Thread Mark Brown
On Tue, Jun 11, 2024 at 03:23:17PM -0700, Andrew Morton wrote: > On Wed, 05 Jun 2024 23:36:12 +0100 Mark Brown wrote: > > KTAP parsers interpret the output of ksft_test_result_*() as being the > > name of the test. The map_fixed_noreplace test uses a dynamically > > alloc

Re: [PATCH v2 2/2] selftests: Add a test mangling with uc_sigmask

2024-06-12 Thread Mark Brown
On Wed, Jun 12, 2024 at 10:14:01AM +0530, Dev Jain wrote: > On 6/11/24 16:55, Mark Brown wrote: > > On Tue, Jun 11, 2024 at 01:26:50PM +0530, Dev Jain wrote: > > > + * A signal is said to be delivered, when the program takes action on the > > > + * signal: such action

Re: [PATCH][next] kselftest/arm64: Fix a couple of spelling mistakes

2024-06-13 Thread Mark Brown
On Thu, Jun 13, 2024 at 08:34:29AM +0100, Colin Ian King wrote: > There are two spelling mistakes in some error messages. Fix them. Reviewed-by: Mark Brown signature.asc Description: PGP signature

Re: [PATCH v2 2/2] selftests: Add a test mangling with uc_sigmask

2024-06-13 Thread Mark Brown
On Thu, Jun 13, 2024 at 10:21:39AM +0530, Dev Jain wrote: > I guess we agree on the same thing; so, how about I rephrase the delivery > and blocking code comments this way: > "A process can request blocking of a signal by masking it into its set of > blocked signals; such a signal, when sent to th

Re: [PATCH 3/5] ALSA: control: Apply sanity check of input values for user elements

2024-06-14 Thread Mark Brown
put value validation for user control > elements no matter whether CONFIG_SND_CTL_INPUT_VALIDATION is set or > not. The kselftest will be happier with this change, as the incorrect > values will be bailed out now with errors. Reviewed-by: Mark Brown signature.asc Description: PGP signature

Re: [PATCH 4/5] kselftest/alsa: mixer-test: Skip write tests for volatile controls

2024-06-14 Thread Mark Brown
On Fri, Jun 14, 2024 at 02:47:26PM +0200, Takashi Iwai wrote: > The control elements with volatile flag don't guarantee that the > written values are actually saved for the next reads, hence they > aren't suitable for the standard mixer tests. Skip the write tests > for those volatile controls fo

Re: selftests: arm64: fp-stress: KERNEL-1-0/3-0/4-0/6-0 - gcc-13 - Failed - clang-pass

2024-06-14 Thread Mark Brown
On Thu, Jun 13, 2024 at 07:21:15PM +0530, Naresh Kamboju wrote: > The following selftests: arm64 tests failed on FVP-aemva test and kernel > built with gcc-13 but pass with clang. > > arm64_fp-stress_KERNEL-1-0/3-0/4-0/6-0 - gcc-13 - Failed > arm64_fp-stress_KERNEL-1-0/3-0/4-0/6-0 - clang-18 - Pas

Re: [PATCH v2 4/6] kselftest/alsa: mixer-test: Skip write verification for volatile controls

2024-06-14 Thread Mark Brown
On Fri, Jun 14, 2024 at 05:37:13PM +0200, Takashi Iwai wrote: > @@ -616,6 +616,10 @@ static int write_and_verify(struct ctl_data *ctl, > if (!snd_ctl_elem_info_is_readable(ctl->info)) > return err; > > + /* Skip the verification for volatile controls, too */ > + if (s

Re: [PATCH v2 4/6] kselftest/alsa: mixer-test: Skip write verification for volatile controls

2024-06-14 Thread Mark Brown
On Fri, Jun 14, 2024 at 06:08:12PM +0200, Takashi Iwai wrote: > Mark Brown wrote: > +++ b/tools/testing/selftests/alsa/mixer-test.c > @@ -668,6 +668,10 @@ static int write_and_verify(struct ctl_data *ctl, > ksft_print_msg("%s read and writte

[PATCH] kselftest/alsa: Fix validation of writes to volatile controls

2024-06-14 Thread Mark Brown
controls that we currently do for events to a separate block and just verifying that whatever value we read is valid for the control. Signed-off-by: Mark Brown --- tools/testing/selftests/alsa/mixer-test.c | 45 --- 1 file changed, 29 insertions(+), 16 deletions(-) diff

[PATCH RFT v6 0/9] fork: Support shadow stacks in clone3()

2024-06-23 Thread Mark Brown
adow 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 v6: - Rebase onto v6.10-rc3. - Ensure we don't try to free the parent shadow stack in error paths of x86 arch co

[PATCH RFT v6 1/9] Documentation: userspace-api: Add shadow stack API documentation

2024-06-23 Thread Mark Brown
feature let's provide some documentation covering the common aspects. Signed-off-by: Mark Brown --- Documentation/userspace-api/index.rst| 1 + Documentation/userspace-api/shadow_stack.rst | 41 2 files changed, 42 insertions(+) diff --git a/Document

[PATCH RFT v6 2/9] selftests: Provide helper header for shadow stack testing

2024-06-23 Thread Mark Brown
interfaces. Reviewed-by: Rick Edgecombe Signed-off-by: Mark Brown --- tools/testing/selftests/ksft_shstk.h | 63 1 file changed, 63 insertions(+) diff --git a/tools/testing/selftests/ksft_shstk.h b/tools/testing/selftests/ksft_shstk.h new file mode 100644 index

[PATCH RFT v6 3/9] mm: Introduce ARCH_HAS_USER_SHADOW_STACK

2024-06-23 Thread Mark Brown
Gupta Reviewed-by: Rick Edgecombe Signed-off-by: Mark Brown --- arch/x86/Kconfig | 1 + fs/proc/task_mmu.c | 2 +- include/linux/mm.h | 2 +- mm/Kconfig | 6 ++ 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 1d7122a1883e

[PATCH RFT v6 4/9] fork: Add shadow stack support to clone3()

2024-06-23 Thread Mark Brown
-by: Mark Brown --- arch/x86/include/asm/shstk.h | 11 +++-- arch/x86/kernel/process.c| 2 +- arch/x86/kernel/shstk.c | 104 +-- include/linux/sched/task.h | 13 ++ include/uapi/linux/sched.h | 13 -- kernel/fork.c

[PATCH RFT v6 5/9] selftests/clone3: Remove redundant flushes of output streams

2024-06-23 Thread Mark Brown
Signed-off-by: Mark Brown --- tools/testing/selftests/clone3/clone3_selftests.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/tools/testing/selftests/clone3/clone3_selftests.h b/tools/testing/selftests/clone3/clone3_selftests.h index 3d2663fe50ba..39b5dcba663c 100644 --- a/tools/testing/s

[PATCH RFT v6 6/9] selftests/clone3: Factor more of main loop into test_clone3()

2024-06-23 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 e61f07973ce5..e066b201fa64

[PATCH RFT v6 7/9] selftests/clone3: Explicitly handle child exits due to signals

2024-06-23 Thread Mark Brown
In order to improve diagnostics and allow tests to explicitly look for signals check to see if the child exited due to a signal and if it did print the code and return it as a positive value, distinct from the negative errnos currently returned. Signed-off-by: Mark Brown --- tools/testing

[PATCH RFT v6 8/9] selftests/clone3: Allow tests to flag if -E2BIG is a valid error code

2024-06-23 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 v6 9/9] selftests/clone3: Test shadow stack support

2024-06-23 Thread Mark Brown
., this should be overly cautious. Signed-off-by: Mark Brown --- tools/testing/selftests/clone3/clone3.c | 135 +- tools/testing/selftests/clone3/clone3_selftests.h | 38 ++ 2 files changed, 172 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests

Re: [PATCH v3 5/9] selftests/arm64: Fix build warnings for ptrace

2024-06-25 Thread Mark Brown
On Tue, Jun 25, 2024 at 05:54:04PM +0530, Dev Jain wrote: > "%s" should have been used in ksft_exit_fail_msg(). Anyways, replace that > with the recently introduced ksft_exit_fail_perror(). Also fix no mention of > type_name in ksft_test_result_skip(). Reviewed-by: Mark Brow

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

2024-06-25 Thread Mark Brown
et of dependencies against Linus' tree at: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/misc.git arm64-gcs [1] https://lore.kernel.org/lkml/20230213045351.3945824-1-de...@rivosinc.com/ Signed-off-by: Mark Brown --- Changes in v9: - Rebase onto v6.10-rc3. - Restructure and clar

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

2024-06-25 Thread Mark Brown
. Reviewed-by: Thiago Jung Bauermann 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

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

2024-06-25 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. Reviewed-by: Thiago Jung Bauermann Signed-off-by: Mark Brown --- include/linux/mm.h | 4 include/uapi/linux

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

2024-06-25 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. Reviewed-by: Thiago Jung Bauermann 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

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

2024-06-25 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. Reviewed-by: Thiago Jung Bauermann Signed-off-by: Mark Brown --- Documentation/arch/arm64/booting.rst | 22 ++ 1

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

2024-06-25 Thread Mark Brown
Add some documentation of the userspace ABI for Guarded Control Stacks. Reviewed-by: Thiago Jung Bauermann Signed-off-by: Mark Brown --- Documentation/arch/arm64/gcs.rst | 233 + Documentation/arch/arm64/index.rst | 1 + 2 files changed, 234 insertions

[PATCH v9 06/39] arm64/sysreg: Add definitions for architected GCS caps

2024-06-25 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. Reviewed-by: Thiago Jung Bauermann Signed-off-by: Mark Brown --- arch/arm64

[PATCH v9 07/39] arm64/gcs: Add manual encodings of GCS instructions

2024-06-25 Thread Mark Brown
sufficiently fast paths for this to be a problem. Note that GCSSTTR is used to store to EL0. Reviewed-by: Thiago Jung Bauermann Signed-off-by: Mark Brown --- arch/arm64/include/asm/gcs.h | 51 arch/arm64/include/asm/uaccess.h | 22 + 2 files

[PATCH v9 08/39] arm64/gcs: Provide put_user_gcs()

2024-06-25 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. Reviewed-by: Thiago Jung Bauermann Signed-off-by: Mark Brown --- arch/arm64/include/asm/uaccess.h | 18 ++ 1 file changed, 18

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

2024-06-25 Thread Mark Brown
Add a cpufeature for GCS, allowing other code to conditionally support it at runtime. Reviewed-by: Thiago Jung Bauermann Signed-off-by: Mark Brown --- arch/arm64/include/asm/cpufeature.h | 6 ++ arch/arm64/kernel/cpufeature.c | 16 arch/arm64/tools/cpucaps

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

2024-06-25 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. Reviewed-by: Thiago Jung Bauermann Signed-off-by: Mark Brown --- arch/arm64

[PATCH v9 11/39] mm: Define VM_SHADOW_STACK for arm64 when we support GCS

2024-06-25 Thread Mark Brown
Use VM_HIGH_ARCH_5 for guarded control stack pages. Reviewed-by: Thiago Jung Bauermann 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

[PATCH v9 12/39] arm64/mm: Map pages for guarded control stack

2024-06-25 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. Reviewed-by: Thiago Jung Bauermann Signed-off-by: Mark Brown

[PATCH v9 14/39] arm64/gcs: Allow GCS usage at EL0 and EL1

2024-06-25 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. Reviewed-by: Thiago Jung Bauermann Signed-off-by: Mark Brown --- arch/arm64

[PATCH v9 13/39] KVM: arm64: Manage GCS registers for guests

2024-06-25 Thread Mark Brown
Bauermann Signed-off-by: Mark Brown --- arch/arm64/include/asm/kvm_host.h | 14 + arch/arm64/include/asm/vncr_mapping.h | 2 ++ arch/arm64/kvm/hyp/include/hyp/sysreg-sr.h | 48 +++--- arch/arm64/kvm/sys_regs.c | 25 +++- 4 files

[PATCH v9 15/39] arm64/idreg: Add overrride for GCS

2024-06-25 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. Reviewed-by: Thiago Jung Bauermann Signed-off-by: Mark Brown --- Documentation/admin-guide/kernel-parameters.txt | 6 ++ arch/arm64/kernel/pi/idreg-override.c

[PATCH v9 16/39] arm64/hwcap: Add hwcap for GCS

2024-06-25 Thread Mark Brown
Provide a hwcap to enable userspace to detect support for GCS. Reviewed-by: Thiago Jung Bauermann Signed-off-by: Mark Brown --- Documentation/arch/arm64/elf_hwcaps.rst | 2 ++ arch/arm64/include/asm/hwcap.h | 1 + arch/arm64/include/uapi/asm/hwcap.h | 1 + arch/arm64/kernel

[PATCH v9 17/39] arm64/traps: Handle GCS exceptions

2024-06-25 Thread Mark Brown
ating any GCS fault as fatal. Reviewed-by: Thiago Jung Bauermann 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/tr

[PATCH v9 18/39] arm64/mm: Handle GCS data aborts

2024-06-25 Thread Mark Brown
it attempts to do GCS operations outside a GCS. Signed-off-by: Mark Brown --- arch/arm64/mm/fault.c | 43 +++ 1 file changed, 43 insertions(+) diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c index 451ba7cbd5ad..bdc28588163d 100644 --- a/arch

[PATCH v9 19/39] arm64/gcs: Context switch GCS state for EL0

2024-06-25 Thread Mark Brown
been disabled. Reviewed-by: Thiago Jung Bauermann 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

[PATCH v9 20/39] arm64/gcs: Ensure that new threads have a GCS

2024-06-25 Thread Mark Brown
, those explicitly configured by the user will not. Reviewed-by: Thiago Jung Bauermann Signed-off-by: Mark Brown --- arch/arm64/include/asm/gcs.h | 9 +++ arch/arm64/kernel/process.c | 29 + arch/arm64/mm/gcs.c | 143 +++ 3 files

[PATCH v9 21/39] arm64/gcs: Implement shadow stack prctl() interface

2024-06-25 Thread Mark Brown
-off-by: Mark Brown --- arch/arm64/include/asm/gcs.h | 22 +++ arch/arm64/include/asm/processor.h | 1 + arch/arm64/mm/gcs.c| 81 ++ 3 files changed, 104 insertions(+) diff --git a/arch/arm64/include/asm/gcs.h b/arch/arm64/include

[PATCH v9 22/39] arm64/mm: Implement map_shadow_stack()

2024-06-25 Thread Mark Brown
hiago Jung Bauermann Signed-off-by: Mark Brown --- arch/arm64/mm/gcs.c | 61 + 1 file changed, 61 insertions(+) diff --git a/arch/arm64/mm/gcs.c b/arch/arm64/mm/gcs.c index c6fae0eb9bd6..918d50ba53c6 100644 --- a/arch/arm64/mm/gcs.c +++ b/arch/arm6

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

2024-06-25 Thread Mark Brown
;t be interpreted as a valid token or address. Reviewed-by: Thiago Jung Bauermann Signed-off-by: Mark Brown --- arch/arm64/include/asm/gcs.h | 1 + arch/arm64/kernel/signal.c | 134 +-- arch/arm64/mm/gcs.c | 1 + 3 files changed, 131 insertions(

[PATCH v9 24/39] arm64/signal: Expose GCS state in signal frames

2024-06-25 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. Reviewed-by: Thiago Jung Bauermann Signed-off-by: Mark Brown --- arch/arm64/include/uapi/asm/sigcontext.h | 9

[PATCH v9 25/39] arm64/ptrace: Expose GCS via ptrace and core files

2024-06-25 Thread Mark Brown
Signed-off-by: Mark Brown --- arch/arm64/include/uapi/asm/ptrace.h | 8 + arch/arm64/kernel/ptrace.c | 59 include/uapi/linux/elf.h | 1 + 3 files changed, 68 insertions(+) diff --git a/arch/arm64/include/uapi/asm/ptrace.h b/arch

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

2024-06-25 Thread Mark Brown
Provide a Kconfig option allowing the user to select if GCS support is built into the kernel. Reviewed-by: Thiago Jung Bauermann Signed-off-by: Mark Brown --- arch/arm64/Kconfig | 20 1 file changed, 20 insertions(+) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig

[PATCH v9 27/39] kselftest/arm64: Verify the GCS hwcap

2024-06-25 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. Reviewed-by: Thiago Jung Bauermann Signed-off-by: Mark Brown --- tools/testing/selftests/arm64/abi/hwcap.c | 19 +++ 1 file changed, 19

[PATCH v9 28/39] kselftest: Provide shadow stack enable helpers for arm64

2024-06-25 Thread Mark Brown
Allow test programs to use the shadow stack helpers on arm64. Reviewed-by: Thiago Jung Bauermann Signed-off-by: Mark Brown --- tools/testing/selftests/ksft_shstk.h | 37 1 file changed, 37 insertions(+) diff --git a/tools/testing/selftests/ksft_shstk.h b

[PATCH v9 29/39] selftests/clone3: Enable arm64 shadow stack testing

2024-06-25 Thread Mark Brown
In order to test shadow stack support in clone3() the clone3() selftests need to have a fully inline clone3() call, provide one for arm64. Signed-off-by: Mark Brown --- tools/testing/selftests/clone3/clone3_selftests.h | 26 +++ 1 file changed, 26 insertions(+) diff --git a

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

2024-06-25 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. Reviewed-by: Thiago Jung Bauermann Signed-off-by: Mark Brown --- tools/testing/selftests/arm64/signal/test_signals.h | 2 ++ tools/testing/selftests/arm64/signal

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

2024-06-25 Thread Mark Brown
Teach the framework about the GCS signal context, avoiding warnings on the unknown context. Reviewed-by: Thiago Jung Bauermann Signed-off-by: Mark Brown --- tools/testing/selftests/arm64/signal/testcases/testcases.c | 7 +++ tools/testing/selftests/arm64/signal/testcases/testcases.h | 1

[PATCH v9 32/39] kselftest/arm64: Allow signals tests to specify an expected si_code

2024-06-25 Thread Mark Brown
: Mark Brown --- .../testing/selftests/arm64/signal/test_signals.h | 4 +++ .../selftests/arm64/signal/test_signals_utils.c| 29 ++ 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/tools/testing/selftests/arm64/signal/test_signals.h b/tools/testing

[PATCH v9 33/39] kselftest/arm64: Always run signals tests with GCS enabled

2024-06-25 Thread Mark Brown
anything with stacks that would cause problems with GCS we can sidestep this issue by unconditionally enabling GCS on startup and exiting with a call to exit() rather than a return from main(). Reviewed-by: Thiago Jung Bauermann Signed-off-by: Mark Brown --- .../testing/selftests/arm64/signal

[PATCH v9 34/39] kselftest/arm64: Add very basic GCS test program

2024-06-25 Thread Mark Brown
This test program just covers the basic GCS ABI, covering aspects of the ABI as standalone features without attempting to integrate things. Reviewed-by: Thiago Jung Bauermann Signed-off-by: Mark Brown --- tools/testing/selftests/arm64/Makefile| 2 +- tools/testing/selftests/arm64/gcs

[PATCH v9 35/39] kselftest/arm64: Add a GCS test program built with the system libc

2024-06-25 Thread Mark Brown
There are things like threads which nolibc struggles with which we want to add coverage for, and the ABI allows us to test most of these even if libc itself does not understand GCS so add a test application built using the system libc. Reviewed-by: Thiago Jung Bauermann Signed-off-by: Mark Brown

[PATCH v9 36/39] kselftest/arm64: Add test coverage for GCS mode locking

2024-06-25 Thread Mark Brown
to not do that in the build system but there are no such toolchains yet so it is not yet an issue. Reviewed-by: Thiago Jung Bauermann Signed-off-by: Mark Brown --- tools/testing/selftests/arm64/gcs/.gitignore| 1 + tools/testing/selftests/arm64/gcs/Makefile | 2 +- tools/testing/selft

[PATCH v9 37/39] kselftest/arm64: Add GCS signal tests

2024-06-25 Thread Mark Brown
Do some testing of the signal handling for GCS, checking that a GCS frame has the expected information in it and that the expected signals are delivered with invalid operations. Reviewed-by: Thiago Jung Bauermann Signed-off-by: Mark Brown --- tools/testing/selftests/arm64/signal/.gitignore

[PATCH v9 38/39] kselftest/arm64: Add a GCS stress test

2024-06-25 Thread Mark Brown
are inserted when moving a GCS using task to another CPU. The test runs for a configurable amount of time, defaulting to 10 seconds. Reviewed-by: Thiago Jung Bauermann Signed-off-by: Mark Brown --- tools/testing/selftests/arm64/gcs/.gitignore | 2 + tools/testing/selftests/arm64/gcs

[PATCH v9 39/39] kselftest/arm64: Enable GCS for the FP stress tests

2024-06-25 Thread Mark Brown
they continue to work as before on systems without GCS. Reviewed-by: Thiago Jung Bauermann Signed-off-by: Mark Brown --- tools/testing/selftests/arm64/fp/assembler.h | 15 +++ tools/testing/selftests/arm64/fp/fpsimd-test.S | 2 ++ tools/testing/selftests/arm64/fp/sve-test.S

Re: [PATCH v3 9/9] selftests: Add build infrastructure along with README

2024-06-25 Thread Mark Brown
On Tue, Jun 25, 2024 at 05:54:08PM +0530, Dev Jain wrote: > Add arm target, individual Makefile targets, and instructions to build the > tests, along with .gitignore files. All the Makefiles are similar to > selftests/arm64, except abi: use TEST_CUSTOM_PROGS to override the make > rule from lib.mk

Re: [PATCH v3 3/9] selftests: arm, arm64: Use ifdeffery to pull signal infrastructure

2024-06-25 Thread Mark Brown
On Tue, Jun 25, 2024 at 05:54:02PM +0530, Dev Jain wrote: > Use ifdeffery to guard code chunks meant specifically for arm64, in > preparation for putting signal tests in selftests/arm. I've got to say I don't love this but I'm not sure how much better we could do if we want to share the code. Th

Re: [PATCH v3 4/9] selftests/arm: Add signal tests

2024-06-25 Thread Mark Brown
t; structure to the signal handler, is mangled with. The kernel must spot this > illegal attempt and the testcases are expected to terminate via SEGV. Reviewed-by: Mark Brown signature.asc Description: PGP signature

Re: [PATCH v3 6/9] selftests/arm64: Split ptrace, use ifdeffery

2024-06-25 Thread Mark Brown
On Tue, Jun 25, 2024 at 05:54:05PM +0530, Dev Jain wrote: > --- /dev/null > +++ b/tools/testing/selftests/arm64/abi/ptrace.h > @@ -0,0 +1,135 @@ > +// SPDX-License-Identifier: GPL-2.0-only > +/* > + * Copyright (C) 2024 ARM Limited. > + */ > +#include "../../kselftest.h" > + > +static void run_te

Re: [PATCH v3 8/9] selftests/arm: Add ptrace_64 test

2024-06-25 Thread Mark Brown
On Tue, Jun 25, 2024 at 05:54:07PM +0530, Dev Jain wrote: > +static int do_child(void) > +{ > + if (ptrace(PTRACE_TRACEME, -1, NULL, NULL)) > + ksft_exit_fail_perror("PTRACE_TRACEME"); > + > + /* SIGTRAP makes the child stop after exec; do_parent() resumes it */ > + execv("

Re: [PATCH] selftests/alsa:Replace malloc with calloc

2024-06-26 Thread Mark Brown
On Wed, Jun 26, 2024 at 02:54:09AM -0700, Zhu Jun wrote: > Using calloc to handling memory allocation, calloc > can initialize the allocated memory > SKIP(return, "Can't read patterns. Probably, module isn't > loaded"); > > card_name = malloc(127); > + memset(card_name,

Re: [PATCH] selftests/alsa:Add memset to initialize memory

2024-06-26 Thread Mark Brown
On Wed, Jun 26, 2024 at 02:58:17AM -0700, Zhu Jun wrote: > Add memset to initialize the requested memory Why? signature.asc Description: PGP signature

Re: [PATCH] selftests/alsa:Fix printf format string in pcm-test.c

2024-06-26 Thread Mark Brown
On Wed, Jun 26, 2024 at 01:48:59AM -0700, Zhu Jun wrote: > Inside of test_pcm_time() arguments are printed via printf > but '%d' is used to print @flags (of type unsigned int). > Use '%u' instead, just like we do everywhere else. > > Signed-off-by

Re: [PATCH v3 2/2] selftests: Add a test mangling with uc_sigmask

2024-06-26 Thread Mark Brown
On Wed, Jun 26, 2024 at 11:18:47AM +0530, Dev Jain wrote: > This test asserts the relation between blocked signal, delivered signal, > and ucontext. The ucontext is mangled with, by adding a signal mask to > it; on return from the handler, the thread must block the corresponding > signal. This loo

Re: [PATCH v4 2/2] selftests: Add a test mangling with uc_sigmask

2024-06-27 Thread Mark Brown
> signal. Reviewed-by: Mark Brown signature.asc Description: PGP signature

Re: [PATCH v1] selftests/harness: Fix tests timeout and race condition

2024-06-28 Thread Mark Brown
get a chance to look at it properly. Tested-by: Mark Brown signature.asc Description: PGP signature

Re: [PATCH 10/17] arm64: generate 64-bit syscall.tbl

2024-07-09 Thread Mark Brown
On Thu, Jul 04, 2024 at 04:36:04PM +0200, Arnd Bergmann wrote: > #define __ARCH_WANT_SYS_CLONE > +#define __ARCH_WANT_NEW_STAT > > -#ifndef __COMPAT_SYSCALL_NR > -#include > -#endif > +#include It looks like this is causing widespread build breakage in kselftest in -next for arm64, there are

Re: [PATCH 10/17] arm64: generate 64-bit syscall.tbl

2024-07-10 Thread Mark Brown
On Wed, Jul 10, 2024 at 10:57:25AM +0200, Arnd Bergmann wrote: > Thanks for the report! I just panicked a bit and thought I had > done something entirely wrong here, but after having a closer > look it turned out to be a silly typo: > -#include > +#include Doh, I should've spotted that even fr

Re: [PATCH 1/2] selftests: arm64: tags_test: conform test to TAP output

2024-07-10 Thread Mark Brown
On Wed, Jul 10, 2024 at 12:31:21PM +0100, Catalin Marinas wrote: > Sorry, these patches slipped through the cracks. We seem to be pretty > inconsistent with using ksft_exit_fail_perror() and ksft_finished(). Is > there some plan to update the rest or is it only this location that you > came across

Re: [PATCH v9 13/39] KVM: arm64: Manage GCS registers for guests

2024-07-10 Thread Mark Brown
On Wed, Jul 10, 2024 at 04:17:02PM +0100, Marc Zyngier wrote: > Mark Brown wrote: > > + if (ctxt_has_gcs(ctxt)) { > Since this is conditioned on S1PIE, it should be only be evaluated > when PIE is enabled in the guest. So make ctxt_has_gcs() embed a check of

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

2024-07-10 Thread Mark Brown
On Wed, Jul 10, 2024 at 12:36:21PM +0200, Florian Weimer wrote: > * Mark Brown: > > +* When GCS is enabled for the interrupted thread a signal handling specific > > + GCS cap token will be written to the GCS, this is an architectural GCS > > cap > > + token with bi

Re: [PATCH v9 13/39] KVM: arm64: Manage GCS registers for guests

2024-07-10 Thread Mark Brown
On Wed, Jul 10, 2024 at 07:28:09PM +0100, Marc Zyngier wrote: > Mark Brown wrote: > > On Wed, Jul 10, 2024 at 04:17:02PM +0100, Marc Zyngier wrote: > > > > + if (ctxt_has_gcs(ctxt)) { > > > Since this is conditioned on S1PIE, it should be only be evaluated &g

[PATCH] kselftest/alsa: Use card name rather than number in test names

2024-07-11 Thread Mark Brown
automated systems and it wasn't that great anyway. Signed-off-by: Mark Brown --- tools/testing/selftests/alsa/mixer-test.c | 76 --- tools/testing/selftests/alsa/pcm-test.c | 35 -- 2 files changed, 60 insertions(+), 51 deletions(-) diff --git a/

Re: [PATCH] kselftest/alsa: Use card name rather than number in test names

2024-07-11 Thread Mark Brown
On Thu, Jul 11, 2024 at 06:08:38PM +0200, Jaroslav Kysela wrote: > On 11. 07. 24 16:33, Mark Brown wrote: > > Address this by replacing our use of card numbers with card names which are > > more likely to be stable across runs. We use the long name since in the > I think tha

Re: [PATCH] kselftest/alsa: Use card name rather than number in test names

2024-07-12 Thread Mark Brown
On Fri, Jul 12, 2024 at 11:20:05AM +0200, Jaroslav Kysela wrote: > On 12. 07. 24 10:21, Takashi Iwai wrote: > > OTOH, longname can be really ugly to read, and it can vary because it > > often embeds address or irq numbers in the string. Capturing that variation is one of the goals - it should mos

Re: [PATCH] kselftest/alsa: Use card name rather than number in test names

2024-07-12 Thread Mark Brown
On Fri, Jul 12, 2024 at 06:25:21PM +0200, Jaroslav Kysela wrote: > On 12. 07. 24 15:00, Mark Brown wrote: > > The trouble with the ID field is that it's too short and seems likely to > > create collisions, for example HDA stuff just seems to default to NVidia > > for nVi

Re: [PATCH] kselftest/alsa: Use card name rather than number in test names

2024-07-15 Thread Mark Brown
On Sat, Jul 13, 2024 at 09:35:36AM +0200, Jaroslav Kysela wrote: > On 12. 07. 24 20:19, Mark Brown wrote: > > Sure, but the genesis of this patch is that probe order isn't > > sufficiently stable and we want to avoid names based on it... using the > > ID will be more

Re: [PATCH] kselftest/alsa: Use card name rather than number in test names

2024-07-15 Thread Mark Brown
On Sat, Jul 13, 2024 at 08:46:43AM +0200, Takashi Iwai wrote: > Mark Brown wrote: > > Sure, but the genesis of this patch is that probe order isn't > > sufficiently stable and we want to avoid names based on it... using the > > ID will be more likely to work out stable

Re: [PATCH] kselftest/alsa: Use card name rather than number in test names

2024-07-15 Thread Mark Brown
On Mon, Jul 15, 2024 at 03:23:24PM +0200, Takashi Iwai wrote: > Mark Brown wrote: > > Interesting - I was mainly developing on a system with multiple HDA > > cards and was getting fairly clearly unique names. > An AMD system usually has two HD-audio entries, and both are &

[PATCH v2 0/2] kselftest/alsa: Diagnostic improvements

2024-07-16 Thread Mark Brown
The first patch fixes unstable naming of tests due to probe ordering not being stable, the second just provides a bit more information. Signed-off-by: Mark Brown --- Changes in v2: - Switch to using ID rather than longame. - Log the PCM ID too. - Link to v1: https://lore.kernel.org/r/20240711

[PATCH v2 1/2] kselftest/alsa: Use card name rather than number in test names

2024-07-16 Thread Mark Brown
their long names. Signed-off-by: Mark Brown --- tools/testing/selftests/alsa/mixer-test.c | 98 +++ tools/testing/selftests/alsa/pcm-test.c | 64 ++-- 2 files changed, 104 insertions(+), 58 deletions(-) diff --git a/tools/testing/selftests/alsa/mixer

[PATCH v2 2/2] kselftest/alsa: Log the PCM ID in pcm-test

2024-07-16 Thread Mark Brown
Drivers report a string with a name for each PCM, log it during startup of pcm-test as a diagnostic aid. Signed-off-by: Mark Brown --- tools/testing/selftests/alsa/pcm-test.c | 4 1 file changed, 4 insertions(+) diff --git a/tools/testing/selftests/alsa/pcm-test.c b/tools/testing

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

2024-07-17 Thread Mark Brown
On Tue, Jul 16, 2024 at 06:50:12PM +, Edgecombe, Rick P wrote: > On Wed, 2024-07-10 at 19:27 +0100, Mark Brown wrote: > > On Wed, Jul 10, 2024 at 12:36:21PM +0200, Florian Weimer wrote: > > > We also have a gap on x86-64 for backtrace generation because the > > &

Re: [PATCH v9 35/39] kselftest/arm64: Add a GCS test program built with the system libc

2024-07-18 Thread Mark Brown
On Thu, Jul 18, 2024 at 01:14:41PM -0300, Thiago Jung Bauermann wrote: > In my FVP VM, this test gets a GCS SIGSEGV before running the first test: Do you have THP enabled? That still doesn't work (I'm expecting it to be fixed with -rc1). signature.asc Description: PGP signature

Re: [PATCH v9 35/39] kselftest/arm64: Add a GCS test program built with the system libc

2024-07-22 Thread Mark Brown
On Thu, Jul 18, 2024 at 07:28:32PM -0300, Thiago Jung Bauermann wrote: > Mark Brown writes: > > Do you have THP enabled? That still doesn't work (I'm expecting it to > > be fixed with -rc1). > I did have it enabled. After turning it off in the kernel config, the &g

Re: [PATCH v9 38/39] kselftest/arm64: Add a GCS stress test

2024-07-22 Thread Mark Brown
On Thu, Jul 18, 2024 at 08:47:49PM -0300, Thiago Jung Bauermann wrote: > Thiago Jung Bauermann writes: > > # # Totals: pass:0 fail:9 xfail:0 xpass:0 skip:0 error:0 > > ok 1 selftests: arm64: gcs-stress > Also, Shouldn't the test report "not ok" at the end considering that > there were fails? It

Re: [PATCH v9 38/39] kselftest/arm64: Add a GCS stress test

2024-07-22 Thread Mark Brown
On Thu, Jul 18, 2024 at 08:34:18PM -0300, Thiago Jung Bauermann wrote: > Mark Brown writes: > # # Waiting for 9 children > # # Thread-4030: Failed to enable GCS > # # Thread-4031: Failed to enable GCS This is already fixed locally, just rebasing bitrot. signature.asc Desc

[PATCH RFT v7 0/9] fork: Support shadow stacks in clone3()

2024-07-31 Thread Mark Brown
adow 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 v7: - Rebase onto v6.11-rc1. - Typo fixes. - Link to v6: https://lore.kernel.org/r/20240623-clone3-shadow-stack

[PATCH RFT v7 1/9] Documentation: userspace-api: Add shadow stack API documentation

2024-07-31 Thread Mark Brown
feature let's provide some documentation covering the common aspects. Signed-off-by: Mark Brown --- Documentation/userspace-api/index.rst| 1 + Documentation/userspace-api/shadow_stack.rst | 41 2 files changed, 42 insertions(+) diff --git a/Document

[PATCH RFT v7 2/9] selftests: Provide helper header for shadow stack testing

2024-07-31 Thread Mark Brown
interfaces. Reviewed-by: Rick Edgecombe Signed-off-by: Mark Brown --- tools/testing/selftests/ksft_shstk.h | 63 1 file changed, 63 insertions(+) diff --git a/tools/testing/selftests/ksft_shstk.h b/tools/testing/selftests/ksft_shstk.h new file mode 100644 index

[PATCH RFT v7 3/9] mm: Introduce ARCH_HAS_USER_SHADOW_STACK

2024-07-31 Thread Mark Brown
Gupta Reviewed-by: Rick Edgecombe Signed-off-by: Mark Brown --- arch/x86/Kconfig | 1 + fs/proc/task_mmu.c | 2 +- include/linux/mm.h | 2 +- mm/Kconfig | 6 ++ 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 007bab9f2a0e

[PATCH RFT v7 4/9] fork: Add shadow stack support to clone3()

2024-07-31 Thread Mark Brown
-by: Mark Brown --- arch/x86/include/asm/shstk.h | 11 +++-- arch/x86/kernel/process.c| 2 +- arch/x86/kernel/shstk.c | 104 +-- include/linux/sched/task.h | 13 ++ include/uapi/linux/sched.h | 13 -- kernel/fork.c

[PATCH RFT v7 5/9] selftests/clone3: Remove redundant flushes of output streams

2024-07-31 Thread Mark Brown
Signed-off-by: Mark Brown --- tools/testing/selftests/clone3/clone3_selftests.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/tools/testing/selftests/clone3/clone3_selftests.h b/tools/testing/selftests/clone3/clone3_selftests.h index 3d2663fe50ba..39b5dcba663c 100644 --- a/tools/testing/s

<    1   2   3   4   5   6   7   8   9   >