Commit Graph

247995 Commits

Author SHA1 Message Date
maya
f959afb267 reorganize the code so we test if open fails at the open call.
this doesn't actually make a functional difference as ftruncate can
handle it, but it's a bit clearer and appeases static analyzers.

ok riastradh
2017-01-14 18:35:43 +00:00
maya
be48413a3c Be explicit about how we're placing part of the on-disk name into
the extension, so it doesn't appear like we are overrunning an array.
Appeases coverity, NFC.

ok riastradh
2017-01-14 17:17:53 +00:00
martin
1ed40762bd Avoid gcc warnings 2017-01-14 17:14:23 +00:00
maya
fe2925feed appease coverity by using strlcpy instead of strncpy
ok riastradh
2017-01-14 16:34:44 +00:00
christos
1990f7e47c cast return value 2017-01-14 16:21:28 +00:00
martin
d8e142070e Avoid stupid gcc redefinition warnings by #undef before redefine. 2017-01-14 16:15:10 +00:00
christos
c22e861866 define empty bodies for incomplete implementations 2017-01-14 16:12:51 +00:00
christos
6802e8e0b8 remove dup definitions 2017-01-14 16:07:53 +00:00
christos
21ad29ec97 fix constant types 2017-01-14 15:58:11 +00:00
christos
9d493e3dc8 remove useless include; asm.h is not useful for c files. our current assumption
is that stuff in cdefs.h is duplicated in asm.h.
2017-01-14 15:50:24 +00:00
wiz
13cf5641ee Wording, macro use. 2017-01-14 14:33:18 +00:00
martin
56f34142db Include <string.h> for strcpy 2017-01-14 12:45:28 +00:00
martin
840c51e6d0 Make the copies of the FE_* macros match verbatim to avoid a gcc warning
when both ieeefp.h and fenv.h are included.
2017-01-14 12:00:13 +00:00
kamil
c2476a0996 Document PTRACE_LWP_CREATE and PTRACE_LWP_EXIT in ptrace(2)
Sponsored by <The NetBSD Foundation>
2017-01-14 07:17:38 +00:00
kamil
6b5f5581b3 Document TRAP_LWP in siginfo(2)
TRAP_LWP - process lwp (thread) traps

Sponsored by <The NetBSD Foundation>
2017-01-14 06:55:40 +00:00
kamil
b501ce61ac Document the latest ptrace(2) and siginfo(2) additions:
Added new entries:
        ptrace(2): Add new options in EVENT_MASK: PTRACE_LWP_CREATE and
                PTRACE_LWP_EXIT
        siginfo(2): Add new si_code for SIGTRAP: TRAP_LWP

Sponsored by <The NetBSD Foundation>
2017-01-14 06:51:02 +00:00
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
christos
7b9289ca62 fix standalone 2017-01-14 04:54:42 +00:00
christos
2663d7ef18 fix standalone 2017-01-14 04:53:25 +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
8787f9ad9e fix rump 2017-01-14 03:35:21 +00:00
christos
53daaf6b96 fix weak symbols. More work needs to be done for memcpy/strlen etc. 2017-01-14 03:00:13 +00:00
christos
0f986ca219 add new test file 2017-01-14 01:44:13 +00:00
kamil
89ada74077 Update TODO.ptrace
Removed:
  - evaluate equivalent for PTRACE_O_TRACECLONE from Linux

clone(2)-like calls are traced with PTRACE_FORK, PTRACE_VFORK and
PTRACE_VFORK_DONE. VFORK ones block parent till termination or execve(2) of
its child.

Added:
  - add proper implementation of PTRACE_VFORK for vfork(2)-like events

Currently PTRACE_VFORK is a stub.

Sponsored by <The NetBSD Foundation>
2017-01-14 01:36:28 +00:00
christos
0ac9d4eb29 better name 2017-01-14 01:33:32 +00:00
christos
01f670b7f6 expose more for _KMEMUSER 2017-01-14 01:02:08 +00:00
christos
31ed49d544 don't do _KERNEL; hides bswap stuff. 2017-01-14 01:01:48 +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
1edda79a21 fix types. 2017-01-14 00:35:37 +00:00
christos
81da05f641 Do things in a less intrusive way. 2017-01-14 00:33:19 +00:00
kamil
4e100202af Document PTRACE_VFORK and PTRACE_VFORK_DONE in ptrace(2)
PTRACE_VFORK - report vfork(2)-like operations and trace child
PTRACE_VFORK_DONE - report unblocking the parent after vfork(2)-like call

Note that PTRACE_VFORK is currently unimplemented and returns ENOTSUP.

Sponsored by <The NetBSD Foundation>
2017-01-14 00:02:40 +00:00
kamil
f985a0fb79 Add new entry for ptrace(2)
Added:
  ptrace(2): Add new options in EVENT_MASK: PTRACE_VFORK and
    PTRACE_VFORK_DONE
2017-01-13 23:29:10 +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
kamil
c18b2e9358 Welcome to NetBSD 7.99.59 - PTRACE_VFORK and PTRACE_VFORK_DONE in ptrace(2)
Sponsored by <The NetBSD Foundation>
2017-01-13 23:05:24 +00:00
kamil
0e96af0f53 Add support for PTRACE_VFORK_DONE and stub for PTRACE_VFORK in ptrace(2)
PTRACE_VFORK is supposed to be used to track vfork(2)-like events, when
parent gives birth to new process child and stops till it exits or calls
exec().
Currently PTRACE_VFORK is a stub.

PTRACE_VFORK_DONE is notification to notify a debugger that a parent has
resumed after vfork(2)-like action.
PTRACE_VFORK_DONE throws SIGTRAP with TRAP_CHLD.

Sponsored by <The NetBSD Foundation>
2017-01-13 23:00:35 +00:00
christos
b5b137cbee fix typo 2017-01-13 22:46:43 +00:00
christos
1544402a99 no namlen on linux 2017-01-13 22:45:15 +00:00
christos
a2e94ed719 use bdp, to avoid compiler warning. 2017-01-13 22:29:59 +00:00
macallan
4b66d9e2f9 add SX_STBM ( STore Byte Masked ) instruction 2017-01-13 21:49:46 +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
christos
968eee5d0b convert strcpy to a bounded copy to avoid compiler warnings, although the
reclen test prevents overflow.
2017-01-13 21:02:05 +00:00
agc
56556fc2dc terminate the statement properly 2017-01-13 21:00:59 +00:00
christos
d352a1f1ba convert strcpy to a bounded copy to avoid compiler warnings, although the
reclen test prevents overflow.
2017-01-13 20:58:59 +00:00