init: optional vsock exec server so OCI runtimes can implement exec and signal delivery

Open
#905 2 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 3 days

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
28/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
rust
Domain
backend

Research direction

Read the issue as a design proposal first: it names Builder::exec_server(port), krun_init_builder_exec_server(), the init config key exec_server, and VsockDevice::add_unix_port(port, path, true) as the touch points. Study the reference implementations before writing anything — the author's forks AlphaJack/libkrun branch init-exec-server and AlphaJack/crun branch krun-exec, plus containers/crun#2090, #2158 and libkrun#667. Done means the three open questions (forked server process, fixed vs configurable port, whether to carry OCI rlimits/caps) are answered by maintainers and a framed protocol covering spawn/stdio/winsize/signals/exit lands with tests; not startable as-is.

Written by the indexing model from the issue text.

Description

krun containers can't do podman exec or health checks (containers/crun#2090) and podman stop can't reach the workload (#10, containers/crun#2158), because nothing on the host can talk to a process inside the VM.

Proposal: an opt-in server in the init binary, exec_server: {port} in the init config, exposed through Builder::exec_server(port) / krun_init_builder_exec_server(). The VMM maps the port to a Unix socket with VsockDevice::add_unix_port(port, path, true).
Small framed protocol (type u8, len u32 LE), host-CID only: spawn a process with argv/env/cwd/uid/gid/pty, relay stdio, winsize and signals, report the exit status; plus a request that signals the workload. Also covers the GitLab runner case in #667.

I've tested this approach end-to-end with podman 6.1 on a forked libkrun2 and crun.

Questions before I open the PR:

  • is a forked server process from init acceptable (thread can't survive KRUN_INIT_PID1=1)
  • should the port be fixed or configurable
  • should the exec'd process also get the OCI rlimits/caps or is uid/gid enough?
Dominant language
Rust
Stars
2.8k
Forks
279
Avg merge
5d 19h
Merged PRs (30d)
48

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from libkrun/libkrun

All issues in libkrun/libkrun

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.