Commit Graph

111 Commits

Author SHA1 Message Date
John Baldwin
50537c971c MFC 341800: Don't report stale signal information in ptrace_lwpinfo.
Once a signal's siginfo was copied to 'td_si' as part of the signal
exchange in issignal(), it was never cleared.  This caused future
thread events that are reported as SIGTRAP events without signal
information to report the stale siginfo in 'td_si'.  For example, if a
debugger created a new process and used SIGSTOP to stop it after
PT_ATTACH, future system call entry / exit events would set PL_FLAG_SI
with the SIGSTOP siginfo in pl_siginfo.  This broke 'catch syscall' in
current versions of gdb as it assumed PL_FLAG_SI with SIGTRAP
indicates a breakpoint or single step trap.
2019-01-02 19:11:49 +00:00
Alan Somers
c074fc92d2 MFC r337222:
Fix LOCAL_PEERCRED with socketpair(2)

Enable the LOCAL_PEERCRED socket option for unix domain stream sockets
created with socketpair(2). Previously, it only worked with unix domain
stream sockets created with socket(2)/listen(2)/connect(2)/accept(2).

PR:		176419
Reported by:	Nicholas Wilson <nicholas@nicholaswilson.me.uk>
Differential Revision:	https://reviews.freebsd.org/D16350
2018-10-01 18:00:52 +00:00
John Baldwin
34cec59992 MFC 287600,287602: Fixes for fork following tests.
287600:
Properly size the children[] arrays in the follow fork tests.

287602:
Use _exit() instead of exit() in child processes created during tests.
2018-01-25 00:08:13 +00:00
John Baldwin
812e1fe7f3 MFC 325028,328344: Discard the correct thread event reported for a ptrace stop.
325028:
Discard the correct thread event reported for a ptrace stop.

When multiple threads wish to report a tracing event to a debugger,
both threads call ptracestop() and one thread will win the race to be
the reporting thread (p->p_xthread).  The debugger uses PT_LWPINFO
with the process ID to determine which thread / LWP is reporting an
event and the details of that event.  This event is cleared as a side
effect of the subsequent ptrace event that resumed the process
(PT_CONTINUE, PT_STEP, etc.).  However, ptrace() was clearing the
event identified by the LWP ID passed to the resume request even if
that wasn't the 'p_xthread'.  This could result in clearing an event
that had not yet been observed by the debugger and leaving the
existing event for 'p_thread' pending so that it was reported a second
time.

Specifically, if the debugger stopped due to a software breakpoint in
one thread, but then switched to another thread that was used to
resume (e.g. if the user switched to a different thread and issued a
step), the resume request (PT_STEP) cleared a pending event (if any)
for the thread being stepped.  However, the process immediately
stopped and the first thread reported it's breakpoint event a second
time.  The debugger decremented the PC for "both" breakpoint events
which resulted in the PC now pointing into the middle of an
instruction (on x86) and a SIGILL fault when the process was resumed a
second time.

To fix, always clear the pending event for 'p_xthread' when resuming a
process.  ptrace() still honors the requested LWP ID when enabling
single-stepping (PT_STEP) or setting a different PC (PT_CONTINUE).

328344:
Mark the unused argument to continue_thread() as such.

clang in HEAD and 11 does not warn about this, but clang in 10 does.
2018-01-24 21:48:39 +00:00
John Baldwin
e8c58205fe MFC 326953:
Catch up to r325719 which makes the kern.proc.pid sysctl "work" for zombies.

Some of the ptrace tests need to wait for a child process to become a
zombie before preceding.  The parent process polls the child process
via the kern.proc.pid sysctl to wait for it to become a zombie.
Previously the code polled until the sysctl failed with ESRCH.  Now it
will poll until either the sysctl fails with ESRCH (for compatiblity
with older kernels) or returns a kinfo_proc structure with the ki_stat
field set to SZOMB.
2018-01-24 00:32:02 +00:00
Enji Cooper
81a349bad3 MFC r324478:
Check the exit code from fsck_ffs instead of relying on MODIFIED being in the output

^/head@r323923 changed when MODIFIED is printed at exit. It's better to follow the
documented way of determining whether or not a filesystem is clean per fsck_ffs, i.e.,
ensure that the exit code is either 0 or 7.

