Commit Graph

286 Commits

Author SHA1 Message Date
kamil 6413a1acf0 Introduce PTRACE_LWP_{CREATE,EXIT} in ptrace(2) and TRAP_LWP in siginfo(5)
Add interface in ptrace(2) to track thread (LWP) events:
 - birth,
 - termination.

The purpose of this thread is to keep track of the current thread state in
a tracee and apply e.g. per-thread designed hardware assisted watchpoints.

This interface reuses the EVENT_MASK and PROCESS_STATE interface, and
shares it with PTRACE_FORK, PTRACE_VFORK and PTRACE_VFORK_DONE.

Change the following structure:

typedef struct ptrace_state {
        int     pe_report_event;
        pid_t   pe_other_pid;
} ptrace_state_t;

to

typedef struct ptrace_state {
        int     pe_report_event;
        union {
                pid_t   _pe_other_pid;
                lwpid_t _pe_lwp;
        } _option;
} ptrace_state_t;

#define pe_other_pid    _option._pe_other_pid
#define pe_lwp          _option._pe_lwp

This keeps size of ptrace_state_t unchanged as both pid_t and lwpid_t are
defined as int32_t-like integer. This change does not break existing
prebuilt software and has minimal effect on necessity for source-code
changes. In summary, this change should be binary compatible and shouldn't
break build of existing software.


Introduce new siginfo(5) type for LWP events under the SIGTRAP signal:
TRAP_LWP. This change will help debuggers to distinguish exact source of
SIGTRAP.


Add two basic t_ptrace_wait* tests:
lwp_create1:
    Verify that 1 LWP creation is intercepted by ptrace(2) with
    EVENT_MASK set to PTRACE_LWP_CREATE

lwp_exit1:
    Verify that 1 LWP creation is intercepted by ptrace(2) with
    EVENT_MASK set to PTRACE_LWP_EXIT

All tests are passing.


Surfing the previous kernel ABI bump to 7.99.59 for PTRACE_VFORK{,_DONE}.

Sponsored by <The NetBSD Foundation>
2017-01-14 06:36:52 +00:00
kamil 14d6312469 Add new tests eventmask[34] in t_ptrace_wait{,3,4,6,id,pid}
eventmask3:
    Verify that PTRACE_VFORK in EVENT_MASK is preserved

eventmask4:
    Verify that PTRACE_VFORK_DONE in EVENT_MASK is preserved

Currently eventmask3 is failing and marked with PR kern/51630

Sponsored by <The NetBSD Foundation>
2017-01-14 04:37:55 +00:00
kamil c35cdcf1bb Update t_ptrace_wait* tests for added support for PTRACE_VFORK{,_DONE}
PTRACE_VFORK and PTRACE_VFORK_DONE are now parts of <sys/ptrace.h>.

PTRACE_VFORK tests are still failing as the support for it is currently
a stub.

Sponsored by <The NetBSD Foundation>
2017-01-13 23:22:12 +00:00
christos c54cb81102 Don't play with "../.." in includes for h_macros.h; deal with it centrally.
Minor fixes.
2017-01-13 21:30:39 +00:00
kre 97c5c4a143 Move the #ifndef/#define dance for the (currently) system undefined
PTRACE_VFORK* macros out of a function that is not always compiled
(as they are used in other functions that are.)   Unbreak the build.
2017-01-13 03:01:09 +00:00
kamil 314c5d1975 Add new tests vforkdone[12] in t_ptrace_wait{,3,4,6,id,pid}
vforkdone1:
    Verify that vfork(2) is intercepted by ptrace(2) with EVENT_MASK
    set to PTRACE_VFORK_DONE

vforkdone2:
    Verify that vfork(2) is intercepted by ptrace(2) with EVENT_MASK
    set to PTRACE_FORK | PTRACE_VFORK_DONE

As of now PTRACE_VFORK_DONE is undefined in <sys/ptrace.h>.

Sponsored by <The NetBSD Foundation>
2017-01-12 21:35:53 +00:00
christos 84802888eb need <sys/stat.h> 2017-01-10 22:10:22 +00:00
kamil 6f12d81bf6 Add new test siginfo6 in t_ptrace_wait{,3,6,6,id,pid} for ports with PT_STEP
siginfo6:
    Verify single PT_STEP call with signal information check

Sponsored by <The NetBSD Foundation>
2017-01-10 05:08:24 +00:00
kamil d7bca94546 Add new test siginfo5 in t_ptrace_wait{,3,4,6,id,pid}
siginfo5:
    Verify that fork(2) is intercepted by ptrace(2) with EVENT_MASK
    set to PTRACE_FORK and reports correct signal information

Sponsored by <The NetBSD Foundation>
2017-01-10 00:54:22 +00:00
kamil bbefe54ab6 PT_GET_SIGINFO is no longer PT_SET_SIGINFO conditional in ATF tests
This interface is MI.

Sponsored by <The NetBSD Foundation>
2017-01-09 22:09:20 +00:00
kamil 5b0bbc1439 Add new test siginfo4 in t_ptrace_wait{,3,4,6,id,pid}
siginfo4:
    Detect SIGTRAP TRAP_EXEC from tracee

This test is currently disabled and it will be enabled once
PT_[SG]ET_SIGINFO will land the sources.

Sponsored by <The NetBSD Foundation>
2017-01-06 22:40:06 +00:00
kamil 9e277af53b Add new tests siginfo[123] in t_ptrace_wait{,3,4,6,id,pid}
These tests are for the proposed PT_[GS]ET_SIGINFO interface for ptrace(2),
accessors for signal information that caused tracee to be interrupted.

siginfo1:
    Verify basic PT_GET_SIGINFO call for SIGTRAP from tracee

siginfo2:
    Verify basic PT_GET_SIGINFO and PT_SET_SIGINFO calls without
    modification of SIGINT from tracee

siginfo3:
    Verify basic PT_GET_SIGINFO and PT_SET_SIGINFO calls with
    setting signal to new value

New tests are protected with #ifded and currently disabled in the HEAD branch.
They will be automatically enabled once the final implementation will land the
sources.

Sponsored by <The NetBSD Foundation>
2017-01-04 22:27:20 +00:00
kamil d36d9d0066 Fix typo in atf_tc_set_md_var(): baic -> basic
No functional change.
2017-01-02 21:02:03 +00:00
kamil 664dff8c85 Remove unused macro for ATF_TP_ADD_TC_HAVE_DBREGS
This code is unused.

Sponsored by <The NetBSD Foundation>
2016-12-30 17:29:34 +00:00
christos 272d6823df fix clang build. 2016-12-17 03:43:38 +00:00
kamil b486a76971 Add ATF tests for hardware assisted watchpoints on amd64
Addedd tests:
 - watchpoint_count
 - watchpoint_read
 - watchpoint_write_unmodified
 - watchpoint_trap_code[0123]
 - watchpoint_trap_data_write[0123]
 - watchpoint_trap_data_rw[0123]

These code will be reused later for i386 and moved to a common place like
tests/kernel/arch/x86.

These tests are x86 specific only. The same API but different private
ptrace_watchpoint MD part has to be used on other ports.

All tests pass on amd64.

Sponsored by <The NetBSD Foundation>
2016-12-15 12:15:20 +00:00
kamil a513f40fac Prepare t_ptrace_wait.h for hardware watchpoints API
Add new symbol ATF_TP_ADD_TC_HAVE_PTRACE_WATCHPOINTS() to be protected with
the __HAVE_PTRACE_WATCHPOINTS guard.


XXX:
    Mark check_happy() with __attribute__((optimize("O0"))).
    Disabled optimization is required to make tests for hardware assisted
    traps in .text functional.

    Tested with GCC 5.4 on NetBSD 7.99.47 amd64

Sponsored by <The NetBSD Foundation>
2016-12-15 08:57:24 +00:00
kamil 15bac0f54a Define -D_KERNTYPES in CPPFLAGS unconditionally to fix MKRUMP=no build
Reported by Robert Swindells

Sponsored by <The NetBSD Foundation>
2016-12-14 06:19:59 +00:00
kamil b8092d5dfa Add regs1 in arch/i386/t_ptrace_wait*
regs1:
    Call PT_GETREGS and iterate over General Purpose registers

Sponsored by <The NetBSD Foundation>
2016-12-13 18:00:10 +00:00
kamil 9feae32a7c Remove dbregs* in arch/amd64/t_ptrace_wait*
CPU Debug Registers won't be exposed as is to userland.

Hardware Watchpoints will be exported to userland dedicated interface
through the ptrace(2) interface.

Sponsored by <The NetBSD Foundation>
2016-12-13 13:09:00 +00:00
kamil 5f84086eb7 Add regs1 in arch/amd64/t_ptrace_wait*
regs1:
    Call PT_GETREGS and iterate over General Purpose registers

Sponsored by <The NetBSD Foundation>
2016-12-13 13:04:18 +00:00
kamil f9bea37eb4 Define in CPPFLAGS symbol _KERNTYPES in order to get PRIxREGISTER
This type will be used in t_ptrace_wait* for the printf(3) function.

Sponsored by <The NetBSD Foundation>
2016-12-13 12:59:46 +00:00
kamil 2826f37556 Remove dbregs[12] from t_ptrace_wait{,3,4,6,id,pid}
CPU Debug Registers won't be exposed as is to userland.

Hardware Watchpoints will be exported to userland dedicated interface
through the ptrace(2) interface.

Sponsored by <The NetBSD Foundation>
2016-12-13 12:25:05 +00:00
kamil 4b927362a8 Fix Clang/LLVM build
Reported error:
    src/tests/kernel/t_ptrace_wait.c:4401:33:
    error: missing field 'pl_event' initializer
            [-Werror,-Wmissing-field-initializers]

Line in the code:
    struct ptrace_lwpinfo info = {0};

Appease it with initializing info to {0, 0}.

Sponsored by <The NetBSD Foundation>
2016-12-08 13:32:17 +00:00
kamil 9d8a67c608 Stop using atf_utils_fork() in tests/kernel/arch/amd64/t_ptrace_wait.c
Switch from:
    child = atf_utils_fork();
to:
    ATF_REQUIRE((child = fork()) != -1);

Prefer the latter as working as intended and not outputing to files with
danger to overwrite files' content after each fork in test-suite.

Discussed with Christos Zoulas.

Sponsored by <The NetBSD Foundation>
2016-12-07 22:24:44 +00:00
christos 319746a2a5 switch to using fork so we can see the child output. 2016-12-06 18:59:00 +00:00
kamil f38bfbe41f Clean up after fixes and refactoring by Christos Zoulas
No functional change, remove dead and unneeded code.

Sponsored by <The NetBSD Foundation>
2016-12-06 08:03:09 +00:00
christos 3d6c55098c fix lwpinfo2 2016-12-05 22:05:53 +00:00
christos 7649084649 Fix the tests that broke after my changes.
XXX: This code is heavily duplicated and needs some merging.
2016-12-05 21:20:38 +00:00
christos 908ba66926 - abstract the pipe calls into routines.
- some of the tests that worked (really failed silently before) now fail.
2016-12-05 20:10:10 +00:00
kamil 7335a780bf Mark again lwpinfo2 with expected failure in t_ptrace_wait{,3,4,6,id,pid}
Only failure lwpinfo1 was addressed, not lwpinfo2.

PR kern/51685

Sponsored by <The NetBSD Foundation>
2016-12-05 07:18:10 +00:00
kamil e01acbd702 lwpinfo1 and lwpinfo2 in t_ptrace_wait{,3,4,6,id,pid} no longer fails
Remove atf_tc_expect_fail() linked with PR kern/51685.

Issue fixed by Christsos Zoulas in src/sys/kern/kern_sig.c r. 1.331

Sponsored by <The NetBSD Foundation>
2016-12-04 23:48:02 +00:00
kamil 1a4e4ead74 Add dbregs_dr[0123]_trap_variable in arch/amd64/t_ptrace_wait*
Add new preliminary tests for testing that CPU Debug Registers can be used
to trap on a variable (write operation).

dbregs_dr0_trap_variable:
    Verify that setting trap with DR0 triggers SIGTRAP

dbregs_dr1_trap_variable:
    Verify that setting trap with DR1 triggers SIGTRAP

dbregs_dr2_trap_variable:
    Verify that setting trap with DR2 triggers SIGTRAP

dbregs_dr3_trap_variable:
    Verify that setting trap with DR3 triggers SIGTRAP

Sponsored by <The NetBSD Foundation>
2016-12-04 03:38:58 +00:00
kamil a58716a3f0 Add new tests lwpinfo1 in t_ptrace_wait* and lwpinfo2 under HAVE_PID guard
lwpinfo1:
    Verify baic LWPINFO call for single thread (PT_TRACE_ME)

lwpinfo2:
    Verify baic LWPINFO call for single thread (PT_ATTACH from tracer)

Both tests are marked as expected failure PR kern/51685:
    ptrace(2): Signal does not set PL_EVENT_SIGNAL in
    (struct ptrace_lwpinfo.)pl_event

Sponsored by <The NetBSD Foundation>
2016-12-03 07:23:08 +00:00
kamil 4b9f3a9f8a Define new tests for CPU Debug Registers in t_ptrace_wait{,3,4,6,id,pid}
Rename dbregs1 to dbregs_print
Rename dbregs[2345] to dbregs_preserve_dr[0123]

Add new tests dbregs_preserve_dr[0123]_yield.

dbregs_preserve_dr0_yield:
     Verify that setting DR0 is preserved across ptrace(2) calls with
     scheduler yield

dbregs_preserve_dr1_yield:
     Verify that setting DR1 is preserved across ptrace(2) calls with
     scheduler yield

dbregs_preserve_dr2_yield:
     Verify that setting DR2 is preserved across ptrace(2) calls with
     scheduler yield

dbregs_preserve_dr3_yield:
     Verify that setting DR3 is preserved across ptrace(2) calls with
     scheduler yield

Add new tests dbregs_preserve_dr[0123]_continued.

dbregs_preserve_dr0_continued:
    Verify that setting DR0 is preserved across ptrace(2) calls and with
    continued child

dbregs_preserve_dr1_continued:
    Verify that setting DR1 is preserved across ptrace(2) calls and with
    continued child

dbregs_preserve_dr2_continued:
    Verify that setting DR2 is preserved across ptrace(2) calls and with
    continued child

dbregs_preserve_dr3_continued:
    Verify that setting DR3 is preserved across ptrace(2) calls and with
    continued child

Use more meaningful names for these tests as they are MD specific and
testing precise functionality. Also there will be a growing number of
tests in this category and prefixing everything with plain dbregs and
trailing with a number cannot be verbose.

Sponsored by <The NetBSD Foundation>
2016-12-03 01:41:15 +00:00
kamil 0904a3bc79 Add new tests dbregs[2345] in MD arch/amd64/ t_ptrace_wait{,3,4,6,id,pid}
dbregs2:
    Verify that setting DR0 is preserved across ptrace(2) calls

dbregs3:
    Verify that setting DR1 is preserved across ptrace(2) calls

dbregs4:
    Verify that setting DR2 is preserved across ptrace(2) calls

dbregs5:
    Verify that setting DR3 is preserved across ptrace(2) calls

These tests are deliberately fine-grained as they are expected to penetrate
precisely each functional aspect of CPU Debug Registers on amd64 one after
another.

These tests (and MI ones) might be generated or merged with helper
functions, however in order to copy-and-paste them out of a test-suite and
quickly port to other platform (in order to compare results) it's useful to
keep them as stand-alone as they are.

Code from these tests might be shared with other ports in future, for the
same reason keep them currently as they are.

Sponsored by <The NetBSD Foundation>
2016-12-02 06:49:00 +00:00
kamil 96cf2030eb Refactor location of amd64-specific ATF tests to new dir kernel/arch/amd64
Rename
 - tests/kernel/t_ptrace_amd64_wait.c
to
 - tests/kernel/arch/amd64/t_ptrace_wait.c
and adapt appropriate files accordingly.

New directory will be used for more amd64-specific tests, verifying the
MD parts of the kernel.

Remove old entries from distrib/sets/lists as they were added a while ago.

Sponsored by <The NetBSD Foundation>
2016-12-02 05:54:14 +00:00
kamil 6df343d465 Add new test file t_ptrace_amd64_wait.c and refactor t_ptrace_*wait* tests
Clone t_ptrace_wait.c to t_ptrace_amd64_wait.c and put common parts to
t_ptrace_wait.h.

The t_ptrace_amd64_wait.c file is dedicated to hold amd64-specific tests
for the ptrace(2) interface.

Add new basic test dbreg1 in t_ptrace_amd64_wait{,3,4,6,id,pid}:
    Verify plain PT_GETDBREGS with printing Debug Registers

Fix evbarm64-aarch64 issue pointed by <christos>, kill1 and kill2 tests
must be defined without PT_STEP guards.

Sponsored by <The NetBSD Foundation>
2016-12-01 20:11:17 +00:00
kamil 26286941d5 Add new tests kill[12] in t_ptrace_wait{,3,4,6,id,pid}
New tests verify that PT_CONTINUE with SIGKILL is equivalent to PT_KILL.

kill1:
    Verify that PT_CONTINUE with SIGKILL terminates child

kill2:
    Verify that PT_KILL terminates child

Sponsored by <The NetBSD Foundation>
2016-11-30 21:12:53 +00:00
kamil 8834a805a6 Add new tests dbregs[12] in t_ptrace_wait{,3,4,6,id,pid}
dbregs1:
    Verify plain PT_GETDBREGS call without further steps

dbregs2:
    Verify PT_GETDBREGS and PT_SETDBREGS calls without changing regs

These tests are to be used to verify CPU Debug Register accessors in the
ptrace(2) interface.

Additionally fix also fpregs2 test to really call PT_SETFPREGS.

Sponsored by <The NetBSD Foundation>
2016-11-29 21:58:13 +00:00
kamil 1843779dc6 Add more tests for PT_STEP step[234] in t_ptrace_wait{,3,4,6,id,pid}
step2:
    Verify PT_STEP called twice

step3:
    Verify PT_STEP called three times

step4:
    Verify PT_STEP called four times

The purpose of these tests is to assert that PT_STEP can be called more
than once and it sill works.

Sponsored by <The NetBSD Foundation>
2016-11-29 21:31:45 +00:00
kamil dc4348e29b Add new test step1 in t_prace_wait{,3,4,6,id,pid} under PT_STEP guards
step1:
   Verify single PT_STEP call.

This function is calculating happy numbers just to consume CPU cycles for
the test purpose.

PT_STEP raises SIGTRAP to by caught by a debugger.

Sponsored by <The NetBSD Foundation>
2016-11-28 21:37:00 +00:00
kamil 83cbb4a834 Print integers as hex with %#x rather than with plain %x
# if used with o, x or X specifiers the value is preceeded with 0, 0x or 0X
respectively for values different than zero.

Noted by <christos>

Sponsored by <The NetBSD Foundation>
2016-11-26 02:34:49 +00:00
kamil af6e917d6c Fix several printf(3)-like functions usage with printing integers
Integers as hex shall no be printed with PRIx8, but with plain "x".

Pointed by <christos>

Sponsored by <The NetBSD Foundation>
2016-11-25 20:01:05 +00:00
kamil fb0931daa7 Add fpregs[12] in t_ptrace_wait{,3,4,6,id,pid}
fpregs1:
    Verify plain PT_GETFPREGS call without further steps

fpregs2:
    Verify PT_GETFPREGS and PT_SETFPREGS calls without changing regs

Sponsored by <The NetBSD Foundation>
2016-11-24 22:52:03 +00:00
kamil 3bd0170534 Drop unwanted printf(3) call in regs5 in t_ptrace
This call is reserved for other test.

Sponsored by <The NetBSD Foundation>
2016-11-24 04:11:16 +00:00
kamil 07f3b8e854 Add regs[12345] in t_ptrace_wait{,3,4,6,id,pid}
Add new ATF tests for the general purpose register calls.

These tests require platforms to export all of the following macros:
 - PT_GETREGS
 - PT_SETREGS
 - PTRACE_REG_PC
 - PTRACE_REG_SET_PC
 - PTRACE_REG_SP
 - PTRACE_REG_INTRV

This has been done for the sake of C preprocessor magic simplicity.
There are ports without covering all of the above symbols -- skip them.

Added tests
===========

regs1:
    Verify plain PT_GETREGS call without further steps

regs2:
    Verify plain PT_GETREGS call and retrieve PC

regs3:
    Verify plain PT_GETREGS call and retrieve SP

regs4:
    Verify plain PT_GETREGS call and retrieve INTRV

regs5:
    Verify PT_GETREGS and PT_SETREGS calls without changing regs

Sponsored by <The NetBSD Foundation>
2016-11-24 04:08:37 +00:00
kamil 6f188f1097 Add {,io_}read_i[1234] in t_ptrace_wait{,3,4,6,id,pid}
New tests are direct counterparts to the existing ones {,io_}read_d[1234].

PT_READ_D and PIOD_READ_D (from PT_IO) are traditionally used to transfer
data segment. New tests make use of PT_READ_I and PIOD_READ_I (from PT_IO)
in order to copy text segment from traced process.

    Traditionally, ptrace() has
    allowed for machines with distinct address spaces for
    instruction and data, which is why there are two requests:
    conceptually, PT_READ_I reads from the instruction space
    and PT_READ_D reads from the data space.  In the current
    NetBSD implementation, these two requests are completely
    identical.

    --- ptrace(2)

New tests follow the traditional convention and copy only instructions from
dummy functions.

There are no new tests copying data to .text regions from the traced
process, as this is violating mprotect restrictions. This limitation may be
addressed in future, as there are dedicated sysctl(7) handlers for
debuggers (currently mainly gdb(1)).

Tests verifying identical behavior of PT_READ_I and PT_READ_D are not
planned.

Sponsored by <The NetBSD Foundation>
2016-11-23 23:30:50 +00:00
kamil d1ca0f5b0b Add new tests read_d_write_d_handshake[12] in t_ptrace_wait{,3,4,6,id,pid}
read_d_write_d_handshake1:
    Verify PT_READ_D with PT_WRITE_D handshake

read_d_write_d_handshake2:
    Verify PT_WRITE_D with PT_READ_D handshake

Sponsored by <The NetBSD Foundation>
2016-11-23 21:14:23 +00:00
kamil 81f61f06eb Rename read* and write* tests to read_d* and write_d*
The purpose of renaming is to make room for PT_READ_I and PT_WRITE_I type
ptrace(2) tests.

Sponsored by <The NetBSD Foundation>
2016-11-23 20:56:47 +00:00
kamil 9e97be1540 Add new test io_read_d_write_d_handshake2 in tests/kernel/t_ptrace_wait.c
Rename io_read_write_handshake to io_read_d_write_d_handshake1.

io_read_d_write_d_handshake2:
    Verify PT_IO with PIOD_WRITE_D and PIOD_READ_D handshake

This new test first writes and later reads data.
io_read_d_write_d_handshake1 first reads and later writes.

Sponsored by <The NetBSD Foundation>
2016-11-23 19:46:51 +00:00
kamil 618a4d33b4 Add io_read_write_handshake to t_ptrace_wait{,3,4,6,id,pid}
Verify PT_IO with PIOD_READ_D and PIOD_WRITE_D handshake

Sponsored by <The NetBSD Foundation>
2016-11-23 05:00:20 +00:00
kamil 36b77035bc Add new tests read[1234] in t_ptrace_wait{,3,4,6,id,pid}
read1:
    Verify PT_READ_D called once

read2:
    Verify PT_READ_D called twice

read3:
    Verify PT_READ_D called three times

read4:
    Verify PT_READ_D called four times

Sponsored by <The NetBSD Foundation>
2016-11-23 03:02:56 +00:00
kamil 79f7742f7e Add new tests io_write_d[1234] in t_ptrace_wait{,3,4,6,id,pid}
write1:
    Verify PT_WRITE_D called once

write2:
    Verify PT_WRITE_D called twice

write3:
    Verify PT_WRITE_D called three times

write4:
    Verify PT_WRITE_D called four times

Sponsored by <The NetBSD Foundation>
2016-11-23 01:49:05 +00:00
kamil c255d6a0af Add new tests io_write_d[1234] in t_ptrace_wait{,3,4,6,id,pid}
io_write_d1:
    Verify PT_IO with PIOD_WRITE_D and len = sizeof(uint8_t)

io_write_d2:
    Verify PT_IO with PIOD_WRITE_D and len = sizeof(uint16_t)

io_write_d3:
    Verify PT_IO with PIOD_WRITE_D and len = sizeof(uint32_t)

io_write_d4:
    Verify PT_IO with PIOD_WRITE_D and len = sizeof(uint64_t)

Sponsored by <The NetBSD Foundation>
2016-11-22 21:59:32 +00:00
kamil e6698e30f0 Add new tests io_read_d[1234] in t_ptrace_wait{,3,4,6,id,pid}
io_read_d1:
    Verify PT_IO with PIOD_READ_D and len = sizeof(uint8_t)

io_read_d2:
    Verify PT_IO with PIOD_READ_D and len = sizeof(uint16_t)

io_read_d3:
    Verify PT_IO with PIOD_READ_D and len = sizeof(uint32_t)

io_read_d4:
    Verify PT_IO with PIOD_READ_D and len = sizeof(uint64_t)

Sponsored by <The NetBSD Foundation>
2016-11-22 19:46:26 +00:00
kamil 7fa7b9b171 Add vfork1 test in t_ptrace_wait* and vfork2 in t_ptrace_wait{4,6,id,pid}
These tests are exact clones for fork1 and fork2, however testing vfork(2).

vfork1:
    Verify that vfork(2) is intercepted by ptrace(2) with EVENT_MASK set to
    PTRACE_VFORK.

vfork2:
    Verify that vfork(2) is not intercepted by ptrace(2) with empty
    EVENT_MASK.

vfork1 is supposed to test currently unimplemented PTRACE_VFORK option in
EVENT_MASK, marked as failure and linked with PR kern/51630.

Sponsored by <The NetBSD Foundation>
2016-11-15 21:50:38 +00:00
kamil 4179cd8d9b Add new test fork2 in t_ptrace_wait*
Verify that fork(2) is not intercepted by ptrace(2) with empty EVENT_MASK.

This test works with all wait(2)-like functions.

Debugger receives only SIGCHLD from tracee, when its the child of tracee
exits. Tracer notes nothing about fork(2) events.

Sponsored by <The NetBSD Foundation>
2016-11-15 20:59:11 +00:00
kamil c7db20ac6f Add new test fork1 in t_ptrace_wait{4,6,id,pid}
Verify that fork(2) is intercepted by ptrace(2) with EVENT_MASK set to
PTRACE_FORK.

In this test tracee calls fork(2) and this event is noted by tracer, both
for forker and forkee with PT_GET_PROCESS_STATE reporting pe_report_event
equal to PTRACE_FORK and pe_other_pid as forkee for forker and forker for
forkee.

The fork(2) event in the current implementation stops forker and forkee
with the SIGTRAP signal.

Exited forkee stops forker with the SIGCHLD signal.

Sponsored by <The NetBSD Foundation>.
2016-11-15 19:30:28 +00:00
kamil 3388a5a714 Add eventmask1 and eventmask2 in t_ptrace_wait*
Add basic tests verifying that value between PT_SET_EVENT_MASK and
PT_GET_EVENT_MASK is preserved between two ptrace(2) calls.

eventmask1: Verify that empty EVENT_MASK is preserved
eventmask2: Verify that PTRACE_FORK in EVENT_MASK is preserved

Currently the only supported event in ptrace(2) is PTRACE_FORK.

These tests are appropriate for all wait(2)-like functions.

Sponsored by <The NetBSD Foundation>
2016-11-15 02:53:32 +00:00
kamil a57f516cd9 Clean up t_ptrace_wait.c
Remove trailing white space
Remove fflush(3) calls [previously added for debugging purposes]
Correct comment /proc/curproc/stat -> /proc/curpros/status
The status file is native for NetBSD, stat for Linux compatibility

No functional change.

Sponsored by <The NetBSD Foundation>
2016-11-15 02:20:50 +00:00
kamil 0bdd8fbaba Add new tests attach6 and attach7 in t_wait_proc{4,6,id,pid}
attach6:
    Assert that tracer sees its parent when attached to tracer (check
    sysctl(7) and struct kinfo_proc2)

attach7:
    Assert that tracer sees its parent when attached to tracer (check
    /proc/curproc/status 3rd column).

Currently these tests fail as getppid() and parent id obtained in these
alternative ways differ.

Sponsored by <The NetBSD Foundation>
2016-11-14 04:55:57 +00:00
kamil 92c0e7fdb1 Enhance pipe(2)-based IPC barrier in attach5 of t_ptrace_wait
The write(2) call does not block and there is need to perform handshake, in
order to wait on the read(2) call.

The pipe(2) interface for IPC purposes is quite difficult to design and get
right. It might be refactored and with added new helper functions, although
it would be better to switch to some other mechanism rather. But as it
works now quite well in the current set of tests, do not touch it.

Sponsored by <The NetBSD Foundation>.
2016-11-14 00:18:33 +00:00
kamil e124526d89 Add attach_pid1_securelevel in t_ptrace
Assert that a debugger cannot attach to PID 1 with securelevel >= 1 (as root).

Test requested by <mrg>

Sponsored by <The NetBSD Foundation>
2016-11-13 22:59:31 +00:00
christos 2ef9150db4 add on more synchronization point 2016-11-12 20:56:49 +00:00
christos 224320bcba back to expecting SIGSTOP after ptrace 2016-11-12 20:03:53 +00:00
christos 7b9127fdbc add an assert that prints the values, and remove expected failure. 2016-11-12 19:44:59 +00:00
kamil 7e1ce67124 Expect SIGSTOP in attach3 in t_ptrace_wait{,3,4,6,id,pid}
Set SIGSTOP as expected signal in attach3, is it is preferred in general.
Not just because FreeBSD and Linux work this way, but to make it consistent
and regardless of relation between tracee and tracer always get the same
signal.

attach3 tests parent attaching with PT_ATTACH to its child

Sponsored by <The NetBSD Foundation>
2016-11-12 16:33:48 +00:00
christos 9c610b0a94 - Unbuffer stdout and stderr, because the tracee ends up with with the tracers
unflushed buffers, and that confuses things.
2016-11-12 16:23:43 +00:00
christos 9b1476576b - Add a 3 way handshake between the tracer and the tracee to make sure the
tracer got a chance to run before we trace it.
- Unbuffer stdout and stderr, because the tracee ends up with with the tracers
  unflushed buffers, and that confuses things.
2016-11-12 16:23:36 +00:00
kamil f5d5aaf97e Add new test attach5 in t_ptrace_wait{4,6,id,pid}
Assert that tracer sees its parent when attached to tracer.

This test is designed only for wait(2) members with ability to specify the
PID value. This propery excludes wait(2) and wait3(2).

Add new helper macro ATF_TP_ADD_TC_HAVE_PID() enabing tests when
TWAIT_HAVE_PID is defined.

This test fails and is linked with the following issue: PR kern/51624.

Sponsored by <The NetBSD Foundation>.
2016-11-12 14:48:55 +00:00
kamil 83d5aa4c38 Add new test attach4 in t_ptrace_wait{,3,4,6,id,pid}
Assert that tracer child can PT_ATTACH to its parent.

Sponsored by <The NetBSD Foundation>.
2016-11-12 12:54:32 +00:00
christos 5e11bfaeb7 clear failure, print signals symbolically. 2016-11-11 17:08:54 +00:00
kamil 9dd27382de Add new test t_ptrace_attach3 in t_ptrace
Assert that tracer parent can PT_ATTACH to its child.
This test is for all members of the wait(2) family.

Currently it is marked as an explicit failure PR kern/51621.

I faced the following issues (noted and discussed in the bug report):

- PT_ATTACH seems to work, but waiting for stopped status and signal from the
  child results in getting SIGTRAP, not SIGSTOP like in Linux and FreeBSD. This
  might be by design, I'm unsure. However, so far I was getting SIGSTOP from a
  tracer process that was not the parent. SIGSTOP vs SIGTRAP logic also
  complicates the things up as tracer must check whether is a parent for tracee
  or not - this shouldn't be needed.

- PT_CONTINUE seems to have no effect at all, the child hangs. This operation
  works on Linux and FreeBSD and in the end, test passes correctly.

- Debugging this with gdb(1) results in receiving SIGABRT from the GNU
  debugger (in the moment of raising/receiving SIGTRAP). This is making the
  things harder in general.

Sponsored by <The NetBSD Foundation>.
2016-11-11 12:01:14 +00:00
kamil cb35b27d7a Add new test attach2 in t_ptrace_wait{4,6,id,pid}
This test asserts that any tracer sees process termination before its
parent.

This test is not applicable for wait(2) and wait(3) as these interfaces
cannot get specified process id argument (PID).

Sponsored by <The NetBSD Foundation>.
2016-11-10 18:33:52 +00:00
kamil 452a799ce2 Add new test attach_chroot in t_ptrace
Assert that a debugger cannot trace another process unless the process's
root directory is at or below the tracing process's root.

Sponsored by <The NetBSD Foundation>.
2016-11-08 14:49:04 +00:00
kamil 405f1698e4 Add new test attach_self in t_ptrace
Assert that a debugger cannot attach to self (as it's nonsense).
NetBSD returs here EINVAL.

Clean up unused header includes.

Sponsored by <The NetBSD Foundation>.
2016-11-08 11:21:41 +00:00
kamil 5cc56ca0a8 Add new tests for combination of wait(2) interfaces with ptrace(2)
Move out wait(2) specific tests from t_ptrace and put them to t_ptrace_wait

Add generic code fragments to reuse the same source-code for every member
of the wait(2) family, namely:
 - wait(2)
 - waitpid(2)
 - waitid(2)
 - wait3(2)
 - wait4(2)
 - wait6(2)

Currently in the new test-suite there are the following tests:
 - traceme1
 - traceme2
 - traceme3
 - traceme4
 - attach1

Not all tests are possible to be executed against every wait(2)-like
interface, therefore they will be disabled in such case. Currently this
limits attach1 to waitpid(2), waitid(2), wait4(2), wait6(2), while the
other tests (traceme 1-4) run with all of the interfaces.

The construct of this file is dedicated for addition of new tests in the
close future.

As of now all of the tests pass correctly.

Thanks for Robert Elz for suggestions on improving the code (earlier draft
of this new form).

Sponsored by <The NetBSD Foundation>.
2016-11-07 21:09:03 +00:00
kamil eee4e242cc Run the attach_pid1 test (from t_ptrace) in unprivileged mode
Add in ATF_TC_HEAD() of attach_pid1 the following code to run it as
non-root: atf_tc_set_md_var(tc, "require.user", "unprivileged");

Solution pointed out by Nicolas Joly.

Sponsored by <The NetBSD Foundation>.
2016-11-06 21:47:53 +00:00
kamil 4bb815e68e Add new tests attach_pid0 and attach_pid1 to t_ptrace
attach_pid0 asserts that it is not valid to attach PID 0 as it is a special
kernel process.

assert_pid1 asserts that non-root user cannot attach to PID 1 as it is the
/dev/init process. This tests is skipped if run as root.

Sponsored by <The NetBSD Foundation>.
2016-11-06 16:24:16 +00:00
kamil 41d2cf1b30 attach1 in t_ptrace no longer fails
Christos Zoulas fixed the issue that a parent sees termination of its child
before a tracer observing it for its tracee.

Many thanks to Christs for his help, he makes progress with tests so quick.

Closes PR kern/51600

Sponsored by <The NetBSD Foundation>.
2016-11-05 15:52:35 +00:00
kamil b057fe9bfd Add new test attach1 in t_ptrace
This test asserts that tracer sees process termination before the parent

Currently this is not true for NetBSD.

The problem has been reported in gnats as kern/51600.

Originally an early version of this test triggered kernel panic, that
was fixed by Christos Zoulas -- thanks! Appropriate fixes are as follows:
http://mail-index.netbsd.org/source-changes/2016/11/04/msg078868.html
http://mail-index.netbsd.org/source-changes/2016/11/04/msg078869.html

Mark this test as expected failure and linked with proper PR.

As an interesting note, this test uses pipe(2) to perform IPC. Use for
messages uint8_t message to be sure that it will never by transmitted
partially from a caller to a callee, this assumption simplifies the code.

Add local function await_zombie() that takes process identifier (pid).
This function uses the sysctl(7) interface to probe p_stat of a requested
process and compares it with LSZOMB.

Try to keep closing all unneeded file descriptors for pipes in order to not
run out of fds later.

Sponsored by <The NetBSD Foundation>.
2016-11-05 01:49:53 +00:00
kamil e70724aaaf The problem with WIFCONTINUED() and WIFSTOPPED() in traceme4 is resolved
Fixed by Christos Zoulas in:
cvs rdiff -u -r1.260 -r1.261 src/sys/kern/kern_exit.c
http://mail-index.netbsd.org/source-changes/2016/11/03/msg078852.html

This has been verified to work on NetBSD releng machines.

Closes PR kern/51596

Sponsored by <The NetBSD Foundation>.
2016-11-04 09:08:11 +00:00
kamil a46fa40c88 Add FORKEE_ASSERTX()/FORKEE_ASSERT() for forkee; simplify code
A child process cannot call atf functions and expect them to magically
work like in the parent.
The printf(3) messaging from a child will not work out of the box as well
without estabilishing a communication protocol with its parent. To not
overcomplicate the tests - do not log from a child and use err(3)/errx(3)
wrapped with FORKEE_ASSERT()/FORKEE_ASSERTX() as that is guaranteed to work.

Simplify and cleanup code of the tests.

Sponsored by <The NetBSD Foundation>.
2016-11-03 20:24:18 +00:00
kamil 7e50848df6 Simplify code, prefer strerror(3) over sys_errlist(3)
No functional change intended.

strerror(3) change requested by <kre>.
Sponsored by <The NetBSD Foundation>.
2016-11-03 18:54:16 +00:00
kamil 8fa3e407e9 Mark ptraceme4 as expected failure, assume that Linux&FreeBSD are correct
Raising SIGCONT from a ptrace(2)d child should be catched with waidpid(2)
as WIFCONTINUED() false and WIFSTOPPED() true; not both true as it does not
make much sense.

PR kern/51596

Change requested by <kre>
Checked by <christos>

Sponsored by <The NetBSD Foundation>
2016-11-03 18:25:54 +00:00
kamil 9a8dc0b4a1 Add new test traceme4 in t_ptrace
This test verifies calling raise(2) with the SIGCONT argument in the child.
The parent is notified with it and asserts that WIFCONTINUED() and
WIFSTOPPED() are both set.

XXX: This behavior is surprising. Linux for the same code-path returns false
for WIFCONTINUED() and true for WIFSTOPPED().

Include <stdlib.h> for EXIT_FAILURE.

This code covers (uncovers issues?) WIFCONTINUED() and is the last planned
test in the ptraceme category.

Sponsored by <The NetBSD Foundation>.

For future reference and convenience, an out-of-ATF test is as follows:
#include <sys/param.h>
#include <sys/types.h>
#include <sys/ptrace.h>
#include <sys/wait.h>
#include <assert.h>
#include <err.h>
#include <errno.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>

#define ATF_REQUIRE(a) assert(a)

#if defined(linux)
#define WALLSIG __WALL
#define sys_signame sys_siglist
#endif

int main(int argc, char **argv)
{
        int status;
        const int exitval = 5;
        const int sigval = SIGSTOP, sigsent = SIGCONT;
        pid_t child, wpid;

        printf("1: Before forking process PID=%d\n", getpid());
        ATF_REQUIRE((child = fork()) != -1);
        if (child == 0) {
                /* printf(3) messages from a child aren't intercepted by ATF */
                /* "2: Child process PID=%d\n", getpid() */

                /* "2: Before calling ptrace(PT_TRACE_ME, ...)\n" */
                if (ptrace(PT_TRACE_ME, 0, NULL, 0) == -1) {
                        /* XXX: Is it safe to use ATF functions in a child? */
                        err(EXIT_FAILURE, "2: ptrace(2) call failed with "
                            "status %s", sys_errlist[errno]);
                }

                /* "2: Before raising SIGSTOP\n" */
                raise(sigval);

                /* "2: Before raising SIGCONT\n" */
                raise(sigsent);

                /* "2: Before calling _exit(%d)\n", exitval */
                _exit(exitval);
        } else {
                printf("1: Parent process PID=%d, child's PID=%d\n", getpid(),
                    child);

                printf("1: Before calling waitpid() for the child\n");
                wpid = waitpid(child, &status, 0);

                printf("1: Validating child's PID (expected %d, got %d)\n",
                    child, wpid);
                ATF_REQUIRE(child == wpid);

                printf("1: Ensuring that the child has not been exited\n");
                ATF_REQUIRE(!WIFEXITED(status));

                printf("1: Ensuring that the child has not been continued\n");
                ATF_REQUIRE(!WIFCONTINUED(status));

                printf("1: Ensuring that the child has not been terminated "
                    "with a signal\n");
                ATF_REQUIRE(!WIFSIGNALED(status));

                printf("1: Ensuring that the child has been stopped\n");
                ATF_REQUIRE(WIFSTOPPED(status));
                printf("1: Verifying that he child has been stopped with the"
                    " %s signal (received %s)\n", sys_signame[sigval],
                    sys_signame[WSTOPSIG(status)]);
                ATF_REQUIRE(WSTOPSIG(status) == sigval);

                printf("1: Before resuming the child process where it left "
                    "off and without signal to be sent\n");
                ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0)
                    != -1);

                printf("1: Before calling waitpid() for the child\n");
                wpid = waitpid(child, &status, WALLSIG);

                printf("1: Validating that child's PID is still there\n");
                ATF_REQUIRE(wpid == child);

                printf("1: Ensuring that the child has not been exited\n");
                ATF_REQUIRE(!WIFEXITED(status));

                printf("1: Ensuring that the child has been continued\n");
                ATF_REQUIRE(WIFCONTINUED(status));

                printf("1: Ensuring that the child has not been terminated "
                    "with a signal\n");
                ATF_REQUIRE(!WIFSIGNALED(status));

                printf("1: Ensuring that the child has not been stopped\n");
                ATF_REQUIRE(WIFSTOPPED(status));

                printf("1: Before resuming the child process where it left "
                    "off and without signal to be sent\n");
                ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
                printf("1: Before calling waitpid() for the child\n");
                wpid = waitpid(child, &status, 0);

                printf("1: Validating that child's PID is still there\n");
                ATF_REQUIRE(wpid == child);

                printf("1: Ensuring that the child has been exited\n");
                ATF_REQUIRE(WIFEXITED(status));

                printf("1: Ensuring that the child has not been continued\n");
                ATF_REQUIRE(!WIFCONTINUED(status));

                printf("1: Ensuring that the child has not been terminated "
                    "with a signal\n");
                ATF_REQUIRE(!WIFSIGNALED(status));

                printf("1: Ensuring that the child has not been stopped\n");
                ATF_REQUIRE(!WIFSTOPPED(status));

                printf("1: Verifying that he child has exited with the "
                    "%d status (received %d)\n", exitval, WEXITSTATUS(status));
                ATF_REQUIRE(WEXITSTATUS(status) == exitval);

                printf("1: Before calling waitpid() for the exited child\n");
                wpid = waitpid(child, &status, 0);

                printf("1: Validating that child's PID no longer exists\n");
                ATF_REQUIRE(wpid == -1);

                printf("1: Validating that errno is set to %s (got %s)\n",
                    sys_errlist[ECHILD], sys_errlist[errno]);
                ATF_REQUIRE(errno == ECHILD);
	}
}
2016-11-03 11:20:45 +00:00
kamil 0c55761e36 Add new test traceme3 in t_ptrace
This test is modeled after traceme1 and traceme2 with the goal to test if
the child was terminated with a received signal passed with PT_CONTINUE.

Currently the three traceme tests verifies three possible status values from
waitpid(2) called by the parent:
 - WIFEXITED(status),
 - WIFSIGNALED(status),
 - WIFSTOPPED(status)
with associated macros:
 - WEXITSTATUS(status),
 - WTERMSIG(status),
 - WCOREDUMP(status),
 - WSTOPSIG(status).

In traceme3 has been assumed that Ctrl-C (SIGINT) does not emit core(5).

Sponsored by <The NetBSD Foundation>.
2016-11-03 08:48:53 +00:00
kamil 830850eb4c Add new test-case "traceme2" in t_ptrace
This test is a clone of traceme2 with ptrace(2) calling PT_CONTINUE
with signal to be passed to the child: SIGINT. traceme1 sends no signals.

Sponsored by <The NetBSD Foundation>.
2016-11-02 22:18:04 +00:00
kamil 46910e0e26 Add new test t_ptrace with traceme1
This test is a placeholder for further checks of the native ptrace(2)
function calls.

XXX: Is it safe to call ATF functions from a child? FreeBSD seems to
     construct dedicated asserts for them.

XXX: printf(3) calls from a child are not intercepted by atf-run(1)

Sponsored by <The NetBSD Foundation>.
2016-11-02 12:51:22 +00:00
riastradh 8338092962 Test for PR kern/51135 is no longer failing. 2016-05-22 04:34:44 +00:00
pooka 0a4930ca68 mark read_random xfail kern/51135 2016-05-13 13:22:28 +00:00
pooka 2d2ae8f1cf Test that reading /dev/random returns within a reasonable time. 2016-05-12 11:41:43 +00:00
ryoon 09a886100c Tab alignment 2016-04-29 07:12:34 +00:00
christos cfb3849454 This needs _KERNTYPES on some platforms. 2016-02-15 14:59:38 +00:00
christos ffeb8dbf4e Define _KERNTYPES for things that need it. 2016-01-23 21:22:45 +00:00
matt b9e582e94c Don't build tests that depend on RUMP if BSD_MK_COMPAT_FILE is defined. 2015-06-22 00:05:23 +00:00
riastradh d1c2f2cc13 Use <sys/rndio.h> for rnd ioctls. 2015-04-13 22:24:34 +00:00
christos d0b8ae57c5 bump warns. 2015-01-14 22:22:32 +00:00
christos f7afbc7f00 PR/48958: rudolf: EVFILT_VNODE filter miscounting hardlinks (add test) 2015-01-14 22:22:14 +00:00
tls ea6af427bd Merge tls-earlyentropy branch into HEAD. 2014-08-10 16:44:32 +00:00
gson 643acb6d0e Test that reading a CTLTYPE_INT sysctl variable into a buffer that is
too small returns ENOMEM, and that reading it into a buffer that is
large enough returns the expected sizeof(int) bytes of data.
2014-08-09 07:04:03 +00:00
he f693807fd8 Fix static linking for the tests: -lrump is also used by -lrumpuser,
so we also need -lrump after -lrumpuser.  Fixes build for sun2.
2014-06-10 04:28:39 +00:00
martin 36cb4c7daa Skip the curtain test case if curtain is not enabled and we would not
be able to restore it to its old value later due to running at securelevel
above 0.
Previously this would fail and leave curtain enabled untill next reboot (but
causing further runs of the test to suceed, just to maximize confusion).
This went unnoticed initial since most modular test kernels run with options
INSECURE to allow exercising the kernel module loader.
2014-04-28 08:34:16 +00:00
jmmv bcb71d7e8b Make cleanup routines actually work.
The only way to pass global state from the body to the cleanup is via the
file system.

Fixes leaks of global system resources (in all cases, given that the body
does not by itself clean things up).
2014-03-02 20:13:12 +00:00
jmmv c6a5f6dd5a Remove unnecessary and broken cleanup routine. 2014-03-02 19:56:48 +00:00
christos d56fcfc956 fix unused variable warnings 2013-10-19 17:45:00 +00:00
skrll 114c94b6cd Fix msgsz confusion. 2013-07-24 11:44:10 +00:00
gson 321ad68594 Don't rely on "kill -0" to check whether a background shell command
has exited; it does not work reliably because the process may still
exist as a zombie.  OK mlelstv.
2013-05-31 14:40:48 +00:00
mlelstv 3a4772dd1f shorten fileops test further
add new test that verifies locking of the mount list.
2013-04-28 15:49:58 +00:00
mlelstv 1526e77e21 shorten test to not time out on our test infrastructure. 2013-04-27 07:45:07 +00:00
mlelstv 5319147235 Now use correct test files and pass child failures to test function. 2013-04-20 09:00:03 +00:00
mlelstv 86479a1389 First attempt at stress testing umount of a busy disk. 2013-04-16 22:05:44 +00:00
martin 0ed572c9e9 getsockname() needs a socklen_t, not a size_t 2013-02-28 20:41:21 +00:00
martin f368c7a2de Add a testprogram for PR 47598. 2013-02-28 15:31:22 +00:00
pgoyette d5bb255f0c Fix the error message handling. Thanks to Christos for noticing. 2013-02-20 02:22:48 +00:00
pgoyette ab7a59749e Replace printf() in child process with a simple write(STDERR_FILNO,...)
Thanks, Joerg.
2013-02-19 22:44:27 +00:00
pgoyette a3217a378f Rather than just sleeping and hoping that all the sub-processes are
ready to be ptrace()d, use a positive barrier.
2013-02-19 04:58:40 +00:00
pgoyette 7dec801027 White-space in for(...) loops.
Use #define instead of static variables to define test parameters.
No functional change.
2013-02-19 04:46:46 +00:00
pgoyette 593938d6da Create a variable for max number of passes to make. While we're here,
reduce the pass-count from 100 to 50;  this is more than enough to prove
that the test is working, and helps reduce the ever-increasing time it's
taking to run the entire test suite.
2013-02-19 03:22:54 +00:00
pgoyette 2fde625529 Wait a little bit after fork()ing the lockers to give them a chance to
get started before trying to ptrace(ATTACH).  Otherwise, the traced
process doesn't seem to resume properly upon ptrace(DETACH) and on the
next pass the ptrace(ATTACH) just hangs forever, causing the test to
time-out.

XXX The failure-to-resume-properly might actually be a kernel bug that
we need to follow up on.  But for now, let's make the test work as
intended.
2013-02-19 00:54:47 +00:00
pgoyette 706bd0b309 Check that we did get EDEADLK error, and fail immediately if we did not. 2013-02-18 20:59:19 +00:00
joerg f611942e77 Unbreak the NOTE_TRACK event of EVFILT_PROC. When attaching to the child
process, proc_find can't be used as the child is still in state SIDL.
2012-11-17 21:55:24 +00:00
pgoyette 8b483e6488 Add missing '+' so we include t_lock as well as t_lockf and others.
Should fix the build break.
2012-11-07 16:36:49 +00:00
pgoyette 7206730159 Add ATF version of the file locking test 2012-11-07 14:00:38 +00:00
nakayama b826e4d970 Fix MKRUMP=no build.
librt is unrelated to rump.
2012-11-07 05:13:45 +00:00
pgoyette 3c7f7eee04 Use an ATF_TC_CLEANUP() routine to delete the mkdtemp() directory even
if the test case fails/exits sooner.
2012-11-06 19:35:38 +00:00
pgoyette 689370802f Replace the atexit() routines with ATF_TC_CLEANUP()
Factor out the generation of token_keys to a separate routine, called
from each test case.  And make sure we remove the mkdtemp()-created
directory after we're finished with it.
2012-11-06 18:31:53 +00:00
apb 2bf0b7739b use mkdtemp() instead of mktemp(). 2012-11-06 13:55:03 +00:00
pgoyette c168fbbf95 Convert to ATF format the old src/regress/ style tests for Sys V IPC 2012-11-05 04:09:14 +00:00
pgoyette 938a6ff547 Convert the old src/regress/mqueue test to ATF 2012-11-03 05:19:33 +00:00
christos a1801097ec Avoid ssp re-definitions for the functions we provide. 2012-10-31 13:48:12 +00:00
christos cb461c6808 Exclude tests that use rump 2012-08-08 13:57:05 +00:00
jruoho 543143cf18 Move more PR references from comments to ATF's "descr". 2012-03-18 09:46:50 +00:00
jruoho 0a082b37fe Move the _lwp_ctl(2) preemption counter check to the right place. 2012-03-17 17:23:34 +00:00
joerg 66dd2755f5 Add __printflike attribution to use vprintf and friends with an argument
as format string.
2012-03-15 02:02:20 +00:00
martin 0ce98f42a7 Move posix_spawn tests to lib/libc/gen/posix_spawn - they test both libc
and kernel, but that is an implementation detail unrelated to the tests
themselfs.
Ok: releng
2012-02-13 21:03:06 +00:00
martin 19f52532ad Add userland part of posix_spawn. Libc functions imported from FreeBSD.
Based on Charles Zhang's summer of code project.
2012-02-11 23:31:22 +00:00
para 89c9828deb converting extent(9) from malloc(9) to kmem(9)
preceding kmem-vmem-pool-uvm patch

releng@ acknowledged
2012-01-27 18:52:47 +00:00
christos 408524dea5 Add a test for the kernel snprintf. 2011-11-24 01:46:40 +00:00
jruoho d79436d44f Move the sigaction(2) test to the right place. 2011-10-15 07:00:48 +00:00
jruoho d7cfdec1a4 Move the ucontext(2) test to the right place. 2011-10-15 06:54:52 +00:00
jruoho e6064fc127 Move the writev(2) test to the right place. 2011-10-15 06:50:52 +00:00
jruoho 2a39986da0 Move the clock_gettime(2) timer test to the right place. 2011-10-15 06:42:16 +00:00
jruoho 175ae78538 Follow the design principles of tests(7) by merging 't_poll3w' to 't_poll'
as a test case instead of separate file.
2011-10-15 06:33:45 +00:00
jruoho 04c8b02c8d Move the mkdir(2) test to the right place. 2011-10-15 06:26:33 +00:00
jruoho 599acddbd9 Move the pipe(2) test to the right place. 2011-10-15 06:17:02 +00:00
jruoho 45e23a6a46 Move the posix_fadvise(2) test to the right place. 2011-10-15 06:10:26 +00:00
christos 6f52d919ef Add a pty test, written by Matthew Mondor 2011-09-24 15:53:01 +00:00
christos 2a18cea9f4 Turn warns on for all tests and fix all the bugs. 2011-06-11 18:03:17 +00:00