Hello,
The first IPC implementation works under isolation level 1. The high isolation levels need to be there to get compatible with PSA Firmware Framework. A design document is created about implementing isolation level 2 for IPC model:
https://developer.trustedfirmware.org/w/tf_m/design/trusted_firmware-m_isol…
The mainly change of isolation level 2 compare to isolation level 1 is:
* Put AppRoT Secure Partitions' components with same attribute (code, read-only data, read-write data) into the same region, which helps MPU setting region attributes.
* Change Secure Partition privileged setting based on Secure Partition type while scheduling.
* Change mechanism of privileged API, such as printf.
If you have any comments please share it. You can reply in mailing list if there is no place for putting comments on the page.
Thank you!
-Ken
Hi David,
Thanks for raising this. I'll contact you directly to review the Mailman
configuration.
Regards
Bill
On Thu, 28 Feb 2019, 05:04 David Brown via TF-M, <
tf-m(a)lists.trustedfirmware.org> wrote:
> I have noticed that this mailing list seems to be configured in a
> non-ideal way.
>
> Primarily, the messages are sent from the list address itself, and a
> reply-to header is inserted for the original sender. This at least
> often will allow someone to reply to the original sender.
>
> There are a few problems with this. One is that this tends to break
> messages that have been copied to more than one list, especially for
> recipients who subscribe to both lists. Admittedly it is better than
> the all-to-common practice of setting Reply-to to the list itself,
> which effectively steals all replies from any other recipients or
> lists that were originally included.
>
> Secondly, however, this kind of violates the intent of the reply-to
> field, which was intended for the originator of the message to be able
> to give an alternative address they wish for replies to go to.
>
> I don't know how this list is hosted, and usually this kind of
> configuration results from an ISP that rejects messages. But, I know
> a lot of mailing lists are managed with mailman without these
> problems, so it should be possible to get this working in a more
> homogenous way.
>
> Lists admins, feel free to contact me if you want any assistance in
> trying to configure the list better.
>
> Thanks,
> David
> --
> TF-M mailing list
> TF-M(a)lists.trustedfirmware.org
> https://lists.trustedfirmware.org/mailman/listinfo/tf-m
>
I have noticed that this mailing list seems to be configured in a
non-ideal way.
Primarily, the messages are sent from the list address itself, and a
reply-to header is inserted for the original sender. This at least
often will allow someone to reply to the original sender.
There are a few problems with this. One is that this tends to break
messages that have been copied to more than one list, especially for
recipients who subscribe to both lists. Admittedly it is better than
the all-to-common practice of setting Reply-to to the list itself,
which effectively steals all replies from any other recipients or
lists that were originally included.
Secondly, however, this kind of violates the intent of the reply-to
field, which was intended for the originator of the message to be able
to give an alternative address they wish for replies to go to.
I don't know how this list is hosted, and usually this kind of
configuration results from an ISP that rejects messages. But, I know
a lot of mailing lists are managed with mailman without these
problems, so it should be possible to get this working in a more
homogenous way.
Lists admins, feel free to contact me if you want any assistance in
trying to configure the list better.
Thanks,
David
Hi Thomas,
Thanks for the feedback. An additional question from me to understand better the issue: are you rebuilding RTX from source, not using the pre-built binaries distributed with CMSIS_5?
Since this commit: https://github.com/ARM-software/CMSIS_5/commit/8bce76b03565359f31cd20ed86c2… CMSIS_5 has changed from using __DOMAIN_NS to DOMAIN_NS macro for better MISRA compliance. I think to officially support newer releases of CMSIS, we should update our instructions and define DOMAIN_NS in addition to __DOMAIN_NS, as this define will come into picture for integrations which actually rebuild RTX from the CMSIS_5 repo sources.
Thanks,
Antonio
-----Original Message-----
From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of Thomas Törnblom via TF-M
Sent: 26 February 2019 09:58
To: tf-m(a)lists.trustedfirmware.org
Subject: Re: [TF-M] SecureFault when starting the OS
Thanks Miklos and Antonio,
You were both spot on.
Turned out I had not define DOMAIN_NS=1, which change the last byte from FD to BC.
I need to figure out why I need to add that when the documentation says
__DOMAIN_NS=1 should be sufficient.
Cheers,
/Thomas
Den 2019-02-25 kl. 17:13, skrev Antonio De Angelis via TF-M:
> Hi Thomas,
>
> As you correctly identified, the value of the EXC_RETURN is not appropriate for the state the exception was taken from. As a quick double check, you can set it manually from a debugger to 0xFFFFFFBC before the exception return takes place and in that case the exception return will happen correctly. You can find more details on the meaning of each bit of the EXC_RETURN register at the following link: https://static.docs.arm.com/100701/0100/armv8_m_processor_exception_handlin… (section 1.10).
>
> In general, once TF-M has finished booting and has jumped to the NS state, the OS initialisation should take place (you can see as an example in the NS app how the RTX kernel initialisation happens). If the OS manipulates directly the Link Register, it needs to be aware that it's running from the NS state (this can imply a build time configuration step) so that it will set up correctly the default value of the EXC_RETURN when an exception happens. You can find more details in docs/user_guides/os_migration_guide_armv8m.md .
>
> Thanks,
> Antonio
>
> -----Original Message-----
> From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of
> Thomas Törnblom via TF-M
> Sent: 25 February 2019 15:34
> To: tf-m(a)lists.trustedfirmware.org
> Subject: [TF-M] SecureFault when starting the OS
>
> In my work to port TF-M to IAR EWARM I have now gotten the MPC set up so that the startup will properly switch to the NS code.
>
> I'm now running into an issue where I get a SecureFault when attempting to start the OS.
>
> The idle and timer threads have been configured and the timer thread has been put on run.curr and SVC_Exit issues a BX LR, which results in a SecureFault.
>
> SFSR indicates that it is an INVER (Invalid Exception Return):
> ---
> Invalid exception return flag. This can be caused by EXC_RETURN.DCRS being set to 0 when returning from an exception in the Non-secure state, or by EXC_RETURN.ES being set to 1 when returning from an exception in the Non-secure state. The possible values of this bit are:
> 0 Error has not occurred.
> 1 Error has occurred.
> --
>
> LR was 0xfffffffd (DCRS=1, ES=1) and the security bit was cleared, so it appears to be the second condition that triggered the exception.
>
> What am I missing here?
>
> Is the OS supposed to be started from NS mode?
>
> I am still using the ARM.TFM.1.1.0, ARM.Musca_A1_BSP.2.0.0,
> ARM.mbedTLS.1.3.1 and ARM.CMSIS.5.5.0-dev2 packs.
>
> Thanks,
> /Thomas
>
>
> *Thomas Törnblom*, /Product Engineer/
> IAR Systems AB
> Box 23051, Strandbodgatan 1
> SE-750 23 Uppsala, SWEDEN
> Mobile: +46 76 180 17 80 Fax: +46 18 16 78 01
> E-mail: thomas.tornblom(a)iar.com <mailto:thomas.tornblom@iar.com>
> Website: www.iar.com <http://www.iar.com>
> Twitter: www.twitter.com/iarsystems
> <http://www.twitter.com/iarsystems>
> --
> TF-M mailing list
> TF-M(a)lists.trustedfirmware.org
> https://lists.trustedfirmware.org/mailman/listinfo/tf-m
> IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
--
*Thomas Törnblom*, /Product Engineer/
IAR Systems AB
Box 23051, Strandbodgatan 1
SE-750 23 Uppsala, SWEDEN
Mobile: +46 76 180 17 80 Fax: +46 18 16 78 01
E-mail: thomas.tornblom(a)iar.com <mailto:thomas.tornblom@iar.com>
Website: www.iar.com <http://www.iar.com>
Twitter: www.twitter.com/iarsystems <http://www.twitter.com/iarsystems>
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://lists.trustedfirmware.org/mailman/listinfo/tf-m
Thanks Miklos and Antonio,
You were both spot on.
Turned out I had not define DOMAIN_NS=1, which change the last byte from
FD to BC.
I need to figure out why I need to add that when the documentation says
__DOMAIN_NS=1 should be sufficient.
Cheers,
/Thomas
Den 2019-02-25 kl. 17:13, skrev Antonio De Angelis via TF-M:
> Hi Thomas,
>
> As you correctly identified, the value of the EXC_RETURN is not appropriate for the state the exception was taken from. As a quick double check, you can set it manually from a debugger to 0xFFFFFFBC before the exception return takes place and in that case the exception return will happen correctly. You can find more details on the meaning of each bit of the EXC_RETURN register at the following link: https://static.docs.arm.com/100701/0100/armv8_m_processor_exception_handlin… (section 1.10).
>
> In general, once TF-M has finished booting and has jumped to the NS state, the OS initialisation should take place (you can see as an example in the NS app how the RTX kernel initialisation happens). If the OS manipulates directly the Link Register, it needs to be aware that it's running from the NS state (this can imply a build time configuration step) so that it will set up correctly the default value of the EXC_RETURN when an exception happens. You can find more details in docs/user_guides/os_migration_guide_armv8m.md .
>
> Thanks,
> Antonio
>
> -----Original Message-----
> From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of Thomas Törnblom via TF-M
> Sent: 25 February 2019 15:34
> To: tf-m(a)lists.trustedfirmware.org
> Subject: [TF-M] SecureFault when starting the OS
>
> In my work to port TF-M to IAR EWARM I have now gotten the MPC set up so that the startup will properly switch to the NS code.
>
> I'm now running into an issue where I get a SecureFault when attempting to start the OS.
>
> The idle and timer threads have been configured and the timer thread has been put on run.curr and SVC_Exit issues a BX LR, which results in a SecureFault.
>
> SFSR indicates that it is an INVER (Invalid Exception Return):
> ---
> Invalid exception return flag. This can be caused by EXC_RETURN.DCRS being set to 0 when returning from an exception in the Non-secure state, or by EXC_RETURN.ES being set to 1 when returning from an exception in the Non-secure state. The possible values of this bit are:
> 0 Error has not occurred.
> 1 Error has occurred.
> --
>
> LR was 0xfffffffd (DCRS=1, ES=1) and the security bit was cleared, so it appears to be the second condition that triggered the exception.
>
> What am I missing here?
>
> Is the OS supposed to be started from NS mode?
>
> I am still using the ARM.TFM.1.1.0, ARM.Musca_A1_BSP.2.0.0,
> ARM.mbedTLS.1.3.1 and ARM.CMSIS.5.5.0-dev2 packs.
>
> Thanks,
> /Thomas
>
>
> *Thomas Törnblom*, /Product Engineer/
> IAR Systems AB
> Box 23051, Strandbodgatan 1
> SE-750 23 Uppsala, SWEDEN
> Mobile: +46 76 180 17 80 Fax: +46 18 16 78 01
> E-mail: thomas.tornblom(a)iar.com <mailto:thomas.tornblom@iar.com>
> Website: www.iar.com <http://www.iar.com>
> Twitter: www.twitter.com/iarsystems <http://www.twitter.com/iarsystems>
> --
> TF-M mailing list
> TF-M(a)lists.trustedfirmware.org
> https://lists.trustedfirmware.org/mailman/listinfo/tf-m
> IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
--
*Thomas Törnblom*, /Product Engineer/
IAR Systems AB
Box 23051, Strandbodgatan 1
SE-750 23 Uppsala, SWEDEN
Mobile: +46 76 180 17 80 Fax: +46 18 16 78 01
E-mail: thomas.tornblom(a)iar.com <mailto:thomas.tornblom@iar.com>
Website: www.iar.com <http://www.iar.com>
Twitter: www.twitter.com/iarsystems <http://www.twitter.com/iarsystems>
Hi Thomas,
As you correctly identified, the value of the EXC_RETURN is not appropriate for the state the exception was taken from. As a quick double check, you can set it manually from a debugger to 0xFFFFFFBC before the exception return takes place and in that case the exception return will happen correctly. You can find more details on the meaning of each bit of the EXC_RETURN register at the following link: https://static.docs.arm.com/100701/0100/armv8_m_processor_exception_handlin… (section 1.10).
In general, once TF-M has finished booting and has jumped to the NS state, the OS initialisation should take place (you can see as an example in the NS app how the RTX kernel initialisation happens). If the OS manipulates directly the Link Register, it needs to be aware that it's running from the NS state (this can imply a build time configuration step) so that it will set up correctly the default value of the EXC_RETURN when an exception happens. You can find more details in docs/user_guides/os_migration_guide_armv8m.md .
Thanks,
Antonio
-----Original Message-----
From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of Thomas Törnblom via TF-M
Sent: 25 February 2019 15:34
To: tf-m(a)lists.trustedfirmware.org
Subject: [TF-M] SecureFault when starting the OS
In my work to port TF-M to IAR EWARM I have now gotten the MPC set up so that the startup will properly switch to the NS code.
I'm now running into an issue where I get a SecureFault when attempting to start the OS.
The idle and timer threads have been configured and the timer thread has been put on run.curr and SVC_Exit issues a BX LR, which results in a SecureFault.
SFSR indicates that it is an INVER (Invalid Exception Return):
---
Invalid exception return flag. This can be caused by EXC_RETURN.DCRS being set to 0 when returning from an exception in the Non-secure state, or by EXC_RETURN.ES being set to 1 when returning from an exception in the Non-secure state. The possible values of this bit are:
0 Error has not occurred.
1 Error has occurred.
--
LR was 0xfffffffd (DCRS=1, ES=1) and the security bit was cleared, so it appears to be the second condition that triggered the exception.
What am I missing here?
Is the OS supposed to be started from NS mode?
I am still using the ARM.TFM.1.1.0, ARM.Musca_A1_BSP.2.0.0,
ARM.mbedTLS.1.3.1 and ARM.CMSIS.5.5.0-dev2 packs.
Thanks,
/Thomas
*Thomas Törnblom*, /Product Engineer/
IAR Systems AB
Box 23051, Strandbodgatan 1
SE-750 23 Uppsala, SWEDEN
Mobile: +46 76 180 17 80 Fax: +46 18 16 78 01
E-mail: thomas.tornblom(a)iar.com <mailto:thomas.tornblom@iar.com>
Website: www.iar.com <http://www.iar.com>
Twitter: www.twitter.com/iarsystems <http://www.twitter.com/iarsystems>
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://lists.trustedfirmware.org/mailman/listinfo/tf-m
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
Hi Thomas,
According to TF-M's design, an RTOS is meant to be started/run in NS.
If a non-secure SVC handler is called from thread mode (PSP, no FP, default stacking), the value of LR should be 0xFFFF_FFBC on exception entry.
In my experience some v7-M RTOS implementations don't save the EXC_RETURN value on SVC entry but have a default value hard-coded at SVC exit. In a v7-M system the default EXC_RETURN value (assuming no SVC from handlers, and PSP used for thread mode) would be 0xFFFF_FFFD as you describe below, but that's not the case for a NS RTOS in v8-M. (The two bits that are different are EXC_RETURN.S (bit [6]) to indicate NS stack, and EXC_RETURN.ES (bit [0]) to indicate that the Exception was taken to NS)
A recommended and future-proof solution is for the RTOS to save the EXC_RETURN value stored in LR on SVC entry, and when returning from the SVC, to restore that and branch, or, if a switch is needed from MSP to PSP, to set EXC_RETURN.SPSEL as needed, but leave the rest of the EXC_RETURN value unchanged.
Let me know if this helps, or please provide further details if I failed to catch the root cause.
Regards
Miklos
-----Original Message-----
From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of Thomas Törnblom via TF-M
Sent: 25 February 2019 16:34
To: tf-m(a)lists.trustedfirmware.org
Subject: [TF-M] SecureFault when starting the OS
In my work to port TF-M to IAR EWARM I have now gotten the MPC set up so that the startup will properly switch to the NS code.
I'm now running into an issue where I get a SecureFault when attempting to start the OS.
The idle and timer threads have been configured and the timer thread has been put on run.curr and SVC_Exit issues a BX LR, which results in a SecureFault.
SFSR indicates that it is an INVER (Invalid Exception Return):
---
Invalid exception return flag. This can be caused by EXC_RETURN.DCRS being set to 0 when returning from an exception in the Non-secure state, or by EXC_RETURN.ES being set to 1 when returning from an exception in the Non-secure state. The possible values of this bit are:
0 Error has not occurred.
1 Error has occurred.
--
LR was 0xfffffffd (DCRS=1, ES=1) and the security bit was cleared, so it appears to be the second condition that triggered the exception.
What am I missing here?
Is the OS supposed to be started from NS mode?
I am still using the ARM.TFM.1.1.0, ARM.Musca_A1_BSP.2.0.0,
ARM.mbedTLS.1.3.1 and ARM.CMSIS.5.5.0-dev2 packs.
Thanks,
/Thomas
*Thomas Törnblom*, /Product Engineer/
IAR Systems AB
Box 23051, Strandbodgatan 1
SE-750 23 Uppsala, SWEDEN
Mobile: +46 76 180 17 80 Fax: +46 18 16 78 01
E-mail: thomas.tornblom(a)iar.com <mailto:thomas.tornblom@iar.com>
Website: www.iar.com <http://www.iar.com>
Twitter: www.twitter.com/iarsystems <http://www.twitter.com/iarsystems>
--
TF-M mailing list
TF-M(a)lists.trustedfirmware.org
https://lists.trustedfirmware.org/mailman/listinfo/tf-m
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
In my work to port TF-M to IAR EWARM I have now gotten the MPC set up so
that the startup will properly switch to the NS code.
I'm now running into an issue where I get a SecureFault when attempting
to start the OS.
The idle and timer threads have been configured and the timer thread has
been put on run.curr and SVC_Exit issues a BX LR, which results in a
SecureFault.
SFSR indicates that it is an INVER (Invalid Exception Return):
---
Invalid exception return flag. This can be caused by EXC_RETURN.DCRS
being set to 0 when returning from
an exception in the Non-secure state, or by EXC_RETURN.ES being set to 1
when returning from an exception
in the Non-secure state. The possible values of this bit are:
0 Error has not occurred.
1 Error has occurred.
--
LR was 0xfffffffd (DCRS=1, ES=1) and the security bit was cleared, so it
appears to be the second condition that triggered the exception.
What am I missing here?
Is the OS supposed to be started from NS mode?
I am still using the ARM.TFM.1.1.0, ARM.Musca_A1_BSP.2.0.0,
ARM.mbedTLS.1.3.1 and ARM.CMSIS.5.5.0-dev2 packs.
Thanks,
/Thomas
*Thomas Törnblom*, /Product Engineer/
IAR Systems AB
Box 23051, Strandbodgatan 1
SE-750 23 Uppsala, SWEDEN
Mobile: +46 76 180 17 80 Fax: +46 18 16 78 01
E-mail: thomas.tornblom(a)iar.com <mailto:thomas.tornblom@iar.com>
Website: www.iar.com <http://www.iar.com>
Twitter: www.twitter.com/iarsystems <http://www.twitter.com/iarsystems>
Hi Danny,
Could you please check my comments on [Mailbox design](https://developer.trustedfirmware.org/w/tf_m/design/twin-cpu/mailbo… in below?
I’d like to discuss about some high-level designs at the very first time. We can discuss about details later. 😊
1. As designed in Concepts section, secure core has a single dispatcher thread, which is the main thread on the secure core.
AFAIK, there is no such main thread in current TF-M Inter-Process Communication model implementation. Do you mind taking a look at the section "Interaction in thread model" in our [TF-M presentation](https://events.linuxfoundation.org/wp-content/uploads/2017/12…
On the other hand, implementing a dedicated thread in TF-M to handling the mailbox events can be a solution. But it might also bring some difficulties in implementation. I'd like to discuss in detail with Transport Layer together.
2. I like the concept of mailbox event. One of the key points is, after the information carried via mailbox arrives in TF-M, how to deliver it to TF-M core. We can have further discussions on the details.
3. PSA Firmware Framework specifies the parameters and return value for PSA Client APIs. Do you think if it is necessary to cover the mailbox message structure containing information of parameters and return value in mailbox design?
Thank you.
Best regards,
Hu Ziji
Hi Alan,
From my point of view, TZ_StoreContext_S() indicates the non-secure thread accesses secure service
is getting switching out, no one should access secure services before a calling of TZ_LoadContext_S().
This case could be covered in below condition in PSA FF client APIs (Picked on line from page 49 of PSA FF 1.0 beta0):
"Calling psa_connect() is a fatal error and will not return if any of the following conditions are met:
* ...
* The caller is not authorized to access the RoT Service, see RoT Service access control on page 28.
* ..."
Pining the calling non-secure thread is the proper way - which means, 'Does not return' to the non-secure thread in this case.
There should be no such an API to peek the status of SPM from caller out of SPM.
And there should be a similar API for SPM (only) to retrieve the current MemoryID (or information could be represented as MemoryID).
BR
-Ken
> -----Original Message-----
> From: TF-M <tf-m-bounces(a)lists.trustedfirmware.org> On Behalf Of DeMars,
> Alan via TF-M
> Sent: Thursday, February 21, 2019 10:54 PM
> To: tf-m(a)lists.trustedfirmware.org
> Subject: [TF-M] What is the behavior of SPM between `TZ_StoreContext_S()` and
> `TZ_LoadContext_S()`
>
> Are calls to psa_connect/call/close allowed after `TZ_StoreContext_S()` has
> been called but before `TZ_LoadContext_S()` is called? If not, does that result in
> a panic or simply error return codes?
>
> Is there a secure-side SPM API that can be invoked from a custom veneer
> function to determine if the SPM is in the zone between `TZ_StoreContext_S()`
> and `TZ_LoadContext_S()`?
>
> Is there an API that returns the current MemoryId?
>
> Alan
> --
> TF-M mailing list
> TF-M(a)lists.trustedfirmware.org
> https://lists.trustedfirmware.org/mailman/listinfo/tf-m