[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <AANLkTi=XURM0hOiitvNSiacd9+7Vx8s7V0KZ+oZQsDDQ@mail.gmail.com>
Date: Sat, 25 Sep 2010 11:42:41 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Al Viro <viro@...iv.linux.org.uk>
Cc: rth@...ddle.net, linux-kernel@...r.kernel.org
Subject: Re: alpha: potential race around hae_cache in RESTORE_ALL
On Sat, Sep 25, 2010 at 11:13 AM, Al Viro <viro@...iv.linux.org.uk> wrote:
> 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?
Ok, so it's been absolutely ages since I touched the HAE stuff, but I
think the logic was that interrupts will always restore HAE to the
pre-interrupt state on exit, so reading it was always supposedly
race-free and didn't need any protection from normal code.
But yes, any actual _changes_ to HAE had better protect against
interrupts, so that they don't see the half-done state.
So yes, I think you found a bug.
I also don't see why that crazy RESTORE_ALL code does that reload of
$0 and $1 when it updates HAE. Is that just legacy from it having
_used_ to do the swipl PAL-call and that trashed those registers?
Anyway, I think the fix should be that we really always do have
interrupts disabled in RESTORE_ALL, rather than re-introduce the swipl
into the RESTORE_ALL sequence. A lot of the critical sequences already
do that - notably the normal return-to-user space code sequence that
is the really critical one.
Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists