<div dir="ltr"><div dir="ltr">Hi Mathew,<div><br></div><div>Yes. I reworked the 4.10 priority inheritance mechanism in late 2018, post 4.10.2. The changes should go into 4.10.3 if that gets cut. With the 4.10 head using the reworked priority inheritance, there is a NULL pointer access in case of using priority discipline but non-priority-inheritance mutexes.</div><div><br></div><div>The 4.11 and 5.x branches reworked PIP in different ways.</div><div><br></div><div>Gedare</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jan 2, 2020 at 4:27 PM Mathew Benson <<a href="mailto:mbenson@windhoverlabs.com">mbenson@windhoverlabs.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>This piqued my interest due to an issue we ran into several months ago.  Just so I can better understand this, what is "PIP"?  Are you referring to maybe Priority Inversion Protection?</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jan 2, 2020 at 5:25 PM Gedare Bloom <<a href="mailto:gedare@rtems.org" target="_blank">gedare@rtems.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">The PIP modifications from #3359 introduced new data structures<br>
to track priority inheritance. Prioritized mutexes without PIP<br>
share some of the code paths, and may result in NULL pointer<br>
accesses. This patch checks for NULL, and also adds ISR critical<br>
sections to an uncovered corner case during thread restarts.<br>
<br>
Closes #3829.<br>
---<br>
 cpukit/score/src/threadqextractpriority.c | 4 +++-<br>
 cpukit/score/src/threadreset.c            | 5 +++++<br>
 2 files changed, 8 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/cpukit/score/src/threadqextractpriority.c b/cpukit/score/src/threadqextractpriority.c<br>
index 5c8188d661..9288d17980 100644<br>
--- a/cpukit/score/src/threadqextractpriority.c<br>
+++ b/cpukit/score/src/threadqextractpriority.c<br>
@@ -109,7 +109,9 @@ bool _Thread_queue_Extract_priority_helper(<br>
   }<br>
<br>
   mutex = _Thread_Dequeue_priority_node( &the_thread->Priority_node );<br>
-  _Thread_Evaluate_priority( mutex->holder );<br>
+  if ( mutex != NULL ) {<br>
+    _Thread_Evaluate_priority( mutex->holder );<br>
+  }<br>
<br>
   if ( !_Watchdog_Is_active( &the_thread->Timer ) ) {<br>
     _ISR_Enable( level );<br>
diff --git a/cpukit/score/src/threadreset.c b/cpukit/score/src/threadreset.c<br>
index 464a611391..dfc85c93aa 100644<br>
--- a/cpukit/score/src/threadreset.c<br>
+++ b/cpukit/score/src/threadreset.c<br>
@@ -48,6 +48,7 @@ void _Thread_Reset(<br>
 )<br>
 {<br>
   CORE_mutex_Control *mutex;<br>
+  ISR_Level              level;<br>
<br>
   the_thread->resource_count   = 0;<br>
   #if defined(RTEMS_ITRON_API)<br>
@@ -66,17 +67,21 @@ void _Thread_Reset(<br>
       (void) _Watchdog_Remove( &the_thread->Timer );<br>
   }<br>
<br>
+  _ISR_Disable( level );<br>
   if ( the_thread->Priority_node.waiting_to_hold != NULL ) {<br>
     mutex = _Thread_Dequeue_priority_node( &the_thread->Priority_node );<br>
     _Thread_Evaluate_priority( mutex->holder );<br>
   }<br>
+  _ISR_Enable( level );<br>
<br>
   while ( !_Chain_Is_empty( &the_thread->Priority_node.Inherited_priorities ) ) {<br>
+    _ISR_Disable( level );<br>
     _Thread_Dequeue_priority_node(<br>
       ((Thread_Priority_node*)_Chain_First(<br>
         &the_thread->Priority_node.Inherited_priorities<br>
       ))<br>
     );<br>
+    _ISR_Enable( level );<br>
   }<br>
<br>
   if ( the_thread->Priority_node.current_priority != the_thread->Start.initial_priority ) {<br>
-- <br>
2.17.1<br>
<br>
_______________________________________________<br>
devel mailing list<br>
<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a><br>
<a href="http://lists.rtems.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.rtems.org/mailman/listinfo/devel</a><br>
</blockquote></div><br clear="all"><br>-- <br><div dir="ltr"><div dir="ltr"><div><div dir="ltr"><div><div><div><b>Mathew Benson</b><br></div>CEO | Chief Engineer<br></div>Windhover Labs, LLC<br>832-640-4018<br><br><img src="https://drive.google.com/a/windhoverlabs.com/uc?id=1cLDczWESrU667xKgEJlFhHa2yjq5UVhJ&export=download"><br></div><a href="http://www.windhoverlabs.com" target="_blank">www.windhoverlabs.com</a><br><br></div></div></div></div>
</blockquote></div></div>