WIP(ptrace): Better support for signals

Signals now cause an event, and there's a way to continue until the
next signal. I can see this being used for detection of `int3`
although I'm not entirely sure as it may prove being too late to stop
abortion of process.
This commit is contained in:
jD91mZM2
2019-07-21 19:56:19 +02:00
parent 1ee9229c6a
commit 85a45f382c
2 changed files with 10 additions and 6 deletions

View File

@@ -305,21 +305,22 @@ impl DerefMut for FloatRegisters {
#[derive(Clone, Copy)]
#[repr(C)]
pub union PtraceEventContent {
pub union PtraceEventData {
pub clone: usize,
pub signal: usize
}
impl Default for PtraceEventContent {
impl Default for PtraceEventData {
fn default() -> Self {
Self {
clone: 0
clone: 0,
}
}
}
impl fmt::Debug for PtraceEventContent {
impl fmt::Debug for PtraceEventData {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "PtraceEventContent(...)")
write!(f, "PtraceEventData(...)")
}
}
@@ -327,7 +328,7 @@ impl fmt::Debug for PtraceEventContent {
#[repr(C)]
pub struct PtraceEvent {
pub tag: u16,
pub data: PtraceEventContent,
pub data: PtraceEventData,
}
impl Deref for PtraceEvent {

View File

@@ -69,10 +69,13 @@ pub const PTRACE_CONT: u8 = 0b0000_0001;
pub const PTRACE_SINGLESTEP: u8 = 0b0000_0010;
pub const PTRACE_SYSCALL: u8 = 0b0000_0011;
pub const PTRACE_WAIT: u8 = 0b0000_0100;
pub const PTRACE_SIGNAL: u8 = 0b0000_0101;
pub const PTRACE_OPERATIONMASK: u8 = 0b0000_1111;
pub const PTRACE_SYSEMU: u8 = 0b0001_0000;
pub const PTRACE_EVENT_CLONE: u16 = 0;
pub const PTRACE_EVENT_SIGNAL: u16 = 1;
pub const SEEK_SET: usize = 0;
pub const SEEK_CUR: usize = 1;