No description
e75cf4a58b
The `grub_util_exec_redirect_all` helper function can be used to spawn an executable and redirect its output to some files. After calling `fork()`, the parent will wait for the child to terminate with `waitpid()` while the child prepares its file descriptors, environment and finally calls `execvp()`. If something in the children's setup fails, it will stop by calling `exit(127)`. Calling `exit()` will cause any function registered via `atexit()` to be executed, which is usually the wrong thing to do in a child. And actually, one can easily observe faulty behaviour on musl-based systems without modprobe(8) installed: executing `grub-install --help` will call `grub_util_exec_redirect_all` with "modprobe", which obviously fails if modprobe(8) is not installed. Due to the child now exiting and invoking the `atexit()` handlers, it will clean up some data structures of the parent and cause it to be deadlocked in the `waitpid()` syscall. The issue can easily be fixed by calling `_exit(127)` instead, which is especially designed to be called when the atexit-handlers should not be executed. Signed-off-by: Patrick Steinhardt <ps@pks.im> |
||
---|---|---|
asm-tests | ||
build-aux | ||
conf | ||
docs | ||
grub-core | ||
include | ||
m4 | ||
po | ||
tests | ||
themes/starfield | ||
unicode | ||
util | ||
.gitignore | ||
ABOUT-NLS | ||
acinclude.m4 | ||
AUTHORS | ||
autogen.sh | ||
BUGS | ||
ChangeLog-2015 | ||
config.h.in | ||
configure.ac | ||
COPYING | ||
coreboot.cfg | ||
geninit.sh | ||
gentpl.py | ||
INSTALL | ||
linguas.sh | ||
Makefile.am | ||
Makefile.util.def | ||
NEWS | ||
README | ||
THANKS | ||
TODO |
This is GRUB 2, the second version of the GRand Unified Bootloader. GRUB 2 is rewritten from scratch to make GNU GRUB cleaner, safer, more robust, more powerful, and more portable. See the file NEWS for a description of recent changes to GRUB 2. See the file INSTALL for instructions on how to build and install the GRUB 2 data and program files. Please visit the official web page of GRUB 2, for more information. The URL is <http://www.gnu.org/software/grub/grub.html>. More extensive documentation is available in the Info manual, accessible using 'info grub' after building and installing GRUB 2. There are a number of important user-visible differences from the first version of GRUB, now known as GRUB Legacy. For a summary, please see: info grub Introduction 'Changes from GRUB Legacy'