Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mmap failure returning 0x00 instead of MAP_FAILED #3218

Closed
gimbling-away opened this issue Dec 10, 2023 · 0 comments · Fixed by #3219
Closed

mmap failure returning 0x00 instead of MAP_FAILED #3218

gimbling-away opened this issue Dec 10, 2023 · 0 comments · Fixed by #3219
Assignees

Comments

@gimbling-away
Copy link

gimbling-away commented Dec 10, 2023

Upon failure, mmap is supposed to return MAP_FAILED, not nullptr.

return Ok(Scalar::from_maybe_pointer(Pointer::null(), this));

Currently mmap returns null pointer in miri.

Is this intentional or accidental?

@saethlin saethlin linked a pull request Dec 10, 2023 that will close this issue
@saethlin saethlin self-assigned this Dec 10, 2023
bors added a commit that referenced this issue Dec 10, 2023
Return MAP_FAILED when mmap fails

I don't properly remember why we ended up with a hodgepodge of return values, but #3218 correctly points out that we are supposed to return `MAP_FAILED`. This should fix that return value and also add sufficient tests to prevent making a similar mistake.
RalfJung pushed a commit to RalfJung/rust that referenced this issue Dec 17, 2023
Return MAP_FAILED when mmap fails

I don't properly remember why we ended up with a hodgepodge of return values, but rust-lang/miri#3218 correctly points out that we are supposed to return `MAP_FAILED`. This should fix that return value and also add sufficient tests to prevent making a similar mistake.
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 a pull request may close this issue.

2 participants