From: "Christian König" <christian.koenig@amd.com>
To: jbmoore <jbmoore61@gmail.com>, alexander.deucher@amd.com
Cc: stable@vger.kernel.org
Subject: Re: [PATCH 3/4] drm/amdgpu/gfx9: replace BUG_ON with WARN_ON_ONCE for KIQ 64-bit fence flag
Date: Mon, 27 Apr 2026 09:28:18 +0200 [thread overview]
Message-ID: <cb27e9ce-b181-480a-bb45-a4aa460bab14@amd.com> (raw)
In-Reply-To: <20260426215256.50722-4-jbmoore@nooks.dev>
On 4/26/26 23:52, jbmoore wrote:
> From: "John B. Moore" <jbmoore61@gmail.com>
>
> gfx_v9_0_ring_emit_fence_kiq() contains a BUG_ON() that fires when
> the AMDGPU_FENCE_FLAG_64BIT flag is passed. The KIQ (Kernel
> Interface Queue) ring only allocates 32-bit writeback buffer
> addresses for fence sequence numbers. A 64-bit fence write would
> overflow the allocated writeback slot, potentially corrupting
> adjacent kernel memory.
>
> Replace BUG_ON() with WARN_ON_ONCE() and mask off the unsupported
> flag. This prevents the kernel panic while still logging the
> unexpected condition and falling back to a safe 32-bit fence write.
>
> This is separated from the main gfx9 BUG_ON conversion patch
> because it addresses a different security concern (potential buffer
> overflow in kernel-managed writeback memory) rather than the address
> alignment assertions in the ring emission paths.
>
> Found by a custom amdgpu DRM ioctl fuzzer.
>
> Fixes: b1023571479020e9 ("drm/amdgpu: implement GFX 9.0 support (v2)")
> Signed-off-by: John B. Moore <jbmoore61@gmail.com>
> Cc: stable@vger.kernel.org
And completely forgotten: Please drop the CC stable here. That is unjustified for this patch.
Regards,
Christian.
> ---
> drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
> index 47e81c33d..fb2a0f1af 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
> @@ -5679,7 +5679,8 @@ static void gfx_v9_0_ring_emit_fence_kiq(struct amdgpu_ring *ring, u64 addr,
> struct amdgpu_device *adev = ring->adev;
>
> /* we only allocate 32bit for each seq wb address */
> - BUG_ON(flags & AMDGPU_FENCE_FLAG_64BIT);
> + if (WARN_ON_ONCE(flags & AMDGPU_FENCE_FLAG_64BIT))
> + flags &= ~AMDGPU_FENCE_FLAG_64BIT;
>
> /* write fence seq to the "addr" */
> amdgpu_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3));
next prev parent reply other threads:[~2026-04-27 7:28 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20260426215256.50722-1-jbmoore@nooks.dev>
2026-04-26 21:52 ` [PATCH 1/4] drm/amdgpu/sdma4: replace BUG_ON with WARN_ON_ONCE in fence emission jbmoore
2026-04-27 7:21 ` Christian König
2026-04-26 21:52 ` [PATCH 2/4] drm/amdgpu/gfx9: replace BUG_ON/BUG with WARN_ON_ONCE in ring emission jbmoore
2026-04-27 7:24 ` Christian König
2026-04-26 21:52 ` [PATCH 3/4] drm/amdgpu/gfx9: replace BUG_ON with WARN_ON_ONCE for KIQ 64-bit fence flag jbmoore
2026-04-27 7:26 ` Christian König
2026-04-27 7:28 ` Christian König [this message]
2026-04-26 21:52 ` [PATCH 4/4] drm/amdgpu/vcn: prevent silent fence drop on 64-bit flag mismatch jbmoore
2026-04-27 7:11 ` Christian König
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=cb27e9ce-b181-480a-bb45-a4aa460bab14@amd.com \
--to=christian.koenig@amd.com \
--cc=alexander.deucher@amd.com \
--cc=jbmoore61@gmail.com \
--cc=stable@vger.kernel.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