[ARM][CMSE] Clear the secure fp-registers when using softfp abi.
authorAlexandros Lamprineas <alexandros.lamprineas@arm.com>
Thu, 2 Sep 2021 11:48:07 +0000 (12:48 +0100)
committerAlexandros Lamprineas <alexandros.lamprineas@arm.com>
Thu, 16 Sep 2021 11:56:43 +0000 (12:56 +0100)
commit61f25daa8d1b69dd5138facd5d57a8e3dfa0c5cc
tree584720a6476618478703fd9666e09ef9f971d20f
parent054e331d9dbd3ce98b19625b75ba38dd9ebc34cc
[ARM][CMSE] Clear the secure fp-registers when using softfp abi.

When expanding the non-secure call instruction we are emiting code
to clear the secure floating-point registers only if the targeted
architecture has floating-point support. The potential problem is
when the source code containing non-secure calls are built with
-mfloat-abi=soft but some other part of the system has been built
with -mfloat-abi=softfp (soft and softfp are compatible as they use
the same procedure calling standard). In this case floating-point
registers could leak to non-secure state as the non-secure won't
have cleared them assuming no floating point has been used.

Differential Revision: https://reviews.llvm.org/D109153
llvm/lib/Target/ARM/ARMExpandPseudoInsts.cpp
llvm/test/CodeGen/ARM/cmse-clear.ll
llvm/test/CodeGen/ARM/cmse.ll