All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Rapoport <rppt@kernel.org>
To: "David Hildenbrand (Arm)" <david@kernel.org>
Cc: Jason Gunthorpe <jgg@ziepe.ca>, Leon Romanovsky <leon@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	James Bottomley <James.Bottomley@hansenpartnership.com>,
	Hagen Paul Pfeifer <hagen@jauu.net>,
	linux-mm@kvack.org, Chris Mason <mason@kernel.org>,
	stable@vger.kernel.org
Subject: Re: [PATCH] mm/hmm: refuse secretmem VMAs in hmm_range_fault()
Date: Sun, 29 Nov 2026 18:01:22 +0200	[thread overview]
Message-ID: <awxMUuZo3H-xOYV8@kernel.org> (raw)
In-Reply-To: <20261129-hmm_secretmem-v1-1-113c4f5e18a1@kernel.org>

On Sun, Nov 29, 2026 at 09:47:02AM +0100, David Hildenbrand (Arm) wrote:
> From: Chris Mason <mason@kernel.org>
> 
> secretmem folios are removed from the directmap. GUP refuses secretmem

Nit: usually direct map is two words :)

> VMAs for that reason, but hmm_range_fault() hands out secretmem folios
> to drivers.
> 
> Consequently, drivers that are not aware of this might access these
> folios through the directmap, resulting in a kernel page fault. For
> example, the rxe ODP code accesses the folios through kmap_local_page()
> when copying data or performing atomic operations on a memory region.
> 
> Let's fix it by refusing secretmem VMAs in hmm_range_fault(), just like
> GUP does.
> 
> This has low urgency, as it requires registering secretmem with a driver
> that uses hmm_range_fault(), such as rxe ODP.
> 
> Fixes: 1507f51255c9 ("mm: introduce memfd_secret system call to create "secret" memory areas")
> Cc: stable@vger.kernel.org
> Signed-off-by: Chris Mason <mason@kernel.org>
> [ david: adjust description and comment ]
> Signed-off-by: David Hildenbrand (Arm) <david@kernel.org>
> ---
> On top of akpm/mm-unstable.
>
> @@ -611,6 +612,9 @@ static int hmm_vma_walk_test(unsigned long start, unsigned long end,
>  	 *
>  	 * Devices must not gain ordinary write access to shadow stacks.
>  	 *
> +	 * secretmem folios have no directmap and drivers are not aware of

Ditto.

I believe Andrew can fix it up while applying.

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

> +	 * that; refuse such mappings, just like GUP does.
> +	 *
>  	 * If a fault is requested for an unsupported range then it is a hard
>  	 * failure.
>  	 */

-- 
Sincerely yours,
Mike.

  reply	other threads:[~2026-11-29 16:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-29  8:47 [PATCH] mm/hmm: refuse secretmem VMAs in hmm_range_fault() David Hildenbrand (Arm)
2026-11-29 16:01 ` Mike Rapoport [this message]
2026-11-30 10:45   ` David Hildenbrand (Arm)
2026-11-29 21:15 ` + mm-hmm-refuse-secretmem-vmas-in-hmm_range_fault.patch added to mm-new branch Andrew Morton
2026-12-01  0:53 ` [PATCH] mm/hmm: refuse secretmem VMAs in hmm_range_fault() Jason Gunthorpe

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=awxMUuZo3H-xOYV8@kernel.org \
    --to=rppt@kernel.org \
    --cc=James.Bottomley@hansenpartnership.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@kernel.org \
    --cc=hagen@jauu.net \
    --cc=jgg@ziepe.ca \
    --cc=leon@kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mason@kernel.org \
    --cc=stable@vger.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 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.