Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 11 Aug 2023 21:04:40 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 271069] syslogd service inside client jail requires restart before server jail receives logs
Message-ID:  <bug-271069-227-83ssWJfc1O@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-271069-227@https.bugs.freebsd.org/bugzilla/>
References:  <bug-271069-227@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D271069

--- Comment #6 from Siva Mahadevan <me@svmhdvn.name> ---
Created attachment 244033
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D244033&action=
=3Dedit
sleep in parent

(In reply to Siva Mahadevan from comment #3)

I was able to find the race condition inside the usr.sbin/jail command and
narrow it down to the area highlighted by the attached patches. Basing the
following commentary on the minimal repro from comment #3.

The confirmed issue is that the jail's start command (in this case, `rc`) r=
uns
before the IPv6 alias address is set in the jail by `ifconfig`. This causes=
 the
`sshd` service to be started before the IPv6 address is available.
When I add a sleep of 350 milliseconds or more to *either* the parent or the
child as shown in the above patches, the above issue does not occur and the
IPv6 alias address is available before `rc` starts the `sshd` service. This=
 is
sensitive to timing; I found that if I change the sleep to 300 milliseconds=
 or
less, the race condition consistently repros.

I tried adding a `waitpid(pid, NULL, 0)` in the parent immediately after the
`fork()` call, but that doesn't seem to work. I am not sure how to proceed =
in
the debug. I think that the solution here is to ensure that each setup comm=
and
runs to completion *serially* before the jail's `start.command` is run. The
code seems to already do this by tracking the process and waiting on it in
`next_proc()` at command.c:275, but I can't see why this doesn't work.

I will continue to debug further in the meantime; please let me know if the=
re
are any ideas here and I will prepare a patch to fix the issue.

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-271069-227-83ssWJfc1O>