From: Jens Axboe <axboe@kernel.dk>
To: Josh Poimboeuf <jpoimboe@kernel.org>
Cc: Phillip Potter <phil@philpotter.co.uk>,
linux-kernel@vger.kernel.org, Jordy Zomer <jordyzomer@google.com>
Subject: Re: [PATCH] cdrom: Avoid barrier_nospec() in cdrom_ioctl_media_changed()
Date: Thu, 17 Oct 2024 19:10:49 -0600 [thread overview]
Message-ID: <3a4cdc4f-63e9-48b1-80b0-54c5d1eb3e7f@kernel.dk> (raw)
In-Reply-To: <20241018005233.styuaj7eyn7b6nux@treble>
On 10/17/24 6:52 PM, Josh Poimboeuf wrote:
> On Thu, Oct 17, 2024 at 06:33:24PM -0600, Jens Axboe wrote:
>> On 10/17/24 4:09 PM, Josh Poimboeuf wrote:
>>> The barrier_nospec() after the array bounds check is overkill and
>>> painfully slow for arches which implement it.
>>>
>>> Furthermore, most arches don't implement it, so they remain exposed to
>>> Spectre v1 (which can affect pretty much any CPU with branch
>>> prediction).
>>>
>>> Instead, clamp the user pointer to a valid range so it's guaranteed to
>>> be a valid array index even when the bounds check mispredicts.
>>
>> It's a cdrom, and media change detection to be more specific. I really
>> don't think anyone would care about performance here, it's not even
>> a hot path for a cdrom driver. That said, I don't disagree with
>> the change, just don't think it'll make one iota of difference
>> in the real world.
>
> Fair, though it's also about hardening as barrier_nospec() is only
> implemented by x86 and powerpc (see 2nd paragraph). Most/all arches are
> affected by Spectre v1.
Yep agree, if we don't have full arch coverage, then that's a better
reason for getting it included rather than performance reasons.
--
Jens Axboe
next prev parent reply other threads:[~2024-10-18 1:10 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-17 22:09 Josh Poimboeuf
2024-10-18 0:33 ` Jens Axboe
2024-10-18 0:52 ` Josh Poimboeuf
2024-10-18 1:10 ` Jens Axboe [this message]
2024-10-18 1:47 ` Jens Axboe
2024-10-18 10:31 ` Phillip Potter
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=3a4cdc4f-63e9-48b1-80b0-54c5d1eb3e7f@kernel.dk \
--to=axboe@kernel.dk \
--cc=jordyzomer@google.com \
--cc=jpoimboe@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=phil@philpotter.co.uk \
/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
all inboxes | Powered by JetHome®