On 03/03/15 16:42, Heiner Kallweit wrote:
Am 03.03.2015 um 15:51 schrieb W.C.A. Wijngaards:
Hi,

Unbound 1.5.3rc1 maintainers prerelease is available:
http://www.unbound.net/downloads/unbound-1.5.3rc1.tar.gz
sha1 8a440a7e9c65da89465d0740254b8c955b83a91a
sha256 9dbe3a89e4f8a16eb55f0dd6634f5a1112fc05303ca466056fbdfc84ad9bc98f

This release fixes an issue where reload (sighup) could cause unbound
to exit, because of permission acquisition changes inserted in 1.5.2.

Bug Fixes:
- - [bugzilla: 647 ] Fix #647 crash in 1.5.2 because pwd.db no longer
accessible after reload.
- - [bugzilla: 645 ] Fix #645 Portability to Solaris 10, use AF_LOCAL.
- - [bugzilla: 646 ] Fix #646 Portability to Solaris, -lrt for
getentropy_solaris.
- - Use the getrandom syscall introduced in Linux 3.17 (from Heiner
Kallweit).

Best regards,
    Wouter
With regard to the proposed getrandom syscall patch Brad Smith sent this
comment to me and the mailing list:
"The getentropy() code for Linux within the Unbound tree is old. The
upstream code from the OpenBSD tree has already dealt with using the
new system call 6 months ago. So Wouter just needs to re-sync with
the code from the OpenBSD tree."
Did you consider this? Or would it simply have caused too much
regression testing effort and you preferred a small extension for now?

I sent a diff to Wouter to sync in those changes from upstream but
haven't heard anything back from him. I also attached the diff here
for you Heiner.

Note: I don't use Linux so if you can test that would probably be
quite useful to Wouter.


--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

Index: compat/getentropy_linux.c
===================================================================
--- compat/getentropy_linux.c	(revision 3341)
+++ compat/getentropy_linux.c	(working copy)
@@ -77,6 +77,9 @@
 extern int main(int, char *argv[]);
 #endif
 static int gotdata(char *buf, size_t len);
+#ifdef SYS_getrandom
+static int getentropy_getrandom(void *buf, size_t len);
+#endif
 static int getentropy_urandom(void *buf, size_t len);
 #ifdef SYS__sysctl
 static int getentropy_sysctl(void *buf, size_t len);
@@ -94,11 +97,15 @@
 	}
 
 #ifdef SYS_getrandom
-	/* try to use getrandom syscall introduced with kernel 3.17 */
-	ret = syscall(SYS_getrandom, buf, len, 0);
+	/*
+	 * Try descriptor-less getrandom()
+	 */
+	ret = getentropy_getrandom(buf, len);
 	if (ret != -1)
 		return (ret);
-#endif /* SYS_getrandom */
+	if (errno != ENOSYS)
+		return (-1);
+#endif
 
 	/*
 	 * Try to get entropy with /dev/urandom
@@ -185,7 +192,26 @@
 	return 0;
 }
 
+#ifdef SYS_getrandom
 static int
+getentropy_getrandom(void *buf, size_t len)
+{
+	int pre_errno = errno;
+	int ret;
+	if (len > 256)
+		return (-1);
+	do {
+		ret = syscall(SYS_getrandom, buf, len, 0);
+	} while (ret == -1 && errno == EINTR);
+
+	if (ret != len)
+		return (-1);
+	errno = pre_errno;
+	return (0);
+}
+#endif
+
+static int
 getentropy_urandom(void *buf, size_t len)
 {
 	struct stat st;
@@ -258,7 +284,7 @@
 		struct __sysctl_args args = {
 			.name = mib,
 			.nlen = 3,
-			.oldval = buf + i,
+			.oldval = (char *)buf + i,
 			.oldlenp = &chunk,
 		};
 		if (syscall(SYS__sysctl, &args) != 0)
_______________________________________________
Unbound-users mailing list
[email protected]
http://unbound.nlnetlabs.nl/mailman/listinfo/unbound-users

Reply via email to