Module Name: src Committed By: martin Date: Tue Oct 15 18:32:13 UTC 2019
Modified Files: src/sys/compat/sys [netbsd-9]: siginfo.h src/sys/kern [netbsd-9]: kern_exec.c kern_fork.c kern_lwp.c kern_sig.c sys_lwp.c sys_ptrace_common.c src/sys/sys [netbsd-9]: siginfo.h signalvar.h Log Message: Pull up following revision(s) (requested by kamil in ticket #311): sys/sys/siginfo.h: revision 1.34 sys/kern/sys_ptrace_common.c: revision 1.59 sys/kern/sys_lwp.c: revision 1.70 sys/compat/sys/siginfo.h: revision 1.8 sys/kern/kern_sig.c: revision 1.365 sys/kern/kern_lwp.c: revision 1.203 sys/sys/signalvar.h: revision 1.96 sys/kern/kern_exec.c: revision 1.482 sys/kern/kern_fork.c: revision 1.214 Move TRAP_CHLD/TRAP_LWP ptrace information from struct proc to siginfo Storing struct ptrace_state information inside struct proc was vulnerable to synchronization bugs, as multiple events emitted in the same time were overwritting other ones. Cache the original parent process id in p_oppid. Reusing here p_opptr is in theory prone to slight race codition. Change the semantics of PT_GET_PROCESS_STATE, reutning EINVAL for calls prompting for the value in cases when there wasn't registered an appropriate event. Add an alternative approach to check the ptrace_state information, directly from the siginfo_t value returned from PT_GET_SIGINFO. The original PT_GET_PROCESS_STATE approach is kept for compat with older NetBSD and OpenBSD. New code is recommended to keep using PT_GET_PROCESS_STATE. Add a couple of compile-time asserts for assumptions in the code. No functional change intended in existing ptrace(2) software. All ATF ptrace(2) and ATF GDB tests pass. This change improves reliability of the threading ptrace(2) code. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.7.2.1 src/sys/compat/sys/siginfo.h cvs rdiff -u -r1.478 -r1.478.2.1 src/sys/kern/kern_exec.c cvs rdiff -u -r1.213 -r1.213.2.1 src/sys/kern/kern_fork.c cvs rdiff -u -r1.202 -r1.202.2.1 src/sys/kern/kern_lwp.c cvs rdiff -u -r1.364 -r1.364.2.1 src/sys/kern/kern_sig.c cvs rdiff -u -r1.69 -r1.69.2.1 src/sys/kern/sys_lwp.c cvs rdiff -u -r1.58.2.1 -r1.58.2.2 src/sys/kern/sys_ptrace_common.c cvs rdiff -u -r1.33 -r1.33.2.1 src/sys/sys/siginfo.h cvs rdiff -u -r1.93 -r1.93.2.1 src/sys/sys/signalvar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.