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

MmapRegion: relax mmap size constraints #178

Merged
merged 1 commit into from
Oct 18, 2021

Commits on Oct 18, 2021

  1. MmapRegion: relax mmap size constraints

    For the build_raw() alternative of the MmapRegion,
    the implementation was validating that the length of
    the mapping was a multiple of the page size.
    
    This generally makes sense, since the OS will round up
    to the nearest multiple anyway and only allocate full
    pages.
    There is one corner case though where this needs to be
    relaxed: when mapping a file with a length not divisible
    by the pagesize.
    
    According to the POSIX reference, the length will be rounded
    up and the extra memory zero-ed. Memory accesses will work
    as expected, even beyond the actual file length (but within the
    allocated memory), but any writes will not be persisted to the
    filesystem and the backing device.
    
    This is a use case where mapping an "uneven" length makes sense,
    so that such "out-of-bounds" checks can be caught by accesses
    via vm-memory primitives.
    
    This commit removes this constraint.
    
    Signed-off-by: alindima <[email protected]>
    alindima committed Oct 18, 2021
    Configuration menu
    Copy the full SHA
    cc7ea2f View commit details
    Browse the repository at this point in the history