From a11f67c619d80d51db486e3863bd374b1377a6e7 Mon Sep 17 00:00:00 2001 From: edef Date: Fri, 29 Jul 2022 21:11:57 +0000 Subject: ripple/minitrace: verify rt_sigaction signal strictly Change-Id: I9237b8740fea2b84174b77487fc42e9464a0b2fc --- ripple/minitrace/src/main.rs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'ripple/minitrace/src') diff --git a/ripple/minitrace/src/main.rs b/ripple/minitrace/src/main.rs index e7da54e..01f7d18 100644 --- a/ripple/minitrace/src/main.rs +++ b/ripple/minitrace/src/main.rs @@ -10,7 +10,7 @@ use { sys::{ personality::{self, Persona}, ptrace, - signal::Signal, + signal::Signal as HostSignal, wait::{waitpid, WaitPidFlag, WaitStatus}, }, unistd::Pid, @@ -75,7 +75,7 @@ impl Process { let tgid = Tgid(child.id() as _); match waitpid(tgid.as_pid(), None).context("Couldn't waitpid on fresh child")? { - WaitStatus::Stopped(_, Signal::SIGTRAP) => {} + WaitStatus::Stopped(_, HostSignal::SIGTRAP) => {} status => bail!("unexpected child state: {status:?}"), } @@ -345,7 +345,7 @@ define_syscalls! { fn mmap(addr: u64, len: u64, prot: ProtFlags, flags: MapFlags, fd: FileDesc, off: u64) -> i64 = 9; fn mprotect(addr: u64, len: usize, prot: ProtFlags) -> i64 = 10; fn brk(brk: u64) -> i64 = 12; - fn rt_sigaction(sig: i32, act: *const SigAction, oact: *mut SigAction, sigsetsize: usize) -> i64 = 13; + fn rt_sigaction(sig: Signal, act: *const SigAction, oact: *mut SigAction, sigsetsize: usize) -> i64 = 13; fn ioctl(fd: FileDesc, cmd: Ioctl, arg: u64) -> i64 = 16; fn pread64(fd: FileDesc, buf: *mut u8, count: usize, pos: u64) -> i64 = 17; fn access(filename: CString, mode: AccessMode) -> i64 = 21; @@ -607,4 +607,12 @@ syscall_enums! { TCGETS = 0x5401 => TCGETS, TIOCGWINSZ = 0x5413 => TIOCGWINSZ, } + + enum Signal: i32 { + ILL = 4 => SIGILL, + ABRT = 6 => SIGABRT, + BUS = 7 => SIGBUS, + FPE = 8 => SIGFPE, + SEGV = 11 => SIGSEGV, + } } -- cgit 1.4.1