diff options
Diffstat (limited to 'lib')
47 files changed, 995 insertions, 121 deletions
| 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/geom/shsec/gshsec.8 b/lib/geom/shsec/gshsec.8 index d4477de3a71e..f80ab9384fe3 100644 --- a/lib/geom/shsec/gshsec.8 +++ b/lib/geom/shsec/gshsec.8 @@ -1,3 +1,6 @@ +.\" +.\" SPDX-License-Identifier: BSD-2-Clause +.\"  .\" Copyright (c) 2005 Pawel Jakub Dawidek <pjd@FreeBSD.org>  .\" All rights reserved.  .\" @@ -64,7 +67,7 @@ the rest of them.  The first argument to  .Nm  indicates an action to be performed: -.Bl -tag -width ".Cm destroy" +.Bl -tag -width indent  .It Cm label  Set up a shared secret device from the given components with the specified  .Ar name . @@ -92,7 +95,7 @@ See  .El  .Pp  Additional options: -.Bl -tag -width ".Fl f" +.Bl -tag -width indent  .It Fl f  Force the removal of the specified shared secret device.  .It Fl h 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/gen/getvfsbyname.3 b/lib/libc/gen/getvfsbyname.3 index 23036429b27e..61fd48624fbd 100644 --- a/lib/libc/gen/getvfsbyname.3 +++ b/lib/libc/gen/getvfsbyname.3 @@ -25,7 +25,7 @@  .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF  .\" SUCH DAMAGE.  .\" -.Dd August 16, 2018 +.Dd October 28, 2025  .Dt GETVFSBYNAME 3  .Os  .Sh NAME @@ -102,6 +102,7 @@ argument  specifies a file system that is unknown or not configured in the kernel.  .El  .Sh SEE ALSO +.Xr lsvfs 1 ,  .Xr jail 2 ,  .Xr mount 2 ,  .Xr sysctl 3 , diff --git a/lib/libc/gen/sysconf.3 b/lib/libc/gen/sysconf.3 index e38357b898a7..290ef0dc158c 100644 --- a/lib/libc/gen/sysconf.3 +++ b/lib/libc/gen/sysconf.3 @@ -25,7 +25,7 @@  .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF  .\" SUCH DAMAGE.  .\" -.Dd April 26, 2013 +.Dd August 30, 2025  .Dt SYSCONF 3  .Os  .Sh NAME @@ -77,7 +77,9 @@ The maximum number of supplemental groups.  .It Li _SC_NPROCESSORS_CONF  The number of processors configured.  .It Li _SC_NPROCESSORS_ONLN -The number of processors currently online. +The number of processors currently online, taking into account current jail +restrictions to report only the number of processors that are usable to the +process.  .It Li _SC_OPEN_MAX  One more than the maximum value the system may assign to a new file descriptor.  .It Li _SC_PAGESIZE diff --git a/lib/libc/gen/sysconf.c b/lib/libc/gen/sysconf.c index b5b732eed05d..87aedc07c110 100644 --- a/lib/libc/gen/sysconf.c +++ b/lib/libc/gen/sysconf.c @@ -72,6 +72,7 @@ long  sysconf(int name)  {  	struct rlimit rl; +	cpuset_t cpus;  	size_t len;  	int mib[2], sverrno, value;  	long lvalue, defaultresult; @@ -581,8 +582,21 @@ yesno:  		return (_POSIX_IPV6);  #endif -	case _SC_NPROCESSORS_CONF:  	case _SC_NPROCESSORS_ONLN: +		/* +		 * Consult our root set first, because our CPU availability +		 * may not match the total number of CPUs available on the +		 * system and we may have a non-uniform layout even within +		 * userland.  In particular, each jail has a root set that can +		 * be constrained by its parent and processes within the jail +		 * cannot widen beyond those constraints, so to those processes +		 * it makes sense to claim the more limited count. +		 */ +		if (cpuset_getaffinity(CPU_LEVEL_ROOT, CPU_WHICH_PID, -1, +		    sizeof(cpus), &cpus) == 0) +			return (CPU_COUNT(&cpus)); +		/* FALLTHROUGH */ +	case _SC_NPROCESSORS_CONF:  		if (_elf_aux_info(AT_NCPUS, &value, sizeof(value)) == 0)  			return ((long)value);  		mib[0] = CTL_HW; 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/libc/tests/sys/cpuset_test.c b/lib/libc/tests/sys/cpuset_test.c index 53d6a8215bbc..c8ad225fadfc 100644 --- a/lib/libc/tests/sys/cpuset_test.c +++ b/lib/libc/tests/sys/cpuset_test.c @@ -34,8 +34,10 @@  #include <sys/uio.h>  #include <sys/wait.h> +#include <assert.h>  #include <errno.h>  #include <stdio.h> +#include <stdlib.h>  #include <unistd.h>  #include <atf-c.h> @@ -107,6 +109,19 @@ skip_ltncpu(int ncpu, cpuset_t *mask)  		atf_tc_skip("Test requires %d or more cores.", ncpu);  } +static void +skip_ltncpu_root(int ncpu, cpuset_t *mask) +{ + +	CPU_ZERO(mask); +	ATF_REQUIRE_EQ(0, cpuset_getaffinity(CPU_LEVEL_ROOT, CPU_WHICH_PID, +	    -1, sizeof(*mask), mask)); +	if (CPU_COUNT(mask) < ncpu) { +		atf_tc_skip("Test requires cpuset root with %d or more cores.", +		    ncpu); +	} +} +  ATF_TC(newset);  ATF_TC_HEAD(newset, tc)  { @@ -234,9 +249,8 @@ ATF_TC_BODY(deadlk, tc)  }  static int -do_jail(int sock) +create_jail(void)  { -	struct jail_test_info info;  	struct iovec iov[2];  	char *name;  	int error; @@ -250,8 +264,22 @@ do_jail(int sock)  	iov[1].iov_base = name;  	iov[1].iov_len = strlen(name) + 1; -	if (jail_set(iov, 2, JAIL_CREATE | JAIL_ATTACH) < 0) +	error = jail_set(iov, 2, JAIL_CREATE | JAIL_ATTACH); +	free(name); +	if (error < 0)  		return (FAILURE_JAIL); +	return (0); +} + +static int +do_jail(int sock) +{ +	struct jail_test_info info; +	int error; + +	error = create_jail(); +	if (error != 0) +		return (error);  	/* Record parameters, kick them over, then make a swift exit. */  	CPU_ZERO(&info.jail_tidmask); @@ -641,6 +669,111 @@ ATF_TC_BODY(jail_attach_disjoint, tc)  	try_attach(jid, &smask);  } +struct nproc_info { +	long		nproc_init; +	long		nproc_final; +	long		nproc_global; +}; + +ATF_TC(jail_nproc); +ATF_TC_HEAD(jail_nproc, tc) +{ +	atf_tc_set_md_var(tc, "descr", +	    "Test that _SC_PROCESSORS_ONLN reflects jail cpuset constraints"); +} +ATF_TC_BODY(jail_nproc, tc) +{ +	cpuset_t jmask; +	struct nproc_info ninfo = { }; +	int sockpair[2]; +	cpusetid_t setid; +	ssize_t readsz; +	pid_t pid; +	int fcpu, error, pfd, sock; +	char okb = 0x7f, rcvb; + +	skip_ltncpu_root(2, &jmask); +	fcpu = CPU_FFS(&jmask) - 1; + +	/* +	 * Just adjusting our affinity should not affect the number of +	 * processors considered online- we want to be sure that it's only +	 * adjusted if our jail's root set is. +	 */ +	CPU_CLR(fcpu, &jmask); +	error = cpuset_setaffinity(CPU_LEVEL_WHICH, CPU_WHICH_PID, -1, +	    sizeof(jmask), &jmask); +	ATF_REQUIRE_EQ(0, error); +	ATF_REQUIRE(sysconf(_SC_NPROCESSORS_ONLN) > CPU_COUNT(&jmask)); + +	ATF_REQUIRE_EQ(0, socketpair(PF_UNIX, SOCK_STREAM, 0, sockpair)); + +	/* We'll wait on the procdesc, too, so we can fail faster if it dies. */ +	ATF_REQUIRE((pid = pdfork(&pfd, 0)) != -1); + +	if (pid == 0) { +		/* First child sets up the jail. */ +		sock = sockpair[SP_CHILD]; +		close(sockpair[SP_PARENT]); + +		error = create_jail(); +		if (error != 0) +			_exit(error); + +		ninfo.nproc_init = sysconf(_SC_NPROCESSORS_ONLN); + +		/* Signal the parent that we're jailed. */ +		readsz = write(sock, &okb, sizeof(okb)); +		assert(readsz == sizeof(okb)); + +		/* Wait for parent to adjust our mask and signal OK. */ +		readsz = read(sock, &rcvb, sizeof(rcvb)); +		assert(readsz == sizeof(rcvb)); +		assert(rcvb == okb); + +		ninfo.nproc_final = sysconf(_SC_NPROCESSORS_ONLN); +		ninfo.nproc_global = sysconf(_SC_NPROCESSORS_CONF); +		readsz = write(sock, &ninfo, sizeof(ninfo)); +		assert(readsz == sizeof(ninfo)); + +		_exit(0); +	} + +	close(sockpair[SP_CHILD]); +	sock = sockpair[SP_PARENT]; + +	/* Wait for signal that they are jailed. */ +	readsz = read(sock, &rcvb, sizeof(rcvb)); +	assert(readsz == sizeof(rcvb)); +	assert(rcvb == okb); + +	/* Grab the cpuset id and adjust it. */ +	error = cpuset_getid(CPU_LEVEL_ROOT, CPU_WHICH_PID, pid, &setid); +	ATF_REQUIRE_EQ(0, error); +	error = cpuset_setaffinity(CPU_LEVEL_WHICH, CPU_WHICH_CPUSET, +	    setid, sizeof(jmask), &jmask); +	ATF_REQUIRE_EQ(0, error); + +	/* Signal OK to proceed. */ +	readsz = write(sock, &okb, sizeof(okb)); +	ATF_REQUIRE_EQ(sizeof(okb), readsz); + +	/* Grab our final nproc info. */ +	readsz = read(sock, &ninfo, sizeof(ninfo)); +	ATF_REQUIRE_EQ(sizeof(ninfo), readsz); + +	/* +	 * We set our own affinity to jmask, which is derived from *our* root +	 * set, at the beginning of the test.  The jail would inherit from this +	 * set, so we just re-use that mask here to confirm that +	 * _SC_NPROCESSORS_ONLN did actually drop in response to us limiting the +	 * jail, and that its _SC_NPROCESSORS_CONF did not. +	 */ +	ATF_REQUIRE_EQ(CPU_COUNT(&jmask) + 1, ninfo.nproc_init); +	ATF_REQUIRE_EQ(CPU_COUNT(&jmask) + 1, ninfo.nproc_global); +	ATF_REQUIRE_EQ(CPU_COUNT(&jmask), ninfo.nproc_final); +} +  ATF_TC(badparent);  ATF_TC_HEAD(badparent, tc)  { @@ -686,6 +819,7 @@ ATF_TP_ADD_TCS(tp)  	ATF_TP_ADD_TC(tp, jail_attach_prevbase);  	ATF_TP_ADD_TC(tp, jail_attach_plain);  	ATF_TP_ADD_TC(tp, jail_attach_disjoint); +	ATF_TP_ADD_TC(tp, jail_nproc);  	ATF_TP_ADD_TC(tp, badparent);  	return (atf_no_error());  } 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/libpfctl/libpfctl.c b/lib/libpfctl/libpfctl.c index 8c4b26b98054..17576066fcfd 100644 --- a/lib/libpfctl/libpfctl.c +++ b/lib/libpfctl/libpfctl.c @@ -3202,6 +3202,9 @@ pfctl_get_ruleset(struct pfctl_handle *h, const char *path, uint32_t nr, struct  			continue;  	} +	rs->nr = nr; +	strlcpy(rs->path, path, sizeof(rs->path)); +  	return (e.error);  } 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/_libsys.h b/lib/libsys/_libsys.h index 6bd768708a78..12417b572a60 100644 --- a/lib/libsys/_libsys.h +++ b/lib/libsys/_libsys.h @@ -32,6 +32,7 @@ struct itimerspec;  struct itimerval;  struct jail;  struct kevent; +struct kexec_segment;  struct kld_file_stat;  struct mac;  struct module_stat; @@ -470,6 +471,7 @@ typedef int (__sys_getgroups_t)(int, gid_t *);  typedef int (__sys_setgroups_t)(int, const gid_t *);  typedef int (__sys_jail_attach_jd_t)(int);  typedef int (__sys_jail_remove_jd_t)(int); +typedef int (__sys_kexec_load_t)(uint64_t, u_long, struct kexec_segment *, u_long);  _Noreturn void __sys__exit(int rval);  int __sys_fork(void); @@ -876,6 +878,7 @@ int __sys_getgroups(int gidsetsize, gid_t * gidset);  int __sys_setgroups(int gidsetsize, const gid_t * gidset);  int __sys_jail_attach_jd(int fd);  int __sys_jail_remove_jd(int fd); +int __sys_kexec_load(uint64_t entry, u_long nseg, struct kexec_segment * segments, u_long flags);  __END_DECLS  #endif /* __LIBSYS_H_ */ diff --git a/lib/libsys/clock_gettime.2 b/lib/libsys/clock_gettime.2 index 89551d0f720b..841673648dfc 100644 --- a/lib/libsys/clock_gettime.2 +++ b/lib/libsys/clock_gettime.2 @@ -27,7 +27,7 @@  .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF  .\" SUCH DAMAGE.  .\" -.Dd August 10, 2024 +.Dd October 15, 2025  .Dt CLOCK_GETTIME 2  .Os  .Sh NAME @@ -80,7 +80,6 @@ Behavior during a leap second is not defined by and POSIX standard.  Increments in SI seconds, even while the system is suspended.  Its epoch is unspecified.  The count is not adjusted by leap seconds. -.Fx implements  .It Dv CLOCK_UPTIME  .It Dv CLOCK_UPTIME_PRECISE  .It Dv CLOCK_UPTIME_FAST diff --git a/lib/libsys/closefrom.2 b/lib/libsys/closefrom.2 index 1885a6fdeaa8..e6b4a5a3e9d7 100644 --- a/lib/libsys/closefrom.2 +++ b/lib/libsys/closefrom.2 @@ -23,7 +23,7 @@  .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF  .\" SUCH DAMAGE.  .\" -.Dd May 17, 2025 +.Dd October 27, 2025  .Dt CLOSEFROM 2  .Os  .Sh NAME @@ -94,6 +94,11 @@ function first appeared in  .Fx 8.0 .  .Pp  The +.Fn close_range +function first appeared in +.Fx 12.2 . +.Pp +The  .Dv CLOSE_RANGE_CLOFORK  flag appeared in  .Fx 15.0 . 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/syscalls.map b/lib/libsys/syscalls.map index b5400b9849b3..d00c862eb462 100644 --- a/lib/libsys/syscalls.map +++ b/lib/libsys/syscalls.map @@ -817,4 +817,6 @@ FBSDprivate_1.0 {  	__sys_jail_attach_jd;  	_jail_remove_jd;  	__sys_jail_remove_jd; +	_kexec_load; +	__sys_kexec_load;  }; 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/libunbound/config.h b/lib/libunbound/config.h index 1cedf5b4de36..1b939b7f1074 100644 --- a/lib/libunbound/config.h +++ b/lib/libunbound/config.h @@ -884,7 +884,7 @@  #define PACKAGE_NAME "unbound"  /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "unbound 1.24.0" +#define PACKAGE_STRING "unbound 1.24.1"  /* Define to the one symbol short name of this package. */  #define PACKAGE_TARNAME "unbound" @@ -893,7 +893,7 @@  #define PACKAGE_URL ""  /* Define to the version of this package. */ -#define PACKAGE_VERSION "1.24.0" +#define PACKAGE_VERSION "1.24.1"  /* default pidfile location */  #define PIDFILE "/var/unbound/unbound.pid" 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/libutil/login_class.c b/lib/libutil/login_class.c index c3c1b0ddda27..9478b4dc98ca 100644 --- a/lib/libutil/login_class.c +++ b/lib/libutil/login_class.c @@ -543,7 +543,7 @@ setusercontext(login_cap_t *lc, const struct passwd *pwd, uid_t uid, unsigned in      /* we need a passwd entry to set these */      if (pwd == NULL) -	flags &= ~(LOGIN_SETGROUP | LOGIN_SETLOGIN | LOGIN_SETMAC); +	flags &= ~(LOGIN_SETGROUP | LOGIN_SETLOGIN);      /* Set the process priority */      if (flags & LOGIN_SETPRIORITY) @@ -564,6 +564,27 @@ setusercontext(login_cap_t *lc, const struct passwd *pwd, uid_t uid, unsigned in  	}      } +    /* Set the sessions login */ +    if ((flags & LOGIN_SETLOGIN) && setlogin(pwd->pw_name) != 0) { +	syslog(LOG_ERR, "setlogin(%s): %m", pwd->pw_name); +	login_close(llc); +	return (-1); +    } + +    /* Inform the kernel about current login class */ +    if (lc != NULL && lc->lc_class != NULL && (flags & LOGIN_SETLOGINCLASS)) { +	error = setloginclass(lc->lc_class); +	if (error != 0) { +	    syslog(LOG_ERR, "setloginclass(%s): %m", lc->lc_class); +#ifdef notyet +	    login_close(llc); +	    return (-1); +#endif +	} +    } + +    setlogincontext(lc, pwd, flags); +      /* Set up the user's MAC label. */      if ((flags & LOGIN_SETMAC) && mac_is_present(NULL) == 1) {  	const char *label_string; @@ -572,8 +593,10 @@ setusercontext(login_cap_t *lc, const struct passwd *pwd, uid_t uid, unsigned in  	label_string = login_getcapstr(lc, "label", NULL, NULL);  	if (label_string != NULL) {  	    if (mac_from_text(&label, label_string) == -1) { -		syslog(LOG_ERR, "mac_from_text('%s') for %s: %m", -		    pwd->pw_name, label_string); +		syslog(LOG_ERR, "mac_from_text('%s') for %s %s: %m", +		    label_string, pwd != NULL ? "user" : "class", +		    pwd != NULL ? pwd->pw_name : lc->lc_class); +		login_close(llc);  		return (-1);  	    }  	    if (mac_set_proc(label) == -1) @@ -582,33 +605,15 @@ setusercontext(login_cap_t *lc, const struct passwd *pwd, uid_t uid, unsigned in  		error = 0;  	    mac_free(label);  	    if (error != 0) { -		syslog(LOG_ERR, "mac_set_proc('%s') for %s: %s", -		    label_string, pwd->pw_name, strerror(error)); +		syslog(LOG_ERR, "mac_set_proc('%s') for %s %s: %s", +		    label_string, pwd != NULL ? "user" : "class", +		    pwd != NULL ? pwd->pw_name : lc->lc_class, strerror(error)); +		login_close(llc);  		return (-1);  	    }  	}      } -    /* Set the sessions login */ -    if ((flags & LOGIN_SETLOGIN) && setlogin(pwd->pw_name) != 0) { -	syslog(LOG_ERR, "setlogin(%s): %m", pwd->pw_name); -	login_close(llc); -	return (-1); -    } - -    /* Inform the kernel about current login class */ -    if (lc != NULL && lc->lc_class != NULL && (flags & LOGIN_SETLOGINCLASS)) { -	error = setloginclass(lc->lc_class); -	if (error != 0) { -	    syslog(LOG_ERR, "setloginclass(%s): %m", lc->lc_class); -#ifdef notyet -	    login_close(llc); -	    return (-1); -#endif -	} -    } - -    setlogincontext(lc, pwd, flags);      login_close(llc);      /* This needs to be done after anything that needs root privs */ diff --git a/lib/libutil/mntopts.c b/lib/libutil/mntopts.c index 07d3dd6d98a3..4a064a086fd5 100644 --- a/lib/libutil/mntopts.c +++ b/lib/libutil/mntopts.c @@ -145,6 +145,18 @@ checkpath_allow_file(const char *path, char *resolved)  	return (0);  } +static char * +prependdevtopath(const char *path, char *buf, u_long buflen) +{ +	u_long len; + +	if ((len = strlen(_PATH_DEV) + strlen(path) + 1) > buflen) +		return NULL; +	strncpy(buf, _PATH_DEV, len); +	strncat(buf, path, len - sizeof(_PATH_DEV)); +	return (buf); +} +  /*   * Get the mount point information for name. Name may be mount point name   * or device name (with or without /dev/ preprended). @@ -153,19 +165,27 @@ struct statfs *  getmntpoint(const char *name)  {  	struct stat devstat, mntdevstat; -	char device[sizeof(_PATH_DEV) - 1 + MNAMELEN]; -	char *ddevname; +	char *devname;  	struct statfs *mntbuf, *statfsp; -	int i, mntsize, isdev; -	u_long len; +	int i, len, isdev, mntsize, mntfromnamesize; +	char device[sizeof(_PATH_DEV) - 1 + MNAMELEN]; +	u_long devlen; -	if (stat(name, &devstat) != 0) +	devlen = sizeof(device); +	/* +	 * Note that stat(NULL, &statbuf) returns -1 (EBADF) which will +	 * cause us to return NULL if prependdevtopath() returns NULL. +	 */ +	if (stat(name, &devstat) != 0 && +	    (name[0] != '/' && +	     stat(prependdevtopath(name, device, devlen), &devstat) != 0))  		return (NULL);  	if (S_ISCHR(devstat.st_mode) || S_ISBLK(devstat.st_mode))  		isdev = 1;  	else  		isdev = 0;  	mntsize = getmntinfo(&mntbuf, MNT_NOWAIT); +	mntfromnamesize = sizeof(statfsp->f_mntfromname);  	for (i = 0; i < mntsize; i++) {  		statfsp = &mntbuf[i];  		if (isdev == 0) { @@ -173,19 +193,20 @@ getmntpoint(const char *name)  				continue;  			return (statfsp);  		} -		ddevname = statfsp->f_mntfromname; -		if (*ddevname != '/') { -			if ((len = strlen(_PATH_DEV) + strlen(ddevname) + 1) > -			    sizeof(statfsp->f_mntfromname) || -			    len > sizeof(device)) +		devname = statfsp->f_mntfromname; +		if (*devname == '/') { +			if (stat(devname, &mntdevstat) != 0) +				continue; +		} else { +			devname = prependdevtopath(devname, device, devlen); +			if (devname == NULL || +			    (len = strlen(devname)) > mntfromnamesize) +				continue; +			if (stat(devname, &mntdevstat) != 0)  				continue; -			strncpy(device, _PATH_DEV, len); -			strncat(device, ddevname, len); -			if (stat(device, &mntdevstat) == 0) -				strncpy(statfsp->f_mntfromname, device, len); +			strncpy(statfsp->f_mntfromname, devname, len);  		} -		if (stat(ddevname, &mntdevstat) == 0 && -		    S_ISCHR(mntdevstat.st_mode) && +		if (S_ISCHR(mntdevstat.st_mode) &&  		    mntdevstat.st_rdev == devstat.st_rdev)  			return (statfsp);  	} 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/libz/Makefile b/lib/libz/Makefile index 6a135158e134..03204e388674 100644 --- a/lib/libz/Makefile +++ b/lib/libz/Makefile @@ -1,7 +1,4 @@ -# -# - -PACKAGE=	runtime +PACKAGE=	zlib  LIB=		z  SHLIBDIR?=	/lib  SHLIB_MAJOR=	6 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> | 
