Re: [PATCH v4 11/11] KVM: selftests: Enable tunning of err_margin_us in arch timer test

2023-12-20 Thread Haibo Xu
On Wed, Dec 20, 2023 at 9:58 PM Marc Zyngier wrote: > > On Wed, 20 Dec 2023 13:51:24 +, > Haibo Xu wrote: > > > > On Wed, Dec 20, 2023 at 5:00 PM Marc Zyngier wrote: > > > > > > On 2023-12-20 06:50, Haibo Xu wrote: > > > > On Wed, Dec 20, 2023 at 2:22 AM Marc Zyngier wrote: > > > >> > > >

[PATCH bpf-next 15/15] selftests/bpf: states pruning checks for scalar vs STACK_{MISC,ZERO}

2023-12-20 Thread Maxim Mikityanskiy
From: Eduard Zingerman Check that stacksafe() considers the following old vs cur stack spill state combinations equivalent: - spill of unbound scalar vs combination of STACK_{MISC,ZERO,INVALID} - STACK_MISC vs spill of unbound scalar - spill of scalar 0 vs STACK_ZERO - STACK_ZERO vs spill of

[PATCH bpf-next 14/15] bpf: Optimize state pruning for spilled scalars

2023-12-20 Thread Maxim Mikityanskiy
From: Eduard Zingerman Changes for scalar ID tracking of spilled unbound scalars lead to certain verification performance regression. This commit mitigates the regression by exploiting the following properties maintained by check_stack_read_fixed_off(): - a mix of STACK_MISC, STACK_ZERO and

[PATCH bpf-next 13/15] selftests/bpf: Add test cases for narrowing fill

2023-12-20 Thread Maxim Mikityanskiy
From: Maxim Mikityanskiy The previous commit allowed to preserve boundaries and track IDs of scalars on narrowing fills. Add test cases for that pattern. Signed-off-by: Maxim Mikityanskiy --- .../selftests/bpf/progs/verifier_spill_fill.c | 108 ++ 1 file changed, 108

[PATCH bpf-next 12/15] bpf: Preserve boundaries and track scalars on narrowing fill

2023-12-20 Thread Maxim Mikityanskiy
From: Maxim Mikityanskiy When the width of a fill is smaller than the width of the preceding spill, the information about scalar boundaries can still be preserved, as long as it's coerced to the right width (done by coerce_reg_to_size). Even further, if the actual value fits into the fill width,

[PATCH bpf-next 11/15] selftests/bpf: Test tracking spilled unbounded scalars

2023-12-20 Thread Maxim Mikityanskiy
From: Maxim Mikityanskiy The previous commit added tracking for unbounded scalars on spill. Add the test case to check the new functionality. Signed-off-by: Maxim Mikityanskiy --- .../selftests/bpf/progs/verifier_spill_fill.c | 27 +++ 1 file changed, 27 insertions(+) diff

[PATCH bpf-next 10/15] bpf: Track spilled unbounded scalars

2023-12-20 Thread Maxim Mikityanskiy
From: Maxim Mikityanskiy Support the pattern where an unbounded scalar is spilled to the stack, then boundary checks are performed on the src register, after which the stack frame slot is refilled into a register. Before this commit, the verifier didn't treat the src register and the stack slot

[PATCH bpf-next 09/15] selftests/bpf: Test assigning ID to scalars on spill

2023-12-20 Thread Maxim Mikityanskiy
From: Maxim Mikityanskiy The previous commit implemented assigning IDs to registers holding scalars before spill. Add the test cases to check the new functionality. Signed-off-by: Maxim Mikityanskiy --- .../selftests/bpf/progs/verifier_spill_fill.c | 133 ++ 1 file changed,

[PATCH bpf-next 08/15] bpf: Assign ID to scalars on spill

2023-12-20 Thread Maxim Mikityanskiy
From: Maxim Mikityanskiy Currently, when a scalar bounded register is spilled to the stack, its ID is preserved, but only if was already assigned, i.e. if this register was MOVed before. Assign an ID on spill if none is set, so that equal scalars could be tracked if a register is spilled to the

[PATCH bpf-next 07/15] bpf: Add the get_reg_width function

2023-12-20 Thread Maxim Mikityanskiy
From: Maxim Mikityanskiy Put calculation of the register value width into a dedicated function. This function will also be used in a following commit. Signed-off-by: Maxim Mikityanskiy --- kernel/bpf/verifier.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git

