linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: catalin.marinas@arm.com (Catalin Marinas)
To: linux-arm-kernel@lists.infradead.org
Subject: ARM syscall restarting with TIF_SYSCALL_RESTARTSYS
Date: Fri, 15 Jun 2012 12:56:41 +0100	[thread overview]
Message-ID: <20120615115641.GA11507@arm.com> (raw)

Hi Al,

With the recent changes the syscall restarting on ARM is done via the
TIF_SYSCALL_RESTARTSYS flag which causes the override of the syscall
number in syscall_trace(). I think there is a scenario where this could
fail:

1. app does a syscall
2. syscall interrupted and returns -ERESTART_RESTARTBLOCK. There is no
   signal to deliver
3. do_signal() sets TIF_SYSCALL_RESTARTSYS and ARM_pc to restart_addr
4. Linux returns to the SVC instruction (restart_addr) in user space
   but, before SVC is re-executed, it gets an interrupt
5. When returning from interrupt, a signal is to be delivered.
   do_signal() does not clear TIF_SYSCALL_RESTARTSYS since it is
   returning from interrupt
6. Signal handler calls sigreturn() but the syscall number gets
   overridden by syscall_trace() since TIF_SYSCALL_RESTARTSYS is set

The solution I see is to do the restarting within the kernel without
returning to user and risk getting another signal (I think Russell
mentioned this in the past).

Are my assumptions above correct or did I miss anything?

Thanks.

-- 
Catalin

                 reply	other threads:[~2012-06-15 11:56 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20120615115641.GA11507@arm.com \
    --to=catalin.marinas@arm.com \
    --cc=linux-arm-kernel@lists.infradead.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).