From 15a889b6d516dee4e494a03ad19d6aea4d5e430f Mon Sep 17 00:00:00 2001 From: Daniel Fox Franke Date: Thu, 2 Feb 2023 09:03:19 -0500 Subject: [PATCH] Forbid SIGBUS SIGBUS is similar to SIGSEGV in regards to when it is raised and the sort of special handling required for recovery. --- signal-hook-registry/src/lib.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/signal-hook-registry/src/lib.rs b/signal-hook-registry/src/lib.rs index 9dca7c7..a4bea94 100644 --- a/signal-hook-registry/src/lib.rs +++ b/signal-hook-registry/src/lib.rs @@ -80,9 +80,9 @@ use libc::{c_int, c_void, sigaction, siginfo_t}; use libc::{c_int, sighandler_t}; #[cfg(not(windows))] -use libc::{SIGFPE, SIGILL, SIGKILL, SIGSEGV, SIGSTOP}; +use libc::{SIGBUS, SIGFPE, SIGILL, SIGKILL, SIGSEGV, SIGSTOP}; #[cfg(windows)] -use libc::{SIGFPE, SIGILL, SIGSEGV}; +use libc::{SIGBUS, SIGFPE, SIGILL, SIGSEGV}; use half_lock::HalfLock; @@ -387,9 +387,9 @@ extern "C" fn handler(sig: c_int, info: *mut siginfo_t, data: *mut c_void) { pub const FORBIDDEN: &[c_int] = FORBIDDEN_IMPL; #[cfg(windows)] -const FORBIDDEN_IMPL: &[c_int] = &[SIGILL, SIGFPE, SIGSEGV]; +const FORBIDDEN_IMPL: &[c_int] = &[SIGILL, SIGFPE, SIGSEGV, SIGBUS]; #[cfg(not(windows))] -const FORBIDDEN_IMPL: &[c_int] = &[SIGKILL, SIGSTOP, SIGILL, SIGFPE, SIGSEGV]; +const FORBIDDEN_IMPL: &[c_int] = &[SIGKILL, SIGSTOP, SIGILL, SIGFPE, SIGSEGV, SIGBUS]; /// Registers an arbitrary action for the given signal. /// @@ -412,6 +412,7 @@ const FORBIDDEN_IMPL: &[c_int] = &[SIGKILL, SIGSTOP, SIGILL, SIGFPE, SIGSEGV]; /// * `SIGILL` /// * `SIGFPE` /// * `SIGSEGV` +/// * `SIGBUS` /// /// The first two are not possible to override (and the underlying C functions simply ignore all /// requests to do so, which smells of possible bugs, or return errors). The rest can be set, but