{
  "finding_id": "DF-2948",
  "status": "reproduced",
  "reproduced": 1,
  "impact": "panic",
  "confidence": "certain",
  "verdict": "init_param2() clamps the computed ncallout to 5*60*hz (subr_param.c:328-329) and only THEN fetches the kern.ncallout tunable (line 330), so the tunable enters the kernel with no bounds at all. The consumer swi_softclock_setup() (kern_timeout.c:374-413) does all sizing in int: with kern.ncallout=2147483647 on the 6-vCPU guest, target=357913966 doubles cwheelsize to 2^30 and 'int wheel_sz = sizeof(struct wheel)*cwheelsize' = 24*2^30 = 25769803776 truncates to 0 (mod 2^32); the six per-CPU kmem_alloc3(kernel_map, 0) zero-length callwheel allocations collide and the kernel panics 'vm_map_entry_link: dup addr' during SI_SUB_SOFTCLOCKS, dead in DDB, ssh never up — unbootable until loader.conf is repaired. Behind that map panic lies the latent outcome spelled out in the sink code: a 2^30-iteration spin_init/TAILQ_INIT loop writing ~25 GB past a zero-byte allocation (kern_timeout.c:410-413), and on <=2-vCPU boxes target can be driven into (2^30,2^31) where the cwheelsize doubling loop itself executes 1<<31 (signed overflow -> negative -> 0) and hangs boot forever. Distinct from DF-0174 (ncallout overflow via unbounded kern.maxfiles): the direct tunable bypasses the sum entirely, and no maxfiles clamp can bound it.",
  "exploit_chain": "1) privileged/console plant: kern.ncallout=\"2147483647\" in /boot/loader.conf; 2) init_param2 fetches it AFTER the 5*60*hz clamp -> unbounded int ncallout; 3) swi_softclock_setup: target=ncallout/ncpus+16, cwheelsize doubles to 2^30, int wheel_sz truncates 24*2^30 to 0; 4) per-CPU kmem_alloc3(kernel_map, 0) -> second allocation collides -> panic vm_map_entry_link: dup addr; machine will not boot until loader.conf repaired. Latent variants: zero/small truncated wheel_sz with intact 2^30 init loop -> massive kernel OOB write; 1-2 vCPU -> 1<<31 signed-shift overflow -> infinite boot loop. No post-boot or unprivileged trigger (kern.ncallout has no runtime sysctl).",
  "evidence": [
    "panic.txt — 'panic: vm_map_entry_link: dup addr map 0xffffffff8159aea0 ent 0xffffffff81709b18' + trace + Debugger(\"panic\") + db> right after 'Initialize MI interrupts for 6 cpus' (SI_SUB_SOFTCLOCKS)",
    "env.txt — stock kernel identity (6.5-DEVELOPMENT #0, X86_64_GENERIC, hw.ncpu=6)",
    "run.sh — exact host-side sequence (pristine single-variable plant after a clean reset)",
    "VERDICT.md — arithmetic derivation (24*2^30 mod 2^32 == 0), two runs (one with stale harmless kern.nbuf line, one pristine, identical panic), duplicate-separation vs DF-0174",
    "fix.diff — clamp kern.ncallout after the fetch in init_param2 + size_t wheel sizing with sanity cap and KKASSERT in swi_softclock_setup"
  ],
  "kernel_refs": [
    "sys/kern/subr_param.c:327-330",
    "sys/kern/kern_timeout.c:386",
    "sys/kern/kern_timeout.c:388-391",
    "sys/kern/kern_timeout.c:398",
    "sys/kern/kern_timeout.c:406-413"
  ],
  "poc_changes": "no compilation needed: trigger is a single loader.conf line; value 2147483647 (INT_MAX) chosen so target=INT_MAX/6+16 lands below 2^31 (avoiding only the unreachable-on-6-cpu infinite-loop variant) while forcing cwheelsize=2^30 and the wheel_sz int truncation to exactly 0",
  "attempts": 2,
  "guest_uname": "DragonFly dfbsd 6.5-DEVELOPMENT DragonFly 6.5-DEVELOPMENT #0: Thu Jul  2 06:02:54 UTC 2026     root@dfbsd:/usr/obj/usr/src/sys/X86_64_GENERIC  x86_64",
  "runtime_sec": 420,
  "guest_dirty": 0,
  "build_cmd": "n/a (boot-tunable trigger; no build step)",
  "run_cmd": "vm.sh run_root 'printf \"kern.ncallout=\\\"2147483647\\\"\\n\" >> /boot/loader.conf && sync'; vm.sh run_root 'shutdown -r now'; sleep 80; vm.sh status; grep panic dfbsd-qemu/boot.log; vm.sh reset with-src",
  "code_hash": "75c2846d0adeddf76076c6fd864198c3dec55cfc295d078c620c2cd8599677ad",
  "notes": "Two runs: first with a leftover (separately proven harmless) kern.nbuf line, second pristine after vm.sh reset — identical panic signature and map/ent addresses. Guest returned to clean with-src snapshot (vm.sh status = up) after verification. DF-2947 slot (negative kern.nbuf boot corruption) was REFUTED live on this guest and intentionally not filed: the cpu_startup caps compare signed nbuf against unsigned vm_offset_t expressions, promoting -1048576 to ~2^64 and clamping it back to a sane positive (129940) — boot.log lines 'Warning: nbufs capped at 67098975 due to kvm' / '129940 due to physmem'.",
  "recommended_fix": "Move the 5*60*hz (and a lower-bound) clamp to AFTER the TUNABLE_INT_FETCH(\"kern.ncallout\") in init_param2; harden swi_softclock_setup with a target sanity cap and size_t wheel_sz.",
  "fix_status": "not_testable",
  "fix_kernel_uname": "",
  "fix_baseline_reproduced": 1,
  "fix_patched_reproduced": 0,
  "fix_verdict": "Fix not built in-guest: demonstrated manifestation is a boot panic (DoS), not memory corruption — the OOB-init-loop outcome is latent behind the vm_map_entry_link panic, so per contract the kernel-rebuild validation cycle is reserved for findings with demonstrated corruption; fix.diff is a minimal line-accurate clamp + sink hardening authored against the read-only sys/ tree.",
  "fix_evidence": ["fix.diff"]
}
