From: "Christian König" <christian.koenig@amd.com>
To: "John B. Moore" <jbmoore61@gmail.com>, alexander.deucher@amd.com
Cc: stable@vger.kernel.org
Subject: Re: [PATCH v3] drm/amdgpu: reject IB addresses with reserved byte-swap bits
Date: Tue, 28 Apr 2026 08:46:18 +0200 [thread overview]
Message-ID: <7b71dd61-4e6e-436e-a5d4-d462aeb6a0da@amd.com> (raw)
In-Reply-To: <20260427205336.25202-1-jbmoore61@gmail.com>
On 4/27/26 22:53, John B. Moore wrote:
> Reject IB GPU addresses with bits [1:0] set early in the CS parser,
> before they reach ring emission callbacks. On legacy AMD hardware
> (pre-amdgpu era), these two bits encoded byte-swap mode for IB memory
> fetches. That feature was dropped on all hardware that amdgpu supports,
> but the ring emission paths still contain BUG_ON(addr & 0x3) assertions
> that crash the kernel if userspace submits a misaligned IB address.
>
> Add an early check in amdgpu_cs_p2_ib() to reject such submissions
> with -EINVAL before the IB is allocated.
>
> Fixes: b0635e808290 ("drm/amdgpu: implement GFX 9.0 support (v2)")
That should probably be dropped. The issue was there much earlier than that.
> Cc: stable@vger.kernel.org
> Signed-off-by: John B. Moore <jbmoore61@gmail.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
@Alex do you want to pick that up or should I do that?
Thanks,
Christian
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> index f3b5bcdbf..c44692a2a 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> @@ -386,6 +386,14 @@ static int amdgpu_cs_p2_ib(struct amdgpu_cs_parser *p,
> if (chunk_ib->flags & AMDGPU_IB_FLAG_PREAMBLE)
> job->preamble_status |= AMDGPU_PREAMBLE_IB_PRESENT;
>
> + /* Reject IB addresses with reserved byte-swap bits set.
> + * On legacy HW (pre-amdgpu), bits [1:0] encoded byte-swap mode
> + * for IB fetches. That feature is deprecated on all HW that
> + * amdgpu supports, so these bits must be zero.
> + */
> + if (chunk_ib->va_start & 0x3)
> + return -EINVAL;
> +
> r = amdgpu_ib_get(p->adev, vm, ring->funcs->parse_cs ?
> chunk_ib->ib_bytes : 0,
> AMDGPU_IB_POOL_DELAYED, ib);
prev parent reply other threads:[~2026-04-28 6:46 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-27 20:53 [PATCH v3] drm/amdgpu: reject IB addresses with reserved byte-swap bits John B. Moore
2026-04-28 6:46 ` Christian König [this message]
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=7b71dd61-4e6e-436e-a5d4-d462aeb6a0da@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