Find a file
Mark Johnston 61a14ddfe0 unix: Fix a lock order reveral
Running the test suite yields:

lock order reversal:
 1st 0xfffff80004bc6700 unp (unp, sleep mutex) @ sys/kern/uipc_usrreq.c:390
 2nd 0xffffffff81a94b30 unp_link_rwlock (unp_link_rwlock, rw) @ sys/kern/uipc_usrreq.c:2934
lock order unp -> unp_link_rwlock attempted at:
0xffffffff80bc216e at witness_checkorder+0xbbe
0xffffffff80b493a5 at _rw_wlock_cookie+0x65
0xffffffff80c0a8e2 at unp_discard+0x22
0xffffffff80c0a888 at unp_freerights+0x38
0xffffffff80c09fdd at unp_scan+0x9d
0xffffffff80c0f9a7 at uipc_sosend_dgram+0x727
0xffffffff80c00a79 at sousrsend+0x79
0xffffffff80c072d0 at kern_sendit+0x1c0
0xffffffff80c074d7 at sendit+0xb7
0xffffffff80c076f3 at sys_sendmsg+0x63
0xffffffff8104d957 at amd64_syscall+0x6b7
0xffffffff8101f9eb at fast_syscall_common+0xf8

This happens when uipc_sosend_dgram() discards a control message because
the receive socket buffer is full.  The overflow handling frees
internalized file references in the socket buffer before freeing mbufs.
It does this with socket PCBs locked, leading to the LOR.  Defer
handling of file references until the PCBs are unlocked.

Reviewed by:	glebius
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D41884
2023-09-27 08:29:34 -04:00
.cirrus-ci Cirrus-CI: add some timing info on pkg install failure 2021-08-04 15:02:00 -04:00
.github MAINTAINERS: Add myself to stand 2023-05-07 22:30:10 -06:00
bin sh: implement PS1 \D to print current time 2023-09-23 20:26:45 +02:00
cddl zfs: merge openzfs/zfs@2e2a46e0a 2023-09-24 23:58:34 +02:00
contrib Add zfs_prepare_disk script for disk firmware install 2023-09-21 08:36:26 -07:00
crypto openssl: document the update process 2023-09-25 11:43:58 -04:00
etc printenv: Add test for printenv. 2023-09-25 10:10:20 -06:00
gnu Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
include Linux 6.6 compat: generic_fillattr has a new u32 request_mask added at arg2 2023-09-21 18:38:40 -07:00
kerberos5 Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
lib libc: Add a rudimentary test for quick_exit(3). 2023-09-26 22:07:10 +02:00
libexec Purge more stray embedded $FreeBSD$ strings 2023-09-25 07:54:56 -07:00
release powerpc/generate-hfs.sh: Don't include $FreeBSD$ in prefix to uuencoded image 2023-09-25 07:55:18 -07:00
rescue zfs: merge openzfs/zfs@804414aad 2023-08-26 23:51:42 +02:00
sbin Purge more stray embedded $FreeBSD$ strings 2023-09-25 07:54:56 -07:00
secure libcrypto: Copy the arm64 header when building asm 2023-09-22 18:15:13 +01:00
share arch.7: fix final 12.x release as 12.4 2023-09-26 18:00:42 -04:00
stand Purge more stray embedded $FreeBSD$ strings 2023-09-25 07:54:56 -07:00
sys unix: Fix a lock order reveral 2023-09-27 08:29:34 -04:00
targets Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
tests tests/block_cloning: try harder to stay on same txg in fallback test 2023-09-21 17:54:15 -07:00
tools stress2: Extent timeout limit to avoid false positive errors 2023-09-27 13:01:00 +02:00
usr.bin dtc: Sync with upstream commit 26a0fe5 2023-09-26 12:59:17 -04:00
usr.sbin Explain the -d option. 2023-09-26 15:05:16 +10:00
.arcconfig arcanist: use FreeBSD/git project repository instead of FreeBSD/svn 2022-08-23 14:16:41 +00:00
.arclint
.cirrus.yml Cirrus-CI: restore amd64-gcc12 build/test on main 2023-08-18 22:35:39 -04:00
.clang-format Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
.git-blame-ignore-revs Add git-blame ignore file 2023-01-23 15:27:25 -05:00
.gitattributes Add a basic clang-format configuration file 2019-06-07 15:23:52 +00:00
.gitignore .gitignore: Ignore LSP generated .cache 2023-03-07 10:04:18 -05:00
.mailmap .mailmap: normalize Mina's name in correct email case as well 2023-09-21 23:26:45 +02:00
CONTRIBUTING.md CONTRIBUTING.md: add author identity info 2023-09-20 19:28:28 -04:00
COPYRIGHT Happy New Year 2023! 2023-01-01 13:44:43 +08:00
LOCKS Remove $FreeBSD$: one-line bare tag 2023-08-16 11:55:20 -06:00
MAINTAINERS Remove $FreeBSD$: one-line bare tag 2023-08-16 11:55:20 -06:00
Makefile Makefile: Support universe-toolchain on non-FreeBSD 2023-08-23 18:00:16 +01:00
Makefile.inc1 libcrypto: link engines and the legacy provider to libcrypto 2023-09-16 16:55:12 +01:00
Makefile.libcompat build{libcompat}: Pass UNIVERSE_TOOLCHAIN_PATH to the _lc_build-tools submake 2023-08-21 21:00:45 -07:00
Makefile.sys.inc Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
ObsoleteFiles.inc Retire old diskless setup scripts 2023-09-25 07:46:21 -07:00
README.md README.md: link to the list of supported platforms 2022-11-01 12:20:55 -03:00
RELNOTES Fix typo in RELNOTES (objump -> objdump) 2023-09-18 11:04:21 +01:00
UPDATING UPDATING: add entry for the new loader tunnable net.pf.default_to_drop 2023-09-22 18:19:33 +08:00

