Re: [PATCH] RDMA/bnxt: Fix structure layout for bnxt_re_pd_resp

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

 



On Thu, Mar 15, 2018 at 09:18:14PM -0600, Jason Gunthorpe wrote:
> What is going on here is a bit subtle, in the kernel there is no
> problem because the struct is copied using copy_from_user, so it
> can safely have an 8 byte alignment, however in userspace it must
> be constructed by concatenation with the ib_uverbs_alloc_pd_resp
> struct. This is due to the required memory layout to execute the
> command.
> 
> Since ibv_uverbs_alloc_pd_resp is only 4 bytes long, this causes
> misalignment, and the user space will experience an unexpected padding.
> Currently it works around this via pointer maths.
> 
> Make everything more robust by having the compiler reduce the alignment
> of the struct to 4. The userspace has assertions to ensure this
> works properly in all situations.
> 
> Signed-off-by: Jason Gunthorpe <jgg@xxxxxxxxxxxx>
> ---
>  include/uapi/rdma/bnxt_re-abi.h | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)

Applied to for-next

Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[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