-
Notifications
You must be signed in to change notification settings - Fork 215
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
Incorrect call to OS_ObjectIdCompose_Impl in OS_TimerDelete #649
Comments
Note - found an easier way to reproduce this error, which is to simply delete timers in a different order than they were created. Turns out all of the current functional tests create and delete in the same order, so it wasn't noticed. Will update at least one test case to delete timers in a different order than they were created. The recommended solution is to use the full object ID - not just the table index - to form the linked list of timer callbacks. This will be more robust and be simpler too, at least after #648 is done. The reason #648 is relevant/related here is that it can provide a simpler and more reliable way to tracking table lock status via lock tokens. Without this it becomes difficult to track the lock status when using functions like |
For the linked list of timer callbacks, use the full object ID value rather than just the index. This ensures consistency in the list and also makes it easier to manage.
For the linked list of timer callbacks, use the full object ID value rather than just the index. This ensures consistency in the list and also makes it easier to manage.
For the linked list of timer callbacks, use the full object ID value rather than just the index. This ensures consistency in the list and also makes it easier to manage.
For the linked list of timer callbacks, use the full object ID value rather than just the index. This ensures consistency in the list and also makes it easier to manage.
For the linked list of timer callbacks, use the full object ID value rather than just the index. This ensures consistency in the list and also makes it easier to manage.
Integration Candidate: 2020-04-22
Describe the bug
OSAL has an incorrect setting of
first_cb
when deleting timers.osal/src/os/shared/src/osapi-time.c
Lines 432 to 436 in 1a82657
The second argument to
OS_ObjectIdCompose_Impl()
is a serial number, not a table index. These are only the same value until table entries start to be re-used, after this they become different, and this will start to fail. This should really not be usingOS_ObjectIdCompose_Impl()
at all here.To Reproduce
OS_MAX_TIMEBASES
- such that table entries start to be re-used.At this point the ID in the timebase callback ring (
first_cb
member) may refer to an invalid entry - a timebase ID which does not exist.Expected behavior
Should look up the
active_id
from the actual table entry instead - do not re-compose the ID, becausenext_ref
is a table index, not a serial number.System observed on:
Ubuntu 20.04
Additional context
It is only possible to trigger this after a rather extensive sequence of creating and deleting these resources. So this is probably unlikely to ever occur in a real system where timers are typically created and run forever. Should still be fixed though.
This was initially discovered by enforcing type-safety in the
osal_index_t
andosal_id_t
- during this scrub it revealed that this was passing anosal_index_t
to a function which is supposed to accept a serial number. So type safety = good.Reporter Info
Joseph Hickey, Vantage Systems, Inc.
The text was updated successfully, but these errors were encountered: