[Midnightbsd-cvs] src [8437] trunk/sys/dev/md/md.c: zero out allocated memory to prevent random kernel memory leaks

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sun Sep 18 17:32:45 EDT 2016


Revision: 8437
          http://svnweb.midnightbsd.org/src/?rev=8437
Author:   laffer1
Date:     2016-09-18 17:32:45 -0400 (Sun, 18 Sep 2016)
Log Message:
-----------
zero out allocated memory to prevent random kernel memory leaks

Modified Paths:
--------------
    trunk/sys/dev/md/md.c

Modified: trunk/sys/dev/md/md.c
===================================================================
--- trunk/sys/dev/md/md.c	2016-09-18 21:29:31 UTC (rev 8436)
+++ trunk/sys/dev/md/md.c	2016-09-18 21:32:45 UTC (rev 8437)
@@ -677,6 +677,15 @@
 				sched_unpin();
 				vm_page_wakeup(m);
 				break;
+			} else if (rv == VM_PAGER_FAIL) {
+				/*
+				 * Pager does not have the page.  Zero
+				 * the allocated page, and mark it as
+				 * valid. Do not set dirty, the page
+				 * can be recreated if thrown out.
+				 */
+				bzero((void *)sf_buf_kva(sf), PAGE_SIZE);
+				m->valid = VM_PAGE_BITS_ALL;
 			}
 			bcopy((void *)(sf_buf_kva(sf) + offs), p, len);
 			cpu_flush_dcache(p, len);



More information about the Midnightbsd-cvs mailing list