The NetBSD Project

CVS log for src/sys/sys/kcov.h

[BACK] Up to [cvs.NetBSD.org] / src / sys / sys

Request diff between arbitrary revisions


Keyword substitution: kv
Default branch: MAIN


Revision 1.10: download - view: text, markup, annotated - select for diffs
Fri Jun 5 17:20:57 2020 UTC (4 years, 10 months ago) by maxv
Branches: MAIN
CVS tags: thorpej-ifq-base, thorpej-ifq, thorpej-i2c-spi-conf2-base, thorpej-i2c-spi-conf2, thorpej-i2c-spi-conf-base, thorpej-i2c-spi-conf, thorpej-futex2-base, thorpej-futex2, thorpej-futex-base, thorpej-futex, thorpej-cfargs2-base, thorpej-cfargs2, thorpej-cfargs-base, thorpej-cfargs, thorpej-altq-separation-base, thorpej-altq-separation, perseant-exfatfs-base-20240630, perseant-exfatfs-base, perseant-exfatfs, netbsd-10-base, netbsd-10-1-RELEASE, netbsd-10-0-RELEASE, netbsd-10-0-RC6, netbsd-10-0-RC5, netbsd-10-0-RC4, netbsd-10-0-RC3, netbsd-10-0-RC2, netbsd-10-0-RC1, netbsd-10, cjep_sun2x-base1, cjep_sun2x-base, cjep_sun2x, cjep_staticlib_x-base1, cjep_staticlib_x-base, cjep_staticlib_x, bouyer-sunxi-drm-base, bouyer-sunxi-drm, HEAD
Diff to: previous 1.9: preferred, colored
Changes since revision 1.9: +3 -1 lines
Register eight vHCI buses, and use separate KCOV mailboxes for them.

Revision 1.9: download - view: text, markup, annotated - select for diffs
Fri May 15 13:09:02 2020 UTC (4 years, 11 months ago) by maxv
Branches: MAIN
Diff to: previous 1.8: preferred, colored
Changes since revision 1.8: +5 -1 lines
Introduce kcov_silence_enter() and kcov_silence_leave(), to allow to
temporarily disable KCOV on the current lwp. Should be used in the rare
but problematic cases where extreme noise is introduced by an
uninteresting subsystem.

Use this capability to silence KCOV during the LOCKDEBUG lookups. This
divides the size of the KCOV output by more than two in my KCOV+vHCI
tests.

Revision 1.8: download - view: text, markup, annotated - select for diffs
Fri May 15 12:34:52 2020 UTC (4 years, 11 months ago) by maxv
Branches: MAIN
Diff to: previous 1.7: preferred, colored
Changes since revision 1.7: +17 -1 lines
Introduce KCOV remote support. This allows to collect KCOV coverage on
threads other than curlwp, which is useful when fuzzing components that
defer processing, such as the network stack (partially runs in softints)
and the USB stack (partially runs in uhub kthreads).

A subsystem that whishes to provide coverage for its threads creates a
"mailbox" via kcov_remote_register() and gives it a (subsystem, id)
identifier. There is one mailbox per "target lwp". The target lwp(s)
must then call kcov_remote_enter() and kcov_remote_leave() with the
identifier, to respectively enable and disable coverage within the
thread.

On the userland side, the fuzzer has access to the mailboxes on the
system with the KCOV_IOC_REMOTE_ATTACH and KCOV_IOC_REMOTE_DETACH ioctls.
When attached to a mailbox with a given identifier, the KCOV_IOC_ENABLE,
KCOV_IOC_DISABLE and mmap() operations will affect the mailbox.

As a demonstrator, the vHCI subsystem is changed to use KCOV mailboxes.
When the vHCI bus attaches it creates as many mailboxes as it has USB
ports, each mailbox being associated with a distinct port. Uhub is changed
to enable KCOV coverage in usbd_new_device(). With that in place, all of
the USB enumeration procedure can be traced with KCOV.

Revision 1.6.2.3: download - view: text, markup, annotated - select for diffs
Wed Apr 8 14:09:03 2020 UTC (5 years ago) by martin
Branches: phil-wifi
Diff to: previous 1.6.2.2: preferred, colored; branchpoint 1.6: preferred, colored; next MAIN 1.7: preferred, colored
Changes since revision 1.6.2.2: +14 -2 lines
Merge changes from current as of 20200406

Revision 1.7: download - view: text, markup, annotated - select for diffs
Sat Apr 4 06:51:46 2020 UTC (5 years ago) by maxv
Branches: MAIN
CVS tags: phil-wifi-20200421, phil-wifi-20200411, phil-wifi-20200406, bouyer-xenpvh-base2, bouyer-xenpvh-base1, bouyer-xenpvh-base, bouyer-xenpvh
Diff to: previous 1.6: preferred, colored
Changes since revision 1.6: +14 -2 lines
Drop specificdata from KCOV, kMSan doesn't interact well with it. Also
reduces the overhead.

Revision 1.6.2.2: download - view: text, markup, annotated - select for diffs
Mon Jun 10 22:09:57 2019 UTC (5 years, 10 months ago) by christos
Branches: phil-wifi
Diff to: previous 1.6.2.1: preferred, colored; branchpoint 1.6: preferred, colored
Changes since revision 1.6.2.1: +50 -0 lines
Sync with HEAD

Revision 1.6.2.1
Sun May 26 01:44:34 2019 UTC (5 years, 10 months ago) by christos
Branches: phil-wifi
FILE REMOVED
Changes since revision 1.6: +0 -50 lines
file kcov.h was added on branch phil-wifi on 2019-06-10 22:09:57 +0000

Revision 1.6: download - view: text, markup, annotated - select for diffs
Sun May 26 01:44:34 2019 UTC (5 years, 10 months ago) by kamil
Branches: MAIN
CVS tags: phil-wifi-20191119, phil-wifi-20190609, netbsd-9-base, netbsd-9-4-RELEASE, netbsd-9-3-RELEASE, netbsd-9-2-RELEASE, netbsd-9-1-RELEASE, netbsd-9-0-RELEASE, netbsd-9-0-RC2, netbsd-9-0-RC1, netbsd-9, is-mlppp-base, is-mlppp, ad-namecache-base3, ad-namecache-base2, ad-namecache-base1, ad-namecache-base, ad-namecache
Branch point for: phil-wifi
Diff to: previous 1.5: preferred, colored
Changes since revision 1.5: +1 -4 lines
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.5: download - view: text, markup, annotated - select for diffs
Thu Apr 11 11:20:46 2019 UTC (6 years ago) by kamil
Branches: MAIN
CVS tags: isaki-audio2-base, isaki-audio2
Diff to: previous 1.4: preferred, colored
Changes since revision 1.4: +1 -13 lines
Rely on volatile operations in KCOV data types

Extra atomicity isn't needed and makes maintenance burden between CPUs.

Fixes build issue on NetBSD/i386 reported by <msaitoh>

Revision 1.4: download - view: text, markup, annotated - select for diffs
Sun Mar 10 17:51:00 2019 UTC (6 years, 1 month ago) by kamil
Branches: MAIN
Diff to: previous 1.3: preferred, colored
Changes since revision 1.3: +6 -2 lines
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.3: download - view: text, markup, annotated - select for diffs
Mon Feb 25 13:19:14 2019 UTC (6 years, 1 month ago) by kamil
Branches: MAIN
Diff to: previous 1.2: preferred, colored
Changes since revision 1.2: +2 -2 lines
Fix typo in kcov.h

Should fix i386.

Revision 1.2: download - view: text, markup, annotated - select for diffs
Sun Feb 24 21:14:43 2019 UTC (6 years, 1 month ago) by kamil
Branches: MAIN
Diff to: previous 1.1: preferred, colored
Changes since revision 1.1: +20 -1 lines
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.1: download - view: text, markup, annotated - select for diffs
Sat Feb 23 03:10:06 2019 UTC (6 years, 1 month ago) by kamil
Branches: 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.

Diff request

This form allows you to request diffs 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.

Log view options

CVSweb <webmaster@jp.NetBSD.org>