-
-
Notifications
You must be signed in to change notification settings - Fork 604
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
mmap() should handle collisions with areas mapped with mmu::linear_map() #1135
Comments
The
In this case 3 anonymous areas collide:
This simple hack fixes the issue but it is not really a proper solution:
Should we register areas mapped by |
wkozaczuk
added a commit
that referenced
this issue
Mar 31, 2022
Sometimes while debugging problems related to how kernel and devices are memory-mapped it is helpful to see it in some form in gdb or by reading a procfs file just like we can do with mmap-ed VMAs. In addition we need to know where linear VMAs are located so that we can avoid collisions with mmap() as described by the issue #1135. To that end this patch adds new struct - linear_vma and collection of those - linear_vma_set - to track how memory gets mapped using linear_map(). It also modifies all places calling linear_map() to pass new argument - name. Please note that we can not re-use existing vma class, as it holds much richer information and lots of it is not applicable to linear map which is quite static and is simply a pre-populated mapping between some area of virtual and physical memory. Upcoming patches will add new 'osv linear_mmap' to loader.py and implementation of new sysfs pseudo file. Signed-off-by: Waldemar Kozaczuk <jwkozaczuk@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
While investigating crash when trying to run Node.JS on OSv on aarch64 (this problem does not seem to be arch specific), I have come to realize that OSv
mmap()
does not check for any potential collisions with areas of memory mapped withmmu::linear_map()
.For example, is case of this crash with extra debug info added one can see clear collision:
The key lines are here:
One can see 1st and 3rd
MAP_ANONYMOUS mmap()
received anaddr
hint that collides the memory mapped from0x0000000010000000
to0x000000003f000000
. And our mmap implementation only checks the addr hint against vma_list not what was mapped bymmu::linear_map
.I am surprised this has not been an issue so far in the past.
The text was updated successfully, but these errors were encountered: