From 214351e168def9426c79e1f65a93ddb112cee906 Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Wed, 19 Jan 2022 17:38:24 +0000 Subject: executor: fail on SEGV during clone() As was found out in #2921, fork bombs are still possible in Linux-based instances. One of the possible reasons is described below. An invalid stack can be passed to the clone() call, thus causing it to stumble on an invalid memory access right during returning from the clone() call. This is in turn catched by the NONFAILING() macro and the control actually jumps over it and eventually both the child and the parent continue executing the same code. Prevent it by handling SIGSEGV and SIGBUS differently during the clone process. Co-authored-by: Andrei Vagin --- executor/executor.cc | 1 + 1 file changed, 1 insertion(+) (limited to 'executor/executor.cc') diff --git a/executor/executor.cc b/executor/executor.cc index 923fccc63..28ab72206 100644 --- a/executor/executor.cc +++ b/executor/executor.cc @@ -90,6 +90,7 @@ static NORETURN PRINTF(2, 3) void failmsg(const char* err, const char* msg, ...) // Just exit (e.g. due to temporal ENOMEM error). static NORETURN PRINTF(1, 2) void exitf(const char* msg, ...); static NORETURN void doexit(int status); +static NORETURN void doexit_thread(int status); // Print debug output that is visible when running syz-manager/execprog with -debug flag. // Debug output is supposed to be relatively high-level (syscalls executed, return values, timing, etc) -- cgit mrf-deployment