Re: [PATCH v1 8/8] kunit: Add tests for faults

2024-03-01 Thread kernel test robot
Hi Mickaël, kernel test robot noticed the following build warnings: [auto build test WARNING on d206a76d7d2726f3b096037f2079ce0bd3ba329b] url: https://github.com/intel-lab-lkp/linux/commits/Micka-l-Sala-n/kunit-Run-tests-when-the-kernel-is-fully-setup/20240301-011020 base

[PATCH v2 6/7] kunit: Print last test location on fault

2024-03-01 Thread Mickaël Salaün
This helps identify the location of test faults. Cc: Brendan Higgins Cc: David Gow Cc: Rae Moar Cc: Shuah Khan Reviewed-by: Kees Cook Signed-off-by: Mickaël Salaün Link: https://lore.kernel.org/r/20240301194037.532117-7-...@digikod.net --- Changes since v1: * Added Kees's Reviewed-by. ---

[PATCH v2 7/7] kunit: Add tests for fault

2024-03-01 Thread Mickaël Salaün
Add a test case to check NULL pointer dereference and make sure it would result as a failed test. The full kunit_fault test suite is marked as skipped when run on UML because it would result to a kernel panic. Tested with: ./tools/testing/kunit/kunit.py run --arch x86_64 kunit_fault ./tools/testi

[PATCH v2 5/7] kunit: Fix KUNIT_SUCCESS() calls in iov_iter tests

2024-03-01 Thread Mickaël Salaün
Fix KUNIT_SUCCESS() calls to pass a test argument. This is a no-op for now because this macro does nothing, but it will be required for the next commit. Cc: Brendan Higgins Cc: David Gow Cc: Rae Moar Cc: Shuah Khan Reviewed-by: Kees Cook Signed-off-by: Mickaël Salaün Link: https://lore.kern

[PATCH v2 4/7] kunit: Handle test faults

2024-03-01 Thread Mickaël Salaün
Previously, when a kernel test thread crashed (e.g. NULL pointer dereference, general protection fault), the KUnit test hanged for 30 seconds and exited with a timeout error. Fix this issue by waiting on task_struct->vfork_done instead of the custom kunit_try_catch.try_completion, and track the ex

[PATCH v2 2/7] kunit: Fix kthread reference

2024-03-01 Thread Mickaël Salaün
There is a race condition when a kthread finishes after the deadline and before the call to kthread_stop(), which may lead to use after free. Cc: Brendan Higgins Cc: David Gow Cc: Rae Moar Cc: Shuah Khan Reviewed-by: Kees Cook Signed-off-by: Mickaël Salaün Link: https://lore.kernel.org/r/202

[PATCH v2 0/7] Handle faults in KUnit tests

2024-03-01 Thread Mickaël Salaün
Hi, This patch series teaches KUnit to handle kthread faults as errors, and it brings a few related fixes and improvements. I removed the previous patch that moved the KUnit test execution at the very end of kernel initialization. We'll address that with a separate series. A new test case check

[PATCH v2 3/7] kunit: Fix timeout message

2024-03-01 Thread Mickaël Salaün
The exit code is always checked, so let's properly handle the -ETIMEDOUT error code. Cc: Brendan Higgins Cc: David Gow Cc: Rae Moar Cc: Shuah Khan Reviewed-by: Kees Cook Signed-off-by: Mickaël Salaün Link: https://lore.kernel.org/r/20240301194037.532117-4-...@digikod.net --- Changes since v

[PATCH v2 1/7] kunit: Handle thread creation error

2024-03-01 Thread Mickaël Salaün
Previously, if a thread creation failed (e.g. -ENOMEM), the function was called (kunit_catch_run_case or kunit_catch_run_case_cleanup) without marking the test as failed. Instead, fill try_result with the error code returned by kthread_run(), which will mark the test as failed and print "internal

Re: [PATCH v1 0/8] Run KUnit tests late and handle faults

2024-03-01 Thread Mickaël Salaün
On Fri, Mar 01, 2024 at 03:15:08PM +0800, David Gow wrote: > On Fri, 1 Mar 2024 at 01:04, Mickaël Salaün wrote: > > > > Hi, > > > > Thanks very much. I think there's a lot going on in this series, and > it'd probably be easier to address if it were broken up a bit more. > > To take things one at

Re: [PATCH v1 8/8] kunit: Add tests for faults

2024-03-01 Thread Mickaël Salaün
On Thu, Feb 29, 2024 at 10:28:18AM -0800, Kees Cook wrote: > On Thu, Feb 29, 2024 at 06:04:09PM +0100, Mickaël Salaün wrote: > > The first test checks NULL pointer dereference and make sure it would > > result as a failed test. > > > > The second and third tests check that read-only data is indeed

Re: [PATCH v1 5/8] kunit: Handle test faults

2024-03-01 Thread Mickaël Salaün
On Thu, Feb 29, 2024 at 10:24:19AM -0800, Kees Cook wrote: > On Thu, Feb 29, 2024 at 06:04:06PM +0100, Mickaël Salaün wrote: > > Previously, when a kernel test thread crashed (e.g. NULL pointer > > dereference, general protection fault), the KUnit test hanged for 30 > > seconds and exited with a ti

Re: [PATCH v1 1/8] kunit: Run tests when the kernel is fully setup

2024-03-01 Thread Mickaël Salaün
On Fri, Mar 01, 2024 at 03:14:49PM +0800, David Gow wrote: > On Fri, 1 Mar 2024 at 01:04, Mickaël Salaün wrote: > > > > Run all the KUnit tests just before the first userspace code is > > launched. This makes it it possible to write new tests that check the > > kernel in its final state i.e., wi

Re: [PATCH v1 1/8] kunit: Run tests when the kernel is fully setup

2024-03-01 Thread kernel test robot
Hi Mickaël, kernel test robot noticed the following build warnings: [auto build test WARNING on d206a76d7d2726f3b096037f2079ce0bd3ba329b] url: https://github.com/intel-lab-lkp/linux/commits/Micka-l-Sala-n/kunit-Run-tests-when-the-kernel-is-fully-setup/20240301-011020 base