lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20210509220834.d8b46dabea050d162df8cdf7@linux-foundation.org>
Date:   Sun, 9 May 2021 22:08:34 -0700
From:   Andrew Morton <akpm@...ux-foundation.org>
To:     Gonzalo Matias Juarez Tello <gmjuareztello@...il.com>
Cc:     linux-mm@...ck.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mm/mmap.c: logic of find_vma_intersection repeated in
 __do_munmap

On Fri,  9 Apr 2021 13:21:26 -0300 Gonzalo Matias Juarez Tello <gmjuareztello@...il.com> wrote:

> Logic of find_vma_intersection() (which is an inline fc) is
> repeated in __do_munmap().
> Besides, prev is assigned a value before checking vma->vm_start >= end
> which might end up on a return statement making that assignment useless.
> 
> Calling find_vma_intersection() checks that condition and returns NULL if
> no vma is found, hence only the !vma check is needed in __do_munmap().
> 
> ...
>
> --- a/mm/mmap.c
> +++ b/mm/mmap.c
> @@ -2822,16 +2822,11 @@ int __do_munmap(struct mm_struct *mm, unsigned long start, size_t len,
>  	 */
>  	arch_unmap(mm, start, end);
>  
> -	/* Find the first overlapping VMA */
> -	vma = find_vma(mm, start);
> +	/* Find the first overlapping VMA where start < vma->vm_end */
> +	vma = find_vma_intersection(mm, start, end);
>  	if (!vma)
>  		return 0;
>  	prev = vma->vm_prev;
> -	/* we have  start < vma->vm_end  */
> -
> -	/* if it doesn't overlap, we have nothing.. */
> -	if (vma->vm_start >= end)
> -		return 0;
>  
>  	/*
>  	 * If we need to split any vma, do it now to save pain later.

Looks good to me, thanks.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