On Thu, Jun 29, 2023 at 05:18:17PM -0400, Sidhartha Kumar wrote:
commit fd4aed8d985a3236d0877ff6d0c80ad39d4ce81a upstream
Ackerley Tng reported an issue with hugetlbfs fallocate as noted in the Closes tag. The issue showed up after the conversion of hugetlb page cache lookup code to use page_cache_next_miss. User visible effects are:
- hugetlbfs fallocate incorrectly returns -EEXIST if pages are presnet in the file.
- hugetlb pages will not be included in core dumps if they need to be brought in via GUP.
- userfaultfd UFFDIO_COPY 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.
Revert the use page_cache_next_miss() in hugetlb code.
The upstream fix[2] cannot be used used directly as the return value for filemap_get_folio() has been changed between 6.3 and upstream.
Closes: https://lore.kernel.org/linux-mm/cover.1683069252.git.ackerleytng@google.com 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
[1] https://lore.kernel.org/linux-mm/cover.1683069252.git.ackerleytng@google.com... [2] https://lore.kernel.org/lkml/20230621230255.GD4155@monkey/
fs/hugetlbfs/inode.c | 8 +++----- mm/hugetlb.c | 11 +++++------ 2 files changed, 8 insertions(+), 11 deletions(-)
Now queued up, thanks.
greg k-h