qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] linux-user/elfload: fix filling psinfo->pr_psargs


From: Laurent Vivier
Subject: Re: [PATCH] linux-user/elfload: fix filling psinfo->pr_psargs
Date: Sat, 15 May 2021 21:59:31 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1

Le 13/04/2021 à 22:58, Ilya Leoshkevich a écrit :
> The current code dumps the memory between arg_start and arg_end,
> which contains the argv pointers. This results in the
> 
>     Core was generated by `<garbage>`
> 
> message when opening the core file in GDB. This is because the code is
> supposed to dump the actual arg strings. Fix by using arg_strings and
> env_strings instead of arg_start and arg_end.
> 
> Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
> ---
>  linux-user/elfload.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/linux-user/elfload.c b/linux-user/elfload.c
> index 4e45bd1539..cffcebfe45 100644
> --- a/linux-user/elfload.c
> +++ b/linux-user/elfload.c
> @@ -3662,10 +3662,10 @@ static int fill_psinfo(struct target_elf_prpsinfo 
> *psinfo, const TaskState *ts)
>  
>      (void) memset(psinfo, 0, sizeof (*psinfo));
>  
> -    len = ts->info->arg_end - ts->info->arg_start;
> +    len = ts->info->env_strings - ts->info->arg_strings;
>      if (len >= ELF_PRARGSZ)
>          len = ELF_PRARGSZ - 1;
> -    if (copy_from_user(&psinfo->pr_psargs, ts->info->arg_start, len))
> +    if (copy_from_user(&psinfo->pr_psargs, ts->info->arg_strings, len))
>          return -EFAULT;
>      for (i = 0; i < len; i++)
>          if (psinfo->pr_psargs[i] == 0)
> 


Applied to my linux-user-for-6.1 branch.

Thanks,
Laurent



reply via email to

[Prev in Thread] Current Thread [Next in Thread]