alpha: potential race around hae_cache in RESTORE_ALL

From: Al Viro
Date: Sat Sep 25 2010 - 14:13:16 EST


What happens if we get to RESTORE_ALL with interrupts enabled,
find that we want to restore HAE, get to
stq $21, HAE_CACHE($19); \
and get hit by an interrupt right after that assignment? Note that
*alpha_mv->hae_register is still not updated, but alpha_mv->hae_cache
already is, so if the interrupt calls set_hae() it would get seriously
confused if the value it wants is equal to the value we've put into
->hae_cache.

Until ~2002 it used to have a couple of swpipl around these
assignments and __set_hae() is still doing those. I agree that on
many exits we *will* have interrupts disabled when we get to RESTORE_ALL,
but not on all of them. E.g. any interrupt taken in kernel mode will
happily go to restore_all without bothering with swpipl at all.

AFAICS, it looks like a race; the change in question had been
introduced in "Update Alpha UP for thread_info and scheduler changes"
(Feb 10 2002, commit 374eeee8a8a50e12278dfa37021df7b6efe506c3 in historical
git tree).

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