Skip to content

virtiofs: enable test case for mapping virtiofs MAP_PRIVATE#13964

Merged
benhillis merged 1 commit intomasterfrom
user/benhill/virtiofs_map_shared
Dec 23, 2025
Merged

virtiofs: enable test case for mapping virtiofs MAP_PRIVATE#13964
benhillis merged 1 commit intomasterfrom
user/benhill/virtiofs_map_shared

Conversation

@benhillis
Copy link
Member

This test enables the virtiofs variation for mapping an app execution link as MAP_PRIVATE and clarifies what support is missing.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enables the virtiofs test variation for mapping app execution links with MAP_PRIVATE and clarifies the specific limitation preventing MAP_SHARED support on virtiofs.

Key changes:

  • Adds a new MAP_PRIVATE mmap test that runs unconditionally for all filesystem types, verifying that app execution links can be mapped with MAP_PRIVATE
  • Updates the virtiofs-specific comment to clarify that the limitation is specifically about MAP_SHARED support, not a general debugging issue


LxtCheckMapErrno(Mapping = mmap(NULL, 2, PROT_READ, MAP_PRIVATE, Fd, 0));
LxtCheckMemoryEqual(Mapping, "MZ", 2);
LxtCheckResult(munmap(Mapping, 2));
Copy link

Copilot AI Dec 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After successfully unmapping the MAP_PRIVATE mapping, the Mapping variable should be set to MAP_FAILED. Without this, when running on virtiofs, the ErrorExit cleanup code at line 3493-3495 will attempt to munmap an already-unmapped address, which can cause undefined behavior. Add Mapping = MAP_FAILED; after this line to prevent double-free of the mapping.

Suggested change
LxtCheckResult(munmap(Mapping, 2));
LxtCheckResult(munmap(Mapping, 2));
Mapping = MAP_FAILED;

Copilot uses AI. Check for mistakes.
@benhillis benhillis merged commit f459aef into master Dec 23, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants