[codex] Fix IAR file lock mutex bounds - #567
Conversation
29ba95c to
e4fdfdf
Compare
Signed-off-by: Old-Ding <35417409+Old-Ding@users.noreply.github.com>
e4fdfdf to
d24bb49
Compare
|
Thank you for this contribution, @Old-Ding. Before we can accept it, you need to sign the Eclipse Contributor Agreement (ECA). The purpose of the ECA is to provide a written record that you have agreed to provide your code and documentation contributions under the licenses used by the Eclipse ThreadX project. It also makes it clear that you are promising that what you are contributing to Eclipse is code you wrote, and you have the necessary rights to contribute it to our projects. And finally, it documents a commitment from you that your open source contributions will be permanently on the public record. Signing the ECA requires an Eclipse Foundation account if you do not already have one. You can create one for free at https://accounts.eclipse.org. Be sure to use the same email address when you register for the account that you intend to use on Git commit records. Also, please add your GitHub ID to your Eclipse account. This enables synchronisation between Eclipse-owned infrastructure and GitHub. Here is the link to sign the ECA: |
|
Also, another comment. If this contribution has been assisted or authored by AI, make sure you conform to the official Generative Artificial Intelligence Usage Guidelines for Eclipse Committers found in the project handbook. |
|
I checked this one carefully because a 26-file search-and-replace is easy to get subtly wrong, and it holds up. The bug is real and the fix is right. The bugThe file-lock block sizes its pool with TX_MUTEX __tx_iar_file_lock_mutexes[_MAX_FLOCK];
...
for (i = 0; i < _MAX_FLOCK; i++)
{
mutex_ptr = &__tx_iar_file_lock_mutexes[__tx_iar_file_lock_next_free_mutex++];
if (__tx_iar_file_lock_next_free_mutex >= _MAX_LOCK) /* wrong bound */
...
}
if (i >= _MAX_LOCK) /* wrong bound */The system-lock block immediately above is correct throughout, which is what makes this look like a copy-paste that was only half adjusted. With the values the module ports declare — Worth recording the inverse, since it is the reason this is worth fixing rather than tidying: if a configuration ever had What I verified
Three things before this can go inRetarget to Rebase and re-run the generators. Cortex-M52 arrived in #519 after you opened this, and it was generated from the unfixed source, so it carries the same bug. Rebasing onto The ECA. Your CI note is right that this is a legal gate rather than a code problem, but it is a hard gate: nothing can be merged until the Eclipse Contributor Agreement is signed with the same email address as your commits. https://www.eclipse.org/legal/eca/ Also, this is still marked as a draft — mark it ready when the above is done. Thank you for the clear root-cause description in the PR body; it made this quick to confirm. |
Summary
_MAX_FLOCK_MAX_LOCKRoot cause
The file lock mutex pool is sized with
_MAX_FLOCK, but its round-robin allocation checks used_MAX_LOCKin two places. When_MAX_FLOCKis larger than_MAX_LOCK, the allocator can wrap or report exhaustion using the system-lock limit instead of the file-lock pool size.Validation
git diff --check_MAX_LOCKto_MAX_FLOCKfile_lockreferences use_MAX_LOCKCI notes
eclipsefdn/ecafailure says the PR author is not covered by the required Eclipse legal agreements.