[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#865763: jessie-pu: package gnutls28/3.3.8-6+deb8u7



Package: release.debian.org
Severity: normal
Tags: jessie
User: release.debian.org@packages.debian.org
Usertags: pu

Hello,

would like to fix the following issue in gnutls28/jessie (It was fixed
in 3.5.3 and therefore does not apply to stretch/buster/sid).

Quoting #865297:
------------
If the application closes open files during startup (e.g., a daemon),
it may close the file that gnutls has open for /dev/urandom. The
recommended way to handle this situation is to call
gnutls_global_init() again. This will check if the fd for /dev/urandom
is still valid and re-open it if not.

Unfortunately, the way that the /dev/urandom fd is checked is not
reliable. It only checks the mode, which might be the same if the
application reused the fd for another character device with the same
permissions (e.g., /dev/null).
------------

Thanks for considering, cu Andreas
diff -Nru gnutls28-3.3.8/debian/changelog gnutls28-3.3.8/debian/changelog
--- gnutls28-3.3.8/debian/changelog	2017-06-16 07:39:56.000000000 +0200
+++ gnutls28-3.3.8/debian/changelog	2017-06-24 17:50:29.000000000 +0200
@@ -1,3 +1,13 @@
+gnutls28 (3.3.8-6+deb8u7) jessie; urgency=medium
+
+  * 57_urandom-use-st_ino-and-st_rdev-to-determine-device-u.patch from
+    upstream gnutls_3_3_x branch: Improve check for /dev/urandom uniqueness.
+    Ensure that when gnutls_global_init() is called for a second time that
+    /dev/urandom is re-opened when the inode or device ID has changed.
+    Closes: #865297
+
+ -- Andreas Metzler <ametzler@debian.org>  Sat, 24 Jun 2017 17:50:21 +0200
+
 gnutls28 (3.3.8-6+deb8u6) jessie-security; urgency=high
 
   * 56_CVE-2017-7507_1-ext-status_request-ensure-response-IDs-are-pro.patch
diff -Nru gnutls28-3.3.8/debian/patches/57_urandom-use-st_ino-and-st_rdev-to-determine-device-u.patch gnutls28-3.3.8/debian/patches/57_urandom-use-st_ino-and-st_rdev-to-determine-device-u.patch
--- gnutls28-3.3.8/debian/patches/57_urandom-use-st_ino-and-st_rdev-to-determine-device-u.patch	1970-01-01 01:00:00.000000000 +0100
+++ gnutls28-3.3.8/debian/patches/57_urandom-use-st_ino-and-st_rdev-to-determine-device-u.patch	2017-06-24 17:49:20.000000000 +0200
@@ -0,0 +1,56 @@
+From 5006914fda50f25807451a03616cdf2e7be0268f Mon Sep 17 00:00:00 2001
+From: Nikos Mavrogiannopoulos <nmav@redhat.com>
+Date: Fri, 15 Jul 2016 14:58:07 +0200
+Subject: [PATCH] urandom: use st_ino and st_rdev to determine device
+ uniqueness
+
+---
+ lib/nettle/rnd-common.c | 11 +++++++----
+ 1 file changed, 7 insertions(+), 4 deletions(-)
+
+diff --git a/lib/nettle/rnd-common.c b/lib/nettle/rnd-common.c
+index 47d2b0edd..33a71d351 100644
+--- a/lib/nettle/rnd-common.c
++++ b/lib/nettle/rnd-common.c
+@@ -137,7 +137,8 @@ void _rnd_system_entropy_deinit(void)
+ #include "egd.h"
+ 
+ static int _gnutls_urandom_fd = -1;
+-static mode_t _gnutls_urandom_fd_mode = 0;
++static ino_t _gnutls_urandom_fd_ino = 0;
++static dev_t _gnutls_urandom_fd_rdev = 0;
+ 
+ static int _rnd_get_system_entropy_urandom(void* _rnd, size_t size)
+ {
+@@ -202,7 +203,7 @@ int _rnd_system_entropy_check(void)
+ 	struct stat st;
+ 
+ 	ret = fstat(_gnutls_urandom_fd, &st);
+-	if (ret < 0 || st.st_mode != _gnutls_urandom_fd_mode) {
++	if (ret < 0 || st.st_ino != _gnutls_urandom_fd_ino || st.st_rdev != _gnutls_urandom_fd_rdev) {
+ 		return _rnd_system_entropy_init();
+ 	}
+ 	return 0;
+@@ -224,7 +225,8 @@ int _rnd_system_entropy_init(void)
+ 		fcntl(_gnutls_urandom_fd, F_SETFD, old | FD_CLOEXEC);
+ 
+ 	if (fstat(_gnutls_urandom_fd, &st) >= 0) {
+-		_gnutls_urandom_fd_mode = st.st_mode;
++		_gnutls_urandom_fd_ino = st.st_ino;
++		_gnutls_urandom_fd_rdev = st.st_rdev;
+ 	}
+ 
+ 	_rnd_get_system_entropy = _rnd_get_system_entropy_urandom;
+@@ -240,7 +242,8 @@ fallback:
+ 	}
+ 
+ 	if (fstat(_gnutls_urandom_fd, &st) >= 0) {
+-		_gnutls_urandom_fd_mode = st.st_mode;
++		_gnutls_urandom_fd_ino = st.st_ino;
++		_gnutls_urandom_fd_rdev = st.st_rdev;
+ 	}
+ 
+ 	_rnd_get_system_entropy = _rnd_get_system_entropy_egd;
+-- 
+2.11.0
+
diff -Nru gnutls28-3.3.8/debian/patches/series gnutls28-3.3.8/debian/patches/series
--- gnutls28-3.3.8/debian/patches/series	2017-06-15 16:13:12.000000000 +0200
+++ gnutls28-3.3.8/debian/patches/series	2017-06-24 17:50:33.000000000 +0200
@@ -36,3 +36,4 @@
 56_CVE-2017-7507_1-ext-status_request-ensure-response-IDs-are-pro.patch
 56_CVE-2017-7507_2-ext-status_request-Removed-the-parsing-of-resp.patch
 56_CVE-2017-7507_3-gnutls_ocsp_status_request_enable_client-docum.patch
+57_urandom-use-st_ino-and-st_rdev-to-determine-device-u.patch

Attachment: signature.asc
Description: PGP signature


Reply to: