* FAILED: patch "[PATCH] accel/amdxdna: reject user command submission without a" failed to apply to 6.18-stable tree
@ 2026-07-20 15:30 gregkh
2026-07-25 19:04 ` Doruk (0sec)
0 siblings, 1 reply; 2+ messages in thread
From: gregkh @ 2026-07-20 15:30 UTC (permalink / raw)
To: doruk, lizhi.hou; +Cc: stable
The patch below does not apply to the 6.18-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable@vger.kernel.org>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.18.y
git checkout FETCH_HEAD
git cherry-pick -x 261c1fe3327ad24508f54552c6366e3e4db82c15
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<stable@vger.kernel.org>' --in-reply-to '2026072039-spouse-automatic-c20e@gregkh' --subject-prefix 'PATCH 6.18.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 261c1fe3327ad24508f54552c6366e3e4db82c15 Mon Sep 17 00:00:00 2001
From: Doruk Tan Ozturk <doruk@0sec.ai>
Date: Mon, 13 Jul 2026 19:30:28 +0200
Subject: [PATCH] accel/amdxdna: reject user command submission without a
command BO
amdxdna_drm_submit_execbuf() passes the user-supplied command BO handle
straight into amdxdna_cmd_submit() with drv_cmd == NULL. When the handle
is AMDXDNA_INVALID_BO_HANDLE (0), the block that fetches job->cmd_bo is
skipped, leaving it NULL, and no check rejects it on the user path (the
!job->cmd_bo guard lives inside the != INVALID branch).
The job is then armed and pushed to the DRM scheduler.
aie2_sched_job_run() takes the drv_cmd == NULL path and calls
amdxdna_cmd_set_state(job->cmd_bo) -> amdxdna_gem_vmap(NULL) ->
to_gobj(NULL)->dev, a NULL pointer dereference in the drm_sched worker.
A process with access to the accel node on a system with a probed AMD NPU
can trigger a kernel oops with a single AMDXDNA_EXEC_CMD ioctl
(cmd_handles = 0).
Only internal driver commands (SYNC_DEBUG_BO / ATTACH_DEBUG_BO)
legitimately pass AMDXDNA_INVALID_BO_HANDLE, and they always set drv_cmd.
Reject the invalid handle for user submissions (drv_cmd == NULL) at the
submit choke point so every user path is covered.
Fixes: aac243092b70 ("accel/amdxdna: Add command execution")
Cc: stable@vger.kernel.org
Found by 0sec automated security-research tooling (https://0sec.ai).
Assisted-by: 0sec:claude-opus-4-8
Signed-off-by: Doruk Tan Ozturk <doruk@0sec.ai>
Reviewed-by: Lizhi Hou <lizhi.hou@amd.com>
Signed-off-by: Lizhi Hou <lizhi.hou@amd.com>
Link: https://patch.msgid.link/20260713173030.87541-2-doruk@0sec.ai
diff --git a/drivers/accel/amdxdna/amdxdna_ctx.c b/drivers/accel/amdxdna/amdxdna_ctx.c
index 8f8df9d04ec5..a5c8c2c4de6d 100644
--- a/drivers/accel/amdxdna/amdxdna_ctx.c
+++ b/drivers/accel/amdxdna/amdxdna_ctx.c
@@ -603,6 +603,16 @@ int amdxdna_cmd_submit(struct amdxdna_client *client,
ret = -EINVAL;
goto free_job;
}
+ } else if (!drv_cmd) {
+ /*
+ * Only internal driver commands (drv_cmd != NULL) may omit a
+ * command BO. A user command submission with the invalid handle
+ * would leave job->cmd_bo NULL and later fault when the scheduler
+ * dereferences it in amdxdna_cmd_set_state().
+ */
+ XDNA_DBG(xdna, "Command BO handle required for user submission");
+ ret = -EINVAL;
+ goto free_job;
}
ret = amdxdna_arg_bos_lookup(client, job, arg_bo_hdls, arg_bo_cnt);
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: FAILED: patch "[PATCH] accel/amdxdna: reject user command submission without a" failed to apply to 6.18-stable tree
2026-07-20 15:30 FAILED: patch "[PATCH] accel/amdxdna: reject user command submission without a" failed to apply to 6.18-stable tree gregkh
@ 2026-07-25 19:04 ` Doruk (0sec)
0 siblings, 0 replies; 2+ messages in thread
From: Doruk (0sec) @ 2026-07-25 19:04 UTC (permalink / raw)
To: stable, gregkh, lizhi.hou
Hi Greg,
I checked both AMD XDNA failures on linux-6.18.y; neither needs a
replacement backport:
- 261c1fe3327ad24508f54552c6366e3e4db82c15 depends on the later
debug-buffer/drv_cmd refactor. Resolving its conflict would change
6.18’s existing command-less aie2_sync_bo path.
- 38953513d7313992676d4136cd425cdb70c6278e fixes AIE4 VF support,
which is absent from 6.18; the supported devices there all have a
cmd_submit op.
Please drop both from the 6.18 queue; no replacement backports are needed.
Thanks,
Doruk
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-07-25 19:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-20 15:30 FAILED: patch "[PATCH] accel/amdxdna: reject user command submission without a" failed to apply to 6.18-stable tree gregkh
2026-07-25 19:04 ` Doruk (0sec)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox