DragonFlyBSD Kernel Audit
DF-2663 / df2663_mark.c
← back to finding ↓ download raw
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
int main(void) {
    size_t n = 256u << 20;
    char *p = malloc(n);
    if (!p) return 1;
    for (size_t i = 0; i < n; i += 4096)
        memcpy(p + i, "DF2663USERHEAP-PAGE-MARKER-0123456789abcdef", 44);
    /* keep half dirty, then exit: all pages go to the free queue */
    _exit(0);
}