Port-vax archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: panic: uvm_unmap_remove: has mapping

On Tue, Mar 04, 2008 at 04:19:27PM +0100, Hans Rosenfeld wrote:
> On Tue, Mar 04, 2008 at 01:45:18PM +0100, Tom Ivar Helbekkmo wrote:
> > > I recall that I've seen this problem two years ago on 3.0, caused by a
> > > bug in pmap_extract(). I sent a patch to fix this bug, but it has never
> > > been committed 
> > > (http://mail-index.netbsd.org/port-vax/2006/03/09/0004.html).
> > 
> > It looks like a slight variation on it has been committed, though...?
> Oh, indeed it has. I must have missed it somehow.
> Anyway, there must be some new problem causing the panic again.

Ok, I think I found it. To quote the VARM, "the P0LR contains the size
of the P0PT in longwords, that is, the number of page table entries."
IIRC this means that first entry is at offset 0, and the last entry in
the table is at offset P0LR-1.

The panic-causing address that is supposed not to have a mapping is
0x80000, while p0lr is 0x400. So this means it is the first address
outside the range the page table maps. In sys/arch/vax/include/pmap.h,
pmap_extract() checks whether the specified virtual address is within
length of the page table:

        sva = PG_PFNUM(va);
        if (va < 0x40000000) {
                if (sva > (pmap->pm_p0lr & ~AST_MASK))
                        goto fail;
                pte = (int *)pmap->pm_p0br;

When sva == p0lr, as was the case for the panic, the va refers to the
first pte not in the range mapped by the table, and therefore the
mapping does not exist. I think the 3rd line should be changed to:

                if (sva >= (pmap->pm_p0lr & ~AST_MASK))

What I don't quite understand is why this never caused panics before,
this code has been that way for ages. So someone please verify this and
correct me if I'm wrong.

%SYSTEM-F-ANARCHISM, The operating system has been overthrown
Index: sys/arch/vax/include/pmap.h
RCS file: /cvsroot/src/sys/arch/vax/include/pmap.h,v
retrieving revision 1.74
diff -u -r1.74 pmap.h
--- sys/arch/vax/include/pmap.h 22 Feb 2008 08:46:48 -0000      1.74
+++ sys/arch/vax/include/pmap.h 8 Mar 2008 21:08:08 -0000
@@ -173,7 +173,7 @@
        sva = PG_PFNUM(va);
        if (va < 0x40000000) {
-               if (sva > (pmap->pm_p0lr & ~AST_MASK))
+               if (sva >= (pmap->pm_p0lr & ~AST_MASK))
                        goto fail;
                pte = (int *)pmap->pm_p0br;
        } else {

Home | Main Index | Thread Index | Old Index