Re: [PATCH] page->flags corruption fix

From: Rik van Riel
Date: Wed Oct 08 2003 - 11:02:07 EST


On Wed, 8 Oct 2003, Hugh Dickins wrote:
> On Wed, 8 Oct 2003 Matt_Domsch@xxxxxxxx wrote:

> > We've seen a similar failure with the RHEL2.1 kernel w/o RMAP patches
> > too. So we fully believe it's possible in stock 2.4.x.
>
> A similar failure - but what exactly?
> And what is the actual race which would account for it?
>
> I don't mind you and Rik fixing bugs!
> I'd just like to understand the bug before it's fixed.

1) cpu A adds page P to the swap cache, loading page->flags
and modifying it locally

2) a second thread scans a page table entry and sees that
the page was accessed, so cpu B moves page P to the
active list

3) cpu A undoes the PG_inactive -> PG_active bit change,
corrupting the page->flags of P

The -rmap VM doesn't do anything to this bug, except making
it easy to trigger due to some side effects.

--
"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it." - Brian W. Kernighan

-
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/