asCa missing locking

Bug #1815999 reported by mdavidsaver
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
EPICS Base
New
Low
Unassigned

Bug Description

I noticed that there is a distinct lack of any locking in asCa.c to guard access to the global 'pasbase' and all the tree accessible through it. A half hearted attempt is made with 'caInitializing'.

Revision history for this message
Andrew Johnson (anj) wrote :

I do see a lock being taken and released in asCaStart() and asCaStop() around the signal/wait for asCaTask() to do its thing. This isn't easy to follow and certainly not how I would have written it, but in conjunction with the RCU-like approach to modifying the volatile ASBASE *pasbase in asLibRoutines.c and the LOCK/UNLOCK pair in asInitialize() I suspect there is enough here to prevent races.

No objections to it being rewritten, but I don't see it as a priority.

Revision history for this message
mdavidsaver (mdavidsaver) wrote :

I was looking at asCa.c from the prospective of whether I would use it as a template for some similar code w/ PVA. Given that asLock isn't exposed outside of asLibRoutines.c, and the whole thing is a singleton anyway, my conclusion is that trying to use 'pasbase' from external code is a bad idea.

If I change anything it will be to hide 'pasbase' and friends behind EPICS_PRIVATE_API.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.