#
321020 |
|
15-Jul-2017 |
dchagin |
MFC r281436 (by mjg@):
fd: remove filedesc argument from fdclose
Just accept a thread instead. This makes it consistent with fdalloc.
No functional changes.
|
#
318192 |
|
11-May-2017 |
jhb |
MFC 313407,313449: Copy ELF machine/flags from binaries to core dumps.
313407: Copy the e_machine and e_flags fields from the binary into an ELF core dump.
In the kernel, cache the machine and flags fields from ELF header to use in the ELF header of a core dump. For gcore, the copy these fields over from the ELF header in the binary.
This matters for platforms which encode ABI information in the flags field (such as o32 vs n32 on MIPS).
313449: Trim trailing whitespace (mostly introduced in r313407).
Sponsored by: DARPA / AFRL
|
#
315949 |
|
25-Mar-2017 |
badger |
MFC r313992, r314075, r314118, r315484:
r315484: ptrace_test: eliminate assumption about thread scheduling
A couple of the ptrace tests make assumptions about which thread in a multithreaded process will run after a halt. This makes the tests less portable across branches, and susceptible to future breakage. Instead, twiddle thread scheduling and priorities to match the tests' expectation.
r314118: Actually fix buildworlds other than i386/amd64/sparc64 after r313992
Disable offending test for platforms without a userspace visible breakpoint().
r314075: Fix world build for archs where __builtin_debugtrap() does not work.
The offending code was introduced in r313992.
r313992: Defer ptracestop() signals that cannot be delivered immediately
When a thread is stopped in ptracestop(), the ptrace(2) user may request a signal be delivered upon resumption of the thread. Heretofore, those signals were discarded unless ptracestop()'s caller was issignal(). Fix this by modifying ptracestop() to queue up signals requested by the ptrace user that will be delivered when possible. Take special care when the signal is SIGKILL (usually generated from a PT_KILL request); no new stop events should be triggered after a PT_KILL.
Add a number of tests for the new functionality. Several tests were authored by jhb.
PR: 212607 Sponsored by: Dell EMC
|
#
304905 |
|
27-Aug-2016 |
kib |
MFC r303426: Rewrite subr_sleepqueue.c use of callouts to not depend on the specifics of callout KPI.
|
#
304613 |
|
22-Aug-2016 |
markj |
MFC r304440, r304487: Fix some handling of P2_PTRACE_FSTP.
|
#
304499 |
|
19-Aug-2016 |
jhb |
MFC 303001: Add PTRACE_VFORK to trace vfork events.
First, PL_FLAG_FORKED events now also set a PL_FLAG_VFORKED flag when the new child was created via vfork() rather than fork(). Second, a new PL_FLAG_VFORK_DONE event can now be enabled via the PTRACE_VFORK event mask. This new stop is reported after the vfork parent resumes due to the child calling exit or exec. Debuggers can use this stop to reinsert breakpoints in the vfork parent process before it resumes.
|
#
304190 |
|
15-Aug-2016 |
kib |
MFC r303423: Force SIGSTOP to be the first signal reported after the attach.
|
#
304188 |
|
15-Aug-2016 |
jhb |
MFC 302900,302902,302921,303461,304009: Add a mask of optional ptrace() events.
302900: Add a test for user signal delivery.
This test verifies we get the correct ptrace event details when a signal is posted to a traced process from userland.
302902: Add a mask of optional ptrace() events.
ptrace() now stores a mask of optional events in p_ptevents. Currently this mask is a single integer, but it can be expanded into an array of integers in the future.
Two new ptrace requests can be used to manipulate the event mask: PT_GET_EVENT_MASK fetches the current event mask and PT_SET_EVENT_MASK sets the current event mask.
The current set of events include: - PTRACE_EXEC: trace calls to execve(). - PTRACE_SCE: trace system call entries. - PTRACE_SCX: trace syscam call exits. - PTRACE_FORK: trace forks and auto-attach to new child processes. - PTRACE_LWP: trace LWP events.
The S_PT_SCX and S_PT_SCE events in the procfs p_stops flags have been replaced by PTRACE_SCE and PTRACE_SCX. PTRACE_FORK replaces P_FOLLOW_FORK and PTRACE_LWP replaces P2_LWP_EVENTS.
The PT_FOLLOW_FORK and PT_LWP_EVENTS ptrace requests remain for compatibility but now simply toggle corresponding flags in the event mask.
While here, document that PT_SYSCALL, PT_TO_SCE, and PT_TO_SCX both modify the event mask and continue the traced process.
302921: Rename PTRACE_SYSCALL to LINUX_PTRACE_SYSCALL.
303461: Note that not all optional ptrace events use SIGTRAP.
New child processes attached due to PTRACE_FORK use SIGSTOP instead of SIGTRAP. All other ptrace events use SIGTRAP.
304009: Remove description of P_FOLLOWFORK as this flag was removed.
|
#
304017 |
|
12-Aug-2016 |
jhb |
MFC 292894,292896: Add ptrace(2) reporting for LWP events.
292894: Add ptrace(2) reporting for LWP events.
Add two new LWPINFO flags: PL_FLAG_BORN and PL_FLAG_EXITED for reporting thread creation and destruction. Newly created threads will stop to report PL_FLAG_BORN before returning to userland and exiting threads will stop to report PL_FLAG_EXIT before exiting completely. Both of these events are only enabled and reported if PT_LWP_EVENTS is enabled on a process.
292896: Document the recently added support for ptrace(2) LWP events.
|
#
303846 |
|
08-Aug-2016 |
bdrewery |
MFC r280331:
cred: add proc_set_cred_init helper
PR: D7431
|
#
303843 |
|
08-Aug-2016 |
bdrewery |
MFC r280330,r282567:
r280330: fork: assign refed credentials earlier r282567: Fix up panics when fork fails due to hitting proc limit
PR: D7431
|
#
303790 |
|
06-Aug-2016 |
kib |
MFC r303702: Remove mention of Giant from the fork_return() description.
|
#
302237 |
|
27-Jun-2016 |
bdrewery |
MFC r292384:
Fix style issues around existing SDT probes.
** Changes to sys/netinet/in_kdtrace.c and sys/netinet/in_kdtrace.h skipped.
|
#
302234 |
|
27-Jun-2016 |
bdrewery |
MFC r298819:
sys/kern: spelling fixes in comments.
|
#
302229 |
|
27-Jun-2016 |
bdrewery |
MFC r280130:
cred: add proc_set_cred helper
|
#
302066 |
|
21-Jun-2016 |
bdrewery |
MFC r297156,r297157,r297158,r297159,r297161,r297172,r297200,r297201,r297202, r297203,r297256:
r297156: Track filemon usage via a proc.p_filemon pointer rather than its own lists. r297157: Stop tracking stat(2). r297158: Consolidate open(2) and openat(2) code. r297159: Use curthread for vn_fullpath. r297161: Attempt to use the namecache for openat(2) path resolution. r297172: Consolidate common link(2) logic. r297200: Follow-up r297156: Close the log in filemon_dtr rather than in the last reference. r297201: Return any log write failure encountered when closing the filemon fd. r297202: Remove unused done argument to copyinstr(9). r297203: Handle copyin failures. r297256: Remove unneeded return left from refactoring.
Relnotes: yes (filemon stability/performance updates) Sponsored by: EMC / Isilon Storage Division
|
#
295674 |
|
16-Feb-2016 |
jhb |
MFC 295418,295419: Fix hangs or panics when misbehaved kernel threads return from their main function.
295418: Mark proc0 as a kernel process via the P_KTHREAD flag.
All other kernel processes have this flag set and all threads in proc0 (including thread0) have the similar TDP_KTHREAD flag set.
295419: Call kthread_exit() rather than kproc_exit() for a premature kthread exit.
Kernel threads (and processes) are supposed to call kthread_exit() (or kproc_exit()) to terminate. However, the kernel includes a fallback in fork_exit() to force a kthread exit if a kernel thread's "main" routine returns. This fallback was added back when the kernel only had processes and was not updated to call kthread_exit() instead of kproc_exit() when threads were added to the kernel.
This mistake was particularly exciting when the errant thread belonged to proc0. Due to the missing P_KTHREAD flag the fallback did not kick in and instead tried to return to userland via whatever garbage was in the trapframe. With P_KTHREAD set it tried to terminate proc0 resulting in other amusements.
PR: 204999 Approved by: re (glebius)
|
#
289798 |
|
23-Oct-2015 |
avg |
MFC r288336: save some bytes by using more concise SDT_PROBE<n>
|
#
289780 |
|
22-Oct-2015 |
jhb |
MFC 287386,288949,288993: Export current system call code and argument count for system call entry and exit events. To preserve the ABI, the new fields are moved to the end of struct thread in these branches (unlike HEAD) and explicitly copied when new threads are created. In addition, the new tests are only added in 10.
r287386: Export current system call code and argument count for system call entry and exit events. procfs stop events for system call tracing report these values (argument count for system call entry and code for system call exit), but ptrace() does not provide this information. (Note that while the system call code can be determined in an ABI-specific manner during system call entry, it is not generally available during system call exit.)
The values are exported via new fields at the end of struct ptrace_lwpinfo available via PT_LWPINFO.
r288949: Fix various edge cases related to system call tracing. - Always set td_dbg_sc_* when P_TRACED is set on system call entry even if the debugger is not tracing system call entries. This ensures the fields are valid when reporting other stops that occur at system call boundaries such as for PT_FOLLOW_FORKS or when only tracing system call exits. - Set TDB_SCX when reporting the stop for a new child process in fork_return(). This causes the event to be reported as a system call exit. - Report a system call exit event in fork_return() for new threads in a traced process. - Copy td_dbg_sc_* to new threads instead of zeroing. This ensures that td_dbg_sc_code in particular will report the system call that created the new thread or process when it reports a system call exit event in fork_return(). - Add new ptrace tests to verify that new child processes and threads report system call exit events with a valid pl_syscall_code via PT_LWPINFO.
r288993: Document the recently added pl_syscall_* fields in struct ptrace_lwpinfo.
|
#
289431 |
|
16-Oct-2015 |
kib |
MFC r289026: Enforce the maxproc limitation before allocating struct proc.
In collaboration with: pho
|
#
284343 |
|
13-Jun-2015 |
jhb |
MFC 283546: Add KTR tracing for some MI ptrace events.
|
#
284205 |
|
10-Jun-2015 |
kib |
Add chunk missed in the r284199.
|
#
277698 |
|
25-Jan-2015 |
kib |
MFC r277322: Add procctl(2) PROC_TRACE_CTL command to enable or disable debugger attachment to the process.
|
#
276686 |
|
05-Jan-2015 |
kib |
Merge reaper facility.
MFC r270443 (by mjg): Properly reparent traced processes when the tracer dies.
MFC r273452 (by mjg): Plug unnecessary PRS_NEW check in kern_procctl.
MFC 275800: Add a facility for non-init process to declare itself the reaper of the orphaned descendants.
MFC r275821: Add missed break.
MFC r275846 (by mckusick): Add some additional clarification and fix a few gammer nits.
MFC r275847 (by bdrewery): Bump Dd for r275846.
|
#
276272 |
|
26-Dec-2014 |
kib |
MFC r275745: Add facility to stop all userspace processes.
MFC r275753: Fix gcc build.
MFC r275820: Add missed break.
|
#
270267 |
|
21-Aug-2014 |
kib |
Commit forgotten chunk of r270264.
|
#
268345 |
|
06-Jul-2014 |
mjg |
MFC r268001: Make fdunshare accept only td parameter.
Proc had to match the thread anyway and 2 parameters were inconsistent with the rest.
|
#
263281 |
|
17-Mar-2014 |
markj |
MFC r259535: The fasttrap fork handler is responsible for removing tracepoints in the child process that were inherited from its parent. However, this should not be done in the case of a vfork, since the fork handler ends up removing the tracepoints from the shared vm space, and userland DTrace probes in the parent will no longer fire as a result.
Now the child of a vfork may trigger userland DTrace probes enabled in its parent, so modify the fasttrap probe handler to handle this case and handle the child process in the same way that it would handle the traced process. In particular, if once traces function foo() in a process that vforks, and the child calls foo(), fasttrap will treat this call as having come from the parent. This is the behaviour of the upstream code.
While here, add #ifdef guards to some code that isn't present upstream.
|
#
260817 |
|
17-Jan-2014 |
avg |
MFC r258622: dtrace sdt: remove the ugly sname parameter of SDT_PROBE_DEFINE
|
#
284343 |
|
13-Jun-2015 |
jhb |
MFC 283546: Add KTR tracing for some MI ptrace events.
|
#
284205 |
|
10-Jun-2015 |
kib |
Add chunk missed in the r284199.
|
#
277698 |
|
25-Jan-2015 |
kib |
MFC r277322: Add procctl(2) PROC_TRACE_CTL command to enable or disable debugger attachment to the process.
|
#
276686 |
|
05-Jan-2015 |
kib |
Merge reaper facility.
MFC r270443 (by mjg): Properly reparent traced processes when the tracer dies.
MFC r273452 (by mjg): Plug unnecessary PRS_NEW check in kern_procctl.
MFC 275800: Add a facility for non-init process to declare itself the reaper of the orphaned descendants.
MFC r275821: Add missed break.
MFC r275846 (by mckusick): Add some additional clarification and fix a few gammer nits.
MFC r275847 (by bdrewery): Bump Dd for r275846.
|
#
276272 |
|
26-Dec-2014 |
kib |
MFC r275745: Add facility to stop all userspace processes.
MFC r275753: Fix gcc build.
MFC r275820: Add missed break.
|
#
270267 |
|
21-Aug-2014 |
kib |
Commit forgotten chunk of r270264.
|
#
268345 |
|
06-Jul-2014 |
mjg |
MFC r268001: Make fdunshare accept only td parameter.
Proc had to match the thread anyway and 2 parameters were inconsistent with the rest.
|
#
263281 |
|
17-Mar-2014 |
markj |
MFC r259535: The fasttrap fork handler is responsible for removing tracepoints in the child process that were inherited from its parent. However, this should not be done in the case of a vfork, since the fork handler ends up removing the tracepoints from the shared vm space, and userland DTrace probes in the parent will no longer fire as a result.
Now the child of a vfork may trigger userland DTrace probes enabled in its parent, so modify the fasttrap probe handler to handle this case and handle the child process in the same way that it would handle the traced process. In particular, if once traces function foo() in a process that vforks, and the child calls foo(), fasttrap will treat this call as having come from the parent. This is the behaviour of the upstream code.
While here, add #ifdef guards to some code that isn't present upstream.
|
#
260817 |
|
17-Jan-2014 |
avg |
MFC r258622: dtrace sdt: remove the ugly sname parameter of SDT_PROBE_DEFINE
|