summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_sig.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix the lock order reversal problem in the code that stops tracedkettenis2014-02-091-9/+35
| | | | | | | | | | | | | | | | | multi-threaded processes when they receive a signal: 1. Make the parent of the process (the tracer) wait for all threads to be stopped (in wait4(2)) instead of the thread that received the signal. This prevents us from calling tsleep(9) recursively. 2. Assume that we already hold the kernel lock if the P_SINTR flag is set (just like we already assumed we were holding the scheduler lock) and don't try to grab it again. This should fix the panic that many people reported when debugging multi-threaded programs with gdb(1). ok & lots of help from guenther@
* bzero -> memsettedu2014-01-211-3/+3
|
* Threads can't be zombies, only processes, so change zombproc to zombprocess,guenther2014-01-201-12/+15
| | | | | | | | make it a list of processes, and change P_NOZOMBIE and P_STOPPED from thread flags to process flags. Add allprocess list for the code that just wants to see processes. ok tedu@
* Fix delivery of SIGPROF and SIGVTALRM to threaded processes by havingguenther2013-10-081-1/+15
| | | | | | | | hardclock() set a flag on the running thread and force AST processing, and then have the thread signal itself from userret(). idea and flag names from FreeBSD ok jsing@
* If a thread sends a signal to its own process, then have that threadguenther2013-10-081-19/+31
| | | | | | take the signal by preference if it's eligible (unblocked or sigwaiting). ok jsing@
* Tweak commentguenther2013-10-061-2/+2
|
* some small style changes that are distracting me from seeing a real bugtedu2013-06-011-15/+10
|
* Extend P_SIGSUSPEND handling in userret() to properly restore thematthew2013-04-291-1/+15
| | | | | | | | | | | | | | | sigmask even if there are no pending signals under the temporary sigmask. Refactor existing select() and poll() system calls to introduce the pselect() and ppoll() system calls. Add rthread wrappers for pselect() and ppoll(). While there, update cancellation point comments to reflect recent fdatasync() addition. Minor bumps for libc and librthread due to new symbols. ok guenther, millert, deraadt, jmc
* i missed a file, crap. found by deraadttedu2013-04-061-4/+1
|
* do not include machine/cpu.h from a .c file; it is the responsibility ofderaadt2013-03-281-2/+1
| | | | | .h files to pull it in, if needed ok tedu
* Insufficient levels of hops in the local brew led to Theo and I muckingguenther2013-02-081-13/+12
| | | | | | up the VFS calls in the error paths in coredump() Pointed out by armani@, ok beck@
* Allow SIGKILL to terminate coredumping processes. Semantics decidedderaadt2013-01-151-1/+14
| | | | | with kettenis guenther and beck. ok guenther
* Slice & dice coredump write requests into MAXPHYS blocks, andderaadt2013-01-151-18/+45
| | | | | | yield between operations. Re-grab the vnode every operation, so that multiple coredumps can be saved at the same time. ok guenther beck etc
* Determine whether we're currently on the alternative signal stackguenther2012-12-021-4/+20
| | | | | | | | | dynamically, by comparing the stack pointer against the altstack base and size, so that you get the correct answer if you longjmp out of the signal handler, as tested by regress/sys/kern/stackjmp/. Also, fix alt stack handling on vax, where it was completely broken. Testing and corrections by miod@, krw@, tobiasu@, pirofti@
* If a thread calls __threxit() or _exit() immediately after anotherguenther2012-10-171-2/+13
| | | | | | | | thread coredumps, the former thread needs to be released by the later single_thread_set(SINGLE_EXIT) call, even though its P_WEXIT flag is set. ok kettenis@
* exit1(EXIT_THREAD) needs to call single_thread_check() so that itguenther2012-07-111-2/+2
| | | | | | | | can be suspended and/or decrement pr->ps_singlecount if necessary. With that added, the call the other direction needs to use its own flag (EXIT_THREAD_NOCHECK) to avoid looping. problem diagnosed from a hang naddy@ hit; ok kettenis@
* EVFILT_SIGNAL and EVFILT_PROC events need to track the process they'reguenther2012-06-061-6/+6
| | | | | | attached to and not just the thread, which can go away. Problem observed by jsg@; ok jsg@ matthew@
* First stab at making ptrace(2) usable for debugging multi-threaded programs.kettenis2012-04-131-4/+12
| | | | | | | | | | It implements a full-stop model where all threads are stopped before handing over control to the debugger. Events are reported as before through wait(2); you will have to call ptrace(PT_GET_PROCESS_STATE, ...) to find out which thread hit the event. Since this changes the size of struct ptrace_state, you will have to recompile gdb. ok guenther@
* move accounting flags to struct process; idea and ok guenthermikeb2012-04-121-3/+3
|
* Move the P_WAITED flag from struct proc to struct process.kettenis2012-04-111-2/+2
| | | | ok guenther@
* Make rusage totals, itimers, and profile settings per-process insteadguenther2012-03-231-3/+3
| | | | | | | of per-rthread. Handling of per-thread tick and runtime counters inspired by how FreeBSD does it. ok kettenis@
* Add tracing and dumping of "pointer to struct" syscall arguments forguenther2012-03-191-1/+20
| | | | | | structs timespec, timeval, sigaction, and rlimit. ok otto@ jsing@
* Give sigwait priority over ptrace to avoid panicguenther2012-03-101-5/+7
|
* Add PS_EXITING to better differentiate between the process exiting andguenther2012-03-101-4/+3
| | | | the main thread exiting. c.f. regress/sys/kern/main-thread-exited/
* First steps for making ptrace work with rthreads:guenther2012-02-201-14/+18
| | | | | | | | | | - move the P_TRACED and P_INEXEC flags, and p_oppid, p_ptmask, and p_ptstat member from struct proc to struct process - sort the PT_* requests into those that take a PID vs those that can also take a TID - stub in PT_GET_THREAD_FIRST and PT_GET_THREAD_NEXT ok kettenis@
* A signal handled by __thrsigdivert() shouldn't be marked pendingguenther2012-01-251-15/+30
| | | | | | | | for the thread handling it. Otherwise (i.e., no sig divert), prefer to deliver a process-aimed signal to some thread which doesn't have the signal blocked. ok tedu@
* Reimplement mutexes, condvars, and rwlocks to eliminate bugs,guenther2012-01-171-3/+3
| | | | | | | | | | | | | particularly the "consume the signal you just sent" hang, and putting the wait queues in userspace. Do cancellation handling in pthread_cond_*wait(), pthread_join(), and sem_wait(). Add __ prefix to thr{sleep,wakeup,exit,sigdivert}() syscalls; add 'abort" argument to thrsleep to close cancellation race; make thr{sleep,wakeup} return errno values via *retval to avoid touching userspace errno.
* Suspend other rthreads before dumping core or execing; make them exitguenther2011-12-111-2/+164
| | | | | | when exec succeeds. ok jsing@
* Move struct proc's sigaltstack struct from the zeroed area into thejoshe2011-11-221-4/+13
| | | | | | | | | copied area, and initialize it properly in the FORK_THREAD case. This restores the behavior of a forked process inheriting its parent's signal stack. ok guenther@
* Make userret() MI. On architectures which jammed stuff into it in thederaadt2011-11-161-1/+12
| | | | | past, pull that code out seperately. ok guenther miod
* Change fork1() and kthread_create() to match the rest of the treeguenther2011-11-091-7/+6
| | | | | | | | and use curp vs p instead of p1 vs p2. Add curpr and pr variables for the respective struct processes. Make sigactsshare() return the shared sigacts intead of taking the struct proc to update. ok deraadt@
* MD trap() passes a MD "traptype" and siginfo-style "code" up to the MIderaadt2011-09-201-24/+23
| | | | | | | | | | layers. Then things get terribly confusing because the various MI layers swap variable names for parameters, local variables, and structure fields numerous times. Unconfuse all this mess. Note that exec_elf.c coredump cpi_sigcode used to contain the MD traptype but will now contain the MI siginfo-style "code" value. ok miod kettenis pirofti
* Revert art@'s moving around of the KERNEL_LOCK()/KERNEL_UNLOCK() calls,guenther2011-07-111-5/+2
| | | | | | as it causes hangs in some ports, including libsigsegv's configure script confirmed by krw@, landry@
* More syscalls.master cleanup:matthew2011-07-091-45/+1
| | | | | | | | | | | | | | sys_osigaltstack() is 7 years old and no longer needed; all glory to the sys_sigaltstack()! sys_ogetdirentries() is about 9 months old, but still acceptable within our release cycle; move from STD to COMPAT_48 to make this clearer for tedu@ next year. sys_sbrk() and sys_sstk() are completely obsolete: all they do is return ENOSYS. ok guenther@
* There is a bunch of places in the kernel entry points where we don'tart2011-07-071-2/+5
| | | | | | | | | | | hold the kernel lock, but still need call one function that needs it. Instead of grabbing the lock all over the place, move the locks into the affected functions: trapsignal, scdebug*, ktrsyscall, ktrsysret, systrace_redirect and ADDUPROF. In the cases we already hold the biglock we'll just recurse. kettenis@, beck@ ok
* Clean up after P_BIGLOCK removal.art2011-07-061-3/+3
| | | | | | | KERNEL_PROC_LOCK -> KERNEL_LOCK KERNEL_PROC_UNLOCK -> KERNEL_UNLOCK oga@ ok
* Recommit the reverted sigacts change now that the NFS use-after-freeguenther2011-07-051-86/+81
| | | | | | | | problem has been tracked down. This fixes the sharing of the signal handling state: shared bits go in sigacts, per-rthread bits goes in struct proc. ok deraadt@
* Revert the sigacts diff: NFS can apparently retain pointers to processesguenther2011-04-181-81/+86
| | | | | | until they're zombies and then send them signals (for intr mounts). Until that is untangled, the sigacts change is unsafe. sthen@ was the victim for this one
* Correct the sharing of the signal handling state: stuff that shouldguenther2011-04-151-86/+81
| | | | | | | | | | | | be shared (p_sigignore, p_sigcatch, P_NOCLDSTOP, P_NOCLDWAIT) moves to struct sigacts, wihle stuff that should be per rthread (ps_oldmask, SAS_OLDMASK, ps_sigstk) moves to struct proc. Treat the coredumping state bits (ps_sig, ps_code, ps_type, ps_sigval) as per-rthread until our locking around coredumping is better. Oh, and remove the old SunOS-compat ps_usertramp member. "I like the sound of this" tedu@
* Move PPWAIT flag from struct proc to process, so that rthreads inguenther2011-04-031-4/+5
| | | | | | | | | a vforked child behave correctly. Have the parent in a vfork() wait on a (different) flag in *its* process instead of the child to prevent a possible use-after-free. When ktracing the child return from a fork, call it rfork if an rthread was created. ok blambert@
* Move P_SUGID and P_SUGIDEXEC from struct proc to struct process, soguenther2011-04-021-4/+4
| | | | | | that you can't evade the checks by doing the dirty work in an rthread ok blambert@, deraadt@
* The scheduling 'nice' value is per-process, not per-thread, so move itguenther2011-03-071-3/+3
| | | | | | into struct process. ok tedu@ deraadt@
* Correct the links between threads, processes, pgrps, and sessions,guenther2010-07-261-29/+30
| | | | | | | | | so that the process-level stuff is to/from struct process and not struct proc. This fixes a bunch of problem cases in rthreads. Based on earlier work by blambert and myself, but mostly written at c2k10. Tested by many: deraadt, sthen, krw, ray, and in snapshots
* remove support for compat_sunos (and m68k4k). ok deraadt guenthertedu2010-07-021-12/+1
|
* Always identify threads with THREAD_PID_OFFSET, so that there's noguenther2010-07-011-11/+12
| | | | | | way a kill() intended for a thread can result in a separate process getting the signal. ok tedu@ art@
* lots of SCARG simplification. ok matthewtedu2010-06-301-20/+34
|
* Strip out ancient bits in struct user that were still used only byguenther2010-06-291-4/+1
| | | | | the now-removed HPUX compat code. ok and build testing deraadt@
* less SCARG, more pretty. ok guenthertedu2010-06-291-14/+15
|
* Eliminate RTHREADS kernel option in favor of a sysctl. The actual statustedu2010-06-291-21/+6
| | | | | (not done) hasn't changed, but now it's less work to test things. ok art deraadt
* <sys/time.b> is for ftime(), which is just in libcompat and not the kernel,guenther2010-06-281-2/+1
| | | | | so stop including it in kernel .c files. "sure" deraadt@