summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_sig.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* Rename pfind(9) into tfind(9) to reflect that it deals with threads.mpi2017-01-241-2/+2
| | | | | | While here document prfind(9. with and ok guenther@
* p_comm is the process's command and isn't per thread, so move it fromguenther2017-01-211-6/+7
| | | | | | struct proc to struct process. ok deraadt@ kettenis@
* Display/test/use the process PID, not the thread's TID, in a few places.guenther2016-10-051-8/+8
| | | | ok mpi@ mikeb@
* all pools have their ipl set via pool_setipl, so fold it into pool_init.dlg2016-09-151-4/+3
| | | | | | | | | | | | | | | | | | | | | | the ioff argument to pool_init() is unused and has been for many years, so this replaces it with an ipl argument. because the ipl will be set on init we no longer need pool_setipl. most of these changes have been done with coccinelle using the spatch below. cocci sucks at formatting code though, so i fixed that by hand. the manpage and subr_pool.c bits i did myself. ok tedu@ jmatthew@ @ipl@ expression pp; expression ipl; expression s, a, o, f, m, p; @@ -pool_init(pp, s, a, o, f, m, p); -pool_setipl(pp, ipl); +pool_init(pp, s, a, ipl, f, m, p);
* Remove sys_o58_kill since OpenBSD 6.0 has been tagged/released.jsing2016-09-041-58/+1
| | | | ok deraadt@
* pool_setipldlg2016-08-251-1/+2
| | | | ok kettenis@
* Prevent silly states via knotes on pids > 2^32 and on nonexistent signals.guenther2016-07-141-1/+4
| | | | ok tedu@
* fix several places where calculating ticks could overflow.tedu2016-07-061-3/+3
| | | | | | | | it's not enough to assign to an unsigned type because if the arithmetic overflows the compiler may decide to do anything. so change all the long long casts to uint64_t so that we start with the right type. reported by Tim Newsham of NCC. ok deraadt
* Repair kill(2) on zombie processes.jca2016-06-271-4/+9
| | | | | | | | | | kill(2) is supposed to find zombie processes, this probably got broken when the process reaper was introduced. As a temporary(tm) workaround, walk the list of zombie processes if we can't find the target pid in the main process list. Problem with zsh initially reported by Geoff Wozniak on misc@, analysis done by naddy@. ok kettenis@ tedu@
* Restore the sys_o58_kill system call.jsing2016-06-271-1/+58
| | | | | | | | | | | | | By keeping both the new (sys_kill/sys_thrkill) and old (sys_o58_kill) system calls for the OpenBSD 6.0 release, code that uses either of these mechanisms will work on both of the supported OpenBSD releases. This provides a clean transition for runtimes that make direct system calls (namely the Go programming language). This requires a minimal amount of non-intrusive code and does not block development progress within OpenBSD. ok deraadt@ guenther@
* if the timeout rounds to zero, make it one tick, otherwise we sleeptedu2016-06-111-1/+6
| | | | | | forever. noticed by Davin McCall. while here, if the timeout actually is zero, return appropriate error. ok guenther.
* sys_o58_kill is no longer needed for compat.deraadt2016-05-311-58/+1
| | | | ok guenther sthen
* Use a macro to check if a thread has a sibling.mpi2016-03-291-3/+2
| | | | | | | Note that without locking a thread cannot claim that it is part of a multi-threaded process using this macro. Suggested by miod@, ok guenther@
* add newline on the end of the failure messagebeck2016-03-261-3/+3
| | | | ok deraadt@
* Remove the unused flags argument from VOP_UNLOCK().natano2016-03-191-4/+4
| | | | | | torture tested on amd64, i386 and macppc ok beck mpi stefan "the change looks right" deraadt
* Correct some comments and definitions, from Michal Mazurek.mpi2016-03-091-3/+3
|
* drop "abort" promise, and make it the default behaviour.semarie2016-01-091-2/+1
| | | | | | | | | The current code has already setted it by default since 1.74 any pledge failure tries to make a coredump (default rules for coredump still applies: so setuid binaries don't create them locally). ok deraadt@
* remove stale lint annotationstedu2015-12-051-5/+1
|
* Split the intra-thread functionality from kill(2) into its own syscallguenther2015-11-101-5/+82
| | | | | | | | | | | | thrkill(2), rolling the kill(2) syscall number with the ABI change to avoid breaking binaries during during the transition. thrkill(2) includes a 'tcb' argument that eliminates the need for locking in pthread_kill() and simplifies pthread_cancel(). Switch __stack_smash_handler() to use thrkill(2) and explicitly unblock SIGABRT. Minor bump to both libc and libpthread: make sure you install a new kernel! ok semarie@
* move the pledgenote annotation from `struct proc' to `struct nameidata'semarie2015-11-021-2/+2
| | | | | | | | | | pledgenote is used for annotate the policy for a namei context. So make it tracking the nameidata. It is expected for the caller to explicitly define the policy. It is a kernel bug to not do so. ok deraadt@
* refactor pledge_*_check and pledge_fail functionssemarie2015-11-011-10/+4
| | | | | | | | | | | | | | - rename _check function without suffix: a "pledge" function called from anywhere is a "check" function. - makes pledge_fail call the responsability to the _check function. remove it from caller. - make proper use of (potential) returned error of _check() functions. - adds pledge_kill() and pledge_protexec() with and OK deraadt@
* Fold "malloc" into "stdio" and -- recognizing that no program so far hasderaadt2015-10-251-3/+3
| | | | | | | | | | | | | | | used less than "stdio" -- include all the "self" operations. Instead of different defines, use regular PLEDGE_* in the "p_pledgenote" variable (which indicates the operation subtype a system call is performing). Many checks before easier to understand. p_pledgenote can often be passed directly to ktrace, so that kdump says: 15565 test CALL pledge(0xa9a3f804c51,0) 15565 test STRU pledge request="stdio" 15565 test RET pledge 0 15565 test CALL open(0xa9a3f804c57,0x2<O_RDWR>) 15565 test NAMI "/tmp/testfile" 15565 test PLDG open, "wpath", errno 1 Operation not permitted with help from semarie, ok guenther
* pid 0 also implies self, so allow that for the pledge case. Found inderaadt2015-10-101-2/+3
| | | | a refactoring being done for the bc/dc relationship with otto.
* Allow kill(self, sig) in pledge SELF also. the stack protector, abort(),deraadt2015-10-091-1/+10
| | | | | and readpassphrase() in particular use this. ok millert tedu semarie
* Rename tame() to pledge(). This fairly interface has evolved to be morederaadt2015-10-091-2/+2
| | | | | | strict than anticipated. It allows a programmer to pledge/promise/covenant that their program will operate within an easily defined subset of the Unix environment, or it pays the price.
* Rather than disabling tame to coredump, leave it enabled but flag thatderaadt2015-07-271-2/+2
| | | | | a coredump is happening. This improves behaviour while threaded. ok semarie
* Fix annoying console spew when we can't write the core file. use log instead.beck2015-07-201-6/+8
| | | | ok krw@ sthen@ comments from deraadt@, miod@
* tame(2) is a subsystem which restricts programs into a "reduced featurederaadt2015-07-191-1/+2
| | | | | | operating model". This is the kernel component; various changes should proceed in-tree for a while before userland programs start using it. ok miod, discussions and help from many
* emul_native is only used for kernel threads which can't dump core, soguenther2015-05-051-40/+4
| | | | | | | | | | | delete coredump_trad(), uvm_coredump(), cpu_coredump(), struct md_coredump, and various #includes that are superfluous. This leaves compat_linux processes without a coredump callback. If that ability is desired, someone should update it to use coredump_elf32() and verify the results... ok kettenis@
* 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@