diff options
author | Michael Shalayeff <mickey@cvs.openbsd.org> | 2004-07-01 02:04:11 +0000 |
---|---|---|
committer | Michael Shalayeff <mickey@cvs.openbsd.org> | 2004-07-01 02:04:11 +0000 |
commit | 5dcb030c453a6d5de627386ae801d7ed0938fa68 (patch) | |
tree | 83a1b177a181770bdaf08e809d891ae281e2273c /lib | |
parent | 30467686092d2f6864a54f35ce9b0523d59b4458 (diff) |
if sym has null value -- report as not found; check that kd->vmst is set before use; millert@ ok
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libkvm/kvm.c | 10 | ||||
-rw-r--r-- | lib/libkvm/kvm_alpha.c | 7 | ||||
-rw-r--r-- | lib/libkvm/kvm_i386.c | 9 | ||||
-rw-r--r-- | lib/libkvm/kvm_vax.c | 7 |
4 files changed, 27 insertions, 6 deletions
diff --git a/lib/libkvm/kvm.c b/lib/libkvm/kvm.c index 42b6cf24939..36614660b9f 100644 --- a/lib/libkvm/kvm.c +++ b/lib/libkvm/kvm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kvm.c,v 1.38 2004/06/15 03:52:58 deraadt Exp $ */ +/* $OpenBSD: kvm.c,v 1.39 2004/07/01 02:04:10 mickey Exp $ */ /* $NetBSD: kvm.c,v 1.43 1996/05/05 04:31:59 gwr Exp $ */ /*- @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)kvm.c 8.2 (Berkeley) 2/13/94"; #else -static char *rcsid = "$OpenBSD: kvm.c,v 1.38 2004/06/15 03:52:58 deraadt Exp $"; +static char *rcsid = "$OpenBSD: kvm.c,v 1.39 2004/07/01 02:04:10 mickey Exp $"; #endif #endif /* LIBC_SCCS and not lint */ @@ -808,6 +808,12 @@ kvm_dump_inval(kvm_t *kd) _kvm_err(kd, 0, "bad namelist"); return (-1); } + + if (nlist[0].n_value == 0) { + _kvm_err(kd, nlist[0].n_name, "not in name list"); + return (-1); + } + if (_kvm_kvatop(kd, (u_long)nlist[0].n_value, &pa) == 0) return (-1); diff --git a/lib/libkvm/kvm_alpha.c b/lib/libkvm/kvm_alpha.c index 2bef0731951..f1b4e43239b 100644 --- a/lib/libkvm/kvm_alpha.c +++ b/lib/libkvm/kvm_alpha.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kvm_alpha.c,v 1.11 2004/06/15 03:52:59 deraadt Exp $ */ +/* $OpenBSD: kvm_alpha.c,v 1.12 2004/07/01 02:04:10 mickey Exp $ */ /* $NetBSD: kvm_alpha.c,v 1.5 1996/10/01 21:12:05 cgd Exp $ */ /* @@ -98,6 +98,11 @@ _kvm_kvatop(kvm_t *kd, u_long va, u_long *pa) alpha_pt_entry_t pte; off_t pteoff; + if (!kd->vmst) { + _kvm_err(kd, 0, "vatop called before initvtop"); + return (0); + } + if (ISALIVE(kd)) { _kvm_err(kd, 0, "vatop called in live kernel!"); return (0); diff --git a/lib/libkvm/kvm_i386.c b/lib/libkvm/kvm_i386.c index 758f1265f29..5e5be968c7a 100644 --- a/lib/libkvm/kvm_i386.c +++ b/lib/libkvm/kvm_i386.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kvm_i386.c,v 1.12 2004/06/15 03:52:59 deraadt Exp $ */ +/* $OpenBSD: kvm_i386.c,v 1.13 2004/07/01 02:04:10 mickey Exp $ */ /* $NetBSD: kvm_i386.c,v 1.9 1996/03/18 22:33:38 thorpej Exp $ */ /*- @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)kvm_hp300.c 8.1 (Berkeley) 6/4/93"; #else -static char *rcsid = "$OpenBSD: kvm_i386.c,v 1.12 2004/06/15 03:52:59 deraadt Exp $"; +static char *rcsid = "$OpenBSD: kvm_i386.c,v 1.13 2004/07/01 02:04:10 mickey Exp $"; #endif #endif /* LIBC_SCCS and not lint */ @@ -133,6 +133,11 @@ _kvm_kvatop(kvm_t *kd, u_long va, u_long *pa) struct vmstate *vm; pt_entry_t pte; + if (!kd->vmst) { + _kvm_err(kd, 0, "vatop called before initvtop"); + return (0); + } + if (ISALIVE(kd)) { _kvm_err(kd, 0, "vatop called in live kernel!"); return (0); diff --git a/lib/libkvm/kvm_vax.c b/lib/libkvm/kvm_vax.c index 3ec966aa7d8..4746b7e6732 100644 --- a/lib/libkvm/kvm_vax.c +++ b/lib/libkvm/kvm_vax.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kvm_vax.c,v 1.9 2004/06/15 03:52:59 deraadt Exp $ */ +/* $OpenBSD: kvm_vax.c,v 1.10 2004/07/01 02:04:10 mickey Exp $ */ /* $NetBSD: kvm_vax.c,v 1.3 1996/03/18 22:34:06 thorpej Exp $ */ /*- @@ -118,6 +118,11 @@ _kvm_kvatop(kvm_t *kd, u_long va, u_long *pa) return (0); } + if (!kd->vmst) { + _kvm_err(kd, 0, "vatop called before initvtop"); + return (0); + } + end = kd->vmst->end; if (va >= end) { _kvm_err(kd, 0, "invalid address (%lx>=%lx)", va, end); |