From: Andrew Morton <akpm@linux-foundation.org>
To: Greg Pearson <greg.pearson@hp.com>
Cc: tj@kernel.org, hpa@linux.intel.com, shangw@linux.vnet.ibm.com,
mingo@elte.hu, yinghai@kernel.org, benh@kernel.crashing.org,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4] mm/memblock: fix overlapping allocation when doubling reserved array
Date: Tue, 19 Jun 2012 15:14:35 -0700 [thread overview]
Message-ID: <20120619151435.10c16aed.akpm@linux-foundation.org> (raw)
In-Reply-To: <1340063278-31601-1-git-send-email-greg.pearson@hp.com>
On Mon, 18 Jun 2012 17:47:58 -0600
Greg Pearson <greg.pearson@hp.com> wrote:
> The __alloc_memory_core_early() routine will ask memblock for a range
> of memory then try to reserve it. If the reserved region array lacks
> space for the new range, memblock_double_array() is called to allocate
> more space for the array. If memblock is used to allocate memory for
> the new array it can end up using a range that overlaps with the range
> originally allocated in __alloc_memory_core_early(), leading to possible
> data corruption.
OK, but we have no information about whether it *does* lead to data
corruption. Are there workloads which trigger this? End users who are
experiencing problems?
See, I (and others) need to work out whether this patch should be
included in 3.5 or even earlier kernels. To do that we often need the
developer to tell us what the impact of the bug is upon users. Please
always include this info when fixing bugs.
> --- a/mm/memblock.c
> +++ b/mm/memblock.c
> @@ -399,7 +427,7 @@ repeat:
> */
> if (!insert) {
> while (type->cnt + nr_new > type->max)
> - if (memblock_double_array(type) < 0)
> + if (memblock_double_array(type, obase, size) < 0)
> return -ENOMEM;
> insert = true;
> goto repeat;
Minor nit: it would be nicer to make memblock_double_array() return 0
on success or a -ve errno, and then propagate that errno back. This is
more flexible than having the caller *assume* that the callee failed for a
particular reason.
--
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>
next prev parent reply other threads:[~2012-06-19 22:14 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-18 23:47 [PATCH v4] mm/memblock: fix overlapping allocation when doubling reserved array Greg Pearson
2012-06-19 21:33 ` Tejun Heo
2012-06-19 22:00 ` Pearson, Greg
2012-06-19 22:21 ` Andrew Morton
2012-06-19 22:14 ` Andrew Morton [this message]
2012-06-19 22:35 ` Pearson, Greg
2012-06-19 23:00 ` Andrew Morton
2012-06-20 15:21 ` Pearson, Greg
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=20120619151435.10c16aed.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=benh@kernel.crashing.org \
--cc=greg.pearson@hp.com \
--cc=hpa@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mingo@elte.hu \
--cc=shangw@linux.vnet.ibm.com \
--cc=tj@kernel.org \
--cc=yinghai@kernel.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;
as well as URLs for NNTP newsgroup(s).