summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_sig.c
Commit message (Collapse)AuthorAgeFilesLines
* MFCattilio2013-02-211-8/+14
|
* Add break to the default case.pjd2013-02-171-0/+1
|
* When vforked child is traced, the debugging events are not generatedkib2013-02-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | until child performs exec(). The behaviour is reasonable when a debugger is the real parent, because the parent is stopped until exec(), and sending a debugging event to the debugger would deadlock both parent and child. On the other hand, when debugger is not the parent of the vforked child, not sending debugging signals makes it impossible to debug across vfork. Fix the issue by declining generating debug signals only when vfork() was done and child called ptrace(PT_TRACEME). Set a new process flag P_PPTRACE from the attach code for PT_TRACEME, if P_PPWAIT flag is set, which indicates that the process was created with vfork() and still did not execed. Check P_PPTRACE from issignal(), instead of refusing the trace outright for the P_PPWAIT case. The scope of P_PPTRACE is exactly contained in the scope of P_PPWAIT. Found and tested by: zont Reviewed by: pluknet MFC after: 2 weeks
* Rework the handling of stop signals in the NFS client. The changes injhb2013-02-061-11/+43
| | | | | | | | | | | | | | | | | | | | | | | | | 195702, 195703, and 195821 prevented a thread from suspending while holding locks inside of NFS by forcing the thread to fail sleeps with EINTR or ERESTART but defer the thread suspension to the user boundary. However, this had the effect that stopping a process during an NFS request could abort the request and trigger EINTR errors that were visible to userland processes (previously the thread would have suspended and completed the request once it was resumed). This change instead effectively masks stop signals while in the NFS client. It uses the existing TDF_SBDRY flag to effect this since SIGSTOP cannot be masked directly. Also, instead of setting PBDRY on individual sleeps, the NFS client now sets the TDF_SBDRY flag around each NFS request and stop signals are masked for all sleeps during that region (the previous change missed sleeps in lockmgr locks). The end result is that stop signals sent to threads performing an NFS request are completely ignored until after the NFS request has finished processing and the thread prepares to return to userland. This restores the behavior of stop signals being transparent to userland processes while still preventing threads from suspending while holding NFS locks. Reviewed by: kib MFC after: 1 month
* Replace expand_name() function with corefile_open() function, which notpjd2012-12-191-54/+35
| | | | | | | | | only returns name, but also vnode of corefile to use. This simplifies the code and closes few races, especially in %I handling. Reviewed by: kib Obtained from: WHEEL Systems
* Use correct file permissions when looking for available core file ifpjd2012-12-191-1/+1
| | | | | | kern.corefile contains %I. Obtained from: WHEEL Systems
* The 'flags' argument can be modified in vn_open_cred(), so we need topjd2012-12-191-1/+1
| | | | | | set it for every loop interation. Pointed out by: kib
* Do not audit paths we try when kern.corefile contains %I.pjd2012-12-191-1/+2
| | | | Obtained from: WHEEL Systems
* Style cleanups.pjd2012-12-191-50/+48
|
* The expand_name() function isn't called with the process lock held anymore,pjd2012-12-191-14/+2
| | | | | | so we can safely use malloc(M_WAITOK) now. Pointed out by: kib
* Minor style tweaks.pjd2012-12-171-6/+5
| | | | Obtained from: WHEEL Systems
* Better variables naming in expand_name() to be more consistent with coredump().pjd2012-12-171-16/+16
| | | | Obtained from: WHEEL Systems
* Move expand_name() after process lock is released.pjd2012-12-161-7/+4
| | | | | | | | | | This fixed panic where we hold mutex (process lock) and try to obtain sleepable lock (vnode lock in expand_name()). The panic could occur when %I was used in kern.corefile. Additionally we avoid expand_name() overhead when coredumps are disabled. Obtained from: WHEEL Systems
* Don't add audit record when coredumps are disabled or name cannot be expanded.pjd2012-12-161-9/+0
| | | | | Discussed with: rwatson Obtained from: WHEEL Systems
* Make the check easier to read.pjd2012-12-161-2/+1
| | | | Obtained from: WHEEL Systems
* Use 'cred' variable.pjd2012-12-161-2/+1
| | | | Obtained from: WHEEL Systems
* Add kern.capmode_coredump sysctl/tunable to allow processes in capability modepjd2012-11-271-2/+13
| | | | | | | | to dump core. Reviewed by: rwatson Obtained from: WHEEL Systems MFC after: 2 weeks
* Allow to use kill(2) in capability mode, but process can send a signal onlypjd2012-11-271-0/+8
| | | | | | | | | to himself. For example abort(3) at first tries to do kill(getpid(), SIGABRT) which was failing in capability mode, so the code was failing back to exit(1). Reviewed by: rwatson Obtained from: WHEEL Systems MFC after: 2 weeks
* Allow to modify kern.sugid_coredump and kern.corefile from loader.conf.pjd2012-11-271-0/+2
| | | | Obtained from: WHEEL Systems
* More style fixes.pjd2012-11-271-4/+4
|
* Style fixes (mostly whitespaces).pjd2012-11-271-35/+39
|
* Remove the support for using non-mpsafe filesystem modules.kib2012-10-221-9/+2
| | | | | | | | | | | | In particular, do not lock Giant conditionally when calling into the filesystem module, remove the VFS_LOCK_GIANT() and related macros. Stop handling buffers belonging to non-mpsafe filesystems. The VFS_VERSION is bumped to indicate the interface change which does not result in the interface signatures changes. Conducted and reviewed by: attilio Tested by: pho
* Correct the killpg(2) return values:eadler2012-10-221-6/+14
| | | | | | | | | | | Return EPERM if processes were found but they were unable to be signaled. Return the first error from p_cansignal if no signal was successful. Reviewed by: jilles Approved by: cperciva MFC after: 1 week
* Colin acked the wrong diff originally. fixed version coming soon.eadler2012-10-221-15/+6
| | | | Approved by: cperciva (implicit)
* Correct the killpg(2) return values:eadler2012-10-221-6/+15
| | | | | | | | | | | Return EPERM if processes were found but they were unable to be signaled. Return the first error from p_cansignal if no signal was successful. Reviewed by: jilles Approved by: cperciva MFC after: 1 week
* Ignore stop and continue signals sent to an exiting process. Stop signalsjhb2012-09-131-2/+5
| | | | | | | | | | | set p_xstat to the signal that triggered the stop, but p_xstat is also used to hold the exit status of an exiting process. Without this change, a stop signal that arrived after a process was marked P_WEXIT but before it was marked a zombie would overwrite the exit status with the stop signal number. Reviewed by: kib MFC after: 1 week
* Deliver SIGSYS to the guilty thread, not to the process.kib2012-08-181-1/+1
| | | | MFC after: 1 week
* Always clear p_xthread if current thread no longer needs it, in theory, ifdavidxu2012-07-101-2/+3
| | | | | | | debugger exited without calling ptrace(PT_DETACH), there is a time window that the p_xthread may be pointing to non-existing thread, in practical, this is not a problem because child process soon will be killed by parent process.
* Add thread-private flag to indicate that error value is already placedkib2012-04-121-0/+2
| | | | | | | | | | | | in td_errno. Flag is supposed to be used by syscalls returning EJUSTRETURN because errno was already placed into the usermode frame by a call to set_syscall_retval(9). Both ktrace and dtrace get errno value from td_errno if the flag is set. Use the flag to fix sigsuspend(2) error return ktrace records. Requested by: bde MFC after: 1 week
* Remove unused and wrong SA_PROC internal signal property.jilles2012-04-091-23/+22
| | | | | | | The SA_PROC signal property indicated whether each signal number is directed at a specific thread or at the process in general. However, that depends on how the signal was generated and not on the signal number. SA_PROC was not used.
* Mark all SYSCTL_NODEs static that have no corresponding SYSCTL_DECLs.ed2011-11-071-1/+2
| | | | | | The SYSCTL_NODE macro defines a list that stores all child-elements of that node. If there's no SYSCTL_DECL macro anywhere else, there's no reason why it shouldn't be static.
* Fix arguments list for proc:::signal-discard DTrace probe.pluknet2011-10-281-1/+1
| | | | | Reported by: Anton Yuzhaninov <citrin citrin ru> MFC after: 1 week
* The sigwait(3) function shall not return EINTR, according to thekib2011-10-011-0/+2
| | | | | | | | | | | | | | POSIX/SUSvN. The sigwait(2) syscall does return EINTR, and libc.so.7 contains the wrapper sigwait(3) which hides EINTR from callers. The EINTR return is used by libthr to handle required cancellation point in the sigwait(3). To help the binaries linked against pre-libc.so.7, i.e. RELENG_6 and earlier, to have right ABI for sigwait(3), transform EINTR return from sigwait(2) into ERESTART. Discussed with: davidxu MFC after: 1 week
* In order to maximize the re-usability of kernel code in user space thiskmacy2011-09-161-17/+17
| | | | | | | | | | | | | patch modifies makesyscalls.sh to prefix all of the non-compatibility calls (e.g. not linux_, freebsd32_) with sys_ and updates the kernel entry points and all places in the code that use them. It also fixes an additional name space collision between the kernel function psignal and the libc function of the same name by renaming the kernel psignal kern_psignal(). By introducing this change now we will ease future MFCs that change syscalls. Reviewed by: rwatson Approved by: re (bz)
* Add experimental support for process descriptorsjonathan2011-08-181-0/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | A "process descriptor" file descriptor is used to manage processes without using the PID namespace. This is required for Capsicum's Capability Mode, where the PID namespace is unavailable. New system calls pdfork(2) and pdkill(2) offer the functional equivalents of fork(2) and kill(2). pdgetpid(2) allows querying the PID of the remote process for debugging purposes. The currently-unimplemented pdwait(2) will, in the future, allow querying rusage/exit status. In the interim, poll(2) may be used to check (and wait for) process termination. When a process is referenced by a process descriptor, it does not issue SIGCHLD to the parent, making it suitable for use in libraries---a common scenario when using library compartmentalisation from within large applications (such as web browsers). Some observers may note a similarity to Mach task ports; process descriptors provide a subset of this behaviour, but in a UNIX style. This feature is enabled by "options PROCDESC", but as with several other Capsicum kernel features, is not enabled by default in GENERIC 9.0. Reviewed by: jhb, kib Approved by: re (kib), mentor (rwatson) Sponsored by: Google Inc
* Fix support for RACCT_CORE by merging forgotten file.trasz2011-05-261-2/+4
|
* ktrace: Log the code for all signals (PSIG events).jilles2011-04-171-2/+2
| | | | | | | | | | | The code provides information on how the signal was generated. Formerly, the code was only logged for traps, much like only signal handlers for traps received a meaningful si_code before FreeBSD 7.0. In rare cases, no information is available and 0 is still logged. MFC after: 1 week
* Fix several places to ignore processes that are not yet fully constructed.jhb2011-04-061-2/+4
| | | | MFC after: 1 week
* Small style fix.jhb2011-03-231-1/+1
|
* Allow debugger to specify that children of the traced process should bekib2011-01-251-0/+4
| | | | | | | | automatically traced. Extend the ptrace(PL_LWPINFO) to report that child just forked. Reviewed by: davidxu, jhb MFC after: 2 weeks
* In kern_sigtimedwait(), move initialization code out of process lock,davidxu2010-10-141-103/+86
| | | | | | | | | | | | | instead of using SIGISMEMBER to test every interesting signal, just unmask the signal set and let cursig() return one, get the signal after it returns, call reschedule_signal() after signals are blocked again. In kern_sigprocmask(), don't call reschedule_signal() when it is unnecessary. In reschedule_signal(), replace SIGISEMPTY() + SIGISMEMBER() with sig_ffs(), rename variable 'i' to sig.
* sigqueue_collect_set() is no longer needed because other functionsdavidxu2010-10-131-29/+7
| | | | maintain pending set correctly.
* Create a global thread hash table to speed up thread lookup, usedavidxu2010-10-091-17/+11
| | | | | | | | | | rwlock to protect the table. In old code, thread lookup is done with process lock held, to find a thread, kernel has to iterate through process and thread list, this is quite inefficient. With this change, test shows in extreme case performance is dramatically improved. Earlier patch was reviewed by: jhb, julian
* Replace sbuf_overflowed() with sbuf_error(), which returns any errormdf2010-09-101-1/+1
| | | | | | code associated with overflow or with the drain function. While this function is not expected to be used often, it produces more information in the form of an errno that sbuf_overflowed() did.
* rescure comments from RELENG_4.davidxu2010-09-011-0/+12
|
* If a process is being debugged, skips job control caused by SIGSTOP/SIGCONTdavidxu2010-08-311-13/+6
| | | | | | | | | signals, because it is managed by debugger, however a normal signal sent to a interruptibly sleeping thread wakes up the thread so it will handle the signal when the process leaves the stopped state. PR: 150138 MFC after: 1 week
* Add an extra comment to the SDT probes definition. This allows us to getrpaulo2010-08-221-3/+3
| | | | | | | | | use '-' in probe names, matching the probe names in Solaris.[1] Add userland SDT probes definitions to sys/sdt.h. Sponsored by: The FreeBSD Foundation Discussed with: rwaston [1]
* Fix function name in error messages.davidxu2010-07-201-2/+2
|
* - Various style and whitespace fixes.jhb2010-07-081-2/+2
| | | | | | | - Make sugid_coredump and kern_logsigexit private to kern_sig.c. Submitted by: bde (partially) MFC after: 1 month
* Extend ptrace(PT_LWPINFO) to report siginfo for the signal that causedkib2010-07-041-9/+8
| | | | | | | debugee stop. The change should keep the ABI. Take care of compat32. Discussed with: davidxu, jhb MFC after: 2 weeks
OpenPOWER on IntegriCloud