Module Name:    src
Committed By:   riastradh
Date:           Mon Aug 26 13:47:52 UTC 2024

Modified Files:
        src/sys/kern: kern_entropy.c

Log Message:
kern.entropy.consolidate, ioctl(RNDCTL): Fail with EINTR on signal.

This can happen if another thread is currently running consolidation
and has the entropy source lock held.  Use the new function
entropy_consolidate_sig to get at EINTR.

PR kern/58646: /dev/random, kern.entropy.*: signal bugs


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/sys/kern/kern_entropy.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/kern_entropy.c
diff -u src/sys/kern/kern_entropy.c:1.67 src/sys/kern/kern_entropy.c:1.68
--- src/sys/kern/kern_entropy.c:1.67	Mon Aug 26 13:46:03 2024
+++ src/sys/kern/kern_entropy.c	Mon Aug 26 13:47:52 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_entropy.c,v 1.67 2024/08/26 13:46:03 riastradh Exp $	*/
+/*	$NetBSD: kern_entropy.c,v 1.68 2024/08/26 13:47:52 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -77,7 +77,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_entropy.c,v 1.67 2024/08/26 13:46:03 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_entropy.c,v 1.68 2024/08/26 13:47:52 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -1420,7 +1420,7 @@ sysctl_entropy_consolidate(SYSCTLFN_ARGS
 	if (error || newp == NULL)
 		return error;
 	if (arg)
-		entropy_consolidate();
+		error = entropy_consolidate_sig();
 
 	return error;
 }
@@ -2793,7 +2793,7 @@ entropy_ioctl(unsigned long cmd, void *d
 		/* Enter the data and consolidate entropy.  */
 		rnd_add_data(&seed_rndsource, rdata->data, rdata->len,
 		    entropybits);
-		entropy_consolidate();
+		error = entropy_consolidate_sig();
 		break;
 	}
 	default:

Reply via email to