kernel_samsung_a53x/net/sunrpc
Daniel Borkmann feb4fd6546 net, sunrpc: Remap EPERM in case of connection failure in xs_tcp_setup_socket
commit 626dfed5fa3bfb41e0dffd796032b555b69f9cde upstream.

When using a BPF program on kernel_connect(), the call can return -EPERM. This
causes xs_tcp_setup_socket() to loop forever, filling up the syslog and causing
the kernel to potentially freeze up.

Neil suggested:

  This will propagate -EPERM up into other layers which might not be ready
  to handle it. It might be safer to map EPERM to an error we would be more
  likely to expect from the network system - such as ECONNREFUSED or ENETDOWN.

ECONNREFUSED as error seems reasonable. For programs setting a different error
can be out of reach (see handling in 4fbac77d2d09) in particular on kernels
which do not have f10d05966196 ("bpf: Make BPF_PROG_RUN_ARRAY return -err
instead of allow boolean"), thus given that it is better to simply remap for
consistent behavior. UDP does handle EPERM in xs_udp_send_request().

Fixes: d74bad4e74ee ("bpf: Hooks for sys_connect")
Fixes: 4fbac77d2d09 ("bpf: Hooks for sys_bind")
Co-developed-by: Lex Siegel <usiegl00@gmail.com>
Signed-off-by: Lex Siegel <usiegl00@gmail.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Cc: Neil Brown <neilb@suse.de>
Cc: Trond Myklebust <trondmy@kernel.org>
Cc: Anna Schumaker <anna@kernel.org>
Link: https://github.com/cilium/cilium/issues/33395
Link: https://lore.kernel.org/bpf/171374175513.12877.8993642908082014881@noble.neil.brown.name
Link: https://patch.msgid.link/9069ec1d59e4b2129fc23433349fd5580ad43921.1720075070.git.daniel@iogearbox.net
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Hugo SIMELIERE <hsimeliere.opensource@witekio.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-11-23 23:21:09 +01:00
..
auth_gss gss_krb5: Fix the error handling path for crypto_sync_skcipher_setkey 2024-11-23 23:20:08 +01:00
xprtrdma svcrdma: Catch another Reply chunk overflow case 2024-11-23 23:21:04 +01:00
addr.c net: sunrpc: Fix an off by one in rpc_sockaddr2uaddr() 2024-11-19 08:44:57 +01:00
auth.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
auth_null.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
auth_unix.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
backchannel_rqst.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cache.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
clnt.c SUNRPC: avoid soft lockup when transmitting UDP to reachable server. 2024-11-23 23:20:09 +01:00
debugfs.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Kconfig Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Makefile Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
netns.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
rpc_pipe.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
rpcb_clnt.c SUNRPC: Add an IS_ERR() check back to where it was 2024-11-18 11:43:19 +01:00
sched.c SUNRPC: Fix a race to wake a sync task 2024-11-23 23:20:24 +01:00
socklib.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
socklib.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
stats.c sunrpc: use the struct net as the svc proc private 2024-11-23 23:21:02 +01:00
sunrpc.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
sunrpc_syms.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
svc.c sunrpc: pass in the sv_stats struct through svc_create_pooled 2024-11-23 23:21:02 +01:00
svc_xprt.c nfsd: Don't call freezable_schedule_timeout() after each successful page allocation in svc_alloc_arg(). 2024-11-23 23:20:50 +01:00
svcauth.c SUNRPC: Add svc_rqst::rq_auth_stat 2024-11-19 12:27:45 +01:00
svcauth_unix.c SUNRPC: Set rq_auth_stat in the pg_authenticate() callout 2024-11-19 12:27:45 +01:00
svcsock.c nfsd: fix double fget() bug in __write_ports_addfd() 2024-11-19 12:28:32 +01:00
sysctl.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
timer.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xdr.c NFSD: Refactor common code out of dirlist helpers 2024-11-19 12:28:23 +01:00
xprt.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xprtmultipath.c SUNRPC: Fix a suspicious RCU usage warning 2024-11-18 12:13:10 +01:00
xprtsock.c net, sunrpc: Remap EPERM in case of connection failure in xs_tcp_setup_socket 2024-11-23 23:21:09 +01:00