Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 20 Jan 2016 00:14:34 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r294366 - head/sys/compat/linuxkpi/common/src
Message-ID:  <201601200014.u0K0EY6c092965@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhb
Date: Wed Jan 20 00:14:34 2016
New Revision: 294366
URL: https://svnweb.freebsd.org/changeset/base/294366

Log:
  Initialize vm_page_prot to VM_MEMATTR_DEFAULT instead of 0.
  
  If a driver's Linux mmap callback passed vm_page_prot through unchanged,
  then linux_dev_mmap_single() would try to apply whatever VM_MEMATTR_xxx
  value 0 is to the mapping.  On x86, VM_MEMATTR_DEFAULT is the PAT value
  for write-back (WB) which is 6, while 0 maps to the PAT value for
  uncacheable (UC).  Thus, any mmap request that did not explicitly set
  page_prot was tried to map memory as UC triggering the warning in
  sg_pager_getpages().
  
  Tested by:	np
  Reported by:	Krishnamraju Eraparaju @ Chelsio
  MFC after:	3 days
  Sponsored by:	Chelsio Communications

Modified:
  head/sys/compat/linuxkpi/common/src/linux_compat.c

Modified: head/sys/compat/linuxkpi/common/src/linux_compat.c
==============================================================================
--- head/sys/compat/linuxkpi/common/src/linux_compat.c	Wed Jan 20 00:03:28 2016	(r294365)
+++ head/sys/compat/linuxkpi/common/src/linux_compat.c	Wed Jan 20 00:14:34 2016	(r294366)
@@ -587,7 +587,7 @@ linux_dev_mmap_single(struct cdev *dev, 
 	vma.vm_end = size;
 	vma.vm_pgoff = *offset / PAGE_SIZE;
 	vma.vm_pfn = 0;
-	vma.vm_page_prot = 0;
+	vma.vm_page_prot = VM_MEMATTR_DEFAULT;
 	if (filp->f_op->mmap) {
 		error = -filp->f_op->mmap(filp, &vma);
 		if (error == 0) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201601200014.u0K0EY6c092965>