From: "Edgecombe, Rick P" <rick.p.edgecombe-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
To: "rppt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org"
<rppt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: "Schimpe,
Christina"
<christina.schimpe-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
"Yang,
Weijiang" <weijiang.yang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
"hjl.tools-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org"
<hjl.tools-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
"x86-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org"
<x86-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
"monstr-pSz03upnqPeHXe+LvDLADg@public.gmane.org"
<monstr-pSz03upnqPeHXe+LvDLADg@public.gmane.org>,
"dave.hansen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org"
<dave.hansen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>,
"linux-snps-arc-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org"
<linux-snps-arc-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>,
"Torvalds,
Linus"
<torvalds-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>,
"kirill.shutemov-VuQAYsv1563Yd54FQh9/CA@public.gmane.org"
<kirill.shutemov-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>,
"linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
"dinguyen-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org"
<dinguyen-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
"rdunlap-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org"
<rdunlap-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>,
"tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org"
<tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>,
"sparclinux-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<sparclinux-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
"arnd-r2nGTMty4D4@public.gmane.org"
<arnd-r2nGTMty4D4@public.gmane.org>,
linux-ia6
Subject: Re: [PATCH v9 01/42] mm: Rename arch pte_mkwrite()'s to pte_mkwrite_novma()
Date: Tue, 13 Jun 2023 16:14:29 +0000 [thread overview]
Message-ID: <5669622238aa3092218b82ced6221a244a25dcc3.camel@intel.com> (raw)
In-Reply-To: <20230613074347.GR52412-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
On Tue, 2023-06-13 at 10:43 +0300, Mike Rapoport wrote:
> On Mon, Jun 12, 2023 at 05:10:27PM -0700, Rick Edgecombe wrote:
> > The x86 Shadow stack feature includes a new type of memory called
> > shadow
> > stack. This shadow stack memory has some unusual properties, which
> > requires
> > some core mm changes to function properly.
> >
> > One of these unusual properties is that shadow stack memory is
> > writable,
> > but only in limited ways. These limits are applied via a specific
> > PTE
> > bit combination. Nevertheless, the memory is writable, and core mm
> > code
> > will need to apply the writable permissions in the typical paths
> > that
> > call pte_mkwrite(). Future patches will make pte_mkwrite() take a
> > VMA, so
> > that the x86 implementation of it can know whether to create
> > regular
> > writable memory or shadow stack memory.
>
> Nit: ^ mapping?
Hmm, sure.
>
> > But there are a couple of challenges to this. Modifying the
> > signatures of
> > each arch pte_mkwrite() implementation would be error prone because
> > some
> > are generated with macros and would need to be re-implemented.
> > Also, some
> > pte_mkwrite() callers operate on kernel memory without a VMA.
> >
> > So this can be done in a three step process. First pte_mkwrite()
> > can be
> > renamed to pte_mkwrite_novma() in each arch, with a generic
> > pte_mkwrite()
> > added that just calls pte_mkwrite_novma(). Next callers without a
> > VMA can
> > be moved to pte_mkwrite_novma(). And lastly, pte_mkwrite() and all
> > callers
> > can be changed to take/pass a VMA.
> >
> > Start the process by renaming pte_mkwrite() to pte_mkwrite_novma()
> > and
> > adding the pte_mkwrite() wrapper in linux/pgtable.h. Apply the same
> > pattern for pmd_mkwrite(). Since not all archs have a
> > pmd_mkwrite_novma(),
> > create a new arch config HAS_HUGE_PAGE that can be used to tell if
> > pmd_mkwrite() should be defined. Otherwise in the !HAS_HUGE_PAGE
> > cases the
> > compiler would not be able to find pmd_mkwrite_novma().
> >
> > No functional change.
> >
> > Cc: linux-doc@vger.kernel.org
> > Cc: linux-kernel@vger.kernel.org
> > Cc: linux-alpha@vger.kernel.org
> > Cc: linux-snps-arc@lists.infradead.org
> > Cc: linux-arm-kernel@lists.infradead.org
> > Cc: linux-csky@vger.kernel.org
> > Cc: linux-hexagon@vger.kernel.org
> > Cc: linux-ia64@vger.kernel.org
> > Cc: loongarch@lists.linux.dev
> > Cc: linux-m68k@lists.linux-m68k.org
> > Cc: Michal Simek <monstr@monstr.eu>
> > Cc: Dinh Nguyen <dinguyen@kernel.org>
> > Cc: linux-mips@vger.kernel.org
> > Cc: openrisc@lists.librecores.org
> > Cc: linux-parisc@vger.kernel.org
> > Cc: linuxppc-dev@lists.ozlabs.org
> > Cc: linux-riscv@lists.infradead.org
> > Cc: linux-s390@vger.kernel.org
> > Cc: linux-sh@vger.kernel.org
> > Cc: sparclinux@vger.kernel.org
> > Cc: linux-um@lists.infradead.org
> > Cc: linux-arch@vger.kernel.org
> > Cc: linux-mm@kvack.org
> > Suggested-by: Linus Torvalds <torvalds@linuxfoundation.org>
> > Signed-off-by: Rick Edgecombe <rick.p.edgecombe@intel.com>
> > Link:
> > https://lore.kernel.org/lkml/CAHk-=wiZjSu7c9sFYZb3q04108stgHff2wfbokGCCgW7riz+8Q@mail.gmail.com/
>
> Reviewed-by: Mike Rapoport (IBM) <rppt@kernel.org>
Thanks!
next prev parent reply other threads:[~2023-06-13 16:14 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20230613001108.3040476-1-rick.p.edgecombe@intel.com>
2023-06-13 0:10 ` [PATCH v9 01/42] mm: Rename arch pte_mkwrite()'s to pte_mkwrite_novma() Rick Edgecombe
2023-06-13 7:19 ` Geert Uytterhoeven
2023-06-13 16:14 ` Edgecombe, Rick P
2023-06-13 7:43 ` Mike Rapoport
[not found] ` <20230613074347.GR52412-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2023-06-13 16:14 ` Edgecombe, Rick P [this message]
2023-06-13 12:26 ` David Hildenbrand
2023-06-13 16:14 ` Edgecombe, Rick P
2023-07-14 22:57 ` Mark Brown
2023-07-17 15:55 ` Edgecombe, Rick P
[not found] ` <87acbb49fa83b0e3f261315a531e105da9e5b9d6.camel-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2023-07-17 16:51 ` Mark Brown
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=5669622238aa3092218b82ced6221a244a25dcc3.camel@intel.com \
--to=rick.p.edgecombe-ral2jqcrhueavxtiumwx3w@public.gmane.org \
--cc=arnd-r2nGTMty4D4@public.gmane.org \
--cc=christina.schimpe-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=dave.hansen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
--cc=dinguyen-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=hjl.tools-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=kirill.shutemov-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
--cc=linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-snps-arc-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=monstr-pSz03upnqPeHXe+LvDLADg@public.gmane.org \
--cc=rdunlap-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org \
--cc=rppt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=sparclinux-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org \
--cc=torvalds-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org \
--cc=weijiang.yang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=x86-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.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