Thank you for your contribution! Sashiko AI review found 1 potential issue(s) 
to consider:

Pre-existing issues:
- [Critical] The DEV_QUERY ioctl handler fails with -EFAULT when userspace 
provides a smaller buffer size than the kernel's structure size, violating the 
documented Panthor UAPI.
--

--- Patch [1]: [PATCH v10 1/7] drm/tyr: add resources to RegistrationData ---
commit 582ca5eb256eb752ad582c7535dd1fc5bf72cd26
Author: Deborah Brouwer <[email protected]>

drm/tyr: add resources to RegistrationData

Currently Tyr is not storing any resources in its drm::Driver
RegistrationData. Move Tyr's device-private resources and gpu information
from drm::Driver::Data to drm::Driver::RegistrationData so they can be
accessed safely while the device is registered with userspace.

> diff --git a/drivers/gpu/drm/tyr/file.rs b/drivers/gpu/drm/tyr/file.rs
> index b686041d5d6b4..9f60a90d49487 100644
> --- a/drivers/gpu/drm/tyr/file.rs
> +++ b/drivers/gpu/drm/tyr/file.rs

[ ... ]

> @@ -53,7 +54,7 @@ pub(crate) fn dev_query(
>                      )
>                      .writer();
>  
> -                    writer.write(&ddev.gpu_info)?;
> +                    writer.write(&reg_data.gpu_info)?;

[Severity: Critical]
This isn't a bug introduced by this patch, but does this strict size check
violate the documented Panthor UAPI?

When userspace invokes the DRM_IOCTL_PANTHOR_DEV_QUERY ioctl with a buffer
size smaller than the kernel's GpuInfo struct (for example, from older
userspace clients), the UserSliceWriter::write() method strictly enforces
that the length must be at least the size of the structure and returns
-EFAULT if it is not.

The C driver permits this as long as the size is at least the documented
min_size, copying only the truncated structure. Could this strict size
check in the Rust driver break backwards compatibility for older userspace?

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=1

Reply via email to