From: "Lorenzo Stoakes (ARM)" <ljs@kernel.org>
To: Daehyeon Ko <4ncienth@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Mike Rapoport <rppt@kernel.org>,
David Hildenbrand <david@kernel.org>,
"Liam R . Howlett" <liam@infradead.org>,
Vlastimil Babka <vbabka@kernel.org>,
Suren Baghdasaryan <surenb@google.com>,
Michal Hocko <mhocko@suse.com>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
"David S . Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Jesper Dangaard Brouer <hawk@kernel.org>,
John Fastabend <john.fastabend@gmail.com>,
Stanislav Fomichev <sdf@fomichev.me>,
James Bottomley <James.Bottomley@hansenpartnership.com>,
Hagen Paul Pfeifer <hagen@jauu.net>,
Pedro Falcato <pfalcato@suse.de>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
linux-kselftest@vger.kernel.org, netdev@vger.kernel.org,
bpf@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] mm/secretmem: properly account locked pages
Date: Tue, 18 Aug 2026 08:00:04 +0100 [thread overview]
Message-ID: <aoQBQWH1zWgC5f3A@lucifer> (raw)
In-Reply-To: <20260818052006.2387242-1-4ncienth@gmail.com>
On Tue, Aug 18, 2026 at 02:20:06PM +0900, Daehyeon Ko wrote:
> Thanks for the patch.
>
> I tested this v1 on its stated base with an x86_64 KASAN kernel. The supplied
> selftest passed 6/6 in three boots. Additional fork/unmap and inherited-VMA
> mremap tests also passed.
>
> One question: the inode stores the creator's user_struct, but the fault path
> uses the current task's RLIMIT_MEMLOCK.
>
> secretmem_init_inode_priv():
> state->user = get_uid(current_user());
> __secretmem_account_pages():
> page_limit = rlimit(RLIMIT_MEMLOCK) >> PAGE_SHIFT;
>
> With A limited to one page and B to four, A created the fd and passed it to B.
> B faulted four pages, after which A got SIGBUS faulting one page on a new fd:
>
> CROSS_PRINCIPAL receiver_pages=4 creator_fresh_page=0
>
> This seems to charge A's locked_vm using B's limit. Is that intended?
Yup, it's a per-process limit even if the accounting spans multiple
processes.
It'd be incredibly involved to track each resource individually and this is
a trade-off.
In practice people aren't typically varying the limits like this and in any
case, the least surprising behaviour is to adhere to the current process's
limit.
And this is the same solution used everywhere else by io_uring, etc.
>
> Thanks,
> Daehyeon
--
Cheers, Lorenzo
next prev parent reply other threads:[~2026-08-18 7:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-14 18:46 [PATCH] mm/secretmem: properly account locked pages Lorenzo Stoakes (ARM)
2026-08-18 5:20 ` Daehyeon Ko
2026-08-18 7:00 ` Lorenzo Stoakes (ARM) [this message]
2026-08-18 7:16 ` Lorenzo Stoakes (ARM)
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=aoQBQWH1zWgC5f3A@lucifer \
--to=ljs@kernel.org \
--cc=4ncienth@gmail.com \
--cc=James.Bottomley@hansenpartnership.com \
--cc=akpm@linux-foundation.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=david@kernel.org \
--cc=hagen@jauu.net \
--cc=hawk@kernel.org \
--cc=john.fastabend@gmail.com \
--cc=kuba@kernel.org \
--cc=liam@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=netdev@vger.kernel.org \
--cc=pfalcato@suse.de \
--cc=rppt@kernel.org \
--cc=sdf@fomichev.me \
--cc=stable@vger.kernel.org \
--cc=surenb@google.com \
--cc=vbabka@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