opnsense-src/sbin
Dag-Erling Smørgrav cf81be35c3 hastd: Use fixed-length protocol names
All communication between hastd nodes and internally between hastd and
its worker children passes through the same pair of send / receive
functions.  The receive function uses recv(2) with the MSG_WAITALL flag,
which in theory means we should never get a short read.  However, when
handing off a socket to a worker child, we also pass a variable-length
string identifying the type of socket we're passing, and reading this
string relies on a short read.  This used to work because the arrival of
the descriptor would interrupt the recv(2) call, but this bug was fixed
when the AF_UNIX code was rewritten a while ago and hastd has been
broken ever since.

Fixing the length of the protocol name to four characters including the
terminating null solves the short-read bug by never requiring a short
read (nothing else in hastd requires one).

Note that this issue appears to have been reported independently first
by Alessandro Sagratini in PR 292322 and then by Martin Vidovic in
D57511.  I ended up going in a different direction than Martin's patch,
but his analysis was invaluable, hence the double credit below.

Approved by:	so
Security:	FreeBSD-EN-26:26.hastd
PR:		292322
Reported by:	Martin Vidovic <xtronom@gmail.com>
MFC after:	1 week
Event:		EuroBSDcon DevSummit 2026
Reviewed by:	xtronom_gmail.com, kevans, glebius, gjb
Differential Revision:	https://reviews.freebsd.org/D59521

(cherry picked from commit b7e5c2e008f5b441611830ad3a0329de0882419e)
(cherry picked from commit cd8eef45d2d0296afe0226bde587f52eb0404516)
2026-10-15 11:28:50 +02:00
..
adjkerntz adjkerntz.8: minor cleanup (markup, spdx, reflow) 2024-07-29 14:06:06 -06:00
bectl manpages: Fix author e-mail address formatting 2026-09-23 09:07:21 +02:00
bsdlabel bsdlabel: Bump removal to FreeBSD 16.0. 2025-10-30 16:05:54 -04:00
camcontrol camcontrol: Add SPDX-License-Identifier tag 2026-03-12 09:43:57 -04:00
ccdconfig ccdconfig.8: Bump Dd for gvinum removal 2025-01-23 11:20:43 -05:00
clri Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
comcontrol tty: Retire zombie dtrwait 2025-09-02 23:18:09 -06:00
conscontrol Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
ddb Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
decryptcore Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
devd virtual_oss: Introduce virtual_oss_default_control_device rc variable 2026-04-23 10:41:15 +02:00
devfs Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
devmatch devmatch: Catch truncated linker hints files 2024-10-23 22:12:45 +00:00
dhclient dhclient: Improve server and filename validation 2026-04-30 21:06:54 +00:00
dmesg manuals: System message vs kernel message 2026-04-13 16:02:32 -04:00
dump Standardize the definition of a UFS dinode. 2025-01-27 17:39:45 -08:00
dumpfs Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
dumpon dumpon(8): Add a SYSCTL VARIABLES section 2025-11-06 11:42:56 -05:00
etherswitchcfg Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
fdisk fdisk: Bump removal to FreeBSD 16.0 2025-10-27 10:34:43 -04:00
ffsinfo Remove references to gvinum(8) in various manpages 2025-01-23 13:16:47 -05:00
fsck Move mntopts(3) suppport into libutil 2025-04-22 22:51:42 +01:00
fsck_ffs fsck_ffs: garbage collect calcsb 2025-10-28 02:20:36 -07:00
fsck_msdosfs fsck_msdosfs: fix FAT header correction not persisting in cache mode 2026-05-12 12:00:33 -07:00
fsdb
fsirand
geom sbin/geom: Convert err/warn() to xo_err/warn() and style(9) fixes 2026-02-24 12:53:02 +01:00
ggate geom manuals: Clarify units 2026-04-23 16:28:54 -04:00
growfs growfs(8): use gpart(8) instead of bsdlabel(8) in test 2025-06-17 23:21:20 -08:00
hastctl Remove "All Rights Reserved" from FreeBSD Foundation copyrights 2024-07-30 12:16:36 -04:00
hastd hastd: Use fixed-length protocol names 2026-10-15 11:28:50 +02:00
ifconfig sbin/ifconfig: remove unused static function parameter 2026-09-23 08:43:48 +02:00
init init: Use root's home directory in single-user mode 2025-09-23 23:38:07 +02:00
ipf man: Fix RFC 1918 network prefix lengths 2026-08-11 08:31:59 +02:00
ipfw ipfw.8: clarify a difference between reset and reset6 actions 2026-10-07 07:53:20 +02:00
kldconfig
kldload
kldstat kldstat: Memory zeroing using memset() 2025-07-18 09:30:52 -06:00
kldunload
ldconfig Canonicalize the name of the FreeBSD Foundation 2024-10-24 05:03:07 +08:00
md5 md5: Don't generate test cases just to skip them 2026-05-07 13:18:56 -07:00
mdconfig Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
mdmfs mdmfs: Fix soft updates logic 2026-01-31 17:49:24 +00:00
mknod Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
mksnap_ffs mksnap_ffs: fix running unded chroot 2025-11-05 11:56:13 -08:00
mount mount.8: document nosymfollow option 2026-02-08 14:13:26 +00:00
mount_cd9660 Search for mntopts.h globally, not locally 2025-04-22 22:51:42 +01:00
mount_fusefs Replace last few remaining MAN[1-8] with MAN 2025-07-26 12:00:02 +02:00
mount_msdosfs Search for mntopts.h globally, not locally 2025-04-22 22:51:42 +01:00
mount_nfs Search for mntopts.h globally, not locally 2025-04-22 22:51:42 +01:00
mount_nullfs mount_nullfs.8: document unixbypass and nounixbypass 2025-10-16 05:22:20 +03:00
mount_udf Search for mntopts.h globally, not locally 2025-04-22 22:51:42 +01:00
mount_unionfs Search for mntopts.h globally, not locally 2025-04-22 22:51:42 +01:00
natd natd: Enable support for EIM NAT 2024-12-06 09:21:06 +00:00
newfs newfs: Don't combine GEOM journaling with SU 2026-04-04 08:59:14 +00:00
newfs_msdos t_create.sh: use ATF_TESTS_SH_SED & remove local mods 2026-02-21 19:36:25 -08:00
nfsiod Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
nos-tun sbin/nos-tun: correct SIOCDIFADDR calls to use ifreq 2024-07-22 09:58:37 +00:00
nvmecontrol nvmf: Limit the default I/O queue size to 128 entries 2026-04-24 11:42:35 -04:00
pfctl pfctl: fix printing of wildcard anchors 2026-09-11 09:40:55 +02:00
pfilctl Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
pflogd Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
pflowctl Update Makefile.depend files 2024-10-14 10:26:17 -07:00
ping ping6: treat setsockopt failures as fatal 2026-04-24 00:51:05 +00:00
quotacheck Standardize the definition of a UFS dinode. 2025-01-27 17:39:45 -08:00
rcorder rcorder: Fix grammar in warning about loops 2025-10-09 12:16:05 +00:00
reboot nextboot: Reimplement missing -a option 2025-12-13 22:01:14 +00:00
recoverdisk Recoverdisk: Refine the determination of defaults 2025-09-02 05:48:05 +00:00
resolvconf Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
restore Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
route route(8): Fix -expire argument when using netlink 2026-03-26 12:42:14 +03:30
routed packages: move route(6)d to the rip package 2025-08-07 13:36:59 +01:00
rtsol
savecore manpages: prefer linking to xo_options.7 over xo_parse_args.3 2025-07-16 12:02:24 -06:00
setkey sbin/setkey/setkey.8: cleanup groff mdoc warnings 2026-02-15 05:13:37 +02:00
shutdown shutdown(8): Document additional formats supported by the code. 2025-12-15 19:46:52 -08:00
swapon swapon: Improve tests for non-standard kernel page size and small media 2025-07-31 02:23:13 +02:00
sysctl sysctl_test: Print standard error if sysctl -ao fails 2025-07-08 12:56:00 +00:00
tests Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
tunefs tunefs: Better fix for arm64 alignment issues 2026-04-13 17:39:24 +00:00
umbctl umb: Introduce the USB umb(4) network driver 2025-01-20 23:46:15 +00:00
umount manuals: Fix "unusual .Xr" warnings with a script 2024-10-15 17:18:14 -03:00
veriexec veriexec.8: Fix a typo in the manual page 2025-08-30 07:47:22 +02:00
zfsbootcfg zfsboot: Remove zfsboot(8) program used to boot ZFS from MBR + BIOS 2025-07-28 10:58:02 -04:00
Makefile gvinum(8): Remove userland tool for managing vinum volumes 2025-01-23 11:20:43 -05:00
Makefile.amd64 Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
Makefile.arm Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
Makefile.i386 Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
Makefile.inc Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
Makefile.powerpc64 Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00