[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC][PATCH 11/14 v9] introduce a new monitor command '
From: |
Wen Congyang |
Subject: |
Re: [Qemu-devel] [RFC][PATCH 11/14 v9] introduce a new monitor command 'dump' to dump guest's memory |
Date: |
Fri, 16 Mar 2012 14:41:19 +0800 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100413 Fedora/3.0.4-2.fc13 Thunderbird/3.0.4 |
At 03/16/2012 11:23 AM, HATAYAMA Daisuke Wrote:
> From: Wen Congyang <address@hidden>
> Subject: [RFC][PATCH 11/14 v9] introduce a new monitor command 'dump' to dump
> guest's memory
> Date: Wed, 14 Mar 2012 10:11:35 +0800
>
>> +/*
>> + * QEMU dump
>> + *
>> + * Copyright Fujitsu, Corp. 2011
>> + *
>
> Now 2012.
On, I forgot to update it.
>
>> + /*
>> + * calculate phdr_num
>> + *
>> + * the type of phdr->num is uint16_t, so we should avoid overflow
>
> e_phnum is correct.
Yes
>
>> + */
>> + s->phdr_num = 1; /* PT_NOTE */
>> + if (s->list.num < (1 << 16) - 2) {
>
> s->list.num < UINT16_MAX is better.
>
>> + s->phdr_num += s->list.num;
>> + s->have_section = false;
>> + } else {
>> + s->have_section = true;
>> + s->phdr_num = PN_XNUM;
>> +
>> + /* the type of shdr->sh_info is uint32_t, so we should avoid
>> overflow */
>> + if (s->list.num > (1ULL << 32) - 2) {
>
> s->list.num < UINT32_MAX is better.
>
>> + s->sh_info = 0xffffffff;
>
> UINT32_MAX is better. Is it rough around here?
>
>> + } else {
>> + s->sh_info += s->list.num;
>> + }
>> + }
>
> Now orders of processings in positive and negative cases for e_phnum
> and sh_info are different. It's better to make them sorted in the same
> order.
>
> if (phdr_num not overflow?) {
> not overflow case;
> } else {
> overflow case;
> if (sh_info not overflow?) {
> not overflow case;
> } else {
> overflow case;
> }
> }
>
> is better.
OK
Thanks
Wen Congyang
>
> Thanks.
> HATAYAMA, Daisuke
>
>
- [Qemu-devel] [RFC][PATCH 08/14 v9] target-i386: Add API to write cpu status to core file, (continued)
- [Qemu-devel] [RFC][PATCH 08/14 v9] target-i386: Add API to write cpu status to core file, Wen Congyang, 2012/03/13
- [Qemu-devel] [RFC][PATCH 09/14 v9] target-i386: add API to get dump info, Wen Congyang, 2012/03/13
- [Qemu-devel] [RFC][PATCH 10/14 v9] make gdb_id() generally avialable, Wen Congyang, 2012/03/13
- [Qemu-devel] [RFC][PATCH 11/14 v9] introduce a new monitor command 'dump' to dump guest's memory, Wen Congyang, 2012/03/13
- [Qemu-devel] [RFC][PATCH 12/14 v9] support to cancel the current dumping, Wen Congyang, 2012/03/13
- [Qemu-devel] [RFC][PATCH 13/14 v9] support to query dumping status, Wen Congyang, 2012/03/13
- [Qemu-devel] [RFC][PATCH 14/14 v9] allow user to dump a fraction of the memory, Wen Congyang, 2012/03/13
- Re: [Qemu-devel] [RFC][PATCH 00/14 v9] introducing a new, dedicated memory dump mechanism, Luiz Capitulino, 2012/03/14