virtiofs: enable test case for mapping virtiofs MAP_PRIVATE#13964
Merged
virtiofs: enable test case for mapping virtiofs MAP_PRIVATE#13964
Conversation
Contributor
There was a problem hiding this comment.
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)); |
There was a problem hiding this comment.
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; |
OneBlue
approved these changes
Dec 23, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This test enables the virtiofs variation for mapping an app execution link as MAP_PRIVATE and clarifies what support is missing.