This is an archive of the discontinued LLVM Phabricator instance.

[ARM][CMSE] Clear the secure fp-registers when using softfp abi.
ClosedPublic

Authored by labrinea on Sep 2 2021, 6:22 AM.

Details

Summary

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.

Diff Detail

Event Timeline

labrinea created this revision.Sep 2 2021, 6:22 AM
labrinea requested review of this revision.Sep 2 2021, 6:22 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 2 2021, 6:22 AM
chill added a subscriber: chill.Sep 2 2021, 7:14 AM

Looks reasonable. Could we, please, add a comment which explains why it's correct to emit vlldm/vllsm (e.g. "they behave as NOPs") and various other instrucvtion that access FP regfisters (e.g. "we are passing parameters in FP-regs anyway")?

chill edited reviewers, added: chill; removed: momchil.velikov, llvm-commits.Sep 2 2021, 7:15 AM
labrinea updated this revision to Diff 370338.Sep 2 2021, 11:36 AM

Added an assertion for when fpregs are passed or returned, and a comment about vlstm/vlldm being NOP in the absence of FPU.

chill accepted this revision.Sep 3 2021, 2:06 AM

LGTM, cheers!

This revision is now accepted and ready to land.Sep 3 2021, 2:06 AM
This revision was landed with ongoing or failed builds.Sep 16 2021, 5:16 AM
This revision was automatically updated to reflect the committed changes.