Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Jason Gunthorpe <jgg@nvidia.com>
Cc: "Gregory Price (Meta)" <gourry@gourry.net>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	kernel-team@meta.com, leon@kernel.org, david@kernel.org,
	kas@kernel.org, dave.hansen@linux.intel.com, bp@alien8.de,
	rppt@kernel.org, stable@vger.kernel.org,
	"Lorenzo Stoakes (ARM)" <ljs@kernel.org>
Subject: Re: [PATCH] mm/hmm: reject shadow-stack mappings
Date: Sat, 14 Nov 2026 17:01:27 -0800	[thread overview]
Message-ID: <20261114170127.3d29199864eb352d9045eaba@linux-foundation.org> (raw)
In-Reply-To: <20261115000005.GG3706007@nvidia.com>

On Sat, 14 Nov 2026 20:00:05 -0400 Jason Gunthorpe <jgg@nvidia.com> wrote:

> On Fri, Nov 13, 2026 at 06:10:25PM -0800, Andrew Morton wrote:
> 
> > How does this look for an altered changelog?
> > 
> > : On x86, a shadow-stack PTE has its ordinary write bit clear.  The CPU
> > : rejects ordinary stores to it, but pte_write() reports it writable because
> > : shadow-stack instructions can write it.  HMM consequently sets
> > : HMM_PFN_WRITE, which Nouveau turns into ordinary GPU write permission.  A
> > : process with GPU access can then overwrite its own shadow stack,
> > : potentially corrupting return addresses or bypassing that protection.
> > : 
> > : Reject shadow-stack VMAs in hmm_vma_walk_test(), including read access.  A
> > : requested fault returns -EFAULT; a snapshot records HMM_PFN_ERROR.
> 
> Yes, but it is not just nouveau, RDMA user can do this too and
> that is far more common..

Thanks.  This?

On x86, a shadow-stack PTE has its ordinary write bit clear.  The CPU
rejects ordinary stores, but pte_write() reports it writable because
shadow-stack instructions can write it.  HMM consequently sets
HMM_PFN_WRITE.  Nouveau uses that flag for GPU write permission, and
RDMA on-demand paging can use it to grant device write permission to a
registered memory region.  A device, or an RDMA peer with write access
to that region, can then overwrite the process's shadow stack,
potentially corrupting return addresses or bypassing that protection.

Reject shadow-stack VMAs in hmm_vma_walk_test(), including read access.
A requested fault returns -EFAULT; a snapshot records HMM_PFN_ERROR.


  reply	other threads:[~2026-11-15  1:01 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-13 19:55 [PATCH] mm/hmm: reject shadow-stack mappings Gregory Price (Meta)
2026-11-13 19:57 ` Lorenzo Stoakes (ARM)
2026-11-13 20:15   ` Gregory Price (Meta)
2026-11-13 20:03 ` Jason Gunthorpe
2026-11-13 20:41   ` Gregory Price (Meta)
2026-11-14  0:20     ` Jason Gunthorpe
2026-11-14  2:10       ` Andrew Morton
2026-11-15  0:00         ` Jason Gunthorpe
2026-11-15  1:01           ` Andrew Morton [this message]
2026-11-14  7:25       ` Gregory Price (Meta)
2026-11-14 11:11         ` David Hildenbrand (Arm)
2026-11-13 20:03 ` David Hildenbrand (Arm)
2026-11-13 20:42   ` Gregory Price (Meta)
2026-11-13 21:19     ` David Hildenbrand (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=20261114170127.3d29199864eb352d9045eaba@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=david@kernel.org \
    --cc=gourry@gourry.net \
    --cc=jgg@nvidia.com \
    --cc=kas@kernel.org \
    --cc=kernel-team@meta.com \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ljs@kernel.org \
    --cc=rppt@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox