#
b9ae17a0 |
| 30-Dec-2024 |
guenther <guenther@openbsd.org> |
All the device and file type ioctl routines just ignore FIONBIO, so stop calling down into those layer from fcntl(F_SETFL) or ioctl(FIONBIO) and delete the "do nothing for this" stubs in all the *ioc
All the device and file type ioctl routines just ignore FIONBIO, so stop calling down into those layer from fcntl(F_SETFL) or ioctl(FIONBIO) and delete the "do nothing for this" stubs in all the *ioctl routines.
ok dlg@
show more ...
|
#
55a277b3 |
| 10-Nov-2024 |
bluhm <bluhm@openbsd.org> |
Lock send socket buffer for fstat syscall.
In soo_stat() lock send socket buffer mutex around access to sb_state. Althoug not strictly necessary as this is only a single read access, make clear wher
Lock send socket buffer for fstat syscall.
In soo_stat() lock send socket buffer mutex around access to sb_state. Althoug not strictly necessary as this is only a single read access, make clear where parallel variable access happens. As this is not performance critical, use mutex instead of read once wrapper. This is also consistent to the receive socket buffer a few lines above.
OK mvs@
show more ...
|
#
a6ba80fb |
| 30-Apr-2024 |
mvs <mvs@openbsd.org> |
Push solock() down to sosend() for SOCK_RAW sockets.
Raw sockets are the simplest inet sockets, so use them to start landing `sb_mtx' mutex(9) protection for `so_snd' buffer. Now solock() is taken
Push solock() down to sosend() for SOCK_RAW sockets.
Raw sockets are the simplest inet sockets, so use them to start landing `sb_mtx' mutex(9) protection for `so_snd' buffer. Now solock() is taken only around pru_send*(), the rest of sosend() serialized by sblock() and `sb_mtx'. The unlocked SS_ISCONNECTED check is fine, because rip{,6}_send() check it. Also, previously the SS_ISCONNECTED could be lost due to solock() release around following m_getuio().
ok bluhm
show more ...
|
#
510c9557 |
| 11-Apr-2024 |
mvs <mvs@openbsd.org> |
Take solock_shared() in soo_stat().
Only unix(4) and tcp(4) sockets set (*pru_sence)() handler. The rest of soo_stat() is the read only access.
ok bluhm
|
#
c80eb486 |
| 31-Mar-2024 |
mvs <mvs@openbsd.org> |
Mark `so_rcv' sockbuf of udp(4) sockets as SB_OWNLOCK.
sbappend*() and soreceive() of SB_MTXLOCK marked sockets uses `sb_mtx' mutex(9) for protection, meanwhile buffer usage check and corresponding
Mark `so_rcv' sockbuf of udp(4) sockets as SB_OWNLOCK.
sbappend*() and soreceive() of SB_MTXLOCK marked sockets uses `sb_mtx' mutex(9) for protection, meanwhile buffer usage check and corresponding sbwait() sleep still serialized by solock(). Mark udp(4) as SB_OWNLOCK to avoid solock() serialization and rely to `sb_mtx' mutex(9). The `sb_state' and `sb_flags' modifications must be protected by `sb_mtx' too.
ok bluhm
show more ...
|
#
02a82712 |
| 26-Mar-2024 |
mvs <mvs@openbsd.org> |
Use `sb_mtx' to protect `so_rcv' receive buffer of unix(4) sockets.
This makes re-locking unnecessary in the uipc_*send() paths, because it's enough to lock one socket to prevent peer from concurren
Use `sb_mtx' to protect `so_rcv' receive buffer of unix(4) sockets.
This makes re-locking unnecessary in the uipc_*send() paths, because it's enough to lock one socket to prevent peer from concurrent disconnection. As the little bonus, one unix(4) socket can perform simultaneous transmission and reception with one exception for uipc_rcvd(), which still requires the re-lock for connection oriented sockets.
The socket lock is not held while filt_soread() and filt_soexcept() called from uipc_*send() through sorwakeup(). However, the unlocked access to the `so_options', `so_state' and `so_error' is fine.
The receiving socket can't be or became listening socket. It also can't be disconnected concurrently. This makes immutable SO_ACCEPTCONN, SS_ISDISCONNECTED and SS_ISCONNECTED bits which are clean and set respectively.
`so_error' is set on the peer sockets only by unp_detach(), which also can't be called concurrently on sending socket.
This is also true for filt_fiforead() and filt_fifoexcept(). For other callers like kevent(2) or doaccept() the socket lock is still held.
ok bluhm
show more ...
|
#
3a5067a8 |
| 15-Apr-2023 |
kn <kn@openbsd.org> |
return directly to drop needless error variable; OK mvs
|
#
4b9bfff3 |
| 22-Jan-2023 |
mvs <mvs@openbsd.org> |
Move SS_CANTRCVMORE and SS_RCVATMARK bits from `so_state' to `sb_state' of receive buffer. As it was done for SS_CANTSENDMORE bit, the definition kept as is, but now these bits belongs to the `sb_sta
Move SS_CANTRCVMORE and SS_RCVATMARK bits from `so_state' to `sb_state' of receive buffer. As it was done for SS_CANTSENDMORE bit, the definition kept as is, but now these bits belongs to the `sb_state' of receive buffer. `sb_state' ored with `so_state' when socket data exporting to the userland.
ok bluhm@
show more ...
|
#
9e437519 |
| 21-Jan-2023 |
mvs <mvs@openbsd.org> |
Introduce per-sockbuf `sb_state' to use it with SS_CANTSENDMORE.
This time, socket's buffer lock requires solock() to be held. As a part of socket buffers standalone locking work, move socket state
Introduce per-sockbuf `sb_state' to use it with SS_CANTSENDMORE.
This time, socket's buffer lock requires solock() to be held. As a part of socket buffers standalone locking work, move socket state bits which represent its buffers state to per buffer state.
Opposing the previous reverted diff, the SS_CANTSENDMORE definition left as is, but it used only with `sb_state'. `sb_state' ored with original `so_state' when socket's data exported to the userland, so the ABI kept as it was.
Inputs from deraadt@.
ok bluhm@
show more ...
|
#
33da1efb |
| 12-Dec-2022 |
tb <tb@openbsd.org> |
Revert sb_state changes to unbreak tree.
|
#
cba97bf9 |
| 11-Dec-2022 |
mvs <mvs@openbsd.org> |
This time, socket's buffer lock requires solock() to be held. As a part of socket buffers standalone locking work, move socket state bits which represent its buffers state to per buffer state. Introd
This time, socket's buffer lock requires solock() to be held. As a part of socket buffers standalone locking work, move socket state bits which represent its buffers state to per buffer state. Introduce `sb_state' and turn SS_CANTSENDMORE to SBS_CANTSENDMORE. This bit will be processed on `so_snd' buffer only.
Move SS_CANTRCVMORE and SS_RCVATMARK bits with separate diff to make review easier and exclude possible so_rcv/so_snd mistypes.
Also, don't adjust the remaining SS_* bits right now.
ok millert@
show more ...
|
#
ceecbd6e |
| 19-Nov-2022 |
kn <kn@openbsd.org> |
Push kernel lock into pru_control() aka. in6_control() / in_control()
so->so_state is already read without kernel lock inside soo_ioctl() which calls pru_control() aka in6_control() and in_control()
Push kernel lock into pru_control() aka. in6_control() / in_control()
so->so_state is already read without kernel lock inside soo_ioctl() which calls pru_control() aka in6_control() and in_control().
OK mvs
show more ...
|
#
be2d4851 |
| 08-Nov-2022 |
kn <kn@openbsd.org> |
Push kernel lock down into ifioctl()
This is a mechanical diff without semantical changes, locking ioctls individually inside ifioctl() rather than all of them around it.
This allows us to unlock i
Push kernel lock down into ifioctl()
This is a mechanical diff without semantical changes, locking ioctls individually inside ifioctl() rather than all of them around it.
This allows us to unlock ioctls one by one.
OK mpi
show more ...
|
#
3f68dcd3 |
| 02-Sep-2022 |
mvs <mvs@openbsd.org> |
Move PRU_CONTROL request to (*pru_control)().
The 'proc *' arg is not used for PRU_CONTROL request, so remove it from pru_control() wrapper.
Split out {tcp,udp}6_usrreqs from {tcp,udp}_usrreqs and
Move PRU_CONTROL request to (*pru_control)().
The 'proc *' arg is not used for PRU_CONTROL request, so remove it from pru_control() wrapper.
Split out {tcp,udp}6_usrreqs from {tcp,udp}_usrreqs and use them for inet6 case.
ok guenther@ bluhm@
show more ...
|
#
0d280c5f |
| 14-Aug-2022 |
jsg <jsg@openbsd.org> |
remove unneeded includes in sys/kern ok mpi@ miod@
|
#
69690c9b |
| 13-Aug-2022 |
mvs <mvs@openbsd.org> |
Introduce the pru_*() wrappers for corresponding (*pr_usrreq)() calls.
This is helpful for the following (*pr_usrreq)() split to multiple handlers. But right now this makes code more readable.
Also
Introduce the pru_*() wrappers for corresponding (*pr_usrreq)() calls.
This is helpful for the following (*pr_usrreq)() split to multiple handlers. But right now this makes code more readable.
Also add '#ifndef _SYS_SOCKETVAR_H_' to sys/socketvar.h. This prevents the collisions when both sys/protosw.h and sys/socketvar.h are included together. Both 'socket' and 'protosw' structures are required to be defined before pru_*() wrappers, so we need to include sys/socketvar.h to sys/protosw.h.
ok bluhm@
show more ...
|
#
d3f5ce76 |
| 20-Jun-2022 |
visa <visa@openbsd.org> |
Remove unused struct fileops field fo_poll and callbacks.
OK mpi@
|
#
84245c07 |
| 06-Jun-2022 |
claudio <claudio@openbsd.org> |
Simplify solock() and sounlock(). There is no reason to return a value for the lock operation and to pass a value to the unlock operation. sofree() still needs an extra flag to know if sounlock() sho
Simplify solock() and sounlock(). There is no reason to return a value for the lock operation and to pass a value to the unlock operation. sofree() still needs an extra flag to know if sounlock() should be called or not. But sofree() is called less often and mostly without keeping the lock. OK mpi@ mvs@
show more ...
|
#
53224561 |
| 25-Feb-2022 |
guenther <guenther@openbsd.org> |
Reported-by: syzbot+1b5b209ce506db4d411d@syzkaller.appspotmail.com Revert the pr_usrreqs move: syzkaller found a NULL pointer deref and I won't be available to monitor for followup issues for a bit
|
#
80ceac19 |
| 25-Feb-2022 |
guenther <guenther@openbsd.org> |
Move pr_attach and pr_detach to a new structure pr_usrreqs that can then be shared among protosw structures, following the same basic direction as NetBSD and FreeBSD for this.
Split PRU_CONTROL out
Move pr_attach and pr_detach to a new structure pr_usrreqs that can then be shared among protosw structures, following the same basic direction as NetBSD and FreeBSD for this.
Split PRU_CONTROL out of pr_usrreq into pru_control, giving it the proper prototype to eliminate the previously necessary casts.
ok mvs@ bluhm@
show more ...
|
#
da571ddd |
| 24-Oct-2021 |
jsg <jsg@openbsd.org> |
use NULL not 0 for pointer values in kern ok semarie@
|
#
073f1883 |
| 07-Jun-2021 |
mpi <mpi@openbsd.org> |
Kill SS_ASYNC and only check SB_ASYNC when async signals are wanted.
This socket flag was redundant with the socket buffer one.
ok mvs@
|
#
60e616d4 |
| 22-Feb-2020 |
anton <anton@openbsd.org> |
In preparation for unlocking ioctl(2), grab the kernel lock as needed.
ok kettenis@ mpi@ visa@
|
#
36b1b8b4 |
| 08-Jan-2020 |
visa <visa@openbsd.org> |
Unify handling of ioctls FIOSETOWN/SIOCSPGRP/TIOCSPGRP and FIOGETOWN/SIOCGPGRP/TIOCGPGRP. Do this by determining the meaning of the ID parameter inside the sigio code. Also add cases for FIOSETOWN an
Unify handling of ioctls FIOSETOWN/SIOCSPGRP/TIOCSPGRP and FIOGETOWN/SIOCGPGRP/TIOCGPGRP. Do this by determining the meaning of the ID parameter inside the sigio code. Also add cases for FIOSETOWN and FIOGETOWN where there have been TIOCSPGRP and TIOCGPGRP before. These changes allow removing the ID translation from sys_fcntl() and sys_ioctl().
Idea from NetBSD
OK mpi@, claudio@
show more ...
|
#
c02bfb27 |
| 05-Jan-2020 |
visa <visa@openbsd.org> |
Constify instances of struct fileops.
OK anton@, mpi@, bluhm@
|