Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 11 Mar 2022 13:21:43 +0100
From:      Alexander Leidinger <Alexander@leidinger.net>
To:        net@freebsd.org, jails@freebsd.org
Subject:   Logging jid and uid for listen queue overflow? (resend)
Message-ID:  <20220311132143.Horde.JhU6vehr3ihMGo93zIP0MN7@webmail.leidinger.net>

next in thread | raw e-mail | index | archive | help
This message is in MIME format and has been PGP signed.

--=_opYhSpos5neXsfnlSa4U3kx
Content-Type: text/plain; charset=utf-8; format=flowed; DelSp=Yes
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hi,

sorry jails@ resend after subscription to net@ to have this mail not reject=
ed.

Any opinion about logging the jid and uid in case a jailed process is=20=20
causing=20listen queue overflows? Any strong objections about committing=20=
=20
something=20like this?

Code (tabs are most probably mangled up):
---snip---
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c
index ab8e5d6e1b6..8fba46d7d03 100644
--- a/sys/kern/uipc_socket.c
+++ b/sys/kern/uipc_socket.c
@@ -699,12 +699,24 @@ sonewconn(struct socket *head, int connstatus)
                          }
                          KASSERT(sbuf_len(&descrsb) > 0,
                              ("%s: sbuf creation failed", __func__));
-                       log(LOG_DEBUG,
-                           "%s: pcb %p (%s): Listen queue overflow: "
-                           "%i already in queue awaiting acceptance "
-                           "(%d occurrences)\n",
-                           __func__, head->so_pcb, sbuf_data(&descrsb),
-                           qlen, overcount);
+                       if (head->so_cred =3D=3D 0) {
+                               log(LOG_DEBUG,
+                               "%s: pcb %p (%s): Listen queue overflow: "
+                               "%i already in queue awaiting acceptance "
+                               "(%d occurrences)\n",
+                               __func__, head->so_pcb, sbuf_data(&descrsb)=
,
+                               qlen, overcount);
+                       } else {
+                               log(LOG_DEBUG, "%s: pcb %p (%s):=20=20
Listen=20queue overflow: "
+                                   "%i already in queue awaiting acceptanc=
e "
+                                   "(%d occurrences), euid %d, rgid=20=20
%d,=20jail %s\n",
+                                   __func__, head->so_pcb,=20=20
sbuf_data(&descrsb),
+=20                                  qlen, overcount,
+                                   head->so_cred->cr_uid,=20=20
head->so_cred->cr_rgid,
+=20                                  head->so_cred->cr_prison ?
+                                       head->so_cred->cr_prison->pr_name :
+                                       "not_jailed");
+                       }
                          sbuf_delete(&descrsb);

                          overcount =3D 0;
---snip---

--=20
http://www.Leidinger.net=20Alexander@Leidinger.net: PGP 0x8F31830F9F2772BF
http://www.FreeBSD.org    netchild@FreeBSD.org  : PGP 0x8F31830F9F2772BF

--=20
http://www.Leidinger.net=20Alexander@Leidinger.net: PGP 0x8F31830F9F2772BF
http://www.FreeBSD.org    netchild@FreeBSD.org  : PGP 0x8F31830F9F2772BF

--=_opYhSpos5neXsfnlSa4U3kx
Content-Type: application/pgp-signature
Content-Description: Digitale PGP-Signatur
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIzBAABCAAdFiEER9UlYXp1PSd08nWXEg2wmwP42IYFAmIrPtYACgkQEg2wmwP4
2IbsMw/+LEq5EyADztfO0AEdWjgpJwKeWwN11p/OBfz5cxfS4TR2Mps8WFV/UZeH
/h7eEAxmAQOws2O7KjCf94WK21EZB9h8a4y8vCRh9JXWdrKbESMA8emntEuwoq9c
QotsZxOV9OlDP96I1dj273gL4t36/Vy1DP7JvdX0ZREKj5RKQYH/QxcnJbKMpfel
HPzYpaMxu4hIvOQkCAusKXmJV4rayqFbQmts81IGlqhGcgMS3QWX1KY7ZtwG+NOG
B+s/1tKa1FNMyw3AUjEDP1PIGrPYP8MmUrvqq0xV2bewNh+6/UauCLbJCbNSWX8R
iQ/EkxrrpWShxfPrb6rfyS7hHHdWlOHWHMWUJvy2cgX6P37Z4R46gt/sBXr9UOUe
WAEx4C8tHWEoHbKVzgKaDwJvplFLoGR/Grx2fyKq32x9vGFZLtmSgqpHuaA1f7W0
81nW8nr07M4vARA0fnvAiuLOlUS0hsyjUFzEksEV+ooNXiYqU0LdGU0oFTEOseib
19JNJZ6kxadn1BnLtMC5lb4t1IFJa/b8fXRJT/qyYEb6gpJP3q3KPqeb3BVKsPzu
QuQ8V9hxMhjw5A4wNNACcUo0lOCklycizjdmW19eNGEspZ9mhAzSYDTNos4NosiX
rRhwiDXP4NMEUuQnfeJoLP8go4Pxwm08rB69YNHXH1FYhgkpceo=
=7QAF
-----END PGP SIGNATURE-----

--=_opYhSpos5neXsfnlSa4U3kx--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20220311132143.Horde.JhU6vehr3ihMGo93zIP0MN7>