[PATCH] DEV: zero: use correct pgprot for zeromapping

Imre Deak
2007-02-10T09:39:46Z

Instead of PAGE_COPY use the pgprot bits established already at
original mapping time of the VMA. This will also include any
architecture specific bits setup through protection_map.
zeromap_page_range will take care of COW'ing the passed pgprot.

This fixes at least one problem on ARM where reading /dev/zero
in one process created global PTE mappings thus - practically -
zeroing out memory ranges of all other processes.

Signed-off-by: Imre Deak <imre.deak@solidboot.com>
---
drivers/char/mem.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/char/mem.c b/drivers/char/mem.c
index f5c160c..9a7264f 100644
--- a/drivers/char/mem.c
+++ b/drivers/char/mem.c
@@ -646,7 +646,7 @@ static inline size_t read_zero_pagealigned(char __user * buf, size_t size)
count = size;

zap_page_range(vma, addr, count, NULL);
- if (zeromap_page_range(vma, addr, count, PAGE_COPY))
+ if (zeromap_page_range(vma, addr, count, vma->vm_page_prot))
break;

size -= count;
--
1.4.4.3.GIT