From: Al Viro <viro@ZenIV.linux.org.uk>
To: David Miller <davem@davemloft.net>
Cc: torvalds@linux-foundation.org, akpm@linux-foundation.org,
sparclinux@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [GIT] Sparc
Date: Wed, 22 Sep 2010 19:32:00 +0100 [thread overview]
Message-ID: <20100922183200.GC19804@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20100922.111019.200357319.davem@davemloft.net>
On Wed, Sep 22, 2010 at 11:10:19AM -0700, David Miller wrote:
>
> Al Viro has been auditing signal handling in various architectures,
> and he found some sparc bugs along the way.
>
> Those he found are fixed here, as well as a short patch to add
> raw perf event support.
Actually, there's one more problem; I have a tentative fix for sparc64,
but not for sparc32 (yet).
Basically, sparc is unlike all other architectures in this respect:
normally, after do_signal() has handled a signal the syscall exit
glue loops back, rechecks if we need to be rescheduled, if we need
to deal with more signals, etc. As the result, we build all sigframes
at once. sparc (and, until recently, alpha) normally calls do_signal()
only once; sparc64 _may_ call it twice, but that's it. sparc32 may
call it up to three times if we had userland window spill on entry.
That has unpleasant results - for starters, delivery of SIGSEGV upon
failure to set sigframe up is delayed unpredictably; we will take it
only when we trap again. Moreover, sigsuspend() has inconsistent
behaviour in case when we have several pending signals unmasked by
new mask. E.g. if we do the following on anything but sparc
block signals 1 and 2
set handlers for both
get signals 1 and 2 sent to you
sigsuspend(&emptyset)
we'll get both handlers run. On sparc we'll get only one of them, except
that if we get an IRQ while running in its handler, we'll get both run...
What happens is that sparc (and alpha until it got fixed) sets up one sigframe
and happily buggers off to userland; the first handler runs until we hit
a trap. If that trap happens to be the call of sigreturn() in the end of
handler, the first thing it'll do will be restoring the original sigmask.
Anything else will leave sigmask alone, see that we have another pending
signal and handle it...
Anyway, the sparc64 part of fix follows; I'm still digging through the
sparc32 side of things. Dave, could you take a look at that and ACK or NAK
it?
diff --git a/arch/sparc/kernel/rtrap_64.S b/arch/sparc/kernel/rtrap_64.S
index 090b9e9..77f1b95 100644
--- a/arch/sparc/kernel/rtrap_64.S
+++ b/arch/sparc/kernel/rtrap_64.S
@@ -34,37 +34,9 @@ __handle_preemption:
__handle_user_windows:
call fault_in_user_windows
wrpr %g0, RTRAP_PSTATE, %pstate
- wrpr %g0, RTRAP_PSTATE_IRQOFF, %pstate
- /* Redo sched+sig checks */
- ldx [%g6 + TI_FLAGS], %l0
- andcc %l0, _TIF_NEED_RESCHED, %g0
-
- be,pt %xcc, 1f
- nop
- call schedule
- wrpr %g0, RTRAP_PSTATE, %pstate
- wrpr %g0, RTRAP_PSTATE_IRQOFF, %pstate
- ldx [%g6 + TI_FLAGS], %l0
-
-1: andcc %l0, _TIF_DO_NOTIFY_RESUME_MASK, %g0
- be,pt %xcc, __handle_user_windows_continue
- nop
- mov %l5, %o1
- add %sp, PTREGS_OFF, %o0
- mov %l0, %o2
-
- call do_notify_resume
- wrpr %g0, RTRAP_PSTATE, %pstate
- wrpr %g0, RTRAP_PSTATE_IRQOFF, %pstate
- /* Signal delivery can modify pt_regs tstate, so we must
- * reload it.
- */
- ldx [%sp + PTREGS_OFF + PT_V9_TSTATE], %l1
- sethi %hi(0xf << 20), %l4
- and %l1, %l4, %l4
- ba,pt %xcc, __handle_user_windows_continue
+ ba,pt %xcc, __handle_preemption_continue
+ wrpr %g0, RTRAP_PSTATE_IRQOFF, %pstate
- andn %l1, %l4, %l1
__handle_userfpu:
rd %fprs, %l5
andcc %l5, FPRS_FEF, %g0
@@ -87,7 +59,7 @@ __handle_signal:
ldx [%sp + PTREGS_OFF + PT_V9_TSTATE], %l1
sethi %hi(0xf << 20), %l4
and %l1, %l4, %l4
- ba,pt %xcc, __handle_signal_continue
+ ba,pt %xcc, __handle_preemption_continue
andn %l1, %l4, %l1
/* When returning from a NMI (%pil==15) interrupt we want to
@@ -177,11 +149,9 @@ __handle_preemption_continue:
bne,pn %xcc, __handle_preemption
andcc %l0, _TIF_DO_NOTIFY_RESUME_MASK, %g0
bne,pn %xcc, __handle_signal
-__handle_signal_continue:
ldub [%g6 + TI_WSAVED], %o2
brnz,pn %o2, __handle_user_windows
nop
-__handle_user_windows_continue:
sethi %hi(TSTATE_PEF), %o0
andcc %l1, %o0, %g0
next prev parent reply other threads:[~2010-09-22 18:32 UTC|newest]
Thread overview: 361+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-22 18:10 [GIT] Sparc David Miller
2010-09-22 18:32 ` Al Viro [this message]
2010-09-22 18:46 ` Linus Torvalds
2010-09-22 18:53 ` Al Viro
2010-09-22 19:04 ` Al Viro
2010-09-22 19:08 ` Linus Torvalds
2010-09-22 19:53 ` Al Viro
2010-09-22 20:43 ` Al Viro
2010-09-22 21:15 ` David Miller
2010-09-22 23:12 ` Al Viro
2010-09-24 4:48 ` David Miller
2010-09-23 0:27 ` Al Viro
2010-09-24 4:53 ` David Miller
2010-09-23 4:59 ` Al Viro
2010-09-24 5:01 ` David Miller
-- strict thread matches above, loose matches on Subject: below --
2021-03-08 23:46 [GIT] SPARC David Miller
2021-03-09 0:19 ` John Paul Adrian Glaubitz
2021-03-09 19:08 ` David Miller
2021-03-09 19:27 ` Linus Torvalds
2021-03-10 0:24 ` David Miller
2021-03-10 1:15 ` David Miller
2021-03-10 1:17 ` Linus Torvalds
2021-03-10 1:18 ` David Miller
2021-03-10 10:40 ` Geert Uytterhoeven
2021-03-10 13:14 ` Konstantin Ryabitsev
2021-02-23 21:21 [GIT] Sparc David Miller
2021-02-23 23:36 ` pr-tracker-bot
2020-06-08 0:16 David Miller
2020-06-08 0:35 ` pr-tracker-bot
2020-04-06 18:25 David Miller
2020-04-07 19:55 ` pr-tracker-bot
2020-02-02 10:57 David Miller
2020-02-02 20:20 ` pr-tracker-bot
2020-01-30 10:19 David Miller
2020-01-30 18:00 ` pr-tracker-bot
2019-07-13 6:17 David Miller
2019-07-13 23:15 ` pr-tracker-bot
2019-06-03 5:21 David Miller
2019-06-03 17:35 ` pr-tracker-bot
2019-05-09 21:35 David Miller
2019-05-09 22:15 ` pr-tracker-bot
2018-12-22 23:46 David Miller
2018-12-26 19:20 ` pr-tracker-bot
2018-12-21 20:42 David Miller
2018-12-21 22:30 ` pr-tracker-bot
2018-12-03 5:33 David Miller
2018-12-03 17:55 ` pr-tracker-bot
2018-11-01 1:44 David Miller
2018-11-01 16:15 ` Linus Torvalds
2018-10-26 23:08 David Miller
2018-10-27 0:17 ` Linus Torvalds
2018-10-25 18:28 David Miller
2018-10-26 1:30 ` Linus Torvalds
2018-10-24 3:31 David Miller
2018-10-24 5:43 ` Linus Torvalds
2018-10-18 23:33 David Miller
2018-10-19 7:16 ` Greg KH
2018-10-16 2:39 David Miller
2018-10-16 16:55 ` Greg KH
2018-10-08 6:48 David Miller
2018-10-08 14:26 ` Greg KH
2018-08-22 5:16 David Miller
2018-06-09 14:21 David Miller
2018-04-30 20:12 David Miller
2018-04-03 15:31 David Miller
2018-03-15 21:20 David Miller
2018-02-01 15:20 David Miller
2018-01-24 23:23 David Miller
2017-12-31 4:17 David Miller
2017-11-29 20:17 David Miller
2017-11-18 3:15 David Miller
2017-09-10 3:24 David Miller
2017-08-21 21:01 David Miller
2017-08-10 5:26 David Miller
2017-08-04 17:11 David Miller
2017-07-17 20:57 David Miller
2017-07-12 4:05 David Miller
2017-07-08 10:40 David Miller
2017-06-06 20:57 David Miller
2017-05-18 18:03 David Miller
2017-05-09 20:04 David Miller
2017-04-26 19:22 David Miller
2017-04-18 20:20 David Miller
2017-04-07 21:21 David Miller
2017-02-24 16:34 David Miller
2017-01-30 22:37 David Miller
2016-12-12 15:10 David Miller
2016-12-06 17:19 David Miller
2016-11-28 21:03 David Miller
2016-11-21 18:41 David Miller
2016-10-31 1:04 David Miller
2016-10-06 7:57 David Miller
2016-10-02 13:02 David Miller
2016-07-29 18:15 David Miller
2016-06-29 13:06 David Miller
2016-06-29 13:32 ` David Miller
2016-06-01 4:17 David Miller
2016-05-22 6:03 David Miller
2016-05-02 5:10 David Miller
2016-03-28 19:45 David Miller
2016-03-01 5:47 David Miller
2016-01-15 21:04 David Miller
2015-12-31 20:30 David Miller
2015-12-24 17:16 David Miller
2015-11-05 21:39 David Miller
2015-11-06 0:43 ` Linus Torvalds
2015-11-06 0:56 ` Linus Torvalds
2015-11-06 1:05 ` Julian Calaby
2015-11-06 6:44 ` Julia Lawall
2015-11-07 3:31 ` Julian Calaby
2015-11-07 6:04 ` Julia Lawall
2015-11-06 5:14 ` David Miller
2015-08-07 2:19 David Miller
2015-06-25 13:27 David Miller
2015-06-02 0:17 David Miller
2015-04-22 2:58 David Miller
2015-04-18 21:58 David Miller
2015-04-17 20:14 David Miller
2015-03-23 16:55 David Miller
2015-03-23 17:05 ` Linus Torvalds
2015-03-23 17:12 ` Linus Torvalds
2015-03-23 19:14 ` David Miller
2015-03-23 19:10 ` David Miller
2015-03-19 4:59 David Miller
2014-12-18 21:39 David Miller
2014-12-12 20:58 David Miller
2014-11-26 21:42 David Miller
2014-11-16 21:43 David Miller
2014-10-31 20:44 David Miller
2014-10-24 17:32 David Miller
2014-10-24 19:47 ` Linus Torvalds
2014-10-27 21:09 ` Andrew Morton
2014-10-27 22:43 ` David Miller
2014-10-28 10:49 ` Steve Capper
2014-10-19 17:26 David Miller
2014-10-15 18:45 David Miller
2014-10-10 20:01 David Miller
2014-08-14 23:17 David Miller
2014-08-12 4:01 David Miller
2014-08-06 5:03 David Miller
2014-07-22 5:38 David Miller
2014-06-16 6:45 David Miller
2014-05-22 21:53 David Miller
2014-05-06 15:30 David Miller
2014-05-06 16:29 ` Dave Jones
2014-05-06 17:13 ` David Miller
2014-03-24 19:18 David Miller
2014-02-21 17:42 David Miller
2014-01-29 8:51 David Miller
2014-01-05 2:04 David Miller
2013-11-19 22:18 David Miller
2013-11-14 23:19 David Miller
2013-10-03 3:52 David Miller
2013-10-01 17:57 David Miller
2013-09-05 20:44 David Miller
2013-09-05 22:32 ` Sergei Shtylyov
2013-09-06 2:54 ` David Miller
2013-07-10 21:00 David Miller
2013-06-19 9:28 David Miller
2013-05-05 2:42 David Miller
2013-04-25 0:08 David Miller
2013-04-21 1:16 David Miller
2013-03-19 21:18 David Miller
2013-02-20 22:09 David Miller
2013-02-14 20:14 David Miller
2012-12-20 0:15 David Miller
2012-12-13 20:11 David Miller
2012-12-03 20:33 David Miller
2012-11-23 19:48 David Miller
2012-11-10 19:21 David Miller
2012-10-17 5:05 David Miller
2012-10-12 19:26 David Miller
2012-10-10 1:26 David Miller
2012-10-08 20:18 David Miller
2012-10-10 5:11 ` Al Viro
2012-10-11 0:34 ` David Miller
2012-10-03 6:14 David Miller
2012-10-02 18:13 David Miller
2012-09-21 19:48 David Miller
2012-08-15 7:44 David Miller
2012-08-15 7:51 ` [GIT] Sparc David Miller
2012-07-26 23:58 David Miller
2012-06-15 22:41 David Miller
2012-05-30 22:38 David Miller
2012-05-24 21:32 David Miller
2012-05-21 9:03 David Miller
2012-05-21 17:37 ` Linus Torvalds
2012-05-21 18:24 ` Sam Ravnborg
2012-05-21 18:28 ` Linus Torvalds
2012-05-21 18:33 ` Linus Torvalds
2012-05-21 18:38 ` Sam Ravnborg
2012-05-10 20:52 David Miller
2012-04-21 20:58 David Miller
2012-04-13 19:24 David Miller
2012-04-13 19:46 ` Linus Torvalds
2012-04-13 20:12 ` David Miller
2012-04-13 21:50 ` Sam Ravnborg
2012-04-14 9:13 ` Ingo Molnar
2012-04-14 10:23 ` Sam Ravnborg
2012-04-14 10:50 ` Ingo Molnar
2012-04-04 8:03 David Miller
2012-03-31 1:37 David Miller
2012-03-30 7:39 David Miller
2012-03-30 10:02 ` Sam Ravnborg
2012-01-26 21:55 David Miller
2012-01-09 22:22 David Miller
2011-12-23 22:11 David Miller
2011-12-16 20:22 David Miller
2011-11-18 19:22 David Miller
2011-11-08 20:07 David Miller
2011-10-31 8:32 David Miller
2011-10-20 9:48 David Miller
2011-09-29 19:31 David Miller
2011-08-30 18:13 David Miller
2011-08-29 16:50 David Miller
2011-08-24 6:34 David Miller
2011-08-19 4:54 David Miller
2011-08-15 22:47 David Miller
2011-08-12 1:08 David Miller
2011-08-07 22:48 David Miller
2011-08-05 11:25 David Miller
2011-07-28 8:46 David Miller
2011-07-28 10:08 ` Anca Emanuel
2011-07-16 17:48 David Miller
2011-06-09 23:14 David Miller
2011-05-23 4:52 David Miller
2011-05-12 4:42 David Miller
2011-04-01 6:33 David Miller
2011-03-25 21:05 David Miller
2011-03-21 2:51 David Miller
2011-03-17 3:06 David Miller
2011-02-17 21:34 David Miller
2011-01-12 0:26 David Miller
2011-01-06 22:48 David Miller
2010-12-14 20:11 David Miller
2010-10-29 3:46 David Miller
2010-09-11 4:25 David Miller
2010-08-24 9:02 David Miller
2010-08-18 1:03 David Miller
2010-08-18 1:31 ` Linus Torvalds
2010-08-18 1:59 ` Linus Torvalds
2010-08-18 2:14 ` David Miller
2010-08-18 2:12 ` David Miller
2010-08-18 2:50 ` Al Viro
2010-08-09 10:28 David Miller
2010-08-05 0:21 David Miller
2010-07-21 4:25 [GIT] SPARC David Miller
2010-05-19 19:50 [GIT] Sparc David Miller
2010-04-20 8:49 [GIT]: Sparc David Miller
2010-04-13 11:43 [GIT] Sparc David Miller
2010-04-04 8:15 David Miller
2010-03-29 20:11 David Miller
2010-03-16 21:46 [GIT]: Sparc David Miller
2010-03-14 2:17 David Miller
2010-03-14 14:34 ` Geert Uytterhoeven
2010-03-14 21:24 ` David Miller
2010-03-04 8:28 David Miller
2010-03-02 12:41 David Miller
2010-02-22 2:32 David Miller
2010-02-19 7:29 David Miller
2010-02-20 0:23 ` David Miller
2010-02-10 18:04 David Miller
2010-02-11 20:45 ` David Miller
2010-01-26 0:56 David Miller
2010-01-26 9:23 ` Alexander Beregalov
2010-01-26 12:12 ` David Miller
2010-01-05 7:28 David Miller
2009-12-15 6:04 David Miller
2009-12-06 3:35 David Miller
2009-11-30 9:14 David Miller
2009-11-09 5:31 David Miller
2009-10-14 21:14 David Miller
2009-10-05 9:02 David Miller
2009-09-25 21:31 David Miller
2009-09-17 17:54 David Miller
2009-09-16 8:43 David Miller
2009-09-12 4:01 David Miller
2009-09-04 12:27 David Miller
2009-08-26 3:38 David Miller
2009-06-19 7:08 David Miller
2009-06-16 12:23 David Miller
2009-06-01 10:26 David Miller
2009-04-22 10:48 David Miller
2009-04-16 11:12 David Miller
2009-04-08 23:08 David Miller
2009-03-30 0:11 David Miller
2009-03-28 1:18 David Miller
2009-03-26 9:08 David Miller
2009-03-23 8:40 David Miller
2009-03-12 15:58 David Miller
2009-02-25 7:15 David Miller
2009-02-10 4:21 David Miller
2009-02-04 7:27 David Miller
2009-01-26 22:57 David Miller
2009-01-16 0:02 David Miller
2009-01-11 7:56 David Miller
2009-01-08 1:19 David Miller
2009-01-06 2:34 David Miller
2008-12-29 4:51 David Miller
2008-12-18 3:57 David Miller
2008-12-04 19:58 David Miller
2008-12-02 7:19 David Miller
2008-11-17 7:51 David Miller
2008-11-11 6:23 David Miller
2008-11-02 7:45 David Miller
2008-10-31 6:02 David Miller
2008-10-24 0:33 David Miller
2008-10-13 7:00 David Miller
2008-10-11 22:33 David Miller
2008-09-22 23:18 David Miller
2008-09-19 2:28 David Miller
2008-09-12 22:59 David Miller
2008-09-09 23:13 David Miller
2008-09-08 20:59 David Miller
2008-08-30 20:01 David Miller
2008-08-25 3:40 David Miller
2008-08-18 5:39 David Miller
2008-08-13 23:45 David Miller
2008-08-14 0:21 ` David Miller
2008-08-08 6:20 David Miller
2008-08-02 5:12 David Miller
2008-07-28 1:09 David Miller
2008-07-25 22:21 David Miller
2008-07-24 6:27 David Miller
2008-07-23 0:14 David Miller
2008-07-21 6:41 David Miller
2008-06-13 4:15 David Miller
2008-06-04 23:56 David Miller
2008-05-26 6:18 David Miller
2008-05-22 4:55 David Miller
2008-05-20 23:04 David Miller
2008-05-16 22:27 David Miller
2008-05-15 0:22 David Miller
2008-05-14 1:19 David Miller
2008-05-12 7:58 David Miller
2008-05-11 9:28 David Miller
2008-05-11 11:30 ` Christoph Hellwig
2008-05-09 0:05 David Miller
2008-05-07 23:39 David Miller
2008-05-08 0:06 ` Linus Torvalds
2008-05-08 1:16 ` David Miller
2008-05-07 1:14 David Miller
2008-05-03 3:02 David Miller
2008-04-30 8:33 David Miller
2008-04-28 0:01 David Miller
2008-04-28 6:29 ` Christoph Hellwig
2008-04-28 6:37 ` David Miller
2008-04-25 10:25 David Miller
2008-04-24 11:02 David Miller
2008-04-24 15:39 ` Linus Torvalds
2008-04-24 15:41 ` David Miller
2008-04-21 22:32 David Miller
2008-04-21 22:50 ` Roland Dreier
2008-04-21 23:54 ` David Miller
2008-04-21 23:10 ` Linus Torvalds
2008-04-21 23:18 ` Al Viro
2008-04-21 23:25 ` Al Viro
2008-04-22 0:16 ` David Miller
2008-04-22 0:26 ` Al Viro
2008-04-21 23:32 ` Linus Torvalds
2008-04-22 0:06 ` David Miller
2008-04-22 0:20 ` Linus Torvalds
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=20100922183200.GC19804@ZenIV.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--cc=akpm@linux-foundation.org \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=sparclinux@vger.kernel.org \
--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;
as well as URLs for NNTP newsgroup(s).