[Intel-gfx] [PATCH v6] drm/i915: Avoid writing relocs with addresses in non-canonical form

Chris Wilson chris at chris-wilson.co.uk
Tue Dec 22 07:00:20 PST 2015


On Tue, Dec 22, 2015 at 01:37:10PM +0100, MichaƂ Winiarski wrote:
> +		/* Offset can be used as input (EXEC_OBJECT_PINNED), since
> +		 * userspace has to use canonical format, we need to reject all
> +		 * non-canonical addresses.
> +		 */
> +		if (exec[i].offset != gen8_canonical_addr(exec[i].offset))
> +			return -EINVAL;
> +
> +		/* On the other hand, from drm_mm perspective address space is
> +		 * continuous, so we're converting to non-canonical form
> +		 */
> +		exec[i].offset &= (1ULL << 48) - 1;

I'm still dubious about making this ABI change backwards. Only
EXEC_OBJECT_PINNED uses this as an input and in the past we have stuffed
bad values in here to force relocations etc.

Also note that EXEC_OBJECT_PINNED doesn't do if (exec[i].offset & 4095)
return -EINVAL;

I would address both at once.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list