From nobody Thu Sep 07 17:04:54 2023 X-Original-To: virtualization@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4RhQbB4Ycbz4s1Q9 for ; Thu, 7 Sep 2023 17:04:54 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4RhQbB2cfzz4Cwc for ; Thu, 7 Sep 2023 17:04:54 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1694106294; a=rsa-sha256; cv=none; b=ucwX3/43Yvyf0uO3pLiT/Hz+CosOe1hGLL1TwZvMcyh9yCSJ0pVIfjaZEwTYQA+V99mBNK al5eQH4PIQUGsdHUEba8gzCnJfazbA9H37jQYOJZAKGcr/SeBvzmma6cLjcpXS9sOK1PmD 461SOUHOj45RnIsunBL5L4ToYVXhY21CphjIH7mFGeBtVVI4Gjr7b5Y01LuhRvD0ZQScgV HigK0U2jcYmbfwG+kMhzOWWd09qgYE3qYRak6lH8sl000AONi9rqIGOXhR35o9+ylEQf1d YjrNQKx9en10iKN5KSB6gXH1g1BWTzpWuULZlupMVU9F48sKrRTkU4pqayRT1A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1694106294; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TSrMVxwS3S63FLiw+gybXwqFyC9U3q2TTUfSt35gv48=; b=UzAdIqcvq0uN6zJcOZhnbbemMECuktJbFLq41u3JhAn3ZykpsGHMIQVQn+fzxTfe/uw+Xn SjF+w0bjxXQdhRx+wk9aXBulOQybGHk8MM3PU8cqDTqxMLC5DGvy99skcTQo70anYtUugB bnya563GwWkuN6bTrsVxT4xiMp0MGQwgyWSFhRU4a+GxnrmzDCCneiDMaTlg+gPayNgJIS p/NG3VsRwcNRrCxMdGLSkOPizi+zlZF+uJC4eorIhXdxBt/74SCdd4Y+Ub5G5leN0as2vz lu//9/9ytb+sSntlTR8BD4F4O6U5vC5M/C7ERFqYnFAO8oCCTJ2yXB6Hu5bp3A== Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4RhQbB1ggXz16JW for ; Thu, 7 Sep 2023 17:04:54 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 387H4sEo077725 for ; Thu, 7 Sep 2023 17:04:54 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 387H4s55077724 for virtualization@FreeBSD.org; Thu, 7 Sep 2023 17:04:54 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: virtualization@FreeBSD.org Subject: [Bug 273557] Regression preventing bhyve from running inside a jail without IP after f74147e26999838e03a522bf59ea33bef470d356) breaks support for jailing bhyve with IPv4 and IPv6 disabled. Patch included. Date: Thu, 07 Sep 2023 17:04:54 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bhyve X-Bugzilla-Version: 14.0-STABLE X-Bugzilla-Keywords: bhyve, easy, patch, regression X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: crest@rlwinm.de X-Bugzilla-Status: In Progress X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: virtualization@FreeBSD.org X-Bugzilla-Flags: mfc-stable14? X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Discussion List-Archive: https://lists.freebsd.org/archives/freebsd-virtualization List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-virtualization@freebsd.org X-BeenThere: freebsd-virtualization@freebsd.org MIME-Version: 1.0 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D273557 --- Comment #6 from crest@rlwinm.de --- (In reply to Bjoern A. Zeeb from comment #4) The untested patch would still attempt to create a socket (which can fail), closing the socket could be factored out (keep only the last close(s), but = put a label before and after it). It will allow bhyve to start, but bhyve will = fail to bring up the tap/vmnet interface on its own if it can't create an IP soc= ket (either IPv4 or IPv6). For example if bhyve is started inside very restrict= ive jail with ip=3Ddisabled and ip6=3Ddisabled. In this case bhyve will start b= ut the tap/vmnet device will stay in its default link state forcing users to either set sysctl net.link.tap.up_on_open=3D1 to change the default link state for= all tap/vmnet interface from DOWN to UP or have a wrapper poll the tap/vmnet de= vice aggressive enough until bhyve has opened it to bring the link state up befo= re the guest notices it. This is complicated by the fact that bhyve(8) exists = if the guest requests a reboot. While I've always run my bhyve hosts with net.link.tap.up_on_open=3D1 bhyve users shouldn't be forced to do change th= eir global system configuration. The corner case I ran into is clearly a bug th= at should be fixed. I see no advantage to addressing only one half of the bug = by still using an IP socket, but continuing if the socket creation or ioctl()s fail. Processes running inside a jail with both IPv4 and IPv6 disabled can't be create new IP sockets of either IP version. The only way for bhyve to bring= up the tap/vmnet device from inside such a jail is to use the ioctl(VMIO_SIOCSIFFLAGS) on the tap/vmnet device. It's also the only place = in bhyve that I found with a quick `grep -r` which creates IP sockets. From my understanding ioctl(VMIO_SIOCSIFFLAGS) covers all cases (inside a jail and outside), avoids creating and destroying a socket, saves a few syscalls, removes a (theoretical) race condition, removes failure cases that have to = be handled (even if only to report and ignore them). Am I overlooking a downside to using ioctl(VMIO_SIOCSIFFLAGS) on the tap/vm= net device and getting rid of the IP socket and the variables holding the socket file descriptor number and struct passed to ioctl()s on the socket? --=20 You are receiving this mail because: You are the assignee for the bug.=