Re: [PATCH 1/2] tools: kernel-chktaint: Fix bashism, simplify code

2024-06-21 Thread Randy Dunlap
On 6/18/24 2:06 AM, Petr Vorel wrote: > '==' is bashism, '=' needs to be used for comparison. > With this fix script can work on systems where the default shell is > dash, busybox ash or any other strictly POSIX compatible shell. > > While at it, also improve: > * remove "x" in the comparison

[PATCH bpf-next v2 7/7] selftests/bpf: Drop make_socket in sk_lookup

2024-06-21 Thread Geliang Tang
From: Geliang Tang Use local helper make_client() instead of using make_socket() and connect(). Then make_socket() can be dropped now. Signed-off-by: Geliang Tang --- .../selftests/bpf/prog_tests/sk_lookup.c | 40 +-- 1 file changed, 2 insertions(+), 38 deletions(-) diff

[PATCH bpf-next v2 5/7] selftests/bpf: Use connect_to_addr in sk_lookup

2024-06-21 Thread Geliang Tang
From: Geliang Tang Use public network helpers make_sockaddr() and connect_to_addr() instead of using the local defined function make_socket() and connect(). This make_socket() can be dropped latter. Signed-off-by: Geliang Tang --- .../selftests/bpf/prog_tests/sk_lookup.c | 20

[PATCH bpf-next v2 6/7] selftests/bpf: Drop inetaddr_len in sk_lookup

2024-06-21 Thread Geliang Tang
From: Geliang Tang This patch adds a new parameter "len" for make_socket() to get the length of the address by make_sockaddr(), then local helper inetaddr_len() can be dropped. Signed-off-by: Geliang Tang --- .../testing/selftests/bpf/prog_tests/sk_lookup.c | 15 +-- 1 file

[PATCH bpf-next v2 4/7] selftests/bpf: Use connect_to_fd in sk_lookup

2024-06-21 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 v2 3/7] selftests/bpf: Use start_server_str in sk_lookup

2024-06-21 Thread Geliang Tang
From: Geliang Tang This patch uses public helper start_server_addr() in 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 pass it to start_server_addr().

[PATCH bpf-next v2 2/7] selftests/bpf: Use connect_to_fd in sockmap_ktls

2024-06-21 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

[PATCH bpf-next v2 1/7] selftests/bpf: Use start_server in sockmap_ktls

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

[PATCH bpf-next v2 0/7] use network helpers, part 8

2024-06-21 Thread Geliang Tang
From: Geliang Tang v2: - address Eduard's comments in v1. (thanks) - fix errors reported by CI. This patch set uses network helpers in sockmap_ktls and sk_lookup, and drop three local helpers tcp_server(), inetaddr_len() and make_socket() in them. Geliang Tang (7): selftests/bpf: Use

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

2024-06-21 Thread Andrew Morton
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 should return an EINVAL. > > We need to fix this issue since we can

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

2024-06-21 Thread Jakub Kicinski
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 modifies > the pmtu.sh script to

Re: [PATCH v4 0/4] Userspace controls soft-offline pages

2024-06-21 Thread Jiaqi Yan
Thanks for your comment, Andi. On Thu, Jun 20, 2024 at 3:53 PM Andi Kleen wrote: > > Jiaqi Yan writes: > > > Correctable memory errors are very common on servers with large > > amount of memory, and are corrected by ECC, but with two > > pain points to users: > > 1. Correction usually happens

Re: [PATCH v2 5/5] kunit: Merge assertion test into kunit-test.c

2024-06-21 Thread Rae Moar
On Tue, Jun 18, 2024 at 1:03 PM Ivan Orlov wrote: > > Since assert_test covers the part of the KUnit core (the assertion > formatting functions), I believe it would be better to have it merged > into kunit-test (as it is done for other tests for the KUnit core). > > Signed-off-by: Ivan Orlov

Re: [PATCH v2 3/3] Turn off test_uffdio_wp if CONFIG_PTE_MARKER_UFFD_WP is not configured.

2024-06-21 Thread Peter Xu
On Fri, Jun 21, 2024 at 02:12:24PM -0400, Audra Mitchell wrote: > If CONFIG_PTE_MARKER_UFFD_WP is disabled, then testing with test_uffdio_up Here you're talking about pte markers, then.. > enables calling uffdio_regsiter with the flag UFFDIO_REGISTER_MODE_WP. The > kernel ensures in

Re: [PATCH v2 2/3] Update uffd-stress to handle EINVAL for unset config features

2024-06-21 Thread Peter Xu
On Fri, Jun 21, 2024 at 02:12:23PM -0400, Audra Mitchell wrote: > Now that we have updated userfaultfd_api to correctly return > EIVAL when a feature is requested but not available, let's fix > the uffd-stress test to only set the UFFD_FEATURE_WP_UNPOPULATED > feature when the config is set. In

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

2024-06-21 Thread Peter Xu
On Fri, Jun 21, 2024 at 02:12:22PM -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 should return an EINVAL. > > We need to fix this issue since we

Re: [PATCH v2 4/5] kunit: assert_test: Prepare to be merged into kunit-test.c

2024-06-21 Thread Rae Moar
On Tue, Jun 18, 2024 at 1:03 PM Ivan Orlov wrote: > > Add 'kunit_assert_' prefix for 'is_literal' and 'is_str_literal' > functions. This way we will be sure that we are not exporting ambiguous > symbols into the KUnit namespace. > > Export these (and other) functions from assert into the KUnit

Re: [PATCH 0/2] Modify the watchdog selftest for execution with

2024-06-21 Thread Shuah Khan
On 6/18/24 07:40, Laura Nao wrote: Hi Shuah, On 6/7/24 23:07, Shuah Khan wrote: On 6/7/24 03:53, Laura Nao wrote: Hi Shuah, On 6/7/24 01:03, Shuah Khan wrote: On 6/6/24 03:57, Laura Nao wrote: Hi Shuah, On 5/6/24 13:13, Laura Nao wrote: The watchdog selftest script supports various

Re: [PATCH v2 3/5] kunit: string-stream-test: Make it a separate module

2024-06-21 Thread Rae Moar
On Tue, Jun 18, 2024 at 1:03 PM Ivan Orlov wrote: > > Currently, the only way to build string-stream-test is by setting > CONFIG_KUNIT_TEST=y. However, CONFIG_KUNIT_TEST is a config option for > a different test (`kunit-test.c`). > > Introduce a new Kconfig entry in order to be able to build the

Re: [PATCH v2 2/5] kunit: kunit-test: Remove stub for log tests

2024-06-21 Thread Rae Moar
On Tue, Jun 18, 2024 at 1:03 PM Ivan Orlov wrote: > > Since now we are exporting string-stream functions into the KUnit > namespace, we can safely use them in kunit-test when it is compiled as > a module as well. So, remove the stubs used when kunit-test is compiled > as a module. Import the

Re: [PATCH v2 1/5] kunit: string-stream: export non-static functions

2024-06-21 Thread Rae Moar
On Tue, Jun 18, 2024 at 1:03 PM Ivan Orlov wrote: > > Export non-static functions from the string-stream.c file into the KUnit > namespace in order to be able to access them from the KUnit core tests > (when they are loaded as modules). > > Reviewed-by: David Gow > Signed-off-by: Ivan Orlov

Re: [RFC PATCH v5 00/29] TDX KVM selftests

2024-06-21 Thread Sagi Shahar
On Thu, Jun 20, 2024 at 9:51 PM Edgecombe, Rick P wrote: > > +Yan > > On Wed, 2024-06-05 at 14:44 -0700, Rick Edgecombe wrote: > > > I will take a look at rebasing the selftests on top of the Intel > > > development branch and I can post it on our github branch. We can talk > > > about

Re: [PATCH v7 00/16] selftests/resctrl: resctrl_val() related cleanups & improvements

2024-06-21 Thread Reinette Chatre
On 6/18/24 4:44 PM, Shuah Khan wrote: On 6/10/24 09:14, Ilpo Järvinen wrote: Hi all, This series does a number of cleanups into resctrl_val() and generalizes it by removing test name specific handling from the function. v7: - Truly use "bound to", not bounded to. - Fix separator to use 3

Re: [PATCH bpf-next 6/6] selftests/bpf: Drop make_socket in sk_lookup

2024-06-21 Thread Eduard Zingerman
On Fri, 2024-06-21 at 18:35 +0800, Geliang Tang wrote: [...] > @@ -224,24 +188,22 @@ static int make_server(int sotype, const char *ip, int > port, > > static int make_client(int sotype, const char *ip, int port) > { > + int family = is_ipv6(ip) ? AF_INET6 : AF_INET; > struct

Re: [PATCH bpf-next 5/6] selftests/bpf: Use connect_to_fd in sk_lookup

2024-06-21 Thread Eduard Zingerman
On Fri, 2024-06-21 at 18:35 +0800, Geliang Tang wrote: [...] > @@ -883,12 +881,10 @@ static void drop_on_lookup(const struct test *t) > if (server_fd < 0) > goto detach; > > - client_fd = make_socket(t->sotype, t->connect_to.ip, > -

Re: [PATCH bpf-next 3/6] selftests/bpf: Use start_server_str in sk_lookup

2024-06-21 Thread Eduard Zingerman
On Fri, 2024-06-21 at 18:35 +0800, Geliang Tang wrote: > From: Geliang Tang > > This patch uses public helper start_server_addr() in 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

Re: [PATCH bpf-next 2/6] selftests/bpf: Use connect_to_fd in sockmap_ktls

2024-06-21 Thread Eduard Zingerman
On Fri, 2024-06-21 at 18:35 +0800, Geliang Tang wrote: > 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. > > Signed-off-by: Geliang Tang > --- Acked-by: Eduard Zingerman [...]

Re: [PATCH bpf-next 1/6] selftests/bpf: Use start_server in sockmap_ktls

2024-06-21 Thread Eduard Zingerman
On Fri, 2024-06-21 at 18:35 +0800, Geliang Tang wrote: > From: Geliang Tang > > Include network_helpers.h in prog_tests/sockmap_ktls.c, use public network > helper start_server() instead of the local defined function tcp_server(). > This can avoid duplicate code. > > Signed-off-by: Geliang Tang

[PATCH 0/1] KVM: selftests: pmu_counters_test: increase robustness of LLC cache misses

2024-06-21 Thread Maxim Levitsky
Recent CI failures brought my attention to the fact that pmu_counters_test sometimes fails because it doesn't get any LLC cache misses. It apparently happens because CLFLUSH can race with CPU prediction. To attempt to fix this, implement a more aggressive cache flushing - now it is flushed on

[PATCH 1/1] KVM: selftests: pmu_counters_test: increase robustness of LLC cache misses

2024-06-21 Thread Maxim Levitsky
Currently this test does a single CLFLUSH on its memory location but due to speculative execution this might not cause LLC misses. Instead, do a cache flush on each loop iteration to confuse the prediction and make sure that cache misses always occur. Signed-off-by: Maxim Levitsky ---

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

2024-06-21 Thread Mina Almasry
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 userspace indicates

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

2024-06-21 Thread Charlie Jenkins
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 tracer > > >

[PATCH RFC 3/3] drivers/misc: add test driver and selftest for proclocal allocator

2024-06-21 Thread Roman Kagan
Introduce a simple driver for functional and stress testing of proclocal kernel allocator. The driver exposes a device node /dev/proclocal-test, which allows userland programs to request creation of proclocal areas and to obtain their addresses as seen by the kernel, and in addition to read and

[PATCH RFC 2/3] mm/secretmem: implement mm-local kernel allocations

2024-06-21 Thread Roman Kagan
From: Fares Mehanna In order to be resilient against cross-process speculation-based attacks, it makes sense to store certain (secret) items in kernel memory local to mm. Implement such allocations on top of secretmem infrastructure. Specifically, on allocate 1. Create secretmem file. 2. To

[PATCH RFC 1/3] mseal: expose interface to seal / unseal user memory ranges

2024-06-21 Thread Roman Kagan
From: Fares Mehanna To make sure the kernel mm-local mapping is untouched by the user, we will seal the VMA before changing the protection to be used by the kernel. This will guarantee that userspace can't unmap or alter this VMA while it is being used by the kernel. After the kernel is done

[PATCH RFC 0/3] add support for mm-local memory allocations

2024-06-21 Thread Roman Kagan
In a series posted a few years ago [1], a proposal was put forward to allow the kernel to allocate memory local to a mm and thus push it out of reach for current and future speculation-based cross-process attacks. We still believe this is a nice thing to have. However, in the time passed since

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

2024-06-21 Thread Mina Almasry
On Mon, Jun 17, 2024 at 7:17 AM Pavel Begunkov wrote: > > On 6/13/24 02:35, Mina Almasry wrote: > > Convert netmem to be a union of struct page and struct netmem. Overload > > the LSB of struct netmem* to indicate that it's a net_iov, otherwise > > it's a page. > > > > Currently these entries in

[PATCH v2 3/3] Turn off test_uffdio_wp if CONFIG_PTE_MARKER_UFFD_WP is not configured.

2024-06-21 Thread Audra Mitchell
If CONFIG_PTE_MARKER_UFFD_WP is disabled, then testing with test_uffdio_up enables calling uffdio_regsiter with the flag UFFDIO_REGISTER_MODE_WP. The kernel ensures in vma_can_userfault() that if CONFIG_PTE_MARKER_UFFD_WP is disabled, only allow the VM_UFFD_WP on anonymous vmas. Signed-off-by:

[PATCH v2 2/3] Update uffd-stress to handle EINVAL for unset config features

2024-06-21 Thread Audra Mitchell
Now that we have updated userfaultfd_api to correctly return EIVAL when a feature is requested but not available, let's fix the uffd-stress test to only set the UFFD_FEATURE_WP_UNPOPULATED feature when the config is set. In addition, still run the test if the CONFIG_PTE_MARKER_UFFD_WP is not set,

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

2024-06-21 Thread Audra Mitchell
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 should return an EINVAL. We need to fix this issue since we can end up with a Kernel warning should a program request the feature

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

2024-06-21 Thread Mickaël Salaün
We cannot use CLONE_VFORK because we also need to wait for the timeout signal. Restore tests timeout by using the original fork() call in __run_test() but also in __TEST_F_IMPL(). Also fix a race condition when waiting for the test child process. Because test metadata are shared between test

Re: [PATCH RFC 0/5] mm/gup: Introduce exclusive GUP pinning

2024-06-21 Thread Elliot Berman
On Fri, Jun 21, 2024 at 11:16:31AM +0100, Fuad Tabba wrote: > Hi David, > > On Fri, Jun 21, 2024 at 10:10 AM David Hildenbrand wrote: > > > > On 21.06.24 10:54, Fuad Tabba wrote: > > > Hi David, > > > > > > On Fri, Jun 21, 2024 at 9:44 AM David Hildenbrand > > > wrote: > > >> > > Again

Re: [PATCH RFC 0/5] mm/gup: Introduce exclusive GUP pinning

2024-06-21 Thread Elliot Berman
On Fri, Jun 21, 2024 at 09:25:10AM +, Quentin Perret wrote: > On Friday 21 Jun 2024 at 10:02:08 (+0200), David Hildenbrand wrote: > > Sure, there might be cases like "pKVM can handle access to private pages in > > user page mappings", "AMD-SNP will not crash the host if writing to private > >

Re: [PATCH HID 06/12] HID: bpf: add HID-BPF hooks for hid_hw_output_report

2024-06-21 Thread Alexei Starovoitov
On Fri, Jun 21, 2024 at 9:08 AM Benjamin Tissoires wrote: > > On Jun 21 2024, Alexei Starovoitov wrote: > > On Fri, Jun 21, 2024 at 1:56 AM Benjamin Tissoires > > wrote: > > > > > > Same story than hid_hw_raw_requests: > > > > > > This allows to intercept and prevent or change the behavior of >

Re: [PATCH HID 06/12] HID: bpf: add HID-BPF hooks for hid_hw_output_report

2024-06-21 Thread Benjamin Tissoires
On Jun 21 2024, Alexei Starovoitov wrote: > On Fri, Jun 21, 2024 at 1:56 AM Benjamin Tissoires wrote: > > > > Same story than hid_hw_raw_requests: > > > > This allows to intercept and prevent or change the behavior of > > hid_hw_output_report() from a bpf program. > > > > The intent is to solve a

Re: [PATCH HID 03/12] HID: bpf: add HID-BPF hooks for hid_hw_raw_requests

2024-06-21 Thread Alexei Starovoitov
On Fri, Jun 21, 2024 at 1:56 AM Benjamin Tissoires wrote: > > This allows to intercept and prevent or change the behavior of > hid_hw_raw_request() from a bpf program. > > The intent is to solve a couple of use case: > - firewalling a HID device: a firewall can monitor who opens the hidraw >

Re: [PATCH HID 06/12] HID: bpf: add HID-BPF hooks for hid_hw_output_report

2024-06-21 Thread Alexei Starovoitov
On Fri, Jun 21, 2024 at 1:56 AM Benjamin Tissoires wrote: > > Same story than hid_hw_raw_requests: > > This allows to intercept and prevent or change the behavior of > hid_hw_output_report() from a bpf program. > > The intent is to solve a couple of use case: > - firewalling a HID device: a

Re: [PATCH v4 3/4] selftest/mm: test enable_soft_offline behaviors

2024-06-21 Thread Jiaqi Yan
On Thu, Jun 20, 2024 at 10:08 PM Muhammad Usama Anjum wrote: > > On 6/20/24 11:48 PM, Jiaqi Yan wrote: > > Add regression and new tests when hugepage has correctable memory > > errors, and how userspace wants to deal with it: > > * if enable_soft_offline=1, mapped hugepage is soft offlined > > *

Re: [PATCH net-next] selftests: net: change shebang to bash in amt.sh

2024-06-21 Thread patchwork-bot+netdevbpf
Hello: This patch was applied to netdev/net-next.git (main) by David S. Miller : On Fri, 21 Jun 2024 04:16:37 + you wrote: > amt.sh is written in bash, not sh. > So, shebang should be bash. > > Signed-off-by: Taehee Yoo > --- > tools/testing/selftests/net/amt.sh | 2 +- > 1 file changed,

Re: [PATCH RFC 0/5] mm/gup: Introduce exclusive GUP pinning

2024-06-21 Thread Jason Gunthorpe
On Thu, Jun 20, 2024 at 04:54:00PM -0700, Sean Christopherson wrote: > Heh, and then we'd end up turning memfd into guest_memfd. As I see it, being > able to safely map TDX/SNP/pKVM private memory is a happy side effect that is > possible because guest_memfd isn't subordinate to the primary MMU,

Re: [PATCH V4] rcutorture: Add CFcommon.arch for the various arch's need

2024-06-21 Thread Paul E. McKenney
On Fri, Jun 21, 2024 at 12:25:59PM +0100, Mark Rutland wrote: > On Thu, Jun 20, 2024 at 10:57:27AM -0700, Paul E. McKenney wrote: > > On Wed, Jun 19, 2024 at 11:06:58PM +, Zhouyi Zhou wrote: > > > Add CFcommon.arch for the various arch's need for rcutorture. > > > > > > In accordance with

Re: [PATCH RFC 0/5] mm/gup: Introduce exclusive GUP pinning

2024-06-21 Thread Jason Gunthorpe
On Fri, Jun 21, 2024 at 07:32:40AM +, Quentin Perret wrote: > > No, I'm interested in what pKVM is doing that needs this to be so much > > different than the CC case.. > > The underlying technology for implementing CC is obviously very > different (MMU-based for pKVM, encryption-based for the

Re: [PATCH V4] rcutorture: Add CFcommon.arch for the various arch's need

2024-06-21 Thread Mark Rutland
On Thu, Jun 20, 2024 at 10:57:27AM -0700, Paul E. McKenney wrote: > On Wed, Jun 19, 2024 at 11:06:58PM +, Zhouyi Zhou wrote: > > Add CFcommon.arch for the various arch's need for rcutorture. > > > > In accordance with [1], [2] and [3], move x86 specific kernel option > >

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

2024-06-21 Thread Barry Song
On Fri, Jun 21, 2024 at 4:50 PM Chris Li wrote: > > On Fri, Jun 21, 2024 at 12:47 AM Barry Song <21cn...@gmail.com> wrote: > > > > 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 wrote: > > > >>

[PATCH bpf-next 6/6] selftests/bpf: Drop make_socket in sk_lookup

2024-06-21 Thread Geliang Tang
From: Geliang Tang Use public network helpers make_sockaddr() and connect_to_addr() instead of using the local defined function make_socket() and connect(). Then make_socket() can be dropped. Signed-off-by: Geliang Tang --- .../selftests/bpf/prog_tests/sk_lookup.c | 50

[PATCH bpf-next 5/6] selftests/bpf: Use connect_to_fd in sk_lookup

2024-06-21 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 --- .../selftests/bpf/prog_tests/sk_lookup.c | 33

[PATCH bpf-next 4/6] selftests/bpf: Drop inetaddr_len in sk_lookup

2024-06-21 Thread Geliang Tang
From: Geliang Tang This patch adds a new parameter "len" for make_socket() to get the length of the address by make_sockaddr(), then local helper inetaddr_len() can be dropped. Signed-off-by: Geliang Tang --- .../selftests/bpf/prog_tests/sk_lookup.c | 30 +-- 1 file

[PATCH bpf-next 3/6] selftests/bpf: Use start_server_str in sk_lookup

2024-06-21 Thread Geliang Tang
From: Geliang Tang This patch uses public helper start_server_addr() in 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 pass it to start_server_addr().

[PATCH bpf-next 2/6] selftests/bpf: Use connect_to_fd in sockmap_ktls

2024-06-21 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. Signed-off-by: Geliang Tang --- .../selftests/bpf/prog_tests/sockmap_ktls.c| 14 ++ 1 file changed, 2 insertions(+), 12

[PATCH bpf-next 1/6] selftests/bpf: Use start_server in sockmap_ktls

2024-06-21 Thread Geliang Tang
From: Geliang Tang Include network_helpers.h in prog_tests/sockmap_ktls.c, use public network helper start_server() instead of the local defined function tcp_server(). This can avoid duplicate code. Signed-off-by: Geliang Tang --- .../selftests/bpf/prog_tests/sockmap_ktls.c| 18

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

2024-06-21 Thread Geliang Tang
From: Geliang Tang This patch set uses network helpers in sockmap_ktls and sk_lookup, and drop three local helpers tcp_server(), inetaddr_len() and make_socket() in them. Geliang Tang (6): selftests/bpf: Use start_server in sockmap_ktls selftests/bpf: Use connect_to_fd in sockmap_ktls

Re: [PATCH RFC 0/5] mm/gup: Introduce exclusive GUP pinning

2024-06-21 Thread Fuad Tabba
Hi David, On Fri, Jun 21, 2024 at 10:10 AM David Hildenbrand wrote: > > On 21.06.24 10:54, Fuad Tabba wrote: > > Hi David, > > > > On Fri, Jun 21, 2024 at 9:44 AM David Hildenbrand wrote: > >> > Again from that thread, one of most important aspects guest_memfd is > that VMAs >

[PATCH net-next v4 10/10] selftests: openvswitch: add emit_sample test

2024-06-21 Thread Adrian Moreno
Add a test to verify sampling packets via psample works. In order to do that, create a subcommand in ovs-dpctl.py to listen to on the psample multicast group and print samples. Signed-off-by: Adrian Moreno --- .../selftests/net/openvswitch/openvswitch.sh | 110 +-

[PATCH net-next v4 09/10] selftests: openvswitch: parse trunc action

2024-06-21 Thread Adrian Moreno
The trunc action was supported decode-able but not parse-able. Add support for parsing the action string. Signed-off-by: Adrian Moreno --- .../testing/selftests/net/openvswitch/ovs-dpctl.py | 13 + 1 file changed, 13 insertions(+) diff --git

[PATCH net-next v4 08/10] selftests: openvswitch: add userspace parsing

2024-06-21 Thread Adrian Moreno
The userspace action lacks parsing support plus it contains a bug in the name of one of its attributes. This patch makes userspace action work. Signed-off-by: Adrian Moreno --- .../selftests/net/openvswitch/ovs-dpctl.py| 24 +-- 1 file changed, 22 insertions(+), 2

[PATCH net-next v4 07/10] selftests: openvswitch: add emit_sample action

2024-06-21 Thread Adrian Moreno
Add sample and emit_sample action support to ovs-dpctl.py. Refactor common attribute parsing logic into an external function. Signed-off-by: Adrian Moreno --- .../selftests/net/openvswitch/ovs-dpctl.py| 162 +- 1 file changed, 161 insertions(+), 1 deletion(-) diff --git

[PATCH net-next v4 00/10] net: openvswitch: Add sample multicasting.

2024-06-21 Thread Adrian Moreno
** Background ** Currently, OVS supports several packet sampling mechanisms (sFlow, per-bridge IPFIX, per-flow IPFIX). These end up being translated into a userspace action that needs to be handled by ovs-vswitchd's handler threads only to be forwarded to some third party application that will

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

2024-06-21 Thread Barry Song
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 wrote: > >> >> On 20/06/2024 01:26, Barry Song

Re: [PATCH RFC 0/5] mm/gup: Introduce exclusive GUP pinning

2024-06-21 Thread David Hildenbrand
On 21.06.24 11:25, Quentin Perret wrote: On Friday 21 Jun 2024 at 10:02:08 (+0200), David Hildenbrand wrote: Thanks for the information. IMHO we really should try to find a common ground here, and FOLL_EXCLUSIVE is likely not it :) That's OK, IMO at least :-). Thanks for reviving this

Re: [PATCH RFC 0/5] mm/gup: Introduce exclusive GUP pinning

2024-06-21 Thread Quentin Perret
On Friday 21 Jun 2024 at 10:02:08 (+0200), David Hildenbrand wrote: > Thanks for the information. IMHO we really should try to find a common > ground here, and FOLL_EXCLUSIVE is likely not it :) That's OK, IMO at least :-). > Thanks for reviving this discussion with your patch set! > > pKVM is

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

2024-06-21 Thread Huang, Ying
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 wrote: >> >> On 20/06/2024 01:26, Barry Song wrote: >> >>> From: Barry Song >> >>> >> >>> Both Ryan and Chris

Re: [PATCH RFC 0/5] mm/gup: Introduce exclusive GUP pinning

2024-06-21 Thread David Hildenbrand
On 21.06.24 10:54, Fuad Tabba wrote: Hi David, On Fri, Jun 21, 2024 at 9:44 AM David Hildenbrand wrote: Again from that thread, one of most important aspects guest_memfd is that VMAs are not required. Stating the obvious, lack of VMAs makes it really hard to drive swap, reclaim,

[PATCH HID 12/12] selftests/hid: add an infinite loop test for hid_bpf_try_input_report

2024-06-21 Thread Benjamin Tissoires
We don't want this call to allow an infinite loop in HID-BPF, so let's have some tests. Signed-off-by: Benjamin Tissoires --- tools/testing/selftests/hid/hid_bpf.c | 41 + tools/testing/selftests/hid/progs/hid.c | 37 + 2 files

[PATCH HID 11/12] selftests/hid: add another test for injecting an event from an event hook

2024-06-21 Thread Benjamin Tissoires
Similar to test_multiply_events_wq: we receive one event and inject a new one. But given that this time we are already in the event hook, we can use hid_bpf_try_input_report() directly as this function will not sleep. Note that the injected event gets processed before the original one this way.

[PATCH HID 10/12] HID: bpf: allow hid_device_event hooks to inject input reports on self

2024-06-21 Thread Benjamin Tissoires
This is the same logic than hid_hw_raw_request or hid_hw_output_report: we can allow hid_bpf_try_input_report to be called from a hook on hid_input_report if we ensure that the call can not be made twice in a row. There is one extra subtlety in which there is a lock in hid_input_report. But given

[PATCH HID 09/12] selftests/hid: add wq test for hid_bpf_input_report()

2024-06-21 Thread Benjamin Tissoires
Now that bpf_wq is available, we can write a test with it. Having hid_bpf_input_report() waiting for the device means that we can directly call it, and we get that event when the device is ready. Signed-off-by: Benjamin Tissoires --- tools/testing/selftests/hid/hid_bpf.c | 38

[PATCH HID 08/12] HID: bpf: make hid_bpf_input_report() sleep until the device is ready

2024-06-21 Thread Benjamin Tissoires
hid_bpf_input_report() is already marked to be used in sleepable context only. So instead of hammering with timers the device to hopefully get an available slot where the device is not sending events, we can make that kfunc wait for the current event to be terminated before it goes in. This

[PATCH HID 07/12] selftests/hid: add tests for hid_hw_output_report HID-BPF hooks

2024-06-21 Thread Benjamin Tissoires
We add 3 new tests: - first, we make sure we can prevent the output_report to happen - second, we make sure that we can detect that a given hidraw client was actually doing the request, and for that client only, call ourself hid_bpf_hw_output_report(), returning a custom value - last, we

[PATCH HID 06/12] HID: bpf: add HID-BPF hooks for hid_hw_output_report

2024-06-21 Thread Benjamin Tissoires
Same story than hid_hw_raw_requests: This allows to intercept and prevent or change the behavior of hid_hw_output_report() from a bpf program. The intent is to solve a couple of use case: - firewalling a HID device: a firewall can monitor who opens the hidraw nodes and then prevent or

[PATCH HID 05/12] selftests/hid: add tests for hid_hw_raw_request HID-BPF hooks

2024-06-21 Thread Benjamin Tissoires
We add 3 new tests: - first, we make sure we can prevent the raw_request to happen - second, we make sure that we can detect that a given hidraw client was actually doing the request, and for that client only, call ourself hid_bpf_hw_request(), returning a custom value - last, we ensure that

[PATCH HID 04/12] HID: bpf: prevent infinite recursions with hid_hw_raw_requests hooks

2024-06-21 Thread Benjamin Tissoires
When we attach a sleepable hook to hid_hw_raw_requests, we can (and in many cases should) call ourself hid_bpf_raw_request(), to actually fetch data from the device itself. However, this means that we might enter an infinite loop between hid_hw_raw_requests hooks and hid_bpf_hw_request() call.

[PATCH HID 03/12] HID: bpf: add HID-BPF hooks for hid_hw_raw_requests

2024-06-21 Thread Benjamin Tissoires
This allows to intercept and prevent or change the behavior of hid_hw_raw_request() from a bpf program. The intent is to solve a couple of use case: - firewalling a HID device: a firewall can monitor who opens the hidraw nodes and then prevent or allow access to write operations on that

[PATCH HID 02/12] HID: add source argument to HID low level functions

2024-06-21 Thread Benjamin Tissoires
This allows to know who actually sent what when we process the request to the device. This will be useful for a BPF firewall program to allow or not requests coming from a dedicated hidraw node client. Signed-off-by: Benjamin Tissoires --- drivers/hid/bpf/hid_bpf_dispatch.c | 12 ++---

[PATCH HID 01/12] HID: bpf: fix dispatch_hid_bpf_device_event uninitialized ret value

2024-06-21 Thread Benjamin Tissoires
Looks like if a bpf program gets inserted and then removed, hdev->bpf.device_data is then allocated, but the loop iterating over the bpf program is never assigning ret. This is a problem and also revealed another bug in which only the last value of ret was checked. This effectively meant than

[PATCH HID 00/12] HID: bpf_struct_ops, part 2

2024-06-21 Thread Benjamin Tissoires
This series is a followup of the struct_ops conversion. Therefore, it is based on top of the for-6.11/bpf branch of the hid.git tree: https://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git/log/?h=for-6.11/bpf The first patch should go in ASAP, it's a fix that was detected by Dan and which

Re: [PATCH RFC 0/5] mm/gup: Introduce exclusive GUP pinning

2024-06-21 Thread Fuad Tabba
Hi David, On Fri, Jun 21, 2024 at 9:44 AM David Hildenbrand wrote: > > >> Again from that thread, one of most important aspects guest_memfd is that > >> VMAs > >> are not required. Stating the obvious, lack of VMAs makes it really hard > >> to drive > >> swap, reclaim, migration, etc. from

Re: [PATCH v5 4/4] KVM: riscv: selftests: Add Svade and Svadu Extension to get-reg-list test

2024-06-21 Thread Andrew Jones
On Wed, Jun 05, 2024 at 08:15:10PM GMT, Yong-Xuan Wang wrote: > Update the get-reg-list test to test the Svade and Svadu Extensions are > available for guest OS. > > Signed-off-by: Yong-Xuan Wang > --- > tools/testing/selftests/kvm/riscv/get-reg-list.c | 8 > 1 file changed, 8

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

2024-06-21 Thread David Hildenbrand
On 21.06.24 09:25, Ryan Roberts wrote: On 20/06/2024 12:34, David Hildenbrand wrote: On 20.06.24 11:04, Ryan Roberts wrote: On 20/06/2024 01:26, Barry Song wrote: From: Barry Song Both Ryan and Chris have been utilizing the small test program to aid in debugging and identifying issues with

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

2024-06-21 Thread Chris Li
On Fri, Jun 21, 2024 at 12:47 AM Barry Song <21cn...@gmail.com> wrote: > > 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 wrote: > > >> On 20/06/2024 01:26, Barry Song wrote: > > >>> From: Barry Song

Re: [PATCH RFC 0/5] mm/gup: Introduce exclusive GUP pinning

2024-06-21 Thread David Hildenbrand
Again from that thread, one of most important aspects guest_memfd is that VMAs are not required. Stating the obvious, lack of VMAs makes it really hard to drive swap, reclaim, migration, etc. from code that fundamentally operates on VMAs. : More broadly, no VMAs are required. The lack of

Re: [PATCH RFC 0/5] mm/gup: Introduce exclusive GUP pinning

2024-06-21 Thread Fuad Tabba
Hi Sean, On Thu, Jun 20, 2024 at 4:37 PM Sean Christopherson wrote: > > On Wed, Jun 19, 2024, Fuad Tabba wrote: > > Hi Jason, > > > > On Wed, Jun 19, 2024 at 12:51 PM Jason Gunthorpe wrote: > > > > > > On Wed, Jun 19, 2024 at 10:11:35AM +0100, Fuad Tabba wrote: > > > > > > > To be honest,

Re: [PATCH RFC 0/5] mm/gup: Introduce exclusive GUP pinning

2024-06-21 Thread David Hildenbrand
On 21.06.24 09:32, Quentin Perret wrote: On Thursday 20 Jun 2024 at 20:18:14 (-0300), Jason Gunthorpe wrote: On Thu, Jun 20, 2024 at 03:47:23PM -0700, Elliot Berman wrote: On Thu, Jun 20, 2024 at 11:29:56AM -0300, Jason Gunthorpe wrote: On Thu, Jun 20, 2024 at 04:01:08PM +0200, David

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

2024-06-21 Thread Ryan Roberts
On 21/06/2024 08:47, Barry Song wrote: > 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 wrote: On 20/06/2024 01:26, Barry Song wrote: > From: Barry Song > > Both Ryan and Chris have been

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

2024-06-21 Thread Barry Song
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 wrote: > >> On 20/06/2024 01:26, Barry Song wrote: > >>> From: Barry Song > >>> > >>> Both Ryan and Chris have been utilizing the small test program to aid >

Re: [PATCH RFC 0/5] mm/gup: Introduce exclusive GUP pinning

2024-06-21 Thread David Hildenbrand
On 21.06.24 01:54, Sean Christopherson wrote: On Thu, Jun 20, 2024, Jason Gunthorpe wrote: On Thu, Jun 20, 2024 at 01:30:29PM -0700, Sean Christopherson wrote: I.e. except for blatant bugs, e.g. use-after-free, we need to be able to guarantee with 100% accuracy that there are no outstanding

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

2024-06-21 Thread Ryan Roberts
On 21/06/2024 00:34, Chris Li wrote: >> + * thp_swap_allocator_test >> + * >> + * The purpose of this test program is helping check if THP swpout >> + * can correctly get swap slots to swap out as a whole instead of >> + * being split. It randomly releases swap entries through madvise >> + *

Re: [PATCH RFC 0/5] mm/gup: Introduce exclusive GUP pinning

2024-06-21 Thread Quentin Perret
On Thursday 20 Jun 2024 at 20:18:14 (-0300), Jason Gunthorpe wrote: > On Thu, Jun 20, 2024 at 03:47:23PM -0700, Elliot Berman wrote: > > On Thu, Jun 20, 2024 at 11:29:56AM -0300, Jason Gunthorpe wrote: > > > On Thu, Jun 20, 2024 at 04:01:08PM +0200, David Hildenbrand wrote: > > > > Regarding huge

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

2024-06-21 Thread Ryan Roberts
On 20/06/2024 12:34, David Hildenbrand wrote: > On 20.06.24 11:04, Ryan Roberts wrote: >> On 20/06/2024 01:26, Barry Song wrote: >>> From: Barry Song >>> >>> Both Ryan and Chris have been utilizing the small test program to aid >>> in debugging and identifying issues with swap entry allocation.

Re: [PATCH v4 00/14] security: digest_cache LSM

2024-06-21 Thread Roberto Sassu
On Thu, 2024-06-20 at 13:13 -0400, Paul Moore wrote: > On Thu, Jun 20, 2024 at 1:06 PM Roberto Sassu > wrote: > > On Thu, 2024-06-20 at 12:51 -0400, Paul Moore wrote: > > > On Thu, Jun 20, 2024 at 12:31 PM Roberto Sassu > > > wrote: > > > > On Thu, 2024-06-20 at 12:08 -0400, Paul Moore wrote: >

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

2024-06-21 Thread Quan Zhou
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 tracer actively sends a SIGUSR1 signal in user mode to interrupt the read syscall being executed by

  1   2   >