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>
21 lines
898 B
C++
21 lines
898 B
C++
// Allowed patterns: the checker must not flag any of these.
|
|
#include "strawberry/parse_num.hpp"
|
|
#include "strawberry/proc_read.hpp"
|
|
#include "strawberry/thread_entry.hpp"
|
|
#include <csignal>
|
|
#include <fstream>
|
|
#include <thread>
|
|
#include <vector>
|
|
void handler(int) noexcept {}
|
|
struct W {
|
|
std::vector<std::thread> workers_;
|
|
std::thread t_;
|
|
void start() {
|
|
t_ = std::thread(strawberry::run_guarded("t", [] {}));
|
|
workers_.emplace_back(strawberry::run_guarded("w", [] {}));
|
|
}
|
|
};
|
|
int pid(const std::string& s) { return strawberry::parse_number<int>(s).value_or(-1); }
|
|
std::string boot() { return strawberry::read_small_file_or_empty("/proc/sys/kernel/random/boot_id"); }
|
|
std::ifstream config(const char* p) { return std::ifstream(p); } // invariant-allow(ifstream): fixture
|
|
void install() { struct sigaction a{}; a.sa_handler = handler; sigaction(SIGSEGV, &a, nullptr); }
|