From: Will Deacon <will@kernel.org>
To: Suzuki K Poulose <suzuki.poulose@arm.com>
Cc: mark.rutland@arm.com, catalin.marinas@arm.com,
linux-kernel@vger.kernel.org, james.morse@arm.com,
maz@kernel.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 0/5] arm64: Add workaround for Cortex-A77 erratum 1542418
Date: Thu, 14 Nov 2019 16:39:48 +0000 [thread overview]
Message-ID: <20191114163948.GA5158@willie-the-truck> (raw)
In-Reply-To: <20191114145918.235339-1-suzuki.poulose@arm.com>
Hi Suzuki,
On Thu, Nov 14, 2019 at 02:59:13PM +0000, Suzuki K Poulose wrote:
> This series adds workaround for Arm erratum 1542418 which affects
Searching for that erratum number doesn't find me a description :(
> Cortex-A77 cores (r0p0 - r1p0). Affected cores may execute stale
> instructions from the L0 macro-op cache violating the
> prefetch-speculation-protection guaranteed by the architecture.
> This happens when the when the branch predictor bases its predictions
> on a branch at this address on the stale history due to ASID or VMID
> reuse.
Two immediate questions:
1. Can we disable the L0 MOP cache?
2. Can we invalidate the branch predictor? If Spectre-v2 taught us
anything it's that removing those instructions was a mistake!
Moving on...
Have you reproduced this at top-level? If I recall the
prefetch-speculation-protection, it's designed to protect against the
case where you have a direct branch:
addr: B foo
and another CPU writes out a new function:
bar:
insn0
...
insnN
before doing any necessary maintenance and then patches the original
branch to:
addr: B bar
The idea is that a concurrently executing CPU could mispredict the original
branch to point at 'bar', fetch the instructions before they've been written
out and then confirm the prediction by looking at the newly written branch
instruction. Even without the prefetch-speculation-protection, that's
fairly difficult to achieve in practice: you'd need to be doing something
like reusing memory to hold the instructions so that the initial
misprediction occurs.
How does A77 stop this from occurring when the ASID is not reallocated (e.g.
the example above)? Is the MOP cache flushed somehow?
With this erratum, it sounds like you have to end up reusing an ASID from
a task that had a branch at 'addr' in its address space that branched to
the address of 'bar' (again. in its address space). Is that right? That
sounds super rare to me, particularly with ASLR: not only does the aliasing
branch need to exist, but it needs to be held in the branch predictor while
we cycle through 64k ASIDs *and* the race with the writer needs to happen
so that we get stale instructions from the MOP cache.
Is there something I'm missing that makes this remotely plausible?
Will
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2019-11-14 16:40 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-14 14:59 [PATCH 0/5] arm64: Add workaround for Cortex-A77 erratum 1542418 Suzuki K Poulose
2019-11-14 14:59 ` [PATCH 1/5] arm64: Add MIDR encoding for Arm Cortex-A77 Suzuki K Poulose
2019-11-14 14:59 ` [PATCH 2/5] arm64: mm: Workaround Cortex-A77 erratum 1542418 on ASID rollover Suzuki K Poulose
2019-11-14 14:59 ` [PATCH 3/5] arm64: Workaround Cortex-A77 erratum 1542418 on boot due to kexec Suzuki K Poulose
2019-11-14 14:59 ` [PATCH 4/5] KVM: arm64: Workaround Cortex-A77 erratum 1542418 on VMID rollover Suzuki K Poulose
2019-11-14 14:59 ` [PATCH 5/5] KVM: arm/arm64: Don't invoke defacto-CnP on first run Suzuki K Poulose
2019-11-14 16:39 ` Will Deacon [this message]
2019-11-15 1:14 ` [PATCH 0/5] arm64: Add workaround for Cortex-A77 erratum 1542418 Suzuki K Poulose
2019-11-20 19:18 ` Will Deacon
2020-04-08 10:09 ` Will Deacon
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=20191114163948.GA5158@willie-the-truck \
--to=will@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=james.morse@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=maz@kernel.org \
--cc=suzuki.poulose@arm.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