security-advisory-tfv-6.rst 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. Advisory TFV-6 (CVE-2017-5753, CVE-2017-5715, CVE-2017-5754)
  2. ============================================================
  3. +----------------+-------------------------------------------------------------+
  4. | Title | Trusted Firmware-A exposure to speculative processor |
  5. | | vulnerabilities using cache timing side-channels |
  6. +================+=============================================================+
  7. | CVE ID | `CVE-2017-5753`_ / `CVE-2017-5715`_ / `CVE-2017-5754`_ |
  8. +----------------+-------------------------------------------------------------+
  9. | Date | 03 Jan 2018 (Updated 11 Jan, 18 Jan, 26 Jan, 30 Jan and 07 |
  10. | | June 2018) |
  11. +----------------+-------------------------------------------------------------+
  12. | Versions | All, up to and including v1.4 |
  13. | Affected | |
  14. +----------------+-------------------------------------------------------------+
  15. | Configurations | All |
  16. | Affected | |
  17. +----------------+-------------------------------------------------------------+
  18. | Impact | Leakage of secure world data to normal world |
  19. +----------------+-------------------------------------------------------------+
  20. | Fix Version | `Pull Request #1214`_, `Pull Request #1228`_, |
  21. | | `Pull Request #1240`_ and `Pull Request #1405`_ |
  22. +----------------+-------------------------------------------------------------+
  23. | Credit | Google / Arm |
  24. +----------------+-------------------------------------------------------------+
  25. This security advisory describes the current understanding of the Trusted
  26. Firmware-A exposure to the speculative processor vulnerabilities identified by
  27. `Google Project Zero`_. To understand the background and wider impact of these
  28. vulnerabilities on Arm systems, please refer to the `Arm Processor Security
  29. Update`_.
  30. Variant 1 (`CVE-2017-5753`_)
  31. ----------------------------
  32. At the time of writing, no vulnerable patterns have been observed in upstream TF
  33. code, therefore no workarounds have been applied or are planned.
  34. Variant 2 (`CVE-2017-5715`_)
  35. ----------------------------
  36. Where possible on vulnerable CPUs, Arm recommends invalidating the branch
  37. predictor as early as possible on entry into the secure world, before any branch
  38. instruction is executed. There are a number of implementation defined ways to
  39. achieve this.
  40. For Cortex-A57 and Cortex-A72 CPUs, the Pull Requests (PRs) in this advisory
  41. invalidate the branch predictor when entering EL3 by disabling and re-enabling
  42. the MMU.
  43. For Cortex-A73 and Cortex-A75 CPUs, the PRs in this advisory invalidate the
  44. branch predictor when entering EL3 by temporarily dropping into AArch32
  45. Secure-EL1 and executing the ``BPIALL`` instruction. This workaround is
  46. significantly more complex than the "MMU disable/enable" workaround. The latter
  47. is not effective at invalidating the branch predictor on Cortex-A73/Cortex-A75.
  48. Note that if other privileged software, for example a Rich OS kernel, implements
  49. its own branch predictor invalidation during context switch by issuing an SMC
  50. (to execute firmware branch predictor invalidation), then there is a dependency
  51. on the PRs in this advisory being deployed in order for those workarounds to
  52. work. If that other privileged software is able to workaround the vulnerability
  53. locally (for example by implementing "MMU disable/enable" itself), there is no
  54. such dependency.
  55. `Pull Request #1240`_ and `Pull Request #1405`_ optimise the earlier fixes by
  56. implementing a specified `CVE-2017-5715`_ workaround SMC
  57. (``SMCCC_ARCH_WORKAROUND_1``) for use by normal world privileged software. This
  58. is more efficient than calling an arbitrary SMC (for example ``PSCI_VERSION``).
  59. Details of ``SMCCC_ARCH_WORKAROUND_1`` can be found in the `CVE-2017-5715
  60. mitigation specification`_. The specification and implementation also enable
  61. the normal world to discover the presence of this firmware service.
  62. On Juno R1 we measured the round trip latency for both the ``PSCI_VERSION`` and
  63. ``SMCCC_ARCH_WORKAROUND_1`` SMCs on Cortex-A57, using both the "MMU
  64. disable/enable" and "BPIALL at AArch32 Secure-EL1" workarounds described above.
  65. This includes the time spent in test code conforming to the SMC Calling
  66. Convention (SMCCC) from AArch64. For the ``SMCCC_ARCH_WORKAROUND_1`` cases, the
  67. test code uses SMCCC v1.1, which reduces the number of general purpose registers
  68. it needs to save/restore. Although the ``BPIALL`` instruction is not effective
  69. at invalidating the branch predictor on Cortex-A57, the drop into Secure-EL1
  70. with MMU disabled that this workaround entails effectively does invalidate the
  71. branch predictor. Hence this is a reasonable comparison.
  72. The results were as follows:
  73. +------------------------------------------------------------------+-----------+
  74. | Test | Time (ns) |
  75. +==================================================================+===========+
  76. | ``PSCI_VERSION`` baseline (without PRs in this advisory) | 515 |
  77. +------------------------------------------------------------------+-----------+
  78. | ``PSCI_VERSION`` baseline (with PRs in this advisory) | 527 |
  79. +------------------------------------------------------------------+-----------+
  80. | ``PSCI_VERSION`` with "MMU disable/enable" | 930 |
  81. +------------------------------------------------------------------+-----------+
  82. | ``SMCCC_ARCH_WORKAROUND_1`` with "MMU disable/enable" | 386 |
  83. +------------------------------------------------------------------+-----------+
  84. | ``PSCI_VERSION`` with "BPIALL at AArch32 Secure-EL1" | 1276 |
  85. +------------------------------------------------------------------+-----------+
  86. | ``SMCCC_ARCH_WORKAROUND_1`` with "BPIALL at AArch32 Secure-EL1" | 770 |
  87. +------------------------------------------------------------------+-----------+
  88. Due to the high severity and wide applicability of this issue, the above
  89. workarounds are enabled by default (on vulnerable CPUs only), despite some
  90. performance and code size overhead. Platforms can choose to disable them at
  91. compile time if they do not require them. `Pull Request #1240`_ disables the
  92. workarounds for unaffected upstream platforms.
  93. For vulnerable AArch32-only CPUs (for example Cortex-A8, Cortex-A9 and
  94. Cortex-A17), the ``BPIALL`` instruction should be used as early as possible on
  95. entry into the secure world. For Cortex-A8, also set ``ACTLR[6]`` to 1 during
  96. early processor initialization. Note that the ``BPIALL`` instruction is not
  97. effective at invalidating the branch predictor on Cortex-A15. For that CPU, set
  98. ``ACTLR[0]`` to 1 during early processor initialization, and invalidate the
  99. branch predictor by performing an ``ICIALLU`` instruction.
  100. On AArch32 EL3 systems, the monitor and secure-SVC code is typically tightly
  101. integrated, for example as part of a Trusted OS. Therefore any Variant 2
  102. workaround should be provided by vendors of that software and is outside the
  103. scope of TF. However, an example implementation in the minimal AArch32 Secure
  104. Payload, ``SP_MIN`` is provided in `Pull Request #1228`_.
  105. Other Arm CPUs are not vulnerable to this or other variants. This includes
  106. Cortex-A76, Cortex-A53, Cortex-A55, Cortex-A32, Cortex-A7 and Cortex-A5.
  107. For more information about non-Arm CPUs, please contact the CPU vendor.
  108. Variant 3 (`CVE-2017-5754`_)
  109. ----------------------------
  110. This variant is only exploitable between Exception Levels within the same
  111. translation regime, for example between EL0 and EL1, therefore this variant
  112. cannot be used to access secure memory from the non-secure world, and is not
  113. applicable for TF. However, Secure Payloads (for example, Trusted OS) should
  114. provide mitigations on vulnerable CPUs to protect themselves from exploited
  115. Secure-EL0 applications.
  116. The only Arm CPU vulnerable to this variant is Cortex-A75.
  117. .. _Google Project Zero: https://googleprojectzero.blogspot.co.uk/2018/01/reading-privileged-memory-with-side.html
  118. .. _Arm Processor Security Update: http://www.arm.com/security-update
  119. .. _CVE-2017-5753: http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-5753
  120. .. _CVE-2017-5715: http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-5715
  121. .. _CVE-2017-5754: http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-5754
  122. .. _Pull Request #1214: https://github.com/ARM-software/arm-trusted-firmware/pull/1214
  123. .. _Pull Request #1228: https://github.com/ARM-software/arm-trusted-firmware/pull/1228
  124. .. _Pull Request #1240: https://github.com/ARM-software/arm-trusted-firmware/pull/1240
  125. .. _Pull Request #1405: https://github.com/ARM-software/arm-trusted-firmware/pull/1405
  126. .. _CVE-2017-5715 mitigation specification: https://developer.arm.com/cache-speculation-vulnerability-firmware-specification