cvs commit: src/sys/vm vm_contig.c

Maxime Henrion mux at freebsd.org
Sat Jul 26 05:58:10 PDT 2003


Alan L. Cox wrote:
> Maxime Henrion wrote:
> > 
> > mux         2003/07/25 14:02:25 PDT
> > 
> >   FreeBSD src repository
> > 
> >   Modified files:
> >     sys/vm               vm_contig.c
> >   Log:
> >   Add support for the M_ZERO flag to contigmalloc().
> > 
> >   Reviewed by:    jeff
> > 
> >   Revision  Changes    Path
> >   1.21      +5 -1      src/sys/vm/vm_contig.c
> 
> This has a bug.  The page is not mapped at the time you perform
> bzero().  (In fact, it is not mapped until after the vm_map_wire()
> occurs.)  Thus, you need to use pmap_zero_page() instead.
> 
> Your tests probably succeeded because of page prezeroing.  (With
> prezeroing, you never exercised the bug.)
> 
> I'm pretty sure that I sent you an e-mail about this.  If not, I
> apologize.

I sent you two mails aout this, specifically asking if I was allowed to
touch the page before vm_map_wire() was called, because I was pretty
sure nothing else could be wrong in this patch :-).  I never received
your answer, so maybe it got lost, but anyways, here is a patch which
should fix this issue.

Does this look OK to you?

Thanks,
Maxime
-------------- next part --------------
Index: vm_contig.c
===================================================================
RCS file: /space2/ncvs/src/sys/vm/vm_contig.c,v
retrieving revision 1.21
diff -u -p -r1.21 vm_contig.c
--- vm_contig.c	25 Jul 2003 21:02:25 -0000	1.21
+++ vm_contig.c	26 Jul 2003 12:57:03 -0000
@@ -261,7 +261,7 @@ again1:
 			vm_page_insert(m, kernel_object,
 				OFF_TO_IDX(tmp_addr - VM_MIN_KERNEL_ADDRESS));
 			if ((flags & M_ZERO) && !(m->flags & PG_ZERO))
-				bzero((void *)tmp_addr, PAGE_SIZE);
+				pmap_zero_page(m);
 			m->flags = 0;
 			tmp_addr += PAGE_SIZE;
 		}


More information about the cvs-src mailing list