The pass/fail determination is brittle prior to this commit, and ^/head@r323923 made
the issue apparent -- thus this needs to be fixed independent of ^/head@r323923.

PR:		222780
MFC with:	r323923
2017-10-17 15:49:36 +00:00
Enji Cooper
f1d1415923 MFC r320446:
trailing_slash is a TAP-compliant testcase; mark it as such, instead
of calling is a plain testcase.
2017-07-28 03:26:05 +00:00
Enji Cooper
ecf0f66ab3 MFC r320445:
Don't hardcode path to file in /tmp; this violates the kyua sandbox
2017-07-28 03:24:57 +00:00
Alan Somers
a2528eb0ca MFC r318593:
Fix build of AIO tests with -DDEBUG

Also, redefine some constants for clarity.  No functional change.
2017-05-31 17:20:55 +00:00
Enji Cooper
9ad345a483 MFC r319056,r319058,r319059,r319060,r319061,r319078:
r319056:

tests/sys/file/ftruncate_test: use an exit code of 1 instead
of -1 with err*(3).

An exit code of -1 is implementation defined -- it's best to stick
with something well-defined (1).

r319058:

Create a deterministic file in the kyua sandbox, instead of a
temporary file outside the kyua sandbox

This helps ensure that the file is removed at test exit, and as
a side effect, cures a warning about umasks with Coverity.

r319059:

Use an exit code of 1 instead of -1 for reasons noted in r319056

r319060:

Use main(void) instead of main(argc __unused, argv __unused)

r319061:

Don't leak accept_fd on thread completion

CID:		1296068

r319078:

Tweak r319058 slightly

- Specify an explicit mode when using O_CREAT per open(2).
- Fix the error message (add missing enclosing parentheses).

MFC with:	r319058
2017-05-31 08:36:47 +00:00
Enji Cooper
183269e8f7 MFC r318546:
sys/fs/tmpfs/vnd_test: make md(4) allocation dynamic

The previous logic was flawed in the sense that it assumed that /dev/md3
was always available. This was a caveat I noted in r306038, that I hadn't
gotten around to solving before now.

Cache the device for the mountpoint after executing mdmfs, then use the
cached value in basic_cleanup(..) when unmounting/disconnecting the md(4)
device.

Apply sed expressions to use reuse logic in the NetBSD code that could
also be applied to FreeBSD, just with different tools.
2017-05-27 23:04:48 +00:00
Brooks Davis
7d4ee1b034 MFC r317566:
Don't pass size_t arguments to setsockopt(SO_SNDBUF/SO_RCVBUF).

These commands take an int. The tests work by accident on little-endian,
64-bit systems.

PR:		218919
Tested with:	qemu-cheri and CheriBSD built for mips64
Reviewed by:	asomers, ngie
Obtained from:	CheriBSD
Sponsored by:	DARPA, AFRL
2017-05-05 16:24:35 +00:00
Alan Somers
ddc5034c27 MFC r285117
Make cleanup routines idempotent

cleanup routines can be executed at any point during the execution of the
body, including even before the body has done any real work.  In those
cases, cleanup routines should be careful to not raise spurious errors so
as to not "override" the actual result of the test case.

This is just general good coding style but is not a problem in practice
for these specific tests.  (The way I discovered the issue, though, was
due to a regression I introduced in Kyua itself while refactoring some
internals.)

MFC after:      1 week
2017-04-18 16:17:38 +00:00
Eric Badger
b6705875cb MFC r315412, r314852:
r315412:
    Don't clear p_ptevents on normal SIGKILL delivery

    The ptrace() user has the option of discarding the signal. In such a
    case, p_ptevents should not be modified. If the ptrace() user decides to
    send a SIGKILL, ptevents will be cleared in ptracestop(). procfs events
    do not have the capability to discard the signal, so continue to clear
    the mask in that case.

r314852:
    don't stop in issignal() if P_SINGLE_EXIT is set

    Suppose a traced process is stopped in ptracestop() due to receipt of a
    SIGSTOP signal, and is awaiting orders from the tracing process on how
    to handle the signal. Before sending any such orders, the tracing
    process exits. This should kill the traced process. But suppose a second
    thread handles the SIGKILL and proceeds to exit1(), calling
    thread_single(). The first thread will now awaken and will have a chance
    to check once more if it should go to sleep due to the SIGSTOP.  It must
    not sleep after P_SINGLE_EXIT has been set; this would prevent the
    SIGKILL from taking effect, leaving a stopped orphan behind after the
    tracing process dies.

    Also add new tests for this condition.

Sponsored by:	Dell EMC
2017-03-25 20:14:08 +00:00
Eric Badger
21cbd2de3e MFC r313992, r314075, r314118, r315484:
r315484:
    ptrace_test: eliminate assumption about thread scheduling

    A couple of the ptrace tests make assumptions about which thread in a
    multithreaded process will run after a halt. This makes the tests less
    portable across branches, and susceptible to future breakage. Instead,
    twiddle thread scheduling and priorities to match the tests'
    expectation.

r314118:
    Actually fix buildworlds other than i386/amd64/sparc64 after r313992

    Disable offending test for platforms without a userspace visible
    breakpoint().

r314075:
    Fix world build for archs where __builtin_debugtrap() does not work.

    The offending code was introduced in r313992.

r313992:
    Defer ptracestop() signals that cannot be delivered immediately

    When a thread is stopped in ptracestop(), the ptrace(2) user may request
    a signal be delivered upon resumption of the thread. Heretofore, those signals
    were discarded unless ptracestop()'s caller was issignal(). Fix this by
    modifying ptracestop() to queue up signals requested by the ptrace user that
    will be delivered when possible. Take special care when the signal is SIGKILL
    (usually generated from a PT_KILL request); no new stop events should be
    triggered after a PT_KILL.

    Add a number of tests for the new functionality. Several tests were authored
    by jhb.

PR:		212607
Sponsored by:	Dell EMC
2017-03-25 13:33:23 +00:00
Enji Cooper
92a942abc7 MFC r314450,r313439:
r314450:

Add additional __FreeBSD_version guards around the hsearch_r testcases

The reasoning for this is the same as r276046: to ease MFCing the tests
to ^/stable/10 .

This was accidentally missed in r313439

r313439 | ngie | 2017-02-08 01:46:15 -0800 (Wed, 08 Feb 2017) | 25 lines

Merge content from ^/projects/netbsd-tests-upstream-01-2017 into ^/head

The primary end-goal of this drop is ease future merges with NetBSD and
collaborate further with the NetBSD project.

The goal was (largely, not completely as some items are still oustanding
in the NetBSD GNATS system) achieved by doing the following:
- Pushing as many changes required to port contrib/netbsd-tests
  back to NetBSD as possible, then pull the upstream applied changes
  back in to FreeBSD.
- Diff reduce with upstream where possible by:
-- Improving libnetbsd header, etc compat glue.
-- Using _SED variables to modify test scripts on the fly for items
   that could not be upstreamed to NetBSD.

As a bonus for this work, this change also introduces testcases for
uniq(1).

Many thanks to Christos for working with me to get many of the changes
back into the NetBSD project.

In collaboration with:	Christos Zoulas <christos@netbsd.org>
2017-03-07 01:52:50 +00:00
Enji Cooper
e155225fa2 MFC r295643:
r295643 (by bdrewery):

Test directories can build in parallel fine.
2017-02-16 05:17:40 +00:00
Alan Somers
567eee3bb1 MFC r311893, r313008, r313081
I had to modify the tests slightly for the MFC to stable/10, because
stable/10 lacks r294037, which enabled /sbin/md5 to work on md(4)
devices.

r311893:
ATFify the geom gate tests.

This ensures their cleanup routines will be run even if they should timeout.

tests/sys/geom/class/gate/ggate_test.sh
tests/sys/geom/class/gate/Makefile
	Add an ATF test with three testcases, one for each TAP test. Use
	ATF-style cleanup functions, and convert sleeps to polling loops.

ObsoleteFiles.inc
tests/sys/geom/class/gate/conf.sh
tests/sys/geom/class/gate/1_test.sh
tests/sys/geom/class/gate/2_test.sh
tests/sys/geom/class/gate/3_test.sh
	Delete TAP test files

Reviewed by:	ngie
MFC after:	4 weeks
Sponsored by:	Spectra Logic Corp
Differential Revision:	https://reviews.freebsd.org/D8891

r313008:
Wait for /dev/ggate* to appear after calling `ggatel create` in :ggatel_{file,md}

The test assumed that `ggatel create` created a device on completion, but that's
incorrect. This squashes the race by waiting for the device to appear, as
`ggatel create` daemonizes before issuing an ioctl to geom_gate(4) if not called
with `-v`.

Discussed with:	asomers
MFC after:	1 week
PR:		204616
Sponsored by:	Dell EMC Isilon

r313081:
Replace for/retry loops with "wait_for_ggate_device" calls and check
results of commands

As noted in r313008, the underlying issue was that geom_gate device
creation wasn't created at ggatel command completion, but some short
time after. ggatec(8) employs similar logic when creating geom_gate(4)
devices.

Switch from retry loops (after the ggatec/dd write calls) to
wait_for_ggate_device function calls after calling ggatec(8) instead
to detect the presence of the /dev/ggate* device, as this function is
sufficient for determining whether or not the character device is ready
for testing

While here, use atf_check consistently with all dd calls to ensure that
data output is as expected.

MFC after:	1 week
Reviewed by:	asomers
Differential Revision:	D9409
Sponsored by:	Dell EMC Isilon
2017-02-15 00:16:52 +00:00
Enji Cooper
15c13d8da4 MFC r307702:
Integrate contrib/netbsd-tests/fs/tmpfs into the FreeBSD test suite
as tests/sys/fs

These testcases exercise tmpfs support
2017-02-10 03:17:11 +00:00
Enji Cooper
cb4649d0b2 MFC r305468:
Port contrib/netbsd-tests/kernel/kqueue/... as tests/sys/kqueue/...

proc2_test must be skipped because the invariant tested
(`ke.fflags & NOTE_TRACKERR`) doesn't pass.
2017-02-10 02:29:39 +00:00
Enji Cooper
c320a567cd Remove EVFILT_PROCDESC block
This reapplies the patch that was done in ^/stable/10@r297977

This is a direct commit to ^/stable/10

Sponsored by:	Dell EMC Isilon
2017-02-10 02:29:09 +00:00
Enji Cooper
653ad4330c MFC r304797,r305467:
r304797 (by jmmv):

Make use of Kyua's work directories.

Change the vnode tests to use the current directory when creating temporary
files, which we can assume is a volatile work directory, and then make the
kqueue_test.sh driver _not_ abandon the directory created by Kyua.

This makes the various kqueue tests independent of each other, and ensures
the temporary file is cleaned up on failure.

Problem spotted by asomers@ when reviewing D4254.

r305467:

Move tests/sys/kqueue/... to tests/sys/kqueue/libkqueue/...

This is being done to clearly distinguish the libkqueue tests
from the (soon to be imported) NetBSD tests.
2017-02-10 02:21:57 +00:00
Enji Cooper
c06eac9206 MFC r289172,r290254:
r289172:

Refactor the test/ Makefiles after recent changes to bsd.test.mk (r289158) and
netbsd-tests.test.mk (r289151)

- Eliminate explicit OBJTOP/SRCTOP setting
- Convert all ad hoc NetBSD test integration over to netbsd-tests.test.mk
- Remove unnecessary TESTSDIR setting
- Use SRCTOP where possible for clarity

r290254:

Remove unused variable (SRCDIR)
2017-02-09 22:49:48 +00:00
Jilles Tjoelker
83da6fc42f MFC r310096: reaper: Make REAPER_KILL_SUBTREE actually work. 2017-02-05 21:31:40 +00:00
Enji Cooper
731ceea1fd MFC r312164:
Fix -Wformat issue

Use %zu for printing out results from nitems, as it's size_t based
2017-02-04 16:31:24 +00:00
Enji Cooper
168f8a992f MFC r312114,r312194:
r312114:

Enable WARNS?= 6 across all of tests/sys

r312194:

Add include Makefiles for tests/sys/{fs,kern,kqueue,mac}/...

The primary goal for doing this is to leverage the work done in r312114
for enabling WARNS to address trivial code quality issues with new tests

Tested with:	make tinderbox
2017-02-04 16:29:23 +00:00
Enji Cooper
d1d4d810d4 MFC r312110:
Fix -Wsign-compare warnings

The loop index (i) doesn't need to be size_t as its comparison is signed
2017-02-04 16:16:41 +00:00
Enji Cooper
eedcca3466 MFC r312120:
Fix warnings

- Staticize test_num
- Promote i to size_t to deal with -Wsign-compare issues

Tested with:	clang, gcc, gcc49
2017-02-04 16:15:26 +00:00
Enji Cooper
90d26106da MFC r312119,r312216,r312226:
r312119:

encode_long, encode_timeval: mechanically replace `exp` with `exponent`

This helps fix a -Wshadow issue with exp(3) with tests/sys/acct/acct_test,
which include math.h, which in turn defines exp(3)

Tested with:	clang, gcc 4.2.1, gcc 4.9

r312216:

Revert r312119 and reword the intent to fix -Wshadow issues
between exp(3) and `exp` var.

The approach taken previously was not ideal for multiple
functional and stylistic reasons.

Add to existing sed call in Makefile to replace `exp` with
`exponent` instead.

Requested by:	bde

r312226:

Fix typo in r312216

I meant to replace "exp" with "exponent", not "expected"

Pointyhat to:	ngie
2017-02-04 16:02:49 +00:00
Alan Somers
15e8741a9e MFC r310786, r310803, r310985, r311894
r310786:
Reduce the runtime of the GELI tests

There is no reduction in test coverage.  On my system runtime is reduced
from 38m32s to 6m24s.

tests/sys/geom/class/eli/conf.sh
tests/sys/geom/class/eli/init_a_test.sh
tests/sys/geom/class/eli/init_test.sh
tests/sys/geom/class/eli/integrity_copy_test.sh
tests/sys/geom/class/eli/integrity_data_test.sh
tests/sys/geom/class/eli/integrity_hmac_test.sh
tests/sys/geom/class/eli/onetime_a_test.sh
tests/sys/geom/class/eli/onetime_test.sh
	Move the looping code into common functions in conf.sh, and remove
	alias ciphers from the list.

tests/sys/geom/class/eli/init_a_test.sh
tests/sys/geom/class/eli/init_test.sh
tests/sys/geom/class/eli/integrity_copy_test.sh
tests/sys/geom/class/eli/integrity_data_test.sh
tests/sys/geom/class/eli/integrity_hmac_test.sh
tests/sys/geom/class/eli/onetime_a_test.sh
	Move a few commands that don't need to be in the inner loop out.

tests/sys/geom/class/eli/init_test.sh
tests/sys/geom/class/eli/onetime_a_test.sh
	Reduce the sector count

tests/sys/geom/class/eli/Makefile
tests/sys/geom/class/eli/init_alias_test.sh
	Add a test for initializing a GELI device using one of the cipher
	aliases, and check that the alias is correctly interpreted.

MFC after:	4 weeks
Sponsored by:	Spectra Logic Corp
Differential Revision:	https://reviews.freebsd.org/D8814

r310803:
ATFify the gnop tests

Also, add test cases for the -p, -P, and -s options to gnop create

Reviewed by:	ngie
MFC after:	4 weeks
Differential Revision:	https://reviews.freebsd.org/D8892

r310985:
Update ObsoleteFiles.inc for r310803

MFC after:	26 days
X-MFC-with:	310803

r311894:
Fix typo from change 310985 in ObsoleteFiles.inc

MFC after:	16 days
X-MFC-With:	310803
Sponsored by:	Spectra Logic Corp
2017-01-26 20:10:31 +00:00
Enji Cooper
51e38587c4 MFC r312111:
Remove unused vars to fix -Wunused issues
2017-01-17 01:56:49 +00:00
Enji Cooper
adbb08d43b MFC r312118,r312121:
r312118:

Fix -Wformat issue with zero-length format string passed to err(3)

Tested with:	clang, gcc 4.2.1, gcc 4.9

r312121:

Follow up to r312118

State that execve failed instead of just printing out the program name
and strerror(errno) via err(3).
2017-01-17 01:55:05 +00:00
Jilles Tjoelker
56b77ed64d MFC r309957: Add tests for reaper receiving SIGCHLD (r309886).
PR:		213928
2016-12-26 17:26:25 +00:00
Jilles Tjoelker
cd8d0bf773 MFC r309836: Add some tests for reaper functionality (in procctl()). 2016-12-25 22:32:16 +00:00
Enji Cooper
295fae79ea MFstable/11 r309661:
MFC r306962:
r306962 (by br):

Ensure data in pipe is available to read.
Useful for latest (5th, direct mode) test only.
2016-12-07 00:57:15 +00:00
Enji Cooper
0cdb27dd84 MFstable/11 r307715:
MFC r305916,r305918:

r305916:

Make sure $TMPDIR is created with 0755 permissions

This is required to ensure that the temporary script can be executed,
as the default mode is apparently too restrictive

r305918:

Only chmod $TMPDIR if it's not /tmp

This is a safety belt to ensure that the /tmp sticky bit stuff doesn't
get whacked by accident if someone runs the script outright
2016-10-21 08:25:03 +00:00
Jilles Tjoelker
2cd6359e05 wait: Do not copyout uninitialized status/rusage/wrusage.
If wait4() or wait6() return 0 because of WNOHANG, the status, rusage and
wrusage information should not be returned.

PR:		212048
Reported by:	Casey Lucas
2016-10-11 18:51:03 +00:00
Enji Cooper
51868bd8d6 MFstable/11 r305914:
MFC r305357:

Skip testcases 9/10 if jail(8) isn't installed

These testcases require jail support
2016-09-18 04:34:32 +00:00
Enji Cooper
b3e63e7a5e MFstable/11 r305912:
MFC r305356:

Add a missing "Bail out!" if zpool create fails

This will make the exit info more meaningful if/when zpool create fails,
and establishes parity with the other 2 zfs acl testcases (01, 03).
2016-09-18 03:00:46 +00:00
Enji Cooper
d62130ceb7 MFstable/11 r304947:
MFC r304238:

Only expect :encode_tv_random_million to fail on 64-bit platforms

It passes on i386
2016-09-01 19:08:07 +00:00
Enji Cooper
1271c8406c MFC r304040:
Redirect the output of the testcases to stderr instead of
redirecting it to /dev/null

This will aid in debugging failures
2016-09-01 19:05:23 +00:00
John Baldwin
fe0654c31f MFC 303001: Add PTRACE_VFORK to trace vfork events.
First, PL_FLAG_FORKED events now also set a PL_FLAG_VFORKED flag when
the new child was created via vfork() rather than fork().  Second, a
new PL_FLAG_VFORK_DONE event can now be enabled via the PTRACE_VFORK
event mask.  This new stop is reported after the vfork parent resumes
due to the child calling exit or exec.  Debuggers can use this stop to
reinsert breakpoints in the vfork parent process before it resumes.
2016-08-19 20:17:57 +00:00
John Baldwin
6c57684dd2 MFC 302900,302902,302921,303461,304009:
Add a mask of optional ptrace() events.

302900:
Add a test for user signal delivery.

This test verifies we get the correct ptrace event details when a signal
is posted to a traced process from userland.

302902:
Add a mask of optional ptrace() events.

ptrace() now stores a mask of optional events in p_ptevents.  Currently
this mask is a single integer, but it can be expanded into an array of
integers in the future.

Two new ptrace requests can be used to manipulate the event mask:
PT_GET_EVENT_MASK fetches the current event mask and PT_SET_EVENT_MASK
sets the current event mask.

The current set of events include:
- PTRACE_EXEC: trace calls to execve().
- PTRACE_SCE: trace system call entries.
- PTRACE_SCX: trace syscam call exits.
- PTRACE_FORK: trace forks and auto-attach to new child processes.
- PTRACE_LWP: trace LWP events.

The S_PT_SCX and S_PT_SCE events in the procfs p_stops flags have
been replaced by PTRACE_SCE and PTRACE_SCX.  PTRACE_FORK replaces
P_FOLLOW_FORK and PTRACE_LWP replaces P2_LWP_EVENTS.

