]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
2 years agoFurther refine the ExpDataSN checks for SCSI Response PDUs.
John Baldwin [Tue, 26 Oct 2021 21:50:05 +0000 (14:50 -0700)]
Further refine the ExpDataSN checks for SCSI Response PDUs.

According to 11.4.8 in RFC 7143, ExpDataSN MUST be 0 if the response
code is not Command Completed, but we were requiring it to always be
the count of DataIn PDUs regardless of the response code.

In addition, at least one target (OCI Oracle iSCSI block device)
returns an ExpDataSN of 0 when returning a valid completion with an
error status (Check Condition) in response to a SCSI Inquiry.  As a
workaround for this target, only warn without resetting the connection
for a 0 ExpDataSN for responses with a non-zero error status.

PR: 259152
Reported by: dch
Reviewed by: dch, mav, emaste
Fixes: 4f0f5bf99591 iscsi: Validate DataSN values in Data-In PDUs in the initiator.
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D32650

2 years agoAvoid building libfido2 if WITHOUT_USB
Ed Maste [Tue, 26 Oct 2021 21:15:54 +0000 (17:15 -0400)]
Avoid building libfido2 if WITHOUT_USB

libfido2 requires USB, so disable it if not available.

Reported by: peterj
Fixes: 7b1e19ad78c6 ("Add libfido2 to the build")
Sponsored by: The FreeBSD Foundation

2 years agoRetire obsolete iscsi_initiator(4)
Ed Maste [Tue, 26 Oct 2021 17:24:30 +0000 (13:24 -0400)]
Retire obsolete iscsi_initiator(4)

