From nobody Fri Apr 07 08:01:17 2023 X-Original-To: freebsd-current@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 4Pt9mm1zrNz44KGJ for ; Fri, 7 Apr 2023 08:01:28 +0000 (UTC) (envelope-from zlei@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (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 "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Pt9mm0L8Dz4QgD; Fri, 7 Apr 2023 08:01:28 +0000 (UTC) (envelope-from zlei@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1680854488; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WQ9n8kwsMdiuLW562R3m5fiapB0uAi9hgff4Z1t3QQU=; b=tnRO1EOTj/iISaffnWmkvWcROKm0LsYz8Upp2bIYuSqg61MW8+ogssO6hHigyiXitk/zpi Rx9PcWt9aMSJAWj/gDeEiIH1SkLlBufZQymMnLEYHpqmtnKIsxH2Wp1bA7J2E5LHjmyoZ+ an8i6U3lW4hePXU+sNi/uypYPGe3wGNfJ5P/EVqj7cd+QN7FtEET20s/vn/ERpULu+1m6F UxlsvuLu/zvKacFFOjo0PHus1/XJ+JqT7y2/n6T5L8gcCc4gSKpOVmnPNPHCLwtOInbWZn bTHSjGMR9kKffWuYfSaiv/Mz9N/m7Pn5vGivMtxmPSFTj7GH5+CzhcUoKD0JNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1680854488; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WQ9n8kwsMdiuLW562R3m5fiapB0uAi9hgff4Z1t3QQU=; b=teospP9IidTvVoJv+cOurMv7F24CRaU6Ne1ZAhn8xMOOSbzvDFk7iCHiODZAykTDALUX4h ROF1ZVjOQf6ZmF0T9m2za2vK7mgL4KZvu3gcJh5Yr5pjn2imbJ3U7fjCkKOdN1EV2dDb3M kG+2Tny99ooY9mt8G89yUdZQ7/JT83RCFZu9oHpgVZHVqxFuKgRicU5IQatDsV/5jB5v7l eYsfV4tO0aDVHCLOaVNiNaalU/L19HP0CCyTLw0ja1gbYGyBDxQp8i6xeHfgB51z08Q9/n u3/bm1Tcx4uLifzum0vdT7RI1SnM22VZHsTF2jjn6Fam4rjNTbXRhfVpm+TRyw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1680854488; a=rsa-sha256; cv=none; b=ZmC1erQAUVwUIs4P+paBWLe37v4EqQBncjNUWbAB91TmFP2tseLKQmjk0cPRWVP4aim3XD Orc+sFo34YE6OpnPRS5V9UmkszJr50yBE3p64DK+rRy+zqZBOm76q7htSLBx0UYLjBtMXI vSfG5nI4Z8ttm7yhopBFXCFyLnkOn00PxJkSKJuMwACifYNYL8z0IKnC5o8vJDkTlmT8nY zSJyzyGO741whV4SO3zKllbeojtCn3Gnls5kzKd8GYEWWt2I4Ylzbs7oNYs1uEI3nu+3u6 HifZpVmYjV5olIIjBBriQQezrrTP3uctozZ8Ck9AJf94btrjfUIudMsgZSqYfA== Received: from smtpclient.apple (ns1.oxydns.net [45.32.91.63]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: zlei/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4Pt9mk5mD6z10jX; Fri, 7 Apr 2023 08:01:25 +0000 (UTC) (envelope-from zlei@FreeBSD.org) Content-Type: text/plain; charset=utf-8 List-Id: Discussions about the use of FreeBSD-current List-Archive: https://lists.freebsd.org/archives/freebsd-current List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-current@freebsd.org Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.2\)) Subject: Re: Is it valid to combine CTLFLAG_TUN with CTLFLAG_VNET ? From: Zhenlei Huang In-Reply-To: <263045d4-409a-8a2d-87e1-50b1afcb7338@selasky.org> Date: Fri, 7 Apr 2023 16:01:17 +0800 Cc: freebsd-current@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <6B4FF474-6E25-4E8A-8FDE-7E8F01989038@FreeBSD.org> References: <94C1B333-9C0F-4874-BBB1-3E72F3DF3F6A@FreeBSD.org> <9dc65578-9312-1139-932f-396bc42e66b2@selasky.org> <263045d4-409a-8a2d-87e1-50b1afcb7338@selasky.org> To: Hans Petter Selasky X-Mailer: Apple Mail (2.3696.120.41.1.2) X-ThisMailContainsUnwantedMimeParts: N > On Apr 6, 2023, at 3:56 AM, Hans Petter Selasky = wrote: >=20 > On 4/5/23 21:44, Hans Petter Selasky wrote: >> On 4/5/23 20:23, Gleb Smirnoff wrote: >>> What if we remove the CTLFLAG_VNET check from the code you posted = above? >>> I don't see anything going wrong, rather going right =F0=9F=98=84 >>>=20 >>> CTLFLAG_VNET will not mask away CTLFLAG_TUN. >> Hi Gleb, >> It's possible to bypass that check, but some work needs to be done = first. Then all jails created, will also start from those sysctl tunable = values. >> The problem is, where does the VNET base pointer come from? >> Especially those static sysctl's. You would need to make some design = there I guess and look at the SYSINIT() order. When are SYSINIT's filled = with tunable data's. And when is the default VNET created. >> Because the data pointer passed to the register sysctl function is = simply an offset pointer into a malloc'ed structure. >> --HPS >=20 > Hi Zhenlei, >=20 > Feel free to work on this, and add me as a reviewer and complete phase = two of: >=20 >> commit 3da1cf1e88f8448bb10c5f778ab56ff65c7a6938 >> Author: Hans Petter Selasky >> Date: Fri Jun 27 16:33:43 2014 +0000 >> Extend the meaning of the CTLFLAG_TUN flag to automatically check = if >> there is an environment variable which shall initialize the SYSCTL >> during early boot. This works for all SYSCTL types both statically = and >> dynamically created ones, except for the SYSCTL NODE type and = SYSCTLs >> which belong to VNETs. A new flag, CTLFLAG_NOFETCH, has been added = to >=20 I'd like to do some refactoring firstly, so that I can focus on = CTLFLAG_VNET ;) > --HPS Best regards, Zhenlei