Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Rapoport <rppt@kernel.org>
To: "Baek Kyu, Kim" <pocj8ur4in@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	David Hildenbrand <david@kernel.org>,
	Lorenzo Stoakes <ljs@kernel.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 RESEND] mm/secretmem: Keep locked memory accounting until inode eviction
Date: Mon, 30 Nov 2026 08:56:02 +0200	[thread overview]
Message-ID: <aw0eAjsIRpOweF2z@kernel.org> (raw)
In-Reply-To: <179600882107.30666.13893484586058179051.c113-v4-resend@gmail.com>

On Mon, Nov 30, 2026 at 12:20:21PM +0900, Baek Kyu, Kim wrote:
> A secretmem inode can outlive its original file. An O_PATH descriptor
> opened through /proc/self/fd keeps the inode and its unevictable folios
> alive after the mapping and original descriptor are closed. The file
> release path nevertheless drops the locked-memory charge, allowing the
> same user to reuse RLIMIT_MEMLOCK while those folios remain allocated.
> 
> Move private-state and locked-memory accounting cleanup to inode eviction,
> after truncating the page cache. Keep secretmem_users active over the same
> lifetime so the hibernation guard covers retained secret pages.
> 
> Initialize private state after creating the secure inode. The filesystem
> root and an inode evicted before state attachment have no private state,
> so skip private cleanup in those cases. Once state is attached, iput()
> handles file-creation failures and releases the user reference on eviction.
> 
> Fixes: 97d34aa65c29 ("mm/secretmem: properly account locked pages")
> Signed-off-by: Baek Kyu, Kim <pocj8ur4in@gmail.com>

Reviewed-by: Mike Rapoport (Microsoft) <rppt@kernel.org>

> ---
>  mm/secretmem.c | 30 +++++++++++++++++-------------
>  1 file changed, 17 insertions(+), 13 deletions(-)

-- 
Sincerely yours,
Mike.


      reply	other threads:[~2026-11-30  6:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-30  3:20 [PATCH v4 RESEND] mm/secretmem: Keep locked memory accounting until inode eviction Baek Kyu, Kim
2026-11-30  6:56 ` Mike Rapoport [this message]

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=aw0eAjsIRpOweF2z@kernel.org \
    --to=rppt@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=david@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ljs@kernel.org \
    --cc=pocj8ur4in@gmail.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