linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Hillf Danton <dhillf@gmail.com>
Cc: akpm@linux-foundation.org, abarry@cray.com, hughd@google.com,
	mgorman@suse.de, minchan.kim@gmail.com, paulus@samba.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] hugepages: Fix use after free bug in "quota" handling
Date: Tue, 6 Mar 2012 13:37:00 +1100	[thread overview]
Message-ID: <20120306023700.GE12818@truffala.fritz.box> (raw)
In-Reply-To: <CAJd=RBAK-iTs6HfNm+Lv_5GKPbQfpALgYCgB+mitXUPofJ1gtA@mail.gmail.com>

On Thu, Feb 16, 2012 at 08:33:51PM +0800, Hillf Danton wrote:
> On Thu, Feb 16, 2012 at 12:24 PM, David Gibson
> <david@gibson.dropbear.id.au> wrote:
> > @@ -1046,12 +1124,12 @@ static struct page *alloc_huge_page(struct vm_area_struct *vma,
> >        if (!page) {
> >                page = alloc_buddy_huge_page(h, NUMA_NO_NODE);
> >                if (!page) {
> > -                       hugetlb_put_quota(inode->i_mapping, chg);
> > +                       hugepage_subpool_put_pages(spool, chg);
> >                        return ERR_PTR(-VM_FAULT_SIGBUS);
> >                }
> >        }
> >
> > -       set_page_private(page, (unsigned long) mapping);
> > +       set_page_private(page, (unsigned long)spool);

Sorry for the very delayed reply.  Somehow I never spotted this when
it first came.  I think I must have acidentally deleted it when
cleaning out automated messages and spam.

> Page mapping is used in unmap_ref_private(), and I am
> wondering it no longer works:-(

Good point.  But unmap_ref_private() does take the vma, so it should
be able to get to the mapping from there.  I'll respin doing that,
instead of using page_private().

> > @@ -2392,7 +2471,8 @@ retry_avoidcopy:
> >
> >        /* Drop page_table_lock as buddy allocator may be called */
> >        spin_unlock(&mm->page_table_lock);
> > -       new_page = alloc_huge_page(vma, address, outside_reserve);
> > +       new_page = alloc_huge_page(vma, address, outside_reserve,
> > +                                  subpool_vma(vma));
> 
> Change in the number of parameters of alloc_huge_page()
> looks unnecessary.

Because alloc_huge_page() also takes vma.  Yeah, fair enough.  I'll
change that in the respin too.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

  reply	other threads:[~2012-03-06  3:06 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-16  4:23 Hugepage cleanup and bugfix David Gibson
2012-02-16  4:23 ` [PATCH 1/2] Cleanup to hugetlb.h David Gibson
2012-02-16  4:24 ` [PATCH 2/2] hugepages: Fix use after free bug in "quota" handling David Gibson
2012-02-16 12:33   ` Hillf Danton
2012-03-06  2:37     ` David Gibson [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-03-07  4:48 [PATCH 1/2] Cleanup to hugetlb.h David Gibson
2012-03-07  4:48 ` [PATCH 2/2] hugepages: Fix use after free bug in "quota" handling David Gibson
2012-03-07 12:28   ` Hillf Danton
2012-03-08  0:57     ` David Gibson
2012-03-08  4:17     ` Aneesh Kumar K.V
2012-03-08 11:59       ` Hillf Danton
2012-03-08 14:19         ` David Gibson
2012-03-08  0:27   ` Andrew Morton
2012-03-08  2:09     ` David Gibson
2012-03-09  3:25     ` David Gibson
2012-03-08  4:30   ` Aneesh Kumar K.V
2012-03-08 14:18     ` David Gibson

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=20120306023700.GE12818@truffala.fritz.box \
    --to=david@gibson.dropbear.id.au \
    --cc=abarry@cray.com \
    --cc=akpm@linux-foundation.org \
    --cc=dhillf@gmail.com \
    --cc=hughd@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=minchan.kim@gmail.com \
    --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).