Re: [RFC ABI V5 07/10] IB/core: Support getting IOCTL header/SGEs from kernel space

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

 



On 08/11/2016 02:43, Jason Gunthorpe wrote:
On Sun, Oct 30, 2016 at 10:48:39AM +0200, Matan Barak wrote:
On Fri, Oct 28, 2016 at 5:46 PM, Leon Romanovsky <leonro@xxxxxxxxxxxx> wrote:
On Fri, Oct 28, 2016 at 08:37:25AM -0700, Christoph Hellwig wrote:
On Fri, Oct 28, 2016 at 06:33:06PM +0300, Leon Romanovsky wrote:
Just to summarize, to be sure that I understood you correctly.

| write | -> | conversion logic | ---
| ioctl | ---------------------------

Am I right?

Yes, as long as the write and ioctl boxes do the copy_{from,to}_user.

If we accept the limitations here (i.e - all commands attributes
come either from kernel or from user, but you can't mix them -
that's mean the write comparability layer either needs to copy all
attributes or use a direct mapping for all of them), I could just
either break ib_uverbs_cmd_verbs to a a few functions or just pass a
callback of boxing the descriptors copy.

From what I saw in the series, this looks easy enough to fix..

Just lightly refactor things so that the write() compat layer can call
into the ioctl processor with an already prepared tlv list in kernel
memory and form such a list on the stack when doing the compat stuff.


Yeah, it's just an easy refactor of ib_uverbs_cmd_verbs and there's multiple ways of doing that :)

The bigger problem is the tlv list pointers themselves, they have to
point to user memory so the compat layer can only do so much of a
transformation.

I guess another flag in the copy_from_user wrapper would do the trick
if we need it.


Currently we assume the payload itself is in user-space only so direct mapping is mandatory. If we ever need to do something other than (bunch of consecutive write ABI struct fields) -> (attribute in the ioctl world), we'll have to box these copy macros/functions with copy_from_attr and copy_to_attr calls.

Jason

Matan

--
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


--
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