Re: [PATCH 2/2] qemu: parse 'vm_footer' section

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

 



* Pankaj Gupta (pagupta@xxxxxxxxxx) wrote:
>  Parse 'QEMU_VM_SECTION_FOOTER' in crash. This section is also
>  added by VM migration code to avoid misparsing.
> 
> Signed-off-by: Pankaj Gupta <pagupta@xxxxxxxxxx>
> ---
>  qemu-load.c | 4 ++++
>  qemu-load.h | 3 ++-
>  2 files changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/qemu-load.c b/qemu-load.c
> index 7ee58a3..4b8313d 100644
> --- a/qemu-load.c
> +++ b/qemu-load.c
> @@ -972,6 +972,10 @@ qemu_load (const struct qemu_device_loader *devices, uint32_t required_features,
>  			break;
>  		if (sec == QEMU_VM_EOF)
>  			break;
> +		if (sec == QEMU_VM_SECTION_FOOTER) {
> +			uint32_t footerSecId = get_be32 (fp);
> +			continue;
> +                }

Yes, that should work.
One possible thing you could add in the future would be to compare the
footerSecId with the ID in the last received section - they should match, if
they don't then you could print a warning that you think you might have a corrupt
file.

Dave

>  		if (sec == QEMU_VM_CONFIGURATION) {
>  			uint32_t len = get_be32 (fp);
>  			get_string_len (fp, name, len);
> diff --git a/qemu-load.h b/qemu-load.h
> index d5b2078..f4fbb06 100644
> --- a/qemu-load.h
> +++ b/qemu-load.h
> @@ -30,7 +30,8 @@ enum qemu_save_section {
>    QEMU_VM_SECTION_END,
>    QEMU_VM_SECTION_FULL,
>    QEMU_VM_SUBSECTION,
> -  QEMU_VM_CONFIGURATION = 0x07
> +  QEMU_VM_CONFIGURATION = 0x07,
> +  QEMU_VM_SECTION_FOOTER = 0x7e
>  };
>  
>  enum qemu_features {
> -- 
> 1.9.3
> 
--
Dr. David Alan Gilbert / dgilbert@xxxxxxxxxx / Manchester, UK

--
Crash-utility mailing list
Crash-utility@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/crash-utility



[Index of Archives]     [Fedora Development]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]

 

Powered by Linux