-
Couldn't load subscription status.
- Fork 400
Use throw_unsup_format! instead of returning ENOTSUP in the mmap shim
#3610
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
Conversation
|
@marc0246 Can you add a test that verifies that a program which encounters The precipitating program is this: let ptr = unsafe {
libc::mmap(
std::ptr::null_mut(),
4096,
libc::PROT_NONE,
libc::MAP_PRIVATE | libc::MAP_ANONYMOUS,
-1,
0,
)
};
if ptr == libc::MAP_FAILED {
Err::<(), _>(std::io::Error::last_os_error()).unwrap();
}Which before this PR prints: This scenario is close to a viable test case, the only complaint I'd have about this as a test is that it relies on the details of our |
|
The program could set the last error itself and then print it, instead of relying on |
libs decided not to FCP a colliding conversion from errno values to About this PR as a whole, we definitely need a better message for this
There is no good reason. I waffled a lot while implementing the I suspect that given your experience and given that I've now been corrected that the standard library does not use Lines 83 to 84 in e1099c6
|
|
That sounds good to me. I for one will definitely agree that a recovery in this situation is doubtful, and the error has rather confused me. |
|
Okay, so let's bring mmap in sync with all other Miri shims then by defaulting to throw_unsup_format. @marc0246 can you update the PR to do that instead? |
|
@rustbot author |
e4fdabb to
1953292
Compare
|
This is what the UI looks like now: @rustbot ready |
ENOTSUP and EOPNOTSUPP error codesthrow_unsup_format! instead of returning ENOTSUP in the mmap shim
1953292 to
424e5ed
Compare
|
Looks good, thanks! @bors r+ |
|
☀️ Test successful - checks-actions |
I noticed this while trying to use
mmapwithPROT_NONE, which resulted in this error message:cc @saethlin