From: sashiko-bot@kernel.org
To: "David Francis" <David.Francis@amd.com>, amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/amdkfd: Correctly handle multi-xcc mqd size in CRIU restore
Date: Mon, 23 Nov 2026 19:34:04 +0000 [thread overview]
Message-ID: <sashiko-outbox-229943@kernel.org> (raw)
In-Reply-To: <20261123192532.2062064-1-David.Francis@amd.com>
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:
- [Critical] drm/amdkfd: missing bounds check in
kfd_criu_restore_queue() [1]
--
commit b6c60f35cb12af1932936a6a6d849d52fd98120b
Author: David Francis <David.Francis@amd.com>
drm/amdkfd: Correctly handle multi-xcc mqd size in CRIU restore
This commit scales the expected mqd_size check in kfd_criu_restore_queue()
by the number of XCCs on the device.
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c
> index b68e884b1c37a..2b86d359c4065 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c
> @@ -1041,7 +1041,8 @@ int kfd_criu_restore_queue(struct kfd_process *p,
> goto exit;
> }
>
> - if (q_data->mqd_size != mqd_size_from_queue_type(pdd->dev->dqm, q_data->type)) {
> + if (q_data->mqd_size != mqd_size_from_queue_type(pdd->dev->dqm, q_data->type) *
> + NUM_XCC(pdd->dev->xcc_mask)) {
> ret = -EINVAL;
> goto exit;
> }
[Severity: Critical]
This problem wasn't introduced by this patch, but can an unvalidated
q_data->priority cause an out-of-bounds read of pipe_priority_map[]
[1]?
kfd_criu_restore_queue() checks q_data->type and q_data->mqd_size after
copy_from_user(), then set_queue_properties_from_criu() copies
q_data->priority into qp.priority without checking it against
KFD_MAX_QUEUE_PRIORITY (15):
drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c:set_queue_properties_from_criu() {
qp->is_interop = false;
qp->queue_percent = q_data->q_percent;
qp->priority = q_data->priority;
...
}
When pqm_create_queue() invokes the hardware-specific update_mqd() ->
set_priority() path, qp.priority indexes directly into the 16-element
pipe_priority_map[] array and writes the result into the MQD, which can
crash the kernel or leak out-of-bounds kernel memory through a
userspace-mapped MQD.
[1] https://sashiko.dev/#/bug/linux-ce93c1d0-79a1-4b46-89c1-185592185549
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261123192532.2062064-1-David.Francis@amd.com?part=1
next prev parent reply other threads:[~2026-11-23 19:34 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-23 19:25 [PATCH] drm/amdkfd: Correctly handle multi-xcc mqd size in CRIU restore David Francis
2026-11-23 19:34 ` sashiko-bot [this message]
2026-11-23 20:14 ` Yat Sin, David
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=sashiko-outbox-229943@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=David.Francis@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=sashiko-reviews@lists.linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.