RTEMS | posix: Defer mutex flags until after validation (!1493)

Yang Zhang (@Chloe) gitlab at rtems.org
Thu Sep 17 09:12:24 UTC 2026



Yang Zhang created a merge request: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/1493

Project:Branches: Chloe/rtems:fix-mutex-init-flags to rtems/rtos/rtems:main
Author: Yang Zhang

## Summary

Previously, pthread_mutex_init() wrote the object flags containing POSIX_MUTEX_MAGIC before validating the priority ceiling attribute. If the priority ceiling was invalid, the function returned EINVAL, but left the mutex object marked as a valid initialized mutex. Subsequent calls such as pthread_mutex_trylock() and pthread_mutex_destroy() then mistakenly accepted the object and returned EBUSY, or pthread_mutex_lock() triggered a fatal data abort due to uninitialized queues.

Defer modifying the mutex object and setting the flags until after all attribute validations (including priority ceiling) have succeeded, and publish the flags after the mutex queue and control fields are initialized. Also add test coverage in psx05.

Close #5776.

## Generative AI

None

-- 
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/1493
You're receiving this email because of your account on gitlab.rtems.org. Unsubscribe from this thread: https://gitlab.rtems.org/-/namespace/49/sent_notifications/5-5i1ocm7vehatrn2zl59dyrazn-1d/unsubscribe | Manage all notifications: https://gitlab.rtems.org/-/profile/notifications | Help: https://gitlab.rtems.org/help


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/bugs/attachments/20260917/0b399996/attachment-0001.htm>


More information about the bugs mailing list