freebsd-src/sys
Stefan Eßer 445d3d227e msdosfs: fix potential inode collision on FAT12 and FAT16
FAT file systems do not use inodes, instead all file meta-information
is stored in directory entries.

FAT12 and FAT16 use a fixed size area for root directories, with
typically 512 entries of 32 bytes each (for a total of 16 KB) on hard
disk formats. The file system data is stored in clusters of typically
512 to 4096 bytes, depending on the size of the file system.

The current code uses the offset of a DOS 8.3 style directory entry as
a pseudo-inode, which leads to inode values of 0 to 16368 for typical
root directories with 512 entries.

Sub-directories use 2 cluster length plus the byte offset of the
directory entry in the data area for the pseudo-inode, which may be
as low as 1024 in case of 512 byte clusters. A sub-directory in
cluster 2 and with 512 byte clusters will therefore lead to a
re-use of inode 1024 when there are at least 32 DOS 8.3 style
filenames in the root directory (or 11 14-character Windows
long file names, each of which takes up 3 directory entries).

FAT32 file systems are not affected by this issue and FAT12/FAT16
file systems with larger cluster sizes are unlikely to have as
many directory entries in the root directory as are required to
cause the collision.

This commit leads to inode numbers that are guaranteed to not collide
for all valid FAT12 and FAT16 file system parameters. It does also
provide a small speed-up due to more efficient use of the vnode cache.

Approved by:	mckusick
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D43978
2024-02-20 13:02:24 +01:00
..
amd64 amd64 pcb.h: use 4 hex digits for pcb flags 2024-02-11 05:38:41 +02:00
arm aw_gpio: temporarily switch to input function if read in eint mode 2024-02-18 15:55:20 +02:00
arm64 busdma: fix page miscount for small segment sizes 2024-02-16 14:38:48 -04:00
bsm
cam scsi_da: add 4K quirks for Samsung SSD 860 and 870 2024-02-19 12:16:47 +02:00
cddl Abstract UIO allocation and deallocation. 2024-02-10 11:38:04 -05:00
compat LinuxKPI: 802.11: lsta txq locking cleanup 2024-02-16 15:50:11 +00:00
conf riscv: Introduce support for APLIC interrupt controller 2024-02-14 11:42:29 -04:00
contrib zlib: use more memory for a small deflate speedup. 2024-02-19 15:01:04 -08:00
crypto ossl: Remove a stray __FBSDID("$FreeBSD$") 2023-12-04 12:29:30 -05:00
ddb ddb: Fix typo (triple S) 2023-12-27 20:24:31 -07:00
dev ugen: fix USB_IFACE_DRIVER_ACTIVE after detaching a driver 2024-02-19 12:44:00 +02:00
dts add allwinner overlays for enabling additional USB ports 2024-01-28 13:12:39 +02:00
fs msdosfs: fix potential inode collision on FAT12 and FAT16 2024-02-20 13:02:24 +01:00
gdb sys: Automated cleanup of cdefs and other formatting 2023-11-26 22:24:00 -07:00
geom graid: unbreak Promise RAID1 with 4+ providers 2024-02-12 14:33:43 +07:00
gnu sys: Automated cleanup of cdefs and other formatting 2023-11-26 22:24:00 -07:00
i386 i386: Use bool for booleans in getmemsize 2024-02-05 15:39:31 -08:00
isa sys: Automated cleanup of cdefs and other formatting 2023-11-26 22:24:00 -07:00
kern sched: sched_switch(): Factorize sleepqueue flags 2024-02-19 17:37:19 +01:00
kgssapi sys: Automated cleanup of cdefs and other formatting 2023-11-26 22:24:00 -07:00
libkern sys: Automated cleanup of cdefs and other formatting 2023-11-26 22:24:00 -07:00
modules zfs: merge openzfs/zfs@e0bd8118d 2024-02-15 10:22:15 +01:00
net net: bandaid for plugging a fw_com leak in fwip_detach() 2024-02-15 01:00:49 +00:00
net80211 net80211: Fix two typos in kernel messages 2024-02-19 12:08:07 +01:00
netgraph sockets: garbage collect SS_ISCONFIRMING 2024-01-30 10:38:33 -08:00
netinet sctp(4): Fix a typo in a source code comment 2024-02-18 13:01:04 +01:00
netinet6 Revert "sockets: retire sorflush()" 2024-02-03 13:08:41 -08:00
netipsec netipsec: fix LINT-NOINET build 2024-01-20 22:22:21 +01:00
netlink sys/netlink/route/iface.c: remove an extra semicolon 2024-02-02 18:35:01 -07:00
netpfil ipfw: Skip to the start of the loop when following a keep-state rule 2024-02-15 17:57:51 -08:00
netsmb sys: Automated cleanup of cdefs and other formatting 2023-11-26 22:24:00 -07:00
nfs sys: Automated cleanup of cdefs and other formatting 2023-11-26 22:24:00 -07:00
nfsclient sys: Remove ancient SCCS tags. 2023-11-26 22:23:30 -07:00
nfsserver sys: Remove ancient SCCS tags. 2023-11-26 22:23:30 -07:00
nlm sys: Automated cleanup of cdefs and other formatting 2023-11-26 22:24:00 -07:00
ofed sockets: provide correct pr_shutdown for keysock and SDP 2024-01-16 12:02:59 -08:00
opencrypto sys: Automated cleanup of cdefs and other formatting 2023-11-26 22:24:00 -07:00
powerpc powerpc psim: Fix infinite recursion in multiple bus methods 2024-02-16 23:19:06 -08:00
riscv busdma: fix page miscount for small segment sizes 2024-02-16 14:38:48 -04:00
rpc rpc: Fix typo in comment 2024-02-13 14:20:45 +08:00
security sys: Automated cleanup of cdefs and other formatting 2023-11-26 22:24:00 -07:00
sys umtxvar.h: Add missing include 2024-02-19 17:41:34 +01:00
teken
tests callout: retire callout_async_drain() 2024-01-24 09:33:27 -08:00
tools makesyscalls: generate private syscall symbols 2024-02-05 20:34:56 +00:00
ufs Eliminate unnecessary UFS1 integrity checks. 2024-02-19 16:17:05 -08:00
vm pmap: Convert boolean_t to bool. 2024-01-31 14:48:26 -08:00
x86 busdma: fix page miscount for small segment sizes 2024-02-16 14:38:48 -04:00
xdr sys: Automated cleanup of cdefs and other formatting 2023-11-26 22:24:00 -07:00
xen xen: add atomic #defines to accomodate differing xen_ulong_t sizes 2023-12-15 14:59:26 +01:00
Makefile
README.md

