mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-06-04 11:14:48 +02:00
73 lines
3.2 KiB
Diff
73 lines
3.2 KiB
Diff
diff --git a/src/event_log.rs b/src/event_log.rs
|
|
index 5b668f7..896925f 100644
|
|
--- a/src/event_log.rs
|
|
+++ b/src/event_log.rs
|
|
@@ -123,19 +123,19 @@ impl TraceEvent {
|
|
PTRACE_EVENT_CLONE => {
|
|
event.description = "Ptrace Clone".to_string();
|
|
if *sig == Signal::SIGTRAP {
|
|
- event.child = get_event_data(*pid).ok();
|
|
+ event.child = get_event_data(*pid).ok().map(|x| x as i64);
|
|
}
|
|
}
|
|
PTRACE_EVENT_FORK => {
|
|
event.description = "Ptrace fork".to_string();
|
|
if *sig == Signal::SIGTRAP {
|
|
- event.child = get_event_data(*pid).ok();
|
|
+ event.child = get_event_data(*pid).ok().map(|x| x as i64);
|
|
}
|
|
}
|
|
PTRACE_EVENT_VFORK => {
|
|
event.description = "Ptrace vfork".to_string();
|
|
if *sig == Signal::SIGTRAP {
|
|
- event.child = get_event_data(*pid).ok();
|
|
+ event.child = get_event_data(*pid).ok().map(|x| x as i64);
|
|
}
|
|
}
|
|
PTRACE_EVENT_EXEC => {
|
|
diff --git a/src/process_handling/breakpoint.rs b/src/process_handling/breakpoint.rs
|
|
index 32b37f8..b0d1ce9 100644
|
|
--- a/src/process_handling/breakpoint.rs
|
|
+++ b/src/process_handling/breakpoint.rs
|
|
@@ -1,5 +1,6 @@
|
|
use crate::ptrace_control::*;
|
|
use crate::statemachine::*;
|
|
+use nix::libc::c_long;
|
|
use nix::unistd::Pid;
|
|
use nix::{Error, Result};
|
|
use std::collections::HashMap;
|
|
@@ -56,8 +57,8 @@ impl Breakpoint {
|
|
pub fn enable(&mut self, pid: Pid) -> Result<()> {
|
|
let data = read_address(pid, self.aligned_address())?;
|
|
self.is_running.insert(pid, true);
|
|
- let mut intdata = data & (!(0xFFu64 << self.shift) as i64);
|
|
- intdata |= (INT << self.shift) as i64;
|
|
+ let mut intdata = data & (!(0xFFu64 << self.shift) as c_long);
|
|
+ intdata |= (INT << self.shift) as c_long;
|
|
if data == intdata {
|
|
Err(Error::UnknownErrno)
|
|
} else {
|
|
@@ -68,8 +69,8 @@ impl Breakpoint {
|
|
pub fn disable(&self, pid: Pid) -> Result<()> {
|
|
// I require the bit fiddlin this end.
|
|
let data = read_address(pid, self.aligned_address())?;
|
|
- let mut orgdata = data & (!(0xFFu64 << self.shift) as i64);
|
|
- orgdata |= i64::from(self.data) << self.shift;
|
|
+ let mut orgdata = data & (!(0xFFu64 << self.shift) as c_long);
|
|
+ orgdata |= c_long::from(self.data) << self.shift;
|
|
write_to_address(pid, self.aligned_address(), orgdata)
|
|
}
|
|
|
|
diff --git a/src/process_handling/ptrace_control.rs b/src/process_handling/ptrace_control.rs
|
|
index 284c637..cdf2f2d 100644
|
|
--- a/src/process_handling/ptrace_control.rs
|
|
+++ b/src/process_handling/ptrace_control.rs
|
|
@@ -39,7 +39,7 @@ pub fn read_address(pid: Pid, address: u64) -> Result<c_long> {
|
|
read(pid, address as AddressType)
|
|
}
|
|
|
|
-pub fn write_to_address(pid: Pid, address: u64, data: i64) -> Result<()> {
|
|
+pub fn write_to_address(pid: Pid, address: u64, data: c_long) -> Result<()> {
|
|
write(pid, address as AddressType, data)
|
|
}
|
|
|