The NetBSD Project

CVS log for src/tests/modules/t_kcov.c

[BACK] Up to [cvs.NetBSD.org] / src / tests / modules

Request diff between arbitrary revisions


Default branch: MAIN
Current tag: MAIN


Revision 1.10 / (download) - annotate - [select for diffs], Sun May 26 01:44:34 2019 UTC (22 months, 3 weeks ago) by kamil
Branch: MAIN
CVS Tags: phil-wifi-20200421, phil-wifi-20200411, phil-wifi-20200406, phil-wifi-20191119, phil-wifi-20190609, netbsd-9-base, netbsd-9-1-RELEASE, netbsd-9-0-RELEASE, netbsd-9-0-RC2, netbsd-9-0-RC1, netbsd-9, is-mlppp-base, is-mlppp, HEAD
Branch point for: phil-wifi
Changes since 1.9: +7 -7 lines
Diff to previous 1.9 (unified)

Drop no longer needed macros KCOV_STORE() KCOV_LOAD() in kcov(4)

Corrently KCOV_STORE() and KCOV_LOAD() are equivalent to x=y.

Obtained from <R3x>

Revision 1.9 / (download) - annotate - [select for diffs], Thu Apr 4 10:53:20 2019 UTC (2 years ago) by kamil
Branch: MAIN
Changes since 1.8: +8 -0 lines
Diff to previous 1.8 (unified)

Fix flaky check for the /dev/kcov device in t_kcov

Add a top-level check for the KCOV device, instead of deferring it ot each
thread. The thread-based solution was flaky.

PR kern/54064 by Andreas Gustafsson

Revision 1.8 / (download) - annotate - [select for diffs], Sun Mar 10 22:34:14 2019 UTC (2 years, 1 month ago) by kamil
Branch: MAIN
Changes since 1.7: +69 -11 lines
Diff to previous 1.7 (unified)

Introduce enhancements to the kcov(4) code

Add new tests verifying dup2(2) scenarios:
 - kcov_dup2
 - kcov_basic_dup2_pc
 - kcov_basic_dup2_cmp

The dup2(2) trick is used by syzkaller and assert that it works.
All new tests pass.

While there add minor non-functional cleanup changes.

Revision 1.7 / (download) - annotate - [select for diffs], Sun Mar 10 17:51:00 2019 UTC (2 years, 1 month ago) by kamil
Branch: MAIN
Changes since 1.6: +62 -17 lines
Diff to previous 1.6 (unified)

Add support for trace type selection in kcov(4)

Allow to specify mode in KCOV_IOC_ENABLE synchronizing the functionality
with Linux, FreeBSD and OpenBSD. As a NetBSD (and OpenBSD) specific of
the ioctl(2) interface, the mode argument has to be specified as &value
rather than value.

There are 3 modes available:
 1. KCOV_MODE_NONE       -- no trace specified, useful for testing purposes
 2. KCOV_MODE_TRACE_PC   -- trace the kernel program counter
 3. KCOV_MODE_TRACE_CMP  -- trace comparison instructions and switch statements

Adapt the ATF tests and documentation for new API.

The KCOV_MODE_TRACE_CMP mode is implemented but still awaits for the
GCC 8.x upgrade or selection of Clang/LLVM as the kernel compiler.

Obtained from OpenBSD and adapted for NetBSD by myself.

Revision 1.6 / (download) - annotate - [select for diffs], Sun Mar 10 13:24:50 2019 UTC (2 years, 1 month ago) by kamil
Branch: MAIN
Changes since 1.5: +2 -2 lines
Diff to previous 1.5 (unified)

Fix bug in kcov_multiple_threads in t_kcov

Spawn the expected number of threads rather than hardcoding one value for
all tests.

Revision 1.5 / (download) - annotate - [select for diffs], Sun Mar 10 12:54:39 2019 UTC (2 years, 1 month ago) by kamil
Branch: MAIN
Changes since 1.4: +164 -14 lines
Diff to previous 1.4 (unified)

Add support for multiple threads in kcov(4)

Reuse the fd_clone() API to associate kcov descriptors (KD) with a file
descriptor. Each fd (/dev/kcov) can be reused for a single LWP.

Add new ATF regression tests and cleanup existing code there. All tests
pass.

Refresh the kcov(4) man page documentation.

Developed with help from <maxv>.

Revision 1.4 / (download) - annotate - [select for diffs], Mon Feb 25 10:23:01 2019 UTC (2 years, 1 month ago) by kamil
Branch: MAIN
Changes since 1.3: +4 -6 lines
Diff to previous 1.3 (unified)

Fix build of t_kcov

Correct the syntax that used to work in earlier uncommitted version.

Revision 1.3 / (download) - annotate - [select for diffs], Sun Feb 24 21:14:43 2019 UTC (2 years, 1 month ago) by kamil
Branch: MAIN
Changes since 1.2: +4 -6 lines
Diff to previous 1.2 (unified)

Add KCOV_LOAD() and KCOV_STORE() - new helper macros

New macros prefer 64-bit atomic operations whenever accessible.

As a fallback they use volatile move operations that are not known
to have negative effect in KCOV even if interrupted in the middle of
operation.

Enable kcov_basic and kcov_thread tests on targets without
__HAVE_ATOMIC64_OPS.

Revision 1.2 / (download) - annotate - [select for diffs], Sat Feb 23 08:03:24 2019 UTC (2 years, 1 month ago) by kamil
Branch: MAIN
Changes since 1.1: +4 -0 lines
Diff to previous 1.1 (unified)

Fix build of kcov tests on CPUs without 64-bit atomics

Restrict the 64-bit atomics to ports defining __HAVE_ATOMIC64_OPS.

Using 64-bit atomics is still good for i586 fuzzing, but the tests are
build for earlier CPUs. This makes this code to be disabled in i386 builds.

There is a similar situation with few other ports that offer 64-bit atomics
in certain CPU models and ABIs.

Revision 1.1 / (download) - annotate - [select for diffs], Sat Feb 23 03:10:06 2019 UTC (2 years, 1 month ago) by kamil
Branch: MAIN

Add KCOV - kernel code coverage tracing device

The KCOV driver implements collection of code coverage inside the kernel.
It can be enabled on a per process basis from userland, allowing the kernel
program counter to be collected during syscalls triggered by the same
process.

The device is oriented towards kernel fuzzers, in particular syzkaller.

Currently the only supported coverage type is -fsanitize-coverage=trace-pc.

The KCOV driver was initially developed in Linux. A driver based on the
same concept was then implemented in FreeBSD and OpenBSD.

Documentation is borrowed from OpenBSD and ATF tests from FreeBSD.

This patch has been prepared by Siddharth Muralee, improved by <maxv>
and polished by myself before importing into the mainline tree.

All ATF tests pass.

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.




CVSweb <webmaster@jp.NetBSD.org>