The PT_FOLLOW_FORK and PT_LWP_EVENTS ptrace requests remain for
compatibility but now simply toggle corresponding flags in the
event mask.

While here, document that PT_SYSCALL, PT_TO_SCE, and PT_TO_SCX both
modify the event mask and continue the traced process.

302921:
Rename PTRACE_SYSCALL to LINUX_PTRACE_SYSCALL.

303461:
Note that not all optional ptrace events use SIGTRAP.

New child processes attached due to PTRACE_FORK use SIGSTOP instead of
SIGTRAP.  All other ptrace events use SIGTRAP.

304009:
Remove description of P_FOLLOWFORK as this flag was removed.
2016-08-15 21:10:41 +00:00
John Baldwin
b0fbcc609d MFC 292894,292896: Add ptrace(2) reporting for LWP events.
292894:
Add ptrace(2) reporting for LWP events.

Add two new LWPINFO flags: PL_FLAG_BORN and PL_FLAG_EXITED for reporting
thread creation and destruction. Newly created threads will stop to report
PL_FLAG_BORN before returning to userland and exiting threads will stop to
report PL_FLAG_EXIT before exiting completely. Both of these events are
only enabled and reported if PT_LWP_EVENTS is enabled on a process.

292896:
Document the recently added support for ptrace(2) LWP events.
2016-08-12 19:43:06 +00:00
Alan Somers
30baf996d2 MFC r302036
Skip sys/acl tests on systems lacking perl

tests/sys/acl/Makefile
        add perl to the required_programs for all tests in this directory
2016-07-12 22:09:05 +00:00
Enji Cooper
629dae7e20 MFC r299508:
r299508 (by cem):

kern_descrip_test: Fix trivial buffer overrun with readlink(2)

CID:		1229965, 1229972
2016-06-10 18:07:35 +00:00
Enji Cooper
7934328001 MFC r298304:
Fix issues identified by Coverity

- Always munmap memory regions after mmap'ing them.
- Make sure getpagesize() returns a value greater than 0 and use a
  cached value instead of always calling getpagesize(3).
- Remove intermediate variable for assigning from $TMPDIR if set in the
  environment to eliminate warnings about pointer conversions with "/tmp",
  and to mute an invalid buffer overflow concern from Coverity
  (snprintf and tacking on a NUL terminator was alleviating that concern
  before).
- Remove useless self-test of psize before it's initialized.
- Check the return values of getrlimit/setrlimit.

Cosmetic changes:
- Replace a `(void*)0` with NULL.
- Do some minor whitespace clean up.
- Remove an unnecessary cast to mmap.
- Make all munmap calls use ATF_REQUIRE_MSG instead of using the:

  > if (munmap(..) == -1)
  >    atf_tc_fail(..)

  idiom. Employ the new idiom consistently when calling munmap.

CID: 1331351, 1331382-1331386, 1331513, 1331514, 1331565, 1331583, 1331694
2016-05-04 07:37:02 +00:00
Enji Cooper
9059c6e44d MFC r298301:
Fix leaks and test for getpagesize() returning == -1

- close file descriptors after use.
- Always munmap memory regions after mmap'ing them.
- Make sure getpagesize() returns a value greater than 0 and use a
  cached value instead of always calling getpagesize(3).

CID: 1331374-1331377, 1331653-1331662
2016-05-04 07:35:43 +00:00
Enji Cooper
224be49968 MFC r298024,r298196:
r298024:

Set test_argv to NULL, not 0, if not executing a specific test

r298196:

Minor cosmetic cleanup

- Remove spurious trailing whitespace in licensing header
- Remove unnecessary semi-colon after comment
2016-04-22 21:30:42 +00:00
Eric van Gyzen
dc03379e84 MFC r295012
kqueue EVFILT_PROC: avoid collision between NOTE_CHILD and NOTE_EXIT

NOTE_CHILD and NOTE_EXIT return something in kevent.data: the parent
pid (ppid) for NOTE_CHILD and the exit status for NOTE_EXIT.
Do not let the two events be combined, since one would overwrite
the other's data.

PR:		180385
Submitted by:	David A. Bright <david_a_bright@dell.com>
Sponsored by:	Dell Inc.
2016-04-14 17:14:11 +00:00