List Info

Thread: the rndlinux module opens a file handle and never closes it




the rndlinux module opens a file handle and never closes it
user name
2006-12-18 13:20:23
Package: libgcrypt11
Version: 1.2.3-2
Tags: patch

The function _gcry_rndlinux_gather_random() in
cipher/rndlinux.c opens
two file handles (fd_random and fd_urandom) which are never
closed.
Since it does not apply the FD_CLOEXEC flag, all
subprocesses will
inherit these two handles without ever using them.

Please apply this patch which sets the FD_CLOEXEC flag.

_______________________________________________
Gcrypt-devel mailing list
Gcrypt-develgnupg.org

http://lists.gnupg.org/mailman/listinfo/gcrypt-devel
the rndlinux module opens a file handle and never closes it
user name
2006-12-18 15:29:57
Max Kellermann wrote:
> The function _gcry_rndlinux_gather_random() in
cipher/rndlinux.c opens
> two file handles (fd_random and fd_urandom) which are
never closed.
> Since it does not apply the FD_CLOEXEC flag, all
subprocesses will
> inherit these two handles without ever using them.
> 
> Please apply this patch which sets the FD_CLOEXEC flag.

The correct way to set this flag is this:

{
	int flags = fcntl(fd, F_GETFD);
	flags |= FD_CLOEXEC;
	fcntl(fd, F_SETFD, flags);
}

Paranoids would even check for errors.

-- 
Christian

_______________________________________________
Gcrypt-devel mailing list
Gcrypt-develgnupg.org

http://lists.gnupg.org/mailman/listinfo/gcrypt-devel
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )