LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Imre Deak <imre.deak@solidboot.com>
To: linux-kernel@vger.kernel.org
Cc: rmk@arm.linux.org.uk
Subject: [PATCH] DEV: zero: use correct pgprot for zeromapping
Date: Sat, 10 Feb 2007 11:15:21 +0200	[thread overview]
Message-ID: <20070210091521.GA7350@bitbox.mine.nu> (raw)

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


             reply	other threads:[~2007-02-10  9:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-10  9:15 Imre Deak [this message]
2007-02-10  9:39 ` Russell King
2007-02-10 10:03   ` Imre Deak
2007-02-10 17:29     ` [PATCH] ARM: VM: fix user page protection values (was Re: [PATCH] DEV: zero: use correct pgprot for zeromapping) Imre Deak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070210091521.GA7350@bitbox.mine.nu \
    --to=imre.deak@solidboot.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rmk@arm.linux.org.uk \
    --subject='Re: [PATCH] DEV: zero: use correct pgprot for zeromapping' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).