aboutsummaryrefslogtreecommitdiff
path: root/linux-user/elfload.c
diff options
context:
space:
mode:
authorIlya Leoshkevich <iii@linux.ibm.com>2021-04-13 22:58:14 +0200
committerLaurent Vivier <laurent@vivier.eu>2021-05-18 07:10:46 +0200
commit5f779a3a26a9dcc8072d909b7759bb9fade097a9 (patch)
tree63205ba4ec84af2174e6dcdc6ecf8f7e1e68294b /linux-user/elfload.c
parentfb80439b1ede60d214ae5bbacc29b137a89b9e72 (diff)
downloadqemu-5f779a3a26a9dcc8072d909b7759bb9fade097a9.zip
qemu-5f779a3a26a9dcc8072d909b7759bb9fade097a9.tar.gz
qemu-5f779a3a26a9dcc8072d909b7759bb9fade097a9.tar.bz2
linux-user/elfload: fix filling psinfo->pr_psargs
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> Message-Id: <20210413205814.22821-1-iii@linux.ibm.com> [lv: add missing braces] Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Diffstat (limited to 'linux-user/elfload.c')
-rw-r--r--linux-user/elfload.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 015eed1..9779263 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -3618,11 +3618,12 @@ 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)
psinfo->pr_psargs[i] = ' ';