From nobody Tue Aug 15 21:33:51 2023
X-Original-To: jail@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 4RQPf82T0jz4qSFN
	for <jail@mlmmj.nyi.freebsd.org>; Tue, 15 Aug 2023 21:33:52 +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 4RQPf773Ypz4Fj0
	for <jail@FreeBSD.org>; Tue, 15 Aug 2023 21:33:51 +0000 (UTC)
	(envelope-from bugzilla-noreply@freebsd.org)
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1692135232;
	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=r+zzqX+DkQRwzbukUJrFFfba5h0RvIjRvvfsUytHG6o=;
	b=tfUxde27Z3UrJwyk85He5cBTwBhBybEyhvheSyj05M4aaOh4LZkME/b9VYBxRZDnjZjYrV
	xki/tBF64D88ox72kIRtlQZDh3HjCz31rCX8nYEMEgDmY/q+JxWaOXIM6JY9kAahJHkEGN
	T/e9VFmdyzhrOvJTebatIHdsLtDE36CXqj9COP/rzS509U/30dHqbXUueXGicOLhB/S6Vl
	U2lw0kQifix1rXwnM5t4byEmTjoj1qRIBLAVvgBXZkNePn6ZXsbwRXraiCkPaAb9pZgbgn
	gQ3dZQsMDQ/KzDMANiZ6n3jANduD62u9Sp3hhIskMAFc9iTa5yNh0xtRqbnz+g==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1692135232; a=rsa-sha256; cv=none;
	b=xP5c1cdwtuNHFPNj4+A2v8DB7bFPC4TFwrvfkZu3vYhQQ8gPl7d6luy8qnxfmQy5p+dh5A
	LiDxqGCZ/2St/BkcLAJJJSQJ2lT3JPCV23QOchF5akd6Ddk5Dc2NcdIk5z+qju1hW6Gt/y
	f9LxfBXlUdXRD1s5ntORv8/N/n6Tw3F2t9frhPEyHV04aMV5UPZt6M9IwYuKRivjtH8mbN
	yjgV9dUxYIDO7jaJ44ycos9n1WRYSRqF86Ur6zFUoU5YBxOe8T0I05DBT2DF3vdaXsbgGI
	FN5bjZqYtUn/EuzP0xe43G4naJJAtjYmeFI1fvM+kpIUxpsiFlNPhCxFHHjEpA==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
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 4RQPf7678wzB8K
	for <jail@FreeBSD.org>; Tue, 15 Aug 2023 21:33:51 +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 37FLXp9p044162
	for <jail@FreeBSD.org>; Tue, 15 Aug 2023 21:33:51 GMT
	(envelope-from bugzilla-noreply@freebsd.org)
Received: (from www@localhost)
	by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 37FLXpIM044160
	for jail@FreeBSD.org; Tue, 15 Aug 2023 21:33:51 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: jail@FreeBSD.org
Subject: [Bug 271069] syslogd service inside client jail requires restart
 before server jail receives logs
Date: Tue, 15 Aug 2023 21:33:51 +0000
X-Bugzilla-Reason: AssignedTo
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: Base System
X-Bugzilla-Component: bin
X-Bugzilla-Version: 13.2-RELEASE
X-Bugzilla-Keywords: 
X-Bugzilla-Severity: Affects Only Me
X-Bugzilla-Who: me@svmhdvn.name
X-Bugzilla-Status: Open
X-Bugzilla-Resolution: 
X-Bugzilla-Priority: ---
X-Bugzilla-Assigned-To: jail@FreeBSD.org
X-Bugzilla-Flags: 
X-Bugzilla-Changed-Fields: attachments.isobsolete attachments.created
Message-ID: <bug-271069-29815-4lMnxISpyO@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-271069-29815@https.bugs.freebsd.org/bugzilla/>
References: <bug-271069-29815@https.bugs.freebsd.org/bugzilla/>
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 about FreeBSD jail(8) <freebsd-jail.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/freebsd-jail
List-Help: <mailto:freebsd-jail+help@freebsd.org>
List-Post: <mailto:freebsd-jail@freebsd.org>
List-Subscribe: <mailto:freebsd-jail+subscribe@freebsd.org>
List-Unsubscribe: <mailto:freebsd-jail+unsubscribe@freebsd.org>
Sender: owner-freebsd-jail@freebsd.org
MIME-Version: 1.0

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D271069

Siva Mahadevan <me@svmhdvn.name> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #244032|0                           |1
        is obsolete|                            |
 Attachment #244033|0                           |1
        is obsolete|                            |

--- Comment #7 from Siva Mahadevan <me@svmhdvn.name> ---
Created attachment 244132
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D244132&action=
=3Dedit
minimal workaround

Found the root issue (all based on comment #3 with code from releng/13.2
branch, but it's still applicable in the main branch):

When the IPv6 jail is created, `/sbin/ifconfig <interface> inet6
<jail_ipv6_addr> alias` gets called to create the new IPv6 alias address. T=
his
calls the `SIOCAIFADDR` ioctl at sbin/ifconfig/ifconfig.c:1042, which
eventually reaches sys/netinet6/in6.c:560 in the kernel. Once the new ipv6
address is created, it is marked IN6_IFF_TENTATIVE at sys/netinet6/in6.c:11=
77
and then later queued for Duplicate Address Detection at
sys/netinet6/in6.c:1247. However, the call to `nd6_dad_start(...)` is
asynchronous and returns immediately after starting the DAD timer at
sys/netinet6/nd6_nbr.c:1341. This causes a race condition between:
* completing the DAD process and clearing the IN6_IFF_TENTATIVE flag on the
newly created IPv6 address
* exiting the `/sbin/ifconfig` call successfully, finishing jail setup, and
starting the jail while its IPv6 address is still marked as "tentative"

By adding a sufficiently long pause at (b) in the newly attached patch, this
gives enough time for the next `nd6_timer(...)` run to find this tentative
address, complete DAD, and clear the IN6_IFF_TENTATIVE flag. This is confir=
med
by adding the exact same pause at (a) instead of (b), then noticing that the
race condition still exists.

I don't have much knowledge of the IPv6 networking stack, so I'm not sure a=
bout
the proper fix here. However, it seems like there could be two possible fix=
es
here:
* `SIOCAIFADDR` ioctl call still returns a tentative IPv6 address pending f=
ull
DAD completion, but change the userspace `/sbin/ifconfig` tool to wait until
the tentative flag is cleared before exiting successfully
* change the `SIOCAIFADDR` ioctl handler to call the DAD routine synchronou=
sly
and return back a regular non-tentative address

--=20
You are receiving this mail because:
You are the assignee for the bug.=

From nobody Tue Aug 15 21:56:29 2023
X-Original-To: jail@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 4RQQ8F5hr2z4qT70
	for <jail@mlmmj.nyi.freebsd.org>; Tue, 15 Aug 2023 21:56:29 +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 4RQQ8F095bz4HJ3
	for <jail@FreeBSD.org>; Tue, 15 Aug 2023 21:56:29 +0000 (UTC)
	(envelope-from bugzilla-noreply@freebsd.org)
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1692136589;
	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=uvgmuj+zkCF1+qPzo4REIioIEB9ms3qasl7G5c/ca6s=;
	b=ijmXIv6FTqmzf+82Gwy+WdH1lagLufFVHJ7Au4hG/4Gu3byzmBWo+SssxYkrOpI8tEEbxy
	rCzPtSCCzXUHFinlcxPrb3LTvqzSJzKSOlZOZHtu1iRFO6uMZyrYTkdq2u93ZpvTk6984s
	Lzo5gd5CGPcX06Vwv9N9hqGiZE0RmgSdB8UrDotSAoy3fwZ1B3uYWeVE38jUOrOVBWz0Q+
	rt9tWrLw00J/x7NwzjmNBdswg3iJNuip8jTJ7L3nh2HwlwwVt7gk7uFLI7FzAc9l1llQWk
	Ynz9LW/UAlLl+fQD8xAc951DDr6iph+7mxNEoMzoY5yS5kgCH5raL6z10xhQwg==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1692136589; a=rsa-sha256; cv=none;
	b=KyWHtGiut7GNMpGtZA/AhazfmN1mxC1yTZy9FX93ET7WLtE8760DsYjLMucZLa4zl4Erjp
	MEpxSvJPS/x103wuEk9IN79SSRdOoKo8cjE5XNEqqgADa7oamwMMpPv7A2Pr01SIwePJXd
	AAHBpFWPITTibbKrwLvB+/42Benfu12PpcQpqqAgdSljLH184FsICBjV2FPSPwfzLyV1B0
	oiiyU7opyj+pgx2zhhFuEluJd5Mh4miWJ5tmbQlT32+8s5EA6YiLfUw+Uj4Z1sPAKaJtBh
	SusQwl/cISybU+kBW8qtJ3leP1gSTcR0tGbdQwTlb/bYQuBL3kA09AAmMGi0Pw==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
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 4RQQ8D6KpczBYS
	for <jail@FreeBSD.org>; Tue, 15 Aug 2023 21:56:28 +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 37FLuSoE077687
	for <jail@FreeBSD.org>; Tue, 15 Aug 2023 21:56:28 GMT
	(envelope-from bugzilla-noreply@freebsd.org)
Received: (from www@localhost)
	by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 37FLuSXR077686
	for jail@FreeBSD.org; Tue, 15 Aug 2023 21:56:28 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: jail@FreeBSD.org
Subject: [Bug 271069] syslogd service inside client jail requires restart
 before server jail receives logs
Date: Tue, 15 Aug 2023 21:56:29 +0000
X-Bugzilla-Reason: AssignedTo
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: Base System
X-Bugzilla-Component: bin
X-Bugzilla-Version: 13.2-RELEASE
X-Bugzilla-Keywords: 
X-Bugzilla-Severity: Affects Only Me
X-Bugzilla-Who: dvl@FreeBSD.org
X-Bugzilla-Status: Open
X-Bugzilla-Resolution: 
X-Bugzilla-Priority: ---
X-Bugzilla-Assigned-To: jail@FreeBSD.org
X-Bugzilla-Flags: 
X-Bugzilla-Changed-Fields: cc
Message-ID: <bug-271069-29815-8bvoZvn9XX@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-271069-29815@https.bugs.freebsd.org/bugzilla/>
References: <bug-271069-29815@https.bugs.freebsd.org/bugzilla/>
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 about FreeBSD jail(8) <freebsd-jail.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/freebsd-jail
List-Help: <mailto:freebsd-jail+help@freebsd.org>
List-Post: <mailto:freebsd-jail@freebsd.org>
List-Subscribe: <mailto:freebsd-jail+subscribe@freebsd.org>
List-Unsubscribe: <mailto:freebsd-jail+unsubscribe@freebsd.org>
Sender: owner-freebsd-jail@freebsd.org
MIME-Version: 1.0

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D271069

Dan Langille <dvl@FreeBSD.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dvl@FreeBSD.org

--- Comment #8 from Dan Langille <dvl@FreeBSD.org> ---
(In reply to Siva Mahadevan from comment #7)

Congratulations. Well done.

--=20
You are receiving this mail because:
You are the assignee for the bug.=