From adf901b3dec32994a39ec6cb0ba5625afdeca319 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Wed, 21 Jul 2021 10:17:02 +0200 Subject: [PATCH] BUG/MINOR: mworker: do not export HAPROXY_MWORKER_REEXEC across programs This undocumented variable is only for internal use, and its sole presence affects the process' behavior, as shown in bug #1324. It must not be exported to workers, external checks, nor programs. Let's unset it before forking programs and workers. This should be backported as far as 1.8. The worker code might differ a bit before 2.5 due to the recent removal of multi-process support. (cherry picked from commit 3c032f2d4d3ba508d508ae70603ccac6d5cf9d4a) Signed-off-by: Christopher Faulet (cherry picked from commit a9274a17f6466b82359a5b6954bb3a35bce814f3) Signed-off-by: Christopher Faulet --- src/haproxy.c | 2 ++ src/mworker-prog.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/haproxy.c b/src/haproxy.c index d4658f6..889854e 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -3425,6 +3425,8 @@ int main(int argc, char **argv) exit(1); /* there has been an error */ } else if (ret == 0) { /* child breaks here */ + /* This one must not be exported, it's internal! */ + unsetenv("HAPROXY_MWORKER_REEXEC"); ha_random_jump96(relative_pid); break; } diff --git a/src/mworker-prog.c b/src/mworker-prog.c index e77317f..126cfab 100644 --- a/src/mworker-prog.c +++ b/src/mworker-prog.c @@ -110,6 +110,8 @@ int mworker_ext_launch_all() exit(1); } + /* This one must not be exported, it's internal! */ + unsetenv("HAPROXY_MWORKER_REEXEC"); execvp(child->command[0], child->command); ha_alert("Cannot execute %s: %s\n", child->command[0], strerror(errno)); -- 1.7.10.4