Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [High] drm/tyr: unaligned BO size in new_dummy_object() and
  KernelBo::new() [1]
--

commit c6eb3c50c479a4d12cbfccb1e7746b3f539a34fd
Author: Danilo Krummrich <[email protected]>

drm/tyr: use pin-init self-referential support

This commit replaces Arc-based sharing of the MMIO mapping, MMU, and
firmware VM in the Tyr driver with borrows using pin-init's
self-referential struct support.

> diff --git a/drivers/gpu/drm/tyr/gem.rs b/drivers/gpu/drm/tyr/gem.rs
> index 0439bf96467f3..05965a9135b77 100644
> --- a/drivers/gpu/drm/tyr/gem.rs
> +++ b/drivers/gpu/drm/tyr/gem.rs
[ ... ]
> @@ -99,7 +96,7 @@ impl<'bo> KernelBo<'bo> {
>      /// cleaned up when the [`KernelBo`] is dropped.
>      pub(crate) fn new(
>          ddev: &TyrDrmDevice,
> -        vm: Arc<Vm<'bo>>,
> +        vm: &'bo Vm<'bo, 'res>,
>          size: u64,
>          va_alloc: KernelBoVaAlloc,
>          flags: VmMapFlags,

[Severity: High]
This problem wasn't introduced by this patch, but can KernelBo::new() and
new_dummy_object() panic in drm_gem_private_object_init() on 16 KiB or
64 KiB page kernels [1]?

new_dummy_object() passes a hardcoded size of 4096 bytes to Bo::new(), and
KernelBo::new() passes firmware section sizes that are only aligned to
4 KiB:

drivers/gpu/drm/tyr/gem.rs:new_dummy_object() {
    let bo = Bo::new(
        ddev,
        4096,
    ...
}

drivers/gpu/drm/tyr/gem.rs:KernelBo::new() {
    ...
        let bo_size = usize::try_from(size).map_err(|_| EOVERFLOW)?;
        let va_end = va.checked_add(size).ok_or(EINVAL)?;

        let bo = Bo::new(
            ddev,
            bo_size,
    ...
}

Bo::new() forwards the size to drm_gem_private_object_init(), which
triggers BUG_ON((size & (PAGE_SIZE - 1)) != 0) during probe when
PAGE_SIZE exceeds 4 KiB.

[1] https://sashiko.dev/#/bug/linux-c7c6866e-fcae-455a-98bc-11dd06209188

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

Reply via email to