qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] monitor: move json init from OPEN event to init


From: Max Filippov
Subject: Re: [Qemu-devel] [PATCH] monitor: move json init from OPEN event to init
Date: Fri, 24 Aug 2012 02:18:31 +0400

On Fri, Aug 24, 2012 at 2:06 AM, Max Filippov <address@hidden> wrote:
> On Thu, Aug 23, 2012 at 5:22 PM, Anthony Liguori <address@hidden> wrote:
>> At some point in the past, the OPEN event was changed to be issued from a
>> bottom half.  This creates a small window whereas a data callback registered 
>> in
>> init may be invoked before the OPEN event has been issued.
>>
>> This is reproducible with:
>>
>>  echo "{'execute': 'qmp_capabilities'}" | qemu-system-x86_64 -M none -qmp 
>> stdio
>>
>> We can fix this for the monitor by moving the parser initialization to init.
>>
>> The remaining state that is set in OPEN appears harmless.
>>
>> Reported-by: Daniel Berrange <address@hidden>
>> Signed-off-by: Anthony Liguori <address@hidden>
>> ---
>>  monitor.c |    4 +++-
>>  1 files changed, 3 insertions(+), 1 deletions(-)
>>
>> diff --git a/monitor.c b/monitor.c
>> index 480f583..b188582 100644
>> --- a/monitor.c
>> +++ b/monitor.c
>> @@ -4832,7 +4832,6 @@ static void monitor_control_event(void *opaque, int 
>> event)
>>      switch (event) {
>>      case CHR_EVENT_OPENED:
>>          mon->mc->command_mode = 0;
>> -        json_message_parser_init(&mon->mc->parser, handle_qmp_command);
>>          data = get_qmp_greeting();
>>          monitor_json_emitter(mon, data);
>>          qobject_decref(data);
>> @@ -4840,6 +4839,7 @@ static void monitor_control_event(void *opaque, int 
>> event)
>>          break;
>>      case CHR_EVENT_CLOSED:
>>          json_message_parser_destroy(&mon->mc->parser);
>> +        json_message_parser_init(&mon->mc->parser, handle_qmp_command);
>>          mon_refcount--;
>>          monitor_fdsets_cleanup();
>>          break;
>> @@ -4951,6 +4951,8 @@ void monitor_init(CharDriverState *chr, int flags)
>>                                monitor_event, mon);
>>      }
>>
>> +    json_message_parser_init(&mon->mc->parser, handle_qmp_command);
>> +
>
> This hunk causes SIGSEGV on qemu-system-xtensa with the following trace:

I see that '[PATCH] monitor: don't try to initialize json parser when
monitor is HMP'
is meant to fix it.

-- 
Thanks.
-- Max



reply via email to

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