From nobody Fri Aug 11 21:04:40 2023 X-Original-To: bugs@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 4RMxBK2KGmz4mTQl for ; Fri, 11 Aug 2023 21:04:41 +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 4RMxBJ6KFhz3Z6r for ; Fri, 11 Aug 2023 21:04:40 +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=1691787880; 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=luz12dVoGgjrCD0/36Zl8j0osFGRZ/pCDiRPhmG8H5E=; b=XkO43z0fuRDpTZFAUEmIjzp5EPlSV0w7jY6fMYvy2DzyBIn40gI6SbGAX+cDzHpxeoFpJC Ykr7RsfV/yjw4+Z5usmhGR5a8VXgVtYKpgvLs1VyOT2Q72dlZi8iY59s6ktLkvJUWi31iP SmLD+5tagthK6bJS+Vy9vBZ37gBrcHUIiV7BhcTPuTgBDeiB/ZgtPhhg+5vAS9i2iyM01M pu3EHOSjMumDUS/SyhUMsUUrSDSjM95X2gaXqOHbF9oyBDFTUtvSPmxcHXi3MvyqOeTviE RkL5ppvgi+1wM2oBAIj+KbBBDSIGVPzMkJ5mMVFF/q3ZSsYPiT/nD07nDCqlPA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1691787880; a=rsa-sha256; cv=none; b=qTSn1SUlkfZlFrLt7JnTBjXGRM7gSIvt7b44la1nOwXEbqoqjyLbTSoY8Y3Uyj/82BHvyT QxWH0KAKTExft3XvdD60KW+6OZ/xzqJLJZxov400k1OksO+zaic+EpG7srODbe/sEXkNg4 d70O7OLYeLNSiv0+iEdUfooQ5CpUnSggvNrZ0bliPrNBEUixfIXdFnnCg9JaOaR/R2LTj9 wOIKllWZ+yJIvcrGbqcoqSTkmZFeL06i8+/g2xzpLauA8QcXtALoH2McTqlb27TUTy+CCN EpMxLmqOlkgi/lhW2d1jRbT84F1KOGsLE0+378HmsQQ/HlHjx3zHO9X0Cey/VA== 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 4RMxBJ5PYnztWB for ; Fri, 11 Aug 2023 21:04:40 +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 37BL4eW4038738 for ; Fri, 11 Aug 2023 21:04:40 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 37BL4elu038737 for bugs@FreeBSD.org; Fri, 11 Aug 2023 21:04:40 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: bugs@FreeBSD.org Subject: [Bug 271069] syslogd service inside client jail requires restart before server jail receives logs Date: Fri, 11 Aug 2023 21:04:40 +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: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: attachments.created 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: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@freebsd.org MIME-Version: 1.0 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D271069 --- Comment #6 from Siva Mahadevan --- 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.=