cmse_check_address_range() changed behaviour, why?

Asked by Peer Springstübe on 2021-02-17

I'm using a Cortex-M33 with arm trust-zone. I have a secure api inside my secure firmware that I can call from my non-secure firmware. All works as expected - at least until I upgraded my compiler from `gcc-arm-none-eabi-7-2018-q2-update` to `gcc-arm-none-eabi-10-2020-q4-major`.

The function in question looks like this:

 bool __attribute__((cmse_nonsecure_call)) (*Callback_Handler)();

    __unused __attribute__((cmse_nonsecure_entry))
    bool Secure_SetSomeCallbackHandler(bool (*handler)()) {
        // this cmse-check fails with the compiler in `version gcc-arm-none-eabi-10-2020-q4-major`
        // it works with the `gcc-arm-none-eabi-7-2018-q2-update` though
        handler = cmse_check_address_range(handler, 4, CMSE_NONSECURE);
        if (handler == NULL) {
            return false;
        }
        Callback_Handler = handler;
        return true;
    }

I make sure the supplied pointer really is in non-secure space by using `cmse_check_address_range`. That works for the version 7, but if I compile the code with version 10, `NULL` is returned. I did not change anything in the source or any other part, just the compiler.

I checked for any changes in that function, but even `https://github.com/gcc-mirror/gcc/commits/master/libgcc/config/arm/cmse.c` does not show any changes whatsoever.

Did anything change? Maybe I'm using the function not as intended (do I need different flags for functions? But then again, it works with version 7.

I posted the same question on Stackoverflow, but this place seems more appropriate. Here is the link:
https://stackoverflow.com/q/66240436/1358283

Question information

Language:
English Edit question
Status:
Expired
For:
GNU Arm Embedded Toolchain Edit question
Assignee:
No assignee Edit question
Last query:
2021-02-19
Last reply:
14 hours ago
Launchpad Janitor (janitor) said : #2

This question was expired because it remained in the 'Open' state without activity for the last 15 days.