DF-5683 / vq_leak.c
/* * DF-5683 — sys_vquotactl() leaks every prop object per call (unprivileged). * * Drives the exact kernel path: * sys_vquotactl (sys/kern/vfs_quota.c:328) * -> prop_dictionary_copyin (&pref, &dict) [vfs_quota.c:346] * -> prop_dictionary_get_cstring "command" -> cmd [vfs_quota.c:362] * -> prop_array_create pa_out [vfs_quota.c:374] * -> dict = prop_dictionary_create() [vfs_quota.c:405] * -> prop_dictionary_copyout(&pref, dict) [vfs_quota.c:408] * ...and none of dict/cmd/pa_out/odict is ever released. * * We use the base-system tool vquota(8) (sbin/vquota/vquota.c send_command) * which performs exactly one vquotactl(2) per invocation with the * "get usage all" command — no custom marshalling needed. * * Build: nothing to compile (shell driver + base-system vquota). * Run: as an UNPRIVILEGED user on a kernel booted with vfs.quota_enabled=1. * Success criterion: kernel "prop *" malloc-type InUse/MemUse grows linearly * with the call count (vmstat -m), never returns, no error from vquota. */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <errno.h> #include <unistd.h> /* Not compiled by default; kept as documentation of the raw syscall form. */ int main(void) { fprintf(stderr, "use vq_leak.sh (drives /sbin/vquota)\n"); return 2; } |