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

[fix] mappages: potential memory leak #118

Open
wants to merge 1 commit into
base: riscv
Choose a base branch
from
Open

Conversation

yztz
Copy link

@yztz yztz commented Apr 19, 2022

In mappages, if size > 1 * PAGESIZE or va not page-aligned(i.e. need to map more than one page), it will lead to a memory leak with a midway kalloc failure. When mappages returns -1, it will try to call uvmfree->freewalk to free the page-table pages and may lead to a panic because of an mapped page.
In the unmodified version, maapages always successes or is only called with 1 * PAGESIZE, so this problem doesn't rise.

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.

1 participant