You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This allows OS_OBJECT_TYPE_OS_CONDVAR to become a valid index for the OS_ObjectIdIteratorInit()->OS_ObjectIdTransactionInit()->OS_Lock_Global()->OS_Lock_Global_Impl() call chain. Unfortunately, OS_impl_objtype_lock_table for VxWorks does not contain an entry for OS_OBJECT_TYPE_OS_CONDVAR:
Thanks for catching this, this was an oversight in the original change. Since VxWorks 6 does not support condvars there is no real need for a lock for this objtype because it uses the "no-condvar" implementation.
The problem is that this function unconditionally tries to take the lock, regardless of whether the lock exists or not. It was assumed in OS_Lock_Global_Impl that all defined object types would have a corresponding lock, but if a particular object type is not being supported then this lock can (validly) not exist.
To fix the immediate issue I'd propose to add a null check on the table entry, and just skip the lock if so. This is OK as long as the "no-condvar" implementation is used, as that does not need a real lock.
Actually, even in the case of a non-implementation it still goes through the motions of allocating a table slot (i.e. OS_ObjectIdFindNextFree is still called, it just won't actually be successful later on). This is necessary to avoid conditional compilation among other things.
So the best bet is probably to just instantiate the missing lock....
Describe the bug
Array access overflow in src/os/vxworks/src/os-impl-idmap.c
To Reproduce
Enable FM in cFS on VxWorks. Streaming
semTake
/semGive
errors should occur whenOSAL_CONFIG_DEBUG_PRINTF
is enabledExpected behavior
Error printouts should not occur
Code snips
This PR adds the following lines:
osal/src/os/shared/src/osapi-idmap.c
Lines 163 to 164 in b8e9b83
This allows
OS_OBJECT_TYPE_OS_CONDVAR
to become a valid index for theOS_ObjectIdIteratorInit()->OS_ObjectIdTransactionInit()->OS_Lock_Global()->OS_Lock_Global_Impl()
call chain. Unfortunately,OS_impl_objtype_lock_table
for VxWorks does not contain an entry forOS_OBJECT_TYPE_OS_CONDVAR
:osal/src/os/vxworks/src/os-impl-idmap.c
Lines 74 to 87 in b8e9b83
OS_Lock_Global_Impl
/OS_Unlock_Global_Impl
runs past the end of the array, which results in invalid vxids being passed tosemTake()
/semGive()
System observed on:
Additional context
Reporter Info
John N Pham, Northrop Grumman
The text was updated successfully, but these errors were encountered: