All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Hansen <dave@linux.vnet.ibm.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: cl@linux.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	aarcange@redhat.com, kosaki.motohiro@jp.fujitsu.com,
	hughd@google.com, rientjes@google.com, adobriyan@gmail.com,
	mel@csn.ul.ie
Subject: Re: [PATCH] hugetlb: fix resv_map leak in error path
Date: Tue, 22 May 2012 13:59:53 -0700	[thread overview]
Message-ID: <4FBBFE49.4070409@linux.vnet.ibm.com> (raw)
In-Reply-To: <20120522134558.49255899.akpm@linux-foundation.org>

On 05/22/2012 01:45 PM, Andrew Morton wrote:
> On Mon, 21 May 2012 13:28:14 -0700
> Dave Hansen <dave@linux.vnet.ibm.com> wrote:
> 
>> When called for anonymous (non-shared) mappings,
>> hugetlb_reserve_pages() does a resv_map_alloc().  It depends on
>> code in hugetlbfs's vm_ops->close() to release that allocation.
>>
>> However, in the mmap() failure path, we do a plain unmap_region()
>> without the remove_vma() which actually calls vm_ops->close().
>>
>> This is a decent fix.  This leak could get reintroduced if
>> new code (say, after hugetlb_reserve_pages() in
>> hugetlbfs_file_mmap()) decides to return an error.  But, I think
>> it would have to unroll the reservation anyway.
> 
> How far back does this bug go?  The patch applies to 3.4 but gets
> rejects in 3.3 and earlier.

commit 17c9d12e126cb0de8d535dc1908c4819d712bc68
Date:   Wed Feb 11 16:34:16 2009 +0000

So, ~2.6.30.

I don't think it existed before that.  The code was there, but the
ordering made it OK.

--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

WARNING: multiple messages have this Message-ID (diff)
From: Dave Hansen <dave@linux.vnet.ibm.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: cl@linux.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	aarcange@redhat.com, kosaki.motohiro@jp.fujitsu.com,
	hughd@google.com, rientjes@google.com, adobriyan@gmail.com,
	mel@csn.ul.ie
Subject: Re: [PATCH] hugetlb: fix resv_map leak in error path
Date: Tue, 22 May 2012 13:59:53 -0700	[thread overview]
Message-ID: <4FBBFE49.4070409@linux.vnet.ibm.com> (raw)
In-Reply-To: <20120522134558.49255899.akpm@linux-foundation.org>

On 05/22/2012 01:45 PM, Andrew Morton wrote:
> On Mon, 21 May 2012 13:28:14 -0700
> Dave Hansen <dave@linux.vnet.ibm.com> wrote:
> 
>> When called for anonymous (non-shared) mappings,
>> hugetlb_reserve_pages() does a resv_map_alloc().  It depends on
>> code in hugetlbfs's vm_ops->close() to release that allocation.
>>
>> However, in the mmap() failure path, we do a plain unmap_region()
>> without the remove_vma() which actually calls vm_ops->close().
>>
>> This is a decent fix.  This leak could get reintroduced if
>> new code (say, after hugetlb_reserve_pages() in
>> hugetlbfs_file_mmap()) decides to return an error.  But, I think
>> it would have to unroll the reservation anyway.
> 
> How far back does this bug go?  The patch applies to 3.4 but gets
> rejects in 3.3 and earlier.

commit 17c9d12e126cb0de8d535dc1908c4819d712bc68
Date:   Wed Feb 11 16:34:16 2009 +0000

So, ~2.6.30.

I don't think it existed before that.  The code was there, but the
ordering made it OK.


  reply	other threads:[~2012-05-22 21:01 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-21 20:28 [PATCH] hugetlb: fix resv_map leak in error path Dave Hansen
2012-05-21 20:28 ` Dave Hansen
2012-05-21 22:01 ` KOSAKI Motohiro
2012-05-21 22:01   ` KOSAKI Motohiro
2012-05-22 20:45 ` Andrew Morton
2012-05-22 20:45   ` Andrew Morton
2012-05-22 20:59   ` Dave Hansen [this message]
2012-05-22 20:59     ` Dave Hansen
2012-05-22 21:05   ` Christoph Lameter
2012-05-22 21:05     ` Christoph Lameter
2012-05-22 21:28     ` Andrew Morton
2012-05-22 21:28       ` Andrew Morton

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=4FBBFE49.4070409@linux.vnet.ibm.com \
    --to=dave@linux.vnet.ibm.com \
    --cc=aarcange@redhat.com \
    --cc=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=cl@linux.com \
    --cc=hughd@google.com \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mel@csn.ul.ie \
    --cc=rientjes@google.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.