[PATCH bpf-next 06/15] bpf: Add the assign_scalar_id_before_mov function

2023-12-20 Thread Maxim Mikityanskiy
From: Maxim Mikityanskiy Extract the common code that generates a register ID for src_reg before MOV if needed into a new function. This function will also be used in a following commit. Signed-off-by: Maxim Mikityanskiy --- kernel/bpf/verifier.c | 33 +++-- 1 file

[PATCH bpf-next 05/15] selftests/bpf: Add a test case for 32-bit spill tracking

2023-12-20 Thread Maxim Mikityanskiy
From: Maxim Mikityanskiy When a range check is performed on a register that was 32-bit spilled to the stack, the IDs of the two instances of the register are the same, so the range should also be the same. Signed-off-by: Maxim Mikityanskiy --- .../selftests/bpf/progs/verifier_spill_fill.c |

[PATCH bpf-next 04/15] bpf: Make bpf_for_each_spilled_reg consider narrow spills

2023-12-20 Thread Maxim Mikityanskiy
From: Maxim Mikityanskiy Adjust the check in bpf_get_spilled_reg to take into account spilled registers narrower than 64 bits. That allows find_equal_scalars to properly adjust the range of all spilled registers that have the same ID. Before this change, it was possible for a register and a

[PATCH bpf-next 03/15] selftests/bpf: check if imprecise stack spills confuse infinite loop detection

2023-12-20 Thread Maxim Mikityanskiy
From: Eduard Zingerman Verify that infinite loop detection logic separates states with identical register states but different imprecise scalars spilled to stack. Signed-off-by: Eduard Zingerman --- .../selftests/bpf/progs/verifier_loops1.c | 24 +++ 1 file changed, 24

[PATCH bpf-next 02/15] bpf: make infinite loop detection in is_state_visited() exact

2023-12-20 Thread Maxim Mikityanskiy
From: Eduard Zingerman Current infinite loops detection mechanism is speculative: - first, states_maybe_looping() check is done which simply does memcmp for R1-R10 in current frame; - second, states_equal(..., exact=false) is called. With exact=false states_equal() would compare scalars for

[PATCH bpf-next 01/15] selftests/bpf: Fix the u64_offset_to_skb_data test

2023-12-20 Thread Maxim Mikityanskiy
From: Maxim Mikityanskiy The u64_offset_to_skb_data test is supposed to make a 64-bit fill, but instead makes a 16-bit one. Fix the test according to its intention. The 16-bit fill is covered by u16_offset_to_skb_data. Signed-off-by: Maxim Mikityanskiy ---

[PATCH bpf-next 00/15] Improvements for tracking scalars in the BPF verifier

2023-12-20 Thread Maxim Mikityanskiy
From: Maxim Mikityanskiy The goal of this series is to extend the verifier's capabilities of tracking scalars when they are spilled to stack, especially when the spill or fill is narrowing. It also contains a fix by Eduard for infinite loop detection and a state pruning optimization by Eduard

Re: [PATCH] selftests/livepatch: fix and refactor new dmesg message code

2023-12-20 Thread Alexander Gordeev
On Wed, Dec 20, 2023 at 10:11:51AM -0500, Joe Lawrence wrote: > The livepatching kselftests rely on comparing expected vs. observed > dmesg output. After each test, new dmesg entries are determined by the > 'comm' utility comparing a saved, pre-test copy of dmesg to post-test > dmesg output. > >

Re: [PATCH 0/2] kselftest/seccomp: Convert to KTAP output

2023-12-20 Thread Anders Roxell
On 2023-12-19 21:21, Mark Brown wrote: > Currently the seccomp benchmark selftest produces non-standard output, > meaning that while it makes a number of checks of the performance it > observes this has to be parsed by humans. This means that automated > systems running this suite of tests are

[PATCH RESEND v4 3/3] selftests: livepatch: Test livepatching a heavily called syscall

2023-12-20 Thread Marcos Paulo de Souza
The test proves that a syscall can be livepatched. It is interesting because syscalls are called a tricky way. Also the process gets livepatched either when sleeping in the userspace or when entering or leaving the kernel space. The livepatch is a bit tricky: 1. The syscall function name is

[PATCH RESEND v4 2/3] livepatch: Move tests from lib/livepatch to selftests/livepatch

2023-12-20 Thread Marcos Paulo de Souza
The modules are being moved from lib/livepatch to tools/testing/selftests/livepatch/test_modules. This code moving will allow writing more complex tests, like for example an userspace C code that will call a livepatched kernel function. The modules are now built as out-of-tree modules, but being

[PATCH RESEND v4 1/3] kselftests: lib.mk: Add TEST_GEN_MODS_DIR variable

2023-12-20 Thread Marcos Paulo de Souza
Add TEST_GEN_MODS_DIR variable for kselftests. It can point to a directory containing kernel modules that will be used by selftest scripts. The modules are built as external modules for the running kernel. As a result they are always binary compatible and the same tests can be used for older or

[PATCH RESEND v4 0/3] livepatch: Move modules to selftests and add a new test

2023-12-20 Thread Marcos Paulo de Souza
Changes in v4: * Documented how to compile the livepatch selftests without running the tests (Joe) * Removed the mention to lib/livepatch on MAINTAINERS file, reported by checkpatch. Changes in v3: * Rebased on top of v6.6-rc5 * The commits messages were improved (Thanks Petr!) * Created

[PATCH] kunit: Protect string comparisons against NULL

2023-12-20 Thread Richard Fitzgerald
Add NULL checks to KUNIT_BINARY_STR_ASSERTION() so that it will fail cleanly if either pointer is NULL, instead of causing a NULL pointer dereference in the strcmp(). A test failure could be that a string is unexpectedly NULL. This could be trapped by KUNIT_ASSERT_NOT_NULL() but that would

[PATCH 6/6] wifi: cfg80211: tests: add some scanning related tests

2023-12-20 Thread benjamin
From: Benjamin Berg This adds some scanning related tests, mainly exercising the ML element parsing and inheritance. Signed-off-by: Benjamin Berg Reviewed-by: Johannes Berg --- net/wireless/core.h | 13 +- net/wireless/scan.c | 9 +- net/wireless/tests/Makefile | 2 +-

[PATCH 5/6] wifi: mac80211: kunit: extend MFP tests

2023-12-20 Thread benjamin
From: Johannes Berg Extend the MFP tests to handle the case of deauth/disassoc and robust action frames (that are not protected dual of public action frames). Signed-off-by: Johannes Berg Reviewed-by: Gregory Greenman --- net/mac80211/tests/mfp.c | 74 +---

[PATCH 4/6] wifi: mac80211: kunit: generalize public action test

2023-12-20 Thread benjamin
From: Johannes Berg Generalize the test to be able to handle arbitrary action categories and non-action frames, for further test expansion. Signed-off-by: Johannes Berg Reviewed-by: Gregory Greenman --- net/mac80211/tests/mfp.c | 78 +--- 1 file changed,

[PATCH 1/6] kunit: add parameter generation macro using description from array

2023-12-20 Thread benjamin
From: Benjamin Berg The existing KUNIT_ARRAY_PARAM macro requires a separate function to get the description. However, in a lot of cases the description can just be copied directly from the array. Add a second macro that avoids having to write a static function just for a single strscpy.

[PATCH 3/6] wifi: mac80211: add kunit tests for public action handling

2023-12-20 Thread benjamin
From: Johannes Berg Check the logic in ieee80211_drop_unencrypted_mgmt() according to a list of test cases derived from the spec. Signed-off-by: Johannes Berg Reviewed-by: Benjamin Berg --- net/mac80211/ieee80211_i.h | 10 ++ net/mac80211/rx.c | 4 +-

[PATCH 2/6] kunit: add a convenience allocation wrapper for SKBs

2023-12-20 Thread benjamin
From: Benjamin Berg Add a simple convenience helper to allocate and zero fill an SKB for the use by a kunit test. Also provide a way to free it again in case that may be desirable. This simply mirrors the kunit_kmalloc API. Signed-off-by: Benjamin Berg --- include/kunit/skbuff.h | 56

[PATCH 0/6] Add some more cfg80211 and mac80211 kunit tests

2023-12-20 Thread benjamin
From: Benjamin Berg This patchset adds a couple of helpers for kunit as well as tests for cfg80211 and mac80211 that use them. Benjamin Berg (3): kunit: add parameter generation macro using description from array kunit: add a convenience allocation wrapper for SKBs wifi: cfg80211: tests:

[PATCH] selftests/livepatch: fix and refactor new dmesg message code

2023-12-20 Thread Joe Lawrence
The livepatching kselftests rely on comparing expected vs. observed dmesg output. After each test, new dmesg entries are determined by the 'comm' utility comparing a saved, pre-test copy of dmesg to post-test dmesg output. Alexander reports that the 'comm --nocheck-order -13' invocation used by

Re: [PATCH v4 11/11] KVM: selftests: Enable tunning of err_margin_us in arch timer test

2023-12-20 Thread Marc Zyngier
On Wed, 20 Dec 2023 13:51:24 +, Haibo Xu wrote: > > On Wed, Dec 20, 2023 at 5:00 PM Marc Zyngier wrote: > > > > On 2023-12-20 06:50, Haibo Xu wrote: > > > On Wed, Dec 20, 2023 at 2:22 AM Marc Zyngier wrote: > > >> > > >> On Tue, 12 Dec 2023 09:31:20 +, > > >> Haibo Xu wrote: > > >> >

Re: [PATCH v4 11/11] KVM: selftests: Enable tunning of err_margin_us in arch timer test

2023-12-20 Thread Haibo Xu
On Wed, Dec 20, 2023 at 5:00 PM Marc Zyngier wrote: > > On 2023-12-20 06:50, Haibo Xu wrote: > > On Wed, Dec 20, 2023 at 2:22 AM Marc Zyngier wrote: > >> > >> On Tue, 12 Dec 2023 09:31:20 +, > >> Haibo Xu wrote: > >> > > @@ -216,6 +221,9 @@ static bool parse_args(int argc, char *argv[]) >

Re: selftests/livepatch fails on s390

2023-12-20 Thread Petr Mladek
On Tue 2023-12-19 09:50:18, Joe Lawrence wrote: > On 12/19/23 04:45, Alexander Gordeev wrote: > > On Mon, Dec 18, 2023 at 05:44:54PM -0500, Joe Lawrence wrote: > > > >> @@ -280,7 +268,13 @@ function set_pre_patch_ret { > >> function start_test { > >>local test="$1" > >> > >> - save_dmesg

Re: [PATCH v3 3/3] selftests: livepatch: Test livepatching a heavily called syscall

2023-12-20 Thread Marcos Paulo de Souza
On Mon, 2023-12-18 at 13:47 -0700, Shuah Khan wrote: > On 12/15/23 13:36, Joe Lawrence wrote: > > On 12/11/23 16:53, Shuah Khan wrote: > > > On 12/6/23 07:39, Miroslav Benes wrote: > > > > Hi, > > > > > > > > On Tue, 5 Dec 2023, Shuah Khan wrote: > > > > > > > > > On 12/5/23 05:52,

Re: [PATCH v6 0/6] iommufd: Add nesting infrastructure (part 2/2)

2023-12-20 Thread Joel Granados
On Tue, Dec 19, 2023 at 05:26:21PM +0800, Yi Liu wrote: > On 2023/12/17 19:21, Joel Granados wrote: > > Hey Yi > > > > I have been working with > >

Re: [PATCH v3] kunit: run test suites only after module initialization completes

2023-12-20 Thread Richard Fitzgerald
On 06/12/2023 15:07, Marco Pagani wrote: Commit 2810c1e99867 ("kunit: Fix wild-memory-access bug in kunit_free_suite_set()") fixed a wild-memory-access bug that could have happened during the loading phase of test suites built and executed as loadable modules. However, it also introduced a

Re: [PATCH v14 10/12] selftests/landlock: Add network tests

2023-12-20 Thread Mickaël Salaün
Hi Muhammad, Thanks for the report. On Tue, Dec 19, 2023 at 03:38:55PM +0500, Muhammad Usama Anjum wrote: > Hi Konstantin, > > There are some errors being reported in KernelCI: > https://linux.kernelci.org/test/plan/id/657ab2240c761c0bd1e134ee/ > > The following sub-tests are failing: >

Re: [PATCH v4 11/11] KVM: selftests: Enable tunning of err_margin_us in arch timer test

2023-12-20 Thread Marc Zyngier
On 2023-12-20 06:50, Haibo Xu wrote: On Wed, Dec 20, 2023 at 2:22 AM Marc Zyngier wrote: On Tue, 12 Dec 2023 09:31:20 +, Haibo Xu wrote: > > @@ -216,6 +221,9 @@ static bool parse_args(int argc, char *argv[]) > case 'm': > test_args.migration_freq_ms =