[RFC 2/2] drm/i915: Handle validation of relocation object with length >=2GB

Chris Wilson chris at chris-wilson.co.uk
Tue Feb 7 09:00:15 UTC 2017


On Tue, Feb 07, 2017 at 02:15:48PM +0530, Sagar Arun Kamble wrote:
> With prefaulting extended to support >=2GB, i915 can handle
> relocation objects >=2GB. type conversion of length from int to
> unsigned long in access_ok was making the validation bail out with
> -EFAULT.
> 
> Testcase: igt/gem_exec_reloc/wc-31
> Cc: Daniel Vetter <daniel.vetter at ffwll.ch>
> Cc: Chris Wilson <chris at chris-wilson.co.uk>
> Signed-off-by: Sagar Arun Kamble <sagar.a.kamble at intel.com>
> ---
>  drivers/gpu/drm/i915/i915_gem_execbuffer.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
> index 91c2393..db2c40e 100644
> --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
> +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
> @@ -1159,8 +1159,8 @@ static bool only_mappable_for_reloc(unsigned int flags)
>  		   struct drm_i915_gem_exec_object2 *exec,
>  		   int count)
>  {
> -	unsigned relocs_total = 0;
> -	unsigned relocs_max = UINT_MAX / sizeof(struct drm_i915_gem_relocation_entry);
> +	unsigned long relocs_total = 0;
> +	unsigned long relocs_max = ULONG_MAX / sizeof(struct drm_i915_gem_relocation_entry);

The abi is limited to 32b max relocs.

Please see
https://cgit.freedesktop.org/~ickle/linux-2.6/commit/?h=prescheduler&id=bcf3bca07f21a4c0c754ccecca81228c28437906
(a patch that is years overdue) in which this just evaporates.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx-trybot mailing list