Merge pull request #29657 from sundeep8967/fix/pause-process-environ

rootless: clear environment before spawning pause process
This commit is contained in:
Paul Holzinger 2026-09-28 12:54:47 +02:00 • committed by GitHub
commit 95fc00bca3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -656,7 +656,7 @@ is_pause_process (long pid)
if (asprintf (&environ_path, "/proc/%ld/environ", pid) < 0)
return 0;
buf = malloc (buf_size);
buf = malloc (buf_size + 1);
if (buf == NULL)
return 0;
@ -668,6 +668,7 @@ is_pause_process (long pid)
n = TEMP_FAILURE_RETRY (read (fd, buf, buf_size));
if (n <= 0)
return 0;
buf[n] = '\0';
/* environ entries are separated by '\0'. Search for "_PODMAN_PAUSE=1". */
for (char *p = buf; p < buf + n; )
@ -1099,6 +1100,7 @@ create_pause_process (const char *state_dir, char **argv)
for (fd = 3; fd < open_files_max_fd + 16; fd++)
close (fd);
clearenv ();
setenv ("_PODMAN_PAUSE", "1", 1);
execlp (argv[0], argv[0], NULL);