Comment 10 for bug 1816841

Revision history for this message
Heinz Junkes (junkes) wrote : Re: [Bug 1816841] Re: non-epicsThreads may receive wrong priority and crash

I created Till's patch as a separate commit:

https://github.com/epics-base/epics-base/commit/ddaf464de8e899220fed87dc5fd6e2e7af5278e0

Till's patch made it very easy for me. I had to make a lot of changes to the code before to set the priorities correctly, especially in relation to RTEMS priorities (eg. used by nfs tasks)
and nonEpicsTask. The elimination of "nonEpicsTasks" was very helpful.

> On 7. Mar 2019, at 03:42, mdavidsaver <email address hidden> wrote:
>
> @Till, What is the status of this patch? Does it need a refresh?
>
> imo. it is too large to be reviewed as a single patch. Could you commit
> it and start a merge request here on launchpad, or a PR on github?
> (hint, a github PR will also run our unit tests)
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1816841
>
> Title:
> non-epicsThreads may receive wrong priority and crash
>
> Status in EPICS Base:
> New
>
> Bug description:
> The following applies to the POSIX threading implementation.
>
> If an application is launched with enough privilege to use the real-
> time scheduler (SCHED_FIFO) and creates some non-epicsThreads which
> use SCHED_OTHER then a bug is triggered when the non-epicsThread gets
> a 'pseudo-epics context' attached (via 'createImplicit()' e.g, by
> calling epicsThreadSuspendSelf()):
>
> createImplicit() computes a thread priority for the non-epics thread
> assuming SCHED_FIFO -- which is actually wrong. Under some
> circumstances the 'illegal' priority value can lead to a crash.
>
> The attached patch fixes this and cleans up some cruft. It also makes
> sure that whenever 'pcommonAttr' is used the scheduling policy of
> pcommonAttr matches the scheduling policy of the target thread.
>
> The patch also adds a test program which exercises the described
> behavior - however, it is necessary to execute the test with
> sufficient privilege for epicsThreads to use SCHED_FIFO (if the
> privilege is lacking then the test is skipped).
>
> The patch is against R7.0.2.
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/epics-base/+bug/1816841/+subscriptions