summaryrefslogtreecommitdiff
path: root/tests/lib/libc/sys
AgeCommit message (Collapse)Author
2021-11-01Test lib/libc/sys/t_timerfd often fails when run on QEMU becausehannken
QEMU misses clock interrupts. Always check values against [ lower, upper ] bounds and use "4 * upper" when run under QEMU. Now becomes part of PR kern/43997 "Kernel timer discrepancies".
2021-10-21Skip the lib/libc/sys/t_ptrace_waitid:syscall_signal_on_sce test casegson
with a reference to PR lib/55087. Marking it as an expected failure would be more appropriate, but that doesn't work for test cases that fail by timing out.
2021-10-14Remove trailing whitespacegson
2021-10-02- Strenghen the poll(2) fifo_inout test to ensure that once the readerthorpej
has read enough that exactly PIPE_BUF space is available that the FIFO becomes writable again. - When creating a FIFO, ensure that the receive low water mark is 1 (a FIFO must be readable when at least 1 byte is available); this was already the case implicitly, but this makes it explicit. - Similarly, set the send low water mark to PIPE_BUF to ensure that the pipe is writable when at least PIPE_BUF bytes of space are available in the send buffer. Without this change, the strengthened test case above does not pass (the default send low water mark is larger than PIPE_BUF; see soreserve()). - Make the same low water mark changes to the PIPE_SOCKETPAIR case.
2021-10-02Add a fifo_inout test case that validates the expected POLLIN / POLLOUTthorpej
behavior for FIFOs: - A FIFO is readable so long as at least 1 byte is available. - A FIFO is writable so long as at least PIPE_BUF (obtained with _PC_PIPE_BUF) space is avaiable. This will be cloned for a forthcoming kevent test case.
2021-10-02In the fifo_hup1 test, also ensure that POLLHUP is de-asserted when athorpej
new writer appears.
2021-10-02- fifo_poll(): If the last writer has disappeared, detect this and returnthorpej
POLLHUP, per POSIX. - fifo_close(): Use the new fifo_socantrcvmore(), which is like the garden-variety socantrcvmore(), except it specifies POLL_HUP rather than POLL_IN (so the correct code for SIGIO is sent). - sowakeup(): Allow POLL_HUP as a code (notifies poll'ers with POLLHUP). - Add test cases for correct POLLHUP behavior with FIFOs. Fixes PR kern/56429.
2021-09-19Add native implementations of eventfd(2) and timerfd(2), compatible withthorpej
the Linux interfaces of the same name.
2021-08-22s/priviledge/privilege/ in comments/log messages and fix one typo in descriptor.andvar
2021-07-24For sh3, increment PC when PT_CONTINUE from trigger_trap(), as alreadyrin
done for aarch64, arm, and powerpc. Otherwise, child is trapped to the PTRACE_BREAKPOINT_ASM (== trapa) instruction indefinitely. Fix tests/lib/libc/sys/t_ptrace_wait*:core_dump_procinfo.
2021-07-17PR 56313: fix eroneous = that was meant to be ==martin
2021-05-24On mips, avoid deliberately executing an illegal instruction for nowgson
because it causes GXemul to exit rather than generating a trap. A bug report has been sent to the GXemul author.
2021-03-28yield so we can lose packetschristos
2021-03-21use a pipe instead of sched_yield()christos
2021-03-19Sprinkle a few more \n's and the end of some debug printfs.simonb
2021-01-18Check for MAP_FAILED instead of NULL when looking for an error from mmap(2).simonb
2020-10-31PR/55663: Ruslan Nikolaev: Add support for EVFILT_USER in kqueue(2)christos
2020-10-27Add tests for AVX-512 registers (zmm0..zmm31, k0..7)mgorny
Thanks to David Seifert <soap@gentoo.org> for providing a VM on an AVX-512 capable hardware Reviewed by kamil
2020-10-24Issue 64-bit versions of *XSAVE* for 64-bit amd64 programsmgorny
When calling FXSAVE, XSAVE, FXRSTOR, ... for 64-bit programs on amd64 use the 64-suffixed variant in order to include the complete FIP/FDP registers in the x87 area. The difference between the two variants is that the FXSAVE64 (new) variant represents FIP/FDP as 64-bit fields (union fp_addr.fa_64), while the legacy FXSAVE variant uses split fields: 32-bit offset, 16-bit segment and 16-bit reserved field (union fp_addr.fa_32). The latter implies that the actual addresses are truncated to 32 bits which is insufficient in modern programs. The change is applied only to 64-bit programs on amd64. Plain i386 and compat32 continue using plain FXSAVE. Similarly, NVMM is not changed as I am not familiar with that code. This is a potentially breaking change. However, I don't think it likely to actually break anything because the data provided by the old variant were not meaningful (because of the truncated pointer).
2020-10-16Remove leftover commented out #if 0mgorny
2020-10-15Apply fix in rev 1.2 for core_dump_procinfo to aarch64 and arm:rin
http://cvsweb.netbsd.org/bsdweb.cgi/src/tests/lib/libc/sys/t_ptrace_core_wait.h#rev1.2 > For powerpc, program counter is not automatically incremented by trap > instruction. We cannot increment PC in the trap handler, which breaks > applications depending on this behavior, e.g., GDB. This statement is true for aarch64 and arm. Also, use PTRACE_BREAKPOINT_SIZE instead of hard-coded 4 to address instruction next to PC. OK ryo
2020-10-15Fix s87_tw reconstruction to correctly indicate register statesmgorny
Fix the code reconstructing s87_tw (full tag word) from fx_sw (abridged tag word) to correctly represent all register states. The previous code only distinguished between empty/non-empty registers, and assigned 'regular value' to all non-empty registers. The new code explicitly distinguishes the two other tag word values: empty and special.
2020-10-13Bump soft/hard limits for stack to 6MB for aarch64{,eb}, where old valuerin
(~4MB) is too small to be accepted.
2020-10-09Add tests for x87 FPU registersmgorny
Reviewed by kamil
2020-10-09Rename MM_REG macro to ST_MAN, and cover fpr/xstate with itmgorny
Rename the MM_REG macro to ST_MAN, to make it clearer that it gets mantissa of ST registers which overlaps with MM registers but can be also used to read ST registers (to be used in the next commit). Extend it to cover the difference between GETFPREGS and GETXSTATE, and therefore avoid additional condition on i386. Reviewed by kamil.
2020-09-06add support for new GCC 9 warnings that may be too much to fixmrg
right now. new address-of-packed-member and format-overflow warnings have new GCC_NO_ADDR_OF_PACKED_MEMBER amd GCC_NO_FORMAT_OVERFLOW variables to remove these warnings. apply to a bunch of the tree. mostly, these are real bugs that should be fixed, but in many cases, only by removing the 'packed' attribute from some structure that doesn't really need it. (i looked at many different ones, and while perhaps 60-80% were already properly aligned, it wasn't clear to me that the uses were always coming from sane data vs network alignment, so it doesn't seem safe to remove packed without careful research for each affect struct.) clang already warned (and was not erroring) for many of these cases, but gcc picked up dozens more.
2020-08-25Fix getrandom() tests.riastradh
Use sigaction() without SA_RESTART -- signal() implies SA_RESTART so we never got the EINTR. While here, reduce the timeout to something more reasonable so we don't waste 20min of testbed time if anything goes wrong and the one-second alarm doesn't fire.
2020-08-23Split getrandom tests into several cases to find out which ones hang.riastradh
2020-08-14New system call getrandom() compatible with Linux and others.riastradh
Three ways to call: getrandom(p, n, 0) Blocks at boot until full entropy. Returns up to n bytes at p; guarantees up to 256 bytes even if interrupted after blocking. getrandom(0,0,0) serves as an entropy barrier: return only after system has full entropy. getrandom(p, n, GRND_INSECURE) Never blocks. Guarantees up to 256 bytes even if interrupted. Equivalent to /dev/urandom. Safe only after successful getrandom(...,0), getrandom(...,GRND_RANDOM), or read from /dev/random. getrandom(p, n, GRND_RANDOM) May block at any time. Returns up to n bytes at p, but no guarantees about how many -- may return as short as 1 byte. Equivalent to /dev/random. Legacy. Provided only for source compatibility with Linux. Can also use flags|GRND_NONBLOCK to fail with EWOULDBLOCK/EAGAIN without producing any output instead of blocking. - The combination GRND_INSECURE|GRND_NONBLOCK is the same as GRND_INSECURE, since GRND_INSECURE never blocks anyway. - The combinations GRND_INSECURE|GRND_RANDOM and GRND_INSECURE|GRND_RANDOM|GRND_NONBLOCK are nonsensical and fail with EINVAL. As proposed on tech-userlevel, tech-crypto, tech-security, and tech-kern, and subsequently adopted by core (minus the getentropy part of the proposal, because other operating systems and participants in the discussion couldn't come to an agreement about getentropy and blocking semantics): https://mail-index.netbsd.org/tech-userlevel/2020/05/02/msg012333.html
2020-07-17Add ppoll() a compatibility wrapper around pollts(2)kamil
Submitted by Apurva Nandan.
2020-06-26Reference PRs consistently.jruoho
2020-06-25Reference PRs consistently.jruoho
2020-06-24Fix core_dump_procinfo tests for powerpc, for which child process wasrin
stalled indefinitely in trap instruction even after PT_CONTINUE. For powerpc, program counter is not automatically incremented by trap instruction. We cannot increment PC in the trap handler, which breaks applications depending on this behavior, e.g., GDB. Therefore, we need to pass (PC + 4) instead of (void *)1 (== PC) to PT_CONTINUE when child process traps itself.
2020-06-22Work around QEMU bug #1668041 differently, by which floating-pointrin
division by zero is not correctly trapped for i386 and amd64: https://bugs.launchpad.net/qemu/+bug/1668041 Make trigger_fpe() cause integer division by zero for x86, and floating-point one for other architectures. Also, assertions for si_code in *_crash_fpe tests are commented out for now. They should be cleaned up after the bug is fixed. Now, *_crash_fpe tests are working also on powerpc. Suggested by kamil.
2020-06-22Turn trigger_fpe() back to integer division by zero for a whilerin
until QEMU bug #1668041 is fixed: https://bugs.launchpad.net/qemu/+bug/1668041 by which floating-point division by zero is not trapped correctly both on amd64 and i386. Skip *_crash_fpe tests on powerpc, where integer division by zero is never trapped.
2020-06-17Fix build for vax; Compile t_ptrace_sigchld.c with -D__TEST_FENV.rin
2020-06-17Let trigger_fpe() cause floating-point divide by zero exception, instead ofrin
integer one, which is not trapped for powerpc and aarch64. Note that it is checked in lib/libc/gen/t_siginfo whether integer divide by zero is interpreted as SIGFPE or not. Now, all *_crash_fpe tests pass for powerpc, and nothing changes for amd64 at least.
2020-06-17Regardless of __HAVE_FENV, include <fenv.h>, which itself defines __HAVE_FENV.rin
2020-06-15language sensitivitychristos
2020-06-09Add fork/vfork/posix_spawn tests for processes within pgrpkamil
New tests: - fork_setpgid - vfork_setpgid - posix_spawn_setpgid - unrelated_tracer_fork_setpgid - unrelated_tracer_vfork_setpgid - unrelated_tracer_posix_spawn_setpgid These tests trigger a kernel assert for pg_jobc going negative. The tests are temporarily skipped.
2020-06-06Add a test case to ensure that _lwp_create() fails with thethorpej
expected error code when a bad new-lwp-id pointer is passed.
2020-05-16Ignore interception of SIGCHLD signals in the debuggerkamil
Set SIGPASS for SIGCHLD for the traced child in the following tests: - unrelated_tracer_fork* - unrelated_tracer_vfork* - unrelated_tracer_posix_spawn* There is a race that SIGCHLD might be blocked during forking and dropped. PR/55241 by Andreas Gustafsson
2020-05-16Fix typo in test nameskamil
Noted by <joerg>
2020-05-16Ignore interception of SIGCHLD signals in the debuggerkamil
Set SIGPASS for SIGCHLD for the traced child in the following tests: - posix_spawn_singalmasked - posix_spawn_singalignored - fork_singalmasked - fork_singalignored - vfork_singalmasked - vfork_singalignored - vforkdone_singalmasked - vforkdone_singalignored There is a race that SIGCHLD might be blocked during forking and dropped. PR/55241 by Andreas Gustafsson
2020-05-14Ignore interception of the SIGCHLD signals.kamil
SIGCHLD once blocked is discarded by the kernel as it has the SA_IGNORE property. During the fork(2) operation all signals can be shortly blocked and missed (unless there is a registered signal handler in the traced child). This leads to a race in this test if there would be an intention to catch SIGCHLD. Fixes PR lib/55241 by Andreas Gustafsson
2020-05-11Fix potential race in ptrace(2) clone(2) testskamil
Instead of comparing old and new signal mask, just after the cloning operation, check whether the expected signal is still masked and in another test whether it is still ignored. Catch up after t_ptrace_fork_wait.h r. 1.2.
2020-05-11Fix race in fork_singalmaskedkamil
ELF RTLD after rtld.c r. 1.204 introduced locking that wraps the fork syscall. This locking changes signal mask of the calling process during the forking process. Instead of comparing old and new signal mask, just after the forking operation, check whether the expected signal is still masked and in another test whether it is still ignored.
2020-05-11Simplify previouskamil
Emit SIGKILL without a loop and without checking for exact process status once it is collected.
2020-05-11Do not fail when trying to kill a dying processkamil
A dying process can disappear for a while. Rather than aborting, retry sending SIGKILL to it.
2020-05-06Fix a bug in the futex_wake_highest_pri test case. Still fails asthorpej
expected.