LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Valentina Manea <valentina.manea.m@gmail.com>,
	Shuah Khan <shuah@kernel.org>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] usbip: vhci_sysfs: fix potential Spectre v1
Date: Thu, 17 May 2018 14:29:17 -0500	[thread overview]
Message-ID: <32f8fcd6-ca00-ff7d-bcd0-a307f178f765@embeddedor.com> (raw)
In-Reply-To: <20180517191535.GB3799@kroah.com>



On 05/17/2018 02:15 PM, Greg Kroah-Hartman wrote:
>>> Shouldn't we just do this in one place, in the valid_port() function?
>>>
>>> That way it keeps the range checking logic in one place (now it is in 3
>>> places in the function), which should make maintenance much simpler.
>>>
>>
>> Yep, I thought about that, the thing is: what happens if the hardware is
>> "trained" to predict that valid_port always evaluates to false, and then
>> malicious values are stored in pdev_nr and nhport?
>>
>> It seems to me that under this scenario we need to serialize instructions in
>> this place.
>>
>> What do you think?
> 
> I don't understand, it should not matter where you put the barrier.  Be
> it a function call back or right after it, it does the same thing, it
> stops speculation from crossing that barrier.
> 

Yeah. It makes sense.

> So it _should_ work either way, if I understand the issue correctly.
> 
> If not, what am I missing?
> 

No. It seems I'm the one who was missing something.

I'll place the barrier into valid_port and send v2 shortly.

Thanks!
--
Gustavo

      reply	other threads:[~2018-05-17 19:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-16 22:22 Gustavo A. R. Silva
2018-05-17  6:51 ` Greg Kroah-Hartman
2018-05-17 17:57   ` Gustavo A. R. Silva
2018-05-17 19:15     ` Greg Kroah-Hartman
2018-05-17 19:29       ` Gustavo A. R. Silva [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=32f8fcd6-ca00-ff7d-bcd0-a307f178f765@embeddedor.com \
    --to=gustavo@embeddedor.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=shuah@kernel.org \
    --cc=valentina.manea.m@gmail.com \
    --subject='Re: [PATCH] usbip: vhci_sysfs: fix potential Spectre v1' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).