linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: paulus@samba.org
Cc: linuxppc-dev@ozlabs.org, linux-kernel@vger.kernel.org
Subject: Re: [LMB][2/2] Restructure allocation loops to avoid unsigned underflow
Date: Thu, 17 Apr 2008 00:09:46 -0700 (PDT)	[thread overview]
Message-ID: <20080417.000946.44234467.davem@davemloft.net> (raw)
In-Reply-To: <18432.18107.854417.50018@cargo.ozlabs.ibm.com>

From: Paul Mackerras <paulus@samba.org>
Date: Sat, 12 Apr 2008 15:20:59 +1000

> There is a potential bug in __lmb_alloc_base where we subtract `size'
> from the base address of a reserved region without checking whether
> the subtraction could wrap around and produce a very large unsigned
> value.  In fact it probably isn't possible to hit the bug in practice
> since it would only occur in the situation where we can't satisfy the
> allocation request and there is a reserved region starting at 0.
> 
> This fixes the potential bug by breaking out of the loop when we get
> to the point where the base of the reserved region is less than the
> size requested.  This also restructures the loop to be a bit easier to
> follow. 
> 
> The same logic got copied into lmb_alloc_nid_unreserved, so this makes
> a similar change there.  Here the bug is more likely to be hit because
> the outer loop  (in lmb_alloc_nid) goes through the memory regions in
> increasing order rather than decreasing order as __lmb_alloc_base
> does, and we are therefore more likely to hit the case where we are
> testing against a reserved region with a base address of 0.
> 
> Signed-off-by: Paul Mackerras <paulus@samba.org>

This looks great, thanks for doing this work Paul.

I'll try to find some cycles to validate these changes alongside
the pending sparc64 NUMA changes I have.

      reply	other threads:[~2008-04-17  7:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-12  5:20 [LMB][2/2] Restructure allocation loops to avoid unsigned underflow Paul Mackerras
2008-04-17  7:09 ` David Miller [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=20080417.000946.44234467.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=paulus@samba.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).