Oops, indeed.
Thanks, patch obviously correct and applied.
However, I further _suspect_ that the test should be extended to do
"!pte_dirty()" too, but I wouldn't want to add that without testing. As
you have an obvious test-case, would you mind trying with the following
modified version:
> + if (write && (!pte_write(*pgtable) || !pte_dirty(*pgtable)))
> + goto fault_in_page;
which also makes sure that the page will always be marked dirty after the
thing.
> We probably have to mark the page dirty if (write) as well; exercise for
> the reader I guess. The 'if (pgd_none(*pgdir))' looks suspicious too --
> should that that be !pgd_present?
(pgd_none() <=> !pgd_present) for all cases except for the error cases.
Linux does not support swapped out page tables - it adds a surprising
amount to complexity for a fairly small gain.
So the stickler version to test a page directory entry is:
if (pgd_none(entry)) goto no-entry
if (pgd_bad(entry)) goto bad-entry
.. it's present and usable ..
so pgd/pmd_present is basically not really ever usable (except as part of
the pgd/pmd_bad() test, where a non-present pmd/pgd is always considered
bad).
Linus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/