diff options
176 files changed, 2391 insertions, 1379 deletions
@@ -27,6 +27,12 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 16.x IS SLOW: world, or to merely disable the most expensive debugging functionality at runtime, run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20251025: + flua(1) has moved to the new FreeBSD-flua package. If you use flua, + you may want to install this package if it's not otherwise installed + as a dependency of something else. This change only affects pkgbase + users. + 20251021: Bump __FreeBSD_version to 1600002 for LinuxKPI. An embedded struct has changed size and might possibly be an issue otherwise. diff --git a/contrib/blocklist/bin/blacklistctl.8 b/contrib/blocklist/bin/blacklistctl.8 index 4d557c0c979d..08f1d1b9e5af 100644 --- a/contrib/blocklist/bin/blacklistctl.8 +++ b/contrib/blocklist/bin/blacklistctl.8 @@ -45,7 +45,6 @@ is a program used to display and change the state of the database. The following sub-commands are supported: .Ss dump -.Pp The following options are available for the .Cm dump sub-command: @@ -90,7 +89,7 @@ associated with the database entry. column will show the identifier for the packet filter rule associated with the database entry, though this may only be the word .Ql OK -for packet filters which do not creat a unique identifier for each rule. +for packet filters which do not create a unique identifier for each rule. .It Ql nfail The number of .Em failures diff --git a/contrib/blocklist/bin/blacklistd.c b/contrib/blocklist/bin/blacklistd.c index ded3075ed707..b5f9358122ef 100644 --- a/contrib/blocklist/bin/blacklistd.c +++ b/contrib/blocklist/bin/blacklistd.c @@ -1,4 +1,4 @@ -/* $NetBSD: blocklistd.c,v 1.10 2025/03/26 17:09:35 christos Exp $ */ +/* $NetBSD: blocklistd.c,v 1.11 2025/10/25 16:55:23 christos Exp $ */ /*- * Copyright (c) 2015 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ #ifdef HAVE_SYS_CDEFS_H #include <sys/cdefs.h> #endif -__RCSID("$NetBSD: blocklistd.c,v 1.10 2025/03/26 17:09:35 christos Exp $"); +__RCSID("$NetBSD: blocklistd.c,v 1.11 2025/10/25 16:55:23 christos Exp $"); #include <sys/types.h> #include <sys/socket.h> @@ -191,12 +191,12 @@ process(bl_t bl) } if (getremoteaddress(bi, &rss, &rsl) == -1) - goto out; + return; if (debug || bi->bi_msg[0]) { sockaddr_snprintf(rbuf, sizeof(rbuf), "%a:%p", (void *)&rss); (*lfun)(bi->bi_msg[0] ? LOG_INFO : LOG_DEBUG, - "processing type=%d fd=%d remote=%s msg=%s uid=%lu gid=%lu", + "processing type=%d fd=%d remote=%s msg=\"%s\" uid=%lu gid=%lu", bi->bi_type, bi->bi_fd, rbuf, bi->bi_msg, (unsigned long)bi->bi_uid, (unsigned long)bi->bi_gid); @@ -204,12 +204,12 @@ process(bl_t bl) if (conf_find(bi->bi_fd, bi->bi_uid, &rss, &c) == NULL) { (*lfun)(LOG_DEBUG, "no rule matched"); - goto out; + return; } if (state_get(state, &c, &dbi) == -1) - goto out; + return; if (debug) { char b1[128], b2[128]; @@ -226,7 +226,7 @@ process(bl_t bl) * set the number of fails to be one less than the * configured limit. Fallthrough to the normal BL_ADD * processing, which will increment the failure count - * to the threshhold, and block the abusive address. + * to the threshold, and block the abusive address. */ if (c.c_nfail != -1) dbi.count = c.c_nfail - 1; @@ -269,8 +269,6 @@ process(bl_t bl) state_put(state, &c, &dbi); out: - close(bi->bi_fd); - if (debug) { char b1[128], b2[128]; (*lfun)(LOG_DEBUG, "%s: final db state for %s: count=%d/%d " @@ -565,7 +563,7 @@ main(int argc, char *argv[]) conf_parse(configfile); } ret = poll(pfd, (nfds_t)nfd, tout); - if (debug) + if (debug && ret != 0) (*lfun)(LOG_DEBUG, "received %d from poll()", ret); switch (ret) { case -1: diff --git a/contrib/blocklist/bin/blocklistctl.8 b/contrib/blocklist/bin/blocklistctl.8 index a98c16374f19..75228599a9de 100644 --- a/contrib/blocklist/bin/blocklistctl.8 +++ b/contrib/blocklist/bin/blocklistctl.8 @@ -1,4 +1,4 @@ -.\" $NetBSD: blocklistctl.8,v 1.4 2025/02/07 01:35:38 kre Exp $ +.\" $NetBSD: blocklistctl.8,v 1.5 2025/10/25 16:56:27 christos Exp $ .\" .\" Copyright (c) 2015 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -27,7 +27,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd January 27, 2025 +.Dd October 25, 2025 .Dt BLOCKLISTCTL 8 .Os .Sh NAME @@ -45,7 +45,6 @@ is a program used to display and change the state of the database. The following sub-commands are supported: .Ss dump -.Pp The following options are available for the .Cm dump sub-command: @@ -83,6 +82,10 @@ sub-command consists of a header (unless was given) and one line for each record in the database, where each line has the following columns: .Bl -tag -width indent +.It Ql rulename +The packet filter rule name associated with the database entry, +usually +.Dv blocklistd . .It Ql address/ma:port The remote address, mask, and local port number of the client connection associated with the database entry. @@ -90,7 +93,7 @@ associated with the database entry. column will show the identifier for the packet filter rule associated with the database entry, though this may only be the word .Ql OK -for packet filters which do not creat a unique identifier for each rule. +for packet filters which do not create a unique identifier for each rule. .It Ql nfail The number of .Em failures diff --git a/contrib/blocklist/bin/blocklistctl.c b/contrib/blocklist/bin/blocklistctl.c index 8c75e0430c61..b43d8b8aaab3 100644 --- a/contrib/blocklist/bin/blocklistctl.c +++ b/contrib/blocklist/bin/blocklistctl.c @@ -1,4 +1,4 @@ -/* $NetBSD: blocklistctl.c,v 1.4 2025/02/11 17:48:30 christos Exp $ */ +/* $NetBSD: blocklistctl.c,v 1.5 2025/10/25 16:56:10 christos Exp $ */ /*- * Copyright (c) 2015 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ #ifdef HAVE_SYS_CDEFS_H #include <sys/cdefs.h> #endif -__RCSID("$NetBSD: blocklistctl.c,v 1.4 2025/02/11 17:48:30 christos Exp $"); +__RCSID("$NetBSD: blocklistctl.c,v 1.5 2025/10/25 16:56:10 christos Exp $"); #include <stdio.h> #include <time.h> @@ -135,7 +135,7 @@ main(int argc, char *argv[]) clock_gettime(CLOCK_REALTIME, &ts); wide = wide ? 8 * 4 + 7 : 4 * 3 + 3; if (!noheader) - printf("%*.*s/ma:port\tid\tnfail\t%s\n", wide, wide, + printf("rulename\t%*.*s/ma:port\tid\tnfail\t%s\n", wide, wide, "address", remain ? "remaining time" : "last access"); for (i = 1; state_iterate(db, &c, &dbi, i) != 0; i = 0) { char buf[BUFSIZ]; @@ -150,7 +150,7 @@ main(int argc, char *argv[]) } } sockaddr_snprintf(buf, sizeof(buf), "%a", (void *)&c.c_ss); - printf("%*.*s/%s:%s\t", wide, wide, buf, + printf("%s\t%*.*s/%s:%s\t", c.c_name, wide, wide, buf, star(mbuf, sizeof(mbuf), c.c_lmask), star(pbuf, sizeof(pbuf), c.c_port)); if (c.c_duration == -1) { diff --git a/contrib/blocklist/bin/blocklistd.c b/contrib/blocklist/bin/blocklistd.c index 03a1dbbf056c..c78c560613fc 100644 --- a/contrib/blocklist/bin/blocklistd.c +++ b/contrib/blocklist/bin/blocklistd.c @@ -1,4 +1,4 @@ -/* $NetBSD: blocklistd.c,v 1.10 2025/03/26 17:09:35 christos Exp $ */ +/* $NetBSD: blocklistd.c,v 1.11 2025/10/25 16:55:23 christos Exp $ */ /*- * Copyright (c) 2015 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ #ifdef HAVE_SYS_CDEFS_H #include <sys/cdefs.h> #endif -__RCSID("$NetBSD: blocklistd.c,v 1.10 2025/03/26 17:09:35 christos Exp $"); +__RCSID("$NetBSD: blocklistd.c,v 1.11 2025/10/25 16:55:23 christos Exp $"); #include <sys/types.h> #include <sys/socket.h> @@ -191,12 +191,12 @@ process(bl_t bl) } if (getremoteaddress(bi, &rss, &rsl) == -1) - goto out; + return; if (debug || bi->bi_msg[0]) { sockaddr_snprintf(rbuf, sizeof(rbuf), "%a:%p", (void *)&rss); (*lfun)(bi->bi_msg[0] ? LOG_INFO : LOG_DEBUG, - "processing type=%d fd=%d remote=%s msg=%s uid=%lu gid=%lu", + "processing type=%d fd=%d remote=%s msg=\"%s\" uid=%lu gid=%lu", bi->bi_type, bi->bi_fd, rbuf, bi->bi_msg, (unsigned long)bi->bi_uid, (unsigned long)bi->bi_gid); @@ -204,12 +204,12 @@ process(bl_t bl) if (conf_find(bi->bi_fd, bi->bi_uid, &rss, &c) == NULL) { (*lfun)(LOG_DEBUG, "no rule matched"); - goto out; + return; } if (state_get(state, &c, &dbi) == -1) - goto out; + return; if (debug) { char b1[128], b2[128]; @@ -226,7 +226,7 @@ process(bl_t bl) * set the number of fails to be one less than the * configured limit. Fallthrough to the normal BL_ADD * processing, which will increment the failure count - * to the threshhold, and block the abusive address. + * to the threshold, and block the abusive address. */ if (c.c_nfail != -1) dbi.count = c.c_nfail - 1; @@ -269,8 +269,6 @@ process(bl_t bl) state_put(state, &c, &dbi); out: - close(bi->bi_fd); - if (debug) { char b1[128], b2[128]; (*lfun)(LOG_DEBUG, "%s: final db state for %s: count=%d/%d " @@ -565,7 +563,7 @@ main(int argc, char *argv[]) conf_parse(configfile); } ret = poll(pfd, (nfds_t)nfd, tout); - if (debug) + if (debug && ret != 0) (*lfun)(LOG_DEBUG, "received %d from poll()", ret); switch (ret) { case -1: diff --git a/contrib/blocklist/libexec/blocklistd-helper b/contrib/blocklist/libexec/blocklistd-helper index 14a192ee35ce..1d4a38b1d831 100755 --- a/contrib/blocklist/libexec/blocklistd-helper +++ b/contrib/blocklist/libexec/blocklistd-helper @@ -259,7 +259,7 @@ flush) # dynamically determine which anchors exist for anchor in $(/sbin/pfctl -a "$2" -s Anchors 2> /dev/null); do /sbin/pfctl -a "$anchor" -t "port${anchor##*/}" -T flush 2> /dev/null - /sbin/pfctl -a "$anchor" -F rules + /sbin/pfctl -a "$anchor" -F rules 2> /dev/null done echo OK ;; diff --git a/lib/geom/Makefile.inc b/lib/geom/Makefile.inc index 35163127538d..75d312a94fe4 100644 --- a/lib/geom/Makefile.inc +++ b/lib/geom/Makefile.inc @@ -1,10 +1,11 @@ .include <src.opts.mk> -SHLIBDIR=${GEOM_CLASS_DIR} -SHLIB_NAME?=geom_${GEOM_CLASS}.so -MAN= g${GEOM_CLASS}.8 -SRCS+= geom_${GEOM_CLASS}.c subr.c -CFLAGS+=-I${SRCTOP}/sbin/geom +SHLIBDIR= ${GEOM_CLASS_DIR} +SHLIB_NAME?= geom_${GEOM_CLASS}.so +MANNODEV= g${GEOM_CLASS}.8 + +SRCS+= geom_${GEOM_CLASS}.c subr.c +CFLAGS+= -I${SRCTOP}/sbin/geom .PATH: ${SRCTOP}/sbin/geom/misc diff --git a/lib/geom/part/gpart.8 b/lib/geom/part/gpart.8 index f76c1d9d5d6c..2e11417f8494 100644 --- a/lib/geom/part/gpart.8 +++ b/lib/geom/part/gpart.8 @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd February 11, 2025 +.Dd October 24, 2025 .Dt GPART 8 .Os .Sh NAME @@ -1497,6 +1497,26 @@ and .Bd -literal -offset indent /sbin/gpart backup ada0 | /sbin/gpart restore -F ada1 ada2 .Ed +.Sh DIAGNOSTICS +.Bl -diag +.It gpart: arg0 '%s': Invalid argument +The provided +.Ar geom +argument +is not a GEOM provider. +Not every device in +.Xr devfs 4 +is a GEOM provider. +For example, a +.Xr zfs 4 +zvol will show up as a GEOM provider only if its +.Sy volmode +is set properly +.Po refer to +.Xr zfsprops 8 +for details +.Pc . +.El .Sh SEE ALSO .Xr geom 4 , .Xr boot0cfg 8 , diff --git a/lib/libarchive/Makefile b/lib/libarchive/Makefile index fed73c388318..4e32dcf72341 100644 --- a/lib/libarchive/Makefile +++ b/lib/libarchive/Makefile @@ -184,12 +184,13 @@ MAN= archive_entry.3 \ archive_write_new.3 \ archive_write_open.3 \ archive_write_set_options.3 \ - cpio.5 \ libarchive.3 \ libarchive_changes.3 \ - libarchive_internals.3 \ - libarchive-formats.5 \ - tar.5 + libarchive_internals.3 + +MANNODEV= cpio.5 \ + libarchive-formats.5 \ + tar.5 # Symlink the man pages under each function name. MLINKS+= archive_entry.3 archive_entry_clear.3 diff --git a/lib/libc/locale/Makefile.inc b/lib/libc/locale/Makefile.inc index 33caafc5c10a..127f8fc67abc 100644 --- a/lib/libc/locale/Makefile.inc +++ b/lib/libc/locale/Makefile.inc @@ -46,7 +46,7 @@ MAN+= btowc.3 \ wctrans.3 wctype.3 wcwidth.3 \ duplocale.3 freelocale.3 newlocale.3 querylocale.3 uselocale.3 xlocale.3 -MAN+= big5.5 euc.5 gb18030.5 gb2312.5 gbk.5 mskanji.5 utf8.5 +MANNODEV+= big5.5 euc.5 gb18030.5 gb2312.5 gbk.5 mskanji.5 utf8.5 MLINKS+=btowc.3 wctob.3 MLINKS+=digittoint.3 digittoint_l.3 diff --git a/lib/libc/posix1e/Makefile.inc b/lib/libc/posix1e/Makefile.inc index 934998cdd092..48f6c1ddf884 100644 --- a/lib/libc/posix1e/Makefile.inc +++ b/lib/libc/posix1e/Makefile.inc @@ -84,7 +84,6 @@ MAN+= acl.3 \ acl_valid.3 \ extattr.3 \ mac.3 \ - mac.conf.5 \ mac_free.3 \ mac_is_present.3 \ mac_get.3 \ @@ -134,4 +133,6 @@ MLINKS+=acl_create_entry.3 acl_create_entry_np.3\ mac_text.3 mac_from_text.3 \ mac_text.3 mac_to_text.3 +MANNODEV+= mac.conf.5 + CLEANFILES+= subr_acl_nfs4.c diff --git a/lib/libc/posix1e/mac_free.3 b/lib/libc/posix1e/mac_free.3 index 4ed68b70f3a3..6674ca2e9094 100644 --- a/lib/libc/posix1e/mac_free.3 +++ b/lib/libc/posix1e/mac_free.3 @@ -31,7 +31,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd September 21, 2023 +.Dd October 26, 2025 .Dt MAC_FREE 3 .Os .Sh NAME @@ -85,7 +85,7 @@ is a complex structure in the implementation, .Fn mac_free is specific to -.Vt mac_3 , +.Vt mac_t , and must not be used to free the character strings returned from .Fn mac_to_text . Doing so may result in undefined behavior. diff --git a/lib/libc/posix1e/mac_text.3 b/lib/libc/posix1e/mac_text.3 index 29c1aacca485..7633f4b0da64 100644 --- a/lib/libc/posix1e/mac_text.3 +++ b/lib/libc/posix1e/mac_text.3 @@ -28,7 +28,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd September 21, 2023 +.Dd October 26, 2025 .Dt MAC_TEXT 3 .Os .Sh NAME @@ -52,14 +52,16 @@ into the internal policy label format and places it in .Fa *mac , which must later be freed with -.Xr free 3 . +.Xr mac_free 3 . .Pp The .Fn mac_to_text function allocates storage for .Fa *text , which will be set to the text representation of -.Fa label . +.Fa label +and must later be freed with +.Xr free 3 . .Pp Refer to .Xr maclabel 7 diff --git a/lib/libc/regex/Makefile.inc b/lib/libc/regex/Makefile.inc index 89468f1317f6..e3417a3d9983 100644 --- a/lib/libc/regex/Makefile.inc +++ b/lib/libc/regex/Makefile.inc @@ -9,9 +9,9 @@ SYM_MAPS+=${LIBC_SRCTOP}/regex/Symbol.map # manpages only included in libc version .if ${LIB} == "c" -MAN+= regex.3 -MAN+= re_format.7 +MAN+= regex.3 +MLINKS+= regex.3 regcomp.3 regex.3 regexec.3 regex.3 regerror.3 +MLINKS+= regexec.3 regfree.3 -MLINKS+=regex.3 regcomp.3 regex.3 regexec.3 regex.3 regerror.3 -MLINKS+=regexec.3 regfree.3 +MANNODEV+= re_format.7 .endif diff --git a/lib/libc/rpc/Makefile.inc b/lib/libc/rpc/Makefile.inc index 87963d10eec1..c22fac2c0e16 100644 --- a/lib/libc/rpc/Makefile.inc +++ b/lib/libc/rpc/Makefile.inc @@ -42,12 +42,12 @@ crypt_xdr.c: ${RPCDIR}/crypt.x crypt.h crypt.h: ${RPCDIR}/crypt.x ${RPCGEN} -h -o ${.TARGET} ${RPCDIR}/crypt.x + MAN+= bindresvport.3 des_crypt.3 getnetconfig.3 getnetpath.3 getrpcent.3 \ getrpcport.3 rpc.3 rpc_soc.3 rpc_clnt_auth.3 rpc_clnt_calls.3 \ rpc_clnt_create.3 rpc_svc_calls.3 rpc_svc_create.3 rpc_svc_err.3 \ rpc_svc_reg.3 rpc_xdr.3 rpcbind.3 publickey.3 rpc_secure.3 \ rtime.3 -MAN+= rpc.5 netconfig.5 MLINKS+= bindresvport.3 bindresvport_sa.3 \ des_crypt.3 ecb_crypt.3 \ des_crypt.3 cbc_crypt.3 \ @@ -177,3 +177,5 @@ MLINKS+= bindresvport.3 bindresvport_sa.3 \ rpc_soc.3 xdr_authunix_parms.3 \ rpc_soc.3 xdr_pmap.3 \ rpc_soc.3 xdr_pmaplist.3 + +MANNODEV+= rpc.5 netconfig.5 diff --git a/lib/libc/string/ffs.3 b/lib/libc/string/ffs.3 index 2a5adb01c737..1cca54c0b30b 100644 --- a/lib/libc/string/ffs.3 +++ b/lib/libc/string/ffs.3 @@ -27,7 +27,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd October 17, 2015 +.Dd October 25, 2025 .Dt FFS 3 .Os .Sh NAME @@ -80,6 +80,17 @@ argument was zero. .Sh SEE ALSO .Xr bitstring 3 , .Xr bitset 9 +.Sh STANDARDS +The +.Fn ffs +function conforms to +.St -p1003.1-2008 . +The +.Fn ffsl +and +.Fn ffsll +functions conform to +.St -p1003.1-2024 . .Sh HISTORY The .Fn ffs diff --git a/lib/libedit/Makefile b/lib/libedit/Makefile index c7a54253dae9..9161e05a7d36 100644 --- a/lib/libedit/Makefile +++ b/lib/libedit/Makefile @@ -15,10 +15,10 @@ SRCS= chared.c chartype.c common.c el.c eln.c emacs.c filecomplete.c \ parse.c prompt.c read.c readline.c refresh.c search.c sig.c \ terminal.c tokenizer.c tokenizern.c tty.c vi.c +MAN= editline.3 +MANNODEV= editrc.5 editline.7 -MAN= editline.3 editrc.5 editline.7 - -MLINKS= \ +MLINKS=\ editline.3 el_deletestr.3 \ editline.3 el_end.3 \ editline.3 el_get.3 \ diff --git a/lib/libmagic/Makefile b/lib/libmagic/Makefile index 150ddc686241..fe04f5ea68c8 100644 --- a/lib/libmagic/Makefile +++ b/lib/libmagic/Makefile @@ -11,7 +11,9 @@ SHLIB_MAJOR= 4 .if !make(build-tools) LIBADD= z .endif -MAN= libmagic.3 magic.5 + +MAN= libmagic.3 +MANNODEV= magic.5 SRCS= apprentice.c apptype.c ascmagic.c buffer.c cdf.c cdf_time.c \ compress.c der.c encoding.c fsmagic.c funcs.c is_json.c \ @@ -73,8 +75,8 @@ magic.mgc: mkmagic FILEVER!= awk '$$1 == "\#define" && $$2 == "VERSION" { print $$3; exit }' \ ${.CURDIR}/config.h -CLEANFILES+= ${MAN} -.for mp in ${MAN} +CLEANFILES+= ${MAN} ${MANNODEV} +.for mp in ${MAN} ${MANNODEV} ${mp}: ${mp:C/[0-9]/man/} sed -e 's/__FSECTION__/5/g' -e 's/__CSECTION__/1/g' \ -e 's/__VERSION__/${FILEVER}/g' \ diff --git a/lib/libmd/Makefile b/lib/libmd/Makefile index 547a134fc440..c4ab767c8b2f 100644 --- a/lib/libmd/Makefile +++ b/lib/libmd/Makefile @@ -108,7 +108,7 @@ CFLAGS+= -DWEAK_REFS CFLAGS.skein_block.c+= -DSKEIN_LOOP=995 .PATH: ${.CURDIR}/${MACHINE_ARCH} ${SRCTOP}/sys/crypto/sha2 .PATH: ${SRCTOP}/sys/crypto/skein ${SRCTOP}/sys/crypto/skein/${MACHINE_ARCH} -.PATH: ${SRCTOP}/sys/kern +.PATH: ${SRCTOP}/sys/crypto USE_ASM_SOURCES?=1 .if defined(BOOTSTRAPPING) || ${MK_MACHDEP_OPTIMIZATIONS} == no @@ -117,6 +117,13 @@ USE_ASM_SOURCES:=0 .endif .if ${USE_ASM_SOURCES} != 0 +.if exists(${MACHINE_ARCH}/md5block.S) +SRCS+= md5block.S +CFLAGS+= -DMD5_ASM +.if exists(${MACHINE_ARCH}/md5dispatch.c) +SRCS+= md5dispatch.c +.endif +.endif .if exists(${MACHINE_ARCH}/sha1block.S) SRCS+= sha1block.S CFLAGS+= -DSHA1_ASM diff --git a/lib/libmd/aarch64/md5block.S b/lib/libmd/aarch64/md5block.S new file mode 100644 index 000000000000..b928c8dd795a --- /dev/null +++ b/lib/libmd/aarch64/md5block.S @@ -0,0 +1,206 @@ +/*- + * Copyright (c) 2024 Robert Clausecker <fuz@FreeBSD.org> + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#include <sys/elf_common.h> +#include <machine/asm.h> + +# optimal instruction sequence for k = \key + \m +.macro addkm key, m +.if 0x100000000 - \key > 0x00ffffff + movz k, #\key & 0xffff + movk k, #\key >> 16, lsl #16 + add k, k, \m +.elseif 0x100000000 - \key > 0x0000ffff + sub k, \m, #(0x100000000 - \key) & 0xfff000 + sub k, k, #(0x100000000 - \key) & 0xfff +.else + movz k, #0x100000000 - \key + sub k, \m, k +.endif +.endm + +.macro round a, b, c, d, f, key, m, s + \f f, \b, \c, \d + addkm \key, \m // k[i] + m[g] + add \a, \a, k // k[i] + m[g] + a + add \a, \a, f // k[i] + m[g] + a + f + ror \a, \a, #32-\s + add \a, \a, \b +.endm + + /* f = b ? c : d */ +.macro f0 f, b, c, d + eor \f, \c, \d + and \f, \f, \b + eor \f, \f, \d +.endm + + /* + * special cased round 1 function + * f1 = d ? b : c = (d & b) + (~d & c) + */ +.macro round1 a, b, c, d, key, m, s + bic tmp, \c, \d // ~d & c + addkm \key, \m // k[i] + m[g] + add \a, \a, k // k[i] + m[g] + a + and f, \b, \d // d & b + add \a, \a, tmp // k[i] + m[g] + a + (~d & c) + add \a, \a, f // k[i] + m[g] + a + (~d & c) + (d & b) + ror \a, \a, #32-\s + add \a, \a, \b +.endm + + /* f = b ^ c ^ d */ +.macro f2 f, b, c, d + eor \f, \c, \d + eor \f, \f, \b +.endm + + /* f = c ^ (b | ~d) */ +.macro f3 f, b, c, d + orn \f, \b, \d + eor \f, \f, \c +.endm + + /* do 4 rounds */ +.macro rounds f, m0, m1, m2, m3, s0, s1, s2, s3, k0, k1, k2, k3 + round a, b, c, d, \f, \k0, \m0, \s0 + round d, a, b, c, \f, \k1, \m1, \s1 + round c, d, a, b, \f, \k2, \m2, \s2 + round b, c, d, a, \f, \k3, \m3, \s3 +.endm + + /* do 4 rounds with f0, f1, f2, f3 */ +.macro rounds0 m0, m1, m2, m3, k0, k1, k2, k3 + rounds f0, \m0, \m1, \m2, \m3, 7, 12, 17, 22, \k0, \k1, \k2, \k3 +.endm + +.macro rounds1 m0, m1, m2, m3, k0, k1, k2, k3 + round1 a, b, c, d, \k0, \m0, 5 + round1 d, a, b, c, \k1, \m1, 9 + round1 c, d, a, b, \k2, \m2, 14 + round1 b, c, d, a, \k3, \m3, 20 +.endm + +.macro rounds2 m0, m1, m2, m3, k0, k1, k2, k3 + rounds f2, \m0, \m1, \m2, \m3, 4, 11, 16, 23, \k0, \k1, \k2, \k3 +.endm + +.macro rounds3 m0, m1, m2, m3, k0, k1, k2, k3 + rounds f3, \m0, \m1, \m2, \m3, 6, 10, 15, 21, \k0, \k1, \k2, \k3 +.endm + + /* md5block(MD5_CTX, buf, len) */ +ENTRY(_libmd_md5block) +ctx .req x0 +buf .req x1 +len .req x2 +end .req x2 // aliases len +a .req w3 +b .req w4 +c .req w5 +d .req w6 +f .req w7 +tmp .req w8 +k .req w9 +m0 .req w10 +m1 .req w11 +m2 .req w12 +m3 .req w13 +m4 .req w14 +m5 .req w15 +m6 .req w16 +m7 .req w17 + // x18 is the platform register +m8 .req w19 +m9 .req w20 +m10 .req w21 +m11 .req w22 +m12 .req w23 +m13 .req w24 +m14 .req w25 +m15 .req w26 + +a_ .req m0 +b_ .req m7 +c_ .req m14 +d_ .req m5 + + stp x19, x20, [sp, #-0x40]! + stp x21, x22, [sp, #0x10] + stp x23, x24, [sp, #0x20] + stp x25, x26, [sp, #0x30] + + bics len, len, #63 // length in blocks + add end, buf, len // end pointer + + beq .Lend // was len == 0 after BICS? + + ldp a, b, [ctx, #0] + ldp c, d, [ctx, #8] + + /* first eight rounds interleaved with data loads */ +.Lloop: ldp m0, m1, [buf, #0] + round a, b, c, d, f0, 0xd76aa478, m0, 7 + ldp m2, m3, [buf, #8] + round d, a, b, c, f0, 0xe8c7b756, m1, 12 + ldp m4, m5, [buf, #16] + round c, d, a, b, f0, 0x242070db, m2, 17 + ldp m6, m7, [buf, #24] + round b, c, d, a, f0, 0xc1bdceee, m3, 22 + + ldp m8, m9, [buf, #32] + round a, b, c, d, f0, 0xf57c0faf, m4, 7 + ldp m10, m11, [buf, #40] + round d, a, b, c, f0, 0x4787c62a, m5, 12 + ldp m12, m13, [buf, #48] + round c, d, a, b, f0, 0xa8304613, m6, 17 + ldp m14, m15, [buf, #56] + round b, c, d, a, f0, 0xfd469501, m7, 22 + + /* remaining rounds use the roundsX macros */ + rounds0 m8, m9, m10, m11, 0x698098d8, 0x8b44f7af, 0xffff5bb1, 0x895cd7be + rounds0 m12, m13, m14, m15, 0x6b901122, 0xfd987193, 0xa679438e, 0x49b40821 + + rounds1 m1, m6, m11, m0, 0xf61e2562, 0xc040b340, 0x265e5a51, 0xe9b6c7aa + rounds1 m5, m10, m15, m4, 0xd62f105d, 0x02441453, 0xd8a1e681, 0xe7d3fbc8 + rounds1 m9, m14, m3, m8, 0x21e1cde6, 0xc33707d6, 0xf4d50d87, 0x455a14ed + rounds1 m13, m2, m7, m12, 0xa9e3e905, 0xfcefa3f8, 0x676f02d9, 0x8d2a4c8a + + rounds2 m5, m8, m11, m14, 0xfffa3942, 0x8771f681, 0x6d9d6122, 0xfde5380c + rounds2 m1, m4, m7, m10, 0xa4beea44, 0x4bdecfa9, 0xf6bb4b60, 0xbebfbc70 + rounds2 m13, m0, m3, m6, 0x289b7ec6, 0xeaa127fa, 0xd4ef3085, 0x04881d05 + rounds2 m9, m12, m15, m2, 0xd9d4d039, 0xe6db99e5, 0x1fa27cf8, 0xc4ac5665 + + rounds3 m0, m7, m14, m5, 0xf4292244, 0x432aff97, 0xab9423a7, 0xfc93a039 + rounds3 m12, m3, m10, m1, 0x655b59c3, 0x8f0ccc92, 0xffeff47d, 0x85845dd1 + rounds3 m8, m15, m6, m13, 0x6fa87e4f, 0xfe2ce6e0, 0xa3014314, 0x4e0811a1 + rounds3 m4, m11, m2, m9, 0xf7537e82, 0xbd3af235, 0x2ad7d2bb, 0xeb86d391 + + ldp a_, b_, [ctx, #0] + ldp c_, d_, [ctx, #8] + add a, a, a_ + add b, b, b_ + add c, c, c_ + add d, d, d_ + stp a, b, [ctx, #0] + stp c, d, [ctx, #8] + + add buf, buf, #64 + cmp buf, end + bne .Lloop + +.Lend: ldp x25, x26, [sp, #0x30] + ldp x23, x24, [sp, #0x20] + ldp x21, x22, [sp, #0x10] + ldp x19, x20, [sp], #0x40 + + ret +END(_libmd_md5block) + +GNU_PROPERTY_AARCH64_FEATURE_1_NOTE(GNU_PROPERTY_AARCH64_FEATURE_1_VAL) + + .section .note.GNU-stack,"",%progbits diff --git a/lib/libmd/aarch64/sha1block.S b/lib/libmd/aarch64/sha1block.S index 56a0297efadd..e16fb36342fd 100644 --- a/lib/libmd/aarch64/sha1block.S +++ b/lib/libmd/aarch64/sha1block.S @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2024 Robert Clausecker <fuz@freebsd.org> + * Copyright (c) 2024 Robert Clausecker <fuz@FreeBSD.org> * * SPDX-License-Identifier: BSD-2-Clause * diff --git a/lib/libmd/aarch64/sha1dispatch.c b/lib/libmd/aarch64/sha1dispatch.c index e34bf0a1a344..045527044320 100644 --- a/lib/libmd/aarch64/sha1dispatch.c +++ b/lib/libmd/aarch64/sha1dispatch.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2024 Robert Clausecker <fuz@freebsd.org> + * Copyright (c) 2024 Robert Clausecker <fuz@FreeBSD.org> * * SPDX-License-Identifier: BSD-2-Clause */ diff --git a/lib/libmd/amd64/md5block.S b/lib/libmd/amd64/md5block.S new file mode 100644 index 000000000000..0dd594dd5dc2 --- /dev/null +++ b/lib/libmd/amd64/md5block.S @@ -0,0 +1,363 @@ +/*- + * Copyright (c) 2024, 2025 Robert Clausecker <fuz@FreeBSD.org> + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#include <machine/asm.h> + +/* apply the round keys to the four round functions */ +.macro allrounds rfn0, rfn1, rfn2, rfn3 + \rfn0 0, 0xd76aa478, 0xe8c7b756, 0x242070db, 0xc1bdceee + \rfn0 4, 0xf57c0faf, 0x4787c62a, 0xa8304613, 0xfd469501 + \rfn0 8, 0x698098d8, 0x8b44f7af, 0xffff5bb1, 0x895cd7be + \rfn0 12, 0x6b901122, 0xfd987193, 0xa679438e, 0x49b40821 + + \rfn1 16, 0xf61e2562, 0xc040b340, 0x265e5a51, 0xe9b6c7aa + \rfn1 20, 0xd62f105d, 0x02441453, 0xd8a1e681, 0xe7d3fbc8 + \rfn1 24, 0x21e1cde6, 0xc33707d6, 0xf4d50d87, 0x455a14ed + \rfn1 28, 0xa9e3e905, 0xfcefa3f8, 0x676f02d9, 0x8d2a4c8a + + \rfn2 32, 0xfffa3942, 0x8771f681, 0x6d9d6122, 0xfde5380c + \rfn2 36, 0xa4beea44, 0x4bdecfa9, 0xf6bb4b60, 0xbebfbc70 + \rfn2 40, 0x289b7ec6, 0xeaa127fa, 0xd4ef3085, 0x04881d05 + \rfn2 44, 0xd9d4d039, 0xe6db99e5, 0x1fa27cf8, 0xc4ac5665 + + \rfn3 48, 0xf4292244, 0x432aff97, 0xab9423a7, 0xfc93a039 + \rfn3 52, 0x655b59c3, 0x8f0ccc92, 0xffeff47d, 0x85845dd1 + \rfn3 56, 0x6fa87e4f, 0xfe2ce6e0, 0xa3014314, 0x4e0811a1 + \rfn3 60, 0xf7537e82, 0xbd3af235, 0x2ad7d2bb, 0xeb86d391 +.endm + + // md5block(MD5_CTX, buf, len) +ENTRY(_libmd_md5block_baseline) +.macro round a, b, c, d, f, k, m, s + \f %ebp, \b, \c, \d + add $\k, \a // a + k[i] + add ((\m)%16*4)(%rsi), \a // a + k[i] + m[g] + add %ebp, \a // a + k[i] + m[g] + f + rol $\s, \a + add \b, \a +.endm + + // f = b ? c : d +.macro f0 f, b, c, d + mov \c, \f + xor \d, \f + and \b, \f + xor \d, \f +.endm + + // f = d ? b : c +.macro f1 f, b, c, d + mov \c, \f + xor \b, \f + and \d, \f + xor \c, \f +.endm + + // f = b ^ c ^ d +.macro f2 f, b, c, d + mov \c, \f + xor \d, \f + xor \b, \f +.endm + + // f = c ^ (b | ~d) +.macro f3 f, b, c, d + mov $-1, \f + xor \d, \f + or \b, \f + xor \c, \f +.endm + + // do 4 rounds +.macro rounds f, p, q, s0, s1, s2, s3, k0, k1, k2, k3 + round %eax, %ebx, %ecx, %edx, \f, \k0, \p*0+\q, \s0 + round %edx, %eax, %ebx, %ecx, \f, \k1, \p*1+\q, \s1 + round %ecx, %edx, %eax, %ebx, \f, \k2, \p*2+\q, \s2 + round %ebx, %ecx, %edx, %eax, \f, \k3, \p*3+\q, \s3 +.endm + + // do 4 rounds with f0, f1, f2, f3 +.macro rounds0 i, k0, k1, k2, k3 + rounds f0, 1, \i, 7, 12, 17, 22, \k0, \k1, \k2, \k3 +.endm + +.macro rounds1 i, k0, k1, k2, k3 + rounds f1, 5, 5*\i+1, 5, 9, 14, 20, \k0, \k1, \k2, \k3 +.endm + +.macro rounds2 i, k0, k1, k2, k3 + rounds f2, 3, 3*\i+5, 4, 11, 16, 23, \k0, \k1, \k2, \k3 +.endm + +.macro rounds3 i, k0, k1, k2, k3 + rounds f3, 7, 7*\i, 6, 10, 15, 21, \k0, \k1, \k2, \k3 +.endm + + push %rbx + push %rbp + push %r12 + + and $~63, %rdx // length in blocks + lea (%rsi, %rdx, 1), %r12 // end pointer + + mov (%rdi), %eax // a + mov 4(%rdi), %ebx // b + mov 8(%rdi), %ecx // c + mov 12(%rdi), %edx // d + + cmp %rsi, %r12 // any data to process? + je .Lend + + .balign 16 +.Lloop: mov %eax, %r8d + mov %ebx, %r9d + mov %ecx, %r10d + mov %edx, %r11d + + allrounds rounds0, rounds1, rounds2, rounds3 + + add %r8d, %eax + add %r9d, %ebx + add %r10d, %ecx + add %r11d, %edx + + add $64, %rsi + cmp %rsi, %r12 + jne .Lloop + + mov %eax, (%rdi) + mov %ebx, 4(%rdi) + mov %ecx, 8(%rdi) + mov %edx, 12(%rdi) + +.Lend: pop %r12 + pop %rbp + pop %rbx + ret +END(_libmd_md5block_baseline) + + /* + * An implementation leveraging the ANDN instruction + * from BMI1 to shorten some dependency chains. + */ +ENTRY(_libmd_md5block_bmi1) + // special-cased round 1 + // f1 = d ? b : c = (d & b) + (~d & c) +.macro round1 a, b, c, d, k, m, s + andn \c, \d, %edi // ~d & c + add $\k, \a // a + k[i] + mov \d, %ebp + add ((\m)%16*4)(%rsi), \a // a + k[i] + m[g] + and \b, %ebp // d & b + add %edi, \a // a + k[i] + m[g] + (~d & c) + add %ebp, \a // a + k[i] + m[g] + (~d & c) + (d & b) + rol $\s, \a + add \b, \a +.endm + + // special-cased round 3 + // f3 = c ^ (b | ~d) = ~(c ^ ~b & d) = -1 - (c ^ ~b & d) +.macro round3 a, b, c, d, k, m, s + andn \d, \b, %ebp + add $\k - 1, \a // a + k[i] - 1 + add ((\m)%16*4)(%rsi), \a // a + k[i] + m[g] + xor \c, %ebp + sub %ebp, \a // a + k[i] + m[g] + f + rol $\s, \a + add \b, \a +.endm + + .purgem rounds1 +.macro rounds1 i, k0, k1, k2, k3 + round1 %eax, %ebx, %ecx, %edx, \k0, 5*\i+ 1, 5 + round1 %edx, %eax, %ebx, %ecx, \k1, 5*\i+ 6, 9 + round1 %ecx, %edx, %eax, %ebx, \k2, 5*\i+11, 14 + round1 %ebx, %ecx, %edx, %eax, \k3, 5*\i+16, 20 +.endm + + .purgem rounds3 +.macro rounds3 i, k0, k1, k2, k3 + round3 %eax, %ebx, %ecx, %edx, \k0, 7*\i+ 0, 6 + round3 %edx, %eax, %ebx, %ecx, \k1, 7*\i+ 7, 10 + round3 %ecx, %edx, %eax, %ebx, \k2, 7*\i+14, 15 + round3 %ebx, %ecx, %edx, %eax, \k3, 7*\i+21, 21 +.endm + + push %rbx + push %rbp + push %r12 + + and $~63, %rdx // length in blocks + lea (%rsi, %rdx, 1), %r12 // end pointer + + mov (%rdi), %eax // a + mov 4(%rdi), %ebx // b + mov 8(%rdi), %ecx // c + mov 12(%rdi), %edx // d + + cmp %rsi, %r12 // any data to process? + je 0f + + push %rdi + + .balign 16 +1: mov %eax, %r8d + mov %ebx, %r9d + mov %ecx, %r10d + mov %edx, %r11d + + allrounds rounds0, rounds1, rounds2, rounds3 + + add %r8d, %eax + add %r9d, %ebx + add %r10d, %ecx + add %r11d, %edx + + add $64, %rsi + cmp %rsi, %r12 + jne 1b + + pop %rdi + mov %eax, (%rdi) + mov %ebx, 4(%rdi) + mov %ecx, 8(%rdi) + mov %edx, 12(%rdi) + +0: pop %r12 + pop %rbp + pop %rbx + ret +END(_libmd_md5block_bmi1) + +#ifndef _KERNEL + /* + * An implementation leveraging AVX-512 for its VPTERNLOGD + * instruction. We're using only XMM registers here, + * avoiding costly thermal licensing. + */ +ENTRY(_libmd_md5block_avx512) +.macro vround a, b, c, d, f, i, m, mi, s + vmovdqa \b, %xmm4 + vpternlogd $\f, \d, \c, %xmm4 + vpaddd 4*(\i)(%rax){1to4}, \m, %xmm5 // m[g] + k[i] +.if \mi != 0 + vpshufd $0x55 * \mi, %xmm5, %xmm5 // broadcast to each dword +.endif + vpaddd %xmm5, \a, \a // a + k[i] + m[g] + vpaddd %xmm4, \a, \a // a + k[i] + m[g] + f + vprold $\s, \a, \a + vpaddd \b, \a, \a +.endm + +.macro vrounds f, i, m0, i0, m1, i1, m2, i2, m3, i3, s0, s1, s2, s3 + vround %xmm0, %xmm1, %xmm2, %xmm3, \f, \i+0, \m0, \i0, \s0 + vround %xmm3, %xmm0, %xmm1, %xmm2, \f, \i+1, \m1, \i1, \s1 + vround %xmm2, %xmm3, %xmm0, %xmm1, \f, \i+2, \m2, \i2, \s2 + vround %xmm1, %xmm2, %xmm3, %xmm0, \f, \i+3, \m3, \i3, \s3 +.endm + +/* + * d c b f0 f1 f2 f3 + * 0 0 0 0 0 0 1 + * 1 0 0 1 0 1 0 + * 0 1 0 0 1 1 0 + * 1 1 0 1 0 0 1 + * 0 0 1 0 0 1 1 + * 1 0 1 0 1 0 1 + * 0 1 1 1 1 0 0 + * 1 1 1 1 1 1 0 + */ + +.macro vrounds0 i, m + vrounds 0xca, \i, \m, 0, \m, 1, \m, 2, \m, 3, 7, 12, 17, 22 +.endm + +.macro vrounds1 i, m0, i0, m1, i1, m2, i2, m3, i3 + vrounds 0xe4, \i, \m0, \i0, \m1, \i1, \m2, \i2, \m3, \i3, 5, 9, 14, 20 +.endm + +.macro vrounds2 i, m0, i0, m1, i1, m2, i2, m3, i3 + vrounds 0x96, \i, \m0, \i0, \m1, \i1, \m2, \i2, \m3, \i3, 4, 11, 16, 23 +.endm + +.macro vrounds3 i, m0, i0, m1, i1, m2, i2, m3, i3 + vrounds 0x39, \i, \m0, \i0, \m1, \i1, \m2, \i2, \m3, \i3, 6, 10, 15, 21 +.endm + + and $~63, %rdx // length in blocks + add %rsi, %rdx // end pointer + + vmovd (%rdi), %xmm0 // a + vmovd 4(%rdi), %xmm1 // b + vmovd 8(%rdi), %xmm2 // c + vmovd 12(%rdi), %xmm3 // d + + lea keys(%rip), %rax + + cmp %rsi, %rdx // any data to process? + je 0f + + .balign 16 +1: vmovdqu 0*4(%rsi), %xmm8 // message words + vmovdqu 4*4(%rsi), %xmm9 + vmovdqu 8*4(%rsi), %xmm10 + vmovdqu 12*4(%rsi), %xmm11 + + vmovdqa %xmm0, %xmm12 // stash old state variables + vmovdqa %xmm1, %xmm13 + vmovdqa %xmm2, %xmm14 + vmovdqa %xmm3, %xmm15 + + vrounds0 0, %xmm8 + vrounds0 4, %xmm9 + vrounds0 8, %xmm10 + vrounds0 12, %xmm11 + + vrounds1 16, %xmm8, 1, %xmm9, 2, %xmm10, 3, %xmm8, 0 + vrounds1 20, %xmm9, 1, %xmm10, 2, %xmm11, 3, %xmm9, 0 + vrounds1 24, %xmm10, 1, %xmm11, 2, %xmm8, 3, %xmm10, 0 + vrounds1 28, %xmm11, 1, %xmm8, 2, %xmm9, 3, %xmm11, 0 + + vrounds2 32, %xmm9, 1, %xmm10, 0, %xmm10, 3, %xmm11, 2 + vrounds2 36, %xmm8, 1, %xmm9, 0, %xmm9, 3, %xmm10, 2 + vrounds2 40, %xmm11, 1, %xmm8, 0, %xmm8, 3, %xmm9, 2 + vrounds2 44 %xmm10, 1, %xmm11, 0, %xmm11, 3, %xmm8, 2 + + vrounds3 48, %xmm8, 0, %xmm9, 3, %xmm11, 2, %xmm9, 1 + vrounds3 52, %xmm11, 0, %xmm8, 3, %xmm10, 2, %xmm8, 1 + vrounds3 56, %xmm10, 0, %xmm11, 3, %xmm9, 2, %xmm11, 1 + vrounds3 60, %xmm9, 0, %xmm10, 3, %xmm8, 2, %xmm10, 1 + + vpaddd %xmm12, %xmm0, %xmm0 + vpaddd %xmm13, %xmm1, %xmm1 + vpaddd %xmm14, %xmm2, %xmm2 + vpaddd %xmm15, %xmm3, %xmm3 + + add $64, %rsi + cmp %rsi, %rdx + jne 1b + + vmovd %xmm0, (%rdi) + vmovd %xmm1, 4(%rdi) + vmovd %xmm2, 8(%rdi) + vmovd %xmm3, 12(%rdi) + +0: ret +END(_libmd_md5block_avx512) + + // round keys, for use in md5block_avx512 + .section .rodata + .balign 16 + +.macro putkeys i, a, b, c, d + .4byte \a, \b, \c, \d +.endm + +keys: allrounds putkeys, putkeys, putkeys, putkeys + .size keys, .-keys +#endif /* !defined(_KERNEL) */ + + .section .note.GNU-stack,"",%progbits diff --git a/lib/libmd/amd64/md5dispatch.c b/lib/libmd/amd64/md5dispatch.c new file mode 100644 index 000000000000..dd2131c5a57c --- /dev/null +++ b/lib/libmd/amd64/md5dispatch.c @@ -0,0 +1,41 @@ +/*- + * Copyright (c) 2024 Robert Clausecker <fuz@FreeBSD.org> + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#include <sys/types.h> +#include <sys/md5.h> + +#include <machine/cpufunc.h> +#include <machine/specialreg.h> +#include <stdint.h> +#include <string.h> +#include <x86/ifunc.h> + +extern void _libmd_md5block_baseline(MD5_CTX *, const void *, size_t); +extern void _libmd_md5block_bmi1(MD5_CTX *, const void *, size_t); +extern void _libmd_md5block_avx512(MD5_CTX *, const void *, size_t); + +DEFINE_UIFUNC(, void, _libmd_md5block, (MD5_CTX *, const void *, size_t)) +{ + if ((cpu_stdext_feature & (CPUID_STDEXT_AVX512F | CPUID_STDEXT_AVX512VL)) + == (CPUID_STDEXT_AVX512F | CPUID_STDEXT_AVX512VL)) { + u_int regs[4]; + char cpu_vendor[12]; + + do_cpuid(0, regs); + ((u_int *)&cpu_vendor)[0] = regs[1]; + ((u_int *)&cpu_vendor)[1] = regs[3]; + ((u_int *)&cpu_vendor)[2] = regs[2]; + + /* the AVX-512 kernel performs poorly on AMD */ + if (memcmp(cpu_vendor, AMD_VENDOR_ID, sizeof(cpu_vendor)) != 0) + return (_libmd_md5block_avx512); + } + + if (cpu_stdext_feature & CPUID_STDEXT_BMI1) + return (_libmd_md5block_bmi1); + else + return (_libmd_md5block_baseline); +} diff --git a/lib/libmd/amd64/sha1block.S b/lib/libmd/amd64/sha1block.S index f1291ef2647a..6ef083178abc 100644 --- a/lib/libmd/amd64/sha1block.S +++ b/lib/libmd/amd64/sha1block.S @@ -1,6 +1,6 @@ /*- * Copyright (c) 2013 The Go Authors. All rights reserved. - * Copyright (c) 2024 Robert Clausecker <fuz@freebsd.org> + * Copyright (c) 2024 Robert Clausecker <fuz@FreeBSD.org> * * Adapted from Go's crypto/sha1/sha1block_amd64.s. * diff --git a/lib/libmd/amd64/sha1dispatch.c b/lib/libmd/amd64/sha1dispatch.c index 86509195d56e..c82a60334739 100644 --- a/lib/libmd/amd64/sha1dispatch.c +++ b/lib/libmd/amd64/sha1dispatch.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2016 The Go Authors. All rights reserved. - * Copyright (c) 2024 Robert Clausecker <fuz@freebsd.org> + * Copyright (c) 2024 Robert Clausecker <fuz@FreeBSD.org> * * Adapted from Go's crypto/sha1/sha1block_amd64.go. * diff --git a/lib/libmd/sha1c.c b/lib/libmd/sha1c.c index 128e0b991742..02132d720dac 100644 --- a/lib/libmd/sha1c.c +++ b/lib/libmd/sha1c.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2009 The Go Authors. All rights reserved. - * Copyright (c) 2024 Robert Clausecker <fuz@freebsd.org> + * Copyright (c) 2024 Robert Clausecker <fuz@FreeBSD.org> * * Adapted from Go's crypto/sha1/sha1.go. * diff --git a/lib/libpam/libpam/Makefile b/lib/libpam/libpam/Makefile index dd19eba5c1ec..c6db4992bb36 100644 --- a/lib/libpam/libpam/Makefile +++ b/lib/libpam/libpam/Makefile @@ -148,10 +148,10 @@ MAN?= openpam.3 \ pam_strerror.3 \ pam_verror.3 \ pam_vinfo.3 \ - pam_vprompt.3 \ - pam.conf.5 + pam_vprompt.3 -MLINKS?= pam.conf.5 pam.d.5 +MANNODEV?= pam.conf.5 +MANNODEVLINKS?= pam.conf.5 pam.d.5 CFLAGS+= -DLOCALBASE=\"${LOCALBASE:U/usr/local}\" CFLAGS+= -I${OPENPAM}/include diff --git a/lib/libpam/static_libpam/Makefile b/lib/libpam/static_libpam/Makefile index a1f0f209dea1..8830f09ef0da 100644 --- a/lib/libpam/static_libpam/Makefile +++ b/lib/libpam/static_libpam/Makefile @@ -42,6 +42,7 @@ NO_PIC= # Avoid redundancy with the master Makefile. MAN= +MANNODEV= INCS= MLINKS= MK_TESTS= no diff --git a/lib/libpcap/Makefile b/lib/libpcap/Makefile index 9ba91504852b..c4bd175b502a 100644 --- a/lib/libpcap/Makefile +++ b/lib/libpcap/Makefile @@ -109,10 +109,11 @@ MAN= pcap.3 \ pcap_strerror.3 \ pcap_tstamp_type_name_to_val.3 \ pcap_tstamp_type_val_to_name.3 \ - pcap-savefile.5 \ - pcap-filter.7 \ - pcap-linktype.7 \ - pcap-tstamp.7 + pcap-savefile.5 + +MANNODEV= pcap-filter.7 \ + pcap-linktype.7 \ + pcap-tstamp.7 MLINKS= \ pcap_datalink_val_to_name.3 pcap_datalink_val_to_description.3 \ @@ -129,7 +130,7 @@ MLINKS= \ pcap_setnonblock.3 pcap_getnonblock.3 # Our man pages are a special copy from the distdir. See below. -CLEANFILES+=${MAN} +CLEANFILES+=${MAN} ${MANNODEV} CLEANFILES+=grammar.y scanner.h tokdefs.h YFLAGS+=-p pcap_ @@ -175,7 +176,7 @@ tokdefs.h: grammar.h .NOMETA # # Magic to convert the man pages to something non Solarish # -.for _page in ${MAN} +.for _page in ${MAN} ${MANNODEV} ${_page}: if [ -f ${PCAP_DISTDIR}/${_page:S/3$/3pcap/} ]; then \ F=${_page:S/3$/3pcap/}; \ diff --git a/lib/libradius/Makefile b/lib/libradius/Makefile index 0ab83d5418b1..b6857a71260a 100644 --- a/lib/libradius/Makefile +++ b/lib/libradius/Makefile @@ -31,7 +31,9 @@ INCS= radlib.h radlib_vs.h CFLAGS+= -Wall CFLAGS+= -DOPENSSL_API_COMPAT=0x10100000L SHLIB_MAJOR= 4 -MAN= libradius.3 radius.conf.5 + +MAN= libradius.3 +MANNODEV= radius.conf.5 MLINKS+=libradius.3 rad_acct_open.3 \ libradius.3 rad_add_server.3 \ diff --git a/lib/libsys/getrlimitusage.2 b/lib/libsys/getrlimitusage.2 index e2114def56c2..d0e92d7f88b4 100644 --- a/lib/libsys/getrlimitusage.2 +++ b/lib/libsys/getrlimitusage.2 @@ -25,7 +25,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd September 27, 2024 +.Dd October 24, 2025 .Dt GETRLIMITUSAGE 2 .Os .Sh NAME @@ -97,4 +97,4 @@ and The .Fn getrlimitusage system call appeared in -.Bx 15.0 . +.Fx 14.2 . diff --git a/lib/libsys/write.2 b/lib/libsys/write.2 index d2ff41ceead9..77067893ab4c 100644 --- a/lib/libsys/write.2 +++ b/lib/libsys/write.2 @@ -132,6 +132,26 @@ and may write fewer bytes than requested; the return value must be noted, and the remainder of the operation should be retried when possible. +.Sh ATOMICITY OF WRITES +When operating on regular files on local file systems, the effects of +.Fn write +are atomic. +As required by the POSIX standard, +the +.Fn read , +.Fn write , +and +.Fn ftruncate +functions and their variations are atomic with respect to +each other on the file data and metadata for regular files. +See for instance +.St -p1003.1-2024 +Volume 2, Section 2.9.7 for more information. +.Pp +.Fx +implements the requirement by taking +a read/write range lock on the file byte range +affected by the corresponding function. .Sh RETURN VALUES Upon successful completion the number of bytes which were written is returned. diff --git a/lib/libtacplus/Makefile b/lib/libtacplus/Makefile index 43567350aeac..2149b57b124a 100644 --- a/lib/libtacplus/Makefile +++ b/lib/libtacplus/Makefile @@ -29,7 +29,9 @@ INCS= taclib.h CFLAGS+= -Wall LIBADD= md pam SHLIB_MAJOR= 5 -MAN= libtacplus.3 tacplus.conf.5 + +MAN= libtacplus.3 +MANNODEV= tacplus.conf.5 WARNS?= 2 diff --git a/lib/libutil/Makefile b/lib/libutil/Makefile index f6251c093345..d54d9af38a34 100644 --- a/lib/libutil/Makefile +++ b/lib/libutil/Makefile @@ -147,7 +147,8 @@ MLINKS+=uucplock.3 uu_lock.3 MLINKS+=uucplock.3 uu_lock_txfr.3 MLINKS+=uucplock.3 uu_lockerr.3 MLINKS+=uucplock.3 uu_unlock.3 -MAN+= login.conf.5 + +MANNODEV= login.conf.5 HAS_TESTS= SUBDIR.${MK_TESTS}+= tests diff --git a/lib/libwrap/Makefile b/lib/libwrap/Makefile index bc39d5804637..7c302e0f0dc5 100644 --- a/lib/libwrap/Makefile +++ b/lib/libwrap/Makefile @@ -1,6 +1,3 @@ -# -# - .include <src.opts.mk> PACKAGE= tcpd @@ -9,12 +6,14 @@ CONFS= hosts.allow LIB= wrap SHLIB_MAJOR= 6 INCS= tcpd.h -MAN= hosts_access.3 -MAN+= hosts_access.5 hosts_options.5 -MLINKS= hosts_access.3 hosts_ctl.3 \ - hosts_access.3 request_init.3 \ - hosts_access.3 request_set.3 \ - hosts_options.5 hosts.allow.5 + +MAN= hosts_access.3 +MLINKS= hosts_access.3 hosts_ctl.3 \ + hosts_access.3 request_init.3 \ + hosts_access.3 request_set.3 + +MANNODEV= hosts_access.5 hosts_options.5 +MANNODEVLINKS= hosts_options.5 hosts.allow.5 .PATH: ${SRCTOP}/contrib/tcp_wrappers diff --git a/lib/libxo/libxo/Makefile b/lib/libxo/libxo/Makefile index 38e6ff031c7f..9caf8a498b05 100644 --- a/lib/libxo/libxo/Makefile +++ b/lib/libxo/libxo/Makefile @@ -51,7 +51,7 @@ MAN+= xo_attr.3 \ MAN+= xo_format.5 -MAN+= xo_options.7 +MANNODEV= xo_options.7 MLINKS= xo_attr.3 xo_attr_h.3 \ xo_attr.3 xo_attr_hv.3 \ diff --git a/lib/ncurses/tinfo/Makefile b/lib/ncurses/tinfo/Makefile index 8f01557edaee..08c2311cd7a9 100644 --- a/lib/ncurses/tinfo/Makefile +++ b/lib/ncurses/tinfo/Makefile @@ -399,6 +399,7 @@ terminfo.5: MKterminfo.sh terminfo.head Caps CLEANFILES+= terminfo.5 .PATH: ${NCURSES_DIR}/man + MAN= \ curs_addch.3 \ curs_addchstr.3 \ @@ -475,8 +476,9 @@ MAN+= \ curs_printw.3 \ curs_scanw.3 -MAN+= term.5 terminfo.5 scr_dump.5 user_caps.5 -MAN+= term.7 +MAN+= scr_dump.5 + +MANNODEV= term.5 term.7 terminfo.5 user_caps.5 CLEANFILES+= ${MAN:M*.3} diff --git a/lib/nss_tacplus/Makefile b/lib/nss_tacplus/Makefile index c85297a7dbaa..e6fb934c234b 100644 --- a/lib/nss_tacplus/Makefile +++ b/lib/nss_tacplus/Makefile @@ -4,6 +4,6 @@ SHLIB_MAJOR= 1 SHLIB_NAME= ${LIB}.so.${SHLIB_MAJOR} LIBADD= tacplus MK_INSTALLLIB= no -MAN= ${LIB}.8 +MANNODEV= ${LIB}.8 .include <bsd.lib.mk> diff --git a/libexec/blocklistd-helper/blacklistd-helper b/libexec/blocklistd-helper/blacklistd-helper index 92f768e86cdf..053c9ce9b2a2 100644 --- a/libexec/blocklistd-helper/blacklistd-helper +++ b/libexec/blocklistd-helper/blacklistd-helper @@ -280,7 +280,7 @@ flush) # dynamically determine which anchors exist for anchor in $(/sbin/pfctl -a "$2" -s Anchors 2> /dev/null); do /sbin/pfctl -a "$anchor" -t "port${anchor##*/}" -T flush 2> /dev/null - /sbin/pfctl -a "$anchor" -F rules + /sbin/pfctl -a "$anchor" -F rules 2> /dev/null done echo OK ;; diff --git a/libexec/flua/Makefile b/libexec/flua/Makefile index 23de404710d0..f1c46b270ded 100644 --- a/libexec/flua/Makefile +++ b/libexec/flua/Makefile @@ -1,5 +1,7 @@ .include <src.lua.mk> +PACKAGE= flua + # New flua modules should be added here rather than to SUBDIR so that we can do # the right thing for both bootstrap flua and target flua. The former does not # do any shared libs, so we just build them all straight into flua itself rather diff --git a/libexec/flua/Makefile.inc b/libexec/flua/Makefile.inc index 37a49e258ecb..5e214c76921b 100644 --- a/libexec/flua/Makefile.inc +++ b/libexec/flua/Makefile.inc @@ -1,3 +1,5 @@ +PACKAGE= flua + SHLIBDIR?= ${LIBDIR}/flua CFLAGS+= \ diff --git a/release/packages/ucl/bsdinstall.ucl b/release/packages/ucl/bsdinstall.ucl index 7fe8898b9427..96ff220bfb54 100644 --- a/release/packages/ucl/bsdinstall.ucl +++ b/release/packages/ucl/bsdinstall.ucl @@ -21,4 +21,9 @@ deps { "runtime" { version = "${VERSION}" }, + + # the pkgbase script requires flua + "flua" { + version = "${VERSION}" + }, } diff --git a/release/packages/ucl/dhclient-all.ucl b/release/packages/ucl/dhclient-all.ucl index bae3c7d7c413..b540a23eeb71 100644 --- a/release/packages/ucl/dhclient-all.ucl +++ b/release/packages/ucl/dhclient-all.ucl @@ -46,5 +46,5 @@ EOD licenses = [ "BSD-3-Clause" ] annotations { - set = minimal + set = "minimal,minimal-jail" } diff --git a/release/packages/ucl/dhclient.ucl b/release/packages/ucl/dhclient.ucl new file mode 100644 index 000000000000..f15ca8703edf --- /dev/null +++ b/release/packages/ucl/dhclient.ucl @@ -0,0 +1,26 @@ +/* + * SPDX-License-Identifier: ISC + * + * Copyright (c) 2025 Lexi Winter <ivy@FreeBSD.org> + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +deps { + # dhclient uses resolvconf to update /etc/resolv.conf in case the + # DHCP server returns nameserver addresses. + "resolvconf" { + version = "${VERSION}" + }, +} + diff --git a/release/packages/ucl/flua-all.ucl b/release/packages/ucl/flua-all.ucl new file mode 100644 index 000000000000..7488e2e36839 --- /dev/null +++ b/release/packages/ucl/flua-all.ucl @@ -0,0 +1,32 @@ +/* + * SPDX-License-Identifier: ISC + * + * Copyright (c) 2025 Lexi Winter <ivy@FreeBSD.org> + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +comment = "Private Lua implementation" + +desc = <<EOD +flua(1) is an implementation of Lua for use by the base system. This facility +is not intended for general use, and may be modified or removed at any time +without notice. + +Supported versions of Lua for general use are available in the FreeBSD Ports +Collection. +EOD + +annotations { + set = "optional,optional-jail" +} diff --git a/release/packages/ucl/local-unbound.ucl b/release/packages/ucl/local-unbound.ucl index 0f1c77a0d0ee..34d4c3664c9e 100644 --- a/release/packages/ucl/local-unbound.ucl +++ b/release/packages/ucl/local-unbound.ucl @@ -25,3 +25,11 @@ by running "service local_unbound setup" before restarting the service. EOM } ] + +deps { + # local-unbound uses resolvconf to update resolv.conf and to generate + # its forward.conf. + "resolvconf" { + version = "${VERSION}" + }, +} diff --git a/release/packages/ucl/nuageinit-all.ucl b/release/packages/ucl/nuageinit-all.ucl index c9913f8cfb88..8c7a0754040c 100644 --- a/release/packages/ucl/nuageinit-all.ucl +++ b/release/packages/ucl/nuageinit-all.ucl @@ -27,6 +27,13 @@ loaded from a local disk or CD-ROM. nuageinit implements the cloud-init (https://cloud-init.io/) specification. EOD +deps { + # nuageinit is written in Lua + "flua" { + version = "${VERSION}" + }, +} + annotations { set = minimal } diff --git a/release/packages/ucl/tests.ucl b/release/packages/ucl/tests.ucl new file mode 100644 index 000000000000..bac72f1534d3 --- /dev/null +++ b/release/packages/ucl/tests.ucl @@ -0,0 +1,27 @@ +/* + * SPDX-License-Identifier: ISC + * + * Copyright (c) 2025 Lexi Winter <ivy@FreeBSD.org> + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + + +deps { + # Quite a few tests require flua. + "flua" { + version = "${VERSION}" + }, +} + + diff --git a/release/scripts/mtree-to-plist.awk b/release/scripts/mtree-to-plist.awk index a9f1e194389a..38c9963680ee 100644 --- a/release/scripts/mtree-to-plist.awk +++ b/release/scripts/mtree-to-plist.awk @@ -40,12 +40,6 @@ for (i in a) { if (a[i] ~ /^package=/) { pkgname=a[i] - if ($1 ~ /^\/boot\//) { - if (kernel != "" && $1 ~ /^\/boot\/dtb\//) - pkgname="dtb" - else if ($1 !~ /^\/boot\/firmware\//) - pkgname="bootloader" - } gsub(/package=/, "", pkgname) } else if (a[i] == "config") { type="config" diff --git a/sbin/fdisk/fdisk.8 b/sbin/fdisk/fdisk.8 index 09933acf57df..f26e6bb67d6e 100644 --- a/sbin/fdisk/fdisk.8 +++ b/sbin/fdisk/fdisk.8 @@ -1,5 +1,5 @@ .\" -.Dd October 5, 2016 +.Dd October 24, 2025 .Dt FDISK 8 .Os .Sh NAME @@ -18,7 +18,7 @@ .Sh DEPRECATION NOTICE .Nm is deprecated and is not available in -.Fx 15.0 +.Fx 16.0 or later. Use .Xr gpart 8 diff --git a/sbin/fdisk/fdisk.c b/sbin/fdisk/fdisk.c index 925cc68932d7..28230191bb16 100644 --- a/sbin/fdisk/fdisk.c +++ b/sbin/fdisk/fdisk.c @@ -266,7 +266,7 @@ main(int argc, char *argv[]) struct dos_partition *partp; fprintf(stderr, - "WARNING: fdisk is deprecated and is not available in FreeBSD 15 or later.\n" + "WARNING: fdisk is deprecated and is not available in FreeBSD 16 or later.\n" "Please use gpart instead.\n\n"); while ((c = getopt(argc, argv, "BIab:f:ipqstuv1234")) != -1) diff --git a/sbin/ipfw/dummynet.c b/sbin/ipfw/dummynet.c index 6714b2af3124..a0cefcffd183 100644 --- a/sbin/ipfw/dummynet.c +++ b/sbin/ipfw/dummynet.c @@ -680,7 +680,7 @@ ipfw_delete_pipe(int do_pipe, int i) i = do_cmd(IP_DUMMYNET3, &cmd, cmd.oid.len); if (i) { i = 1; - warn("rule %u: setsockopt(IP_DUMMYNET_DEL)", i); + warn("rule %u: setsockopt(IP_DUMMYNET3)", i); } return i; } @@ -1863,7 +1863,7 @@ end_mask: i = do_cmd(IP_DUMMYNET3, base, (char *)buf - (char *)base); if (i) - err(1, "setsockopt(%s)", "IP_DUMMYNET_CONFIGURE"); + err(1, "setsockopt(%s)", "IP_DUMMYNET3"); } void diff --git a/sbin/ipfw/ipfw2.c b/sbin/ipfw/ipfw2.c index 2addc0295f0f..eed390ba5bec 100644 --- a/sbin/ipfw/ipfw2.c +++ b/sbin/ipfw/ipfw2.c @@ -648,7 +648,7 @@ do_cmd(int optname, void *optval, uintptr_t optlen) if (ipfw_socket < 0) err(EX_UNAVAILABLE, "socket"); - if (optname == IP_FW_GET || optname == IP_DUMMYNET_GET || + if (optname == IP_FW_GET || optname == IP_FW_ADD || optname == IP_FW3 || optname == IP_FW_NAT_GET_CONFIG || optname < 0 || diff --git a/sbin/nvmecontrol/perftest.c b/sbin/nvmecontrol/perftest.c index 59439d3ed2a9..da75afc64d8d 100644 --- a/sbin/nvmecontrol/perftest.c +++ b/sbin/nvmecontrol/perftest.c @@ -171,7 +171,7 @@ perftest(const struct cmd *f, int argc, char *argv[]) arg_help(argc, argv, f); } if (opt.time == 0) { - fprintf(stderr, "No time speciifed\n"); + fprintf(stderr, "No time specified\n"); arg_help(argc, argv, f); } io_test.time = opt.time; diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index 0f7702fc4630..127e2c257d69 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -6246,7 +6246,7 @@ check_binat_redirspec(struct node_host *src_host, struct pfctl_rule *r, } if (PF_AZERO(&r->src.addr.v.a.mask, af) || PF_AZERO(&(nat_pool->addr.v.a.mask), af)) { - yyerror ("source and redir addresess must have " + yyerror ("source and redir addresses must have " "a matching network mask in binat-rule"); error++; } diff --git a/share/examples/mdoc/example.1 b/share/examples/mdoc/example.1 index 0bdabe95aa95..daffb8bc0422 100644 --- a/share/examples/mdoc/example.1 +++ b/share/examples/mdoc/example.1 @@ -1,28 +1,7 @@ .\" -.\" SPDX-License-Identifier: BSD-2-Clause -.\" .\" Copyright (c) [year] [your name] .\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. +.\" SPDX-License-Identifier: BSD-2-Clause .\" .\" Note: The date here should be updated whenever a non-trivial .\" change is made to the manual page. diff --git a/share/examples/mdoc/example.3 b/share/examples/mdoc/example.3 index c4e85062cad1..22c398e0491c 100644 --- a/share/examples/mdoc/example.3 +++ b/share/examples/mdoc/example.3 @@ -1,28 +1,7 @@ .\" -.\" SPDX-License-Identifier: BSD-2-Clause -.\" .\" Copyright (c) [year] [your name] .\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. +.\" SPDX-License-Identifier: BSD-2-Clause .\" .\" Note: The date here should be updated whenever a non-trivial .\" change is made to the manual page. diff --git a/share/examples/mdoc/example.4 b/share/examples/mdoc/example.4 index 47ae5456b79a..e627f81af530 100644 --- a/share/examples/mdoc/example.4 +++ b/share/examples/mdoc/example.4 @@ -1,28 +1,7 @@ .\" -.\" SPDX-License-Identifier: BSD-2-Clause -.\" .\" Copyright (c) [year] [your name] .\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. +.\" SPDX-License-Identifier: BSD-2-Clause .\" .\" Note: The date here should be updated whenever a non-trivial .\" change is made to the manual page. diff --git a/share/examples/mdoc/example.9 b/share/examples/mdoc/example.9 index 1dd24a99fd42..f105f7465f2c 100644 --- a/share/examples/mdoc/example.9 +++ b/share/examples/mdoc/example.9 @@ -1,28 +1,7 @@ .\" -.\" SPDX-License-Identifier: BSD-2-Clause -.\" .\" Copyright (c) [year] [your name] .\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. +.\" SPDX-License-Identifier: BSD-2-Clause .\" .\" Note: The date here should be updated whenever a non-trivial .\" change is made to the manual page. diff --git a/share/man/man3/Makefile b/share/man/man3/Makefile index 3511acb254e1..18e439491793 100644 --- a/share/man/man3/Makefile +++ b/share/man/man3/Makefile @@ -1,6 +1,7 @@ .include <src.opts.mk> PACKAGE= clibs +MANSUBPACKAGE= -dev MAN= alloca.3 \ arb.3 \ diff --git a/share/man/man3/queue.3 b/share/man/man3/queue.3 index 79c8d92decbe..535358ae82d5 100644 --- a/share/man/man3/queue.3 +++ b/share/man/man3/queue.3 @@ -1420,13 +1420,13 @@ while in userland builds it prints the diagnostic message on .Dv stderr and then calls .Fn abort . -These behaviors can be overriden by defining a custom +These behaviors can be overridden by defining a custom .Fn QMD_PANIC macro before first inclusion of .In sys/queue.h . The diagnostic messages automatically include the source file, line and function -where the failing check occured. -This behavior can be overriden by defining a custom +where the failing check occurred. +This behavior can be overridden by defining a custom .Fn QMD_ASSERT macro before first inclusion of .In sys/queue.h . diff --git a/share/man/man3/siginfo.3 b/share/man/man3/siginfo.3 index f57cf5f7d706..59e3ecf8f3e8 100644 --- a/share/man/man3/siginfo.3 +++ b/share/man/man3/siginfo.3 @@ -224,7 +224,7 @@ raised by a hardware watchpoint exception may report the data address that triggered the watchpoint in .Va si_addr . .Pp -Sychronous signals set +Synchronous signals set .Va si_trapno to a machine-dependent trap number. .Pp diff --git a/share/man/man4/acpi_battery.4 b/share/man/man4/acpi_battery.4 index 3707cd125678..49fed625ea31 100644 --- a/share/man/man4/acpi_battery.4 +++ b/share/man/man4/acpi_battery.4 @@ -158,8 +158,8 @@ Typically this will decrease every charging cycle. .It btech Battery technology: .Bl -tag -width indent -.It 0x00000000 Primary cell Pq non-rechargable -.It 0x00000001 Secondary cell Pq rechargable +.It 0x00000000 Primary cell Pq non-rechargeable +.It 0x00000001 Secondary cell Pq rechargeable .El .It Va dvol Design voltage in mV, diff --git a/share/man/man4/ahc.4 b/share/man/man4/ahc.4 index 72a1e092f1bc..a2aa911c0646 100644 --- a/share/man/man4/ahc.4 +++ b/share/man/man4/ahc.4 @@ -144,7 +144,7 @@ system hang if memory mapped I/O is attempted. .Pp Most modern motherboards perform the initialization correctly and work fine with this option enabled and it is the default. This option can also be -dynamically configued through a device hint documented below. +dynamically configured through a device hint documented below. .Ed .Pp To statically configure one or more controllers to assume the target role: diff --git a/share/man/man4/bce.4 b/share/man/man4/bce.4 index ab979f371b66..aab9eaebd505 100644 --- a/share/man/man4/bce.4 +++ b/share/man/man4/bce.4 @@ -240,7 +240,7 @@ Values from 0-256 are valid. A value of 0 disables this status block update (default 6). .It Va hw.bce.tx_ticks Time in microsecond ticks to wait before a status block -update is generated due to TX activitiy. +update is generated due to TX activity. Values from 0-100 are valid. A value of 0 disables this status block update. Cannot be set to 0 if hw.bce.tx_quick_cons_trip is also 0 diff --git a/share/man/man4/iwlwifi.4 b/share/man/man4/iwlwifi.4 index 660f6a9bf57c..411af54be9fb 100644 --- a/share/man/man4/iwlwifi.4 +++ b/share/man/man4/iwlwifi.4 @@ -284,7 +284,7 @@ module parameters and are mapped automatically by .Sy linuxkpi . They were not adjusted so that they stay consistent with upstream Linux, e.g., for documentation available and problem investigations. -This left their names inconsistent between themselves and incosistent to +This left their names inconsistent between themselves and inconsistent to .Fx style. .Pp diff --git a/share/man/man4/le.4 b/share/man/man4/le.4 index ff39361a1780..04b57633c91f 100644 --- a/share/man/man4/le.4 +++ b/share/man/man4/le.4 @@ -34,7 +34,7 @@ .\" .\" from: Header: le.4,v 1.2 92/10/13 05:31:33 leres Exp .\" -.Dd June 21, 2023 +.Dd October 24, 2025 .Dt LE 4 .Os .Sh NAME @@ -66,7 +66,7 @@ numbers have to be specified in The .Nm driver may not be present in -.Fx 15.0 +.Fx 16.0 and later. .Sh DESCRIPTION The diff --git a/share/man/man4/mac_do.4 b/share/man/man4/mac_do.4 index 39bfafd95474..d02932070e25 100644 --- a/share/man/man4/mac_do.4 +++ b/share/man/man4/mac_do.4 @@ -246,7 +246,7 @@ nor contradictory ones. In practice, no two clauses may display the same ID except for group IDs but only if, each time the same ID appears, it does so with a different flag, or no flags only once. -Additionally, the specified flags in multiple occurences must not be +Additionally, the specified flags in multiple occurrences must not be contradictory. For example, the same group ID appearing with both .Ql + diff --git a/share/man/man4/p9fs.4 b/share/man/man4/p9fs.4 index 04f27abd2545..a49053d461d4 100644 --- a/share/man/man4/p9fs.4 +++ b/share/man/man4/p9fs.4 @@ -96,7 +96,7 @@ may not work correctly. If .Nm is the root filesystem, -it is recommented to use with +it is recommended to use with .Xr tmpfs 5 to ensure that temporary files created in .Pa /tmp diff --git a/share/man/man4/rights.4 b/share/man/man4/rights.4 index 8f5f6ad9c2d2..0223ba0b6b88 100644 --- a/share/man/man4/rights.4 +++ b/share/man/man4/rights.4 @@ -281,7 +281,8 @@ Permit and .Xr openat 2 with -.Dv O_FSYNC +.Dv O_DSYNC , +.Dv O_FSYNC , or .Dv O_SYNC flag. diff --git a/share/man/man5/Makefile b/share/man/man5/Makefile index c13a8b7afde2..abf4b59d184b 100644 --- a/share/man/man5/Makefile +++ b/share/man/man5/Makefile @@ -43,20 +43,6 @@ MAN= a.out.5 \ style.mdoc.5 \ sysctl.conf.5 \ -.if ${MK_BLUETOOTH} != "no" -MAN+= bluetooth.device.conf.5 \ - bluetooth.hosts.5 \ - bluetooth.protocols.5 -.endif - -.if ${MK_FREEBSD_UPDATE} != "no" -MAN+= freebsd-update.conf.5 -.endif - -.if ${MK_HESIOD} != "no" -MAN+= hesiod.conf.5 -.endif - MLINKS= dir.5 dirent.5 MLINKS+=fs.5 inode.5 MLINKS+=hosts.equiv.5 rhosts.5 @@ -69,37 +55,46 @@ MANGROUPS+= ACCT ACCT= acct.5 ACCTPACKAGE= acct -MANGROUPS+= BOOTLOADER +MANGROUPS.${MK_BLUETOOTH}+= BLUETOOTH +BLUETOOTHPACKAGE= bluetooth +BLUETOOTH= bluetooth.device.conf.5 \ + bluetooth.hosts.5 \ + bluetooth.protocols.5 + +MANGROUPS+= BOOTLOADER +BOOTLOADERPACKAGE= bootloader BOOTLOADER= device.hints.5 -BOOTLOADERPACKAGE=bootloader -.if ${MK_TOOLCHAIN} != "no" -MANGROUPS+= TOOLCHAIN +MANGROUPS.${MK_FREEBSD_UPDATE}+= FREEBSD_UPDATE +FREEBSD_UPDATE= freebsd-update.conf.5 + +MANGROUPS.${MK_HESIOD}+= HESIOD +HESIOD= hesiod.conf.5 + +MANGROUPS.${MK_TOOLCHAIN}+= TOOLCHAIN +TOOLCHAINPACKAGE= toolchain TOOLCHAIN= ar.5 -TOOLCHAINPACKAGE=toolchain -.endif -MANGROUPS+= LP +MANGROUPS+= LP +LPPACKAGE= lp LP= hosts.lpd.5 -LPPACKAGE= lp -MANGROUPS+= PERIODIC +MANGROUPS+= PERIODIC +PERIODICPACKAGE= periodic PERIODIC= periodic.conf.5 -PERIODICPACKAGE=periodic -.if ${MK_PF} != "no" -MANGROUPS+= PF +MANGROUPS.${MK_PF}+= PF +PFPACKAGE= pf PF= pf.conf.5 \ pf.os.5 -PFPACKAGE= pf -.endif -MANGROUPS+= RC +MANGROUPS+= RC +RCPACKAGE= rc RC= rc.conf.5 RCLINKS= rc.conf.5 rc.conf.local.5 -RCPACKAGE= rc -MANGROUPS+= RUNTIME +MANGROUPS+= RUNTIME +RUNTIMEPACKAGE= runtime RUNTIME= devfs.conf.5 \ devfs.rules.5 \ fstab.5 \ @@ -107,19 +102,18 @@ RUNTIME= devfs.conf.5 \ RUNTIMELINKS= passwd.5 master.passwd.5 RUNTIMELINKS+= passwd.5 pwd.db.5 RUNTIMELINKS+= passwd.5 spwd.db.5 -RUNTIMEPACKAGE= runtime -MANGROUPS+= SMB +MANGROUPS+= SMB +SMBPACKAGE= smbutils SMB= nsmb.conf.5 -SMBPACKAGE= smbutils -MANGROUPS+= SSH +MANGROUPS.${MK_OPENSSH}+= SSH +SSHPACKAGE= ssh SSH= moduli.5 -SSHPACKAGE= ssh -MANGROUPS+= UFS +MANGROUPS+= UFS +UFSPACKAGE= ufs UFS= fs.5 -UFSPACKAGE= ufs # This makes more sense for amd64 and i386 but # we decide to install all manpages in all architectures diff --git a/share/man/man5/pf.conf.5 b/share/man/man5/pf.conf.5 index 41410d6bc0fa..be46b1a47291 100644 --- a/share/man/man5/pf.conf.5 +++ b/share/man/man5/pf.conf.5 @@ -1490,7 +1490,7 @@ options and both implicitly and explicitly in the case of ones. A .Ar rdr-to -opion may cause the source port to be modified if doing so avoids a conflict +option may cause the source port to be modified if doing so avoids a conflict with an existing connection. A random source port in the range 50001-65535 is chosen in this case. Port numbers are never translated with a diff --git a/share/man/man5/rc.conf.5 b/share/man/man5/rc.conf.5 index edbfa937f8df..6274c1ee5b94 100644 --- a/share/man/man5/rc.conf.5 +++ b/share/man/man5/rc.conf.5 @@ -4950,7 +4950,7 @@ can be used in jails) depending on the content of the .Ao Ar name Ac Ns Va _svcj_options variable. Typically this variable is set inside rc scripts, but it can be -overriden in the rc config. +overridden in the rc config. Valid options for .Ao Ar name Ac Ns Va _svcj_options are: @@ -5041,7 +5041,7 @@ service at all, or may set it to if it is not set in the rc config, to exclude it from .Va svcj_all_enable -but allow to explicitely enable it. +but allow to explicitly enable it. The sshd service for example would not see other jails, if it would run as a service jail. This may or may not be what is needed, and as such it is diff --git a/share/man/man5/style.mdoc.5 b/share/man/man5/style.mdoc.5 index 1c3ec2012118..2f8ea90ae21f 100644 --- a/share/man/man5/style.mdoc.5 +++ b/share/man/man5/style.mdoc.5 @@ -1,30 +1,9 @@ .\" -.\" SPDX-License-Identifier: BSD-2-Clause -.\" -.\" Copyright (c) 2018-2022 Mateusz Piotrowski <0mp@FreeBSD.org> +.\" Copyright (c) 2018-2025 Mateusz Piotrowski <0mp@FreeBSD.org> .\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. +.\" SPDX-License-Identifier: BSD-2-Clause .\" -.Dd December 21, 2024 +.Dd October 24, 2025 .Dt STYLE.MDOC 5 .Os .Sh NAME @@ -71,6 +50,9 @@ Historically, was the preferred way before the deprecation of .Sy \&Li . .El +.Ss Copyright Header +Refer to +.Xr style 9 . .Ss HARDWARE Section Driver manuals in section four should have a .Sx HARDWARE diff --git a/share/man/man7/arch.7 b/share/man/man7/arch.7 index 668f5aa23155..5170a27768b8 100644 --- a/share/man/man7/arch.7 +++ b/share/man/man7/arch.7 @@ -76,7 +76,7 @@ Pointers should not be cast to or .Vt size_t if they will later be cast back to a pointer that is expected to be -dereferencable as they remain bare integer types on all architectures. +dereferenceable as they remain bare integer types on all architectures. .Pp On some architectures, e.g., AIM variants of diff --git a/share/man/man7/build.7 b/share/man/man7/build.7 index 5e15a528246b..9adfd4bc8a63 100644 --- a/share/man/man7/build.7 +++ b/share/man/man7/build.7 @@ -202,7 +202,7 @@ package or port provides a more generic solution. .It Cm buildenvvars Print the shell variables that are set for a .Cm buildenv -envirnoment and exit. +environment and exit. .It Cm buildworld Build everything but the kernel, configure files in .Pa etc , @@ -732,7 +732,7 @@ See .Xr src.conf 5 .It Va REPODIR The root directory used to create the package repository for building -.Xr packges 7 . +.Xr packages 7 . Defaults to .Pa ${OBJROOT}/repo/ . This can also be set in diff --git a/share/man/man8/debug.sh.8 b/share/man/man8/debug.sh.8 index bf0fdbd6bcf5..3b59d6ae2e78 100644 --- a/share/man/man8/debug.sh.8 +++ b/share/man/man8/debug.sh.8 @@ -143,7 +143,7 @@ and defaults to .It Ic DebugTrace Ar message Debug output can be very noisy, and it can be tricky to align with the script. -This function outputs a very noticable banner indicating the value of +This function outputs a very noticeable banner indicating the value of .Va DEBUG_ON , and .Ar message @@ -168,7 +168,7 @@ skipped/run when debugging is turned on. .Va DEBUGGING is the same as .Va DEBUG_SKIP -for backwards compatability and is only set by +for backwards compatibility and is only set by .Fn Debug . .Pp The use of diff --git a/share/man/man8/rc.subr.8 b/share/man/man8/rc.subr.8 index 1fd5041cecd8..45a9e9a684cd 100644 --- a/share/man/man8/rc.subr.8 +++ b/share/man/man8/rc.subr.8 @@ -1010,7 +1010,7 @@ However, if fails, just return. .Pp .Ic DebugOn -will be called with tags derrived from +will be called with tags derived from .Va name and .Va rc_arg diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile index 52ec9be3ae02..fecde7152f80 100644 --- a/share/man/man9/Makefile +++ b/share/man/man9/Makefile @@ -1,6 +1,6 @@ .include <src.opts.mk> -PACKAGE= kernel-man +MANPACKAGE= kernel-man MAN= accept_filter.9 \ accf_data.9 \ @@ -90,6 +90,7 @@ MAN= accept_filter.9 \ DECLARE_MODULE.9 \ DEFINE_IFUNC.9 \ DELAY.9 \ + deadfs.9 \ devclass.9 \ devclass_find.9 \ devclass_get_device.9 \ diff --git a/share/man/man9/PCI_IOV_ADD_VF.9 b/share/man/man9/PCI_IOV_ADD_VF.9 index 512b0b8668cc..95bf5a218e8e 100644 --- a/share/man/man9/PCI_IOV_ADD_VF.9 +++ b/share/man/man9/PCI_IOV_ADD_VF.9 @@ -41,7 +41,7 @@ The .Fn PCI_IOV_ADD_VF method is called by the PCI Single-Root I/O Virtualization .Pq SR-IOV -infrastructure when it is initializating a new Virtual Function (VF) as a child +infrastructure when it is initializing a new Virtual Function (VF) as a child of the given Physical Function (PF) device. This method will not be called until a successful call to .Xr PCI_IOV_INIT 9 diff --git a/share/man/man9/atomic.9 b/share/man/man9/atomic.9 index df24cd4a4d2b..c9133c6311a5 100644 --- a/share/man/man9/atomic.9 +++ b/share/man/man9/atomic.9 @@ -272,7 +272,7 @@ In C11, a release fence by one thread synchronizes with an acquire fence by another thread when an atomic load that is prior to the acquire fence (by program order) reads the value written by an atomic store that is subsequent to the release fence. -In constrast, in +In contrast, in .Fx , because of the atomicity of ordinary, naturally aligned loads and stores, fences can also be synchronized by ordinary loads diff --git a/share/man/man9/bhnd.9 b/share/man/man9/bhnd.9 index 722ae6b6a393..ed3007ea748d 100644 --- a/share/man/man9/bhnd.9 +++ b/share/man/man9/bhnd.9 @@ -2350,7 +2350,7 @@ function retains and returns a reference to the provider registered for .Fa service with the parent .Xr bhnd 4 -bus of devce +bus of device .Fa dev , if available. On success, the caller is responsible for releasing this provider reference diff --git a/share/man/man9/bus_dma.9 b/share/man/man9/bus_dma.9 index b644eeb2a476..0bf27eb5eb22 100644 --- a/share/man/man9/bus_dma.9 +++ b/share/man/man9/bus_dma.9 @@ -197,7 +197,7 @@ in addition to restrictions that differ between unrelated groups of transactions, the driver can first create a .Dq parent -tag that decribes the common restrictions. +tag that describes the common restrictions. The per-group tags can then inherit these restrictions from this .Dq parent tag rather than having to list them explicitly when creating the per-group tags. @@ -733,7 +733,7 @@ Fills in the selected fields of the template with a variable number of key-value parameters. The macros listed below take an argument of the specified type and encapsulate it into a key-value structure that is directly usable as a parameter argument. -Muliple parameters may be provided at once. +Multiple parameters may be provided at once. .Bd -literal BD_PARENT() void * BD_ALIGNMENT() uintmax_t diff --git a/share/man/man9/copy.9 b/share/man/man9/copy.9 index 8b2d0dc67727..3a3105ddf644 100644 --- a/share/man/man9/copy.9 +++ b/share/man/man9/copy.9 @@ -43,7 +43,7 @@ .Nm copyout_nofault , .Nm copystr , .Nm copyinstr -.Nd heterogenous address space copy functions +.Nd heterogeneous address space copy functions .Sh SYNOPSIS .In sys/types.h .In sys/systm.h diff --git a/share/man/man9/crypto_request.9 b/share/man/man9/crypto_request.9 index af62b9089561..77e6a60b46de 100644 --- a/share/man/man9/crypto_request.9 +++ b/share/man/man9/crypto_request.9 @@ -383,7 +383,7 @@ depending on whether the driver is implemented by software or hardware. dispatches the request asynchronously. If the driver is inherently synchronous, the request is queued to a taskqueue backed by a pool of worker threads. -This can increase througput by allowing requests from a single producer to be +This can increase throughput by allowing requests from a single producer to be processed in parallel. By default the pool is sized to provide one thread for each CPU. Worker threads dequeue requests and pass them to the driver asynchronously. diff --git a/share/man/man9/deadfs.9 b/share/man/man9/deadfs.9 new file mode 100644 index 000000000000..5f4d037a0f09 --- /dev/null +++ b/share/man/man9/deadfs.9 @@ -0,0 +1,36 @@ +.\" +.\" SPDX-License-Identifier: BSD-2-Clause +.\" +.\" Copyright (c) 2025 Mateusz Piotrowski <0mp@FreeBSD.org> +.\" +.Dd October 24, 2025 +.Dt DEADFS 9 +.Os +.Sh NAME +.Nm deadfs +.Nd pseudo-filesystem to own reclaimed vnodes +.Sh DESCRIPTION +The +.Nm +file system implements operations that do not modify any data +and instead return indications of invalid IO. +Its role is to provide a fallback vnode operations vector for reclaimed +.Xr vnode 9 Ap s . +.Pp +It is a kernel-only pseudo-file system and so cannot be mounted from userspace. +.Sh SEE ALSO +.Xr insmntque 9 , +.Xr vnode 9 , +.Xr VOP_RECLAIM 9 +.Sh HISTORY +UNIX System Manager's Manual (SMM) for +.Bx 4.4 +described +.Nm +as a file system +.Dq where rejected vnodes go to die . +.Sh AUTHORS +The +.Nm +manual page was written by +.An Mateusz Piotrowski Aq Mt 0mp@FreeBSD.org . diff --git a/share/man/man9/domain.9 b/share/man/man9/domain.9 index dab8cff89e12..d7e743eaf247 100644 --- a/share/man/man9/domain.9 +++ b/share/man/man9/domain.9 @@ -173,7 +173,7 @@ Once a domain is added it cannot be completely unloaded. This is because there is no reference counting system in place to determine if there are any active references from sockets within that domain. -However, the exprimental +However, the experimental .Fn domain_remove exists, and unloadable domains may be supported in the future. .Pp diff --git a/share/man/man9/efirt.9 b/share/man/man9/efirt.9 index c31f52bf2245..e085916801d5 100644 --- a/share/man/man9/efirt.9 +++ b/share/man/man9/efirt.9 @@ -183,7 +183,7 @@ is NULL. .It Dv EIO The variable could not be retrieved due to a hardware error. .It Dv EDOOFUS -The variable could not be retireved due to an authentication failure. +The variable could not be retrieved due to an authentication failure. .El .Pp The diff --git a/share/man/man9/g_bio.9 b/share/man/man9/g_bio.9 index 407c38e6ca70..fc278cd229a9 100644 --- a/share/man/man9/g_bio.9 +++ b/share/man/man9/g_bio.9 @@ -22,7 +22,7 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd August 7, 2019 +.Dd October 26, 2025 .Dt G_BIO 9 .Os .Sh NAME @@ -309,6 +309,7 @@ example_start(struct bio *bp) } .Ed .Sh SEE ALSO +.Xr dtrace_io 4 , .Xr geom 4 , .Xr DECLARE_GEOM_CLASS 9 , .Xr g_access 9 , diff --git a/share/man/man9/g_geom.9 b/share/man/man9/g_geom.9 index c5b0c0aded2d..99d0ba074e89 100644 --- a/share/man/man9/g_geom.9 +++ b/share/man/man9/g_geom.9 @@ -66,7 +66,7 @@ function is very similar to .Fn g_new_geomf except that it accepts a regular string instead of a .Xr printf 3 Ns --like format strng as the geom's name. +-like format string as the geom's name. .Pp The .Fn g_destroy_geom diff --git a/share/man/man9/gone_in.9 b/share/man/man9/gone_in.9 index 7521adfda204..ebdc1ab19bfa 100644 --- a/share/man/man9/gone_in.9 +++ b/share/man/man9/gone_in.9 @@ -1,6 +1,6 @@ .\" Copyright (c) 2021 The FreeBSD Foundation .\" -.\" This document was written by Ed Maste under sponsorhip from +.\" This document was written by Ed Maste under sponsorship from .\" The FreeBSD Foundation. .\" .\" Redistribution and use in source and binary forms, with or without @@ -72,7 +72,7 @@ Obsolete code will be removed soon: void sample_init(void) { - /* Initializaiton code omitted. */ + /* Initialization code omitted. */ gone_in(14, "Giant-locked filesystem"); } diff --git a/share/man/man9/ifnet.9 b/share/man/man9/ifnet.9 index 3c45e4f29e2d..e81c2990c13c 100644 --- a/share/man/man9/ifnet.9 +++ b/share/man/man9/ifnet.9 @@ -482,7 +482,7 @@ This is initialized by driver at attach. .It Fn if_getaddrlen .It Fn if_gethwaddr .It Fn if_getbroadcastaddr Fn if_setbroadcastaddr -Access the interface broadcast addess. +Access the interface broadcast address. .It Fn if_setmtu .It Fn if_getmtu Access the interface MTU. diff --git a/share/man/man9/nvmem.9 b/share/man/man9/nvmem.9 index 812cd09a5e35..fa88cbb91854 100644 --- a/share/man/man9/nvmem.9 +++ b/share/man/man9/nvmem.9 @@ -59,19 +59,19 @@ Get the size of the cell base on the reg property on the node. Return the size or ENOENT if the cell name wasn't found .It Fn nvmem_read_cell_by_name "phandle_t node" "const char *name" "void *cell" "size_t buflen" Get the cell content based on the name. -Return 0 on sucess or ENOENT if the cell doesn't exists, ENXIO if no provider device was found, +Return 0 on success or ENOENT if the cell doesn't exists, ENXIO if no provider device was found, EINVAL if the size isn't correct. .It Fn nvmem_read_cell_by_idx "phandle_t node" "int idx" "void *cell" "size_t buflen" Get the cell content based on the id. -Return 0 on sucess or ENOENT if the cell doesn't exists, ENXIO if no provider device was found, +Return 0 on success or ENOENT if the cell doesn't exists, ENXIO if no provider device was found, EINVAL if the size isn't correct. .It Fn nvmem_write_cell_by_name "phandle_t node" "const char *name" "void *cell" "size_t buflen" Write the cell content based on the name. -Return 0 on sucess or ENOENT if the cell doesn't exists, ENXIO if no provider device was found, +Return 0 on success or ENOENT if the cell doesn't exists, ENXIO if no provider device was found, EINVAL if the size isn't correct. .It Fn nvmem_write_cell_by_idx "phandle_t node" "int idx" "void *cell" "size_t buflen" Write the cell content based on the id. -Return 0 on sucess or ENOENT if the cell doesn't exists, ENXIO if no provider device was found, +Return 0 on success or ENOENT if the cell doesn't exists, ENXIO if no provider device was found, EINVAL if the size isn't correct. .El .Sh DEVICE METHODS diff --git a/share/man/man9/ofw_bus_is_compatible.9 b/share/man/man9/ofw_bus_is_compatible.9 index 1b44807e84e8..fcfe8755cf86 100644 --- a/share/man/man9/ofw_bus_is_compatible.9 +++ b/share/man/man9/ofw_bus_is_compatible.9 @@ -61,7 +61,7 @@ older revisions of the driver. If hardware revision B is backward compatible with revision A device tree node can signal this compatibility by providing both "vndr,hrdwrA" and "vndr,hrdwrB" strings in -the "compatibile" property value. +the "compatible" property value. This way older driver can use features available only in revision A, and the new version of the driver can take advantage of revision B feature set. diff --git a/share/man/man9/pci.9 b/share/man/man9/pci.9 index eeb62a63a2bd..871f69f887a6 100644 --- a/share/man/man9/pci.9 +++ b/share/man/man9/pci.9 @@ -523,7 +523,7 @@ device is not a PCI-express device, returns zero. When completion timeouts are disabled for .Fa dev , -this function returns the maxmimum timeout that would be used if timeouts +this function returns the maximum timeout that would be used if timeouts were enabled. .Pp The diff --git a/share/man/man9/refcount.9 b/share/man/man9/refcount.9 index 78631f9a865a..7375f429a607 100644 --- a/share/man/man9/refcount.9 +++ b/share/man/man9/refcount.9 @@ -106,7 +106,7 @@ but additionally checks that the value does not overflow as result of the operation. It returns .Dv true -if the reference was sucessfully obtained, and +if the reference was successfully obtained, and .Dv false if it was not, due to the overflow. .Pp diff --git a/share/man/man9/seqc.9 b/share/man/man9/seqc.9 index e13d73ecb5d7..b1e59b6b7af1 100644 --- a/share/man/man9/seqc.9 +++ b/share/man/man9/seqc.9 @@ -81,7 +81,7 @@ repeated. In case when sequence number is odd the object change is in progress and the reader will wait until the write will the sequence number will become even. .Sh EXAMPLES -The following example for a writer changees the +The following example for a writer changes the .Va var1 and .Va var2 diff --git a/share/man/man9/style.9 b/share/man/man9/style.9 index 26c7a3b2aa64..c9c3af23864a 100644 --- a/share/man/man9/style.9 +++ b/share/man/man9/style.9 @@ -816,7 +816,7 @@ If no local variables are declared, the first line should be a statement. Older versions of this .Nm document required a blank line before code. -Such lines should be removed when signficant changes are made to the code. +Such lines should be removed when significant changes are made to the code. .Pp Use .Xr printf 3 , @@ -947,7 +947,7 @@ namespace foo::bar { .Ed .Pp Member function declarations should follow the same style used for standalone -function protoypes except that a space should be used between a function's +function prototypes except that a space should be used between a function's return type and name. .Pp Function definitions at the top level should use a newline after the function diff --git a/share/man/man9/vn_fullpath.9 b/share/man/man9/vn_fullpath.9 index 9815abc3c86c..af459ed281c0 100644 --- a/share/man/man9/vn_fullpath.9 +++ b/share/man/man9/vn_fullpath.9 @@ -107,7 +107,7 @@ than one name (hard links), not all file systems use the name cache be used for more than one file (in the context of file systems covering other file systems); a file may have no name (if deleted but still open or referenced). -However, the resulting string may still be more useable to a user than +However, the resulting string may still be more usable to a user than a vnode pointer value, or a device number and inode number. Code consuming the results of this function should anticipate (and properly handle) failure. @@ -187,7 +187,7 @@ otherwise, an error number is returned. .Xr free 9 .Sh AUTHORS .An -nosplit -This manual page was initally written by +This manual page was initially written by .An Robert Watson Aq Mt rwatson@FreeBSD.org to describe the .Fn vn_fullpath diff --git a/share/mk/bsd.lib.mk b/share/mk/bsd.lib.mk index 065e635ed43d..159957b6300b 100644 --- a/share/mk/bsd.lib.mk +++ b/share/mk/bsd.lib.mk @@ -82,7 +82,18 @@ DEV_TAG_ARGS= ${TAG_ARGS},dev .else DEV_TAG_ARGS= ${TAG_ARGS} .endif -.endif # !defined(NO_ROOT) + +.endif # defined(NO_ROOT) + +# By default, put library manpages in the -dev subpackage, since they're not +# usually interesting if the development files aren't installed. For pages +# that should be installed in the base package, define a new MANNODEV group. +# Note that bsd.man.mk ignores this setting if MANSPLITPKG is enabled: then +# manpages are always installed in the -man subpackage. +MANSUBPACKAGE?= -dev +MANGROUPS?= MAN +MANGROUPS+= MANNODEV +MANNODEVSUBPACKAGE= # ELF hardening knobs .if ${MK_BIND_NOW} != "no" diff --git a/share/mk/bsd.man.mk b/share/mk/bsd.man.mk index 1591a3e0905e..dde11afb8283 100644 --- a/share/mk/bsd.man.mk +++ b/share/mk/bsd.man.mk @@ -61,6 +61,16 @@ MANGROUPS?= MAN +# MAN_SUBPACKAGE is the subpackage manpages will be installed in. When +# MANSPLITPKG is enabled, this is ignored and the subpackage is forced +# to be "-man", otherwise it defaults to empty so manpages go in the +# base package. This can be set to "-dev" for manpages that should go +# in the -dev package. +MAN_SUBPACKAGE?= + +# The default man package, if not otherwise specified. +MAN_PACKAGE= ${PACKAGE:Uutilities} + # Backwards compatibility. MINSTALL?= ${MANINSTALL} @@ -113,17 +123,19 @@ manlinksinstall: manlinksinstall-${__group} ${__group}OWN?= ${MANOWN} ${__group}GRP?= ${MANGRP} ${__group}MODE?= ${MANMODE} -${__group}PACKAGE?= ${PACKAGE:Uutilities} +# If MANSPLITPKG is enabled, ignore the requested man subpackage and put the +# manpages in -man instead. +.if ${MK_MANSPLITPKG} == "yes" +${__group}SUBPACKAGE= -man +.else +${__group}SUBPACKAGE?= ${MAN_SUBPACKAGE} +.endif +${__group}PACKAGE?= ${MAN_PACKAGE}${${__group}SUBPACKAGE} # Tag processing is only done for NO_ROOT installs. .if defined(NO_ROOT) - .if !defined(${__group}TAGS) || ! ${${__group}TAGS:Mpackage=*} -.if ${MK_MANSPLITPKG} == "no" || ${${__group}PACKAGE:M*-man} -${__group}TAGS+= package=${${__group}PACKAGE} -.else -${__group}TAGS+= package=${${__group}PACKAGE}-man -.endif +${__group}TAGS+= package=${${__group}PACKAGE} .endif ${__group}TAG_ARGS= -T ${${__group}TAGS:ts,:[*]} diff --git a/stand/Makefile.inc b/stand/Makefile.inc index 5d55c4e4a16f..2866ebd20af3 100644 --- a/stand/Makefile.inc +++ b/stand/Makefile.inc @@ -1,5 +1,7 @@ SUBDIR_PARALLEL= yes +PACKAGE= bootloader + # Firmware may not be able to handle branch protection failures MK_BRANCH_PROTECTION= no diff --git a/stand/libsa/Makefile b/stand/libsa/Makefile index f5a1acea843e..470c03032f61 100644 --- a/stand/libsa/Makefile +++ b/stand/libsa/Makefile @@ -189,9 +189,9 @@ SRCS+= g_eli_hmac.c pkcs5v2.c .PATH: ${SYSDIR}/crypto/sha2 SRCS+= sha256c.c sha512c.c -# md5 from the kernel -.PATH: ${SYSDIR}/kern +.PATH: ${SYSDIR}/crypto SRCS+= md5c.c +CFLAGS.md5c.c+= -DSTANDALONE_SMALL .if ${DO32:U0} == 0 MAN=libsa.3 diff --git a/stand/userboot/Makefile.inc b/stand/userboot/Makefile.inc index 01b5f23410c8..392fd59a115f 100644 --- a/stand/userboot/Makefile.inc +++ b/stand/userboot/Makefile.inc @@ -1 +1,5 @@ .include "../Makefile.inc" + +# userboot.so should be installed in the base bootloader package, +# not bootloader-dev. +NO_DEV_PACKAGE= diff --git a/sys/amd64/amd64/trap.c b/sys/amd64/amd64/trap.c index f3469ed5e2bc..84305ca918df 100644 --- a/sys/amd64/amd64/trap.c +++ b/sys/amd64/amd64/trap.c @@ -435,9 +435,9 @@ trap(struct trapframe *frame) if ((print_efirt_faults == 1 && cnt == 0) || print_efirt_faults == 2) { - trap_diag(frame, 0); printf("EFI RT fault %s\n", traptype_to_msg(type)); + trap_diag(frame, 0); } frame->tf_rip = (long)curpcb->pcb_onfault; return; @@ -870,8 +870,8 @@ after_vmfault: if ((print_efirt_faults == 1 && cnt == 0) || print_efirt_faults == 2) { - trap_diag(frame, eva); printf("EFI RT page fault\n"); + trap_diag(frame, eva); } } frame->tf_rip = (long)curpcb->pcb_onfault; diff --git a/sys/cam/ata/ata_da.c b/sys/cam/ata/ata_da.c index 0d844a6fbf9e..08747cd59131 100644 --- a/sys/cam/ata/ata_da.c +++ b/sys/cam/ata/ata_da.c @@ -1557,11 +1557,11 @@ adasysctlinit(void *context, int pending) SYSCTL_ADD_PROC(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), OID_AUTO, "unmapped_io", CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, &softc->flags, (u_int)ADA_FLAG_UNMAPPEDIO, adabitsysctl, "I", - "Use unmapped I/O. This sysctl is *DEPRECATED*, gone in FreeBSD 15"); + "Use unmapped I/O. This sysctl is *DEPRECATED*, gone in FreeBSD 16"); SYSCTL_ADD_PROC(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), OID_AUTO, "rotating", CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, &softc->flags, (u_int)ADA_FLAG_ROTATING, adabitsysctl, "I", - "Rotating media. This sysctl is *DEPRECATED*, gone in FreeBSD 15"); + "Rotating media. This sysctl is *DEPRECATED*, gone in FreeBSD 16"); #ifdef CAM_TEST_FAILURE /* diff --git a/sys/cam/scsi/scsi_da.c b/sys/cam/scsi/scsi_da.c index fc8c0413448d..c0c0be12856b 100644 --- a/sys/cam/scsi/scsi_da.c +++ b/sys/cam/scsi/scsi_da.c @@ -2408,11 +2408,11 @@ dasysctlinit(void *context, int pending) SYSCTL_ADD_PROC(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), OID_AUTO, "rotating", CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, &softc->flags, (u_int)DA_FLAG_ROTATING, dabitsysctl, "I", - "Rotating media *DEPRECATED* gone in FreeBSD 15"); + "Rotating media *DEPRECATED* gone in FreeBSD 16"); SYSCTL_ADD_PROC(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), OID_AUTO, "unmapped_io", CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, &softc->flags, (u_int)DA_FLAG_UNMAPPEDIO, dabitsysctl, "I", - "Unmapped I/O support *DEPRECATED* gone in FreeBSD 15"); + "Unmapped I/O support *DEPRECATED* gone in FreeBSD 16"); #ifdef CAM_TEST_FAILURE SYSCTL_ADD_PROC(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), diff --git a/sys/conf/dtb.mk b/sys/conf/dtb.mk index ec3df525d1e7..2050be7560a4 100644 --- a/sys/conf/dtb.mk +++ b/sys/conf/dtb.mk @@ -31,6 +31,8 @@ .include "dtb.build.mk" +PACKAGE?= dtb + .if !target(install) && !target(realinstall) all: ${DTB} ${DTBO} realinstall: _dtbinstall diff --git a/sys/conf/files b/sys/conf/files index d9730e6bf55b..c17451324324 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -681,6 +681,8 @@ crypto/curve25519.c optional crypto \ compile-with "${NORMAL_C} -I$S/contrib/libsodium/src/libsodium/include -I$S/crypto/libsodium" crypto/des/des_ecb.c optional netsmb crypto/des/des_setkey.c optional netsmb +crypto/md4c.c optional netsmb +crypto/md5c.c standard crypto/openssl/ossl.c optional ossl crypto/openssl/ossl_aes.c optional ossl crypto/openssl/ossl_chacha20.c optional ossl @@ -3896,8 +3898,6 @@ kern/kern_vnodedumper.c standard kern/kern_xxx.c standard kern/link_elf.c standard kern/linker_if.m standard -kern/md4c.c optional netsmb -kern/md5c.c standard kern/p1003_1b.c standard kern/posix4_mib.c standard kern/sched_4bsd.c optional sched_4bsd diff --git a/sys/contrib/openzfs/.mailmap b/sys/contrib/openzfs/.mailmap index e6f09c6c9d43..3397fbc3745d 100644 --- a/sys/contrib/openzfs/.mailmap +++ b/sys/contrib/openzfs/.mailmap @@ -53,6 +53,7 @@ Jason Harmening <jason.harmening@gmail.com> Jeremy Faulkner <gldisater@gmail.com> Jinshan Xiong <jinshan.xiong@gmail.com> John Poduska <jpoduska@datto.com> +Jo Zzsi <jozzsicsataban@gmail.com> Justin Scholz <git@justinscholz.de> Ka Ho Ng <khng300@gmail.com> Kash Pande <github@tripleback.net> @@ -67,6 +68,7 @@ Michael Gmelin <grembo@FreeBSD.org> Olivier Mazouffre <olivier.mazouffre@ims-bordeaux.fr> Piotr Kubaj <pkubaj@anongoth.pl> Quentin Zdanis <zdanisq@gmail.com> +Roberto Ricci <io@r-ricci.it> Roberto Ricci <ricci@disroot.org> Rob Norris <robn@despairlabs.com> Rob Norris <rob.norris@klarasystems.com> @@ -83,7 +85,10 @@ Youzhong Yang <youzhong@gmail.com> # Signed-off-by: overriding Author: Alexander Ziaee <ziaee@FreeBSD.org> <concussious@runbox.com> Felix Schmidt <felixschmidt20@aol.com> <f.sch.prototype@gmail.com> +Jean-Sébastien Pédron <dumbbell@FreeBSD.org> <jean-sebastien.pedron@dumbbell.fr> +Konstantin Belousov <kib@FreeBSD.org> <kib@kib.kiev.ua> Olivier Certner <olce@FreeBSD.org> <olce.freebsd@certner.fr> +Patrick Xia <patrickx@google.com> <octalc0de@aim.com> Phil Sutter <phil@nwl.cc> <p.github@nwl.cc> poscat <poscat@poscat.moe> <poscat0x04@outlook.com> Qiuhao Chen <chenqiuhao1997@gmail.com> <haohao0924@126.com> @@ -125,6 +130,7 @@ buzzingwires <buzzingwires@outlook.com> <131118055+buzzingwires@users.noreply.gi Cedric Maunoury <cedric.maunoury@gmail.com> <38213715+cedricmaunoury@users.noreply.github.com> Charles Suh <charles.suh@gmail.com> <charlessuh@users.noreply.github.com> Chris Peredun <chris.peredun@ixsystems.com> <126915832+chrisperedun@users.noreply.github.com> +classabbyamp <dev@placeviolette.net> <5366828+classabbyamp@users.noreply.github.com> Dacian Reece-Stremtan <dacianstremtan@gmail.com> <35844628+dacianstremtan@users.noreply.github.com> Damian Szuberski <szuberskidamian@gmail.com> <30863496+szubersk@users.noreply.github.com> Daniel Hiepler <d-git@coderdu.de> <32984777+heeplr@users.noreply.github.com> @@ -185,6 +191,7 @@ Michael Niewöhner <foss@mniewoehner.de> <c0d3z3r0@users.noreply.github.com> Michael Zhivich <mzhivich@akamai.com> <33133421+mzhivich@users.noreply.github.com> MigeljanImeri <ImeriMigel@gmail.com> <78048439+MigeljanImeri@users.noreply.github.com> Mo Zhou <cdluminate@gmail.com> <5723047+cdluminate@users.noreply.github.com> +nav1s <nav1s@proton.me> <42621369+nav1s@users.noreply.github.com> Nick Mattis <nickm970@gmail.com> <nmattis@users.noreply.github.com> omni <omni+vagant@hack.org> <79493359+omnivagant@users.noreply.github.com> Pablo Correa Gómez <ablocorrea@hotmail.com> <32678034+pablofsf@users.noreply.github.com> @@ -206,6 +213,7 @@ Samuel Wycliffe <samuelwycliffe@gmail.com> <50765275+npc203@users.noreply.github Savyasachee Jha <hi@savyasacheejha.com> <savyajha@users.noreply.github.com> Scott Colby <scott@scolby.com> <scolby33@users.noreply.github.com> Sean Eric Fagan <kithrup@mac.com> <kithrup@users.noreply.github.com> +Shreshth Srivastava <shreshthsrivastava2@gmail.com> <66148173+Shreshth3@users.noreply.github.com> Spencer Kinny <spencerkinny1995@gmail.com> <30333052+Spencer-Kinny@users.noreply.github.com> Srikanth N S <srikanth.nagasubbaraoseetharaman@hpe.com> <75025422+nssrikanth@users.noreply.github.com> Stefan Lendl <s.lendl@proxmox.com> <1321542+stfl@users.noreply.github.com> diff --git a/sys/contrib/openzfs/AUTHORS b/sys/contrib/openzfs/AUTHORS index 6c34c07f39ef..e496c0e8a807 100644 --- a/sys/contrib/openzfs/AUTHORS +++ b/sys/contrib/openzfs/AUTHORS @@ -154,6 +154,7 @@ CONTRIBUTORS: Chris Zubrzycki <github@mid-earth.net> Chuck Tuffli <ctuffli@gmail.com> Chunwei Chen <david.chen@nutanix.com> + classabbyamp <dev@placeviolette.net> Clemens Fruhwirth <clemens@endorphin.org> Clemens Lang <cl@clang.name> Clint Armstrong <clint@clintarmstrong.net> @@ -161,6 +162,7 @@ CONTRIBUTORS: Colin Ian King <colin.king@canonical.com> Colin Percival <cperciva@tarsnap.com> Colm Buckley <colm@tuatha.org> + Cong Zhang <congzhangzh@users.noreply.github.com> Crag Wang <crag0715@gmail.com> Craig Loomis <cloomis@astro.princeton.edu> Craig Sanders <github@taz.net.au> @@ -217,6 +219,7 @@ CONTRIBUTORS: Eitan Adler <lists@eitanadler.com> Eli Rosenthal <eli.rosenthal@delphix.com> Eli Schwartz <eschwartz93@gmail.com> + Eric A. Borisch <eborisch@gmail.com> Eric Desrochers <eric.desrochers@canonical.com> Eric Dillmann <eric@jave.fr> Eric Schrock <Eric.Schrock@delphix.com> @@ -288,6 +291,7 @@ CONTRIBUTORS: Henrik Riomar <henrik.riomar@gmail.com> Herb Wartens <wartens2@llnl.gov> Hiếu Lê <leorize+oss@disroot.org> + hoshinomori <hoshinomorimorimo@gmail.com> Huang Liu <liu.huang@zte.com.cn> HÃ¥kan Johansson <f96hajo@chalmers.se> Igor K <igor@dilos.org> @@ -300,6 +304,7 @@ CONTRIBUTORS: ilovezfs <ilovezfs@icloud.com> InsanePrawn <Insane.Prawny@gmail.com> Isaac Huang <he.huang@intel.com> + Ivan Shapovalov <intelfx@intelfx.name> Ivan Volosyuk <Ivan.Volosyuk@gmail.com> Jacek FefliÅ„ski <feflik@gmail.com> Jacob Adams <tookmund@gmail.com> @@ -322,6 +327,7 @@ CONTRIBUTORS: Javen Wu <wu.javen@gmail.com> Jaydeep Kshirsagar <jkshirsagar@maxlinear.com> Jean-Baptiste Lallement <jean-baptiste@ubuntu.com> + Jean-Sébastien Pédron <dumbbell@FreeBSD.org> Jeff Dike <jdike@akamai.com> Jeremy Faulkner <gldisater@gmail.com> Jeremy Gill <jgill@parallax-innovations.com> @@ -355,7 +361,9 @@ CONTRIBUTORS: Josh Soref <jsoref@users.noreply.github.com> Joshua M. Clulow <josh@sysmgr.org> José Luis Salvador Rufo <salvador.joseluis@gmail.com> + Jo Zzsi <jozzsicsataban@gmail.com> João Carlos Mendes LuÃs <jonny@jonny.eng.br> + JT Pennington <jt.pennington@klarasystems.com> Julian Brunner <julian.brunner@gmail.com> Julian Heuking <JulianH@beckhoff.com> jumbi77 <jumbi77@users.noreply.github.com> @@ -388,6 +396,7 @@ CONTRIBUTORS: Kleber TarcÃsio <klebertarcisio@yahoo.com.br> Kody A Kantor <kody.kantor@gmail.com> Kohsuke Kawaguchi <kk@kohsuke.org> + Konstantin Belousov <kib@FreeBSD.org> Konstantin Khorenko <khorenko@virtuozzo.com> KORN Andras <korn@elan.rulez.org> kotauskas <v.toncharov@gmail.com> @@ -416,6 +425,7 @@ CONTRIBUTORS: luozhengzheng <luo.zhengzheng@zte.com.cn> LuÃs Henriques <henrix@camandro.org> Madhav Suresh <madhav.suresh@delphix.com> + Maksym Shkolnyi <maksym.shkolnyi@workato.com> manfromafar <jonsonb10@gmail.com> Manoj Joseph <manoj.joseph@delphix.com> Manuel Amador (Rudd-O) <rudd-o@rudd-o.com> @@ -482,6 +492,7 @@ CONTRIBUTORS: Nathaniel Clark <Nathaniel.Clark@misrule.us> Nathaniel Wesley Filardo <nwf@cs.jhu.edu> Nathan Lewis <linux.robotdude@gmail.com> + nav1s <nav1s@proton.me> Nav Ravindranath <nav@delphix.com> Neal Gompa (ニール・ゴンパ) <ngompa13@gmail.com> Ned Bass <bass6@llnl.gov> @@ -506,6 +517,7 @@ CONTRIBUTORS: Palash Gandhi <pbg4930@rit.edu> Patrick Fasano <patrick@patrickfasano.com> Patrick Mooney <pmooney@pfmooney.com> + Patrick Xia <patrickx@google.com> Patrik Greco <sikevux@sikevux.se> Paul B. Henson <henson@acm.org> Paul Dagnelie <pcd@delphix.com> @@ -605,6 +617,7 @@ CONTRIBUTORS: Shengqi Chen <harry-chen@outlook.com> SHENGYI HONG <aokblast@FreeBSD.org> Shen Yan <shenyanxxxy@qq.com> + Shreshth Srivastava <shreshthsrivastava2@gmail.com> Sietse <sietse@wizdom.nu> Simon Guest <simon.guest@tesujimath.org> Simon Howard <fraggle@soulsphere.org> @@ -665,6 +678,7 @@ CONTRIBUTORS: Toyam Cox <aviator45003@gmail.com> Trevor Bautista <trevrb@trevrb.net> Trey Dockendorf <treydock@gmail.com> + trick2011 <trick2011@users.noreply.github.com> Troels Nørgaard <tnn@tradeshift.com> tstabrawa <tstabrawa@users.noreply.github.com> Tulsi Jain <tulsi.jain@delphix.com> diff --git a/sys/contrib/openzfs/cmd/zdb/zdb.c b/sys/contrib/openzfs/cmd/zdb/zdb.c index 1ffb8ebc70f2..2560ad045db3 100644 --- a/sys/contrib/openzfs/cmd/zdb/zdb.c +++ b/sys/contrib/openzfs/cmd/zdb/zdb.c @@ -9747,6 +9747,9 @@ main(int argc, char **argv) */ spa_mode_readable_spacemaps = B_TRUE; + libspl_set_assert_ok((dump_opt['A'] == 1) || (dump_opt['A'] > 2)); + zfs_recover = (dump_opt['A'] > 1); + if (dump_all) verbose = MAX(verbose, 1); @@ -9757,9 +9760,6 @@ main(int argc, char **argv) dump_opt[c] += verbose; } - libspl_set_assert_ok((dump_opt['A'] == 1) || (dump_opt['A'] > 2)); - zfs_recover = (dump_opt['A'] > 1); - argc -= optind; argv += optind; if (argc < 2 && dump_opt['R']) diff --git a/sys/contrib/openzfs/cmd/zpool/zpool_main.c b/sys/contrib/openzfs/cmd/zpool/zpool_main.c index 1feec55c0e8b..a6658a9c2800 100644 --- a/sys/contrib/openzfs/cmd/zpool/zpool_main.c +++ b/sys/contrib/openzfs/cmd/zpool/zpool_main.c @@ -6975,7 +6975,6 @@ collect_vdev_prop(zpool_prop_t prop, uint64_t value, const char *str, /* * print static default line per vdev - * not compatible with '-o' <proplist> option */ static void collect_list_stats(zpool_handle_t *zhp, const char *name, nvlist_t *nv, @@ -7031,48 +7030,98 @@ collect_list_stats(zpool_handle_t *zhp, const char *name, nvlist_t *nv, * 'toplevel' boolean value is passed to the print_one_column() * to indicate that the value is valid. */ - if (VDEV_STAT_VALID(vs_pspace, c) && vs->vs_pspace) { - collect_vdev_prop(ZPOOL_PROP_SIZE, vs->vs_pspace, NULL, - scripted, B_TRUE, format, cb->cb_json, props, - cb->cb_json_as_int); - } else { - collect_vdev_prop(ZPOOL_PROP_SIZE, vs->vs_space, NULL, - scripted, toplevel, format, cb->cb_json, props, - cb->cb_json_as_int); + for (zprop_list_t *pl = cb->cb_proplist; pl != NULL; + pl = pl->pl_next) { + switch (pl->pl_prop) { + case ZPOOL_PROP_SIZE: + if (VDEV_STAT_VALID(vs_pspace, c) && + vs->vs_pspace) { + collect_vdev_prop( + ZPOOL_PROP_SIZE, vs->vs_pspace, + NULL, scripted, B_TRUE, format, + cb->cb_json, props, + cb->cb_json_as_int); + } else { + collect_vdev_prop( + ZPOOL_PROP_SIZE, vs->vs_space, NULL, + scripted, toplevel, format, + cb->cb_json, props, + cb->cb_json_as_int); + } + break; + case ZPOOL_PROP_ALLOCATED: + collect_vdev_prop(ZPOOL_PROP_ALLOCATED, + vs->vs_alloc, NULL, scripted, toplevel, + format, cb->cb_json, props, + cb->cb_json_as_int); + break; + + case ZPOOL_PROP_FREE: + collect_vdev_prop(ZPOOL_PROP_FREE, + vs->vs_space - vs->vs_alloc, NULL, scripted, + toplevel, format, cb->cb_json, props, + cb->cb_json_as_int); + break; + + case ZPOOL_PROP_CHECKPOINT: + collect_vdev_prop(ZPOOL_PROP_CHECKPOINT, + vs->vs_checkpoint_space, NULL, scripted, + toplevel, format, cb->cb_json, props, + cb->cb_json_as_int); + break; + + case ZPOOL_PROP_EXPANDSZ: + collect_vdev_prop(ZPOOL_PROP_EXPANDSZ, + vs->vs_esize, NULL, scripted, B_TRUE, + format, cb->cb_json, props, + cb->cb_json_as_int); + break; + + case ZPOOL_PROP_FRAGMENTATION: + collect_vdev_prop( + ZPOOL_PROP_FRAGMENTATION, + vs->vs_fragmentation, NULL, scripted, + (vs->vs_fragmentation != ZFS_FRAG_INVALID && + toplevel), + format, cb->cb_json, props, + cb->cb_json_as_int); + break; + + case ZPOOL_PROP_CAPACITY: + cap = (vs->vs_space == 0) ? + 0 : (vs->vs_alloc * 10000 / vs->vs_space); + collect_vdev_prop(ZPOOL_PROP_CAPACITY, cap, + NULL, scripted, toplevel, format, + cb->cb_json, props, cb->cb_json_as_int); + break; + + case ZPOOL_PROP_HEALTH: + state = zpool_state_to_name(vs->vs_state, + vs->vs_aux); + if (isspare) { + if (vs->vs_aux == VDEV_AUX_SPARED) + state = "INUSE"; + else if (vs->vs_state == + VDEV_STATE_HEALTHY) + state = "AVAIL"; + } + collect_vdev_prop(ZPOOL_PROP_HEALTH, 0, state, + scripted, B_TRUE, format, cb->cb_json, + props, cb->cb_json_as_int); + break; + + case ZPOOL_PROP_NAME: + break; + + default: + collect_vdev_prop(pl->pl_prop, 0, + NULL, scripted, B_FALSE, format, + cb->cb_json, props, cb->cb_json_as_int); + + } + + } - collect_vdev_prop(ZPOOL_PROP_ALLOCATED, vs->vs_alloc, NULL, - scripted, toplevel, format, cb->cb_json, props, - cb->cb_json_as_int); - collect_vdev_prop(ZPOOL_PROP_FREE, vs->vs_space - vs->vs_alloc, - NULL, scripted, toplevel, format, cb->cb_json, props, - cb->cb_json_as_int); - collect_vdev_prop(ZPOOL_PROP_CHECKPOINT, - vs->vs_checkpoint_space, NULL, scripted, toplevel, format, - cb->cb_json, props, cb->cb_json_as_int); - collect_vdev_prop(ZPOOL_PROP_EXPANDSZ, vs->vs_esize, NULL, - scripted, B_TRUE, format, cb->cb_json, props, - cb->cb_json_as_int); - collect_vdev_prop(ZPOOL_PROP_FRAGMENTATION, - vs->vs_fragmentation, NULL, scripted, - (vs->vs_fragmentation != ZFS_FRAG_INVALID && toplevel), - format, cb->cb_json, props, cb->cb_json_as_int); - cap = (vs->vs_space == 0) ? 0 : - (vs->vs_alloc * 10000 / vs->vs_space); - collect_vdev_prop(ZPOOL_PROP_CAPACITY, cap, NULL, - scripted, toplevel, format, cb->cb_json, props, - cb->cb_json_as_int); - collect_vdev_prop(ZPOOL_PROP_DEDUPRATIO, 0, NULL, - scripted, toplevel, format, cb->cb_json, props, - cb->cb_json_as_int); - state = zpool_state_to_name(vs->vs_state, vs->vs_aux); - if (isspare) { - if (vs->vs_aux == VDEV_AUX_SPARED) - state = "INUSE"; - else if (vs->vs_state == VDEV_STATE_HEALTHY) - state = "AVAIL"; - } - collect_vdev_prop(ZPOOL_PROP_HEALTH, 0, state, scripted, - B_TRUE, format, cb->cb_json, props, cb->cb_json_as_int); if (cb->cb_json) { fnvlist_add_nvlist(ent, "properties", props); diff --git a/sys/contrib/openzfs/config/kernel-block-device-operations.m4 b/sys/contrib/openzfs/config/kernel-block-device-operations.m4 index 4ff20b9c413d..1905340a9c7d 100644 --- a/sys/contrib/openzfs/config/kernel-block-device-operations.m4 +++ b/sys/contrib/openzfs/config/kernel-block-device-operations.m4 @@ -119,15 +119,49 @@ AC_DEFUN([ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS_REVALIDATE_DISK], [ ]) ]) +dnl # +dnl # 6.18 API change +dnl # block_device_operation->getgeo takes struct gendisk* as first arg +dnl # +AC_DEFUN([ZFS_AC_KERNEL_SRC_BLOCK_DEVICE_OPERATIONS_GETGEO_GENDISK], [ + ZFS_LINUX_TEST_SRC([block_device_operations_getgeo_gendisk], [ + #include <linux/blkdev.h> + + static int blk_getgeo(struct gendisk *disk, struct hd_geometry *geo) + { + (void) disk, (void) geo; + return (0); + } + + static const struct block_device_operations + bops __attribute__ ((unused)) = { + .getgeo = blk_getgeo, + }; + ], [], []) +]) + +AC_DEFUN([ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS_GETGEO_GENDISK], [ + AC_MSG_CHECKING([whether bops->getgeo() takes gendisk as first arg]) + ZFS_LINUX_TEST_RESULT([block_device_operations_getgeo_gendisk], [ + AC_MSG_RESULT(yes) + AC_DEFINE([HAVE_BLOCK_DEVICE_OPERATIONS_GETGEO_GENDISK], [1], + [Define if getgeo() in block_device_operations takes struct gendisk * as its first arg]) + ],[ + AC_MSG_RESULT(no) + ]) +]) + AC_DEFUN([ZFS_AC_KERNEL_SRC_BLOCK_DEVICE_OPERATIONS], [ ZFS_AC_KERNEL_SRC_BLOCK_DEVICE_OPERATIONS_CHECK_EVENTS ZFS_AC_KERNEL_SRC_BLOCK_DEVICE_OPERATIONS_RELEASE_VOID ZFS_AC_KERNEL_SRC_BLOCK_DEVICE_OPERATIONS_RELEASE_1ARG ZFS_AC_KERNEL_SRC_BLOCK_DEVICE_OPERATIONS_REVALIDATE_DISK + ZFS_AC_KERNEL_SRC_BLOCK_DEVICE_OPERATIONS_GETGEO_GENDISK ]) AC_DEFUN([ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS], [ ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS_CHECK_EVENTS ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS_RELEASE_VOID ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS_REVALIDATE_DISK + ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS_GETGEO_GENDISK ]) diff --git a/sys/contrib/openzfs/config/kernel-drop-inode.m4 b/sys/contrib/openzfs/config/kernel-drop-inode.m4 new file mode 100644 index 000000000000..6f2b12cadc02 --- /dev/null +++ b/sys/contrib/openzfs/config/kernel-drop-inode.m4 @@ -0,0 +1,24 @@ +dnl # +dnl # 6.18 API change +dnl # - generic_drop_inode() renamed to inode_generic_drop() +dnl # - generic_delete_inode() renamed to inode_just_drop() +dnl # +AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_GENERIC_DROP], [ + ZFS_LINUX_TEST_SRC([inode_generic_drop], [ + #include <linux/fs.h> + ],[ + struct inode *ip = NULL; + inode_generic_drop(ip); + ]) +]) + +AC_DEFUN([ZFS_AC_KERNEL_INODE_GENERIC_DROP], [ + AC_MSG_CHECKING([whether inode_generic_drop() exists]) + ZFS_LINUX_TEST_RESULT([inode_generic_drop], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_INODE_GENERIC_DROP, 1, + [inode_generic_drop() exists]) + ],[ + AC_MSG_RESULT(no) + ]) +]) diff --git a/sys/contrib/openzfs/config/kernel-namespace.m4 b/sys/contrib/openzfs/config/kernel-namespace.m4 new file mode 100644 index 000000000000..9b0b12e4eab4 --- /dev/null +++ b/sys/contrib/openzfs/config/kernel-namespace.m4 @@ -0,0 +1,31 @@ +dnl # +dnl # 6.18 API change +dnl # ns->ops->type was moved to ns->ns.ns_type (struct ns_common) +dnl # +AC_DEFUN([ZFS_AC_KERNEL_SRC_NS_COMMON_TYPE], [ + ZFS_LINUX_TEST_SRC([ns_common_type], [ + #include <linux/user_namespace.h> + ],[ + struct user_namespace ns; + ns.ns.ns_type = 0; + ]) +]) + +AC_DEFUN([ZFS_AC_KERNEL_NS_COMMON_TYPE], [ + AC_MSG_CHECKING([whether ns_type is accessible through ns_common]) + ZFS_LINUX_TEST_RESULT([ns_common_type], [ + AC_MSG_RESULT(yes) + AC_DEFINE([HAVE_NS_COMMON_TYPE], 1, + [Define if ns_type is accessible through ns_common]) + ],[ + AC_MSG_RESULT(no) + ]) +]) + +AC_DEFUN([ZFS_AC_KERNEL_SRC_NAMESPACE], [ + ZFS_AC_KERNEL_SRC_NS_COMMON_TYPE +]) + +AC_DEFUN([ZFS_AC_KERNEL_NAMESPACE], [ + ZFS_AC_KERNEL_NS_COMMON_TYPE +]) diff --git a/sys/contrib/openzfs/config/kernel-userns-capabilities.m4 b/sys/contrib/openzfs/config/kernel-userns-capabilities.m4 deleted file mode 100644 index f4e24fb1606a..000000000000 --- a/sys/contrib/openzfs/config/kernel-userns-capabilities.m4 +++ /dev/null @@ -1,79 +0,0 @@ -dnl # -dnl # 2.6.38 API change -dnl # ns_capable() was introduced -dnl # -AC_DEFUN([ZFS_AC_KERNEL_SRC_NS_CAPABLE], [ - ZFS_LINUX_TEST_SRC([ns_capable], [ - #include <linux/capability.h> - ],[ - ns_capable((struct user_namespace *)NULL, CAP_SYS_ADMIN); - ]) -]) - -AC_DEFUN([ZFS_AC_KERNEL_NS_CAPABLE], [ - AC_MSG_CHECKING([whether ns_capable exists]) - ZFS_LINUX_TEST_RESULT([ns_capable], [ - AC_MSG_RESULT(yes) - ],[ - ZFS_LINUX_TEST_ERROR([ns_capable()]) - ]) -]) - -dnl # -dnl # 2.6.39 API change -dnl # struct user_namespace was added to struct cred_t as cred->user_ns member -dnl # -AC_DEFUN([ZFS_AC_KERNEL_SRC_CRED_USER_NS], [ - ZFS_LINUX_TEST_SRC([cred_user_ns], [ - #include <linux/cred.h> - ],[ - struct cred cr; - cr.user_ns = (struct user_namespace *)NULL; - ]) -]) - -AC_DEFUN([ZFS_AC_KERNEL_CRED_USER_NS], [ - AC_MSG_CHECKING([whether cred_t->user_ns exists]) - ZFS_LINUX_TEST_RESULT([cred_user_ns], [ - AC_MSG_RESULT(yes) - ],[ - ZFS_LINUX_TEST_ERROR([cred_t->user_ns()]) - ]) -]) - -dnl # -dnl # 3.4 API change -dnl # kuid_has_mapping() and kgid_has_mapping() were added to distinguish -dnl # between internal kernel uids/gids and user namespace uids/gids. -dnl # -AC_DEFUN([ZFS_AC_KERNEL_SRC_KUID_HAS_MAPPING], [ - ZFS_LINUX_TEST_SRC([kuid_has_mapping], [ - #include <linux/uidgid.h> - ],[ - kuid_has_mapping((struct user_namespace *)NULL, KUIDT_INIT(0)); - kgid_has_mapping((struct user_namespace *)NULL, KGIDT_INIT(0)); - ]) -]) - -AC_DEFUN([ZFS_AC_KERNEL_KUID_HAS_MAPPING], [ - AC_MSG_CHECKING([whether kuid_has_mapping/kgid_has_mapping exist]) - ZFS_LINUX_TEST_RESULT([kuid_has_mapping], [ - AC_MSG_RESULT(yes) - ],[ - ZFS_LINUX_TEST_ERROR([kuid_has_mapping()]) - ]) -]) - -AC_DEFUN([ZFS_AC_KERNEL_SRC_USERNS_CAPABILITIES], [ - ZFS_AC_KERNEL_SRC_NS_CAPABLE - ZFS_AC_KERNEL_SRC_HAS_CAPABILITY - ZFS_AC_KERNEL_SRC_CRED_USER_NS - ZFS_AC_KERNEL_SRC_KUID_HAS_MAPPING -]) - -AC_DEFUN([ZFS_AC_KERNEL_USERNS_CAPABILITIES], [ - ZFS_AC_KERNEL_NS_CAPABLE - ZFS_AC_KERNEL_HAS_CAPABILITY - ZFS_AC_KERNEL_CRED_USER_NS - ZFS_AC_KERNEL_KUID_HAS_MAPPING -]) diff --git a/sys/contrib/openzfs/config/kernel-writeback.m4 b/sys/contrib/openzfs/config/kernel-writeback.m4 new file mode 100644 index 000000000000..334d65ef84b6 --- /dev/null +++ b/sys/contrib/openzfs/config/kernel-writeback.m4 @@ -0,0 +1,58 @@ +AC_DEFUN([ZFS_AC_KERNEL_SRC_WRITEPAGE_T], [ + dnl # + dnl # 6.3 API change + dnl # The writepage_t function type now has its first argument as + dnl # struct folio* instead of struct page* + dnl # + ZFS_LINUX_TEST_SRC([writepage_t_folio], [ + #include <linux/writeback.h> + static int putpage(struct folio *folio, + struct writeback_control *wbc, void *data) + { return 0; } + writepage_t func = putpage; + ],[]) +]) + +AC_DEFUN([ZFS_AC_KERNEL_WRITEPAGE_T], [ + AC_MSG_CHECKING([whether int (*writepage_t)() takes struct folio*]) + ZFS_LINUX_TEST_RESULT([writepage_t_folio], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_WRITEPAGE_T_FOLIO, 1, + [int (*writepage_t)() takes struct folio*]) + ],[ + AC_MSG_RESULT(no) + ]) +]) + +AC_DEFUN([ZFS_AC_KERNEL_SRC_WRITE_CACHE_PAGES], [ + dnl # + dnl # 6.18 API change + dnl # write_cache_pages() has been removed. + dnl # + ZFS_LINUX_TEST_SRC([write_cache_pages], [ + #include <linux/writeback.h> + ], [ + (void) write_cache_pages(NULL, NULL, NULL, NULL); + ]) +]) + +AC_DEFUN([ZFS_AC_KERNEL_WRITE_CACHE_PAGES], [ + AC_MSG_CHECKING([whether write_cache_pages() is available]) + ZFS_LINUX_TEST_RESULT([write_cache_pages], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_WRITE_CACHE_PAGES, 1, + [write_cache_pages() is available]) + ],[ + AC_MSG_RESULT(no) + ]) +]) + +AC_DEFUN([ZFS_AC_KERNEL_SRC_WRITEBACK], [ + ZFS_AC_KERNEL_SRC_WRITEPAGE_T + ZFS_AC_KERNEL_SRC_WRITE_CACHE_PAGES +]) + +AC_DEFUN([ZFS_AC_KERNEL_WRITEBACK], [ + ZFS_AC_KERNEL_WRITEPAGE_T + ZFS_AC_KERNEL_WRITE_CACHE_PAGES +]) diff --git a/sys/contrib/openzfs/config/kernel-writepage_t.m4 b/sys/contrib/openzfs/config/kernel-writepage_t.m4 deleted file mode 100644 index a82cf370c9d4..000000000000 --- a/sys/contrib/openzfs/config/kernel-writepage_t.m4 +++ /dev/null @@ -1,26 +0,0 @@ -AC_DEFUN([ZFS_AC_KERNEL_SRC_WRITEPAGE_T], [ - dnl # - dnl # 6.3 API change - dnl # The writepage_t function type now has its first argument as - dnl # struct folio* instead of struct page* - dnl # - ZFS_LINUX_TEST_SRC([writepage_t_folio], [ - #include <linux/writeback.h> - static int putpage(struct folio *folio, - struct writeback_control *wbc, void *data) - { return 0; } - writepage_t func = putpage; - ],[]) -]) - -AC_DEFUN([ZFS_AC_KERNEL_WRITEPAGE_T], [ - AC_MSG_CHECKING([whether int (*writepage_t)() takes struct folio*]) - ZFS_LINUX_TEST_RESULT([writepage_t_folio], [ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_WRITEPAGE_T_FOLIO, 1, - [int (*writepage_t)() takes struct folio*]) - ],[ - AC_MSG_RESULT(no) - ]) -]) - diff --git a/sys/contrib/openzfs/config/kernel.m4 b/sys/contrib/openzfs/config/kernel.m4 index 35819e4d68c5..40b7de739882 100644 --- a/sys/contrib/openzfs/config/kernel.m4 +++ b/sys/contrib/openzfs/config/kernel.m4 @@ -121,7 +121,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_SRC], [ ZFS_AC_KERNEL_SRC_IDMAP_MNT_API ZFS_AC_KERNEL_SRC_IDMAP_NO_USERNS ZFS_AC_KERNEL_SRC_IATTR_VFSID - ZFS_AC_KERNEL_SRC_WRITEPAGE_T + ZFS_AC_KERNEL_SRC_WRITEBACK ZFS_AC_KERNEL_SRC_RECLAIMED ZFS_AC_KERNEL_SRC_REGISTER_SYSCTL_TABLE ZFS_AC_KERNEL_SRC_REGISTER_SYSCTL_SZ @@ -136,6 +136,8 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_SRC], [ ZFS_AC_KERNEL_SRC_TIMER ZFS_AC_KERNEL_SRC_SUPER_BLOCK_S_WB_ERR ZFS_AC_KERNEL_SRC_SOPS_FREE_INODE + ZFS_AC_KERNEL_SRC_NAMESPACE + ZFS_AC_KERNEL_SRC_INODE_GENERIC_DROP case "$host_cpu" in powerpc*) ZFS_AC_KERNEL_SRC_CPU_HAS_FEATURE @@ -240,7 +242,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_RESULT], [ ZFS_AC_KERNEL_IDMAP_MNT_API ZFS_AC_KERNEL_IDMAP_NO_USERNS ZFS_AC_KERNEL_IATTR_VFSID - ZFS_AC_KERNEL_WRITEPAGE_T + ZFS_AC_KERNEL_WRITEBACK ZFS_AC_KERNEL_RECLAIMED ZFS_AC_KERNEL_REGISTER_SYSCTL_TABLE ZFS_AC_KERNEL_REGISTER_SYSCTL_SZ @@ -256,6 +258,8 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_RESULT], [ ZFS_AC_KERNEL_TIMER ZFS_AC_KERNEL_SUPER_BLOCK_S_WB_ERR ZFS_AC_KERNEL_SOPS_FREE_INODE + ZFS_AC_KERNEL_NAMESPACE + ZFS_AC_KERNEL_INODE_GENERIC_DROP case "$host_cpu" in powerpc*) ZFS_AC_KERNEL_CPU_HAS_FEATURE diff --git a/sys/contrib/openzfs/include/os/linux/kernel/linux/vfs_compat.h b/sys/contrib/openzfs/include/os/linux/kernel/linux/vfs_compat.h index cbf14e28371f..d9dc904bc322 100644 --- a/sys/contrib/openzfs/include/os/linux/kernel/linux/vfs_compat.h +++ b/sys/contrib/openzfs/include/os/linux/kernel/linux/vfs_compat.h @@ -23,6 +23,7 @@ /* * Copyright (C) 2011 Lawrence Livermore National Security, LLC. * Copyright (C) 2015 Jörg Thalheim. + * Copyright (c) 2025, Rob Norris <robn@despairlabs.com> */ #ifndef _ZFS_VFS_H @@ -262,4 +263,10 @@ zpl_is_32bit_api(void) #define zpl_generic_fillattr(user_ns, ip, sp) generic_fillattr(ip, sp) #endif +#ifdef HAVE_INODE_GENERIC_DROP +/* 6.18 API change. These were renamed, alias the old names to the new. */ +#define generic_delete_inode(ip) inode_just_drop(ip) +#define generic_drop_inode(ip) inode_generic_drop(ip) +#endif + #endif /* _ZFS_VFS_H */ diff --git a/sys/contrib/openzfs/man/man8/zpool-remove.8 b/sys/contrib/openzfs/man/man8/zpool-remove.8 index 4d5fc431d332..483d885f10fd 100644 --- a/sys/contrib/openzfs/man/man8/zpool-remove.8 +++ b/sys/contrib/openzfs/man/man8/zpool-remove.8 @@ -58,8 +58,8 @@ This command supports removing hot spare, cache, log, and both mirrored and non-redundant primary top-level vdevs, including dedup and special vdevs. .Pp Top-level vdevs can only be removed if the primary pool storage does not contain -a top-level raidz vdev, all top-level vdevs have the same sector size, and the -keys for all encrypted datasets are loaded. +a top-level raidz or draid vdev, all top-level vdevs have the same ashift size, +and the keys for all encrypted datasets are loaded. .Pp Removing a top-level vdev reduces the total amount of space in the storage pool. The specified device will be evacuated by copying all allocated space from it to diff --git a/sys/contrib/openzfs/module/icp/algs/sha2/sha2_generic.c b/sys/contrib/openzfs/module/icp/algs/sha2/sha2_generic.c index d0fcca798fa9..ad707341eec7 100644 --- a/sys/contrib/openzfs/module/icp/algs/sha2/sha2_generic.c +++ b/sys/contrib/openzfs/module/icp/algs/sha2/sha2_generic.c @@ -77,7 +77,8 @@ static const uint32_t SHA256_K[64] = { h = g, g = f, f = e, e = d + T1; \ d = c, c = b, b = a, a = T1 + T2; -static void sha256_generic(uint32_t state[8], const void *data, size_t num_blks) +static void +icp_sha256_generic(uint32_t state[8], const void *data, size_t num_blks) { uint64_t blk; @@ -173,7 +174,8 @@ static const uint64_t SHA512_K[80] = { 0x5fcb6fab3ad6faec, 0x6c44198c4a475817 }; -static void sha512_generic(uint64_t state[8], const void *data, size_t num_blks) +static void +icp_sha512_generic(uint64_t state[8], const void *data, size_t num_blks) { uint64_t blk; @@ -226,7 +228,8 @@ static void sha512_generic(uint64_t state[8], const void *data, size_t num_blks) } } -static void sha256_update(sha256_ctx *ctx, const uint8_t *data, size_t len) +static void +icp_sha256_update(sha256_ctx *ctx, const uint8_t *data, size_t len) { uint64_t pos = ctx->count[0]; uint64_t total = ctx->count[1]; @@ -258,7 +261,8 @@ static void sha256_update(sha256_ctx *ctx, const uint8_t *data, size_t len) ctx->count[1] = total; } -static void sha512_update(sha512_ctx *ctx, const uint8_t *data, size_t len) +static void +icp_sha512_update(sha512_ctx *ctx, const uint8_t *data, size_t len) { uint64_t pos = ctx->count[0]; uint64_t total = ctx->count[1]; @@ -290,7 +294,8 @@ static void sha512_update(sha512_ctx *ctx, const uint8_t *data, size_t len) ctx->count[1] = total; } -static void sha256_final(sha256_ctx *ctx, uint8_t *result, int bits) +static void +icp_sha256_final(sha256_ctx *ctx, uint8_t *result, int bits) { uint64_t mlen, pos = ctx->count[0]; uint8_t *m = ctx->wbuf; @@ -334,7 +339,8 @@ static void sha256_final(sha256_ctx *ctx, uint8_t *result, int bits) memset(ctx, 0, sizeof (*ctx)); } -static void sha512_final(sha512_ctx *ctx, uint8_t *result, int bits) +static void +icp_sha512_final(sha512_ctx *ctx, uint8_t *result, int bits) { uint64_t mlen, pos = ctx->count[0]; uint8_t *m = ctx->wbuf, *r; @@ -461,14 +467,14 @@ SHA2Update(SHA2_CTX *ctx, const void *data, size_t len) switch (ctx->algotype) { case SHA256: - sha256_update(&ctx->sha256, data, len); + icp_sha256_update(&ctx->sha256, data, len); break; case SHA512: case SHA512_HMAC_MECH_INFO_TYPE: - sha512_update(&ctx->sha512, data, len); + icp_sha512_update(&ctx->sha512, data, len); break; case SHA512_256: - sha512_update(&ctx->sha512, data, len); + icp_sha512_update(&ctx->sha512, data, len); break; } } @@ -479,32 +485,33 @@ SHA2Final(void *digest, SHA2_CTX *ctx) { switch (ctx->algotype) { case SHA256: - sha256_final(&ctx->sha256, digest, 256); + icp_sha256_final(&ctx->sha256, digest, 256); break; case SHA512: case SHA512_HMAC_MECH_INFO_TYPE: - sha512_final(&ctx->sha512, digest, 512); + icp_sha512_final(&ctx->sha512, digest, 512); break; case SHA512_256: - sha512_final(&ctx->sha512, digest, 256); + icp_sha512_final(&ctx->sha512, digest, 256); break; } } /* the generic implementation is always okay */ -static boolean_t sha2_is_supported(void) +static boolean_t +icp_sha2_is_supported(void) { return (B_TRUE); } const sha256_ops_t sha256_generic_impl = { .name = "generic", - .transform = sha256_generic, - .is_supported = sha2_is_supported + .transform = icp_sha256_generic, + .is_supported = icp_sha2_is_supported }; const sha512_ops_t sha512_generic_impl = { .name = "generic", - .transform = sha512_generic, - .is_supported = sha2_is_supported + .transform = icp_sha512_generic, + .is_supported = icp_sha2_is_supported }; diff --git a/sys/contrib/openzfs/module/os/freebsd/zfs/zio_crypt.c b/sys/contrib/openzfs/module/os/freebsd/zfs/zio_crypt.c index 91cf38016e00..8562c42b3220 100644 --- a/sys/contrib/openzfs/module/os/freebsd/zfs/zio_crypt.c +++ b/sys/contrib/openzfs/module/os/freebsd/zfs/zio_crypt.c @@ -437,6 +437,7 @@ zio_crypt_key_wrap(crypto_key_t *cwkey, zio_crypt_key_t *key, uint8_t *iv, ASSERT3U(crypt, <, ZIO_CRYPT_FUNCTIONS); + memset(&cuio_s, 0, sizeof (cuio_s)); zfs_uio_init(&cuio, &cuio_s); keydata_len = zio_crypt_table[crypt].ci_keylen; @@ -519,6 +520,7 @@ zio_crypt_key_unwrap(crypto_key_t *cwkey, uint64_t crypt, uint64_t version, keydata_len = zio_crypt_table[crypt].ci_keylen; rw_init(&key->zk_salt_lock, NULL, RW_DEFAULT, NULL); + memset(&cuio_s, 0, sizeof (cuio_s)); zfs_uio_init(&cuio, &cuio_s); /* diff --git a/sys/contrib/openzfs/module/os/linux/spl/spl-zone.c b/sys/contrib/openzfs/module/os/linux/spl/spl-zone.c index 45c2999a4bb1..b2eae5d00b10 100644 --- a/sys/contrib/openzfs/module/os/linux/spl/spl-zone.c +++ b/sys/contrib/openzfs/module/os/linux/spl/spl-zone.c @@ -25,6 +25,10 @@ * SUCH DAMAGE. */ +/* + * Copyright (c) 2025, Rob Norris <robn@despairlabs.com> + */ + #include <sys/types.h> #include <sys/sysmacros.h> #include <sys/kmem.h> @@ -56,6 +60,19 @@ typedef struct zone_dataset { } zone_dataset_t; #ifdef CONFIG_USER_NS + +/* + * Linux 6.18 moved the generic namespace type away from ns->ops->type onto + * ns_common itself. + */ +#ifdef HAVE_NS_COMMON_TYPE +#define ns_is_newuser(ns) \ + ((ns)->ns_type == CLONE_NEWUSER) +#else +#define ns_is_newuser(ns) \ + ((ns)->ops != NULL && (ns)->ops->type == CLONE_NEWUSER) +#endif + /* * Returns: * - 0 on success @@ -84,7 +101,7 @@ user_ns_get(int fd, struct user_namespace **userns) goto done; } ns = get_proc_ns(file_inode(nsfile)); - if (ns->ops->type != CLONE_NEWUSER) { + if (!ns_is_newuser(ns)) { error = ENOTTY; goto done; } diff --git a/sys/contrib/openzfs/module/os/linux/zfs/abd_os.c b/sys/contrib/openzfs/module/os/linux/zfs/abd_os.c index 8a8316f63c48..18f2426fbbfc 100644 --- a/sys/contrib/openzfs/module/os/linux/zfs/abd_os.c +++ b/sys/contrib/openzfs/module/os/linux/zfs/abd_os.c @@ -23,6 +23,7 @@ * Copyright (c) 2014 by Chunwei Chen. All rights reserved. * Copyright (c) 2019 by Delphix. All rights reserved. * Copyright (c) 2023, 2024, Klara Inc. + * Copyright (c) 2025, Rob Norris <robn@despairlabs.com> */ /* @@ -1109,6 +1110,14 @@ abd_return_buf_copy(abd_t *abd, void *buf, size_t n) #define ABD_ITER_PAGE_SIZE(page) (PAGESIZE) #endif +#ifndef nth_page +/* + * Since 6.18 nth_page() no longer exists, and is no longer required to iterate + * within a single SG entry, so we replace it with a simple addition. + */ +#define nth_page(p, n) ((p)+(n)) +#endif + void abd_iter_page(struct abd_iter *aiter) { diff --git a/sys/contrib/openzfs/module/os/linux/zfs/zfs_acl.c b/sys/contrib/openzfs/module/os/linux/zfs/zfs_acl.c index daa4b5776837..934d74a112fd 100644 --- a/sys/contrib/openzfs/module/os/linux/zfs/zfs_acl.c +++ b/sys/contrib/openzfs/module/os/linux/zfs/zfs_acl.c @@ -2524,7 +2524,7 @@ zfs_zaccess_common(znode_t *zp, uint32_t v4_mode, uint32_t *working_mode, * Also note: DOS R/O is ignored for directories. */ if ((v4_mode & WRITE_MASK_DATA) && - S_ISDIR(ZTOI(zp)->i_mode) && + !S_ISDIR(ZTOI(zp)->i_mode) && (zp->z_pflags & ZFS_READONLY)) { return (SET_ERROR(EPERM)); } diff --git a/sys/contrib/openzfs/module/os/linux/zfs/zfs_vnops_os.c b/sys/contrib/openzfs/module/os/linux/zfs/zfs_vnops_os.c index 6106726651a3..e845ad69ad78 100644 --- a/sys/contrib/openzfs/module/os/linux/zfs/zfs_vnops_os.c +++ b/sys/contrib/openzfs/module/os/linux/zfs/zfs_vnops_os.c @@ -2033,10 +2033,7 @@ zfs_setattr(znode_t *zp, vattr_t *vap, int flags, cred_t *cr, zidmap_t *mnt_ns) goto out3; } - if ((mask & ATTR_SIZE) && (zp->z_pflags & ZFS_READONLY)) { - err = SET_ERROR(EPERM); - goto out3; - } + /* ZFS_READONLY will be handled in zfs_zaccess() */ /* * Verify timestamps doesn't overflow 32 bits. diff --git a/sys/contrib/openzfs/module/os/linux/zfs/zpl_file.c b/sys/contrib/openzfs/module/os/linux/zfs/zpl_file.c index d07317b0d910..02965ac8cbee 100644 --- a/sys/contrib/openzfs/module/os/linux/zfs/zpl_file.c +++ b/sys/contrib/openzfs/module/os/linux/zfs/zpl_file.c @@ -23,6 +23,7 @@ * Copyright (c) 2011, Lawrence Livermore National Security, LLC. * Copyright (c) 2015 by Chunwei Chen. All rights reserved. * Copyright (c) 2025, Klara, Inc. + * Copyright (c) 2025, Rob Norris <robn@despairlabs.com> */ @@ -478,6 +479,7 @@ zpl_putpage(struct page *pp, struct writeback_control *wbc, void *data) return (ret); } +#ifdef HAVE_WRITE_CACHE_PAGES #ifdef HAVE_WRITEPAGE_T_FOLIO static int zpl_putfolio(struct folio *pp, struct writeback_control *wbc, void *data) @@ -499,6 +501,78 @@ zpl_write_cache_pages(struct address_space *mapping, #endif return (result); } +#else +static inline int +zpl_write_cache_pages(struct address_space *mapping, + struct writeback_control *wbc, void *data) +{ + pgoff_t start = wbc->range_start >> PAGE_SHIFT; + pgoff_t end = wbc->range_end >> PAGE_SHIFT; + + struct folio_batch fbatch; + folio_batch_init(&fbatch); + + /* + * This atomically (-ish) tags all DIRTY pages in the range with + * TOWRITE, allowing users to continue dirtying or undirtying pages + * while we get on with writeback, without us treading on each other. + */ + tag_pages_for_writeback(mapping, start, end); + + int err = 0; + unsigned int npages; + + /* + * Grab references to the TOWRITE pages just flagged. This may not get + * all of them, so we do it in a loop until there are none left. + */ + while ((npages = filemap_get_folios_tag(mapping, &start, end, + PAGECACHE_TAG_TOWRITE, &fbatch)) != 0) { + + /* Loop over each page and write it out. */ + struct folio *folio; + while ((folio = folio_batch_next(&fbatch)) != NULL) { + folio_lock(folio); + + /* + * If the folio has been remapped, or is no longer + * dirty, then there's nothing to do. + */ + if (folio->mapping != mapping || + !folio_test_dirty(folio)) { + folio_unlock(folio); + continue; + } + + /* + * If writeback is already in progress, wait for it to + * finish. We continue after this even if the page + * ends up clean; zfs_putpage() will skip it if no + * further work is required. + */ + while (folio_test_writeback(folio)) + folio_wait_bit(folio, PG_writeback); + + /* + * Write it out and collect any error. zfs_putpage() + * will clear the TOWRITE and DIRTY flags, and return + * with the page unlocked. + */ + int ferr = zpl_putpage(&folio->page, wbc, data); + if (err == 0 && ferr != 0) + err = ferr; + + /* Housekeeping for the caller. */ + wbc->nr_to_write -= folio_nr_pages(folio); + } + + /* Release any remaining references on the batch. */ + folio_batch_release(&fbatch); + } + + return (err); +} +#endif static int zpl_writepages(struct address_space *mapping, struct writeback_control *wbc) diff --git a/sys/contrib/openzfs/module/os/linux/zfs/zpl_super.c b/sys/contrib/openzfs/module/os/linux/zfs/zpl_super.c index 444948d03cb3..347b352506e5 100644 --- a/sys/contrib/openzfs/module/os/linux/zfs/zpl_super.c +++ b/sys/contrib/openzfs/module/os/linux/zfs/zpl_super.c @@ -23,6 +23,7 @@ * Copyright (c) 2011, Lawrence Livermore National Security, LLC. * Copyright (c) 2023, Datto Inc. All rights reserved. * Copyright (c) 2025, Klara, Inc. + * Copyright (c) 2025, Rob Norris <robn@despairlabs.com> */ @@ -33,6 +34,7 @@ #include <sys/zpl.h> #include <linux/iversion.h> #include <linux/version.h> +#include <linux/vfs_compat.h> /* * What to do when the last reference to an inode is released. If 0, the kernel @@ -104,7 +106,7 @@ zpl_dirty_inode(struct inode *ip, int flags) * reporting memory pressure and requests OpenZFS release some memory (see * zfs_prune()). * - * When set to 1, we call generic_delete_node(), which always returns "destroy + * When set to 1, we call generic_delete_inode(), which always returns "destroy * immediately", resulting in inodes being destroyed immediately, releasing * their associated dnodes and dbufs to the dbuf cached and the ARC to be * evicted as normal. diff --git a/sys/contrib/openzfs/module/os/linux/zfs/zvol_os.c b/sys/contrib/openzfs/module/os/linux/zfs/zvol_os.c index 4e66bee7744d..fe939150b641 100644 --- a/sys/contrib/openzfs/module/os/linux/zfs/zvol_os.c +++ b/sys/contrib/openzfs/module/os/linux/zfs/zvol_os.c @@ -21,7 +21,7 @@ */ /* * Copyright (c) 2012, 2020 by Delphix. All rights reserved. - * Copyright (c) 2024, Rob Norris <robn@despairlabs.com> + * Copyright (c) 2024, 2025, Rob Norris <robn@despairlabs.com> * Copyright (c) 2024, 2025, Klara, Inc. */ @@ -1032,12 +1032,12 @@ zvol_os_update_volsize(zvol_state_t *zv, uint64_t volsize) * tiny devices. For devices over 1 Mib a standard head and sector count * is used to keep the cylinders count reasonable. */ -static int -zvol_getgeo(struct block_device *bdev, struct hd_geometry *geo) +static inline int +zvol_getgeo_impl(struct gendisk *disk, struct hd_geometry *geo) { + zvol_state_t *zv = atomic_load_ptr(&disk->private_data); sector_t sectors; - zvol_state_t *zv = atomic_load_ptr(&bdev->bd_disk->private_data); ASSERT3P(zv, !=, NULL); ASSERT3U(zv->zv_open_count, >, 0); @@ -1057,6 +1057,20 @@ zvol_getgeo(struct block_device *bdev, struct hd_geometry *geo) return (0); } +#ifdef HAVE_BLOCK_DEVICE_OPERATIONS_GETGEO_GENDISK +static int +zvol_getgeo(struct gendisk *disk, struct hd_geometry *geo) +{ + return (zvol_getgeo_impl(disk, geo)); +} +#else +static int +zvol_getgeo(struct block_device *bdev, struct hd_geometry *geo) +{ + return (zvol_getgeo_impl(bdev->bd_disk, geo)); +} +#endif + /* * Why have two separate block_device_operations structs? * @@ -1500,7 +1514,7 @@ zvol_os_remove_minor(zvol_state_t *zv) if (zso->use_blk_mq) blk_mq_free_tag_set(&zso->tag_set); - ida_simple_remove(&zvol_ida, MINOR(zso->zvo_dev) >> ZVOL_MINOR_BITS); + ida_free(&zvol_ida, MINOR(zso->zvo_dev) >> ZVOL_MINOR_BITS); kmem_free(zso, sizeof (struct zvol_state_os)); @@ -1655,7 +1669,7 @@ zvol_os_create_minor(const char *name) if (zvol_inhibit_dev) return (0); - idx = ida_simple_get(&zvol_ida, 0, 0, kmem_flags_convert(KM_SLEEP)); + idx = ida_alloc(&zvol_ida, kmem_flags_convert(KM_SLEEP)); if (idx < 0) return (SET_ERROR(-idx)); minor = idx << ZVOL_MINOR_BITS; @@ -1663,7 +1677,7 @@ zvol_os_create_minor(const char *name) /* too many partitions can cause an overflow */ zfs_dbgmsg("zvol: create minor overflow: %s, minor %u/%u", name, minor, MINOR(minor)); - ida_simple_remove(&zvol_ida, idx); + ida_free(&zvol_ida, idx); return (SET_ERROR(EINVAL)); } @@ -1671,7 +1685,7 @@ zvol_os_create_minor(const char *name) if (zv) { ASSERT(MUTEX_HELD(&zv->zv_state_lock)); mutex_exit(&zv->zv_state_lock); - ida_simple_remove(&zvol_ida, idx); + ida_free(&zvol_ida, idx); return (SET_ERROR(EEXIST)); } @@ -1771,7 +1785,7 @@ out_doi: rw_exit(&zvol_state_lock); error = zvol_os_add_disk(zv->zv_zso->zvo_disk); } else { - ida_simple_remove(&zvol_ida, idx); + ida_free(&zvol_ida, idx); } return (error); diff --git a/sys/contrib/openzfs/module/zfs/vdev_removal.c b/sys/contrib/openzfs/module/zfs/vdev_removal.c index 2f7a739da241..abb71543e3ab 100644 --- a/sys/contrib/openzfs/module/zfs/vdev_removal.c +++ b/sys/contrib/openzfs/module/zfs/vdev_removal.c @@ -51,34 +51,70 @@ #include <sys/trace_zfs.h> /* - * This file contains the necessary logic to remove vdevs from a - * storage pool. Currently, the only devices that can be removed - * are log, cache, and spare devices; and top level vdevs from a pool - * w/o raidz or mirrors. (Note that members of a mirror can be removed - * by the detach operation.) + * This file contains the necessary logic to remove vdevs from a storage + * pool. Note that members of a mirror can be removed by the detach + * operation. Currently, the only devices that can be removed are: * - * Log vdevs are removed by evacuating them and then turning the vdev - * into a hole vdev while holding spa config locks. + * 1) Traditional hot spare and cache vdevs. Note that draid distributed + * spares are fixed at creation time and cannot be removed. * - * Top level vdevs are removed and converted into an indirect vdev via - * a multi-step process: + * 2) Log vdevs are removed by evacuating them and then turning the vdev + * into a hole vdev while holding spa config locks. * - * - Disable allocations from this device (spa_vdev_remove_top). + * 3) Top-level singleton and mirror vdevs, including dedup and special + * vdevs, are removed and converted into an indirect vdev via a + * multi-step process: * - * - From a new thread (spa_vdev_remove_thread), copy data from - * the removing vdev to a different vdev. The copy happens in open - * context (spa_vdev_copy_impl) and issues a sync task - * (vdev_mapping_sync) so the sync thread can update the partial - * indirect mappings in core and on disk. + * - Disable allocations from this device (spa_vdev_remove_top). * - * - If a free happens during a removal, it is freed from the - * removing vdev, and if it has already been copied, from the new - * location as well (free_from_removing_vdev). + * - From a new thread (spa_vdev_remove_thread), copy data from the + * removing vdev to a different vdev. The copy happens in open context + * (spa_vdev_copy_impl) and issues a sync task (vdev_mapping_sync) so + * the sync thread can update the partial indirect mappings in core + * and on disk. * - * - After the removal is completed, the copy thread converts the vdev - * into an indirect vdev (vdev_remove_complete) before instructing - * the sync thread to destroy the space maps and finish the removal - * (spa_finish_removal). + * - If a free happens during a removal, it is freed from the removing + * vdev, and if it has already been copied, from the new location as + * well (free_from_removing_vdev). + * + * - After the removal is completed, the copy thread converts the vdev + * into an indirect vdev (vdev_remove_complete) before instructing + * the sync thread to destroy the space maps and finish the removal + * (spa_finish_removal). + * + * The following constraints currently apply primary device removal: + * + * - All vdevs must be online, healthy, and not be missing any data + * according to the DTLs. + * + * - When removing a singleton or mirror vdev, regardless of it's a + * special, dedup, or primary device, it must have the same ashift + * as the devices in the normal allocation class. Furthermore, all + * vdevs in the normal allocation class must have the same ashift to + * ensure the new allocations never includes additional padding. + * + * - The normal allocation class cannot contain any raidz or draid + * top-level vdevs since segments are copied without regard for block + * boundaries. This makes it impossible to calculate the required + * parity columns when using these vdev types as the destination. + * + * - The encryption keys must be loaded so the ZIL logs can be reset + * in order to prevent writing to the device being removed. + * + * N.B. ashift and raidz/draid constraints for primary top-level device + * removal could be slightly relaxed if it were possible to request that + * DVAs from a mirror or singleton in the specified allocation class be + * used (metaslab_alloc_dva). + * + * This flexibility would be particularly useful for raidz/draid pools which + * often include a mirrored special device. If a mistakenly added top-level + * singleton were added it could then still be removed at the cost of some + * special device capacity. This may be a worthwhile tradeoff depending on + * the pool capacity and expense (cost, complexity, time) of creating a new + * pool and copying all of the data to correct the configuration. + * + * Furthermore, while not currently supported it should be possible to allow + * vdevs of any type to be removed as long as they've never been written to. */ typedef struct vdev_copy_arg { diff --git a/sys/contrib/openzfs/module/zfs/zvol.c b/sys/contrib/openzfs/module/zfs/zvol.c index faced0db7e9e..00f98168d3d8 100644 --- a/sys/contrib/openzfs/module/zfs/zvol.c +++ b/sys/contrib/openzfs/module/zfs/zvol.c @@ -410,7 +410,7 @@ zvol_set_volthreading(const char *name, boolean_t value) { zvol_state_t *zv = zvol_find_by_name(name, RW_NONE); if (zv == NULL) - return (SET_ERROR(ENOENT)); + return (-1); zv->zv_threading = value; mutex_exit(&zv->zv_state_lock); return (0); diff --git a/sys/contrib/openzfs/scripts/zfs-tests.sh b/sys/contrib/openzfs/scripts/zfs-tests.sh index 5a0a1a609448..09a15bafc27e 100755 --- a/sys/contrib/openzfs/scripts/zfs-tests.sh +++ b/sys/contrib/openzfs/scripts/zfs-tests.sh @@ -797,6 +797,10 @@ msg "${TEST_RUNNER}" \ 2>&1; echo $? >"$REPORT_FILE"; } | tee "$RESULTS_FILE" read -r RUNRESULT <"$REPORT_FILE" +if [[ "$RUNRESULT" -eq "255" ]] ; then + fail "$TEST_RUNNER failed, test aborted." +fi + # # Analyze the results. # diff --git a/sys/contrib/openzfs/tests/test-runner/bin/test-runner.py.in b/sys/contrib/openzfs/tests/test-runner/bin/test-runner.py.in index d2c1185e4a94..6688b6c4beb6 100755 --- a/sys/contrib/openzfs/tests/test-runner/bin/test-runner.py.in +++ b/sys/contrib/openzfs/tests/test-runner/bin/test-runner.py.in @@ -25,6 +25,7 @@ import sys import ctypes import re import configparser +import traceback from datetime import datetime from optparse import OptionParser @@ -1138,7 +1139,7 @@ def filter_tests(testrun, options): testrun.filter(failed) -def fail(retstr, ret=1): +def fail(retstr, ret=255): print('%s: %s' % (sys.argv[0], retstr)) exit(ret) @@ -1247,23 +1248,27 @@ def parse_args(): def main(): options = parse_args() - testrun = TestRun(options) + try: + testrun = TestRun(options) - if options.runfiles: - testrun.read(options) - else: - find_tests(testrun, options) + if options.runfiles: + testrun.read(options) + else: + find_tests(testrun, options) + + if options.logfile: + filter_tests(testrun, options) - if options.logfile: - filter_tests(testrun, options) + if options.template: + testrun.write(options) + exit(0) - if options.template: - testrun.write(options) - exit(0) + testrun.complete_outputdirs() + testrun.run(options) + exit(testrun.summary()) - testrun.complete_outputdirs() - testrun.run(options) - exit(testrun.summary()) + except Exception: + fail("Uncaught exception in test runner:\n" + traceback.format_exc()) if __name__ == '__main__': diff --git a/sys/contrib/vchiq/interface/vchiq_arm/vchiq_core.c b/sys/contrib/vchiq/interface/vchiq_arm/vchiq_core.c index 2e30dd7dc3de..e7459a5553e4 100644 --- a/sys/contrib/vchiq/interface/vchiq_arm/vchiq_core.c +++ b/sys/contrib/vchiq/interface/vchiq_arm/vchiq_core.c @@ -392,9 +392,9 @@ make_service_callback(VCHIQ_SERVICE_T *service, VCHIQ_REASON_T reason, VCHIQ_HEADER_T *header, void *bulk_userdata) { VCHIQ_STATUS_T status; - vchiq_log_trace(vchiq_core_log_level, "%d: callback:%d (%s, %x, %x)", + vchiq_log_trace(vchiq_core_log_level, "%d: callback:%d (%s, %p, %p)", service->state->id, service->localport, reason_names[reason], - (unsigned int)header, (unsigned int)bulk_userdata); + header, bulk_userdata); status = service->base.callback(reason, header, service->handle, bulk_userdata); if (status == VCHIQ_ERROR) { @@ -640,8 +640,8 @@ process_free_queue(VCHIQ_STATE_T *state) rmb(); - vchiq_log_trace(vchiq_core_log_level, "%d: pfq %d=%x %x %x", - state->id, slot_index, (unsigned int)data, + vchiq_log_trace(vchiq_core_log_level, "%d: pfq %d=%p %x %x", + state->id, slot_index, data, local->slot_queue_recycle, slot_queue_available); /* Initialise the bitmask for services which have used this @@ -675,13 +675,13 @@ process_free_queue(VCHIQ_STATE_T *state) vchiq_log_error(vchiq_core_log_level, "service %d " "message_use_count=%d " - "(header %x, msgid %x, " + "(header %p, msgid %x, " "header->msgid %x, " "header->size %x)", port, service_quota-> message_use_count, - (unsigned int)header, msgid, + header, msgid, header->msgid, header->size); WARN(1, "invalid message use count\n"); @@ -704,24 +704,24 @@ process_free_queue(VCHIQ_STATE_T *state) up(&service_quota->quota_event); vchiq_log_trace( vchiq_core_log_level, - "%d: pfq:%d %x@%x - " + "%d: pfq:%d %x@%p - " "slot_use->%d", state->id, port, header->size, - (unsigned int)header, + header, count - 1); } else { vchiq_log_error( vchiq_core_log_level, "service %d " "slot_use_count" - "=%d (header %x" + "=%d (header %p" ", msgid %x, " "header->msgid" " %x, header->" "size %x)", port, count, - (unsigned int)header, + header, msgid, header->msgid, header->size); @@ -735,9 +735,9 @@ process_free_queue(VCHIQ_STATE_T *state) pos += calc_stride(header->size); if (pos > VCHIQ_SLOT_SIZE) { vchiq_log_error(vchiq_core_log_level, - "pfq - pos %x: header %x, msgid %x, " + "pfq - pos %x: header %p, msgid %x, " "header->msgid %x, header->size %x", - pos, (unsigned int)header, msgid, + pos, header, msgid, header->msgid, header->size); WARN(1, "invalid slot position\n"); } @@ -885,17 +885,16 @@ queue_message(VCHIQ_STATE_T *state, VCHIQ_SERVICE_T *service, int slot_use_count; vchiq_log_info(vchiq_core_log_level, - "%d: qm %s@%x,%x (%d->%d)", + "%d: qm %s@%p,%x (%d->%d)", state->id, msg_type_str(VCHIQ_MSG_TYPE(msgid)), - (unsigned int)header, size, + header, size, VCHIQ_MSG_SRCPORT(msgid), VCHIQ_MSG_DSTPORT(msgid)); BUG_ON(!service); BUG_ON((flags & (QMFLAGS_NO_MUTEX_LOCK | QMFLAGS_NO_MUTEX_UNLOCK)) != 0); - for (i = 0, pos = 0; i < (unsigned int)count; pos += elements[i++].size) if (elements[i].size) { @@ -951,9 +950,9 @@ queue_message(VCHIQ_STATE_T *state, VCHIQ_SERVICE_T *service, VCHIQ_SERVICE_STATS_ADD(service, ctrl_tx_bytes, size); } else { vchiq_log_info(vchiq_core_log_level, - "%d: qm %s@%x,%x (%d->%d)", state->id, + "%d: qm %s@%p,%x (%d->%d)", state->id, msg_type_str(VCHIQ_MSG_TYPE(msgid)), - (unsigned int)header, size, + header, size, VCHIQ_MSG_SRCPORT(msgid), VCHIQ_MSG_DSTPORT(msgid)); if (size != 0) { @@ -1036,9 +1035,9 @@ queue_message_sync(VCHIQ_STATE_T *state, VCHIQ_SERVICE_T *service, int i, pos; vchiq_log_info(vchiq_sync_log_level, - "%d: qms %s@%x,%x (%d->%d)", state->id, + "%d: qms %s@%p,%x (%d->%d)", state->id, msg_type_str(VCHIQ_MSG_TYPE(msgid)), - (unsigned int)header, size, + header, size, VCHIQ_MSG_SRCPORT(msgid), VCHIQ_MSG_DSTPORT(msgid)); @@ -1065,9 +1064,9 @@ queue_message_sync(VCHIQ_STATE_T *state, VCHIQ_SERVICE_T *service, VCHIQ_SERVICE_STATS_ADD(service, ctrl_tx_bytes, size); } else { vchiq_log_info(vchiq_sync_log_level, - "%d: qms %s@%x,%x (%d->%d)", state->id, + "%d: qms %s@%p,%x (%d->%d)", state->id, msg_type_str(VCHIQ_MSG_TYPE(msgid)), - (unsigned int)header, size, + header, size, VCHIQ_MSG_SRCPORT(msgid), VCHIQ_MSG_DSTPORT(msgid)); if (size != 0) { @@ -1368,26 +1367,26 @@ resolve_bulks(VCHIQ_SERVICE_T *service, VCHIQ_BULK_QUEUE_T *queue) "Send Bulk to" : "Recv Bulk from"; if (bulk->actual != VCHIQ_BULK_ACTUAL_ABORTED) vchiq_log_info(SRVTRACE_LEVEL(service), - "%s %c%c%c%c d:%d len:%d %x<->%x", + "%s %c%c%c%c d:%d len:%d %p<->%p", header, VCHIQ_FOURCC_AS_4CHARS( service->base.fourcc), service->remoteport, bulk->size, - (unsigned int)bulk->data, - (unsigned int)bulk->remote_data); + bulk->data, + bulk->remote_data); else vchiq_log_info(SRVTRACE_LEVEL(service), "%s %c%c%c%c d:%d ABORTED - tx len:%d," - " rx len:%d %x<->%x", + " rx len:%d %p<->%p", header, VCHIQ_FOURCC_AS_4CHARS( service->base.fourcc), service->remoteport, bulk->size, bulk->remote_size, - (unsigned int)bulk->data, - (unsigned int)bulk->remote_data); + bulk->data, + bulk->remote_data); } vchiq_complete_bulk(bulk); @@ -1522,8 +1521,8 @@ parse_open(VCHIQ_STATE_T *state, VCHIQ_HEADER_T *header) fourcc = payload->fourcc; vchiq_log_info(vchiq_core_log_level, - "%d: prs OPEN@%x (%d->'%c%c%c%c')", - state->id, (unsigned int)header, + "%d: prs OPEN@%p (%d->'%c%c%c%c')", + state->id, header, localport, VCHIQ_FOURCC_AS_4CHARS(fourcc)); @@ -1661,7 +1660,7 @@ parse_rx_slots(VCHIQ_STATE_T *state) header = (VCHIQ_HEADER_T *)(state->rx_data + (state->rx_pos & VCHIQ_SLOT_MASK)); - DEBUG_VALUE(PARSE_HEADER, (int)header); + DEBUG_VALUE(PARSE_HEADER, (size_t)header); msgid = header->msgid; DEBUG_VALUE(PARSE_MSGID, msgid); size = header->size; @@ -1695,20 +1694,20 @@ parse_rx_slots(VCHIQ_STATE_T *state) remoteport); if (service) vchiq_log_warning(vchiq_core_log_level, - "%d: prs %s@%x (%d->%d) - " + "%d: prs %s@%p (%d->%d) - " "found connected service %d", state->id, msg_type_str(type), - (unsigned int)header, + header, remoteport, localport, service->localport); } if (!service) { vchiq_log_error(vchiq_core_log_level, - "%d: prs %s@%x (%d->%d) - " + "%d: prs %s@%p (%d->%d) - " /* XXX */ "invalid/closed service %d", state->id, msg_type_str(type), - (unsigned int)header, + header, remoteport, localport, localport); goto skip_message; } @@ -1734,12 +1733,12 @@ parse_rx_slots(VCHIQ_STATE_T *state) min(16, size)); } - if (((unsigned int)header & VCHIQ_SLOT_MASK) + calc_stride(size) + if (((size_t)header & VCHIQ_SLOT_MASK) + calc_stride(size) > VCHIQ_SLOT_SIZE) { vchiq_log_error(vchiq_core_log_level, - "header %x (msgid %x) - size %x too big for " + "header %p (msgid %x) - size %x too big for " "slot", - (unsigned int)header, (unsigned int)msgid, + header, (unsigned int)msgid, (unsigned int)size); WARN(1, "oversized for slot\n"); } @@ -1758,8 +1757,8 @@ parse_rx_slots(VCHIQ_STATE_T *state) service->peer_version = payload->version; } vchiq_log_info(vchiq_core_log_level, - "%d: prs OPENACK@%x,%x (%d->%d) v:%d", - state->id, (unsigned int)header, size, + "%d: prs OPENACK@%p,%x (%d->%d) v:%d", + state->id, header, size, remoteport, localport, service->peer_version); if (service->srvstate == VCHIQ_SRVSTATE_OPENING) { @@ -1776,8 +1775,8 @@ parse_rx_slots(VCHIQ_STATE_T *state) WARN_ON(size != 0); /* There should be no data */ vchiq_log_info(vchiq_core_log_level, - "%d: prs CLOSE@%x (%d->%d)", - state->id, (unsigned int)header, + "%d: prs CLOSE@%p (%d->%d)", + state->id, header, remoteport, localport); mark_service_closing_internal(service, 1); @@ -1794,8 +1793,8 @@ parse_rx_slots(VCHIQ_STATE_T *state) break; case VCHIQ_MSG_DATA: vchiq_log_info(vchiq_core_log_level, - "%d: prs DATA@%x,%x (%d->%d)", - state->id, (unsigned int)header, size, + "%d: prs DATA@%p,%x (%d->%d)", + state->id, header, size, remoteport, localport); if ((service->remoteport == remoteport) @@ -1819,8 +1818,8 @@ parse_rx_slots(VCHIQ_STATE_T *state) break; case VCHIQ_MSG_CONNECT: vchiq_log_info(vchiq_core_log_level, - "%d: prs CONNECT@%x", - state->id, (unsigned int)header); + "%d: prs CONNECT@%p", + state->id, header); state->version_common = ((VCHIQ_SLOT_ZERO_T *) state->slot_data)->version; up(&state->connect); @@ -1854,12 +1853,12 @@ parse_rx_slots(VCHIQ_STATE_T *state) wmb(); vchiq_log_info(vchiq_core_log_level, - "%d: prs %s@%x (%d->%d) %x@%x", + "%d: prs %s@%p (%d->%d) %x@%p", state->id, msg_type_str(type), - (unsigned int)header, + header, remoteport, localport, bulk->remote_size, - (unsigned int)bulk->remote_data); + bulk->remote_data); queue->remote_insert++; @@ -1912,10 +1911,10 @@ parse_rx_slots(VCHIQ_STATE_T *state) if ((int)(queue->remote_insert - queue->local_insert) >= 0) { vchiq_log_error(vchiq_core_log_level, - "%d: prs %s@%x (%d->%d) " + "%d: prs %s@%p (%d->%d) " "unexpected (ri=%d,li=%d)", state->id, msg_type_str(type), - (unsigned int)header, + header, remoteport, localport, queue->remote_insert, queue->local_insert); @@ -1932,11 +1931,11 @@ parse_rx_slots(VCHIQ_STATE_T *state) queue->remote_insert++; vchiq_log_info(vchiq_core_log_level, - "%d: prs %s@%x (%d->%d) %x@%x", + "%d: prs %s@%p (%d->%d) %x@%p", state->id, msg_type_str(type), - (unsigned int)header, + header, remoteport, localport, - bulk->actual, (unsigned int)bulk->data); + bulk->actual, bulk->data); vchiq_log_trace(vchiq_core_log_level, "%d: prs:%d %cx li=%x ri=%x p=%x", @@ -1958,14 +1957,14 @@ parse_rx_slots(VCHIQ_STATE_T *state) break; case VCHIQ_MSG_PADDING: vchiq_log_trace(vchiq_core_log_level, - "%d: prs PADDING@%x,%x", - state->id, (unsigned int)header, size); + "%d: prs PADDING@%p,%x", + state->id, header, size); break; case VCHIQ_MSG_PAUSE: /* If initiated, signal the application thread */ vchiq_log_trace(vchiq_core_log_level, - "%d: prs PAUSE@%x,%x", - state->id, (unsigned int)header, size); + "%d: prs PAUSE@%p,%x", + state->id, header, size); if (state->conn_state == VCHIQ_CONNSTATE_PAUSED) { vchiq_log_error(vchiq_core_log_level, "%d: PAUSE received in state PAUSED", @@ -1988,8 +1987,8 @@ parse_rx_slots(VCHIQ_STATE_T *state) break; case VCHIQ_MSG_RESUME: vchiq_log_trace(vchiq_core_log_level, - "%d: prs RESUME@%x,%x", - state->id, (unsigned int)header, size); + "%d: prs RESUME@%p,%x", + state->id, header, size); /* Release the slot mutex */ lmutex_unlock(&state->slot_mutex); if (state->is_master) @@ -2010,8 +2009,8 @@ parse_rx_slots(VCHIQ_STATE_T *state) default: vchiq_log_error(vchiq_core_log_level, - "%d: prs invalid msgid %x@%x,%x", - state->id, msgid, (unsigned int)header, size); + "%d: prs invalid msgid %x@%p,%x", + state->id, msgid, header, size); WARN(1, "invalid message\n"); break; } @@ -2179,10 +2178,10 @@ sync_func(void *v) if (!service) { vchiq_log_error(vchiq_sync_log_level, - "%d: sf %s@%x (%d->%d) - " + "%d: sf %s@%p (%d->%d) - " "invalid/closed service %d", state->id, msg_type_str(type), - (unsigned int)header, + header, remoteport, localport, localport); release_message_sync(state, header); continue; @@ -2213,8 +2212,8 @@ sync_func(void *v) service->peer_version = payload->version; } vchiq_log_info(vchiq_sync_log_level, - "%d: sf OPENACK@%x,%x (%d->%d) v:%d", - state->id, (unsigned int)header, size, + "%d: sf OPENACK@%p,%x (%d->%d) v:%d", + state->id, header, size, remoteport, localport, service->peer_version); if (service->srvstate == VCHIQ_SRVSTATE_OPENING) { service->remoteport = remoteport; @@ -2228,8 +2227,8 @@ sync_func(void *v) case VCHIQ_MSG_DATA: vchiq_log_trace(vchiq_sync_log_level, - "%d: sf DATA@%x,%x (%d->%d)", - state->id, (unsigned int)header, size, + "%d: sf DATA@%p,%x (%d->%d)", + state->id, header, size, remoteport, localport); if ((service->remoteport == remoteport) && @@ -2248,8 +2247,8 @@ sync_func(void *v) default: vchiq_log_error(vchiq_sync_log_level, - "%d: sf unexpected msgid %x@%x,%x", - state->id, msgid, (unsigned int)header, size); + "%d: sf unexpected msgid %x@%p,%x", + state->id, msgid, header, size); release_message_sync(state, header); break; } @@ -2334,8 +2333,8 @@ vchiq_init_state(VCHIQ_STATE_T *state, VCHIQ_SLOT_ZERO_T *slot_zero, if (slot_zero->magic != VCHIQ_MAGIC) { vchiq_loud_error_header(); vchiq_loud_error("Invalid VCHIQ magic value found."); - vchiq_loud_error("slot_zero=%x: magic=%x (expected %x)", - (unsigned int)slot_zero, slot_zero->magic, VCHIQ_MAGIC); + vchiq_loud_error("slot_zero=%p: magic=%x (expected %x)", + slot_zero, slot_zero->magic, VCHIQ_MAGIC); vchiq_loud_error_footer(); return VCHIQ_ERROR; } @@ -2348,9 +2347,9 @@ vchiq_init_state(VCHIQ_STATE_T *state, VCHIQ_SLOT_ZERO_T *slot_zero, if (slot_zero->version < VCHIQ_VERSION_MIN) { vchiq_loud_error_header(); vchiq_loud_error("Incompatible VCHIQ versions found."); - vchiq_loud_error("slot_zero=%x: VideoCore version=%d " + vchiq_loud_error("slot_zero=%p: VideoCore version=%d " "(minimum %d)", - (unsigned int)slot_zero, slot_zero->version, + slot_zero, slot_zero->version, VCHIQ_VERSION_MIN); vchiq_loud_error("Restart with a newer VideoCore image."); vchiq_loud_error_footer(); @@ -2360,9 +2359,9 @@ vchiq_init_state(VCHIQ_STATE_T *state, VCHIQ_SLOT_ZERO_T *slot_zero, if (VCHIQ_VERSION < slot_zero->version_min) { vchiq_loud_error_header(); vchiq_loud_error("Incompatible VCHIQ versions found."); - vchiq_loud_error("slot_zero=%x: version=%d (VideoCore " + vchiq_loud_error("slot_zero=%p: version=%d (VideoCore " "minimum %d)", - (unsigned int)slot_zero, VCHIQ_VERSION, + slot_zero, VCHIQ_VERSION, slot_zero->version_min); vchiq_loud_error("Restart with a newer kernel."); vchiq_loud_error_footer(); @@ -2375,25 +2374,25 @@ vchiq_init_state(VCHIQ_STATE_T *state, VCHIQ_SLOT_ZERO_T *slot_zero, (slot_zero->max_slots_per_side != VCHIQ_MAX_SLOTS_PER_SIDE)) { vchiq_loud_error_header(); if (slot_zero->slot_zero_size != sizeof(VCHIQ_SLOT_ZERO_T)) - vchiq_loud_error("slot_zero=%x: slot_zero_size=%x " + vchiq_loud_error("slot_zero=%p: slot_zero_size=%x " "(expected %zx)", - (unsigned int)slot_zero, + slot_zero, slot_zero->slot_zero_size, sizeof(VCHIQ_SLOT_ZERO_T)); if (slot_zero->slot_size != VCHIQ_SLOT_SIZE) - vchiq_loud_error("slot_zero=%x: slot_size=%d " + vchiq_loud_error("slot_zero=%p: slot_size=%d " "(expected %d", - (unsigned int)slot_zero, slot_zero->slot_size, + slot_zero, slot_zero->slot_size, VCHIQ_SLOT_SIZE); if (slot_zero->max_slots != VCHIQ_MAX_SLOTS) - vchiq_loud_error("slot_zero=%x: max_slots=%d " + vchiq_loud_error("slot_zero=%p: max_slots=%d " "(expected %d)", - (unsigned int)slot_zero, slot_zero->max_slots, + slot_zero, slot_zero->max_slots, VCHIQ_MAX_SLOTS); if (slot_zero->max_slots_per_side != VCHIQ_MAX_SLOTS_PER_SIDE) - vchiq_loud_error("slot_zero=%x: max_slots_per_side=%d " + vchiq_loud_error("slot_zero=%p: max_slots_per_side=%d " "(expected %d)", - (unsigned int)slot_zero, + slot_zero, slot_zero->max_slots_per_side, VCHIQ_MAX_SLOTS_PER_SIDE); vchiq_loud_error_footer(); @@ -2775,18 +2774,18 @@ release_service_messages(VCHIQ_SERVICE_T *service) if ((port == service->localport) && (msgid & VCHIQ_MSGID_CLAIMED)) { vchiq_log_info(vchiq_core_log_level, - " fsi - hdr %x", - (unsigned int)header); + " fsi - hdr %p", + header); release_slot(state, slot_info, header, NULL); } pos += calc_stride(header->size); if (pos > VCHIQ_SLOT_SIZE) { vchiq_log_error(vchiq_core_log_level, - "fsi - pos %x: header %x, " + "fsi - pos %x: header %p, " "msgid %x, header->msgid %x, " "header->size %x", - pos, (unsigned int)header, + pos, header, msgid, header->msgid, header->size); WARN(1, "invalid slot position\n"); @@ -3360,10 +3359,10 @@ vchiq_bulk_transfer(VCHIQ_SERVICE_HANDLE_T handle, wmb(); vchiq_log_info(vchiq_core_log_level, - "%d: bt (%d->%d) %cx %x@%x %x", + "%d: bt (%d->%d) %cx %x@%p %p", state->id, service->localport, service->remoteport, dir_char, - size, (unsigned int)bulk->data, (unsigned int)userdata); + size, bulk->data, userdata); /* The slot mutex must be held when the service is being closed, so claim it here to ensure that isn't happening */ @@ -3710,12 +3709,12 @@ vchiq_dump_state(void *dump_context, VCHIQ_STATE_T *state) vchiq_dump(dump_context, buf, len + 1); len = snprintf(buf, sizeof(buf), - " tx_pos=%x(@%x), rx_pos=%x(@%x)", + " tx_pos=%x(@%p), rx_pos=%x(@%p)", state->local->tx_pos, - (uint32_t)state->tx_data + + state->tx_data + (state->local_tx_pos & VCHIQ_SLOT_MASK), state->rx_pos, - (uint32_t)state->rx_data + + state->rx_data + (state->rx_pos & VCHIQ_SLOT_MASK)); vchiq_dump(dump_context, buf, len + 1); @@ -3817,21 +3816,21 @@ vchiq_dump_service_state(void *dump_context, VCHIQ_SERVICE_T *service) vchiq_dump(dump_context, buf, len + 1); len = snprintf(buf, sizeof(buf), - " Ctrl: tx_count=%d, tx_bytes=%llu, " - "rx_count=%d, rx_bytes=%llu", + " Ctrl: tx_count=%d, tx_bytes=%ju, " + "rx_count=%d, rx_bytes=%ju", service->stats.ctrl_tx_count, - service->stats.ctrl_tx_bytes, + (uintmax_t) service->stats.ctrl_tx_bytes, service->stats.ctrl_rx_count, - service->stats.ctrl_rx_bytes); + (uintmax_t) service->stats.ctrl_rx_bytes); vchiq_dump(dump_context, buf, len + 1); len = snprintf(buf, sizeof(buf), - " Bulk: tx_count=%d, tx_bytes=%llu, " - "rx_count=%d, rx_bytes=%llu", + " Bulk: tx_count=%d, tx_bytes=%ju, " + "rx_count=%d, rx_bytes=%ju", service->stats.bulk_tx_count, - service->stats.bulk_tx_bytes, + (uintmax_t) service->stats.bulk_tx_bytes, service->stats.bulk_rx_count, - service->stats.bulk_rx_bytes); + (uintmax_t) service->stats.bulk_rx_bytes); vchiq_dump(dump_context, buf, len + 1); len = snprintf(buf, sizeof(buf), diff --git a/sys/contrib/vchiq/interface/vchiq_arm/vchiq_kern_lib.c b/sys/contrib/vchiq/interface/vchiq_arm/vchiq_kern_lib.c index 1f849a09d854..4eddcf3b43b2 100644 --- a/sys/contrib/vchiq/interface/vchiq_arm/vchiq_kern_lib.c +++ b/sys/contrib/vchiq/interface/vchiq_arm/vchiq_kern_lib.c @@ -151,9 +151,9 @@ VCHIQ_STATUS_T vchiq_shutdown(VCHIQ_INSTANCE_T instance) list); list_del(pos); vchiq_log_info(vchiq_arm_log_level, - "bulk_waiter - cleaned up %x " + "bulk_waiter - cleaned up %p " "for pid %d", - (unsigned int)waiter, waiter->pid); + waiter, waiter->pid); _sema_destroy(&waiter->bulk_waiter.event); kfree(waiter); @@ -454,8 +454,8 @@ vchiq_blocking_bulk_transfer(VCHIQ_SERVICE_HANDLE_T handle, void *data, list_add(&waiter->list, &instance->bulk_waiter_list); lmutex_unlock(&instance->bulk_waiter_list_mutex); vchiq_log_info(vchiq_arm_log_level, - "saved bulk_waiter %x for pid %d", - (unsigned int)waiter, current->p_pid); + "saved bulk_waiter %p for pid %d", + waiter, current->p_pid); } return status; diff --git a/sys/kern/md4c.c b/sys/crypto/md4c.c index e173e17e3387..e173e17e3387 100644 --- a/sys/kern/md4c.c +++ b/sys/crypto/md4c.c diff --git a/sys/crypto/md5c.c b/sys/crypto/md5c.c new file mode 100644 index 000000000000..f9ffb602afdb --- /dev/null +++ b/sys/crypto/md5c.c @@ -0,0 +1,317 @@ +/*- + * Copyright (c) 2024, 2025 Robert Clausecker <fuz@FreeBSD.org> + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#include <sys/endian.h> +#include <sys/types.h> +#include <sys/md5.h> + +#ifdef _KERNEL +#include <sys/param.h> +#include <sys/stdint.h> +#include <sys/systm.h> +#define assert(expr) MPASS(expr) +#else +#include <assert.h> +#include <stdint.h> +#include <string.h> +#include <strings.h> +#endif /* defined(_KERNEL) */ + +#define md5block _libmd_md5block +#ifdef MD5_ASM +extern void md5block(MD5_CTX *, const void *, size_t); +#else +static void md5block(MD5_CTX *, const void *, size_t); +#endif + +/* don't unroll in bootloader */ +#ifdef STANDALONE_SMALL +#define UNROLL +#else +#define UNROLL _Pragma("unroll") +#endif + +void +MD5Init(MD5_CTX *ctx) +{ + ctx->state[0] = 0x67452301; + ctx->state[1] = 0xefcdab89; + ctx->state[2] = 0x98badcfe; + ctx->state[3] = 0x10325476; + + ctx->count[0] = 0; + ctx->count[1] = 0; +} + +void +MD5Update(MD5_CTX *ctx, const void *data, unsigned int len) +{ + uint64_t nn; + const char *p = data; + unsigned num; + + num = ctx->count[0] % MD5_BLOCK_LENGTH; + nn = (uint64_t)ctx->count[0] | (uint64_t)ctx->count[1] << 32; + nn += len; + ctx->count[0] = (uint32_t)nn; + ctx->count[1] = (uint32_t)(nn >> 32); + + if (num > 0) { + unsigned int n = MD5_BLOCK_LENGTH - num; + + if (n > len) + n = len; + + memcpy((char *)ctx->buffer + num, p, n); + num += n; + if (num == MD5_BLOCK_LENGTH) + md5block(ctx, (void *)ctx->buffer, MD5_BLOCK_LENGTH); + + p += n; + len -= n; + } + + if (len >= MD5_BLOCK_LENGTH) { + unsigned n = len & ~(unsigned)(MD5_BLOCK_LENGTH - 1); + + md5block(ctx, p, n); + p += n; + len -= n; + } + + if (len > 0) + memcpy((void *)ctx->buffer, p, len); +} + +static void +MD5Pad(MD5_CTX *ctx) +{ + uint64_t len; + unsigned t; + unsigned char tmp[MD5_BLOCK_LENGTH + sizeof(uint64_t)] = {0x80, 0}; + + len = (uint64_t)ctx->count[0] | (uint64_t)ctx->count[1] << 32; + t = 64 + 56 - ctx->count[0] % 64; + if (t > 64) + t -= 64; + + /* length in bits */ + len <<= 3; + le64enc(tmp + t, len); + MD5Update(ctx, tmp, t + 8); + assert(ctx->count[0] % MD5_BLOCK_LENGTH == 0); +} + +void +MD5Final(unsigned char md[16], MD5_CTX *ctx) +{ + MD5Pad(ctx); + + le32enc(md + 0, ctx->state[0]); + le32enc(md + 4, ctx->state[1]); + le32enc(md + 8, ctx->state[2]); + le32enc(md + 12, ctx->state[3]); + + explicit_bzero(ctx, sizeof(ctx)); +} + +#ifndef MD5_ASM +static const uint32_t K[64] = { + 0xd76aa478, 0xe8c7b756, 0x242070db, 0xc1bdceee, + 0xf57c0faf, 0x4787c62a, 0xa8304613, 0xfd469501, + 0x698098d8, 0x8b44f7af, 0xffff5bb1, 0x895cd7be, + 0x6b901122, 0xfd987193, 0xa679438e, 0x49b40821, + 0xf61e2562, 0xc040b340, 0x265e5a51, 0xe9b6c7aa, + 0xd62f105d, 0x02441453, 0xd8a1e681, 0xe7d3fbc8, + 0x21e1cde6, 0xc33707d6, 0xf4d50d87, 0x455a14ed, + 0xa9e3e905, 0xfcefa3f8, 0x676f02d9, 0x8d2a4c8a, + 0xfffa3942, 0x8771f681, 0x6d9d6122, 0xfde5380c, + 0xa4beea44, 0x4bdecfa9, 0xf6bb4b60, 0xbebfbc70, + 0x289b7ec6, 0xeaa127fa, 0xd4ef3085, 0x04881d05, + 0xd9d4d039, 0xe6db99e5, 0x1fa27cf8, 0xc4ac5665, + 0xf4292244, 0x432aff97, 0xab9423a7, 0xfc93a039, + 0x655b59c3, 0x8f0ccc92, 0xffeff47d, 0x85845dd1, + 0x6fa87e4f, 0xfe2ce6e0, 0xa3014314, 0x4e0811a1, + 0xf7537e82, 0xbd3af235, 0x2ad7d2bb, 0xeb86d391, +}; + +static inline uint32_t +rol32(uint32_t a, int b) +{ + return (a << b | a >> (32 - b)); +} + +static void +md5block(MD5_CTX *ctx, const void *data, size_t len) +{ + uint32_t m[16], a0, b0, c0, d0; + const char *p = data; + + a0 = ctx->state[0]; + b0 = ctx->state[1]; + c0 = ctx->state[2]; + d0 = ctx->state[3]; + + while (len >= MD5_BLOCK_LENGTH) { + size_t i; + uint32_t a = a0, b = b0, c = c0, d = d0, f, tmp; + + UNROLL + for (i = 0; i < 16; i++) + m[i] = le32dec(p + 4*i); + + UNROLL + for (i = 0; i < 16; i += 4) { + f = d ^ (b & (c ^ d)); + tmp = d; + d = c; + c = b; + b += rol32(a + f + K[i] + m[i], 7); + a = tmp; + + f = d ^ (b & (c ^ d)); + tmp = d; + d = c; + c = b; + b += rol32(a + f + K[i + 1] + m[i + 1], 12); + a = tmp; + + f = d ^ (b & (c ^ d)); + tmp = d; + d = c; + c = b; + b += rol32(a + f + K[i + 2] + m[i + 2], 17); + a = tmp; + + f = d ^ (b & (c ^ d)); + tmp = d; + d = c; + c = b; + b += rol32(a + f + K[i + 3] + m[i + 3], 22); + a = tmp; + } + + UNROLL + for (; i < 32; i += 4) { + f = c ^ (d & (b ^ c)); + tmp = d; + d = c; + c = b; + b += rol32(a + f + K[i] + m[(5*i + 1) % 16], 5); + a = tmp; + + f = c ^ (d & (b ^ c)); + tmp = d; + d = c; + c = b; + b += rol32(a + f + K[i + 1] + m[(5*i + 6) % 16], 9); + a = tmp; + + f = c ^ (d & (b ^ c)); + tmp = d; + d = c; + c = b; + b += rol32(a + f + K[i + 2] + m[(5*i + 11) % 16], 14); + a = tmp; + + f = c ^ (d & (b ^ c)); + tmp = d; + d = c; + c = b; + b += rol32(a + f + K[i + 3] + m[5*i % 16], 20); + a = tmp; + } + + UNROLL + for (; i < 48; i += 4) { + f = b ^ c ^ d; + tmp = d; + d = c; + c = b; + b += rol32(a + f + K[i] + m[(3*i + 5) % 16], 4); + a = tmp; + + f = b ^ c ^ d; + tmp = d; + d = c; + c = b; + b += rol32(a + f + K[i + 1] + m[(3*i + 8) % 16], 11); + a = tmp; + + f = b ^ c ^ d; + tmp = d; + d = c; + c = b; + b += rol32(a + f + K[i + 2] + m[(3*i + 11) % 16], 16); + a = tmp; + + f = b ^ c ^ d; + tmp = d; + d = c; + c = b; + b += rol32(a + f + K[i + 3] + m[(3*i + 14) % 16], 23); + a = tmp; + } + + UNROLL + for (; i < 64; i += 4) { + f = c ^ (b | ~d); + tmp = d; + d = c; + c = b; + b += rol32(a + f + K[i] + m[7*i % 16], 6); + a = tmp; + + f = c ^ (b | ~d); + tmp = d; + d = c; + c = b; + b += rol32(a + f + K[i + 1] + m[(7*i + 7) % 16], 10); + a = tmp; + + f = c ^ (b | ~d); + tmp = d; + d = c; + c = b; + b += rol32(a + f + K[i + 2] + m[(7*i + 14) % 16], 15); + a = tmp; + + f = c ^ (b | ~d); + tmp = d; + d = c; + c = b; + b += rol32(a + f + K[i + 3] + m[(7*i + 5) % 16], 21); + a = tmp; + } + + a0 += a; + b0 += b; + c0 += c; + d0 += d; + + p += MD5_BLOCK_LENGTH; + len -= MD5_BLOCK_LENGTH; + } + + ctx->state[0] = a0; + ctx->state[1] = b0; + ctx->state[2] = c0; + ctx->state[3] = d0; +} +#endif /* !defined(MD5_ASM) */ + +#ifdef WEAK_REFS +/* When building libmd, provide weak references. Note: this is not + activated in the context of compiling these sources for internal + use in libcrypt. + */ +#undef MD5Init +__weak_reference(_libmd_MD5Init, MD5Init); +#undef MD5Update +__weak_reference(_libmd_MD5Update, MD5Update); +#undef MD5Final +__weak_reference(_libmd_MD5Final, MD5Final); +#endif diff --git a/sys/dev/e1000/e1000_osdep.h b/sys/dev/e1000/e1000_osdep.h index 893979025f01..ba1c8a16fad1 100644 --- a/sys/dev/e1000/e1000_osdep.h +++ b/sys/dev/e1000/e1000_osdep.h @@ -152,6 +152,9 @@ struct e1000_osdep { bus_space_tag_t mem_bus_space_tag; bus_space_handle_t mem_bus_space_handle; +#ifdef INVARIANTS + bus_size_t mem_bus_space_size; +#endif bus_space_tag_t io_bus_space_tag; bus_space_handle_t io_bus_space_handle; bus_space_tag_t flash_bus_space_tag; @@ -175,27 +178,44 @@ struct e1000_osdep bus_space_write_4(((struct e1000_osdep *)(hw)->back)->mem_bus_space_tag, \ ((struct e1000_osdep *)(hw)->back)->mem_bus_space_handle, offset, value) +static __inline uint32_t +e1000_rd32(struct e1000_osdep *osdep, uint32_t reg) +{ + + KASSERT(reg < osdep->mem_bus_space_size, + ("e1000: register offset %#jx too large (max is %#jx)", + (uintmax_t)reg, (uintmax_t)osdep->mem_bus_space_size)); + + return (bus_space_read_4(osdep->mem_bus_space_tag, + osdep->mem_bus_space_handle, reg)); +} + + +static __inline void +e1000_wr32(struct e1000_osdep *osdep, uint32_t reg, uint32_t value) +{ + + KASSERT(reg < osdep->mem_bus_space_size, + ("e1000: register offset %#jx too large (max is %#jx)", + (uintmax_t)reg, (uintmax_t)osdep->mem_bus_space_size)); + + bus_space_write_4(osdep->mem_bus_space_tag, + osdep->mem_bus_space_handle, reg, value); +} + /* Register READ/WRITE macros */ -#define E1000_READ_REG(hw, reg) \ - bus_space_read_4(((struct e1000_osdep *)(hw)->back)->mem_bus_space_tag, \ - ((struct e1000_osdep *)(hw)->back)->mem_bus_space_handle, \ - E1000_REGISTER(hw, reg)) +#define E1000_READ_REG(hw, reg) \ + e1000_rd32((hw)->back, E1000_REGISTER(hw, reg)) #define E1000_WRITE_REG(hw, reg, value) \ - bus_space_write_4(((struct e1000_osdep *)(hw)->back)->mem_bus_space_tag, \ - ((struct e1000_osdep *)(hw)->back)->mem_bus_space_handle, \ - E1000_REGISTER(hw, reg), value) + e1000_wr32((hw)->back, E1000_REGISTER(hw, reg), value) #define E1000_READ_REG_ARRAY(hw, reg, index) \ - bus_space_read_4(((struct e1000_osdep *)(hw)->back)->mem_bus_space_tag, \ - ((struct e1000_osdep *)(hw)->back)->mem_bus_space_handle, \ - E1000_REGISTER(hw, reg) + ((index)<< 2)) + e1000_rd32((hw)->back, E1000_REGISTER(hw, reg) + ((index) << 2)) #define E1000_WRITE_REG_ARRAY(hw, reg, index, value) \ - bus_space_write_4(((struct e1000_osdep *)(hw)->back)->mem_bus_space_tag, \ - ((struct e1000_osdep *)(hw)->back)->mem_bus_space_handle, \ - E1000_REGISTER(hw, reg) + ((index)<< 2), value) + e1000_wr32((hw)->back, E1000_REGISTER(hw, reg) + ((index) << 2), value) #define E1000_READ_REG_ARRAY_DWORD E1000_READ_REG_ARRAY #define E1000_WRITE_REG_ARRAY_DWORD E1000_WRITE_REG_ARRAY diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c index 247cf9d7fed3..e3d839b828ed 100644 --- a/sys/dev/e1000/if_em.c +++ b/sys/dev/e1000/if_em.c @@ -1582,7 +1582,7 @@ em_if_init(if_ctx_t ctx) E1000_WRITE_REG(&sc->hw, E1000_VET, ETHERTYPE_VLAN); /* Clear bad data from Rx FIFOs */ - if (sc->hw.mac.type >= igb_mac_min) + if (sc->hw.mac.type >= igb_mac_min && !sc->vf_ifp) e1000_rx_fifo_flush_base(&sc->hw); /* Configure for OS presence */ @@ -1602,7 +1602,9 @@ em_if_init(if_ctx_t ctx) /* Don't lose promiscuous settings */ em_if_set_promisc(ctx, if_getflags(ifp)); - e1000_clear_hw_cntrs_base_generic(&sc->hw); + + if (sc->hw.mac.ops.clear_hw_cntrs != NULL) + sc->hw.mac.ops.clear_hw_cntrs(&sc->hw); /* MSI-X configuration for 82574 */ if (sc->hw.mac.type == e1000_82574) { @@ -2349,7 +2351,7 @@ em_if_stop(if_ctx_t ctx) em_flush_desc_rings(sc); e1000_reset_hw(&sc->hw); - if (sc->hw.mac.type >= e1000_82544) + if (sc->hw.mac.type >= e1000_82544 && !sc->vf_ifp) E1000_WRITE_REG(&sc->hw, E1000_WUFC, 0); e1000_led_off(&sc->hw); @@ -2408,6 +2410,9 @@ em_allocate_pci_resources(if_ctx_t ctx) } sc->osdep.mem_bus_space_tag = rman_get_bustag(sc->memory); sc->osdep.mem_bus_space_handle = rman_get_bushandle(sc->memory); +#ifdef INVARIANTS + sc->osdep.mem_bus_space_size = rman_get_size(sc->memory); +#endif sc->hw.hw_addr = (u8 *)&sc->osdep.mem_bus_space_handle; /* Only older adapters use IO mapping */ @@ -3259,11 +3264,13 @@ em_reset(if_ctx_t ctx) /* Issue a global reset */ e1000_reset_hw(hw); - if (hw->mac.type >= igb_mac_min) { - E1000_WRITE_REG(hw, E1000_WUC, 0); - } else { - E1000_WRITE_REG(hw, E1000_WUFC, 0); - em_disable_aspm(sc); + if (!sc->vf_ifp) { + if (hw->mac.type >= igb_mac_min) { + E1000_WRITE_REG(hw, E1000_WUC, 0); + } else { + E1000_WRITE_REG(hw, E1000_WUFC, 0); + em_disable_aspm(sc); + } } if (sc->flags & IGB_MEDIA_RESET) { e1000_setup_init_funcs(hw, true); @@ -3813,7 +3820,7 @@ em_initialize_receive_unit(if_ctx_t ctx) sc->rx_int_delay.value); } - if (hw->mac.type >= em_mac_min) { + if (hw->mac.type >= em_mac_min && !sc->vf_ifp) { uint32_t rfctl; /* Use extended rx descriptor formats */ rfctl = E1000_READ_REG(hw, E1000_RFCTL); @@ -3833,33 +3840,38 @@ em_initialize_receive_unit(if_ctx_t ctx) E1000_WRITE_REG(hw, E1000_RFCTL, rfctl); } - /* Set up L3 and L4 csum Rx descriptor offloads */ - rxcsum = E1000_READ_REG(hw, E1000_RXCSUM); - if (if_getcapenable(ifp) & IFCAP_RXCSUM) { - rxcsum |= E1000_RXCSUM_TUOFL | E1000_RXCSUM_IPOFL; - if (hw->mac.type > e1000_82575) - rxcsum |= E1000_RXCSUM_CRCOFL; - else if (hw->mac.type < em_mac_min && - if_getcapenable(ifp) & IFCAP_HWCSUM_IPV6) - rxcsum |= E1000_RXCSUM_IPV6OFL; - } else { - rxcsum &= ~(E1000_RXCSUM_IPOFL | E1000_RXCSUM_TUOFL); - if (hw->mac.type > e1000_82575) - rxcsum &= ~E1000_RXCSUM_CRCOFL; - else if (hw->mac.type < em_mac_min) - rxcsum &= ~E1000_RXCSUM_IPV6OFL; - } + /* + * Set up L3 and L4 csum Rx descriptor offloads only on Physical + * Functions. Virtual Functions have no access to this register. + */ + if (!sc->vf_ifp) { + rxcsum = E1000_READ_REG(hw, E1000_RXCSUM); + if (if_getcapenable(ifp) & IFCAP_RXCSUM) { + rxcsum |= E1000_RXCSUM_TUOFL | E1000_RXCSUM_IPOFL; + if (hw->mac.type > e1000_82575) + rxcsum |= E1000_RXCSUM_CRCOFL; + else if (hw->mac.type < em_mac_min && + if_getcapenable(ifp) & IFCAP_HWCSUM_IPV6) + rxcsum |= E1000_RXCSUM_IPV6OFL; + } else { + rxcsum &= ~(E1000_RXCSUM_IPOFL | E1000_RXCSUM_TUOFL); + if (hw->mac.type > e1000_82575) + rxcsum &= ~E1000_RXCSUM_CRCOFL; + else if (hw->mac.type < em_mac_min) + rxcsum &= ~E1000_RXCSUM_IPV6OFL; + } - if (sc->rx_num_queues > 1) { - /* RSS hash needed in the Rx descriptor */ - rxcsum |= E1000_RXCSUM_PCSD; + if (sc->rx_num_queues > 1) { + /* RSS hash needed in the Rx descriptor */ + rxcsum |= E1000_RXCSUM_PCSD; - if (hw->mac.type >= igb_mac_min) - igb_initialize_rss_mapping(sc); - else - em_initialize_rss_mapping(sc); + if (hw->mac.type >= igb_mac_min) + igb_initialize_rss_mapping(sc); + else + em_initialize_rss_mapping(sc); + } + E1000_WRITE_REG(hw, E1000_RXCSUM, rxcsum); } - E1000_WRITE_REG(hw, E1000_RXCSUM, rxcsum); for (i = 0, que = sc->rx_queues; i < sc->rx_num_queues; i++, que++) { struct rx_ring *rxr = &que->rxr; @@ -4367,6 +4379,8 @@ em_get_wakeup(if_ctx_t ctx) switch (sc->hw.mac.type) { case e1000_82542: case e1000_82543: + case e1000_vfadapt: + case e1000_vfadapt_i350: break; case e1000_82544: e1000_read_nvm(&sc->hw, @@ -4412,8 +4426,6 @@ em_get_wakeup(if_ctx_t ctx) case e1000_i354: case e1000_i210: case e1000_i211: - case e1000_vfadapt: - case e1000_vfadapt_i350: apme_mask = E1000_WUC_APME; sc->has_amt = true; eeprom_data = E1000_READ_REG(&sc->hw, E1000_WUC); @@ -4469,7 +4481,6 @@ em_get_wakeup(if_ctx_t ctx) global_quad_port_a = 0; break; } - return; } diff --git a/sys/dev/le/lance.c b/sys/dev/le/lance.c index f5e41e82bb42..df53242e80f4 100644 --- a/sys/dev/le/lance.c +++ b/sys/dev/le/lance.c @@ -193,7 +193,7 @@ lance_attach(struct lance_softc *sc) if_setcapabilitiesbit(ifp, IFCAP_VLAN_MTU, 0); if_setcapenablebit(ifp, IFCAP_VLAN_MTU, 0); - gone_in(15, "Warning! le(4) to be removed: no longer needed for " + gone_in(16, "Warning! le(4) to be removed: no longer needed for " "Qemu/MIPS\n"); } diff --git a/sys/fs/deadfs/dead_vnops.c b/sys/fs/deadfs/dead_vnops.c index 296cf058f8c9..137c86b65058 100644 --- a/sys/fs/deadfs/dead_vnops.c +++ b/sys/fs/deadfs/dead_vnops.c @@ -122,18 +122,18 @@ dead_read(struct vop_read_args *ap) { /* - * Return EOF for tty devices, EIO for others + * Return EOF for tty devices, ENXIO for others */ - if ((ap->a_vp->v_vflag & VV_ISTTY) == 0) - return (EIO); - return (0); + if (ap->a_vp->v_vflag & VV_ISTTY) + return (0); + return (ENXIO); } int dead_write(struct vop_write_args *ap) { - return (EIO); + return (ENXIO); } int diff --git a/sys/fs/devfs/devfs_int.h b/sys/fs/devfs/devfs_int.h index 916297425b53..9fa75c0e90ad 100644 --- a/sys/fs/devfs/devfs_int.h +++ b/sys/fs/devfs/devfs_int.h @@ -67,6 +67,7 @@ struct cdev_priv { void *cdp_dtr_cb_arg; LIST_HEAD(, cdev_privdata) cdp_fdpriv; + u_int cdp_fdpriv_dtrc; struct mtx cdp_threadlock; }; diff --git a/sys/fs/devfs/devfs_vnops.c b/sys/fs/devfs/devfs_vnops.c index caadf257b8ad..323f1e0fa961 100644 --- a/sys/fs/devfs/devfs_vnops.c +++ b/sys/fs/devfs/devfs_vnops.c @@ -200,14 +200,25 @@ devfs_foreach_cdevpriv(struct cdev *dev, int (*cb)(void *data, void *arg), void devfs_destroy_cdevpriv(struct cdev_privdata *p) { + struct file *fp; + struct cdev_priv *cdp; mtx_assert(&cdevpriv_mtx, MA_OWNED); - KASSERT(p->cdpd_fp->f_cdevpriv == p, - ("devfs_destoy_cdevpriv %p != %p", p->cdpd_fp->f_cdevpriv, p)); - p->cdpd_fp->f_cdevpriv = NULL; + fp = p->cdpd_fp; + KASSERT(fp->f_cdevpriv == p, + ("devfs_destoy_cdevpriv %p != %p", fp->f_cdevpriv, p)); + cdp = cdev2priv((struct cdev *)fp->f_data); + cdp->cdp_fdpriv_dtrc++; + fp->f_cdevpriv = NULL; LIST_REMOVE(p, cdpd_list); mtx_unlock(&cdevpriv_mtx); (p->cdpd_dtr)(p->cdpd_data); + mtx_lock(&cdevpriv_mtx); + MPASS(cdp->cdp_fdpriv_dtrc >= 1); + cdp->cdp_fdpriv_dtrc--; + if (cdp->cdp_fdpriv_dtrc == 0) + wakeup(&cdp->cdp_fdpriv_dtrc); + mtx_unlock(&cdevpriv_mtx); free(p, M_CDEVPDATA); } diff --git a/sys/fs/fuse/fuse_device.c b/sys/fs/fuse/fuse_device.c index 75bc0357571f..cee477865c42 100644 --- a/sys/fs/fuse/fuse_device.c +++ b/sys/fs/fuse/fuse_device.c @@ -550,6 +550,13 @@ fuse_device_write(struct cdev *dev, struct uio *uio, int ioflag) } else if (ohead.unique == 0){ /* unique == 0 means asynchronous notification */ SDT_PROBE1(fusefs, , device, fuse_device_write_notify, &ohead); + if (data->mp == NULL) { + SDT_PROBE2(fusefs, , device, trace, 1, + "asynchronous notification before mount" + " or after unmount"); + return (EXTERROR(ENODEV, + "This FUSE session is not mounted")); + } mp = data->mp; vfs_ref(mp); err = vfs_busy(mp, 0); diff --git a/sys/fs/msdosfs/msdosfs_vnops.c b/sys/fs/msdosfs/msdosfs_vnops.c index 33e0d94954d7..6dfac1b4ebd2 100644 --- a/sys/fs/msdosfs/msdosfs_vnops.c +++ b/sys/fs/msdosfs/msdosfs_vnops.c @@ -1944,6 +1944,9 @@ msdosfs_pathconf(struct vop_pathconf_args *ap) case _PC_HAS_HIDDENSYSTEM: *ap->a_retval = 1; return (0); + case _PC_CASE_INSENSITIVE: + *ap->a_retval = 1; + return (0); default: return (vop_stdpathconf(ap)); } diff --git a/sys/geom/zero/g_zero.c b/sys/geom/zero/g_zero.c index e9934ba6c784..7952147d660a 100644 --- a/sys/geom/zero/g_zero.c +++ b/sys/geom/zero/g_zero.c @@ -46,11 +46,11 @@ static SYSCTL_NODE(_kern_geom, OID_AUTO, zero, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, "GEOM_ZERO stuff"); static int g_zero_clear = 1; SYSCTL_PROC(_kern_geom_zero, OID_AUTO, clear, - CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, &g_zero_clear, 0, + CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, &g_zero_clear, 0, g_zero_clear_sysctl, "I", "Clear read data buffer"); static int g_zero_byte = 0; -SYSCTL_INT(_kern_geom_zero, OID_AUTO, byte, CTLFLAG_RW, &g_zero_byte, 0, +SYSCTL_INT(_kern_geom_zero, OID_AUTO, byte, CTLFLAG_RWTUN, &g_zero_byte, 0, "Byte (octet) value to clear the buffers with"); static struct g_provider *gpp; diff --git a/sys/isa/isa_common.c b/sys/isa/isa_common.c index 1a6df7bf6046..41a63a3c676c 100644 --- a/sys/isa/isa_common.c +++ b/sys/isa/isa_common.c @@ -570,7 +570,7 @@ isa_probe_children(device_t dev) strcmp(kern_ident, "GENERIC") == 0 && device_is_attached(child)) device_printf(child, - "non-PNP ISA device will be removed from GENERIC in FreeBSD 15.\n"); + "non-PNP ISA device will be removed from GENERIC in FreeBSD 16.\n"); } /* diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c index 87ffdb8dbf07..6612ac685936 100644 --- a/sys/kern/init_main.c +++ b/sys/kern/init_main.c @@ -384,7 +384,7 @@ C_SYSINIT(diagwarn2, SI_SUB_LAST, SI_ORDER_FIFTH, #if __SIZEOF_LONG__ == 4 static const char ilp32_warn[] = - "WARNING: 32-bit kernels are deprecated and may be removed in FreeBSD 15.0.\n"; + "WARNING: 32-bit kernels are deprecated and may be removed in FreeBSD 16.0.\n"; C_SYSINIT(ilp32warn, SI_SUB_COPYRIGHT, SI_ORDER_FIFTH, print_caddr_t, ilp32_warn); C_SYSINIT(ilp32warn2, SI_SUB_LAST, SI_ORDER_FIFTH, diff --git a/sys/kern/kern_conf.c b/sys/kern/kern_conf.c index b891ed84957a..2da51d84ff60 100644 --- a/sys/kern/kern_conf.c +++ b/sys/kern/kern_conf.c @@ -664,7 +664,7 @@ prep_cdevsw(struct cdevsw *devsw, int flags) if ((devsw->d_flags & D_GIANTOK) == 0) { printf( "WARNING: Device \"%s\" is Giant locked and may be " - "deleted before FreeBSD 15.0.\n", + "deleted before FreeBSD 16.0.\n", devsw->d_name == NULL ? "???" : devsw->d_name); } if (devsw->d_gianttrick == NULL) { @@ -1163,6 +1163,9 @@ destroy_devl(struct cdev *dev) devfs_destroy_cdevpriv(p); mtx_lock(&cdevpriv_mtx); } + while (cdp->cdp_fdpriv_dtrc != 0) { + msleep(&cdp->cdp_fdpriv_dtrc, &cdevpriv_mtx, 0, "cdfdpc", 0); + } mtx_unlock(&cdevpriv_mtx); dev_lock(); diff --git a/sys/kern/md5c.c b/sys/kern/md5c.c deleted file mode 100644 index 0922d0f8cc61..000000000000 --- a/sys/kern/md5c.c +++ /dev/null @@ -1,341 +0,0 @@ -/*- - * SPDX-License-Identifier: RSA-MD - * - * MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm - * - * Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All - * rights reserved. - * - * License to copy and use this software is granted provided that it - * is identified as the "RSA Data Security, Inc. MD5 Message-Digest - * Algorithm" in all material mentioning or referencing this software - * or this function. - * - * License is also granted to make and use derivative works provided - * that such works are identified as "derived from the RSA Data - * Security, Inc. MD5 Message-Digest Algorithm" in all material - * mentioning or referencing the derived work. - * - * RSA Data Security, Inc. makes no representations concerning either - * the merchantability of this software or the suitability of this - * software for any particular purpose. It is provided "as is" - * without express or implied warranty of any kind. - * - * These notices must be retained in any copies of any part of this - * documentation and/or software. - * - * This code is the same as the code published by RSA Inc. It has been - * edited for clarity and style only. - */ - -#include <sys/types.h> - -#ifdef _KERNEL -#include <sys/systm.h> -#else -#include <string.h> -#endif - -#include <machine/endian.h> -#include <sys/endian.h> -#include <sys/md5.h> - -static void MD5Transform(uint32_t [4], const unsigned char [64]); - -#if (BYTE_ORDER == LITTLE_ENDIAN) -#define Encode memcpy -#define Decode memcpy -#else - -/* - * Encodes input (uint32_t) into output (unsigned char). Assumes len is - * a multiple of 4. - */ - -static void -Encode (unsigned char *output, uint32_t *input, unsigned int len) -{ - unsigned int i; - uint32_t ip; - - for (i = 0; i < len / 4; i++) { - ip = input[i]; - *output++ = ip; - *output++ = ip >> 8; - *output++ = ip >> 16; - *output++ = ip >> 24; - } -} - -/* - * Decodes input (unsigned char) into output (uint32_t). Assumes len is - * a multiple of 4. - */ - -static void -Decode (uint32_t *output, const unsigned char *input, unsigned int len) -{ - unsigned int i; - - for (i = 0; i < len; i += 4) { - *output++ = input[i] | (input[i+1] << 8) | (input[i+2] << 16) | - (input[i+3] << 24); - } -} -#endif - -static unsigned char PADDING[64] = { - 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; - -/* F, G, H and I are basic MD5 functions. */ -#define F(x, y, z) (((x) & (y)) | ((~x) & (z))) -#define G(x, y, z) (((x) & (z)) | ((y) & (~z))) -#define H(x, y, z) ((x) ^ (y) ^ (z)) -#define I(x, y, z) ((y) ^ ((x) | (~z))) - -/* ROTATE_LEFT rotates x left n bits. */ -#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n)))) - -/* - * FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4. - * Rotation is separate from addition to prevent recomputation. - */ -#define FF(a, b, c, d, x, s, ac) { \ - (a) += F ((b), (c), (d)) + (x) + (uint32_t)(ac); \ - (a) = ROTATE_LEFT ((a), (s)); \ - (a) += (b); \ - } -#define GG(a, b, c, d, x, s, ac) { \ - (a) += G ((b), (c), (d)) + (x) + (uint32_t)(ac); \ - (a) = ROTATE_LEFT ((a), (s)); \ - (a) += (b); \ - } -#define HH(a, b, c, d, x, s, ac) { \ - (a) += H ((b), (c), (d)) + (x) + (uint32_t)(ac); \ - (a) = ROTATE_LEFT ((a), (s)); \ - (a) += (b); \ - } -#define II(a, b, c, d, x, s, ac) { \ - (a) += I ((b), (c), (d)) + (x) + (uint32_t)(ac); \ - (a) = ROTATE_LEFT ((a), (s)); \ - (a) += (b); \ - } - -/* MD5 initialization. Begins an MD5 operation, writing a new context. */ - -void -MD5Init(MD5_CTX *context) -{ - - context->count[0] = context->count[1] = 0; - - /* Load magic initialization constants. */ - context->state[0] = 0x67452301; - context->state[1] = 0xefcdab89; - context->state[2] = 0x98badcfe; - context->state[3] = 0x10325476; -} - -/* - * MD5 block update operation. Continues an MD5 message-digest - * operation, processing another message block, and updating the - * context. - */ - -void -MD5Update(MD5_CTX *context, const void *in, unsigned int inputLen) -{ - unsigned int i, index, partLen; - const unsigned char *input = in; - - /* Compute number of bytes mod 64 */ - index = (unsigned int)((context->count[0] >> 3) & 0x3F); - - /* Update number of bits */ - if ((context->count[0] += ((uint32_t)inputLen << 3)) - < ((uint32_t)inputLen << 3)) - context->count[1]++; - context->count[1] += ((uint32_t)inputLen >> 29); - - partLen = 64 - index; - - /* Transform as many times as possible. */ - if (inputLen >= partLen) { - memcpy((void *)&context->buffer[index], (const void *)input, - partLen); - MD5Transform (context->state, context->buffer); - - for (i = partLen; i + 63 < inputLen; i += 64) - MD5Transform (context->state, &input[i]); - - index = 0; - } - else - i = 0; - - /* Buffer remaining input */ - memcpy ((void *)&context->buffer[index], (const void *)&input[i], - inputLen-i); -} - -/* - * MD5 padding. Adds padding followed by original length. - */ - -static void -MD5Pad(MD5_CTX *context) -{ - unsigned char bits[8]; - unsigned int index, padLen; - - /* Save number of bits */ - Encode (bits, context->count, 8); - - /* Pad out to 56 mod 64. */ - index = (unsigned int)((context->count[0] >> 3) & 0x3f); - padLen = (index < 56) ? (56 - index) : (120 - index); - MD5Update (context, PADDING, padLen); - - /* Append length (before padding) */ - MD5Update (context, bits, 8); -} - -/* - * MD5 finalization. Ends an MD5 message-digest operation, writing the - * the message digest and zeroizing the context. - */ - -void -MD5Final(unsigned char digest[static MD5_DIGEST_LENGTH], MD5_CTX *context) -{ - /* Do padding. */ - MD5Pad (context); - - /* Store state in digest */ - Encode (digest, context->state, MD5_DIGEST_LENGTH); - - /* Zeroize sensitive information. */ - explicit_bzero (context, sizeof (*context)); -} - -/* MD5 basic transformation. Transforms state based on block. */ - -static void -MD5Transform(uint32_t state[4], const unsigned char block[64]) -{ - uint32_t a = state[0], b = state[1], c = state[2], d = state[3], x[16]; - - Decode (x, block, 64); - - /* Round 1 */ -#define S11 7 -#define S12 12 -#define S13 17 -#define S14 22 - FF (a, b, c, d, x[ 0], S11, 0xd76aa478); /* 1 */ - FF (d, a, b, c, x[ 1], S12, 0xe8c7b756); /* 2 */ - FF (c, d, a, b, x[ 2], S13, 0x242070db); /* 3 */ - FF (b, c, d, a, x[ 3], S14, 0xc1bdceee); /* 4 */ - FF (a, b, c, d, x[ 4], S11, 0xf57c0faf); /* 5 */ - FF (d, a, b, c, x[ 5], S12, 0x4787c62a); /* 6 */ - FF (c, d, a, b, x[ 6], S13, 0xa8304613); /* 7 */ - FF (b, c, d, a, x[ 7], S14, 0xfd469501); /* 8 */ - FF (a, b, c, d, x[ 8], S11, 0x698098d8); /* 9 */ - FF (d, a, b, c, x[ 9], S12, 0x8b44f7af); /* 10 */ - FF (c, d, a, b, x[10], S13, 0xffff5bb1); /* 11 */ - FF (b, c, d, a, x[11], S14, 0x895cd7be); /* 12 */ - FF (a, b, c, d, x[12], S11, 0x6b901122); /* 13 */ - FF (d, a, b, c, x[13], S12, 0xfd987193); /* 14 */ - FF (c, d, a, b, x[14], S13, 0xa679438e); /* 15 */ - FF (b, c, d, a, x[15], S14, 0x49b40821); /* 16 */ - - /* Round 2 */ -#define S21 5 -#define S22 9 -#define S23 14 -#define S24 20 - GG (a, b, c, d, x[ 1], S21, 0xf61e2562); /* 17 */ - GG (d, a, b, c, x[ 6], S22, 0xc040b340); /* 18 */ - GG (c, d, a, b, x[11], S23, 0x265e5a51); /* 19 */ - GG (b, c, d, a, x[ 0], S24, 0xe9b6c7aa); /* 20 */ - GG (a, b, c, d, x[ 5], S21, 0xd62f105d); /* 21 */ - GG (d, a, b, c, x[10], S22, 0x2441453); /* 22 */ - GG (c, d, a, b, x[15], S23, 0xd8a1e681); /* 23 */ - GG (b, c, d, a, x[ 4], S24, 0xe7d3fbc8); /* 24 */ - GG (a, b, c, d, x[ 9], S21, 0x21e1cde6); /* 25 */ - GG (d, a, b, c, x[14], S22, 0xc33707d6); /* 26 */ - GG (c, d, a, b, x[ 3], S23, 0xf4d50d87); /* 27 */ - GG (b, c, d, a, x[ 8], S24, 0x455a14ed); /* 28 */ - GG (a, b, c, d, x[13], S21, 0xa9e3e905); /* 29 */ - GG (d, a, b, c, x[ 2], S22, 0xfcefa3f8); /* 30 */ - GG (c, d, a, b, x[ 7], S23, 0x676f02d9); /* 31 */ - GG (b, c, d, a, x[12], S24, 0x8d2a4c8a); /* 32 */ - - /* Round 3 */ -#define S31 4 -#define S32 11 -#define S33 16 -#define S34 23 - HH (a, b, c, d, x[ 5], S31, 0xfffa3942); /* 33 */ - HH (d, a, b, c, x[ 8], S32, 0x8771f681); /* 34 */ - HH (c, d, a, b, x[11], S33, 0x6d9d6122); /* 35 */ - HH (b, c, d, a, x[14], S34, 0xfde5380c); /* 36 */ - HH (a, b, c, d, x[ 1], S31, 0xa4beea44); /* 37 */ - HH (d, a, b, c, x[ 4], S32, 0x4bdecfa9); /* 38 */ - HH (c, d, a, b, x[ 7], S33, 0xf6bb4b60); /* 39 */ - HH (b, c, d, a, x[10], S34, 0xbebfbc70); /* 40 */ - HH (a, b, c, d, x[13], S31, 0x289b7ec6); /* 41 */ - HH (d, a, b, c, x[ 0], S32, 0xeaa127fa); /* 42 */ - HH (c, d, a, b, x[ 3], S33, 0xd4ef3085); /* 43 */ - HH (b, c, d, a, x[ 6], S34, 0x4881d05); /* 44 */ - HH (a, b, c, d, x[ 9], S31, 0xd9d4d039); /* 45 */ - HH (d, a, b, c, x[12], S32, 0xe6db99e5); /* 46 */ - HH (c, d, a, b, x[15], S33, 0x1fa27cf8); /* 47 */ - HH (b, c, d, a, x[ 2], S34, 0xc4ac5665); /* 48 */ - - /* Round 4 */ -#define S41 6 -#define S42 10 -#define S43 15 -#define S44 21 - II (a, b, c, d, x[ 0], S41, 0xf4292244); /* 49 */ - II (d, a, b, c, x[ 7], S42, 0x432aff97); /* 50 */ - II (c, d, a, b, x[14], S43, 0xab9423a7); /* 51 */ - II (b, c, d, a, x[ 5], S44, 0xfc93a039); /* 52 */ - II (a, b, c, d, x[12], S41, 0x655b59c3); /* 53 */ - II (d, a, b, c, x[ 3], S42, 0x8f0ccc92); /* 54 */ - II (c, d, a, b, x[10], S43, 0xffeff47d); /* 55 */ - II (b, c, d, a, x[ 1], S44, 0x85845dd1); /* 56 */ - II (a, b, c, d, x[ 8], S41, 0x6fa87e4f); /* 57 */ - II (d, a, b, c, x[15], S42, 0xfe2ce6e0); /* 58 */ - II (c, d, a, b, x[ 6], S43, 0xa3014314); /* 59 */ - II (b, c, d, a, x[13], S44, 0x4e0811a1); /* 60 */ - II (a, b, c, d, x[ 4], S41, 0xf7537e82); /* 61 */ - II (d, a, b, c, x[11], S42, 0xbd3af235); /* 62 */ - II (c, d, a, b, x[ 2], S43, 0x2ad7d2bb); /* 63 */ - II (b, c, d, a, x[ 9], S44, 0xeb86d391); /* 64 */ - - state[0] += a; - state[1] += b; - state[2] += c; - state[3] += d; - - /* Zeroize sensitive information. */ - memset ((void *)x, 0, sizeof (x)); -} - -#ifdef WEAK_REFS -/* When building libmd, provide weak references. Note: this is not - activated in the context of compiling these sources for internal - use in libcrypt. - */ -#undef MD5Init -__weak_reference(_libmd_MD5Init, MD5Init); -#undef MD5Update -__weak_reference(_libmd_MD5Update, MD5Update); -#undef MD5Final -__weak_reference(_libmd_MD5Final, MD5Final); -#endif diff --git a/sys/kern/vfs_default.c b/sys/kern/vfs_default.c index 05d1120030f3..4eca09aef145 100644 --- a/sys/kern/vfs_default.c +++ b/sys/kern/vfs_default.c @@ -458,6 +458,7 @@ vop_stdpathconf(struct vop_pathconf_args *ap) case _PC_HAS_NAMEDATTR: case _PC_HAS_HIDDENSYSTEM: case _PC_CLONE_BLKSIZE: + case _PC_CASE_INSENSITIVE: *ap->a_retval = 0; return (0); default: diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 9e1275359715..1a739d354f1f 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -1119,7 +1119,7 @@ flags_to_rights(int flags, cap_rights_t *rightsp) if (flags & O_TRUNC) cap_rights_set_one(rightsp, CAP_FTRUNCATE); - if (flags & (O_SYNC | O_FSYNC)) + if (flags & (O_SYNC | O_FSYNC | O_DSYNC)) cap_rights_set_one(rightsp, CAP_FSYNC); if (flags & (O_EXLOCK | O_SHLOCK)) diff --git a/sys/modules/smbfs/Makefile b/sys/modules/smbfs/Makefile index c796fb0701c5..5ef13757e621 100644 --- a/sys/modules/smbfs/Makefile +++ b/sys/modules/smbfs/Makefile @@ -1,6 +1,6 @@ -.PATH: ${SRCTOP}/sys/crypto/des \ +.PATH: ${SRCTOP}/sys/crypto \ + ${SRCTOP}/sys/crypto/des \ ${SRCTOP}/sys/crypto/des/arch/${MACHINE_CPUARCH} \ - ${SRCTOP}/sys/kern \ ${SRCTOP}/sys/libkern \ ${SRCTOP}/sys/netsmb \ ${SRCTOP}/sys/fs/smbfs diff --git a/sys/modules/thunderbolt/Makefile b/sys/modules/thunderbolt/Makefile index 3b279f4352d4..ba7c7cab6e6b 100644 --- a/sys/modules/thunderbolt/Makefile +++ b/sys/modules/thunderbolt/Makefile @@ -5,7 +5,7 @@ SRCS= nhi_pci.c nhi.c tb_pcib.c tb_acpi_pcib.c tb_debug.c nhi_wmi.c SRCS+= router.c hcm.c tb_dev.c SRCS+= opt_thunderbolt.h SRCS+= device_if.h bus_if.h pci_if.h pcib_if.h tb_if.c tb_if.h -SRCS+= opt_acpi.h opt_acpi_wmi.h acpi_if.h acpi_wmi_if.h +SRCS+= opt_acpi.h acpi_if.h acpi_wmi_if.h opt_thunderbolt.h: echo "#define THUNDERBOLT_DEBUG 1" > ${.TARGET} diff --git a/sys/modules/zfs/zfs_config.h b/sys/modules/zfs/zfs_config.h index 3a17ed289235..39b9229653af 100644 --- a/sys/modules/zfs/zfs_config.h +++ b/sys/modules/zfs/zfs_config.h @@ -204,6 +204,10 @@ /* BLK_STS_RESV_CONFLICT is defined */ /* #undef HAVE_BLK_STS_RESV_CONFLICT */ +/* Define if getgeo() in block_device_operations takes struct gendisk * as its + first arg */ +/* #undef HAVE_BLOCK_DEVICE_OPERATIONS_GETGEO_GENDISK */ + /* Define if release() in block_device_operations takes 1 arg */ /* #undef HAVE_BLOCK_DEVICE_OPERATIONS_RELEASE_1ARG */ @@ -339,6 +343,9 @@ /* Define if compiler supports -Winfinite-recursion */ /* #undef HAVE_INFINITE_RECURSION */ +/* inode_generic_drop() exists */ +/* #undef HAVE_INODE_GENERIC_DROP */ + /* inode_get_atime() exists in linux/fs.h */ /* #undef HAVE_INODE_GET_ATIME */ @@ -510,6 +517,9 @@ /* Define if host toolchain supports MOVBE */ #define HAVE_MOVBE 1 +/* Define if ns_type is accessible through ns_common */ +/* #undef HAVE_NS_COMMON_TYPE */ + /* folio_wait_bit() exists */ /* #undef HAVE_PAGEMAP_FOLIO_WAIT_BIT */ @@ -759,6 +769,9 @@ /* int (*writepage_t)() takes struct folio* */ /* #undef HAVE_WRITEPAGE_T_FOLIO */ +/* write_cache_pages() is available */ +/* #undef HAVE_WRITE_CACHE_PAGES */ + /* xattr_handler->get() wants dentry and inode and flags */ /* #undef HAVE_XATTR_GET_DENTRY_INODE_FLAGS */ @@ -843,7 +856,7 @@ /* #undef ZFS_DEVICE_MINOR */ /* Define the project alias string. */ -#define ZFS_META_ALIAS "zfs-2.4.99-113-FreeBSD_g6ae99d269" +#define ZFS_META_ALIAS "zfs-2.4.99-129-FreeBSD_g0455150f1" /* Define the project author. */ #define ZFS_META_AUTHOR "OpenZFS" @@ -873,7 +886,7 @@ #define ZFS_META_NAME "zfs" /* Define the project release. */ -#define ZFS_META_RELEASE "113-FreeBSD_g6ae99d269" +#define ZFS_META_RELEASE "129-FreeBSD_g0455150f1" /* Define the project version. */ #define ZFS_META_VERSION "2.4.99" diff --git a/sys/modules/zfs/zfs_gitrev.h b/sys/modules/zfs/zfs_gitrev.h index 6f568754f61d..87d2071cb0d2 100644 --- a/sys/modules/zfs/zfs_gitrev.h +++ b/sys/modules/zfs/zfs_gitrev.h @@ -1 +1 @@ -#define ZFS_META_GITREV "zfs-2.4.99-113-g6ae99d269" +#define ZFS_META_GITREV "zfs-2.4.99-129-g0455150f1" diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c index 50077abdfd86..9ed26d5a617b 100644 --- a/sys/netinet/tcp_stacks/rack.c +++ b/sys/netinet/tcp_stacks/rack.c @@ -204,10 +204,6 @@ static int32_t rack_dnd_default = 0; /* For rr_conf = 3, what is the default fo static int32_t rack_rxt_controls = 0; static int32_t rack_fill_cw_state = 0; static uint8_t rack_req_measurements = 1; -/* Attack threshold detections */ -static uint32_t rack_highest_sack_thresh_seen = 0; -static uint32_t rack_highest_move_thresh_seen = 0; -static uint32_t rack_merge_out_sacks_on_attack = 0; static int32_t rack_enable_hw_pacing = 0; /* Due to CCSP keep it off by default */ static int32_t rack_hw_rate_caps = 0; /* 1; */ static int32_t rack_hw_rate_cap_per = 0; /* 0 -- off */ @@ -223,7 +219,6 @@ static int32_t rack_default_pacing_divisor = 250; static uint16_t rack_pacing_min_seg = 0; static int32_t rack_timely_off = 0; -static uint32_t sad_seg_size_per = 800; /* 80.0 % */ static int32_t rack_pkt_delay = 1000; static int32_t rack_send_a_lot_in_prr = 1; static int32_t rack_min_to = 1000; /* Number of microsecond min timeout */ @@ -399,18 +394,6 @@ counter_u64_t rack_extended_rfo; counter_u64_t rack_sack_proc_all; counter_u64_t rack_sack_proc_short; counter_u64_t rack_sack_proc_restart; -counter_u64_t rack_sack_attacks_detected; -counter_u64_t rack_sack_attacks_reversed; -counter_u64_t rack_sack_attacks_suspect; -counter_u64_t rack_sack_used_next_merge; -counter_u64_t rack_sack_splits; -counter_u64_t rack_sack_used_prev_merge; -counter_u64_t rack_sack_skipped_acked; -counter_u64_t rack_ack_total; -counter_u64_t rack_express_sack; -counter_u64_t rack_sack_total; -counter_u64_t rack_move_none; -counter_u64_t rack_move_some; counter_u64_t rack_input_idle_reduces; counter_u64_t rack_collapsed_win; @@ -834,18 +817,6 @@ sysctl_rack_clear(SYSCTL_HANDLER_ARGS) counter_u64_zero(rack_rxt_clamps_cwnd_uniq); counter_u64_zero(rack_multi_single_eq); counter_u64_zero(rack_proc_non_comp_ack); - counter_u64_zero(rack_sack_attacks_detected); - counter_u64_zero(rack_sack_attacks_reversed); - counter_u64_zero(rack_sack_attacks_suspect); - counter_u64_zero(rack_sack_used_next_merge); - counter_u64_zero(rack_sack_used_prev_merge); - counter_u64_zero(rack_sack_splits); - counter_u64_zero(rack_sack_skipped_acked); - counter_u64_zero(rack_ack_total); - counter_u64_zero(rack_express_sack); - counter_u64_zero(rack_sack_total); - counter_u64_zero(rack_move_none); - counter_u64_zero(rack_move_some); counter_u64_zero(rack_try_scwnd); counter_u64_zero(rack_collapsed_win); counter_u64_zero(rack_collapsed_win_rxt); @@ -872,7 +843,6 @@ static void rack_init_sysctls(void) { struct sysctl_oid *rack_counters; - struct sysctl_oid *rack_attack; struct sysctl_oid *rack_pacing; struct sysctl_oid *rack_timely; struct sysctl_oid *rack_timers; @@ -883,12 +853,6 @@ rack_init_sysctls(void) struct sysctl_oid *rack_probertt; struct sysctl_oid *rack_hw_pacing; - rack_attack = SYSCTL_ADD_NODE(&rack_sysctl_ctx, - SYSCTL_CHILDREN(rack_sysctl_root), - OID_AUTO, - "sack_attack", - CTLFLAG_RW | CTLFLAG_MPSAFE, 0, - "Rack Sack Attack Counters and Controls"); rack_counters = SYSCTL_ADD_NODE(&rack_sysctl_ctx, SYSCTL_CHILDREN(rack_sysctl_root), OID_AUTO, @@ -1535,11 +1499,6 @@ rack_init_sysctls(void) "Do not disturb default for rack_rrr = 3"); SYSCTL_ADD_S32(&rack_sysctl_ctx, SYSCTL_CHILDREN(rack_misc), - OID_AUTO, "sad_seg_per", CTLFLAG_RW, - &sad_seg_size_per, 800, - "Percentage of segment size needed in a sack 800 = 80.0?"); - SYSCTL_ADD_S32(&rack_sysctl_ctx, - SYSCTL_CHILDREN(rack_misc), OID_AUTO, "rxt_controls", CTLFLAG_RW, &rack_rxt_controls, 0, "Retransmit sending size controls (valid values 0, 1, 2 default=1)?"); @@ -1619,85 +1578,6 @@ rack_init_sysctls(void) &rack_autosndbuf_inc, 20, "What percentage should rack scale up its snd buffer by?"); - - /* Sack Attacker detection stuff */ - SYSCTL_ADD_U32(&rack_sysctl_ctx, - SYSCTL_CHILDREN(rack_attack), - OID_AUTO, "merge_out", CTLFLAG_RW, - &rack_merge_out_sacks_on_attack, 0, - "Do we merge the sendmap when we decide we are being attacked?"); - - SYSCTL_ADD_U32(&rack_sysctl_ctx, - SYSCTL_CHILDREN(rack_attack), - OID_AUTO, "detect_highsackratio", CTLFLAG_RW, - &rack_highest_sack_thresh_seen, 0, - "Highest sack to ack ratio seen"); - SYSCTL_ADD_U32(&rack_sysctl_ctx, - SYSCTL_CHILDREN(rack_attack), - OID_AUTO, "detect_highmoveratio", CTLFLAG_RW, - &rack_highest_move_thresh_seen, 0, - "Highest move to non-move ratio seen"); - rack_ack_total = counter_u64_alloc(M_WAITOK); - SYSCTL_ADD_COUNTER_U64(&rack_sysctl_ctx, - SYSCTL_CHILDREN(rack_attack), - OID_AUTO, "acktotal", CTLFLAG_RD, - &rack_ack_total, - "Total number of Ack's"); - rack_express_sack = counter_u64_alloc(M_WAITOK); - SYSCTL_ADD_COUNTER_U64(&rack_sysctl_ctx, - SYSCTL_CHILDREN(rack_attack), - OID_AUTO, "exp_sacktotal", CTLFLAG_RD, - &rack_express_sack, - "Total expresss number of Sack's"); - rack_sack_total = counter_u64_alloc(M_WAITOK); - SYSCTL_ADD_COUNTER_U64(&rack_sysctl_ctx, - SYSCTL_CHILDREN(rack_attack), - OID_AUTO, "sacktotal", CTLFLAG_RD, - &rack_sack_total, - "Total number of SACKs"); - rack_move_none = counter_u64_alloc(M_WAITOK); - SYSCTL_ADD_COUNTER_U64(&rack_sysctl_ctx, - SYSCTL_CHILDREN(rack_attack), - OID_AUTO, "move_none", CTLFLAG_RD, - &rack_move_none, - "Total number of SACK index reuse of positions under threshold"); - rack_move_some = counter_u64_alloc(M_WAITOK); - SYSCTL_ADD_COUNTER_U64(&rack_sysctl_ctx, - SYSCTL_CHILDREN(rack_attack), - OID_AUTO, "move_some", CTLFLAG_RD, - &rack_move_some, - "Total number of SACK index reuse of positions over threshold"); - rack_sack_attacks_detected = counter_u64_alloc(M_WAITOK); - SYSCTL_ADD_COUNTER_U64(&rack_sysctl_ctx, - SYSCTL_CHILDREN(rack_attack), - OID_AUTO, "attacks", CTLFLAG_RD, - &rack_sack_attacks_detected, - "Total number of SACK attackers that had sack disabled"); - rack_sack_attacks_reversed = counter_u64_alloc(M_WAITOK); - SYSCTL_ADD_COUNTER_U64(&rack_sysctl_ctx, - SYSCTL_CHILDREN(rack_attack), - OID_AUTO, "reversed", CTLFLAG_RD, - &rack_sack_attacks_reversed, - "Total number of SACK attackers that were later determined false positive"); - rack_sack_attacks_suspect = counter_u64_alloc(M_WAITOK); - SYSCTL_ADD_COUNTER_U64(&rack_sysctl_ctx, - SYSCTL_CHILDREN(rack_attack), - OID_AUTO, "suspect", CTLFLAG_RD, - &rack_sack_attacks_suspect, - "Total number of SACKs that triggered early detection"); - - rack_sack_used_next_merge = counter_u64_alloc(M_WAITOK); - SYSCTL_ADD_COUNTER_U64(&rack_sysctl_ctx, - SYSCTL_CHILDREN(rack_attack), - OID_AUTO, "nextmerge", CTLFLAG_RD, - &rack_sack_used_next_merge, - "Total number of times we used the next merge"); - rack_sack_used_prev_merge = counter_u64_alloc(M_WAITOK); - SYSCTL_ADD_COUNTER_U64(&rack_sysctl_ctx, - SYSCTL_CHILDREN(rack_attack), - OID_AUTO, "prevmerge", CTLFLAG_RD, - &rack_sack_used_prev_merge, - "Total number of times we used the prev merge"); /* Counters */ rack_total_bytes = counter_u64_alloc(M_WAITOK); SYSCTL_ADD_COUNTER_U64(&rack_sysctl_ctx, @@ -1908,18 +1788,6 @@ rack_init_sysctls(void) OID_AUTO, "sack_short", CTLFLAG_RD, &rack_sack_proc_short, "Total times we took shortcut for sack processing"); - rack_sack_skipped_acked = counter_u64_alloc(M_WAITOK); - SYSCTL_ADD_COUNTER_U64(&rack_sysctl_ctx, - SYSCTL_CHILDREN(rack_attack), - OID_AUTO, "skipacked", CTLFLAG_RD, - &rack_sack_skipped_acked, - "Total number of times we skipped previously sacked"); - rack_sack_splits = counter_u64_alloc(M_WAITOK); - SYSCTL_ADD_COUNTER_U64(&rack_sysctl_ctx, - SYSCTL_CHILDREN(rack_attack), - OID_AUTO, "ofsplit", CTLFLAG_RD, - &rack_sack_splits, - "Total number of times we did the old fashion tree split"); rack_input_idle_reduces = counter_u64_alloc(M_WAITOK); SYSCTL_ADD_COUNTER_U64(&rack_sysctl_ctx, SYSCTL_CHILDREN(rack_counters), @@ -3319,16 +3187,6 @@ rack_counter_destroy(void) counter_u64_free(rack_hw_pace_lost); counter_u64_free(rack_non_fto_send); counter_u64_free(rack_extended_rfo); - counter_u64_free(rack_ack_total); - counter_u64_free(rack_express_sack); - counter_u64_free(rack_sack_total); - counter_u64_free(rack_move_none); - counter_u64_free(rack_move_some); - counter_u64_free(rack_sack_attacks_detected); - counter_u64_free(rack_sack_attacks_reversed); - counter_u64_free(rack_sack_attacks_suspect); - counter_u64_free(rack_sack_used_next_merge); - counter_u64_free(rack_sack_used_prev_merge); counter_u64_free(rack_tlp_tot); counter_u64_free(rack_tlp_newdata); counter_u64_free(rack_tlp_retran); @@ -3351,8 +3209,6 @@ rack_counter_destroy(void) counter_u64_free(rack_sack_proc_all); counter_u64_free(rack_sack_proc_restart); counter_u64_free(rack_sack_proc_short); - counter_u64_free(rack_sack_skipped_acked); - counter_u64_free(rack_sack_splits); counter_u64_free(rack_input_idle_reduces); counter_u64_free(rack_collapsed_win); counter_u64_free(rack_collapsed_win_rxt); @@ -9542,7 +9398,6 @@ do_rest_ofb: goto out; } rack_log_map_chg(tp, rack, &stack_map, rsm, next, MAP_SACK_M1, end, __LINE__); - counter_u64_add(rack_sack_used_next_merge, 1); /* Postion for the next block */ start = next->r_end; rsm = tqhash_next(rack->r_ctl.tqh, next); @@ -9574,7 +9429,6 @@ do_rest_ofb: */ goto out; } - counter_u64_add(rack_sack_splits, 1); rack_clone_rsm(rack, nrsm, rsm, start); rsm->r_just_ret = 0; #ifndef INVARIANTS @@ -9596,7 +9450,6 @@ do_rest_ofb: } } else { /* Already sacked this piece */ - counter_u64_add(rack_sack_skipped_acked, 1); if (end == rsm->r_end) { /* Done with block */ rsm = tqhash_next(rack->r_ctl.tqh, rsm); @@ -9696,8 +9549,6 @@ do_rest_ofb: rsm->r_in_tmap = 0; } rack_log_map_chg(tp, rack, NULL, rsm, NULL, MAP_SACK_M3, end, __LINE__); - } else { - counter_u64_add(rack_sack_skipped_acked, 1); } if (end == rsm->r_end) { /* This block only - done, setup for next */ @@ -9876,7 +9727,6 @@ do_rest_ofb: } rack_log_map_chg(tp, rack, prev, &stack_map, rsm, MAP_SACK_M4, end, __LINE__); rsm = prev; - counter_u64_add(rack_sack_used_prev_merge, 1); } else { /** * This is the case where our previous @@ -9941,7 +9791,6 @@ do_rest_ofb: * rsm |---| (acked) * nrsm |------| (not acked) */ - counter_u64_add(rack_sack_splits, 1); rack_clone_rsm(rack, nrsm, rsm, end); rsm->r_flags &= (~RACK_HAS_FIN); rsm->r_just_ret = 0; @@ -9989,11 +9838,6 @@ do_rest_ofb: rsm->r_in_tmap = 0; } } - } else if (start != end){ - /* - * The block was already acked. - */ - counter_u64_add(rack_sack_skipped_acked, 1); } out: if (rsm && @@ -10786,17 +10630,6 @@ rack_log_ack(struct tcpcb *tp, struct tcpopt *to, struct tcphdr *th, int entered changed = 0; th_ack = th->th_ack; segsiz = ctf_fixed_maxseg(rack->rc_tp); - if (BYTES_THIS_ACK(tp, th) >= segsiz) { - /* - * You only get credit for - * MSS and greater (and you get extra - * credit for larger cum-ack moves). - */ - int ac; - - ac = BYTES_THIS_ACK(tp, th) / ctf_fixed_maxseg(rack->rc_tp); - counter_u64_add(rack_ack_total, ac); - } if (SEQ_GT(th_ack, tp->snd_una)) { rack_log_progress_event(rack, tp, ticks, PROGRESS_UPDATE, __LINE__); tp->t_acktime = ticks; @@ -10868,8 +10701,8 @@ rack_log_ack(struct tcpcb *tp, struct tcpopt *to, struct tcphdr *th, int entered if (sacks_seen != NULL) *sacks_seen = num_sack_blks; if (num_sack_blks == 0) { - /* Nothing to sack, but we need to update counts */ - goto out_with_totals; + /* Nothing to sack */ + goto out; } /* Its a sack of some sort */ if (num_sack_blks < 2) { @@ -10892,7 +10725,7 @@ rack_log_ack(struct tcpcb *tp, struct tcpopt *to, struct tcphdr *th, int entered */ again: if (num_sack_blks == 0) - goto out_with_totals; + goto out; if (num_sack_blks > 1) { for (i = 0; i < num_sack_blks; i++) { for (j = i + 1; j < num_sack_blks; j++) { @@ -10945,19 +10778,7 @@ do_sack_work: changed += acked; } if (num_sack_blks == 1) { - /* - * This is what we would expect from - * a normal implementation to happen - * after we have retransmitted the FR, - * i.e the sack-filter pushes down - * to 1 block and the next to be retransmitted - * is the sequence in the sack block (has more - * are acked). Count this as ACK'd data to boost - * up the chances of recovering any false positives. - */ - counter_u64_add(rack_ack_total, (acked / ctf_fixed_maxseg(rack->rc_tp))); - counter_u64_add(rack_express_sack, 1); - goto out_with_totals; + goto out; } else { /* * Start the loop through the @@ -10966,7 +10787,6 @@ do_sack_work: loop_start = 1; } } - counter_u64_add(rack_sack_total, 1); rsm = rack->r_ctl.rc_sacklast; for (i = loop_start; i < num_sack_blks; i++) { acked = rack_proc_sack_blk(tp, rack, &sack_blocks[i], to, &rsm, cts, segsiz); @@ -10975,18 +10795,6 @@ do_sack_work: changed += acked; } } -out_with_totals: - if (num_sack_blks > 1) { - /* - * You get an extra stroke if - * you have more than one sack-blk, this - * could be where we are skipping forward - * and the sack-filter is still working, or - * it could be an attacker constantly - * moving us. - */ - counter_u64_add(rack_move_some, 1); - } out: if (changed) { /* Something changed cancel the rack timer */ @@ -14706,7 +14514,6 @@ rack_init(struct tcpcb *tp, void **ptr) rack->r_ctl.rc_prr_sendalot = rack_send_a_lot_in_prr; rack->r_ctl.rc_min_to = rack_min_to; microuptime(&rack->r_ctl.act_rcv_time); - rack->r_ctl.rc_last_time_decay = rack->r_ctl.act_rcv_time; rack->r_ctl.rack_per_of_gp_ss = rack_per_of_gp_ss; if (rack_hw_up_only) rack->r_up_only = 1; diff --git a/sys/netinet/tcp_stacks/tcp_rack.h b/sys/netinet/tcp_stacks/tcp_rack.h index 144b4fabf7eb..cac17d9aeb50 100644 --- a/sys/netinet/tcp_stacks/tcp_rack.h +++ b/sys/netinet/tcp_stacks/tcp_rack.h @@ -462,7 +462,6 @@ struct rack_control { uint64_t rc_gp_output_ts; /* chg*/ uint64_t rc_gp_cumack_ts; /* chg*/ struct timeval act_rcv_time; - struct timeval rc_last_time_decay; /* SAD time decay happened here */ uint64_t gp_bw; uint64_t init_rate; #ifdef NETFLIX_SHARED_CWND diff --git a/sys/netinet/tcp_timer.c b/sys/netinet/tcp_timer.c index 3b9fe7a317b0..57c57666fa3a 100644 --- a/sys/netinet/tcp_timer.c +++ b/sys/netinet/tcp_timer.c @@ -513,9 +513,12 @@ tcp_timer_persist(struct tcpcb *tp) if (progdrop || (tp->t_rxtshift >= V_tcp_retries && (ticks - tp->t_rcvtime >= tcp_maxpersistidle || ticks - tp->t_rcvtime >= TCP_REXMTVAL(tp) * tcp_totbackoff))) { - if (!progdrop) + if (progdrop) { + tcp_log_end_status(tp, TCP_EI_STATUS_PROGRESS); + } else { TCPSTAT_INC(tcps_persistdrop); - tcp_log_end_status(tp, TCP_EI_STATUS_PERSIST_MAX); + tcp_log_end_status(tp, TCP_EI_STATUS_PERSIST_MAX); + } goto dropit; } /* diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c index 04d01099d54a..f1d952037d5a 100644 --- a/sys/netinet/udp_usrreq.c +++ b/sys/netinet/udp_usrreq.c @@ -1172,7 +1172,19 @@ udp_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *addr, else INP_RLOCK(inp); NET_EPOCH_ENTER(et); +#ifdef INET6 + if ((flags & PRUS_IPV6) != 0) { + if ((inp->in6p_outputopts != NULL) && + (inp->in6p_outputopts->ip6po_tclass != -1)) + tos = (u_char)inp->in6p_outputopts->ip6po_tclass; + else + tos = 0; + } else { + tos = inp->inp_ip_tos; + } +#else tos = inp->inp_ip_tos; +#endif if (control != NULL) { /* * XXX: Currently, we assume all the optional information is @@ -1196,6 +1208,23 @@ udp_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *addr, error = udp_v4mapped_pktinfo(cm, &src, inp, flags); if (error != 0) break; + if (((flags & PRUS_IPV6) != 0) && + (cm->cmsg_level == IPPROTO_IPV6) && + (cm->cmsg_type == IPV6_TCLASS)) { + int tclass; + + if (cm->cmsg_len != CMSG_LEN(sizeof(int))) { + error = EINVAL; + break; + } + tclass = *(int *)CMSG_DATA(cm); + if (tclass < -1 || tclass > 255) { + error = EINVAL; + break; + } + if (tclass != -1) + tos = (u_char)tclass; + } #endif if (cm->cmsg_level != IPPROTO_IP) continue; diff --git a/sys/sys/unistd.h b/sys/sys/unistd.h index 5743dc1c8033..29adf6b59425 100644 --- a/sys/sys/unistd.h +++ b/sys/sys/unistd.h @@ -160,6 +160,7 @@ #define _PC_XATTR_EXISTS _PC_HAS_NAMEDATTR /* Solaris Compatible */ #define _PC_HAS_HIDDENSYSTEM 68 #define _PC_CLONE_BLKSIZE 69 +#define _PC_CASE_INSENSITIVE 70 #endif /* From OpenSolaris, used by SEEK_DATA/SEEK_HOLE. */ diff --git a/sys/x86/x86/local_apic.c b/sys/x86/x86/local_apic.c index db9a1eb757de..c1c9029531f5 100644 --- a/sys/x86/x86/local_apic.c +++ b/sys/x86/x86/local_apic.c @@ -372,9 +372,12 @@ lvt_mode_impl(struct lapic *la, struct lvt *lvt, u_int pin, uint32_t value) case APIC_LVT_DM_SMI: case APIC_LVT_DM_INIT: case APIC_LVT_DM_EXTINT: - if (!lvt->lvt_edgetrigger && bootverbose) { - printf("lapic%u: Forcing LINT%u to edge trigger\n", - la->la_id, pin); + if (!lvt->lvt_edgetrigger) { + if (bootverbose) { + printf( + "lapic%u: Forcing LINT%u to edge trigger\n", + la->la_id, pin); + } value &= ~APIC_LVT_TM; } /* Use a vector of 0. */ diff --git a/tests/sys/fs/fusefs/mockfs.cc b/tests/sys/fs/fusefs/mockfs.cc index e8081dea9604..55c191716629 100644 --- a/tests/sys/fs/fusefs/mockfs.cc +++ b/tests/sys/fs/fusefs/mockfs.cc @@ -827,10 +827,12 @@ void MockFS::loop() { } } -int MockFS::notify_inval_entry(ino_t parent, const char *name, size_t namelen) +int MockFS::notify_inval_entry(ino_t parent, const char *name, size_t namelen, + int expected_errno) { std::unique_ptr<mockfs_buf_out> out(new mockfs_buf_out); + out->expected_errno = expected_errno; out->header.unique = 0; /* 0 means asynchronous notification */ out->header.error = FUSE_NOTIFY_INVAL_ENTRY; out->body.inval_entry.parent = parent; diff --git a/tests/sys/fs/fusefs/mockfs.hh b/tests/sys/fs/fusefs/mockfs.hh index ba6f7fded9d0..4b0628d34dd7 100644 --- a/tests/sys/fs/fusefs/mockfs.hh +++ b/tests/sys/fs/fusefs/mockfs.hh @@ -390,8 +390,10 @@ class MockFS { * @param parent Parent directory's inode number * @param name name of dirent to invalidate * @param namelen size of name, including the NUL + * @param expected_errno The error that write() should return */ - int notify_inval_entry(ino_t parent, const char *name, size_t namelen); + int notify_inval_entry(ino_t parent, const char *name, size_t namelen, + int expected_errno = 0); /* * Send an asynchronous notification to invalidate an inode's cached diff --git a/tests/sys/fs/fusefs/notify.cc b/tests/sys/fs/fusefs/notify.cc index 1e22bde13db7..d370a1e6e706 100644 --- a/tests/sys/fs/fusefs/notify.cc +++ b/tests/sys/fs/fusefs/notify.cc @@ -385,6 +385,27 @@ TEST_F(Notify, inval_inode_with_clean_cache) leak(fd); } +/* + * Attempting to invalidate an entry or inode after unmounting should fail, but + * nothing bad should happen. + * https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=290519 + */ +TEST_F(Notify, notify_after_unmount) +{ + const static char *name = "foo"; + struct inval_entry_args iea; + + expect_destroy(0); + + m_mock->unmount(); + + iea.mock = m_mock; + iea.parent = FUSE_ROOT_ID; + iea.name = name; + iea.namelen = strlen(name); + iea.mock->notify_inval_entry(iea.parent, iea.name, iea.namelen, ENODEV); +} + /* FUSE_NOTIFY_STORE with a file that's not in the entry cache */ /* disabled because FUSE_NOTIFY_STORE is not yet implemented */ TEST_F(Notify, DISABLED_store_nonexistent) @@ -544,3 +565,38 @@ TEST_F(NotifyWriteback, inval_inode_attrs_only) leak(fd); } + +/* + * Attempting asynchronous invalidation of an Entry before mounting the file + * system should fail, but nothing bad should happen. + * + * Note that invalidating an inode before mount goes through the same path, and + * is not separately tested. + * + * https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=290519 + */ +TEST(PreMount, inval_entry_before_mount) +{ + const static char name[] = "foo"; + size_t namelen = strlen(name); + struct mockfs_buf_out *out; + int r; + int fuse_fd; + + fuse_fd = open("/dev/fuse", O_CLOEXEC | O_RDWR); + ASSERT_GE(fuse_fd, 0) << strerror(errno); + + out = new mockfs_buf_out; + out->header.unique = 0; /* 0 means asynchronous notification */ + out->header.error = FUSE_NOTIFY_INVAL_ENTRY; + out->body.inval_entry.parent = FUSE_ROOT_ID; + out->body.inval_entry.namelen = namelen; + strlcpy((char*)&out->body.bytes + sizeof(out->body.inval_entry), + name, sizeof(out->body.bytes) - sizeof(out->body.inval_entry)); + out->header.len = sizeof(out->header) + sizeof(out->body.inval_entry) + + namelen; + r = write(fuse_fd, out, out->header.len); + EXPECT_EQ(-1, r); + EXPECT_EQ(ENODEV, errno); + delete out; +} diff --git a/usr.bin/cut/cut.c b/usr.bin/cut/cut.c index 60ff5a31062a..e4e322b4e5c9 100644 --- a/usr.bin/cut/cut.c +++ b/usr.bin/cut/cut.c @@ -448,8 +448,8 @@ f_cut(FILE *fp, const char *fname) break; } if (*pos) - for (i = 0; i < (int)clen; i++) - putchar(p[i - clen]); + (void)fwrite(p - clen, 1, clen, + stdout); } if (ch == '\n') break; diff --git a/usr.bin/mandoc/mandoc.ucl b/usr.bin/mandoc/mandoc.ucl index f320b6f547fd..75b8123d55cc 100644 --- a/usr.bin/mandoc/mandoc.ucl +++ b/usr.bin/mandoc/mandoc.ucl @@ -1,10 +1,14 @@ -path_glob: "/usr/share/man/*" +path_glob: [ + "/usr/share/man/*", + "/usr/share/openssl/man/*", +] cleanup: { type: lua sandbox: false script: <<EOD os.remove("/usr/share/man/mandoc.db") + os.remove("/usr/share/openssl/man/mandoc.db") EOD } @@ -12,7 +16,17 @@ trigger: { type: lua sandbox: false script: <<EOD - print("Generating apropos(1) database...") - pkg.exec({"/usr/bin/makewhatis", "/usr/share/man"}) + + local dirs = { + "/usr/share/man", + "/usr/share/openssl/man", + } + + for _,dir in ipairs(dirs) do + if pkg.stat(dir) then + print("Generating apropos(1) database for "..dir.."...") + pkg.exec({"/usr/bin/makewhatis", dir}) + end + end EOD } diff --git a/usr.sbin/bluetooth/rtlbtfw/main.c b/usr.sbin/bluetooth/rtlbtfw/main.c index 280045a6aa25..58503b8087b5 100644 --- a/usr.sbin/bluetooth/rtlbtfw/main.c +++ b/usr.sbin/bluetooth/rtlbtfw/main.c @@ -479,7 +479,7 @@ main(int argc, char *argv[]) } else r = rtlbt_parse_fwfile_v1(&fw, rom_version); if (r < 0) { - rtlbt_err("Parseing firmware file failed"); + rtlbt_err("Parsing firmware file failed"); goto shutdown; } diff --git a/usr.sbin/bsnmpd/bsnmpd/Makefile b/usr.sbin/bsnmpd/bsnmpd/Makefile index 601fc31ec475..0943c49c1ca1 100644 --- a/usr.sbin/bsnmpd/bsnmpd/Makefile +++ b/usr.sbin/bsnmpd/bsnmpd/Makefile @@ -17,105 +17,110 @@ XSYM= snmpMIB begemotSnmpdModuleTable begemotSnmpd begemotTrapSinkTable \ freeBSD freeBSDVersion begemotSnmpdTransInet CLEANFILES= oid.h tree.c tree.h -MAN= bsnmpd.1 snmpmod.3 - -MLINKS+= snmpmod.3 FIND_OBJECT_INT.3 -MLINKS+= snmpmod.3 FIND_OBJECT_INT_LINK.3 -MLINKS+= snmpmod.3 FIND_OBJECT_INT_LINK_INDEX.3 -MLINKS+= snmpmod.3 FIND_OBJECT_OID.3 -MLINKS+= snmpmod.3 FIND_OBJECT_OID_LINK.3 -MLINKS+= snmpmod.3 FIND_OBJECT_OID_LINK_INDEX.3 -MLINKS+= snmpmod.3 INSERT_OBJECT_INT.3 -MLINKS+= snmpmod.3 INSERT_OBJECT_INT_LINK.3 -MLINKS+= snmpmod.3 INSERT_OBJECT_INT_LINK_INDEX.3 -MLINKS+= snmpmod.3 INSERT_OBJECT_OID.3 -MLINKS+= snmpmod.3 INSERT_OBJECT_OID_LINK.3 -MLINKS+= snmpmod.3 INSERT_OBJECT_OID_LINK_INDEX.3 -MLINKS+= snmpmod.3 NEXT_OBJECT_INT.3 -MLINKS+= snmpmod.3 NEXT_OBJECT_INT_LINK.3 -MLINKS+= snmpmod.3 NEXT_OBJECT_INT_LINK_INDEX.3 -MLINKS+= snmpmod.3 NEXT_OBJECT_OID.3 -MLINKS+= snmpmod.3 NEXT_OBJECT_OID_LINK.3 -MLINKS+= snmpmod.3 NEXT_OBJECT_OID_LINK_INDEX.3 -MLINKS+= snmpmod.3 bsnmpd_get_target_stats.3 -MLINKS+= snmpmod.3 bsnmpd_get_usm_stats.3 -MLINKS+= snmpmod.3 bsnmpd_reset_usm_stats.3 -MLINKS+= snmpmod.3 buf_alloc.3 -MLINKS+= snmpmod.3 buf_size.3 -MLINKS+= snmpmod.3 comm_define.3 -MLINKS+= snmpmod.3 community.3 -MLINKS+= snmpmod.3 fd_deselect.3 -MLINKS+= snmpmod.3 fd_resume.3 -MLINKS+= snmpmod.3 fd_select.3 -MLINKS+= snmpmod.3 fd_suspend.3 -MLINKS+= snmpmod.3 get_ticks.3 -MLINKS+= snmpmod.3 index_append.3 -MLINKS+= snmpmod.3 index_append_off.3 -MLINKS+= snmpmod.3 index_compare.3 -MLINKS+= snmpmod.3 index_compare_off.3 -MLINKS+= snmpmod.3 index_decode.3 -MLINKS+= snmpmod.3 ip_commit.3 -MLINKS+= snmpmod.3 ip_get.3 -MLINKS+= snmpmod.3 ip_rollback.3 -MLINKS+= snmpmod.3 ip_save.3 -MLINKS+= snmpmod.3 or_register.3 -MLINKS+= snmpmod.3 or_unregister.3 -MLINKS+= snmpmod.3 oid_commit.3 -MLINKS+= snmpmod.3 oid_get.3 -MLINKS+= snmpmod.3 oid_rollback.3 -MLINKS+= snmpmod.3 oid_save.3 -MLINKS+= snmpmod.3 oid_usmNotInTimeWindows.3 -MLINKS+= snmpmod.3 oid_usmUnknownEngineIDs.3 -MLINKS+= snmpmod.3 oid_zeroDotZero.3 -MLINKS+= snmpmod.3 reqid_allocate.3 -MLINKS+= snmpmod.3 reqid_base.3 -MLINKS+= snmpmod.3 reqid_istype.3 -MLINKS+= snmpmod.3 reqid_next.3 -MLINKS+= snmpmod.3 reqid_type.3 -MLINKS+= snmpmod.3 snmp_input_finish.3 -MLINKS+= snmpmod.3 snmp_input_start.3 -MLINKS+= snmpmod.3 snmp_output.3 -MLINKS+= snmpmod.3 snmp_pdu_auth_access.3 -MLINKS+= snmpmod.3 snmp_send_port.3 -MLINKS+= snmpmod.3 snmp_send_trap.3 -MLINKS+= snmpmod.3 snmpd_target_stat.3 -MLINKS+= snmpmod.3 snmpd_usmstats.3 -MLINKS+= snmpmod.3 start_tick.3 -MLINKS+= snmpmod.3 string_commit.3 -MLINKS+= snmpmod.3 string_free.3 -MLINKS+= snmpmod.3 string_get.3 -MLINKS+= snmpmod.3 string_get_max.3 -MLINKS+= snmpmod.3 string_rollback.3 -MLINKS+= snmpmod.3 string_save.3 -MLINKS+= snmpmod.3 systemg.3 -MLINKS+= snmpmod.3 this_tick.3 -MLINKS+= snmpmod.3 timer_start.3 -MLINKS+= snmpmod.3 timer_start_repeat.3 -MLINKS+= snmpmod.3 timer_stop.3 -MLINKS+= snmpmod.3 target_activate_address.3 -MLINKS+= snmpmod.3 target_address.3 -MLINKS+= snmpmod.3 target_delete_address.3 -MLINKS+= snmpmod.3 target_delete_notify.3 -MLINKS+= snmpmod.3 target_delete_param.3 -MLINKS+= snmpmod.3 target_first_address.3 -MLINKS+= snmpmod.3 target_first_notify.3 -MLINKS+= snmpmod.3 target_first_param.3 -MLINKS+= snmpmod.3 target_flush_all.3 -MLINKS+= snmpmod.3 target_next_address.3 -MLINKS+= snmpmod.3 target_next_notify.3 -MLINKS+= snmpmod.3 target_next_param.3 -MLINKS+= snmpmod.3 target_new_address.3 -MLINKS+= snmpmod.3 target_new_notify.3 -MLINKS+= snmpmod.3 target_new_param.3 -MLINKS+= snmpmod.3 target_notify.3 -MLINKS+= snmpmod.3 target_param.3 -MLINKS+= snmpmod.3 usm_delete_user.3 -MLINKS+= snmpmod.3 usm_find_user.3 -MLINKS+= snmpmod.3 usm_first_user.3 -MLINKS+= snmpmod.3 usm_flush_users.3 -MLINKS+= snmpmod.3 usm_next_user.3 -MLINKS+= snmpmod.3 usm_new_user.3 -MLINKS+= snmpmod.3 usm_user.3 +MANGROUPS= MAN MAN3 + +MAN= bsnmpd.1 + +MAN3= snmpmod.3 +MAN3SUBPACKAGE=-dev + +MAN3LINKS+= snmpmod.3 FIND_OBJECT_INT.3 +MAN3LINKS+= snmpmod.3 FIND_OBJECT_INT_LINK.3 +MAN3LINKS+= snmpmod.3 FIND_OBJECT_INT_LINK_INDEX.3 +MAN3LINKS+= snmpmod.3 FIND_OBJECT_OID.3 +MAN3LINKS+= snmpmod.3 FIND_OBJECT_OID_LINK.3 +MAN3LINKS+= snmpmod.3 FIND_OBJECT_OID_LINK_INDEX.3 +MAN3LINKS+= snmpmod.3 INSERT_OBJECT_INT.3 +MAN3LINKS+= snmpmod.3 INSERT_OBJECT_INT_LINK.3 +MAN3LINKS+= snmpmod.3 INSERT_OBJECT_INT_LINK_INDEX.3 +MAN3LINKS+= snmpmod.3 INSERT_OBJECT_OID.3 +MAN3LINKS+= snmpmod.3 INSERT_OBJECT_OID_LINK.3 +MAN3LINKS+= snmpmod.3 INSERT_OBJECT_OID_LINK_INDEX.3 +MAN3LINKS+= snmpmod.3 NEXT_OBJECT_INT.3 +MAN3LINKS+= snmpmod.3 NEXT_OBJECT_INT_LINK.3 +MAN3LINKS+= snmpmod.3 NEXT_OBJECT_INT_LINK_INDEX.3 +MAN3LINKS+= snmpmod.3 NEXT_OBJECT_OID.3 +MAN3LINKS+= snmpmod.3 NEXT_OBJECT_OID_LINK.3 +MAN3LINKS+= snmpmod.3 NEXT_OBJECT_OID_LINK_INDEX.3 +MAN3LINKS+= snmpmod.3 bsnmpd_get_target_stats.3 +MAN3LINKS+= snmpmod.3 bsnmpd_get_usm_stats.3 +MAN3LINKS+= snmpmod.3 bsnmpd_reset_usm_stats.3 +MAN3LINKS+= snmpmod.3 buf_alloc.3 +MAN3LINKS+= snmpmod.3 buf_size.3 +MAN3LINKS+= snmpmod.3 comm_define.3 +MAN3LINKS+= snmpmod.3 community.3 +MAN3LINKS+= snmpmod.3 fd_deselect.3 +MAN3LINKS+= snmpmod.3 fd_resume.3 +MAN3LINKS+= snmpmod.3 fd_select.3 +MAN3LINKS+= snmpmod.3 fd_suspend.3 +MAN3LINKS+= snmpmod.3 get_ticks.3 +MAN3LINKS+= snmpmod.3 index_append.3 +MAN3LINKS+= snmpmod.3 index_append_off.3 +MAN3LINKS+= snmpmod.3 index_compare.3 +MAN3LINKS+= snmpmod.3 index_compare_off.3 +MAN3LINKS+= snmpmod.3 index_decode.3 +MAN3LINKS+= snmpmod.3 ip_commit.3 +MAN3LINKS+= snmpmod.3 ip_get.3 +MAN3LINKS+= snmpmod.3 ip_rollback.3 +MAN3LINKS+= snmpmod.3 ip_save.3 +MAN3LINKS+= snmpmod.3 or_register.3 +MAN3LINKS+= snmpmod.3 or_unregister.3 +MAN3LINKS+= snmpmod.3 oid_commit.3 +MAN3LINKS+= snmpmod.3 oid_get.3 +MAN3LINKS+= snmpmod.3 oid_rollback.3 +MAN3LINKS+= snmpmod.3 oid_save.3 +MAN3LINKS+= snmpmod.3 oid_usmNotInTimeWindows.3 +MAN3LINKS+= snmpmod.3 oid_usmUnknownEngineIDs.3 +MAN3LINKS+= snmpmod.3 oid_zeroDotZero.3 +MAN3LINKS+= snmpmod.3 reqid_allocate.3 +MAN3LINKS+= snmpmod.3 reqid_base.3 +MAN3LINKS+= snmpmod.3 reqid_istype.3 +MAN3LINKS+= snmpmod.3 reqid_next.3 +MAN3LINKS+= snmpmod.3 reqid_type.3 +MAN3LINKS+= snmpmod.3 snmp_input_finish.3 +MAN3LINKS+= snmpmod.3 snmp_input_start.3 +MAN3LINKS+= snmpmod.3 snmp_output.3 +MAN3LINKS+= snmpmod.3 snmp_pdu_auth_access.3 +MAN3LINKS+= snmpmod.3 snmp_send_port.3 +MAN3LINKS+= snmpmod.3 snmp_send_trap.3 +MAN3LINKS+= snmpmod.3 snmpd_target_stat.3 +MAN3LINKS+= snmpmod.3 snmpd_usmstats.3 +MAN3LINKS+= snmpmod.3 start_tick.3 +MAN3LINKS+= snmpmod.3 string_commit.3 +MAN3LINKS+= snmpmod.3 string_free.3 +MAN3LINKS+= snmpmod.3 string_get.3 +MAN3LINKS+= snmpmod.3 string_get_max.3 +MAN3LINKS+= snmpmod.3 string_rollback.3 +MAN3LINKS+= snmpmod.3 string_save.3 +MAN3LINKS+= snmpmod.3 systemg.3 +MAN3LINKS+= snmpmod.3 this_tick.3 +MAN3LINKS+= snmpmod.3 timer_start.3 +MAN3LINKS+= snmpmod.3 timer_start_repeat.3 +MAN3LINKS+= snmpmod.3 timer_stop.3 +MAN3LINKS+= snmpmod.3 target_activate_address.3 +MAN3LINKS+= snmpmod.3 target_address.3 +MAN3LINKS+= snmpmod.3 target_delete_address.3 +MAN3LINKS+= snmpmod.3 target_delete_notify.3 +MAN3LINKS+= snmpmod.3 target_delete_param.3 +MAN3LINKS+= snmpmod.3 target_first_address.3 +MAN3LINKS+= snmpmod.3 target_first_notify.3 +MAN3LINKS+= snmpmod.3 target_first_param.3 +MAN3LINKS+= snmpmod.3 target_flush_all.3 +MAN3LINKS+= snmpmod.3 target_next_address.3 +MAN3LINKS+= snmpmod.3 target_next_notify.3 +MAN3LINKS+= snmpmod.3 target_next_param.3 +MAN3LINKS+= snmpmod.3 target_new_address.3 +MAN3LINKS+= snmpmod.3 target_new_notify.3 +MAN3LINKS+= snmpmod.3 target_new_param.3 +MAN3LINKS+= snmpmod.3 target_notify.3 +MAN3LINKS+= snmpmod.3 target_param.3 +MAN3LINKS+= snmpmod.3 usm_delete_user.3 +MAN3LINKS+= snmpmod.3 usm_find_user.3 +MAN3LINKS+= snmpmod.3 usm_first_user.3 +MAN3LINKS+= snmpmod.3 usm_flush_users.3 +MAN3LINKS+= snmpmod.3 usm_next_user.3 +MAN3LINKS+= snmpmod.3 usm_new_user.3 +MAN3LINKS+= snmpmod.3 usm_user.3 FILESGROUPS= BMIBS DEFS diff --git a/usr.sbin/cxgbetool/tcbshowt7.c b/usr.sbin/cxgbetool/tcbshowt7.c index a3397960b26b..1d4be0fbcc91 100644 --- a/usr.sbin/cxgbetool/tcbshowt7.c +++ b/usr.sbin/cxgbetool/tcbshowt7.c @@ -190,7 +190,7 @@ void t7_display_tcb_aux_0 (_TCBVAR *tvp, int aux) val("rx_flow_control_ddp")); - PR("MISCELANEOUS:\n"); /* *************************** */ + PR("MISCELLANEOUS:\n"); /* *************************** */ PR(" pend_ctl: 0x%1x, core_bypass: 0x%x, main_slush: 0x%x\n", ((val("pend_ctl2")<<2) | (val("pend_ctl1")<<1) | val("pend_ctl0")), diff --git a/usr.sbin/fwcontrol/fwcontrol.c b/usr.sbin/fwcontrol/fwcontrol.c index ce908341a42a..195697475973 100644 --- a/usr.sbin/fwcontrol/fwcontrol.c +++ b/usr.sbin/fwcontrol/fwcontrol.c @@ -440,7 +440,7 @@ show_crom(u_int32_t *crom_buf) if (hdr->info_len == 1) { /* minimum ROM */ reg = (struct csrreg *)hdr; - printf("verndor ID: 0x%06x\n", reg->val); + printf("vendor ID: 0x%06x\n", reg->val); return; } printf("info_len=%d crc_len=%d crc=0x%04x", diff --git a/usr.sbin/pmcstat/pmcstat.c b/usr.sbin/pmcstat/pmcstat.c index 98e14dfb9113..ac9169f3e008 100644 --- a/usr.sbin/pmcstat/pmcstat.c +++ b/usr.sbin/pmcstat/pmcstat.c @@ -215,7 +215,7 @@ pmcstat_find_targets(const char *spec) SLIST_INSERT_HEAD(&args.pa_targets, pt, pt_next); } else if (rv != REG_NOMATCH) { regerror(rv, ®, errbuf, sizeof(errbuf)); - errx(EX_SOFTWARE, "ERROR: Regex evalation failed: %s", + errx(EX_SOFTWARE, "ERROR: Regex evaluation failed: %s", errbuf); } } |
