aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.inc14
-rw-r--r--contrib/bsnmp/oid-list18
-rw-r--r--contrib/bsnmp/snmp_mibII/mibII.c6
-rw-r--r--contrib/llvm-project/clang/lib/Sema/AnalysisBasedWarnings.cpp25
-rw-r--r--etc/mtree/BSD.root.dist2
-rw-r--r--include/unistd.h1
-rw-r--r--lib/geom/part/gpart.84
-rw-r--r--lib/libc/gen/Makefile.inc1
-rw-r--r--lib/libc/gen/Symbol.map1
-rw-r--r--lib/libc/gen/freadlink.c16
-rw-r--r--lib/libc/gen/posix_spawn.c2
-rw-r--r--lib/msun/Makefile6
-rw-r--r--lib/msun/Symbol.map3
-rw-r--r--lib/msun/man/sqrt.353
-rw-r--r--lib/msun/src/math.h3
-rw-r--r--lib/msun/src/math_private.h83
-rw-r--r--lib/msun/src/s_rsqrt.c153
-rw-r--r--lib/msun/src/s_rsqrtf.c155
-rw-r--r--lib/msun/src/s_rsqrtl.c203
-rw-r--r--libexec/nuageinit/tests/Makefile4
-rw-r--r--libexec/nuageinit/tests/adddoas.lua64
-rw-r--r--libexec/nuageinit/tests/addsudo.lua61
-rw-r--r--libexec/nuageinit/tests/decode_base64.lua61
-rw-r--r--libexec/nuageinit/tests/nuage.sh30
-rw-r--r--libexec/nuageinit/tests/update_sshd_config.lua73
-rw-r--r--sbin/fsck_msdosfs/fat.c11
-rw-r--r--share/man/man4/rge.44
-rw-r--r--share/man/man9/Makefile1
-rw-r--r--share/man/man9/uio.945
-rw-r--r--stand/i386/boot2/sio.S2
-rw-r--r--sys/amd64/linux/linux_locore.asm2
-rw-r--r--sys/amd64/linux/linux_support.S2
-rw-r--r--sys/amd64/linux32/linux32_locore.asm2
-rw-r--r--sys/amd64/linux32/linux32_support.S2
-rw-r--r--sys/arm/include/_types.h1
-rw-r--r--sys/arm64/include/_types.h1
-rw-r--r--sys/arm64/linux/linux_locore.asm2
-rw-r--r--sys/arm64/linux/linux_support.S2
-rw-r--r--sys/compat/linux/linux_vdso_inc.S2
-rw-r--r--sys/dev/cxgbe/common/t4_regs.h51
-rw-r--r--sys/dev/cxgbe/firmware/t4fw_interface.h107
-rw-r--r--sys/dev/cxgbe/firmware/t7fw_cfg.txt19
-rw-r--r--sys/dev/cxgbe/firmware/t7fw_cfg_uwire.txt19
-rw-r--r--sys/dev/cxgbe/t4_main.c15
-rw-r--r--sys/dev/pci/pci.c2
-rw-r--r--sys/dev/rge/if_rge.c1
-rw-r--r--sys/dev/rge/if_rge_vendor.h1
-rw-r--r--sys/dev/thunderbolt/tbcfg_reg.h2
-rw-r--r--sys/i386/linux/linux_locore.asm2
-rw-r--r--sys/kern/uipc_usrreq.c21
-rw-r--r--sys/kern/vfs_cache.c4
-rw-r--r--sys/kern/vfs_mount.c6
-rw-r--r--sys/kern/vfs_subr.c34
-rw-r--r--sys/kern/vfs_vnops.c4
-rw-r--r--sys/net/if_geneve.c2
-rw-r--r--sys/powerpc/include/_types.h1
-rw-r--r--sys/riscv/include/_types.h1
-rw-r--r--sys/sys/_decls.h46
-rw-r--r--sys/sys/_types.h5
-rw-r--r--sys/sys/abi_types.h2
-rw-r--r--sys/sys/cdefs.h8
-rw-r--r--sys/sys/fcntl.h7
-rw-r--r--sys/sys/mount.h293
-rw-r--r--sys/sys/time.h4
-rw-r--r--sys/sys/ucred.h11
-rw-r--r--sys/sys/vnode.h30
-rw-r--r--sys/vm/vm_map.c3
-rw-r--r--sys/x86/cpufreq/hwpstate_amd.c2
-rw-r--r--sys/x86/include/_types.h2
-rw-r--r--tools/build/Makefile1
-rwxr-xr-xusr.bin/stat/tests/stat_test.sh2
71 files changed, 1553 insertions, 266 deletions
diff --git a/Makefile.inc1 b/Makefile.inc1
index b07b5f9c1a65..2927054c2e83 100644
--- a/Makefile.inc1
+++ b/Makefile.inc1
@@ -2128,7 +2128,7 @@ real-packages: stage-packages create-packages sign-packages .PHONY
real-update-packages: stage-packages .PHONY
${_+_}${MAKE} -C ${.CURDIR} PKG_VERSION=${PKG_VERSION} create-packages
-.if defined(PKG_VERSION_FROM_DIR)
+.if defined(PKG_VERSION_FROM_DIR) && ${PKG_VERSION} != ${PKG_VERSION_FROM}
@echo "==> Checking for new packages (comparing ${PKG_VERSION} to ${PKG_VERSION_FROM})"
@for pkg in ${PKG_VERSION_FROM_DIR}/${PKG_NAME_PREFIX}-*; do \
pkgname=$$(${PKG_CMD} query -F $${pkg} '%n' | sed 's/${PKG_NAME_PREFIX}-\(.*\)/\1/') ; \
@@ -2146,6 +2146,8 @@ real-update-packages: stage-packages .PHONY
echo "==> New package $${newpkgname}" ; \
fi ; \
done
+.elif defined(PKG_VERSION_FROM_DIR)
+ @echo "==> Package version ${PKG_VERSION} unchanged, keeping old package set"
.else
@echo "==> Bootstrapping repository, not checking for new packages"
.endif
diff --git a/contrib/bsnmp/oid-list b/contrib/bsnmp/oid-list
index 6bd2fe18c25f..7733cd5be063 100644
--- a/contrib/bsnmp/oid-list
+++ b/contrib/bsnmp/oid-list
@@ -10,11 +10,25 @@ enterprises
12325 FOKUS
1 BEGEMOT
1 BEGEMOT-SNMPD
+ 1 begemotSnmpdObjects
+ 1 begemotSnmpdConfig
+ 2 begemotTrapSinkTable
+ 4 begemotSnmpdPortTable
+ 5 begemotSnmpdCommunityTable
+ 6 begemotSnmpdModuleTable
+ 7 begemotSnmpdStats
+ 8 begemotSnmpdDebug
+ 9 begemotSnmpdLocalPortTable
+ 10 begemotSnmpdTransportMappings
+ 11 begemotSnmpdTransInetTable
+ 13 begemotSnmpdTraps
+ 14 begemotSnmpdContextTable
2 BEGEMOT-NETGRAPH snmpd netgraph module
3 BEGEMOT-IP snmpd IP related stuff.
4 BEGEMOT-IFACE-MIB interface MIB private stuff
5 BEGEMOT-IPSTATS-MIB IP statistics
6 BEGEMOT-IP-MIB IP objects
+ 7 BEGEMOT-VACM VACM support objects
100 BEGEMOT-ILMID snmpd ILMID module
101 BEGEMOT-ATM snmpd ATM module
200 BEGEMOT-PF snmpd PF module (phillip@freebsd.org)
@@ -25,10 +39,14 @@ enterprises
205 begemotBridge bridge module
210 begemotWlan WLAN module
220 begemotHast HAST module
+ 230 begemotJails jails module
300 BEGEMOT-ACM DLR ACM project
303 BEGEMOT-WLINK DLR WLINK simulator
304 BEGEMOT-SATX DLR SatX simulator
+ 305 BEGEMOT-INET inet transport module
+ 306 BEGEMOT-LSOCK local socket transport module
+ 307 BEGEMOT-UDP UDP transport module
405 mysql (vanilla@fatpipi.com)
406 varnish (vanilla@fatpipi.com)
diff --git a/contrib/bsnmp/snmp_mibII/mibII.c b/contrib/bsnmp/snmp_mibII/mibII.c
index 59f3836d1ede..4cf4f231facc 100644
--- a/contrib/bsnmp/snmp_mibII/mibII.c
+++ b/contrib/bsnmp/snmp_mibII/mibII.c
@@ -485,6 +485,7 @@ mib_fetch_ifmib(struct mibif *ifp)
syslog(LOG_WARNING, "sysctl linkmib estimate (%s): %m",
ifp->name);
if (ifp->specmib != NULL) {
+ free(ifp->specmib);
ifp->specmib = NULL;
ifp->specmiblen = 0;
}
@@ -492,6 +493,7 @@ mib_fetch_ifmib(struct mibif *ifp)
}
if (len == 0) {
if (ifp->specmib != NULL) {
+ free(ifp->specmib);
ifp->specmib = NULL;
ifp->specmiblen = 0;
}
@@ -500,6 +502,7 @@ mib_fetch_ifmib(struct mibif *ifp)
if (ifp->specmiblen != len) {
if ((newmib = realloc(ifp->specmib, len)) == NULL) {
+ free(ifp->specmib);
ifp->specmib = NULL;
ifp->specmiblen = 0;
goto out;
@@ -510,6 +513,7 @@ mib_fetch_ifmib(struct mibif *ifp)
if (sysctl(name, nitems(name), ifp->specmib, &len, NULL, 0) == -1) {
syslog(LOG_WARNING, "sysctl linkmib (%s): %m", ifp->name);
if (ifp->specmib != NULL) {
+ free(ifp->specmib);
ifp->specmib = NULL;
ifp->specmiblen = 0;
}
@@ -546,9 +550,11 @@ mib_fetch_ifmib(struct mibif *ifp)
alias_maxlen = MIBIF_ALIAS_SIZE_MAX;
/*
+ * Free any alias memory allocated by a previous call.
* Allocate maximum memory for a buffer and later reallocate
* to free extra memory.
*/
+ free(ifp->alias);
if ((ifp->alias = malloc(alias_maxlen)) == NULL) {
syslog(LOG_WARNING, "malloc(%d) failed: %m", (int)alias_maxlen);
goto fin;
diff --git a/contrib/llvm-project/clang/lib/Sema/AnalysisBasedWarnings.cpp b/contrib/llvm-project/clang/lib/Sema/AnalysisBasedWarnings.cpp
index ec39bca6039f..ab55cbceeaa8 100644
--- a/contrib/llvm-project/clang/lib/Sema/AnalysisBasedWarnings.cpp
+++ b/contrib/llvm-project/clang/lib/Sema/AnalysisBasedWarnings.cpp
@@ -2116,11 +2116,26 @@ class ThreadSafetyReporter : public clang::threadSafety::ThreadSafetyHandler {
void handleNoMutexHeld(const NamedDecl *D, ProtectedOperationKind POK,
AccessKind AK, SourceLocation Loc) override {
- assert((POK == POK_VarAccess || POK == POK_VarDereference) &&
- "Only works for variables");
- unsigned DiagID = POK == POK_VarAccess?
- diag::warn_variable_requires_any_lock:
- diag::warn_var_deref_requires_any_lock;
+ unsigned DiagID = 0;
+ switch (POK) {
+ case POK_VarAccess:
+ case POK_PassByRef:
+ case POK_ReturnByRef:
+ case POK_PassPointer:
+ case POK_ReturnPointer:
+ DiagID = diag::warn_variable_requires_any_lock;
+ break;
+ case POK_VarDereference:
+ case POK_PtPassByRef:
+ case POK_PtReturnByRef:
+ case POK_PtPassPointer:
+ case POK_PtReturnPointer:
+ DiagID = diag::warn_var_deref_requires_any_lock;
+ break;
+ case POK_FunctionCall:
+ llvm_unreachable("Only works for variables");
+ break;
+ }
PartialDiagnosticAt Warning(Loc, S.PDiag(DiagID)
<< D << getLockKindFromAccessKind(AK));
Warnings.emplace_back(std::move(Warning), getNotes());
diff --git a/etc/mtree/BSD.root.dist b/etc/mtree/BSD.root.dist
index d5ef29c51a92..274397769cac 100644
--- a/etc/mtree/BSD.root.dist
+++ b/etc/mtree/BSD.root.dist
@@ -105,7 +105,7 @@
untrusted tags=package=caroot
..
..
- sysctl.kld.d tags=package=runtime
+ sysctl.kld.d tags=package=rc
..
syslog.d tags=package=syslogd
..
diff --git a/include/unistd.h b/include/unistd.h
index 797eac4c364d..290bcce6a0b3 100644
--- a/include/unistd.h
+++ b/include/unistd.h
@@ -518,6 +518,7 @@ int execvpe(const char *, char * const *, char * const *);
int feature_present(const char *);
int fchroot(int);
char *fflagstostr(u_long);
+ssize_t freadlink(int fd, char *buf, size_t bufsize);
int getdomainname(char *, int);
int getentropy(void *, size_t);
int getgrouplist(const char *, gid_t, gid_t *, int *);
diff --git a/lib/geom/part/gpart.8 b/lib/geom/part/gpart.8
index 32a247529dfe..89bfc3be6f8a 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 April 20, 2026
+.Dd May 9, 2026
.Dt GPART 8
.Os
.Sh NAME
@@ -1527,7 +1527,7 @@ zvol will show up as a GEOM provider only if its
.Sy volmode
is set properly
.Po refer to
-.Xr zfsprops 8
+.Xr zfsprops 7
for details
.Pc .
.El
diff --git a/lib/libc/gen/Makefile.inc b/lib/libc/gen/Makefile.inc
index c31f789fd1d1..18a68902f50a 100644
--- a/lib/libc/gen/Makefile.inc
+++ b/lib/libc/gen/Makefile.inc
@@ -56,6 +56,7 @@ SRCS+= \
fmtmsg.c \
fnmatch.c \
fpclassify.c \
+ freadlink.c \
frexp.c \
fstab.c \
ftok.c \
diff --git a/lib/libc/gen/Symbol.map b/lib/libc/gen/Symbol.map
index 60f34b3a1923..4d22251f7ec5 100644
--- a/lib/libc/gen/Symbol.map
+++ b/lib/libc/gen/Symbol.map
@@ -475,6 +475,7 @@ FBSD_1.8 {
};
FBSD_1.9 {
+ freadlink;
posix_spawn_file_actions_addchdir;
posix_spawn_file_actions_addfchdir;
posix_spawnattr_getexecfd_np;
diff --git a/lib/libc/gen/freadlink.c b/lib/libc/gen/freadlink.c
new file mode 100644
index 000000000000..e1ed7aba6c06
--- /dev/null
+++ b/lib/libc/gen/freadlink.c
@@ -0,0 +1,16 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright 2026 The FreeBSD Foundation
+ *
+ * This software were developed by Konstantin Belousov <kib@FreeBSD.org>
+ * under sponsorship from the FreeBSD Foundation.
+ */
+
+#include <unistd.h>
+
+ssize_t
+freadlink(int fd, char *buf, size_t bufsize)
+{
+ return (readlinkat(fd, "", buf, bufsize));
+}
diff --git a/lib/libc/gen/posix_spawn.c b/lib/libc/gen/posix_spawn.c
index 11cdb5a29d03..faddb0d1494f 100644
--- a/lib/libc/gen/posix_spawn.c
+++ b/lib/libc/gen/posix_spawn.c
@@ -424,7 +424,7 @@ posix_spawn_file_actions_init(posix_spawn_file_actions_t *ret)
fa = malloc(sizeof(struct __posix_spawn_file_actions));
if (fa == NULL)
- return (-1);
+ return (errno);
STAILQ_INIT(&fa->fa_list);
*ret = fa;
diff --git a/lib/msun/Makefile b/lib/msun/Makefile
index a9b07babc0a6..5e9adb533760 100644
--- a/lib/msun/Makefile
+++ b/lib/msun/Makefile
@@ -88,7 +88,7 @@ COMMON_SRCS= b_tgamma.c \
s_lround.c s_lroundf.c s_lroundl.c s_modff.c \
s_nan.c s_nearbyint.c s_nextafter.c s_nextafterf.c \
s_nexttowardf.c s_remquo.c s_remquof.c \
- s_rint.c s_rintf.c s_round.c s_roundf.c \
+ s_rint.c s_rintf.c s_round.c s_roundf.c s_rsqrt.c s_rsqrtf.c \
s_scalbln.c s_scalbn.c s_scalbnf.c s_signbit.c \
s_signgam.c s_significand.c s_significandf.c s_sin.c \
s_sincos.c s_sincosf.c s_sinf.c \
@@ -143,7 +143,7 @@ COMMON_SRCS+= b_tgammal.c catrigl.c \
s_fminimum_numl.c s_fminimum_mag_numl.c \
s_frexpl.c s_logbl.c s_logl.c s_nanl.c \
s_nextafterl.c s_nexttoward.c s_remquol.c s_rintl.c s_roundl.c \
- s_scalbnl.c s_sinl.c s_sincosl.c s_sinpil.c \
+ s_scalbnl.c s_sinl.c s_sincosl.c s_sinpil.c s_rsqrtl.c \
s_tanhl.c s_tanl.c s_tanpil.c s_truncl.c w_cabsl.c
# Work around this warning from gcc:
# lib/msun/ld80/e_powl.c:275:1: error: floating constant exceeds range of
@@ -289,7 +289,7 @@ MLINKS+=sincos.3 sincosf.3 sin.3 sincosl.3
MLINKS+=sinh.3 sinhf.3 sinh.3 sinhl.3
MLINKS+=sinpi.3 sinpif.3 sinpi.3 sinpil.3
MLINKS+=sqrt.3 cbrt.3 sqrt.3 cbrtf.3 sqrt.3 cbrtl.3 sqrt.3 sqrtf.3 \
- sqrt.3 sqrtl.3
+ sqrt.3 sqrtl.3 sqrt.3 rsqrt.3 sqrt.3 rsqrtf.3 sqrt.3 rsqrtl.3
MLINKS+=tan.3 tanf.3 tan.3 tanl.3
MLINKS+=tanh.3 tanhf.3 tanh.3 tanhl.3
MLINKS+=tanpi.3 tanpif.3 tanpi.3 tanpil.3
diff --git a/lib/msun/Symbol.map b/lib/msun/Symbol.map
index 00222c960f80..2484cc13013b 100644
--- a/lib/msun/Symbol.map
+++ b/lib/msun/Symbol.map
@@ -344,4 +344,7 @@ FBSD_1.9 {
fminimum_mag_num;
fminimum_mag_numf;
fminimum_mag_numl;
+ rsqrt;
+ rsqrtf;
+ rsqrtl;
};
diff --git a/lib/msun/man/sqrt.3 b/lib/msun/man/sqrt.3
index f4a217353af0..6da6407ecc4b 100644
--- a/lib/msun/man/sqrt.3
+++ b/lib/msun/man/sqrt.3
@@ -25,17 +25,20 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd February 15, 2020
+.Dd May 7, 2026
.Dt SQRT 3
.Os
.Sh NAME
.Nm cbrt ,
.Nm cbrtf ,
.Nm cbrtl ,
+.Nm rsqrt ,
+.Nm rsqrtf ,
+.Nm rsqrtl,
.Nm sqrt ,
.Nm sqrtf ,
.Nm sqrtl
-.Nd cube root and square root functions
+.Nd cube root, square root, and inverse square root functions
.Sh LIBRARY
.Lb libm
.Sh SYNOPSIS
@@ -47,6 +50,12 @@
.Ft long double
.Fn cbrtl "long double x"
.Ft double
+.Fn rsqrt "double x"
+.Ft float
+.Fn rsqrtf "float x"
+.Ft long double
+.Fn rsqrtl "long double x"
+.Ft double
.Fn sqrt "double x"
.Ft float
.Fn sqrtf "float x"
@@ -63,6 +72,15 @@ the cube root of
.Fa x .
.Pp
The
+.Fn rsqrt ,
+.Fn rsqrtf ,
+and
+.Fn rsqrtl
+functions compute
+the inverse square root of
+.Fa x .
+.Pp
+The
.Fn sqrt ,
.Fn sqrtf ,
and
@@ -77,6 +95,23 @@ The
and
.Fn cbrtl
functions return the requested cube root.
+.Pp
+The
+.Fn rsqrt ,
+.Fn rsqrtf ,
+and
+.Fn rsqrtl
+functions return 1 divided by the square root of
+.Fa x
+unless an error occurs.
+An attempt to take the
+.Fn rsqrt
+of negative
+.Fa x
+raises an invalid exception and causes an \*(Na to be returned.
+The inverse square root of \*(Pm0 returns \*(Pm\(if and
+raises a divide-by-zero exception.
+.Pp
The
.Fn sqrt ,
.Fn sqrtf ,
@@ -104,6 +139,13 @@ and
.Fn sqrtl
functions conform to
.St -isoC-99 .
+The
+.Fn rsqrt ,
+.Fn rsqrtf ,
+and
+.Fn rsqrtl
+functions conform to ISO/IEC 9899:2024 ("ISO C23").
+.\" .St -isoC-24 .
.Sh HISTORY
The
.Fn cbrt
@@ -120,3 +162,10 @@ The
.Fn cbrtl
function appeared in
.Fx 9.0 .
+The
+.Fn rsqrt ,
+.Fn rsqrtf ,
+and
+.Fn rsqrtl
+functions appeared in
+.Fx 16.0 .
diff --git a/lib/msun/src/math.h b/lib/msun/src/math.h
index 9894401160d4..e5c2ccb786a4 100644
--- a/lib/msun/src/math.h
+++ b/lib/msun/src/math.h
@@ -544,6 +544,9 @@ long double fminimum_mag_numl(long double, long double);
double fminimum_num(double, double);
float fminimum_numf(float, float);
long double fminimum_numl(long double, long double);
+double rsqrt(double);
+float rsqrtf(float);
+long double rsqrtl(long double);
#endif /* __ISO_C_VISIBLE >= 2023 */
__END_DECLS
diff --git a/lib/msun/src/math_private.h b/lib/msun/src/math_private.h
index fbd84e246ca7..e9055a9a8c61 100644
--- a/lib/msun/src/math_private.h
+++ b/lib/msun/src/math_private.h
@@ -472,6 +472,89 @@ do { \
} while (0)
/*
+ * Split x into high and low bits where CC is 0x1p(N/2) + 1 where
+ * N is rounded up for types with odd precisions.
+ *
+ * #define _CC (0x1p12F + 1) // float
+ * #define _CC (0x1p27 + 1) // double
+ * #define _CC (0x1p32L + 1) // long double (LD80)
+ * #define _CC (0x1p57L + 1) // long double (LD128)
+ */
+#define _SPLIT(x, xh, xl) \
+do { \
+ typeof(x) __t1; \
+ __t1 = (x) * _CC; \
+ xh = __t1 + ((x) - __t1); \
+ xl = (x) - xh; \
+} while(0)
+
+/*
+ * FAST2SUM requires |x| >= |y|. x and y are full precision.
+ * Note, _2SUMF(x,y) above destroys x and y.
+ */
+#define _FAST2SUM(x, y, hi, lo) \
+do { \
+ hi = (x) + (y); \
+ lo = (y) - (hi - (x)); \
+} while(0)
+
+/*
+ * SLOW2SUM does not require |x| >= |y|. Here, x and y are full precision.
+ * The t1 temporary variable is volatile to prevent compiler optimizations.
+ * Note, _2SUM(x,y) above destroys x and y.
+ */
+#define _SLOW2SUM(x, y, hi, lo) \
+do { \
+ volatile typeof(x) __t1; \
+ typeof(x) __t2; \
+ hi = (x) + (y); \
+ __t1 = hi - (y); \
+ __t2 = hi - __t1; \
+ lo = ((x) - __t1) + ((y) - __t2); \
+} while(0)
+
+/*
+ * x and y are full precision quantities that have been split into high
+ * and low parts via the _SPLIT macro. x and y are added to give z as
+ * high and low parts.
+ */
+#define _XADD(xh, xl, yh, yl, zh, zl) \
+do { \
+ typeof(xh) __s1, __s2, __s3, __s4, __s5, __s6; \
+ _SLOW2SUM(xh, yh, __s1, __s2); \
+ _SLOW2SUM(xl, yl, __s3, __s4); \
+ _FAST2SUM(__s1, __s2 + __s3, __s5, __s6); \
+ _FAST2SUM(__s5, __s6 + __s4, zh, zl); \
+} while(0)
+
+/*
+ * x and y are full precision quantities. r1 and r2 are full precision
+ * high and low parts of the multiplication x * y.
+ */
+#define _MUL(x, y, r1 ,r2) \
+do { \
+ typeof(x) __xh, __xl, __yh, __yl; \
+ typeof(x) __t1; \
+ _SPLIT(x, __xh, __xl); \
+ _SPLIT(y, __yh, __yl); \
+ r1 = (x) * (y); \
+ __t1 = __xh * __yl + (__xh * __yh - r1); \
+ r2 = __xl * __yl + (__xl * __yh + __t1); \
+} while(0)
+
+/*
+ * x and y are full precision quantities that have been split into high
+ * and low parts via the _SPLIT macro. x and y are multiplied to give z
+ * as high and low parts.
+ */
+#define _XMUL(xh, xl, yh, yl, ph, pl) \
+do { \
+ _MUL(xh, yh, ph, pl); \
+ pl += xl * yl + xl * yh + xh * yl; \
+} while(0)
+
+
+/*
* Common routine to process the arguments to nan(), nanf(), and nanl().
*/
void _scan_nan(uint32_t *__words, int __num_words, const char *__s);
diff --git a/lib/msun/src/s_rsqrt.c b/lib/msun/src/s_rsqrt.c
new file mode 100644
index 000000000000..0a513afe8ed2
--- /dev/null
+++ b/lib/msun/src/s_rsqrt.c
@@ -0,0 +1,153 @@
+/*-
+ * Copyright (c) 2026 Steven G. Kargl
+ * All rights reserved.
+ *
+ * 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 unmodified, 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 ``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 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.
+ */
+
+/**
+ * Compute the inverse sqrt of x, i.e., rsqrt(x) = 1 / sqrt(x).
+ *
+ * First, filter out special cases:
+ *
+ * 1. rsqrt(+-0) = +-inf, and raise FE_DIVBYZERO exception.
+ * 2. rsqrt(nan) = NaN.
+ * 3. rsqrt(+inf) returns +0.
+ * 2. rsqrt(x<0) = NaN, and raises FE_INVALID.
+ *
+ * If x is a subnormal, scale x into the normal range by x*0x1pN; while
+ * recording the exponent of the scale factor N. Split the possibly
+ * scaled x into f*2^n with f in [0.5,1). Set m=n or m=n-N (subnormal).
+ * If n is odd, then set f = f/2 and increase n to n+1. Thus, f is
+ * in [0.25,1) with n even.
+ *
+ * An initial estimate of y = rqrt[f](x) is 1 / sqrt[f](x). Exhaustive
+ * testing of rsqrtf() gave a max ULP of 1.49; while testing 500M x in
+ * [0,1000] gave a max ULP of 1.24 for rsqrt(). The value of y is then
+ * used with one iteration of Goldschmidt's algorithm:
+ *
+ * z = x * y
+ * h = y / 2
+ * r = 0.5 - h * z
+ * y = h * r + h
+ *
+ * A factor of 2 appears missing in the above, but it is included in the
+ * exponent m.
+ */
+#include <fenv.h>
+#include <float.h>
+#include "math.h"
+#include "math_private.h"
+
+#pragma STDC FENV_ACCESS ON
+
+#ifdef _CC
+#undef _CC
+#endif
+#define _CC (0x1p27 + 1)
+
+double
+rsqrt(double x)
+{
+ volatile static const double vzero = 0;
+ static const double half = 0.5;
+ int hx, m, rnd;
+ uint32_t lx, ux;
+ double h, ph, pl, rh, rl, y, zh, zl;
+
+ EXTRACT_WORDS(hx, lx, x);
+ ux = (uint32_t)hx & 0x7fffffff;
+
+ /* x = +-0. Raise exception. */
+ if ((ux | lx) == 0)
+ return (1 / x);
+
+ /* x is NaN. */
+ if (ux > 0x7ff00000)
+ return (x + x);
+
+ /* x is +-inf. */
+ if (ux == 0x7ff00000)
+ return (hx & 0x80000000 ? vzero / vzero : 0.);
+
+ /* x < 0. Raise exception. */
+ if (hx < 0)
+ return (vzero / vzero);
+
+ /*
+ * If x is subnormal, then scale it into the normal range.
+ * Split x into significand and exponent, x = f * 2^m, with
+ * f in [0.5,1) and m a biased exponent.
+ */
+ m = 0;
+ if (hx < 0x00100000) { /* Subnormal */
+ x *= 0x1p54;
+ GET_HIGH_WORD(hx, x);
+ m = -54;
+ }
+ m += (hx >> 20) - 1022;
+ hx = (hx & 0x000fffff) | 0x3fe00000;
+ SET_HIGH_WORD(x, hx);
+
+ /* m is odd. Put x into [0.25,5) and increase m. */
+ if (m & 1) {
+ x /= 2;
+ m += 1;
+ }
+ m = -(m >> 1); /* Prepare for 2^(-m/2). */
+
+ y = 1 / sqrt(x); /* ~52-bit estimate. */
+
+ h = y / 2;
+
+ /*
+ * For values of x with a representation of 0x1.ffffffffffffepN
+ * with N an odd integer, the computed rsqrt() is not correctly
+ * rounded in round-to-nearest without toggling the rounding mode
+ * to FE_TOWARDZERO. Note, FE_DOWNWARD also works. However,
+ * messing with the rounding mode is expensive, so only do it
+ * when necessary. Example, x = 3.9999999999999991
+ * gives y --> hx = 0x3ff00000, lx = 0x00000001
+ */
+ EXTRACT_WORDS(hx, lx, y);
+ if ((hx & 0x000fffff) == 0 && lx == 1) {
+ rnd = fegetround();
+ fesetround(FE_TOWARDZERO);
+ _MUL(x, y, zh, zl);
+ _XMUL(zh, zl, h, 0, ph, pl);
+ fesetround(rnd);
+ } else {
+ _MUL(x, y, zh, zl);
+ _XMUL(zh, zl, h, 0, ph, pl);
+ }
+
+ _XADD(-ph, -pl, half, 0, rh, rl);
+ y = rh * h + h;
+
+ ux = (m + 1024) << 20;
+ INSERT_WORDS(x, ux, 0);
+ return (y *= x);
+}
+
+#if LDBL_MANT_DIG == 53
+__weak_reference(rsqrt, rsqrtl);
+#endif
diff --git a/lib/msun/src/s_rsqrtf.c b/lib/msun/src/s_rsqrtf.c
new file mode 100644
index 000000000000..b71f7baf5657
--- /dev/null
+++ b/lib/msun/src/s_rsqrtf.c
@@ -0,0 +1,155 @@
+/*-
+ * Copyright (c) 2026 Steven G. Kargl
+ * All rights reserved.
+ *
+ * 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 unmodified, 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 ``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 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.
+ */
+
+/**
+ * Compute the inverse sqrt of x, i.e., rsqrt(x) = 1 / sqrt(x).
+ *
+ * First, filter out special cases:
+ *
+ * 1. rsqrt(+-0) = +-inf, and raise FE_DIVBYZERO exception.
+ * 2. rsqrt(nan) = NaN.
+ * 3. rsqrt(+inf) returns +0.
+ * 2. rsqrt(x<0) = NaN, and raises FE_INVALID.
+ *
+ * If x is a subnormal, scale x into the normal range by x*0x1pN; while
+ * recording the exponent of the scale factor N. Split the possibly
+ * scaled x into f*2^n with f in [0.5,1). Set m=n or m=n-N (subnormal).
+ * If n is odd, then set f = f/2 and increase n to n+1. Thus, f is
+ * in [0.25,1) with n even.
+ *
+ * An initial estimate of y = rqrt[f](x) is 1 / sqrt[f](x). Exhaustive
+ * testing of rsqrtf() gave a max ULP of 1.49; while testing 500M x in
+ * [0,1000] gave a max ULP of 1.24 for rsqrt(). The value of y is then
+ * used with one iteration of Goldschmidt's algorithm:
+ *
+ * z = x * y
+ * h = y / 2
+ * r = 0.5 - h * z
+ * y = h * r + h
+ *
+ * A factor of 2 appears missing in the above, but it is included in the
+ * exponent m.
+ */
+#include <fenv.h>
+#include <float.h>
+#include "math.h"
+#include "math_private.h"
+
+#pragma STDC FENV_ACCESS ON
+
+#ifdef _CC
+#undef _CC
+#endif
+#define _CC (0x1p12F + 1)
+
+float
+rsqrtf(float x)
+{
+ volatile static const float vzero = 0;
+ static const float half = 0.5;
+ uint32_t ix, ux;
+ int m, rnd;
+ float h, ph, pl, rh, rl, y, zh, zl;
+
+ GET_FLOAT_WORD(ix, x);
+ ux = ix & 0x7fffffff;
+
+ /* x = +-0. Raise exception. */
+ if (ux == 0)
+ return (1 / x);
+
+ /* x is NaN. */
+ if (ux > 0x7f800000)
+ return (x + x);
+
+ /* x is +-inf. */
+ if (ux == 0x7f800000)
+ return (ix & 0x80000000 ? vzero / vzero : 0.F);
+
+ /* x < 0. Raise exception. */
+ if (ix & 0x80000000)
+ return (vzero / vzero);
+
+ /*
+ * If x is subnormal, then scale it into the normal range.
+ * Split x into significand and exponent, x = f * 2^m, with
+ * f in [0.5,1) and m a biased exponent.
+ */
+ m = 0;
+ if (ux < 0x00800000) { /* Subnormal */
+ x *= 0x1p25f;
+ GET_FLOAT_WORD(ix, x);
+ m = -25;
+ }
+ m += (ix >> 23) - 126; /* Unbiased exponent */
+ ix = (ix & 0x007fffff) | 0x3f000000;
+ SET_FLOAT_WORD(x, ix); /* x is in [0.5,1). */
+
+ /* m is odd. Put x into [0.25,5) and increase m. */
+ if (m & 1) {
+ x /= 2;
+ m += 1;
+ }
+ m = -(m >> 1); /* Prepare for 2^(-m/2). */
+
+ /*
+ * Exhaustive testing of rsqrtf(x) = 1 / sqrtf(x) with x in
+ * [0x1p-127,0x1p126] shows the this approximation gives a
+ * 22- to 23-bit estimate of rsqrt(f). This is equivalent to
+ * a max ulp of ~1.49.
+ */
+ y = 1 / sqrtf(x);
+
+ h = y / 2;
+
+ /*
+ * For values of x with a representation of 0x1.fffffcpN with
+ * N an odd integer, the computed rsqrtf() is not correctly
+ * rounded in round-to-nearest without toggling the rounding
+ * mode to FE_TOWARDZERO. Note, FE_DOWNWARD also works.
+ * However, messing with the rounding mode is expensive, so
+ * only do it when necessary. Example, x = 0x1.fffffcp3 gives
+ * y --> 0x3f800001.
+ */
+ GET_FLOAT_WORD(ix, y);
+ if ((ix & 0x000fffff) == 1) {
+ rnd = fegetround();
+ fesetround(FE_TOWARDZERO);
+ _MUL(x, y, zh, zl);
+ _XMUL(zh, zl, h, 0, ph, pl);
+ fesetround(rnd);
+ } else {
+ _MUL(x, y, zh, zl);
+ _XMUL(zh, zl, h, 0, ph, pl);
+ }
+
+ _XADD(-ph, -pl, half, 0, rh, rl);
+ y = h * rh + h;
+
+ ix = (uint32_t)(m + 128) << 23;
+ SET_FLOAT_WORD(x, ix);
+ return (y *= x);
+}
diff --git a/lib/msun/src/s_rsqrtl.c b/lib/msun/src/s_rsqrtl.c
new file mode 100644
index 000000000000..34d5cdc48173
--- /dev/null
+++ b/lib/msun/src/s_rsqrtl.c
@@ -0,0 +1,203 @@
+/*-
+ * Copyright (c) 2026 Steven G. Kargl
+ * All rights reserved.
+ *
+ * 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 unmodified, 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 ``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 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.
+ */
+
+/**
+ * Compute the inverse sqrt of x, i.e., rsqrt(x) = 1 / sqrt(x).
+ *
+ * First, filter out special cases:
+ *
+ * 1. rsqrt(+-0) = +-inf, and raise FE_DIVBYZERO exception.
+ * 2. rsqrt(nan) = NaN.
+ * 3. rsqrt(+inf) returns +0.
+ * 2. rsqrt(x<0) = NaN, and raises FE_INVALID.
+ *
+ * If x is a subnormal, scale x into the normal range by x*0x1pN; while
+ * recording the exponent of the scale factor N. Split the possibly
+ * scaled x into f*2^n with f in [0.5,1). Set m=n or m=n-N (subnormal).
+ * If n is odd, then set f = f/2 and increase n to n+1. Thus, f is
+ * in [0.25,1) with n even.
+ *
+ * An initial estimate of y = rqrt[f](x) is 1 / sqrt[f](x). Exhaustive
+ * testing of rsqrtf() gave a max ULP of 1.49; while testing 500M x in
+ * [0,1000] gave a max ULP of 1.24 for rsqrt(). The value of y is then
+ * used with one iteration of Goldschmidt's algorithm:
+ *
+ * z = x * y
+ * h = y / 2
+ * r = 0.5 - h * z
+ * y = h * r + h
+ *
+ * A factor of 2 appears missing in the above, but it is included in the
+ * exponent m.
+ */
+#include <fenv.h>
+#include <float.h>
+#include "math.h"
+#include "math_private.h"
+#include "fpmath.h"
+
+#pragma STDC FENV_ACCESS ON
+
+#if LDBL_MANT_DIG == 64
+
+#ifdef _CC
+#undef _CC
+#endif
+#define _CC (0x1p32L + 1)
+
+long double
+rsqrtl(long double x)
+{
+ volatile static const double vzero = 0;
+ static const double half = 0.5;
+ uint32_t ux;
+ int m, rnd;
+ long double h, ph, pl, rh, rl, y, zh, zl;
+ union IEEEl2bits u;
+
+ u.e = x;
+ ux = (u.bits.manl | u.bits.manh);
+
+ /* x = +-0. Raise exception. */
+ if ((u.bits.exp | ux) == 0)
+ return (1 / x);
+
+ /* x is NaN or x is +-inf. */
+ if (u.bits.exp == 0x7fff)
+ return (ux ? (x + x) : (u.bits.sign ? vzero / vzero : 0));
+
+ /* x < 0. Raise exception. */
+ if (u.bits.sign)
+ return (vzero / vzero);
+
+ /*
+ * If x is subnormal, then scale it into the normal range.
+ * Split x into significand and exponent, x = f * 2^m, with
+ * f in [0.5,1) and m a biased exponent.
+ */
+ ENTERI();
+
+ if (u.bits.exp == 0) { /* Subnormal */
+ u.e *= 0x1p512;
+ m = u.bits.exp - 0x41fe;
+ } else {
+ m = u.bits.exp - 0x3ffe;
+ }
+ u.bits.exp = 0x3ffe;
+
+ /* m is odd. Put x into [0.25,5) and increase m. */
+ if (m & 1) {
+ u.e /= 2;
+ m += 1;
+ }
+ m = -(m >> 1); /* Prepare for 2^(-m/2). */
+
+ y = 1 / sqrt((double)u.e); /* ~52-bit estimate. */
+ y -= y * (u.e * y * y - 1) / 2; /* ~63-bit estimate. */
+
+ h = y / 2;
+
+ _MUL(u.e, y, zh, zl);
+ _XMUL(zh, zl, h, 0, ph, pl);
+ _XADD(-ph, -pl, half, 0, rh, rl);
+ y = rh * h + h;
+
+ u.e = 1;
+ u.xbits.expsign = 0x3fff + m + 1;
+ RETURNI(y * u.e);
+}
+
+#else
+
+#ifdef _CC
+#undef _CC
+#endif
+#define _CC (0x1p57L + 1)
+
+long double
+rsqrtl(long double x)
+{
+ volatile static const double vzero = 0;
+ int hx, m, rnd;
+ long double y;
+
+ /* x = +-0. Raise exception. */
+ if (x == 0)
+ return (1 / x);
+
+ /* x is NaN. */
+ if (isnan(x))
+ return (x + x);
+
+ /* x is +-inf. */
+ if (isinf(x))
+ return (x > 0 ? 0 : vzero / vzero);
+
+ /* x < 0. Raise exception. */
+ if (x < 0)
+ return (vzero / vzero);
+
+ /*
+ * If x is subnormal, then scale it into the normal range.
+ * Split x into significand and exponent, x = f * 2^m, with
+ * f in [0.5,1) and m a biased exponent.
+ */
+ m = 0;
+ if (!isnormal(x)) {
+ x *= 0x1p114L;
+ m = -114;
+ }
+ x = frexpl(x, &hx);
+ m += hx;
+
+ /* m is odd. Put x into [0.25,5) and increase m. */
+ if (m & 1) {
+ x /= 2;
+ m += 1;
+ }
+ m = -(m >> 1); /* Prepare for 2^(-m/2). */
+
+ y = 1 / sqrt((double)x); /* ~52-bit estimate. */
+ y -= y * (x * y * y - 1) / 2; /* ~104-bit estimate. */
+
+ static const double half = 0.5;
+ long double h, ph, pl, rh, rl, zh, zl;
+
+ h = y / 2;
+
+ rnd = fegetround();
+ fesetround(FE_TOWARDZERO);
+ _MUL(x, y, zh, zl);
+ _XMUL(zh, zl, -h, 0, ph, pl);
+ fesetround(rnd);
+
+ _XADD(ph, pl, half, 0, rh, rl);
+ y = rh * h + h;
+ m++;
+
+ RETURNI(ldexpl(y, m));
+}
+#endif
diff --git a/libexec/nuageinit/tests/Makefile b/libexec/nuageinit/tests/Makefile
index dc8997717b59..fc7765268660 100644
--- a/libexec/nuageinit/tests/Makefile
+++ b/libexec/nuageinit/tests/Makefile
@@ -18,5 +18,9 @@ ${PACKAGE}FILES+= sethostname.lua
${PACKAGE}FILES+= settimezone.lua
${PACKAGE}FILES+= warn.lua
${PACKAGE}FILES+= addfile.lua
+${PACKAGE}FILES+= decode_base64.lua
+${PACKAGE}FILES+= addsudo.lua
+${PACKAGE}FILES+= adddoas.lua
+${PACKAGE}FILES+= update_sshd_config.lua
.include <bsd.test.mk>
diff --git a/libexec/nuageinit/tests/adddoas.lua b/libexec/nuageinit/tests/adddoas.lua
new file mode 100644
index 000000000000..d4bab41ecc3d
--- /dev/null
+++ b/libexec/nuageinit/tests/adddoas.lua
@@ -0,0 +1,64 @@
+#!/usr/libexec/flua
+---
+-- SPDX-License-Identifier: BSD-2-Clause
+--
+-- Copyright (c) 2026 Baptiste Daroussin <bapt@FreeBSD.org>
+
+local n = require("nuage")
+
+local root = os.getenv("NUAGE_FAKE_ROOTDIR")
+if not root then
+ root = ""
+end
+
+local function get_localbase()
+ local f = io.popen("sysctl -in user.localbase 2> /dev/null")
+ local lb = f:read("*l")
+ f:close()
+ if lb == nil or lb:len() == 0 then
+ lb = "/usr/local"
+ end
+ return lb
+end
+
+local function read_doasconf()
+ local path = root .. get_localbase() .. "/etc/doas.conf"
+ local f = io.open(path, "r")
+ if not f then
+ return nil
+ end
+ local content = f:read("*a")
+ f:close()
+ return content
+end
+
+-- test with a single string rule with %u substitution
+n.adddoas({ name = "testuser", doas = "permit persist %u as root" })
+local content = read_doasconf()
+if not content then
+ n.err("doas.conf not created")
+end
+if content ~= "permit persist testuser as root\n" then
+ n.err("unexpected doas.conf content with %u: '" .. content .. "'")
+end
+
+-- remove file for next test
+os.remove(root .. get_localbase() .. "/etc/doas.conf")
+
+-- test with a table of rules
+n.adddoas({
+ name = "testuser",
+ doas = {
+ "deny %u as foobar",
+ "permit persist %u as root cmd whoami"
+ }
+})
+content = read_doasconf()
+if not content then
+ n.err("doas.conf not created for table")
+end
+if content ~= "deny testuser as foobar\npermit persist testuser as root cmd whoami\n" then
+ n.err("unexpected doas.conf content for table: '" .. content .. "'")
+end
+
+os.exit(0)
diff --git a/libexec/nuageinit/tests/addsudo.lua b/libexec/nuageinit/tests/addsudo.lua
new file mode 100644
index 000000000000..7fc5865d83f4
--- /dev/null
+++ b/libexec/nuageinit/tests/addsudo.lua
@@ -0,0 +1,61 @@
+#!/usr/libexec/flua
+---
+-- SPDX-License-Identifier: BSD-2-Clause
+--
+-- Copyright (c) 2026 Baptiste Daroussin <bapt@FreeBSD.org>
+
+local n = require("nuage")
+
+local root = os.getenv("NUAGE_FAKE_ROOTDIR")
+if not root then
+ root = ""
+end
+
+local function get_localbase()
+ local f = io.popen("sysctl -in user.localbase 2> /dev/null")
+ local lb = f:read("*l")
+ f:close()
+ if lb == nil or lb:len() == 0 then
+ lb = "/usr/local"
+ end
+ return lb
+end
+
+local function read_sudoers()
+ local path = root .. get_localbase() .. "/etc/sudoers.d/90-nuageinit-users"
+ local f = io.open(path, "r")
+ if not f then
+ return nil
+ end
+ local content = f:read("*a")
+ f:close()
+ return content
+end
+
+-- test with a single string rule
+n.addsudo({ name = "testuser", sudo = "ALL=(ALL) NOPASSWD:ALL" })
+local content = read_sudoers()
+if not content then
+ n.err("sudoers file not created")
+end
+if content ~= "testuser ALL=(ALL) NOPASSWD:ALL\n" then
+ n.err("unexpected sudoers content for string rule: '" .. content .. "'")
+end
+
+-- remove file for next test
+os.remove(root .. get_localbase() .. "/etc/sudoers.d/90-nuageinit-users")
+
+-- test with a table of rules
+n.addsudo({
+ name = "testuser",
+ sudo = { "ALL=(ALL) NOPASSWD:/usr/sbin/pw", "ALL=(ALL) ALL" }
+})
+content = read_sudoers()
+if not content then
+ n.err("sudoers file not created for table")
+end
+if content ~= "testuser ALL=(ALL) NOPASSWD:/usr/sbin/pw\ntestuser ALL=(ALL) ALL\n" then
+ n.err("unexpected sudoers content for table: '" .. content .. "'")
+end
+
+os.exit(0)
diff --git a/libexec/nuageinit/tests/decode_base64.lua b/libexec/nuageinit/tests/decode_base64.lua
new file mode 100644
index 000000000000..0951d77f0ed7
--- /dev/null
+++ b/libexec/nuageinit/tests/decode_base64.lua
@@ -0,0 +1,61 @@
+#!/usr/libexec/flua
+---
+-- SPDX-License-Identifier: BSD-2-Clause
+--
+-- Copyright (c) 2026 Baptiste Daroussin <bapt@FreeBSD.org>
+
+local n = require("nuage")
+
+-- decode_base64 is not exported, test via addfile
+
+local function test_decode(input, expected)
+ local r, err = n.addfile({
+ content = input,
+ encoding = "base64",
+ path = "/tmp/nuage_test_b64"
+ }, false)
+ if not r then
+ n.err(err)
+ end
+ local root = os.getenv("NUAGE_FAKE_ROOTDIR")
+ if not root then
+ root = ""
+ end
+ local f = assert(io.open(root .. "/tmp/nuage_test_b64", "r"))
+ local str = f:read("*all")
+ f:close()
+ if str ~= expected then
+ n.err("base64 decode failed: expected '" .. expected
+ .. "' got '" .. str .. "'")
+ end
+end
+
+-- empty input
+test_decode("", "")
+
+-- single byte: 'a'
+test_decode("YQ==", "a")
+
+-- two bytes: 'ab'
+test_decode("YWI=", "ab")
+
+-- three bytes: 'abc'
+test_decode("YWJj", "abc")
+
+-- newline in base64
+test_decode("YmxhCg==", "bla\n")
+
+-- spaces should be ignored
+test_decode("Y Q = =", "a")
+
+-- b64 alias
+local r, err = n.addfile({
+ content = "YQ==",
+ encoding = "b64",
+ path = "/tmp/nuage_test_b64_b64"
+}, false)
+if not r then
+ n.err("b64 encoding alias should work: " .. tostring(err))
+end
+
+os.exit(0)
diff --git a/libexec/nuageinit/tests/nuage.sh b/libexec/nuageinit/tests/nuage.sh
index 57d83b62928a..348a8d93ba09 100644
--- a/libexec/nuageinit/tests/nuage.sh
+++ b/libexec/nuageinit/tests/nuage.sh
@@ -14,6 +14,10 @@ atf_test_case adduser
atf_test_case adduser_passwd
atf_test_case addgroup
atf_test_case addfile
+atf_test_case decode_base64
+atf_test_case addsudo
+atf_test_case adddoas
+atf_test_case update_sshd_config
settimezone_body()
{
@@ -90,6 +94,28 @@ addfile_body()
atf_check /usr/libexec/flua $(atf_get_srcdir)/addfile.lua
}
+decode_base64_body()
+{
+ mkdir tmp
+ atf_check /usr/libexec/flua $(atf_get_srcdir)/decode_base64.lua
+}
+
+addsudo_body()
+{
+ atf_check /usr/libexec/flua $(atf_get_srcdir)/addsudo.lua
+}
+
+adddoas_body()
+{
+ atf_check /usr/libexec/flua $(atf_get_srcdir)/adddoas.lua
+}
+
+update_sshd_config_body()
+{
+ mkdir -p etc/ssh
+ atf_check /usr/libexec/flua $(atf_get_srcdir)/update_sshd_config.lua
+}
+
atf_init_test_cases()
{
atf_add_test_case sethostname
@@ -98,4 +124,8 @@ atf_init_test_cases()
atf_add_test_case adduser_passwd
atf_add_test_case addgroup
atf_add_test_case addfile
+ atf_add_test_case decode_base64
+ atf_add_test_case addsudo
+ atf_add_test_case adddoas
+ atf_add_test_case update_sshd_config
}
diff --git a/libexec/nuageinit/tests/update_sshd_config.lua b/libexec/nuageinit/tests/update_sshd_config.lua
new file mode 100644
index 000000000000..ac56c29986ac
--- /dev/null
+++ b/libexec/nuageinit/tests/update_sshd_config.lua
@@ -0,0 +1,73 @@
+#!/usr/libexec/flua
+---
+-- SPDX-License-Identifier: BSD-2-Clause
+--
+-- Copyright (c) 2026 Baptiste Daroussin <bapt@FreeBSD.org>
+
+local n = require("nuage")
+
+local root = os.getenv("NUAGE_FAKE_ROOTDIR")
+if not root then
+ root = ""
+end
+
+local sshd_config = root .. "/etc/ssh/sshd_config"
+
+local function setup(content)
+ local dir = root .. "/etc/ssh"
+ n.mkdir_p(dir)
+ local f = assert(io.open(sshd_config, "w"))
+ f:write(content)
+ f:close()
+end
+
+local function read_config()
+ local f = assert(io.open(sshd_config, "r"))
+ local content = f:read("*a")
+ f:close()
+ return content
+end
+
+-- Key not found: appended
+setup("SomeOtherKey yes\n")
+n.update_sshd_config("PasswordAuthentication", "yes")
+if read_config() ~= "SomeOtherKey yes\nPasswordAuthentication yes\n" then
+ n.err("Key not found: should be appended")
+end
+
+-- Key with same value: no change
+setup("PasswordAuthentication yes\n")
+n.update_sshd_config("PasswordAuthentication", "yes")
+if read_config() ~= "PasswordAuthentication yes\n" then
+ n.err("Same value: should not change")
+end
+
+-- Key with different value: changed
+setup("PasswordAuthentication no\n")
+n.update_sshd_config("PasswordAuthentication", "yes")
+if read_config() ~= "PasswordAuthentication yes\n" then
+ n.err("Different value: should change")
+end
+
+-- Key with comment
+setup("PasswordAuthentication no # keep this\n")
+n.update_sshd_config("PasswordAuthentication", "yes")
+if read_config() ~= "PasswordAuthentication yes\n" then
+ n.err("Comment stripped: '" .. read_config() .. "'")
+end
+
+-- Case insensitive key matching
+setup("passwordauthentication no\n")
+n.update_sshd_config("PasswordAuthentication", "yes")
+if read_config() ~= "PasswordAuthentication yes\n" then
+ n.err("Case insensitive matching failed")
+end
+
+-- Extra spaces
+setup(" PasswordAuthentication no \n")
+n.update_sshd_config("PasswordAuthentication", "yes")
+if read_config() ~= "PasswordAuthentication yes\n" then
+ n.err("Extra spaces handling failed: '" .. read_config() .. "'")
+end
+
+os.exit(0)
diff --git a/sbin/fsck_msdosfs/fat.c b/sbin/fsck_msdosfs/fat.c
index 567bfcd428cb..5ead0b1bf783 100644
--- a/sbin/fsck_msdosfs/fat.c
+++ b/sbin/fsck_msdosfs/fat.c
@@ -927,6 +927,17 @@ readfat(int fs, struct bootblock *boot, struct fat_descriptor **fp)
default:
break;
}
+ /*
+ * In cache mode the header lives in
+ * fat32_cache_allentries[0]. Mark it
+ * dirty so it is flushed to disk (either
+ * on eviction or in writefat()) before
+ * copyfat() copies the primary FAT to
+ * backup copies.
+ */
+ if (fat->use_cache)
+ fat->fat32_cache_allentries[0].dirty =
+ true;
}
}
}
diff --git a/share/man/man4/rge.4 b/share/man/man4/rge.4
index 24c42f9106dc..5e338ebf9c87 100644
--- a/share/man/man4/rge.4
+++ b/share/man/man4/rge.4
@@ -3,7 +3,7 @@
.\"
.\" SPDX-License-Identifier: BSD-2-Clause
.\"
-.Dd April 5, 2026
+.Dd May 11, 2026
.Dt RGE 4
.Os
.Sh NAME
@@ -137,6 +137,8 @@ RealTek RTL8126 (up to 5 Gbps)
RealTek RTL8127 (up to 10 Gbps)
.It
Killer E3000 (up to 2.5 Gbps)
+.It
+Killer E5000 (up to 5 Gbps)
.El
.Sh SYSCTL VARIABLES
The following variables are available as both
diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile
index 29c822c10eb2..fbb981891ce4 100644
--- a/share/man/man9/Makefile
+++ b/share/man/man9/Makefile
@@ -2333,6 +2333,7 @@ MLINKS+=uidinfo.9 uifind.9 \
uidinfo.9 uihold.9
MLINKS+=uio.9 uiomove.9 \
uio.9 uiomove_frombuf.9 \
+ uio.9 uiomove_fromphys.9 \
uio.9 uiomove_nofault.9
MLINKS+=unr.9 alloc_unr.9 \
unr.9 alloc_unrl.9 \
diff --git a/share/man/man9/uio.9 b/share/man/man9/uio.9
index b143eb6e8e62..a7563125a351 100644
--- a/share/man/man9/uio.9
+++ b/share/man/man9/uio.9
@@ -23,13 +23,14 @@
.\" (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 October 22, 2025
+.Dd May 7, 2026
.Dt UIO 9
.Os
.Sh NAME
.Nm uio ,
.Nm uiomove ,
.Nm uiomove_frombuf ,
+.Nm uiomove_fromphys ,
.Nm uiomove_nofault
.Nd device driver I/O routines
.Sh SYNOPSIS
@@ -37,25 +38,29 @@
.In sys/uio.h
.Bd -literal
struct uio {
- struct iovec *uio_iov; /* scatter/gather list */
- int uio_iovcnt; /* length of scatter/gather list */
- off_t uio_offset; /* offset in target object */
- ssize_t uio_resid; /* remaining bytes to copy */
- enum uio_seg uio_segflg; /* address space */
- enum uio_rw uio_rw; /* operation */
- struct thread *uio_td; /* owner */
+ struct iovec *uio_iov; /* scatter/gather list */
+ int uio_iovcnt; /* length of scatter/gather list */
+ off_t uio_offset; /* offset in target object */
+ ssize_t uio_resid; /* remaining bytes to process */
+ enum uio_seg uio_segflg; /* address space */
+ enum uio_rw uio_rw; /* operation */
+ struct thread *uio_td; /* owner */
};
.Ed
+.Pp
.Ft int
.Fn uiomove "void *buf" "int howmuch" "struct uio *uiop"
.Ft int
.Fn uiomove_frombuf "void *buf" "int howmuch" "struct uio *uiop"
.Ft int
+.Fn uiomove_fromphys "vm_page_t ma[]" "vm_offset_t offset" "int howmuch" "struct uio *uiop"
+.Ft int
.Fn uiomove_nofault "void *buf" "int howmuch" "struct uio *uiop"
.Sh DESCRIPTION
The functions
.Fn uiomove ,
.Fn uiomove_frombuf ,
+.Fn uiomove_fromphys ,
and
.Fn uiomove_nofault
are used to transfer data between buffers and I/O vectors that might
@@ -152,10 +157,27 @@ When
.Va uio_offset
is greater than or equal to the buffer size, the result is success
with no bytes transferred, effectively signaling EOF.
+.Pp
+The
+.Fn uiomove_fromphys
+function provides a machine-independent way to copy memory
+to and from the physical address space.
+The
+.Fa "ma[]"
+argument is an array of physical pages.
+Every physical page address in the array provides
+a page-sized chunk of the physical space.
+The
+.Fa "offset"
+argument is the offset into the
+.Fa "ma[]"
+array.
+In particular, the offset does not have to lie within the first page.
.Sh RETURN VALUES
On success
.Fn uiomove ,
.Fn uiomove_frombuf ,
+.Fn uiomove_fromphys ,
and
.Fn uiomove_nofault
will return 0; on error they will return an appropriate error code.
@@ -168,7 +190,7 @@ will not work (the buffer pointer is not being advanced in case of a
partial read), it is just here to demonstrate the
.Nm
handling.
-.Bd -literal
+.Bd -literal -offset 2n
/* MIN() can be found there: */
#include <sys/param.h>
@@ -200,7 +222,8 @@ fooread(struct cdev *dev, struct uio *uio, int flag)
}
.Ed
.Sh ERRORS
-.Fn uiomove
+.Fn uiomove ,
+.Fn uiomove_fromphys
and
.Fn uiomove_nofault
will fail and return the following error code if:
@@ -211,7 +234,7 @@ The invoked
or
.Xr copyout 9
returned
-.Er EFAULT
+.Er EFAULT .
.El
.Pp
In addition,
diff --git a/stand/i386/boot2/sio.S b/stand/i386/boot2/sio.S
index de554efb5b3e..5c4650dc0533 100644
--- a/stand/i386/boot2/sio.S
+++ b/stand/i386/boot2/sio.S
@@ -80,3 +80,5 @@ sio_ischar: movw $SIO_PRT+0x5,%dx # Line status register
inb (%dx),%al # Received data
andb $0x1,%al # ready?
ret # To caller
+
+ .section .note.GNU-stack,"",%progbits
diff --git a/sys/amd64/linux/linux_locore.asm b/sys/amd64/linux/linux_locore.asm
index 19a6ac5d50d8..d4af90bda5fb 100644
--- a/sys/amd64/linux/linux_locore.asm
+++ b/sys/amd64/linux/linux_locore.asm
@@ -85,3 +85,5 @@ END(linux_rt_sigcode)
.balign 4
.previous
#endif
+
+ .section .note.GNU-stack,"",%progbits
diff --git a/sys/amd64/linux/linux_support.S b/sys/amd64/linux/linux_support.S
index 7cc59b205a97..2ab46fe8c5ea 100644
--- a/sys/amd64/linux/linux_support.S
+++ b/sys/amd64/linux/linux_support.S
@@ -227,3 +227,5 @@ ENTRY(futex_xorl_smap)
movq %rax,PCB_ONFAULT(%r8)
ret
END(futex_xorl_smap)
+
+ .section .note.GNU-stack,"",%progbits
diff --git a/sys/amd64/linux32/linux32_locore.asm b/sys/amd64/linux32/linux32_locore.asm
index 4b77bd32600e..cc4b0488edb0 100644
--- a/sys/amd64/linux32/linux32_locore.asm
+++ b/sys/amd64/linux32/linux32_locore.asm
@@ -128,3 +128,5 @@ END(__kernel_vsyscall)
.balign 4
.previous
#endif
+
+ .section .note.GNU-stack,"",%progbits
diff --git a/sys/amd64/linux32/linux32_support.S b/sys/amd64/linux32/linux32_support.S
index a316a9bf066d..1018b6ce579c 100644
--- a/sys/amd64/linux32/linux32_support.S
+++ b/sys/amd64/linux32/linux32_support.S
@@ -227,3 +227,5 @@ ENTRY(futex_xorl_smap)
movq %rax,PCB_ONFAULT(%r8)
ret
END(futex_xorl_smap)
+
+ .section .note.GNU-stack,"",%progbits
diff --git a/sys/arm/include/_types.h b/sys/arm/include/_types.h
index 7319d950443b..9fde5fc5d7c9 100644
--- a/sys/arm/include/_types.h
+++ b/sys/arm/include/_types.h
@@ -57,6 +57,7 @@ typedef __int64_t __int_fast64_t;
typedef __int32_t __register_t;
typedef __int32_t __segsz_t; /* segment size (in pages) */
typedef __int64_t __time_t; /* time()... */
+#define __SIZEOF_TIME_T __SIZEOF_INT64_T
typedef __uint32_t __uint_fast8_t;
typedef __uint32_t __uint_fast16_t;
typedef __uint32_t __uint_fast32_t;
diff --git a/sys/arm64/include/_types.h b/sys/arm64/include/_types.h
index 98f7dea67520..c46f64b2b252 100644
--- a/sys/arm64/include/_types.h
+++ b/sys/arm64/include/_types.h
@@ -55,6 +55,7 @@ typedef __int64_t __int_fast64_t;
typedef __int64_t __register_t;
typedef __int64_t __segsz_t; /* segment size (in pages) */
typedef __int64_t __time_t; /* time()... */
+#define __SIZEOF_TIME_T __SIZEOF_INT64_T
typedef __uint32_t __uint_fast8_t;
typedef __uint32_t __uint_fast16_t;
typedef __uint32_t __uint_fast32_t;
diff --git a/sys/arm64/linux/linux_locore.asm b/sys/arm64/linux/linux_locore.asm
index c330546702f1..20846a324647 100644
--- a/sys/arm64/linux/linux_locore.asm
+++ b/sys/arm64/linux/linux_locore.asm
@@ -51,3 +51,5 @@ __user_rt_sigreturn:
mov x8, #LINUX_SYS_linux_rt_sigreturn
svc #0
EEND(__kernel_rt_sigreturn)
+
+ .section .note.GNU-stack,"",%progbits
diff --git a/sys/arm64/linux/linux_support.S b/sys/arm64/linux/linux_support.S
index 3b16583e9d54..61a0604dd91b 100644
--- a/sys/arm64/linux/linux_support.S
+++ b/sys/arm64/linux/linux_support.S
@@ -176,3 +176,5 @@ ENTRY(futex_xorl)
END(futex_xorl)
GNU_PROPERTY_AARCH64_FEATURE_1_NOTE(GNU_PROPERTY_AARCH64_FEATURE_1_VAL)
+
+ .section .note.GNU-stack,"",%progbits
diff --git a/sys/compat/linux/linux_vdso_inc.S b/sys/compat/linux/linux_vdso_inc.S
index 44cc357b4a4a..d2ac3e28aabe 100644
--- a/sys/compat/linux/linux_vdso_inc.S
+++ b/sys/compat/linux/linux_vdso_inc.S
@@ -37,3 +37,5 @@ _binary_linux_vdso_so_o_end:
#include <machine/asm.h>
GNU_PROPERTY_AARCH64_FEATURE_1_NOTE(GNU_PROPERTY_AARCH64_FEATURE_1_VAL)
#endif
+
+ .section .note.GNU-stack,"",%progbits
diff --git a/sys/dev/cxgbe/common/t4_regs.h b/sys/dev/cxgbe/common/t4_regs.h
index 09d0d4aa2c08..9984461352d0 100644
--- a/sys/dev/cxgbe/common/t4_regs.h
+++ b/sys/dev/cxgbe/common/t4_regs.h
@@ -1465,10 +1465,10 @@
#define A_SGE_INT_ENABLE3 0x1040
#define A_SGE_FL_BUFFER_SIZE0 0x1044
-#define S_SIZE 4
+#define CXGBE_S_SIZE 4
#define CXGBE_M_SIZE 0xfffffffU
-#define V_SIZE(x) ((x) << S_SIZE)
-#define G_SIZE(x) (((x) >> S_SIZE) & CXGBE_M_SIZE)
+#define CXGBE_V_SIZE(x) ((x) << S_SIZE)
+#define CXGBE_G_SIZE(x) (((x) >> S_SIZE) & CXGBE_M_SIZE)
#define S_T6_SIZE 4
#define M_T6_SIZE 0xfffffU
@@ -26578,15 +26578,10 @@
#define V_CIM_ULP_TX_PKT_ERR_CODE(x) ((x) << S_CIM_ULP_TX_PKT_ERR_CODE)
#define G_CIM_ULP_TX_PKT_ERR_CODE(x) (((x) >> S_CIM_ULP_TX_PKT_ERR_CODE) & M_CIM_ULP_TX_PKT_ERR_CODE)
-#define S_CIM_SGE1_PKT_ERR_CODE 8
-#define M_CIM_SGE1_PKT_ERR_CODE 0xffU
-#define V_CIM_SGE1_PKT_ERR_CODE(x) ((x) << S_CIM_SGE1_PKT_ERR_CODE)
-#define G_CIM_SGE1_PKT_ERR_CODE(x) (((x) >> S_CIM_SGE1_PKT_ERR_CODE) & M_CIM_SGE1_PKT_ERR_CODE)
-
-#define S_CIM_SGE0_PKT_ERR_CODE 0
-#define M_CIM_SGE0_PKT_ERR_CODE 0xffU
-#define V_CIM_SGE0_PKT_ERR_CODE(x) ((x) << S_CIM_SGE0_PKT_ERR_CODE)
-#define G_CIM_SGE0_PKT_ERR_CODE(x) (((x) >> S_CIM_SGE0_PKT_ERR_CODE) & M_CIM_SGE0_PKT_ERR_CODE)
+#define S_CIM_SGE_PKT_ERR_CODE 0
+#define M_CIM_SGE_PKT_ERR_CODE 0xffU
+#define V_CIM_SGE_PKT_ERR_CODE(x) ((x) << S_CIM_SGE_PKT_ERR_CODE)
+#define G_CIM_SGE_PKT_ERR_CODE(x) (((x) >> S_CIM_SGE_PKT_ERR_CODE) & M_CIM_SGE_PKT_ERR_CODE)
#define S_CIM_PCIE_PKT_ERR_CODE 8
#define M_CIM_PCIE_PKT_ERR_CODE 0xffU
@@ -60550,17 +60545,15 @@
#define A_MAC_PORT_PTP_DRIFT_ADJUST_COUNT 0x9a0
#define A_MAC_PORT_PTP_OFFSET_ADJUST_FINE 0x9a4
-#if 0
-#define S_B 16
-#define M_B 0xffffU
-#define V_B(x) ((x) << S_B)
-#define G_B(x) (((x) >> S_B) & M_B)
-#endif
+#define CXGBE_S_B 16
+#define CXGBE_M_B 0xffffU
+#define CXGBE_V_B(x) ((x) << CXGBE_S_B)
+#define CXGBE_G_B(x) (((x) >> CXGBE_S_B) & CXGBE_M_B)
-#define S_A 0
-#define M_A 0xffffU
-#define V_A(x) ((x) << S_A)
-#define G_A(x) (((x) >> S_A) & M_A)
+#define CXGBE_S_A 0
+#define CXGBE_M_A 0xffffU
+#define CXGBE_V_A(x) ((x) << CXGBE_S_A)
+#define CXGBE_G_A(x) (((x) >> CXGBE_S_A) & CXGBE_M_A)
#define A_MAC_PORT_PTP_OFFSET_ADJUST_TOTAL 0x9a8
#define A_MAC_PORT_PTP_CFG 0x9ac
@@ -62257,10 +62250,10 @@
#define A_MAC_PORT_MTIP_VLAN_TPID_0 0x1a00
-#define S_VLANTAG 0
+#define CXGBE_S_VLANTAG 0
#define CXGBE_M_VLANTAG 0xffffU
-#define V_VLANTAG(x) ((x) << S_VLANTAG)
-#define G_VLANTAG(x) (((x) >> S_VLANTAG) & M_VLANTAG)
+#define CXGBE_V_VLANTAG(x) ((x) << CXGBE_S_VLANTAG)
+#define CXGBE_G_VLANTAG(x) (((x) >> CXGBE_S_VLANTAG) & CXGBE_M_VLANTAG)
#define A_MAC_PORT_MTIP_VLAN_TPID_1 0x1a04
#define A_MAC_PORT_MTIP_VLAN_TPID_2 0x1a08
@@ -69613,10 +69606,10 @@
#define V_INIT_ENABLE(x) ((x) << S_INIT_ENABLE)
#define F_INIT_ENABLE V_INIT_ENABLE(1U)
-#define S_WAIT 16
-#define M_WAIT 0xfffU
-#define CXGBE_V_WAIT(x) ((x) << S_WAIT)
-#define G_WAIT(x) (((x) >> S_WAIT) & M_WAIT)
+#define CXGBE_S_WAIT 16
+#define CXGBE_M_WAIT 0xfffU
+#define CXGBE_V_WAIT(x) ((x) << CXGBE_S_WAIT)
+#define CXGBE_G_WAIT(x) (((x) >> CXGBE_S_WAIT) & CXGBE_M_WAIT)
#define S_EN_MULTI_RANK_SEL 4
#define V_EN_MULTI_RANK_SEL(x) ((x) << S_EN_MULTI_RANK_SEL)
diff --git a/sys/dev/cxgbe/firmware/t4fw_interface.h b/sys/dev/cxgbe/firmware/t4fw_interface.h
index b11552dce021..6235a2c3fab4 100644
--- a/sys/dev/cxgbe/firmware/t4fw_interface.h
+++ b/sys/dev/cxgbe/firmware/t4fw_interface.h
@@ -2560,6 +2560,22 @@ struct fw_ri_wr {
__be32 tpt_offset_t10_config;
__be32 r8[2];
} nvmet_init;
+ struct fw_ri_iscsi_init {
+ __u8 type;
+ __u8 dcrc_dis_to_hcrc;
+ __u8 r4[3];
+ __u8 qp_caps;
+ __be16 r5;
+ __be32 pdid;
+ __be32 qpid;
+ __be32 sq_eqid;
+ __be32 r6;
+ __be32 scqid;
+ __be32 rcqid;
+ __be32 r7[4];
+ __be32 r8[2];
+ __be64 r9;
+ } iscsi_init;
struct fw_ri_fini {
__u8 type;
__u8 r3[7];
@@ -2634,6 +2650,37 @@ struct fw_ri_wr {
#define G_FW_RI_WR_T10_CONFIG(x) \
(((x) >> S_FW_RI_WR_T10_CONFIG) & M_FW_RI_WR_T10_CONFIG)
+#define S_FW_RI_WR_DCRC_DIS 7
+#define M_FW_RI_WR_DCRC_DIS 0x1
+#define V_FW_RI_WR_DCRC_DIS(x) ((x) << S_FW_RI_WR_DCRC_DIS)
+#define G_FW_RI_WR_DCRC_DIS(x) \
+ (((x) >> S_FW_RI_WR_DCRC_DIS) & M_FW_RI_WR_DCRC_DIS)
+#define F_FW_RI_WR_DCRC_DIS V_FW_RI_WR_DCRC_DIS(1U)
+
+#define S_FW_RI_WR_HCRC_DIS 6
+#define M_FW_RI_WR_HCRC_DIS 0x1
+#define V_FW_RI_WR_HCRC_DIS(x) ((x) << S_FW_RI_WR_HCRC_DIS)
+#define G_FW_RI_WR_HCRC_DIS(x) \
+ (((x) >> S_FW_RI_WR_HCRC_DIS) & M_FW_RI_WR_HCRC_DIS)
+#define F_FW_RI_WR_HCRC_DIS V_FW_RI_WR_HCRC_DIS(1U)
+
+#define S_FW_RI_WR_PSZ_IDX 4
+#define M_FW_RI_WR_PSZ_IDX 0x3
+#define V_FW_RI_WR_PSZ_IDX(x) ((x) << S_FW_RI_WR_PSZ_IDX)
+#define G_FW_RI_WR_PSZ_IDX(x) \
+ (((x) >> S_FW_RI_WR_PSZ_IDX) & M_FW_RI_WR_PSZ_IDX)
+
+#define S_FW_RI_WR_DCRC 1
+#define M_FW_RI_WR_DCRC 0x1
+#define V_FW_RI_WR_DCRC(x) ((x) << S_FW_RI_WR_DCRC)
+#define G_FW_RI_WR_DCRC(x) (((x) >> S_FW_RI_WR_DCRC) & M_FW_RI_WR_DCRC)
+#define F_FW_RI_WR_DCRC V_FW_RI_WR_DCRC(1U)
+
+#define S_FW_RI_WR_HCRC 0
+#define M_FW_RI_WR_HCRC 0x1
+#define V_FW_RI_WR_HCRC(x) ((x) << S_FW_RI_WR_HCRC)
+#define G_FW_RI_WR_HCRC(x) (((x) >> S_FW_RI_WR_HCRC) & M_FW_RI_WR_HCRC)
+#define F_FW_RI_WR_HCRC V_FW_RI_WR_HCRC(1U)
/******************************************************************************
* R o C E V 2 W O R K R E Q U E S T s
@@ -2951,6 +2998,24 @@ struct fw_v2_nvmet_tx_data_wr {
#endif
};
+#define S_FW_V2_NVMET_TX_DATA_WR_DACK_CHANGE 20
+#define M_FW_V2_NVMET_TX_DATA_WR_DACK_CHANGE 0x1
+#define V_FW_V2_NVMET_TX_DATA_WR_DACK_CHANGE(x) \
+ ((x) << S_FW_V2_NVMET_TX_DATA_WR_DACK_CHANGE)
+#define G_FW_V2_NVMET_TX_DATA_WR_DACK_CHANGE(x) \
+ (((x) >> S_FW_V2_NVMET_TX_DATA_WR_DACK_CHANGE) & \
+ M_FW_V2_NVMET_TX_DATA_WR_DACK_CHANGE)
+#define F_FW_V2_NVMET_TX_DATA_WR_DACK_CHANGE \
+ V_FW_V2_NVMET_TX_DATA_WR_DACK_CHANGE(1U)
+
+#define S_FW_V2_NVMET_TX_DATA_WR_DACK_MODE 18
+#define M_FW_V2_NVMET_TX_DATA_WR_DACK_MODE 0x3
+#define V_FW_V2_NVMET_TX_DATA_WR_DACK_MODE(x) \
+ ((x) << S_FW_V2_NVMET_TX_DATA_WR_DACK_MODE)
+#define G_FW_V2_NVMET_TX_DATA_WR_DACK_MODE(x) \
+ (((x) >> S_FW_V2_NVMET_TX_DATA_WR_DACK_MODE) & \
+ M_FW_V2_NVMET_TX_DATA_WR_DACK_MODE)
+
#define S_FW_V2_NVMET_TX_DATA_WR_FLAGS_HI 10
#define M_FW_V2_NVMET_TX_DATA_WR_FLAGS_HI 0x3fffff
#define V_FW_V2_NVMET_TX_DATA_WR_FLAGS_HI(x) \
@@ -4990,6 +5055,16 @@ struct fw_crypto_update_sa_wr {
} key;
};
+#define S_FW_CRYPTO_UPDATE_SA_WR_EG_IPVER 3
+#define M_FW_CRYPTO_UPDATE_SA_WR_EG_IPVER 0x1
+#define V_FW_CRYPTO_UPDATE_SA_WR_EG_IPVER(x) \
+ ((x) << S_FW_CRYPTO_UPDATE_SA_WR_EG_IPVER)
+#define G_FW_CRYPTO_UPDATE_SA_WR_EG_IPVER(x) \
+ (((x) >> S_FW_CRYPTO_UPDATE_SA_WR_EG_IPVER) & \
+ M_FW_CRYPTO_UPDATE_SA_WR_EG_IPVER)
+#define F_FW_CRYPTO_UPDATE_SA_WR_EG_IPVER \
+ V_FW_CRYPTO_UPDATE_SA_WR_EG_IPVER(1U)
+
#define S_FW_CRYPTO_UPDATE_SA_WR_SAOP 2
#define M_FW_CRYPTO_UPDATE_SA_WR_SAOP 0x1
#define V_FW_CRYPTO_UPDATE_SA_WR_SAOP(x) \
@@ -8952,24 +9027,40 @@ enum fw_port_type {
FW_PORT_TYPE_KX4 = 5, /* No, 4, No, No, Yes, Yes, 10G */
FW_PORT_TYPE_CX4 = 6, /* No, 4, No, No, No, No, 10G */
FW_PORT_TYPE_KX = 7, /* No, 1, No, No, Yes, No, 1G */
- FW_PORT_TYPE_KR = 8, /* No, 1, No, No, Yes, Yes, 10G */
+ FW_PORT_TYPE_KR = 8, /* No, 1, No, No, Yes, Yes, 10G BP AN */
FW_PORT_TYPE_SFP = 9, /* No, 1, Yes, No, No, No, 10G */
- FW_PORT_TYPE_BP_AP = 10, /* No, 1, No, No, Yes, Yes, 10G, BP ANGE */
- FW_PORT_TYPE_BP4_AP = 11, /* No, 4, No, No, Yes, Yes, 10G, BP ANGE */
+ FW_PORT_TYPE_BP_AP = 10, /* No, 1, No, No, Yes, Yes, 10G, BP AN */
+ FW_PORT_TYPE_BP4_AP = 11, /* No, 4, No, No, Yes, Yes, 10G, BP AN */
FW_PORT_TYPE_QSFP_10G = 12, /* No, 1, Yes, No, No, No, 10G */
FW_PORT_TYPE_QSA = 13, /* No, 1, Yes, No, No, No, 10G */
FW_PORT_TYPE_QSFP = 14, /* No, 4, Yes, No, No, No, 40G */
- FW_PORT_TYPE_BP40_BA = 15, /* No, 4, No, No, Yes, Yes, 40G/10G/1G, BP ANGE */
- FW_PORT_TYPE_KR4_100G = 16, /* No, 4, 100G/40G/25G, Backplane */
+ FW_PORT_TYPE_BP40_BA = 15, /* No, 4, No, No, Yes, Yes, 40G/10G/1G, BP AN */
+ FW_PORT_TYPE_KR4_100G = 16, /* No, 4, 100G/40G/50G/25G/10G/1G, BP AN */
FW_PORT_TYPE_CR4_QSFP = 17, /* No, 4, 100G/40G/25G */
- FW_PORT_TYPE_CR_QSFP = 18, /* No, 1, 25G Spider cable */
- FW_PORT_TYPE_CR2_QSFP = 19, /* No, 2, 50G */
+ FW_PORT_TYPE_CR_QSFP = 18, /* No, 1, 25G, Spider cable */
+ FW_PORT_TYPE_CR2_QSFP = 19, /* No, 2, 50G, Spider cable */
FW_PORT_TYPE_SFP28 = 20, /* No, 1, 25G/10G/1G */
FW_PORT_TYPE_KR_SFP28 = 21, /* No, 1, 25G/10G/1G using Backplane */
FW_PORT_TYPE_KR_XLAUI = 22, /* No, 4, 40G/10G/1G, No AN*/
+ FW_PORT_TYPE_BARE_LINK_50G = 23, /* No, 1, 50G */
+ FW_PORT_TYPE_BARE_LINK_100G = 24, /* No, 2, 100G/50G */
+ FW_PORT_TYPE_BARE_LINK_200G = 25, /* No, 4, 200G/100G/50G */
FW_PORT_TYPE_SFP56 = 26, /* No, 1, 50G/25G */
FW_PORT_TYPE_QSFP56 = 27, /* No, 4, 200G/100G/50G/25G */
- FW_PORT_TYPE_QSFPDD = 34, /* No, 8, 400G/200G/100G/50G */
+ FW_PORT_TYPE_QSFP56_4_50G = 28, /* No, 1, 50G, Spider cable */
+ FW_PORT_TYPE_KR_50G = 29, /* No, 1, 50G/25G/10G/1G, BP AN */
+ FW_PORT_TYPE_KR2_100G = 30, /* No, 2, 100G/50G/25G/10G/1G, BP AN */
+ FW_PORT_TYPE_KR4_200G = 31, /* No, 4, 200G/100G/40G/50G/25G/10G/1G, BP AN */
+ FW_PORT_TYPE_QSFP56_2_50G = 32, /* No, 1, 50G, Spider cable */
+ FW_PORT_TYPE_OSFP = 33, /* No, 8, 400G/200G/100G/50G */
+ FW_PORT_TYPE_QSFPDD = 34, /* No, 8, 400G/200G/100G/50G */
+ FW_PORT_TYPE_OSFP_2_200G = 35, /* No, 4, 200G, Spider cable */
+ FW_PORT_TYPE_QSFPDD_2_200G = 36,/* No, 4, 200G, Spider cable */
+ FW_PORT_TYPE_KR8_400G = 37, /* No, 8, 400G/200G/100G/50G/40G/25G/10G/1G, BP AN */
+ FW_PORT_TYPE_QSFP56_2_100G = 38,/* No, 2, 100G, Spider cable */
+ FW_PORT_TYPE_QSFPDD_4_100G = 39,/* No, 2, 100G, Spider cable */
+ FW_PORT_TYPE_KR2_50G = 40, /* No, 1, 50G/25G/10G/1G, BP AN */
+ FW_PORT_TYPE_MAX,
FW_PORT_TYPE_NONE = M_FW_PORT_CMD_PORTTYPE32
};
diff --git a/sys/dev/cxgbe/firmware/t7fw_cfg.txt b/sys/dev/cxgbe/firmware/t7fw_cfg.txt
index 70b05da04a23..33c703fdc9d7 100644
--- a/sys/dev/cxgbe/firmware/t7fw_cfg.txt
+++ b/sys/dev/cxgbe/firmware/t7fw_cfg.txt
@@ -175,6 +175,11 @@
# TPT error.
# Err2uP = 0
+ # ULP_TX_ACCELERATOR_CTL
+ reg[0x8f90] = 0x00000015/0x00000015 # Compression block clock gating
+ # Dedupe clock gating
+ # Erasure Coding clock gating
+
#ULP_RX_CTL1
reg[0x19330] = 0x000000f0/0x000000f0 # RDMA_Invld_Msg_Dis = 3
# ROCE_Invld_Msg_Dis = 3
@@ -201,7 +206,7 @@
# default gc enabled.
# HMA configuration (uncomment following lines to enable HMA)
- hma_size = 128 # Size (in MBs) of host memory expected
+ hma_size = 256 # Size (in MBs) of host memory expected
hma_regions = iscsi,rrq,tls,ddp,pmrx,stag,pbl,rq # What all regions to place in host memory
#mc[0]=0
@@ -394,8 +399,7 @@
neq = 16 # niqflint + nethctrl Egress Queues
nexactf = 8 # number of exact MPSTCAM MAC filters
cmask = all # access to all channels
- #pmask = 0x4 # access to only one port
- pmask = 0x1 # access to only one port
+ pmask = 0x4 # access to only one port
[function "3"]
nvf = 16 # NVF on this function
@@ -407,7 +411,7 @@
neq = 16 # niqflint + nethctrl Egress Queues
nexactf = 8 # number of exact MPSTCAM MAC filters
cmask = all # access to all channels
- #pmask = 0x2 # access to only one port
+ pmask = 0x8 # access to only one port
# Some OS Drivers manage all application functions for all ports via PF4.
# Thus we need to provide a large number of resources here. For Egress
@@ -421,7 +425,7 @@
r_caps = all # read permissions for all commands
nvi = 28 # NVI_UNIFIED
niqflint = 170 # NFLIQ_UNIFIED + NLFIQ_WD
- nethctrl = 224 # NETHCTRL_UNIFIED + NETHCTRL_WD
+ nethctrl = 288 # NETHCTRL_UNIFIED + NETHCTRL_WD
neq = 252 # NEQ_UNIFIED + NEQ_WD
nqpcq = 12288
nexactf = 40 # NMPSTCAM_UNIFIED
@@ -435,8 +439,7 @@
nserver = 480 # number of server region entries
nhash = 12288 # number of hash region entries
nhpfilter = 64 # number of high priority filter region entries
- #protocol = nic_vm, ofld, rddp, rdmac, iscsi_initiator_pdu, iscsi_target_pdu, iscsi_t10dif, tlskeys, crypto_lookaside, ipsec_inline, rocev2, nic_hashfilter, ofld_sendpath
- protocol = nic_vm, ofld, rddp, rdmac, iscsi_initiator_pdu, iscsi_target_pdu, iscsi_t10dif, tlskeys, crypto_lookaside, ipsec_inline, rocev2, nic_hashfilter, nvme_tcp
+ protocol = nic_vm, ofld, rddp, rdmac, iscsi_initiator_pdu, iscsi_target_pdu, iscsi_t10dif, tlskeys, crypto_lookaside, ipsec_inline, rocev2, nic_hashfilter, nvme_tcp, ofld_sendpath
tp_l2t = 3072
tp_ddp = 2
tp_ddp_iscsi = 2
@@ -643,7 +646,7 @@
[fini]
version = 0x1425001d
- checksum = 0x3671da3b
+ checksum = 0x2419f987
# Total resources used by above allocations:
# Virtual Interfaces: 104
diff --git a/sys/dev/cxgbe/firmware/t7fw_cfg_uwire.txt b/sys/dev/cxgbe/firmware/t7fw_cfg_uwire.txt
index b1f5129238eb..9da841153138 100644
--- a/sys/dev/cxgbe/firmware/t7fw_cfg_uwire.txt
+++ b/sys/dev/cxgbe/firmware/t7fw_cfg_uwire.txt
@@ -175,6 +175,11 @@
# TPT error.
# Err2uP = 0
+ # ULP_TX_ACCELERATOR_CTL
+ reg[0x8f90] = 0x00000015/0x00000015 # Compression block clock gating
+ # Dedupe clock gating
+ # Erasure Coding clock gating
+
#ULP_RX_CTL1
reg[0x19330] = 0x000000f0/0x000000f0 # RDMA_Invld_Msg_Dis = 3
# ROCE_Invld_Msg_Dis = 3
@@ -201,7 +206,7 @@
# default gc enabled.
# HMA configuration (uncomment following lines to enable HMA)
- hma_size = 128 # Size (in MBs) of host memory expected
+ hma_size = 256 # Size (in MBs) of host memory expected
hma_regions = iscsi,rrq,tls,ddp,pmrx,stag,pbl,rq # What all regions to place in host memory
#mc[0]=0
@@ -394,8 +399,7 @@
neq = 16 # niqflint + nethctrl Egress Queues
nexactf = 8 # number of exact MPSTCAM MAC filters
cmask = all # access to all channels
- #pmask = 0x4 # access to only one port
- pmask = 0x1 # access to only one port
+ pmask = 0x4 # access to only one port
[function "3"]
nvf = 16 # NVF on this function
@@ -407,7 +411,7 @@
neq = 16 # niqflint + nethctrl Egress Queues
nexactf = 8 # number of exact MPSTCAM MAC filters
cmask = all # access to all channels
- #pmask = 0x2 # access to only one port
+ pmask = 0x8 # access to only one port
# Some OS Drivers manage all application functions for all ports via PF4.
# Thus we need to provide a large number of resources here. For Egress
@@ -421,7 +425,7 @@
r_caps = all # read permissions for all commands
nvi = 28 # NVI_UNIFIED
niqflint = 170 # NFLIQ_UNIFIED + NLFIQ_WD
- nethctrl = 224 # NETHCTRL_UNIFIED + NETHCTRL_WD
+ nethctrl = 288 # NETHCTRL_UNIFIED + NETHCTRL_WD
neq = 252 # NEQ_UNIFIED + NEQ_WD
nqpcq = 12288
nexactf = 40 # NMPSTCAM_UNIFIED
@@ -435,8 +439,7 @@
nserver = 480 # number of server region entries
nhash = 12288 # number of hash region entries
nhpfilter = 64 # number of high priority filter region entries
- #protocol = nic_vm, ofld, rddp, rdmac, iscsi_initiator_pdu, iscsi_target_pdu, iscsi_t10dif, tlskeys, crypto_lookaside, ipsec_inline, rocev2, nic_hashfilter, ofld_sendpath
- protocol = nic_vm, ofld, rddp, rdmac, iscsi_initiator_pdu, iscsi_target_pdu, iscsi_t10dif, tlskeys, crypto_lookaside, ipsec_inline, rocev2, nic_hashfilter, nvme_tcp
+ protocol = nic_vm, ofld, rddp, rdmac, iscsi_initiator_pdu, iscsi_target_pdu, iscsi_t10dif, tlskeys, crypto_lookaside, ipsec_inline, rocev2, nic_hashfilter, nvme_tcp, ofld_sendpath
tp_l2t = 3072
tp_ddp = 2
tp_ddp_iscsi = 2
@@ -643,7 +646,7 @@
[fini]
version = 0x1425001d
- checksum = 0x96513217
+ checksum = 0x83f95163
# Total resources used by above allocations:
# Virtual Interfaces: 104
diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c
index 69ecfce1dade..d73204eb808c 100644
--- a/sys/dev/cxgbe/t4_main.c
+++ b/sys/dev/cxgbe/t4_main.c
@@ -3760,10 +3760,17 @@ port_mword(struct port_info *pi, uint32_t speed)
return (IFM_NONE);
}
break;
- case M_FW_PORT_CMD_PTYPE: /* FW_PORT_TYPE_NONE for old firmware */
- if (chip_id(pi->adapter) >= CHELSIO_T7)
- return (IFM_UNKNOWN);
- /* fall through */
+ case FW_PORT_TYPE_KR4_200G: {
+ /*
+ * Pre-T7 firmware used M_FW_PORT_CMD_PTYPE for PORT_TYPE_NONE
+ * and driver needs to deal with both.
+ */
+ _Static_assert(M_FW_PORT_CMD_PTYPE == FW_PORT_TYPE_KR4_200G,
+ "driver/firmware mismatch");
+ if (chip_id(pi->adapter) < CHELSIO_T7)
+ return (IFM_NONE);
+ return (IFM_200G_KR4_PAM4);
+ }
case FW_PORT_TYPE_NONE:
return (IFM_NONE);
}
diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c
index 0dddd2dd263f..b5a3012accd6 100644
--- a/sys/dev/pci/pci.c
+++ b/sys/dev/pci/pci.c
@@ -3756,7 +3756,7 @@ xhci_early_takeover(device_t self)
struct resource *res;
uint32_t cparams;
uint32_t eec;
- uint8_t eecp;
+ uint32_t eecp;
uint8_t bios_sem;
uint8_t offs;
int rid;
diff --git a/sys/dev/rge/if_rge.c b/sys/dev/rge/if_rge.c
index 8887e8d39ae4..06f034ebd61d 100644
--- a/sys/dev/rge/if_rge.c
+++ b/sys/dev/rge/if_rge.c
@@ -113,6 +113,7 @@ struct rge_matchid {
const struct rge_matchid rge_devices[] = {
{ PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_E3000, "Killer E3000" },
+ { PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_E5000, "Killer E5000" },
{ PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RTL8125, "RTL8125" },
{ PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RTL8126, "RTL8126", },
{ PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RTL8127, "RTL8127" },
diff --git a/sys/dev/rge/if_rge_vendor.h b/sys/dev/rge/if_rge_vendor.h
index eea94e39e20b..f80b99f1f8b6 100644
--- a/sys/dev/rge/if_rge_vendor.h
+++ b/sys/dev/rge/if_rge_vendor.h
@@ -21,6 +21,7 @@
#define PCI_VENDOR_REALTEK 0x10ec
#define PCI_PRODUCT_REALTEK_E3000 0x3000
+#define PCI_PRODUCT_REALTEK_E5000 0x5000
#define PCI_PRODUCT_REALTEK_RTL8125 0x8125
#define PCI_PRODUCT_REALTEK_RTL8126 0x8126
#define PCI_PRODUCT_REALTEK_RTL8127 0x8127
diff --git a/sys/dev/thunderbolt/tbcfg_reg.h b/sys/dev/thunderbolt/tbcfg_reg.h
index bb68faa543b0..6ae5c6fea7fa 100644
--- a/sys/dev/thunderbolt/tbcfg_reg.h
+++ b/sys/dev/thunderbolt/tbcfg_reg.h
@@ -52,7 +52,7 @@ struct tb_cfg_read {
uint32_t crc;
};
-/* Config space read request, 6.4.2.4 */
+/* Config space read response, 6.4.2.4 */
struct tb_cfg_read_resp {
tb_route_t route;
uint32_t addr_attrs;
diff --git a/sys/i386/linux/linux_locore.asm b/sys/i386/linux/linux_locore.asm
index dbd0757c44bc..c188ad72f009 100644
--- a/sys/i386/linux/linux_locore.asm
+++ b/sys/i386/linux/linux_locore.asm
@@ -122,3 +122,5 @@ END(__kernel_vsyscall)
.balign 4
.previous
#endif
+
+ .section .note.GNU-stack,"",%progbits
diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c
index 8ff9822ee9eb..2508f7edd1c5 100644
--- a/sys/kern/uipc_usrreq.c
+++ b/sys/kern/uipc_usrreq.c
@@ -83,6 +83,7 @@
#include <sys/socketvar.h>
#include <sys/signalvar.h>
#include <sys/stat.h>
+#include <sys/sysent.h>
#include <sys/sx.h>
#include <sys/sysctl.h>
#include <sys/systm.h>
@@ -2752,8 +2753,24 @@ uipc_ctloutput(struct socket *so, struct sockopt *sopt)
error = EINVAL;
}
UNP_PCB_UNLOCK(unp);
- if (error == 0)
- error = sooptcopyout(sopt, &xu, sizeof(xu));
+ if (error != 0)
+ break;
+#ifdef COMPAT_FREEBSD32
+ if (SV_PROC_FLAG(sopt->sopt_td->td_proc, SV_ILP32)) {
+ struct xucred32 xu32 = {};
+ int i;
+
+ xu32.cr_version = xu.cr_version;
+ xu32.cr_uid = xu.cr_uid;
+ xu32.cr_ngroups = xu.cr_ngroups;
+ for (i = 0; i < XU_NGROUPS; i++)
+ xu32.cr_groups[i] = xu.cr_groups[i];
+ xu32.cr_pid = xu.cr_pid;
+ error = sooptcopyout(sopt, &xu32, sizeof(xu32));
+ break;
+ }
+#endif
+ error = sooptcopyout(sopt, &xu, sizeof(xu));
break;
case LOCAL_CREDS:
diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c
index 3f8591bd0ba7..66210bf58a7c 100644
--- a/sys/kern/vfs_cache.c
+++ b/sys/kern/vfs_cache.c
@@ -5737,7 +5737,7 @@ cache_fplookup_climb_mount(struct cache_fpl *fpl)
prev_mp = NULL;
for (;;) {
- if (!vfs_op_thread_enter_crit(mp, mpcpu)) {
+ if (!vfs_op_thread_enter_crit(mp, &mpcpu)) {
if (prev_mp != NULL)
vfs_op_thread_exit_crit(prev_mp, prev_mpcpu);
return (cache_fpl_partial(fpl));
@@ -5792,7 +5792,7 @@ cache_fplookup_cross_mount(struct cache_fpl *fpl)
return (0);
}
- if (!vfs_op_thread_enter_crit(mp, mpcpu)) {
+ if (!vfs_op_thread_enter_crit(mp, &mpcpu)) {
return (cache_fpl_partial(fpl));
}
if (!vn_seqc_consistent(vp, vp_seqc)) {
diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c
index ddc5a1b70887..fff05a627162 100644
--- a/sys/kern/vfs_mount.c
+++ b/sys/kern/vfs_mount.c
@@ -500,7 +500,7 @@ vfs_ref_from_vp(struct vnode *vp)
if (__predict_false(mp == NULL)) {
return (mp);
}
- if (vfs_op_thread_enter(mp, mpcpu)) {
+ if (vfs_op_thread_enter(mp, &mpcpu)) {
if (__predict_true(mp == vp->v_mount)) {
vfs_mp_count_add_pcpu(mpcpu, ref, 1);
vfs_op_thread_exit(mp, mpcpu);
@@ -527,7 +527,7 @@ vfs_ref(struct mount *mp)
struct mount_pcpu *mpcpu;
CTR2(KTR_VFS, "%s: mp %p", __func__, mp);
- if (vfs_op_thread_enter(mp, mpcpu)) {
+ if (vfs_op_thread_enter(mp, &mpcpu)) {
vfs_mp_count_add_pcpu(mpcpu, ref, 1);
vfs_op_thread_exit(mp, mpcpu);
return;
@@ -645,7 +645,7 @@ vfs_rel(struct mount *mp)
struct mount_pcpu *mpcpu;
CTR2(KTR_VFS, "%s: mp %p", __func__, mp);
- if (vfs_op_thread_enter(mp, mpcpu)) {
+ if (vfs_op_thread_enter(mp, &mpcpu)) {
vfs_mp_count_sub_pcpu(mpcpu, ref, 1);
vfs_op_thread_exit(mp, mpcpu);
return;
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index 823ccc6cab71..4bfbc0a7057e 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -237,15 +237,15 @@ static struct mtx mntid_mtx;
*/
static struct mtx __exclusive_cache_line vnode_list_mtx;
-static uma_zone_t buf_trie_zone;
-static smr_t buf_trie_smr;
+static __read_mostly uma_zone_t buf_trie_zone;
+static __read_mostly smr_t buf_trie_smr;
/* Zone for allocation of new vnodes - used exclusively by getnewvnode() */
-static uma_zone_t vnode_zone;
-MALLOC_DEFINE(M_VNODEPOLL, "VN POLL", "vnode poll");
-
+static __read_mostly uma_zone_t vnode_zone;
__read_frequently smr_t vfs_smr;
+MALLOC_DEFINE(M_VNODEPOLL, "VN POLL", "vnode poll");
+
/*
* The workitem queue.
*
@@ -876,7 +876,7 @@ vfs_busy(struct mount *mp, int flags)
MPASS((flags & ~MBF_MASK) == 0);
CTR3(KTR_VFS, "%s: mp %p with flags %d", __func__, mp, flags);
- if (vfs_op_thread_enter(mp, mpcpu)) {
+ if (vfs_op_thread_enter(mp, &mpcpu)) {
MPASS((mp->mnt_kern_flag & MNTK_DRAINING) == 0);
MPASS((mp->mnt_kern_flag & MNTK_UNMOUNT) == 0);
MPASS((mp->mnt_kern_flag & MNTK_REFEXPIRE) == 0);
@@ -939,7 +939,7 @@ vfs_unbusy(struct mount *mp)
CTR2(KTR_VFS, "%s: mp %p", __func__, mp);
- if (vfs_op_thread_enter(mp, mpcpu)) {
+ if (vfs_op_thread_enter(mp, &mpcpu)) {
MPASS((mp->mnt_kern_flag & MNTK_DRAINING) == 0);
vfs_mp_count_sub_pcpu(mpcpu, lockref, 1);
vfs_mp_count_sub_pcpu(mpcpu, ref, 1);
@@ -6090,7 +6090,7 @@ vop_create_post(void *ap, int rc)
a = ap;
dvp = a->a_dvp;
vn_seqc_write_end(dvp);
- if (!rc) {
+ if (rc == 0) {
VFS_KNOTE_LOCKED(dvp, NOTE_WRITE);
INOTIFY_NAME(*a->a_vpp, dvp, a->a_cnp, IN_CREATE);
}
@@ -6244,7 +6244,7 @@ vop_mknod_post(void *ap, int rc)
a = ap;
dvp = a->a_dvp;
vn_seqc_write_end(dvp);
- if (!rc) {
+ if (rc == 0) {
VFS_KNOTE_LOCKED(dvp, NOTE_WRITE);
INOTIFY_NAME(*a->a_vpp, dvp, a->a_cnp, IN_CREATE);
}
@@ -6512,8 +6512,10 @@ vop_read_pgcache_post(void *ap, int rc)
{
struct vop_read_pgcache_args *a = ap;
- if (!rc)
- VFS_KNOTE_UNLOCKED(a->a_vp, NOTE_READ);
+ if (rc == 0) {
+ VFS_KNOTE_LOCKED(a->a_vp, NOTE_READ);
+ INOTIFY(a->a_vp, IN_ACCESS);
+ }
}
static struct knlist fs_knlist;
@@ -6659,6 +6661,8 @@ vfs_knlunlock(void *arg)
{
struct vnode *vp = arg;
+ if (KNLIST_EMPTY(&vp->v_pollinfo->vpi_selinfo.si_note))
+ vn_irflag_unset(vp, VIRF_KNOTE);
VOP_UNLOCK(vp);
}
@@ -6706,7 +6710,11 @@ vfs_kqfilter(struct vop_kqfilter_args *ap)
return (ENOMEM);
knl = &vp->v_pollinfo->vpi_selinfo.si_note;
vhold(vp);
- knlist_add(knl, kn, 0);
+ vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
+ knlist_add(knl, kn, 1);
+ if ((vn_irflag_read(vp) & VIRF_KNOTE) == 0)
+ vn_irflag_set(vp, VIRF_KNOTE);
+ VOP_UNLOCK(vp);
return (0);
}
@@ -6985,7 +6993,7 @@ vfs_cache_root(struct mount *mp, int flags, struct vnode **vpp)
struct vnode *vp;
int error;
- if (!vfs_op_thread_enter(mp, mpcpu))
+ if (!vfs_op_thread_enter(mp, &mpcpu))
return (vfs_cache_root_fallback(mp, flags, vpp));
vp = atomic_load_ptr(&mp->mnt_rootvnode);
if (vp == NULL || VN_IS_DOOMED(vp)) {
diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c
index 4061b2272193..15704634ff62 100644
--- a/sys/kern/vfs_vnops.c
+++ b/sys/kern/vfs_vnops.c
@@ -2083,7 +2083,7 @@ vn_start_write_refed(struct mount *mp, int flags)
struct mount_pcpu *mpcpu;
int error, mflags;
- if ((flags & V_XSLEEP) == 0 && vfs_op_thread_enter(mp, mpcpu)) {
+ if ((flags & V_XSLEEP) == 0 && vfs_op_thread_enter(mp, &mpcpu)) {
MPASS((mp->mnt_kern_flag & MNTK_SUSPEND) == 0);
vfs_mp_count_add_pcpu(mpcpu, writeopcount, 1);
vfs_op_thread_exit(mp, mpcpu);
@@ -2252,7 +2252,7 @@ vn_finished_write(struct mount *mp)
if (mp == NULL)
return;
- if (vfs_op_thread_enter(mp, mpcpu)) {
+ if (vfs_op_thread_enter(mp, &mpcpu)) {
vfs_mp_count_sub_pcpu(mpcpu, writeopcount, 1);
vfs_mp_count_sub_pcpu(mpcpu, ref, 1);
vfs_op_thread_exit(mp, mpcpu);
diff --git a/sys/net/if_geneve.c b/sys/net/if_geneve.c
index ab8b313e860a..59822045b77b 100644
--- a/sys/net/if_geneve.c
+++ b/sys/net/if_geneve.c
@@ -3021,6 +3021,7 @@ geneve_udp_input(struct mbuf *m, int offset, struct inpcb *inpcb,
if (sc == NULL)
return (false);
+ ifp = sc->gnv_ifp;
if ((sc->gnv_flags & GENEVE_FLAG_RUNNING) == 0)
goto out;
@@ -3043,7 +3044,6 @@ geneve_udp_input(struct mbuf *m, int offset, struct inpcb *inpcb,
if (error != 0)
goto out;
- ifp = sc->gnv_ifp;
if (ifp == m->m_pkthdr.rcvif)
/* XXX Does not catch more complex loops. */
goto out;
diff --git a/sys/powerpc/include/_types.h b/sys/powerpc/include/_types.h
index 33cc6e731b50..746f9a4837c6 100644
--- a/sys/powerpc/include/_types.h
+++ b/sys/powerpc/include/_types.h
@@ -66,6 +66,7 @@ typedef __int32_t __register_t;
typedef __int32_t __segsz_t; /* segment size (in pages) */
#endif
typedef __int64_t __time_t; /* time()... */
+#define __SIZEOF_TIME_T __SIZEOF_INT64_T
typedef __uint32_t __uint_fast8_t;
typedef __uint32_t __uint_fast16_t;
typedef __uint32_t __uint_fast32_t;
diff --git a/sys/riscv/include/_types.h b/sys/riscv/include/_types.h
index 3e9abd27a156..a9f95d4b6839 100644
--- a/sys/riscv/include/_types.h
+++ b/sys/riscv/include/_types.h
@@ -51,6 +51,7 @@ typedef __int64_t __int_fast64_t;
typedef __int64_t __register_t;
typedef __int64_t __segsz_t; /* segment size (in pages) */
typedef __int64_t __time_t; /* time()... */
+#define __SIZEOF_TIME_T __SIZEOF_INT64_T
typedef __uint32_t __uint_fast8_t;
typedef __uint32_t __uint_fast16_t;
typedef __uint32_t __uint_fast32_t;
diff --git a/sys/sys/_decls.h b/sys/sys/_decls.h
new file mode 100644
index 000000000000..2ef61671dd70
--- /dev/null
+++ b/sys/sys/_decls.h
@@ -0,0 +1,46 @@
+/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ * Copyright (c) 1991, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Berkeley Software Design, Inc.
+ *
+ * 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.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
+ */
+
+#ifndef _SYS__DECLS_H_
+#define _SYS__DECLS_H_
+
+#if defined(__cplusplus)
+#define __BEGIN_DECLS extern "C" {
+#define __END_DECLS }
+#else
+#define __BEGIN_DECLS
+#define __END_DECLS
+#endif
+
+#endif
diff --git a/sys/sys/_types.h b/sys/sys/_types.h
index a2ee83a862da..bc438c17c8c0 100644
--- a/sys/sys/_types.h
+++ b/sys/sys/_types.h
@@ -40,18 +40,23 @@
*/
typedef signed char __int8_t;
typedef unsigned char __uint8_t;
+#define __SIZEOF_INT8_T __SIZEOF_CHAR__
typedef short __int16_t;
typedef unsigned short __uint16_t;
+#define __SIZEOF_INT16_T __SIZEOF_SHORT__
typedef int __int32_t;
typedef unsigned int __uint32_t;
+#define __SIZEOF_INT32_T __SIZEOF_INT__
#if __SIZEOF_LONG__ == 8
typedef long __int64_t;
typedef unsigned long __uint64_t;
+#define __SIZEOF_INT64_T __SIZEOF_LONG__
#elif __SIZEOF_LONG__ == 4
__extension__
typedef long long __int64_t;
__extension__
typedef unsigned long long __uint64_t;
+#define __SIZEOF_INT64_T __SIZEOF_LONG_LONG__
#else
#error unsupported long size
#endif
diff --git a/sys/sys/abi_types.h b/sys/sys/abi_types.h
index 44d1bd733bbd..ddacd08ff011 100644
--- a/sys/sys/abi_types.h
+++ b/sys/sys/abi_types.h
@@ -27,8 +27,10 @@ typedef struct {
#if defined(__amd64__) || defined(__i386__)
typedef __int32_t time32_t;
+#define __SIZEOF_TIME32_T __SIZEOF_INT32_T
#else
typedef __int64_t time32_t;
+#define __SIZEOF_TIME32_T __SIZEOF_INT64_T
#endif
#define __HAVE_TIME32_T
diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h
index a08c50c8439a..d0a34f1bdfc0 100644
--- a/sys/sys/cdefs.h
+++ b/sys/sys/cdefs.h
@@ -61,13 +61,7 @@
#define __has_builtin(x) 0
#endif
-#if defined(__cplusplus)
-#define __BEGIN_DECLS extern "C" {
-#define __END_DECLS }
-#else
-#define __BEGIN_DECLS
-#define __END_DECLS
-#endif
+#include <sys/_decls.h>
/*
* This code has been put in place to help reduce the addition of
diff --git a/sys/sys/fcntl.h b/sys/sys/fcntl.h
index 0b13241f0ee3..80cbca4ea753 100644
--- a/sys/sys/fcntl.h
+++ b/sys/sys/fcntl.h
@@ -142,6 +142,13 @@ typedef __pid_t pid_t;
#define O_EMPTY_PATH 0x02000000
#define O_NAMEDATTR 0x04000000 /* NFSv4 named attributes */
#define O_XATTR O_NAMEDATTR /* Solaris compatibility */
+
+/*
+ * Emulate MacOSX compatibility flag without consuming a flags bit.
+ * It is not fully correct since reads over regular files opened with
+ * this definition fail.
+ */
+#define O_SYMLINK (O_PATH | O_NOFOLLOW)
#endif
#if __POSIX_VISIBLE >= 202405
diff --git a/sys/sys/mount.h b/sys/sys/mount.h
index 1ca492929813..d6696bba0a4f 100644
--- a/sys/sys/mount.h
+++ b/sys/sys/mount.h
@@ -36,8 +36,10 @@
#include <sys/ucred.h>
#include <sys/queue.h>
#ifdef _KERNEL
+#include <sys/systm.h>
#include <sys/lock.h>
#include <sys/lockmgr.h>
+#include <sys/proc.h>
#include <sys/tslog.h>
#include <sys/_mutex.h>
#include <sys/_sx.h>
@@ -851,114 +853,134 @@ struct vfsops {
vfs_statfs_t __vfs_statfs;
-#define VFS_MOUNT(MP) ({ \
- int _rc; \
- \
- TSRAW(curthread, TS_ENTER, "VFS_MOUNT", (MP)->mnt_vfc->vfc_name);\
- _rc = (*(MP)->mnt_op->vfs_mount)(MP); \
- TSRAW(curthread, TS_EXIT, "VFS_MOUNT", (MP)->mnt_vfc->vfc_name);\
- _rc; })
+static inline int
+VFS_MOUNT(struct mount *mp)
+{
+ int rc;
-#define VFS_UNMOUNT(MP, FORCE) ({ \
- int _rc; \
- \
- _rc = (*(MP)->mnt_op->vfs_unmount)(MP, FORCE); \
- _rc; })
+ TSRAW(curthread, TS_ENTER, "VFS_MOUNT", mp->mnt_vfc->vfc_name);
+ rc = mp->mnt_op->vfs_mount(mp);
+ TSRAW(curthread, TS_EXIT, "VFS_MOUNT", mp->mnt_vfc->vfc_name);
+ return (rc);
+}
-#define VFS_ROOT(MP, FLAGS, VPP) ({ \
- int _rc; \
- \
- _rc = (*(MP)->mnt_op->vfs_root)(MP, FLAGS, VPP); \
- _rc; })
+static inline int
+VFS_UNMOUNT(struct mount *mp, int force)
+{
+ return (mp->mnt_op->vfs_unmount(mp, force));
+}
-#define VFS_CACHEDROOT(MP, FLAGS, VPP) ({ \
- int _rc; \
- \
- _rc = (*(MP)->mnt_op->vfs_cachedroot)(MP, FLAGS, VPP); \
- _rc; })
+static inline int
+VFS_ROOT(struct mount *mp, int flags, struct vnode **vpp)
+{
+ return (mp->mnt_op->vfs_root(mp, flags, vpp));
+}
-#define VFS_QUOTACTL(MP, C, U, A, MP_BUSY) ({ \
- int _rc; \
- \
- _rc = (*(MP)->mnt_op->vfs_quotactl)(MP, C, U, A, MP_BUSY); \
- _rc; })
+static inline int
+VFS_CACHEDROOT(struct mount *mp, int flags, struct vnode **vpp)
+{
+ return (mp->mnt_op->vfs_cachedroot(mp, flags, vpp));
+}
-#define VFS_STATFS(MP, SBP) ({ \
- int _rc; \
- \
- _rc = __vfs_statfs((MP), (SBP)); \
- _rc; })
+static inline int
+VFS_QUOTACTL(struct mount *mp, int cmds, uid_t uid, void *arg, bool *mp_busy)
+{
+ return (mp->mnt_op->vfs_quotactl(mp, cmds, uid, arg, mp_busy));
+}
-#define VFS_SYNC(MP, WAIT) ({ \
- int _rc; \
- \
- _rc = (*(MP)->mnt_op->vfs_sync)(MP, WAIT); \
- _rc; })
+static inline int
+VFS_STATFS(struct mount *mp, struct statfs *sbp)
+{
+ return (__vfs_statfs(mp, sbp));
+}
-#define VFS_VGET(MP, INO, FLAGS, VPP) ({ \
- int _rc; \
- \
- _rc = (*(MP)->mnt_op->vfs_vget)(MP, INO, FLAGS, VPP); \
- _rc; })
+static inline int
+VFS_SYNC(struct mount *mp, int waitfor)
+{
+ return (mp->mnt_op->vfs_sync(mp, waitfor));
+}
-#define VFS_FHTOVP(MP, FIDP, FLAGS, VPP) ({ \
- int _rc; \
- \
- _rc = (*(MP)->mnt_op->vfs_fhtovp)(MP, FIDP, FLAGS, VPP); \
- _rc; })
+static inline int
+VFS_VGET(struct mount *mp, ino_t ino, int flags, struct vnode **vpp)
+{
+ return (mp->mnt_op->vfs_vget(mp, ino, flags, vpp));
+}
-#define VFS_CHECKEXP(MP, NAM, EXFLG, CRED, NUMSEC, SEC) ({ \
- int _rc; \
- \
- _rc = (*(MP)->mnt_op->vfs_checkexp)(MP, NAM, EXFLG, CRED, NUMSEC,\
- SEC); \
- _rc; })
+static inline int
+VFS_FHTOVP(struct mount *mp, struct fid *fidp, int flags, struct vnode **vpp)
+{
+ return (mp->mnt_op->vfs_fhtovp(mp, fidp, flags, vpp));
+}
-#define VFS_EXTATTRCTL(MP, C, FN, NS, N) ({ \
- int _rc; \
- \
- _rc = (*(MP)->mnt_op->vfs_extattrctl)(MP, C, FN, NS, N); \
- _rc; })
+static inline int
+VFS_CHECKEXP(struct mount *mp, struct sockaddr *nam, uint64_t *extflagsp,
+ struct ucred **credanonp, int *numsecflavors, int *secflavors)
+{
+ return (mp->mnt_op->vfs_checkexp(mp, nam, extflagsp, credanonp,
+ numsecflavors, secflavors));
+}
-#define VFS_SYSCTL(MP, OP, REQ) ({ \
- int _rc; \
- \
- _rc = (*(MP)->mnt_op->vfs_sysctl)(MP, OP, REQ); \
- _rc; })
+static inline int
+VFS_EXTATTRCTL(struct mount *mp, int cmd, struct vnode *filename_vp,
+ int attrnamespace, const char *attrname)
+{
+ return (mp->mnt_op->vfs_extattrctl(mp, cmd, filename_vp,
+ attrnamespace, attrname));
+}
-#define VFS_SUSP_CLEAN(MP) do { \
- if (*(MP)->mnt_op->vfs_susp_clean != NULL) { \
- (*(MP)->mnt_op->vfs_susp_clean)(MP); \
- } \
-} while (0)
+static inline int
+VFS_SYSCTL(struct mount *mp, fsctlop_t op, struct sysctl_req *req)
+{
+ return (mp->mnt_op->vfs_sysctl(mp, op, req));
+}
-#define VFS_RECLAIM_LOWERVP(MP, VP) do { \
- if (*(MP)->mnt_op->vfs_reclaim_lowervp != NULL) { \
- (*(MP)->mnt_op->vfs_reclaim_lowervp)((MP), (VP)); \
- } \
-} while (0)
+static inline void
+VFS_SUSP_CLEAN(struct mount *mp)
+{
+ if (mp->mnt_op->vfs_susp_clean != NULL)
+ mp->mnt_op->vfs_susp_clean(mp);
+}
-#define VFS_UNLINK_LOWERVP(MP, VP) do { \
- if (*(MP)->mnt_op->vfs_unlink_lowervp != NULL) { \
- (*(MP)->mnt_op->vfs_unlink_lowervp)((MP), (VP)); \
- } \
-} while (0)
+static inline void
+VFS_RECLAIM_LOWERVP(struct mount *mp, struct vnode *vp)
+{
+ if (mp->mnt_op->vfs_reclaim_lowervp != NULL)
+ mp->mnt_op->vfs_reclaim_lowervp(mp, vp);
+}
-#define VFS_PURGE(MP) do { \
- if (*(MP)->mnt_op->vfs_purge != NULL) { \
- (*(MP)->mnt_op->vfs_purge)(MP); \
- } \
-} while (0)
+static inline void
+VFS_UNLINK_LOWERVP(struct mount *mp, struct vnode *vp)
+{
+ if (mp->mnt_op->vfs_unlink_lowervp != NULL)
+ mp->mnt_op->vfs_unlink_lowervp(mp, vp);
+}
-#define VFS_KNOTE_LOCKED(vp, hint) do \
-{ \
- VN_KNOTE((vp), (hint), KNF_LISTLOCKED); \
-} while (0)
+static inline void
+VFS_PURGE(struct mount *mp)
+{
+ if (mp->mnt_op->vfs_purge != NULL)
+ mp->mnt_op->vfs_purge(mp);
+}
-#define VFS_KNOTE_UNLOCKED(vp, hint) do \
-{ \
- VN_KNOTE((vp), (hint), 0); \
-} while (0)
+#include <sys/vnode.h>
+
+static inline void
+VFS_KNOTE_LOCKED(struct vnode *vp, int hint)
+{
+ if ((vn_irflag_read(vp) & VIRF_KNOTE) != 0) {
+ KNOTE_LOCKED(&vp->v_pollinfo->vpi_selinfo.si_note,
+ hint);
+ }
+}
+
+static inline void
+VFS_KNOTE_UNLOCKED(struct vnode *vp, int hint)
+{
+ if ((vn_irflag_read(vp) & VIRF_KNOTE) != 0) {
+ KNOTE_UNLOCKED(&vp->v_pollinfo->vpi_selinfo.si_note,
+ hint);
+ }
+}
#include <sys/module.h>
@@ -1137,47 +1159,64 @@ void resume_all_fs(void);
*/
#define vfs_mount_pcpu(mp) zpcpu_get(mp->mnt_pcpu)
#define vfs_mount_pcpu_remote(mp, cpu) zpcpu_get_cpu(mp->mnt_pcpu, cpu)
+static void vfs_op_thread_exit_crit(struct mount *mp, struct mount_pcpu *mpcpu);
-#define vfs_op_thread_entered(mp) ({ \
- MPASS(curthread->td_critnest > 0); \
- struct mount_pcpu *_mpcpu = vfs_mount_pcpu(mp); \
- _mpcpu->mntp_thread_in_ops == 1; \
-})
+static inline bool
+vfs_op_thread_entered(struct mount *mp)
+{
+ struct mount_pcpu *mpcpu = vfs_mount_pcpu(mp);
-#define vfs_op_thread_enter_crit(mp, _mpcpu) ({ \
- bool _retval_crit = true; \
- MPASS(curthread->td_critnest > 0); \
- _mpcpu = vfs_mount_pcpu(mp); \
- MPASS(mpcpu->mntp_thread_in_ops == 0); \
- _mpcpu->mntp_thread_in_ops = 1; \
- atomic_interrupt_fence(); \
- if (__predict_false(mp->mnt_vfs_ops > 0)) { \
- vfs_op_thread_exit_crit(mp, _mpcpu); \
- _retval_crit = false; \
- } \
- _retval_crit; \
-})
+ MPASS(curthread->td_critnest > 0);
+ return (mpcpu->mntp_thread_in_ops == 1);
+}
-#define vfs_op_thread_enter(mp, _mpcpu) ({ \
- bool _retval; \
- critical_enter(); \
- _retval = vfs_op_thread_enter_crit(mp, _mpcpu); \
- if (__predict_false(!_retval)) \
- critical_exit(); \
- _retval; \
-})
+static inline bool
+vfs_op_thread_enter_crit(struct mount *mp, struct mount_pcpu **mpcpup)
+{
+ struct mount_pcpu *mpcpu;
+ bool retval_crit = true;
-#define vfs_op_thread_exit_crit(mp, _mpcpu) do { \
- MPASS(_mpcpu == vfs_mount_pcpu(mp)); \
- MPASS(_mpcpu->mntp_thread_in_ops == 1); \
- atomic_interrupt_fence(); \
- _mpcpu->mntp_thread_in_ops = 0; \
-} while (0)
+ MPASS(curthread->td_critnest > 0);
+ mpcpu = vfs_mount_pcpu(mp);
+ MPASS(mpcpu->mntp_thread_in_ops == 0);
+ mpcpu->mntp_thread_in_ops = 1;
+ atomic_interrupt_fence();
+ if (__predict_false(mp->mnt_vfs_ops > 0)) {
+ vfs_op_thread_exit_crit(mp, mpcpu);
+ retval_crit = false;
+ }
+ *mpcpup = mpcpu;
+ return (retval_crit);
+}
-#define vfs_op_thread_exit(mp, _mpcpu) do { \
- vfs_op_thread_exit_crit(mp, _mpcpu); \
- critical_exit(); \
-} while (0)
+static inline bool
+vfs_op_thread_enter(struct mount *mp, struct mount_pcpu **mpcpup)
+{
+ bool retval;
+
+ critical_enter();
+ retval = vfs_op_thread_enter_crit(mp, mpcpup);
+ if (__predict_false(!retval))
+ critical_exit();
+ return (retval);
+}
+
+static inline void
+vfs_op_thread_exit_crit(struct mount *mp, struct mount_pcpu *mpcpu)
+{
+ MPASS(mpcpu == vfs_mount_pcpu(mp));
+ MPASS(mpcpu->mntp_thread_in_ops == 1);
+
+ atomic_interrupt_fence();
+ mpcpu->mntp_thread_in_ops = 0;
+}
+
+static inline void
+vfs_op_thread_exit(struct mount *mp, struct mount_pcpu *mpcpu)
+{
+ vfs_op_thread_exit_crit(mp, mpcpu);
+ critical_exit();
+}
#define vfs_mp_count_add_pcpu(_mpcpu, count, val) do { \
MPASS(_mpcpu->mntp_thread_in_ops == 1); \
diff --git a/sys/sys/time.h b/sys/sys/time.h
index 6f18d8bd844d..5255d3bc9c7e 100644
--- a/sys/sys/time.h
+++ b/sys/sys/time.h
@@ -355,7 +355,7 @@ tstosbt(struct timespec _ts)
static __inline sbintime_t
tstosbt_sat(struct timespec _ts)
{
-#ifndef __i386__
+#if __SIZEOF_TIME_T > 4
if (_ts.tv_sec > SBT_MAX >> 32)
return (SBT_MAX);
if (_ts.tv_sec < -(SBT_MAX >> 32) - 1)
@@ -384,7 +384,7 @@ tvtosbt(struct timeval _tv)
static __inline sbintime_t
tvtosbt_sat(struct timeval _tv)
{
-#ifndef __i386__
+#if __SIZEOF_TIME_T > 4
if (_tv.tv_sec > SBT_MAX >> 32)
return (SBT_MAX);
if (_tv.tv_sec < -(SBT_MAX >> 32) - 1)
diff --git a/sys/sys/ucred.h b/sys/sys/ucred.h
index ba241cf9ff3a..4bf48a5e4b87 100644
--- a/sys/sys/ucred.h
+++ b/sys/sys/ucred.h
@@ -193,6 +193,17 @@ struct setcred32 {
uint32_t sc_label; /* struct mac32 [*] */
};
+#ifdef COMPAT_FREEBSD32
+/* 32-bit compatible version of xucred */
+struct xucred32 {
+ u_int cr_version; /* structure layout version */
+ uid_t cr_uid; /* effective user id */
+ short cr_ngroups; /* number of groups (incl. cr_gid). */
+ gid_t cr_groups[XU_NGROUPS]; /* groups */
+ pid_t cr_pid;
+};
+#endif
+
struct thread;
/* Common native and 32-bit compatibility entry point. */
diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h
index 3fd2c770cda1..4fee025a93ea 100644
--- a/sys/sys/vnode.h
+++ b/sys/sys/vnode.h
@@ -221,21 +221,16 @@ _Static_assert(sizeof(struct vnode) <= 448, "vnode size crosses 448 bytes");
#define bo2vnode(bo) __containerof((bo), struct vnode, v_bufobj)
-/* XXX: These are temporary to avoid a source sweep at this time */
#define v_object v_bufobj.bo_object
-/* We don't need to lock the knlist */
-#define VN_KNLIST_EMPTY(vp) ((vp)->v_pollinfo == NULL || \
- KNLIST_EMPTY(&(vp)->v_pollinfo->vpi_selinfo.si_note))
-
-#define VN_KNOTE(vp, b, a) \
- do { \
- if (!VN_KNLIST_EMPTY(vp)) \
- KNOTE(&vp->v_pollinfo->vpi_selinfo.si_note, (b), \
- (a) | KNF_NOKQLOCK); \
- } while (0)
-#define VN_KNOTE_LOCKED(vp, b) VN_KNOTE(vp, b, KNF_LISTLOCKED)
-#define VN_KNOTE_UNLOCKED(vp, b) VN_KNOTE(vp, b, 0)
+#define VN_KNOTE(vp, b, a) do { \
+ if ((vn_irflag_read(vp) & VIRF_KNOTE) != 0) { \
+ KNOTE(&vp->v_pollinfo->vpi_selinfo.si_note, (b), \
+ (a) | KNF_NOKQLOCK); \
+ } \
+} while (0)
+#define VN_KNOTE_LOCKED(vp, b) VN_KNOTE(vp, b, KNF_LISTLOCKED)
+#define VN_KNOTE_UNLOCKED(vp, b) VN_KNOTE(vp, b, 0)
/*
* Vnode flags.
@@ -260,6 +255,7 @@ _Static_assert(sizeof(struct vnode) <= 448, "vnode size crosses 448 bytes");
#define VIRF_INOTIFY 0x0080 /* This vnode is being watched */
#define VIRF_INOTIFY_PARENT 0x0100 /* A parent of this vnode may be being
watched */
+#define VIRF_KNOTE 0x0200 /* Has knlist */
#define VI_UNUSED0 0x0001 /* unused */
#define VI_MOUNT 0x0002 /* Mount in progress */
@@ -1052,7 +1048,7 @@ void vop_rename_fail(struct vop_rename_args *ap);
off_t osize, ooffset, noffset; \
\
osize = ooffset = noffset = 0; \
- if (!VN_KNLIST_EMPTY((ap)->a_vp)) { \
+ if ((vn_irflag_read((ap)->a_vp) & VIRF_KNOTE) != 0) { \
error = VOP_GETATTR((ap)->a_vp, &va, (ap)->a_cred); \
if (error) \
return (error); \
@@ -1063,10 +1059,8 @@ void vop_rename_fail(struct vop_rename_args *ap);
#define vop_write_post(ap, ret) \
noffset = (ap)->a_uio->uio_offset; \
if (noffset > ooffset) { \
- if (!VN_KNLIST_EMPTY((ap)->a_vp)) { \
- VFS_KNOTE_LOCKED((ap)->a_vp, NOTE_WRITE | \
- (noffset > osize ? NOTE_EXTEND : 0)); \
- } \
+ VFS_KNOTE_LOCKED((ap)->a_vp, NOTE_WRITE | \
+ (noffset > osize ? NOTE_EXTEND : 0)); \
INOTIFY((ap)->a_vp, IN_MODIFY); \
}
diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c
index 7ead7d7e6472..94dd7d3a19bc 100644
--- a/sys/vm/vm_map.c
+++ b/sys/vm/vm_map.c
@@ -4761,8 +4761,7 @@ vm_map_growstack(vm_map_t map, vm_offset_t addr, vm_map_entry_t gap_entry)
* debugger or AIO daemon. The reason is that the wrong
* resource limits are applied.
*/
- if (p != initproc && (map != &p->p_vmspace->vm_map ||
- p->p_textvp == NULL))
+ if (p != initproc && (map != &vm->vm_map || p->p_textvp == NULL))
return (KERN_FAILURE);
MPASS(!vm_map_is_system(map));
diff --git a/sys/x86/cpufreq/hwpstate_amd.c b/sys/x86/cpufreq/hwpstate_amd.c
index 5e075a26a57b..bbc6592579e3 100644
--- a/sys/x86/cpufreq/hwpstate_amd.c
+++ b/sys/x86/cpufreq/hwpstate_amd.c
@@ -745,7 +745,7 @@ hwpstate_settings(device_t dev, struct cf_setting *sets, int *count)
static int
hwpstate_type_cppc(device_t dev, int *type)
{
- *type |= CPUFREQ_TYPE_ABSOLUTE | CPUFREQ_FLAG_INFO_ONLY |
+ *type = CPUFREQ_TYPE_ABSOLUTE | CPUFREQ_FLAG_INFO_ONLY |
CPUFREQ_FLAG_UNCACHED;
return (0);
}
diff --git a/sys/x86/include/_types.h b/sys/x86/include/_types.h
index b33dc0bfc7af..2630af1257c7 100644
--- a/sys/x86/include/_types.h
+++ b/sys/x86/include/_types.h
@@ -71,10 +71,12 @@ typedef __int64_t __int_fast64_t;
typedef __int64_t __register_t;
typedef __int64_t __segsz_t; /* segment size (in pages) */
typedef __int64_t __time_t; /* time()... */
+#define __SIZEOF_TIME_T __SIZEOF_INT64_T
#else
typedef __int32_t __register_t;
typedef __int32_t __segsz_t;
typedef __int32_t __time_t;
+#define __SIZEOF_TIME_T __SIZEOF_INT32_T
#endif
typedef __uint32_t __uint_fast8_t;
typedef __uint32_t __uint_fast16_t;
diff --git a/tools/build/Makefile b/tools/build/Makefile
index f0856900b281..d71cc710be87 100644
--- a/tools/build/Makefile
+++ b/tools/build/Makefile
@@ -360,6 +360,7 @@ DISKINCS+= ${SRCTOP}/sys/sys/disk/bsd.h
.if ${.MAKE.OS} == "FreeBSD"
# Needed to build most of the things below, which include sys/cdefs.h either
# directly or transitively
+SYSINCS+= ${SRCTOP}/sys/sys/_decls.h
SYSINCS+= ${SRCTOP}/sys/sys/_visible.h
SYSINCS+= ${SRCTOP}/sys/sys/cdefs.h
.endif
diff --git a/usr.bin/stat/tests/stat_test.sh b/usr.bin/stat/tests/stat_test.sh
index 282efc91303f..aa8563c62ccc 100755
--- a/usr.bin/stat/tests/stat_test.sh
+++ b/usr.bin/stat/tests/stat_test.sh
@@ -26,6 +26,7 @@
#
: ${CHKPATH:="mnt"}
+: ${NODEV:="#NODEV"}
atf_test_case F_flag
F_flag_head()
@@ -323,6 +324,7 @@ devname_body()
atf_check -o inline:"$devname\n" stat -f '%Sd' "$CHKPATH"
atf_check -o inline:"$devname\n" stat -f '%Sr' "$devpath"
+ atf_check -o inline:"$NODEV\n" stat -f '%Sr' "$CHKPATH"
}
devname_cleanup()
{