From: "plaisthos (Code Review)" Date: Mon, 27 Oct 2025 21:10:34 +0000 References: Reply-To: arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="Ml1HThSfLKs="; 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: flichtenheld Cc: openvpn-devel --Ml1HThSfLKs= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Attention is currently required from: flichtenheld. Hello flichtenheld, I'd like you to do a code review. Please visit http://gerrit.openvpn.net/c/openvpn/+/1319?usp=3Demail to review the following change. 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: contact@...2949... Found-By: Zeropath Change-Id: I7b94de92723f9528b01cb932bb079eedf0f1f272 --- 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/1 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: newchange Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I7b94de92723f9528b01cb932bb079eedf0f1f272 Gerrit-Change-Number: 1319 Gerrit-PatchSet: 1 Gerrit-Owner: plaisthos Gerrit-Reviewer: flichtenheld Gerrit-CC: openvpn-devel Gerrit-Attention: flichtenheld --Ml1HThSfLKs= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is cur= rently required from: flichtenheld.

plaisthos would like flichtenheld to review this change.

V= iew Change

Avoid possible race condition that kill Ope=
nVPN itself

If for whatever reason the child pid is zero, we would k= ill ourselves
since killing 0 means killing the own process group.
Reported-By: contact@...2949...
Found-By: Zeropath
Change-Id: I7b94= de92723f9528b01cb932bb079eedf0f1f272
---
M src/openvpn/tun_afunix.c1 file changed, 6 insertions(+), 1 deletion(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/19/1319/1
<=
span>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, SIGIN= T);
+ /* only kill= the child process if the PID is not 0 to avoid killing
+ * ourselves by accident */<= br>+ if (tt->afunix.child= process)
+ {

+ kill(tt->afuni= x.childprocess, SIGINT);
+ }

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

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

<= div itemscope itemtype=3D"http://schema.org/EmailMessage">
<= meta itemprop=3D"name" content=3D"View Change"/>
Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I7b94de92723f9528b01cb932bb0= 79eedf0f1f272
Gerrit-Change-Number: 1319
Gerrit-PatchSet: 1
Gerrit-Owner: plaisthos <arne-openvpn@...1711...= 27...>
Gerrit-Reviewer: flichtenheld <frank@...2716...= 1...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-Attention: flichtenheld <frank@...2375...= 41...>
= --Ml1HThSfLKs=--