AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Cheng <benjamin.cheng@amd.com>
To: Alex Deucher <alexdeucher@gmail.com>, "Lazar, Lijo" <lijo.lazar@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>, amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH 1/7] drm/amdgpu/mmhub2.0: add bounds checking for cid
Date: Mon, 16 Mar 2026 15:20:21 -0400	[thread overview]
Message-ID: <dd5aa9ee-989a-4d32-ba9e-9b9232fe164f@amd.com> (raw)
In-Reply-To: <CADnq5_Md6LQ2n7ciXKuhvvbcq7NZxHZ2VsY0TpPQyDNwAko7iA@mail.gmail.com>


On 2026-03-05 11:16, Alex Deucher wrote:
> On Thu, Mar 5, 2026 at 10:24 AM Lazar, Lijo <lijo.lazar@amd.com> wrote:
>>
>>
>> On 05-Mar-26 3:57 AM, Alex Deucher wrote:
>>> The value should never exceed the array size as those
>>> are the only values the hardware is expected to return,
>>> but add checks anyway.
>>>
>>> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
>>> ---
>>>   drivers/gpu/drm/amd/amdgpu/mmhub_v2_0.c | 9 ++++++---
>>>   1 file changed, 6 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/mmhub_v2_0.c b/drivers/gpu/drm/amd/amdgpu/mmhub_v2_0.c
>>> index a0cc8e218ca1e..534cb4c544dc4 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/mmhub_v2_0.c
>>> +++ b/drivers/gpu/drm/amd/amdgpu/mmhub_v2_0.c
>>> @@ -154,14 +154,17 @@ mmhub_v2_0_print_l2_protection_fault_status(struct amdgpu_device *adev,
>>>       switch (amdgpu_ip_version(adev, MMHUB_HWIP, 0)) {
>>>       case IP_VERSION(2, 0, 0):
>>>       case IP_VERSION(2, 0, 2):
>>> -             mmhub_cid = mmhub_client_ids_navi1x[cid][rw];
>>> +             mmhub_cid = cid < ARRAY_SIZE(mmhub_client_ids_navi1x) ?
>> Does this introduce speculation and requirement to use array_index_nospec?
> I don't think so, but I'm not really an expert on side channel attacks.
>
> Alex

Also not an expert here but I don't think this can be used as an exploit. The cid is read from HW and is not controllable by users.

This series is:

Reviewed-by: Benjamin Cheng <benjamin.cheng@amd.com>

>
>> Thanks,
>> Lijo
>>
>>> +                     mmhub_client_ids_navi1x[cid][rw] : NULL;
>>>               break;
>>>       case IP_VERSION(2, 1, 0):
>>>       case IP_VERSION(2, 1, 1):
>>> -             mmhub_cid = mmhub_client_ids_sienna_cichlid[cid][rw];
>>> +             mmhub_cid = cid < ARRAY_SIZE(mmhub_client_ids_sienna_cichlid) ?
>>> +                     mmhub_client_ids_sienna_cichlid[cid][rw] : NULL;
>>>               break;
>>>       case IP_VERSION(2, 1, 2):
>>> -             mmhub_cid = mmhub_client_ids_beige_goby[cid][rw];
>>> +             mmhub_cid = cid < ARRAY_SIZE(mmhub_client_ids_beige_goby) ?
>>> +                     mmhub_client_ids_beige_goby[cid][rw] : NULL;
>>>               break;
>>>       default:
>>>               mmhub_cid = NULL;

      parent reply	other threads:[~2026-03-16 19:20 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-04 22:27 [PATCH 1/7] drm/amdgpu/mmhub2.0: add bounds checking for cid Alex Deucher
2026-03-04 22:27 ` [PATCH 2/7] drm/amdgpu/mmhub2.3: " Alex Deucher
2026-03-04 22:27 ` [PATCH 3/7] drm/amdgpu/mmhub3.0.1: " Alex Deucher
2026-03-04 22:27 ` [PATCH 4/7] drm/amdgpu/mmhub3.0.2: " Alex Deucher
2026-03-04 22:27 ` [PATCH 5/7] drm/amdgpu/mmhub3.0: " Alex Deucher
2026-03-04 22:27 ` [PATCH 6/7] drm/amdgpu/mmhub4.1.0: " Alex Deucher
2026-03-04 22:27 ` [PATCH 7/7] drm/amdgpu/mmhub4.2.0: " Alex Deucher
2026-03-05 15:07 ` [PATCH 1/7] drm/amdgpu/mmhub2.0: " Lazar, Lijo
2026-03-05 16:16   ` Alex Deucher
2026-03-16 17:56     ` Alex Deucher
2026-03-16 19:20     ` Benjamin Cheng [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=dd5aa9ee-989a-4d32-ba9e-9b9232fe164f@amd.com \
    --to=benjamin.cheng@amd.com \
    --cc=alexander.deucher@amd.com \
    --cc=alexdeucher@gmail.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=lijo.lazar@amd.com \
    /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