NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: kern/54435: reading TCP urgent data with MSG_OOB doesn't clear poll(2) status
The following reply was made to PR kern/54435; it has been noted by GNATS.
From: Taylor R Campbell <riastradh%NetBSD.org@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc:
Subject: Re: kern/54435: reading TCP urgent data with MSG_OOB doesn't clear poll(2) status
Date: Sat, 3 Aug 2019 19:37:34 +0000
This is a multi-part message in MIME format.
--=_zuStfGoWPMcVlXnvkpRI2k8NISfYH+LY
poll on a socket returns POLLPRI|POLLRDBAND as long as so->so_oobmark
is nonzero or so->so_state has SS_RCVATMARK is set.
- so_oobmark is the pointer to how many bytes away the urgent data are.
- SS_RCVATMARK is set when the urgent data are clamouring at the gate.
These are updated by normal reads, but not by the recv(MSG_OOB) call
that actually returns the urgent data.
Candidate fix: set so_oobmark = 0, clear SS_RCVATMARK when we do
recv(MSG_OOB).
--=_zuStfGoWPMcVlXnvkpRI2k8NISfYH+LY
Content-Type: text/plain; charset="ISO-8859-1"; name="oobfix"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment; filename="oobfix.patch"
From 8f07765d4d7f455359d1a4d131b4b9ad3973b224 Mon Sep 17 00:00:00 2001
From: Taylor R Campbell <riastradh%NetBSD.org@localhost>
Date: Sat, 3 Aug 2019 19:31:42 +0000
Subject: [PATCH] Clear the oobmark when we read oob data.
Candidate fix for spurious POLLPRI/POLLRDBAND availability after
recv(MSG_OOB) just consumed it.
---
sys/kern/uipc_socket.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c
index c89dc0f4d576..f19d86321a21 100644
--- a/sys/kern/uipc_socket.c
+++ b/sys/kern/uipc_socket.c
@@ -1179,6 +1179,9 @@ soreceive(struct socket *so, struct mbuf **paddr, str=
uct uio *uio,
MIN(uio->uio_resid, m->m_len), uio);
m =3D m_free(m);
} while (uio->uio_resid > 0 && error =3D=3D 0 && m);
+ /* We consumed the oob data, no more oobmark. */
+ so->so_oobmark =3D 0;
+ so->so_state &=3D ~SS_RCVATMARK;
bad:
if (m !=3D NULL)
m_freem(m);
--=_zuStfGoWPMcVlXnvkpRI2k8NISfYH+LY--
Home |
Main Index |
Thread Index |
Old Index