Re: [PATCH] x86 page fault handler not interrupt safe

Linus Torvalds (torvalds@transmeta.com)
Mon, 7 May 2001 09:51:16 -0700 (PDT)


On Mon, 7 May 2001, Alan Cox wrote:
>
> I dont see that we will get a valid value in both cases.
>
> get_user
> fault - set %cr2
> IRQ
> vmalloc
> fault
> set %cr2
> fixup runs
> end IRQ
> cr2 is corrupt

Wrong. "%cr2" is _not_ "corrupt". It has a well-defined value.

So what happens is

get_user (or user-mode access)
fault - set %cr2 to fault1
irq
vmalloc fault - set %cr2 to fault2
fixup runs, iret
irq runs, iret
%cr2 is still %fault2
vmalloc fault - nothing to do
"false fixup" runs, iret
get_user (or user-mode access)
fault - set %cr2 to fault1
... get the right behaviour now ...

> There are a whole set of races with the vmalloc fixups.

As far as I can tell, there are no races anywhere. Just silly bugs that
are hard to see.

Linus

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