From: "Christian König" <christian.koenig-5C7GfCeVMHo@public.gmane.org>
To: "Alex Deucher"
<alexdeucher-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
"Michel Dänzer" <michel-otUistvHUpPR7s880joybQ@public.gmane.org>
Cc: "David (ChunMing) Zhou"
<David1.Zhou-5C7GfCeVMHo@public.gmane.org>,
"Gustavo A. R. Silva"
<gustavo-L1vi/lXTdts+Va1GwOuvDg@public.gmane.org>,
David Airlie <airlied-cv59FeDIM0c@public.gmane.org>,
LKML <linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Maling list - DRI developers
<dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>,
amd-gfx list
<amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>,
Alex Deucher <alexander.deucher-5C7GfCeVMHo@public.gmane.org>
Subject: Re: [PATCH] drm/amdgpu/pm: Fix potential Spectre v1
Date: Tue, 31 Jul 2018 08:46:10 +0200 [thread overview]
Message-ID: <658cd654-be3e-659a-20a7-f33034c231ce@amd.com> (raw)
In-Reply-To: <CADnq5_MKR=qYCX-m4wKA47F0EejNcUmS7jsnY9=1nyKKEQhqJQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
Am 30.07.2018 um 22:14 schrieb Alex Deucher:
> On Mon, Jul 30, 2018 at 5:55 AM, Michel Dänzer <michel@daenzer.net> wrote:
>> On 2018-07-24 10:53 PM, Alex Deucher wrote:
>>> On Mon, Jul 23, 2018 at 12:32 PM, Gustavo A. R. Silva
>>> <gustavo@embeddedor.com> wrote:
>>>> idx can be indirectly controlled by user-space, hence leading to a
>>>> potential exploitation of the Spectre variant 1 vulnerability.
>>>>
>>>> This issue was detected with the help of Smatch:
>>>>
>>>> drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c:408 amdgpu_set_pp_force_state()
>>>> warn: potential spectre issue 'data.states'
>>>>
>>>> Fix this by sanitizing idx before using it to index data.states
>>> Is this actually necessary? We already check that idx is valid a few
>>> lines before:
>>> if (ret || idx >= ARRAY_SIZE(data.states)) {
>>> count = -EINVAL;
>>> goto fail;
>>> }
>> A Spectre attack would be based on idx ending up too large, but the CPU
>> speculatively executing the following code assuming idx <
>> ARRAY_SIZE(data.states), and extracting information from the incorrectly
>> speculated code via side channels.
>>
>> I'm not sure if that's actually possible in this case, but better safe
>> than sorry?
> Yeah, I'm not sure. I guess this can't hurt.
Well is idx actually controlable by userspace in an IOCTL? I guess the
answer is no.
On the other hand the array_index_nospec() macro makes the overhead
absolute negligible.
So I agree that we should be better safe than sorry.
Christian.
>
> Alex
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
next prev parent reply other threads:[~2018-07-31 6:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-23 16:32 [PATCH] drm/amdgpu/pm: Fix potential Spectre v1 Gustavo A. R. Silva
[not found] ` <20180723163232.GA17358-L1vi/lXTdts+Va1GwOuvDg@public.gmane.org>
2018-07-24 20:53 ` Alex Deucher
[not found] ` <CADnq5_Ons4y+sweZGg4LgJpfn8wzgg8xdpytLt-78PVqqg-LpA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-07-30 9:55 ` Michel Dänzer
[not found] ` <50f9f4f3-76e1-401a-bd84-6ae746fe4647-otUistvHUpPR7s880joybQ@public.gmane.org>
2018-07-30 20:14 ` Alex Deucher
[not found] ` <CADnq5_MKR=qYCX-m4wKA47F0EejNcUmS7jsnY9=1nyKKEQhqJQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-07-31 6:46 ` Christian König [this message]
2018-07-31 21:29 ` Alex Deucher
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=658cd654-be3e-659a-20a7-f33034c231ce@amd.com \
--to=christian.koenig-5c7gfcevmho@public.gmane.org \
--cc=David1.Zhou-5C7GfCeVMHo@public.gmane.org \
--cc=airlied-cv59FeDIM0c@public.gmane.org \
--cc=alexander.deucher-5C7GfCeVMHo@public.gmane.org \
--cc=alexdeucher-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
--cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
--cc=gustavo-L1vi/lXTdts+Va1GwOuvDg@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=michel-otUistvHUpPR7s880joybQ@public.gmane.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