Thread (115 messages) 115 messages, 12 authors, 2023-03-01

Re: [PATCH v6 20/41] x86/mm: Teach pte_mkwrite() about stack memory

From: Deepak Gupta <hidden>
Date: 2023-03-01 15:43:25
Also in: linux-arch, linux-doc, linux-mm, lkml

On Sat, Feb 18, 2023 at 01:14:12PM -0800, Rick Edgecombe wrote:
If a VMA has the VM_SHADOW_STACK flag, it is shadow stack memory. So
when it is made writable with pte_mkwrite(), it should create shadow
stack memory, not conventionally writable memory. Now that pte_mkwrite()
takes a VMA, and places where shadow stack memory might be created pass
one, pte_mkwrite() can know when it should do this.

So make pte_mkwrite() create shadow stack memory when the VMA has the
VM_SHADOW_STACK flag. Do the same thing for pmd_mkwrite().

This requires referencing VM_SHADOW_STACK in these functions, which are
currently defined in pgtable.h, however mm.h (where VM_SHADOW_STACK is
located) can't be pulled in without causing problems for files that
reference pgtable.h. So also move pte/pmd_mkwrite() into pgtable.c, where
they can safely reference VM_SHADOW_STACK.

Tested-by: Pengfei Xu <redacted>
Signed-off-by: Rick Edgecombe <rick.p.edgecombe@intel.com>
Acked-by: Deepak Gupta <redacted>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help