Re: [PATCH v3 09/29] mm: abstract shadow stack vma behind `vma_is_shadow_stack`

From: Deepak Gupta
Date: Thu Apr 04 2024 - 17:39:37 EST


On Thu, Apr 04, 2024 at 09:02:17PM +0200, David Hildenbrand wrote:
On 04.04.24 01:34, Deepak Gupta wrote:
}
- } else if (!(vm_flags & VM_READ)) {
+ } else if (!(vm_flags & VM_READ) && !vma_is_shadow_stack(vm_flags)) {
+ /* reads allowed if its shadow stack vma */
if (!(gup_flags & FOLL_FORCE))
return -EFAULT;
/*

Unless I am missing something, this is not a simple cleanup. It should go into a separate patch with a clearly documented reason for that change.

I tried that here
https://lore.kernel.org/linux-mm/CAKC1njTPBqtsAOn-CWhB+-8FaZ2KWkkz-vRZr7MZq=0yLUdjcQ@xxxxxxxxxxxxxx/T/
But at that time, VM_SHADOW_STACK for riscv meant only VM_WRITE. So I think
there was obvious uneasiness with that part.

Now we have VM_SHADOW_STACK pretty much same for all arches and only 64bit.
I'll try it again as a separate patch.


--
Cheers,

David / dhildenb