grub2/grub-core/osdep/unix
Dimitri John Ledkov 82fbd3f55c osdep/unix/exec: Avoid atexit() handlers when child execvp() fails
The functions grub_util_exec_pipe() and grub_util_exec_pipe_stderr()
currently call execvp(). If the call fails for any reason, the child
currently calls exit(127). This in turn executes the parents
atexit() handlers from the forked child, and then the same handlers
are called again from parent. This is usually not desired, and can
lead to deadlocks, and undesired behavior. So, change the exit() calls
to _exit() calls to avoid calling atexit() handlers from child.

Fixes: e75cf4a58 (unix exec: avoid atexit handlers when child exits)

Signed-off-by: Dimitri John Ledkov <xnox@ubuntu.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>

Bug-Debian: https://bugs.debian.org/983435
Last-Update: 2021-06-14

Patch-Name: osdep-exec-avoid-atexit-when-child-exits.patch
2021-06-14 00:34:57 +01:00
..
compress.c Rewrite grub-install, grub-mkrescue, grub-mkstandalone and grub-mknetdir 2013-11-16 20:21:16 +01:00
config.c unix/config: Fix integer overflow in grub_util_load_config 2020-07-26 23:38:34 +01:00
cputime.c unix/cputime.c: Cache sc_clk_tck and check it for sanity. 2015-01-21 17:42:15 +01:00
dl.c Move OS-dependent mprotect for module loading to grub-core/osdep/*/dl.c 2013-12-08 18:08:23 +01:00
efivar.c Minimise writes to EFI variable storage 2020-03-07 12:21:23 +00:00
emuconsole.c * grub-core/osdep/unix/emuconsole.c (put): Pacify the compiler on 2013-11-13 13:34:57 +00:00
exec.c osdep/unix/exec: Avoid atexit() handlers when child execvp() fails 2021-06-14 00:34:57 +01:00
getroot.c Tell zpool to emit full device names 2020-03-07 12:21:23 +00:00
hostdisk.c util: Detect more I/O errors 2019-03-05 10:23:47 +01:00
password.c unix: do not close stdin in grub_passwd_get 2015-11-18 22:23:58 +03:00
platform.c Minimise writes to EFI variable storage 2020-03-07 12:21:23 +00:00
random.c Add a wrapper for fopen. On unix-like systems just pass-through. On 2013-10-13 20:36:28 +02:00
relpath.c unix/relpath: memory leak 2015-06-19 18:38:25 +03:00
sleep.c Move sleep routines to grub-core/osdep. 2013-10-08 17:38:46 +02:00