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: <c82fbab0-1ba1-43cf-9f31-57d365b2baa2@amd.com>
Date: Mon, 8 Jan 2024 07:45:09 +0100
From: Christian König <christian.koenig@....com>
To: Dipam Turkar <dipamt1729@...il.com>, alexander.deucher@....com
Cc: Xinhui.Pan@....com, airlied@...il.com, daniel@...ll.ch,
 amd-gfx@...ts.freedesktop.org, dri-devel@...ts.freedesktop.org,
 linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/1] Refactor radeon driver to use
 drm_gem_create_map_offset() instead of its custom implementation for
 associating GEM object with a fake offset. Since, we already have a generic
 implementation, we don't need the custom function and it is better to
 standardize the code.

Am 06.01.24 um 15:14 schrieb Dipam Turkar:
> Signed-off-by: Dipam Turkar <dipamt1729@...il.com>
> ---
>   drivers/gpu/drm/radeon/radeon_drv.c |  2 +-
>   drivers/gpu/drm/radeon/radeon_gem.c | 24 ++----------------------
>   2 files changed, 3 insertions(+), 23 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
> index fa531493b111..f590ed65ffba 100644
> --- a/drivers/gpu/drm/radeon/radeon_drv.c
> +++ b/drivers/gpu/drm/radeon/radeon_drv.c
> @@ -578,7 +578,7 @@ static const struct drm_driver kms_driver = {
>   	.ioctls = radeon_ioctls_kms,
>   	.num_ioctls = ARRAY_SIZE(radeon_ioctls_kms),
>   	.dumb_create = radeon_mode_dumb_create,
> -	.dumb_map_offset = radeon_mode_dumb_mmap,
> +	.dumb_map_offset = drm_gem_dumb_map_offset,
>   	.fops = &radeon_driver_kms_fops,
>   
>   	.gem_prime_import_sg_table = radeon_gem_prime_import_sg_table,
> diff --git a/drivers/gpu/drm/radeon/radeon_gem.c b/drivers/gpu/drm/radeon/radeon_gem.c
> index 358d19242f4b..99794c550d2c 100644
> --- a/drivers/gpu/drm/radeon/radeon_gem.c
> +++ b/drivers/gpu/drm/radeon/radeon_gem.c
> @@ -31,6 +31,7 @@
>   
>   #include <drm/drm_device.h>
>   #include <drm/drm_file.h>
> +#include <drm/dem_gem.h>
>   #include <drm/drm_gem_ttm_helper.h>
>   #include <drm/radeon_drm.h>
>   
> @@ -480,33 +481,12 @@ int radeon_gem_set_domain_ioctl(struct drm_device *dev, void *data,
>   	return r;
>   }
>   
> -int radeon_mode_dumb_mmap(struct drm_file *filp,
> -			  struct drm_device *dev,
> -			  uint32_t handle, uint64_t *offset_p)
> -{
> -	struct drm_gem_object *gobj;
> -	struct radeon_bo *robj;
> -
> -	gobj = drm_gem_object_lookup(filp, handle);
> -	if (gobj == NULL) {
> -		return -ENOENT;
> -	}
> -	robj = gem_to_radeon_bo(gobj);
> -	if (radeon_ttm_tt_has_userptr(robj->rdev, robj->tbo.ttm)) {

Well apart from the obvious typos, the missing commit message and the 
mangled subject line this also removes this important check for userptrs 
here.

This in turn is a complete no-go since it can lead to kernel crashes.

Regards,
Christian.

> -		drm_gem_object_put(gobj);
> -		return -EPERM;
> -	}
> -	*offset_p = radeon_bo_mmap_offset(robj);
> -	drm_gem_object_put(gobj);
> -	return 0;
> -}
> -
>   int radeon_gem_mmap_ioctl(struct drm_device *dev, void *data,
>   			  struct drm_file *filp)
>   {
>   	struct drm_radeon_gem_mmap *args = data;
>   
> -	return radeon_mode_dumb_mmap(filp, dev, args->handle, &args->addr_ptr);
> +	return drm_gem_dumb_map_offset(filp, dev, args->handle, &args->addr_ptr);
>   }
>   
>   int radeon_gem_busy_ioctl(struct drm_device *dev, void *data,


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