1. 09 9月, 2022 1 次提交
  2. 20 7月, 2022 1 次提交
  3. 05 7月, 2022 2 次提交
  4. 01 7月, 2022 2 次提交
  5. 23 4月, 2022 3 次提交
  6. 08 3月, 2022 1 次提交
  7. 25 2月, 2022 2 次提交
  8. 24 2月, 2022 2 次提交
    • J
      arm64: Use the clearbhb instruction in mitigations · 228a26b9
      James Morse 提交于
      Future CPUs may implement a clearbhb instruction that is sufficient
      to mitigate SpectreBHB. CPUs that implement this instruction, but
      not CSV2.3 must be affected by Spectre-BHB.
      
      Add support to use this instruction as the BHB mitigation on CPUs
      that support it. The instruction is in the hint space, so it will
      be treated by a NOP as older CPUs.
      Reviewed-by: NRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
      Reviewed-by: NCatalin Marinas <catalin.marinas@arm.com>
      Signed-off-by: NJames Morse <james.morse@arm.com>
      228a26b9
    • J
      arm64: Mitigate spectre style branch history side channels · 558c303c
      James Morse 提交于
      Speculation attacks against some high-performance processors can
      make use of branch history to influence future speculation.
      When taking an exception from user-space, a sequence of branches
      or a firmware call overwrites or invalidates the branch history.
      
      The sequence of branches is added to the vectors, and should appear
      before the first indirect branch. For systems using KPTI the sequence
      is added to the kpti trampoline where it has a free register as the exit
      from the trampoline is via a 'ret'. For systems not using KPTI, the same
      register tricks are used to free up a register in the vectors.
      
      For the firmware call, arch-workaround-3 clobbers 4 registers, so
      there is no choice but to save them to the EL1 stack. This only happens
      for entry from EL0, so if we take an exception due to the stack access,
      it will not become re-entrant.
      
      For KVM, the existing branch-predictor-hardening vectors are used.
      When a spectre version of these vectors is in use, the firmware call
      is sufficient to mitigate against Spectre-BHB. For the non-spectre
      versions, the sequence of branches is added to the indirect vector.
      Reviewed-by: NCatalin Marinas <catalin.marinas@arm.com>
      Signed-off-by: NJames Morse <james.morse@arm.com>
      558c303c
  9. 20 8月, 2021 1 次提交
  10. 18 8月, 2021 1 次提交
  11. 11 8月, 2021 1 次提交
  12. 30 7月, 2021 1 次提交
  13. 11 6月, 2021 1 次提交
  14. 27 5月, 2021 1 次提交
  15. 09 4月, 2021 1 次提交
  16. 25 3月, 2021 1 次提交
  17. 19 3月, 2021 1 次提交
  18. 09 2月, 2021 5 次提交
  19. 03 12月, 2020 1 次提交
    • M
      arm64: sdei: explicitly simulate PAN/UAO entry · 2376e75c
      Mark Rutland 提交于
      In preparation for removing addr_limit and set_fs() we must decouple the
      SDEI PAN/UAO manipulation from the uaccess code, and explicitly
      reinitialize these as required.
      
      SDEI enters the kernel with a non-architectural exception, and prior to
      the most recent revision of the specification (ARM DEN 0054B), PSTATE
      bits (e.g. PAN, UAO) are not manipulated in the same way as for
      architectural exceptions. Notably, older versions of the spec can be
      read ambiguously as to whether PSTATE bits are inherited unchanged from
      the interrupted context or whether they are generated from scratch, with
      TF-A doing the latter.
      
      We have three cases to consider:
      
      1) The existing TF-A implementation of SDEI will clear PAN and clear UAO
         (along with other bits in PSTATE) when delivering an SDEI exception.
      
      2) In theory, implementations of SDEI prior to revision B could inherit
         PAN and UAO (along with other bits in PSTATE) unchanged from the
         interrupted context. However, in practice such implementations do not
         exist.
      
      3) Going forward, new implementations of SDEI must clear UAO, and
         depending on SCTLR_ELx.SPAN must either inherit or set PAN.
      
      As we can ignore (2) we can assume that upon SDEI entry, UAO is always
      clear, though PAN may be clear, inherited, or set per SCTLR_ELx.SPAN.
      Therefore, we must explicitly initialize PAN, but do not need to do
      anything for UAO.
      
      Considering what we need to do:
      
      * When set_fs() is removed, force_uaccess_begin() will have no HW
        side-effects. As this only clears UAO, which we can assume has already
        been cleared upon entry, this is not a problem. We do not need to add
        code to manipulate UAO explicitly.
      
      * PAN may be cleared upon entry (in case 1 above), so where a kernel is
        built to use PAN and this is supported by all CPUs, the kernel must
        set PAN upon entry to ensure expected behaviour.
      
      * PAN may be inherited from the interrupted context (in case 3 above),
        and so where a kernel is not built to use PAN or where PAN support is
        not uniform across CPUs, the kernel must clear PAN to ensure expected
        behaviour.
      
      This patch reworks the SDEI code accordingly, explicitly setting PAN to
      the expected state in all cases. To cater for the cases where the kernel
      does not use PAN or this is not uniformly supported by hardware we add a
      new cpu_has_pan() helper which can be used regardless of whether the
      kernel is built to use PAN.
      
      The existing system_uses_ttbr0_pan() is redefined in terms of
      system_uses_hw_pan() both for clarity and as a minor optimization when
      HW PAN is not selected.
      Signed-off-by: NMark Rutland <mark.rutland@arm.com>
      Reviewed-by: NJames Morse <james.morse@arm.com>
      Cc: James Morse <james.morse@arm.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Will Deacon <will@kernel.org>
      Link: https://lore.kernel.org/r/20201202131558.39270-3-mark.rutland@arm.comSigned-off-by: NCatalin Marinas <catalin.marinas@arm.com>
      2376e75c
  20. 28 11月, 2020 1 次提交
  21. 14 11月, 2020 2 次提交
  22. 10 11月, 2020 1 次提交
  23. 30 10月, 2020 2 次提交
  24. 29 9月, 2020 3 次提交
    • M
      arm64: Get rid of arm64_ssbd_state · 31c84d6c
      Marc Zyngier 提交于
      Out with the old ghost, in with the new...
      Signed-off-by: NMarc Zyngier <maz@kernel.org>
      Signed-off-by: NWill Deacon <will@kernel.org>
      31c84d6c
    • W
      arm64: Rewrite Spectre-v2 mitigation code · d4647f0a
      Will Deacon 提交于
      The Spectre-v2 mitigation code is pretty unwieldy and hard to maintain.
      This is largely due to it being written hastily, without much clue as to
      how things would pan out, and also because it ends up mixing policy and
      state in such a way that it is very difficult to figure out what's going
      on.
      
      Rewrite the Spectre-v2 mitigation so that it clearly separates state from
      policy and follows a more structured approach to handling the mitigation.
      Signed-off-by: NWill Deacon <will@kernel.org>
      d4647f0a
    • W
      arm64: Remove Spectre-related CONFIG_* options · 6e5f0927
      Will Deacon 提交于
      The spectre mitigations are too configurable for their own good, leading
      to confusing logic trying to figure out when we should mitigate and when
      we shouldn't. Although the plethora of command-line options need to stick
      around for backwards compatibility, the default-on CONFIG options that
      depend on EXPERT can be dropped, as the mitigations only do anything if
      the system is vulnerable, a mitigation is available and the command-line
      hasn't disabled it.
      
      Remove CONFIG_HARDEN_BRANCH_PREDICTOR and CONFIG_ARM64_SSBD in favour of
      enabling this code unconditionally.
      Signed-off-by: NWill Deacon <will@kernel.org>
      6e5f0927
  25. 07 9月, 2020 1 次提交
  26. 04 9月, 2020 1 次提交