Skip to content

wslc: containers can't use AF_VSOCK — seccomp blocks socket(AF_VSOCK) with no --security-opt/--privileged escape hatch #41503

Description

Summary

In WSL Containers (WSLC) public preview, a process inside a container cannot create an AF_VSOCK socket — socket(AF_VSOCK, SOCK_STREAM, 0) fails with EPERM. This blocks host↔container communication over Hyper-V sockets. There is no wslc run/create flag (--privileged, --security-opt, --cap-add, --device) nor any settings.yaml option to relax the seccomp/security policy, so there is currently no supported workaround.

Repro

# Dockerfile
FROM ubuntu:22.04
COPY vsock_server /vsock_server        # any program that calls socket(AF_VSOCK, SOCK_STREAM, 0) + bind/listen
ENTRYPOINT ["/vsock_server"]
wslc build -t vsock-test .
wslc run --name v vsock-test
# -> socket error: Operation not permitted   (EPERM on socket(AF_VSOCK))

Actual vs. expected

  • Actual: socket(AF_VSOCK, …) returns EPERM; the container cannot open a vsock socket at all.
  • Expected: a supported way to permit AF_VSOCK (e.g. --security-opt seccomp=unconfined, a configurable seccomp profile, or --privileged), consistent with Docker.

This is a policy block, not an architecture limit

  • The container runs on the shared WSL2 kernel (wslc run --rm ubuntu:22.04 uname -r6.18.40.1-microsoft-standard-WSL2), which fully supports AF_VSOCK (it works fine from a normal WSL distro on the same kernel).
  • The failure is EPERM, not EAFNOSUPPORT → the family is supported but denied by policy (seccomp/LSM), i.e. the default container profile filters AF_VSOCK.

What's missing

wslc run, wslc create, wslc system, and settings.yaml expose no security/seccomp/capability/privileged/device controls, so there is no way to allowlist AF_VSOCK.

Request

Add a Docker-compatible escape hatch — one or more of:

  • --security-opt seccomp=<profile|unconfined>
  • --privileged
  • allowlist AF_VSOCK in the default seccomp profile (or a documented opt-in)

so containers can use Hyper-V sockets for host↔guest IPC.

Related

Environment

  • WSL 2.9.9.0 (pre-release), kernel 6.18.40.1-microsoft-standard-WSL2
  • Windows 10.0.26220.9223
  • wslc 2.9.9.0

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions