8000 Update libkrun to 1.19.6 by gominimal-pkgmgr-mgr[bot] · Pull Request #835 · gominimal/pkgs · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Karl Godard <karl@minimal.dev>
Date: Thu, 8 Oct 2026 19:22:37 +0000
Subject: [PATCH] virtio/vsock: refuse a stream whose unix proxy cannot be
created

When the guest opens a stream to a vsock port mapped to a host unix
socket with krun_add_vsock_port2(..., listen=false), process_op_request()
creates the host leg with UnixProxy::new(...).unwrap(). UnixProxy::new()
fails only when socket(AF_UNIX) fails (EMFILE, ENFILE, ENOBUFS, ENOMEM),
a transient host condition, but the unwrap() turns it into a panic on the
event-manager thread, and the panic aborts the whole VMM: every guest
connection and the guest itself go down because one host socket could
not be created.

Refuse just that connection instead. Log the error, which carries the
errno, and answer the guest with OP_RST, the same reply the function
already sends when a guest connects to a port that is mapped for
listening. Nothing is inserted into the proxy map, so there is no state
to clean up, and the guest's connect() fails with ECONNRESET while the
VM keeps running.

The TSI stream and dgram proxy creation paths already handle this error;
this was the only guest-triggered proxy construction that unwrapped it.

Assisted-by: Claude Code: opus-5.5
---
src/devices/src/virtio/vsock/muxer.rs | 22 +++++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/src/devices/src/virtio/vsock/muxer.rs b/src/devices/src/virtio/vsock/muxer.rs
index 6cf8b6f..4cc56fd 100644
--- a/src/devices/src/virtio/vsock/muxer.rs
+++ b/src/devices/src/virtio/vsock/muxer.rs
@@ -560,7 +560,7 @@ impl VsockMuxer {
}
let rxq = self.rxq.clone();

- let mut unix = UnixProxy::new(
+ let mut unix = match UnixProxy::new(
id,
self.cid,
pkt.dst_port(),
@@ -569,8 +569,24 @@ impl VsockMuxer {
queue.clone(),
rxq,
path.to_path_buf(),
- )
- .unwrap();
+ ) {
+ Ok(unix) => unix,
+ Err(e) => {
+ // Creating the host socket can fail transiently (e.g.
+ // EMFILE, ENFILE, ENOBUFS). Refuse this connection
+ // instead of taking the whole VM down.
+ error!(
+ "error creating unix proxy for port {}, sending rst: {e}",
+ pkt.dst_port()
+ );
+ let rx = MuxerRx::Reset {
+ local_port: pkt.dst_port(),
+ peer_port: pkt.src_port(),
+ };
+ push_packet(self.cid, rx, &self.rxq, queue, mem);
+ return;
+ }
+ };
let tsi = TsiConnectReq {
peer_port: 0,
addr: SocketAddrV4::new(Ipv4Addr::new(0, 0, 0, 0), 0).into(),
--
2.55.0

14 changes: 12 additions & 2 deletions packages/libkrun/build.ncl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ let pkgconf = import "../pkgconf/build.ncl" in
let rust = import "../rust/build.ncl" in
let toolchain = import "../toolchain/build.ncl" in

let version = "1.19.4" in
let version = "1.19.6" in
{
name = "libkrun",

Expand Down Expand Up @@ -39,9 +39,19 @@ let version = "1.19.4" in
# fix lands in an upstream release we can pin.
# https://github.com/gominimal/minimal/issues/869
{ file = "0001-vsock-bound-outstanding-packets.patch" } | Local,
# A guest-to-host vsock stream whose host unix socket cannot be created
# (EMFILE, ENFILE, ENOBUFS) hit UnixProxy::new(...).unwrap() in
# muxer.rs, and the panic aborted the whole VMM. The patch logs the error
# and answers that one stream with OP_RST instead, so the guest's
# connect() fails and the VM keeps running. 1.19.6 does not fix this.
#
# Identical to the patch gominimal/minimal carries at
# vendor/libkrun/patches/ (#2105); drop it once upstream releases the fix.
# https://github.com/gominimal/minimal/issues/2103
{ file = "0002-vsock-refuse-stream-when-unix-proxy-creation-fails.patch" } | Local,
{
url = "https://github.com/containers/libkrun/archive/refs/tags/v%{version}.tar.gz",
sha256 = "e8775fab2b460972a67ca6cd936296bb79cdb078d852d712a283cb290dd0b284",
sha256 = "7025d72208172dc06f791ad5af7ccaafeabdac9869f74ccb45fb6d4f6e5991cd",
extract = true,
strip_prefix = "libkrun-%{version}",
} | Source,
Expand Down
3 changes: 2 additions & 1 deletion packages/libkrun/build.sh
76A8
Original file line number Diff line numberDiff line change
Expand Up @@ -7,11 +7,12 @@ export CC=gcc
export LD=gcc
export RUSTFLAGS="-C linker=gcc --remap-path-prefix=$(pwd)=/builddir --remap-path-prefix=$HOME/.cargo=/cargo"

# vsock fix (see build.ncl). Applied by explicit name, not by glob. `set -e`
# vsock fixes (see build.ncl). Applied by explicit name, not by glob. `set -e`
# plus patch's non-zero exit on a rejected hunk makes a stale patch abort the
# build; a silently-skipped patch would publish a libkrun that looks fixed and
# is not.
patch -Np1 -i "0001-vsock-bound-outstanding-packets.patch"
patch -Np1 -i "0002-vsock-refuse-stream-when-unix-proxy-creation-fails.patch"

# BLK=1 enables virtio-blk (exports krun_add_disk2); `blk` is not a default
# libkrun feature, so consumers fail to link without it.
Expand Down
Loading
0