1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-09 13:42:56 +00:00
freebsd/sys/sys
Mark Johnston 74a68313b5 socket: Add macros to lock socket buffers using socket references
Since commit c67f3b8b78 the sockbuf
mutexes belong to the containing socket.  Sockbufs contain a pointer to
a mutex, which by default is initialized to the corresponding mutexes in
the socket.  The SOCKBUF_LOCK() etc. macros operate on this pointer.
However, the pointer is clobbered by listen(2) so it's not safe to use
them unless one is sure that the socket is not a listening socket.

This change introduces a new set of macros which lock socket buffers
through the socket.  This is a bit cheaper since it removes the pointer
indirection, and allows one to safely lock socket buffers and then check
for a listening socket.

For MFC, these macros should be reimplemented in terms of the existing
socket buffer layout.

Reviewed by:	tuexen, gallatin, jhb
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D31900
2021-09-10 17:20:39 -04:00
..
disk
_atomic64e.h
_atomic_subword.h
_bitset.h
_blockcount.h
_bus_dma.h
_callout.h
_clock_id.h clock_id: These symbols weren't in 4.4BSD, adjust copyright 2021-08-02 15:50:32 -06:00
_cpuset.h
_domainset.h
_endian.h Consolidate machine/endian.h definitions 2021-03-26 19:00:22 -03:00
_eventhandler.h
_ffcounter.h
_iovec.h
_lock.h
_lockmgr.h lockmgr: shrink struct lock by 8 bytes on LP64 2021-02-15 13:57:25 +00:00
_mutex.h
_null.h
_pctrie.h
_pthreadtypes.h
_rangeset.h Remove "All Rights Reserved" from FreeBSD Foundation sys/ copyrights 2021-08-08 10:42:24 -04:00
_rmlock.h
_rwlock.h
_semaphore.h
_seqc.h
_sigset.h
_smr.h
_sockaddr_storage.h
_stack.h
_stdarg.h
_stdint.h
_sx.h
_task.h
_termios.h termios: add more speeds 2021-03-18 10:44:01 +00:00
_timespec.h
_timeval.h
_types.h Reduce code duplication in machine/_types.h 2021-06-14 16:30:16 +01:00
_ucontext.h
_uio.h
_umtx.h Revert most of ce42e79310 2021-07-28 13:21:12 +03:00
_unrhdr.h
_winsize.h
aac_ioctl.h
abi_compat.h
acct.h
acl.h libc/posix1e: Add acl_extended_file_np() function. 2021-08-27 11:52:26 +03:00
agpio.h
aio.h lio_listio(2): Allow LIO_READV and LIO_WRITEV. 2021-08-22 23:00:42 +12:00
alq.h
apm.h
arb.h
asan.h kasan: Use vm_offset_t for the first parameter to kasan_shadow_map() 2021-04-29 11:39:02 -04:00
assym.h genoffset: simplify and rewrite in sh 2021-07-28 13:50:09 -06:00
ata.h
atomic_common.h Remove "All Rights Reserved" from FreeBSD Foundation sys/ copyrights 2021-08-08 10:42:24 -04:00
atomic_san.h Simplify kernel sanitizer interceptors 2021-07-29 21:13:32 -04:00
auxv.h
backlight.h
bio.h
bitset.h
bitstring.h bitstring(3): Add bitstring traversal macros. 2021-08-16 23:24:05 +03:00
blist.h
blockcount.h
boot.h
buf_ring.h Minor style tidy: if( -> if ( 2021-04-18 11:19:15 -06:00
buf.h vnode: move write cluster support data to inodes. 2021-02-21 11:38:21 +02:00
bufobj.h
bus_dma_internal.h
bus_dma.h
bus_san.h Simplify kernel sanitizer interceptors 2021-07-29 21:13:32 -04:00
bus.h newbus: Move from bus_child_{pnpinfo,location}_src to bus_child_{pnpinfo,location} with sbuf 2021-06-22 20:52:06 -06:00
busdma_bufalloc.h
callout.h
caprights.h Remove "All Rights Reserved" from FreeBSD Foundation sys/ copyrights 2021-08-08 10:42:24 -04:00
capsicum.h
cdefs.h cdefs.h: Remove redundant #ifdefs 2021-09-07 09:51:48 -06:00
cdio.h
cdrio.h
cfictl.h
chio.h
ck.h sys/ck.h: Add an include guard 2021-03-21 11:55:52 -07:00
clock.h
cnv.h
compressor.h
condvar.h
conf.h netdump: send key before dump, in case dump fails 2021-08-11 10:54:56 -05:00
cons.h Re-implement virtual console (constty). 2021-09-03 22:18:51 -04:00
consio.h
copyright.h
counter.h
coverage.h
cpu.h
cpuctl.h
cpuset.h iflib: Improve mapping of TX/RX queues to CPUs 2021-04-26 01:06:34 -04:00
csan.h
ctype.h
devctl.h
devicestat.h
devmap.h
dirent.h
disk_zone.h
disk.h
disklabel.h
diskmbr.h
dkstat.h
dnv.h Remove "All Rights Reserved" from FreeBSD Foundation sys/ copyrights 2021-08-08 10:42:24 -04:00
domain.h domain: make it safer to add domains post-domainfinalize 2021-08-16 00:59:56 -05:00
domainset.h domainset: Define additional global policies 2021-04-14 13:03:33 -04:00
dtrace_bsd.h
dvdio.h
efi.h EFI RT: resurrect EFIIOC_GET_TABLE 2021-07-03 20:06:48 +03:00
efiio.h EFI RT: resurrect EFIIOC_GET_TABLE 2021-07-03 20:06:48 +03:00
elf32.h
elf64.h
elf_common.h elf: Remove R_RISCV_[GT]PREL_[IS] relocation defines 2021-07-20 06:13:43 +01:00
elf_generic.h Add ElfW() macro for compatibility with Linux 2021-08-06 20:50:32 +02:00
elf.h
endian.h
epoch.h The old thread priority must be stored as part of the EPOCH(9) tracker. 2021-05-23 10:53:25 +02:00
errno.h
eui64.h
event.h kqueue: drain kqueue taskqueue if syscall tickled it 2021-09-07 02:43:34 +03:00
eventfd.h
eventhandler.h Minor style cleanup 2021-04-18 11:14:17 -06:00
eventvar.h
exec.h Refactor core dumping code a bit 2021-05-22 09:59:00 +01:00
extattr.h
fail.h
fbio.h fbio: Use appropriate types for the physical and virtual framebuffer address 2021-02-19 20:55:54 -03:00
fcntl.h Add fspacectl(2), vn_deallocate(9) and VOP_DEALLOCATE(9). 2021-08-05 23:20:42 +08:00
fdcio.h
file.h Add fspacectl(2), vn_deallocate(9) and VOP_DEALLOCATE(9). 2021-08-05 23:20:42 +08:00
filedesc.h open(2): Implement O_PATH 2021-04-15 12:48:24 +03:00
filio.h
firmware.h
fnv_hash.h
font.h Remove "All Rights Reserved" from FreeBSD Foundation sys/ copyrights 2021-08-08 10:42:24 -04:00
gmon.h
gpio.h Fix build of stand/usb . 2021-04-12 16:13:33 +02:00
gpt.h
gsb_crc32.h
gtaskqueue.h
hash.h
hhook.h
iconv.h
imgact_aout.h
imgact_binmisc.h
imgact_elf.h Add a link to the Elf_Brandinfo into the struc proc. 2021-06-29 20:15:08 +03:00
imgact.h
interrupt.h Use the word "LinuxKPI" instead of "Linux compatibility", to not confuse with 2021-03-10 12:35:16 +01:00
intr.h kern/intr: declare interrupt vectors unsigned 2021-05-03 13:24:30 -04:00
ioccom.h ioccom: define ioctl cmd value that can never be valid 2021-04-30 17:43:45 +03:00
ioctl_compat.h
ioctl.h
iov_schema.h
iov.h
ipc.h
ipmi.h
jail.h Fix some common typos in source code comments 2021-08-14 08:55:58 +02:00
joystick.h
kbio.h
kcov.h
kdb.h Introduce kdb-level watchpoint functions 2021-03-29 12:05:43 -03:00
kenv.h kenv: allow listing of static kernel environments 2021-07-18 23:06:19 -05:00
kern_prefetch.h
kernel.h config_intrhook: provide config_intrhook_drain 2021-03-11 09:45:10 -07:00
kerneldump.h
khelp.h
kobj.h newbus: style nit: use while<space>(0) 2021-04-17 23:46:18 -06:00
kpilite.h Use atomic_interrupt_fence() instead of bare __compiler_membar() 2021-02-28 01:27:29 +02:00
ksem.h
kthread.h
ktls.h ktls: Support asynchronous dispatch of AEAD ciphers. 2021-08-30 13:11:52 -07:00
ktr_class.h
ktr.h Minor style cleanup 2021-04-18 11:14:17 -06:00
ktrace.h Fix a braino in previous. 2021-05-22 19:53:40 +00:00
libkern.h Simplify kernel sanitizer interceptors 2021-07-29 21:13:32 -04:00
limits.h
link_aout.h
link_elf.h
linker_set.h linker_set: Disable ASAN only in userspace 2021-05-07 14:31:08 -04:00
linker.h link_elf_obj: Invoke fini callbacks 2021-07-29 09:46:25 -04:00
lock_profile.h lockprof: pass lock type as an argument instead of reading the spin flag 2021-05-23 17:55:27 +00:00
lock.h
lockf.h
lockmgr.h
lockstat.h lockprof: pass lock type as an argument instead of reading the spin flag 2021-05-23 17:55:27 +00:00
loginclass.h
mac.h
malloc.h Remove bzero declaration 2021-08-23 18:38:05 +00:00
mbuf.h Introduce m_get3() 2021-08-18 08:48:27 +02:00
mchain.h
md4.h
md5.h
mdioctl.h
memdesc.h
memrange.h
mman.h
module_khelp.h
module.h
mount.h VFS: add retry limit and delay for failed recursive unmounts 2021-08-20 13:20:50 -07:00
mouse.h
mpt_ioctl.h
mqueue.h
msan.h kmsan: Export kmsan_mark_mbuf() and kmsan_mark_bio() 2021-08-11 16:33:41 -04:00
msg.h
msgbuf.h
mtio.h
mutex.h lockprof: pass lock type as an argument instead of reading the spin flag 2021-05-23 17:55:27 +00:00
namei.h namei: Add cn_flags bits for OPENREAD and OPENWRITE 2021-08-06 18:41:11 -07:00
nlist_aout.h
nv.h
osd.h
param.h Bump __FreeBSD_version for the recent socket KPI changes 2021-09-07 17:14:36 -04:00
pciio.h pci: Add an ioctl to perform I/O to BARs 2021-08-14 10:59:03 -04:00
pcpu.h Minor style cleanup 2021-04-18 11:14:17 -06:00
pctrie.h
physmem.h
pidctrl.h
pipe.h Remove #define _KERNEL hacks from libprocstat 2021-02-21 11:38:21 +02:00
pmc.h hwpmc: Move 4 bits of mode to extend class size to 8 2021-05-26 18:40:58 +00:00
pmckern.h
pmclog.h
poll.h poll(2): Add POLLRDHUP. 2021-04-28 23:00:31 +12:00
posix4.h
power.h
priority.h
priv.h base: remove if_wg(4) and associated utilities, manpage 2021-03-17 09:14:48 -05:00
prng.h
proc.h kqueue: drain kqueue taskqueue if syscall tickled it 2021-09-07 02:43:34 +03:00
procctl.h procctl(2): add PROC_NO_NEW_PRIVS_CTL, PROC_NO_NEW_PRIVS_STATUS 2021-07-01 09:42:07 +01:00
procdesc.h
procfs.h
protosw.h uipc: create dedicated lists for fast and slow timeout callbacks 2021-08-17 21:56:05 +02:00
ptio.h
ptrace.h sys_process.c: extract ptrace_unsuspend() 2021-05-25 18:22:27 +03:00
qmath.h Minor style cleanup 2021-04-18 11:14:17 -06:00
queue.h
racct.h
random.h
rangelock.h
rangeset.h Remove "All Rights Reserved" from FreeBSD Foundation sys/ copyrights 2021-08-08 10:42:24 -04:00
rctl.h
reboot.h
refcount.h
reg.h Create sys/reg.h for the common code previously in machine/reg.h 2021-08-30 12:50:53 +01:00
regression.h
resource.h
resourcevar.h Fix up macro use in lim_cur 2021-05-29 22:04:09 +00:00
rman.h
rmlock.h rmlock(9): add an RM_DUPOK flag 2021-04-12 11:42:21 -03:00
rtprio.h
runq.h
rwlock.h
sbuf.h Export sbuf_drain to orchestrate lock and drain action 2021-03-31 19:17:37 +02:00
sched.h Use atomic_interrupt_fence() instead of bare __compiler_membar() 2021-02-28 01:27:29 +02:00
sdt.h
select.h
selinfo.h
sem.h
sema.h
seqc.h seqc: add symbolic name for in-modify bit 2021-06-23 23:46:15 +03:00
serial.h
sf_buf.h
sglist.h sglist: Add sglist_append_single_mbuf(). 2021-05-25 16:59:18 -07:00
shm.h
sigio.h
signal.h Pass the syscall number to capsicum permission-denied signals 2021-07-16 18:06:44 +01:00
signalvar.h Minor style cleanup 2021-04-18 11:14:17 -06:00
sleepqueue.h Allow sleepq_signal() to drop the lock. 2021-06-25 14:12:21 -04:00
slicer.h
smp.h Refactor/optimize cpu_search_*(). 2021-07-28 22:00:29 -04:00
smr_types.h
smr.h
sndstat.h sndstat: nvlist schema and API definition changes 2021-04-21 16:19:15 +08:00
snoop.h
sockbuf.h socket: Add macros to lock socket buffers using socket references 2021-09-10 17:20:39 -04:00
socket.h socket: Implement SO_RERROR 2021-07-28 09:35:09 -07:00
socketvar.h socket: Add macros to lock socket buffers using socket references 2021-09-10 17:20:39 -04:00
sockio.h
sockopt.h
soundcard.h Fix a few typos in comments 2021-03-13 16:37:28 +01:00
specialfd.h
spigenio.h
stack.h Minor style cleanup 2021-04-18 11:14:17 -06:00
stat.h
stats.h
statvfs.h
stdatomic.h
stddef.h Reduce code duplication in machine/_types.h 2021-06-14 16:30:16 +01:00
stdint.h
sx.h
syscall.h Regen after 0dc332bff2 2021-08-05 23:22:02 +08:00
syscall.mk Regen after 0dc332bff2 2021-08-05 23:22:02 +08:00
syscallsubr.h Add fspacectl(2), vn_deallocate(9) and VOP_DEALLOCATE(9). 2021-08-05 23:20:42 +08:00
sysctl.h
sysent.h fork: Allow ABI to specify fork return values for child. 2021-08-12 11:45:25 +03:00
syslimits.h
syslog.h
sysproto.h Regen after 0dc332bff2 2021-08-05 23:22:02 +08:00
systm.h Remove bcopy declaration 2021-08-24 11:24:08 +00:00
taskqueue.h taskqueue: Add missing comma to TASKQUEUE_FAST_DEFINE_THREAD 2021-05-24 20:37:55 -07:00
terminal.h Remove "All Rights Reserved" from FreeBSD Foundation sys/ copyrights 2021-08-08 10:42:24 -04:00
termios.h
thr.h
tiio.h
tim_filter.h
time.h time.h: reduce CLOCK_ namespace pollution, move to _clock_id.h 2021-07-30 17:20:22 -06:00
timeb.h
timeet.h
timeffc.h
timepps.h Remove "All Rights Reserved" from FreeBSD Foundation sys/ copyrights 2021-08-08 10:42:24 -04:00
timers.h Stop arming realtime posix process timers on suspend or terminate 2021-04-09 23:42:51 +03:00
times.h
timespec.h
timetc.h
timex.h
tree.h Minor style tidy: if( -> if ( 2021-04-18 11:19:15 -06:00
tslog.h
tty.h
ttycom.h
ttydefaults.h
ttydevsw.h
ttydisc.h
ttyhook.h
ttyqueue.h
turnstile.h
types.h Rename struct device to struct _device 2021-04-12 09:32:30 -04:00
ucontext.h
ucred.h
uio.h
umtx.h umtx: Split umtx.h on two counterparts. 2021-07-29 12:41:29 +03:00
umtxvar.h umtx: Add new pi_futex type. 2021-07-29 12:48:34 +03:00
un.h
unistd.h Add fspacectl(2), vn_deallocate(9) and VOP_DEALLOCATE(9). 2021-08-05 23:20:42 +08:00
unpcb.h
user.h Fix some common typos in comments 2021-08-08 10:16:06 +02:00
utsname.h
uuid.h
vdso.h
vmem.h
vmmeter.h
vnode.h VOP_COPY_FILE_RANGE: Add a COPY_FILE_RANGE_TIMEO1SEC flag 2021-09-07 17:35:26 -07:00
vtoc.h
wait.h
watchdog.h