Hey,
While trying to debug a crash in the TF-M regression tests, I noticed that the msplim_ns register is set to 0x0, leaving the non-secure application without any stack to protection, sadly I wasn't able to figure out how to enable the stack protection, which would be nice as we suspect that a stack overflow could cause the crash.
Therefore, I would be interested if it possible to enable stack protection for the non-secure application of the TF-M regression tests and if so, how?
Thanks for the help
Markus Swarowsky | R & D Engineer M +47 404 66 922 | Trondheim, Norway
nordicsemi.comhttps://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.nordicsemi.com%2F&data=02%7C01%7CMarkus.Swarowsky%40nordicsemi.no%7C0d3ed81ea8d74110a3a508d870161ca3%7C28e5afa2bf6f419a8cf6b31c6e9e5e8d%7C0%7C0%7C637382587611052308&sdata=SSGYnGE11tg135jAt2TSrFxSSML7w04BMDyQfFyNtSQ%3D&reserved=0 | devzone.nordicsemi.comhttps://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdevzone.nordicsemi.com%2F&data=02%7C01%7CMarkus.Swarowsky%40nordicsemi.no%7C0d3ed81ea8d74110a3a508d870161ca3%7C28e5afa2bf6f419a8cf6b31c6e9e5e8d%7C0%7C0%7C637382587611062262&sdata=NEZ5ZZ5egKR%2Fht4XJf8Ki64pt7cJlCFbOhrSZF4TKWE%3D&reserved=0
Facebookhttps://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.facebook.com%2Fnordicsemiconductor%2F&data=02%7C01%7CMarkus.Swarowsky%40nordicsemi.no%7C0d3ed81ea8d74110a3a508d870161ca3%7C28e5afa2bf6f419a8cf6b31c6e9e5e8d%7C0%7C0%7C637382587611062262&sdata=bdgQcyQRea%2FPxNh5V9ZXky4UMh0rzvaY6GXBm2xf2OU%3D&reserved=0 | LinkedInhttps://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.linkedin.com%2Fcompany%2Fnordic-semiconductor-asa%2F&data=02%7C01%7CMarkus.Swarowsky%40nordicsemi.no%7C0d3ed81ea8d74110a3a508d870161ca3%7C28e5afa2bf6f419a8cf6b31c6e9e5e8d%7C0%7C0%7C637382587611072222&sdata=tLELG6wRrmCwsnmCSBAmsy3%2FJPQnxqzn5ImF8e%2B10YM%3D&reserved=0 | Twitterhttps://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Ftwitter.com%2FNordicTweets&data=02%7C01%7CMarkus.Swarowsky%40nordicsemi.no%7C0d3ed81ea8d74110a3a508d870161ca3%7C28e5afa2bf6f419a8cf6b31c6e9e5e8d%7C0%7C0%7C637382587611072222&sdata=%2B3iQhVA4AZLTfuF48Ma5VtngCFdFshENkZA1tImWkME%3D&reserved=0 | YouTubehttps://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.youtube.com%2Fuser%2FNordicSemi&data=02%7C01%7CMarkus.Swarowsky%40nordicsemi.no%7C0d3ed81ea8d74110a3a508d870161ca3%7C28e5afa2bf6f419a8cf6b31c6e9e5e8d%7C0%7C0%7C637382587611082178&sdata=Oq8zPCmpXUdsEc6kzO5bPLmgKchSb%2FCQ1JQnKKhHdow%3D&reserved=0 | Instagramhttps://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.instagram.com%2Fnordicsemi%2F&data=02%7C01%7CMarkus.Swarowsky%40nordicsemi.no%7C0d3ed81ea8d74110a3a508d870161ca3%7C28e5afa2bf6f419a8cf6b31c6e9e5e8d%7C0%7C0%7C637382587611082178&sdata=cK9gyH%2FckFKv73hY8yj1Rz8SwV8lWw5YGw8rf2jYDyU%3D&reserved=0
Can anyone confirm or deny if enabling stack protection in the TF-M non-secure application is possible?
-Joakim Andersson
From: Swarowsky, Markus via TF-M tf-m@lists.trustedfirmware.org Sent: torsdag 29. september 2022 16:49 To: tf-m@lists.trustedfirmware.org Subject: [TF-M] Enable stack protection in the regression tests
Hey,
While trying to debug a crash in the TF-M regression tests, I noticed that the msplim_ns register is set to 0x0, leaving the non-secure application without any stack to protection, sadly I wasn't able to figure out how to enable the stack protection, which would be nice as we suspect that a stack overflow could cause the crash. Therefore, I would be interested if it possible to enable stack protection for the non-secure application of the TF-M regression tests and if so, how?
Thanks for the help
Markus Swarowsky | R & D Engineer M +47 404 66 922 | Trondheim, Norway
nordicsemi.comhttps://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.nordicsemi.com%2F&data=05%7C01%7Cjoakim.andersson%40nordicsemi.no%7Cf3bbf759a0944aee84c008daa229dc99%7C28e5afa2bf6f419a8cf6b31c6e9e5e8d%7C0%7C0%7C638000597935670404%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=cjEy%2B2nt0mMS1h61fceYkii5p2vvRclKPTpdEOKMUI8%3D&reserved=0 | devzone.nordicsemi.comhttps://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdevzone.nordicsemi.com%2F&data=05%7C01%7Cjoakim.andersson%40nordicsemi.no%7Cf3bbf759a0944aee84c008daa229dc99%7C28e5afa2bf6f419a8cf6b31c6e9e5e8d%7C0%7C0%7C638000597935670404%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=KooLpBIV9sHnNz97nMpRCJBpRGmxQBZlP6aowDYxvhY%3D&reserved=0
Facebookhttps://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.facebook.com%2Fnordicsemiconductor%2F&data=05%7C01%7Cjoakim.andersson%40nordicsemi.no%7Cf3bbf759a0944aee84c008daa229dc99%7C28e5afa2bf6f419a8cf6b31c6e9e5e8d%7C0%7C0%7C638000597935670404%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=lsxrNyWp%2FYBofEH27iQuH1ZSttvbRnWL9OUvkottXY0%3D&reserved=0 | LinkedInhttps://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.linkedin.com%2Fcompany%2Fnordic-semiconductor-asa%2F&data=05%7C01%7Cjoakim.andersson%40nordicsemi.no%7Cf3bbf759a0944aee84c008daa229dc99%7C28e5afa2bf6f419a8cf6b31c6e9e5e8d%7C0%7C0%7C638000597935670404%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=sC4n6zQ3u%2BEcEkI9tWrPoWTgRBDMqJwg1dWf0Dhr2TE%3D&reserved=0 | Twitterhttps://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Ftwitter.com%2FNordicTweets&data=05%7C01%7Cjoakim.andersson%40nordicsemi.no%7Cf3bbf759a0944aee84c008daa229dc99%7C28e5afa2bf6f419a8cf6b31c6e9e5e8d%7C0%7C0%7C638000597935670404%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=Sryoe58Kv%2BVVl8wofjW0%2FFhQYPCmuOZZe4A5%2BJXgFUg%3D&reserved=0 | YouTubehttps://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.youtube.com%2Fuser%2FNordicSemi&data=05%7C01%7Cjoakim.andersson%40nordicsemi.no%7Cf3bbf759a0944aee84c008daa229dc99%7C28e5afa2bf6f419a8cf6b31c6e9e5e8d%7C0%7C0%7C638000597935670404%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=qmvmjh1x6zg0cYf17CHj4%2FEwUu3mzSMjUd11P14AtS4%3D&reserved=0 | Instagramhttps://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.instagram.com%2Fnordicsemi%2F&data=05%7C01%7Cjoakim.andersson%40nordicsemi.no%7Cf3bbf759a0944aee84c008daa229dc99%7C28e5afa2bf6f419a8cf6b31c6e9e5e8d%7C0%7C0%7C638000597935826630%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=tfc1C5D31Hurf1PcDAtIGOlkTtQTqdzjTDdqfbW4X5s%3D&reserved=0
Hi Markus, Joakim,
Apologize for the slow reply. TF-M core experts are having national holiday this week and will back to you next week. Meanwhile, could you give a bit more details on the scenario you consider? Is it NS stack overflow problem but not a security breach, mitigated by stack sealing on S side?
Thanks, Anton
From: Andersson, Joakim via TF-M tf-m@lists.trustedfirmware.org Sent: Wednesday, October 5, 2022 8:36 AM To: Swarowsky, Markus Markus.Swarowsky@nordicsemi.no; tf-m@lists.trustedfirmware.org Subject: [TF-M] Re: Enable stack protection in the regression tests
Can anyone confirm or deny if enabling stack protection in the TF-M non-secure application is possible?
-Joakim Andersson
From: Swarowsky, Markus via TF-M <tf-m@lists.trustedfirmware.orgmailto:tf-m@lists.trustedfirmware.org> Sent: torsdag 29. september 2022 16:49 To: tf-m@lists.trustedfirmware.orgmailto:tf-m@lists.trustedfirmware.org Subject: [TF-M] Enable stack protection in the regression tests
Hey,
While trying to debug a crash in the TF-M regression tests, I noticed that the msplim_ns register is set to 0x0, leaving the non-secure application without any stack to protection, sadly I wasn't able to figure out how to enable the stack protection, which would be nice as we suspect that a stack overflow could cause the crash. Therefore, I would be interested if it possible to enable stack protection for the non-secure application of the TF-M regression tests and if so, how?
Thanks for the help
Markus Swarowsky | R & D Engineer M +47 404 66 922 | Trondheim, Norway
nordicsemi.comhttps://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.nordicsemi.com%2F&data=05%7C01%7Cjoakim.andersson%40nordicsemi.no%7Cf3bbf759a0944aee84c008daa229dc99%7C28e5afa2bf6f419a8cf6b31c6e9e5e8d%7C0%7C0%7C638000597935670404%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=cjEy%2B2nt0mMS1h61fceYkii5p2vvRclKPTpdEOKMUI8%3D&reserved=0 | devzone.nordicsemi.comhttps://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdevzone.nordicsemi.com%2F&data=05%7C01%7Cjoakim.andersson%40nordicsemi.no%7Cf3bbf759a0944aee84c008daa229dc99%7C28e5afa2bf6f419a8cf6b31c6e9e5e8d%7C0%7C0%7C638000597935670404%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=KooLpBIV9sHnNz97nMpRCJBpRGmxQBZlP6aowDYxvhY%3D&reserved=0
Facebookhttps://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.facebook.com%2Fnordicsemiconductor%2F&data=05%7C01%7Cjoakim.andersson%40nordicsemi.no%7Cf3bbf759a0944aee84c008daa229dc99%7C28e5afa2bf6f419a8cf6b31c6e9e5e8d%7C0%7C0%7C638000597935670404%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=lsxrNyWp%2FYBofEH27iQuH1ZSttvbRnWL9OUvkottXY0%3D&reserved=0 | LinkedInhttps://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.linkedin.com%2Fcompany%2Fnordic-semiconductor-asa%2F&data=05%7C01%7Cjoakim.andersson%40nordicsemi.no%7Cf3bbf759a0944aee84c008daa229dc99%7C28e5afa2bf6f419a8cf6b31c6e9e5e8d%7C0%7C0%7C638000597935670404%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=sC4n6zQ3u%2BEcEkI9tWrPoWTgRBDMqJwg1dWf0Dhr2TE%3D&reserved=0 | Twitterhttps://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Ftwitter.com%2FNordicTweets&data=05%7C01%7Cjoakim.andersson%40nordicsemi.no%7Cf3bbf759a0944aee84c008daa229dc99%7C28e5afa2bf6f419a8cf6b31c6e9e5e8d%7C0%7C0%7C638000597935670404%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=Sryoe58Kv%2BVVl8wofjW0%2FFhQYPCmuOZZe4A5%2BJXgFUg%3D&reserved=0 | YouTubehttps://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.youtube.com%2Fuser%2FNordicSemi&data=05%7C01%7Cjoakim.andersson%40nordicsemi.no%7Cf3bbf759a0944aee84c008daa229dc99%7C28e5afa2bf6f419a8cf6b31c6e9e5e8d%7C0%7C0%7C638000597935670404%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=qmvmjh1x6zg0cYf17CHj4%2FEwUu3mzSMjUd11P14AtS4%3D&reserved=0 | Instagramhttps://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.instagram.com%2Fnordicsemi%2F&data=05%7C01%7Cjoakim.andersson%40nordicsemi.no%7Cf3bbf759a0944aee84c008daa229dc99%7C28e5afa2bf6f419a8cf6b31c6e9e5e8d%7C0%7C0%7C638000597935826630%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=tfc1C5D31Hurf1PcDAtIGOlkTtQTqdzjTDdqfbW4X5s%3D&reserved=0
Hi,
Currently TF-M tests or the reference NS app don't set the MSPLIM, but I think that it wouldn't be a big change to implement that.
You could use CMSIS-CORE and in particular __set_MSPLIM(uint32_t MainStackPtrLimit), where the value of MainStackPtrLimit could be platform-dependent. You could call this function from the NS main, before triggering the test threads. CMSIS-CORE reference is here: Core Register Access (keil.com)https://www.keil.com/pack/doc/CMSIS/Core/html/group__Core__Register__gr.html#ga6809a07c5cb7410e361f3fba57f72172
Thanks, Antonio
From: Andersson, Joakim via TF-M tf-m@lists.trustedfirmware.org Sent: Wednesday, October 5, 2022 08:36 To: Swarowsky, Markus Markus.Swarowsky@nordicsemi.no; tf-m@lists.trustedfirmware.org Subject: [TF-M] Re: Enable stack protection in the regression tests
Can anyone confirm or deny if enabling stack protection in the TF-M non-secure application is possible?
-Joakim Andersson
From: Swarowsky, Markus via TF-M <tf-m@lists.trustedfirmware.orgmailto:tf-m@lists.trustedfirmware.org> Sent: torsdag 29. september 2022 16:49 To: tf-m@lists.trustedfirmware.orgmailto:tf-m@lists.trustedfirmware.org Subject: [TF-M] Enable stack protection in the regression tests
Hey,
While trying to debug a crash in the TF-M regression tests, I noticed that the msplim_ns register is set to 0x0, leaving the non-secure application without any stack to protection, sadly I wasn't able to figure out how to enable the stack protection, which would be nice as we suspect that a stack overflow could cause the crash. Therefore, I would be interested if it possible to enable stack protection for the non-secure application of the TF-M regression tests and if so, how?
Thanks for the help
Markus Swarowsky | R & D Engineer M +47 404 66 922 | Trondheim, Norway
nordicsemi.comhttps://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.nordicsemi.com%2F&data=05%7C01%7Cjoakim.andersson%40nordicsemi.no%7Cf3bbf759a0944aee84c008daa229dc99%7C28e5afa2bf6f419a8cf6b31c6e9e5e8d%7C0%7C0%7C638000597935670404%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=cjEy%2B2nt0mMS1h61fceYkii5p2vvRclKPTpdEOKMUI8%3D&reserved=0 | devzone.nordicsemi.comhttps://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdevzone.nordicsemi.com%2F&data=05%7C01%7Cjoakim.andersson%40nordicsemi.no%7Cf3bbf759a0944aee84c008daa229dc99%7C28e5afa2bf6f419a8cf6b31c6e9e5e8d%7C0%7C0%7C638000597935670404%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=KooLpBIV9sHnNz97nMpRCJBpRGmxQBZlP6aowDYxvhY%3D&reserved=0
Facebookhttps://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.facebook.com%2Fnordicsemiconductor%2F&data=05%7C01%7Cjoakim.andersson%40nordicsemi.no%7Cf3bbf759a0944aee84c008daa229dc99%7C28e5afa2bf6f419a8cf6b31c6e9e5e8d%7C0%7C0%7C638000597935670404%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=lsxrNyWp%2FYBofEH27iQuH1ZSttvbRnWL9OUvkottXY0%3D&reserved=0 | LinkedInhttps://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.linkedin.com%2Fcompany%2Fnordic-semiconductor-asa%2F&data=05%7C01%7Cjoakim.andersson%40nordicsemi.no%7Cf3bbf759a0944aee84c008daa229dc99%7C28e5afa2bf6f419a8cf6b31c6e9e5e8d%7C0%7C0%7C638000597935670404%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=sC4n6zQ3u%2BEcEkI9tWrPoWTgRBDMqJwg1dWf0Dhr2TE%3D&reserved=0 | Twitterhttps://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Ftwitter.com%2FNordicTweets&data=05%7C01%7Cjoakim.andersson%40nordicsemi.no%7Cf3bbf759a0944aee84c008daa229dc99%7C28e5afa2bf6f419a8cf6b31c6e9e5e8d%7C0%7C0%7C638000597935670404%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=Sryoe58Kv%2BVVl8wofjW0%2FFhQYPCmuOZZe4A5%2BJXgFUg%3D&reserved=0 | YouTubehttps://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.youtube.com%2Fuser%2FNordicSemi&data=05%7C01%7Cjoakim.andersson%40nordicsemi.no%7Cf3bbf759a0944aee84c008daa229dc99%7C28e5afa2bf6f419a8cf6b31c6e9e5e8d%7C0%7C0%7C638000597935670404%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=qmvmjh1x6zg0cYf17CHj4%2FEwUu3mzSMjUd11P14AtS4%3D&reserved=0 | Instagramhttps://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.instagram.com%2Fnordicsemi%2F&data=05%7C01%7Cjoakim.andersson%40nordicsemi.no%7Cf3bbf759a0944aee84c008daa229dc99%7C28e5afa2bf6f419a8cf6b31c6e9e5e8d%7C0%7C0%7C638000597935826630%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=tfc1C5D31Hurf1PcDAtIGOlkTtQTqdzjTDdqfbW4X5s%3D&reserved=0
Hi,
I'm working on a change, which is solve your problem, please check: https://review.trustedfirmware.org/c/TF-M/trusted-firmware-m/+/16356/2 In the updated startup files psp, psplim and msplim are set to the main stack top and bottom. This formula is coming from the official CMSIS repo, for the M55 core please check: https://github.com/ARM-software/CMSIS_5/blob/5.9.0/Device/ARM/ARMCM55/Source...
David
From: Antonio De Angelis via TF-M tf-m@lists.trustedfirmware.org Sent: 05 October 2022 14:31 To: tf-m@lists.trustedfirmware.org Subject: [TF-M] Re: Enable stack protection in the regression tests
Hi,
Currently TF-M tests or the reference NS app don't set the MSPLIM, but I think that it wouldn't be a big change to implement that.
You could use CMSIS-CORE and in particular __set_MSPLIM(uint32_t MainStackPtrLimit), where the value of MainStackPtrLimit could be platform-dependent. You could call this function from the NS main, before triggering the test threads. CMSIS-CORE reference is here: Core Register Access (keil.com)https://www.keil.com/pack/doc/CMSIS/Core/html/group__Core__Register__gr.html#ga6809a07c5cb7410e361f3fba57f72172
Thanks, Antonio
From: Andersson, Joakim via TF-M <tf-m@lists.trustedfirmware.orgmailto:tf-m@lists.trustedfirmware.org> Sent: Wednesday, October 5, 2022 08:36 To: Swarowsky, Markus <Markus.Swarowsky@nordicsemi.nomailto:Markus.Swarowsky@nordicsemi.no>; tf-m@lists.trustedfirmware.orgmailto:tf-m@lists.trustedfirmware.org Subject: [TF-M] Re: Enable stack protection in the regression tests
Can anyone confirm or deny if enabling stack protection in the TF-M non-secure application is possible?
-Joakim Andersson
From: Swarowsky, Markus via TF-M <tf-m@lists.trustedfirmware.orgmailto:tf-m@lists.trustedfirmware.org> Sent: torsdag 29. september 2022 16:49 To: tf-m@lists.trustedfirmware.orgmailto:tf-m@lists.trustedfirmware.org Subject: [TF-M] Enable stack protection in the regression tests
Hey,
While trying to debug a crash in the TF-M regression tests, I noticed that the msplim_ns register is set to 0x0, leaving the non-secure application without any stack to protection, sadly I wasn't able to figure out how to enable the stack protection, which would be nice as we suspect that a stack overflow could cause the crash. Therefore, I would be interested if it possible to enable stack protection for the non-secure application of the TF-M regression tests and if so, how?
Thanks for the help
Markus Swarowsky | R & D Engineer M +47 404 66 922 | Trondheim, Norway
nordicsemi.comhttps://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.nordicsemi.com%2F&data=05%7C01%7Cjoakim.andersson%40nordicsemi.no%7Cf3bbf759a0944aee84c008daa229dc99%7C28e5afa2bf6f419a8cf6b31c6e9e5e8d%7C0%7C0%7C638000597935670404%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=cjEy%2B2nt0mMS1h61fceYkii5p2vvRclKPTpdEOKMUI8%3D&reserved=0 | devzone.nordicsemi.comhttps://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdevzone.nordicsemi.com%2F&data=05%7C01%7Cjoakim.andersson%40nordicsemi.no%7Cf3bbf759a0944aee84c008daa229dc99%7C28e5afa2bf6f419a8cf6b31c6e9e5e8d%7C0%7C0%7C638000597935670404%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=KooLpBIV9sHnNz97nMpRCJBpRGmxQBZlP6aowDYxvhY%3D&reserved=0
Facebookhttps://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.facebook.com%2Fnordicsemiconductor%2F&data=05%7C01%7Cjoakim.andersson%40nordicsemi.no%7Cf3bbf759a0944aee84c008daa229dc99%7C28e5afa2bf6f419a8cf6b31c6e9e5e8d%7C0%7C0%7C638000597935670404%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=lsxrNyWp%2FYBofEH27iQuH1ZSttvbRnWL9OUvkottXY0%3D&reserved=0 | LinkedInhttps://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.linkedin.com%2Fcompany%2Fnordic-semiconductor-asa%2F&data=05%7C01%7Cjoakim.andersson%40nordicsemi.no%7Cf3bbf759a0944aee84c008daa229dc99%7C28e5afa2bf6f419a8cf6b31c6e9e5e8d%7C0%7C0%7C638000597935670404%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=sC4n6zQ3u%2BEcEkI9tWrPoWTgRBDMqJwg1dWf0Dhr2TE%3D&reserved=0 | Twitterhttps://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Ftwitter.com%2FNordicTweets&data=05%7C01%7Cjoakim.andersson%40nordicsemi.no%7Cf3bbf759a0944aee84c008daa229dc99%7C28e5afa2bf6f419a8cf6b31c6e9e5e8d%7C0%7C0%7C638000597935670404%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=Sryoe58Kv%2BVVl8wofjW0%2FFhQYPCmuOZZe4A5%2BJXgFUg%3D&reserved=0 | YouTubehttps://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.youtube.com%2Fuser%2FNordicSemi&data=05%7C01%7Cjoakim.andersson%40nordicsemi.no%7Cf3bbf759a0944aee84c008daa229dc99%7C28e5afa2bf6f419a8cf6b31c6e9e5e8d%7C0%7C0%7C638000597935670404%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=qmvmjh1x6zg0cYf17CHj4%2FEwUu3mzSMjUd11P14AtS4%3D&reserved=0 | Instagramhttps://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.instagram.com%2Fnordicsemi%2F&data=05%7C01%7Cjoakim.andersson%40nordicsemi.no%7Cf3bbf759a0944aee84c008daa229dc99%7C28e5afa2bf6f419a8cf6b31c6e9e5e8d%7C0%7C0%7C638000597935826630%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=tfc1C5D31Hurf1PcDAtIGOlkTtQTqdzjTDdqfbW4X5s%3D&reserved=0
tf-m@lists.trustedfirmware.org