Re: [patch 2.6.13-rc4] fix get_user_pages bug

From: Linus Torvalds
Date: Mon Aug 01 2005 - 15:23:18 EST




On Mon, 1 Aug 2005, Andrew Morton wrote:
>
> That was introduced 19 months ago by the s390 guys (see patch below).

This really is a very broken patch, btw.

> + if (write && !pte_write(pte))
> + goto out;
> + if (write && !pte_dirty(pte)) {
> + struct page *page = pte_page(pte);
> + if (!PageDirty(page))
> + set_page_dirty(page);
> + }
> + pfn = pte_pfn(pte);
> + if (pfn_valid(pfn)) {
> + struct page *page = pfn_to_page(pfn);
> +
> + mark_page_accessed(page);
> + return page;

Note how it doesn't do any "pfn_valid()" stuff for the dirty bit setting,
so it will set random bits in memory if the pte points to some IO page.

Maybe that doesn't happen on s390, but..

Anyway, if the s390 people just have a sw-writable bit in their page table
layout, I bet they can fix their problem by just having a "sw dirty"
bit, and then make "pte_mkdirty()" set that bit. Nobody else will care,
but ptrace will then just work correctly for them too.

Linus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/