FreeBSD/src e3898d5libexec/rc/rc.d devd

Revert "rc.d: Add hastd as a prereq for devd"

This reverts commit 2d17f44a5ae6e948c3a93cac30b8315d127ba900. It hangs
the boot. It turns out I installed my test on the wrong machine and
rebooted the other one...

Sponsored by:           Netflix
DeltaFile
+1-1libexec/rc/rc.d/devd
+1-11 files

FreeBSD/src d90e14fusr.sbin/mptutil mpt_config.c

mptutil: Capture CAM errors from bus rescan

This will force reporting of CAM errors from rescanning the bus.

PR: 174072
Reviewed by: imp
DeltaFile
+12-8usr.sbin/mptutil/mpt_config.c
+12-81 files

FreeBSD/src f52154asys/dev/hptrr hptrr_osm_bsd.c

hptrr: Better error recovery

This bug and https://www.mail-archive.com/freebsd-stable@freebsd.org/msg124458.html
both have this fix. It turns unknown errors into an autosense failure, which causes
us to grab the sense buffer manually. It also sets a condition that we use to retry
timed out commands that jmg reports as being helpful.

I'm torn on committing it. The code seems fine in terms of fixing
things. But this is a 10-year-old bug with few other bugs and a short CC
list for a driver that might go away in 15 anyway. I'm going to commit
and close the bug, and MFC it in a week, unless someone complains (which
seems unliekly, given the age of this hardware, I susepct most of it is
out of service).

Suggested by: jmg, Scott Long
PR: 191135
MFC After: 1 week
Reviewed by: imp
DeltaFile
+2-2sys/dev/hptrr/hptrr_osm_bsd.c
+2-21 files

FreeBSD/src 841dcdcsys/netlink netlink_domain.c netlink_module.c, sys/netlink/route iface.c

netlink: initialize VNET context with VNET_SYSINIT()

With the initial check-in netlink(4) was very conservative with regards to
using memory and intrusiveness to the kernel and network stack. In
particular it would initialize the VNET context only on the first actuall
call to socket(PF_NETLINK), saving on allocation of a struct nl_control of
size 224 bytes.

Now it is clear that netlink(4) is primary citizen of FreeBSD, with a set
of system tools using it.  So resort to normal VNET_SYSINIT() and with
that shave a lot of complexity, since after the change V_nl_ctl is
immutable.
DeltaFile
+30-59sys/netlink/netlink_domain.c
+16-45sys/netlink/netlink_module.c
+1-5sys/netlink/netlink_var.h
+0-6sys/netlink/route/iface.c
+0-1sys/netlink/netlink_ctl.h
+47-1165 files

FreeBSD/src 164dec8sys/netlink netlink_domain.c

netlink: rename functions that manipulate group membership of a pcb

Use nlp_ prefix for them, cause they operate on single pcb.  Use words
"join" and "leave" instead of "add" and "del", cause we aren't creating
or destroying groups, we are just joining or leaving.
Really assert locks instead of just having "locked" suffix.
DeltaFile
+17-12sys/netlink/netlink_domain.c
+17-121 files

FreeBSD/src ef3991dsys/netlink netlink_glue.c netlink_domain.c

netlink: don't store an extra pointer to so_cred
DeltaFile
+2-2sys/netlink/netlink_glue.c
+0-2sys/netlink/netlink_domain.c
+0-1sys/netlink/netlink_var.h
+2-53 files

FreeBSD/src 5630457sys/netlink netlink_domain.c

netlink: remove _pru_ prefix from protosw method names

This is a relic that doesn't has any value now.
DeltaFile
+8-8sys/netlink/netlink_domain.c
+8-81 files

FreeBSD/src 5b900bdsys/dev/mpt mpt_cam.c

mpt: replace mpt_prt with mpt_lprt in mpt_cam.c

Replace mpt_prt with mpt_lprt with DEBUG level to print kernel pointers
only at the debug level.

PR: 238662
Signed-off-by: Fuqian Huang <huangfq.daxian at gmail.com>
Reviewed-by: imp
DeltaFile
+10-5sys/dev/mpt/mpt_cam.c
+10-51 files

FreeBSD/src 2d17f44libexec/rc/rc.d devd

rc.d: Add hastd as a prereq for devd

Setuping up CARP and HAST described in:
        https://www.freebsd.org/doc/en/books/handbook/disks-hast.html
doesn't work at boot time because devd start before hastd.

PR: 199733
Submitted-by: hs_fbsd at on-sky.net (no name given)
DeltaFile
+1-1libexec/rc/rc.d/devd
+1-11 files

FreeBSD/src d9beef9sys/dev/mpt mpt.c

mpt: print req->index rather than the pointer itself in mpt.c

Print req->index instead of printing the pointer itself to avoid kernel
pointer leakage.

PR: 238661
Signed-off-by: Fuqian Huang <huangfq.daxian at gmail.com>
Reviewed-by: imp
DeltaFile
+2-2sys/dev/mpt/mpt.c
+2-21 files

FreeBSD/src 1a0cb93sys/kern vfs_subr.c vfs_syscalls.c

unlink, rmdir: call notify_upper from VOP pre method instead of syscall

Suppose that there are two or more nullfs mounts over some fs, and
suppose the we unlink a file on one of the nullfs mount.
This way notify_upper get called from the lower vnode as well, allowing
the other nullfs mounts to note that and drop their caches for the
unlinked vnode.

PR:     254210
Reviewed by:    olce
Tested by:      pho
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D48825
DeltaFile
+2-0sys/kern/vfs_subr.c
+0-2sys/kern/vfs_syscalls.c
+2-22 files

FreeBSD/src f16ca17sbin/ipf/ipnat ipnat.5, sys/netinet/libalias libalias.3

man: Remove references to classful networks

Update wording in manual pages to replace references to classful networks with
CIDR notation.

Approved by:    glebius, dhw
Sponsored by:   Netflix
Differential Revision:  https://reviews.freebsd.org/D48853
DeltaFile
+4-4sys/netinet/libalias/libalias.3
+3-3usr.sbin/ppp/ppp.8
+1-1sbin/ipf/ipnat/ipnat.5
+8-83 files

FreeBSD/src fffedd8sys/net pfvar.h, sys/netpfil/pf pf.c

pf: send ICMP destination unreachable fragmentation needed when appropriate

Just like we do for IPv6, generate an ICMP fragmentation needed packet if we're
going to need fragmenation for IPv4 as well (i.e. DF is set). Do so before full
processing, so we generate it with pre-NAT addreses, just as we do for IPv6.

Sponsored by:   Rubicon Communications, LLC ("Netgate")
Differential Revision:  https://reviews.freebsd.org/D48805
DeltaFile
+48-0tests/sys/netpfil/pf/icmp.py
+26-15sys/netpfil/pf/pf.c
+1-0sys/net/pfvar.h
+75-153 files

FreeBSD/src 1f4c388sys/netinet ip_output.c ip_fastfwd.c

pfil: set PFIL_FWD for IPv4 forwarding

Just like we already do for IPv6 set the PFIL_FWD flag when we're forwarding
IPv4 traffic. This allows firewalls to make more precise decisions.

Reviewed by:    glebius
Sponsored by:   Rubicon Communications, LLC ("Netgate")
Differential Revision:  https://reviews.freebsd.org/D48824
DeltaFile
+7-1sys/netinet/ip_output.c
+1-1sys/netinet/ip_fastfwd.c
+8-22 files

FreeBSD/src b7f2a45share/man/man7 arch.7

arch.7: grammar fixes

The "for hysterical raisons" was a nice one, though.

MFC after:      3 days
DeltaFile
+2-2share/man/man7/arch.7
+2-21 files

FreeBSD/src 46b9160share/man/man7 arch.7

arch.7: Update version reference to 13.0

This document is intended to be a reference for supported FreeBSD
versions, so update text to refer to 13.0 and later.

Sponsored by:   The FreeBSD Foundation
DeltaFile
+2-2share/man/man7/arch.7
+2-21 files

FreeBSD/src 753a4acsys/netlink netlink_generic.c netlink_var.h

netlink: make struct genl_family and genl_group private
DeltaFile
+41-31sys/netlink/netlink_generic.c
+0-15sys/netlink/netlink_var.h
+41-462 files

FreeBSD/src d2e6eb6usr.bin/genl genl.c

genl: fix printing of a command with zero capabilities
DeltaFile
+10-4usr.bin/genl/genl.c
+10-41 files

FreeBSD/src c032fb8usr.bin/netstat main.c netstat.h

