All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Zi Yan" <ziy@nvidia.com>
Cc: linux-trace-kernel@vger.kernel.org
Subject: Re: [PATCH v2 14/14] mm/page-flags: remove PG_private
Date: Tue, 01 Sep 2026 00:16:14 +0000	[thread overview]
Message-ID: <20260901001614.D5D451F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260831-remove-pg_private-v2-14-3668159cd9e8@nvidia.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Removal of PG_private safety check causes leaked filesystem private data to go undetected.
--

commit 9b27f18c6460a8f0a47a836096a558c0ddbb879d
Author: Zi Yan <ziy@nvidia.com>
Subject: mm/page-flags: remove PG_private

This patch removes the PG_private flag and repurposes its space as
__PG_folio. It replaces the flag checks with checking if
folio->private != NULL to determine if a folio carries private data. It
also updates relevant documentation to reflect these changes.

> diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
> index ae2ebaed6d4d9..02e67307ffff4 100644
> --- a/include/linux/page-flags.h
> +++ b/include/linux/page-flags.h
[ ... ]
> @@ -1169,7 +1170,7 @@ static __always_inline void __ClearPageAnonExclusive(struct page *page)
>   */
>  #define PAGE_FLAGS_CHECK_AT_FREE				\
>  	(1UL << PG_lru		| 1UL << PG_locked	|	\
> -	 1UL << PG_private	| 1UL << PG_private_2	|	\
> +	 1UL << PG_private_2	|				\
>  	 1UL << PG_writeback	| 1UL << PG_reserved	|	\
>  	 1UL << PG_active 	|				\
>  	 1UL << PG_unevictable	| __PG_MLOCKED | LRU_GEN_MASK)

[Severity: High]
Does removing PG_private from this mask cause leaked filesystem private data
to go undetected?

By removing the PG_private check without adding a replacement check for
folio->private != NULL on the head page, the memory allocator's validation
routines no longer catch this leak.

Instead, when a buggy filesystem or subsystem frees a page with a non-NULL
private field, free_pages_prepare() in mm/page_alloc.c will unconditionally
zero it without warning:

mm/page_alloc.c:free_pages_prepare() {
    ...
    page->flags.f &= ~PAGE_FLAGS_CHECK_AT_PREP;
    page->private = 0;
    ...
}

Could this silently erase the leaked private data (such as buffer heads) and
mask the underlying memory leak?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260831-remove-pg_private-v2-0-3668159cd9e8@nvidia.com?part=14

  reply	other threads:[~2026-09-01  0:16 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-31 19:25 [PATCH v2 00/14] Remove PG_private by using page/folio->private checks instead Zi Yan
2026-08-31 19:25 ` [f2fs-dev] " Zi Yan via Linux-f2fs-devel
2026-08-31 19:25 ` Zi Yan
2026-08-31 19:25 ` [PATCH v2 01/14] mm/zsmalloc: replace PG_private with pointer comparison Zi Yan
2026-08-31 19:25 ` [PATCH v2 02/14] perf/ring_buffer: stop using PG_private as AUX page high-order marker Zi Yan
2026-08-31 21:35   ` sashiko-bot
2026-08-31 19:25 ` [PATCH v2 03/14] xen/grant-table: stop setting PG_private on pages for grant mapping Zi Yan
2026-08-31 19:25 ` [PATCH v2 04/14] fscrypt: stop setting PG_private on bounce page Zi Yan
2026-08-31 19:25 ` [PATCH v2 05/14] mm/hugetlb: use direct assignment instead of folio_change_private() Zi Yan
2026-09-03  0:05   ` Gregory Price
2026-08-31 19:25 ` [PATCH v2 06/14] f2fs: stop using PG_private Zi Yan
2026-08-31 19:25   ` [f2fs-dev] " Zi Yan via Linux-f2fs-devel
2026-09-03 15:37   ` Jaegeuk Kim
2026-09-03 15:37     ` [f2fs-dev] " Jaegeuk Kim via Linux-f2fs-devel
2026-08-31 19:25 ` [PATCH v2 07/14] erofs: mm/pagemap: add readahead_folio_last() to avoid folio->private Zi Yan
2026-08-31 19:25 ` [PATCH v2 08/14] erofs: use folio_attach/detach_private() instead of direct assignment Zi Yan
2026-08-31 19:25 ` [PATCH v2 09/14] mm/page-flags: check page/folio->private instead of PG_private Zi Yan
2026-08-31 23:21   ` sashiko-bot
2026-09-01  2:11   ` Zi Yan
2026-08-31 19:25 ` [PATCH v2 10/14] mm/page-flags: introduce folio_test_fs_private() Zi Yan
2026-08-31 19:25 ` [PATCH v2 11/14] treewide: remove folio_set/clear_private() Zi Yan
2026-08-31 19:25 ` [PATCH v2 12/14] treewide: replace PagePrivate() with page_private() Zi Yan
2026-08-31 19:25 ` [PATCH v2 13/14] treewide: adjust comments on PagePrivate and PG_private Zi Yan
2026-08-31 19:25   ` Zi Yan
2026-08-31 19:25 ` [PATCH v2 14/14] mm/page-flags: remove PG_private Zi Yan
2026-09-01  0:16   ` sashiko-bot [this message]
2026-09-01  2:17   ` Zi Yan
2026-09-01 15:55   ` Steven Rostedt
2026-09-01 16:01     ` Zi Yan
2026-09-01 17:50       ` Steven Rostedt
2026-09-02 17:09   ` Usama Arif
2026-09-02 17:57     ` Zi Yan
2026-09-03 16:10 ` [f2fs-dev] [PATCH v2 00/14] Remove PG_private by using page/folio->private checks instead patchwork-bot+f2fs
2026-09-03 16:10   ` patchwork-bot+f2fs
2026-09-03 16:10   ` patchwork-bot+f2fs--- via Linux-f2fs-devel

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=20260901001614.D5D451F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=ziy@nvidia.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.