android_kernel_motorola_sm6375/arch/sparc
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Martynas Pumputis ae6919a83c UPSTREAM: net: retrieve netns cookie via getsocketopt
It's getting more common to run nested container environments for
testing cloud software. One of such examples is Kind [1] which runs a
Kubernetes cluster in Docker containers on a single host. Each container
acts as a Kubernetes node, and thus can run any Pod (aka container)
inside the former. This approach simplifies testing a lot, as it
eliminates complicated VM setups.

Unfortunately, such a setup breaks some functionality when cgroupv2 BPF
programs are used for load-balancing. The load-balancer BPF program
needs to detect whether a request originates from the host netns or a
container netns in order to allow some access, e.g. to a service via a
loopback IP address. Typically, the programs detect this by comparing
netns cookies with the one of the init ns via a call to
bpf_get_netns_cookie(NULL). However, in nested environments the latter
cannot be used given the Kubernetes node's netns is outside the init ns.
To fix this, we need to pass the Kubernetes node netns cookie to the
program in a different way: by extending getsockopt() with a
SO_NETNS_COOKIE option, the orchestrator which runs in the Kubernetes
node netns can retrieve the cookie and pass it to the program instead.

Thus, this is following up on Eric's commit 3d368ab87cf6 ("net:
initialize net->net_cookie at netns setup") to allow retrieval via
SO_NETNS_COOKIE.  This is also in line in how we retrieve socket cookie
via SO_COOKIE.

  [1] https://kind.sigs.k8s.io/

Signed-off-by: Lorenz Bauer <lmb@cloudflare.com>
Signed-off-by: Martynas Pumputis <m@lambda.lt>
Cc: Eric Dumazet <edumazet@google.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit e8b9eab99232c4e62ada9d7976c80fd5e8118289)
Bug: 274789652
Tested: builds, net_test passes
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: If784a592450af38d70f16da61e36cbbaff80ebca
2026-05-07 10:18:28 -04:00
..
boot
configs
crypto
include UPSTREAM: net: retrieve netns cookie via getsocketopt 2026-05-07 10:18:28 -04:00
kernel BACKPORT: epoll: fix compat syscall wire up of epoll_pwait2 2025-12-22 07:42:51 +02:00
lib sparc: fix accurate exception reporting in copy_{from,to}_user for M7 2025-10-29 13:59:49 +01:00
math-emu
mm Merge tag 'ASB-2025-12-01_11-5.4' of https://android.googlesource.com/kernel/common into android13-5.4-lahaina 2025-12-04 19:21:35 +02:00
net
oprofile
power
prom sparc64: Fix incorrect function signature and add prototype for prom_cif_init 2024-08-19 05:33:32 +02:00
vdso sparc: vDSO: fix return value of __setup handler 2024-04-13 12:51:22 +02:00
Kbuild
Kconfig sparc/cpu: Switch to arch_cpu_finalize_init() 2023-08-08 19:56:34 +02:00
Kconfig.debug
Makefile