From: Matthew Brost <matthew.brost@intel.com>
To: Simon Richter <Simon.Richter@hogyros.de>
Cc: <intel-xe@lists.freedesktop.org>, <dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH 1/1] drm/ttm: Avoid NULL pointer deref for evicted BOs
Date: Sun, 12 Oct 2025 16:09:08 -0700 [thread overview]
Message-ID: <aOw1FA4j522F3yTr@lstrano-desk.jf.intel.com> (raw)
In-Reply-To: <20251012124544.1325125-2-Simon.Richter@hogyros.de>
On Sun, Oct 12, 2025 at 09:45:32PM +0900, Simon Richter wrote:
> It is possible for a BO to exist that is not currently associated with a
> resource, e.g. because it has been evicted.
>
> When devcoredump tries to read the contents of all BOs for dumping, we need
> to expect this as well -- in this case, ENODATA is recorded instead of the
> buffer contents.
>
Please include dri-devel on TTM patches.
> Fixes: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/6271
s/Fixes/Closes
"Closes" is used for linking to issues, while "Fixes" refers to the
original offending patch that we need to backport to stable. So, you'll
need to include a "Fixes" tag here, along with CC stable.
Let me review this GitLab entry, but it does seem odd that bo->resource
is NULL. What kind of WL is this? I think this might be possible for
a faulting VM that defers validating the BO and performs the bind in the
page fault handler. But for all other WL, I really don’t think this
should be possible—unless I’m missing something.
> ---
> drivers/gpu/drm/ttm/ttm_bo_vm.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/ttm/ttm_bo_vm.c b/drivers/gpu/drm/ttm/ttm_bo_vm.c
> index b47020fca199..99bd75be8b1a 100644
> --- a/drivers/gpu/drm/ttm/ttm_bo_vm.c
> +++ b/drivers/gpu/drm/ttm/ttm_bo_vm.c
> @@ -434,7 +434,9 @@ int ttm_bo_access(struct ttm_buffer_object *bo, unsigned long offset,
> if (ret)
> return ret;
>
> - switch (bo->resource->mem_type) {
> + if (!bo->resource)
> + ret = -ENODATA;
> + else switch (bo->resource->mem_type) {
This is really odd style. I'd prefer:
if (!bo->resource) {
ret = -ENODATA;
goto unlock;
}
Matt
> case TTM_PL_SYSTEM:
> fallthrough;
> case TTM_PL_TT:
> --
> 2.47.3
>
next prev parent reply other threads:[~2025-10-12 23:09 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-12 12:45 [PATCH 0/1] Avoid crash during dump when finding an evicted BO Simon Richter
2025-10-12 12:45 ` [PATCH 1/1] drm/ttm: Avoid NULL pointer deref for evicted BOs Simon Richter
2025-10-12 23:09 ` Matthew Brost [this message]
2025-10-13 16:02 ` [PATCH v2] " Simon Richter
2025-10-13 16:11 ` [PATCH v3] " Simon Richter
2025-10-13 16:27 ` Matthew Brost
2025-12-05 17:46 ` Lin, Shuicheng
2025-12-05 18:25 ` Matthew Brost
2025-12-08 7:54 ` Christian König
2025-10-12 12:52 ` ✗ CI.checkpatch: warning for Avoid crash during dump when finding an evicted BO Patchwork
2025-10-12 12:53 ` ✓ CI.KUnit: success " Patchwork
2025-10-12 13:35 ` ✓ Xe.CI.BAT: " Patchwork
2025-10-12 14:47 ` ✗ Xe.CI.Full: failure " Patchwork
2025-10-13 18:03 ` ✓ CI.KUnit: success for Avoid crash during dump when finding an evicted BO (rev3) Patchwork
2025-10-13 18:39 ` ✓ Xe.CI.BAT: " Patchwork
2025-10-13 22:03 ` ✗ Xe.CI.Full: failure " Patchwork
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=aOw1FA4j522F3yTr@lstrano-desk.jf.intel.com \
--to=matthew.brost@intel.com \
--cc=Simon.Richter@hogyros.de \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
/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