Re: [patch] mm: sparsemem memory_present() memory corruption fix

From: Ingo Molnar
Date: Tue Apr 15 2008 - 20:37:35 EST



* Christoph Lameter <clameter@xxxxxxx> wrote:

> On Wed, 16 Apr 2008, Ingo Molnar wrote:
>
> > if a !PAE x86 kernel is booted on a 32-bit system with more than 4GB
> > of RAM, then we call memory_present() with a start/end that goes
> > outside the scope of MAX_PHYSMEM_BITS.
>
> Well okay this fixes it but is this the right fix? The arch should not
> call memory_present() with an invalid pfn.

it is the right fix. The architecture memory setup code doesnt even
_know_ the limits at this place in an open-coded way (and shouldnt know
them) - and even later on we use pfn_valid() to determine whether to
attempt to get to a struct page and free it into the buddy.

[ Of course the architecture code in general 'knows' about the limits -
but still it's cleaner to have a dumb enumeration interface here
combined with a resilient core code - that's always going to be less
fragile. ]

btw., i just did some bug history analysis, the calls were originally
added when sparsemem support was added:

| commit 215c3409eed16c89b6d11ea1126bd9d4f36b9afd
| Author: Andy Whitcroft <apw@xxxxxxxxxxxx>
| Date: Fri Jan 6 00:12:06 2006 -0800
|
| [PATCH] i386 sparsemem for single node systems

in v2.6.15-1003-g215c340. (so this is appears to be an unfixed bug in
v2.6.16 as well)

Ingo
--
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/