All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: Timothy E Baldwin <T.E.Baldwin99@members.leeds.ac.uk>
Cc: Riku Voipio <riku.voipio@iki.fi>,
	QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH 00/34] linux-user: Fix signal race conditions and SA_RESTART
Date: Thu, 10 Sep 2015 19:00:18 +0100	[thread overview]
Message-ID: <CAFEAcA8bjhBJ9SNOzXtgEKiUCrYx5oXAxSV4cwu9xNgj1K7Ycg@mail.gmail.com> (raw)
In-Reply-To: <1441497448-32489-1-git-send-email-T.E.Baldwin99@members.leeds.ac.uk>

On 6 September 2015 at 00:56, Timothy E Baldwin
<T.E.Baldwin99@members.leeds.ac.uk> wrote:
> There are many races with signals in linux user:
>
>  - Multiple host signals in quick succession, fixed by keeping host signals
>    blocked, and checking if target signals are blocked before calling
>    target signal handler.
>  - Signal shortly before blocking system call, fixed by either:
>    - Block hosts signals, check and use host system call with
>      sigset_t parameter.
>    - Or check if signals are pending immediately before host system call
>      and if a signal arrives between the check and system call rewind
>      host instruction pointer to before the check. Also fixes SA_RESTART.
>  - Signal before or during sensitive system call, fixed in a similar manner.
>  - Close host and synchronous signals, partly fixed by implementing a separate
>    queue for synchronous signals which are dispatched first. The asynchronous
>    signal may still be delayed or lost rather than dispatched to another thread
>    or handled after exec().
>
> Also fixed:
>  - Errno array bounds.
>  - Default fatal actions occurring in the middle of target instructions.

Thanks for sending this patchset. This is really cool and we've needed
it for a long time...

> I have major problems testing the system call restarting:
>  - x86, ARM MIPS, PowerPC and SPARC sucessful tested.
>  - Microblaze and SH4 works without signals, but signal test case
>    crashes with or without my changes.
>  - Alpha works without signals, but don't have a toolchain.
>    to compile the signal test case.
>  - I have been unable to test UniCore32, OpenRISC, M68K, S390
>    and CRIS due to a lack of binaries and toolchains.

If the relevant maintainers don't get round to testing the patches
I think we can go ahead and commit anyway -- some of our minor
architectures are somewhat unmaintained. It's probably worth cc'ing
the architecture maintainers on the next round of this series
(look for who's listed for target-whatever in MAINTAINERS).

I ran this patchset through the Linux Test Project test suite for
the ARM target. Unfortunately it has a handful of extra test failures.
For instance:
open08      2  TFAIL  :  call succeeded unexpectedly
(a test which should have failed EISDIR)

read02      2  TFAIL  :  call succeeded unexpectedly
should also have failed EISDIR and didn't

The waitid01 and waitid02 tests also failed, as did a few others.
Some of the fcntl tests seemed to hang.

(http://wiki.qemu.org/Testing/LTP has the info on how to run the
tests if you want to try it yourself.)

You should probably run your patches through scripts/checkpatch.pl,
which will flag up formatting problems. (Don't worry about trying
to do that for the "reindent signal.c" patch, fixing the style
issues in the same commit there would make the patch hard to review
with diff -w.)

It might be wise to rearrange the patchseries a little, so all
the patches which do the 'support restarting syscalls' work
plus the 'safe_syscall' implementation go at the start. I think
these are more obviously correct and easier to review than the
changes to the signal handling code in 'Fix race between multiple
signals' and later patches. So they might be able to go into the
tree ahead of the rest if the later patches need to go through
further rounds of review.

I'll send out my comments on the first half or so of the
patchset in a moment; the second half I need to think about
in more detail first.

thanks
-- PMM

  parent reply	other threads:[~2015-09-10 18:00 UTC|newest]

Thread overview: 76+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-05 23:56 [Qemu-devel] [PATCH 00/34] linux-user: Fix signal race conditions and SA_RESTART Timothy E Baldwin
2015-09-05 23:56 ` [Qemu-devel] [PATCH 01/34] linux-user: Fix array bounds in errno conversion Timothy E Baldwin
2015-09-10 18:04   ` Peter Maydell
2015-09-11 10:59   ` Peter Maydell
2015-10-12 13:42     ` Riku Voipio
2015-10-31  2:51       ` Laurent Vivier
2015-09-05 23:56 ` [Qemu-devel] [PATCH 02/34] linux-user: Reindent signal handling Timothy E Baldwin
2015-09-05 23:56 ` [Qemu-devel] [PATCH 03/34] linux-user: Support for restarting system calls Timothy E Baldwin
2015-09-10 18:08   ` Peter Maydell
2015-09-05 23:56 ` [Qemu-devel] [PATCH 04/34] linux-user: Support for restarting system calls for x86 targets Timothy E Baldwin
2015-09-10 18:08   ` Peter Maydell
2015-09-05 23:56 ` [Qemu-devel] [PATCH 05/34] linux-user: Support for restarting system calls for ARM targets Timothy E Baldwin
2015-09-10 18:09   ` Peter Maydell
2015-09-05 23:57 ` [Qemu-devel] [PATCH 06/34] linux-user: Support for restarting system calls for MIPS targets Timothy E Baldwin
2015-09-10 18:09   ` Peter Maydell
2015-09-05 23:57 ` [Qemu-devel] [PATCH 07/34] linux-user: Support for restarting system calls for PPC targets Timothy E Baldwin
2015-09-10 18:10   ` Peter Maydell
2015-09-05 23:57 ` [Qemu-devel] [PATCH 08/34] linux-user: Support for restarting system calls for SPARC targets Timothy E Baldwin
2015-09-10 18:10   ` Peter Maydell
2015-09-05 23:57 ` [Qemu-devel] [PATCH 09/34] linux-user: Test for restarting system calls Timothy E Baldwin
2015-09-10 18:12   ` Peter Maydell
2015-09-05 23:57 ` [Qemu-devel] [PATCH 10/34] linux-user: Support for restarting system calls for Microblaze targets Timothy E Baldwin
2015-09-10 18:14   ` Peter Maydell
2016-03-03 20:15     ` Peter Maydell
2016-03-04  0:27       ` Edgar E. Iglesias
2016-03-04 10:11         ` Peter Maydell
2015-09-05 23:57 ` [Qemu-devel] [PATCH 11/34] linux-user: Support for restarting system calls for SH4 targets Timothy E Baldwin
2015-09-10 18:15   ` Peter Maydell
2015-09-05 23:57 ` [Qemu-devel] [PATCH 12/34] linux-user: Support for restarting system calls for APLHA targets Timothy E Baldwin
2015-09-10 18:16   ` Peter Maydell
2015-09-05 23:57 ` [Qemu-devel] [PATCH 13/34] linux-user: Fix signal before blocking system calls race and SA_RESTART Timothy E Baldwin
2015-09-10 18:46   ` Peter Maydell
2015-09-11 10:57   ` Peter Maydell
2015-09-05 23:57 ` [Qemu-devel] [PATCH 14/34] linux-user: Use safe_syscall for read and write system calls Timothy E Baldwin
2015-09-10 18:48   ` Peter Maydell
2015-09-05 23:57 ` [Qemu-devel] [PATCH 15/34] linux-user: Remove redundant get_errno() calls Timothy E Baldwin
2015-09-10 18:50   ` Peter Maydell
2015-09-05 23:57 ` [Qemu-devel] [PATCH 16/34] linux-user: Use safe_syscall for open and openat system calls Timothy E Baldwin
2015-09-10 18:54   ` Peter Maydell
2015-09-05 23:57 ` [Qemu-devel] [PATCH 17/34] linux-user: Use safe_syscall for wait " Timothy E Baldwin
2015-09-10 18:58   ` Peter Maydell
2015-09-05 23:57 ` [Qemu-devel] [PATCH 18/34] linux-user: Fix race between multiple signals Timothy E Baldwin
2015-09-11 14:30   ` Peter Maydell
2015-09-05 23:57 ` [Qemu-devel] [PATCH 19/34] linux-user: Restart fork() if signals pending Timothy E Baldwin
2015-09-11 14:34   ` Peter Maydell
2015-09-05 23:57 ` [Qemu-devel] [PATCH 20/34] linux-user: Remove redundant default action check in queue_signal() Timothy E Baldwin
2015-09-11 14:41   ` Peter Maydell
2015-09-05 23:57 ` [Qemu-devel] [PATCH 21/34] linux-user: Remove redundant gdb_queuesig() Timothy E Baldwin
2015-09-05 23:57 ` [Qemu-devel] [PATCH 22/34] linux-user: Remove real-time signal queuing Timothy E Baldwin
2015-09-05 23:57 ` [Qemu-devel] [PATCH 23/34] linux-user: Queue synchronous signals separately Timothy E Baldwin
2015-09-05 23:57 ` [Qemu-devel] [PATCH 24/34] linux-user: Restart execve() if signal pending Timothy E Baldwin
2015-09-11 14:36   ` Peter Maydell
2015-09-05 23:57 ` [Qemu-devel] [PATCH 25/34] linux-user: Restart exit() " Timothy E Baldwin
2015-09-11 14:36   ` Peter Maydell
2015-09-05 23:57 ` [Qemu-devel] [PATCH 26/34] linux-user: Restart kill() " Timothy E Baldwin
2015-09-05 23:57 ` [Qemu-devel] [PATCH 27/34] linux-user: pause() should not pause " Timothy E Baldwin
2015-09-11 14:36   ` Peter Maydell
2015-09-05 23:57 ` [Qemu-devel] [PATCH 28/34] linux-user: Restart sigaction() " Timothy E Baldwin
2015-09-11 14:37   ` Peter Maydell
2015-09-05 23:57 ` [Qemu-devel] [PATCH 29/34] linux-user: Support for restarting system calls for UniCore32 targets Timothy E Baldwin
2015-09-10 19:05   ` Peter Maydell
2015-09-05 23:57 ` [Qemu-devel] [PATCH 30/34] linux-user: Support for restarting system calls for OpenRISC targets Timothy E Baldwin
2015-09-10 19:06   ` Peter Maydell
2015-09-05 23:57 ` [Qemu-devel] [PATCH 31/34] linux-user: Support for restarting system calls for M68K targets Timothy E Baldwin
2015-09-10 19:06   ` Peter Maydell
2015-09-05 23:57 ` [Qemu-devel] [PATCH 32/34] linux-user: Support for restarting system calls for S390 targets Timothy E Baldwin
2015-09-10 19:07   ` Peter Maydell
2015-09-05 23:57 ` [Qemu-devel] [PATCH 33/34] linux-user: Support for restarting system calls for CRIS targets Timothy E Baldwin
2015-09-10 19:12   ` Peter Maydell
2015-09-11 14:18     ` Edgar E. Iglesias
2015-09-11 14:20       ` Peter Maydell
2015-09-11 14:26         ` Edgar E. Iglesias
2015-09-05 23:57 ` [Qemu-devel] [PATCH 34/34] linux-user: Remove TARGET_USE_ERESTARTSYS Timothy E Baldwin
2015-09-10 19:13   ` Peter Maydell
2015-09-10 18:00 ` Peter Maydell [this message]
2015-10-02 11:52   ` [Qemu-devel] [PATCH 00/34] linux-user: Fix signal race conditions and SA_RESTART Riku Voipio

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=CAFEAcA8bjhBJ9SNOzXtgEKiUCrYx5oXAxSV4cwu9xNgj1K7Ycg@mail.gmail.com \
    --to=peter.maydell@linaro.org \
    --cc=T.E.Baldwin99@members.leeds.ac.uk \
    --cc=qemu-devel@nongnu.org \
    --cc=riku.voipio@iki.fi \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.