Re: [PATCH] cpukit/score: avoid NULL and races in priority mutex

2020-01-03 Thread Gedare Bloom
On Fri, Jan 3, 2020 at 10:19 AM Joel Sherrill wrote: > > > > On Fri, Jan 3, 2020, 12:08 AM Sebastian Huber > wrote: >> >> On 03/01/2020 00:24, Gedare Bloom wrote: >> > while ( !_Chain_Is_empty( >> > &the_thread->Priority_node.Inherited_priorities ) ) { >> > +_ISR_Disable( level ); >> >

Re: [PATCH] cpukit/score: avoid NULL and races in priority mutex

2020-01-03 Thread Joel Sherrill
On Fri, Jan 3, 2020, 12:08 AM Sebastian Huber < sebastian.hu...@embedded-brains.de> wrote: > On 03/01/2020 00:24, Gedare Bloom wrote: > > while ( !_Chain_Is_empty( > &the_thread->Priority_node.Inherited_priorities ) ) { > > +_ISR_Disable( level ); > > _Thread_Dequeue_priority_node( >

Re: [PATCH] cpukit/score: avoid NULL and races in priority mutex

2020-01-03 Thread Gedare Bloom
On Thu, Jan 2, 2020 at 11:08 PM Sebastian Huber wrote: > > On 03/01/2020 00:24, Gedare Bloom wrote: > > while ( !_Chain_Is_empty( > > &the_thread->Priority_node.Inherited_priorities ) ) { > > +_ISR_Disable( level ); > > _Thread_Dequeue_priority_node( > > ((Thread_Priority_no

Re: [PATCH] cpukit/score: avoid NULL and races in priority mutex

2020-01-02 Thread Sebastian Huber
On 03/01/2020 00:24, Gedare Bloom wrote: while ( !_Chain_Is_empty( &the_thread->Priority_node.Inherited_priorities ) ) { +_ISR_Disable( level ); _Thread_Dequeue_priority_node( ((Thread_Priority_node*)_Chain_First( &the_thread->Priority_node.Inherited_priorities

Re: [PATCH] cpukit/score: avoid NULL and races in priority mutex

2020-01-02 Thread Gedare Bloom
Sorry I should also clarify, PIP stands for "Priority Inheritance Protocol" On Thu, Jan 2, 2020 at 4:33 PM Gedare Bloom wrote: > Hi Mathew, > > 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 >

Re: [PATCH] cpukit/score: avoid NULL and races in priority mutex

2020-01-02 Thread Gedare Bloom
Hi Mathew, 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-inherit

Re: [PATCH] cpukit/score: avoid NULL and races in priority mutex

2020-01-02 Thread Gedare Bloom
This patch is for 4.10. A user reported a problem they saw in testing. I believe this will fix the problem. On Thu, Jan 2, 2020 at 4:25 PM Gedare Bloom wrote: > > The PIP modifications from #3359 introduced new data structures > to track priority inheritance. Prioritized mutexes without PIP > sha

Re: [PATCH] cpukit/score: avoid NULL and races in priority mutex

2020-01-02 Thread Mathew Benson
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? On Thu, Jan 2, 2020 at 5:25 PM Gedare Bloom wrote: > The PIP modifications from #3359 introduced new data struc

[PATCH] cpukit/score: avoid NULL and races in priority mutex

2020-01-02 Thread Gedare Bloom
The PIP modifications from #3359 introduced new data structures to track priority inheritance. Prioritized mutexes without PIP share some of the code paths, and may result in NULL pointer accesses. This patch checks for NULL, and also adds ISR critical sections to an uncovered corner case during th