Date: Sun, 22 Nov 1998 16:45:42 -0800 (PST) From: Don Lewis <truckman@FreeBSD.ORG> To: cvs-committers@FreeBSD.ORG, cvs-all@FreeBSD.ORG Subject: cvs commit: src/sys/kern uipc_socket2.c uipc_syscalls.c Message-ID: <199811230045.QAA04343@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
truckman 1998/11/22 16:45:42 PST
Modified files:
sys/kern uipc_socket2.c uipc_syscalls.c
Log:
We can't call fsetown() from sonewconn() because sonewconn() is be called
from an interrupt context and fsetown() wants to peek at curproc, call
malloc(..., M_WAITOK), and fiddle with various unprotected data structures.
The fix is to move the code that duplicates the F_SETOWN/FIOSETOWN state
of the original socket to the new socket from sonewconn() to accept1(),
since accept1() runs in the correct context. Deferring this until the
process calls accept() is harmless since the process can't do anything
useful with SIGIO on the new socket until it has the descriptor for that
socket.
One could make the case for not bothering to duplicate the
F_SETOWN/FIOSETOWN state and requiring the process to explicitly make the
fcntl() or ioctl() call on the new socket, but this would be incompatible
with the previous implementation and might break programs which rely on
the old semantics.
This bug was discovered by Andrew Gallatin <gallatin@cs.duke.edu>.
Revision Changes Path
1.42 +1 -2 src/sys/kern/uipc_socket2.c
1.47 +3 -1 src/sys/kern/uipc_syscalls.c
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199811230045.QAA04343>
