mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Laight <david.laight.linux@gmail.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: Breno Leitao <leitao@debian.org>,
	Eric Dumazet <edumazet@google.com>,
	Kuniyuki Iwashima <kuniyu@google.com>,
	Paolo Abeni <pabeni@redhat.com>,
	Willem de Bruijn <willemb@google.com>,
	"David S. Miller" <davem@davemloft.net>,
	Simon Horman <horms@kernel.org>, Jens Axboe <axboe@kernel.dk>,
	Martin KaFai Lau <martin.lau@kernel.org>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel-team@meta.com, Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH net v2] net/socket: remove unused do_sock_{set,get}sockopt() exports
Date: Sat, 22 Aug 2026 22:46:07 +0100	[thread overview]
Message-ID: <20260822224607.3777abf2@pumpkin> (raw)
In-Reply-To: <20260822123957.694f2812@kernel.org>

On Sat, 22 Aug 2026 12:39:57 -0700
Jakub Kicinski <kuba@kernel.org> wrote:

> On Fri, 21 Aug 2026 01:28:32 -0700 Breno Leitao wrote:
> > do_sock_setsockopt() and do_sock_getsockopt() have been exported since
> > they were split out of the syscall handlers for io_uring to reuse.
> > 
> > io_uring is the only caller outside net/socket.c, and it is never
> > modular: cmd_net.o is built under obj-$(CONFIG_NET), and both CONFIG_NET
> > and CONFIG_IO_URING are bool. The declarations in <net/sock.h> are all
> > it needs, so no module has ever been able to use these exports.  
> 
> FTR I'd prefer this export (or something along these lines) to having 
> to add individual helpers for every sockopt for in-kernel networking
> socket users. Maybe other maintainers disagree.
> 

As a 'user' I'd re-instate the kernel_setsockopt() that was removed in 5.7
before sockptr_t was added in 5.8.
Before I retired I supported some code that contains:

int xxx_setsockopt(struct socket *sock, int level, int optname,
	void *optval, unsigned int optlen)
{
	sockptr_t koptval = KERNEL_SOCKPTR(optval);

	if (level == SOL_SOCKET)
		return sock_setsockopt(sock, level, optname, koptval, optlen);
	else
		return sock->ops->setsockopt(sock, level, optname, koptval, optlen);
}

I suspect both bpf and io_uring have to do the same.

The code does need one getsockopt() - SCTP_STATUS to get the negotiated
number of output streams, any code using SCTP needs to do that.
However that returns the wrong value for kernels 5.1 to 5.8 so the driver
digs the value out of the sctp internal data structures.
(Not exporting functions doesn't make much difference!)

David

  reply	other threads:[~2026-08-22 21:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-21  8:28 Breno Leitao
2026-08-21  8:58 ` Eric Dumazet
2026-08-22 19:39 ` Jakub Kicinski
2026-08-22 21:46   ` David Laight [this message]
2026-08-24  8:49   ` Breno Leitao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260822224607.3777abf2@pumpkin \
    --to=david.laight.linux@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hch@lst.de \
    --cc=horms@kernel.org \
    --cc=kernel-team@meta.com \
    --cc=kuba@kernel.org \
    --cc=kuniyu@google.com \
    --cc=leitao@debian.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.lau@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=willemb@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®