linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Fleming, Matt" <matt.fleming@intel.com>
To: Dave Hansen <dave.hansen@intel.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Alan Cox <alan@lxorguk.ukuu.org.uk>
Subject: Re: [PATCH] mm: bootmem: Check pfn_valid() before accessing struct page
Date: Tue, 3 Jun 2014 16:17:06 +0100	[thread overview]
Message-ID: <CAL01qpvbDRnE0mHBttomcqYtT6i9OaG_kvnj6BMXtqYn4cP1FQ@mail.gmail.com> (raw)
In-Reply-To: <5384DD67.3010408@intel.com>

On 27 May 2014 19:45, Dave Hansen <dave.hansen@intel.com> wrote:
>
> I don't think this is quite right.  pfn_valid() tells us whether we have
> a 'struct page' there or not.  *BUT*, it does not tell us whether it is
> RAM that we can actually address and than can be freed in to the buddy
> allocator.
>
> I think sparsemem is where this matters.  Let's say mem= caused lowmem
> to end in the middle of a section (or that 896MB wasn't
> section-aligned).  Then someone calls free_bootmem_late() on an area
> that is in the last section, but _above_ max_mapnr.  It'll be
> pfn_valid(), we'll free it in to the buddy allocator, and we'll blam the
> first time we try to write to a bogus vaddr after a phys_to_virt().

Ah, the sparsemem case wasn't something I'd considered. Thanks Dave.

> At a higher level, I don't like the idea of the bootmem code papering
> over bugs when somebody calls in to it trying to _free_ stuff that's not
> memory (as far as the kernel is concerned).
>
> I think the right thing to do is to call in to the e820 code and see if
> the range is E820_RAM before trying to bootmem-free it.

OK, this makes sense. I'll try that approach and see if it also fixes
Alan's problem.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

      reply	other threads:[~2014-06-03 15:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-27 14:10 Matt Fleming
2014-05-27 18:45 ` Dave Hansen
2014-06-03 15:17   ` Fleming, Matt [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAL01qpvbDRnE0mHBttomcqYtT6i9OaG_kvnj6BMXtqYn4cP1FQ@mail.gmail.com \
    --to=matt.fleming@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=dave.hansen@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox