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

sched/sem_waitirq: Fix semaphore wait interruption when MMU is in use #8918

Merged
merged 2 commits into from
Mar 29, 2023

Conversation

pussuw
Copy link
Contributor

@pussuw pussuw commented Mar 28, 2023

Summary

When MMU is in use, sem_waitirq fails because it tries to access sem_t (the waited object) which is user memory. This either results in page fault (crash) o access to the wrong address environment (crash later). This fixes the issue by:

  • Allowing user memory access from idle process (this is a more generic bug, fixed here)
  • Swapping to the correct address environment when accessing waitobj

Impact

Builds with MMU only (CONFIG_BUILD_KERNEL)

Testing

icicle:knsh

Linked with issue #8917
This is a way to fix the problem, but there might be an obvious alternative solution I could not think of

@pussuw pussuw changed the title Sem waitirq mmu fix sched/sem_waitirq: Fix semaphore wait interruption when MMU is in use Mar 28, 2023
This has been a long issue for me as it results in random crashes when
asynchronous events occur when the idle process is active.

The problem is that the kernel cannot access user memory, because the CPU
status prevents it.
sem_t is user memory and the correct mappings are needed to perform
the semaphore wait interruption.

Otherwise either a page fault, or access to the WRONG address environment
happens.
@acassis acassis merged commit f468371 into apache:master Mar 29, 2023
@pussuw pussuw deleted the sem_waitirq_mmu_fix branch March 29, 2023 18:24
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

Successfully merging this pull request may close these issues.

4 participants