Bug 1817900 - Update memmap2 to 0.5.9. r=emilio,supply-chain-reviewers

Differential Revision: https://phabricator.services.mozilla.com/D170443
This commit is contained in:
Mike Hommey 2023-02-23 01:17:30 +00:00
parent 32473816f4
commit 12958ab5a5
8 changed files with 89 additions and 22 deletions

14
Cargo.lock generated
View File

@ -342,7 +342,7 @@ dependencies = [
"iovec",
"libc",
"log",
"memmap2 0.5.8",
"memmap2 0.5.9",
"mio 0.8.0",
"scopeguard",
"serde",
@ -3197,7 +3197,7 @@ source = "git+https://github.com/jfkthame/mapped_hyph.git?rev=c7651a0cffff41996a
dependencies = [
"arrayref",
"log",
"memmap2 0.5.8",
"memmap2 0.5.9",
]
[[package]]
@ -3249,14 +3249,14 @@ checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
name = "memmap2"
version = "0.2.999"
dependencies = [
"memmap2 0.5.8",
"memmap2 0.5.9",
]
[[package]]
name = "memmap2"
version = "0.5.8"
version = "0.5.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4b182332558b18d807c4ce1ca8ca983b34c3ee32765e47b3f0f69b90355cc1dc"
checksum = "2af2c65375e552a67fe3829ca63e8a7c27a378a62824594f43b2851d682b5ec2"
dependencies = [
"libc",
]
@ -3368,7 +3368,7 @@ dependencies = [
"goblin",
"libc",
"mach2",
"memmap2 0.5.8",
"memmap2 0.5.9",
"memoffset 0.7.1",
"minidump-common",
"nix 0.25.1",
@ -4327,7 +4327,7 @@ dependencies = [
name = "profiler_helper"
version = "0.1.0"
dependencies = [
"memmap2 0.5.8",
"memmap2 0.5.9",
"object",
"rustc-demangle",
"thin-vec",

View File

@ -1409,6 +1409,11 @@ who = "Mike Hommey <mh+mozilla@glandium.org>"
criteria = "safe-to-deploy"
delta = "0.5.7 -> 0.5.8"
[[audits.memmap2]]
who = "Mike Hommey <mh+mozilla@glandium.org>"
criteria = "safe-to-deploy"
delta = "0.5.8 -> 0.5.9"
[[audits.memoffset]]
who = "Gabriele Svelto <gsvelto@mozilla.com>"
criteria = "safe-to-deploy"

View File

@ -1 +1 @@
{"files":{"CHANGELOG.md":"2c44b332748c22db37c7bc17f8c90edd5616c084a9b7238eef5067f3dd287813","Cargo.lock":"ed33b2c7bd22c158bd527fefa4079e62a3e98a63c2b653ba50d977a8a43f92c2","Cargo.toml":"cad69c38d627420a71d549945b9bbc4b21323b2855d63e3b98d344d2fe3ea07e","LICENSE-APACHE":"04ea4849dba9dcae07113850c6f1b1a69052c625210639914eee352023f750ad","LICENSE-MIT":"0d25d03b5ab49576178ad0cae7a2648d12c17ad0452fe49c07e55e4b59aa5257","README.md":"c7b3cd928f0d1a10faa255e2f84a2a06636e55ea3e7edd4f6334dd9215151205","examples/cat.rs":"ab0b575d19662e2d5b6c7cea2756b57530e495d56acdb4fd2b56c0ba4d768dfd","src/advice.rs":"194bfd6a32495f6b0c739d083b06230ae656927767f15c1b49b245b63431cc4d","src/lib.rs":"4f345df103c78344e07454da7b8f3941af094efd599e3d51a29ea735fab19dba","src/stub.rs":"f276bb5e4bc29c2129ebc660b01a1de173b9575e2e866ea5a34e0ee6318f1177","src/unix.rs":"03fe91a320d0146993019ea51e486275b8c8e13e42a995e649b8c76690e3f167","src/windows.rs":"bbb39200ac35b5517626c12efad4886f7b5d34e56256284914c556dec1567e38"},"package":"4b182332558b18d807c4ce1ca8ca983b34c3ee32765e47b3f0f69b90355cc1dc"}
{"files":{"CHANGELOG.md":"ec5972562a347a1be399c91584ccecb609578c003cf32a5897457a42d3011a6d","Cargo.lock":"48644099a4476d43e9c5a4735b2afe8ef5421e264a96b0dd1ab9c11674afbe69","Cargo.toml":"dc57d3ea17db4790f9dc1a7c7453e86e21e2e1b47b234c8c04cbc9878afd93f8","LICENSE-APACHE":"04ea4849dba9dcae07113850c6f1b1a69052c625210639914eee352023f750ad","LICENSE-MIT":"0d25d03b5ab49576178ad0cae7a2648d12c17ad0452fe49c07e55e4b59aa5257","README.md":"c7b3cd928f0d1a10faa255e2f84a2a06636e55ea3e7edd4f6334dd9215151205","examples/cat.rs":"ab0b575d19662e2d5b6c7cea2756b57530e495d56acdb4fd2b56c0ba4d768dfd","src/advice.rs":"194bfd6a32495f6b0c739d083b06230ae656927767f15c1b49b245b63431cc4d","src/lib.rs":"43af9a94be23c31795b56af94614dc89c39b256b05b9a6b1afd3a836c0982c92","src/stub.rs":"f276bb5e4bc29c2129ebc660b01a1de173b9575e2e866ea5a34e0ee6318f1177","src/unix.rs":"ec544b17083e7737edec8588983461385abe3acfa793b07bb1342373ba540113","src/windows.rs":"bbb39200ac35b5517626c12efad4886f7b5d34e56256284914c556dec1567e38"},"package":"2af2c65375e552a67fe3829ca63e8a7c27a378a62824594f43b2851d682b5ec2"}

View File

@ -6,6 +6,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
## [Unreleased]
## [0.5.9] - 2023-02-17
### Added
- `From<Mmap> for MmapRaw` and `From<MmapMut> for MmapRaw`.
[@swlynch99](https://github.com/swlynch99)
- `Mmap::advise_range`, `MmapMut::advise_range`, `MmapRaw::advise_range`.
[@ho-229](https://github.com/ho-229)
## [0.5.8] - 2022-11-09
### Added
- `MmapRaw::advise`, `MmapRaw::lock` and `MmapRaw::unlock`.
@ -123,7 +130,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Removed
- `winapi` dependency. [memmap-rs/pull/89](https://github.com/danburkert/memmap-rs/pull/89)
[Unreleased]: https://github.com/RazrFalcon/memmap2-rs/compare/v0.5.8...HEAD
[Unreleased]: https://github.com/RazrFalcon/memmap2-rs/compare/v0.5.9...HEAD
[0.5.9]: https://github.com/RazrFalcon/memmap2-rs/compare/v0.5.8...v0.5.9
[0.5.8]: https://github.com/RazrFalcon/memmap2-rs/compare/v0.5.7...v0.5.8
[0.5.7]: https://github.com/RazrFalcon/memmap2-rs/compare/v0.5.6...v0.5.7
[0.5.6]: https://github.com/RazrFalcon/memmap2-rs/compare/v0.5.5...v0.5.6

14
third_party/rust/memmap2/Cargo.lock generated vendored
View File

@ -16,9 +16,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "fastrand"
version = "1.7.0"
version = "1.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3fcf0cee53519c866c09b5de1f6c56ff9d647101f81c1964fa632e148896cdf"
checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be"
dependencies = [
"instant",
]
@ -34,13 +34,13 @@ dependencies = [
[[package]]
name = "libc"
version = "0.2.99"
version = "0.2.139"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a7f823d141fe0a24df1e23b4af4e3c7ba9e5966ec514ea068c93024aa7deb765"
checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79"
[[package]]
name = "memmap2"
version = "0.5.8"
version = "0.5.9"
dependencies = [
"libc",
"owning_ref",
@ -59,9 +59,9 @@ dependencies = [
[[package]]
name = "redox_syscall"
version = "0.2.13"
version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42"
checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a"
dependencies = [
"bitflags",
]

View File

@ -12,7 +12,7 @@
[package]
edition = "2018"
name = "memmap2"
version = "0.5.8"
version = "0.5.9"
authors = [
"Dan Burkert <dan@danburkert.com>",
"Yevhenii Reizner <razrfalcon@gmail.com>",

View File

@ -627,7 +627,19 @@ impl Mmap {
/// See [madvise()](https://man7.org/linux/man-pages/man2/madvise.2.html) map page.
#[cfg(unix)]
pub fn advise(&self, advice: Advice) -> Result<()> {
self.inner.advise(advice)
self.inner.advise(advice, 0, self.inner.len())
}
/// Advise OS how this range of memory map will be accessed.
///
/// The offset and length must be in the bounds of the memory map.
///
/// Only supported on Unix.
///
/// See [madvise()](https://man7.org/linux/man-pages/man2/madvise.2.html) map page.
#[cfg(unix)]
pub fn advise_range(&self, advice: Advice, offset: usize, len: usize) -> Result<()> {
self.inner.advise(advice, offset, len)
}
/// Lock the whole memory map into RAM. Only supported on Unix.
@ -806,7 +818,19 @@ impl MmapRaw {
/// See [madvise()](https://man7.org/linux/man-pages/man2/madvise.2.html) map page.
#[cfg(unix)]
pub fn advise(&self, advice: Advice) -> Result<()> {
self.inner.advise(advice)
self.inner.advise(advice, 0, self.inner.len())
}
/// Advise OS how this range of memory map will be accessed.
///
/// The offset and length must be in the bounds of the memory map.
///
/// Only supported on Unix.
///
/// See [madvise()](https://man7.org/linux/man-pages/man2/madvise.2.html) map page.
#[cfg(unix)]
pub fn advise_range(&self, advice: Advice, offset: usize, len: usize) -> Result<()> {
self.inner.advise(advice, offset, len)
}
/// Lock the whole memory map into RAM. Only supported on Unix.
@ -835,6 +859,18 @@ impl fmt::Debug for MmapRaw {
}
}
impl From<Mmap> for MmapRaw {
fn from(value: Mmap) -> Self {
Self { inner: value.inner }
}
}
impl From<MmapMut> for MmapRaw {
fn from(value: MmapMut) -> Self {
Self { inner: value.inner }
}
}
/// A handle to a mutable memory mapped buffer.
///
/// A file-backed `MmapMut` buffer may be used to read from or write to a file. An anonymous
@ -1050,7 +1086,19 @@ impl MmapMut {
/// See [madvise()](https://man7.org/linux/man-pages/man2/madvise.2.html) map page.
#[cfg(unix)]
pub fn advise(&self, advice: Advice) -> Result<()> {
self.inner.advise(advice)
self.inner.advise(advice, 0, self.inner.len())
}
/// Advise OS how this range of memory map will be accessed.
///
/// The offset and length must be in the bounds of the memory map.
///
/// Only supported on Unix.
///
/// See [madvise()](https://man7.org/linux/man-pages/man2/madvise.2.html) map page.
#[cfg(unix)]
pub fn advise_range(&self, advice: Advice, offset: usize, len: usize) -> Result<()> {
self.inner.advise(advice, offset, len)
}
/// Lock the whole memory map into RAM. Only supported on Unix.
@ -1633,6 +1681,9 @@ mod test {
// check that the mmap is empty
assert_eq!(&zeros[..], &mmap[..]);
mmap.advise_range(Advice::Sequential, 0, mmap.len())
.expect("mmap advising should be supported on unix");
// write values into the mmap
(&mut mmap[..]).write_all(&incr[..]).unwrap();

View File

@ -240,9 +240,12 @@ impl MmapInner {
self.len
}
pub fn advise(&self, advice: Advice) -> io::Result<()> {
pub fn advise(&self, advice: Advice, offset: usize, len: usize) -> io::Result<()> {
let alignment = (self.ptr as usize + offset) % page_size();
let offset = offset as isize - alignment as isize;
let len = len + alignment;
unsafe {
if libc::madvise(self.ptr, self.len, advice as i32) != 0 {
if libc::madvise(self.ptr.offset(offset), len, advice as i32) != 0 {
Err(io::Error::last_os_error())
} else {
Ok(())