Skip to content
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

lwIP mbox synchronization issue #5379

Open
pillip8282 opened this issue Dec 22, 2021 · 0 comments
Open

lwIP mbox synchronization issue #5379

pillip8282 opened this issue Dec 22, 2021 · 0 comments

Comments

@pillip8282
Copy link
Contributor

Get a wrong event caused by sharing common variable.

Description

To signal both empty and full event of mbox, it uses same variable mail. However following specific case, it can send wrong event to the Task.

Issue procedure

  1. Task A called mbox_fetch. But there is no data in mbox, task A waits an event with mbox->mail
  2. Task B called mbox post. And call sys_arch_sem_signal(mbox->mail) to signal Task A
  3. If context switching didn't happen then Task B is doing mbox post repeatedly.
  4. mbox can be fulled because Task B posts data again and again. Then it calls sys_arch_sem_wait() to get a signal that mbox is not full
  5. sys_arch_sem_wait() from Task B return immediately because task A didn't receive a signal.
  6. Unexpected behavior will happen.

Solution

  • Do not share the event variable between full and empty event.
  • If state of mbox which is in full is changed then deliver not_full signal
  • If state of mbox which is in empty is changed then deliver not_empty signal.
pillip8282 added a commit to pillip8282/TizenRT that referenced this issue Jan 3, 2022
This commit played issue reported
Samsung#5379. The patch should pass
the testcase which is in mbox_shared.
an4967 pushed a commit that referenced this issue Jan 4, 2022
This commit played issue reported
#5379. The patch should pass
the testcase which is in mbox_shared.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant