[libvirt] locking down struct size/layout in remote-protocol.x

Eric Blake eblake at redhat.com
Fri May 7 14:34:56 UTC 2010


On 05/07/2010 04:14 AM, Daniel P. Berrange wrote:
>> Are we sure migration between 32-bit and 64-bit hypervisors works?  And
>> if it does, then these structs don't quite match what is actually sent
>> over the wire.  At any rate,
> 
> Yes, the XDR protocol encoding is architecture + wordsize independant. The
> struct sizes won't match what is sent on the wire, and the latter is the thing
> we actually need to verify.
> 
> Perhaps marking all structs with __attribute__((packed))  will make then
> architecture invariant enough for checking of the struct to suffice.

No, __attribute__((packed)) won't help; the fundamental difference is
that pointers change from 4 bytes to 8 bytes between the two platforms,
whether or not you also pack out the extra holes when passing things
like uint8_t.

But Jim's suggestion of just normalizing field names and types is
reasonable, since the whole point of the .x file is that names and types
are enough to generate the code that does the conversion from struct to
on-the-wire format.

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20100507/1635d67f/attachment-0001.sig>


More information about the libvir-list mailing list