Skip to content

Commit

Permalink
Update deps + fix clippy (rust-minidump#75)
Browse files Browse the repository at this point in the history
* Update deps + fix clippy

* Cleanup

* Disable android for now
  • Loading branch information
Jake-Shadle authored Mar 28, 2023
1 parent 9a3d010 commit 59179c8
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 34 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: deny audit
uses: EmbarkStudios/cargo-deny-action@v1
with:
Expand Down
22 changes: 11 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ jobs:
strategy:
matrix:
job:
- { os: ubuntu-20.04 , target: x86_64-unknown-linux-gnu }
- { os: ubuntu-20.04, target: x86_64-unknown-linux-musl }
- { os: ubuntu-22.04, target: x86_64-unknown-linux-gnu }
- { os: ubuntu-22.04, target: x86_64-unknown-linux-musl }
- { os: windows-2022, target: x86_64-pc-windows-msvc }
- { os: macos-12, target: x86_64-apple-darwin }
# TODO: Add macos aarch64 here once it becomes available as a runner
Expand All @@ -57,17 +57,17 @@ jobs:
strategy:
matrix:
job:
- { os: ubuntu-latest, target: i686-unknown-linux-gnu, use-cross: true }
- { os: ubuntu-22.04, target: i686-unknown-linux-gnu, use-cross: true }
#- { os: ubuntu-latest, target: i686-unknown-linux-musl, use-cross: true }
- { os: ubuntu-latest, target: aarch64-unknown-linux-gnu, use-cross: true }
- { os: ubuntu-latest, target: aarch64-unknown-linux-musl, use-cross: true }
- { os: ubuntu-latest, target: aarch64-linux-android, use-cross: true }
- { os: ubuntu-latest, target: arm-unknown-linux-gnueabi, use-cross: true }
- { os: ubuntu-latest, target: arm-unknown-linux-musleabi, use-cross: true }
- { os: ubuntu-latest, target: arm-linux-androideabi, use-cross: true }
- { os: ubuntu-latest, target: arm-unknown-linux-gnueabihf, use-cross: true }
- { os: ubuntu-22.04, target: aarch64-unknown-linux-gnu, use-cross: true }
- { os: ubuntu-22.04, target: aarch64-unknown-linux-musl, use-cross: true }
#- { os: ubuntu-22.04, target: aarch64-linux-android, use-cross: true }
- { os: ubuntu-22.04, target: arm-unknown-linux-gnueabi, use-cross: true }
- { os: ubuntu-22.04, target: arm-unknown-linux-musleabi, use-cross: true }
- { os: ubuntu-22.04, target: arm-linux-androideabi, use-cross: true }
- { os: ubuntu-22.04, target: arm-unknown-linux-gnueabihf, use-cross: true }
# TODO: Remove this when aarch64 macs can be used as runners
- { os: macos-latest, target: aarch64-apple-darwin, use-cross: false }
- { os: macos-12, target: aarch64-apple-darwin, use-cross: false }
steps:
- uses: actions/checkout@v3
- name: Install Rust
Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ license = "MIT"
byteorder = "1.3.2"
cfg-if = "1.0"
crash-context = "0.5"
memoffset = "0.7"
memoffset = "0.8"
minidump-common = "0.15"
scroll = "0.11"
tempfile = "3.1.0"
Expand All @@ -24,7 +24,7 @@ goblin = "0.6"
memmap2 = "0.5"

[target.'cfg(any(target_os = "linux", target_os = "android"))'.dependencies]
nix = { version = "0.25", default-features = false, features = [
nix = { version = "0.26", default-features = false, features = [
"mman",
"process",
"ptrace",
Expand Down
4 changes: 2 additions & 2 deletions src/bin/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,11 @@ mod linux {

fn spawn_mmap_wait() -> Result<()> {
let page_size = nix::unistd::sysconf(nix::unistd::SysconfVar::PAGE_SIZE).unwrap();
let memory_size = page_size.unwrap() as usize;
let memory_size = std::num::NonZeroUsize::new(page_size.unwrap() as usize).unwrap();
// Get some memory to be mapped by the child-process
let mapped_mem = unsafe {
mmap(
std::ptr::null_mut(),
None,
memory_size,
ProtFlags::PROT_READ | ProtFlags::PROT_WRITE,
MapFlags::MAP_PRIVATE | MapFlags::MAP_ANON,
Expand Down
22 changes: 11 additions & 11 deletions src/linux/dso_debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,21 @@ pub struct LinkMap {
}

// COPY from <link.h>
#[derive(Debug, Clone)]
/// This state value describes the mapping change taking place when
/// the `r_brk' address is called.
#[derive(Debug, Clone, Default)]
#[allow(non_camel_case_types, unused)]
#[repr(C)]
enum RState {
/* This state value describes the mapping change taking place when
the `r_brk' address is called. */
RT_CONSISTENT, /* Mapping change is complete. */
RT_ADD, /* Beginning to add a new object. */
RT_DELETE, /* Beginning to remove an object mapping. */
}
impl Default for RState {
fn default() -> Self {
RState::RT_CONSISTENT // RStates are not used anyway
}
/// Mapping change is complete.
#[default]
RT_CONSISTENT,
/// Beginning to add a new object.
RT_ADD,
/// Beginning to remove an object mapping.
RT_DELETE,
}

// COPY from <link.h>
#[derive(Debug, Clone, Default)]
#[repr(C)]
Expand Down
1 change: 0 additions & 1 deletion src/linux/ptrace_dumper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,6 @@ impl PtraceDumper {
if task_path.is_dir() {
std::fs::read_dir(task_path)
.map_err(|e| InitError::IOError(filename, e))?
.into_iter()
.filter_map(|entry| entry.ok()) // Filter out bad entries
.filter_map(|entry| {
entry
Expand Down
12 changes: 6 additions & 6 deletions tests/ptrace_dumper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ fn test_linux_gate_mapping_id() {
#[test]
fn test_merged_mappings() {
let page_size = nix::unistd::sysconf(nix::unistd::SysconfVar::PAGE_SIZE).unwrap();
let page_size = page_size.unwrap() as usize;
let map_size = 3 * page_size;
let page_size = std::num::NonZeroUsize::new(page_size.unwrap() as usize).unwrap();
let map_size = std::num::NonZeroUsize::new(3 * page_size.get()).unwrap();

let path: &'static str = std::env!("CARGO_BIN_EXE_test");
let file = std::fs::File::open(path).unwrap();
Expand All @@ -124,7 +124,7 @@ fn test_merged_mappings() {
// enclosed in the other, but with different protections.
let mapped_mem = unsafe {
mmap(
std::ptr::null_mut(),
None,
map_size,
ProtFlags::PROT_READ,
MapFlags::MAP_SHARED,
Expand All @@ -137,14 +137,14 @@ fn test_merged_mappings() {
// Carve a page out of the first mapping with different permissions.
let _inside_mapping = unsafe {
mmap(
(mapped_mem as usize + 2 * page_size) as *mut libc::c_void,
std::num::NonZeroUsize::new(mapped_mem as usize + 2 * page_size.get()),
page_size,
ProtFlags::PROT_NONE,
MapFlags::MAP_SHARED | MapFlags::MAP_FIXED,
file.as_raw_fd(),
// Map a different offset just to
// better test real-world conditions.
page_size.try_into().unwrap(), // try_into() in order to work for 32 and 64 bit
page_size.get().try_into().unwrap(), // try_into() in order to work for 32 and 64 bit
)
};

Expand All @@ -153,7 +153,7 @@ fn test_merged_mappings() {
&[
path,
&format!("{}", mapped_mem as usize),
&format!("{}", map_size),
&format!("{map_size}"),
],
);
}
Expand Down

0 comments on commit 59179c8

Please sign in to comment.