From: Liviu Dudau <liviu.dudau@arm.com>
To: Boris Brezillon <boris.brezillon@collabora.com>
Cc: "Steven Price" <steven.price@arm.com>,
"Adrián Larumbe" <adrian.larumbe@collabora.com>,
dri-devel@lists.freedesktop.org,
"Lars-Ivar Hesselberg Simonsen" <lars-ivar.simonsen@arm.com>,
kernel@collabora.com
Subject: Re: [PATCH v1 1/4] drm/panthor: Fix UAF on kernel BO VA nodes
Date: Mon, 3 Nov 2025 11:10:43 +0000 [thread overview]
Message-ID: <aQiNsxAlPVPwT415@e110455-lin.cambridge.arm.com> (raw)
In-Reply-To: <20251031154818.821054-2-boris.brezillon@collabora.com>
On Fri, Oct 31, 2025 at 04:48:15PM +0100, Boris Brezillon wrote:
> If the MMU is down, panthor_vm_unmap_range() might return an error.
> We expect the page table to be updated still, and if the MMU is blocked,
> the rest of the GPU should be blocked too, so no risk of accessing
> physical memory returned to the system (which the current code doesn't
> cover for anyway).
>
> Proceed with the rest of the cleanup instead of bailing out and leaving
> the va_node inserted in the drm_mm, which leads to UAF when other
> adjacent nodes are removed from the drm_mm tree.
>
> Reported-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
> Closes: https://gitlab.freedesktop.org/panfrost/linux/-/issues/57
> Fixes: 8a1cc07578bf ("drm/panthor: Add GEM logical block")
> Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Liviu Dudau <liviu.dudau@arm.com>
Best regards,
Liviu
> ---
> drivers/gpu/drm/panthor/panthor_gem.c | 14 +++-----------
> 1 file changed, 3 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/gpu/drm/panthor/panthor_gem.c b/drivers/gpu/drm/panthor/panthor_gem.c
> index 7e7d2f223cfa..f369cc3e2a5f 100644
> --- a/drivers/gpu/drm/panthor/panthor_gem.c
> +++ b/drivers/gpu/drm/panthor/panthor_gem.c
> @@ -87,7 +87,6 @@ static void panthor_gem_free_object(struct drm_gem_object *obj)
> void panthor_kernel_bo_destroy(struct panthor_kernel_bo *bo)
> {
> struct panthor_vm *vm;
> - int ret;
>
> if (IS_ERR_OR_NULL(bo))
> return;
> @@ -95,18 +94,11 @@ void panthor_kernel_bo_destroy(struct panthor_kernel_bo *bo)
> vm = bo->vm;
> panthor_kernel_bo_vunmap(bo);
>
> - if (drm_WARN_ON(bo->obj->dev,
> - to_panthor_bo(bo->obj)->exclusive_vm_root_gem != panthor_vm_root_gem(vm)))
> - goto out_free_bo;
> -
> - ret = panthor_vm_unmap_range(vm, bo->va_node.start, bo->va_node.size);
> - if (ret)
> - goto out_free_bo;
> -
> + drm_WARN_ON(bo->obj->dev,
> + to_panthor_bo(bo->obj)->exclusive_vm_root_gem != panthor_vm_root_gem(vm));
> + panthor_vm_unmap_range(vm, bo->va_node.start, bo->va_node.size);
> panthor_vm_free_va(vm, &bo->va_node);
> drm_gem_object_put(bo->obj);
> -
> -out_free_bo:
> panthor_vm_put(vm);
> kfree(bo);
> }
> --
> 2.51.0
>
--
====================
| I would like to |
| fix the world, |
| but they're not |
| giving me the |
\ source code! /
---------------
¯\_(ツ)_/¯
next prev parent reply other threads:[~2025-11-03 11:10 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-31 15:48 [PATCH v1 0/4] drm/panthor: Misc fixes Boris Brezillon
2025-10-31 15:48 ` [PATCH v1 1/4] drm/panthor: Fix UAF on kernel BO VA nodes Boris Brezillon
2025-11-03 11:10 ` Liviu Dudau [this message]
2025-11-03 14:34 ` Liviu Dudau
2025-10-31 15:48 ` [PATCH v1 2/4] drm/panthor: Add support for atomic page table updates Boris Brezillon
2025-11-07 16:26 ` Steven Price
2025-11-07 17:14 ` Boris Brezillon
2025-10-31 15:48 ` [PATCH v1 3/4] drm/panthor: Make panthor_vm_[un]map_pages() more robust Boris Brezillon
2025-11-03 21:00 ` Akash Goel
2025-11-04 7:43 ` Boris Brezillon
2025-10-31 15:48 ` [PATCH v1 4/4] drm/panthor: Relax check in panthor_sched_pre_reset() Boris Brezillon
2025-11-07 16:40 ` Steven Price
2025-11-12 12:47 ` Boris Brezillon
2025-11-17 9:49 ` Steven Price
2025-11-17 10:26 ` Boris Brezillon
2025-11-17 11:07 ` Steven Price
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aQiNsxAlPVPwT415@e110455-lin.cambridge.arm.com \
--to=liviu.dudau@arm.com \
--cc=adrian.larumbe@collabora.com \
--cc=boris.brezillon@collabora.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=kernel@collabora.com \
--cc=lars-ivar.simonsen@arm.com \
--cc=steven.price@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox