Hi,

Thanks, looks good and fixes getrusage02 ltp test.

Added to the linux-user que:

https://git.linaro.org/people/riku.voipio/qemu.git/shortlog/refs/heads/linux-user-for-upstream

Peter, do you prefer a new pull request for linux-user with this patch
added on top, or is pulling the updated branch good enough for you?

Riku


On 5 May 2014 12:02, Petar Jovanovic <petar.jovano...@imgtec.com> wrote:

> ping
>
> http://patchwork.ozlabs.org/patch/337703/
>
> ________________________________________
> From: Petar Jovanovic [petar.jovano...@rt-rk.com]
> Sent: Tuesday, April 08, 2014 7:24 PM
> To: qemu-devel@nongnu.org
> Cc: Petar Jovanovic; riku.voi...@linaro.org
> Subject: [PATCH] linux-user: fix getrusage and wait4 failures with invalid
> rusage struct
>
> From: Petar Jovanovic <petar.jovano...@imgtec.com>
>
> Implementations of system calls getrusage and wait4 have not previously
> handled correctly cases when incorrect address of struct rusage is
> passed.
> This change makes sure return values are correctly set for these cases.
>
> Signed-off-by: Petar Jovanovic <petar.jovano...@imgtec.com>
> ---
>  linux-user/syscall.c |   11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index 9864813..fc52f0b 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -6309,7 +6309,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long
> arg1,
>              struct rusage rusage;
>              ret = get_errno(getrusage(arg1, &rusage));
>              if (!is_error(ret)) {
> -                host_to_target_rusage(arg2, &rusage);
> +                ret = host_to_target_rusage(arg2, &rusage);
>              }
>          }
>          break;
> @@ -6974,6 +6974,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long
> arg1,
>              abi_long status_ptr = arg2;
>              struct rusage rusage, *rusage_ptr;
>              abi_ulong target_rusage = arg4;
> +            abi_long rusage_err;
>              if (target_rusage)
>                  rusage_ptr = &rusage;
>              else
> @@ -6985,8 +6986,12 @@ abi_long do_syscall(void *cpu_env, int num,
> abi_long arg1,
>                      if (put_user_s32(status, status_ptr))
>                          goto efault;
>                  }
> -                if (target_rusage)
> -                    host_to_target_rusage(target_rusage, &rusage);
> +                if (target_rusage) {
> +                    rusage_err = host_to_target_rusage(target_rusage,
> &rusage);
> +                    if (rusage_err) {
> +                        ret = rusage_err;
> +                    }
> +                }
>              }
>          }
>          break;
> --
> 1.7.9.5
>
>

Reply via email to