BUG/MINOR: mworker: unset more internal variables from program section
People who use HAProxy as a process 1 in containers sometimes starts
other things from the program section. This is still not recommend as
the master process has minimal features regarding process management.
Environment variables are still inherited, even internal ones.
Since 2.7, it could provoke a crash when inheriting the
HAPROXY_STARTUPLOGS_FD variable.
Note: for future releases it should be better to clean the env and sets
a list of variable to be exported. We need to determine which variables
are used by users before.
Must be backported in 2.7.
diff --git a/src/mworker-prog.c b/src/mworker-prog.c
index 75cfc42..502c549 100644
--- a/src/mworker-prog.c
+++ b/src/mworker-prog.c
@@ -114,6 +114,9 @@
/* This one must not be exported, it's internal! */
unsetenv("HAPROXY_MWORKER_REEXEC");
+ unsetenv("HAPROXY_STARTUPLOGS_FD");
+ unsetenv("HAPROXY_MWORKER_WAIT_ONLY");
+ unsetenv("HAPROXY_PROCESSES");
execvp(child->command[0], child->command);
ha_alert("Cannot execute %s: %s\n", child->command[0], strerror(errno));