From: "cron2 (Code Review)" Date: Tue, 28 Oct 2025 09:34:58 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: <4eddf01f940af27ed49bcc4b617932f0bff94665-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="bFTABC2+rKk="; 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 Cc: flichtenheld , openvpn-devel --bFTABC2+rKk= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/13= 19?usp=3Demail ) 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(-) 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: merged 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 --bFTABC2+rKk= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 sub= mitted this change.

View Change

Avoid possible race condition that kill OpenVPN =
itself

If for whatever reason the child pid is zero, we would kill o= urselves
since killing 0 means killing the own process group.

Rep= orted-By: Joshua Rogers <contact@...2949...>
Found-By: ZeropathChange-Id: I7b94de92723f9528b01cb932bb079eedf0f1f272
Signed-off-by: Arn= e Schwabe <arne-openvpn@...1227...>
Acked-by: Gert Doering <ger= t@...1296...>
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/msg33910.htmlSigned-off-by: Gert Doering <gert@...1296...>
---
M src/openv= pn/tun_afunix.c
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/openvpn/tun_afunix.c b/src/openvpn/tun_afunix.c<=
br>index 4d48a31..124db6d 100644
--- a/src/openvpn/tu= n_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.childp= rocess)
+ {=
+ kill(tt->afunix= .childprocess, SIGINT);
+ }

free(tt->actual_name);<= /span>
free(tt);

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

<= meta itemprop=3D"name" content=3D"View Change"/>
Gerrit-MessageType: merged
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>
= --bFTABC2+rKk=--