]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: mworker: unset more internal variables from program section
authorWilliam Lallemand <wlallemand@haproxy.org>
Wed, 5 Apr 2023 13:50:57 +0000 (15:50 +0200)
committerWilliam Lallemand <wlallemand@haproxy.org>
Wed, 5 Apr 2023 14:02:36 +0000 (16:02 +0200)
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.

src/mworker-prog.c

index 75cfc4255c90404fc4a8aa48e51094ec42c05b31..502c54991e5ece8d240da2706ad9029590bf616c 100644 (file)
@@ -114,6 +114,9 @@ int mworker_ext_launch_all()
 
                                /* 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));