summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_sig.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* Remove some includes include-what-you-use claims don'tjsg2015-03-141-2/+1
| | | | | | | have any direct symbols used. Tested for indirect use by compiling amd64/i386/sparc64 kernels. ok tedu@ deraadt@
* make sigprocmask(2) not take the kernel lockpelikan2015-02-091-10/+7
| | | | | | Tests on a 4-core CPU show setjmp(3) run four times as fast under load. discussed on tech@ some time ago, now by kettenis and guenther, ok deraadt
* start retiring the nointr allocator. specify PR_WAITOK as a flag as atedu2014-12-191-3/+3
| | | | marker for which pools are not interrupt safe. ok dlg
* primary change: move uvm_vnode out of vnode, keeping only a pointer.tedu2014-12-161-1/+3
| | | | | | objective: vnode.h doesn't include uvm_extern.h anymore. followup changes: include uvm_extern.h or lock.h where necessary. ok and help from deraadt
* Rework the __thrsigdivert (aka sigwait()) handling: instead of interferingguenther2014-11-161-63/+71
| | | | | | | | | | in ptsignal(), which broke ptrace() in various circumstances, act more like sigsuspend() by updating the signal mask and picking off waited for signals when one occurs. Don't always restart when an unwaited-for-but-handled signal occurs, as that screws with both timeout calculation and cancellation. main problem noted by jmatthew@ ok tedu@
* Write the core file of a non-suid process into the current directorybluhm2014-08-101-3/+3
| | | | | | even if sysctl kern.nosuidcoredump has been set to 2 or 3. This allows a regular user to debug his programs again. OK guenther@ deraadt@
* Introduce PS_NOBROADCASTKILL a process flag that excludes processes fromclaudio2014-07-131-2/+3
| | | | | | | receiving broadcast signals (kill -1). The flag can be set via a new sysctl KERN_PROC_NOBROADCASTKILL. This will be used by iscsid to survive the mass killing by init(8) when terminating multi-user operations. With and OK guenther@
* KERNEL_ASSERT_LOCKED(9): Assertion for kernel lock (Rev. 3)uebayasi2014-07-131-7/+3
| | | | | | | | | | | | | | | This adds a new assertion macro, KERNEL_ASSERT_LOCKED(), to assert that kernel_lock is held. In the long process of removing kernel_lock, there will be a lot (hundreds or thousands) of use of this; virtually almost all functions in !MP-safe subsystems should have this assertion. Thus this assertion should have a short, good name. Not only that "KERNEL_ASSERT_LOCKED" is consistent with other KERNEL_* and SCHED_ASSERT_LOCKED() macros. Input from dlg@ guenther@ kettenis@. OK dlg@ guenther@
* Refactor out dosigsuspend() functionmatthew2014-07-121-11/+16
| | | | Discussed with guenther and kettenis
* It's init as a process that's special, not init's original thread.guenther2014-07-111-2/+2
| | | | | | Remember initprocess instead of initproc. ok matthew@ blambert@
* decouple struct uvmexp into a new file, so that uvm_extern.h and sysctl.hderaadt2014-07-081-4/+1
| | | | | don't need to be married. ok guenther miod beck jsing kettenis
* Track whether a process is a zombie or not yet fully built via flagsguenther2014-07-041-3/+2
| | | | | | | | | | | PS_{ZOMBIE,EMBRYO} on the process instead of peeking into the process's thread data. This eliminates the need for the thread-level SDEAD state. Change kvm_getprocs() (both the sysctl() and kvm backends) to report the "most active" scheduler state for the process's threads. tweaks kettenis@ feedback and ok matthew@
* If the kernel generates a deadly trap signal (SEGV, BUS, etc) forguenther2014-06-211-1/+12
| | | | | | | | | an untraced process but finds it blocking or ignoring it, just kill the process instead of looping. It's undefined behavor in POSIX but quite annoying when encountered in practice. improvements from kettenis@ ok matthew@
* Add PS_SYSTEM, the process-level mirror of the thread-level P_SYSTEM,guenther2014-05-041-9/+6
| | | | | | | and FORK_SYSTEM as a flag to set them. This eliminates needing to peek into other processes threads in various places. Inspired by NetBSD ok miod@ matthew@
* When kern.nosuidcoredump=3, act like =2 but try to dump cores intoderaadt2014-05-041-14/+40
| | | | | | | | | | | | | | | | | | the /var/crash/programname/ directory, as root. For instance, # mkdir /var/crash/bgpd/ # chmod 700 /var/crash/bgpd/ # If you skip this step, you are a moron # sysctl kern.nosuidcoredump=3 # bgpd # pkill -ABRT bgpd # ls /var/crash/bgpd/ 14764.core 23207.core 6423.core Of course, in real life the idea is that you don't kill the daemon but it crashes and you collect parallel cores. Careful you don't fill your /var. Further tuneables are being considered. Sorry to be picking on bgpd for this example. I've watched the "too difficult to debug privsep code" angst for far too long. ok guenther
* Have each thread keeps its own (counted!) reference to the process's ucredsguenther2014-04-181-7/+8
| | | | | | | | | to avoid possible use-after-free references when swapping ids in threaded processes. "Do I have the right creds?" checks are always made with the threads creds. Inspired by FreeBSD and NetBSD "right time" deraadt@
* Eliminates struct pcred by moving the real and saved ugids intoguenther2014-03-301-18/+24
| | | | | | | | | struct ucred; struct process then directly links to the ucred Based on a discussion at c2k10 or so before noting that FreeBSD and NetBSD did this too. ok matthew@
* Simply cansignal(), passing it processes instead of procs andguenther2014-03-261-20/+20
| | | | | | | dropping the pcred argument. Fix handling of kill(-1, sig) from a thread other than the original thread. ok deraadt@
* Move p_emul and p_sigcode from proc to process.guenther2014-03-261-9/+11
| | | | | | | | | Tweak the handling of ktrace EMUL when changing ktracing: only generate one per process (not one per thread) and pass the correct proc pointer down to the VFS layer. Permit generating of NAMI and CSW records inside ktrace(2) itself. ok deraadt@ millert@
* The kernel isn't involved in times(3); <sys/times.h> should never beguenther2014-03-241-2/+1
| | | | included there
* Move p_sigacts from struct proc to struct process.guenther2014-03-221-32/+36
| | | | testing help mpi@
* 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@