FreeBSD Source:

This is the top level of the FreeBSD source directory.

FreeBSD is an operating system used to power modern servers, desktops, and embedded platforms. A large community has continually developed it for more than thirty years. Its advanced networking, security, and storage features have made FreeBSD the platform of choice for many of the busiest web sites and most pervasive embedded networking and storage devices.

For copyright information, please see the file COPYRIGHT in this directory. Additional copyright information also exists for some sources in this tree - please see the specific source directories for more information.

The Makefile in this directory supports a number of targets for building components (or all) of the FreeBSD source tree. See build(7), config(8), FreeBSD handbook on building userland, and Handbook for kernels for more information, including setting make(1) variables.

For information on the CPU architectures and platforms supported by FreeBSD, see the FreeBSD website's Platforms page.

Source Roadmap:

Directory Description
bin System/user commands.
cddl Various commands and libraries under the Common Development and Distribution License.
contrib Packages contributed by 3rd parties.
crypto Cryptography stuff (see crypto/README).
etc Template files for /etc.
gnu Commands and libraries under the GNU General Public License (GPL) or Lesser General Public License (LGPL). Please see gnu/COPYING and gnu/COPYING.LIB for more information.
include System include files.
kerberos5 Kerberos5 (Heimdal) package.
lib System libraries.
libexec System daemons.
release Release building Makefile & associated tools.
rescue Build system for statically linked /rescue utilities.
sbin System commands.
secure Cryptographic libraries and commands.
share Shared resources.
stand Boot loader sources.
sys Kernel sources (see sys/README.md).
targets Support for experimental DIRDEPS_BUILD
tests Regression tests which can be run by Kyua. See tests/README for additional information.
tools Utilities for regression testing and miscellaneous tasks.
usr.bin User commands.
usr.sbin System administration commands.

For information on synchronizing your source tree with one or more of the FreeBSD Project's development branches, please see FreeBSD Handbook.