summaryrefslogtreecommitdiffstats
path: root/sys/compat
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2016-01-20 00:14:34 +0000
committerjhb <jhb@FreeBSD.org>2016-01-20 00:14:34 +0000
commitaae5878eb3bca3067b218dc570c2bfcd310b3c02 (patch)
tree630b5949e3b75df563252a87bfbf5f79a26c7249 /sys/compat
parenteef4b2b8aa5f8a9286884969f8f4041674fcb154 (diff)
downloadFreeBSD-src-aae5878eb3bca3067b218dc570c2bfcd310b3c02.zip
FreeBSD-src-aae5878eb3bca3067b218dc570c2bfcd310b3c02.tar.gz
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
Diffstat (limited to 'sys/compat')
-rw-r--r--sys/compat/linuxkpi/common/src/linux_compat.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c b/sys/compat/linuxkpi/common/src/linux_compat.c
index 56080a4..9c73664 100644
--- a/sys/compat/linuxkpi/common/src/linux_compat.c
+++ b/sys/compat/linuxkpi/common/src/linux_compat.c
@@ -587,7 +587,7 @@ linux_dev_mmap_single(struct cdev *dev, vm_ooffset_t *offset,
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) {
OpenPOWER on IntegriCloud