linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] Unblocked by fake_signal_wake_up then real signal
@ 2018-03-20  2:38 NIIBE Yutaka
  2018-03-20  2:38 ` [PATCH 1/4] signal/x86: Factor out nosig handling NIIBE Yutaka
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: NIIBE Yutaka @ 2018-03-20  2:38 UTC (permalink / raw)
  To: linux-kernel; +Cc: gniibe

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 unblocked by the signal.  In this situation, a signal
handler is called correctly, but it seems that the pselect is
restarted.  Expected behavior is unblocked pselect returning -EINTR.

Looking the code, my theory is: 
It is a fake signal by suspend which unblocks 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.

NIIBE Yutaka (4):
  signal/x86: Factor out nosig handling.
  signal/x86: do_signal: syscall restart should be done only once.
  signal/x86: Move nosig handling at the end of exit_to_usermode_loop.
  signal/x86: Move restore_saved_sigmask().

 arch/x86/entry/common.c       |  6 +++++-
 arch/x86/include/asm/signal.h |  3 ++-
 arch/x86/kernel/signal.c      | 22 ++++++++++++++--------
 3 files changed, 21 insertions(+), 10 deletions(-)

-- 
2.11.0

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-03-21  1:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-20  2:38 [PATCH 0/4] Unblocked by fake_signal_wake_up then real signal NIIBE Yutaka
2018-03-20  2:38 ` [PATCH 1/4] signal/x86: Factor out nosig handling NIIBE Yutaka
2018-03-20  2:38 ` [PATCH 2/4] signal/x86: do_signal: syscall restart should be done only once NIIBE Yutaka
2018-03-20  2:38 ` [PATCH 3/4] signal/x86: Move nosig handling at the end of exit_to_usermode_loop NIIBE Yutaka
2018-03-21  1:39   ` kbuild test robot
2018-03-20  2:38 ` [PATCH 4/4] signal/x86: Move restore_saved_sigmask() NIIBE Yutaka

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).