Skip to content

Potential empty page leaks in mapped areas #56

Description

@greatbridf

in mm_list.rs:784:

fn set_mapped(&mut self, execute: bool) {
    // Writable flag is set during page fault handling while executable flag is
    // preserved across page faults, so we set executable flag now.
    let mut attr = PageAttribute::READ | PageAttribute::USER | PageAttribute::MAPPED;
    attr.set(PageAttribute::EXECUTE, execute);

    self.set(EMPTY_PAGE.clone().into_raw(), T::Attr::from(attr));
}

in mm_area.rs:153:

let map_page = |cache_page: &CachePage| {
    if !self.permission.write {
        assert!(!write, "Write fault on read-only mapping");

        *pfn = cache_page.add_mapping();
        return;
    }

The empty pages mapped here are not released. Since the empty page will reside in memory forever, this won't be a huge issue. But it may cause more issues if not handled properly.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions