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
1 KiB
C++
21 lines
1 KiB
C++
// /proc, PSI and cgroup text parsers used by the resource governor.
|
|
#include "strawberry/resource_governor.hpp"
|
|
|
|
#include <cstdint>
|
|
#include <cstdlib>
|
|
#include <string_view>
|
|
|
|
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
|
|
const std::string_view text(reinterpret_cast<const char*>(data), size);
|
|
using namespace strawberry;
|
|
if (auto v = parse_psi_some_avg10(text); v && (*v < 0 || *v > 100)) std::abort();
|
|
if (auto v = parse_loadavg_1m(text); v && *v < 0) std::abort();
|
|
if (auto m = parse_meminfo(text); m && m->total_bytes == 0) std::abort();
|
|
if (auto c = parse_proc_stat(text); c && c->online_cpus == 0) std::abort();
|
|
(void) parse_self_stat_cpu(text);
|
|
(void) parse_status_rss(text);
|
|
if (auto p = parse_cgroup_v2_path(text); p && (p->empty() || p->front() != '/' || p->find("..") != std::string::npos)) std::abort();
|
|
if (auto m = parse_cgroup_memory_max(text); m && *m == 0) std::abort();
|
|
if (auto c = parse_cgroup_cpu_max(text); c && *c <= 0) std::abort();
|
|
return 0;
|
|
}
|