All of lore.kernel.org
 help / color / mirror / Atom feed
From: Russell King - ARM Linux <linux@armlinux.org.uk>
To: Marc Zyngier <marc.zyngier@arm.com>
Cc: Florian Fainelli <f.fainelli@gmail.com>,
	Christoffer Dall <christoffer.dall@arm.com>,
	linux-arm-kernel@lists.infradead.org,
	kvmarm@lists.cs.columbia.edu
Subject: Re: [PATCH 09/14] ARM: spectre-v2: add PSCI based hardening
Date: Thu, 24 May 2018 14:04:07 +0100	[thread overview]
Message-ID: <20180524130406.GZ17671@n2100.armlinux.org.uk> (raw)
In-Reply-To: <dcd72fc1-4ec3-217e-30ed-00c6b6b2a122@arm.com>

On Thu, May 24, 2018 at 01:49:51PM +0100, Marc Zyngier wrote:
> On 24/05/18 13:30, Russell King - ARM Linux wrote:
> > On Thu, May 24, 2018 at 01:03:50PM +0100, Marc Zyngier wrote:
> >> On 23/05/18 20:45, Russell King - ARM Linux wrote:
> >>> On Tue, May 22, 2018 at 06:24:13PM +0100, Marc Zyngier wrote:
> >>>> On 21/05/18 12:45, Russell King wrote:
> >>>>> +#ifdef CONFIG_ARM_PSCI
> >>>>> +	if (psci_ops.smccc_version != SMCCC_VERSION_1_0) {
> >>>>> +		struct arm_smccc_res res;
> >>>>> +
> >>>>> +		switch (psci_ops.conduit) {
> >>>>> +		case PSCI_CONDUIT_HVC:
> >>>>> +			arm_smccc_1_1_hvc(ARM_SMCCC_ARCH_FEATURES_FUNC_ID,
> >>>>> +					  ARM_SMCCC_ARCH_WORKAROUND_1, &res);
> >>>>> +			if ((int)res.a0 < 0)
> >>>>> +				break;
> >>>>
> >>>> I just realised that there is a small, but significant difference
> >>>> between this and the arm64 version: On arm64, we have a table of
> >>>> vulnerable implementations, and we try the mitigation on a per-cpu
> >>>> basis. Here, you entirely rely on the firmware to discover whether the
> >>>> CPU needs mitigation or not. You then need to check for a return value
> >>>> of 1, which indicates that although the mitigation is implemented, it is
> >>>> not required on this particular CPU.
> >>>
> >>> Okay, so digging further into the documentation seems to suggest that we
> >>> only need to check the firmware for A72 and A57 CPUs, and given this
> >>> statement:
> >>>
> >>> "Arm recommends that the caller only call this on PEs for which a
> >>>  firmware based mitigation of CVE-2017-5715 is required, or where
> >>>  a local workaround is infeasible."
> >>>
> >>> it seems that the right answer is to ignore the PSCI based methods when
> >>> we have anything but these CPUs.  Do you agree?
> >>
> >> For CPUs that are produced by ARM, I agree. I don't know about CPUs
> >> produced by ARM licensees though, so I'd rather use the opposite logic:
> >> Use the firmware unless the CPU is one of those that can be easily
> >> mitigated at EL1 (or isn't affected).
> > 
> > The "or isn't affected" is the difficult bit - I guess we could match
> > on the CPU vendor field though, and just reject all ARM CPUs that
> > aren't explicitly listed as having a problem.
> 
> That seems sensible. ARM has published an exhaustive status for all its
> cores, which we can trust. For architecture licensees, I'm not aware of
> such a list, but I'd expect them to communicate one if they were affected.

It's not that simple - there's an exhaustive list for those affected
cores, but it says that cores which aren't listed are unaffected.

If we want to explicitly list each core, we need a complete list of
both affected and unaffected cores to ensure that none are missed.

-- 
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 8.8Mbps down 630kbps up
According to speedtest.net: 8.21Mbps down 510kbps up

WARNING: multiple messages have this Message-ID (diff)
From: linux@armlinux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 09/14] ARM: spectre-v2: add PSCI based hardening
Date: Thu, 24 May 2018 14:04:07 +0100	[thread overview]
Message-ID: <20180524130406.GZ17671@n2100.armlinux.org.uk> (raw)
In-Reply-To: <dcd72fc1-4ec3-217e-30ed-00c6b6b2a122@arm.com>

On Thu, May 24, 2018 at 01:49:51PM +0100, Marc Zyngier wrote:
> On 24/05/18 13:30, Russell King - ARM Linux wrote:
> > On Thu, May 24, 2018 at 01:03:50PM +0100, Marc Zyngier wrote:
> >> On 23/05/18 20:45, Russell King - ARM Linux wrote:
> >>> On Tue, May 22, 2018 at 06:24:13PM +0100, Marc Zyngier wrote:
> >>>> On 21/05/18 12:45, Russell King wrote:
> >>>>> +#ifdef CONFIG_ARM_PSCI
> >>>>> +	if (psci_ops.smccc_version != SMCCC_VERSION_1_0) {
> >>>>> +		struct arm_smccc_res res;
> >>>>> +
> >>>>> +		switch (psci_ops.conduit) {
> >>>>> +		case PSCI_CONDUIT_HVC:
> >>>>> +			arm_smccc_1_1_hvc(ARM_SMCCC_ARCH_FEATURES_FUNC_ID,
> >>>>> +					  ARM_SMCCC_ARCH_WORKAROUND_1, &res);
> >>>>> +			if ((int)res.a0 < 0)
> >>>>> +				break;
> >>>>
> >>>> I just realised that there is a small, but significant difference
> >>>> between this and the arm64 version: On arm64, we have a table of
> >>>> vulnerable implementations, and we try the mitigation on a per-cpu
> >>>> basis. Here, you entirely rely on the firmware to discover whether the
> >>>> CPU needs mitigation or not. You then need to check for a return value
> >>>> of 1, which indicates that although the mitigation is implemented, it is
> >>>> not required on this particular CPU.
> >>>
> >>> Okay, so digging further into the documentation seems to suggest that we
> >>> only need to check the firmware for A72 and A57 CPUs, and given this
> >>> statement:
> >>>
> >>> "Arm recommends that the caller only call this on PEs for which a
> >>>  firmware based mitigation of CVE-2017-5715 is required, or where
> >>>  a local workaround is infeasible."
> >>>
> >>> it seems that the right answer is to ignore the PSCI based methods when
> >>> we have anything but these CPUs.  Do you agree?
> >>
> >> For CPUs that are produced by ARM, I agree. I don't know about CPUs
> >> produced by ARM licensees though, so I'd rather use the opposite logic:
> >> Use the firmware unless the CPU is one of those that can be easily
> >> mitigated at EL1 (or isn't affected).
> > 
> > The "or isn't affected" is the difficult bit - I guess we could match
> > on the CPU vendor field though, and just reject all ARM CPUs that
> > aren't explicitly listed as having a problem.
> 
> That seems sensible. ARM has published an exhaustive status for all its
> cores, which we can trust. For architecture licensees, I'm not aware of
> such a list, but I'd expect them to communicate one if they were affected.

It's not that simple - there's an exhaustive list for those affected
cores, but it says that cores which aren't listed are unaffected.

If we want to explicitly list each core, we need a complete list of
both affected and unaffected cores to ensure that none are missed.

-- 
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 8.8Mbps down 630kbps up
According to speedtest.net: 8.21Mbps down 510kbps up

  reply	other threads:[~2018-05-24 13:04 UTC|newest]

Thread overview: 82+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-21 11:42 [PATCH v2 00/14] ARM Spectre variant 2 fixes Russell King - ARM Linux
2018-05-21 11:42 ` Russell King - ARM Linux
2018-05-21 11:44 ` [PATCH 01/14] ARM: add CPU part numbers for Cortex A73, A75 and Brahma B15 Russell King
2018-05-21 11:44   ` Russell King
2018-05-21 11:44 ` [PATCH 02/14] ARM: bugs: prepare processor bug infrastructure Russell King
2018-05-21 11:44   ` Russell King
2018-05-21 11:44 ` [PATCH 03/14] ARM: bugs: hook processor bug checking into SMP and suspend paths Russell King
2018-05-21 11:44   ` Russell King
2018-05-24 23:30   ` Florian Fainelli
2018-05-24 23:30     ` Florian Fainelli
2018-05-25 10:03     ` Russell King - ARM Linux
2018-05-25 10:03       ` Russell King - ARM Linux
2018-05-25 11:31       ` Russell King - ARM Linux
2018-05-25 11:31         ` Russell King - ARM Linux
2018-05-21 11:44 ` [PATCH 04/14] ARM: bugs: add support for per-processor bug checking Russell King
2018-05-21 11:44   ` Russell King
2018-05-21 11:44 ` [PATCH 05/14] ARM: spectre: add Kconfig symbol for CPUs vulnerable to Spectre Russell King
2018-05-21 11:44   ` Russell King
2018-05-21 11:44 ` [PATCH 06/14] ARM: spectre-v2: harden branch predictor on context switches Russell King
2018-05-21 11:44   ` Russell King
2018-05-22  3:21   ` Florian Fainelli
2018-05-22  3:21     ` Florian Fainelli
2018-05-22  9:55     ` Russell King - ARM Linux
2018-05-22  9:55       ` Russell King - ARM Linux
2018-05-22 18:27   ` Tony Lindgren
2018-05-22 18:27     ` Tony Lindgren
2018-05-21 11:44 ` [PATCH 07/14] ARM: spectre-v2: add Cortex A8 and A15 validation of the IBE bit Russell King
2018-05-21 11:44   ` Russell King
2018-05-22 18:28   ` Tony Lindgren
2018-05-22 18:28     ` Tony Lindgren
2018-05-21 11:45 ` [PATCH 08/14] ARM: spectre-v2: harden user aborts in kernel space Russell King
2018-05-21 11:45   ` Russell King
2018-05-22 17:15   ` Marc Zyngier
2018-05-22 17:15     ` Marc Zyngier
2018-05-22 17:56     ` Russell King - ARM Linux
2018-05-22 17:56       ` Russell King - ARM Linux
2018-05-22 18:12       ` Russell King - ARM Linux
2018-05-22 18:12         ` Russell King - ARM Linux
2018-05-22 18:19         ` Florian Fainelli
2018-05-22 18:19           ` Florian Fainelli
2018-05-22 23:25     ` Russell King - ARM Linux
2018-05-22 23:25       ` Russell King - ARM Linux
2018-05-21 11:45 ` [PATCH 09/14] ARM: spectre-v2: add PSCI based hardening Russell King
2018-05-21 11:45   ` Russell King
2018-05-22 17:24   ` Marc Zyngier
2018-05-22 17:24     ` Marc Zyngier
2018-05-22 17:57     ` Russell King - ARM Linux
2018-05-22 17:57       ` Russell King - ARM Linux
2018-05-23  7:25       ` Marc Zyngier
2018-05-23  7:25         ` Marc Zyngier
2018-05-23 19:45     ` Russell King - ARM Linux
2018-05-23 19:45       ` Russell King - ARM Linux
2018-05-24 12:03       ` Marc Zyngier
2018-05-24 12:03         ` Marc Zyngier
2018-05-24 12:30         ` Russell King - ARM Linux
2018-05-24 12:30           ` Russell King - ARM Linux
2018-05-24 12:49           ` Marc Zyngier
2018-05-24 12:49             ` Marc Zyngier
2018-05-24 13:04             ` Russell King - ARM Linux [this message]
2018-05-24 13:04               ` Russell King - ARM Linux
2018-05-21 11:45 ` [PATCH 10/14] ARM: KVM: invalidate BTB on guest exit for Cortex-A12/A17 Russell King
2018-05-21 11:45   ` Russell King
2018-05-21 11:45 ` [PATCH 11/14] ARM: KVM: invalidate icache on guest exit for Cortex-A15 Russell King
2018-05-21 11:45   ` Russell King
2018-05-21 11:45 ` [PATCH 12/14] ARM: spectre-v2: KVM: invalidate icache on guest exit for Brahma B15 Russell King
2018-05-21 11:45   ` Russell King
2018-05-22  3:22   ` Florian Fainelli
2018-05-22  3:22     ` Florian Fainelli
2018-05-21 11:45 ` [PATCH 13/14] ARM: KVM: Add SMCCC_ARCH_WORKAROUND_1 fast handling Russell King
2018-05-21 11:45   ` Russell King
2018-05-23 10:50   ` Marc Zyngier
2018-05-23 10:50     ` Marc Zyngier
2018-05-21 11:45 ` [PATCH 14/14] ARM: KVM: report support for SMCCC_ARCH_WORKAROUND_1 Russell King
2018-05-21 11:45   ` Russell King
2018-05-24 23:18 ` [PATCH v2 00/14] ARM Spectre variant 2 fixes Florian Fainelli
2018-05-24 23:18   ` Florian Fainelli
2018-05-25 10:00   ` Russell King - ARM Linux
2018-05-25 10:00     ` Russell King - ARM Linux
  -- strict thread matches above, loose matches on Subject: below --
2018-05-16 10:59 [PATCH 0/14] " Russell King - ARM Linux
2018-05-16 11:01 ` [PATCH 09/14] ARM: spectre-v2: add PSCI based hardening Russell King
2018-05-16 11:01   ` Russell King
2018-05-16 17:01   ` Marc Zyngier
2018-05-16 17:01     ` Marc Zyngier

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=20180524130406.GZ17671@n2100.armlinux.org.uk \
    --to=linux@armlinux.org.uk \
    --cc=christoffer.dall@arm.com \
    --cc=f.fainelli@gmail.com \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=marc.zyngier@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.