Commit Graph

330 Commits

Author SHA1 Message Date
martin
abb6b48937 Allow emulations to override the creation of ktrace records for posting
signals. In compat_netbsd32 use this to write the 32bit version of
the records, so a 32bit userland kdump is happy.
2016-09-13 07:39:45 +00:00
hannken
b3aa7e069f siggetinfo: use TAILQ_FOREACH_SAFE as the element gets removed from the list. 2016-08-21 15:24:17 +00:00
christos
c10c4abe0f Realtime signal support from GSoC 2016, Charles Cui. 2016-08-04 06:43:43 +00:00
christos
41f8fdba9d Simplify 2016-04-28 00:37:39 +00:00
christos
cbf2c4d885 We need a flag for WCONTINUED so that we can reset it... Fixes bash issue. 2016-04-27 21:15:40 +00:00
christos
9fe48813ae don't create ktrace records if we were not asked. 2016-04-06 03:11:31 +00:00
christos
5ba99e8511 Add parent notification on SIGCONT as required by waitid(2)/wait6(2) 2016-04-06 00:48:30 +00:00
christos
5c35dbcd66 no need to pass the coredump flag to exit1() since it is set and known
in one place.
2016-04-04 23:07:06 +00:00
christos
4fbdf206cb Split p_xstat (composite wait(2) status code, or signal number depending
on context) into:
1. p_xexit:		exit code
2. p_xsig:		signal number
3. p_sflag & WCOREFLAG	bit to indicated that the process core-dumped.

