diff mbox

[25/34] linux-user: Restart exit() if signal pending

Message ID 1441497448-32489-26-git-send-email-T.E.Baldwin99@members.leeds.ac.uk
State New
Headers show

Commit Message

Timothy Baldwin Sept. 5, 2015, 11:57 p.m. UTC
Without this a signal could vanish on thread exit.

Signed-off-by: Timothy Edward Baldwin <T.E.Baldwin99@members.leeds.ac.uk>
---
 linux-user/syscall.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Peter Maydell Sept. 11, 2015, 2:36 p.m. UTC | #1
On 6 September 2015 at 00:57, Timothy E Baldwin
<T.E.Baldwin99@members.leeds.ac.uk> wrote:
> Without this a signal could vanish on thread exit.
>
> Signed-off-by: Timothy Edward Baldwin <T.E.Baldwin99@members.leeds.ac.uk>
> ---
>  linux-user/syscall.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index 4839154..efe61e3 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -5719,8 +5719,12 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
>             However in threaded applictions it is used for thread termination,
>             and _exit_group is used for application termination.
>             Do thread termination if we have more then one thread.  */
> -        /* FIXME: This probably breaks if a signal arrives.  We should probably
> -           be disabling signals.  */
> +
> +        if (block_signals()) {
> +            ret = -TARGET_ERESTARTSYS;
> +            break;
> +        }
> +
>          if (CPU_NEXT(first_cpu)) {
>              TaskState *ts;
>

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM
diff mbox

Patch

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 4839154..efe61e3 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -5719,8 +5719,12 @@  abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
            However in threaded applictions it is used for thread termination,
            and _exit_group is used for application termination.
            Do thread termination if we have more then one thread.  */
-        /* FIXME: This probably breaks if a signal arrives.  We should probably
-           be disabling signals.  */
+
+        if (block_signals()) {
+            ret = -TARGET_ERESTARTSYS;
+            break;
+        }
+
         if (CPU_NEXT(first_cpu)) {
             TaskState *ts;