Re: [PATCH v2] selftests: openat2: don't print total number of tests and then skip

2024-08-01 Thread Muhammad Usama Anjum
On 8/1/24 10:27 PM, Shuah Khan wrote: > On 8/1/24 10:27, Shuah Khan wrote: >> On 8/1/24 02:42, Muhammad Usama Anjum wrote: >>> On 7/31/24 9:57 PM, Shuah Khan wrote: On 7/31/24 07:39, Muhammad Usama Anjum wrote: > Don't print that 88 sub-tests are going to be executed, but then skip. >

Re: [PATCH v2] selftests: openat2: don't print total number of tests and then skip

2024-08-01 Thread Muhammad Usama Anjum
On 8/1/24 9:27 PM, Shuah Khan wrote: > On 8/1/24 02:42, Muhammad Usama Anjum wrote: >> On 7/31/24 9:57 PM, Shuah Khan wrote: >>> On 7/31/24 07:39, Muhammad Usama Anjum wrote: Don't print that 88 sub-tests are going to be executed, but then skip. This is against TAP compliance. Instead che

Re: [PATCH net 0/7] mptcp: fix endpoints with 'signal' and 'subflow' flags

2024-08-01 Thread patchwork-bot+netdevbpf
Hello: This series was applied to netdev/net.git (main) by Jakub Kicinski : On Wed, 31 Jul 2024 13:05:52 +0200 you wrote: > When looking at improving the user experience around the MPTCP endpoints > setup, I noticed that setting an endpoint with both the 'signal' and the > 'subflow' flags -- as i

[PATCH net-next v3 3/3] selftests: net: ksft: replace 95 with errno.EOPNOTSUPP

2024-08-01 Thread Stanislav Fomichev
Petr suggested to use errno.EOPNOTSUPP instead of hard-coded 95 in the new test case. Adjust existing ones to match this style. Signed-off-by: Stanislav Fomichev -- Cc: Shuah Khan Cc: Joe Damato Cc: Petr Machata Cc: linux-kselftest@vger.kernel.org --- tools/testing/selftests/drivers/net/hw/pp

[PATCH net-next v3 1/3] selftests: net-drv: exercise queue stats when the device is down

2024-08-01 Thread Stanislav Fomichev
Verify that total device stats don't decrease after it has been turned down. Also make sure the device doesn't crash when we access per-queue stats when it's down (in case it tries to access some pointers that are NULL). KTAP version 1 1..5 ok 1 stats.check_pause ok 2 stats.check_fec ok

[PATCH net-next v3 2/3] selftests: net: ksft: support marking tests as disruptive

2024-08-01 Thread Stanislav Fomichev
Add new @ksft_disruptive decorator to mark the tests that might be disruptive to the system. Depending on how well the previous test works in the CI we might want to disable disruptive tests by default and only let the developers run them manually. KSFT framework runs disruptive tests by default.

Re: [PATCH] selftests: tpm2: redirect python unittest logs to stdout

2024-08-01 Thread Shuah Khan
On 8/1/24 16:24, Jarkko Sakkinen wrote: On Wed Jul 31, 2024 at 8:45 PM EEST, Shuah Khan wrote: On 7/31/24 07:42, Muhammad Usama Anjum wrote: Reminder top post??? On 7/10/24 1:15 PM, Muhammad Usama Anjum wrote: The python unittest module writes all its output to stderr, even when the run i

Re: [PATCH] selftests: tpm2: redirect python unittest logs to stdout

2024-08-01 Thread Jarkko Sakkinen
On Wed Jul 31, 2024 at 8:45 PM EEST, Shuah Khan wrote: > On 7/31/24 07:42, Muhammad Usama Anjum wrote: > > Reminder > > > > top post??? > > > On 7/10/24 1:15 PM, Muhammad Usama Anjum wrote: > >> The python unittest module writes all its output to stderr, even when > >> the run is clean. Redirect i

Re: [PATCH] selftests: tpm2: redirect python unittest logs to stdout

2024-08-01 Thread Jarkko Sakkinen
On Wed Jul 31, 2024 at 4:42 PM EEST, Muhammad Usama Anjum wrote: > Reminder > > On 7/10/24 1:15 PM, Muhammad Usama Anjum wrote: > > The python unittest module writes all its output to stderr, even when > > the run is clean. Redirect its output logs to stdout. > > > > Cc: Jarkko Sakkinen > > Signe

RE: [PATCH RFC] kselftest: devices: Add test to detect missing devices

2024-08-01 Thread Bird, Tim
> -Original Message- > From: Nícolas F. R. A. Prado > On Thu, Aug 01, 2024 at 02:13:05PM -0600, Shuah Khan wrote: > > On 8/1/24 13:15, Nícolas F. R. A. Prado wrote: > > > On Wed, Jul 31, 2024 at 05:19:45PM -0600, Shuah Khan wrote: > > > > On 7/24/24 15:40, Nícolas F. R. A. Prado wrote: >

Re: [PATCH RFC] kselftest: devices: Add test to detect missing devices

2024-08-01 Thread Shuah Khan
On 8/1/24 15:03, Nícolas F. R. A. Prado wrote: On Thu, Aug 01, 2024 at 02:13:05PM -0600, Shuah Khan wrote: On 8/1/24 13:15, Nícolas F. R. A. Prado wrote: On Wed, Jul 31, 2024 at 05:19:45PM -0600, Shuah Khan wrote: On 7/24/24 15:40, Nícolas F. R. A. Prado wrote: Introduce a new test to identif

Re: [PATCH net-next v2 1/2] selftests: net-drv: exercise queue stats when the device is down

2024-08-01 Thread Petr Machata
Stanislav Fomichev writes: > On 08/01, Petr Machata wrote: >> >> Stanislav Fomichev writes: >> >> > On 07/31, Jakub Kicinski wrote: >> >> On Wed, 31 Jul 2024 13:34:58 +0200 Petr Machata wrote: >> >> > > +qstat = netfam.qstats_get({"ifindex": cfg.ifindex}, >> >> > > dump=True) >> >>

Re: [PATCH net-next v2 2/2] selftests: net: ksft: support marking tests as disruptive

2024-08-01 Thread Petr Machata
Jakub Kicinski writes: > On Thu, 1 Aug 2024 10:36:18 +0200 Petr Machata wrote: >> You seem to be right about the exit code. This was discussed some time >> ago, that SKIP is considered a sort of a failure. As the person running >> the test you would want to go in and fix whatever configuration

Re: [PATCH RFC] kselftest: devices: Add test to detect missing devices

2024-08-01 Thread Nícolas F . R . A . Prado
On Thu, Aug 01, 2024 at 02:13:05PM -0600, Shuah Khan wrote: > On 8/1/24 13:15, Nícolas F. R. A. Prado wrote: > > On Wed, Jul 31, 2024 at 05:19:45PM -0600, Shuah Khan wrote: > > > On 7/24/24 15:40, Nícolas F. R. A. Prado wrote: > > > > Introduce a new test to identify regressions causing devices to

Re: [PATCH RFC] kselftest: devices: Add test to detect missing devices

2024-08-01 Thread Shuah Khan
On 8/1/24 13:15, Nícolas F. R. A. Prado wrote: On Wed, Jul 31, 2024 at 05:19:45PM -0600, Shuah Khan wrote: On 7/24/24 15:40, Nícolas F. R. A. Prado wrote: Introduce a new test to identify regressions causing devices to go missing on the system. For each bus and class on the system the test che

Re: [PATCH] MAINTAINERS: Add selftests/x86 entry

2024-08-01 Thread Shuah Khan
On 8/1/24 13:27, Shuah Khan wrote: On 7/31/24 15:23, Peter Zijlstra wrote: On Wed, Jul 31, 2024 at 12:14:16PM -0600, Shuah Khan wrote: On 7/31/24 07:42, Muhammad Usama Anjum wrote: Kind reminder On 7/2/24 3:17 PM, Muhammad Usama Anjum wrote: Kind reminder Top post ??? On 6/10/24 10:28 A

Re: [PATCH] MAINTAINERS: Add selftests/x86 entry

2024-08-01 Thread Shuah Khan
On 7/31/24 15:23, Peter Zijlstra wrote: On Wed, Jul 31, 2024 at 12:14:16PM -0600, Shuah Khan wrote: On 7/31/24 07:42, Muhammad Usama Anjum wrote: Kind reminder On 7/2/24 3:17 PM, Muhammad Usama Anjum wrote: Kind reminder Top post ??? On 6/10/24 10:28 AM, Muhammad Usama Anjum wrote: Ther

Re: [PATCH RFC] kselftest: devices: Add test to detect missing devices

2024-08-01 Thread Nícolas F . R . A . Prado
On Wed, Jul 31, 2024 at 05:19:45PM -0600, Shuah Khan wrote: > On 7/24/24 15:40, Nícolas F. R. A. Prado wrote: > > Introduce a new test to identify regressions causing devices to go > > missing on the system. > > > > For each bus and class on the system the test checks the number of > > devices pre

Re: [PATCH] KVM: selftests: arm64: Correct feature test for S1PIE in get-reg-list

2024-08-01 Thread Mark Brown
On Thu, Aug 01, 2024 at 05:45:49PM +0100, Marc Zyngier wrote: > Can we please switch all this stuff to symbolic naming instead of > magic numbers? Given how much effort is going into the "automated > generation" thing, it is mind-boggling that the tests still rely on > handcrafted numbers. We just

Re: [PATCH] selftests: tc-testing: Fixed Typo error

2024-08-01 Thread Simon Horman
On Wed, Jul 31, 2024 at 06:07:38PM +, Karan Sanghavi wrote: > Corrected the typographical of the word "different" > in the "name" field of the JSON object with ID "4319". > > Signed-off-by: Karan Sanghavi Thanks, I checked an this is the item flagged by codespell in this file. ...

Re: [PATCH net-next v8 3/3] selftests: add MSG_ZEROCOPY msg_control notification test

2024-08-01 Thread Zijian Zhang
On 8/1/24 10:36 AM, Willem de Bruijn wrote: On Thu, Aug 1, 2024 at 1:30 PM Zijian Zhang wrote: -static bool do_sendmsg(int fd, struct msghdr *msg, bool do_zerocopy, int domain) +static void add_zcopy_info(struct msghdr *msg) +{ +struct zc_info *zc_info; +struct cmsghdr *cm; + +if

Re: [syzbot] [mm?] WARNING in hpage_collapse_scan_pmd (2)

2024-08-01 Thread syzbot
syzbot has bisected this issue to: commit ef5b6a542b1dbb718226a5f8208be09ef405983d Author: Paolo Bonzini Date: Wed Nov 8 09:40:35 2023 + selftests: kvm/s390x: use vm_create_barebones() bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=14071cd398 start commit: e67572cd

Re: [PATCH net-next v8 2/3] sock: add MSG_ZEROCOPY notification mechanism based on msg_control

2024-08-01 Thread Willem de Bruijn
On Wed, Jul 31, 2024 at 9:29 PM Jakub Kicinski wrote: > > On Wed, 31 Jul 2024 18:20:35 -0400 Willem de Bruijn wrote: > > Btw patchwork shows red for patch 1/3 due to a new error or warning. > > Not sure if it's a false positive, but take a look. > > Patchwork is not for contributors, I keep repeat

Re: [PATCH v4] selftest: acct: Add selftest for the acct() syscall

2024-08-01 Thread Shuah Khan
On 8/1/24 03:29, Abdulrasaq Lawani wrote: The acct() system call enables or disables process accounting. If accounting is turned on, records for each terminating process are appended to a specified filename as it terminates. An argument of NULL causes accounting to be turned off. This patch will

Re: [PATCH net-next v8 3/3] selftests: add MSG_ZEROCOPY msg_control notification test

2024-08-01 Thread Willem de Bruijn
On Thu, Aug 1, 2024 at 1:30 PM Zijian Zhang wrote: > > On 7/31/24 3:32 PM, Willem de Bruijn wrote: > > zijianzhang@ wrote: > >> From: Zijian Zhang > >> > >> We update selftests/net/msg_zerocopy.c to accommodate the new mechanism, > > First of all, thanks for the detailed suggestions! > > > > > Pl

Re: [PATCH net-next v8 3/3] selftests: add MSG_ZEROCOPY msg_control notification test

2024-08-01 Thread Zijian Zhang
On 7/31/24 3:32 PM, Willem de Bruijn wrote: zijianzhang@ wrote: From: Zijian Zhang We update selftests/net/msg_zerocopy.c to accommodate the new mechanism, First of all, thanks for the detailed suggestions! Please make commit messages stand on their own. If someone does a git blame, make

Re: [PATCH v2] selftests: openat2: don't print total number of tests and then skip

2024-08-01 Thread Shuah Khan
On 8/1/24 10:27, Shuah Khan wrote: On 8/1/24 02:42, Muhammad Usama Anjum wrote: On 7/31/24 9:57 PM, Shuah Khan wrote: On 7/31/24 07:39, Muhammad Usama Anjum wrote: Don't print that 88 sub-tests are going to be executed, but then skip. This is against TAP compliance. Instead check pre-requisite

Re: [PATCH net-next 1/6] net: netconsole: selftests: Create a new netconsole selftest

2024-08-01 Thread Jakub Kicinski
On Thu, 1 Aug 2024 09:11:58 -0700 Breno Leitao wrote: > .../net/netconsole/basic_integration_test.sh | 153 ++ It needs to be included in a Makefile If we only have one script I'd put it directly in .../net/, or drivers/netdevsim/? each target should technically have a Kconfig,

Re: [PATCH] KVM: selftests: arm64: Correct feature test for S1PIE in get-reg-list

2024-08-01 Thread Marc Zyngier
On Wed, 31 Jul 2024 17:21:13 +0100, Mark Brown wrote: > > The ID register for S1PIE is ID_AA64MMFR3_EL1.S1PIE which is bits 11:8 but > get-reg-list uses a shift of 4, checking SCTLRX instead. Use a shift of 8 > instead. > > Fixes: 5f0419a0083b ("KVM: selftests: get-reg-list: add Permission > In

Re: [PATCH v2] selftests: openat2: don't print total number of tests and then skip

2024-08-01 Thread Shuah Khan
On 8/1/24 02:42, Muhammad Usama Anjum wrote: On 7/31/24 9:57 PM, Shuah Khan wrote: On 7/31/24 07:39, Muhammad Usama Anjum wrote: Don't print that 88 sub-tests are going to be executed, but then skip. This is against TAP compliance. Instead check pre-requisites first before printing total number

[PATCH net-next 6/6] selftests: fib_nexthops: Test 16-bit next hop weights

2024-08-01 Thread Petr Machata
Add tests that attempt to create NH groups that use full 16 bits of NH weight. Signed-off-by: Petr Machata Reviewed-by: Ido Schimmel --- tools/testing/selftests/net/fib_nexthops.sh | 55 - 1 file changed, 54 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/

[PATCH net-next 5/6] selftests: router_mpath_nh_res: Test 16-bit next hop weights

2024-08-01 Thread Petr Machata
Add tests that exercise full 16 bits of NH weight. Like in the previous patch, omit the 255:65535 test when KSFT_MACHINE_SLOW. Signed-off-by: Petr Machata Reviewed-by: Ido Schimmel --- .../net/forwarding/router_mpath_nh_res.sh | 56 --- 1 file changed, 48 insertions(+), 8 d

[PATCH net-next 4/6] selftests: router_mpath_nh: Test 16-bit next hop weights

2024-08-01 Thread Petr Machata
Add tests that exercise full 16 bits of NH weight. To test the 255:65535, it is necessary to run more packets than for the other tests. On a debug kernel, the test can take up to a minute, therefore avoid the test when KSFT_MACHINE_SLOW. Signed-off-by: Petr Machata Reviewed-by: Ido Schimmel ---

[PATCH net-next 3/6] selftests: router_mpath: Sleep after MZ

2024-08-01 Thread Petr Machata
In the context of an offloaded datapath, it may take a while for the ip link stats to be updated. This causes the test to fail when MZ_DELAY is too low. Sleep after the packets are sent for the link stats to get up to date. Signed-off-by: Petr Machata Reviewed-by: Ido Schimmel --- tools/testing

[PATCH net-next 1/6] net: netconsole: selftests: Create a new netconsole selftest

2024-08-01 Thread Breno Leitao
Adds a selftest that creates two virtual interfaces, assigns one to a new namespace, and assigns IP addresses to both. It listens on the destination interface using netcat and configures a dynamic target on netconsole, pointing to the destination IP address. The test then checks if the message wa

Re: [PATCH net-next v2 1/2] selftests: net-drv: exercise queue stats when the device is down

2024-08-01 Thread Stanislav Fomichev
On 08/01, Petr Machata wrote: > > Stanislav Fomichev writes: > > > On 07/31, Jakub Kicinski wrote: > >> On Wed, 31 Jul 2024 13:34:58 +0200 Petr Machata wrote: > >> > > +qstat = netfam.qstats_get({"ifindex": cfg.ifindex}, dump=True) > >> > > +except NlError as e: > >> > > +if

Re: [PATCH v3 07/10] selftests: kvm: s390: Add uc_map_unmap VM test case

2024-08-01 Thread Christoph Schlameuss
On Thu, 1 Aug 2024 11:08:30 +0200 Janosch Frank wrote: > On 7/30/24 9:24 AM, Christoph Schlameuss wrote: > > Add a test case verifying basic running and interaction of ucontrol VMs. > > Fill the segment and page tables for allocated memory and map memory on > > first access. > > > > * uc_map_unm

Re: [PATCH net-next v2 2/2] selftests: net: ksft: support marking tests as disruptive

2024-08-01 Thread Jakub Kicinski
On Thu, 1 Aug 2024 10:36:18 +0200 Petr Machata wrote: > You seem to be right about the exit code. This was discussed some time > ago, that SKIP is considered a sort of a failure. As the person running > the test you would want to go in and fix whatever configuration issue is > preventing the test f

[PATCH v10 40/40] KVM: selftests: arm64: Add GCS registers to get-reg-list

2024-08-01 Thread Mark Brown
GCS adds new registers GCSCR_EL1, GCSCRE0_EL1, GCSPR_EL1 and GCSPR_EL0. Add these to those validated by get-reg-list. Signed-off-by: Mark Brown --- tools/testing/selftests/kvm/aarch64/get-reg-list.c | 28 ++ 1 file changed, 28 insertions(+) diff --git a/tools/testing/selftes

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

2024-08-01 Thread Mark Brown
While it's a bit off topic for them the floating point stress tests do give us some coverage of context thrashing cases, and also of active signal delivery separate to the relatively complicated framework in the actual signals tests. Have the tests enable GCS on startup, ignoring failures so they c

[PATCH v10 38/40] kselftest/arm64: Add a GCS stress test

2024-08-01 Thread Mark Brown
Add a stress test which runs one more process than we have CPUs spinning through a very recursive function with frequent syscalls immediately prior to return and signals being injected every 100ms. The goal is to flag up any scheduling related issues, for example failure to ensure that barriers are

[PATCH v10 37/40] kselftest/arm64: Add GCS signal tests

2024-08-01 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 v10 36/40] kselftest/arm64: Add test coverage for GCS mode locking

2024-08-01 Thread Mark Brown
Verify that we can lock individual GCS mode bits, that other modes aren't affected and as a side effect also that every combination of modes can be enabled. Normally the inability to reenable GCS after disabling it would be an issue with testing but fortunately the kselftest_harness runs each test

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

2024-08-01 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 v10 34/40] kselftest/arm64: Add very basic GCS test program

2024-08-01 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 v10 33/40] kselftest/arm64: Always run signals tests with GCS enabled

2024-08-01 Thread Mark Brown
Since it is not possible to return from the function that enabled GCS without disabling GCS it is very inconvenient to use the signal handling tests to cover GCS when GCS is not enabled by the toolchain and runtime, something that no current distribution does. Since none of the testcases do anythin

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

2024-08-01 Thread Mark Brown
Currently we ignore si_code unless the expected signal is a SIGSEGV, in which case we enforce it being SEGV_ACCERR. Allow test cases to specify exactly which si_code should be generated so we can validate this, and test for other segfault codes. Reviewed-by: Thiago Jung Bauermann Signed-off-by: M

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

2024-08-01 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 v10 30/40] kselftest/arm64: Add GCS as a detected feature in the signal tests

2024-08-01 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/te

[PATCH v10 29/40] selftests/clone3: Enable arm64 shadow stack testing

2024-08-01 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 v10 28/40] kselftest: Provide shadow stack enable helpers for arm64

2024-08-01 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/t

[PATCH v10 27/40] kselftest/arm64: Verify the GCS hwcap

2024-08-01 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 i

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

2024-08-01 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 ind

[PATCH v10 25/40] arm64/ptrace: Expose GCS via ptrace and core files

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

[PATCH v10 24/40] arm64/signal: Expose GCS state in signal frames

2024-08-01 Thread Mark Brown
Add a context for the GCS state and include it in the signal context when running on a system that supports GCS. We reuse the same flags that the prctl() uses to specify which GCS features are enabled and also provide the current GCS pointer. We do not support enabling GCS via signal return, there

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

2024-08-01 Thread Mark Brown
When invoking a signal handler we use the GCS configuration and stack for the current thread. Since we implement signal return by calling the signal handler with a return address set up pointing to a trampoline in the vDSO we need to also configure any active GCS for this by pushing a frame for th

[PATCH v10 22/40] arm64/mm: Implement map_shadow_stack()

2024-08-01 Thread Mark Brown
As discussed extensively in the changelog for the addition of this syscall on x86 ("x86/shstk: Introduce map_shadow_stack syscall") the existing mmap() and madvise() syscalls do not map entirely well onto the security requirements for guarded control stacks since they lead to windows where memory i

[PATCH v10 21/40] arm64/gcs: Implement shadow stack prctl() interface

2024-08-01 Thread Mark Brown
Implement the architecture neutral prtctl() interface for setting the shadow stack status, this supports setting and reading the current GCS configuration for the current thread. Userspace can enable basic GCS functionality and additionally also support for GCS pushes and arbitrary GCS stores. It

[PATCH v10 20/40] arm64/gcs: Ensure that new threads have a GCS

2024-08-01 Thread Mark Brown
When a new thread is created by a thread with GCS enabled the GCS needs to be specified along with the regular stack. clone3() has been extended to support this case, allowing userspace to explicitly specify the size and location of the GCS. The specified GCS must have a valid GCS token at the to

[PATCH v10 19/40] arm64/gcs: Context switch GCS state for EL0

2024-08-01 Thread Mark Brown
There are two registers controlling the GCS state of EL0, GCSPR_EL0 which is the current GCS pointer and GCSCRE0_EL1 which has enable bits for the specific GCS functionality enabled for EL0. Manage these on context switch and process lifetime events, GCS is reset on exec(). Also ensure that any ch

[PATCH v10 18/40] arm64/mm: Handle GCS data aborts

2024-08-01 Thread Mark Brown
All GCS operations at EL0 must happen on a page which is marked as having UnprivGCS access, including read operations. If a GCS operation attempts to access a page without this then it will generate a data abort with the GCS bit set in ESR_EL1.ISS2. EL0 may validly generate such faults, for examp

[PATCH v10 17/40] arm64/traps: Handle GCS exceptions

2024-08-01 Thread Mark Brown
A new exception code is defined for GCS specific faults other than standard load/store faults, for example GCS token validation failures, add handling for this. These faults are reported to userspace as segfaults with code SEGV_CPERR (protection error), mirroring the reporting for x86 shadow stack

[PATCH v10 16/40] arm64/hwcap: Add hwcap for GCS

2024-08-01 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/cpufeat

[PATCH v10 15/40] arm64/idreg: Add overrride for GCS

2024-08-01 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 | 3 +++ arch/arm64/kernel/pi/idreg-override.c

[PATCH v10 14/40] KVM: arm64: Manage GCS access and registers for guests

2024-08-01 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. In order to allow guests to use GCS we also need to configure HCRX_EL2.GCSEn, if this is not set GCS instructions will be noops and CH

[PATCH v10 13/40] arm64/mm: Map pages for guarded control stack

2024-08-01 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 v10 12/40] mm: Define VM_SHADOW_STACK for arm64 when we support GCS

2024-08-01 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 +- include/linux/mm.h | 12 +++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Documentation/fi

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

2024-08-01 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 | 9 + arch/arm64/tools/cpucaps| 1 + 3

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

2024-08-01 Thread Mark Brown
Pages used for guarded control stacks need to be described to the hardware using the Permission Indirection Extension, GCS is not supported without PIE. In order to support copy on write for guarded stacks we allocate two values, one for active GCSs and one for GCS pages marked as read only prior t

[PATCH v10 09/40] arm64/gcs: Provide basic EL2 setup to allow GCS usage at EL0 and EL1

2024-08-01 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. We also initialise GCSCR_EL1 and GCSCRE0_EL1 to ensure that we can execute functio

[PATCH v10 08/40] arm64/gcs: Provide put_user_gcs()

2024-08-01 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 insertio

[PATCH v10 07/40] arm64/gcs: Add manual encodings of GCS instructions

2024-08-01 Thread Mark Brown
Define C callable functions for GCS instructions used by the kernel. In order to avoid ambitious toolchain requirements for GCS support these are manually encoded, this means we have fixed register numbers which will be a bit limiting for the compiler but none of these should be used in sufficientl

[PATCH v10 06/40] arm64/sysreg: Add definitions for architected GCS caps

2024-08-01 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/includ

[PATCH v10 05/40] arm64/gcs: Document the ABI for Guarded Control Stacks

2024-08-01 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 v10 04/40] arm64: Document boot requirements for Guarded Control Stacks

2024-08-01 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. Since if GCS is enabled any function call instruction will be checked we also require that the feature be specifically disabled. Signed-off

[PATCH v10 03/40] mman: Add map_shadow_stack() flags

2024-08-01 Thread Mark Brown
In preparation for adding arm64 GCS support make the map_shadow_stack() SHADOW_STACK_SET_TOKEN flag generic and add _SET_MARKER. The existing flag indicats that a token usable for stack switch should be added to the top of the newly mapped GCS region while the new flag indicates that a top of stack

[PATCH v10 02/40] prctl: arch-agnostic prctl for shadow stack

2024-08-01 Thread Mark Brown
Three architectures (x86, aarch64, riscv) have announced support for shadow stacks with fairly similar functionality. While x86 is using arch_prctl() to control the functionality neither arm64 nor riscv uses that interface so this patch adds arch-agnostic prctl() support to get and set status of s

[PATCH v10 01/40] arm64/mm: Restructure arch_validate_flags() for extensibility

2024-08-01 Thread Mark Brown
Currently arch_validate_flags() is written in a very non-extensible fashion, returning immediately if MTE is not supported and writing the MTE check as a direct return. Since we will want to add more checks for GCS refactor the existing code to be more extensible, no functional change intended. Re

[PATCH v10 00/40] arm64/gcs: Provide support for GCS in userspace

2024-08-01 Thread Mark Brown
The arm64 Guarded Control Stack (GCS) feature provides support for hardware protected stacks of return addresses, intended to provide hardening against return oriented programming (ROP) attacks and to make it easier to gather call stacks for applications such as profiling. When GCS is active a sec

Re: [PATCH v3 10/10] s390: Enable KVM_S390_UCONTROL config in debug_defconfig

2024-08-01 Thread Janosch Frank
On 7/30/24 9:24 AM, Christoph Schlameuss wrote: To simplify testing enable UCONTROL KVM by default in debug kernels. Signed-off-by: Christoph Schlameuss --- arch/s390/configs/debug_defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/s390/configs/debug_defconfig b/arch/s390/co

Re: [PATCH bpf-next 4/4] selftests/bpf: convert test_skb_cgroup_id_user to test_progs

2024-08-01 Thread Alexis Lothoré
On 8/1/24 10:49, Alan Maguire wrote: > On 31/07/2024 11:38, Alexis Lothoré (eBPF Foundation) wrote: [...] >> +static int wait_local_ip(void) >> +{ >> +char *ping_cmd = ping_command(AF_INET6); >> +int i, err; >> + >> +for (i = 0; i < WAIT_AUTO_IP_MAX_ATTEMPT; i++) { >> +err

Re: [PATCH bpf-next 3/4] selftests/bpf: add proper section name to bpf prog and rename it

2024-08-01 Thread Alexis Lothoré
On 8/1/24 10:35, Alan Maguire wrote: > On 31/07/2024 11:38, Alexis Lothoré (eBPF Foundation) wrote: >> test_skb_cgroup_id_kern.c is currently involved in a manual test. In its >> current form, it can not be used with the auto-generated skeleton APIs, >> because the section name is not valid to allo

[PATCH v4] selftest: acct: Add selftest for the acct() syscall

2024-08-01 Thread Abdulrasaq Lawani
The acct() system call enables or disables process accounting. If accounting is turned on, records for each terminating process are appended to a specified filename as it terminates. An argument of NULL causes accounting to be turned off. This patch will add a test for the acct() syscall. Signed-

Re: [PATCH] KVM: selftests: arm64: Correct feature test for S1PIE in get-reg-list

2024-08-01 Thread Joey Gouly
On Wed, Jul 31, 2024 at 05:21:13PM +0100, Mark Brown wrote: > The ID register for S1PIE is ID_AA64MMFR3_EL1.S1PIE which is bits 11:8 but > get-reg-list uses a shift of 4, checking SCTLRX instead. Use a shift of 8 > instead. > > Fixes: 5f0419a0083b ("KVM: selftests: get-reg-list: add Permission >

Re: [PATCH bpf-next 2/4] selftests/bpf: convert test_cgroup_storage to test_progs

2024-08-01 Thread Alexis Lothoré
On 8/1/24 10:27, Alan Maguire wrote: > On 31/07/2024 11:38, Alexis Lothoré (eBPF Foundation) wrote: >> test_cgroup_storage is currently a standalone program which is not run >> when executing test_progs. >> >> Convert it to the test_progs framework so it can be automatically executed >> in CI. The

Re: [PATCH v3 09/10] selftests: kvm: s390: Verify reject memory region operations for ucontrol VMs

2024-08-01 Thread Janosch Frank
On 7/30/24 9:24 AM, Christoph Schlameuss wrote: Add a test case verifying KVM_SET_USER_MEMORY_REGION and KVM_SET_USER_MEMORY_REGION2 cannot be executed on ucontrol VMs. Executing this test case on not patched kernels will cause a null pointer dereference in the host kernel. This is fixed with co

Re: [PATCH v3 07/10] selftests: kvm: s390: Add uc_map_unmap VM test case

2024-08-01 Thread Janosch Frank
On 7/30/24 9:24 AM, Christoph Schlameuss wrote: Add a test case verifying basic running and interaction of ucontrol VMs. Fill the segment and page tables for allocated memory and map memory on first access. * uc_map_unmap Store and load data to mapped and unmapped memory and use pic segment

Re: [PATCH net-next v2 2/2] selftests: net: ksft: support marking tests as disruptive

2024-08-01 Thread Petr Machata
Stanislav Fomichev writes: > On 07/31, Petr Machata wrote: >> >> Stanislav Fomichev writes: >> >> > Add new @ksft_disruptive decorator to mark the tests that might >> > be disruptive to the system. Depending on how well the previous >> > test works in the CI we might want to disable disrupti

Re: [PATCH bpf-next 1/4] selftests/bpf: convert get_current_cgroup_id_user to test_progs

2024-08-01 Thread Alexis Lothoré
Hello Alan, On 8/1/24 10:17, Alan Maguire wrote: > On 31/07/2024 19:53, Alexis Lothoré wrote: >> Hello Alan, >> >> On 7/31/24 19:23, Alan Maguire wrote: >>> On 31/07/2024 11:38, Alexis Lothoré (eBPF Foundation) wrote: >> >> [...] >> + pid = getpid(); + if (!ASSERT_OK(bpf_map__update_el

Re: [PATCH net-next v2 1/2] selftests: net-drv: exercise queue stats when the device is down

2024-08-01 Thread Petr Machata
Stanislav Fomichev writes: > On 07/31, Jakub Kicinski wrote: >> On Wed, 31 Jul 2024 13:34:58 +0200 Petr Machata wrote: >> > > +qstat = netfam.qstats_get({"ifindex": cfg.ifindex}, dump=True) >> > > +except NlError as e: >> > > +if e.error == 95: >> > >> > Could you do this

Re: [PATCH bpf-next 4/4] selftests/bpf: convert test_skb_cgroup_id_user to test_progs

2024-08-01 Thread Alan Maguire
On 31/07/2024 11:38, Alexis Lothoré (eBPF Foundation) wrote: > test_skb_cgroup_id_user allows testing skb cgroup id retrieval at different > levels, but is not integrated in test_progs, so it is not run > automatically in CI. The test overlaps a bit with > cgroup_skb_sk_lookup_kern, which is integr

Re: [PATCH v3 05/10] selftests: kvm: s390: Add debug print functions

2024-08-01 Thread Janosch Frank
On 7/30/24 9:24 AM, Christoph Schlameuss wrote: [...] +#endif /* SELFTEST_KVM_DEBUG_PRINT_H */ diff --git a/tools/testing/selftests/kvm/s390x/ucontrol_test.c b/tools/testing/selftests/kvm/s390x/ucontrol_test.c index d103a92e7495..029233374465 100644 --- a/tools/testing/selftests/kvm/s390x/ucont

Re: [PATCH v2] selftests: openat2: don't print total number of tests and then skip

2024-08-01 Thread Muhammad Usama Anjum
On 7/31/24 9:57 PM, Shuah Khan wrote: > On 7/31/24 07:39, Muhammad Usama Anjum wrote: >> Don't print that 88 sub-tests are going to be executed, but then skip. >> This is against TAP compliance. Instead check pre-requisites first >> before printing total number of tests. > > Does TAP clearly menti

Re: [PATCH bpf-next 3/4] selftests/bpf: add proper section name to bpf prog and rename it

2024-08-01 Thread Alan Maguire
On 31/07/2024 11:38, Alexis Lothoré (eBPF Foundation) wrote: > test_skb_cgroup_id_kern.c is currently involved in a manual test. In its > current form, it can not be used with the auto-generated skeleton APIs, > because the section name is not valid to allow libbpf to deduce the program > type. >

Re: [PATCH bpf-next 2/4] selftests/bpf: convert test_cgroup_storage to test_progs

2024-08-01 Thread Alan Maguire
On 31/07/2024 11:38, Alexis Lothoré (eBPF Foundation) wrote: > test_cgroup_storage is currently a standalone program which is not run > when executing test_progs. > > Convert it to the test_progs framework so it can be automatically executed > in CI. The conversion led to the following changes: >

Re: [PATCH bpf-next 1/4] selftests/bpf: convert get_current_cgroup_id_user to test_progs

2024-08-01 Thread Alan Maguire
On 31/07/2024 19:53, Alexis Lothoré wrote: > Hello Alan, > > On 7/31/24 19:23, Alan Maguire wrote: >> On 31/07/2024 11:38, Alexis Lothoré (eBPF Foundation) wrote: > > [...] > >>> + pid = getpid(); >>> + if (!ASSERT_OK(bpf_map__update_elem(skel->maps.pidmap, &key, >>> +

Re: [PATCH v3 06/10] selftests: kvm: s390: Add VM run test case

2024-08-01 Thread Christoph Schlameuss
On Wed, 31 Jul 2024 16:37:19 +0200 Janosch Frank wrote: > On 7/30/24 9:24 AM, Christoph Schlameuss wrote: > > Add test case running code interacting with registers within a > > ucontrol VM. > > > > * Add uc_gprs test case > > > > The test uses the same VM setup using the fixture and debug macro