tech-kern archive

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

Logging a kernel message when blocking on entropy



All,

The following patch will cause a kernel message to be logged when a
process blocks on /dev/random or some other randomness API.  It may
help some users befuddled by pkgsrc builds blocking on /dev/random,
and I'm finding it useful when testing changes aimed at fixing PR
55659.

OK to commit?

Index: src/sys/kern/kern_entropy.c
===================================================================
RCS file: /bracket/repo/src/sys/kern/kern_entropy.c,v
retrieving revision 1.23
diff -u -r1.23 kern_entropy.c
--- src/sys/kern/kern_entropy.c	14 Aug 2020 00:53:16 -0000	1.23
+++ src/sys/kern/kern_entropy.c	20 Sep 2020 13:53:46 -0000
@@ -1297,6 +1297,9 @@
 
 		/* Wait for some entropy to come in and try again.  */
 		KASSERT(E->stage >= ENTROPY_WARM);
+		printf("entropy: pid %d (%s) blocking due to lack of entropy\n",
+		       curproc->p_pid, curproc->p_comm);
+
 		if (ISSET(flags, ENTROPY_SIG)) {
 			error = cv_wait_sig(&E->cv, &E->lock);
 			if (error)

-- 
Andreas Gustafsson, gson%gson.org@localhost


Home | Main Index | Thread Index | Old Index