Commit Graph

2971 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
pgoyette
ea3582b27e Set FILESBUILD=yes to actually run the creation script for the file.
Should fix the build by creating a file which install can then find.
2017-01-14 03:59:58 +00:00
christos
0ac9d4eb29 better name 2017-01-14 01:33:32 +00:00
christos
6a94a0768f PR/51832: Ngie Cooper:
- limit memory to 64M
- error msg fixes
- includes fixes
2017-01-14 00:50:56 +00:00
christos
81da05f641 Do things in a less intrusive way. 2017-01-14 00:33:19 +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
christos
6e9c6546e8 PR/51859: Ngie Cooper: use closefrom/restore RLIMIT_NOFILE when done 2017-01-13 21:19:45 +00:00
christos
9398a6c8c6 PR/51861: Ngie Cooper: Sprinkle __unused, mark __dead, _exit(). 2017-01-13 21:18:33 +00:00
christos
f3f1ae73bf PR/51862: Ngie Cooper: don't leak buf 2017-01-13 21:16:38 +00:00
christos
1b5bdd34e2 PR/51860: Ngie Cooper: don't leak fd 2017-01-13 21:15:57 +00:00
christos
f4c1dfe02d PR/51857: Ngie Cooper: mark signo __unused for -Wunused 2017-01-13 21:15:14 +00:00
agc
a5445b4eea also terminate 2 other statements properly 2017-01-13 21:09:12 +00:00
agc
56556fc2dc terminate the statement properly 2017-01-13 21:00:59 +00:00
christos
35c57c2fc8 PR/51858: Ngie Cooper: don't leak buf 2017-01-13 20:46:15 +00:00
christos
93538aec95 PR/51856: Ngie Cooper: add limits.h for INT_MAX 2017-01-13 20:44:45 +00:00
christos
26e010503c PR/51847: Ngie Cooper: More error checks, add __unused 2017-01-13 20:44:10 +00:00
christos
666a964a93 PR/51855: Ngie Cooper: fix leaks 2017-01-13 20:43:11 +00:00
christos
86d82e08a1 PR/51853: Ngie Cooper: add limits.h for MAXPATHLEN in FreeBSD 2017-01-13 20:42:36 +00:00
christos
10ef6baaf5 PR/51854: Ngie Cooper: sys/socket.h include and check result from socket(2) 2017-01-13 20:41:50 +00:00
christos
cee075369e PR/51851: Ngie Cooper: add stdbool.h #include for false/true 2017-01-13 20:31:53 +00:00
christos
faab7dc2ec PR/51852: Ngie Cooper: mark signo __unused 2017-01-13 20:31:06 +00:00
christos
bf323d9fd1 PR/51849: Ngie Cooper: headers portability fixes 2017-01-13 20:10:57 +00:00
christos
180ffa9edb PR/51850: Ngie Cooper: add sys/socket.h for socket(2) and don't leak fds 2017-01-13 20:09:48 +00:00
christos
57ddf889e1 PR/51848: Ngie Cooper: tests/lib/libc/sys/t_sigaction: mark variables __unused
XXX: h_macros.h needs to be fixed differently.
2017-01-13 20:08:38 +00:00
christos
4cc87d7ee2 PP/51845: Ngie Cooper: need <netinet/in.h> for htonl etc and fix socket leak 2017-01-13 20:06:50 +00:00
christos
26785dc779 PR/51846: Ngie Cooper: closefrom(3) instead of fcntl(3, F_CLOSEM)
for portability
2017-01-13 20:04:52 +00:00
christos
af06389089 PR/51844: Ngie Cooper: use root-owned file created during build instead of
/usr/bin/fpr
2017-01-13 20:03:51 +00:00
christos
d0d6e976d7 PR/51843: Ngie Cooper: don't leak file descriptor 2017-01-13 19:34:19 +00:00
christos
499ce000b9 PR/51842: Ngie Cooper: don't leak fifo file descriptor 2017-01-13 19:33:03 +00:00
christos
86df5d0a52 PR/51841: Ngie Cooper: portability fixes for FreeBSD 2017-01-13 19:28:55 +00:00
christos
54f5f52408 PR/51840: Ngie Cooper: portability fixes for FreeBSD, etc 2017-01-13 19:27:23 +00:00
christos
5d4836fefb PR/51839: Ngie Cooper: reset errno to 0 before calling scalbn* 2017-01-13 19:26:03 +00:00
christos
6660f1abd6 PR/51837: Ngie Cooper: add limits.h for INT_MAX 2017-01-13 19:23:40 +00:00
ozaki-r
a0d1dbdc06 Remove a check added wrongly 2017-01-13 08:11:01 +00:00
ozaki-r
6fe17373ab Add tests for net.inet6.ip6.prefer_tempaddr 2017-01-13 06:30:33 +00:00
ozaki-r
ade7bb4d73 Remove extra checks and cleanup 2017-01-13 06:30:09 +00:00
christos
a1bf1494f3 Bart Simpson's punishment. 2017-01-13 05:18:22 +00:00
christos
f6982a4254 help gcc's numbscullness. 2017-01-13 05:12:44 +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
af5b14872f more error checks 2017-01-11 18:15:02 +00:00
christos
2b582fd0b7 fix mismatched paren, also the previous commit should say and check error
for -1.
2017-01-11 18:09:40 +00:00
christos
64565cf3c6 PR/51822: Ngie Cooper: add additional t_memmem check 2017-01-11 18:07:37 +00:00
christos
22f9a6b271 PR/51823: Ngie Cooper: Add output diagnostic if memcmp of the md5 string fails 2017-01-11 18:05:54 +00:00
joerg
77fe1f22f1 Remove LLVM atomic hacks for Sparc. 2017-01-11 12:10:26 +00:00
christos
69ee1aa91e wrap the macro in do/while. 2017-01-11 07:26:17 +00:00
ozaki-r
79ca97d6c8 Cope with tentative state 2017-01-11 07:22:43 +00:00
ozaki-r
285906a96f Add a test case for IPv6 temporary address 2017-01-11 03:15:44 +00:00