diff options
author | 2011-04-15 17:58:25 +0000 | |
---|---|---|
committer | 2011-04-15 17:58:25 +0000 | |
commit | 82e33f6f1abcbe965090790a6bd11968bc5392f9 (patch) | |
tree | 8b64689513148437bfc6765f35fd912de90d1c55 | |
parent | Remove the acpi event definitions. They've not been used for over a (diff) | |
download | wireguard-openbsd-82e33f6f1abcbe965090790a6bd11968bc5392f9.tar.xz wireguard-openbsd-82e33f6f1abcbe965090790a6bd11968bc5392f9.zip |
p_sigacts is NULL for zombies, so FILL_KPROC() and kvm_proclist() have
to handle that with the sigacts change.
problem observed and diagnosed by claudio@ and kettenis@
-rw-r--r-- | lib/libkvm/kvm_proc2.c | 19 | ||||
-rw-r--r-- | sys/sys/sysctl.h | 6 |
2 files changed, 15 insertions, 10 deletions
diff --git a/lib/libkvm/kvm_proc2.c b/lib/libkvm/kvm_proc2.c index 5610641292e..d7b485af1a2 100644 --- a/lib/libkvm/kvm_proc2.c +++ b/lib/libkvm/kvm_proc2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kvm_proc2.c,v 1.5 2011/04/15 04:52:40 guenther Exp $ */ +/* $OpenBSD: kvm_proc2.c,v 1.6 2011/04/15 17:58:25 guenther Exp $ */ /* $NetBSD: kvm_proc.c,v 1.30 1999/03/24 05:50:50 mrg Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -114,7 +114,7 @@ kvm_proclist(kvm_t *kd, int op, int arg, struct proc *p, struct process process, process2; struct pgrp pgrp; struct tty tty; - struct sigacts sa; + struct sigacts sa, *sap; struct vmspace vm, *vmp; struct plimit limits, *limp; struct pstats pstats, *ps; @@ -190,11 +190,16 @@ kvm_proclist(kvm_t *kd, int op, int arg, struct proc *p, } else leader_pid = 0; - if (KREAD(kd, (u_long)proc.p_sigacts, &sa)) { - _kvm_err(kd, kd->program, "can't read sigacts at %x", - proc.p_sigacts); - return (-1); + if (proc.p_sigacts) { + if (KREAD(kd, (u_long)proc.p_sigacts, &sa)) { + _kvm_err(kd, kd->program, "can't read sigacts at %x", + proc.p_sigacts); + return (-1); + } + sap = &sa; } + else + sap = NULL; switch (op) { case KERN_PROC_PID: @@ -273,7 +278,7 @@ kvm_proclist(kvm_t *kd, int op, int arg, struct proc *p, #define do_copy_str(_d, _s, _l) kvm_read(kd, (u_long)(_s), (_d), (_l)-1) FILL_KPROC(&kp, do_copy_str, &proc, &process, &pcred, &ucred, - &pgrp, p, proc.p_p, &sess, vmp, limp, ps, &sa); + &pgrp, p, proc.p_p, &sess, vmp, limp, ps, sap); #undef do_copy_str /* stuff that's too painful to generalize into the macros */ diff --git a/sys/sys/sysctl.h b/sys/sys/sysctl.h index 217aa42a5a8..774691daab8 100644 --- a/sys/sys/sysctl.h +++ b/sys/sys/sysctl.h @@ -1,4 +1,4 @@ -/* $OpenBSD: sysctl.h,v 1.111 2011/04/15 04:52:40 guenther Exp $ */ +/* $OpenBSD: sysctl.h,v 1.112 2011/04/15 17:58:25 guenther Exp $ */ /* $NetBSD: sysctl.h,v 1.16 1996/04/09 20:55:36 cgd Exp $ */ /* @@ -519,8 +519,8 @@ do { \ \ (kp)->p_siglist = (p)->p_siglist; \ (kp)->p_sigmask = (p)->p_sigmask; \ - (kp)->p_sigignore = (sa)->ps_sigignore; \ - (kp)->p_sigcatch = (sa)->ps_sigcatch; \ + (kp)->p_sigignore = (sa) ? (sa)->ps_sigignore : 0; \ + (kp)->p_sigcatch = (sa) ? (sa)->ps_sigcatch : 0; \ \ (kp)->p_stat = (p)->p_stat; \ (kp)->p_nice = (pr)->ps_nice; \ |