[Midnightbsd-cvs] src [8845] trunk/sys/kern/kern_intr.c: add optional entropy harvesting for software interrupts in swi_sched as controlled by kern.random.sys/harvest.swi

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Mon Sep 26 00:12:38 EDT 2016


Revision: 8845
          http://svnweb.midnightbsd.org/src/?rev=8845
Author:   laffer1
Date:     2016-09-26 00:12:38 -0400 (Mon, 26 Sep 2016)
Log Message:
-----------
add optional entropy harvesting for software interrupts in swi_sched as controlled by kern.random.sys/harvest.swi

Modified Paths:
--------------
    trunk/sys/kern/kern_intr.c

Modified: trunk/sys/kern/kern_intr.c
===================================================================
--- trunk/sys/kern/kern_intr.c	2016-09-26 04:11:59 UTC (rev 8844)
+++ trunk/sys/kern/kern_intr.c	2016-09-26 04:12:38 UTC (rev 8845)
@@ -1144,11 +1144,21 @@
 {
 	struct intr_handler *ih = (struct intr_handler *)cookie;
 	struct intr_event *ie = ih->ih_event;
+	struct intr_entropy entropy;
 	int error;
 
 	CTR3(KTR_INTR, "swi_sched: %s %s need=%d", ie->ie_name, ih->ih_name,
 	    ih->ih_need);
 
+	if (harvest.swi) {
+		CTR2(KTR_INTR, "swi_sched: pid %d (%s) gathering entropy",
+		    curproc->p_pid, curthread->td_name);
+		entropy.event = (uintptr_t)ih;
+		entropy.td = curthread;
+		random_harvest(&entropy, sizeof(entropy), 1, 0,
+		    RANDOM_INTERRUPT);
+	}
+
 	/*
 	 * Set ih_need for this handler so that if the ithread is already
 	 * running it will execute this handler on the next pass.  Otherwise,



More information about the Midnightbsd-cvs mailing list