Thread (18 messages) read the whole thread 18 messages, 5 authors, 2026-06-05

Re: [PATCH net-next v3 0/4] net: move .getsockopt away from __user buffers (update 1)

From: Breno Leitao <leitao@debian.org>
Date: 2026-06-05 12:25:38
Also in: bpf, io-uring, lkml

On Wed, Apr 08, 2026 at 03:30:28AM -0700, Breno Leitao wrote:
Currently, the .getsockopt callback requires __user pointers:

  int (*getsockopt)(struct socket *sock, int level,
                    int optname, char __user *optval, int __user *optlen);

This prevents kernel callers (io_uring, BPF) from using getsockopt on
levels other than SOL_SOCKET, since they pass kernel pointers.

Following Linus' suggestion [0], this series introduces sockopt_t, a
type-safe wrapper around iov_iter, and a getsockopt_iter callback that
works with both user and kernel buffers. AF_PACKET and CAN raw are
converted as initial users, with selftests covering the trickiest
conversion patterns.
Quick update on this effort.

All proto_ops users have been converted to getsockopt_iter and submitted.

Most conversions are already in linux-next. Three remain:

1) rds: Under review
   https://lore.kernel.org/all/20260605-getsock_more-v2-3-80f38cdb8706@debian.org/ (local)

2) smc: Submitted today. This is only limited to UBUF right now
   https://lore.kernel.org/all/20260605-getsockopt_smc-v1-1-65da62fa44c4@debian.org/ (local)

3) CAN drivers: Reviewed and acked, pending Marc's merge
   https://lore.kernel.org/all/f83e25e1-b9f5-4810-bbd6-fdb8d2a10c8e@hartkopp.net/ (local)

Once these are merged, I'll rename getsockopt_iter to getsockopt and
remove the legacy path.

Next, I'll convert struct proto the same way to eliminate the remaining
userspace optlen/optval pointers.

After that, io_uring getsockopt operations will be unblocked.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help