include/strawberry/platform_process.hpp answers what /proc answers on Linux: running PIDs (proc_listallpids), executable path (proc_pidpath), parent and start time (sysctl KERN_PROC_PID, readable for every process), argv (KERN_PROCARGS2) and a boot id (kern.bootsessionuuid). A process is identified by its start time in microseconds since the epoch plus the boot id, so node ids survive PID reuse as on Linux. It is header-only, so the per-test source lists stay as they are. Users on macOS: resolve_process_ref (default root), the pipeline's image hashing and exec-decision actor, and YaraScanner::scan_process (scans the image by path). A synthetic procfs root still takes the procfs code, so the existing procfs tests run on macOS too. The resource governor samples Mach/sysctl on macOS: own CPU from getrusage, RSS from task_info, load from getloadavg, available memory from host_statistics64 (free + inactive + purgeable + speculative). The behavior engine knows macOS debuggers (debugserver, dtrace) and kext loaders (kernelmanagerd, kmutil), and macOS temp and Downloads paths count as drop locations. The Linux lists are unchanged. The KERN_PROCARGS2 parser is portable: a property test (exact argv recovery, truncation never invents data, total on junk) and the fuzz_procargs target run on every platform. test_platform_process checks the live helpers against this process; the daemon test reads the stopped state through sysctl on macOS. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
45 lines
1.9 KiB
Meson
45 lines
1.9 KiB
Meson
# libFuzzer targets for every boundary that parses untrusted or
|
|
# attacker-influenced input. Build with clang:
|
|
# CC=clang CXX=clang++ meson setup build/fuzz -Denable_fuzzing=true -Denable_app=disabled
|
|
# nice -n 19 ninja -C build/fuzz -j2
|
|
# scripts/run_fuzzers.sh 60 # each target for 60 s, capped
|
|
fuzz_args = ['-fsanitize=fuzzer']
|
|
fuzz_targets = {
|
|
'fuzz_ioc_list': ['fuzz_ioc_list.cpp', '../src/rule_updater.cpp', '../src/yara_scanner.cpp'],
|
|
'fuzz_policy_apply': ['fuzz_policy_apply.cpp'],
|
|
'fuzz_governor_parsers': ['fuzz_governor_parsers.cpp'],
|
|
'fuzz_status_snapshot': ['fuzz_status_snapshot.cpp'],
|
|
'fuzz_config': ['fuzz_config.cpp'],
|
|
'fuzz_record_decoder': ['fuzz_record_decoder.cpp'],
|
|
'fuzz_block_decoder': ['fuzz_block_decoder.cpp'],
|
|
'fuzz_segment_reader': ['fuzz_segment_reader.cpp'],
|
|
'fuzz_manifest': ['fuzz_manifest.cpp'],
|
|
'fuzz_evidence_records': ['fuzz_evidence_records.cpp'],
|
|
'fuzz_legacy_kv': ['fuzz_legacy_kv.cpp'],
|
|
'fuzz_procargs': ['fuzz_procargs.cpp'],
|
|
}
|
|
foreach name, sources : fuzz_targets
|
|
extra = name == 'fuzz_ioc_list' ? [updater_feature_dep, yara_dep, yara_feature_dep] : []
|
|
executable(name, sources,
|
|
include_directories: inc_dirs,
|
|
dependencies: [strawberry_core_dep] + extra,
|
|
link_args: fuzz_args,
|
|
)
|
|
endforeach
|
|
# I/O-failure fuzzing: its sources are compiled with the fault injector on, so
|
|
# it does not link strawberry_core (whose objects have no injector).
|
|
executable('fuzz_io_faults',
|
|
'fuzz_io_faults.cpp', '../src/hash_utils.cpp', '../src/resource_governor.cpp',
|
|
include_directories: inc_dirs,
|
|
cpp_args: ['-DSTRAWBERRY_FAULT_INJECTION=1'],
|
|
dependencies: [openssl_dep, threads_dep],
|
|
link_args: fuzz_args,
|
|
)
|
|
if get_option('enable_mcp').allowed()
|
|
executable('fuzz_mcp_handle', 'fuzz_mcp_handle.cpp',
|
|
include_directories: inc_dirs,
|
|
link_with: strawberry_mcp_lib,
|
|
dependencies: [nlohmann_json_dep, strawberry_core_dep],
|
|
link_args: fuzz_args,
|
|
)
|
|
endif
|