-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make munmap throw unsup errors instead of trying to work
- Loading branch information
Showing
6 changed files
with
68 additions
and
64 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
//@compile-flags: -Zmiri-disable-isolation | ||
//@ignore-target-windows: No libc on Windows | ||
|
||
#![feature(rustc_private)] | ||
#![feature(strict_provenance)] | ||
|
||
use std::ptr; | ||
|
||
fn main() { | ||
// Linux specifies that it is not an error if the specified range does not contain any pages. | ||
// But we simply do not support such calls. This test checks that we report this as | ||
// unsupported, not Undefined Behavior. | ||
let res = unsafe { | ||
libc::munmap( | ||
//~^ ERROR: unsupported operation | ||
// Some high address we surely have not allocated anything at | ||
ptr::invalid_mut(1 << 30), | ||
4096, | ||
) | ||
}; | ||
assert_eq!(res, 0); | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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