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

riscv64/pmap: fix not currently mapped memory being accessed #619

Merged
merged 1 commit into from
Nov 5, 2024

Conversation

lukileczo
Copy link
Member

@lukileczo lukileczo commented Nov 5, 2024

Description

When executing (v)fork, first the memory map is copied and then the new process switches to that map. On risc-v, when mapping new page, cache is invalidated. However, the invalidation may cause page fault when the virtual address is not mapped in the context of currently used memory map. This PR fixes this by switching to the memory map in which the address is mapped, executing the flush/inval and returning to original memory map.

Motivation and Context

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Chore (refactoring, style fixes, git/CI config, submodule management, no code logic changes)

How Has This Been Tested?

  • Already covered by automatic testing.
  • New test added: (add PR link here).
  • Tested by hand on: riscv64-noelv-fpga

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing linter checks and tests passed.
  • My changes generate no new compilation warnings for any of the targets.

Special treatment

  • This PR needs additional PRs to work (list the PRs, preferably in merge-order).
  • I will merge this PR by myself when appropriate.

@lukileczo lukileczo force-pushed the lukileczo/noelv-fix branch 2 times, most recently from fb92f50 to 736bfe2 Compare November 5, 2024 16:38
This commit fixes a bug where data cache of not currently mapped memory
was invalidated. This lead to an exception when memory was being mapped
in context of a process different than the currently executing one
(especially in fork).

JIRA: RTOS-968
@lukileczo lukileczo merged commit 856e918 into master Nov 5, 2024
33 checks passed
@lukileczo lukileczo deleted the lukileczo/noelv-fix branch November 5, 2024 17:04
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.

2 participants