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

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

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 redhat com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

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