Author: kib
Date: Thu Nov 22 16:20:08 2012
New Revision: 243408
URL: http://svnweb.freebsd.org/changeset/base/243408

Log:
  MFC r242744:
  Zero the newly allocated md(4) swap-backed page to prevent random
  kernel memory leakage to userspace.

Modified:
  stable/9/sys/dev/md/md.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/dev/   (props changed)

Modified: stable/9/sys/dev/md/md.c
==============================================================================
--- stable/9/sys/dev/md/md.c    Thu Nov 22 16:14:41 2012        (r243407)
+++ stable/9/sys/dev/md/md.c    Thu Nov 22 16:20:08 2012        (r243408)
@@ -677,6 +677,15 @@ mdstart_swap(struct md_s *sc, struct bio
                                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);
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9
To unsubscribe, send any mail to "[email protected]"

Reply via email to