[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] Since USER_PTRS_PER_PGD depends on TASK_SIZE and thus on the current



# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID aefd8b8c6b1fc3242e6a231a4461c12780d0c254
# Parent  581d4a0ac7290523d04f5a7d8b35cc727baa8089
Since USER_PTRS_PER_PGD depends on TASK_SIZE and thus on the current
thread, it must not be used in code that can be called in the context
switch path (otherwise the 32-bitness of the outgoing task is used
here rather then the 32-bitness of the incoming one, possibly
resulting in large parts of the page tables not getting converted to
read-only).

Signed-off-by: Jan Beulich <JBeulich@xxxxxxxxxx>

diff -r 581d4a0ac729 -r aefd8b8c6b1f 
linux-2.6-xen-sparse/arch/x86_64/mm/pageattr-xen.c
--- a/linux-2.6-xen-sparse/arch/x86_64/mm/pageattr-xen.c        Tue Feb  7 
15:24:04 2006
+++ b/linux-2.6-xen-sparse/arch/x86_64/mm/pageattr-xen.c        Tue Feb  7 
18:16:11 2006
@@ -40,7 +40,14 @@
        int          g,u,m;
 
        pgd = mm->pgd;
-       for (g = 0; g <= USER_PTRS_PER_PGD; g++, pgd++) {
+       /*
+        * Cannot iterate up to USER_PTRS_PER_PGD as these pagetables may not
+        * be the 'current' task's pagetables (e.g., current may be 32-bit,
+        * but the pagetables may be for a 64-bit task).
+        * Subtracting 1 from TASK_SIZE64 means the loop limit is correct
+        * regardless of whether TASK_SIZE64 is a multiple of PGDIR_SIZE.
+        */
+       for (g = 0; g <= ((TASK_SIZE64-1) / PGDIR_SIZE); g++, pgd++) {
                if (pgd_none(*pgd))
                        continue;
                pud = pud_offset(pgd, 0);

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.