-
Notifications
You must be signed in to change notification settings - Fork 163
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lib: Avoid calling setenv between fork and exec
setenv can call malloc and is not safe to call here. Glibc is usually tolerant of this and we haven't had problems before, but if you use GLIBC_TUNABLES glibc.malloc.check=1 (or any alternate malloc / libc which serializes) then you would see hangs if starting multiple libguestfs handles from different threads at the same time. This commit also updates the common submodule to pick up: commit 3c64bcdeaf684f05f46f3928b55aadafdfe72720 Author: Richard W.M. Jones <rjones@redhat.com> Date: Fri Oct 14 11:07:21 2022 +0100 utils: Add function for copying the environment and adding new entries libguestfs is currently calling setenv at an unsafe location between fork and exec. To fix this we need a way to copy and modify the environment before fork and then we can pass the modified environ to execve-like functions. nbdkit already does the same so use that code. This function is copied and adapted from here under a compatible license: https://gitlab.com/nbdkit/nbdkit/-/blob/master/common/utils/environ.c Thanks: Siddhesh Poyarekar
- Loading branch information
Showing
3 changed files
with
33 additions
and
12 deletions.
There are no files selected for viewing
Submodule common
updated
6 files
+2 −1 | mlcustomize/firstboot.ml | |
+0 −2 | options/decrypt.c | |
+3 −0 | options/keys.c | |
+1 −0 | utils/Makefile.am | |
+107 −0 | utils/environ.c | |
+3 −0 | utils/guestfs-utils.h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters