Calling error_get_progname() in the context of qemu-x86_64 can cause
segmentation fault because linux-user/main.c doesn't initialize its
progname with error_set_progname(). This patch adds the
initialization.

Currently, the missing call of error_set_progname() doesn't cause any
problems because qemu-x86_64 doesn't use error_get_progname(). This
patch is a proactive action.

Cc: Riku Voipio <riku.voi...@iki.fi>
Cc: Markus Armbruster <arm...@redhat.com>
Signed-off-by: Hitoshi Mitake <mitake.hito...@lab.ntt.co.jp>
---
 linux-user/main.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/linux-user/main.c b/linux-user/main.c
index 8c70be4..4610b20 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -33,6 +33,7 @@
 #include "qemu/timer.h"
 #include "qemu/envlist.h"
 #include "elf.h"
+#include "qemu/error-report.h"
 
 char *exec_path;
 
@@ -3835,6 +3836,7 @@ int main(int argc, char **argv, char **envp)
     int ret;
     int execfd;
 
+    error_set_progname(argv[0]);
     module_call_init(MODULE_INIT_QOM);
 
     if ((envlist = envlist_create()) == NULL) {
-- 
1.9.1


Reply via email to