WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] Clarifiation about WP bit CR0 and copy on write in Xen

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] Clarifiation about WP bit CR0 and copy on write in Xen
From: "sting sting" <zstingx@xxxxxxxxxxx>
Date: Mon, 11 Apr 2005 12:17:35 +0300
Bcc:
Cc: zstingx@xxxxxxxxxxx
Delivery-date: Mon, 11 Apr 2005 09:17:32 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Hello,

I see in xen/arch/x86/mm.c a note (at the very beginning of
the file) which says that Xen sets to 1 the WP bit of CR0
so that processors operationg in CPL 1 and 2 will be unable
to write read-only pages.
(When WP bit of CR0 is cleared (0) it says to ignore write protection
so all pages are writable in Supervisor more).

From what is written there I understand that
this is done in order to prevent OS opetaing in CPL 1 and CPL 2 from
writing into the page tables (I assume the page tables are read only
and only the HyperVisor can update them).

Later, it says : "this is very unlikely to cause a problem for guest
OS's, which will generally use the WP bit to simplify copy-on-write
implementation (in that case, OS wants a fault when it writes to
an application-supplied buffer)."

As I remember ,and I am not sure abouth the details,
in Linux (and other *NIX), when a process calls
fork() it creates another process , and the pages of the old process
are mapped to the new process; But they are marked
as read only (for the new process)) and only when the process tries to write to the page then a new page is created. (There is a page fault).So this fork()
method uses "copy on write".

Can anybody please elaborate more on this ? what is the simplification
of "Copy on Write" here? How does it uses the WP bit ?
Does XenoLinux (for example) has a different implementation of clone() than the usual implementation?


Regards,
Sting

_________________________________________________________________
FREE pop-up blocking with the new MSN Toolbar - get it now! http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

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