diff options
author | peter <peter@FreeBSD.org> | 2005-10-20 05:41:38 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 2005-10-20 05:41:38 +0000 |
commit | e62b997c41571d84324a7c4090af53a7fe74ff9f (patch) | |
tree | 02a7c9251deadd967b69f895279f2b6cdf3f1425 /lib | |
parent | cd579e831a1baa37bf0078180c99d3f610b19217 (diff) | |
download | FreeBSD-src-e62b997c41571d84324a7c4090af53a7fe74ff9f.zip FreeBSD-src-e62b997c41571d84324a7c4090af53a7fe74ff9f.tar.gz |
Fix a well duplicated fencepost error that stopped crashdumps being
readable on certain random memory configurations. If the libkvm consumer
tried to read something that was in the very last pdpe, pde or pte slot,
it would bogusly fail.
This is broken in RELENG_6 too.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libkvm/kvm_amd64.c | 6 | ||||
-rw-r--r-- | lib/libkvm/kvm_i386.c | 8 |
2 files changed, 7 insertions, 7 deletions
diff --git a/lib/libkvm/kvm_amd64.c b/lib/libkvm/kvm_amd64.c index 534323c..e73e6a2 100644 --- a/lib/libkvm/kvm_amd64.c +++ b/lib/libkvm/kvm_amd64.c @@ -241,7 +241,7 @@ _kvm_vatop(kvm_t *kd, u_long va, off_t *pa) (pdpeindex * sizeof(pdp_entry_t)); s = _kvm_pa2off(kd, pdpe_pa, &ofs); - if (s <= sizeof pdpe) { + if (s < sizeof pdpe) { _kvm_err(kd, kd->program, "_kvm_vatop: pdpe_pa not found"); goto invalid; } @@ -262,7 +262,7 @@ _kvm_vatop(kvm_t *kd, u_long va, off_t *pa) pde_pa = ((u_long)pdpe & PG_FRAME) + (pdeindex * sizeof(pd_entry_t)); s = _kvm_pa2off(kd, pde_pa, &ofs); - if (s <= sizeof pde) { + if (s < sizeof pde) { _kvm_syserr(kd, kd->program, "_kvm_vatop: pde_pa not found"); goto invalid; } @@ -299,7 +299,7 @@ _kvm_vatop(kvm_t *kd, u_long va, off_t *pa) pte_pa = ((u_long)pde & PG_FRAME) + (pteindex * sizeof(pt_entry_t)); s = _kvm_pa2off(kd, pte_pa, &ofs); - if (s <= sizeof pte) { + if (s < sizeof pte) { _kvm_err(kd, kd->program, "_kvm_vatop: pte_pa not found"); goto invalid; } diff --git a/lib/libkvm/kvm_i386.c b/lib/libkvm/kvm_i386.c index e70098a..258c2f2 100644 --- a/lib/libkvm/kvm_i386.c +++ b/lib/libkvm/kvm_i386.c @@ -280,7 +280,7 @@ _kvm_vatop(kvm_t *kd, u_long va, off_t *pa) #define PG_FRAME4M (~PAGE4M_MASK) pde_pa = ((u_long)pde & PG_FRAME4M) + (va & PAGE4M_MASK); s = _kvm_pa2off(kd, pde_pa, &ofs); - if (s <= sizeof pde) { + if (s < sizeof pde) { _kvm_syserr(kd, kd->program, "_kvm_vatop: pde_pa not found"); goto invalid; @@ -293,7 +293,7 @@ _kvm_vatop(kvm_t *kd, u_long va, off_t *pa) pte_pa = ((u_long)pde & PG_FRAME) + (pteindex * sizeof(pde)); s = _kvm_pa2off(kd, pte_pa, &ofs); - if (s <= sizeof pte) { + if (s < sizeof pte) { _kvm_err(kd, kd->program, "_kvm_vatop: pdpe_pa not found"); goto invalid; } @@ -376,7 +376,7 @@ _kvm_vatop_pae(kvm_t *kd, u_long va, off_t *pa) #define PG_FRAME2M (~PAGE2M_MASK) pde_pa = ((u_long)pde & PG_FRAME2M) + (va & PAGE2M_MASK); s = _kvm_pa2off(kd, pde_pa, &ofs); - if (s <= sizeof pde) { + if (s < sizeof pde) { _kvm_syserr(kd, kd->program, "_kvm_vatop_pae: pde_pa not found"); goto invalid; @@ -389,7 +389,7 @@ _kvm_vatop_pae(kvm_t *kd, u_long va, off_t *pa) pte_pa = ((uint64_t)pde & PG_FRAME_PAE) + (pteindex * sizeof(pde)); s = _kvm_pa2off(kd, pte_pa, &ofs); - if (s <= sizeof pte) { + if (s < sizeof pte) { _kvm_err(kd, kd->program, "_kvm_vatop_pae: pdpe_pa not found"); goto invalid; } |