linux-mips
[Top] [All Lists]

Re: [MIPS] Fix aliasing bug in copy_user_highpage, take 2.

To: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Subject: Re: [MIPS] Fix aliasing bug in copy_user_highpage, take 2.
From: Ralf Baechle <ralf@linux-mips.org>
Date: Mon, 15 Oct 2007 19:28:11 +0100
Cc: linux-mips@linux-mips.org
In-reply-to: <20071016.023125.59033711.anemo@mba.ocn.ne.jp>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <S20036863AbXJOPrf/20071015154735Z+80955@ftp.linux-mips.org> <20071016.023125.59033711.anemo@mba.ocn.ne.jp>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Mutt/1.5.14 (2007-02-12)
On Tue, Oct 16, 2007 at 02:31:25AM +0900, Atsushi Nemoto wrote:

> On Mon, 15 Oct 2007 16:47:30 +0100, linux-mips@linux-mips.org wrote:
> > Turns out 6a36458d9348265327d074bdd40bfb1c5b6fb2cb  wasn't quite right.
> > When called for a page that isn't marked dirty it would artificially
> > create an alias instead of doing the obvious thing and access the page
> > via KSEG0.
> > 
> > The same issue also exists in copy_to_user_page and copy_from_user_page
> > which was causing the machine to die under rare circumstances for example
> > when running ps if the BUG_ON() assertion added by the earlier fix was
> > getting triggered.
> 
> This commit added a SetPageDcacheDirty() call for both
> copy_to_user_page() and copy_from_user_page().  The call in
> copy_from_user_page() is really needed?

After copy_from_user_page the page will reside in the D-cache.  So just
in case it ever gets mapped to userspace and modified there we better
make sure its kernel address will get flushed before mapping it to user
space.  If not, we might see stale data if the page got modified under
its userspace address.

  Ralf

<Prev in Thread] Current Thread [Next in Thread>