linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Miaohe Lin <linmiaohe@huawei.com>
Cc: Mike Kravetz <mike.kravetz@oracle.com>, <linux-mm@kvack.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] mm/hugetlb: Fix use after free when subpool max_hpages accounting is not enabled
Date: Wed, 27 Jan 2021 16:17:55 -0800	[thread overview]
Message-ID: <20210127161755.68bf43047007a8a2889e302a@linux-foundation.org> (raw)
In-Reply-To: <d8dfb9e4-1823-cc79-3d8c-18240fdd0567@huawei.com>

On Wed, 27 Jan 2021 10:08:22 +0800 Miaohe Lin <linmiaohe@huawei.com> wrote:

> On 2021/1/27 8:06, Mike Kravetz wrote:
> > On 1/26/21 3:55 AM, Miaohe Lin wrote:
> >> When subpool max_hpages accounting is not enabled, used_hpages is always 0
> >> and might lead to release subpool prematurely because it indicates no pages
> >> are used now while there might be.
> > 
> > It might be good to say that you need min_hpages accounting (min_size mount
> > option) enabled for this issue to occur.  Or, perhaps say this is possible
> > if a hugetlbfs filesystem is created with the min_size option and without
> > the size option.
> > 
> > That might better explain the conditions in which a user could see the issue.
> 
> So commit log might looks like this ?
> """
> If a hugetlbfs filesystem is created with the min_size option and without
> the size option, used_hpages is always 0 and might lead to release subpool
> prematurely because it indicates no pages are used now while there might
> be.
> 
> In order to fix this issue, we should check used_hpages == 0 iff max_hpages
> accounting is enabled. As max_hpages accounting should be enabled in most
> common case, this is not worth a Cc stable.
> """
> 
> If so, should I send a V2 or Andrew would kindly do this?
> Many thanks.

I made that change, thanks.


  reply	other threads:[~2021-01-28  0:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-26 11:55 Miaohe Lin
2021-01-27  0:06 ` Mike Kravetz
2021-01-27  2:08   ` Miaohe Lin
2021-01-28  0:17     ` Andrew Morton [this message]
2021-01-28  1:46       ` Miaohe Lin

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=20210127161755.68bf43047007a8a2889e302a@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=linmiaohe@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mike.kravetz@oracle.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