From c2c08bfea9f0b67e5dc6d1bfb4965653311fefe3 Mon Sep 17 00:00:00 2001 From: rwatson Date: Sun, 20 Jun 2004 17:35:50 +0000 Subject: Annotate two intentionally unlocked reads with comments. Annotate a potentially inconsistent result returned to user space when performing fstaT() on a socket due to not using socket buffer locking. --- sys/kern/sys_socket.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'sys') diff --git a/sys/kern/sys_socket.c b/sys/kern/sys_socket.c index 986edf7..e59823c 100644 --- a/sys/kern/sys_socket.c +++ b/sys/kern/sys_socket.c @@ -170,6 +170,7 @@ soo_ioctl(fp, cmd, data, active_cred, td) return (0); case FIONREAD: + /* Unlocked read. */ *(int *)data = so->so_rcv.sb_cc; return (0); @@ -188,6 +189,7 @@ soo_ioctl(fp, cmd, data, active_cred, td) return (0); case SIOCATMARK: + /* Unlocked read. */ *(int *)data = (so->so_rcv.sb_state & SBS_RCVATMARK) != 0; return (0); } @@ -229,7 +231,11 @@ soo_stat(fp, ub, active_cred, td) /* * If SBS_CANTRCVMORE is set, but there's still data left in the * receive buffer, the socket is still readable. + * + * XXXRW: perhaps should lock socket buffer so st_size result + * is consistent. */ + /* Unlocked read. */ if ((so->so_rcv.sb_state & SBS_CANTRCVMORE) == 0 || so->so_rcv.sb_cc != 0) ub->st_mode |= S_IRUSR | S_IRGRP | S_IROTH; -- cgit v1.1