-
Notifications
You must be signed in to change notification settings - Fork 207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CFE_EVS_WriteLogFileCmd requires recursive locking #373
Comments
Has this bug been checked in the current version? This bug is for cFE 6.5.0. The logging code was considerably updated in CFE 6.6.0. |
I checked the code and concur that this still does apply to the current version. The function is now called We don't support recursive locking. The code must be updated to avoid calling My vote would be to defer the actual EVS_SendEvent until the process is done. It looks like it can only be a write error or success. I can implement this. |
The mutex for the log file write during the WriteLogFileCmd excution was held longer than it should have been. This lock must *NOT* be held during EVS_SendEvent, as this will cause deadlock. This moves the mutex to protect only the area that actually accesses the log data, and it moves all send event calls to be AFTER the mutex is released.
The mutex for the log file write during the WriteLogFileCmd excution was held longer than it should have been. This lock must *NOT* be held during EVS_SendEvent, as this will cause deadlock. This moves the mutex to protect only the area that actually accesses the log data, and it moves all send event calls to be AFTER the mutex is released.
Describe the bug
The function
CFE_EVS_WriteLogFileCmd
in cfe_evs_log.c locksCFE_EVS_GlobalData.EVS_SharedDataMutexID
for the entire duration of the function. If an error is encountered, it will callEVS_SendEvent
, which also tries to lock the mutex. If the OS/OSAL do not support recursive locking on mutexes, this will lead to a deadlock.To Reproduce
Steps to reproduce the behavior:
CFE_EVS_WriteLogFileCmd
(by e.g. giving it an invalid filename).Expected behavior
This may be expected behavior, if cFE requires its mutexes to be recursively lockable. If so, this isn't a bug and I'll have to modify our OSAL. But if that is not the expectation, then I would this function should relinquish its lock before calling
EVS_SendEvent
.More specifically, it looks like the this can be accomplished by moving the line
to just before each instance of
EVS_SendEvent()
in the function. By each of these points, this function is done accessing sensitive EVS data.Code snips
System observed on:
Additional context
I found this while testing our fix for #372.
Reporter Info
Mike Stewart, Capella Space.
The text was updated successfully, but these errors were encountered: