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: <bccdb508-0ced-24ff-3c27-a95d4b1a662e@amd.com>
Date:   Thu, 20 Oct 2022 12:50:29 -0400
From:   Felix Kuehling <felix.kuehling@....com>
To:     Deming Wang <wangdeming@...pur.com>, alexander.deucher@....com,
        christian.koenig@....com, Xinhui.Pan@....com, airlied@...il.com,
        daniel@...ll.ch
Cc:     amd-gfx@...ts.freedesktop.org, dri-devel@...ts.freedesktop.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] drm/amdkfd: use vma_lookup() instead of find_vma()

Am 2022-10-20 um 04:20 schrieb Deming Wang:
> Using vma_lookup() verifies the start address is contained in the found
> vma.  This results in easier to read the code.
>
> Signed-off-by: Deming Wang <wangdeming@...pur.com>

Thank you. This patch is

Reviewed-by: Felix Kuehling <Felix.Kuehling@....com>

I squashed it with your earlier patch in kfd_migrate.c and submitted it 
to our amd-staging-drm-next branch.

Regards,
   Felix


> ---
>   drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 17 ++++++++---------
>   1 file changed, 8 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
> index 64fdf63093a0..0100812478b2 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
> @@ -1586,8 +1586,8 @@ static int svm_range_validate_and_map(struct mm_struct *mm,
>   		unsigned long npages;
>   		bool readonly;
>   
> -		vma = find_vma(mm, addr);
> -		if (!vma || addr < vma->vm_start) {
> +		vma = vma_lookup(mm, addr);
> +		if (!vma) {
>   			r = -EFAULT;
>   			goto unreserve_out;
>   		}
> @@ -2542,8 +2542,8 @@ svm_range_get_range_boundaries(struct kfd_process *p, int64_t addr,
>   	struct interval_tree_node *node;
>   	unsigned long start_limit, end_limit;
>   
> -	vma = find_vma(p->mm, addr << PAGE_SHIFT);
> -	if (!vma || (addr << PAGE_SHIFT) < vma->vm_start) {
> +	vma = vma_lookup(p->mm, addr << PAGE_SHIFT);
> +	if (!vma) {
>   		pr_debug("VMA does not exist in address [0x%llx]\n", addr);
>   		return -EFAULT;
>   	}
> @@ -2871,8 +2871,8 @@ svm_range_restore_pages(struct amdgpu_device *adev, unsigned int pasid,
>   	/* __do_munmap removed VMA, return success as we are handling stale
>   	 * retry fault.
>   	 */
> -	vma = find_vma(mm, addr << PAGE_SHIFT);
> -	if (!vma || (addr << PAGE_SHIFT) < vma->vm_start) {
> +	vma = vma_lookup(mm, addr << PAGE_SHIFT);
> +	if (!vma) {
>   		pr_debug("address 0x%llx VMA is removed\n", addr);
>   		r = 0;
>   		goto out_unlock_range;
> @@ -3152,9 +3152,8 @@ svm_range_is_valid(struct kfd_process *p, uint64_t start, uint64_t size)
>   	start <<= PAGE_SHIFT;
>   	end = start + (size << PAGE_SHIFT);
>   	do {
> -		vma = find_vma(p->mm, start);
> -		if (!vma || start < vma->vm_start ||
> -		    (vma->vm_flags & device_vma))
> +		vma = vma_lookup(p->mm, start);
> +		if (!vma || (vma->vm_flags & device_vma))
>   			return -EFAULT;
>   		start = min(end, vma->vm_end);
>   	} while (start < end);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