* [PATCH net v2] net/socket: remove unused do_sock_{set,get}sockopt() exports
@ 2026-08-21 8:28 Breno Leitao
2026-08-21 8:58 ` Eric Dumazet
2026-08-22 19:39 ` Jakub Kicinski
0 siblings, 2 replies; 5+ messages in thread
From: Breno Leitao @ 2026-08-21 8:28 UTC (permalink / raw)
To: Eric Dumazet, Kuniyuki Iwashima, Paolo Abeni, Willem de Bruijn,
David S. Miller, Jakub Kicinski, Simon Horman, Jens Axboe,
Martin KaFai Lau
Cc: netdev, linux-kernel, kernel-team, Christoph Hellwig, Breno Leitao
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.
Drop the symbol exports.
Fixes: 1406245c2945 ("net/socket: Break down __sys_setsockopt")
Fixes: 0b05b0cd78c9 ("net/socket: Break down __sys_getsockopt")
Suggested-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/all/20260819090439.GB9267@lst.de/
Signed-off-by: Breno Leitao <leitao@debian.org>
---
Changes in v2:
- s/export/exports/ in the commit message (hch)
- Link to v1: https://patch.msgid.link/20260819-hch_not_export-v1-1-af4b0de70e13@debian.org
---
net/socket.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/net/socket.c b/net/socket.c
index 63c69a0fa74e1..ba3eca4324e7b 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -2371,7 +2371,6 @@ int do_sock_setsockopt(struct socket *sock, bool compat, int level,
out_put:
return err;
}
-EXPORT_SYMBOL(do_sock_setsockopt);
/* Set a socket option. Because we don't know the option lengths we have
* to pass the user mode parameter for the protocols to sort out.
@@ -2484,7 +2483,6 @@ int do_sock_getsockopt(struct socket *sock, bool compat, int level,
return err;
}
-EXPORT_SYMBOL(do_sock_getsockopt);
/*
* Get a socket option. Because we don't know the option lengths we have
---
base-commit: 564973a259ec76f2dad0853420e7034cc43994c4
change-id: 20260819-hch_not_export-908dcceab01f
Best regards,
--
Breno Leitao <leitao@debian.org>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net v2] net/socket: remove unused do_sock_{set,get}sockopt() exports
2026-08-21 8:28 [PATCH net v2] net/socket: remove unused do_sock_{set,get}sockopt() exports Breno Leitao
@ 2026-08-21 8:58 ` Eric Dumazet
2026-08-22 19:39 ` Jakub Kicinski
1 sibling, 0 replies; 5+ messages in thread
From: Eric Dumazet @ 2026-08-21 8:58 UTC (permalink / raw)
To: Breno Leitao
Cc: Kuniyuki Iwashima, Paolo Abeni, Willem de Bruijn,
David S. Miller, Jakub Kicinski, Simon Horman, Jens Axboe,
Martin KaFai Lau, netdev, linux-kernel, kernel-team,
Christoph Hellwig
On Fri, Aug 21, 2026 at 10:29 AM Breno Leitao <leitao@debian.org> 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.
>
> Drop the symbol exports.
>
> Fixes: 1406245c2945 ("net/socket: Break down __sys_setsockopt")
> Fixes: 0b05b0cd78c9 ("net/socket: Break down __sys_getsockopt")
> Suggested-by: Christoph Hellwig <hch@lst.de>
> Link: https://lore.kernel.org/all/20260819090439.GB9267@lst.de/
> Signed-off-by: Breno Leitao <leitao@debian.org>
Reviewed-by: Eric Dumazet <edumazet@google.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net v2] net/socket: remove unused do_sock_{set,get}sockopt() exports
2026-08-21 8:28 [PATCH net v2] net/socket: remove unused do_sock_{set,get}sockopt() exports Breno Leitao
2026-08-21 8:58 ` Eric Dumazet
@ 2026-08-22 19:39 ` Jakub Kicinski
2026-08-22 21:46 ` David Laight
2026-08-24 8:49 ` Breno Leitao
1 sibling, 2 replies; 5+ messages in thread
From: Jakub Kicinski @ 2026-08-22 19:39 UTC (permalink / raw)
To: Breno Leitao
Cc: Eric Dumazet, Kuniyuki Iwashima, Paolo Abeni, Willem de Bruijn,
David S. Miller, Simon Horman, Jens Axboe, Martin KaFai Lau,
netdev, linux-kernel, kernel-team, Christoph Hellwig
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.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net v2] net/socket: remove unused do_sock_{set,get}sockopt() exports
2026-08-22 19:39 ` Jakub Kicinski
@ 2026-08-22 21:46 ` David Laight
2026-08-24 8:49 ` Breno Leitao
1 sibling, 0 replies; 5+ messages in thread
From: David Laight @ 2026-08-22 21:46 UTC (permalink / raw)
To: Jakub Kicinski
Cc: Breno Leitao, Eric Dumazet, Kuniyuki Iwashima, Paolo Abeni,
Willem de Bruijn, David S. Miller, Simon Horman, Jens Axboe,
Martin KaFai Lau, netdev, linux-kernel, kernel-team,
Christoph Hellwig
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net v2] net/socket: remove unused do_sock_{set,get}sockopt() exports
2026-08-22 19:39 ` Jakub Kicinski
2026-08-22 21:46 ` David Laight
@ 2026-08-24 8:49 ` Breno Leitao
1 sibling, 0 replies; 5+ messages in thread
From: Breno Leitao @ 2026-08-24 8:49 UTC (permalink / raw)
To: Jakub Kicinski
Cc: Eric Dumazet, Kuniyuki Iwashima, Paolo Abeni, Willem de Bruijn,
David S. Miller, Simon Horman, Jens Axboe, Martin KaFai Lau,
netdev, linux-kernel, kernel-team, Christoph Hellwig
On Sat, Aug 22, 2026 at 12:39:57PM -0700, Jakub Kicinski 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.
Fair — you and Christoph disagree here, and the nvme-tcp series needs it
modular.
I'll park this until that settles. If we decide to keep it, I would
suggest we change it to EXPORT_SYMBOL_GPL, at least.
--
pw-bot: rejected
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-08-24 8:50 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-21 8:28 [PATCH net v2] net/socket: remove unused do_sock_{set,get}sockopt() exports Breno Leitao
2026-08-21 8:58 ` Eric Dumazet
2026-08-22 19:39 ` Jakub Kicinski
2026-08-22 21:46 ` David Laight
2026-08-24 8:49 ` Breno Leitao
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®