From: NIIBE Yutaka <gniibe@fsij.org>
To: linux-kernel@vger.kernel.org
Cc: NIIBE Yutaka <gniibe@fsij.org>
Subject: [PATCH v2 0/4] Fix no signal delivery at do_signal
Date: Thu, 22 Mar 2018 10:44:09 +0900 [thread overview]
Message-ID: <20180322014413.24099-1-gniibe@fsij.org> (raw)
Hello,
Background:
I tried to fix my own problem in suspend-to-ram with USB devices (some
device doesn't work well after suspend/resume). I know it's common
problems. Well, while I identified some problems of USB devices and
drivers, I did try my best. I fixed a USB device implementation of
mine. Then, I also located and fixed bugs in a USB user space driver
which I maintain.
Now, I think I found a kernel problem. After suspend/resume, in my
USB user space driver, a task sends a signal to another task, then,
pselect is woken up by the signal. In this situation, a signal
handler is called correctly, but it seems that the pselect is
restarted. Expected behavior is woken pselect returning -EINTR.
Looking the code, my theory is:
It is a fake signal by suspend which wakes up pselect to be frozen,
and after resume, real signal is sent. When both of signals are
handled in a single call of exit_to_usermode_loop, by two calls of
do_signal, firstly for fake signal and secondly for real signal, the
system call is restarted wrongly, where it should return -EINTR.
Here is a patch series of mine for x86. I'd suggest architecture
maintainers to do similar if an architecture supports suspend/resume.
I found that, in arch/arm, it does differently. When it finds no
signal delivery at do_signal, it restarts the system call soon,
breaking the loop. This approach also works.
Changes from v1:
* Title change of cover leter
* Avoid User Mode Linux breakage
* Only call nosig_restart_syscall when really needed
* Add 'unlikely'.
NIIBE Yutaka (4):
signal/x86: Factor out nosig handling.
signal/x86: do_signal: syscall restart should be done only once.
signal/x86: Move restore_saved_sigmask().
signal/x86: Move nosig handling at the end of exit_to_usermode_loop.
arch/x86/entry/common.c | 6 +++++-
arch/x86/include/asm/signal.h | 5 ++++-
arch/x86/kernel/signal.c | 22 ++++++++++++++--------
3 files changed, 23 insertions(+), 10 deletions(-)
--
2.11.0
next reply other threads:[~2018-03-22 1:44 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-22 1:44 NIIBE Yutaka [this message]
2018-03-22 1:44 ` [PATCH v2 1/4] signal/x86: Factor out nosig handling NIIBE Yutaka
2018-03-22 1:44 ` [PATCH v2 2/4] signal/x86: do_signal: syscall restart should be done only once NIIBE Yutaka
2018-03-22 1:44 ` [PATCH v2 3/4] signal/x86: Move restore_saved_sigmask() NIIBE Yutaka
2018-03-22 1:44 ` [PATCH v2 4/4] signal/x86: Move nosig handling at the end of exit_to_usermode_loop NIIBE Yutaka
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=20180322014413.24099-1-gniibe@fsij.org \
--to=gniibe@fsij.org \
--cc=linux-kernel@vger.kernel.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
all inboxes | Powered by JetHome®