[openib-general] [PATCH] IB/core - ib_umad can cause address alignment fault onia64

JWM jwm at systemfabricworks.com
Thu Jan 18 10:22:21 PST 2007


    I've been looking at the code and it seems as though Sean is correct.
    The data comes in from userland through a
    if(copy_from_user(&packet->mad,buf,
        sizeof(struct ib_user_mad) + IB_MGMT_RMPP_HDR))

    BTW - why is IB_MGMT_RMPP_HDR an enum? Why not a sizeof ?

    In any case the data element will be aligned in the packet->mad through 
compiler padding. The raw ib_user_mad comming in will not, or may be 
depending on how it was created etc. If it's allocated seperatly or just 
declared then it's not going to work.

    ....JW

----- Original Message ----- 
From: "Michael S. Tsirkin" <mst at mellanox.co.il>
To: "Sean Hefty" <mshefty at ichips.intel.com>
Cc: "Ralph Campbell" <ralph.campbell at qlogic.com>; "John W. Marland" 
<jwm at prairieinet.net>; "openib-general" <openib-general at openib.org>
Sent: Thursday, January 18, 2007 12:01 PM
Subject: Re: [openib-general] [PATCH] IB/core - ib_umad can cause address 
alignment fault onia64


>> Quoting r. Sean Hefty <mshefty at ichips.intel.com>:
>> Subject: Re: [openib-general] [PATCH] IB/core - ib_umad can cause address 
>> alignment fault onia64
>>
>> > But I thought it is the data field which is cast to ib_mad_hdr
>> > and not ib_user_mad? If so Jason's suggestion of using
>> > u64 data[0]
>> > makes more sense.
>>
>> I don't think that you can change struct ib_user_mad or struct 
>> ib_user_mad_hdr
>> without breaking the ABI.
>
> This won't break ABI, since data is aligned already relative to start of 
> struct.
> We only force the struct itself to be aligned, which has no ABI 
> implications.
>
> -- 
> MST
>
> _______________________________________________
> openib-general mailing list
> openib-general at openib.org
> http://openib.org/mailman/listinfo/openib-general
>
> To unsubscribe, please visit 
> http://openib.org/mailman/listinfo/openib-general
> 





More information about the general mailing list