Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 Apr 2023 10:31:42 +0800
From:      Zhenlei Huang <zlei@FreeBSD.org>
To:        Hans Petter Selasky <hps@selasky.org>, Gleb Smirnoff <glebius@FreeBSD.org>
Cc:        freebsd-current@freebsd.org
Subject:   Re: Is it valid to combine CTLFLAG_TUN with CTLFLAG_VNET ?
Message-ID:  <2CFA5EBD-ABEB-4D22-9D9A-50725168112E@FreeBSD.org>
In-Reply-To: <263045d4-409a-8a2d-87e1-50b1afcb7338@selasky.org>
References:  <94C1B333-9C0F-4874-BBB1-3E72F3DF3F6A@FreeBSD.org> <9dc65578-9312-1139-932f-396bc42e66b2@selasky.org> <ZC28li9kOc5e4rbc@FreeBSD.org> <b2338626-4f3a-d0f8-ce6b-365b8e393fec@selasky.org> <263045d4-409a-8a2d-87e1-50b1afcb7338@selasky.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--Apple-Mail=_B7DDE398-2F32-4F00-BCD5-DEB9D957E844
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=utf-8



> On Apr 6, 2023, at 3:56 AM, Hans Petter Selasky <hps@selasky.org> =
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 <hselasky@FreeBSD.org>
>> 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
> --HPS

Posted to https://reviews.freebsd.org/D39638 =
<https://reviews.freebsd.org/D39638>=20

CC freebsd-current if some people are interested in the fix.

Best regards,
Zhenlei


--Apple-Mail=_B7DDE398-2F32-4F00-BCD5-DEB9D957E844
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
	charset=utf-8

<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html; =
charset=3Dutf-8"></head><body style=3D"word-wrap: break-word; =
-webkit-nbsp-mode: space; line-break: after-white-space;" class=3D""><br =
class=3D""><div><br class=3D""><blockquote type=3D"cite" class=3D""><div =
class=3D"">On Apr 6, 2023, at 3:56 AM, Hans Petter Selasky &lt;<a =
href=3D"mailto:hps@selasky.org" class=3D"">hps@selasky.org</a>&gt; =
wrote:</div><br class=3D"Apple-interchange-newline"><div class=3D""><div =
class=3D"">On 4/5/23 21:44, Hans Petter Selasky wrote:<br =
class=3D""><blockquote type=3D"cite" class=3D"">On 4/5/23 20:23, Gleb =
Smirnoff wrote:<br class=3D""><blockquote type=3D"cite" class=3D"">What =
if we remove the CTLFLAG_VNET check from the code you posted above?<br =
class=3D"">I don't see anything going wrong, rather going right =F0=9F=98=84=
<br class=3D""><br class=3D"">CTLFLAG_VNET will not mask away =
CTLFLAG_TUN.<br class=3D""></blockquote>Hi Gleb,<br class=3D"">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.<br class=3D"">The problem is, where does the VNET base pointer =
come from?<br class=3D"">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.<br class=3D"">Because the data pointer passed to the =
register sysctl function is simply an offset pointer into a malloc'ed =
structure.<br class=3D"">--HPS<br class=3D""></blockquote><br =
class=3D"">Hi Zhenlei,<br class=3D""><br class=3D"">Feel free to work on =
this, and add me as a reviewer and complete phase two of:<br =
class=3D""><br class=3D""><blockquote type=3D"cite" class=3D"">commit =
3da1cf1e88f8448bb10c5f778ab56ff65c7a6938<br class=3D"">Author: Hans =
Petter Selasky &lt;<a href=3D"mailto:hselasky@FreeBSD.org" =
class=3D"">hselasky@FreeBSD.org</a>&gt;<br class=3D"">Date: =
&nbsp;&nbsp;Fri Jun 27 16:33:43 2014 +0000<br class=3D""> =
&nbsp;&nbsp;&nbsp;Extend the meaning of the CTLFLAG_TUN flag to =
automatically check if<br class=3D""> &nbsp;&nbsp;&nbsp;there is an =
environment variable which shall initialize the SYSCTL<br class=3D""> =
&nbsp;&nbsp;&nbsp;during early boot. This works for all SYSCTL types =
both statically and<br class=3D""> &nbsp;&nbsp;&nbsp;dynamically created =
ones, except for the SYSCTL NODE type and SYSCTLs<br class=3D""> =
&nbsp;&nbsp;&nbsp;which belong to VNETs. A new flag, CTLFLAG_NOFETCH, =
has been added to<br class=3D""></blockquote><br class=3D"">--HPS<br =
class=3D""></div></div></blockquote><br class=3D""></div>Posted =
to&nbsp;<a href=3D"https://reviews.freebsd.org/D39638" =
class=3D"">https://reviews.freebsd.org/D39638</a>&nbsp;<div class=3D""><br=
 class=3D""></div><div class=3D"">CC <span style=3D"caret-color: rgb(0, =
0, 0); color: rgb(0, 0, 0);" class=3D"">freebsd-current</span>&nbsp;if =
some people are interested in the fix.<div class=3D""><br class=3D""><div =
class=3D"">
<div>Best regards,</div><div>Zhenlei</div>

</div>
<br class=3D""></div></div></body></html>=

--Apple-Mail=_B7DDE398-2F32-4F00-BCD5-DEB9D957E844--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?2CFA5EBD-ABEB-4D22-9D9A-50725168112E>