diff options
52 files changed, 697 insertions, 159 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/cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 b/cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 index 5173074ee63e..e78b6e1875ae 100644 --- a/cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 +++ b/cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 @@ -20,7 +20,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 20, 2026 +.Dd May 7, 2026 .Dt DTRACE 1 .Os .Sh NAME @@ -1304,12 +1304,14 @@ in .Xr dtrace_ip 4 , .Xr dtrace_kinst 4 , .Xr dtrace_lockstat 4 , +.Xr dtrace_mib 4 , .Xr dtrace_pid 4 , .Xr dtrace_proc 4 , .Xr dtrace_priv 4 , .Xr dtrace_profile 4 , .Xr dtrace_sched 4 , .Xr dtrace_sctp 4 , +.Xr dtrace_syscall 4 , .Xr dtrace_tcp 4 , .Xr dtrace_udp 4 , .Xr dtrace_udplite 4 , diff --git a/lib/libpfctl/libpfctl.c b/lib/libpfctl/libpfctl.c index ac60a924c228..4e51167b401a 100644 --- a/lib/libpfctl/libpfctl.c +++ b/lib/libpfctl/libpfctl.c @@ -1929,6 +1929,8 @@ static const struct snl_attr_parser nla_p_skey[] = { SNL_DECLARE_ATTR_PARSER(skey_parser, nla_p_skey); #undef _OUT +SNL_DECLARE_ATTR_PARSER(rule_parser, ap_getrule); + #define _IN(_field) offsetof(struct genlmsghdr, _field) #define _OUT(_field) offsetof(struct pfctl_state, _field) static struct snl_attr_parser ap_state[] = { @@ -1963,6 +1965,7 @@ static struct snl_attr_parser ap_state[] = { { .type = PF_ST_RT_IFNAME, .off = _OUT(rt_ifname), .cb = snl_attr_store_ifname }, { .type = PF_ST_SRC_NODE_FLAGS, .off = _OUT(src_node_flags), .cb = snl_attr_get_uint8 }, { .type = PF_ST_RT_AF, .off = _OUT(rt_af), .cb = snl_attr_get_uint8 }, + { .type = PF_ST_CREATED_BY_RULE, .off = _OUT(created_by_rule), .arg = &rule_parser, .cb = snl_attr_get_nested }, }; #undef _IN #undef _OUT @@ -1988,6 +1991,7 @@ pfctl_get_states_h(struct pfctl_handle *h, struct pfctl_state_filter *filter, pf snl_add_msg_attr_u8(&nw, PF_ST_AF, filter->af); snl_add_msg_attr_ip6(&nw, PF_ST_FILTER_ADDR, &filter->addr.v6); snl_add_msg_attr_ip6(&nw, PF_ST_FILTER_MASK, &filter->mask.v6); + snl_add_msg_attr_bool(&nw, PF_ST_INCLUDE_RULE, filter->include_rule); hdr = snl_finalize_msg(&nw); if (hdr == NULL) diff --git a/lib/libpfctl/libpfctl.h b/lib/libpfctl/libpfctl.h index 1012be53db65..3080209ec7a0 100644 --- a/lib/libpfctl/libpfctl.h +++ b/lib/libpfctl/libpfctl.h @@ -406,6 +406,7 @@ struct pfctl_state { char rt_ifname[IFNAMSIZ]; sa_family_t rt_af; uint8_t src_node_flags; + struct pfctl_rule created_by_rule; }; TAILQ_HEAD(pfctl_statelist, pfctl_state); @@ -504,6 +505,7 @@ struct pfctl_state_filter { sa_family_t af; struct pf_addr addr; struct pf_addr mask; + bool include_rule; }; typedef int (*pfctl_get_state_fn)(struct pfctl_state *, void *); int pfctl_get_states_iter(pfctl_get_state_fn f, void *arg); diff --git a/lib/libsys/intro.2 b/lib/libsys/intro.2 index 008936b278ae..33dfecf648c5 100644 --- a/lib/libsys/intro.2 +++ b/lib/libsys/intro.2 @@ -28,7 +28,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd April 19, 2024 +.Dd May 7, 2026 .Dt INTRO 2 .Os .Sh NAME @@ -756,7 +756,8 @@ during a system boot. .El .Sh SEE ALSO .Xr intro 3 , -.Xr perror 3 +.Xr perror 3 , +.Xr dtrace_syscall 4 .Sh HISTORY The .Nm Ns Pq 2 diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index 57a5140ffeb7..7e9d81da6ed9 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -4242,7 +4242,7 @@ dynaddr : '(' STRING ')' { char *p, *op; op = $2; - if (!isalpha(op[0])) { + if (op[0] == '\0') { yyerror("invalid interface name '%s'", op); free(op); YYERROR; diff --git a/sbin/pfctl/pf_print_state.c b/sbin/pfctl/pf_print_state.c index 1c5a46f86b35..9b0c57fd73d3 100644 --- a/sbin/pfctl/pf_print_state.c +++ b/sbin/pfctl/pf_print_state.c @@ -434,6 +434,10 @@ print_state(struct pfctl_state *s, int opts) if (strcmp(s->ifname, s->orig_ifname) != 0) printf(" origif: %s\n", s->orig_ifname); + + printf(" rule: "); + print_rule(&s->created_by_rule, "", 0, 0); + printf("\n"); } } diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c index f35baf25ec35..c349487ed9d2 100644 --- a/sbin/pfctl/pfctl.c +++ b/sbin/pfctl/pfctl.c @@ -1996,6 +1996,9 @@ pfctl_show_states(int dev, const char *iface, int opts) if (iface != NULL) strlcpy(filter.ifname, iface, IFNAMSIZ); + if (opts & PF_OPT_VERBOSE2) + filter.include_rule = true; + arg.opts = opts; arg.dotitle = opts & PF_OPT_SHOWALL; arg.iface = iface; diff --git a/sbin/sysctl/sysctl.8 b/sbin/sysctl/sysctl.8 index e0e35f075a78..b97bce320898 100644 --- a/sbin/sysctl/sysctl.8 +++ b/sbin/sysctl/sysctl.8 @@ -28,7 +28,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd January 31, 2025 +.Dd May 7, 2026 .Dt SYSCTL 8 .Os .Sh NAME @@ -336,6 +336,7 @@ The option has been deprecated and is silently ignored. .Sh SEE ALSO .Xr sysctl 3 , +.Xr dtrace_mib 4 , .Xr loader.conf 5 , .Xr sysctl.conf 5 , .Xr security 7 , diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index 60ab6e8bdab6..b9c441e97597 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -1023,12 +1023,14 @@ _dtrace_provs= dtrace_audit.4 \ dtrace_ip.4 \ dtrace_kinst.4 \ dtrace_lockstat.4 \ + dtrace_mib.4 \ dtrace_pid.4 \ dtrace_priv.4 \ dtrace_proc.4 \ dtrace_profile.4 \ dtrace_sched.4 \ dtrace_sctp.4 \ + dtrace_syscall.4 \ dtrace_tcp.4 \ dtrace_udp.4 \ dtrace_udplite.4 \ diff --git a/share/man/man4/dtrace_cam.4 b/share/man/man4/dtrace_cam.4 index e5b7ae34c391..8e2790e72d22 100644 --- a/share/man/man4/dtrace_cam.4 +++ b/share/man/man4/dtrace_cam.4 @@ -2,7 +2,7 @@ .\" .\" SPDX-License-Identifier: BSD-2-Clause .\" -.Dd December 26, 2025 +.Dd May 7, 2026 .Dt DTRACE_CAM 4 .Os .Sh NAME @@ -25,11 +25,9 @@ probe fires when that request completes. The .Fn cam::xpt:async-cb probe fires just before an async callback is called. -.Sh ARGUMENTS -.Sh FILES -.Sh EXAMPLES .Sh SEE ALSO .Xr dtrace 1 , +.Xr cam 4 , .Xr SDT 9 .Sh HISTORY The diff --git a/share/man/man4/dtrace_ip.4 b/share/man/man4/dtrace_ip.4 index e9fbdfa3cf43..6faeb305ffc5 100644 --- a/share/man/man4/dtrace_ip.4 +++ b/share/man/man4/dtrace_ip.4 @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd September 14, 2015 +.Dd May 7, 2026 .Dt DTRACE_IP 4 .Os .Sh NAME @@ -266,6 +266,7 @@ This provider is compatible with the providers found in Solaris and Darwin. .Sh SEE ALSO .Xr dtrace 1 , +.Xr dtrace_mib 4 , .Xr dtrace_tcp 4 , .Xr dtrace_udp 4 , .Xr ip 4 , diff --git a/share/man/man4/dtrace_mib.4 b/share/man/man4/dtrace_mib.4 new file mode 100644 index 000000000000..e8c2dd3a6f05 --- /dev/null +++ b/share/man/man4/dtrace_mib.4 @@ -0,0 +1,123 @@ +.\" +.\" Copyright (c) 2025-2026 Mateusz Piotrowski <0mp@FreeBSD.org> +.\" +.\" SPDX-License-Identifier: BSD-2-Clause +.\" +.Dd May 7, 2026 +.Dt DTRACE_MIB 4 +.Os +.Sh NAME +.Nm dtrace_mib +.Nd a DTrace provider for Management Information Base +.Sh SYNOPSIS +.Cm mib: Ns Ar module Ns Cm \&:count: Ns Ar counter +.Pp +In +.Xr config 5 : +.Cd "options KDTRACE_MIB_SDT" +.Sh DESCRIPTION +The +.Nm mib +provider allows tracing of Management Information Base stats counters. +.Pp +The list of instrumented +.Ar module Ns s +includes: +.Bl -tag -offset indent -width ipcomp -compact +.It Cm ah +IP Authentication Header (RFC 2402), +.Xr ipsec 4 +.It Cm esp +IP Encapsulating Security Payload (RFC 1827, RFC 2406), +.Xr ipsec 4 +.It Cm icmp +.Xr icmp 4 +.It Cm icmp6 +.Xr icmp6 4 +.It Cm ip +.Xr ip 4 +.It Cm ip6 +.Xr ip6 4 +.It Cm ipcomp +IP Payload Compression Protocol, +.Xr ipsec 4 +.It Cm ipsec +.Xr ipsec 4 +.It Cm tcp +.Xr tcp 4 +.It Cm udp +.Xr udp 4 +.El +.Pp +The +.Cm mib: Ns Ar module Ns Cm \&:count: Ns Ar counter +probes fire when the +.Ar counter +in +.Ar module Ns s +increases. +.Pp +The first probe argument, +.Vt uint64_t Va args[0] , +is the increment that the +.Ar counter +will increase by. +.Pp +Note that some probes like +.Cm mib:esp:count:esps_hist +or +.Cm mib:icmp6:count:icp6s_outhist +provide additional probe-specific arguments. +.Sh EXAMPLES +.Ss Example 1 : Tracing IP Stats Counters +When debugging network issues one common clue is an unexpectedly +incrementing error counter. +This is helpful, in that it gives us an +idea of what might be going wrong, but often these counters may be +incremented in different functions. +.Pp +Trace all +.Nm mib +probes in the +.Xr ip 4 +module and print the current count and a stack trace: +.Pp +.Bd -literal -offset 2n +# dtrace -n 'mib:ip:count: { printf("%d", arg0); stack(); }' +dtrace: description 'mib:ip:count: ' matched 29 probes +CPU ID FUNCTION:NAME + 7 98784 count:ips_localout 1 + kernel`ip_output+0x17a2 + kernel`udp_send+0xaca + kernel`sosend_dgram+0x315 + kernel`sousrsend+0x79 + kernel`kern_sendit+0x1be + kernel`sendit+0x1ab + kernel`sys_sendmsg+0x5b + kernel`amd64_syscall+0x169 + kernel`0xffffffff81094b8b +.Ed +.Sh SEE ALSO +.Xr dtrace 1 , +.Xr dtrace_ip 4 , +.Xr dtrace_tcp 4 , +.Xr dtrace_udp 4 , +.Xr tracing 7 , +.Xr sysctl 8 +.Sh STANDARDS +The probe descriptions in +the +.Fx +.Nm mib +provider are not compatible with those in the Solaris/illumos mib provider. +.Sh AUTHORS +.An -nosplit +The +.Nm mib +provider was added to +.Fx +by +.An Kristof Provost Aq Mt kp@FreeBSD.org . +.Pp +This manual page was written by +.An Mateusz Piotrowski Aq Mt 0mp@FreeBSD.org . diff --git a/share/man/man4/dtrace_syscall.4 b/share/man/man4/dtrace_syscall.4 new file mode 100644 index 000000000000..e154e4c6046b --- /dev/null +++ b/share/man/man4/dtrace_syscall.4 @@ -0,0 +1,87 @@ +.\" +.\" SPDX-License-Identifier: BSD-2-Clause +.\" +.\" Copyright (c) 2026 Mateusz Piotrowski <0mp@FreeBSD.org> +.\" +.Dd May 7, 2026 +.Dt DTRACE_SYSCALL 4 +.Os +.Sh NAME +.Nm dtrace_syscall +.Nd a DTrace provider for system calls +.Sh SYNOPSIS +.Nm syscall Ns Cm \&: Ns Ar abi Ns Cm \&: Ns Ar syscall Ns Cm :entry +.Nm syscall Ns Cm \&: Ns Ar abi Ns Cm \&: Ns Ar syscall Ns Cm :return +.Sh DESCRIPTION +The +.Nm syscall +provider provides entry and return probes for system calls. +.Pp +The module in the probe's description is +.Ar abi , +which indicates what system call ABI a +.Ar syscall +belongs to. +.Nm +supports the following system call ABIs: +.Pp +.Bl -tag -offset indent -width freebsd32 -compact +.It Cm freebsd +Native ABI. +.It Cm freebsd32 +Non-native, 32-bit ABI. +.It Cm linux +Refer to +.Xr linux 4 . +.It Cm linux32 +Refer to +.Xr linux 4 . +.El +.Pp +The arguments to the +.Cm entry +probes are the arguments passed to the system call. +.Pp +The +.Cm return +probe stores the system call's return value in both +.Fa arg0 +and +.Fa arg1 . +.Pp +Inspect the +.Xr d 7 Ap s +.Va errno +variable to check if a system call failed. +.Sh EXAMPLES +.Ss Example 1 : Count Up System Calls +The following script traces all system calls and counts them for every process +on the system. +.Bd -literal -offset 2n +syscall:::entry { + @[execname, pid] = count(); +} +.Ed +.Sh SEE ALSO +.Xr dtrace 1 , +.Xr intro 2 , +.Xr tracing 7 +.Rs +.%B The illumos Dynamic Tracing Guide +.%O Chapter syscall Provider +.%D 2008 +.%U https://illumos.org/books/dtrace/chp-syscall.html +.Re +.Rs +.%A Brendan Gregg +.%A Jim Mauro +.%B DTrace: Dynamic Tracing in Oracle Solaris, Mac OS X and FreeBSD +.%I Prentice Hall +.%O Chapter Syscall Provider +.%P pp. 315\(en327 +.%D 2011 +.%U https://www.brendangregg.com/dtracebook/ +.Re +.Sh AUTHORS +This manual page was written by +.An Mateusz Piotrowski Aq Mt 0mp@FreeBSD.org . diff --git a/share/man/man4/dtrace_tcp.4 b/share/man/man4/dtrace_tcp.4 index af57f6e94a63..5570dd965706 100644 --- a/share/man/man4/dtrace_tcp.4 +++ b/share/man/man4/dtrace_tcp.4 @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd July 2, 2023 +.Dd May 7, 2026 .Dt DTRACE_TCP 4 .Os .Sh NAME @@ -501,6 +501,7 @@ provider in Solaris. .Sh SEE ALSO .Xr dtrace 1 , .Xr dtrace_ip 4 , +.Xr dtrace_mib 4 , .Xr dtrace_sctp 4 , .Xr dtrace_udp 4 , .Xr dtrace_udplite 4 , diff --git a/share/man/man4/icmp.4 b/share/man/man4/icmp.4 index c8c92a794e24..493d2d218cec 100644 --- a/share/man/man4/icmp.4 +++ b/share/man/man4/icmp.4 @@ -25,7 +25,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd December 11, 2024 +.Dd May 7, 2026 .Dt ICMP 4 .Os .Sh NAME @@ -264,6 +264,7 @@ exists. .Xr recv 2 , .Xr send 2 , .Xr sysctl 3 , +.Xr dtrace_mib 4 , .Xr inet 4 , .Xr intro 4 , .Xr ip 4 , diff --git a/share/man/man4/icmp6.4 b/share/man/man4/icmp6.4 index 8730e3fefacb..d9a8bd34a81a 100644 --- a/share/man/man4/icmp6.4 +++ b/share/man/man4/icmp6.4 @@ -28,7 +28,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd November 1, 2018 +.Dd May 7, 2026 .Dt ICMP6 4 .Os .Sh NAME @@ -243,6 +243,7 @@ structure as the option value. .Xr setsockopt 2 , .Xr socket 2 , .Xr getprotobyname 3 , +.Xr dtrace_mib 4 , .Xr inet6 4 , .Xr ip6 4 , .Xr netintro 4 diff --git a/share/man/man4/ifmib.4 b/share/man/man4/ifmib.4 index 20b5613b6873..48e79c1f9411 100644 --- a/share/man/man4/ifmib.4 +++ b/share/man/man4/ifmib.4 @@ -25,7 +25,7 @@ .\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd December 26, 2020 +.Dd May 7, 2026 .Dt IFMIB 4 .Os .Sh NAME @@ -165,6 +165,7 @@ and implements a superset of the MIB for Ethernet-like networks. .Sh SEE ALSO .Xr sysctl 3 , +.Xr dtrace_mib 4 , .Xr intro 4 , .Xr ifnet 9 .\" .Xr ethermib 4 , diff --git a/share/man/man4/ip.4 b/share/man/man4/ip.4 index fb5ea398c840..140866f6fcf6 100644 --- a/share/man/man4/ip.4 +++ b/share/man/man4/ip.4 @@ -25,7 +25,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd August 9, 2021 +.Dd May 7, 2026 .Dt IP 4 .Os .Sh NAME @@ -907,6 +907,7 @@ field was not equal to the length of the datagram written to the socket. .Xr byteorder 3 , .Xr CMSG_DATA 3 , .Xr sourcefilter 3 , +.Xr dtrace_mib 4 , .Xr icmp 4 , .Xr igmp 4 , .Xr inet 4 , diff --git a/share/man/man4/ipsec.4 b/share/man/man4/ipsec.4 index 9fd6207c2f14..0c60e0e3c121 100644 --- a/share/man/man4/ipsec.4 +++ b/share/man/man4/ipsec.4 @@ -27,7 +27,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd March 4, 2025 +.Dd May 7, 2026 .Dt IPSEC 4 .Os .Sh NAME @@ -336,6 +336,7 @@ routines from looking into the IP payload. .Xr socket 2 , .Xr ipsec_set_policy 3 , .Xr crypto 4 , +.Xr dtrace_mib 4 , .Xr enc 4 , .Xr icmp6 4 , .Xr if_ipsec 4 , diff --git a/share/man/man4/linux.4 b/share/man/man4/linux.4 index 711ac11e8fce..ec8342efe705 100644 --- a/share/man/man4/linux.4 +++ b/share/man/man4/linux.4 @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd May 19, 2024 +.Dd May 7, 2026 .Dt LINUX 4 .Os .Sh NAME @@ -179,6 +179,7 @@ Linux kernel objects file system, see .El .Sh SEE ALSO .Xr brandelf 1 , +.Xr dtrace_syscall 4 , .Xr fdescfs 4 , .Xr linprocfs 4 , .Xr linsysfs 4 , diff --git a/share/man/man4/scsi.4 b/share/man/man4/scsi.4 index e66fccf53e64..b6390fec646e 100644 --- a/share/man/man4/scsi.4 +++ b/share/man/man4/scsi.4 @@ -22,7 +22,7 @@ .\" 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. -.Dd December 11, 2025 +.Dd May 7, 2026 .Dt CAM 4 .Os .Sh NAME @@ -530,6 +530,8 @@ for details. .\" .Xr ps3cdrom 4 , .Xr sbp 4 , .Xr twa 4 +.It Sy DTrace Providers: +.Xr dtrace_cam 4 .El .Sh HISTORY The diff --git a/share/man/man4/smartpqi.4 b/share/man/man4/smartpqi.4 index ef5f903fe422..ae85e184114d 100644 --- a/share/man/man4/smartpqi.4 +++ b/share/man/man4/smartpqi.4 @@ -1,4 +1,4 @@ -.\" Copyright (C) 2019-2025, Microchip Technology Inc. and its subsidiaries +.\" Copyright (C) 2019-2026, Microchip Technology Inc. and its subsidiaries .\" Copyright (C) 2016-2018, Microsemi Corporation .\" Copyright (C) 2016, PMC-Sierra, Inc. .\" Written by John Hall <john.hall@microchip.com> @@ -24,7 +24,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd August 28, 2025 +.Dd April 14, 2026 .Dt SMARTPQI 4 amd64 .Os .Sh NAME @@ -64,11 +64,13 @@ OEM Controllers based on the Microchip Technology Inc. SmartROC and SmartIOC Chipsets .El .Sh DEBUGGING -Driver diagnostic printing is controlled in +Driver diagnostic printing is controlled at boot time in .Xr loader.conf 5 by using the global .Va hw.smartpqi.debug_level -tunable. +tunable, or at runtime via the per-controller +.Va dev.smartpqi.<unit>.debug_level +sysctl. .Pp The .Va debug_level @@ -82,11 +84,27 @@ The following levels are available: .It 0x0002 Ta info Ta Basic information .It 0x0004 Ta function Ta Used to show function entry and exit .It 0x0008 Ta io Ta Logging data from controller -.It 0x0010 Ta discovery Ta Device discovery +.It 0x0010 Ta discovery Ta Device discovery state transitions .It 0x0020 Ta warning Ta Operational warnings .It 0x0040 Ta error Ta Parameter errors and programming bugs .It 0x0080 Ta note Ta More detailed information .El +.Pp +In addition to the level-gated debug output, the driver always logs +device addition, device removal, and controller events +(hotplug, hardware, physical/logical device changes, AIO state and +configuration changes) via +.Xr device_printf 9 , +which appear in +.Xr dmesg 8 +regardless of the +.Va debug_level +setting. +.Pp +For example, to enable discovery logging at runtime on the first controller: +.Bd -literal -offset indent +sysctl dev.smartpqi.0.debug_level=0x0070 +.Ed .Sh DEVICE HINTS The following tunable values can be set in .Pa /boot/device.hints @@ -162,7 +180,9 @@ https://www.microchip.com/design-centers/storage .Xr xpt 4 , .Xr loader.conf 5 , .Xr camcontrol 8 , -.Xr kldload 8 +.Xr dmesg 8 , +.Xr kldload 8 , +.Xr sysctl 8 .Sh HISTORY The .Nm diff --git a/share/man/man4/tcp.4 b/share/man/man4/tcp.4 index 3c9f4ff83f3d..4c01daf4e14e 100644 --- a/share/man/man4/tcp.4 +++ b/share/man/man4/tcp.4 @@ -31,7 +31,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd September 5, 2025 +.Dd May 7, 2026 .Dt TCP 4 .Os .Sh NAME @@ -1098,6 +1098,7 @@ when trying to use a TCP function block that is not available; .Xr stats 3 , .Xr sysctl 3 , .Xr blackhole 4 , +.Xr dtrace_mib 4 , .Xr inet 4 , .Xr intro 4 , .Xr ip 4 , diff --git a/share/man/man4/udp.4 b/share/man/man4/udp.4 index b1dbff56154f..db9d0e0ae2c7 100644 --- a/share/man/man4/udp.4 +++ b/share/man/man4/udp.4 @@ -25,7 +25,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd January 20, 2025 +.Dd May 7, 2026 .Dt UDP 4 .Os .Sh NAME @@ -175,6 +175,7 @@ exists. .Xr send 2 , .Xr socket 2 , .Xr blackhole 4 , +.Xr dtrace_mib 4 , .Xr inet 4 , .Xr intro 4 , .Xr ip 4 , diff --git a/share/man/man7/d.7 b/share/man/man7/d.7 index 59b3389b121b..792f6d36ce73 100644 --- a/share/man/man7/d.7 +++ b/share/man/man7/d.7 @@ -1,9 +1,9 @@ .\" .\" SPDX-License-Identifier: BSD-2-Clause .\" -.\" Copyright (c) 2025 Mateusz Piotrowski <0mp@FreeBSD.org> +.\" Copyright (c) 2025-2026 Mateusz Piotrowski <0mp@FreeBSD.org> .\" -.Dd October 28, 2025 +.Dd May 7, 2026 .Dt D 7 .Os .Sh NAME @@ -39,6 +39,41 @@ This manual page serves as a short reference of the language. Refer to books listed in .Sx SEE ALSO for a complete reference. +.Sh MACRO VARIABLES +.Bl -column "$1, $2, $3, ..." "Syntax" +.It Sy Name Ta Sy Description +.It Va $1 , $2 , $3 , .\&.\&. Ta Macro arguments +.It Va $egid Ta Effective group ID Pq Xr getegid 2 +.It Va $euid Ta Effective user ID Pq Xr geteuid 2 +.It Va $gid Ta Real group ID Pq Xr getgid 2 +.It Va $pid Ta Process ID Pq Xr getpid 2 +.It Va $pgid Ta Process group ID Pq Xr getpgrp 2 +.It Va $ppid Ta Parent process ID Pq Xr getppid 2 +.It Va $sid Ta Session ID Pq Xr getsid 2 +.It Va $target Ta Target process ID of the process +specified via the +.Fl p +flag or created via the +.Fl c +flag. +.It Va $uid Ta Real user ID Pq Xr getuid 2 +.El +.Pp +The macro arguments correspond to the command-line operands. +They expand to an integer, identifier, or string depending on the context. +Prepending a macro argument with an extra dollar sign +.Pq Ql $ +forces string expansion. +.Pp +For example, +.Bd -literal -compact -offset indent +dtrace -n 'syscall::fstatat: /execname == $$1/ {}' -- ls +.Ed +uses +.Va $$1 +instead of +.Va $1 +to expand to a string instead rather than to a global variable identifier. .Sh PROBE'S DESCRIPTION A probe's description consists of four elements: .Sm off @@ -411,3 +446,10 @@ variable which typically provides the current working directory is not supported on .Fx at the moment. +.Pp +Macro variables +.Va $projid +and +.Va $taskid +are always 0 on +.Fx . diff --git a/share/man/man7/stats.7 b/share/man/man7/stats.7 index 0b57d525522c..f81c2fef0155 100644 --- a/share/man/man7/stats.7 +++ b/share/man/man7/stats.7 @@ -24,7 +24,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd October 28, 2025 +.Dd May 7, 2026 .Dt STATS 7 .Os .Sh NAME @@ -44,6 +44,8 @@ are currently included in the base system, with more appearing periodically. Show Bluetooth socket information .It Nm ctlstat CAM Target Layer statistics utility +.It Nm dtrace_mib +Access the MIB stats counters with DTrace .It Nm dwatch Watch processes as they trigger a particular DTrace probe .It Nm fstat @@ -99,6 +101,7 @@ Report ZFS I/O statistics .Xr sockstat 1 , .Xr stat 1 , .Xr systat 1 , +.Xr dtrace_mib 4 , .Xr intro 7 , .Xr tuning 7 , .Xr ctlstat 8 , 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/libsa/zfs/Makefile.inc b/stand/libsa/zfs/Makefile.inc index 3df6779559c9..540635d144ef 100644 --- a/stand/libsa/zfs/Makefile.inc +++ b/stand/libsa/zfs/Makefile.inc @@ -75,9 +75,13 @@ CFLAGS.zfs.c+= -DHAS_ZSTD_ZFS \ # # ZSTD coding style has some issues, so suppress clang's warnings. Also, zstd's # use of BMI instrucitons is broken in this environment, so avoid them. +# Avoid generating the DYNAMIC_BMI2 code paths because the code duplication +# inflates the resulting binaries. Disable ZSTD_TRACE because we don't need it +# and the bfd linker trips over the weak undefined symbols it generates. # .for i in ${ZSTD_SRC} -CFLAGS.$i+= -U__BMI__ ${NO_WBITWISE_INSTEAD_OF_LOGICAL} +CFLAGS.$i+= -U__BMI__ -DDYNAMIC_BMI2=0 -DZSTD_TRACE=0 \ + ${NO_WBITWISE_INSTEAD_OF_LOGICAL} .endfor CFLAGS.zfs_zstd.c+= -DIN_BASE -DIN_LIBSA diff --git a/sys/dev/smartpqi/smartpqi_cam.c b/sys/dev/smartpqi/smartpqi_cam.c index 690b38c9f855..6ded8aa97e39 100644 --- a/sys/dev/smartpqi/smartpqi_cam.c +++ b/sys/dev/smartpqi/smartpqi_cam.c @@ -1,5 +1,5 @@ /*- - * Copyright 2016-2025 Microchip Technology, Inc. and/or its subsidiaries. + * Copyright 2016-2026 Microchip Technology, Inc. and/or its subsidiaries. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -1300,7 +1300,7 @@ register_sim(struct pqisrc_softstate *softs, int card_index) csa.callback_arg = softs; xpt_action((union ccb *)&csa); if (csa.ccb_h.status != CAM_REQ_CMP) { - DBG_ERR("Unable to register smartpqi_aysnc handler: %d!\n", + DBG_ERR("Unable to register smartpqi_async handler: %d!\n", csa.ccb_h.status); } diff --git a/sys/dev/smartpqi/smartpqi_defines.h b/sys/dev/smartpqi/smartpqi_defines.h index 0277abd3e318..c4084f069588 100644 --- a/sys/dev/smartpqi/smartpqi_defines.h +++ b/sys/dev/smartpqi/smartpqi_defines.h @@ -1,5 +1,5 @@ /*- - * Copyright 2016-2025 Microchip Technology, Inc. and/or its subsidiaries. + * Copyright 2016-2026 Microchip Technology, Inc. and/or its subsidiaries. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -944,12 +944,12 @@ typedef uint8_t *passthru_buf_type_t; #define PQISRC_DRIVER_MAJOR __FreeBSD__ #if __FreeBSD__ <= 14 -#define PQISRC_DRIVER_MINOR 4690 +#define PQISRC_DRIVER_MINOR 4691 #else #define PQISRC_DRIVER_MINOR 2 #endif -#define PQISRC_DRIVER_RELEASE 0 -#define PQISRC_DRIVER_REVISION 2008 +#define PQISRC_DRIVER_RELEASE 1 +#define PQISRC_DRIVER_REVISION 2000 #define STR(s) # s #define PQISRC_VERSION(a, b, c, d) STR(a.b.c-d) diff --git a/sys/dev/smartpqi/smartpqi_discovery.c b/sys/dev/smartpqi/smartpqi_discovery.c index a7de5a149810..8682e6cabd7e 100644 --- a/sys/dev/smartpqi/smartpqi_discovery.c +++ b/sys/dev/smartpqi/smartpqi_discovery.c @@ -1,5 +1,5 @@ /*- - * Copyright 2016-2025 Microchip Technology, Inc. and/or its subsidiaries. + * Copyright 2016-2026 Microchip Technology, Inc. and/or its subsidiaries. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -155,7 +155,7 @@ pqisrc_remove_target_bit(pqisrc_softstate_t *softs, int target) softs->bit_map.bit_vector[target] = SLOT_AVAILABLE; } -/* Use bit map to find availible targets */ +/* Use bit map to find available targets */ int pqisrc_find_avail_target(pqisrc_softstate_t *softs) { @@ -1423,7 +1423,11 @@ pqisrc_add_device(pqisrc_softstate_t *softs, pqi_scsi_dev_t *device) if(device->expose_device) { pqisrc_init_device_active_io(softs, device); - /* TBD: Call OS upper layer function to add the device entry */ + device_printf(softs->os_specific.pqi_dev, + "device added: vendor=%s model=%s B%d:T%d:L%d type=%s\n", + device->vendor, device->model, + device->bus, device->target, device->lun, + device->is_physical_device ? "physical" : "logical"); os_add_device(softs,device); } DBG_FUNC("OUT\n"); @@ -1451,6 +1455,11 @@ pqisrc_remove_device(pqisrc_softstate_t *softs, pqi_scsi_dev_t *device) } /* Wait for device outstanding Io's */ pqisrc_wait_for_device_commands_to_complete(softs, device); + device_printf(softs->os_specific.pqi_dev, + "device removed: vendor=%s model=%s B%d:T%d:L%d type=%s\n", + device->vendor, device->model, + device->bus, device->target, device->lun, + device->is_physical_device ? "physical" : "logical"); /* Call OS upper layer function to remove the exposed device entry */ os_remove_device(softs,device); DBG_FUNC("OUT\n"); @@ -1674,10 +1683,14 @@ pqisrc_update_device_list(pqisrc_softstate_t *softs, case DEVICE_NOT_FOUND: /* Device not found in existing list */ device->new_device = true; + DBG_DISC("new device found B%d:T%d:L%d\n", + device->bus, device->target, device->lun); break; case DEVICE_CHANGED: /* Actual device gone need to add device to list*/ device->new_device = true; + DBG_DISC("device changed B%d:T%d:L%d\n", + device->bus, device->target, device->lun); break; case DEVICE_IN_REMOVE: /*Older device with same target/lun is in removal stage*/ @@ -1686,6 +1699,8 @@ pqisrc_update_device_list(pqisrc_softstate_t *softs, * free call*/ device->new_device = false; same_device->schedule_rescan = true; + DBG_DISC("device in removal B%d:T%d:L%d, scheduling rescan\n", + device->bus, device->target, device->lun); break; default: break; diff --git a/sys/dev/smartpqi/smartpqi_event.c b/sys/dev/smartpqi/smartpqi_event.c index 77a70f9fb031..c3c27c9e1c0b 100644 --- a/sys/dev/smartpqi/smartpqi_event.c +++ b/sys/dev/smartpqi/smartpqi_event.c @@ -1,5 +1,5 @@ /*- - * Copyright 2016-2025 Microchip Technology, Inc. and/or its subsidiaries. + * Copyright 2016-2026 Microchip Technology, Inc. and/or its subsidiaries. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -204,6 +204,17 @@ pqisrc_process_event_intr_src(pqisrc_softstate_t *softs,int obq_id) } if (event_index >= 0) { + static const char *event_names[] = { + [PQI_EVENT_HOTPLUG] = "hotplug", + [PQI_EVENT_HARDWARE] = "hardware", + [PQI_EVENT_PHYSICAL_DEVICE] = "physical device", + [PQI_EVENT_LOGICAL_DEVICE] = "logical device", + [PQI_EVENT_AIO_STATE_CHANGE] = "AIO state change", + [PQI_EVENT_AIO_CONFIG_CHANGE] = "AIO config change", + }; + device_printf(softs->os_specific.pqi_dev, + "event: %s (type=0x%x)\n", + event_names[event_index], response.event_type); if(response.request_acknowledge) { pending_event = &softs->pending_events[event_index]; pending_event->pending = true; @@ -385,7 +396,7 @@ pqisrc_report_event_config(pqisrc_softstate_t *softs) pqi_event_config_request_t request; pqi_event_config_t *event_config_p ; dma_mem_t buf_report_event ; - /*bytes to be allocaed for report event config data-in buffer */ + /*bytes to be allocated for report event config data-in buffer */ uint32_t alloc_size = sizeof(pqi_event_config_t) ; memset(&request, 0 , sizeof(request)); @@ -446,7 +457,7 @@ pqisrc_set_event_config(pqisrc_softstate_t *softs) pqi_event_config_request_t request; pqi_event_config_t *event_config_p; dma_mem_t buf_set_event; - /*bytes to be allocaed for set event config data-out buffer */ + /*bytes to be allocated for set event config data-out buffer */ uint32_t alloc_size = sizeof(pqi_event_config_t); memset(&request, 0 , sizeof(request)); diff --git a/sys/dev/smartpqi/smartpqi_main.c b/sys/dev/smartpqi/smartpqi_main.c index 1f006939bf7c..fbfbcc962f35 100644 --- a/sys/dev/smartpqi/smartpqi_main.c +++ b/sys/dev/smartpqi/smartpqi_main.c @@ -1,5 +1,5 @@ /*- - * Copyright 2016-2025 Microchip Technology, Inc. and/or its subsidiaries. + * Copyright 2016-2026 Microchip Technology, Inc. and/or its subsidiaries. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -427,6 +427,16 @@ smartpqi_attach(device_t dev) goto out; } + /* Register sysctl for runtime debug_level changes */ + { + struct sysctl_ctx_list *ctx = device_get_sysctl_ctx(dev); + struct sysctl_oid *tree = device_get_sysctl_tree(dev); + + SYSCTL_ADD_ULONG(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, + "debug_level", CTLFLAG_RW, &logging_level, + "Debug logging bitmask"); + } + goto out; dma_out: diff --git a/sys/dev/smartpqi/smartpqi_misc.c b/sys/dev/smartpqi/smartpqi_misc.c index 6db0d80ed993..fd0b907aa252 100644 --- a/sys/dev/smartpqi/smartpqi_misc.c +++ b/sys/dev/smartpqi/smartpqi_misc.c @@ -1,5 +1,5 @@ /*- - * Copyright 2016-2025 Microchip Technology, Inc. and/or its subsidiaries. + * Copyright 2016-2026 Microchip Technology, Inc. and/or its subsidiaries. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -252,7 +252,7 @@ bsd_set_hint_scatter_gather_config(struct pqisrc_softstate *softs) DBG_FUNC("IN\n"); - /* At least > 16 sg's required to wotk hint correctly. + /* At least > 16 sg's required to work hint correctly. * Default the sg count set by driver/controller. */ if ((!softs->hint.sg_segments) || (softs->hint.sg_segments > diff --git a/sys/dev/smartpqi/smartpqi_queue.c b/sys/dev/smartpqi/smartpqi_queue.c index e8a467531aa4..679d956f6f36 100644 --- a/sys/dev/smartpqi/smartpqi_queue.c +++ b/sys/dev/smartpqi/smartpqi_queue.c @@ -1,5 +1,5 @@ /*- - * Copyright 2016-2025 Microchip Technology, Inc. and/or its subsidiaries. + * Copyright 2016-2026 Microchip Technology, Inc. and/or its subsidiaries. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -729,7 +729,7 @@ pqisrc_create_op_ibq(pqisrc_softstate_t *softs, op_ib_q->pi_register_offset); } else { int i = 0; - DBG_WARN("Error Status Decsriptors\n"); + DBG_WARN("Error Status Descriptors\n"); for (i = 0; i < 4; i++) DBG_WARN(" %x\n",admin_resp.resp_type.create_op_iq.status_desc[i]); } diff --git a/sys/dev/smartpqi/smartpqi_request.c b/sys/dev/smartpqi/smartpqi_request.c index c5f8ac3c41ba..655660615797 100644 --- a/sys/dev/smartpqi/smartpqi_request.c +++ b/sys/dev/smartpqi/smartpqi_request.c @@ -1,5 +1,5 @@ /*- - * Copyright 2016-2025 Microchip Technology, Inc. and/or its subsidiaries. + * Copyright 2016-2026 Microchip Technology, Inc. and/or its subsidiaries. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -1998,7 +1998,7 @@ pqisrc_send_raid_tmf(pqisrc_softstate_t *softs, pqi_scsi_dev_t const *devp, if (softs->timeout_in_tmf && tmf_type == SOP_TASK_MANAGEMENT_LUN_RESET) { - /* OS_TMF_TIMEOUT_SEC - 1 to accomodate driver processing */ + /* OS_TMF_TIMEOUT_SEC - 1 to accommodate driver processing */ tmf_req.timeout_in_sec = OS_TMF_TIMEOUT_SEC - 1; } diff --git a/sys/dev/smartpqi/smartpqi_response.c b/sys/dev/smartpqi/smartpqi_response.c index 38695860e520..1ae74a5b95ff 100644 --- a/sys/dev/smartpqi/smartpqi_response.c +++ b/sys/dev/smartpqi/smartpqi_response.c @@ -1,5 +1,5 @@ /*- - * Copyright 2016-2025 Microchip Technology, Inc. and/or its subsidiaries. + * Copyright 2016-2026 Microchip Technology, Inc. and/or its subsidiaries. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -275,7 +275,7 @@ pqisrc_is_innocuous_error(pqisrc_softstate_t *softs, rcb_t *rcb, void *err_info) if (raid_err->data_out_result == PQI_RAID_DATA_IN_OUT_UNDERFLOW) return true; - /* We get these a alot: leave a tiny breadcrumb about the error, + /* We get these a lot: leave a tiny breadcrumb about the error, but don't do full spew about it */ if (raid_err->status == PQI_AIO_STATUS_CHECK_CONDITION) { diff --git a/sys/dev/smartpqi/smartpqi_sis.c b/sys/dev/smartpqi/smartpqi_sis.c index 82eb999ca4b8..99aa952eb149 100644 --- a/sys/dev/smartpqi/smartpqi_sis.c +++ b/sys/dev/smartpqi/smartpqi_sis.c @@ -1,5 +1,5 @@ /*- - * Copyright 2016-2025 Microchip Technology, Inc. and/or its subsidiaries. + * Copyright 2016-2026 Microchip Technology, Inc. and/or its subsidiaries. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -26,7 +26,7 @@ #include "smartpqi_includes.h" -/* Function for disabling msix interrupots */ +/* Function for disabling msix interrupts */ void sis_disable_msix(pqisrc_softstate_t *softs) { @@ -96,7 +96,7 @@ sis_disable_interrupt(pqisrc_softstate_t *softs) sis_disable_msix(softs); break; default: - DBG_ERR("Inerrupt mode none!\n"); + DBG_ERR("Interrupt mode none!\n"); break; } diff --git a/sys/dev/smartpqi/smartpqi_structures.h b/sys/dev/smartpqi/smartpqi_structures.h index 0c9ad375823d..ada6676ada8f 100644 --- a/sys/dev/smartpqi/smartpqi_structures.h +++ b/sys/dev/smartpqi/smartpqi_structures.h @@ -1,5 +1,5 @@ /*- - * Copyright 2016-2025 Microchip Technology, Inc. and/or its subsidiaries. + * Copyright 2016-2026 Microchip Technology, Inc. and/or its subsidiaries. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -1168,7 +1168,7 @@ typedef struct bmic_sense_feature_page_header { uint8_t page; uint8_t sub_page; uint16_t total_length; /** Total length of the page. - * The length is the same wheteher the request buffer is too short or not. + * The length is the same whether the request buffer is too short or not. * When printing out the page, only print the buffer length. */ } OS_ATTRIBUTE_PACKED bmic_sense_feature_page_header_t; 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_bio.c b/sys/kern/vfs_bio.c index 8f47a7abbc5e..675f6fb4e526 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -727,7 +727,8 @@ bufspace_wait(struct bufdomain *bd, struct vnode *vp, int gbflags, BD_LOCK(bd); while (bd->bd_wanted) { if (vp != NULL && vp->v_type != VCHR && - (td->td_pflags & TDP_BUFNEED) == 0) { + (td->td_pflags & TDP_BUFNEED) == 0 && + vp->v_bufobj.bo_dirty.bv_cnt > 0) { BD_UNLOCK(bd); /* * getblk() is called with a vnode locked, and diff --git a/sys/netpfil/pf/pf_nl.c b/sys/netpfil/pf/pf_nl.c index e4ce9e64f637..d1beb7681c21 100644 --- a/sys/netpfil/pf/pf_nl.c +++ b/sys/netpfil/pf/pf_nl.c @@ -51,8 +51,11 @@ #include <netlink/netlink_debug.h> _DECLARE_DEBUG(LOG_DEBUG); +static bool nlattr_add_labels(struct nl_writer *nw, int attrtype, + const struct pf_krule *r); +static bool nlattr_add_rule(struct nl_writer *nw, const struct pf_krule *rule); static bool nlattr_add_pf_threshold(struct nl_writer *, int, - struct pf_kthreshold *); + const struct pf_kthreshold *); struct nl_parsed_state { uint8_t version; @@ -63,6 +66,7 @@ struct nl_parsed_state { sa_family_t af; struct pf_addr addr; struct pf_addr mask; + bool include_rule; }; #define _IN(_field) offsetof(struct genlmsghdr, _field) @@ -75,6 +79,7 @@ static const struct nlattr_parser nla_p_state[] = { { .type = PF_ST_PROTO, .off = _OUT(proto), .cb = nlattr_get_uint16 }, { .type = PF_ST_FILTER_ADDR, .off = _OUT(addr), .cb = nlattr_get_in6_addr }, { .type = PF_ST_FILTER_MASK, .off = _OUT(mask), .cb = nlattr_get_in6_addr }, + { .type = PF_ST_INCLUDE_RULE, .off = _OUT(include_rule), .cb = nlattr_get_bool }, }; static const struct nlfield_parser nlf_p_generic[] = { { .off_in = _IN(version), .off_out = _OUT(version), .cb = nlf_get_u8 }, @@ -146,8 +151,26 @@ dump_state_key(struct nl_writer *nw, int attr, const struct pf_state_key *key) return (true); } +static bool +nlattr_add_rule_nested(struct nl_writer *nw, int attr, const struct pf_krule *r) +{ + int off; + bool ret; + + off = nlattr_add_nested(nw, attr); + if (off == 0) + return (false); + + ret = nlattr_add_rule(nw, r); + + nlattr_set_len(nw, off); + + return (ret); +} + static int -dump_state(struct nlpcb *nlp, const struct nlmsghdr *hdr, struct pf_kstate *s, +dump_state(struct nlpcb *nlp, const struct nlmsghdr *hdr, + struct nl_parsed_state *attrs, struct pf_kstate *s, struct nl_pstate *npt) { struct nl_writer *nw = npt->nw; @@ -231,6 +254,9 @@ dump_state(struct nlpcb *nlp, const struct nlmsghdr *hdr, struct pf_kstate *s, if (!dump_state_peer(nw, PF_ST_PEER_DST, &s->dst)) goto enomem; + if (attrs->include_rule && s->rule != NULL) + nlattr_add_rule_nested(nw, PF_ST_CREATED_BY_RULE, s->rule); + if (nlmsg_end(nw)) return (0); @@ -282,7 +308,7 @@ handle_dumpstates(struct nlpcb *nlp, struct nl_parsed_state *attrs, &attrs->mask, &attrs->addr, af)) continue; - error = dump_state(nlp, hdr, s, npt); + error = dump_state(nlp, hdr, attrs, s, npt); if (error != 0) break; } @@ -307,7 +333,7 @@ handle_getstate(struct nlpcb *nlp, struct nl_parsed_state *attrs, s = pf_find_state_byid(attrs->id, attrs->creatorid); if (s == NULL) return (ENOENT); - ret = dump_state(nlp, hdr, s, npt); + ret = dump_state(nlp, hdr, attrs, s, npt); PF_STATE_UNLOCK(s); return (ret); @@ -465,7 +491,8 @@ NL_DECLARE_ATTR_PARSER(rule_addr_parser, nla_p_ruleaddr); #undef _OUT static bool -nlattr_add_rule_addr(struct nl_writer *nw, int attrtype, struct pf_rule_addr *r) +nlattr_add_rule_addr(struct nl_writer *nw, int attrtype, + const struct pf_rule_addr *r) { struct pf_addr_wrap aw = {0}; int off = nlattr_add_nested(nw, attrtype); @@ -687,7 +714,8 @@ nlattr_get_nested_timeouts(struct nlattr *nla, struct nl_pstate *npt, const void } static bool -nlattr_add_timeout(struct nl_writer *nw, int attrtype, uint32_t *timeout) +nlattr_add_timeout(struct nl_writer *nw, int attrtype, + const uint32_t *timeout) { int off = nlattr_add_nested(nw, attrtype); @@ -875,76 +903,10 @@ out: return (error); } -struct nl_parsed_get_rule { - char anchor[MAXPATHLEN]; - uint8_t action; - uint32_t nr; - uint32_t ticket; - uint8_t clear; -}; -#define _OUT(_field) offsetof(struct nl_parsed_get_rule, _field) -static const struct nlattr_parser nla_p_getrule[] = { - { .type = PF_GR_ANCHOR, .off = _OUT(anchor), .arg = (void *)MAXPATHLEN, .cb = nlattr_get_chara }, - { .type = PF_GR_ACTION, .off = _OUT(action), .cb = nlattr_get_uint8 }, - { .type = PF_GR_NR, .off = _OUT(nr), .cb = nlattr_get_uint32 }, - { .type = PF_GR_TICKET, .off = _OUT(ticket), .cb = nlattr_get_uint32 }, - { .type = PF_GR_CLEAR, .off = _OUT(clear), .cb = nlattr_get_uint8 }, -}; -#undef _OUT -NL_DECLARE_PARSER(getrule_parser, struct genlmsghdr, nlf_p_empty, nla_p_getrule); - -static int -pf_handle_getrule(struct nlmsghdr *hdr, struct nl_pstate *npt) +static bool +nlattr_add_rule(struct nl_writer *nw, const struct pf_krule *rule) { - char anchor_call[MAXPATHLEN]; - struct nl_parsed_get_rule attrs = {}; - struct nl_writer *nw = npt->nw; - struct genlmsghdr *ghdr_new; - struct pf_kruleset *ruleset; - struct pf_krule *rule; - u_int64_t src_nodes_total = 0; - int rs_num; - int error; - - error = nl_parse_nlmsg(hdr, &getrule_parser, npt, &attrs); - if (error != 0) - return (error); - - if (!nlmsg_reply(nw, hdr, sizeof(struct genlmsghdr))) - return (ENOMEM); - - ghdr_new = nlmsg_reserve_object(nw, struct genlmsghdr); - ghdr_new->cmd = PFNL_CMD_GETRULE; - - PF_RULES_WLOCK(); - ruleset = pf_find_kruleset(attrs.anchor); - if (ruleset == NULL) { - PF_RULES_WUNLOCK(); - error = ENOENT; - goto out; - } - - rs_num = pf_get_ruleset_number(attrs.action); - if (rs_num >= PF_RULESET_MAX) { - PF_RULES_WUNLOCK(); - error = EINVAL; - goto out; - } - - if (attrs.ticket != ruleset->rules[rs_num].active.ticket) { - PF_RULES_WUNLOCK(); - error = EBUSY; - goto out; - } - - rule = TAILQ_FIRST(ruleset->rules[rs_num].active.ptr); - while ((rule != NULL) && (rule->nr != attrs.nr)) - rule = TAILQ_NEXT(rule, entries); - if (rule == NULL) { - PF_RULES_WUNLOCK(); - error = EBUSY; - goto out; - } + u_int64_t src_nodes_total = 0; nlattr_add_rule_addr(nw, PF_RT_SRC, &rule->src); nlattr_add_rule_addr(nw, PF_RT_DST, &rule->dst); @@ -1050,6 +1012,81 @@ pf_handle_getrule(struct nlmsghdr *hdr, struct nl_pstate *npt) nlattr_add_u8(nw, PF_RT_SOURCE_LIMIT, rule->sourcelim.id); nlattr_add_u32(nw, PF_RT_SOURCE_LIMIT_ACTION, rule->sourcelim.limiter_action); + return (true); +} + +struct nl_parsed_get_rule { + char anchor[MAXPATHLEN]; + uint8_t action; + uint32_t nr; + uint32_t ticket; + uint8_t clear; +}; +#define _OUT(_field) offsetof(struct nl_parsed_get_rule, _field) +static const struct nlattr_parser nla_p_getrule[] = { + { .type = PF_GR_ANCHOR, .off = _OUT(anchor), .arg = (void *)MAXPATHLEN, .cb = nlattr_get_chara }, + { .type = PF_GR_ACTION, .off = _OUT(action), .cb = nlattr_get_uint8 }, + { .type = PF_GR_NR, .off = _OUT(nr), .cb = nlattr_get_uint32 }, + { .type = PF_GR_TICKET, .off = _OUT(ticket), .cb = nlattr_get_uint32 }, + { .type = PF_GR_CLEAR, .off = _OUT(clear), .cb = nlattr_get_uint8 }, +}; +#undef _OUT +NL_DECLARE_PARSER(getrule_parser, struct genlmsghdr, nlf_p_empty, nla_p_getrule); + +static int +pf_handle_getrule(struct nlmsghdr *hdr, struct nl_pstate *npt) +{ + char anchor_call[MAXPATHLEN]; + struct nl_parsed_get_rule attrs = {}; + struct nl_writer *nw = npt->nw; + struct genlmsghdr *ghdr_new; + struct pf_kruleset *ruleset; + struct pf_krule *rule; + int rs_num; + int error; + + error = nl_parse_nlmsg(hdr, &getrule_parser, npt, &attrs); + if (error != 0) + return (error); + + if (!nlmsg_reply(nw, hdr, sizeof(struct genlmsghdr))) + return (ENOMEM); + + ghdr_new = nlmsg_reserve_object(nw, struct genlmsghdr); + ghdr_new->cmd = PFNL_CMD_GETRULE; + + PF_RULES_WLOCK(); + ruleset = pf_find_kruleset(attrs.anchor); + if (ruleset == NULL) { + PF_RULES_WUNLOCK(); + error = ENOENT; + goto out; + } + + rs_num = pf_get_ruleset_number(attrs.action); + if (rs_num >= PF_RULESET_MAX) { + PF_RULES_WUNLOCK(); + error = EINVAL; + goto out; + } + + if (attrs.ticket != ruleset->rules[rs_num].active.ticket) { + PF_RULES_WUNLOCK(); + error = EBUSY; + goto out; + } + + rule = TAILQ_FIRST(ruleset->rules[rs_num].active.ptr); + while ((rule != NULL) && (rule->nr != attrs.nr)) + rule = TAILQ_NEXT(rule, entries); + if (rule == NULL) { + PF_RULES_WUNLOCK(); + error = EBUSY; + goto out; + } + + nlattr_add_rule(nw, rule); + error = pf_kanchor_copyout(ruleset, rule, anchor_call, sizeof(anchor_call)); MPASS(error == 0); @@ -1729,7 +1766,7 @@ pf_handle_get_ruleset(struct nlmsghdr *hdr, struct nl_pstate *npt) static bool nlattr_add_pf_threshold(struct nl_writer *nw, int attrtype, - struct pf_kthreshold *t) + const struct pf_kthreshold *t) { int off = nlattr_add_nested(nw, attrtype); int conn_rate_count = 0; diff --git a/sys/netpfil/pf/pf_nl.h b/sys/netpfil/pf/pf_nl.h index 6591c707d9a4..4d0186ea86a5 100644 --- a/sys/netpfil/pf/pf_nl.h +++ b/sys/netpfil/pf/pf_nl.h @@ -152,6 +152,8 @@ enum pfstate_type_t { PF_ST_RT_IFNAME = 37, /* string */ PF_ST_SRC_NODE_FLAGS = 38, /* u8 */ PF_ST_RT_AF = 39, /* u8 */ + PF_ST_INCLUDE_RULE = 40, /* bool */ + PF_ST_CREATED_BY_RULE = 41, /* nested, pf_rule_type_t */ }; enum pf_addr_type_t { 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/vm/vm_map.c b/sys/vm/vm_map.c index 63bdce9d60f8..94dd7d3a19bc 100644 --- a/sys/vm/vm_map.c +++ b/sys/vm/vm_map.c @@ -4723,6 +4723,11 @@ vm_map_stack_locked(vm_map_t map, vm_offset_t addrbos, vm_size_t max_ssize, return (rv); } +static bool report_stackoverflow = true; +SYSCTL_BOOL(_vm, OID_AUTO, report_stackoverflow, CTLFLAG_RWTUN, + &report_stackoverflow, 0, + "uprintf() on stack overflow"); + /* * Attempts to grow a vm stack entry. Returns KERN_SUCCESS if we * successfully grow the stack. @@ -4731,6 +4736,7 @@ static int vm_map_growstack(vm_map_t map, vm_offset_t addr, vm_map_entry_t gap_entry) { vm_map_entry_t stack_entry; + struct thread *td; struct proc *p; struct vmspace *vm; vm_offset_t gap_end, gap_start, grow_start; @@ -4746,7 +4752,8 @@ vm_map_growstack(vm_map_t map, vm_offset_t addr, vm_map_entry_t gap_entry) int error __diagused; #endif - p = curproc; + td = curthread; + p = td->td_proc; vm = p->p_vmspace; /* @@ -4754,15 +4761,14 @@ 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)); - lmemlim = lim_cur(curthread, RLIMIT_MEMLOCK); - stacklim = lim_cur(curthread, RLIMIT_STACK); - vmemlim = lim_cur(curthread, RLIMIT_VMEM); + lmemlim = lim_cur(td, RLIMIT_MEMLOCK); + stacklim = lim_cur(td, RLIMIT_STACK); + vmemlim = lim_cur(td, RLIMIT_VMEM); retry: /* If addr is not in a hole for a stack grow area, no need to grow. */ if (gap_entry == NULL && !vm_map_lookup_entry(map, addr, &gap_entry)) @@ -4778,15 +4784,19 @@ retry: } else { return (KERN_FAILURE); } - guard = ((curproc->p_flag2 & P2_STKGAP_DISABLE) != 0 || - (curproc->p_fctl0 & NT_FREEBSD_FCTL_STKGAP_DISABLE) != 0) ? 0 : + guard = ((p->p_flag2 & P2_STKGAP_DISABLE) != 0 || + (p->p_fctl0 & NT_FREEBSD_FCTL_STKGAP_DISABLE) != 0) ? 0 : gap_entry->next_read; max_grow = gap_entry->end - gap_entry->start; if (guard > max_grow) return (KERN_NO_SPACE); max_grow -= guard; - if (grow_amount > max_grow) + if (grow_amount > max_grow) { + if (report_stackoverflow) + uprintf("pid %d comm %s tid %d stack overflow\n", + p->p_pid, p->p_comm, td->td_tid); return (KERN_NO_SPACE); + } /* * If this is the main process stack, see if we're over the stack @@ -4794,8 +4804,12 @@ retry: */ is_procstack = addr >= (vm_offset_t)vm->vm_maxsaddr && addr < (vm_offset_t)vm->vm_stacktop; - if (is_procstack && (ctob(vm->vm_ssize) + grow_amount > stacklim)) + if (is_procstack && (ctob(vm->vm_ssize) + grow_amount > stacklim)) { + if (report_stackoverflow) + uprintf("pid %d comm %s tid %d stack overflow\n", + p->p_pid, p->p_comm, td->td_tid); return (KERN_NO_SPACE); + } #ifdef RACCT if (racct_enable) { diff --git a/tests/sys/netpfil/pf/get_state.sh b/tests/sys/netpfil/pf/get_state.sh index eb2bc854c800..eb2e2f37a15d 100644 --- a/tests/sys/netpfil/pf/get_state.sh +++ b/tests/sys/netpfil/pf/get_state.sh @@ -74,7 +74,51 @@ many_cleanup() pft_cleanup } +atf_test_case "rule" "cleanup" +rule_head() +{ + atf_set descr 'Test retrieving original state establishing rule' + atf_set require.user root +} + +rule_body() +{ + pft_init + + epair=$(vnet_mkepair) + ifconfig ${epair}a 192.0.2.1/24 up + + vnet_mkjail alcatraz ${epair}b + jexec alcatraz ifconfig ${epair}b 192.0.2.2/24 up + jexec alcatraz pfctl -e + + pft_set_rules alcatraz \ + "pass in proto icmp label \"icmplabel\"" + + # Establish state + atf_check -o ignore ping -c 1 -W 1 192.0.2.2 + + # We should see the rule now + atf_check -o match:"rule: pass in proto icmp all keep state label \"icmplabel\"" \ + -e ignore \ + jexec alcatraz pfctl -ss -vv + + pft_set_rules noflush alcatraz \ + "pass" + + # Even after the rules changes we should see the original rule + atf_check -o match:"rule: pass in proto icmp all keep state label \"icmplabel\"" \ + -e ignore \ + jexec alcatraz pfctl -ss -vv +} + +rule_cleanup() +{ + pft_cleanup +} + atf_init_test_cases() { atf_add_test_case "many" + atf_add_test_case "rule" } diff --git a/tests/sys/netpfil/pf/killstate.sh b/tests/sys/netpfil/pf/killstate.sh index f5925d715e7c..161a8b7668f2 100644 --- a/tests/sys/netpfil/pf/killstate.sh +++ b/tests/sys/netpfil/pf/killstate.sh @@ -666,7 +666,7 @@ key_body() --replyif ${epair}a # Get the state key - key=$(jexec alcatraz pfctl -ss -vvv | awk '/icmp/ { print($2 " " $3 " " $4 " " $5); }') + key=$(jexec alcatraz pfctl -ss -vvv | awk '/all icmp/ { print($2 " " $3 " " $4 " " $5); }') bad_key=$(echo ${key} | sed 's/icmp/tcp/') # Kill the wrong key diff --git a/tests/sys/netpfil/pf/names.sh b/tests/sys/netpfil/pf/names.sh index e47b0917cfec..c6f2a06c15f9 100644 --- a/tests/sys/netpfil/pf/names.sh +++ b/tests/sys/netpfil/pf/names.sh @@ -95,8 +95,48 @@ group_cleanup() pft_cleanup } +atf_test_case "start_number" "cleanup" +start_number_head() +{ + atf_set descr 'Test interface names starting with a number' + atf_set require.user root +} + +start_number_body() +{ + pft_init + + epair=$(vnet_mkepair) + ifconfig ${epair}a 192.0.2.1/24 up + + vnet_mkjail alcatraz ${epair}b + jexec alcatraz ifconfig ${epair}b 192.0.2.2/24 up + jexec alcatraz ifconfig ${epair}b name 4ever + jexec alcatraz pfctl -e + + jexec alcatraz ifconfig + + pft_set_rules alcatraz \ + "block" \ + "pass in from any to (4ever)" + + atf_check -o ignore ping -c 3 192.0.2.2 + + # Negative test, if the interface doesn't exist we don't pass packets + pft_set_rules alcatraz \ + "block" \ + "pass in from any to (5ever)" + atf_check -s exit:2 -o ignore ping -c 1 -t 1 192.0.2.2 +} + +start_number_cleanup() +{ + pft_cleanup +} + atf_init_test_cases() { atf_add_test_case "names" atf_add_test_case "group" + atf_add_test_case "start_number" } diff --git a/tools/tools/git/git-arc.sh b/tools/tools/git/git-arc.sh index 395787df970c..f2a325f3452a 100755 --- a/tools/tools/git/git-arc.sh +++ b/tools/tools/git/git-arc.sh @@ -57,7 +57,7 @@ err_usage() Usage: git arc [-vy] <command> <arguments> Commands: - create [-l] [-r <reviewer1>[,<reviewer2>...]] [-s subscriber[,...]] [<commit>|<commit range>] + create [-dl] [-r <reviewer1>[,<reviewer2>...]] [-s subscriber[,...]] [<commit>|<commit range>] list <commit>|<commit range> patch [-bcrs] <diff1> [<diff2> ...] stage [-b branch] [<commit>|<commit range>] 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() { |
