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.
This commit is contained in:
parent
72699a2216
commit
add112ff65
@ -241,7 +241,7 @@ _kvm_vatop(kvm_t *kd, u_long va, off_t *pa)
|
|||||||
(pdpeindex * sizeof(pdp_entry_t));
|
(pdpeindex * sizeof(pdp_entry_t));
|
||||||
|
|
||||||
s = _kvm_pa2off(kd, pdpe_pa, &ofs);
|
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");
|
_kvm_err(kd, kd->program, "_kvm_vatop: pdpe_pa not found");
|
||||||
goto invalid;
|
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));
|
pde_pa = ((u_long)pdpe & PG_FRAME) + (pdeindex * sizeof(pd_entry_t));
|
||||||
|
|
||||||
s = _kvm_pa2off(kd, pde_pa, &ofs);
|
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");
|
_kvm_syserr(kd, kd->program, "_kvm_vatop: pde_pa not found");
|
||||||
goto invalid;
|
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));
|
pte_pa = ((u_long)pde & PG_FRAME) + (pteindex * sizeof(pt_entry_t));
|
||||||
|
|
||||||
s = _kvm_pa2off(kd, pte_pa, &ofs);
|
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");
|
_kvm_err(kd, kd->program, "_kvm_vatop: pte_pa not found");
|
||||||
goto invalid;
|
goto invalid;
|
||||||
}
|
}
|
||||||
|
@ -280,7 +280,7 @@ _kvm_vatop(kvm_t *kd, u_long va, off_t *pa)
|
|||||||
#define PG_FRAME4M (~PAGE4M_MASK)
|
#define PG_FRAME4M (~PAGE4M_MASK)
|
||||||
pde_pa = ((u_long)pde & PG_FRAME4M) + (va & PAGE4M_MASK);
|
pde_pa = ((u_long)pde & PG_FRAME4M) + (va & PAGE4M_MASK);
|
||||||
s = _kvm_pa2off(kd, pde_pa, &ofs);
|
s = _kvm_pa2off(kd, pde_pa, &ofs);
|
||||||
if (s <= sizeof pde) {
|
if (s < sizeof pde) {
|
||||||
_kvm_syserr(kd, kd->program,
|
_kvm_syserr(kd, kd->program,
|
||||||
"_kvm_vatop: pde_pa not found");
|
"_kvm_vatop: pde_pa not found");
|
||||||
goto invalid;
|
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));
|
pte_pa = ((u_long)pde & PG_FRAME) + (pteindex * sizeof(pde));
|
||||||
|
|
||||||
s = _kvm_pa2off(kd, pte_pa, &ofs);
|
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");
|
_kvm_err(kd, kd->program, "_kvm_vatop: pdpe_pa not found");
|
||||||
goto invalid;
|
goto invalid;
|
||||||
}
|
}
|
||||||
@ -376,7 +376,7 @@ _kvm_vatop_pae(kvm_t *kd, u_long va, off_t *pa)
|
|||||||
#define PG_FRAME2M (~PAGE2M_MASK)
|
#define PG_FRAME2M (~PAGE2M_MASK)
|
||||||
pde_pa = ((u_long)pde & PG_FRAME2M) + (va & PAGE2M_MASK);
|
pde_pa = ((u_long)pde & PG_FRAME2M) + (va & PAGE2M_MASK);
|
||||||
s = _kvm_pa2off(kd, pde_pa, &ofs);
|
s = _kvm_pa2off(kd, pde_pa, &ofs);
|
||||||
if (s <= sizeof pde) {
|
if (s < sizeof pde) {
|
||||||
_kvm_syserr(kd, kd->program,
|
_kvm_syserr(kd, kd->program,
|
||||||
"_kvm_vatop_pae: pde_pa not found");
|
"_kvm_vatop_pae: pde_pa not found");
|
||||||
goto invalid;
|
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));
|
pte_pa = ((uint64_t)pde & PG_FRAME_PAE) + (pteindex * sizeof(pde));
|
||||||
|
|
||||||
s = _kvm_pa2off(kd, pte_pa, &ofs);
|
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");
|
_kvm_err(kd, kd->program, "_kvm_vatop_pae: pdpe_pa not found");
|
||||||
goto invalid;
|
goto invalid;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user