netstat: Use bool more widely

Following c2aa91745e87 ("netstat: restore printing the "default"
keyword, provide -nn option"), consistently use bool where appropriate
for commandline flags.

Reviewed by:    glebius
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48832
DeltaFile
+49-49usr.bin/netstat/main.c
+18-18usr.bin/netstat/netstat.h
+67-672 files

FreeBSD/src 5c04086sys/cam/scsi scsi_all.c

cam: Fix off by one error in ASC/ASCQ lookup

To implement ranges of ASC/ASCQ codes, we set SS_RANGE on an entry with
the entry being the end (highest) of the range (with the prior entry
being the start). When looking up a ASC/ASCQ code, however, we return
the second entry, which just has the range info. Instead, return the
prior entry in these cases so we can print the ASC/ASCQ code string
correctly.

Sponsored by:           Netflix
Reviewed by:            mav
Differential Revision:  https://reviews.freebsd.org/D48685
DeltaFile
+8-0sys/cam/scsi/scsi_all.c
+8-01 files

FreeBSD/src 692e5f6sys/cam/scsi scsi_all.c

cam: Fail ASC 0x40

ASC 0x40 is use to report diagnostics (as in the self test the drive
runs on itself) failures. The ASCQ code is the part that failed. These
failures are such that I/O to the drive's LBA range is not possible, so
make this condition fatal, and signal the drive's ill health.

Sponsored by:           Netflix
Reviewed by:            ken, mav
Differential Revision:  https://reviews.freebsd.org/D48684
DeltaFile
+2-2sys/cam/scsi/scsi_all.c
+2-21 files

FreeBSD/src f8ef49csys/cam/scsi scsi_da.c

cam/da: Document what an 'invalid pack' means.

An 'invalid pack' in the da driver means that the media for the drive is
temproarily missing, pending an action by a third party (eg robot arm or
human inserting a disk pack, etc) or has changed since we opened. We
invalidate a pack when the ASC/ASCQ tells us the media is missing (ASC
0x3a MEDIA MISSING), for 0x28/0 (NOT READY TO READY CHANGE, MEDIUM MAY
HAVE CHANGED) and for that brief period of time after a peripheral has
been invalidated before the disk is destroyed. When the pack is invalid,
we can't do READ/WRITE operations to the media, so we fail all
outstanding I/O and any new I/O that comes in when this happens.  This
is cleared in daopen when we've repobed the device.

Sponsored by:           Netflix
Reviewed by:            mav
Differential Revision:  https://reviews.freebsd.org/D48687
DeltaFile
+13-1sys/cam/scsi/scsi_da.c
+13-11 files

FreeBSD/src 43693ffsys/cam cam_periph.c

cam/periph: Use a bool for a bool

This should be a bool, not a non-zero int. no change intended.

Sponsored by:           Netflix
DeltaFile
+4-3sys/cam/cam_periph.c
+4-31 files

FreeBSD/src f5cebe7sys/cam cam_xpt.c cam_iosched.c, sys/cam/ata ata_xpt.c

cam/xpt: Put all messages on one line

Make all error messages from *xpt.c be greppable by putting them on one
line, "outdenting" where necessary to keep things under about 90
columns. More of cam could use this treatment, but not finding a message
in xpt is what prompted this round.

Sponsored by:           Netflix
DeltaFile
+27-28sys/cam/scsi/scsi_xpt.c
+19-21sys/cam/cam_xpt.c
+19-20sys/cam/ata/ata_xpt.c
+9-8sys/cam/mmc/mmc_xpt.c
+6-6sys/cam/nvme/nvme_xpt.c
+3-4sys/cam/cam_iosched.c
+83-876 files

FreeBSD/src 21c534bsys/riscv/include frame.h, sys/riscv/riscv vm_machdep.c exception.S

riscv: Fix and generalise saving TP (PCPU pointer) whilst in userspace

In cpu_fork, we allocate sizeof(struct pcb) + sizeof(struct trapframe)
space on the stack, then round it for stack alignment. This not only
fails to include the space needed for TP but also doesn't round up the
trapframe allocation to be stack-aligned, yet TF_SIZE does, as is the
expectation of fork_trampoline and cpu_exception_handler. Given that
sizeof(struct pcb) + sizeof(struct trapframe) is a multiple of 16, this
causes the saved TP to be stored in the PCB's pcb_sp (the intended
trapframe padding aliasing pcb_ra), which is probably harmless in
practice as the PCB isn't expected to be current, but definitely not
intended.

