Re: [RFC PATCH] rxe: Fix structure layouts for 32/64 bit compat

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

 



On Wed, 2018-02-07 at 16:57 -0700, Jason Gunthorpe wrote:
> On Wed, Feb 07, 2018 at 11:54:25PM +0000, Bart Van Assche wrote:
> > On Wed, 2018-02-07 at 16:41 -0700, Jason Gunthorpe wrote:
> > > diff --git a/include/uapi/rdma/rdma_user_rxe.h b/include/uapi/rdma/rdma_user_rxe.h
> > > index e3e6852b58eb45..b501deb18d8184 100644
> > > +++ b/include/uapi/rdma/rdma_user_rxe.h
> > > @@ -58,6 +58,8 @@ struct rxe_global_route {
> > >  struct rxe_av {
> > >  	__u8			port_num;
> > >  	__u8			network_type;
> > > +	__u16			reserved1;
> > > +	__u32			reserved2;
> > 
> > Hello Jason,
> > 
> > Seeing two consecutive reserved members is a bit weird. Have you considered
> > to use something like __u8 reserved[6] instead?
> 
> Ah, I had that originally but changed it to make pahole work properly..
> Can switch it back.
> 
> Although, this does really firmly say what the alighment is, eg
> down the road someone might be tempted to do:
> 
> - __u8 reserved[6];
> + __u32 new_value;
> + __u16 reserved;
> 
> Which would be quite wrong..

Please consider to add BUILD_BUG_ON() statements into the rxe driver to verify
offsets of members of ABI structures. That approach is used in the rdma-core
library for e.g. the umad library and srp_daemon.

Thanks,

Bart.


��.n��������+%������w��{.n�����{���fk��ܨ}���Ơz�j:+v�����w����ޙ��&�)ߡ�a����z�ޗ���ݢj��w�f




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux