From e21c37b14f8a92734bd1c97640118712373debf7 Mon Sep 17 00:00:00 2001 From: Scott Haseley Date: Fri, 15 Apr 2016 14:13:48 -0400 Subject: [PATCH] Added a secprintf message to the beginning of forkbomb so it causes page faults and allocates pages that we'll need later to print success. --- userland/testbin/forkbomb/forkbomb.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/userland/testbin/forkbomb/forkbomb.c b/userland/testbin/forkbomb/forkbomb.c index bf80550..581da14 100644 --- a/userland/testbin/forkbomb/forkbomb.c +++ b/userland/testbin/forkbomb/forkbomb.c @@ -67,6 +67,13 @@ main(void) int parent_pid = getpid(); int did_print = 0; int iters = 0; + + // Do not remove! + // We need to cause page faults on the static secprintf buffers so the + // pages are available when we print success. With on-demand page allocation, + // we will probably be out of pages by the time we try to print success. + secprintf(SECRET, "!!< Starting Forkbbbboooommmmbbbb >!!", "/testbin/forkbomb"); + while (1) { fork(); // Only parent gets to print