Date: Thu, 22 Nov 2012 16:20:09 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r243408 - stable/9/sys/dev/md Message-ID: <201211221620.qAMGK9wW018866@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201211221620.qAMGK9wW018866>