Re: [PATCH] hold cow while breaking

From: Linus Torvalds (
Date: Sun Jul 29 2001 - 10:30:19 EST

On Sun, 29 Jul 2001, Hugh Dickins wrote:
> do_wp_page() COW breaking is now very slightly unsafe. Please don't
> ask me to provide a test case! but the pte_same() check after regetting
> page_table_lock is not quite enough to guarantee that the old_page was
> not reaped, reused for something else, copy_cow_paged while containing
> that other data, freed and then reused for precisely its original pte.

Oh, but it is.

We do hold the MM semaphore over the whole sequence, so there's no way the
page table entry can be replaced by anything else than a non-present one
(ie vmscan can swap it out, but nothing can swap it in because of the

So yes, we may copy data that is "garbage", but re-testing the page table
will make sure that if it was garbage we will never use it.


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

This archive was generated by hypermail 2b29 : Tue Jul 31 2001 - 21:00:41 EST