diff options
author | Jeff Vander Stoep <jeffv@google.com> | 2023-03-31 00:20:05 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2023-03-31 00:20:05 +0000 |
commit | 1606cff2173f412b218d40c8bef530db3ce3947b (patch) | |
tree | 1f98d45f422d440fb1791dfe8d851584991415eb | |
parent | b20ff161f9a0fe480cd38cca9922d35c02fd7dd3 (diff) | |
parent | e9224f1ec417fd8eb4b3d965d1a27c14fed0196e (diff) | |
download | userfaultfd-1606cff2173f412b218d40c8bef530db3ce3947b.tar.gz |
Upgrade userfaultfd to 0.5.1 am: 384bd3e504 am: 35cd2fa704 am: c41a3c5207 am: 1aa8d27e5d am: e9224f1ec4
Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/userfaultfd/+/2515115
Change-Id: Ie7b4385234950aa8d4243e3f486c37619b8f8062
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r-- | .cargo_vcs_info.json | 6 | ||||
-rwxr-xr-x | .github/ISSUE_TEMPLATE/blank-issue.md | 9 | ||||
-rw-r--r-- | .github/workflows/rust.yml | 39 | ||||
-rw-r--r-- | .gitignore | 8 | ||||
-rw-r--r-- | Android.bp | 2 | ||||
-rw-r--r-- | Cargo.toml | 12 | ||||
-rw-r--r-- | Cargo.toml.orig | 8 | ||||
-rw-r--r-- | METADATA | 15 | ||||
-rw-r--r-- | examples/manpage.rs | 13 |
9 files changed, 88 insertions, 24 deletions
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json new file mode 100644 index 0000000..c054044 --- /dev/null +++ b/.cargo_vcs_info.json @@ -0,0 +1,6 @@ +{ + "git": { + "sha1": "cb2cd6d359b715e24144242e4580679897268ffd" + }, + "path_in_vcs": "" +}
\ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/blank-issue.md b/.github/ISSUE_TEMPLATE/blank-issue.md new file mode 100755 index 0000000..8651c00 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/blank-issue.md @@ -0,0 +1,9 @@ +--- +name: Blank Issue +about: Create a blank issue. +title: '' +labels: '' +assignees: '' + +--- + diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml new file mode 100644 index 0000000..7631965 --- /dev/null +++ b/.github/workflows/rust.yml @@ -0,0 +1,39 @@ +name: Rust + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Build + run: cargo build --verbose + + # The github ubuntu-latest is now on linux 5.11 kernel, + # so we can test the crate with support for each of the + # kernel featuresets: + + - name: Run tests (Linux 4.11 support) + run: cargo test --verbose + - name: Run tests (Linux 4.14 support) + run: cargo test --verbose --features linux4_14 + - name: Run tests (Linux 5.7 support) + run: cargo test --verbose --features linux5_7 + + audit: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Install Cargo Audit + run: cargo install cargo-audit + - name: Audit + run: cargo audit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..954917e --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +target/ +**/*.rs.bk +.google.json +TAGS +package +*.pyc +core.* +Cargo.lock
\ No newline at end of file @@ -29,7 +29,7 @@ rust_library { host_supported: true, crate_name: "userfaultfd", cargo_env_compat: true, - cargo_pkg_version: "0.5.0", + cargo_pkg_version: "0.5.1", srcs: ["src/lib.rs"], edition: "2018", features: ["default"], @@ -10,14 +10,14 @@ # See Cargo.toml.orig for the original contents. [package] -name = "userfaultfd" -version = "0.5.0" -authors = ["Adam C. Foltzer <acfoltzer@fastly.com>"] edition = "2018" -license = "MIT OR Apache-2.0" +name = "userfaultfd" +version = "0.5.1" +authors = ["The Wasmtime Project Developers"] description = "Rust bindings for the Linux userfaultfd functionality" -repository = "https://github.com/fastly/userfaultfd-rs" readme = "README.md" +license = "MIT OR Apache-2.0" +repository = "https://github.com/bytecodealliance/userfaultfd-rs" [dependencies.bitflags] version = "1.0" @@ -29,7 +29,7 @@ version = "^1.0.0" version = "0.2.65" [dependencies.nix] -version = "0.23" +version = "0.26" [dependencies.thiserror] version = "1.0.4" diff --git a/Cargo.toml.orig b/Cargo.toml.orig index 153efe6..04c8ca4 100644 --- a/Cargo.toml.orig +++ b/Cargo.toml.orig @@ -1,18 +1,18 @@ [package] name = "userfaultfd" -version = "0.5.0" -authors = ["Adam C. Foltzer <acfoltzer@fastly.com>"] +version = "0.5.1" +authors = ["The Wasmtime Project Developers"] edition = "2018" license = "MIT OR Apache-2.0" description = "Rust bindings for the Linux userfaultfd functionality" -repository = "https://github.com/fastly/userfaultfd-rs" +repository = "https://github.com/bytecodealliance/userfaultfd-rs" readme = "README.md" [dependencies] bitflags = "1.0" cfg-if = "^1.0.0" libc = "0.2.65" -nix = "0.23" +nix = "0.26" thiserror = "1.0.4" userfaultfd-sys = { path = "userfaultfd-sys", version = "^0.4.0" } @@ -1,3 +1,7 @@ +# This project was upgraded with external_updater. +# Usage: tools/external_updater/updater.sh update rust/crates/userfaultfd +# For more info, check https://cs.android.com/android/platform/superproject/+/master:tools/external_updater/README.md + name: "userfaultfd" description: "Rust bindings for the Linux userfaultfd functionality" third_party { @@ -7,14 +11,13 @@ third_party { } url { type: ARCHIVE - value: "https://static.crates.io/crates/userfaultfd/userfaultfd-0.5.0.crate" + value: "https://static.crates.io/crates/userfaultfd/userfaultfd-0.5.1.crate" } - version: "0.5.0" - # Dual-licensed, using the least restrictive per go/thirdpartylicenses#same. + version: "0.5.1" license_type: NOTICE last_upgrade_date { - year: 2022 - month: 11 - day: 16 + year: 2023 + month: 3 + day: 30 } } diff --git a/examples/manpage.rs b/examples/manpage.rs index f8d6848..29cccd0 100644 --- a/examples/manpage.rs +++ b/examples/manpage.rs @@ -3,9 +3,8 @@ use libc::{self, c_void}; use nix::poll::{poll, PollFd, PollFlags}; use nix::sys::mman::{mmap, MapFlags, ProtFlags}; use nix::unistd::{sysconf, SysconfVar}; -use std::env; use std::os::unix::io::AsRawFd; -use std::ptr; +use std::{convert::TryInto, env}; use userfaultfd::{Event, Uffd, UffdBuilder}; fn fault_handler_thread(uffd: Uffd) { @@ -15,8 +14,8 @@ fn fault_handler_thread(uffd: Uffd) { let page = unsafe { mmap( - ptr::null_mut(), - page_size, + None, + page_size.try_into().unwrap(), ProtFlags::PROT_READ | ProtFlags::PROT_WRITE, MapFlags::MAP_PRIVATE | MapFlags::MAP_ANONYMOUS, -1, @@ -64,7 +63,7 @@ fn fault_handler_thread(uffd: Uffd) { } fault_cnt += 1; - let dst = (addr as usize & !(page_size as usize - 1)) as *mut c_void; + let dst = (addr as usize & !(page_size - 1)) as *mut c_void; let copy = unsafe { uffd.copy(page, dst, page_size, true).expect("uffd copy") }; println!(" (uffdio_copy.copy returned {})", copy); @@ -98,8 +97,8 @@ fn main() { let addr = unsafe { mmap( - ptr::null_mut(), - len, + None, + len.try_into().unwrap(), ProtFlags::PROT_READ | ProtFlags::PROT_WRITE, MapFlags::MAP_PRIVATE | MapFlags::MAP_ANONYMOUS, -1, |