[PATCH] selftests/bpf:fix a resource leak in main()

2024-07-11 Thread Ma Ke
The requested resources should be closed before return in main(), otherwise resource leak will occur. Add a check of cg_fd before close(). Fixes: 435f90a338ae ("selftests/bpf: add a test case for sock_ops perf-event notification") Signed-off-by: Ma Ke --- tools/testing/selftests/bpf/test_tcpno

[PATCH] selftests/bpf:fix a resource leak in main()

2024-07-11 Thread Ma Ke
The requested resources should be closed before return in main(), otherwise resource leak will occur. Add a check of cg_fd before close(). Fixes: 1f5fa9ab6e2e ("selftests/bpf: Test BPF_CGROUP_SYSCTL") Signed-off-by: Ma Ke --- tools/testing/selftests/bpf/test_sysctl.c | 3 ++- 1 file changed, 2 i

[PATCH] selftests/bpf:fix a resource leak in run_tests()

2024-07-11 Thread Ma Ke
The requested resources should be closed before return in run_tests(), otherwise resource leak will occur. Add a check of cg_fd before close(). Fixes: 1d436885b23b ("selftests/bpf: Selftest for sys_bind post-hooks.") Signed-off-by: Ma Ke --- tools/testing/selftests/bpf/test_sock.c | 3 ++- 1 fil

[PATCH] selftests/bpf:fix a resource leak in main()

2024-07-11 Thread Ma Ke
The requested resources should be closed before return in main(), otherwise resource leak will occur. Add a check of cgfd before close(). Fixes: 5ecd8c22739b ("selftests/bpf: Selftest for bpf_skb_ancestor_cgroup_id") Signed-off-by: Ma Ke --- tools/testing/selftests/bpf/test_skb_cgroup_id_user.c

[PATCH] bpf, selftests: fix a resource leak in main()

2024-07-11 Thread Ma Ke
The requested resources should be closed before return in main(), otherwise resource leak will occur. Add a check of cgroup_fd and close(). Fixes: 4939b2847d26 ("bpf, selftests: Use single cgroup helpers for both test_sockmap/progs") Signed-off-by: Ma Ke --- tools/testing/selftests/bpf/test_dev

[PATCH] bpf, selftests: fix a resource leak in main()

2024-07-11 Thread Ma Ke
The requested resources should be closed before return in main(), otherwise resource leak will occur. Add a check of cgroup_fd and close(). Fixes: 4939b2847d26 ("bpf, selftests: Use single cgroup helpers for both test_sockmap/progs") Signed-off-by: Ma Ke --- tools/testing/selftests/bpf/test_cgr

Re: [PATCH] bpf, selftests: fix a resource leak in main()