FreeBSD Kernel Source:

This directory contains the source files and build glue that make up the FreeBSD kernel and its modules, including both original and contributed software.

Kernel configuration files are located in the conf/ subdirectory of each architecture. GENERIC is the configuration used in release builds. NOTES contains documentation of all possible entries. LINT is a compile-only configuration used to maximize build coverage and detect regressions.

Documentation:

Source code documentation is maintained in a set of man pages, under section 9. These pages are located in share/man/man9, from the top-level of the src tree. Consult intro(9) for an overview of existing pages.

Some additional high-level documentation of the kernel is maintained in the Architecture Handbook.

Source Roadmap:

Directory Description
amd64 AMD64 (64-bit x86) architecture support
arm 32-bit ARM architecture support
arm64 64-bit ARM (AArch64) architecture support
cam Common Access Method storage subsystem - cam(4) and ctl(4)
cddl CDDL-licensed optional sources such as DTrace
conf kernel build glue
compat Linux compatibility layer, FreeBSD 32-bit compatibility
contrib 3rd-party imported software such as OpenZFS
crypto crypto drivers
ddb interactive kernel debugger - ddb(4)
fs most filesystems, excluding UFS, NFS, and ZFS
dev device drivers and other arch independent code
gdb kernel remote GDB stub - gdb(4)
geom GEOM framework - geom(4)
i386 i386 (32-bit x86) architecture support
kern main part of the kernel
libkern libc-like and other support functions for kernel use
modules kernel module infrastructure
net core networking code
net80211 wireless networking (IEEE 802.11) - net80211(4)
netgraph graph-based networking subsystem - netgraph(4)
netinet IPv4 protocol implementation - inet(4)
netinet6 IPv6 protocol implementation - inet6(4)
netipsec IPsec protocol implementation - ipsec(4)
netpfil packet filters - ipfw(4), pf(4), and ipfilter(4)
opencrypto OpenCrypto framework - crypto(7)
powerpc PowerPC/POWER (32 and 64-bit) architecture support
riscv 64-bit RISC-V architecture support
security security facilities - audit(4) and mac(4)
sys kernel headers
tests kernel unit tests
ufs Unix File System - ffs(7)
vm virtual memory system
x86 code shared by AMD64 and i386 architectures