-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[BUG] xEventGroupSetBits returns garbage if another high priority thread freed container #1142
Comments
This is a case of use after free and seems like an application bug. The application needs to ensure that no other task is using a resource before deleting it. |
@aggarg I believe it's not: I'm using EventGroup to signal from the child thread to the parent thread that it exited. I'm not using this primitive anymore, but because In general value returned from |
Wouldn't the pattern mentioned by this bug report be reasonably common in apps? The pattern of
isn't anything out of ordinary, and it's more or less exactly what this issue refers to. |
We can do that. I'd still suggest to evaluate your design and see if you really need to free resources dynamically. Would you like to raise a PR for this or would you like us to raise one? |
The use case in question cannot use a globally allocated event group, in this case a local variable is used - so while it's not utilizing FreeRTOS' dynamic allocation, the fact the static buffer is placed on the stack still makes it somewhat dynamic. |
If it's ok with you I can make PR. |
Yes, please do. |
Thanks for explaining. |
Describe the bug
https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/main/event_groups.c#L643
pxEventBits->uxEventBits
used afterxTaskResumeAll();
which will return garbage if another thread freed underlying container.Target
Host
To Reproduce
Expected behavior
Not returning garbage
Screenshots
none
Additional context
none
The text was updated successfully, but these errors were encountered: