Re: [PATCH v1 1/2] mseal: fix mmap(FIXED) error code.

2024-08-31 Thread Lorenzo Stoakes
On Fri, Aug 30, 2024 at 06:15:46PM GMT, Andrew Morton wrote: > On Thu, 29 Aug 2024 13:09:41 +0100 Lorenzo Stoakes > wrote: > > > Relevant section from MAINTAINERS: > > > > MEMORY MAPPING > > I always thought it meant "memory management" ;) Ha ha no, I

Re: [PATCH v3 4/5] selftests/mseal: add more tests for mmap

2024-08-30 Thread Lorenzo Stoakes
On Fri, Aug 30, 2024 at 07:43:12PM GMT, Lorenzo Stoakes wrote: > On Fri, Aug 30, 2024 at 06:02:36PM GMT, jef...@chromium.org wrote: > > From: Jeff Xu > > > > Add sealing test to cover mmap for > > Expand/shrink across sealed vmas (MAP_FIXED) > > Reuse the same add

Re: [PATCH v3 0/5] Increase mseal test coverage

2024-08-30 Thread Lorenzo Stoakes
nux-kselftest/20240829214352.963001-1-jef...@chromium.org/ > - remove the mmap fix (Liam R. Howlett will fix it separately) > - Add cover letter (Lorenzo Stoakes) I think I asked for more than this :) > - split the testcase for ease of review (Mark Brown) > > V1: > - > https:

Re: [PATCH v3 4/5] selftests/mseal: add more tests for mmap

2024-08-30 Thread Lorenzo Stoakes
On Fri, Aug 30, 2024 at 06:02:36PM GMT, jef...@chromium.org wrote: > From: Jeff Xu > > Add sealing test to cover mmap for > Expand/shrink across sealed vmas (MAP_FIXED) > Reuse the same address in !MAP_FIXED case. This commit message is woefully small. I told you on v1 to improve the commit messa

Re: [PATCH RFC v2 0/4] mm: Introduce MAP_BELOW_HINT

2024-08-30 Thread Lorenzo Stoakes
On Fri, Aug 30, 2024 at 08:03:25AM GMT, Dave Hansen wrote: > On 8/29/24 01:42, Lorenzo Stoakes wrote: > >> These applications work on x86 because x86 does an implicit 47-bit > >> restriction of mmap() address that contain a hint address that is less > >> than 48 b

Re: [PATCH RFC v2 0/4] mm: Introduce MAP_BELOW_HINT

2024-08-30 Thread Lorenzo Stoakes
On Thu, Aug 29, 2024 at 03:16:53PM GMT, Charlie Jenkins wrote: > On Thu, Aug 29, 2024 at 10:54:25AM +0100, Lorenzo Stoakes wrote: > > On Thu, Aug 29, 2024 at 09:42:22AM GMT, Lorenzo Stoakes wrote: > > > On Thu, Aug 29, 2024 at 12:15:57AM GMT, Charlie Jenkins wrote: > > &g

Re: [PATCH v1 2/2] selftests/mm: mseal_test add more tests

2024-08-29 Thread Lorenzo Stoakes
On Thu, Aug 29, 2024 at 05:16:50PM GMT, Mark Brown wrote: > On Wed, Aug 28, 2024 at 10:55:22PM +, jef...@chromium.org wrote: > > > Add more testcases and increase test coverage, e.g. add > > get_vma_size to check VMA size and prot bits. > > I think this needs to be split into multiple patches,

Re: [PATCH v1 2/2] selftests/mm: mseal_test add more tests

2024-08-29 Thread Lorenzo Stoakes
On Thu, Aug 29, 2024 at 08:30:11AM GMT, Jeff Xu wrote: > Hi Lorenzo > > On Thu, Aug 29, 2024 at 8:14 AM Lorenzo Stoakes > wrote: > > > > On Thu, Aug 29, 2024 at 07:45:56AM GMT, Jeff Xu wrote: > > > HI Andrew > > > > > > On Wed, Aug 28, 20

Re: [PATCH v1 2/2] selftests/mm: mseal_test add more tests

2024-08-29 Thread Lorenzo Stoakes
On Thu, Aug 29, 2024 at 07:45:56AM GMT, Jeff Xu wrote: > HI Andrew > > On Wed, Aug 28, 2024 at 3:55 PM wrote: > > > > From: Jeff Xu > > > > Add more testcases and increase test coverage, e.g. add > > get_vma_size to check VMA size and prot bits. This commit message is ridiculously short for such

Re: [PATCH v1 1/2] mseal: fix mmap(FIXED) error code.

2024-08-29 Thread Lorenzo Stoakes
elevant section from MAINTAINERS: MEMORY MAPPING M: Andrew Morton R: Liam R. Howlett R: Vlastimil Babka R: Lorenzo Stoakes L: linux...@kvack.org S: Maintained W: http://www.linux-mm.org T: git git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm F: mm

Re: [PATCH RFC v2 0/4] mm: Introduce MAP_BELOW_HINT

2024-08-29 Thread Lorenzo Stoakes
On Thu, Aug 29, 2024 at 09:42:22AM GMT, Lorenzo Stoakes wrote: > On Thu, Aug 29, 2024 at 12:15:57AM GMT, Charlie Jenkins wrote: > > Some applications rely on placing data in free bits addresses allocated > > by mmap. Various architectures (eg. x86, arm64, powerpc) restrict the >

Re: [PATCH RFC v2 2/4] mm: Add hint and mmap_flags to struct vm_unmapped_area_info

2024-08-29 Thread Lorenzo Stoakes
On Thu, Aug 29, 2024 at 12:15:59AM GMT, Charlie Jenkins wrote: [snip] > diff --git a/mm/mmap.c b/mm/mmap.c > index d0dfc85b209b..34ba0db23678 100644 > --- a/mm/mmap.c > +++ b/mm/mmap.c > @@ -1796,6 +1796,9 @@ generic_get_unmapped_area(struct file *filp, unsigned > long addr, > struct vm_un

Re: [PATCH RFC v2 0/4] mm: Introduce MAP_BELOW_HINT

2024-08-29 Thread Lorenzo Stoakes
iller > To: Andreas Larsson > To: Thomas Gleixner > To: Ingo Molnar > To: Borislav Petkov > To: Dave Hansen > To: x...@kernel.org > To: H. Peter Anvin > To: Andy Lutomirski > To: Peter Zijlstra > To: Muchun Song > To: Andrew Morton > To: Liam R. Howl

Re: [PATCH 00/16] mm: Introduce MAP_BELOW_HINT

2024-08-28 Thread Lorenzo Stoakes
gt; To: Paul Walmsley > To: Palmer Dabbelt > To: Albert Ou > To: Catalin Marinas > To: Will Deacon > To: Michael Ellerman > To: Nicholas Piggin > To: Christophe Leroy > To: Naveen N Rao > To: Muchun Song > To: Andrew Morton > To: Liam R. Howlett > To: Vlasti

Re: [PATCH 16/16] selftests/mm: Create MAP_BELOW_HINT test

2024-08-28 Thread Lorenzo Stoakes
On Tue, Aug 27, 2024 at 10:49:22PM GMT, Charlie Jenkins wrote: > Add a selftest for MAP_BELOW_HINT that maps until it runs out of space > below the hint address. > > Signed-off-by: Charlie Jenkins > --- > tools/testing/selftests/mm/Makefile | 1 + > tools/testing/selftests/mm/map_below_h

Re: [PATCH v3 2/7] mm/munmap: Replace can_modify_mm with can_modify_vma

2024-08-21 Thread Lorenzo Stoakes
On Wed, Aug 21, 2024 at 09:33:06AM GMT, Jeff Xu wrote: > On Wed, Aug 21, 2024 at 9:24 AM Pedro Falcato wrote: > > > > On Wed, Aug 21, 2024 at 5:16 PM Jeff Xu wrote: > > > > > > On Fri, Aug 16, 2024 at 5:18 PM Pedro Falcato > > > wrote: > > > > > > > > We were doing an extra mmap tree traversal

Re: [PATCH v3 2/7] mm/munmap: Replace can_modify_mm with can_modify_vma

2024-08-21 Thread Lorenzo Stoakes
On Wed, Aug 21, 2024 at 09:15:52AM GMT, Jeff Xu wrote: > On Fri, Aug 16, 2024 at 5:18 PM Pedro Falcato wrote: > > > > We were doing an extra mmap tree traversal just to check if the entire > > range is modifiable. This can be done when we iterate through the VMAs > > instead. > > > > Signed-off-by

Re: [PATCH v3 7/7] selftests/mm: add more mseal traversal tests

2024-08-21 Thread Lorenzo Stoakes
gular VMA is followed by a sealed VMA. > > Signed-off-by: Pedro Falcato Other than the comment, LGTM. Thanks for this series! Reviewed-by: Lorenzo Stoakes > --- > tools/testing/selftests/mm/mseal_test.c | 111 > +++- > 1 file changed, 110 insertions(+),

Re: [PATCH v3 6/7] mm: Remove can_modify_mm()

2024-08-21 Thread Lorenzo Stoakes
On Sat, Aug 17, 2024 at 01:18:33AM GMT, Pedro Falcato wrote: > With no more users in the tree, we can finally remove can_modify_mm(). > > Signed-off-by: Pedro Falcato Reviewed-by: Lorenzo Stoakes > --- > mm/internal.h | 14 -- > mm/mseal.c| 21 --

Re: [PATCH v3 5/7] mseal: Replace can_modify_mm_madv with a vma variant

2024-08-21 Thread Lorenzo Stoakes
a) > return true; > } > > +bool can_modify_vma_madv(struct vm_area_struct *vma, int behavior); > + > #else > > static inline bool can_modify_vma(struct vm_area_struct *vma) > @@ -387,6 +389,11 @@ static inline bool can_modify_vma(struct vm_area_struct > *vma) > return true; > } > > +static inline bool can_modify_vma_madv(struct vm_area_struct *vma, int > behavior) > +{ > + return true; > +} > + > #endif > > #endif /* __MM_VMA_H */ > > -- > 2.46.0 > I remain baffled that the original implementation tried to do these things at an mm- granularity. Reviewed-by: Lorenzo Stoakes

Re: [PATCH v3 4/7] mm/mremap: Replace can_modify_mm with can_modify_vma

2024-08-20 Thread Lorenzo Stoakes
ink/expand together. > - */ > - if (unlikely(!can_modify_mm(mm, addr, addr + old_len))) { > - ret = -EPERM; > - goto out; > - } > - > /* >* Always allow a shrinking remap: that just unmaps >* the unnecessary pages.. > > -- > 2.46.0 > Reviewed-by: Lorenzo Stoakes

Re: [PATCH v3 3/7] mm/mprotect: Replace can_modify_mm with can_modify_vma

2024-08-20 Thread Lorenzo Stoakes
ng newflags); Which explicitly says DO NOT MODIFY THE VMA. So we're good. > prev = vma_prev(&vmi); > if (start > vma->vm_start) > prev = vma; > > -- > 2.46.0 > Reviewed-by: Lorenzo Stoakes

Re: [PATCH v3 2/7] mm/munmap: Replace can_modify_mm with can_modify_vma

2024-08-20 Thread Lorenzo Stoakes
*/ > - if (unlikely(!can_modify_mm(mm, start, end))) > - return -EPERM; > - This means we will arch_unmap() first, before realising we can't unmap, however there are a number of other error conditions that would cause a similar outcome in do_vmi_align_munmap() so I don't think that's a problem. > /* Find the first overlapping VMA */ > vma = vma_find(vmi, end); > if (!vma) { > > -- > 2.46.0 > LGTM, Reviewed-by: Lorenzo Stoakes

Re: [PATCH v3 1/7] mm: Move can_modify_vma to mm/vma.h

2024-08-20 Thread Lorenzo Stoakes
ic inline bool can_modify_vma(struct vm_area_struct *vma) > +{ > + return true; > +} > + > +#endif > + > #endif /* __MM_VMA_H */ > > -- > 2.46.0 > Thanks for moving to vma.h rather than internal.h! Definitely seems to me to be the correct place for it. Reviewed-by: Lorenzo Stoakes