Package: e2fsprogs
Version: 1.42.4-3
Severity: normal

The logsave program is leaking a file descriptor when it fork and
exec's the program that it is logging.  In the case of
/etc/init.d/checkroot, this would be fsck.  This file descriptor never
gets closed, so it's still present when fsck runs e2fsck, and then if
e2fsck has its own logging enabled using (in /etc/e2fsck.conf):

[options]
    log_dir = /mnt
    log_filename = e2fsck-%N.%h.INFO.%D-%T
    log_dir_wait = true

then e2fsck will fork off a process waiting for /mnt to get remounted
read/write.  This causes logsave to never get an EOF from its pipe, so
it hangs waiting for the read to fail --- which won't happen due to
the file descriptor leak which is still being held open by e2fsck's
forked child process.  And so /etc/init.d/checkroot hangs, and the
root file system never gets remounted read/write, and we deadlock.

The fix is to close the leaked file descriptor before we exit, with:

diff --git a/misc/logsave.c b/misc/logsave.c
index c37473c..e783546 100644
--- a/misc/logsave.c
+++ b/misc/logsave.c
@@ -190,6 +190,7 @@ static int run_program(char **argv)
                dup2(fds[1],1);         /* fds[1] replaces stdout */
                dup2(fds[1],2);         /* fds[1] replaces stderr */
                close(fds[0]);  /* don't need this here */
+               close(fds[1]);
 
                execvp(argv[0], argv);
                perror(argv[0]);


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to