public inbox for linux-arch@vger.kernel.org
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: ralf@linux-mips.org
Cc: linux-arch@vger.kernel.org
Subject: Re: Signal restarting happing multiple time in do_signal
Date: Tue, 08 Aug 2006 15:25:04 -0700 (PDT)	[thread overview]
Message-ID: <20060808.152504.55835990.davem@davemloft.net> (raw)
In-Reply-To: <20060808110437.GB18770@linux-mips.org>

From: Ralf Baechle <ralf@linux-mips.org>
Date: Tue, 8 Aug 2006 12:04:37 +0100

> We were able to trigger this when debugging a multithreaded programs.
> At least i386 uses virtually identical algorithms so I think is likely
> to have the same issue.

Other platforms, including x86, clear the state out in one way or
another before the next iteration.

Actually on x86 it occurs as a side effect of setting
regs->eax, it is reset to the system call number requested
at syscall trap time, so it will not match any of the
error return values in this switch statement:

	/* Are we from a system call? */
	if (regs->orig_eax >= 0) {
		/* If so, check system call restarting.. */
		switch (regs->eax) {
		        case -ERESTART_RESTARTBLOCK:
			case -ERESTARTNOHAND:
				regs->eax = -EINTR;
				break;

			case -ERESTARTSYS:
				if (!(ka->sa.sa_flags & SA_RESTART)) {
					regs->eax = -EINTR;
					break;
				}
			/* fallthrough */
			case -ERESTARTNOINTR:
				regs->eax = regs->orig_eax;
				regs->eip -= 2;
		}
	}

So after the first iteration, the next time through here we
won't be "from a system call".

  reply	other threads:[~2006-08-08 22:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-08 11:04 Signal restarting happing multiple time in do_signal Ralf Baechle
2006-08-08 22:25 ` David Miller [this message]
2006-08-09  2:26   ` Andi Kleen
2006-08-11  8:12 ` Heiko Carstens

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=20060808.152504.55835990.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=linux-arch@vger.kernel.org \
    --cc=ralf@linux-mips.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