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: <20230405171912.6o7tiy6qzg5wfyi7@revolver>
Date:   Wed, 5 Apr 2023 13:19:12 -0400
From:   "Liam R. Howlett" <Liam.Howlett@...cle.com>
To:     Peng Zhang <zhangpeng362@...wei.com>
Cc:     linux-mm@...ck.org, linux-kernel@...r.kernel.org,
        akpm@...ux-foundation.org, wangkefeng.wang@...wei.com,
        sunnanyong@...wei.com
Subject: Re: [PATCH] mm/madvise: Use vma_lookup() instead of find_vma()

* Peng Zhang <zhangpeng362@...wei.com> [230404 05:45]:
> From: ZhangPeng <zhangpeng362@...wei.com>
> 
> Using vma_lookup() verifies the address is contained in the found vma.
> This results in easier to read the code.
> 
> Signed-off-by: ZhangPeng <zhangpeng362@...wei.com>

Reviewed-by: Liam R. Howlett <Liam.Howlett@...cle.com>

> ---
>  mm/madvise.c | 14 +-------------
>  1 file changed, 1 insertion(+), 13 deletions(-)
> 
> diff --git a/mm/madvise.c b/mm/madvise.c
> index 340125d08c03..405a2c4a0a18 100644
> --- a/mm/madvise.c
> +++ b/mm/madvise.c
> @@ -852,21 +852,9 @@ static long madvise_dontneed_free(struct vm_area_struct *vma,
>  		*prev = NULL; /* mmap_lock has been dropped, prev is stale */
>  
>  		mmap_read_lock(mm);
> -		vma = find_vma(mm, start);
> +		vma = vma_lookup(mm, start);
>  		if (!vma)
>  			return -ENOMEM;
> -		if (start < vma->vm_start) {
> -			/*
> -			 * This "vma" under revalidation is the one
> -			 * with the lowest vma->vm_start where start
> -			 * is also < vma->vm_end. If start <
> -			 * vma->vm_start it means an hole materialized
> -			 * in the user address space within the
> -			 * virtual range passed to MADV_DONTNEED
> -			 * or MADV_FREE.
> -			 */
> -			return -ENOMEM;
> -		}
>  		/*
>  		 * Potential end adjustment for hugetlb vma is OK as
>  		 * the check below keeps end within vma.
> -- 
> 2.25.1
> 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