In cpu_thread_alloc, we do include the 8 bytes for TP and then stack
align that. This again fails to include the padding for trapframe as
present in TF_SIZE, but sizeof(struct pcb) + sizeof(struct trapframe)
happens to be a multiple of 16, as above, so adding 8 then rounding to
stack alignment (16) includes an extra 8 bytes of padding, giving the
right result for the wrong reason (and could be broken by future struct

    [11 lines not shown]
DeltaFile
+24-11sys/riscv/riscv/vm_machdep.c
+14-0sys/riscv/include/frame.h
+2-2sys/riscv/riscv/exception.S
+3-1sys/riscv/riscv/genassym.c
+1-1sys/riscv/riscv/swtch.S
+44-155 files

FreeBSD/src 9735007usr.sbin/bsdinstall/scripts finalconfig

bsdinstall: Switched back to amended single-button finalconfig

Commit ac78e3e9c581 ("bsdinstall: Add "Finish" button to finalconfig")
removed the Exit entry from the menu, renamed OK to Select and added a
Finish in place of the old Exit entry. On the surface this seemed like a
good idea, as at a glance OK wasn't clear that it was selecting an entry
rather than just closing the box, Exit isn't the most obvious term
to use for proceeding through the installer without doing anything, and
it separated out the different cases of "do something extra" and
"continue". However, because bsddialog (and dialog) keep a menu entry
highlighted even when the Cancel (in this case, Finish) button is
selected, this now looks even more confusing, with users easily
believing that they are about to select the Add User option (being
either surprised when it doesn't actually do that, or being confused
about how to not select it).

Instead, go back to the old scheme that fits more with bsddialog's
supported functionality but tweak it to try and improve on the confusing
UI/UX from the past. Specifically, the UI changes compared with the

    [10 lines not shown]
DeltaFile
+5-1usr.sbin/bsdinstall/scripts/finalconfig
+5-11 files

FreeBSD/src ecccb63usr.sbin/mountd mountd.c

mountd: Promote missing netmask log to LOG_ERR

Historical network classes are deprecated, but currently still supported
in mountd with a LOG_WARNING-priority message added by Mike Karels in
2021.  Upgrade the log to LOG_ERR well in advance of this becoming a
fatal error.

Reviewed by:    rmacklem
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48795
DeltaFile
+1-1usr.sbin/mountd/mountd.c
+1-11 files

FreeBSD/src 955f974share/mk bsd.lib.mk

mk: Add missing escape character

Add a missing escape character that splits a long line to avoid breaking
the builds.

Reported by:    cy
Approved by:    emaste (mentor)
Fixes:  88d448ec815c ("mk: Move vm stack test debug symbols")
MFC after:      1 week
DeltaFile
+1-1share/mk/bsd.lib.mk
+1-11 files

FreeBSD/src 1ed9b38sys/net bpf.c if.c

ifnet: Detach BPF descriptors on interface vmove event

When an interface is moving to/from a vnet jail, it may still have BPF
descriptors attached. The userland (e.g. tcpdump) does not get noticed
that the interface is departing and still opens BPF descriptors thus
may result in leaking sensitive traffic (e.g. an interface is moved
back to parent jail but a user is still sniffing traffic over it in
the child jail).

Detach BPF descriptors so that the userland will be signaled.

Reviewed by:    ae
MFC after:      3 days
Differential Revision:  https://reviews.freebsd.org/D45727
DeltaFile
+27-0sys/net/bpf.c
+5-0sys/net/if.c
+1-0sys/net/bpf.h
+33-03 files

FreeBSD/src bb0348asys/net if.c

ifnet: Make if_detach_internal() and if_vmove() void

if_detach_internal() never fail since change [1]. As a consequence,
also does its caller if_vmove(). While here, remove a stall comment.

No functional change intended.

This reverts commit c7bab2a7ca9a6dae79f970c6730a19b65a1ed86e.

[1] a779388f8bb3 if: Protect V_ifnet in vnet_if_return()

Reviewed by:    glebius
MFC after:      3 days
Differential Revision:  https://reviews.freebsd.org/D48820
DeltaFile
+16-27sys/net/if.c
+16-271 files