Re: [PATCH v7 5/8] drm/panthor: Introduce sampling sessions to handle userspace clients

From: Lukas Zapolskas

Date: Thu Nov 26 2026 - 10:49:14 EST


Hello Ashley,

On Wed, Nov 04, 2026 at 05:39:01PM +0000, Ashley Smith wrote:
> On Sun, Oct 11, 2026 at 06:36:52PM +0100, Lukas Zapolskas wrote:
> > + ret = panthor_perf_bo_get(file, create_args->control_handle, 0, &control);
>
> Like the ringbuffer BO above, I think we need to include the size here since
> if the actual size is less than what the kernel expects it could lead to
> writing to out of bounds memory (imported BOs):
>
> ret = panthor_perf_bo_get(file, create_args->control_handle, sizeof(
> struct drm_panthor_perf_ringbuf_control), &control);

Will add this to the next series. I will drop the strict equality check
due to Steven's review comments on the uAPI patch and just check the
size versus the expected minimum size of the struct.

>
> Could also change panthor_perf_bo_get() to always test and instead
> of != use <=
>
> if (obj->size <= PFN_ALIGN(expected_size))
>
> so callers cant silently skip validation.
>
> FWIW, I have tested v7 of this patch series on a Rock5B and can see reliable
> counter values.
>
> Tested-by: Ashley Smith <ashley.smith@xxxxxxxxxxxxx>

Thanks for testing it out!

Kind regards,
Lukas