1. 01 12月, 2019 1 次提交
    • M
      powerpc/book3s64: Fix link stack flush on context switch · 0a60d4bd
      Michael Ellerman 提交于
      commit 39e72bf96f5847ba87cc5bd7a3ce0fed813dc9ad upstream.
      
      In commit ee13cb24 ("powerpc/64s: Add support for software count
      cache flush"), I added support for software to flush the count
      cache (indirect branch cache) on context switch if firmware told us
      that was the required mitigation for Spectre v2.
      
      As part of that code we also added a software flush of the link
      stack (return address stack), which protects against Spectre-RSB
      between user processes.
      
      That is all correct for CPUs that activate that mitigation, which is
      currently Power9 Nimbus DD2.3.
      
      What I got wrong is that on older CPUs, where firmware has disabled
      the count cache, we also need to flush the link stack on context
      switch.
      
      To fix it we create a new feature bit which is not set by firmware,
      which tells us we need to flush the link stack. We set that when
      firmware tells us that either of the existing Spectre v2 mitigations
      are enabled.
      
      Then we adjust the patching code so that if we see that feature bit we
      enable the link stack flush. If we're also told to flush the count
      cache in software then we fall through and do that also.
      
      On the older CPUs we don't need to do do the software count cache
      flush, firmware has disabled it, so in that case we patch in an early
      return after the link stack flush.
      
      The naming of some of the functions is awkward after this patch,
      because they're called "count cache" but they also do link stack. But
      we'll fix that up in a later commit to ease backporting.
      
      This is the fix for CVE-2019-18660.
      Reported-by: NAnthony Steinhauser <asteinhauser@google.com>
      Fixes: ee13cb24 ("powerpc/64s: Add support for software count cache flush")
      Cc: stable@vger.kernel.org # v4.4+
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0a60d4bd
  2. 07 8月, 2018 2 次提交
    • M
      powerpc/64s: Add support for software count cache flush · ee13cb24
      Michael Ellerman 提交于
      Some CPU revisions support a mode where the count cache needs to be
      flushed by software on context switch. Additionally some revisions may
      have a hardware accelerated flush, in which case the software flush
      sequence can be shortened.
      
      If we detect the appropriate flag from firmware we patch a branch
      into _switch() which takes us to a count cache flush sequence.
      
      That sequence in turn may be patched to return early if we detect that
      the CPU supports accelerating the flush sequence in hardware.
      
      Add debugfs support for reporting the state of the flush, as well as
      runtime disabling it.
      
      And modify the spectre_v2 sysfs file to report the state of the
      software flush.
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      ee13cb24
    • M
      powerpc/64s: Add new security feature flags for count cache flush · dc8c6cce
      Michael Ellerman 提交于
      Add security feature flags to indicate the need for software to flush
      the count cache on context switch, and for the presence of a hardware
      assisted count cache flush.
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      dc8c6cce
  3. 22 5月, 2018 1 次提交
  4. 03 4月, 2018 1 次提交
  5. 27 3月, 2018 2 次提交
    • M
      powerpc/64s: Enhance the information in cpu_show_meltdown() · ff348355
      Michael Ellerman 提交于
      Now that we have the security feature flags we can make the
      information displayed in the "meltdown" file more informative.
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      ff348355
    • M
      powerpc: Add security feature flags for Spectre/Meltdown · 9a868f63
      Michael Ellerman 提交于
      This commit adds security feature flags to reflect the settings we
      receive from firmware regarding Spectre/Meltdown mitigations.
      
      The feature names reflect the names we are given by firmware on bare
      metal machines. See the hostboot source for details.
      
      Arguably these could be firmware features, but that then requires them
      to be read early in boot so they're available prior to asm feature
      patching, but we don't actually want to use them for patching. We may
      also want to dynamically update them in future, which would be
      incompatible with the way firmware features work (at the moment at
      least). So for now just make them separate flags.
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      9a868f63