Skip to content

uaccess/sockptr: copy_struct_ fixes and more helpers

Stefan Metzmacher linux-bluetooth lkml netdev 1 version Applied

Status from this message: Applied to the vfs-7.2.misc branch of the vfs/vfs.git tree.

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest5 patches 9 repliesApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/5uaccess: fix ignored_trailing logic in copy_struct_to_user()include/linux/uaccess.h+1 -14 replies
2/5sockptr: fix usize check in copy_struct_from_sockptr() for user pointersinclude/linux/sockptr.h+1 -12 replies
3/5uaccess: add copy_struct_{from,to}_bounce_buffer() helpersinclude/linux/uaccess.h+63 -02 replies
4/5sockptr: let copy_struct_from_sockptr() use copy_struct_from_bounce_buffer()include/linux/sockptr.h+1 -150 replies
5/5sockptr: introduce copy_struct_to_sockptr()include/linux/sockptr.h+10 -00 replies

Reviews trailers per patch

2 of 5 patches have a Reviewed-by or Acked-by.

PatchAleksa Sarai
1/5R-b
2/5R-b
3/5
4/5
5/5

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/5] uaccess/sockptr: copy_struct_ fixes and more helpers

Hi,

here are some patches related to copy_struct_{from,to}_{user,sockptr}()
I collected during my work on an IPPROTO_SMBDIRECT implementation wrapping the smbdirect code used by cifs.ko and ksmbd.ko.

The first patch fixes copy_struct_to_user() to behave like documented.

The 2nd patch fixes the case where
copy_struct_from_user() is called by
copy_struct_from_sockptr().

The 3rd patch introduces copy_struct_{from,to}_bounce_buffer()
as a result of a discussion about the IPPROTO_QUIC driver in order to
be future prove when handling msg_control messages in sendmsg and recvmsg.
But I'll likely also use them in my IPPROTO_SMBDIRECT driver.

The 4th patch makes copy_struct_from_sockptr() a trivial wrapper switching between copy_struct_from_user() and copy_struct_from_bounce_buffer()

The 5th patch introduces copy_struct_to_sockptr() which I'll also use in my IPPROTO_SMBDIRECT driver.

As future cleanup I was thinking about trick to hide size_t ksize from the callers, similar to what was done with kmalloc_obj(). Whould others think that would be useful?

Stefan Metzmacher (5):
uaccess: fix ignored_trailing logic in copy_struct_to_user()
sockptr: fix usize check in copy_struct_from_sockptr() for user
pointers
uaccess: add copy_struct_{from,to}_bounce_buffer() helpers
sockptr: let copy_struct_from_sockptr() use
copy_struct_from_bounce_buffer()
sockptr: introduce copy_struct_to_sockptr()

 include/linux/sockptr.h | 28 ++++++++----------
 include/linux/uaccess.h | 65 ++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 76 insertions(+), 17 deletions(-)
Signature · 1 line
2.43.0