KEMBAR78
SingleFile: Unix: Unaligned R2R images in bundle are loaded as IL assemblies · Issue #38061 · dotnet/runtime · GitHub
Skip to content

SingleFile: Unix: Unaligned R2R images in bundle are loaded as IL assemblies #38061

@swaroop-sridhar

Description

@swaroop-sridhar

Assemblies embedded within a single-file are aligned at 16 byte boundaries.
However, MappedImageLayout assumes that assemblies are mapped at 4K offsets.
The mmap() call here is incorrect when offset is not a multiple of 4096. This results in map failure and subsequent failure to load the image in a mapped layout. Subsequently, the image is loaded as IL as a fallback.

The work in this issue is to try and fix this problem by:

  • mmap() pages containing sections/headers using appropriate ROUND_DOWN and ROUND_UP operations
  • Zero out any contents of mapped pages containing data with inappropriate permissions
  • Load sections at unaligned offsets in MAPMapPEFile.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions