[openib-general] Data structure size mismatch

Pradeep Satyanarayana pradeep at us.ibm.com
Mon Nov 7 17:14:28 PST 2005







Roland Dreier <rolandd at cisco.com> wrote on 11/07/2005 07:28:33 AM:

>     Pradeep> Now, sizeof *packet will be different between 32-bit and
>     Pradeep> 64-bit because of the pointers. Because of this, the
>     Pradeep> offset of packet->mad will be incorrect and one might
>     Pradeep> find unexpected data. Would you agree?
>
> I don't understand your point.  packet is a kernel data structure, and
> it doesn't matter that the layout changes if I compile the kernel for
> a different architecture.  What is being copied from userspace is a
> struct ib_user_mad whose does not depend on the word size.
>

I have seen applications duplicate the data structure in the kernel. And
this is copied across
the user-kernel space. If a data structure like packet that contains a
pointer element were
copied across the user-kernel boundary one runs into the problem that I was
mentioning.

In this particular case since ib_user_mad is what is copied across the
user-kernel boundary
it is not an issue. Given that I had already seen this problem in uat.c, I
was trying to sound a
note of caution about this as a potential problem, looking at the kernel
data structures.

Pradeep
pradeep at us.ibm.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openfabrics.org/pipermail/general/attachments/20051107/f7779e1c/attachment.html>


More information about the general mailing list