public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@ZenIV.linux.org.uk>
To: rth@twiddle.net
Cc: linux-kernel@vger.kernel.org,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: alpha: potential race around hae_cache in RESTORE_ALL
Date: Sat, 25 Sep 2010 19:13:04 +0100	[thread overview]
Message-ID: <20100925181304.GV19804@ZenIV.linux.org.uk> (raw)

	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?

             reply	other threads:[~2010-09-25 18:13 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-25 18:13 Al Viro [this message]
2010-09-25 18:42 ` alpha: potential race around hae_cache in RESTORE_ALL Linus Torvalds
2010-09-25 19:18   ` Al Viro
2010-09-25 19:25     ` Al Viro
     [not found]       ` <AANLkTikEVr6wA6D_f2Z6OEFu6SCP_-89u0-k-K-wKgb=@mail.gmail.com>
2010-09-25 21:33         ` Linus Torvalds
2010-09-27  7:58       ` Ivan Kokshaysky
2010-09-27 12:12         ` Al Viro
2010-09-27 12:46           ` Al Viro
2010-09-27 16:26             ` Ivan Kokshaysky
2010-09-27 17:10               ` Linus Torvalds
2010-09-27 18:05                 ` Richard Henderson
2010-09-27 19:01                 ` Al Viro
2010-09-27 21:21                   ` Ivan Kokshaysky
2010-09-25 20:07   ` [PATCH] alpha: fix hae_cache race " Al Viro
2010-09-25 20:07   ` [PATCH] alpha: fix usp value in multithreaded coredumps Al Viro

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100925181304.GV19804@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rth@twiddle.net \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox