From: Mike Yuan Date: Fri, 8 Dec 2023 13:14:11 +0000 (+0800) Subject: core/executor: save argv for later use by rename_process() X-Git-Tag: v256-rc1~1544^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F30384%2Fhead;p=thirdparty%2Fsystemd.git core/executor: save argv for later use by rename_process() Partially fixes #30352 --- diff --git a/src/core/executor.c b/src/core/executor.c index 993cd4a4d2c..51c727f3254 100644 --- a/src/core/executor.c +++ b/src/core/executor.c @@ -6,6 +6,7 @@ #include "sd-messages.h" #include "alloc-util.h" +#include "argv-util.h" #include "build.h" #include "exec-invoke.h" #include "execute-serialize.h" @@ -191,6 +192,11 @@ int main(int argc, char *argv[]) { exec_context_init(&context); cgroup_context_init(&cgroup_context); + /* We use safe_fork() for spawning sd-pam helper process, which internally calls rename_process(). + * As the last step of renaming, all saved argvs are memzero()-ed. Hence, we need to save the argv + * first to prevent showing "intense" cmdline. See #30352. */ + save_argc_argv(argc, argv); + /* We might be starting the journal itself, we'll be told by the caller what to do */ log_set_always_reopen_console(true); log_set_prohibit_ipc(true);