bypass4netns-style socket switching (opt-in host network mode)
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- c, linux
- Domain
- networking, operating-systems, security
Research direction
Start by reading forward_pipe() and the syscall dispatch layer in seccomp-dispatch.c, then trace how socket-related calls and file descriptors are handled. A first version is done when the explicitly opt-in host-bypass mode supports the narrow AF_INET/AF_INET6 SOCK_STREAM outbound-connect scope, applies destination policy controls, and documents the host-network isolation tradeoff and remaining multiplexing limits.
Written by the indexing model from the issue text.
Description
Problem
All network I/O goes through the SLIRP/passt userspace stack. For bulk
transfers, data-path overhead dominates.
Proposed Changes
Add an opt-in --net=host-bypass fast path using SECCOMP_IOCTL_NOTIF_ADDFD
(the same mechanism already used for pipe injection in forward_pipe()):
- Intercept
socket()+connect()via seccomp for eligible sockets. - Create the socket in the host network namespace, inject via ADDFD.
- Subsequent
read/write/send/recvgo directly to the host kernel
without supervisor involvement on the data path.
Scope of first version:
AF_INET/AF_INET6,SOCK_STREAM, outboundconnect()only.- Explicitly exclude
AF_UNIX,AF_PACKET, raw sockets. - Policy controls to restrict which destination addresses/ports are eligible
for bypass.
Additional syscall interception beyond socket() is required:
connect, bind, listen, accept, setsockopt, getsockopt, and
fcntl on bypassed FDs all need consideration in the dispatch layer
(seccomp-dispatch.c).
Considerations
- epoll/poll multiplexing: LKL epoll cannot monitor host socket FDs and
vice versa. Bridging both worlds may require interceptingepoll_ctland
epoll_waitto implement a unified event loop. This is the hardest
architectural challenge and may limit applicability to simple
connect-send-recv workloads initially. - Network isolation tradeoff: the guest operates directly in the host
network namespace for bypassed sockets.bind()binds to host interfaces,
getsockname()returns host IPs. This must be explicitly opt-in with
clear documentation of the security implications. - Relationship to passt backend and SLIRP Phase 2 (#12): this is a
complementary approach. passt improves the stack-mediated path; socket
switching bypasses the stack entirely for eligible connections. - Address-family scope: start narrow (
AF_INET/AF_INET6,
SOCK_STREAM) and expand based on demand.
- Dominant language
- C
- Stars
- 95
- Forks
- 27
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from sysprog21/kbox
-
Difficulty 3/5 1-2 days Newbie friendliness 72/100
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
level/task module/gcp type/bug
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
-
Difficulty 1/5 Under an hour Newbie friendliness 86/100
hapostgres/pg_auto_failover#1190 ·
-
docs
Difficulty 1/5 Under an hour Newbie friendliness 85/100
-
P3 sonic-vpp
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
sonic-net/sonic-buildimage#29662 ·