drm/i915: clarify reasoning for the access_ok call
Subsystems (2)
PATCH 1/1 drm/i915: clarify reasoning for the access_ok call
This clarifies the comment above the access_ok check so a missing VERIFY_READ doesn't alarm anyone.
--- drivers/gpu/drm/i915/i915_gem_execbuffer.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_gem_execbuffer.c +5 -1
@@ -747,7 +747,11 @@ validate_exec_list(struct drm_i915_gem_exec_object2 *exec, length = exec[i].relocation_count *sizeof (struct drm_i915_gem_relocation_entry ); -/* we may also need to update the presumed offsets */ +/* +* Validate memory range. Since we may need to update the +* presumed offsets, use VERIFY_WRITE. (Writable implies +* readable.) +*/ if (!access_ok (VERIFY_WRITE , ptr, length))return -EFAULT ;
Signature · 6 lines
1.7.9.5 -- Kees Cook Chrome OS Security
Quoted 2 lines · Kees Cook
This clarifies the comment above the
access_okcheck so a missingVERIFY_READdoesn't alarm anyone.
Do we really need to copy the interface documentation?
/**
* access_ok: - Checks if a user space pointer is valid
* @type: Type of access: %VERIFY_READ or %VERIFY_WRITE. Note that
* %VERIFY_WRITE is a superset of %VERIFY_READ - if it is safe
* to write to a block, it is always safe to read from it.
* @addr: User space pointer to start of block to check
* @size: Size of block to check
*/
-Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
Quoted 6 lines · Chris Wilson
Quoted 2 lines · Kees Cook
This clarifies the comment above the
access_okcheck so a missingVERIFY_READdoesn't alarm anyone.Do we really need to copy the interface documentation?
Quoted 9 lines
/**
*access_ok: - Checks if a user space pointer is valid
* @type: Type of access: %VERIFY_READ or %VERIFY_WRITE. Note that
* %VERIFY_WRITE is a superset of %VERIFY_READ - if it is safe
* to write to a block, it is always safe to read from it.
* @addr: User space pointer to start of block to check
* @size: Size of block to check
*/
-Chris
Probably not. It just seemed like the existing comment was insufficient after the removal of the redundant VERIFY_READ check that happened recently.
-Kees
Signature · 2 lines
Kees Cook Chrome OS Security
Quoted 3 lines · Kees Cook
Probably not. It just seemed like the existing comment was insufficient after the removal of the redundant
VERIFY_READcheck that happened recently.
That's certainly true, the remaining comment is a little cryptic. Something more like:
/* We need to check that we can read the entire relocation array, but
* as we may need to update the presumed_offsets upon execution, we
* need to check now for full write access.
*/
-Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre