Skip to content

Support partial mprotect on mmapings #75

@dmik

Description

@dmik

Currently, our mprotect is quite limited. It returns EACCES for non-anonymous file mappings and, as of #74, it also returns EACCES when applied in part to an anonymous mapping. Both limitations have the same root: we already use page protection flags for our own management so messing with them beyond it will break it.

For example, the page committed bit is used in all mappings to implement lazy page memory allocation on first access. The page write bit is used as a trigger to catch writes to non-anonymous mappings in order to write dirty pages to the underlying files.

As for anonymous mappings, we used to support partial mprotect on them but it showed bugs as #74 demonstrates so it had to be disabled. In short, the reason is that our internal mmap representation only keeps track of mmap-level protection flags for the whole region, not for individual pages. We could add a map of per-page protection flags but this needs some redesign of internal structures and it's better to be done globally, taking other needs into account (like supporting mprotect for non-anonymous mappings). This is what this ticket is about.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions