Commit Graph

3718 Commits

Author SHA1 Message Date
isaki
ecae8bc568 Add ATF tests for atomic_ops(3). 2019-02-17 12:24:17 +00:00
kamil
144442f947 Add new ATF t_ptrace_wait* vfork(2) tests
Add traceme_vfork_signalmasked_crash and traceme_vfork_signalignored_crash
tests for crash signals (SIGTRAP, SIGSEGV, SIGILL, SIGFPE, SIGBUS).

These new scenario assert that signal masked/ignored are delivered to
vfork(2)ed child.

All tests pass.
2019-02-17 09:29:35 +00:00
kamil
f3e7347b92 Remove redundant test from ATF t_ptrace_wait*
signal3 duplicates traceme_signalmasked_crash(SIGSEGV)
2019-02-17 05:21:49 +00:00
kamil
94af723a9a Add additional assert in traceme_signalignored_crash t_ptrace_wait* tests
Check whether sigignore is not reset on a trapsignal under a debugger.
The expected behavior is to not reset it. A side effect of resetting
signal mask is noticable especially with a software/hardware breakpoint
that changes state of a process.

Mark these tests as failing.
2019-02-17 04:57:09 +00:00
kamil
f42cdc6585 Add additional assert in traceme_signalmasked_crash t_ptrace_wait* tests
Check whether signal mask is not reset on a trapsignal under a debugger.
The expected behavior is to not reset it. A side effect of resetting
signal mask is noticable especially with a software/hardware breakpoint
that changes state of a process.

Mark these tests as failing.
2019-02-17 04:19:39 +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
kamil
53cc2476a7 Add new ATF tests traceme_signal{ignored,masked}_crash* in t_ptrace_wait*
New tests verify that crashes (from trap signals) are delivered to tracer
regardless of the signal masking or signal ignoring option enabled in the
traced child.

All tests pass.

In close future these tests will obtain additional asserts.
2019-02-15 05:06:38 +00:00
kamil
d5a7a3281b Add new ATF tests traceme_raisesignal_ignored in t_ptrace_wait*
Verify that ignoring (with SIG_IGN) in tracee
does not stop tracer from catching this raised signal.

Cover crash signals and already covered ones in other tests.

All tests pass.
2019-02-15 04:11:39 +00:00
mrg
2358f4548e implement return_one for hppa, mips, ppc64, and vax. 2019-02-14 10:36:33 +00:00
kamil
c26a89103c Replace signal2 in t_ptrace_wait* with new tests
Add new tests traceme_raisesignal_masked[1-8].

New tests to verify that masking (with SIG_BLOCK) signal in tracee
stops tracer from catching this raised signal. Masked crash signals are
invisible to tracer as well.

All tests pass.
2019-02-14 06:47:32 +00:00
kamil
0c1b4f39e5 Add new regression scenarios for crash signals in t_ptrace_wait*
Verify correct behavior of crash signals (SIGTRAP, SIGBUS, SIGILL, SIGFPE,
SIGSEGV) in existing test scenarios:
 - traceme_raise
 - traceme_sendsignal_handle
 - traceme_sendsignal_masked
 - traceme_sendsignal_ignored
 - traceme_sendsignal_simple
 - traceme_vfork_raise

These tests verify signals out of the context of CPU trap. These new tests
will help to retain expected behavior in future changes in semantics of
the trapsignals in the kernel.
2019-02-14 05:38:45 +00:00
kamil
e3a629e53f Rename signal1 to signal_mask_unrelated in t_ptrace_wait*
No functional change intended.
2019-02-12 21:35:35 +00:00
kamil
7439bd598d Refactor lwp_create1 and lwp_exit1 into trace_thread* in ptrace(2) tests
New tests:
 - trace_thread1
 - trace_thread2
 - trace_thread3
 - trace_thread4

These tests verify _lwp_create(2) and _lwp_exit(2) events. They are
currently skipped as not reliable.
2019-02-12 06:00:05 +00:00
kamil
2d4745f8b2 Rename the siginfo4 test in ATF t_ptrace_wait*
The siginfo group of ptrace(2) tests has been replaced with new individual
tests or merged into existing ones. This is the last siginfo* test that
has been renamed.

New name: traceme_exec.
2019-02-11 05:59:00 +00:00
kamil
32c33d29c1 Merge siginfo6 into other PT_STEP tests in t_ptrace_wait* 2019-02-11 05:51:20 +00:00
kamil
bfae04bf15 Drop siginfo5 from ATF tests in t_ptrace_wait*
siginfo5 duplicates older tests verifying PTRACE_FORK.
2019-02-11 04:20:06 +00:00
kamil
bc00947fe2 Initial refactoring of siginfo* tests in t_ptrace_wait*
Drop test siginfo1 as duplicated with earlier tests.

Rework and rename siginfo2 and siginfo3 into a single test body.

New tests:
 - siginfo_set_unmodified (replaces siginfo2)
 - siginfo_set_faked (replaces siginfo3)

All new tests pass.
2019-02-11 04:13:28 +00:00
mlelstv
82fe3e95ba provide a test function, avoids crashing tests with SIGSEGV. 2019-02-10 09:54:39 +00:00
kamil
5a04cbf366 Link t_ptrace_wait* tests with -pthread
While there, bump (c) for ATF ptrace(2) tests.

Add __used in infinite_thread() for consistency with other functions in
the file.
2019-02-10 02:13:45 +00:00
kamil
8ac77c305d Add initial pthread(3) tests in ATF t_prace_wait* tests
There were tested few scenarios with native _lwp_create(2) functions, using
this interface is not needed and it's easier to manage tests with
high-level pthread(3) API.

Rewrite original lwpinfo1 and lwpinfo2 tests into 8 new tests:
 - traceme_lwpinfo0 (0 spawned additional threads)
 - traceme_lwpinfo1 (1 spawned additional thread)
 - traceme_lwpinfo2 (2 spawned additional threads)
 - traceme_lwpinfo3 (3 spawned additional threads)
 - attach_lwpinfo0 (0 spawned additional threads)
 - attach_lwpinfo1 (1 spawned additional thread)
 - attach_lwpinfo2 (2 spawned additional threads)
 - attach_lwpinfo3 (3 spawned additional threads)

These tests verify primarily the PT_LWPINFO interface.

Build the t_ptrace_wait* tests with -pthread.

All tests pass.
2019-02-10 02:04:06 +00:00
kamil
fb7fe14f74 Add infinite_thread() for ptrace(2) ATF tests
infinite_thread() is designed to be spawned as a pthread(3) function.

It will be used soon in new tests.
2019-02-09 23:10:42 +00:00
scole
a253ff12d9 use HAVE_FPREGS not HAVE_FPGPREGS and move some register_t inside proper #define. fixes ia64 build. ok <kamil> 2019-02-09 23:03:01 +00:00
mrg
01ef24fd3f fix hello_profile's hello_profile_head function name. 2019-02-09 02:36:28 +00:00
mrg
f4fc04f995 add $NetBSD$ tags. 2019-02-09 00:13:19 +00:00
mrg
9ca42b4c5e add very simple test that you can link -fopenmp.
currently fails, but should work soon...
2019-02-09 00:12:14 +00:00
kamil
120dbb13e3 Refactor kill* test in t_ptrace_wait*
Drop original scenario of kill1 (PT_CONTINUE(SIGKILL)) as it duplicates
traceme_sendsignal_simple1.

New kill tests:
 - kill1: ptrace(PT_KILL) (previously kill2)
 - kill2: kill(SIGKILL)
 - kill3: killpg(SIGKILL)

All kill* tests share the same function body.

All tests pass.
2019-02-08 03:08:00 +00:00
kamil
fe7f44d815 Correct a style in description of PT_STEP tests in t_ptrace_wait* 2019-02-08 00:31:46 +00:00
kamil
60980e6752 Refactor definition of PT_STEP tests into single macro
No functional change intended.
2019-02-08 00:29:41 +00:00
kamil
c18cba814b Refactor GPR and FPR tests in t_ptrace_wait* tests
This change deduplicates the code and puts all the test into shared
function body.

No functional change except ranaming tests regs* to access_regs* and
fpregs* to access_fpregs*.
2019-02-07 23:03:33 +00:00
maxv
83ed0b5e52 Improvements:
- Emulate the instructions by executing them directly on the host CPU.
   This is easier and probably faster than doing it in software
   manually.

 - Decode SUB from Primary, CMP from Group1, TEST from Group3, and add
   associated tests.

 - Handle correctly the cases where an instruction that always implicitly
   reads the register operand is executed with the mem operand as source
   (eg: "orq (%rbx),%rax").

 - Fix the MMU handling of 32bit-PAE. Under PAE CR3 is not page-aligned,
   so there are extra bits that are valid.

With these changes in place I can boot Windows XP on Qemu+NVMM.
2019-02-07 10:58:45 +00:00
kamil
f51f2525b1 Enable 3 new ptrace(2) tests for SIGILL
Add missing code for SIGILL verification and enable new SIGILL tests:
 - traceme_crash_ill
 - traceme_vfork_crash_ill
 - unrelated_tracer_sees_crash_ill

SIGILL is caused by a crash signal and needs special treatement that has
to be asserted to behave correctly.

In the unrelated_tracer_sees_crash* tests add additional check to catch
scenarios when a test dies due to abnormal condition and it's not caught
as the tracer is collected by initproc.

All tests pass on NetBSD/amd64, other ports have temporarily unimplemented
PTRACE_ILLEGAL_ASM.
2019-02-07 00:24:59 +00:00
joerg
abf7fd5db8 movzx is not AT&T syntax, but some bastard version of Intel syntax.
Switch to the equivalent mnenomic.
2019-02-06 15:42:31 +00:00
mrg
7081cfef47 use strncpy() into a buffer that may not be nul terminated. 2019-02-06 09:16:49 +00:00
kamil
fdaf7bbf8c Add 2 new tests in t_fopen
Added:
 - fopen_nullptr (without COMPAT_10)
 - fopen_nullptr_compat10 (with COMPAT_10)

PR kern/53948

Reviewed by <mgorny>
2019-02-05 17:30:19 +00:00
maxv
0cfadc3649 Ah, I had warnings disabled, fix the build. 2019-02-05 17:03:10 +00:00
maxv
ed8fc6e9ad Add 12 tests for libnvmm's I/O Assist. 2019-02-05 13:00:03 +00:00
kamil
9e1a0a9819 Add missing break keywords in t_ptrace_wait* x86 tests
Add missing break in switch() cases in dbregs_trap_variable().

Reported by <mrg>
Detected by GCC 7
2019-02-05 02:57:10 +00:00
mrg
844d41bff8 - add __unreachable() after ATF_REQUIRE(pid > 0) where pid <= 0.
- rearrange one switch so that the -1/0/default cases are the
  same order in all instances.
2019-02-04 09:35:11 +00:00
mrg
5bb852d0c6 - tests explicitly check failure modes, ignore those warnings 2019-02-04 05:24:18 +00:00
mrg
bd9cab8c09 - make ERRX() return a value since it doesn't actually exit in the !TEST case. 2019-02-04 04:20:13 +00:00
mrg
466118942b - revert previous to t_ubsan.c, it is desired behaviour. from kamil.
- use -Wno-int-in-bool-context instead
2019-02-04 03:10:33 +00:00
mrg
37649e4074 - enlarge buffer to avoid snprintf() truncation 2019-02-03 10:48:46 +00:00
mrg
770680b518 - avoid multipling a boolean value, use &&. 2019-02-03 10:45:58 +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
mrg
fbffadb9f8 - add or adjust /* FALLTHROUGH */ where appropriate
- add __unreachable() after functions that can return but won't in
  this case, and thus can't be marked __dead easily
2019-02-03 03:19:25 +00:00
mrg
8dec05958d don't check the return value of execvp() for failure to call err().
assume if it returns at all something has failed.
2019-02-01 09:06:07 +00:00
maxv
2089a3819a Fix two issues:
* Uh I put the wrong masks in some GPRs, fuck.

 * When the opsize of MOVZX is 4, we need to combine the zero-extend from
   the instruction with the natural zero-extend of long mode.

Add two associated tests.
2019-02-01 06:49:58 +00:00
maxv
a8470e3880 Put correct values in the seg fields. AMD doesn't check for that, but Intel
does, so they need to be correct.
2019-02-01 05:32:08 +00:00
martin
d648db56e0 Move from uname -m to uname -p when checking if this target does support
ifunc - someone with a powerpc machine please double check!
2019-01-30 12:42:53 +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