The new iSCSI initiator iscsi(4) was introduced with FreeBSD 10.0, and
the old intiator was marked obsolete shortly thereafter (in commit
d32789d95cfbf, MFC'd to stable/10 in ba54910169c4).  Remove it now.

Reviewed by: jhb, mav
Relnotes: yes
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D32673

2 years agotcp: The rack stack can incorrectly have an overflow when calculating a burst delay.
Randall Stewart [Tue, 26 Oct 2021 17:17:58 +0000 (13:17 -0400)]
tcp: The rack stack can incorrectly have an overflow when calculating a burst delay.

If the congestion window is very large the fact that we multiply it by 1000 (for microseconds) can
cause the uint32_t to overflow and we incorrectly calculate a very small divisor. This will then
cause the burst timer to be very large when it should be 0. Instead lets make the three variables
uint64_t and avoid the issue.

Reviewed by: Michael Tuexen
Sponsored by: Netflix Inc.
Differential Revision: https://reviews.freebsd.org/D32668

2 years agolualoader: fix the autoboot_delay countdown message
Katsuyuki Miyoshi [Tue, 26 Oct 2021 16:21:34 +0000 (11:21 -0500)]
lualoader: fix the autoboot_delay countdown message

When the timer drops from double to single digits, a spare 'e' is left
on the end of the line as we don't overwrite it. Include an extra space
at the end to account for this and overwrite the leftover character.

PR: 259429
MFC after: 3 days
Reviewed by: emaste

2 years ago/etc/periodic/weekly/310.locate must read /etc/locate.rc
Wolfram Schneider [Tue, 26 Oct 2021 14:59:39 +0000 (14:59 +0000)]
/etc/periodic/weekly/310.locate must read /etc/locate.rc

PR:             160225
Reported by:    Hiroaki Abe
Reviewed by:    se
Approved by:    se
Differential Revision: https://reviews.freebsd.org/D32646

2 years agosh: Set PATH envvar after setting HOME in dotfile
Ka Ho Ng [Tue, 26 Oct 2021 14:48:57 +0000 (22:48 +0800)]
sh: Set PATH envvar after setting HOME in dotfile

In single-user mode, all env vars are absent, so exptilde() would not be
able to expand ~ correctly.
Place the lines setting PATH below HOME, so exptilde() would work as
expected.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Reviewed by: jilles, emaste
Differential Revision: https://reviews.freebsd.org/D27003

2 years agobpf: Fix the write filter for detached descriptors
Mark Johnston [Tue, 26 Oct 2021 13:57:27 +0000 (09:57 -0400)]
bpf: Fix the write filter for detached descriptors

A BPF descriptor only has an associated interface descriptor once it is
attached to an interface, e.g., with BIOCSETIF.  Avoid dereferencing a
NULL pointer in filt_bpfwrite() if the BPF descriptor is not attached.

Reviewed by: ae
Reported by: syzbot+ae45d5166afe15a5a21d@syzkaller.appspotmail.com
Fixes: ded77e0237a8 ("Allow the BPF to be select for write.")
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D32561

2 years agoncurses: rework static linker script generation
Baptiste Daroussin [Tue, 26 Oct 2021 10:02:00 +0000 (12:02 +0200)]
ncurses: rework static linker script generation

Rework the generation of the linker script to make it in par with
ldscript, this also forces the regeneration of the .aldscript in the obj
dir which might in the past have ended up empty.

Tested by: manu

2 years agoAugment systat(1) -swap to display large swap space processes
Konstantin Belousov [Tue, 26 Oct 2021 08:43:08 +0000 (11:43 +0300)]
Augment systat(1) -swap to display large swap space processes

This change updates the systat(1) -swap display to use libprocstat to
obtain and display per-process swap space usage infomation following its
existing swap devise/file statistics. It also incorporates the disk I/O
information from the -vmstat display.

The new screen looks like below with 'systat -swap':
                    /0   /1   /2   /3   /4   /5   /6   /7   /8   /9 /10
     Load Average   |

Device/Path       Size  Used |0%  /10  /20  /30  /40  / 60\  70\  80\ 90\ 100|
ada0s1b          2048M 2034M
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
zvol/sys/tempora 1024M 1015M
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
zvol/sys/swap    1024M 1014M
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Total            4096M 4063M
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Pid    Username   Command     Swap/Total Per-Process    Per-System
 24153 hiro       seamonkey   98M /   1G  7%              2%
 23677 hiro       xfce4-pane  28M /  81M 34% XXX          0%
 23629 hiro       xfce4-sess  25M / 118M 21% XX           0%
 23681 hiro       xfdesktop   20M /  58M 34% XXX          0%
 23678 hiro       thunar      15M /  43M 36% XXX          0%
 23658 hiro       at-spi-bus  14M /  23M 63% XXXXXX       0%
 23660 hiro       gvfsd       12M /  21M 56% XXXXX        0%

Disks  ada0  ada1  ada2   cd0 pass0 pass1 pass2 pass3
KB/t   8.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00
tps       0     0     0     0     1     0     0     0
MB/s   0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00
%busy     0     0     0     0     0     0     0     0

Submitted by: Yoshihiro Ota
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D29754

2 years agolibutil: add kinfo_getswapvmobject(3)
Konstantin Belousov [Tue, 26 Oct 2021 08:40:10 +0000 (11:40 +0300)]
libutil: add kinfo_getswapvmobject(3)

which is the wrapper around the vm.swap_objects sysctl, same as
kinfo_getvmobject(3) wraps vm.objects.

Submitted by: Yoshihiro Ota
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D29754

2 years agoMana: move mana polling from EQ to CQ
Wei Hu [Tue, 26 Oct 2021 12:25:22 +0000 (12:25 +0000)]
Mana: move mana polling from EQ to CQ

    -Each CQ start task queue to poll when completion happens.
    This means every rx and tx queue has its own cleanup task
    thread to poll the completion.
    - Arm EQ everytime no matter it is mana or hwc. CQ arming
    depends on the budget.
    - Fix a warning in mana_poll_tx_cq() when cqe_read is 0.
    - Move cqe_poll from EQ to CQ struct.
    - Support EQ sharing up to 8 vPorts.
    - Ease linkdown message from mana_info to mana_dbg.

Tested by: whu
MFC after: 2 weeks
Sponsored by: Microsoft

2 years agostress2: Added two syzkaller reproducers
Peter Holm [Tue, 26 Oct 2021 09:59:04 +0000 (09:59 +0000)]
stress2: Added two syzkaller reproducers

2 years agonfscl: Add a missing delegation lock release
Rick Macklem [Tue, 26 Oct 2021 02:09:14 +0000 (19:09 -0700)]
nfscl: Add a missing delegation lock release

There was a case in nfscl_doiods() where the function would return
without releasing the delegation shared lock, if it was aquired by
the call to nfscl_getstateid().  This patch adds that release.

I have never observed a failure due to this missing release, so I
do not know if it ever happens in practice.  However, since the pNFS
client is not yet heavily used, it might be the case.

Found by code inspection during a recent NFSv4 IETF working group
testing event.

MFC after: 2 week

2 years ago[LIBM] implementations of sinpi[fl], cospi[fl], and tanpi[fl]
Steve Kargl [Mon, 25 Oct 2021 13:13:52 +0000 (16:13 +0300)]
[LIBM] implementations of sinpi[fl], cospi[fl], and tanpi[fl]

Both IEEE-754 2008 and ISO/IEC TS 18661-4 define the half-cycle
trignometric functions cospi, sinpi, and tanpi.  The attached
patch implements cospi[fl], sinpi[fl], and tanpi[fl].  Limited
testing on the cospi and sinpi reveal a max ULP less than 0.89;
while tanpi is more problematic with a max ULP less than 2.01
in the interval [0,0.5].  The algorithms used in these functions
are documented in {ks}_cospi.c, {ks}_sinpi.c, and s_tanpi.c.

Note.  I no longer have access to a system with ld128 and
adequate support to compile and test the ld128 implementations
of these functions.  Given the almost complete lack of input from
others on improvements to libm, I doubt that anyone cares.  If
someone does care, the ld128 files contain a number of FIXME comments,
and in particular, while the polynomial coefficients are given
I did not update the polynomial algorithms to properly use the
coefficients.

PR: 218514
MFC after: 2 weeks

2 years agostrip/objcopy: handle empty file as unknown
Ed Maste [Mon, 25 Oct 2021 21:25:26 +0000 (17:25 -0400)]
strip/objcopy: handle empty file as unknown

Previously strip reported a somewhat cryptic error for empty files:

    strip: elf_begin() failed: Invalid argument

Add a special case to treat empty files as with an unknown file format.
This is consistent with llvm-strip.  GNU strip produces no output which
does not seem like useful behaviour (but it does exit with status 1).

Reported by: andrew
Reviewed by: markj
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D32648

2 years agotcp: allow new reno functions to be called from other CC modules
Michael Tuexen [Mon, 25 Oct 2021 20:48:36 +0000 (22:48 +0200)]
tcp: allow new reno functions to be called from other CC modules

Some new reno functions use the internal data, but are also called
from functions of other CC modules. Ensure that in this case, the
internal data is not accessed.

Reported by: syzbot+1d219ea351caa5109d4b@syzkaller.appspotmail.com
Reported by:     syzbot+b08144f8cad9c67258c5@syzkaller.appspotmail.com
Reviewed by: rrs
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D32649

2 years agoLinuxKPI: module.h add MODULE_SUPPORTED_DEVICE()
Bjoern A. Zeeb [Mon, 25 Oct 2021 16:39:56 +0000 (16:39 +0000)]
LinuxKPI: module.h add MODULE_SUPPORTED_DEVICE()

Add a dummy MODULE_SUPPORTED_DEVICE define as we do for other
MODULE_* macros.  This is needed by a wireless driver.

MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D32641

2 years agoiscsid: set max_recv_data_segment_length to what we advertise
Ed Maste [Thu, 21 Oct 2021 15:09:58 +0000 (11:09 -0400)]
iscsid: set max_recv_data_segment_length to what we advertise

Previously we updated the conection's conn_max_recv_data_segment_length
only when we received a response containing MaxRecvDataSegmentLength
from the target.  If the target did not send MaxRecvDataSegmentLength
then we left conn_max_recv_data_segment_length at the default (i.e.,
8192).  A target could then send more data than that defult (up to our
advertised maximum), and we would drop the connection.

RFC 7143 specifies that MaxRecvDataSegmentLength is Declarative, not
negotiated.  Just set conn_max_recv_data_segment_length to our
advertised value in login_negotiate().

PR: 259355
Reviewed by: mav
MFC after: 1 week
Fixes: a15fbc904a4d ("Alike to r312190 decouple iSCSI...")
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D32605

2 years agoLinuxKPI: add bcd.h
Bjoern A. Zeeb [Mon, 25 Oct 2021 18:14:08 +0000 (18:14 +0000)]
LinuxKPI: add bcd.h

Add bcd2bin() as linuxkpi_bcd2bin().  Libkern does provide a bcd2bin()
which cannot be used leaving us with a conflict (see comment in file).
Fortunately this is only seen in one driver so far and it seems easier
to drop this in and change a single line in the driver than to add this
inline in the driver.

MFC after: 3 days
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D32647

2 years agoLinuxKPI: pci.h / linux_pci.c rename pci_driver field
Bjoern A. Zeeb [Mon, 25 Oct 2021 17:15:01 +0000 (17:15 +0000)]
LinuxKPI: pci.h / linux_pci.c rename pci_driver field

Rename the struct pci_driver {} field got the list_head from links
to node as a driver is actually initialsing this to {} which seems
questionable but it will at least make us match the Linux structure
field name.

MFC after: 3 days
Reviewed by: manu, hselasky
Differential Revision: https://reviews.freebsd.org/D32645

2 years agoLinuxKPI: pci.h make pci_dev argument const for pci_{read,write}_config*()
Bjoern A. Zeeb [Mon, 25 Oct 2021 17:06:09 +0000 (17:06 +0000)]
LinuxKPI: pci.h make pci_dev argument const for pci_{read,write}_config*()

Make the struct pci_dev argument to the pci_{read,write}_config*()
functions "const" to match the Linux definition as some drivers
try to pass in a const argument which we currently fail to honor.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D32644

2 years agoLinuxKPI: add netdev_features.h
Bjoern A. Zeeb [Mon, 25 Oct 2021 16:50:27 +0000 (16:50 +0000)]
LinuxKPI: add netdev_features.h

Add netdev_features.h as a spearate file from the future netdevice.h
implementation to avoid include problems with a future skbuff.h.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D32643

2 years agoLinuxKPI: add simple_open() to fs.h
Bjoern A. Zeeb [Mon, 25 Oct 2021 16:44:18 +0000 (16:44 +0000)]
LinuxKPI: add simple_open() to fs.h

Add a dummy simple_open() to fs.h as we have for other
(unsupported) functions.
This is needed by a wireless driver.

MFC after: 3 days
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D32642

2 years agomlx4: rename conflicting netdev_priv() to mlx4_netdev_priv()
Bjoern A. Zeeb [Mon, 25 Oct 2021 16:18:11 +0000 (16:18 +0000)]
mlx4: rename conflicting netdev_priv() to mlx4_netdev_priv()

netdev_priv() is a LinuxKPI function which was used with the old ifnet
linux/netdevice.h implementation which was not adaptable to modern
Linux drviers unless rewriting them for ifnet in first place which
defeats the purpose.
Rename the netdev_priv() calls in mlx4 to mlx4_netdev_priv()
returning the ifnet softc to avoid conflicting symbol names
with different implementations in the future.

MFC after: 3 days
Reviewed by: hselasky, kib
Differential Revision: https://reviews.freebsd.org/D32640

2 years agoInline critical enter/exit for "tied" kernel modules
Mateusz Guzik [Mon, 25 Oct 2021 17:29:46 +0000 (17:29 +0000)]
Inline critical enter/exit for "tied" kernel modules

Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agoarm: fix a typo in nvidia/drm2/tegra_bo.c
Mateusz Guzik [Mon, 25 Oct 2021 18:42:10 +0000 (18:42 +0000)]
arm: fix a typo in nvidia/drm2/tegra_bo.c

Unbreaks building TEGRA124

Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agoDon't run ip_ctloutput() for divert socket.
Gleb Smirnoff [Fri, 22 Oct 2021 23:24:56 +0000 (16:24 -0700)]
Don't run ip_ctloutput() for divert socket.

It was here since divert(4) was introduced, probably just came with a
protocol definition boilerplate.  There is no useful socket option
that can be set or get for a divert socket.

Reviewed by: donner
Differential Revision: https://reviews.freebsd.org/D32608

2 years agoRemove div_ctlinput().
Gleb Smirnoff [Fri, 22 Oct 2021 23:21:10 +0000 (16:21 -0700)]
Remove div_ctlinput().

This function does nothing since 97d8d152c28b. It was introduced
in 252f24a2cf40 with a sidenote "may not be needed".

Reviewed by: donner
Differential Revision: https://reviews.freebsd.org/D32608

2 years agortld: Print currently configured search path for libraries for -v
Konstantin Belousov [Mon, 25 Oct 2021 16:16:37 +0000 (19:16 +0300)]
rtld: Print currently configured search path for libraries for -v

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

2 years agosysctl vm.objects: yield if hog
Konstantin Belousov [Fri, 7 May 2021 22:13:29 +0000 (01:13 +0300)]
sysctl vm.objects: yield if hog

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D31163

2 years agovm.objects_swap: disable reporting some information
Konstantin Belousov [Tue, 13 Jul 2021 10:34:31 +0000 (13:34 +0300)]
vm.objects_swap: disable reporting some information

For making the call faster, do not count active/inactive object queues,
and do not report vnode info if any (for tmpfs).

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D31163

2 years agoAdd vm.swap_objects sysctl
Konstantin Belousov [Tue, 13 Jul 2021 10:27:36 +0000 (13:27 +0300)]
Add vm.swap_objects sysctl

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D31163

2 years agovm_object_list: split sysctl handler in separate function
Konstantin Belousov [Tue, 13 Jul 2021 10:23:25 +0000 (13:23 +0300)]
vm_object_list: split sysctl handler in separate function

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D31163

2 years agohyperv: Register hyperv_timecounter later during boot
Mark Johnston [Mon, 25 Oct 2021 17:08:38 +0000 (13:08 -0400)]
hyperv: Register hyperv_timecounter later during boot

Previously the MSR-based timecounter was registered during
SI_SUB_HYPERVISOR, i.e., very early during boot, and before SI_SUB_LOCK.
After commit 621fd9dcb2d8 this triggers a panic since the timecounter
list lock is not yet initialized.

The hyperv timecounter does not need to be registered so early, so defer
that to SI_SUB_DRIVERS, at the same time the hyperv TSC timecounter is
registered.

Reported by: whu
Approved by: whu
Fixes: 621fd9dcb2d8 ("timecounter: Lock the timecounter list")
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

2 years agoLinuxKPI: add strreplace() to string.h
Bjoern A. Zeeb [Fri, 22 Oct 2021 11:00:36 +0000 (11:00 +0000)]
LinuxKPI: add strreplace() to string.h

Add strreplace() needed by a driver.
MFC after: 3 days

Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D32597

2 years agoLinuxKPI: add kstrtou8() and kstrtou8_from_user() to kernel.h
Bjoern A. Zeeb [Fri, 22 Oct 2021 11:04:36 +0000 (11:04 +0000)]
LinuxKPI: add kstrtou8() and kstrtou8_from_user() to kernel.h

Analogous to the other sized version of kstrto[u]<type>() and
kstrtobool_from_user() add the "u8" versions needed by a driver.

MFC after: 3 days
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D32598

2 years agoMakefile.inc1: Remove mentions of removed target "update"
Mateusz Piotrowski [Sun, 24 Oct 2021 19:03:22 +0000 (21:03 +0200)]
Makefile.inc1: Remove mentions of removed target "update"

This is follow-up to commits e290182bcf38 and 1f7d11e636ab.

2 years agousb(4): Fix for use after free in combination with EVDEV_SUPPORT.
Hans Petter Selasky [Sun, 24 Oct 2021 11:38:04 +0000 (13:38 +0200)]
usb(4): Fix for use after free in combination with EVDEV_SUPPORT.

When EVDEV_SUPPORT was introduced, the USB transfers may be running
after the main FIFO is closed. In connection to this a race may appear
which can lead to use-after-free scenarios. Fix this for all FIFO
consumers by initializing and resetting the FIFO queues under the
lock used by the client. Then the client driver will see an empty
queue in all cases a race may appear.

Found by: pho@
MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agomixer(3): Fix spelling in comment.
Hans Petter Selasky [Mon, 18 Oct 2021 14:03:17 +0000 (16:03 +0200)]
mixer(3): Fix spelling in comment.

s/MIX_STATUS_XXX/MIX_MODE_XXX/g

Differential Revision: https://reviews.freebsd.org/D32548
Submitted by: christos@
Sponsored by: NVIDIA Networking

2 years agounionfs: implement vnode-based cache lookup
Jason A. Harmening [Sun, 17 Oct 2021 02:16:25 +0000 (19:16 -0700)]
unionfs: implement vnode-based cache lookup

unionfs uses a per-directory hashtable to cache subdirectory nodes.
Currently this hashtable is looked up using the directory name, but
since unionfs nodes aren't removed from the cache until they're
reclaimed, this poses some problems.  For example, if a directory is
created on a unionfs mount shortly after deleting a previous directory
with the same path, the cache may end up reusing the node for the
previous directory, including its upper/lower FS vnodes.  Operations
against those vnodes with then likely fail because the vnodes
represent deleted files; for example UFS will reject VOP_MKDIR()
against such a vnode because its effective link count is 0.  This may
then manifest as e.g. mkdir(2) or open(2) returning ENOENT for an
attempt to create a file under the re-created directory.

While it would be possible to fix this by explicitly managing the
name-based cache during delete or rename operations, or by rejecting
cache hits if the underlying FS vnodes don't match those passed to
unionfs_nodeget(), it seems cleaner to instead hash the unionfs nodes
based on their underlying FS vnodes.  Since unionfs prefers to operate
against the upper vnode if one is present, the lower vnode will only
be used for hashing as long as the upper vnode is NULL.  This should
also make hashing faster by eliminating string traversal and using
the already-computed hash index stored in each vnode.

While here, fix a couple of other cache-related issues:

--Remove 8 bytes of unnecessary baggage from each unionfs node by
  getting rid of the stored hash mask field.  The mask is knowable
  at compile time.

--When a matching node is found in the cache, reference its vnode
  using vrefl() while still holding the vnode interlock.  Previously
  unionfs_nodeget() would vref() the vnode after the interlock was
  dropped, but the vnode may be reclaimed during that window.  This
  caused intermittent panics from vn_lock(9) during unionfs stress
  testing.

Reviewed by: kib, markj
Tested by: pho
Differential Revision: https://reviews.freebsd.org/D32533

2 years agoAllow biodone() to be used as a completion routine.
Kirk McKusick [Sat, 23 Oct 2021 14:25:49 +0000 (07:25 -0700)]
Allow biodone() to be used as a completion routine.

An ordered series of BIO_READ and BIO_WRITE operations are
typically done as:

while (work to do) {
setup bp for I/O
g_io_request(bp, consumer);
biowait(bp);
}

Here you need to have biodone() called at the completion of
the I/O to set the BIO_DONE flag and awaken the biowait(). The
obvious way to do this would be to set bio_done = biodone, but
biodone() will only take the desired action if bio_done == NULL.
The relevant code at the end of biodone() is:

done = bp->bio_done;
if (done == NULL) {
mtxp = mtx_pool_find(mtxpool_sleep, bp);
mtx_lock(mtxp);
bp->bio_flags |= BIO_DONE;
wakeup(bp);
mtx_unlock(mtxp);
} else
done(bp);

This code would infinitely recurse if biodone() is specified as the
routine to use at completion. So before this change, a wrapper done
function had to be written:

static void
g_io_done(struct bio *bp)
{

bp->bio_done = NULL;
biodone(bp);
bp->bio_done = g_io_done;
}

This commit changes

if (done == NULL)

to

if (done == NULL || done == biodone)

which eliminates the need for the wrapper function.

Reviewed by:  kib
Sponsored by: Netflix

2 years agosys/mount.h: remove dead prototype
Robert Wing [Sun, 24 Oct 2021 00:13:20 +0000 (16:13 -0800)]
sys/mount.h: remove dead prototype

vfs_getrootfsid() was removed in 245efbba4d6a3e60a0d6d16d18d9a5fad6260733

Reviewed by: mjg
Differential Revision: https://reviews.freebsd.org/D32606

2 years agolinux: Improve debug for PTRACE_GETEVENTMSG
Edward Tomasz Napierala [Sat, 23 Oct 2021 18:53:12 +0000 (19:53 +0100)]
linux: Improve debug for PTRACE_GETEVENTMSG

No functional changes.

Sponsored By: EPSRC

2 years agolinux: implement PTRACE_EVENT_EXEC
Edward Tomasz Napierala [Sat, 23 Oct 2021 18:13:14 +0000 (19:13 +0100)]
linux: implement PTRACE_EVENT_EXEC

This fixes strace(1) from Ubuntu Focal.

Reviewed By: jhb
Sponsored By: EPSRC
Differential Revision: https://reviews.freebsd.org/D32367

2 years agoFix clang's internal assembler adding unwanted prefix to VIA xstore
Dimitry Andric [Sat, 23 Oct 2021 18:19:26 +0000 (20:19 +0200)]
Fix clang's internal assembler adding unwanted prefix to VIA xstore

Merge commit 2d8c18fbbdd1 from llvm git (by Jessica Clarke):

  [X86] Don't add implicit REP prefix to VIA PadLock xstore

  Commit 8fa3e8fa1492 added an implicit REP prefix to all VIA PadLock
  instructions, but GNU as doesn't add one to xstore, only all the others.
  This resulted in a kernel panic regression in FreeBSD upon updating to
  LLVM 11 (https://bugs.freebsd.org/259218) which includes the commit in
  question. This partially reverts that commit.

  Reviewed By: craig.topper

  Differential Revision: https://reviews.llvm.org/D112355

MFC after: 3 days

2 years agolinux: Make PTRACE_GET_SYSCALL_INFO handle EJUSTRETURN
Edward Tomasz Napierala [Sat, 23 Oct 2021 17:56:29 +0000 (18:56 +0100)]
linux: Make PTRACE_GET_SYSCALL_INFO handle EJUSTRETURN

This fixes panic when trying to run strace(8) from Focal.

Reviewed By: kib
Sponsored By: EPSRC
Differential Revision: https://reviews.freebsd.org/D32355

2 years agolinux: Improve debug for PTRACE_GETREGSET
Edward Tomasz Napierala [Fri, 22 Oct 2021 18:58:52 +0000 (19:58 +0100)]
linux: Improve debug for PTRACE_GETREGSET

No functional changes.

Sponsored By: EPSRC

2 years agolinux: Fix ENOTSOCK handling in sendfile(2)
Edward Tomasz Napierala [Sat, 23 Oct 2021 08:15:37 +0000 (09:15 +0100)]
linux: Fix ENOTSOCK handling in sendfile(2)

The Linux way for sendfile(2) to tell the application
to fallback to another way of copying data is by EINVAL,
not ENOTSOCK.  This fixes package installation scripts
for Mono packages from Focal.

Sponsored By: EPSRC
Differential Revision: https://reviews.freebsd.org/D32604

2 years agolinux: Constify bsd_to_linux_regset()
Edward Tomasz Napierala [Sat, 23 Oct 2021 07:33:48 +0000 (08:33 +0100)]
linux: Constify bsd_to_linux_regset()

No functional changes.

Reviewed By: emaste
Sponsored By: EPSRC
Differential Revision: https://reviews.freebsd.org/D32599

2 years agostress2: Fix typo
Peter Holm [Sat, 23 Oct 2021 06:39:36 +0000 (06:39 +0000)]
stress2: Fix typo

2 years agomsun: Add copyright notices
Warner Losh [Sat, 23 Oct 2021 04:00:54 +0000 (22:00 -0600)]
msun: Add copyright notices

These files were copied from MUSL. Add the standard copyright notice and
SPDX-License-Identifier: MIT consistent with our new draft license
policy. It reads word for word the same as the MIT license on the SPDX
web site. Add a pointer to the MUSL COPYIRGHT file which contains a list
of all authors of MUSL.

Sponsored by: Netflix
Noticed by: Steve Kargl

2 years agoAdd libfido2 to the build
Ed Maste [Thu, 7 Oct 2021 01:52:05 +0000 (21:52 -0400)]
Add libfido2 to the build

From https://github.com/Yubico/libfido2:

    libfido2 provides library functionality and command-line tools to
    communicate with a FIDO device over USB, and to verify attestation
    and assertion signatures.

    libfido2 supports the FIDO U2F (CTAP 1) and FIDO 2.0 (CTAP 2)
    protocols.

libfido2 will be used by ssh to support FIDO/U2F keys. It is currently
intended only for use by ssh, and so is installed as a PRIVATELIB and is
placed in the ssh pkgbase package.

This is currently disabled for the 32-bit library build as libfido2 is
not compatible with the COMPAT_32BIT hack in usb_ioctl.h.

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D32448

2 years agonehemiah: manually assemble xstore(-rng)
Konstantin Belousov [Wed, 20 Oct 2021 22:42:05 +0000 (01:42 +0300)]
nehemiah: manually assemble xstore(-rng)

It seems that clang IAS erronously adds repz prefix which should not be
there.  Cpu would try to store around %ecx bytes of random, while we
only expect a word.

PR: 259218
Reported and tested by:  Dennis Clarke <dclarke@blastwave.org>
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

2 years agobsnmpd: Remove "All Rights Reserved" from FreeBSD Foundation copyrights
Ed Maste [Fri, 22 Oct 2021 22:52:05 +0000 (18:52 -0400)]
bsnmpd: Remove "All Rights Reserved" from FreeBSD Foundation copyrights

Sponsored by: The FreeBSD Foundation

2 years agoUse network epoch to protect local IPv4 addresses hash.
Gleb Smirnoff [Sun, 10 Oct 2021 17:02:26 +0000 (10:02 -0700)]
Use network epoch to protect local IPv4 addresses hash.

The modification to the hash are already naturally locked by
in_control_sx.  Convert the hash lists to CK lists. Remove the
in_ifaddr_rmlock. Assert the network epoch where necessary.

Most cases when the hash lookup is done the epoch is already entered.
Cover a few cases, that need entering the epoch, which mostly is
initial configuration of tunnel interfaces and multicast addresses.

Reviewed by: melifaro
Differential revision: https://reviews.freebsd.org/D32584

2 years agoFix sconfig(8) build.
Gleb Smirnoff [Fri, 22 Oct 2021 20:28:44 +0000 (13:28 -0700)]
Fix sconfig(8) build.

Missed that since sconfig(8) was built on i386 only. Since I enabled
cp(4) on amd64, enable sconfig(8) as well.

Fixes: 6aae3517ed25

2 years agoRevert "Handle partial reads in zfs_read"
Mark Johnston [Fri, 22 Oct 2021 18:55:14 +0000 (14:55 -0400)]
Revert "Handle partial reads in zfs_read"

This reverts commit 59eab1093a361ca76849ca76b2ec079c8736e8e3.

The change suppressed EFAULT originating from uiomove().  The deadlock
avoidance mechanism implemented by vn_io_fault1() in the VFS handles
such errors by wiring the user pages and retrying, but this change
caused read() to return early instead.  This can result in short I/O,
causing misbehaviour in some applications, and possibly other
consequences.

Until this is resolved somehow, revert the commit.

Approved by: mm

2 years agoRetire synchronous PPP kernel driver sppp(4).
Gleb Smirnoff [Thu, 21 Oct 2021 04:08:13 +0000 (21:08 -0700)]
Retire synchronous PPP kernel driver sppp(4).

The last two drivers that required sppp are cp(4) and ce(4).

These devices are still produced and can be purchased
at Cronyx <http://cronyx.ru/hardware/wan.html>.

Since Roman Kurakin <rik@FreeBSD.org> has quit them, they no
longer support FreeBSD officially.  Later they have dropped
support for Linux drivers to.  As of mid-2020 they don't even
have a developer to maintain their Windows driver.  However,
their support verbally told me that they could provide aid to
a FreeBSD developer with documentaion in case if there appears
a new customer for their devices.

These drivers have a feature to not use sppp(4) and create an
interface, but instead expose the device as netgraph(4) node.
Then, you can attach ng_ppp(4) with help of ports/net/mpd5 on
top of the node and get your synchronous PPP.  Alternatively
you can attach ng_frame_relay(4) or ng_cisco(4) for HDLC.
Actually, last time I used cp(4) back in 2004, using netgraph(4)
instead of sppp(4) was already the right way to do.

Thus, remove the sppp(4) related part of the drivers and enable
by default the negraph(4) part.  Further maintenance of these
drivers in the tree shouldn't be a big deal.

While doing that, remove some cruft and enable cp(4) compilation
on amd64.  The ce(4) for some unknown reason marks its internal
DDK functions with __attribute__ fastcall, which most likely is
safe to remove, but without hardware I'm not going to do that, so
ce(4) remains i386-only.

Reviewed by: emaste, imp, donner
Differential Revision: https://reviews.freebsd.org/D32590
See also: https://reviews.freebsd.org/D23928

2 years agopowerpc64: tell kernel when radix is not available
Leandro Lupori [Fri, 22 Oct 2021 16:44:21 +0000 (13:44 -0300)]
powerpc64: tell kernel when radix is not available

If CAS detects that radix is not supported, set radix_mmu to 0
to avoid the kernel trying to use it and panic.

MFC after: 2 weeks
Sponsored by: Instituto de Pesquisas Eldorado (eldorado.org.br)

2 years agovm_page: Break reservations to handle noobj allocations
Mark Johnston [Thu, 21 Oct 2021 15:46:25 +0000 (11:46 -0400)]
vm_page: Break reservations to handle noobj allocations

vm_reserv_reclaim_*() will release pages to the default freepool, not
the direct freepool from which noobj allocations are drawn.  But if both
pools are empty, the noobj allocator variants must break reservations to
make progress.

Reported by: cy
Reviewed by: kib (previous version)
Fixes: b498f71bc56a ("vm_page: Add a new page allocator interface for unnamed pages")
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D32592

2 years agotcp: Add hystart-plus to cc_newreno and rack.
Randall Stewart [Fri, 22 Oct 2021 11:10:28 +0000 (07:10 -0400)]
tcp: Add hystart-plus to cc_newreno and rack.

TCP Hystart draft version -03:
https://datatracker.ietf.org/doc/html/draft-ietf-tcpm-hystartplusplus

Is a new version of hystart that allows one to carefully exit slow start if the RTT
spikes too much. The newer version has a slower-slow-start so to speak that then
kicks in for five round trips. To see if you exited too early, if not into congestion avoidance.
This commit will add that feature to our newreno CC and add the needed bits in rack to
be able to enable it.

Reviewed by: tuexen
Sponsored by: Netflix Inc.
Differential Revision: https://reviews.freebsd.org/D32373

2 years agoigc: correctly update RCTL when changing multicast filters.
Peter Grehan [Mon, 11 Oct 2021 17:49:01 +0000 (03:49 +1000)]
igc: correctly update RCTL when changing multicast filters.

Fix clearing of bits in RCTL for the non-bpf/non-allmulti case.
Update RCTL after modifying the multicast filter registers as per
the Linux driver.

This fixes LACP on igc interfaces, where incoming LACP multicasti
control packets were being dropped.

Reviewed by: kbowling
Obtained from: Rubicon Communications, LLC ("Netgate")
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D32574

2 years agonet80211: correct input_sta length checks and control frame handling
Bjoern A. Zeeb [Thu, 30 Sep 2021 16:41:19 +0000 (16:41 +0000)]
net80211: correct input_sta length checks and control frame handling

Correct input_sta "assertion" checks.  CTS/ACK CTRL frames are shorter
then sizeof(struct ieee80211_frame_min) and were thus running into the
is_rx_tooshort error case.
Use ieee80211_anyhdrsize() to handle this better but make sure we do
at least have the first 2 octets needed for that.
While here move the safety checks before any code which may not obey
them later, just for good style.

The non-scanning check further down assumes a frame format also not
matching control frames.  For now skip the checks for control frames
which allows us to deal with some of them at least now.

Sponsored by: The FreeBSD Foundation
Obtained from: 20210906 wireless v0.91 code drop
MFC after: 3 days
Reviewed by: adrian
Differential Revision: https://reviews.freebsd.org/D32238

2 years agonet80211/drivers: improve ieee80211_rx_stats for band
Bjoern A. Zeeb [Sun, 6 Jun 2021 21:14:28 +0000 (21:14 +0000)]
net80211/drivers: improve ieee80211_rx_stats for band

While IEEE80211_R_BAND was defined, there was no place to store the
band.  Add a field for that, adjust ieee80211_lookup_channel_rxstatus()
to require it, and update drivers passing "R_{FREQ|IEEE}" in already to
provide the band as well.  For the moment keep the fall-back code
requiring all three fields.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Reviewed by: adrian
Differential Revision: https://reviews.freebsd.org/D30662

2 years agopf tests: test NAT-ed ICMP errors
Kristof Provost [Tue, 19 Oct 2021 11:52:21 +0000 (13:52 +0200)]
pf tests: test NAT-ed ICMP errors

Ensure that the ICMP error is returned with the correct
source and destination addresses.

MFC after: 3 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D32572

2 years agopf: ensure we have the correct source/destination IP address in ICMP errors
Luiz Otavio O Souza [Tue, 19 Oct 2021 11:37:54 +0000 (13:37 +0200)]
pf: ensure we have the correct source/destination IP address in ICMP errors

When we route-to a packet that later turns out to not fit in the
outbound interface MTU we generate an ICMP error.
However, if we've already changed those (i.e. we've passed through a NAT
rule) we have to undo the transformation first.

Obtained from: pfSense
MFC after: 3 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D32571

2 years agoRELNOTES: Fix KMSAN entry
Elliott Mitchell [Fri, 22 Oct 2021 07:16:54 +0000 (15:16 +0800)]
RELNOTES: Fix KMSAN entry

The lead digit was lost in 05eba8e068c1 making it impossible to find the
commit.

The two subsequent RELNOTES commits gave one less digit of the commit
hash, which is what `git rev-parse --short` thinks the minimal length is,
but keep them to align with other entries.

Fixes: 05eba8e068c1
Differential Revision: https://reviews.freebsd.org/D32595

2 years agocontrib/tzdata: import tzdata 2021e
Philip Paeps [Fri, 22 Oct 2021 05:20:20 +0000 (13:20 +0800)]
contrib/tzdata: import tzdata 2021e

Merge commit 'c66f7aacfc78e5e86469f85f20d3d4fc7d1e9a74'

Changes: https://github.com/eggert/tz/blob/2021e/NEWS

MFC after: 3 days

2 years agoImport tzdata 2021e
Philip Paeps [Fri, 22 Oct 2021 05:17:04 +0000 (13:17 +0800)]
Import tzdata 2021e

2 years agoDocument my doc commit bit history
Li-Wen Hsu [Fri, 22 Oct 2021 03:54:06 +0000 (11:54 +0800)]
Document my doc commit bit history

Reminded by: ygy

2 years agouefi(8): loader.efi does not search for loader.efi
Colin Percival [Thu, 21 Oct 2021 20:15:57 +0000 (13:15 -0700)]
uefi(8): loader.efi does not search for loader.efi

This man page formerly referred to boot1.efi searching for loader.efi;
when boot1.efi was obsoleted in favour of having loader.efi launched
directly, this was left claiming that loader.efi searched for
loader.efi.

Reviewed by: bcran
Fixes: db8b56134506 Rework UEFI ESP generation
Differential Revision: https://reviews.freebsd.org/D32334

2 years agoarswitch(4): Hook new manpage to build
Guangyuan Yang [Thu, 21 Oct 2021 19:22:34 +0000 (15:22 -0400)]
arswitch(4): Hook new manpage to build

PR: 211668
Fixes: 262717e270c3e8a28fa2937db750ba946be8c836
Reported by: jhb

2 years agouipc_shm: silent warnings about write-only variables in largepage code
Konstantin Belousov [Thu, 21 Oct 2021 17:46:36 +0000 (20:46 +0300)]
uipc_shm: silent warnings about write-only variables in largepage code

In shm_largepage_phys_populate(), the result from vm_page_grab() is only
needed for assertion.

In shm_dotruncate_largepage(), there is a commented-out prototype code
for managed largepages.   The oldobjsz is saved for its sake, so mark
the variable as __unused directly.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

2 years agosig_ast_checksusp(): mark the local p as __diagused
Konstantin Belousov [Thu, 21 Oct 2021 17:43:32 +0000 (20:43 +0300)]
sig_ast_checksusp(): mark the local p as __diagused

It is only used to assert that the (current) process is locked

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

2 years agosubr_firmware.c::unloadentry(): remote write-only variable
Konstantin Belousov [Thu, 21 Oct 2021 17:40:24 +0000 (20:40 +0300)]
subr_firmware.c::unloadentry(): remote write-only variable

The function ignores result returned by linker_release_module().
The FW_UNLOAD flag on the file is cleared, so even on error it would
not be tried again.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

2 years agoalq_open_flags(): mark local td variable as unused
Konstantin Belousov [Thu, 21 Oct 2021 17:39:15 +0000 (20:39 +0300)]
alq_open_flags(): mark local td variable as unused

It is passed to the NDINIT() macro which ignores the thread argument
for some time.

Sponsored by: The FreeBSD Foundation

2 years agoDMAR: clean up warnings about write-only variables
Konstantin Belousov [Thu, 21 Oct 2021 17:23:45 +0000 (20:23 +0300)]
DMAR: clean up warnings about write-only variables

For some of them, used only when KTR or KMSAN are configured, apply
__unused attribute directly.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

2 years agoumtxq_requeue: remove write-only variable uh2
Konstantin Belousov [Thu, 21 Oct 2021 17:10:42 +0000 (20:10 +0300)]
umtxq_requeue: remove write-only variable uh2

umtxq_queue_lookup() does not change state.  It is redone inside
umtxq_insert() later, anyway.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

2 years agoufs: remove write-only variables
Konstantin Belousov [Wed, 20 Oct 2021 01:42:31 +0000 (04:42 +0300)]
ufs: remove write-only variables

Mark variables as __diagused for invariant-only vars

Reviewed by: imp, mjg
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D32577

2 years agoktls: Always create a software backend for receive sessions.
John Baldwin [Thu, 21 Oct 2021 16:37:17 +0000 (09:37 -0700)]
ktls: Always create a software backend for receive sessions.

A future change to TOE TLS will require a software fallback for the
first few TLS records received.  Future support for NIC TLS on receive
will also require a software fallback for certain cases.

Reviewed by: gallatin, hselasky
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D32566

2 years agoktls: Change struct ktls_session.cipher to an OCF-specific type.
John Baldwin [Thu, 21 Oct 2021 16:36:53 +0000 (09:36 -0700)]
ktls: Change struct ktls_session.cipher to an OCF-specific type.

As a followup to SW KTLS assuming an OCF backend, rename
struct ocf_session to struct ktls_ocf_session and forward
declare it in <sys/ktls.h> to use as the type of
struct ktls_session.cipher.

Reviewed by: gallatin, hselasky
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D32565

2 years agoktls: Add a routine to query information in a receive socket buffer.
John Baldwin [Thu, 21 Oct 2021 16:36:29 +0000 (09:36 -0700)]
ktls: Add a routine to query information in a receive socket buffer.

In particular, ktls_pending_rx_info() determines which TLS record is
at the end of the current receive socket buffer (including
not-yet-decrypted data) along with how much data in that TLS record is
not yet present in the socket buffer.

This is useful for future changes to support NIC TLS receive offload
and enhancements to TOE TLS receive offload.  Those use cases need a
way to synchronize a state machine on the NIC with the TLS record
boundaries in the TCP stream.

Reviewed by: gallatin, hselasky
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D32564

2 years agocmp: initialize limit to avoid stack garbage limits
Kyle Evans [Thu, 21 Oct 2021 16:30:55 +0000 (11:30 -0500)]
cmp: initialize limit to avoid stack garbage limits

Pointy hat: kevans
Fixes: 4e380e847460 ("cmp: add -n, --bytes to limit number of bytes [...]")
Sponsored by: Klara, Inc.

2 years agoEnable stack gap on arm64
Dawid Gorecki [Thu, 21 Oct 2021 15:18:46 +0000 (17:18 +0200)]
Enable stack gap on arm64

Stack gap code used on amd64 can also be reused for arm64. Point
sv_stackgap to elf64_stackgap to enable this feature.

Reviewed by: mw, kib, emaste
Tested by: mw
MFC: after 1 month
Differential Revision: https://reviews.freebsd.org/D32588

2 years agozfs: merge openzfs/zfs@ec64fdb93 (master) into main
Martin Matuska [Thu, 21 Oct 2021 11:58:45 +0000 (13:58 +0200)]
zfs: merge openzfs/zfs@ec64fdb93 (master) into main

Notable upstream pull request merges:
  #12392 Avoid panic in case of pool errors and missing L2ARC
  #12448 skip snapshot in zfs_iter_mounted()
  #12516 Fix NFS and large reads on older kernels
  #12533 Fail invalid incremental recursive send gracefully
  #12569 FreeBSD: Really zero the zero page
  #12575 Reject zfs send -RI with nonexistent fromsnap
  #12602 Correct refcount_add in dmu_zfetch
  #12650 zpool should call zfs_nicestrtonum() with non-NULL handle

Obtained from: OpenZFS
OpenZFS commit: ec64fdb93d144ab1884097cfd36e18b62a2db848

2 years agoOnly change the fadt revision in acpidump on i386
Andrew Turner [Wed, 20 Oct 2021 09:19:55 +0000 (10:19 +0100)]
Only change the fadt revision in acpidump on i386

There is a workaround in acpidump for an old IBM laptop. This is being
hit on a modern arm64 system causing acpidump to use the wrong field
when reading a later address.

As the laptop has a 32-bit CPU the only FreeBSD support for it is i386.
As such limit the workaround to that architecture.

Reviewed by: emaste, jkim, jhb (all earlier version)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D32573

2 years agotimeout.1: Fix typos in examples
Mateusz Piotrowski [Thu, 21 Oct 2021 11:06:45 +0000 (13:06 +0200)]
timeout.1: Fix typos in examples

MFC after: 3 days

2 years agoxen/devices: purge uses of intr_machdep.h
Elliott Mitchell [Fri, 23 Apr 2021 02:59:22 +0000 (19:59 -0700)]
xen/devices: purge uses of intr_machdep.h

Devices in sys/dev should be architecture-independent and NOT #include
intr_machdep.h.

Reviewed by: mhorne royger
Differential Revision: https://reviews.freebsd.org/D29959

2 years agoxen/pcifront: purge from tree
Roger Pau Monné [Wed, 20 Oct 2021 10:39:33 +0000 (12:39 +0200)]
xen/pcifront: purge from tree

Xen pcifront has been unhooked from the build for a long time, as it's
only used by PV mode which FreeBSD doesn't support. Remove it from the
tree.

2 years agobhyve: Bump the SMBIOS firmware version to 14.0 for 14-CURRENT
Rebecca Cran [Thu, 21 Oct 2021 02:33:49 +0000 (20:33 -0600)]
bhyve: Bump the SMBIOS firmware version to 14.0 for 14-CURRENT

Bump the firmware version to 14.0 and set the firmware release date
to today.

Reviewed by: jhb, bz, imp
Differential Revision: https://reviews.freebsd.org/D32534

2 years agoldd: do not use dlopen(RTLD_TRACE) for dso when format is specified
Konstantin Belousov [Mon, 11 Oct 2021 22:35:56 +0000 (01:35 +0300)]
ldd: do not use dlopen(RTLD_TRACE) for dso when format is specified

Problem is that rtld cannot reliably access updated environment.
This was made more obvious by bfd4c875a10560aaa2.  The application
environment can be in arbitrary state and place, system components
can observe it only during execve(2), or in case of rtld, right after
execve, when environment is still at know location and format.

Instead spawn ld-elf.so.1 in direct exec mode which can correctly read
all inherited updates to the environment.

PR: 259069
Reviewed by: arichardson, jhb
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D32464

2 years agoldd: style
Konstantin Belousov [Tue, 12 Oct 2021 11:39:32 +0000 (14:39 +0300)]
ldd: style

Reviewed by: arichardson, jhb
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D32464

2 years agortld-elf/paths.h: Make it usable outside rtld
Konstantin Belousov [Tue, 12 Oct 2021 15:50:49 +0000 (18:50 +0300)]
rtld-elf/paths.h: Make it usable outside rtld

but still for tightly coupled things like ldd(1)

Rename paths.h to rtld_paths.h.
Add guard for rtld-specific externs declarations.
Add _COMPAT32_BASENAME_RTLD and _COMPAT32_PATH_RTLD.

Reviewed by: arichardson, jhb
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D32464

2 years agoping: fix parsing of options including '4' and '6'
Alan Somers [Wed, 6 Oct 2021 22:54:59 +0000 (16:54 -0600)]
ping: fix parsing of options including '4' and '6'

ping uses a two-pass option parser.  The first pass determines whether
ipv4 or ipv6 is desired, and the second parses the rest of the options.
But the first pass wrongly detects a '4' or '6' in an option's value as
a request to use ipv6 or ipv6 respectively, for example in an invocation
like "ping -c6 1.2.3.4".

Fix this confusion by including all options in the first round of
parsing, but ignoring those unrelated to ipv4/ipv6 selection.

PR: 258048
Reported by: ghuckriede@blackberry.com
Submitted by: ghuckriede@blackberry.com
MFC after: 2 weeks
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D32344

2 years agonet: Allow binding of unspecified address without address existance
Roy Marples [Wed, 20 Oct 2021 15:47:29 +0000 (11:47 -0400)]
net: Allow binding of unspecified address without address existance

Previously in_pcbbind_setup returned EADDRNOTAVAIL for empty
V_in_ifaddrhead (i.e., no IPv4 addresses configured) and in6_pcbbind
did the same for empty V_in6_ifaddrhead (no IPv6 addresses).

An equivalent test has existed since 4.4-Lite.  It was presumably done
to avoid extra work (assuming the address isn't going to be found
later).

In normal system operation *_ifaddrhead will not be empty: they will
at least have the loopback address(es).  In practice no work will be
avoided.

Further, this case caused net/dhcpd to fail when run early in boot
before assignment of any addresses.  It should be possible to bind the
unspecified address even if no addresses have been configured yet, so
just remove the tests.

The now-removed "XXX broken" comments were added in 59562606b9d3,
which converted the ifaddr lists to TAILQs.  As far as I (emaste) can
tell the brokenness is the issue described above, not some aspect of
the TAILQ conversion.

PR: 253166
Reviewed by: ae, bz, donner, emaste, glebius
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D32563

2 years agoSkip snapshot in zfs_iter_mounted()
youzhongyang [Wed, 20 Oct 2021 23:07:19 +0000 (19:07 -0400)]
Skip snapshot in zfs_iter_mounted()

The intention of the zfs_iter_mounted() is to traverse the dataset
and its descendants, not the snapshots. The current code can cause
a mounted snapshot to be included and thus zfs_open() on the snapshot
with ZFS_TYPE_FILESYSTEM would print confusing message such as "cannot
open 'rpool/fs@snap': snapshot delimiter '@' is not expected here".

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Youzhong Yang <yyang@mathworks.com>
Closes #12447
Closes #12448

2 years agovdev_id: Fix enclosure_symlinks feature
Tony Hutter [Wed, 20 Oct 2021 22:48:04 +0000 (15:48 -0700)]
vdev_id: Fix enclosure_symlinks feature

The vdev_id.conf "enclosure_symlinks" option persistently creates
and maps /dev/by-enclosure symlinks to dynamic /dev/sg* devices.

This patch fixes two issues:

1. The enclosure_symlinks feature was accidentally broken in:

   vdev_id: Support daisy-chained JBODs in multipath mode

2. Even when working, the feature numbered the enclosure
   sequentially rather than by HBA port number.  That meant that
   if a port was down or didn't appear in sysfs, then the
   enclosure_sumlinks numbers would be numbered wrong.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Signed-off-by: Tony Hutter <hutter2@llnl.gov>
Closes #12660

2 years agopowerpc64le: stand fixes
Leandro Lupori [Wed, 20 Oct 2021 18:48:33 +0000 (15:48 -0300)]
powerpc64le: stand fixes

Fix boot1 and loader on PowerPC64 little-endian (LE).

Due to endian issues, boot1 couldn't find the UFS boot partition
and loader wasn't able to load the kernel. Most of the issues
happened because boot1 and loader were BE binaries trying to access
LE UFS partitions and because loader expects the kernel ELF image
to use the same endian as itself.

To fix these issues, boot1 and loader are now built as LE binaries
on PPC64LE. To support this, the functions that call OpenFirmware
were enhanced to correctly perform endian conversion on its input
and output arguments and to change the CPU into BE mode before
making the calls, as OpenFirmware always runs in BE. Besides that,
some other small fixes were needed.

Submitted by: bdragon (initial version)
Reviewed by: alfredo, jhibbits
Sponsored by: Instituto de Pesquisas Eldorado (eldorado.org.br)
Differential Revision: https://reviews.freebsd.org/D32160

2 years agosys/bus.h: silence warnings about write-only variables
Konstantin Belousov [Wed, 20 Oct 2021 13:23:30 +0000 (16:23 +0300)]
sys/bus.h: silence warnings about write-only variables

in the generated functions for bus accessors.  These are the most
noising instances for drivers when non-debug kernel is compiled with
clang 13.

Reviewed by: imp
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D32578