[PATCH] arm: Zero/Sign extends for CMSE security

Richard Ball richard.ball@arm.com
Wed Apr 24 15:55:53 GMT 2024


This patch makes the following changes:

1) When calling a secure function from non-secure code then any arguments
   smaller than 32-bits that are passed in registers are zero- or sign-extended.
2) After a non-secure function returns into secure code then any return value
   smaller than 32-bits that is passed in a register is  zero- or sign-extended.

This patch addresses the following CVE-2024-0151.

gcc/ChangeLog:
        PR target/114837
        * config/arm/arm.cc (cmse_nonsecure_call_inline_register_clear):
          Add zero/sign extend.
        (arm_expand_prologue): Add zero/sign extend.

gcc/testsuite/ChangeLog:

        * gcc.target/arm/cmse/extend-param.c: New test.
        * gcc.target/arm/cmse/extend-return.c: New test.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CMSEvulnerability.patch
Type: text/x-patch
Size: 7607 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20240424/60f5ad9b/attachment-0001.bin>


More information about the Gcc-patches mailing list