Let the host choose where a guest's listening sockets bind

オープン
#255 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@NopeCharon がすでに取り組んでいます。

2026年11月19日 から。

  • #291 @NopeCharon による — オープン

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
25/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
活発
技術スタック
rust

調査の方向性

Start by reading the SandboxBuilder, AppSandbox, socket bind/listen handling, and restore paths; the issue does not name specific files or tests. Work out how redirected host addresses should be reported and translated by net_getsockname, including port-zero binds and restored listeners. Done means the host can choose distinct listener addresses for each sandbox while guests see their requested addresses; the TCP-versus-listen decision and port-zero naming question need resolution first.

索引モデルが issue の本文から書いたものです。

説明

enhancement

A guest's listening socket is a host socket, bound at exactly the address and port the guest asks for. For a host that runs many sandboxes in one process and puts its own front end in front of each, that causes four problems:

  • A guest that binds 0.0.0.0, as most servers do, is reachable on every host interface, not only through the host's front end.
  • A restored guest re-binds the port it had at snapshot time. If another process or sandbox holds that port by then, the re-bind fails: the guest kernel logs hostsock: cannot re-create a listening socket after restore, the listener is dead (accept returns EIO, poll reports it hung up), and restore() still returns Ok, so the host is not told.
  • Two sandboxes restored from one snapshot both try the same port, so only one of them can listen. If the guest set SO_REUSEPORT, both bind, and the host kernel splits connections between them.
  • A guest that bound port 0 is silently given a different port on restore.

ListenPorts limits which ports a guest may bind, not where they are bound (#184 is related).

Proposal: a SandboxBuilder option that redirects listens. Whatever address and port a guest's listening socket asks for, the host socket is bound to an address the host chooses (for example 127.0.0.1:0), and AppSandbox reports the real address for each guest port, e.g. listen_addr(guest_port) -> Option<SocketAddr>. net_getsockname translates back to the guest's address, for listeners and the connections they accept. A restore re-establishes listeners through the same redirect, so each restored sandbox gets a port of its own.

Open questions:

  • Bind comes before listen, so the host cannot yet tell a listener from a UDP server or a client choosing its source port. Should the redirect apply to TCP sockets only, or be decided at listen?
  • How should listen_addr name a guest listener that bound port 0?
主要言語
Rust
スター
72
フォーク
14
平均マージ
15時間 29分
マージ済み PR(30日)
40

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

hyperlight-dev/hyperlight-unikraft のほかの issue

hyperlight-dev/hyperlight-unikraft の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。