Comment 300 for bug 2059809

Revision history for this message
Felix Huettner (felix.huettner) wrote :

Hi everyone,
we probably have found an additional regression by this fix when using openstack server resuce with a ISO file.

Reproduce:
1. Create a image with a ISO file and disk_format iso
2. Resuce (create probably also affected) a server using this image.

This raises "Image not in a supported format" in do_image_deep_inspection as we do not have a iso format inspector.

When implementing this inspector you can use the reference from here: http://wiki.osdev.org/ISO_9660
Most probably the following can be used for identification:
$ xxd -s 0x8001 -l 5 orig.iso
00008001: 4344 3030 31 CD001

When implementing this inspector please keep in mind that the first 32kb of a iso file are not actually part of the iso file itself, but free for other things to use: http://wiki.osdev.org/ISO_9660#System_Area
This can be used for image type confusion if you upload an iso file where the first 32kb are a qcow2 header. So the inspector for iso does not only need to check that it is a valid iso file, but also that the system area does not contain any other file headers.

Reproducer for this issue:

$ mkisofs -o orig.iso /etc/resolv.conf
$ qemu-img create orig.qcow2 -f qcow2 64M
$ dd if=orig.qcow2 of=outcome bs=32K count=1
$ dd if=orig.iso of=outcome bs=32K skip=1 seek=1
$ file outcome
outcome: ISO 9660 CD-ROM filesystem data 'CDROM'
$ qemu-img info outcome
image: outcome
file format: qcow2
virtual size: 64 MiB (67108864 bytes)
disk size: 348 KiB
cluster_size: 65536
Format specific information:
    compat: 1.1
    compression type: zlib
    lazy refcounts: false
    refcount bits: 16
    corrupt: false
    extended l2: false
Child node '/file':
    filename: outcome
    protocol type: file
    file length: 348 KiB (356352 bytes)
    disk size: 348 KiB