From: "cron2 (Code Review)" Date: Tue, 28 Oct 2025 09:34:56 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: <4eddf01f940af27ed49bcc4b617932f0bff94665-EmailReplacePatchSet-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="Zkdkt9uNbZI="; charset=UTF-8 Subject: [Openvpn-devel] [XS] Change in openvpn[master]: Avoid possible race condition that kill OpenVPN itself List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: plaisthos , flichtenheld Cc: openvpn-devel --Zkdkt9uNbZI= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has uploaded a new patch set (#2) to the change originally created by= plaisthos. ( http://gerrit.openvpn.net/c/openvpn/+/1319?usp=3Demail ) The following approvals got outdated and were removed: Code-Review+2 by cron2 Change subject: Avoid possible race condition that kill OpenVPN itself ...................................................................... Avoid possible race condition that kill OpenVPN itself If for whatever reason the child pid is zero, we would kill ourselves since killing 0 means killing the own process group. Reported-By: Joshua Rogers Found-By: Zeropath Change-Id: I7b94de92723f9528b01cb932bb079eedf0f1f272 Signed-off-by: Arne Schwabe Acked-by: Gert Doering Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1319 Message-Id: <20251027213308.5588-1-gert@...1296...> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg33= 910.html Signed-off-by: Gert Doering --- M src/openvpn/tun_afunix.c 1 file changed, 6 insertions(+), 1 deletion(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/19/1319/2 diff --git a/src/openvpn/tun_afunix.c b/src/openvpn/tun_afunix.c index 4d48a31..124db6d 100644 --- a/src/openvpn/tun_afunix.c +++ b/src/openvpn/tun_afunix.c @@ -128,7 +128,12 @@ close(tt->fd); tt->fd =3D 0; } - kill(tt->afunix.childprocess, SIGINT); + /* only kill the child process if the PID is not 0 to avoid killing + * ourselves by accident */ + if (tt->afunix.childprocess) + { + kill(tt->afunix.childprocess, SIGINT); + } free(tt->actual_name); free(tt); -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1319?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings?usp=3Demail Gerrit-MessageType: newpatchset Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I7b94de92723f9528b01cb932bb079eedf0f1f272 Gerrit-Change-Number: 1319 Gerrit-PatchSet: 2 Gerrit-Owner: plaisthos Gerrit-Reviewer: cron2 Gerrit-Reviewer: flichtenheld Gerrit-CC: openvpn-devel --Zkdkt9uNbZI= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 upl= oaded patch set #2 to the change originally created by plaisthos.<= /p>

Vi= ew Change

The following approvals got outdated and were removed: Code-Review+2 by cron2

Avoid possible race condition that =
kill OpenVPN itself

If for whatever reason the child pid is zero, we= would kill ourselves
since killing 0 means killing the own process grou= p.

Reported-By: Joshua Rogers <contact@...2949...>
Found-By= : Zeropath
Change-Id: I7b94de92723f9528b01cb932bb079eedf0f1f272
Signe= d-off-by: Arne Schwabe <arne-openvpn@...1227...>
Acked-by: Gert Do= ering <gert@...1296...>
Gerrit URL: https://gerrit.openvpn.net/c/o= penvpn/+/1319
Message-Id: <20251027213308.5588-1-gert@...1296...><= br>URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/ms= g33910.html
Signed-off-by: Gert Doering <gert@...1296...>
---M src/openvpn/tun_afunix.c
1 file changed, 6 insertions(+), 1 deletion= (-)

git pull ssh://gerrit.openvpn.net:29418/open=
vpn refs/changes/19/1319/2
diff --git a/src/openvpn/tun_afunix.c b/=
src/openvpn/tun_afunix.c
index 4d48a31..124db6d 100644
--- a/src/openvpn/tun_afunix.c
+++ b/src/openvp= n/tun_afunix.c
@@ -128,7 +128,12 @@
= close(tt->fd);
tt->fd =3D 0;
}

- kill(tt-= >afunix.childprocess, SIGINT);
+ /* only kill the child process if the PID is not 0 to avo= id killing
+ * ou= rselves by accident */
+ {
+ kill(tt->afunix.childprocess, SIGINT);
+ }

= free(tt->actual_name);
free(tt);

To view, visit change 1319. To unsubscribe, or for help = writing mail filters, visit settings.

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I7b94de92723f9528b01cb932bb0= 79eedf0f1f272
Gerrit-Change-Number: 1319
Gerrit-PatchSet: 2
Gerrit-Owner: plaisthos <arne-openvpn@...1711...= 27...>
Gerrit-Reviewer: cron2 <gert@...1296...>=
Gerrit-Reviewer: flichtenheld <frank@...2716...= 1...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
= --Zkdkt9uNbZI=--