Fix the documentation of the flag bits in <sys/proc.h>
2016-04-04 20:47:57 +00:00
pgoyette
764be6be1d When delivering a signal, it's possible that the process's state in
p_stat is SACTIVE yet p_sflag is PS_STOPPING (while waiting for other
lwp's to stop).  In that case, we don't want to adjust the parent's
p_nstopchild count.

Found by Robert Elz.

XXX Pullups to: NetBSD-7, -6{,-0,-1}, and -5{,-0,-1,-2}
2015-10-13 07:00:59 +00:00
christos
db70f1818e Change SDT (Statically Defined Tracing) probes to use link sets so that it
is easier to add probes. (From FreeBSD)
2015-10-02 16:54:15 +00:00
christos
471b216b8f convert vmem, signals, powerhooks from CIRCLEQ -> TAILQ. 2013-11-22 21:04:11 +00:00
riz
c02fb3c915 Add another field to the SDT_PROBE_DEFINE macro, so our DTrace probes
can named the same as those on other platforms.

For example, proc:::exec-success, not proc:::exec_success.

Implementation follows the same basic principle as FreeBSD's; add
another field to the SDT_PROBE_DEFINE macro which is the name
as exposed to userland.
2013-06-09 01:13:47 +00:00
rmind
ad12c77015 Remove COMPAT_SA / KERN_SA. Welcome to 6.99.3!
Approved by core@.
2012-02-19 21:05:51 +00:00
reinoud
981eb029d6 Fix sigactsunshare() to do what the manpage and the commit tells it to do!
I.e. unshare a process its sigacts by creating a new one BUT maintaining all
signal state.

The old code would CLEAR all the signal state. It used to work only due to the
fact that sigactunshare() is only used in execsigs() and the fact that
SIG_DFL was NULL.
2011-09-16 22:07:17 +00:00
christos
4a0c950526 don't delete signal from the debugger. 2011-09-04 23:03:00 +00:00
christos
04056fb8c6 Split sigget into sigget() and siggetinfo(). When a signal comes from the
debugger (l->l_sigpendset == NULL), using siggetinfo() try to fetch the
siginfo information from l->l_sigpend and then from p->p_sigpend if it
was not found. This allows us to pass siginfo information for traps from
the debugger.
2011-09-04 13:09:12 +00:00
christos
6f879bd995 PR/45327: Jared McNeill: ptrace: siginfo doesn't work with traced processes
When saving the signal in p->p_xstat, clear it from the pending mask, but
don't remove it from the siginfo queue, so that next time the debugger
delivers it, the original information is found.
When posting a signal from the debugger l->l_sigpendset is not set, so we
use the process pending signal and add it back to the process pending set.
2011-09-03 19:33:40 +00:00
rmind
0479426ceb sigispending: simplify a little. 2011-08-31 22:43:19 +00:00
christos
0330b42b89 Make sigispending() return the signal that is pending, or 0. Fix the comment
that said that it returns true or false (it returned EINTR or 0 before).
Perhaps we should rename the function now?
2011-08-31 16:05:44 +00:00
uebayasi
bf4e691e73 Include uvm/uvm_extern.h only once. 2011-07-27 13:45:49 +00:00
yamt
cd31d483de sigpost: don't interfere coredump. PR/45032 2011-07-26 13:33:43 +00:00
rmind
69a047faf7 Make stopsigmask static, sprinkle __cacheline_aligned and __read_mostly. 2011-04-27 00:38:37 +00:00
uebayasi
9d567f003d Include internal definitions (uvm/uvm.h) only where necessary. 2011-01-17 07:13:31 +00:00
rmind
3c507045e2 Remove pfind() and pgfind(), fix locking in various broken uses of these.
Rename real routines to proc_find() and pgrp_find(), remove PFIND_* flags
and have consistent behaviour.  Provide proc_find_raw() for special cases.
Fix memory leak in sysctl_proc_corename().

COMPAT_LINUX: rework ptrace() locking, minimise differences between
different versions per-arch.

Note: while this change adds some formal cosmetics for COMPAT_DARWIN and
COMPAT_IRIX - locking there is utterly broken (for ages).

Fixes PR/43176.
2010-07-01 02:38:26 +00:00
christos
ca843a73b0 PR/43128: Paul Koning: Threads support in ptrace() is insufficient for gdb to
debug threaded live apps: Add an optional lwpid in PT_STEP and PT_CONTINUE to
indicate which lwp to operate on, and implement the glue required to make it
work.
2010-04-06 13:50:22 +00:00
yamt
b1521a3612 remove redundant checks of PK_MARKER. 2010-03-03 00:47:30 +00:00
darran
6a9056a926 DTrace: Add an SDT (Statically Defined Tracing) provider framework, and
implement most of the proc provider.  Adds proc:::create, exec,
exec_success, exec_faillure, signal_send, signal_discard, signal_handle,
lwp_create, lwp_start, lwp_exit.
2010-03-01 21:10:13 +00:00
rmind
ffb9a7ee3c sigactsunshare(): set reference count in a case of new sigacts allocation.
Bug (e.g. memory leak) can happen when using clone(2) call.
2009-12-30 23:31:56 +00:00
rmind
3c74cdf150 signal(9) code: add some comments, improve/fix wrong ones. While here, kill
trailing whitespaces, wrap long lines, etc.  No functional changes intended.
2009-12-20 04:49:09 +00:00
rmind
16347a5be7 kpsignal2: do not make the signal pending twice when tracing the process,
also update a comment and add an assert.  Fixes PR/42309 by Nicolas Joly.
2009-11-14 19:06:54 +00:00
elad
8751f894d8 Put signal delivery policy back in the subsystem. 2009-10-02 23:24:15 +00:00
ad
d991fcb3b6 More changes to improve kern_descrip.c.
- Avoid atomics in more places.
- Remove the per-descriptor mutex, and just use filedesc_t::fd_lock.
  It was only being used to synchronize close, and in any case we needed
  to take fd_lock to free the descriptor slot.
- Optimize certain paths for the <NDFDFILE case.
- Sprinkle more comments and assertions.
- Cache more stuff in filedesc_t.
- Fix numerous minor bugs spotted along the way.
- Restructure how the open files array is maintained, for clarity and so
  that we can eliminate the membar_consumer() call in fd_getfile().  This is
  mostly syntactic sugar; the main functional change is that fd_nfiles now
  lives alongside the open file array.

Some measurements with libmicro:

- simple file syscalls are like close() are between 1 to 10% faster.
- some nice improvements, e.g. poll(1000) which is ~50% faster.
2009-05-24 21:41:25 +00:00
rmind
be5c9950c6 kpsignal2: do not start process (when it is stopped) for all termination
signals (i.e. SA_KILL), just if SIGKILL (or SIGCONT).  Improve comments.

Make some functions static, remove unused sigrealloc() prototype.

Fixes PR/39814.  Similar patch reviewed by <ad>.
2009-03-29 05:02:46 +00:00
drochner
083fa0419a In sigput(), save the siginfo no matter whether SA_SIGINFO is set or not.
There are also sigtimedwait(2) et al. to catch signals without invoking
a signal handler. Fixes PR kern/41076 by Matteo Beccati (the first
test case, where the signal is sent before sigwaitinfo(2) gets called).
2009-03-27 10:58:38 +00:00
yamt
cb1e92d5d5 malloc -> kmem_alloc 2009-01-22 14:38:34 +00:00
ad
7a3593355a Fix a comment. 2008-12-13 20:49:49 +00:00
ad
24da1f6ca4 PR kern/36183 problem with ptrace and multithreaded processes
Fix the famous "gdb + threads = panic" problem.
Also, fix another revivesa merge botch.
2008-12-13 20:43:38 +00:00
ad
2e606b7b1b sigchecktrace: process SIGKILL before everything else. 2008-12-13 18:55:01 +00:00
ad
c90afa3efc vax uses v3 trampoline. 2008-11-25 15:05:38 +00:00
ad
92ce8c6a3d Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
2008-11-19 18:35:57 +00:00
wrstuden
0a30ab777e toall signals really are toall. The fact we're sa doesn't matter.
They are start/stop signals, and need to impact more than just
blessed lwps.
2008-10-24 18:07:36 +00:00
wrstuden
fc7511b00e Merge wrstuden-revivesa into HEAD. 2008-10-15 06:51:17 +00:00
christos
0ff103ebea - remove dup code
- make sure that sigput always initializes ksi
- initialize si_code with SI_NOINFO instead of lying (SI_USER)
- if a process is being ktraced, make siginfo available
- always pass the available siginfo to ktrace, even if it has SI_NOINFO
2008-09-12 21:33:39 +00:00
ad
40818746b1 Use pool_cache. 2008-06-25 11:05:46 +00:00
ad
5adf7333fd - PPWAIT is need only be locked by proc_lock, so move it to proc::p_lflag.
- Remove a few needless lock acquires from exec/fork/exit.
- Sprinkle branch hints.

No functional change.
2008-06-16 09:51:14 +00:00
ad
245f0726ac Reduce ifdefs due to MULTIPROCESSOR slightly. 2008-05-19 17:06:02 +00:00
ad
1074fa7182 Ignore processes with PK_MARKER set. 2008-04-29 15:55:24 +00:00
ad
ddeba2439c Ignore processes with PK_MARKER set. 2008-04-29 15:51:23 +00:00
ad
254bed5bd3 Fix a race condition that could cause a deadlock between two threads in
the same process simultaneously trying to dump core. Fixes PR kern/37704.
2008-04-29 14:04:06 +00:00