From 2081f66ad07722ba9a808fa4f0d2ced2822950f7 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Fri, 28 Jun 2024 13:20:29 +0200 Subject: executor: fix max signal/cover filter mapping into subprocesses There is a quirk related to posix_spawn_file_actions_adddup2: it just executes the specified dup's in order in the child process. In our case we do dups as follows: 20 -> 4 (output region) 4 -> 5 (max signal) So we dup the output region onto 4 first, and then dup the same output region (fd 4 becomes the output region) onto 5 (max signal). So we have output region as both output region and max signal. --- executor/executor_runner.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'executor/executor_runner.h') diff --git a/executor/executor_runner.h b/executor/executor_runner.h index 57d63f6a7..766669dda 100644 --- a/executor/executor_runner.h +++ b/executor/executor_runner.h @@ -797,5 +797,11 @@ static void runner(char** argv, int argc) fail("signal(SIGBUS) failed"); Connection conn(manager_addr, manager_port); + + // This is required to make Subprocess fd remapping logic work. + // kCoverFilterFd is the largest fd we set in the child processes. + for (int fd = conn.FD(); fd < kCoverFilterFd;) + fd = dup(fd); + Runner(conn, name, argv[0]); } -- cgit mrf-deployment