This patchset contains everything needed to integrate KASAN and KUnit.
KUnit will be able to:
(1) Fail tests when an unexpected KASAN error occurs
(2) Pass tests when an expected KASAN error occurs
Convert KASAN tests to KUnit with the exception of copy_user_test
because KUnit is unable to test those.
Add documentation on how to run the KASAN tests with KUnit and what to
expect when running these tests.
Depends on [1].
Changes since v2:
- Due to Alan's changes in [1], KUnit can be built as a module.
- The name of the tests that could not be run with KUnit has been
changed to be more generic: test_kasan_module.
- Documentation on how to run the new KASAN tests and what to expect
when running them has been added.
- Some variables and functions are now static.
- Now save/restore panic_on_warn in a similar way to kasan_multi_shot
and renamed the init/exit functions to be more generic to accommodate.
- Due to [2] in kasan_strings, kasan_memchr, and
kasan_memcmp will fail if CONFIG_AMD_MEM_ENCRYPT is enabled so return
early and print message explaining this circumstance.
- Changed preprocessor checks to C checks where applicable.
[1] https://lore.kernel.org/linux-kselftest/1585313122-26441-1-git-send-email-a…
[2] https://bugzilla.kernel.org/show_bug.cgi?id=206337
Patricia Alfonso (4):
Add KUnit Struct to Current Task
KUnit: KASAN Integration
KASAN: Port KASAN Tests to KUnit
KASAN: Testing Documentation
Documentation/dev-tools/kasan.rst | 70 +++
include/kunit/test.h | 5 +
include/linux/kasan.h | 6 +
include/linux/sched.h | 4 +
lib/Kconfig.kasan | 15 +-
lib/Makefile | 3 +-
lib/kunit/test.c | 13 +-
lib/test_kasan.c | 686 +++++++++++++-----------------
lib/test_kasan_module.c | 76 ++++
mm/kasan/report.c | 33 ++
10 files changed, 521 insertions(+), 390 deletions(-)
create mode 100644 lib/test_kasan_module.c
--
2.26.0.rc2.310.g2932bb562d-goog
From: Colin Ian King <colin.king(a)canonical.com>
Currently pointer 'suite' is dereferenced when variable success
is being initialized before the pointer is null checked. Fix this
by only dereferencing suite after is has been null checked.
Addresses-Coverity: ("Dereference before null check")
Fixes: e2219db280e3 ("kunit: add debugfs /sys/kernel/debug/kunit/<suite>/results display")
Signed-off-by: Colin Ian King <colin.king(a)canonical.com>
---
lib/kunit/debugfs.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/kunit/debugfs.c b/lib/kunit/debugfs.c
index 9214c493d8b7..05547642f37c 100644
--- a/lib/kunit/debugfs.c
+++ b/lib/kunit/debugfs.c
@@ -52,12 +52,13 @@ static void debugfs_print_result(struct seq_file *seq,
static int debugfs_print_results(struct seq_file *seq, void *v)
{
struct kunit_suite *suite = (struct kunit_suite *)seq->private;
- bool success = kunit_suite_has_succeeded(suite);
+ bool success;
struct kunit_case *test_case;
if (!suite || !suite->log)
return 0;
+ success = kunit_suite_has_succeeded(suite);
seq_printf(seq, "%s", suite->log);
kunit_suite_for_each_test_case(suite, test_case)
--
2.25.1
This series introduces a new KVM selftest (mem_slot_test) that goal
is to verify memory slots can be added up to the maximum allowed. An
extra slot is attempted which should occur on error.
The patch 01 is needed so that the VM fd can be accessed from the
test code (for the ioctl call attempting to add an extra slot).
I ran the test successfully on x86_64, aarch64, and s390x. This
is why it is enabled to build on those arches.
Finally, I hope it is useful test!
Wainer dos Santos Moschetta (2):
selftests: kvm: Add vm_get_fd() in kvm_util
selftests: kvm: Add mem_slot_test test
tools/testing/selftests/kvm/.gitignore | 1 +
tools/testing/selftests/kvm/Makefile | 3 +
.../testing/selftests/kvm/include/kvm_util.h | 1 +
tools/testing/selftests/kvm/lib/kvm_util.c | 5 +
tools/testing/selftests/kvm/mem_slot_test.c | 92 +++++++++++++++++++
5 files changed, 102 insertions(+)
create mode 100644 tools/testing/selftests/kvm/mem_slot_test.c
--
2.17.2
Hi Linus,
Please pull the following Kselftest Kunit update for Linux 5.7-rc1.
This kunit update for Linux-5.7-rc1 consists of:
- debugfs support for displaying kunit test suite results; this is
especially useful for module-loaded tests to allow disentangling of
test result display from other dmesg events. CONFIG_KUNIT_DEBUGFS
enables/disables the debugfs support.
- Several fixes and improvements to kunit framework and tool.
diff is attached.
thanks,
-- Shuah
----------------------------------------------------------------
The following changes since commit 2c523b344dfa65a3738e7039832044aa133c75fb:
Linux 5.6-rc5 (2020-03-08 17:44:44 -0700)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest
tags/linux-kselftest-kunit-5.7-rc1
for you to fetch changes up to e23349af9ee25a5760112a2f8476b94a4ec86f1c:
kunit: tool: add missing test data file content (2020-03-26 14:11:12
-0600)
----------------------------------------------------------------
linux-kselftest-kunit-5.7-rc1
This kunit update for Linux-5.7-rc1 consists of:
- debugfs support for displaying kunit test suite results; this is
especially useful for module-loaded tests to allow disentangling of
test result display from other dmesg events. CONFIG_KUNIT_DEBUGFS
enables/disables the debugfs support.
- Several fixes and improvements to kunit framework and tool.
----------------------------------------------------------------
Alan Maguire (4):
kunit: add debugfs /sys/kernel/debug/kunit/<suite>/results display
kunit: add log test
kunit: subtests should be indented 4 spaces according to TAP
kunit: update documentation to describe debugfs representation
Brendan Higgins (1):
kunit: tool: add missing test data file content
David Gow (4):
kunit: Always print actual pointer values in asserts
kunit: kunit_tool: Allow .kunitconfig to disable config items
Fix linked-list KUnit test when run multiple times
Documentation: kunit: Make the KUnit documentation less UML-specific
Greg Thelen (1):
kunit: add --make_options
Heidi Fahim (2):
kunit: kunit_parser: make parser more robust
kunit: Run all KUnit tests through allyesconfig
Documentation/dev-tools/kunit/index.rst | 40 +++---
Documentation/dev-tools/kunit/kunit-tool.rst | 7 +
Documentation/dev-tools/kunit/start.rst | 80 +++++++++--
Documentation/dev-tools/kunit/usage.rst | 14 ++
include/kunit/test.h | 63 +++++++--
lib/kunit/Kconfig | 8 ++
lib/kunit/Makefile | 4 +
lib/kunit/assert.c | 79 +++++------
lib/kunit/debugfs.c | 116 ++++++++++++++++
lib/kunit/debugfs.h | 30 +++++
lib/kunit/kunit-test.c | 44 +++++-
lib/kunit/test.c | 148
++++++++++++++++-----
lib/list-test.c | 4 +-
tools/testing/kunit/.gitattributes | 1 +
tools/testing/kunit/configs/broken_on_uml.config | 41 ++++++
tools/testing/kunit/kunit.py | 38 ++++--
tools/testing/kunit/kunit_config.py | 41 ++++--
tools/testing/kunit/kunit_kernel.py | 84 ++++++++----
tools/testing/kunit/kunit_parser.py | 51 +++----
tools/testing/kunit/kunit_tool_test.py | 108 ++++++++++++---
.../kunit/test_data/test_config_printk_time.log | Bin 0 -> 1584 bytes
.../test_data/test_interrupted_tap_output.log | Bin 0 -> 1982 bytes
.../test_data/test_kernel_panic_interrupt.log | Bin 0 -> 1321 bytes
.../kunit/test_data/test_multiple_prefixes.log | Bin 0 -> 1832 bytes
.../test_output_with_prefix_isolated_correctly.log | Bin 0 -> 1655 bytes
.../kunit/test_data/test_pound_no_prefix.log | Bin 0 -> 1193 bytes
tools/testing/kunit/test_data/test_pound_sign.log | Bin 0 -> 1656 bytes
27 files changed, 799 insertions(+), 202 deletions(-)
create mode 100644 lib/kunit/debugfs.c
create mode 100644 lib/kunit/debugfs.h
create mode 100644 tools/testing/kunit/.gitattributes
create mode 100644 tools/testing/kunit/configs/broken_on_uml.config
create mode 100644
tools/testing/kunit/test_data/test_config_printk_time.log
create mode 100644
tools/testing/kunit/test_data/test_interrupted_tap_output.log
create mode 100644
tools/testing/kunit/test_data/test_kernel_panic_interrupt.log
create mode 100644
tools/testing/kunit/test_data/test_multiple_prefixes.log
create mode 100644
tools/testing/kunit/test_data/test_output_with_prefix_isolated_correctly.log
create mode 100644 tools/testing/kunit/test_data/test_pound_no_prefix.log
create mode 100644 tools/testing/kunit/test_data/test_pound_sign.log
----------------------------------------------------------------
Hi Linus,
Please pull the following Kselftest update for Linux 5.7-rc1.
This kselftest update Linux 5.7-rc1 consists of:
- resctrl_tests for resctrl file system. resctrl isn't included in the
default TARGETS list in kselftest Makefile. It can be run manually.
- Kselftest harness improvements.
- Kselftest framework and individual test fixes to support runs on
Kernel CI rings and other environments that use relocatable build
and install features.
- Minor cleanups and typo fixes.
diff is attached.
thanks,
-- Shuah
----------------------------------------------------------------
The following changes since commit bb6d3fb354c5ee8d6bde2d576eb7220ea09862b9:
Linux 5.6-rc1 (2020-02-09 16:08:48 -0800)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest
tags/linux-kselftest-5.7-rc1
for you to fetch changes up to 1056d3d2c97e47397d0037cbbdf24235ae8f88cb:
selftests: enforce local header dependency in lib.mk (2020-03-26
15:29:55 -0600)
----------------------------------------------------------------
linux-kselftest-5.7-rc1
This kselftest update Linux 5.7-rc1 consists of:
- resctrl_tests for resctrl file system. resctrl isn't included in the
default TARGETS list in kselftest Makefile. It can be run manually.
- Kselftest harness improvements.
- Kselftest framework and individual test fixes to support runs on
Kernel CI rings and other environments that use relocatable build
and install features.
- Minor cleanups and typo fixes.
----------------------------------------------------------------
Babu Moger (3):
selftests/resctrl: Add vendor detection mechanism
selftests/resctrl: Use cache index3 id for AMD schemata masks
selftests/resctrl: Disable MBA and MBM tests for AMD
Colin Ian King (1):
selftests/resctrl: fix spelling mistake "Errror" -> "Error"
Fenghua Yu (6):
selftests/resctrl: Add README for resctrl tests
selftests/resctrl: Add MBM test
selftests/resctrl: Add MBA test
selftests/resctrl: Add Cache QoS Monitoring (CQM) selftest
selftests/resctrl: Add Cache Allocation Technology (CAT) selftest
selftests/resctrl: Add the test in MAINTAINERS
Kees Cook (3):
selftests/seccomp: Adjust test fixture counts
selftests/harness: Move test child waiting logic
selftests/harness: Handle timeouts cleanly
Masanari Iida (1):
selftests/ftrace: Fix typo in trigger-multihist.tc
Sai Praneeth Prakhya (4):
selftests/resctrl: Add basic resctrl file system operations and data
selftests/resctrl: Read memory bandwidth from perf IMC counter
and from resctrl file system
selftests/resctrl: Add callback to start a benchmark
selftests/resctrl: Add built in benchmark
Shuah Khan (6):
selftests: Fix kselftest O=objdir build from cluttering top level
objdir
selftests: android: ion: Fix ionmap_test compile error
selftests: android: Fix custom install from skipping test progs
selftests: Fix seccomp to support relocatable build (O=objdir)
selftests: Fix memfd to support relocatable build (O=objdir)
selftests: enforce local header dependency in lib.mk
YueHaibing (1):
selftests/timens: Remove duplicated include <time.h>
MAINTAINERS | 1 +
tools/testing/selftests/Makefile | 4 +-
tools/testing/selftests/android/Makefile | 2 +-
tools/testing/selftests/android/ion/Makefile | 2 +-
.../ftrace/test.d/trigger/trigger-multihist.tc | 2 +-
tools/testing/selftests/kselftest_harness.h | 144 ++--
tools/testing/selftests/lib.mk | 3 +-
tools/testing/selftests/memfd/Makefile | 9 +-
tools/testing/selftests/resctrl/Makefile | 17 +
tools/testing/selftests/resctrl/README | 53 ++
tools/testing/selftests/resctrl/cache.c | 272 ++++++++
tools/testing/selftests/resctrl/cat_test.c | 250 +++++++
tools/testing/selftests/resctrl/cqm_test.c | 176 +++++
tools/testing/selftests/resctrl/fill_buf.c | 213 ++++++
tools/testing/selftests/resctrl/mba_test.c | 171 +++++
tools/testing/selftests/resctrl/mbm_test.c | 145 ++++
tools/testing/selftests/resctrl/resctrl.h | 107 +++
tools/testing/selftests/resctrl/resctrl_tests.c | 202 ++++++
tools/testing/selftests/resctrl/resctrl_val.c | 744
+++++++++++++++++++++
tools/testing/selftests/resctrl/resctrlfs.c | 722
++++++++++++++++++++
tools/testing/selftests/seccomp/Makefile | 17 +-
tools/testing/selftests/seccomp/seccomp_bpf.c | 10 +-
tools/testing/selftests/timens/exec.c | 1 -
tools/testing/selftests/timens/procfs.c | 1 -
tools/testing/selftests/timens/timens.c | 1 -
tools/testing/selftests/timens/timer.c | 1 -
26 files changed, 3191 insertions(+), 79 deletions(-)
create mode 100644 tools/testing/selftests/resctrl/Makefile
create mode 100644 tools/testing/selftests/resctrl/README
create mode 100644 tools/testing/selftests/resctrl/cache.c
create mode 100644 tools/testing/selftests/resctrl/cat_test.c
create mode 100644 tools/testing/selftests/resctrl/cqm_test.c
create mode 100644 tools/testing/selftests/resctrl/fill_buf.c
create mode 100644 tools/testing/selftests/resctrl/mba_test.c
create mode 100644 tools/testing/selftests/resctrl/mbm_test.c
create mode 100644 tools/testing/selftests/resctrl/resctrl.h
create mode 100644 tools/testing/selftests/resctrl/resctrl_tests.c
create mode 100644 tools/testing/selftests/resctrl/resctrl_val.c
create mode 100644 tools/testing/selftests/resctrl/resctrlfs.c
----------------------------------------------------------------
On Mon, Mar 30, 2020 at 5:19 PM Liu Yiding <liuyd.fnst(a)cn.fujitsu.com> wrote:
>
>
> On 3/30/20 2:09 PM, Andrii Nakryiko wrote:
> > On 3/29/20 5:48 PM, Liu Yiding wrote:
> >> Add attachment.
> >>
> >
> > Your BTF seems to be invalid. It has struct perf_ibs, which has a
> > first field `struct pmu pmu` field with valid-looking size of 296
> > bytes, **but** the type that field points to is not a complete `struct
> > pmu` definition, but rather just forward declaration. The way it is it
> > shouldn't be even compilable, because forward declaration of a struct
> > doesn't specify the size of a struct, so compiler should have rejected
> > it. So it must be that either DWARF generated by compiler isn't
> > correct, or there is DWARF -> BTF conversion bug somewhere. Are you
> > using any special DWARF Kconfig settings? Maybe you can share your
> > full .config and I might try to repro it on my machine.
> >
>
> >> Are you using any special DWARF Kconfig settings?
>
> Sorry, i'm a newbie at this. I don't know which settings are related to
> DWARF.
>
> Just search keywords.
>
> ```
>
> liuyd@localhost:~$ cat config-5.6.0-rc5 | grep DWARF
> # CONFIG_DEBUG_INFO_DWARF4 is not set
>
> ```
>
> I built attached config on a clear ubuntu machine. Error could be
> reproduced. So you are right, there is a conflict between kconfigs.
>
>
> >> Maybe you can share your full .config and I might try to repro it on
> my machine.
>
> Thanks a lot. I attached the broken config.
Thanks a lot! I think it's due to DEBUG_INFO_REDUCED which produces
not entirely correct DWARF. I'm asking Slava to disable this config
when BTF is requested in [0].
[0] https://lore.kernel.org/bpf/CAEf4BzadnfAwfa1D0jZb=01Ou783GpK_U7PAYeEJca-L9k…
>
>
> > But either way, that warning you get is a valid one, it should be
> > illegal to have non-pointer forward-declared struct as a type for a
> > struct member.
> >
> >>
> >> On 3/30/20 8:46 AM, Liu Yiding wrote:
> >>> Something wrong with my smtp and this email missed.
> >>>
> >>> Send again.
> >>>
> >>>
> >>> On 3/27/20 11:09 AM, Liu Yiding wrote:
> >>>> Hi, Andrii.
> >>>>
> >>>> Thanks for your prompt reply!
> >>>>
> >>>> Please check attatchment for my_btf.bin.
> >>>>
> >>>>
> >>>> On 3/27/20 4:28 AM, Andrii Nakryiko wrote:
> >>>>> Would you be able to share BTF of vmlinux that is used to generate
> >>>>> vmlinux.h? Please run in verbose mode: `make V=1` and search for
> >>>>> `bpftool btf dump file` command. It should point either to
> >>>>> /sys/kernel/btf/vmlinux or some other location, depending on how
> >>>>> things are set up on your side.
> >>>>>
> >>>>> If it's /sys/kernel/btf/vmlinux, you can just `cat
> >>>>> /sys/kernel/btf/vmlinux > my_btf.bin`. If it's some other file,
> >>>>> easiest would be to just share that file. If not, it's possible to
> >>>>> extract .BTF ELF section, let me know if you need help with that.
> >>>>
> >
> >
> >
> --
> Best Regards.
> Liu Yiding
>
>
>