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

bug?: kfree the same page twice #191

Open
qin-you opened this issue Jul 6, 2023 · 1 comment
Open

bug?: kfree the same page twice #191

qin-you opened this issue Jul 6, 2023 · 1 comment

Comments

@qin-you
Copy link

qin-you commented Jul 6, 2023

in kernel/proc.c freeproc() function :

kfree((void*)p->trapframe);                                  // first
proc_freepagetable(p->pagetable, p->sz);
         uvmunmap(pagetable, TRAPFRAME, 1, 0);
                     kfree((void*)pa);                                // second

kfree will not give up this duplicated page, and this could lead to some problems. I delete the first kfree above and the code works well.

@jduck
Copy link

jduck commented Dec 21, 2024

This doesn't make much sense because the final argument to uvmunmap dictates whether or not that kfree is called. As you can see here, it's passed a zero for do_free arg.

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

2 participants