Fix for the 2026-10-25 host freeze (an uncaught iostream exception on a /proc read aborted the daemon; its core dump deadlocked with the exec guard): non-throwing /proc reads, crash handlers that release fanotify permission fds, guarded thread entries, from_chars parsing. Adds the io fault-injection seam with property tests, source invariant checks (R1-R6) with self-test fixtures, libFuzzer targets and seeds (including I/O-fault fuzzing), the fold changed-files scan scripts and the agent workflow docs (CLAUDE.md, prompts). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
27 lines
1.1 KiB
C++
27 lines
1.1 KiB
C++
#ifndef STRAWBERRY_CRASH_SAFETY_HPP
|
|
#define STRAWBERRY_CRASH_SAFETY_HPP
|
|
|
|
// A process holding a fanotify FAN_OPEN_EXEC_PERM group must never die slowly:
|
|
// until its fanotify fd is closed, every exec on the host waits for it. On
|
|
// 2026-10-25 the daemon aborted, the kernel started a core dump, the dump
|
|
// helper (an exec) waited on the dying exec guard, and the host froze.
|
|
//
|
|
// install_crash_safety():
|
|
// - marks the process non-dumpable (no core dump, so no helper exec);
|
|
// - on SIGSEGV/SIGBUS/SIGILL/SIGFPE/SIGABRT/SIGTRAP and std::terminate,
|
|
// closes every registered permission fd first (the kernel then answers
|
|
// pending events with allow), then re-raises with the default action.
|
|
// Registered fds are plain ints in a fixed lock-free table (signal-safe).
|
|
|
|
namespace strawberry {
|
|
|
|
void install_crash_safety();
|
|
/// Register / unregister a fanotify permission fd (thread- and signal-safe).
|
|
void register_permission_fd(int fd);
|
|
void unregister_permission_fd(int fd);
|
|
/// Close all registered fds now (what the handlers do). Exposed for tests.
|
|
void release_permission_fds_for_crash();
|
|
|
|
} // namespace strawberry
|
|
|
|
#endif // STRAWBERRY_CRASH_SAFETY_HPP
|