freebsd-dev/tools/test
Eric van Gyzen 8c5a9161d1 Save the last callout function executed on each CPU
Save the last callout function pointer (and its argument) executed
on each CPU for inspection by a debugger.  Add a ddb `show callout_last`
command to show these pointers.  Add a kernel module that I used
for testing that command.

Relocate `ce_migration_cpu` to reduce padding and therefore preserve
the size of `struct callout_cpu` (320 bytes on amd64) despite the
added members.

This should help diagnose reference-after-free bugs where the
callout's mutex has already been freed when `softclock_call_cc`
tries to unlock it.

You might hope that the pointer would still be available, but it
isn't.  The argument to that function is on the stack (because
`softclock_call_cc` uses it later), and that might be enough in
some cases, but even then, it's very laborious.  A pointer to the
callout is saved right before these newly added fields, but that
callout might have been freed.  We still have the pointer to its
associated mutex, and the name within might be enough, but it might
also have been freed.

Reviewed by:	markj jhb
MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D20794
2019-07-03 19:22:44 +00:00
..
auxinfo NO_MAN= has been deprecated in favor of MAN= for some time, go ahead 2014-04-13 05:21:56 +00:00
callout_free Save the last callout function executed on each CPU 2019-07-03 19:22:44 +00:00
devrandom
hwpmc General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
iconv NO_MAN= has been deprecated in favor of MAN= for some time, go ahead 2014-04-13 05:21:56 +00:00
malloc NO_MAN= has been deprecated in favor of MAN= for some time, go ahead 2014-04-13 05:21:56 +00:00
net Add a test for the listen queue using two test programs, 2015-10-28 03:43:24 +00:00
netfibs Use the right length. 2014-07-25 20:49:59 +00:00
popss Add the test program to examine CPU behaviour for pop ss issue 2018-05-10 13:52:52 +00:00
ppsapi Eliminate a "format string is not a string literal" warning. 2017-03-21 22:21:29 +00:00
pthread_vfork
ptrace Update scescx test to print syscall number and arguments. 2017-06-12 21:16:37 +00:00
sort Remove apparently unused 0-byte files that cause grief on Windows 2018-11-03 01:53:26 +00:00
testfloat
upsdl NO_MAN= has been deprecated in favor of MAN= for some time, go ahead 2014-04-13 05:21:56 +00:00
vm86 Add a test for vm86(2), simple to use and diagnose. 2018-05-12 11:53:49 +00:00
README Fix spelling and grammer in tools/test/README. 2015-10-28 15:00:21 +00:00

$FreeBSD$

This directory is for standalone test programs.  For the FreeBSD
Test Suite, which uses Kyua, please see /usr/src/tests/

A test program is one that exercises a particular bit of the system
and either tries to break it or measures its performance.

Please make a subdir per program, and add a brief description to this file.

auxinfo		Return information on page sizes, CPUs, and OS release date.
devrandom	Programs to test /dev/*random.
hwpmc		Automatically trigger every event in hwpmc(4).
iconv		Character set conversion tests.
malloc		A program to test and benchmark malloc().
net		A set of generic test programs for networking.
netfibs		Programs to test multi-FIB network stacks.
posixshm	A program to test POSIX shared memory.
ppsapi		Test 1 Pulse Per Second (1PPS) input for time control.
pthread_vfork	Check that vfork and pthreads work together.
ptrace		Verify that ptrace works with syscalls, vfork etc.
sort		Tests for the sort command, including a full regression.
testfloat	Programs to test floating-point implementations
upsdl		Test of mmap functionality.