linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/vma: Return the exact errno for vms_gather_munmap_vmas()
@ 2024-09-01 14:50 Xiao Yang
  2024-09-03 15:58 ` Liam R. Howlett
  0 siblings, 1 reply; 3+ messages in thread
From: Xiao Yang @ 2024-09-01 14:50 UTC (permalink / raw)
  To: Liam.Howlett, linux-mm
  Cc: linux-kernel, ltp, andrea.cervesato, oliver.sang, Xiao Yang

can_modify_vma() in vms_gather_munmap_vmas() returns -EPERM if vma is
sealed so don't always return the fixed -ENOMEM on failure.

Fixes: c2eb22189bbc ("mm/vma: inline munmap operation in mmap_region()")
Fixes: 5887a7ac2383 ("mm/vma: expand mmap_region() munmap call")
Signed-off-by: Xiao Yang <ice_yangxiao@163.com>
Reported-by: kernel test robot <oliver.sang@intel.com>
Closes: https://lore.kernel.org/oe-lkp/202408312155.fd26a58c-oliver.sang@intel.com
---
 mm/mmap.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/mm/mmap.c b/mm/mmap.c
index c1781f643046..c9a0dc035819 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -1386,8 +1386,9 @@ unsigned long mmap_region(struct file *file, unsigned long addr,
 		mt_on_stack(mt_detach);
 		mas_init(&mas_detach, &mt_detach, /* addr = */ 0);
 		/* Prepare to unmap any existing mapping in the area */
-		if (vms_gather_munmap_vmas(&vms, &mas_detach))
-			return -ENOMEM;
+		error = vms_gather_munmap_vmas(&vms, &mas_detach);
+		if (error)
+			return error;
 
 		vmg.next = vms.next;
 		vmg.prev = vms.prev;
-- 
2.44.0



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mm/vma: Return the exact errno for vms_gather_munmap_vmas()
  2024-09-01 14:50 [PATCH] mm/vma: Return the exact errno for vms_gather_munmap_vmas() Xiao Yang
@ 2024-09-03 15:58 ` Liam R. Howlett
  2024-09-04  4:37   ` 杨晓
  0 siblings, 1 reply; 3+ messages in thread
From: Liam R. Howlett @ 2024-09-03 15:58 UTC (permalink / raw)
  To: Xiao Yang; +Cc: linux-mm, linux-kernel, ltp, andrea.cervesato, oliver.sang


Thanks, but this is already fixed in v8 of my patches.

* Xiao Yang <ice_yangxiao@163.com> [240901 10:51]:
> can_modify_vma() in vms_gather_munmap_vmas() returns -EPERM if vma is
> sealed so don't always return the fixed -ENOMEM on failure.
> 
> Fixes: c2eb22189bbc ("mm/vma: inline munmap operation in mmap_region()")
> Fixes: 5887a7ac2383 ("mm/vma: expand mmap_region() munmap call")
> Signed-off-by: Xiao Yang <ice_yangxiao@163.com>
> Reported-by: kernel test robot <oliver.sang@intel.com>
> Closes: https://lore.kernel.org/oe-lkp/202408312155.fd26a58c-oliver.sang@intel.com
> ---
>  mm/mmap.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/mm/mmap.c b/mm/mmap.c
> index c1781f643046..c9a0dc035819 100644
> --- a/mm/mmap.c
> +++ b/mm/mmap.c
> @@ -1386,8 +1386,9 @@ unsigned long mmap_region(struct file *file, unsigned long addr,
>  		mt_on_stack(mt_detach);
>  		mas_init(&mas_detach, &mt_detach, /* addr = */ 0);
>  		/* Prepare to unmap any existing mapping in the area */
> -		if (vms_gather_munmap_vmas(&vms, &mas_detach))
> -			return -ENOMEM;
> +		error = vms_gather_munmap_vmas(&vms, &mas_detach);
> +		if (error)
> +			return error;
>  
>  		vmg.next = vms.next;
>  		vmg.prev = vms.prev;
> -- 
> 2.44.0
> 
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re:Re: [PATCH] mm/vma: Return the exact errno for vms_gather_munmap_vmas()
  2024-09-03 15:58 ` Liam R. Howlett
@ 2024-09-04  4:37   ` 杨晓
  0 siblings, 0 replies; 3+ messages in thread
From: 杨晓 @ 2024-09-04  4:37 UTC (permalink / raw)
  To: Liam R. Howlett
  Cc: linux-mm, linux-kernel, ltp, andrea.cervesato, oliver.sang

[-- Attachment #1: Type: text/plain, Size: 1474 bytes --]

Hi Liam R


Thanks for your reply.

Could you share the URL of your v8 patches.



Best Regards,
Xiao Yang

At 2024-09-03 23:58:26, "Liam R. Howlett" <Liam.Howlett@oracle.com> wrote:
>
>Thanks, but this is already fixed in v8 of my patches.
>
>* Xiao Yang <ice_yangxiao@163.com> [240901 10:51]:
>> can_modify_vma() in vms_gather_munmap_vmas() returns -EPERM if vma is
>> sealed so don't always return the fixed -ENOMEM on failure.
>> 
>> Fixes: c2eb22189bbc ("mm/vma: inline munmap operation in mmap_region()")
>> Fixes: 5887a7ac2383 ("mm/vma: expand mmap_region() munmap call")
>> Signed-off-by: Xiao Yang <ice_yangxiao@163.com>
>> Reported-by: kernel test robot <oliver.sang@intel.com>
>> Closes: https://lore.kernel.org/oe-lkp/202408312155.fd26a58c-oliver.sang@intel.com
>> ---
>>  mm/mmap.c | 5 +++--
>>  1 file changed, 3 insertions(+), 2 deletions(-)
>> 
>> diff --git a/mm/mmap.c b/mm/mmap.c
>> index c1781f643046..c9a0dc035819 100644
>> --- a/mm/mmap.c
>> +++ b/mm/mmap.c
>> @@ -1386,8 +1386,9 @@ unsigned long mmap_region(struct file *file, unsigned long addr,
>>  		mt_on_stack(mt_detach);
>>  		mas_init(&mas_detach, &mt_detach, /* addr = */ 0);
>>  		/* Prepare to unmap any existing mapping in the area */
>> -		if (vms_gather_munmap_vmas(&vms, &mas_detach))
>> -			return -ENOMEM;
>> +		error = vms_gather_munmap_vmas(&vms, &mas_detach);
>> +		if (error)
>> +			return error;
>>  
>>  		vmg.next = vms.next;
>>  		vmg.prev = vms.prev;
>> -- 
>> 2.44.0
>> 
>> 

[-- Attachment #2: Type: text/html, Size: 2047 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-09-04  4:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-09-01 14:50 [PATCH] mm/vma: Return the exact errno for vms_gather_munmap_vmas() Xiao Yang
2024-09-03 15:58 ` Liam R. Howlett
2024-09-04  4:37   ` 杨晓

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox