summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2002-02-22 19:19:33 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2002-02-22 19:19:33 +0000
commit8587f314348ce0067933e1207bbd0d1c15e33830 (patch)
treee2b6907021853a0db93493ae57f8c9867a65c7da /sys
parent73032fcd052b774b91d07262a83ecfacd6f61de5 (diff)
include a siginfo_t with ktrace PSIG information, so that kdump can print
fault addresses and other information. (a small bug exists: in some signal delivery cases, two PSIG records may be inserted, because postsig() is unaware a PSIG record has already been placed. but this small bug can stay since the siginfo_t information helps us find and fix other bugs)
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/kern_ktrace.c8
-rw-r--r--sys/kern/kern_sig.c25
-rw-r--r--sys/sys/ktrace.h6
3 files changed, 26 insertions, 13 deletions
diff --git a/sys/kern/kern_ktrace.c b/sys/kern/kern_ktrace.c
index 456fc6c9316..e9e5944f139 100644
--- a/sys/kern/kern_ktrace.c
+++ b/sys/kern/kern_ktrace.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_ktrace.c,v 1.25 2001/11/06 19:53:20 miod Exp $ */
+/* $OpenBSD: kern_ktrace.c,v 1.26 2002/02/22 19:19:28 deraadt Exp $ */
/* $NetBSD: kern_ktrace.c,v 1.23 1996/02/09 18:59:36 christos Exp $ */
/*
@@ -244,14 +244,15 @@ ktrgenio(p, fd, rw, iov, len, error)
}
void
-ktrpsig(p, sig, action, mask, code)
+ktrpsig(p, sig, action, mask, code, si)
struct proc *p;
int sig;
sig_t action;
int mask, code;
+ siginfo_t *si;
{
struct ktr_header kth;
- struct ktr_psig kp;
+ struct ktr_psig kp;
p->p_traceflag |= KTRFAC_ACTIVE;
ktrinitheader(&kth, p, KTR_PSIG);
@@ -259,6 +260,7 @@ ktrpsig(p, sig, action, mask, code)
kp.action = action;
kp.mask = mask;
kp.code = code;
+ kp.si = *si;
kth.ktr_buf = (caddr_t)&kp;
kth.ktr_len = sizeof (struct ktr_psig);
diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c
index 989ba8c085f..450aa0df795 100644
--- a/sys/kern/kern_sig.c
+++ b/sys/kern/kern_sig.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_sig.c,v 1.54 2002/01/31 02:12:18 weingart Exp $ */
+/* $OpenBSD: kern_sig.c,v 1.55 2002/02/22 19:19:28 deraadt Exp $ */
/* $NetBSD: kern_sig.c,v 1.54 1996/04/22 01:38:32 christos Exp $ */
/*
@@ -719,15 +719,19 @@ trapsignal(p, signum, code, type, sigval)
register struct sigacts *ps = p->p_sigacts;
int mask;
+#ifdef KTRACE
+ if (KTRPOINT(p, KTR_PSIG)) {
+ siginfo_t si;
+
+ initsiginfo(&si, signum, code, type, sigval);
+ ktrpsig(p, signum, ps->ps_sigact[signum],
+ p->p_sigmask, code, &si);
+ }
+#endif
mask = sigmask(signum);
if ((p->p_flag & P_TRACED) == 0 && (p->p_sigcatch & mask) != 0 &&
(p->p_sigmask & mask) == 0) {
p->p_stats->p_ru.ru_nsignals++;
-#ifdef KTRACE
- if (KTRPOINT(p, KTR_PSIG))
- ktrpsig(p, signum, ps->ps_sigact[signum],
- p->p_sigmask, code);
-#endif
(*p->p_emul->e_sendsig)(ps->ps_sigact[signum], signum,
p->p_sigmask, code, type, sigval);
p->p_sigmask |= ps->ps_catchmask[signum];
@@ -1151,9 +1155,14 @@ postsig(signum)
p->p_siglist &= ~mask;
action = ps->ps_sigact[signum];
#ifdef KTRACE
- if (KTRPOINT(p, KTR_PSIG))
+ if (KTRPOINT(p, KTR_PSIG)) {
+ siginfo_t si;
+
+ null_sigval.sival_ptr = 0;
+ initsiginfo(&si, signum, 0, SI_USER, null_sigval);
ktrpsig(p, signum, action, ps->ps_flags & SAS_OLDMASK ?
- ps->ps_oldmask : p->p_sigmask, 0);
+ ps->ps_oldmask : p->p_sigmask, code, &si);
+ }
#endif
if (action == SIG_DFL) {
/*
diff --git a/sys/sys/ktrace.h b/sys/sys/ktrace.h
index bf8d744d06c..9524c799fcf 100644
--- a/sys/sys/ktrace.h
+++ b/sys/sys/ktrace.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ktrace.h,v 1.5 2001/07/04 21:54:27 espie Exp $ */
+/* $OpenBSD: ktrace.h,v 1.6 2002/02/22 19:19:31 deraadt Exp $ */
/* $NetBSD: ktrace.h,v 1.12 1996/02/04 02:12:29 christos Exp $ */
/*
@@ -120,6 +120,7 @@ struct ktr_psig {
sig_t action;
int mask;
int code;
+ siginfo_t si;
};
/*
@@ -137,6 +138,7 @@ struct ktr_csw {
#define KTR_EMUL 7
/* record contains emulation name */
+
/*
* kernel trace points (in p_traceflag)
*/
@@ -169,7 +171,7 @@ void ktrcsw __P((struct proc *, int, int));
void ktremul __P((struct proc *, char *));
void ktrgenio __P((struct proc *, int, enum uio_rw, struct iovec *, int, int));
void ktrnamei __P((struct proc *, char *));
-void ktrpsig __P((struct proc *, int, sig_t, int, int));
+void ktrpsig __P((struct proc *, int, sig_t, int, int, siginfo_t *));
void ktrsyscall __P((struct proc *, register_t, size_t, register_t []));
void ktrsysret __P((struct proc *, register_t, int, register_t));