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>
26 lines
1.1 KiB
C++
26 lines
1.1 KiB
C++
// Control-socket payload verbs: arbitrary JSON from group members, applied by root.
|
|
#include "strawberry/policy.hpp"
|
|
|
|
#include <cstdint>
|
|
#include <cstdlib>
|
|
#include <filesystem>
|
|
#include <string>
|
|
#include <unistd.h>
|
|
|
|
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
|
|
if (size == 0) return 0;
|
|
static const char* verbs[] = {"allowlist-add", "allowlist-remove", "feed-add", "feed-remove",
|
|
"feed-set-enabled", "protection-set", "contain-add", "bogus"};
|
|
static const std::string dir = "/tmp/strawberry-fuzz-policy-" + std::to_string(::getpid());
|
|
std::filesystem::create_directories(dir);
|
|
strawberry::PolicyStore store(dir + "/policy.json");
|
|
std::string error;
|
|
if (!store.load(&error)) std::abort();
|
|
const std::string payload(reinterpret_cast<const char*>(data) + 1, size - 1);
|
|
(void) store.apply(verbs[data[0] % 8], payload, 1000, &error);
|
|
// Whatever was accepted must reload.
|
|
strawberry::PolicyStore again(dir + "/policy.json");
|
|
if (!again.load(&error)) std::abort();
|
|
std::filesystem::remove(dir + "/policy.json");
|
|
return 0;
|
|
}
|