8000 mach: read_string: don't read unreadable memory by schopin-mozilla · Pull Request #250 · rust-minidump/minidump-writer · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions src/mac/streams/module_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -344,14 +344,6 @@ mod test {
/// both the local and intra-process scenarios
#[test]
fn images_match() {
if std::env::var_os("CI").is_some() && cfg!(target_arch = "aarch64") {
// https://github.com/rust-minidump/minidump-writer/issues/101
println!(
"this fails on github actions but works on a local aarch64-apple-darwin machine..."
);
return;
}

let mdw = MinidumpWriter::new(None, None);
let td = TaskDumper::new(mdw.task);

Expand Down
8 changes: 7 additions & 1 deletion src/mac/task_dumper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,12 @@ pub struct VMRegionInfo {
pub range: std::ops::Range<u64>,
}

impl VMRegionInfo {
fn is_readable(&self) -> bool {
self.info.protection & mach2::vm_prot::VM_PROT_READ != 0
}
}

/// Similarly to PtraceDumper for Linux, this provides access to information
/// for a task (MacOS process)
pub struct TaskDumper {
Expand Down Expand Up @@ -205,7 +211,7 @@ impl TaskDumper {
if size_to_end < 4 * 1024 {
let maybe_adjacent = self.get_vm_region(region.range.end)?;

if maybe_adjacent.range.start == region.range.end {
if maybe_adjacent.range.start == region.range.end && maybe_adjacent.is_readable() {
size_to_end += maybe_adjacent.range.end - maybe_adjacent.range.start;
}
}
Expand Down
Loading
0