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

2024-06-23 Thread Mark Brown
The kernel has recently added support for shadow stacks, currently x86 only using their CET feature but both arm64 and RISC-V have equivalent features (GCS and Zicfiss respectively), I am actively working on GCS[1]. With shadow stacks the hardware maintains an additional stack containing only the

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

2024-06-23 Thread Mark Brown
There are a number of architectures with shadow stack features which we are presenting to userspace with as consistent an API as we can (though there are some architecture specifics). Especially given that there are some important considerations for userspace code interacting directly with the feat

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

2024-06-23 Thread Mark Brown
While almost all users of shadow stacks should be relying on the dynamic linker and libc to enable the feature there are several low level test programs where it is useful to enable without any libc support, allowing testing without full system enablement. This low level testing is helpful during b

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

2024-06-23 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 Reviewed-by: Deepak Gupt

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

2024-06-23 Thread Mark Brown
Unlike with the normal stack there is no API for configuring the the shadow stack for a new thread, instead the kernel will dynamically allocate a new shadow stack with the same size as the normal stack. This appears to be due to the shadow stack series having been in development since before the m

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

2024-06-23 Thread Mark Brown
Since there were widespread issues with output not being flushed the kselftest framework was modified to explicitly set the output streams unbuffered in commit 58e2847ad2e6 ("selftests: line buffer test program's stdout") so there is no need to explicitly flush in the clone3 tests. Signed-off-by:

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

2024-06-23 Thread Mark Brown
In order to make it easier to add more configuration for the tests and more support for runtime detection of when tests can be run pass the structure describing the tests into test_clone3() rather than picking the arguments out of it and have that function do all the per-test work. No functional c

[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/selfte

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

2024-06-23 Thread Mark Brown
The clone_args structure is extensible, with the syscall passing in the length of the structure. Inside the kernel we use copy_struct_from_user() to read the struct but this has the unfortunate side effect of silently accepting some overrun in the structure size providing the extra data is all zero

[PATCH RFT v6 9/9] selftests/clone3: Test shadow stack support

2024-06-23 Thread Mark Brown
Add basic test coverage for specifying the shadow stack for a newly created thread via clone3(), including coverage of the newly extended argument structure. We check that a user specified shadow stack can be provided, and that invalid combinations of parameters are rejected. In order to facilita

[PATCH] selftests/bpf: don't close(-1) in serial_test_fexit_stress()

2024-06-23 Thread Ma Ke
Guard close() with extra link_fd[i] >= 0 and fexit_fd[i] >= 0 check to prevent close(-1). Signed-off-by: Ma Ke --- tools/testing/selftests/bpf/prog_tests/fexit_stress.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/bpf/prog_tests/fexit_stress.c

Re: [PATCH v2 1/3] Fix userfaultfd_api to return EINVAL as expected

2024-06-23 Thread Peter Xu
On Fri, Jun 21, 2024 at 06:03:30PM -0700, Andrew Morton wrote: > On Fri, 21 Jun 2024 14:12:22 -0400 Audra Mitchell wrote: > > > Currently if we request a feature that is not set in the Kernel > > config we fail silently and return all the available features. However, > > the man page indicates we

Re: [PATCH v7 08/16] riscv: add ISA parsing for Zca, Zcf, Zcd and Zcb

2024-06-23 Thread Conor Dooley
On Wed, Jun 19, 2024 at 01:35:18PM +0200, Clément Léger wrote: > The Zc* standard extension for code reduction introduces new extensions. > This patch adds support for Zca, Zcf, Zcd and Zcb. Zce, Zcmt and Zcmp > are left out of this patch since they are targeting microcontrollers/ > embedded CPUs i

Re: [PATCH v2 net-next 0/7] selftests: net: Switch pmtu.sh to use the internal ovs script.

2024-06-23 Thread Aaron Conole
Jakub Kicinski writes: > On Thu, 20 Jun 2024 08:55:54 -0400 Aaron Conole wrote: >> This series enhances the ovs-dpctl utility to provide support for set() >> and tunnel() flow specifiers, better ipv6 handling support, and the >> ability to add tunnel vports, and LWT interfaces. Finally, it modif

Re: [PATCH net-next v12 06/13] page_pool: devmem support

2024-06-23 Thread Pavel Begunkov
On 6/21/24 19:48, Mina Almasry wrote: On Mon, Jun 17, 2024 at 7:17 AM Pavel Begunkov wrote: ... static inline unsigned long netmem_to_pfn(netmem_ref netmem) { + if (netmem_is_net_iov(netmem)) + return 0; IIRC 0 is a valid pfn. Not much of a concern since it's used only

Re: [PATCH net-next v12 10/13] tcp: RX path for devmem TCP

2024-06-23 Thread Pavel Begunkov
On 6/21/24 21:31, Mina Almasry wrote: On Mon, Jun 17, 2024 at 9:36 AM Pavel Begunkov wrote: On 6/13/24 02:35, Mina Almasry wrote: The pages awaiting freeing are stored in the newly added sk->sk_user_frags, and each page passed to userspace is get_page()'d. This reference is dropped once the

Re: [PATCH 1/2] selftest: rtc: Add to check rtc alarm status for alarm related test

2024-06-23 Thread Joseph Jang
On 2024/6/21 3:36 AM, Alexandre Belloni wrote: On 23/05/2024 18:38:06-0700, Joseph Jang wrote: In alarm_wkalm_set and alarm_wkalm_set_minute test, they use different ioctl (RTC_ALM_SET/RTC_WKALM_SET) for alarm feature detection. They will skip testing if RTC_ALM_SET/RTC_WKALM_SET ioctl return

Re: [PATCH 1/2] selftest: rtc: Add to check rtc alarm status for alarm related test

2024-06-23 Thread Joseph Jang
On 2024/6/21 3:36 AM, Alexandre Belloni wrote: > On 23/05/2024 18:38:06-0700, Joseph Jang wrote: >> In alarm_wkalm_set and alarm_wkalm_set_minute test, they use different >> ioctl (RTC_ALM_SET/RTC_WKALM_SET) for alarm feature detection. They will >> skip testing if RTC_ALM_SET/RTC_WKALM_SET ioctl

Re: [PATCH v4 1/4] mm/memory-failure: refactor log format in soft offline code

2024-06-23 Thread Miaohe Lin
On 2024/6/21 2:48, Jiaqi Yan wrote: > Logs from soft_offline_page and soft_offline_in_use_page have > different formats than majority of the memory failure code: > > "Memory failure: 0x${pfn}: ${lower_case_message}" > > Convert them to the following format: > > "Soft offline: 0x${pfn}: ${low

Re: [RFC PATCH 2/2] riscv: selftests: Add a ptrace test to check a0 of restarted syscall

2024-06-23 Thread Quan Zhou
On 2024/6/22 04:20, Charlie Jenkins wrote: On Fri, Jun 21, 2024 at 02:29:07PM +0800, Quan Zhou wrote: On 2024/6/20 10:55, Charlie Jenkins wrote: On Wed, Jun 19, 2024 at 10:01:47AM +0800, zhouq...@iscas.ac.cn wrote: From: Quan Zhou This test creates two processes: a tracer and a tracee. The

Re: [PATCH v4 2/4] mm/memory-failure: userspace controls soft-offlining pages

2024-06-23 Thread Miaohe Lin
On 2024/6/21 2:48, Jiaqi Yan wrote: > Correctable memory errors are very common on servers with large ... > > /* > @@ -2749,8 +2760,9 @@ static int soft_offline_in_use_page(struct page *page) > * @pfn: pfn to soft-offline > * @flags: flags. Same as memory_failure(). > * > - * Returns 0 on

Re: [PATCH] selftests/mm: Introduce a test program to assess swap entry allocation for thp_swapout

2024-06-23 Thread Huang, Ying
Barry Song <21cn...@gmail.com> writes: > On Fri, Jun 21, 2024 at 9:24 PM Huang, Ying wrote: >> >> Barry Song <21cn...@gmail.com> writes: >> >> > On Fri, Jun 21, 2024 at 7:25 PM Ryan Roberts wrote: >> >> >> >> On 20/06/2024 12:34, David Hildenbrand wrote: >> >> > On 20.06.24 11:04, Ryan Roberts w

Re: [PATCH] selftests/mm: Introduce a test program to assess swap entry allocation for thp_swapout

2024-06-23 Thread Barry Song
On Mon, Jun 24, 2024 at 3:44 PM Huang, Ying wrote: > > Barry Song <21cn...@gmail.com> writes: > > > On Fri, Jun 21, 2024 at 9:24 PM Huang, Ying wrote: > >> > >> Barry Song <21cn...@gmail.com> writes: > >> > >> > On Fri, Jun 21, 2024 at 7:25 PM Ryan Roberts > >> > wrote: > >> >> > >> >> On 20/06

[PATCH bpf-next v4 1/9] selftests/bpf: Add backlog for network_helper_opts

2024-06-23 Thread Geliang Tang
From: Geliang Tang Some callers expect __start_server() helper to pass their own "backlog" value to listen() instead of the default of 1. So this patch adds struct member "backlog" for network_helper_opts to allow callers to set "backlog" value via start_server_str() helper. Signed-off-by: Gelia

[PATCH bpf-next v4 0/9] use network helpers, part 8

2024-06-23 Thread Geliang Tang
From: Geliang Tang v4: - a new patch to use make_sockaddr in sockmap_ktls. - a new patch to close fd in error path in drop_on_reuseport. - drop make_server() in patch 7. - drop make_client() too in patch 9. v3: - a new patch to add backlog for network_helper_opts. - use start_server_str in

[PATCH bpf-next v4 2/9] selftests/bpf: Use start_server_str in sockmap_ktls

2024-06-23 Thread Geliang Tang
From: Geliang Tang Include network_helpers.h in prog_tests/sockmap_ktls.c, use public network helper start_server_str() instead of local defined function tcp_server(). This can avoid duplicate code. Technically, this is not a one-for-one replacement, as start_server_str() also does bind(). But t

[PATCH bpf-next v4 3/9] selftests/bpf: Use connect_to_fd in sockmap_ktls

2024-06-23 Thread Geliang Tang
From: Geliang Tang Use public network helper connect_to_fd() instead of open-coding it in prog_tests/sockmap_ktls.c. This can avoid duplicate code. Acked-by: Eduard Zingerman Signed-off-by: Geliang Tang --- .../selftests/bpf/prog_tests/sockmap_ktls.c| 14 ++ 1 file changed

[PATCH bpf-next v4 4/9] selftests/bpf: Use make_sockaddr in sockmap_ktls

2024-06-23 Thread Geliang Tang
From: Geliang Tang This patch uses public helper make_sockaddr() exported in network_helpers.h instead of open-coding in sockmap_ktls.c. This can avoid duplicate code. Signed-off-by: Geliang Tang --- .../selftests/bpf/prog_tests/sockmap_ktls.c | 16 ++-- 1 file changed, 2 inse

[PATCH bpf-next v4 5/9] selftests/bpf: Close fd in error path in drop_on_reuseport

2024-06-23 Thread Geliang Tang
From: Geliang Tang Server 1 fd should be closed in the error path when update_lookup_map() fails. This patch fixes it by goto "close_srv1" instead of "detach" lable in that case. Signed-off-by: Geliang Tang --- tools/testing/selftests/bpf/prog_tests/sk_lookup.c | 2 +- 1 file changed, 1 insert

[PATCH bpf-next v4 6/9] selftests/bpf: Invoke attach_reuseport out of make_server

2024-06-23 Thread Geliang Tang
From: Geliang Tang In order to facilitate subsequent commits to drop make_server(), this patch invokes attach_reuseport() out of make_server(), right after invoking make_server() if the passed "reuseport_prog" argument is not NULL. Signed-off-by: Geliang Tang --- .../selftests/bpf/prog_tests/s

[PATCH bpf-next v4 8/9] selftests/bpf: Use connect_to_fd in sk_lookup

2024-06-23 Thread Geliang Tang
From: Geliang Tang This patch uses public helper connect_to_fd() exported in network_helpers.h instead of using make_socket() and connect() in prog_tests/sk_lookup.c. This can simplify the code. Signed-off-by: Geliang Tang --- .../testing/selftests/bpf/prog_tests/sk_lookup.c | 16 ++---

[PATCH bpf-next v4 9/9] selftests/bpf: Use connect_to_addr in sk_lookup

2024-06-23 Thread Geliang Tang
From: Geliang Tang Use public network helpers make_sockaddr() and connect_to_addr() instead of using make_socket() + connect() or make_client(). Now local defined functions inetaddr_len(), make_socket() and make_client() all can be dropped. Signed-off-by: Geliang Tang --- .../selftests/bpf/pr

[PATCH bpf-next v4 7/9] selftests/bpf: Use start_server_str in sk_lookup

2024-06-23 Thread Geliang Tang
From: Geliang Tang This patch uses public helper start_server_addr() instead of local defined function make_server() in prog_tests/sk_lookup.c to avoid duplicate code. Add a helper setsockopts() to set SOL_CUSTOM sockopt looply, set it to setsockopt pointer of struct network_helper_opts, and pas

[PATCH net] selftests: net: remove unneeded IP_GRE config

2024-06-23 Thread Yujie Liu
It seems that there is no definition for config IP_GRE, and it is not a dependency of other configs, so remove it. linux$ find -name Kconfig | xargs grep "IP_GRE" <-- nothing There is a IPV6_GRE config defined in net/ipv6/Kconfig. It only depends on NET_IPGRE_DEMUX but not IP_GRE. Fixes: 04fe7c5