qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v6 09/11] dump: Add API to write dump pages


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH v6 09/11] dump: Add API to write dump pages
Date: Tue, 07 Jan 2014 16:12:56 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0

On 01/07/2014 03:37 PM, Laszlo Ersek wrote:
> comments below
> 
> On 01/05/14 08:27, Qiao Nuohan wrote:
>> functions are used to write page to vmcore. vmcore is written page by page.
>> page desc is used to store the information of a page, including a page's 
>> size,
>> offset, compression format, etc.
>>
>> +    uint64_t pfn_start, pfn_end, pfn;
>> +    unsigned char buf[s->page_size];
> 
> Whoa, a VLA! :) I believe it's *very* non-idiomatic in the qemu source.
> Please consider allocating it dynamically. (Of course others might point
> out that I'm wrong.)

Worse, a stack allocation greater than the size of a stack frame.  Any
time you have a function taking more than a page size of local storage,
you risk nasty behavior on some platforms (Windows in particular is
notorious for giving you only a single guard page, and if you overflow
the stack by more than the guard page, your program is unceremoniously
terminated with no message, compared to the usual desirable behavior of
getting a SIGSEGV that your program can at least react to in order to
diagnose that you had a stack overflow).

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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