You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 24, 2021. It is now read-only.
With Uhyve, when performing file read/write operations in the host, the target buffer is fully read or written from the guest physical memory. Such a design assumes that the buffer is contiguous in physical memory, which is not always the case. When using a buffer allocated with malloc, example of bad things that can happen are:
Reading from a file in a buffer that is not or partially mapped to physical memory (because of on-demand mapping)
Reading from a file in a buffer which virtual pages are not mapped to contiguous physical pages
Writing in a file from a buffer which virtual pages are not mapped to contiguous physical pages
You can confirm these issues with these two sample programs and the corresponding Makefile:
Here is my proposed solution: a patch that forces the file read and write operations to be performed on a page-by-page basis, i.e. Uhyve file read or write operation is called for each page composing the buffer. I did not extensively tested it, nor did I evaluated the performance impact (I guess it slows things down a bit).
@olivierpierre: I got to know about your problem, however not about your proposed solution.
Anyway, I've committed a fix for HermitCore-rs (the Rust implementation of HermitCore), which lets uhyve perform the virtual-to-physical address translation for the buffers of read/write operations.
This way, the physical memory addresses of the buffer pages can be arbitrary.
The fix commit is hermit-os/hermit-caves@6b9e4be and seems to have also been merged to the HermitCore C version in the meantime.
@olivierpierre : Since yesterday I added a patch to the C version (see pull request 97). Could you test it on your system? By the way, I add also gdb support for aarch64...
@ColinFinck: I believe my initial post includes a description of the problem as well as two sample programs that trigger the issue. Please let me know if you need something specific.
@stlankes: thank! I will try the patch on our version and let you know
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hello,
With Uhyve, when performing file read/write operations in the host, the target buffer is fully read or written from the guest physical memory. Such a design assumes that the buffer is contiguous in physical memory, which is not always the case. When using a buffer allocated with
malloc
, example of bad things that can happen are:You can confirm these issues with these two sample programs and the corresponding Makefile:
Here is my proposed solution: a patch that forces the file read and write operations to be performed on a page-by-page basis, i.e. Uhyve file read or write operation is called for each page composing the buffer. I did not extensively tested it, nor did I evaluated the performance impact (I guess it slows things down a bit).
The text was updated successfully, but these errors were encountered: