Re: [patch] fix for cc1 Out of memory [Re: [TESTCASE] `Out of memory for cc1']

Linus Torvalds (torvalds@transmeta.com)
Mon, 12 Apr 1999 12:27:01 -0700 (PDT)


On Mon, 12 Apr 1999, Andrea Arcangeli wrote:
>
> It's triggered by shmdt but I think that the bug is in munmap
> (free_pgtable() more precisely).

No. Your patch makes it not ever free the pmd entries, as far as I can
tell.

I think you're on to something, but I think your patch just hides the real
problem.

> This looks like to me the obvious fix since we want to free pagetables
> only for the part of mapping that completly fits in the PGD_SIZE regions.

No. We want to free the "superset", not the subset. Think of somebody just
mapping a single page in a 4MB area: when it gets unmapped, the code will
try to unmap the pmd too. With your change, that no longer happens.

> The patch works here. But why are we playing with prev for example? Right
> now I think something like that should be just fine:

Your second larger patch essentially does the old thing, and misses the
reason for trying to do this in the first place: getting rid of stale
pmd's that aren't used anymore.. And yes, it simplifies the logic, but it
also opens us up to some really simple out-of-memory attacks (ask Alan
about them).

Linus

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