Re: 2.6.10-rc1-mm3

From: Andi Kleen
Date: Fri Nov 05 2004 - 06:19:26 EST


On Fri, Nov 05, 2004 at 12:09:51PM +0100, Ingo Molnar wrote:
>
> * Ingo Molnar <mingo@xxxxxxx> wrote:
>
> > > ------------[ cut here ]------------
> > > kernel BUG at mm/memory.c:156!
> >
> > > Process shmt04 (pid: 4854, threadinfo=dca51000 task=de374510)
> >
> > reproducible here too, just running LTP's shmt04 directly triggers it
> > immediately. Looks like there's interaction of 4-level pagetables with
> > ipc/shm.c or mm/shmem.c.
>
> due to the PML4 feature, the clear_page_tables() function changed to
> clear_page_range(), changing its (first,size) argument to (first,last).
> Normally it's called with (0,TASK_SIZE) which normally is PML4-aligned,
> but in the (relatively rare) do_munmap() use this is not the case. We
> correctly calculate the range that could be cleared, but it's not
> PML4_SIZE aligned.

I think just removing the BUG_ON is easier. I sent a patch for that
to Andrew.

> The solution is to clip both 'first' and 'last' to PML4_SIZE boundary.
> Since when we calculate 'first' we add at least +PML4_SIZE to the value,
> it is safe to clip 'first'. It is obviously safe to clip 'last'.

It's a bit tricky because on 3level architectures it clips on
PGDs, not PML4s, otherwise it would never free any pagetables.
But the if()s check that correctly.

-Andi
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/