Message ID | 1421917694-6824-5-git-send-email-mitake.hitoshi@lab.ntt.co.jp |
---|---|
State | New |
Headers | show |
On 22 January 2015 at 09:08, Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp> wrote: > 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. I don't think this patch is right. The *-user binaries don't (and should not) use the qemu-error infrastructure (they don't have the monitor or any of the other stuff that uses). Code which tries to use error_get_progname() in *-user would be broken. thanks -- PMM
Hi Peter, Sorry for my late reply. At Thu, 22 Jan 2015 10:07:27 +0000, Peter Maydell wrote: > > On 22 January 2015 at 09:08, Hitoshi Mitake > <mitake.hitoshi@lab.ntt.co.jp> wrote: > > 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. > > I don't think this patch is right. The *-user binaries don't > (and should not) use the qemu-error infrastructure (they don't > have the monitor or any of the other stuff that uses). Code > which tries to use error_get_progname() in *-user would be > broken. I just thought linux-user would be a potential user of the qemu-error infrastructure because it is liked with util/qemu-error.o. Actually, the changes of the patch (let linux-user/main.c include "qemu/error-report.h" and call error_get_progname()) didn't cause any problems. But I'm not familiar with linux-user. If the command should never be a user of the error infrastructure, I'd like to drop this patch, of course. Thanks, Hitoshi
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) {
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.voipio@iki.fi> Cc: Markus Armbruster <armbru@redhat.com> Signed-off-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp> --- linux-user/main.c | 2 ++ 1 file changed, 2 insertions(+)