summaryrefslogtreecommitdiff
path: root/tests/lib/libc/sys
AgeCommit message (Collapse)Author
2023-07-08clock_gettime(2): Fix CLOCK_PROCESS/THREAD_CPUTIME_ID.riastradh
Use same calculation as getrusage, not some ad-hoc arithmetic of internal scheduler parameters that are periodically rewound. PR kern/57512 XXX pullup-8 XXX pullup-9 XXX pullup-10
2023-07-08t_timerfd: Sprinkle slightly more diagnostics.riastradh
Might help us to see if we're off by just a little bit (maybe a tiny jitter between the hardclock timer and the monotonic clock), or if something is seriously amiss when the timerfd_block test fails sporadically.
2023-07-08t_clock_gettime: Add test for PR kern/57512.riastradh
2023-06-03bsd.own.mk: rename to CC_WNO_ADDRESS_OF_PACKED_MEMBERlukem
Provide a single variable CC_WNO_ADDRESS_OF_PACKED_MEMBER with options for both clang and gcc, to replace CLANG_NO_ADDR_OF_PACKED_MEMBER CC_NO_ADDR_OF_PACKED_MEMBER GCC_NO_ADDR_OF_PACKED_MEMBER Using the convention CC_compilerflag, where compilerflag is based on the full compiler flag name.
2023-03-20Adjust pc/npc before syscall allowing EJUSTRETURN to returnhannken
to the next instruction. Only ERESTART should return to the same instruction. Differences to sparc64 reduced. Test t_ptrace_wait:syscallemu1 now passes on sparc. Fixes PR kern/52166 "syscallemu does not work on sparc (32-bit)" Ok: Martin Husemann
2022-08-01Provide _GNU_SOURCE for t_clone now that is required to make clone()kre
visible.
2022-06-09There are two hard problems in computer science cache invalidation, namingskrll
and off-by-one errors. Fix a naming and off-by-one bug... Thanks to Tom Lane for spotting my typo.
2022-06-07PR/56865: hppa: t_ptrace_core_wait test doesn't know it must advance PC ↵skrll
after breakpoint Add __hppa__ to the list of architectures that need to advance to the instruction after the breakpoint Thanks to Tom Lane for the fix.
2022-06-04tests/lib/libc: Test mmap(2) with bad hints.riastradh
2022-05-31Avoid plabels on hppa to make some tests not crashskrll
2022-05-24s/estabilishing/establishing/ in copy pasted comment.andvar
2022-04-06Add a regression test for PR kern/52239, "Changing protections ofgson
already mmap'ed region can fail", based on the test program in the PR.
2022-04-05In the mmap_err test case, mmap the address, not the address of the address.gson
Should fix PR kern/56780.
2022-04-05When the t_mmap:mmap_err test fails due to errno not having the expectedgson
value of EINVAL, print the actual value.
2022-04-04fix various typos, mainly in comments.andvar
2022-03-26Add sparc* to the list of architectures that need an explicit addressmartin
with PT_CONTINUE in this test.
2022-03-18getrandom(2): Fix return value checks in automatic tests.riastradh
The syscall only guarantees up to 256 bytes in a single go -- if interrupted, it might return short, but if the caller requested at least 256 bytes it will definitely return 256 bytes.
2022-02-20Validate basic fcntl(2) behavior for eventfd and timerfd.thorpej
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