<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>nrf9160 secure services causing a crash</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/60850/nrf9160-secure-services-causing-a-crash</link><description>I have been trying to use the secure services to read random from the CC310 and have been getting unpredictable crashes. I have been able to modify the secure_services sample code to create a crash, but it&amp;#39;s the oddest thing. The combination of CONFIG_LOG</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 01 Dec 2020 09:28:22 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/60850/nrf9160-secure-services-causing-a-crash" /><item><title>RE: nrf9160 secure services causing a crash</title><link>https://devzone.nordicsemi.com/thread/282613?ContentTypeID=1</link><pubDate>Tue, 01 Dec 2020 09:28:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d7d2d021-9a07-40c1-8b56-9624613cfcfa</guid><dc:creator>fastfox</dc:creator><description>&lt;p&gt;I got around that crash by increasing the SPM stack size. See&amp;nbsp;the whole story&amp;nbsp;from here:&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/68395/nrf9160-sdk-1-4-crash-in-random-number-generation"&gt;devzone.nordicsemi.com/.../nrf9160-sdk-1-4-crash-in-random-number-generation&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160 secure services causing a crash</title><link>https://devzone.nordicsemi.com/thread/282550?ContentTypeID=1</link><pubDate>Mon, 30 Nov 2020 20:37:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:99605a8a-1cc6-42ef-a900-5baca9acea08</guid><dc:creator>Jameson</dc:creator><description>&lt;p&gt;I am upgrading&amp;nbsp;to the v1.4 SDK and am seeing similar behavior.&amp;nbsp; I see it occur the net driver&amp;nbsp;is getting initialized (specifically sys_init_net_init0), however it ultimately&amp;nbsp;calls &amp;quot;spm_request_random_number&amp;quot; and crashes/restarts.&amp;nbsp; It then just gets stuck in a boot loop.&lt;/p&gt;
&lt;p&gt;Are there any updates on this?&amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160 secure services causing a crash</title><link>https://devzone.nordicsemi.com/thread/280062?ContentTypeID=1</link><pubDate>Mon, 16 Nov 2020 09:50:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7750ab50-f81a-4222-b88f-43174b10a82e</guid><dc:creator>fastfox</dc:creator><description>&lt;p&gt;Interestingly, my app started to crash on&amp;nbsp;spm_request_random_number(stack is generating COAP tokens) after upgrading to 1.4 SDK. Dunno yet if it is related to this or not&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160 secure services causing a crash</title><link>https://devzone.nordicsemi.com/thread/278998?ContentTypeID=1</link><pubDate>Mon, 09 Nov 2020 12:49:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5a511630-d92c-4a98-960e-e9fbe2c8ebeb</guid><dc:creator>Didrik Rokhaug</dc:creator><description>&lt;p&gt;This is the workaround I posted earlier.&lt;/p&gt;
&lt;p&gt;It should remove the problem, yes, but it doesn&amp;#39;t really solve the fundamental issue of synchronization accross the secure/non-secure boundry. It just works around it by not letting the non-secure domain do anything.&lt;/p&gt;
&lt;p&gt;There are more changes and improvements coming in the future that should make this workaround no longer necessary.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160 secure services causing a crash</title><link>https://devzone.nordicsemi.com/thread/278869?ContentTypeID=1</link><pubDate>Sat, 07 Nov 2020 01:12:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:49660c80-c1c5-4dfd-b76c-db7e22fb8df1</guid><dc:creator>miked531</dc:creator><description>&lt;p&gt;I noticed this recent commit:&amp;nbsp;&lt;a href="https://github.com/nrfconnect/sdk-nrf/commit/6efb6fd633a4ea47279943c5660239083c5bdd65"&gt;https://github.com/nrfconnect/sdk-nrf/commit/6efb6fd633a4ea47279943c5660239083c5bdd65&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Does it resolve the issue?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160 secure services causing a crash</title><link>https://devzone.nordicsemi.com/thread/271807?ContentTypeID=1</link><pubDate>Mon, 28 Sep 2020 13:35:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:05198f8a-356c-44ab-921a-642a61fbf0f1</guid><dc:creator>Didrik Rokhaug</dc:creator><description>&lt;p&gt;A workaround is scheduled to be part of the next NCS release.&lt;/p&gt;
&lt;p&gt;The workaroud is dependent on some changes made in Zephyr, so the developers are currently waiting for the next upmerge to complete.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160 secure services causing a crash</title><link>https://devzone.nordicsemi.com/thread/271638?ContentTypeID=1</link><pubDate>Mon, 28 Sep 2020 00:18:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fdf43887-a031-4afa-872d-cabc4a4d66d0</guid><dc:creator>miked531</dc:creator><description>&lt;p&gt;Is there any update on this?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160 secure services causing a crash</title><link>https://devzone.nordicsemi.com/thread/262698?ContentTypeID=1</link><pubDate>Mon, 03 Aug 2020 07:04:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:98de5c46-a042-4cea-9b74-14ed3306b960</guid><dc:creator>Didrik Rokhaug</dc:creator><description>[quote user="miked531"]I looked at the PR and it doesn&amp;#39;t seem to be progressing at the moment.[/quote]
&lt;p&gt;&amp;nbsp;We are just coming out of the summer vacation period here in Norway, so the lack of progress might be due to low staffing during the vacation.&lt;/p&gt;
&lt;p&gt;As for when the solution will be available in an NCS release, I can not really give you an answer.&lt;/p&gt;
&lt;p&gt;Hopefully, it will be a part of the next release. Although it could also take longer, I will let you know if the developers have an estimate.&lt;/p&gt;
&lt;p&gt;Anyway, I have asked the developers for a status update.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160 secure services causing a crash</title><link>https://devzone.nordicsemi.com/thread/262616?ContentTypeID=1</link><pubDate>Fri, 31 Jul 2020 16:09:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b5f13883-0c19-49e6-9f99-6f60c36cfaee</guid><dc:creator>miked531</dc:creator><description>&lt;p&gt;I looked at the PR and it doesn&amp;#39;t seem to be progressing at the moment. Is this still the intended way to resolve this? Actually my real question is when will a solution be available in a NCS SDK release?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160 secure services causing a crash</title><link>https://devzone.nordicsemi.com/thread/256747?ContentTypeID=1</link><pubDate>Wed, 24 Jun 2020 14:47:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:468aa193-ad6e-43e9-a186-64bd43f0d7c6</guid><dc:creator>Didrik Rokhaug</dc:creator><description>&lt;p&gt;There is also a more complete proposal for a solution: &lt;a href="https://github.com/zephyrproject-rtos/zephyr/pull/26414"&gt;https://github.com/zephyrproject-rtos/zephyr/pull/26414&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160 secure services causing a crash</title><link>https://devzone.nordicsemi.com/thread/256417?ContentTypeID=1</link><pubDate>Tue, 23 Jun 2020 11:46:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1c36be0e-c50e-4a6c-9846-d2fd41ad30d2</guid><dc:creator>Didrik Rokhaug</dc:creator><description>&lt;p&gt;Hi.&lt;/p&gt;
&lt;p&gt;A PR with a workaround has been opened: &lt;a href="https://github.com/nrfconnect/sdk-nrf/pull/2519/files"&gt;https://github.com/nrfconnect/sdk-nrf/pull/2519/files&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Didrik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160 secure services causing a crash</title><link>https://devzone.nordicsemi.com/thread/253015?ContentTypeID=1</link><pubDate>Wed, 03 Jun 2020 12:58:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4bdec36a-1826-4214-8971-29df1eea0d21</guid><dc:creator>Didrik Rokhaug</dc:creator><description>&lt;p&gt;Hi again.&lt;/p&gt;
&lt;p&gt;There has been some further progress in finding the root cause, but it does not look like there is an easy fix, so it will probably take some time until it is properly fixed.&lt;/p&gt;
&lt;p&gt;Here is an explanation of what probably happens, given by one of our developers:&lt;/p&gt;
&lt;p&gt;&amp;quot;Short story: if a Zephyr thread context-switch occurs while doing a Secure call, the Zephyr kernel may crash.&lt;/p&gt;
&lt;p&gt;Elaboration:&lt;/p&gt;
&lt;p&gt;This might, actually, be happening in the scenario reported in this issue: I believe, so, because it seems the secure service takes some time to finish, so an NSPE Zephyr system time may fire, in the mean time, and lead to a thread re-schedule point.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;When in a regular function call, the Zephyr Cortex-M swap logic (running in PendSV IRQ, possibly tail-chained from a higher priority IRQ context) will simply stack the current execution context into the thread&amp;#39;s stack, tweak PSP, and eventually return into the new thread&amp;#39;s execution context, using that thread&amp;#39;s stack(ed) information.&lt;/p&gt;
&lt;p&gt;When in a Secure function call, however, things are not as simple as the above scenario. The swap logic will still change the NSPE context, but it will return to the SPE to finish the secure service. When the secure service is complete, the TrustZone logic will attempt to branch to the NSPE (most likely using BXNS LR instruction), however, since the NSPE context has changed, the service call is not returning to the context it was called from.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;This bug, may be causing system crashes (possibly such as the one we are currently observing here), but is, also a direct Security violation, since secure service result is exposed to a NSPE context other than the caller.&amp;quot;&lt;/p&gt;
&lt;p&gt;We are looking into what is the best way to ensure that a secure call always returns to the caller.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Didrik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160 secure services causing a crash</title><link>https://devzone.nordicsemi.com/thread/250111?ContentTypeID=1</link><pubDate>Fri, 15 May 2020 08:30:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:03e42bc3-352a-476b-b8c4-f0f19672bb21</guid><dc:creator>Didrik Rokhaug</dc:creator><description>&lt;p&gt;Hi.&lt;/p&gt;
&lt;p&gt;A quick update:&lt;/p&gt;
&lt;p&gt;The error does not seem to be linked to the buttons library in particular, but to the workqueue.&lt;/p&gt;
&lt;p&gt;It seems the workqueue thread is not allowed to run when the timeout happens while in secure mode, and consequently an error happens once the main thread is unloaded.&lt;/p&gt;
&lt;p&gt;We are investigating ways to solve this.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160 secure services causing a crash</title><link>https://devzone.nordicsemi.com/thread/248771?ContentTypeID=1</link><pubDate>Thu, 07 May 2020 14:41:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f4975e25-d736-4291-84fb-f3bf8af637be</guid><dc:creator>Didrik Rokhaug</dc:creator><description>&lt;p&gt;Hi again.&lt;/p&gt;
&lt;p&gt;I have found another way of avoiding the crash: changing the system workqueue&amp;#39;s priority to a positive priority (e.g. 1).&lt;/p&gt;
&lt;p&gt;The changes the system workqueue thread from a cooperative one to a preemptible one. That allows other threads (with higher priorities) to interrupt the system workqueue.&lt;/p&gt;
&lt;p&gt;You can read more here: &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/reference/kernel/threads/index.html#thread-priorities"&gt;https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/reference/kernel/threads/index.html#thread-priorities&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;However, I have not been able to find the root cause of the crash. I will continue to investigate together with the SDK team.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Didrik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160 secure services causing a crash</title><link>https://devzone.nordicsemi.com/thread/247639?ContentTypeID=1</link><pubDate>Thu, 30 Apr 2020 17:44:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:81dc3bce-266d-4807-b25e-cc994eec6008</guid><dc:creator>miked531</dc:creator><description>&lt;p&gt;I&amp;#39;m glad you see it too. I looked into it a little bit and it seemed to be related to the button_scan_fn or maybe zephyr&amp;#39;s handling of the workq, but that&amp;#39;s as far as I got.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160 secure services causing a crash</title><link>https://devzone.nordicsemi.com/thread/247620?ContentTypeID=1</link><pubDate>Thu, 30 Apr 2020 15:12:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1a677063-5daf-41ea-99af-5cf5bfa2d6ed</guid><dc:creator>Didrik Rokhaug</dc:creator><description>&lt;p&gt;Hi.&lt;/p&gt;
&lt;p&gt;What an interesting problem you have found.&lt;/p&gt;
&lt;p&gt;I have done some testing myself, and the fault only happens if the buttons are initialized. Logging does not matter, other than for printing the fault message.&lt;/p&gt;
&lt;p&gt;It also only happens when we try to get random numbers and not any of the other secure services.&lt;/p&gt;
&lt;p&gt;Based on your comment regarding the scan interval, I expect it is a race condition related to the transition between the secure and non-secure domains.&lt;/p&gt;
&lt;p&gt;However, I will have do look deeper into it next week to be able to pinpoint the cause of the problem.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Didrik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160 secure services causing a crash</title><link>https://devzone.nordicsemi.com/thread/247420?ContentTypeID=1</link><pubDate>Wed, 29 Apr 2020 20:12:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bd96589c-8bf1-4507-9b24-250ce99c0684</guid><dc:creator>miked531</dc:creator><description>&lt;p&gt;The behavior changes to &amp;quot;working&amp;quot; by increasing CONFIG_DK_LIBRARY_BUTTON_SCAN_INTERVAL in prj.conf from the default of 10 to 100. I can&amp;#39;t even come up with an explanation for this&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>