Skip to content

glibc mmap incorrectly translates addr argument, breaking MAP_FIXED #1085

@rishabhBudhouliya

Description

@rishabhBudhouliya

Bug

mmap.c and mmap64.c call TRANSLATE_GUEST_POINTER_TO_HOST(addr) on the address argument. Since addr is a guest virtual address and not a pointer to data, this causes unexpected memory allocation via mmap.

When using mmap (with MAP_FIXED flag) with non-NULL addr:

  1. glibc translates: host_addr = base + addr
  2. rawposix truncates 64-bit to 32-bit: useraddr = host_addr as u32
  3. rawposix translates again: sysaddr = base + useraddr

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