Linux Kernel Selftest development
 help / color / mirror / Atom feed
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>, Shuah Khan <shuah@kernel.org>,
	 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>,
	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 v2] mm/secretmem: properly account locked pages
Date: Wed, 26 Aug 2026 08:57:51 +0100	[thread overview]
Message-ID: <ao6b7b9AIUPWRTkJ@gremlin> (raw)
In-Reply-To: <20260826013948.1325213-1-4ncienth@gmail.com>

On Wed, Aug 26, 2026 at 10:39:48AM +0900, Daehyeon Ko wrote:
> Hi Lorenzo,
>
> I tested the exact v2 from this Message-ID on its stated base with an x86_64
> KASAN kernel. The supplied memfd_secret selftest passed 6/6 in three boots,
> and my accounting-boundary suite also passed in three boots. I saw no
> patch-attributable KASAN report, warning, Oops, or panic.
>
> A v1/v2 differential also confirms that v2 fixes the CAP_IPC_LOCK creator
> delegation issue Mike identified:
>
>   v1: CAP_DELEGATION creator_cap_ipc_lock=1 receiver_uid=2001 receiver_pages=2
>   v2: CAP_DELEGATION creator_cap_ipc_lock=1 receiver_uid=2001 receiver_pages=1
>
> I have one policy question before adding Tested-by. With a one-page soft and
> hard RLIMIT_MEMLOCK, a non-root task whose only effective and permitted
> capability was CAP_IPC_LOCK produced this on v2:
>
>   CAP_ONLY uid=2002 cap_ipc_lock=1 mlock_two_pages=1 faulted_pages=1 raise_hard_rc=-1 raise_hard_errno=1
>
> Thus ordinary mlock() of two pages succeeded, while only one secretmem page
> could be faulted. Raising the hard limit failed with EPERM because that
> requires CAP_SYS_RESOURCE. Is this divergence from ordinary mlock() the
> intended consequence of removing the CAP_IPC_LOCK exemption for secretmem?

I'm not quite sure what you're getting at here, as stated in the patch
CAP_IPC_LOCK does not bypass this limit for secretmem because the scope of
the folios is greater than the process so a process-level capability isn't
suited to bypass it.

Also a typical use case of secretmem is privileged process establishes,
then passes fd to less-privileged user. So it's relatively unique in this
respect and therefore it is not enforced.

The idea is that those with CAP_IPC_LOCK could raise the limits as needed
should they wish to bypass.

>
> I saw the planned selftest split and cleanup in the follow-up discussion. I
> will retest the revised patch before adding Tested-by.

Thanks!

>
> Thanks,
> Daehyeon

--
Cheers, Lorenzo

      reply	other threads:[~2026-08-26  7:57 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-22 19:14 [PATCH v2] mm/secretmem: properly account locked pages Lorenzo Stoakes (ARM)
2026-08-24 13:21 ` Mike Rapoport
2026-08-25 10:50 ` David Hildenbrand (Arm)
2026-08-25 11:18   ` Lorenzo Stoakes (ARM)
2026-08-25 12:56     ` David Hildenbrand (Arm)
2026-08-26 16:18     ` Lorenzo Stoakes (ARM)
2026-08-26  1:39 ` Daehyeon Ko
2026-08-26  7:57   ` Lorenzo Stoakes (ARM) [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=ao6b7b9AIUPWRTkJ@gremlin \
    --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=rppt@kernel.org \
    --cc=sdf@fomichev.me \
    --cc=shuah@kernel.org \
    --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