From: Greg KH <greg@kroah.com>
To: Sidhartha Kumar <sidhartha.kumar@oracle.com>
Cc: stable@vger.kernel.org, linux-kernel@vger.kernel.org,
songmuchun@bytedance.com, mike.kravetz@oracle.com,
Ackerley Tng <ackerleytng@google.com>
Subject: Re: [PATCH 6.3.y] mm/hugetlb: revert use of page_cache_next_miss()
Date: Tue, 6 Jun 2023 19:38:27 +0200 [thread overview]
Message-ID: <2023060650-overlying-skiing-191d@gregkh> (raw)
In-Reply-To: <20230606172022.128441-1-sidhartha.kumar@oracle.com>
On Tue, Jun 06, 2023 at 10:20:22AM -0700, Sidhartha Kumar wrote:
> As reported by Ackerley[1], the use of page_cache_next_miss() in
> hugetlbfs_fallocate() introduces a bug where a second fallocate() call to
> same offset fails with -EEXIST. Revert this change and go back to the
> previous method of using get from the page cache and then dropping the
> reference on success.
>
> hugetlbfs_pagecache_present() was also refactored to use
> page_cache_next_miss(), revert the usage there as well.
>
> User visible impacts include hugetlb fallocate incorrectly returning
> EEXIST if pages are already present in the file. In addition, hugetlb
> pages will not be included in core dumps if they need to be brought in via
> GUP. userfaultfd UFFDIO_COPY also uses this code and will not notice pages
> already present in the cache. It may try to allocate a new page and
> potentially return ENOMEM as opposed to EEXIST.
>
> Fixes: d0ce0e47b323 ("mm/hugetlb: convert hugetlb fault paths to use alloc_hugetlb_folio()")
> Cc: <stable@vger.kernel.org> #v6.3
> Reported-by: Ackerley Tng <ackerleytng@google.com>
> Signed-off-by: Sidhartha Kumar <sidhartha.kumar@oracle.com>
> Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com>
>
> [1] https://lore.kernel.org/linux-mm/cover.1683069252.git.ackerleytng@google.com/
> ---
>
> This revert is the safest way to fix 6.3. The upstream fix will either
> fix page_cache_next_miss() itself or use Ackerley's patch to introduce a
> new function to check if a page is present in the page cache. Both
> directions are currently under review so we can use this safe and simple
> fix for 6.3
Is there any specific reason why we don't just wait for the fix for
Linus's tree before applying this one, or applying the real fix instead?
thanks,
greg k-h
next prev parent reply other threads:[~2023-06-06 17:38 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-06 17:20 [PATCH 6.3.y] mm/hugetlb: revert use of page_cache_next_miss() Sidhartha Kumar
2023-06-06 17:38 ` Greg KH [this message]
2023-06-06 18:13 ` Sidhartha Kumar
2023-06-07 18:33 ` Greg KH
2023-06-07 20:35 ` Sidhartha Kumar
-- strict thread matches above, loose matches on Subject: below --
2023-06-29 21:18 Sidhartha Kumar
2023-07-03 18:31 ` Greg KH
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=2023060650-overlying-skiing-191d@gregkh \
--to=greg@kroah.com \
--cc=ackerleytng@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mike.kravetz@oracle.com \
--cc=sidhartha.kumar@oracle.com \
--cc=songmuchun@bytedance.com \
--cc=stable@vger.kernel.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