summaryrefslogtreecommitdiffstats
path: root/tests/sys/kern
Commit message (Collapse)AuthorAgeFilesLines
* MFC r317512:tuexen2017-06-012-1/+26
| | | | | | | | | armv8 has support for optional CRC32C instructions. This patch checks if they are available and if that is true make use of them. Thank you very much to Andrew Turner for providing help and review the patch! Reviewed by: andrew Differential Revision: https://reviews.freebsd.org/D10499
* MFC r317566:brooks2017-05-051-10/+10
| | | | | | | | | | | | | 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
* MFC r313006 (by cem), r315983 (by bde):markj2017-04-192-1/+139
| | | | Add an SSE4.2 implementation of crc32 for x86.
* MFC r315412, r314852:badger2017-03-251-0/+210
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* MFC r313992, r314075, r314118, r315484:badger2017-03-252-0/+1163
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* MFC r310096: reaper: Make REAPER_KILL_SUBTREE actually work.jilles2017-02-051-0/+102
|
* MFC r312119,r312216,r312226:ngie2017-02-041-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* MFC r312118,r312121:ngie2017-01-171-1/+1
| | | | | | | | | | | | | | | 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).
* MFC r311522:kib2017-01-131-2/+4
| | | | Use type-independent formats for printing nlink_t and ino_t.
* MFC r309957: Add tests for reaper receiving SIGCHLD (r309886).jilles2016-12-261-0/+162
| | | | PR: 213928
* MFC r309836: Add some tests for reaper functionality (in procctl()).jilles2016-12-182-0/+495
|
* MFC r306962:ngie2016-12-071-0/+18
| | | | | | | r306962 (by br): Ensure data in pipe is available to read. Useful for latest (5th, direct mode) test only.
* MFC r305676: wait: Do not copyout uninitialized status/rusage/wrusage.jilles2016-10-102-0/+71
| | | | | | | | 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
* MFC r304238:ngie2016-08-281-1/+4
| | | | | | Only expect :encode_tv_random_million to fail on 64-bit platforms It passes on i386
* MFC 303001: Add PTRACE_VFORK to trace vfork events.jhb2016-08-191-0/+126
| | | | | | | | | 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.
* MFC 302900,302902,302921,303461,304009:jhb2016-08-151-0/+198
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Commit a missing change from 299090asomers2016-05-231-2/+0
| | | | | | | | | | | tests/sys/kern/Makefile Reenable a disabled compiler warning, the need for which was eliminated by r299090. Reviewed by: ngie MFC after: 4 weeks X-MFC-With: 299090 Sponsored by: Spectra Logic Corp
* kern_descrip_test: Fix trivial buffer overrun with readlink(2)cem2016-05-121-1/+2
| | | | | | Reported by: Coverity CID: 1229965, 1229972 Sponsored by: EMC / Isilon Storage Division
* Merge ^/user/ngie/release-pkg-fix-tests to unbreak how test files are installedngie2016-05-044-12/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | after r298107 Summary of changes: - Replace all instances of FILES/TESTS with ${PACKAGE}FILES. This ensures that namespacing is kept with FILES appropriately, and that this shouldn't need to be repeated if the namespace changes -- only the definition of PACKAGE needs to be changed - Allow PACKAGE to be overridden by callers instead of forcing it to always be `tests`. In the event we get to the point where things can be split up enough in the base system, it would make more sense to group the tests with the blocks they're a part of, e.g. byacc with byacc-tests, etc - Remove PACKAGE definitions where possible, i.e. where FILES wasn't used previously. - Remove unnecessary TESTSPACKAGE definitions; this has been elided into bsd.tests.mk - Remove unnecessary BINDIRs used previously with ${PACKAGE}FILES; ${PACKAGE}FILESDIR is now automatically defined in bsd.test.mk. - Fix installation of files under data/ subdirectories in lib/libc/tests/hash and lib/libc/tests/net/getaddrinfo - Remove unnecessary .include <bsd.own.mk>s (some opportunistic cleanup) Document the proposed changes in share/examples/tests/tests/... via examples so it's clear that ${PACKAGES}FILES is the suggested way forward in terms of replacing FILES. share/mk/bsd.README didn't seem like the appropriate method of communicating that info. MFC after: never probably X-MFC with: r298107 PR: 209114 Relnotes: yes Tested with: buildworld, installworld, checkworld; buildworld, packageworld Sponsored by: EMC / Isilon Storage Division
* Automate the subr_unit test.asomers2016-04-291-0/+10
| | | | | | | | | | | | | | | | | | | Build and install the subr_unit test program originally written by phk, and run it with the other ATF tests. tests/sys/kern/Makefile * Build and install the subr_unit test as a plain test sys/kern/subr_unit.c * Reduce the default number of repetitions from 100 to 1, and add a command-line parser to override it. * Don't be so noisy by default * Fix an include problem for the test build Reviewed by: ngie MFC after: 4 weeks Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D6038
* MFHgjb2016-03-104-0/+77
|\ | | | | | | Sponsored by: The FreeBSD Foundation
| * DIRDEPS_BUILD: Connect MK_TESTS.bdrewery2016-03-094-0/+77
| | | | | | | | Sponsored by: EMC / Isilon Storage Division
* | More 'tests' package fixes.gjb2016-02-034-0/+12
|/ | | | Sponsored by: The FreeBSD Foundation
* Rename `recvfd` and `sendfd` variables in recvfd/sendfd functions to avoidngie2015-12-301-11/+11
| | | | | | | | -Wshadow issues with gcc MFC after: 1 week Reported by: bz, jenkins Sponsored by: EMC / Isilon Storage Division
* Integrate tools/regression/sockets/unix_passfd into the FreeBSD testngie2015-12-302-0/+397
| | | | | | | | | | | | | | | suite as tests/sys/kern/unix_passfd_test - Convert testcases to ATF - Fix an alignment issues - Mark rights_creds_payload(..) as an expected failure (see PR # 181741) Based [in part] on the following Differential Revision: https://reviews.freebsd.org/D689 MFC after: 1 week Submitted by: markj Sponsored by: EMC / Isilon Storage Division
* Add ptrace(2) reporting for LWP events.jhb2015-12-291-7/+186
| | | | | | | | 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.
* Remove retval to fix a -Wunused-but-set-variable warning from gcc 4.9ngie2015-12-281-4/+3
| | | | | MFC after: 1 week Sponsored by: EMC / Isilon Storage Division
* - Remove unused but set ssize in shutdown_send_sigpipengie2015-12-281-5/+11
| | | | | | | | | | - Add #ifdef TEST_SEQ_PACKET_SOURCE_ADDRESS` for untestable code because FreeBSD doesn't have a means to map source addresses for SEQ_PACKET AF_UNIX sockets (paraphrased). Put pathname variable under the #ifdef to mute another unused but set variable warning MFC after: 1 week Sponsored by: EMC / Isilon Storage Division
* Clean trailing whitespacengie2015-12-281-19/+19
| | | | | MFC after: 1 week Sponsored by: EMC / Isilon Storage Division
* Fix LDADD/DPADD that should be LIBADD.bdrewery2015-12-041-4/+3
| | | | Sponsored by: EMC / Isilon Storage Division
* Avoid requiring 'make depend' here.bdrewery2015-11-251-0/+1
| | | | | | | | Really this should not be a DPSRCS. The acct_test.c should not #include convert.c, but just link it in as a normal SRCS. MFC after: 1 week Sponsored by: EMC / Isilon Storage Division
* Integrate contrib/netbsd-tests/kernel/t_mqueue into the FreeBSD testngie2015-11-231-0/+5
| | | | | | suite as tests/sys/kern/mqueue_test MFC after: 1 week
* Fix up convert.c generationngie2015-11-231-2/+3
| | | | | | | | | | - Use a temporary file for convert.c to reduce likelihood of an interrupted build resulting in bad code being written to convert.c - Truncate the file instead of appending to it to ensure that the file being touched will not result in duplicate declarations/definitions from kern_acct.c if/when kern_acct.c changes. MFC after: 1 week
* Integrate tools/regression/pipe in to the FreeBSD test suite asngie2015-11-1610-0/+799
| | | | | | | | | | | | | | tests/sys/kern/pipe - Fix style(9) bugs - Fix compiler warnings - Use `nitems(x)` instead of `sizeof(x) / sizeof(*x)` pattern The testcases will be converted over to ATF eventually, but for now will be integrated in as plain C tests MFC after: 1 week Sponsored by: EMC / Isilon Storage Division
* Integrate contrib/netbsd-tests/kernel/t_lockf.c into the FreeBSD test suite asngie2015-11-161-0/+6
| | | | | | | tests/sys/kern/lockf_test MFC after: 1 week Sponsored by: EMC / Isilon Storage Division
* Integrate kern/kern_acct.c testcase in as tests/sys/kern/acct/acct_testngie2015-11-163-0/+255
| | | | | | | | | The :encode_tv_random_million testcase fails the epsilon tests few thousand times out of one million, so expect the testcase to fail MFC after: 1 week Submitted by: keramida Sponsored by: EMC / Isilon Storage Division
* Add tests for the copyin(9) handling of illegal buffers.kib2015-10-192-0/+87
| | | | | | Reviewed by: emaste, ngie Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D3925
* Tweak: use 'mainlwp' instead of 'mainpid' since this is a thread (LWP)jhb2015-10-061-3/+3
| | | | identifier, not a pid.
* Fix build with older GCC which, doesn't like 'main' being a variable name.bdrewery2015-10-061-3/+3
|
* Fix various edge cases related to system call tracing.jhb2015-10-062-15/+245
| | | | | | | | | | | | | | | | | | | | | | | - Always set td_dbg_sc_* when P_TRACED is set on system call entry even if the debugger is not tracing system call entries. This ensures the fields are valid when reporting other stops that occur at system call boundaries such as for PT_FOLLOW_FORKS or when only tracing system call exits. - Set TDB_SCX when reporting the stop for a new child process in fork_return(). This causes the event to be reported as a system call exit. - Report a system call exit event in fork_return() for new threads in a traced process. - Copy td_dbg_sc_* to new threads instead of zeroing. This ensures that td_dbg_sc_code in particular will report the system call that created the new thread or process when it reports a system call exit event in fork_return(). - Add new ptrace tests to verify that new child processes and threads report system call exit events with a valid pl_syscall_code via PT_LWPINFO. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D3822
* Revert r288682ngie2015-10-0510-0/+277
| | | | | | I meant to do this on ^/user/ngie/more-tests Pointyhat to: ngie (use svn info next time...)
* Remove some paths preparing for a re-copy from headngie2015-10-0510-277/+0
|
* Use _exit() instead of exit() in child processes created during tests.jhb2015-09-091-10/+10
| | | | Suggested by: kib
* Add a test to verify that a traced process sees its original parent viajhb2015-09-091-0/+87
| | | | | | | getppid() after a debugger process that is not the parent has attached. Reviewed by: kib (earlier version) Differential Revision: https://reviews.freebsd.org/D3615
* Properly size the children[] arrays in the follow fork tests.jhb2015-09-091-6/+6
|
* Clear P_TRACED before reparenting a detached process back to itsjhb2015-08-011-54/+527
| | | | | | | | | | | original parent. Otherwise the debugee will be set as an orphan of the debugger. Add tests for tracing forks via PT_FOLLOW_FORK. Reviewed by: kib MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D2809
* Fixed shutdown(2) unix(4) tests for SOCK_SEQPACKET after r285910 (by ed).pluknet2015-07-291-8/+52
|
* Add a CHILD_REQUIRE macro similar to ATF_REQUIRE for use in child processesjhb2015-06-041-25/+47
| | | | | | | of the main test process. Differential Revision: https://reviews.freebsd.org/D2664 Reviewed by: ngie (previous version)
* Consistently only use one end of the pipe in the parent and debuggerjhb2015-05-311-3/+5
| | | | | | | | processes and do not rely on EOF due to a close() in the debugger. PR: 200489 Differential Revision: https://reviews.freebsd.org/D2674 Reviewed by: kib, ngie, rodrigc
* Tweak the description of when waitpid() doesn't return any status for ajhb2015-05-281-6/+6
| | | | | | non-blocking wait to avoid the word "empty". Requested by: ngie
OpenPOWER on IntegriCloud