2024-07-11 Thread Eduard Zingerman
On Thu, 2024-07-11 at 15:44 +0800, Ma Ke wrote: > The requested resources should be closed before return in main(), otherwise > resource leak will occur. Add a check of cgroup_fd and close(). Note: it is better to group related patches to a patch-set. > > Fixes: 4939b2847d26 ("bpf, selftests: Us

[PATCH 0/3] selftests/bpf: convert test_xdp_veth to test_progs framework

2024-07-11 Thread eBPF Foundation
Hello everyone, this small series is a first step in a larger effort aiming to help improve eBPF selftests and the testing coverage in CI. It focuses for now on test_xdp_veth.sh, a small test which is not integrated yet in test_progs. The series is mostly about a rewrite of test_xdp_veth.sh to mak

[PATCH 1/3] selftests/bpf: update xdp_redirect_map prog sections for libbpf

2024-07-11 Thread eBPF Foundation
xdp_redirect_map.c is a bpf program used by test_xdp_veth.sh, which is not handled by the generic test runner (test_progs). To allow converting this test to test_progs, the corresponding program must be updated to allow handling it through skeletons generated by bpftool and libbpf. Update programs

[PATCH 2/3] selftests/bpf: integrate test_xdp_veth into test_progs

2024-07-11 Thread eBPF Foundation
test_xdp_veth.sh tests that XDP return codes work as expected, by bringing up multiple veth pairs isolated in different namespaces, attaching specific xdp programs to each interface, and ensuring that the whole chain allows to ping one end interface from the first one. The test runs well but is cur

[PATCH 3/3] bpf/selftests: drop old version of test_xdp_veth.sh

2024-07-11 Thread eBPF Foundation
Now that test_xdp_veth has been rewritten to fit in the test_progs runner, drop the shell script version Signed-off-by: Alexis Lothoré --- tools/testing/selftests/bpf/Makefile | 1 - tools/testing/selftests/bpf/test_xdp_veth.sh | 121 --- 2 files changed, 122 de

Re: [PATCH net-next v2] selftests: openvswitch: retry instead of sleep

2024-07-11 Thread Adrián Moreno
On Wed, Jul 10, 2024 at 11:04:59AM GMT, Adrian Moreno wrote: > There are a couple of places where the test script "sleep"s to wait for > some external condition to be met. > > This is error prone, specially in slow systems (identified in CI by > "KSFT_MACHINE_SLOW=yes"). > > To fix this, add a "ovs

Re: [syzbot] [mm?] INFO: rcu detected stall in sys_wait4 (4)

2024-07-11 Thread syzbot
syzbot suspects this issue was fixed by commit: commit fb66df20a7201e60f2b13d7f95d031b31a8831d3 Author: Vladimir Oltean Date: Mon May 27 15:39:55 2024 + net/sched: taprio: extend minimum interval restriction to entire cycle too bisection log: https://syzkaller.appspot.com/x/bisect.tx

[PATCH bpf-next v4 02/20] lsm: Refactor return value of LSM hook inode_need_killpriv

2024-07-11 Thread Xu Kuohai
From: Xu Kuohai To be consistent with most LSM hooks, convert the return value of hook inode_need_killpriv to 0 or a negative error code. Before: - Both hook inode_need_killpriv and func security_inode_need_killpriv return > 0 if security_inode_killpriv is required, 0 if not, and < 0 to abor

[PATCH bpf-next v4 05/20] lsm: Refactor return value of LSM hook inode_copy_up_xattr

2024-07-11 Thread Xu Kuohai
From: Xu Kuohai To be consistent with most LSM hooks, convert the return value of hook inode_copy_up_xattr to 0 or a negative error code. Before: - Hook inode_copy_up_xattr returns 0 when accepting xattr, 1 when discarding xattr, -EOPNOTSUPP if it does not know xattr, or any other negative e

[PATCH bpf-next v4 08/20] lsm: Refactor return value of LSM hook getprocattr

2024-07-11 Thread Xu Kuohai
From: Xu Kuohai To be consistent with most LSM hooks, convert the return value of hook getprocattr to 0 or a negative error code. Before: - Hook getprocattr returns length of value on success or a negative error code on failure. After: - Hook getprocattr returns 0 on success or a negative err

[PATCH bpf-next v4 00/20] Add return value range check for BPF LSM

2024-07-11 Thread Xu Kuohai
From: Xu Kuohai LSM BPF prog returning a positive number attached to the hook file_alloc_security makes kernel panic. Here is a panic log: [ 441.235774] BUG: kernel NULL pointer dereference, address: 09 [ 441.236748] #PF: supervisor write access in kernel mode [ 441.237429] #PF:

[PATCH bpf-next v4 11/20] bpf, lsm: Add disabled BPF LSM hook list

2024-07-11 Thread Xu Kuohai
From: Xu Kuohai Add a disabled hooks list for BPF LSM. progs being attached to the listed hooks will be rejected by the verifier. Suggested-by: KP Singh Signed-off-by: Xu Kuohai --- kernel/bpf/bpf_lsm.c | 19 +-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/k

[PATCH bpf-next v4 04/20] lsm: Refactor return value of LSM hook inode_listsecurity

2024-07-11 Thread Xu Kuohai
From: Xu Kuohai To be consistent with most LSM hooks, convert the return value of hook inode_listsecurity to 0 or a negative error code. Before: - Hook inode_listsecurity returns number of bytes used/required on success or a negative error code on failure. After: - Hook inode_listsecurity ret

[PATCH bpf-next v4 03/20] lsm: Refactor return value of LSM hook inode_getsecurity

2024-07-11 Thread Xu Kuohai
From: Xu Kuohai To be consistent with most LSM hooks, convert the return value of hook inode_getsecurity to 0 or a negative error code. Before: - Hook inode_getsecurity returns size of buffer on success or a negative error code on failure. After: - Hook inode_getsecurity returns 0 on success

[PATCH bpf-next v4 01/20] lsm: Refactor return value of LSM hook vm_enough_memory

2024-07-11 Thread Xu Kuohai
From: Xu Kuohai To be consistent with most LSM hooks, convert the return value of hook vm_enough_memory to 0 or a negative error code. Before: - Hook vm_enough_memory returns 1 if permission is granted, 0 if not. - LSM_RET_DEFAULT(vm_enough_memory_mm) is 1. After: - Hook vm_enough_memory reutrn

[PATCH bpf-next v4 07/20] lsm: Refactor return value of LSM hook setprocattr

2024-07-11 Thread Xu Kuohai
From: Xu Kuohai To be consistent with most LSM hooks, convert the return value of hook setprocattr to 0 or a negative error code. Before: - Hook setprocattr returns the number of bytes written on success or a negative error code on failure. After: - Hook setprocattr returns 0 on success or a

[PATCH bpf-next v4 06/20] lsm: Refactor return value of LSM hook getselfattr

2024-07-11 Thread Xu Kuohai
From: Xu Kuohai To be consistent with most LSM hooks, convert the return value of hook getselfattr to 0 or a negative error code. Before: - Hook getselfattr returns number of attributes found on success or a negative error code on failure. After: - Hook getselfattr returns 0 on success or a n

[PATCH bpf-next v4 09/20] lsm: Refactor return value of LSM hook key_getsecurity

2024-07-11 Thread Xu Kuohai
From: Xu Kuohai To be consistent with most LSM hooks, convert the return value of hook key_getsecurity to 0 or a negative error code. Before: - Hook key_getsecurity returns length of value on success or a negative error code on failure. After: - Hook key_getsecurity returns 0 on success or a

[PATCH bpf-next v4 10/20] lsm: Refactor return value of LSM hook audit_rule_match

2024-07-11 Thread Xu Kuohai
From: Xu Kuohai To be consistent with most LSM hooks, convert the return value of hook audit_rule_match to 0 or a negative error code. Before: - Hook audit_rule_match returns 1 if the rule matches, 0 if it not, and negative error code otherwise. After: - Hook audit_rule_match returns 0 on suc

[PATCH bpf-next v4 12/20] bpf, lsm: Enable BPF LSM prog to read/write return value parameters

2024-07-11 Thread Xu Kuohai
From: Xu Kuohai Output parameters are used to refactor the LSM hook return values. To make these hooks usable by bpf prog, it is necessary for bpf prog to read and write these output return value parameters. All return value parameters are added as the last parameter and are always pointers to i

[PATCH bpf-next v4 15/20] bpf: Fix compare error in function retval_range_within

2024-07-11 Thread Xu Kuohai
From: Xu Kuohai After checking lsm hook return range in verifier, the test case "test_progs -t test_lsm" failed, and the failure log says: libbpf: prog 'test_int_hook': BPF program load failed: Invalid argument libbpf: prog 'test_int_hook': -- BEGIN PROG LOAD LOG -- 0: R1=ctx() R10=fp0 ; int BPF

[PATCH bpf-next v4 14/20] bpf: Prevent tail call between progs attached to different hooks

2024-07-11 Thread Xu Kuohai
From: Xu Kuohai bpf progs can be attached to kernel functions, and the attached functions can take different parameters or return different return values. If prog attached to one kernel function tail calls prog attached to another kernel function, the ctx access or return value verification could

[PATCH bpf-next v4 13/20] bpf, lsm: Add check for BPF LSM return value

2024-07-11 Thread Xu Kuohai
From: Xu Kuohai A bpf prog returning a positive number attached to file_alloc_security hook makes kernel panic. This happens because file system can not filter out the positive number returned by the LSM prog using IS_ERR, and misinterprets this positive number as a file pointer. Given that hoo

[PATCH bpf-next v4 16/20] bpf: Add a special case for bitwise AND on range [-1, 0]

2024-07-11 Thread Xu Kuohai
From: Xu Kuohai With lsm return value check, the no-alu32 version test_libbpf_get_fd_by_id_opts is rejected by the verifier, and the log says: 0: R1=ctx() R10=fp0 ; int BPF_PROG(check_access, struct bpf_map *map, fmode_t fmode) @ test_libbpf_get_fd_by_id_opts.c:27 0: (b7) r0 = 0

[PATCH bpf-next v4 17/20] selftests/bpf: Avoid load failure for token_lsm.c

2024-07-11 Thread Xu Kuohai
From: Xu Kuohai The compiler optimized the two bpf progs in token_lsm.c to make return value from the bool variable in the "return -1" path, causing an unexpected rejection: 0: R1=ctx() R10=fp0 ; int BPF_PROG(bpf_token_capable, struct bpf_token *token, int cap) @ bpf_lsm.c:17 0: (b7) r6 = 0

[PATCH bpf-next v4 18/20] selftests/bpf: Add return value checks for failed tests

2024-07-11 Thread Xu Kuohai
From: Xu Kuohai The return ranges of some bpf lsm test progs can not be deduced by the verifier accurately. To avoid erroneous rejections, add explicit return value checks for these progs. Signed-off-by: Xu Kuohai --- tools/testing/selftests/bpf/progs/err.h| 10 ++ tool

[PATCH bpf-next v4 19/20] selftests/bpf: Add test for lsm tail call

2024-07-11 Thread Xu Kuohai
From: Xu Kuohai Add test for lsm tail call to ensure tail call can only be used between bpf lsm progs attached to the same hook. Signed-off-by: Xu Kuohai --- .../selftests/bpf/prog_tests/test_lsm.c | 46 ++- .../selftests/bpf/progs/lsm_tailcall.c| 34 +

[PATCH bpf-next v4 20/20] selftests/bpf: Add verifier tests for bpf lsm

2024-07-11 Thread Xu Kuohai
From: Xu Kuohai Add verifier tests to check bpf lsm return values, output parameter access and disabled hooks. Signed-off-by: Xu Kuohai --- .../selftests/bpf/prog_tests/verifier.c | 2 + .../selftests/bpf/progs/verifier_lsm.c| 274 ++ 2 files changed, 276 insert

Re: [ovs-dev] [PATCH net-next v2] selftests: openvswitch: retry instead of sleep

2024-07-11 Thread Ilya Maximets
On 7/10/24 11:04, Adrian Moreno wrote: > There are a couple of places where the test script "sleep"s to wait for > some external condition to be met. > > This is error prone, specially in slow systems (identified in CI by > "KSFT_MACHINE_SLOW=yes"). > > To fix this, add a "ovs_wait" function that

[PATCH] kselftest: cpufreq: Add RTC wakeup alarm

2024-07-11 Thread Shreeya Patel
Add RTC wakeup alarm for devices to resume after specific time interval. This improvement in the test will help in enabling this test in the CI systems and will eliminate the need of manual intervention for resuming back the devices after suspend/hibernation. Signed-off-by: Shreeya Patel --- too

Re: [PATCH] kselftest: cpufreq: Add RTC wakeup alarm

2024-07-11 Thread Rafael J. Wysocki
On Thu, Jul 11, 2024 at 2:10 PM Shreeya Patel wrote: > > Add RTC wakeup alarm for devices to resume after specific time interval. > This improvement in the test will help in enabling this test > in the CI systems and will eliminate the need of manual intervention > for resuming back the devices af

Re: [PATCH v1 5/9] selftests: kvm: s390: Add debug print functions

2024-07-11 Thread Christoph Schlameuss
On Tue, 9 Jul 2024 18:31:54 +0200 Claudio Imbrenda wrote: > On Tue, 9 Jul 2024 14:57:00 +0200 > Christoph Schlameuss wrote: > [...] > > +static inline void print_hex_bytes(const char *name, u64 page, size_t len) > > > > "page" is not an appropriate name, it's just an address, right? "add

Re: [PATCH v1 8/9] selftests: kvm: s390: Add uc_skey VM test case

2024-07-11 Thread Christoph Schlameuss
On Tue, 9 Jul 2024 19:06:58 +0200 Claudio Imbrenda wrote: > On Tue, 9 Jul 2024 14:57:03 +0200 > Christoph Schlameuss wrote: > > > Add a test case manipulating s390 storage keys from within the ucontrol > > VM. > > > > Signed-off-by: Christoph Schlameuss > > --- > > .../selftests/kvm/s390x/u

Re: [PATCH bpf-next v4 01/20] lsm: Refactor return value of LSM hook vm_enough_memory

2024-07-11 Thread Serge Hallyn
Jul 11, 2024 06:14:08 Xu Kuohai : > From: Xu Kuohai > > To be consistent with most LSM hooks, convert the return value of > hook vm_enough_memory to 0 or a negative error code. > > Before: > - Hook vm_enough_memory returns 1 if permission is granted, 0 if not. > - LSM_RET_DEFAULT(vm_enough_memory

Re: [PATCH bpf] selftests/bpf: DENYLIST.aarch64: Remove fexit_sleep

2024-07-11 Thread Puranjay Mohan
Hi, I was able find the root cause of this bug and will send a fix soon! > Unable to handle kernel paging request at virtual address c2a80e68 We are running this test on Qemu with '-cpu max', this means 52-bit virtual addresses are being used. The trampolines generation code has the fol

Re: [PATCH bpf-next v4 02/20] lsm: Refactor return value of LSM hook inode_need_killpriv

2024-07-11 Thread Serge Hallyn
Jul 11, 2024 06:14:09 Xu Kuohai : > From: Xu Kuohai > > To be consistent with most LSM hooks, convert the return value of > hook inode_need_killpriv to 0 or a negative error code. > > Before: > - Both hook inode_need_killpriv and func security_inode_need_killpriv >   return > 0 if security_inode_

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

2024-07-11 Thread Mark Brown
test_class_name, test_name, -data->card, data->device, data->subdevice, +data->card_name, data->device, + data->subdevice, snd_pcm_stream_name(data->stream)); else - ksft_test_result_skip("%s.%s.%d.%d.%d.%s\n", + ksft_test_result_skip("%s.%s.%s.%d.%d.%s\n", test_class_name, test_name, -data->card, data->device, data->subdevice, +data->card_name, data->device, +data->subdevice, snd_pcm_stream_name(data->stream)); if (msg[0]) @@ -609,8 +616,8 @@ int main(void) conf->filename, conf->config_id); for (pcm = pcm_missing; pcm != NULL; pcm = pcm->next) { - ksft_test_result(false, "test.missing.%d.%d.%d.%s\n", -pcm->card, pcm->device, pcm->subdevice, + ksft_test_result(false, "test.missing.%s.%d.%d.%s\n", +pcm->card_name, pcm->device, pcm->subdevice, snd_pcm_stream_name(pcm->stream)); } --- base-commit: f2661062f16b2de5d7b6a5c42a9a5c96326b8454 change-id: 20240711-alsa-kselftest-board-name-e4a1add4cfa0 Best regards, -- Mark Brown

Re: [RFC 1/5] selftests: KVM: Add a basic SNP smoke test

2024-07-11 Thread Peter Gonda
On Wed, Jul 10, 2024 at 4:06 PM Pratik R. Sampat wrote: > > Extend sev_smoke_test to also run a minimal SEV-SNP smoke test that > initializes and sets up private memory regions required to run a simple > SEV-SNP guest. > > Similar to it's SEV-ES smoke test counterpart, this also does not support >

Re: [PATCH] kselftest: cpufreq: Add RTC wakeup alarm

2024-07-11 Thread Shreeya Patel
On Thursday, July 11, 2024 17:43 IST, "Rafael J. Wysocki" wrote: Hi, > On Thu, Jul 11, 2024 at 2:10 PM Shreeya Patel > wrote: > > > > Add RTC wakeup alarm for devices to resume after specific time interval. > > This improvement in the test will help in enabling this test > > in the CI systems

Re: [RFC 2/5] selftests: KVM: Decouple SEV ioctls from asserts

2024-07-11 Thread Peter Gonda
On Wed, Jul 10, 2024 at 4:06 PM Pratik R. Sampat wrote: > > This commit separates the SEV, SEV-ES, SEV-SNP ioctl calls from its > positive test asserts. This is done so that negative tests can be > introduced and both kinds of testing can be performed independently > using the same base helpers of

Re: [RFC 3/5] selftests: KVM: SEV IOCTL test

2024-07-11 Thread Peter Gonda
> + > +static void test_sev_launch(void *guest_code, uint32_t type, uint64_t policy) > +{ > + struct kvm_vcpu *vcpu; > + struct kvm_vm *vm; > + struct ucall uc; > + bool cond; > + int ret; > + > + vm = vm_sev_create_with_one_vcpu(type, guest_code, &vcpu); > +

Re: [PATCH net-next v16 12/13] selftests: add ncdevmem, netcat for devmem TCP

2024-07-11 Thread Mina Almasry
On Wed, Jul 10, 2024 at 5:44 PM John Hubbard wrote: > > On 7/9/24 5:17 PM, Mina Almasry wrote: > ... > > diff --git a/tools/testing/selftests/net/Makefile > > b/tools/testing/selftests/net/Makefile > > index bc3925200637c..39420a6e86b7f 100644 > > --- a/tools/testing/selftests/net/Makefile > > ++

Re: [PATCH net-next v2] selftests: openvswitch: retry instead of sleep

2024-07-11 Thread Jakub Kicinski
On Thu, 11 Jul 2024 09:41:08 + Adrián Moreno wrote: > This patch is supposed to fix openvswitch selftests on "-dbg" machines. > However, as Simon points out, all recent rounds are failing [1]. I don't > see this patch being included in the batches and I was wondering why. > > Also I see a (pre

Re: [PATCH bpf] selftests/bpf: DENYLIST.aarch64: Remove fexit_sleep

2024-07-11 Thread Daniel Borkmann
On 7/11/24 4:00 PM, Puranjay Mohan wrote: Hi, I was able find the root cause of this bug and will send a fix soon! Unable to handle kernel paging request at virtual address c2a80e68 We are running this test on Qemu with '-cpu max', this means 52-bit virtual addresses are being used.

Re: [RFC 1/5] selftests: KVM: Add a basic SNP smoke test

2024-07-11 Thread Tom Lendacky
On 7/10/24 17:05, Pratik R. Sampat wrote: > Extend sev_smoke_test to also run a minimal SEV-SNP smoke test that > initializes and sets up private memory regions required to run a simple > SEV-SNP guest. > > Similar to it's SEV-ES smoke test counterpart, this also does not support > GHCB and ucall

Re: [RFC 4/5] selftests: KVM: SNP IOCTL test

2024-07-11 Thread Peter Gonda
On Wed, Jul 10, 2024 at 4:06 PM Pratik R. Sampat wrote: > > Introduce testing of SNP ioctl calls. This patch includes both positive > and negative tests of various parameters such as flags, page types and > policies. > > Signed-off-by: Pratik R. Sampat Tested-by: Peter Gonda > --- > .../selft

Re: [RFC 5/5] selftests: KVM: SEV-SNP test for KVM_SEV_INIT2

2024-07-11 Thread Peter Gonda
On Wed, Jul 10, 2024 at 4:06 PM Pratik R. Sampat wrote: > > Add SEV-SNP VM type to exercise the KVM_SEV_INIT2 call. > > Signed-off-by: Pratik R. Sampat Tested-by: Peter Gonda

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

2024-07-11 Thread Jaroslav Kysela
On 11. 07. 24 16:33, Mark Brown wrote: Currently for the PCM and mixer tests we report test names which identify the card being tested with the card number. This ensures we have unique names but since card numbers are dynamically assigned at runtime the names we end up with will often not be stab

Re: [RFC 2/5] selftests: KVM: Decouple SEV ioctls from asserts

2024-07-11 Thread Peter Gonda
> +int sev_vm_launch_update(struct kvm_vm *vm, uint32_t policy) > +{ > + struct userspace_mem_region *region; > + int ctr, ret; > > + hash_for_each(vm->regions.slot_hash, ctr, region, slot_node) { > + ret = encrypt_region(vm, region, 0); > + if (ret) >

Re: [PATCH 0/4] selftest: x86: conform tests to TAP format output

2024-07-11 Thread Shuah Khan
On 7/10/24 02:58, Muhammad Usama Anjum wrote: Hi Shuah, Thank you for replying. On 7/10/24 4:39 AM, Shuah Khan wrote: On 7/2/24 04:17, Muhammad Usama Anjum wrote: On 6/10/24 10:19 AM, Muhammad Usama Anjum wrote: Adding Borislav, Dave and x86 mailing list: Please review the series. Kind

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 that a combination of car

Re: [PATCH] KVM: selftests: Add SEV-ES shutdown test

2024-07-11 Thread Sampat, Pratik Rajesh
Hi Peter, On 7/9/2024 1:29 PM, Peter Gonda wrote: > Regression test for ae20eef5 ("KVM: SVM: Update SEV-ES shutdown intercepts > with more metadata"). Test confirms userspace is correctly indicated of > a guest shutdown not previous behavior of an EINVAL from KVM_RUN. > > Cc: Paolo Bonzini > Cc:

Re: [RFC 1/5] selftests: KVM: Add a basic SNP smoke test

2024-07-11 Thread Sampat, Pratik Rajesh
Hi Peter, Thank you for your review! On 7/11/2024 10:16 AM, Peter Gonda wrote: > On Wed, Jul 10, 2024 at 4:06 PM Pratik R. Sampat > wrote: >> >> Extend sev_smoke_test to also run a minimal SEV-SNP smoke test that >> initializes and sets up private memory regions required to run a simple >> SEV-S

Re: [RFC 3/5] selftests: KVM: SEV IOCTL test

2024-07-11 Thread Sampat, Pratik Rajesh
On 7/11/2024 10:23 AM, Peter Gonda wrote: >> + >> +static void test_sev_launch(void *guest_code, uint32_t type, uint64_t >> policy) >> +{ >> + struct kvm_vcpu *vcpu; >> + struct kvm_vm *vm; >> + struct ucall uc; >> + bool cond; >> + int ret; >> + >> + vm = vm

Re: [RFC 1/5] selftests: KVM: Add a basic SNP smoke test

2024-07-11 Thread Sampat, Pratik Rajesh
Hi Tom, On 7/11/2024 10:56 AM, Tom Lendacky wrote: > On 7/10/24 17:05, Pratik R. Sampat wrote: >> Extend sev_smoke_test to also run a minimal SEV-SNP smoke test that >> initializes and sets up private memory regions required to run a simple >> SEV-SNP guest. >> >> Similar to it's SEV-ES smoke test

Re: [RFC 4/5] selftests: KVM: SNP IOCTL test

2024-07-11 Thread Sampat, Pratik Rajesh
On 7/11/2024 10:57 AM, Peter Gonda wrote: > On Wed, Jul 10, 2024 at 4:06 PM Pratik R. Sampat > wrote: >> >> Introduce testing of SNP ioctl calls. This patch includes both positive >> and negative tests of various parameters such as flags, page types and >> policies. >> >> Signed-off-by: Pratik

Re: [RFC 2/5] selftests: KVM: Decouple SEV ioctls from asserts

2024-07-11 Thread Sampat, Pratik Rajesh
On 7/11/2024 11:11 AM, Peter Gonda wrote: >> +int sev_vm_launch_update(struct kvm_vm *vm, uint32_t policy) >> +{ >> + struct userspace_mem_region *region; >> + int ctr, ret; >> >> + hash_for_each(vm->regions.slot_hash, ctr, region, slot_node) { >> + ret = encrypt_

Re: [PATCH] KVM: selftests: Add SEV-ES shutdown test

2024-07-11 Thread Peter Gonda
> > I guess this case also applies to SNP. So maybe once this patch is > queued up I could spin another patch in my SNP kselftest patch series > that parameterizes this function to test SNP as well. > Thanks! That sounds great. I plan on sending a few tests for the sev-es termination codes. I can

Re: [PATCH v2] selftests: x86: conform test to TAP format output

2024-07-11 Thread Shuah Khan
On 7/11/24 00:52, Muhammad Usama Anjum wrote: On 7/10/24 9:16 PM, Shuah Khan wrote: On 7/10/24 03:37, Muhammad Usama Anjum wrote: This patch brings just readability implements by using kselftests wrappers instead of manual pass/fail test cases counting. It has been on mailing list from several

[PATCH v2] kunit: executor: Simplify string allocation handling

2024-07-11 Thread Kees Cook
The alloc/copy code pattern is better consolidated to single kstrdup (and kstrndup) calls instead. This gets rid of deprecated[1] strncpy() uses as well. Replace one other strncpy() use with the more idiomatic strscpy(). Link: https://github.com/KSPP/linux/issues/90 [1] Reviewed-by: David Gow Sig

Re: [PATCH] kunit: executor: Simplify string allocation handling

2024-07-11 Thread Kees Cook
On Thu, Jul 11, 2024 at 01:39:15PM +0800, David Gow wrote: > On Wed, 10 Jul 2024 at 08:02, Kees Cook wrote: > > diff --git a/lib/kunit/executor_test.c b/lib/kunit/executor_test.c > > index 3f7f967e3688..7191be9c4f9b 100644 > > --- a/lib/kunit/executor_test.c > > +++ b/lib/kunit/executor_test.c > >

Re: [RFC 3/5] selftests: KVM: SEV IOCTL test

2024-07-11 Thread Tom Lendacky
On 7/10/24 17:05, Pratik R. Sampat wrote: > Introduce tests for sev and sev-es ioctl that exercises the boot path > of launch, update and finish on an invalid policy. > > Signed-off-by: Pratik R. Sampat > --- > .../selftests/kvm/x86_64/sev_smoke_test.c | 57 +++ > 1 file chan

Re: [PATCH net-next v16 12/13] selftests: add ncdevmem, netcat for devmem TCP

2024-07-11 Thread John Hubbard
On 7/11/24 8:28 AM, Mina Almasry wrote: On Wed, Jul 10, 2024 at 5:44 PM John Hubbard wrote: On 7/9/24 5:17 PM, Mina Almasry wrote: ... diff --git a/tools/testing/selftests/net/Makefile b/tools/testing/selftests/net/Makefile index bc3925200637c..39420a6e86b7f 100644 --- a/tools/testing/selfte

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

2024-07-11 Thread Catalin Marinas
On Sun, 02 Jun 2024 18:24:59 +0500, Muhammad Usama Anjum wrote: > Conform the layout, informational and status messages to TAP. No > functional change is intended other than the layout of output messages. > > Applied to arm64 (for-next/kselftest), thanks! [1/2] selftests: arm64: tags_test: conf

kselftest/next build: 6 builds: 0 failed, 6 passed, 1 warning (v6.10-rc7-29-gdf09b0bb09ea)

2024-07-11 Thread kernelci.org bot
kselftest/next build: 6 builds: 0 failed, 6 passed, 1 warning (v6.10-rc7-29-gdf09b0bb09ea) Full Build Summary: https://kernelci.org/build/kselftest/branch/next/kernel/v6.10-rc7-29-gdf09b0bb09ea/ Tree: kselftest Branch: next Git Describe: v6.10-rc7-29-gdf09b0bb09ea Git Commit: df09b0bb09ea9775b6

Re: [PATCH v2 0/4] add tests to verify IFS (In Field Scan) driver functionality

2024-07-11 Thread Shuah Khan
On 7/10/24 19:42, Joseph, Jithu wrote: Acked-by: Jithu Joseph Applied to linux-kselftest next for Linux 6.11-rc1. thanks, -- Shuah

[PATCH v2 0/3] kunit: Improve the readability and functionality of macro

2024-07-11 Thread Eric Chan
This series let kunit macro more neat and clear. Fix comment and rename the macro. Also introduce new type of assertion marco for functionality. This is a follow-up to [0](v1). v1 -> v2: [PATCH 2/3] changed KUNIT_ASSERT to KUNIT_FAIL_AND_ABORT [0] https://lore.kernel.org/lkml/20240710170448.13999

[PATCH v2 1/3] kunit: Fix the comment of KUNIT_ASSERT_STRNEQ as assertion

2024-07-11 Thread Eric Chan
The current comment for KUNIT_ASSERT_STRNEQ incorrectly describes it as an expectation. Since KUNIT_ASSERT_STRNEQ is an assertion, updates the comment to correctly refer to it as such. Signed-off-by: Eric Chan --- include/kunit/test.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) di

[PATCH v2 2/3] kunit: Rename KUNIT_ASSERT_FAILURE to KUNIT_FAIL_AND_ABORT for readability

2024-07-11 Thread Eric Chan
Both KUNIT_FAIL and KUNIT_ASSERT_FAILURE defined to KUNIT_FAIL_ASSERTION with different tpye of kunit_assert_type. The current naming of KUNIT_ASSERT_FAILURE and KUNIT_FAIL_ASSERTION is confusing due to their similarities. To improve readability and symmetry, renames KUNIT_ASSERT_FAILURE to KUNIT_F

[PATCH v2 3/3] kunit: Introduce KUNIT_ASSERT_MEMEQ and KUNIT_ASSERT_MEMNEQ macros

2024-07-11 Thread Eric Chan
Introduces KUNIT_ASSERT_MEMEQ and KUNIT_ASSERT_MEMNEQ macros to provide assert-type equivalents for memory comparison. While KUNIT_EXPECT_MEMEQ and KUNIT_EXPECT_MEMNEQ are available for expectations, the addition of these new macros ensures that assertions can also be used for memory comparisons, e

Re: [PATCH 2/3] kunit: Rename KUNIT_ASSERT_FAILURE to KUNIT_ASSERT for readability

2024-07-11 Thread Eric Chan
On Thu, Jul 11, 2024 at 11:49 AM David Gow wrote: > > On Thu, 11 Jul 2024 at 01:06, Eric Chan wrote: > > > > Both KUNIT_FAIL and KUNIT_ASSERT_FAILURE defined to KUNIT_FAIL_ASSERTION > > with different tpye of kunit_assert_type. The current naming of > > KUNIT_ASSERT_FAILURE and KUNIT_FAIL_ASSERTI

Re: [PATCH v2 0/3] kselftest: Add test to report device log errors

2024-07-11 Thread Shuah Khan
On 7/10/24 15:49, Shuah Khan wrote: On 7/10/24 07:11, Greg Kroah-Hartman wrote: On Fri, Jul 05, 2024 at 07:29:53PM -0400, Nícolas F. R. A. Prado wrote: Log errors are the most widely used mechanism for reporting issues in the kernel. When an error is logged using the device helpers, eg dev_err(

Re: [RFC 3/5] selftests: KVM: SEV IOCTL test

2024-07-11 Thread Sampat, Pratik Rajesh
Hi Tom On 7/11/2024 1:34 PM, Tom Lendacky wrote: > On 7/10/24 17:05, Pratik R. Sampat wrote: >> Introduce tests for sev and sev-es ioctl that exercises the boot path >> of launch, update and finish on an invalid policy. >> >> Signed-off-by: Pratik R. Sampat >> --- >> .../selftests/kvm/x86_64/sev

kselftest/next kselftest-seccomp: 6 runs, 2 regressions (v6.10-rc7-29-gdf09b0bb09ea)

2024-07-11 Thread kernelci.org bot
kselftest/next kselftest-seccomp: 6 runs, 2 regressions (v6.10-rc7-29-gdf09b0bb09ea) Regressions Summary --- platform | arch | lab | compiler | defconfig | regressions -+---+---+---

kselftest/next kselftest-lkdtm: 5 runs, 1 regressions (v6.10-rc7-29-gdf09b0bb09ea)

2024-07-11 Thread kernelci.org bot
kselftest/next kselftest-lkdtm: 5 runs, 1 regressions (v6.10-rc7-29-gdf09b0bb09ea) Regressions Summary --- platform| arch | lab | compiler | defconfig | regressions +---+---+--+

Re: [PATCH net-next v16 05/13] page_pool: devmem support

2024-07-11 Thread Mina Almasry
On Wed, Jul 10, 2024 at 6:23 PM Jakub Kicinski wrote: > > On Wed, 10 Jul 2024 16:42:04 -0700 Mina Almasry wrote: > > > > +static inline void netmem_set_pp(netmem_ref netmem, struct page_pool > > > > *pool) > > > > +{ > > > > + __netmem_clear_lsb(netmem)->pp = pool; > > > > +} > > > > > > Why

Re: [PATCH net-next v16 05/13] page_pool: devmem support

2024-07-11 Thread Jakub Kicinski
On Thu, 11 Jul 2024 13:57:01 -0700 Mina Almasry wrote: > > > Sorry none of those are only used by net/core/*. Pretty much all of > > > these are used by include/net/page_pool/helpers.h, and some have > > > callers in net/core/devmem.c or net/core/skbuff.c > > > > > > Would you like me to move these

Re: [PATCH v2 0/3] kselftest: Add test to report device log errors

2024-07-11 Thread Nícolas F . R . A . Prado
On Thu, Jul 11, 2024 at 01:53:37PM -0600, Shuah Khan wrote: > On 7/10/24 15:49, Shuah Khan wrote: > > On 7/10/24 07:11, Greg Kroah-Hartman wrote: > > > On Fri, Jul 05, 2024 at 07:29:53PM -0400, Nícolas F. R. A. Prado wrote: > > > > Log errors are the most widely used mechanism for reporting issues

Re: [PATCH v2 0/3] kselftest: Add test to report device log errors

2024-07-11 Thread Shuah Khan
On 7/11/24 15:44, Nícolas F. R. A. Prado wrote: On Thu, Jul 11, 2024 at 01:53:37PM -0600, Shuah Khan wrote: On 7/10/24 15:49, Shuah Khan wrote: On 7/10/24 07:11, Greg Kroah-Hartman wrote: On Fri, Jul 05, 2024 at 07:29:53PM -0400, Nícolas F. R. A. Prado wrote: Log errors are the most widely us

kselftest/next build: 1 build: 0 failed, 1 passed (v6.10-rc7-33-gbb408dae9e73)

2024-07-11 Thread kernelci.org bot
kselftest/next build: 1 build: 0 failed, 1 passed (v6.10-rc7-33-gbb408dae9e73) Full Build Summary: https://kernelci.org/build/kselftest/branch/next/kernel/v6.10-rc7-33-gbb408dae9e73/ Tree: kselftest Branch: next Git Describe: v6.10-rc7-33-gbb408dae9e73 Git Commit: bb408dae9e73803eab8a648115d6c4a

Re: [PATCH] selftests/bpf:fix a resource leak in main()

2024-07-11 Thread Stanislav Fomichev
On 07/11, Ma Ke wrote: > The requested resources should be closed before return in main(), otherwise > resource leak will occur. Add a check of cg_fd before close(). > > Fixes: 435f90a338ae ("selftests/bpf: add a test case for sock_ops perf-event > notification") > Signed-off-by: Ma Ke > --- >

Re: [PATCH bpf-next 2/5] selftests/bpf: Drop must_fail from network_helper_opts

2024-07-11 Thread Martin KaFai Lau
On 7/10/24 7:52 PM, Geliang Tang wrote: From: Geliang Tang The struct member "must_fail" of network_helper_opts() is only used in cgroup_v1v2 tests, it makes sense to drop it from network_helper_opts. Return value (fd) of connect_to_fd_opts() and the expect errno (EPERM) can be checked in cgro

Re: [PATCH 2/3] selftests/bpf: integrate test_xdp_veth into test_progs

2024-07-11 Thread Stanislav Fomichev
On 07/11, Alexis Lothoré (eBPF Foundation) wrote: > test_xdp_veth.sh tests that XDP return codes work as expected, by bringing > up multiple veth pairs isolated in different namespaces, attaching specific > xdp programs to each interface, and ensuring that the whole chain allows to > ping one end i

Re: [PATCH net-next v2] selftests: openvswitch: retry instead of sleep

2024-07-11 Thread patchwork-bot+netdevbpf
Hello: This patch was applied to netdev/net-next.git (main) by Jakub Kicinski : On Wed, 10 Jul 2024 11:04:59 +0200 you wrote: > There are a couple of places where the test script "sleep"s to wait for > some external condition to be met. > > This is error prone, specially in slow systems (identif

[PATCH v2] selftests:Fix printf format string in kselftest_harness.h

2024-07-11 Thread Zhu Jun
'%u' in format string requires 'unsigned int' in __wait_for_test() but the argument type is 'signed int' that this problem was discovered by reading code Signed-off-by: Zhu Jun --- Changes in v2: - modify commit info add how to find the problem in the log tools/testing/selftests/kselftest_har

[PATCH v23 4/4] selftests/vDSO: add tests for vgetrandom

2024-07-11 Thread Jason A. Donenfeld
This adds two tests for vgetrandom. The first one, vdso_test_chacha, simply checks that the assembly implementation of chacha20 matches that of libsodium, a basic sanity check that should catch most errors. The second, vdso_test_getrandom, is a full "libc-like" implementation of the userspace side

[RESEND bpf-next v2] selftests/bpf:fix a resource leak

2024-07-11 Thread Zhu Jun
The requested resources should be closed before return in main(), otherwise resource leak will occur Signed-off-by: Zhu Jun --- Changes in v2: - check for cg_fd >= 0 and have just one out label tools/testing/selftests/bpf/test_sockmap.c | 11 +++ 1 file changed, 7 insertions(+), 4 dele

Re: [PATCH v2 1/3] kunit: Fix the comment of KUNIT_ASSERT_STRNEQ as assertion

2024-07-11 Thread David Gow
On Fri, 12 Jul 2024 at 03:39, Eric Chan wrote: > > The current comment for KUNIT_ASSERT_STRNEQ incorrectly describes it as > an expectation. Since KUNIT_ASSERT_STRNEQ is an assertion, updates the > comment to correctly refer to it as such. > > Signed-off-by: Eric Chan > --- Reviewed-by: David Go

Re: [PATCH v2 2/3] kunit: Rename KUNIT_ASSERT_FAILURE to KUNIT_FAIL_AND_ABORT for readability

2024-07-11 Thread David Gow
On Fri, 12 Jul 2024 at 03:39, Eric Chan wrote: > > Both KUNIT_FAIL and KUNIT_ASSERT_FAILURE defined to KUNIT_FAIL_ASSERTION > with different tpye of kunit_assert_type. The current naming of > KUNIT_ASSERT_FAILURE and KUNIT_FAIL_ASSERTION is confusing due to their > similarities. To improve readabi

Re: [PATCH v2 3/3] kunit: Introduce KUNIT_ASSERT_MEMEQ and KUNIT_ASSERT_MEMNEQ macros

2024-07-11 Thread David Gow
On Fri, 12 Jul 2024 at 03:39, Eric Chan wrote: > > Introduces KUNIT_ASSERT_MEMEQ and KUNIT_ASSERT_MEMNEQ macros > to provide assert-type equivalents for memory comparison. > While KUNIT_EXPECT_MEMEQ and KUNIT_EXPECT_MEMNEQ are available for > expectations, the addition of these new macros ensures