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] [thread-next>] [day] [month] [year] [list]
Message-ID: <412d2736-8a51-2360-431c-26978af1ecf7@suse.cz>
Date:   Tue, 18 Jan 2022 19:15:30 +0100
From:   Vlastimil Babka <vbabka@...e.cz>
To:     Liam Howlett <liam.howlett@...cle.com>,
        "maple-tree@...ts.infradead.org" <maple-tree@...ts.infradead.org>,
        "linux-mm@...ck.org" <linux-mm@...ck.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Andrew Morton <akpm@...ux-foundation.org>
Cc:     Song Liu <songliubraving@...com>,
        Davidlohr Bueso <dave@...olabs.net>,
        "Paul E . McKenney" <paulmck@...nel.org>,
        Matthew Wilcox <willy@...radead.org>,
        Laurent Dufour <ldufour@...ux.ibm.com>,
        David Rientjes <rientjes@...gle.com>,
        Axel Rasmussen <axelrasmussen@...gle.com>,
        Suren Baghdasaryan <surenb@...gle.com>,
        Rik van Riel <riel@...riel.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Michel Lespinasse <walken.cr@...il.com>,
        Jerome Glisse <jglisse@...hat.com>,
        Minchan Kim <minchan@...gle.com>,
        Joel Fernandes <joelaf@...gle.com>,
        Rom Lemarchand <romlem@...gle.com>
Subject: Re: [PATCH v4 35/66] optee: Remove vma linked list walk

On 12/1/21 15:30, Liam Howlett wrote:
> From: "Liam R. Howlett" <Liam.Howlett@...cle.com>
> 
> Use the VMA iterator instead.  Change the calling convention of
> __check_mem_type() to pass in the mm instead of the first vma in the
> range.
> 
> Signed-off-by: Matthew Wilcox (Oracle) <willy@...radead.org>
> Signed-off-by: Liam R. Howlett <Liam.Howlett@...cle.com>

Acked-by: Vlastimil Babka <vbabka@...e.cz>

> ---
>  drivers/tee/optee/call.c | 18 ++++++++++--------
>  1 file changed, 10 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/tee/optee/call.c b/drivers/tee/optee/call.c
> index b25cc1fac945..177575c445de 100644
> --- a/drivers/tee/optee/call.c
> +++ b/drivers/tee/optee/call.c
> @@ -342,15 +342,18 @@ static bool is_normal_memory(pgprot_t p)
>  #endif
>  }
>  
> -static int __check_mem_type(struct vm_area_struct *vma, unsigned long end)
> +static int __check_mem_type(struct mm_struct *mm, unsigned long start,
> +				unsigned long end)
>  {
> -	while (vma && is_normal_memory(vma->vm_page_prot)) {
> -		if (vma->vm_end >= end)
> -			return 0;
> -		vma = vma->vm_next;
> +	struct vm_area_struct *vma;
> +	VMA_ITERATOR(vmi, mm, start);
> +
> +	for_each_vma_range(vmi, vma, end) {
> +		if (!is_normal_memory(vma->vm_page_prot))
> +			return -EINVAL;
>  	}
>  
> -	return -EINVAL;
> +	return 0;
>  }
>  
>  int optee_check_mem_type(unsigned long start, size_t num_pages)
> @@ -366,8 +369,7 @@ int optee_check_mem_type(unsigned long start, size_t num_pages)
>  		return 0;
>  
>  	mmap_read_lock(mm);
> -	rc = __check_mem_type(find_vma(mm, start),
> -			      start + num_pages * PAGE_SIZE);
> +	rc = __check_mem_type(mm, start, start + num_pages * PAGE_SIZE);
>  	mmap_read_unlock(mm);
>  
>  	return rc;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