Re: [PATCH 3/3] mm: Care about shadow stack guard gap when getting an unmapped area

2024-09-04 Thread Deepak Gupta
On Tue, Sep 03, 2024 at 08:57:20PM +0100, Mark Brown wrote: On Tue, Sep 03, 2024 at 03:41:49PM -0400, Liam R. Howlett wrote: * Mark Brown [240902 15:09]: > +static inline unsigned long stack_guard_placement(vm_flags_t vm_flags) > +{ > + if (vm_flags & VM_SHADOW_STACK) > + return PA

Re: [PATCH 3/3] mm: Care about shadow stack guard gap when getting an unmapped area

2024-09-04 Thread Deepak Gupta
On Mon, Sep 02, 2024 at 08:08:15PM +0100, Mark Brown wrote: As covered in the commit log for c44357c2e76b ("x86/mm: care about shadow stack guard gap during placement") our current mmap() implementation does not take care to ensure that a new mapping isn't placed with existing mappings inside it'

Re: [PATCH 3/3] mm: Care about shadow stack guard gap when getting an unmapped area

2024-09-03 Thread Mark Brown
On Tue, Sep 03, 2024 at 03:41:49PM -0400, Liam R. Howlett wrote: > * Mark Brown [240902 15:09]: > > +static inline unsigned long stack_guard_placement(vm_flags_t vm_flags) > > +{ > > + if (vm_flags & VM_SHADOW_STACK) > > + return PAGE_SIZE; > Is PAGE_SIZE is enough? It's what x86 cu

Re: [PATCH 3/3] mm: Care about shadow stack guard gap when getting an unmapped area

2024-09-03 Thread Liam R. Howlett
* Mark Brown [240902 15:09]: > As covered in the commit log for c44357c2e76b ("x86/mm: care about shadow > stack guard gap during placement") our current mmap() implementation does > not take care to ensure that a new mapping isn't placed with existing > mappings inside it's own guard gaps. This i

Re: [PATCH 3/3] mm: Care about shadow stack guard gap when getting an unmapped area

2024-09-03 Thread Lorenzo Stoakes
On Tue, Sep 03, 2024 at 07:20:02PM GMT, Mark Brown wrote: > On Tue, Sep 03, 2024 at 06:49:46PM +0100, Lorenzo Stoakes wrote: > > On Mon, Sep 02, 2024 at 08:08:15PM GMT, Mark Brown wrote: > > > > On x86 there is a custom arch_get_unmapped_area() which was updated by the > > > above commit to cover t

Re: [PATCH 3/3] mm: Care about shadow stack guard gap when getting an unmapped area

2024-09-03 Thread Mark Brown
On Tue, Sep 03, 2024 at 06:49:46PM +0100, Lorenzo Stoakes wrote: > On Mon, Sep 02, 2024 at 08:08:15PM GMT, Mark Brown wrote: > > On x86 there is a custom arch_get_unmapped_area() which was updated by the > > above commit to cover this case by specifying a start_gap for allocations > > with VM_SHAD

Re: [PATCH 3/3] mm: Care about shadow stack guard gap when getting an unmapped area

2024-09-03 Thread Lorenzo Stoakes
On Mon, Sep 02, 2024 at 08:08:15PM GMT, Mark Brown wrote: > As covered in the commit log for c44357c2e76b ("x86/mm: care about shadow > stack guard gap during placement") our current mmap() implementation does > not take care to ensure that a new mapping isn't placed with existing > mappings inside

[PATCH 3/3] mm: Care about shadow stack guard gap when getting an unmapped area

2024-09-02 Thread Mark Brown
As covered in the commit log for c44357c2e76b ("x86/mm: care about shadow stack guard gap during placement") our current mmap() implementation does not take care to ensure that a new mapping isn't placed with existing mappings inside it's own guard gaps. This is particularly important for shadow st