Commit Graph

301 Commits

Author SHA1 Message Date
christos ffcac9dc43 Avoid hard-coding names and limits so this will not break again. 2020-10-31 14:57:02 +00:00
jruoho 4704e28c3f Add basic checks for magic symlink(7)'s. These include a case for PR lib/55361,
although it seems that realpath(3) has bigger problems with these symlinks.
2020-07-01 13:49:26 +00:00
jruoho 55908713e4 Reference PRs consistently. 2020-06-26 07:50:11 +00:00
jruoho 2a70c17495 Add a test case for PR kern/52744, which no longer appears to be present. 2020-06-25 16:16:48 +00:00
rin f01e01eb6a errno is irrelevant here. 2020-06-24 07:02:57 +00:00
rin bc51181201 Fix random failures for pty_queue test.
Setting queue size by TIOCSQSIZE ioctl does not guarantee that data of
that size can be read by single shot of read(2).

Remove assertion based on this assertion, while total amount of data
read from child process is still checked appropriately.
2020-06-24 06:15:40 +00:00
rin 5e62095eac Turn err() into atf_tc_fail_errno() for parent process, so that
atf can catch failures correctly.
2020-06-24 05:59:18 +00:00
christos 0dc8cda9a3 Centralize the base rump libraries into a variable used by all the other
Makefiles so that we can make changes to it centrally as needed and have
less mess. Fixes the sun2 build that needs rumpvfs after librump after
the latest changes.
2020-03-01 18:08:12 +00:00
riastradh d78835f01e Test that fpu state is preserved by fork. 2020-02-11 03:15:10 +00:00
riastradh 9a872c5926 Show errno on failure. 2020-02-10 16:51:48 +00:00
christos d35ed14f2a opening a symlink with O_NOFOLLOW is expected to fail. 2019-10-20 16:02:11 +00:00
mrg 21303c93e9 convert HAVE_GCC == 7 to HAVE_GCC >= 7. 2019-09-29 23:44:58 +00:00
christos 7d2cda35f1 Add tests for fexecve(2) 2019-09-15 16:53:58 +00:00
christos 0a76d2ed5a Add F_GETPATH, presented to tech-kern. 2019-09-15 16:25:57 +00:00
kamil 8d8be769a2 Adapt tests/kernel/t_subr_prf for MKSANITIZER
Allow to rename snprintf-like functions to avoid clashes with a sanitizer.

This tests needs a fixup to remove 'undef symbol' from the test code
generator.
2019-08-15 08:46:09 +00:00
christos da8b7648ed Add a $ORIGIN test 2019-06-07 21:18:16 +00:00
kamil 173c420d5d Fix a mistake in a test for KERN_PROC_CWD
Emit properly ENOENT scenario in chroot. For some reason the final patch
did not hit the tree.
2019-06-01 22:18:23 +00:00
kamil 707a3080aa Add ATF KERN_PROC_CWD tests 2019-06-01 19:49:02 +00:00
christos 64bf11ba3e unexpand 2019-05-21 04:10:20 +00:00
christos 38217df340 add printf attribute 2019-05-21 04:09:46 +00:00
kre 8b2a560acf Make the t_subr_prf test build after changes to sys/kern/subr_prf.c
and while here add a simple test for the new kernel vasprintf().
2019-05-21 03:46:45 +00:00
kamil 14fc6dc308 Fix typo 2019-04-25 19:37:09 +00:00
mgorny f5c01693d5 Fix reporting EOF via kevent and add a test case
Fix the kernel pty driver to report closed slave via master's kevent
EVFILT_READ.  This behavior matches the behavior for pipes, is
consistent with how FreeBSD implements it and is relied upon by LLDB's
main loop implementation.

Includes feedback by kre and kamil (from tech-kern), commit approved
by kamil.
2019-02-15 18:57:15 +00:00
mrg 5bb852d0c6 - tests explicitly check failure modes, ignore those warnings 2019-02-04 05:24:18 +00:00
mrg 37649e4074 - enlarge buffer to avoid snprintf() truncation 2019-02-03 10:48:46 +00:00
thorpej 68e270a267 Implement support for "pshared" POSIX semaphores.
Fixes lib/53273 (and Firefox's multi-process tab feature).
2019-02-03 03:20:23 +00:00
martin b39c506b5a Clean up terminology: modern arm CPUs do properly implement IEEE 754
floating point exceptions - but some (actually all currently know ones)
do not implement sending traps when these exceptions are raised.

Pointed out by Peter Maydell.
2019-01-30 12:16:28 +00:00
christos e9c3f5723c vaxinate against ieeefp.h 2019-01-27 16:29:56 +00:00
martin 15fd2d17a6 Some arm CPUs do not implement traps on floating point exceptions. 2019-01-26 16:44:30 +00:00
christos 78928445f5 PR/53908: Alex Raschi: Test that require modules belong in modules; move the
threadpool test from kernel to modules.
2019-01-25 18:33:58 +00:00
christos 323118b11c add call error checks, requested by mrg@ 2019-01-14 00:23:43 +00:00
christos 42bad95822 Increase the timeout a bit, and make sure we join so that there is no
race.
2019-01-13 15:36:57 +00:00
thorpej 3cc63623bb kre@ notified me that the kernel/t_threadpool "rapid" test was occasionally
tripping a KASSERT() failure in the i386-qemu test rig.  It turns out this
is due to "rapid" simply being a buggy test that makes assumptions that
aren't always true, especially on slower / uniprocesor hardware.  So, the
right thing to do is just remove the test.
2018-12-28 16:01:53 +00:00
thorpej ad5e13cec6 Fix spurios whitespace (thank you substandard vi clones). 2018-12-26 22:21:10 +00:00
thorpej fd47102229 - De-opaque'ify struct threadpool_job.
- De-_t'ify all of the structure types.

No functional chage, no ABI change (verified with old rump unit test
before and after new librump.so).

Per Taylor's request.
2018-12-26 18:54:19 +00:00
thorpej 2834fa0ab4 Add threadpool(9), an abstraction that provides shared pools of kernel
threads running at specific priorities, with support for unbound pools
and per-cpu pools.

Written by riastradh@, and based on the May 2014 draft, with a few changes
by me:
- Working on the assumption that a relative few priorities will actually
  be used, reduce the memory footprint by using linked lists, rather than
  2 large (and mostly empty) tables.  The performance impact is essentially
  nil, since these lists are consulted only when pools are created (and
  destroyed, for DIAGNOSTIC checks), and the lists will have at most 225
  entries.
- Make threadpool job object, which the caller must allocate storage for,
  really opaque.
- Use typedefs for the threadpool types, to reduce the verbosity of the
  API somewhat.
- Fix a bunch of pool / worker thread / job object lifecycle bugs.

Also include an ATF unit test, written by me, that exercises the basics
of the API by loading a kernel module that exposes several sysctls that
allow the ATF test script to create and destroy threadpools, schedule a
basic job, and verify that it ran.

And thus NetBSD 8.99.29 has arrived.
2018-12-24 16:58:53 +00:00
riastradh ae35b062b5 Make fenv.h optional for this test to unbreak the vax build. 2018-11-12 05:02:00 +00:00
riastradh a31ad98a39 Use feenableexcept to trap fp exceptions, and trigger one, for SIGFPE.
Not every CPU traps integer division by zero -- aarch64, powerpc,
&c., just return zero.
2018-11-11 01:26:08 +00:00
riastradh bb7a1ff9e2 Sort #includes. 2018-11-11 01:26:00 +00:00
kamil 6abbe0506f Add a comment for the workaround in trigger_bus()
Explain PROT_READ|PROT_WRITE.
2018-05-30 17:48:13 +00:00
kamil 398835f368 Make the trigger_bus() test compatible with more CPUs (at least ALPHA)
If we write a byte character into a pointer, a compiler can emit a
read-modify-write operation, especially when a CPU cannot access directly
a character wide address.

In this scenario calling mmap(2) with PROT_WRITE, without PROT_READ will
emit unexpected trap.

There are two possible workarounds for this issue:
 - write register wide memory without rmw sequence,
 - mark the region with additional protection PROT_READ

Both work for NetBSD/alpha.

Go for the latter as perhaps more safe for dump compilers emitting rmw
sequences.

Investigated by <martin>
2018-05-30 17:31:34 +00:00
kamil 49994bfcd7 Handle FPE and BUS scenarios in the ATF t_trapsignal tests
These crash signals are crucial for proper handling of abnormal conditions
in a program. The additional purpose of these tests it to assure the proper
handling of these signals for the coming ptrace(2)-related changes in the
signal routing code.

Add a stub for ILL scenarios.

All tests pass (on amd64).

The shell ATF script contains duplicated code. There should be a way to
deduplicate it, without rewrite to C.

Sponsored by <The NetBSD Foundation>
2018-05-27 17:04:45 +00:00
kamil aaef92583a Extend ATF tests in t_trapsignal.sh to verify software breakpoint traps
There are at least four types of SIGTRAP events:
 - software/hardware single step (trace trap)
 - software breakpoint
 - hardware breakpoint/watchpoint
 - kernel event (exec, fork, vfork, vfork-done, lwp-create, lwp-exit)

A program can execute software breakpoint without the context of being
traced and this is a regular crash signal emitting SIGTRAP (TRAP_BRKPT).

Rename original trap_* tests (trap_simple, trap_handle, trap_mask,
trap_handle_recurse and trap_ignore) to segv_* tests and restrict them for
SIGSEGV.

Add new tests: trap_* testing the same scenarios as segv_ ones, however
verifying the software breakpoint trap (SIGTRAP).

Keep the original name of h_segv.c, and extend it for software breakpoint
events.

The purpose of these tests is to verify SIGTRAP kernel paths without the
ptrace(2) context.

All tests pass.

Sponsored by <The NetBSD Foundation>
2018-05-22 04:32:56 +00:00
kamil 5607b39231 Add new ATF test: t_trapsignal:trap_ignore
Test ignored trap with right exit code.

This test passes.

Sponsored by <The NetBSD Foundation>
2018-05-21 08:49:03 +00:00
kamil ed68aafd9d Correct assert in ATF t_zombie test
A failure is reported with -1, not 1.

Sponsored by <The NetBSD Foundation>
2018-05-18 00:25:30 +00:00
kamil ce34db38fd Add new ATF tests: kernel/t_zombie
New tests attempting to kill, stop, drop or revive a zombie:
 - signal1 (SIGKILL)
 - signal2 (SIGSTOP)
 - signal3 (SIGABRT)
 - signal4 (SIGHUP)
 - signal5 (SIGCONT)

New test race1 verifying whether there are any kernel races when processing
signals to zombies, executing in a loop for 5 seconds.

These tests were inspired by a kernel unexpected behavior when a lookup
of a dying process could result in two detected entities once as an alive
process and once as a zombie.

race1 is similar to t_ptrace_wait* race1, however without ptrace(2) involved.

Sponsored by <The NetBSD Foundation>
2018-03-14 02:13:47 +00:00
pgoyette 96bdb2f1f0 * Use 'struct testmsg' rather than 'struct mymsg' (avoids a conflict
with FreeBSD)
* Fix a broken call to open(2) with O_CREAT and no permission argument.
* ANSIfy function definitions.
* Improve failure messages.

From freebsd.org via Brooks Davis - Thanks!
2018-02-03 02:57:15 +00:00
martin cea0645f8c Add EVFILT_FS 2018-01-09 17:35:29 +00:00
martin 35cce3cf1f Double the nanosleep() time to make the test work more reliably on my
dual CPU alpha (where previously we sometimes ended up with no delay
at all).
2017-12-30 17:06:27 +00:00
nakayama 036e3ece76 Use SCRIPTS instead of PROGS to avoid strip(1) if STRIPFLAG=-s. 2017-12-14 14:38:17 +00:00