The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Segher Boessenkool <segher@kernel.crashing.org>
To: David Gibson <david@gibson.dropbear.id.au>
Cc: Andrew Morton <akpm@osdl.org>,
	libhugetlbfs-devel@lists.sourceforge.net,
	linux-kernel@vger.kernel.org,
	William Lee Irwin <wli@holomorphy.com>,
	linuxppc-dev@ozlabs.org, Paul Mackerras <paulus@samba.org>
Subject: Re: [powerpc] Fix bogus BUG_ON() in in hugetlb_get_unmapped_area()
Date: Fri, 22 Dec 2006 19:51:09 +0100	[thread overview]
Message-ID: <EE6A12AA-3BE6-43DE-AEB2-7477CDAD21DC@kernel.crashing.org> (raw)
In-Reply-To: <20061222011706.GA27396@localhost.localdomain>

>>> +	if (len > TASK_SIZE)
>>> +		return -ENOMEM;
>>
>> Shouldn't that be addr+len instead?  The check looks incomplete
>> otherwise.  And you meant ">=" I guess?
>
> No.  Have a look at the other hugetlb_get_unmapped_area()
> implementations.  Because this is in the get_unmapped_area() path,
> 'addr' is just a hint,

Ah I missed this vital piece of information, thanks for the
explanation.  Care putting in a code comment pointing this out?

> so checking addr+len would give bogus
> failures.  This test is, I believe, essentially an optimization - if
> it fails, we're never going to find a suitable addr, so we might as
> well give up now.

Yes, it all makes sense now.

>>> -		/* Paranoia, caller should have dealt with this */
>>> -		BUG_ON((addr + len) > 0x100000000UL);
>>> -
>>
>> Any real reason to remove the paranoia check?  If it's trivially
>> always satisfied, the compiler will get rid of it for you :-)
>
> Yes - this is the very bug on which was causing crashes - the "caller
> should have dealt with this" comment is wrong.  The test has been
> moved into htlb_check_hinted_area() and now simply fails (and so falls
> back to searching for a suitable address), rather than BUG()ing.

Yep.

Cheers,


Segher


      reply	other threads:[~2006-12-22 18:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-21 22:23 [powerpc] Fix bogus BUG_ON() in in hugetlb_get_unmapped_area() David Gibson
2006-12-22  0:31 ` Segher Boessenkool
2006-12-22  1:17   ` David Gibson
2006-12-22 18:51     ` Segher Boessenkool [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=EE6A12AA-3BE6-43DE-AEB2-7477CDAD21DC@kernel.crashing.org \
    --to=segher@kernel.crashing.org \
    --cc=akpm@osdl.org \
    --cc=david@gibson.dropbear.id.au \
    --cc=libhugetlbfs-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=paulus@samba.org \
    --cc=wli@holomorphy.com \
    /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