]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
2 years agoriscv timer: implement riscv_timer_et_stop()
Mitchell Horne [Tue, 21 Jun 2022 16:23:40 +0000 (13:23 -0300)]
riscv timer: implement riscv_timer_et_stop()

Simply by masking timer interrupts.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D35463

2 years agoriscv timer: provide a function for cpu_ticks
Mitchell Horne [Tue, 21 Jun 2022 16:23:31 +0000 (13:23 -0300)]
riscv timer: provide a function for cpu_ticks

This is cheaper than the default of tc_cpu_ticks().

MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D35462

2 years agoriscv timer: remove intermediate helper
Mitchell Horne [Tue, 21 Jun 2022 16:23:21 +0000 (13:23 -0300)]
riscv timer: remove intermediate helper

get_counts() doesn't do anything at the moment but return the result of
get_cycles(), so remove it.

For clarity, rename get_cycles() to get_timecount(); RISC-V defines
separate time and cyclecount CSRs, so let's avoid confusing the two.
They may be backed by the same underlying clock, but this is an
implementation detail.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D35461

2 years agoriscv timer: cleanup
Mitchell Horne [Tue, 21 Jun 2022 16:22:40 +0000 (13:22 -0300)]
riscv timer: cleanup

- Prune unused definitions and includes
- Slight renaming of callback functions to indicate their usage
- Place vdso_fill_timehands callback logically in the file
- Small style nits

MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D35460

2 years agoset_cputicker: use a bool
Mitchell Horne [Tue, 21 Jun 2022 16:22:26 +0000 (13:22 -0300)]
set_cputicker: use a bool

The third argument to this function indicates whether the supplied
ticker is fixed or variable, i.e. requiring calibration. Give this
argument a type and name that better conveys this purpose.

Reviewed by: kib, markj
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D35459

2 years agobus_if: provide a default null rescan method
Mitchell Horne [Tue, 21 Jun 2022 13:29:53 +0000 (10:29 -0300)]
bus_if: provide a default null rescan method

There is an existing helper method in subr_bus.c, but almost no drivers
know to use it. It also returns the same error as an empty method,
making it not very useful. Move this to bus_if.m and return a more
sensible error code.

This gives a slightly more meaningful error message when attempting
'devctl rescan' on buses and devices alike:
  "Device not configured" --> "Operation not supported by device"

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

2 years agoif_ffec: free the dmamem allocation in detach
Mitchell Horne [Wed, 15 Jun 2022 15:53:25 +0000 (12:53 -0300)]
if_ffec: free the dmamem allocation in detach

Calling bus_dmamap_destroy() for a mapping which was allocated with
bus_dmamem_alloc() will result in a panic. This change is not run-time
tested, but I identified the issue while implementing the analogous
method in if_dwc(4), using this implementation as the template.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

2 years agoif_ffec: fix some misleading indentation
Mitchell Horne [Sat, 7 May 2022 20:26:44 +0000 (17:26 -0300)]
if_ffec: fix some misleading indentation

2 years agoif_dwc: avoid duplicate packet counts
Mitchell Horne [Tue, 21 Jun 2022 13:24:25 +0000 (10:24 -0300)]
if_dwc: avoid duplicate packet counts

We already increment the unicast IPACKETS and OPACKETS counters in the
rx/tx paths, respectively. Multicast packets are counted in the generic
ethernet code. Therefore, we shouldn't increment these counters in
dwc_harvest_stats().

Drop the early return from dwc_rxfinish_one() so that we still count
received packets with e.g. a checksum error.

PR: 263817
Reported by: Jiahao LI <jiahali@blackberry.com>
Reviewed by: manu
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D35499

2 years agoif_dwc: enable RX checksum offload feature
Jiahao Li [Tue, 21 Jun 2022 13:23:43 +0000 (10:23 -0300)]
if_dwc: enable RX checksum offload feature

We claim support in ifcaps, but don't actually enable it.

PR: 263886
Reviewed by: manu
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D35498

2 years agoif_dwc: recognize additional rgmii phy-modes
Mitchell Horne [Tue, 21 Jun 2022 13:22:53 +0000 (10:22 -0300)]
if_dwc: recognize additional rgmii phy-modes

Per the reports, some Allwinner device trees now list the desired
phy-mode as "rgmii-id". The manual string comparison fails to detect
this, and we end up falling back to MII mode. Instead, select the clock
name using the sc->phy_mode variable, which is set in the main attach
function.

The logic to actually handle rgmii-id mode delays will be added to the
relevant PHY driver.

PR: 261355, 264673
Reported by: Maren <marentoy@protonmail.com>
Reported by: Arie Bikker <src-2016@bikker.homeunix.net>
Reviewed by: manu
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D35500

2 years agoif_dwc: add detach method
Mitchell Horne [Tue, 21 Jun 2022 13:26:44 +0000 (10:26 -0300)]
if_dwc: add detach method

It can be useful for testing.

Reviewed by: manu
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D35496

2 years agoif_dwc: consistently use if.c helper methods
Mitchell Horne [Tue, 21 Jun 2022 13:28:06 +0000 (10:28 -0300)]
if_dwc: consistently use if.c helper methods

And if_t rather than struct ifnet *. No functional change intended.

Reviewed by: manu
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D35497

2 years agomptable_hostb: Use legacy_get_pcibus() to fetch PCI bus number.
John Baldwin [Thu, 23 Jun 2022 17:49:09 +0000 (10:49 -0700)]
mptable_hostb: Use legacy_get_pcibus() to fetch PCI bus number.

The mptable_hostb driver is a child of legacy0 and has legacy bus
ivars, not PCI or PCI bridge ivars.

PR: 264819
Reported by: Dennis Clarke <dclarke@blastwave.org>
Diagnosed by: avg
Reviewed by: avg
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D35548

2 years agozfs: fix static module build broken in 1f1e2261e
Martin Matuska [Thu, 23 Jun 2022 17:42:55 +0000 (19:42 +0200)]
zfs: fix static module build broken in 1f1e2261e

2 years agoses: don't panic if disk elements have really weird descriptors
Alan Somers [Fri, 10 Jun 2022 22:44:59 +0000 (16:44 -0600)]
ses: don't panic if disk elements have really weird descriptors

SES allows element descriptors to contain characters like spaces and
quotes that devfs does not allow to appear in device aliases.  Since SES
element descriptors are outside of the kernel's control, we should
gracefully handle a failure to create a device physical path alias.

PR: 264513
Reported by: Yuri <yuri@aetern.org>
Reviewed by: imp, mav
Sponsored by: Axcient
MFC after: 2 weeks

2 years agozfs: merge openzfs/zfs@deb121309
Martin Matuska [Thu, 23 Jun 2022 15:47:42 +0000 (17:47 +0200)]
zfs: merge openzfs/zfs@deb121309

Notable upstream pull request merges:
  #12918 Introduce BLAKE3 checksums as an OpenZFS feature
  #13553 Reduce ZIO io_lock contention on sorted scrub
  #13537 Improve sorted scan memory accounting
  #13540 AVL: Remove obsolete branching optimizations
  #13563 FreeBSD: Improve crypto_dispatch() handling

Obtained from: OpenZFS
OpenZFS commit: deb1213098e2dc10e6eee5e5c57bb40584e096a6

2 years agobsdinstall: improve zfsboots ability to handle datasets under a BE
Brad Davis [Tue, 7 Jun 2022 17:11:02 +0000 (11:11 -0600)]
bsdinstall: improve zfsboots ability to handle datasets under a BE

Currently we only set canmount=noauto on the root of the BE, this
change makes it so we set it on all datasets under the BE as well.

Reviewed by: allanjude
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D35422

2 years agoAdd tests for TCP_MD5 getsockopt
Claudio Jeker [Thu, 23 Jun 2022 14:54:26 +0000 (15:54 +0100)]
Add tests for TCP_MD5 getsockopt

Add tests for TCP_MD5 getsockopt for ipv6 and ipv4. These will only run
when the kernel module is loaded, but will be in place if further
regressions are found.

Reviewed by: rscheff
MFC after: 3 days
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D35532

2 years agoUnlock inp when handling TCP_MD5SIG socket options
Claudio Jeker [Thu, 23 Jun 2022 14:50:47 +0000 (15:50 +0100)]
Unlock inp when handling TCP_MD5SIG socket options

Unlock the inp when hanlding TCP_MD5SIG socket options. tcp_ipsec_pcbctl
handles locking the inp when the option is being modified.

This was found by Claudio Jeker while working on the OpenBGPd port.

On 14 we get a panic when trying to call getsockopt, on 13.1 the process
locks up using 100% CPU.

Reviewed by: rscheff (transport), tuexen
MFC after: 3 days
Sponsored by: Klara Inc.
Differential Revision: https://reviews.freebsd.org/D35532

2 years agoadjkerntz(8): revert "detect extra jailed invokation to keep logs clean"
Eugene Grosbein [Thu, 23 Jun 2022 14:46:08 +0000 (21:46 +0700)]
adjkerntz(8): revert "detect extra jailed invokation to keep logs clean"

This reverts commit 048ce0876f5421f70a6d348479bdeacdd8472bed
due to bugs. Reworked change will be committed later hopefully.

2 years agodiff3: Add man page description for version and help
Tom Jones [Thu, 23 Jun 2022 12:37:28 +0000 (13:37 +0100)]
diff3: Add man page description for version and help

Reviewed by: Pau Amma
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D35325

2 years agolibsysdecode: Fix a typo in my email
Dmitry Chagin [Thu, 23 Jun 2022 09:29:29 +0000 (12:29 +0300)]
libsysdecode: Fix a typo in my email

Reported by: Mikaël Urankar
MFC after: 2 weeks

2 years agopf: copy out rather than m_pullup() in pf_test_eth_rule()
Kristof Provost [Wed, 22 Jun 2022 14:52:24 +0000 (16:52 +0200)]
pf: copy out rather than m_pullup() in pf_test_eth_rule()

Don't change the mbuf chain layout. We've encountered alignment issues
in the tcp syncookie code on armv7, which are triggered by the
m_pullup() here.

Reviewed by: mjg
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D35551

2 years agowpa: Disable P2P in WPS
Cy Schubert [Thu, 23 Jun 2022 03:51:27 +0000 (20:51 -0700)]
wpa: Disable P2P in WPS

Disable P2P in WPS as it is not supported by FreeBSD. Also, it is not
enabled in wpa_supplicant so the WPS P2P code is redundant.

PR: 264238
Reported by: adrian
MFC after: 3 days

2 years agoffs: fix vn_read_from_obj() usage for PAGE_SIZE > block size
Chuck Silvers [Wed, 22 Jun 2022 21:52:42 +0000 (14:52 -0700)]
ffs: fix vn_read_from_obj() usage for PAGE_SIZE > block size

vn_read_from_obj() requires that all pages of a vnode (except the last
partial page) be either completely valid or completely invalid,
but for file systems with block size smaller than PAGE_SIZE,
partially valid pages may exist anywhere in the file.
Do not enable the vn_read_from_obj() path in this case.

Reviewed by: mckusick, kib, markj
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D34836

2 years agonfsd: Clean up the code by not using the vnode_vtype() macro
Rick Macklem [Wed, 22 Jun 2022 20:20:32 +0000 (13:20 -0700)]
nfsd: Clean up the code by not using the vnode_vtype() macro

The vnode_vtype() macro was used to make the code compatible
with Mac OSX, for the Mac OSX port.
For FreeBSD, this macro just obscured the code, so
avoid using it to clean up the code.

This commit should not result in a semantics change.

2 years agorelease: arm - increase IMAGE_SIZE
Glen Barber [Wed, 22 Jun 2022 18:23:39 +0000 (14:23 -0400)]
release: arm - increase IMAGE_SIZE

For some reason, while 3072M is sufficient for 14-CURRENT, it is not
for 13-STABLE.  Notably, previous investigations suggest that there
are changes to makefs(8) in main that do not exist in stable/13,
in which 14-CURRENT seems perfectly happy to ignore the target image
size is smaller than the data being populated to it.

I have no futher investigative details at the moment, but as this had
caused arm failures for the past three weeks, this is the more hasty
measure, hence the MFC timeframe noted.

MFC after: 10 minutes
Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agosrc.conf.5: regen after RELRO knob addition
Ed Maste [Wed, 22 Jun 2022 16:21:31 +0000 (12:21 -0400)]
src.conf.5: regen after RELRO knob addition

2 years agoAdd RELRO build knob, default to enabled
Ed Maste [Wed, 22 Jun 2022 12:58:04 +0000 (08:58 -0400)]
Add RELRO build knob, default to enabled

Note that lld enables relro by default, so that we already had either
partial or full RELRO, depending on the state of the BIND_NOW knob.

Add a RELRO knob so that the option can be disabled if desired, and so
that builds using the GNU toolchain are equivalent to those using the
standard Clang/LLVM toolchain.

Reviewed by: markj
MFC after: 3 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D35545

2 years agorouting: improve debug logging
Alexander V. Chernikov [Wed, 22 Jun 2022 15:04:17 +0000 (15:04 +0000)]
routing: improve debug logging

Use standard logging (FIB_XX_LOG) across nhg code instead of using
 old-style DPRINTFs.
 Add debug object printer for nhgs (`nhgrp_print_buf`).

Example:

```
Jun 19 20:17:09 devel2 kernel: [nhgrp] inet.0 nhgrp_ctl_alloc_default: multipath init done
Jun 19 20:17:09 devel2 kernel: [nhg_ctl] inet.0 alloc_nhgrp: num_nhops: 2, compiled_nhop: 2

Jun 19 20:17:26 devel2 kernel: [nhg_ctl] inet.0 alloc_nhgrp: num_nhops: 3, compiled_nhop: 3
Jun 19 20:17:26 devel2 kernel: [nhg_ctl] inet.0 destroy_nhgrp: destroying nhg#0/sz=2:[#6:1,#5:1]
```

Differential Revision: https://reviews.freebsd.org/D35525
MFC after: 2 weeks

2 years agovendor/bc: update to upstream commit ca53adf83b7a
Stefan Eßer [Wed, 22 Jun 2022 13:41:40 +0000 (15:41 +0200)]
vendor/bc: update to upstream commit ca53adf83b7a

The filter_text function in scripts/functions.sh in version 5.3.3 had
commented out a "rm" command, probably for debugging purposes. This
caused temporary files to persist in /tmp when the bc program had been
built.

This commit fixes the build process with no change of the resulting
artefacts.

(cherry picked from commit 1576f66712876ee8b0fcc8b35fb062e1813b4fc0)

MFC after: 3 days

2 years agonetstat: print path weight when showing routes in structured output.
Alexander V. Chernikov [Mon, 20 Jun 2022 08:59:15 +0000 (08:59 +0000)]
netstat: print path weight when showing routes in structured output.

Differential Revision: https://reviews.freebsd.org/D35530
MFC after: 2 weeks

2 years agoUFS: make mkdir() and link() reliable when using SU and reaching nlink limit
Konstantin Belousov [Sat, 18 Jun 2022 10:59:31 +0000 (13:59 +0300)]
UFS: make mkdir() and link() reliable when using SU and reaching nlink limit

i_nlink overflow might be transient, i_effnlink indicates the final
value of the link count after all dependencies would be resolved. So if
i_nlink reached the maximum but i_efflink did not, we should be able to
make the link by syncing.

We must sync the whole filesystem to resolve dependencies,
which requires unlocking vnodes locked for VOPs.  Use existing
ERELOOKUP/VOP_UNLOCK_PAIR() mechanism to restart the VOP if sync with
unlock was done.

PR: 165392
Reported by: Vsevolod Volkov <vvv@colocall.net>
Reviewed by: mckusick
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D35514

2 years agolinprocfs: Skip printing of the guard page in the /proc/self/maps
Dmitry Chagin [Wed, 22 Jun 2022 11:49:40 +0000 (14:49 +0300)]
linprocfs: Skip printing of the guard page in the /proc/self/maps

To calculate the base (lowest addressable) address of the stack of the
initial thread glibc parses /proc/self/maps.
In fact, the base address is calculated as 'to' value of stack entry of the
/proc/self/maps - stack size limit (if the stack grows down).
The base address should fit in between preceding entry and stack entry of
the /proc/self/maps.
In FreeBSD, since 19bd0d9 (Implement address space guards), we actually
have two mappings for the stack region. The first one is the no-access
mapping for the region the stack can grow into (guard page), and the
second - initial stack region with size sgrowsiz.
The first mapping confuses Glibc, in the end which is improperly
calculate stack size and the base address.

PR: 253337
Reviewed by: kib
Differential revision: https://reviews.freebsd.org/D35537
MFC after: 2 week

2 years agokdump: Decode Linux *at() syscalls
Dmitry Chagin [Wed, 22 Jun 2022 11:29:38 +0000 (14:29 +0300)]
kdump: Decode Linux *at() syscalls

MFC after: 2 weeks

2 years agolinux(4): To reuse MD linux.h hide kernel dependencies unde _KERNEL constraint
Dmitry Chagin [Wed, 22 Jun 2022 11:28:24 +0000 (14:28 +0300)]
linux(4): To reuse MD linux.h hide kernel dependencies unde _KERNEL constraint

MFC after: 2 weeks

2 years agokdump: For future use made decode_filemode() public
Dmitry Chagin [Wed, 22 Jun 2022 11:26:50 +0000 (14:26 +0300)]
kdump: For future use made decode_filemode() public

MFC after: 2 weeks

2 years agolibsysdecode: Decode Linux open() flags
Dmitry Chagin [Wed, 22 Jun 2022 11:26:10 +0000 (14:26 +0300)]
libsysdecode: Decode Linux open() flags

MFC after: 2 weeks

2 years agolibsysdecode: Decode Linux *at() flags
Dmitry Chagin [Wed, 22 Jun 2022 11:25:36 +0000 (14:25 +0300)]
libsysdecode: Decode Linux *at() flags

MFC after: 2 weeks

2 years agokdump: Decode Linux clock_nanosleep syscall
Dmitry Chagin [Wed, 22 Jun 2022 11:21:42 +0000 (14:21 +0300)]
kdump: Decode Linux clock_nanosleep syscall

MFC after: 2 weeks

2 years agokdump: Decode Linux sigprocmask how argument
Dmitry Chagin [Wed, 22 Jun 2022 11:20:39 +0000 (14:20 +0300)]
kdump: Decode Linux sigprocmask how argument

MFC after: 2 weeks

2 years agokdump: Decode getitimer, setitimer which argument
Dmitry Chagin [Wed, 22 Jun 2022 11:19:31 +0000 (14:19 +0300)]
kdump: Decode getitimer, setitimer which argument

Reviewed by: jhb (previous version, without truss)
Differential revision: https://reviews.freebsd.org/D35231
MFC after: 2 weeks

2 years agolibsysdecode: Decode setitimer, getitimer which argument
Dmitry Chagin [Wed, 22 Jun 2022 11:17:10 +0000 (14:17 +0300)]
libsysdecode: Decode setitimer, getitimer which argument

Reviewed by: jhb
Differential revision: https://reviews.freebsd.org/D35230
MFC after: 2 weeks

2 years agokdump: Decode Linux l_sigset_t.
Dmitry Chagin [Wed, 22 Jun 2022 11:15:20 +0000 (14:15 +0300)]
kdump: Decode Linux l_sigset_t.

Reviewed by: markj
Differential revision: https://reviews.freebsd.org/D35153
MFC after: 2 weeks

2 years agolinux(4): Trace Linux l_sigset_t.
Dmitry Chagin [Wed, 22 Jun 2022 11:09:54 +0000 (14:09 +0300)]
linux(4): Trace Linux l_sigset_t.

MFC after: 2 weeks

2 years agokdump: Add preliminary support for decoding Linux syscalls
Dmitry Chagin [Wed, 22 Jun 2022 11:03:56 +0000 (14:03 +0300)]
kdump: Add preliminary support for decoding Linux syscalls

Reviewed by: jhb
Differential revision: https://reviews.freebsd.org/D35216
MFC after: 2 weeks

2 years agokdump: For future use extract common code to a separate files
Dmitry Chagin [Wed, 22 Jun 2022 11:01:36 +0000 (14:01 +0300)]
kdump: For future use extract common code to a separate files

Reviewed by: jhb
Differential revision: https://reviews.freebsd.org/D35356
MFC after: 2 weeks

2 years agolibsysdecode: Add method for decoding Linux signal names
Dmitry Chagin [Wed, 22 Jun 2022 11:00:05 +0000 (14:00 +0300)]
libsysdecode: Add method for decoding Linux signal names

Reviewed by: jhb
Differential revision: https://reviews.freebsd.org/D35215
MFC after: 2 weeks

2 years agolibsysdecode: Add preliminary support for decoding Linux syscalls
Dmitry Chagin [Wed, 22 Jun 2022 10:58:53 +0000 (13:58 +0300)]
libsysdecode: Add preliminary support for decoding Linux syscalls

Differential revision: https://reviews.freebsd.org/D35354
MFC after: 2 weeks

2 years agolibsysdecode: For future use extract common code to a separate files
Dmitry Chagin [Wed, 22 Jun 2022 10:12:21 +0000 (13:12 +0300)]
libsysdecode: For future use extract common code to a separate files

Reviewed by: jhb, emaste
Differential revision: https://reviews.freebsd.org/D35353
MFC after: 2 weeks

2 years agoif_ix: Reset on an ECC error
Neel Chauhan [Wed, 22 Jun 2022 02:13:19 +0000 (19:13 -0700)]
if_ix: Reset on an ECC error

This mirrors the Linux behavior as seen in the kernel commit d773ce2.

Reviewed by: kbowling
MFH after: 3 days
Differential Revision: https://reviews.freebsd.org/D35542

2 years agovfs: fix vfs_bio_clrbuf() for PAGE_SIZE > block size
Chuck Silvers [Wed, 22 Jun 2022 00:58:52 +0000 (17:58 -0700)]
vfs: fix vfs_bio_clrbuf() for PAGE_SIZE > block size

Calculate the desired page valid mask using math that will not
overflow the types used.

Sponsored by: Netflix

Reviewed by: mckusick, kib, markj
Differential Revision: https://reviews.freebsd.org/D34837

2 years agoffs: fix vn_io_fault_pgmove() offset for PAGE_SIZE > block size
Chuck Silvers [Wed, 22 Jun 2022 00:54:18 +0000 (17:54 -0700)]
ffs: fix vn_io_fault_pgmove() offset for PAGE_SIZE > block size

The "offset" argument to vn_io_fault_pgmove() is supposed to be
the offset within the page, but for ffs we currently use the offset
within the block.  When the block size is at least as large as the
page size then these values are the same, but when the page size is
larger than the block size then we need to add the offset of
the block within the page as well.

Sponsored by: Netflix

Reviewed by: mckusick, kib, markj
Differential Revision: https://reviews.freebsd.org/D34835

2 years agoFix memory allocation issue for BLAKE3 context
Tino Reichardt [Tue, 21 Jun 2022 21:32:09 +0000 (23:32 +0200)]
Fix memory allocation issue for BLAKE3 context

The kmem_alloc(sizeof (*ctx), KM_NOSLEEP) call on FreeBSD can't be
used in this code segment. Work around this by pre-allocating a percpu
context array for later use.

Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Tino Reichardt <milky-zfs@mcmilk.de>
Closes #13568

2 years agoRemove ISA sound cards from NOTES
Ed Maste [Tue, 21 Jun 2022 20:33:00 +0000 (16:33 -0400)]
Remove ISA sound cards from NOTES

Fixes: df51e63eb5d7 ("Retire snd_ad1816 ISA sound card driver")
Fixes: aa83e9b189d6 ("Retire snd_ess ISA sound card driver")
Fixes: 754decef384a ("Retire snd_gusc ISA sound card driver")
Fixes: 5126e5eeeb5e ("Retire snd_mss ISA sound card driver")
Fixes: 716924cb4832 ("Retire snd_sbc ISA sound card driver")

Sponsored by: The FreeBSD Foundation

2 years agoRetire snd_sbc ISA sound card driver
Ed Maste [Tue, 21 Jun 2022 18:50:04 +0000 (14:50 -0400)]
Retire snd_sbc ISA sound card driver

Along with the snd_sb8 and snd_sb16 drivers.  They supported ISA
Creative Sound Blaster and compatible sound cards.

Note that isa/sb.h is not removed, as it is still used by some PCI
sound card drivers.

ISA sound card drivers are deprecated as discussed on the current[1] and
stable[2] mailing lists.  Deprecation notices were added in e39ec8933be4
and MFCd to stable branches.

Driver removals are being committed individually so that specific
drivers can be restored if necessary (either in FreeBSD or by downstream
projects).

[1] https://lists.freebsd.org/archives/freebsd-current/2022-March/001680.html
[2] https://lists.freebsd.org/archives/freebsd-stable/2022-March/000585.html

Reviewed by: mav
Relnotes: Yes
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34671

2 years agoRetire snd_mss ISA sound card driver
Ed Maste [Tue, 21 Jun 2022 18:50:04 +0000 (14:50 -0400)]
Retire snd_mss ISA sound card driver

The snd_mss driver supported Microsoft Sound System sound cards.

ISA sound card drivers are deprecated as discussed on the current[1] and
stable[2] mailing lists.  Deprecation notices were added in e39ec8933be4
and MFCd to stable branches.

Driver removals are being committed individually so that specific
drivers can be restored if necessary (either in FreeBSD or by downstream
projects).

[1] https://lists.freebsd.org/archives/freebsd-current/2022-March/001680.html
[2] https://lists.freebsd.org/archives/freebsd-stable/2022-March/000585.html

Reviewed by: mav
Relnotes: yes
Sponsored by: The FreeBSD Foundation
Differential Revision: Thttps://reviews.freebsd.org/D34671

2 years agoRetire snd_gusc ISA sound card driver
Ed Maste [Tue, 21 Jun 2022 18:50:04 +0000 (14:50 -0400)]
Retire snd_gusc ISA sound card driver

snd_gusc supported the Gravis UltraSound MAX and UltraSound PnP sound
cards.

ISA sound card drivers are deprecated as discussed on the current[1] and
stable[2] mailing lists.  Deprecation notices were added in e39ec8933be4
and MFCd to stable branches.

Driver removals are being committed individually so that specific
drivers can be restored if necessary (either in FreeBSD or by downstream
projects).

[1] https://lists.freebsd.org/archives/freebsd-current/2022-March/001680.html
[2] https://lists.freebsd.org/archives/freebsd-stable/2022-March/000585.html

Reviewed by: mav
Relnotes: Yes
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34671

2 years agoRetire snd_ess ISA sound card driver
Ed Maste [Tue, 21 Jun 2022 18:50:04 +0000 (14:50 -0400)]
Retire snd_ess ISA sound card driver

snd_ess supported sound cards using the ESS 18xx chipset.

ISA sound card drivers are deprecated as discussed on the current[1] and
stable[2] mailing lists.  Deprecation notices were added in e39ec8933be4
and MFCd to stable branches.

Driver removals are being committed individually so that specific
drivers can be restored if necessary (either in FreeBSD or by downstream
projects).

[1] https://lists.freebsd.org/archives/freebsd-current/2022-March/001680.html
[2] https://lists.freebsd.org/archives/freebsd-stable/2022-March/000585.html

Reviewed by: mav
Relnotes: Yes
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34671

2 years agoRetire snd_ad1816 ISA sound card driver
Ed Maste [Tue, 21 Jun 2022 18:50:04 +0000 (14:50 -0400)]
Retire snd_ad1816 ISA sound card driver

snd_ad1816 supported ISA sound cards based on the Analog Devices
AD1816A "SoundPort® Controller".

ISA sound card drivers are deprecated as discussed on the current[1] and
stable[2] mailing lists.  Deprecation notices were added in e39ec8933be4
and MFCd to stable branches.

Driver removals are being committed individually so that specific
drivers can be restored if necessary (either in FreeBSD or by downstream
projects).

[1] https://lists.freebsd.org/archives/freebsd-current/2022-March/001680.html
[2] https://lists.freebsd.org/archives/freebsd-stable/2022-March/000585.html

Reviewed by: mav
Relnotes: Yes
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34671

2 years agoadjkerntz(8): detect extra jailed invokation to keep logs clean
Eugene Grosbein [Tue, 21 Jun 2022 18:29:08 +0000 (01:29 +0700)]
adjkerntz(8): detect extra jailed invokation to keep logs clean

It may happen that "adjkerntz -a" called from jailed root crontab.
In that case it spams logs with a line:

sysctl(set: "machdep.wall_cmos_clock"): Operation not permitted

Be silent in that case.

MFC after: 1 month

2 years agoOpenSSL: Regen manual pages for OpenSSL 1.1.1p
Jung-uk Kim [Tue, 21 Jun 2022 18:22:28 +0000 (14:22 -0400)]
OpenSSL: Regen manual pages for OpenSSL 1.1.1p

2 years agoOpenSSL: Regen assembly file for OpenSSSL 1.1.1p
Jung-uk Kim [Tue, 21 Jun 2022 18:20:33 +0000 (14:20 -0400)]
OpenSSL: Regen assembly file for OpenSSSL 1.1.1p

2 years agoRemove install of zfs-load-module.service for dracut
Matthew Thode [Tue, 21 Jun 2022 17:37:20 +0000 (12:37 -0500)]
Remove install of zfs-load-module.service for dracut

The zfs-load-module.service service is not currently provided by
the OpenZFS repository so we cannot safely assume it exists.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Matthew Thode <mthode@mthode.org>
Closes #13574

2 years agoOpenSSL: Merge OpenSSL 1.1.1p
Jung-uk Kim [Tue, 21 Jun 2022 17:33:01 +0000 (13:33 -0400)]
OpenSSL: Merge OpenSSL 1.1.1p

Merge commit '54ae8e38f717f22963c2a87f48af6ecefc6b3e9b'

2 years agoLinuxKPI: add asm/neon.h
Greg V [Tue, 21 Jun 2022 17:09:30 +0000 (19:09 +0200)]
LinuxKPI: add asm/neon.h

This is equivalent to asm/fpu/api.h, but is included by drm on aarch64.

Reviewed by: bz, imp, hselasky
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D35512

2 years agoImport OpenSSL 1.1.1p
Jung-uk Kim [Tue, 21 Jun 2022 14:36:39 +0000 (10:36 -0400)]
Import OpenSSL 1.1.1p

2 years agofb: Add a default getinfo method
Emmanuel Vadot [Tue, 21 Jun 2022 13:52:49 +0000 (15:52 +0200)]
fb: Add a default getinfo method

fb_getinfo is badly designed as it returns either the
info if the driver have the method or ENXIO via the kobj stuff
if the driver doesn't have it.
Add a default method that returns NULL as the code already checks this
and it avoid changing the interface.
None of the drm drivers supported have this method and it sometimes
fails and panic when loading them (for now only usb-c docks seems to be
affected).

MFC after: 3 days
Sponsored by: Beckhoff Automation GmbH & Co. KG

2 years agoTemporarily skip flaky test case: sys.netpfil.common.dummynet.ipfw_queue
Li-Wen Hsu [Tue, 21 Jun 2022 12:00:07 +0000 (20:00 +0800)]
Temporarily skip flaky test case: sys.netpfil.common.dummynet.ipfw_queue

PR: 264805
Sponsored by: The FreeBSD Foundation

2 years agoibcore: Fix a race with disassociate and exit_mmap()
Hans Petter Selasky [Tue, 21 Jun 2022 09:23:55 +0000 (11:23 +0200)]
ibcore: Fix a race with disassociate and exit_mmap()

If uverbs_user_mmap_disassociate() is called while the mmap is
concurrently doing exit_mmap then the ordering of the
rdma_user_mmap_entry_put() is not reliable.

The put must be done before uvers_user_mmap_disassociate() returns,
otherwise there can be a use after free on the ucontext, and a left over
entry in the xarray. If the put is not done here then it is done during
rdma_umap_close() later.

Add the missing put to the error exit path.

Linux commit:
39c011a538272589b9eb02ff1228af528522a22c

PR: 264473
MFC after: 3 days
Sponsored by: NVIDIA Networking

2 years agoibcore: Fix sysfs registration error flow
Hans Petter Selasky [Tue, 21 Jun 2022 09:07:06 +0000 (11:07 +0200)]
ibcore: Fix sysfs registration error flow

The kernel commit cited below restructured ib device management
so that the device kobject is initialized in ib_alloc_device.

As part of the restructuring, the kobject is now initialized in
procedure ib_alloc_device, and is later added to the device hierarchy
in the ib_register_device call stack, in procedure
ib_device_register_sysfs (which calls device_add).

However, in the ib_device_register_sysfs error flow, if an error
occurs following the call to device_add, the cleanup procedure
device_unregister is called. This call results in the device object
being deleted -- which results in various use-after-free crashes.

The correct cleanup call is device_del -- which undoes device_add
without deleting the device object.

The device object will then (correctly) be deleted in the
ib_register_device caller's error cleanup flow, when the caller invokes
ib_dealloc_device.

Linux commit:
b312be3d87e4c80872cbea869e569175c5eb0f9a

PR: 264472
MFC after: 3 days
Sponsored by: NVIDIA Networking

2 years agostress2: Added a timeout
Peter Holm [Tue, 21 Jun 2022 08:20:43 +0000 (10:20 +0200)]
stress2: Added a timeout

2 years agoiommu_gas: Add a missing error-case unlock
Alan Cox [Tue, 21 Jun 2022 04:48:31 +0000 (23:48 -0500)]
iommu_gas: Add a missing error-case unlock

Release the domain lock when iommu_gas_reserve_region_extend()'s call to
iommu_gas_reserve_region_locked() fails.

MFC after: 2 weeks

2 years agobusdma_iommu: Eliminate a redundant trunc_page()
Alan Cox [Mon, 20 Jun 2022 18:40:42 +0000 (13:40 -0500)]
busdma_iommu: Eliminate a redundant trunc_page()

Since OFF_TO_IDX() inherently truncates the given value, there is no
need to perform trunc_page() on it.

MFC after: 2 weeks

2 years agoiommu_gas: Drop needless bound check in lowermatch
Doug Moore [Tue, 21 Jun 2022 00:34:46 +0000 (19:34 -0500)]
iommu_gas: Drop needless bound check in lowermatch

The loop iteration in iommu_gas_lowermatch checks the bound
a->common->lowaddr twice per loop iteration. Rewrite to test only once
per iteration.  Do not worry about passing to iommu_gas_match_one a
range wholly beyond lowaddr. Since that function checks the upper end
of the range against lowaddr, it'll get rejected there.

Reviewed by: alc
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D35522

2 years agonfscl: Clean up the code by removing vfs_flags() macro
Rick Macklem [Mon, 20 Jun 2022 20:23:04 +0000 (13:23 -0700)]
nfscl: Clean up the code by removing vfs_flags() macro

The vfs_flags() macro was used to make the code compatible
with Mac OSX, for the Mac OSX port.
For FreeBSD, this macro just obscured the code, so
remove it to clean up the code.

This commit should not result in a semantics change.

2 years agoiommu_gas: Eliminate a stale comment
Alan Cox [Mon, 20 Jun 2022 17:14:53 +0000 (12:14 -0500)]
iommu_gas: Eliminate a stale comment

As of 19bb5a7244ff, the size passed to iommu_gas_map is no longer
required to be a multiple of the CPU page size.

MFC after: 2 weeks

2 years agokevent.2: Add an xref to listen.2
Mark Johnston [Mon, 20 Jun 2022 16:19:40 +0000 (12:19 -0400)]
kevent.2: Add an xref to listen.2

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

2 years agovm: Fix racy checks for swap objects
Mark Johnston [Mon, 20 Jun 2022 16:18:15 +0000 (12:18 -0400)]
vm: Fix racy checks for swap objects

Commit 4b8365d752ef introduced the ability to dynamically register
VM object types, for use by tmpfs, which creates swap-backed objects.
As a part of this, checks for such objects changed from

  object->type == OBJT_DEFAULT || object->type == OBJT_SWAP

to

  object->type == OBJT_DEFAULT || (object->flags & OBJ_SWAP) != 0

In particular, objects of type OBJT_DEFAULT do not have OBJ_SWAP set;
the swap pager sets this flag when converting from OBJT_DEFAULT to
OBJT_SWAP.

A few of these checks are done without the object lock held.  It turns
out that this can result in false negatives since the swap pager
converts objects like so:

  object->type = OBJT_SWAP;
  object->flags |= OBJ_SWAP;

Fix the problem by adding explicit tests for OBJT_SWAP objects in
unlocked checks.

PR: 258932
Fixes: 4b8365d752ef ("Add OBJT_SWAP_TMPFS pager")
Reported by: bdrewery
Reviewed by: kib
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D35470

2 years agoaio: Improve UMA usage
Mark Johnston [Mon, 20 Jun 2022 16:17:11 +0000 (12:17 -0400)]
aio: Improve UMA usage

- Remove the AIO proc zone.  This zone gets one allocation per AIO
  daemon process, which isn't enough to warrant a dedicated zone.  Plus,
  unlike other AIO structures, aiops are small (32 bytes with LP64), so
  UMA doesn't provide better space efficiency than malloc(9).  Change
  one of the malloc types in vfs_aio.c to make it more general.

- Don't set the NOFREE flag on the other AIO zones.  This flag means
  that memory allocated to the AIO subsystem is never freed back to the
  VM, so it's always preferable to avoid using it when possible.  NOFREE
  was set without explanation when AIO was converted to use UMA 20 years
  ago, but it does not appear to be required; all of the structures
  allocated from UMA (per-process kaioinfo, kaiocb, and aioliojob) keep
  track of references and get freed only when none exist.  Plus, these
  structures will contain dangling pointer after they're freed (e.g.,
  the "cred", "fd_file" and "uiop" fields of struct kaiocb), so
  use-after-frees are dangerous even when the structures themselves are
  type-stable.

Reviewed by: asomers
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D35493

2 years agobpf: Zero pad bytes preceding BPF headers
Mark Johnston [Mon, 20 Jun 2022 16:03:37 +0000 (12:03 -0400)]
bpf: Zero pad bytes preceding BPF headers

BPF headers are word-aligned when copied into the store buffer.  Ensure
that pad bytes following the preceding packet are cleared.

Reported by: KMSAN
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

2 years agobpf: Correct a comment
Mark Johnston [Mon, 20 Jun 2022 16:02:59 +0000 (12:02 -0400)]
bpf: Correct a comment

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

2 years agovm_kern: Update KMSAN shadow maps when allocating kmem memory
Mark Johnston [Mon, 20 Jun 2022 16:01:09 +0000 (12:01 -0400)]
vm_kern: Update KMSAN shadow maps when allocating kmem memory

This addresses a couple of false positive reports for memory returned by
malloc_large().

Sponsored by: The FreeBSD Foundation

2 years agouma: Mark zeroed slabs as initialized for KMSAN
Mark Johnston [Mon, 20 Jun 2022 15:50:54 +0000 (11:50 -0400)]
uma: Mark zeroed slabs as initialized for KMSAN

Otherwise zone initializers can produce false positives, e.g., when
lock_init() attempts to detect double initialization.

Sponsored by: The FreeBSD Foundation

2 years agowpa: Restore missing patch
Cy Schubert [Mon, 20 Jun 2022 14:21:55 +0000 (07:21 -0700)]
wpa: Restore missing patch

In December after a failed MFV due to a now understood issue I had with
git -- git aborts with extremely large MFV -- this patch was removed
during the revert. Restore this patch.

PR: 264238
Fixes: 4b72b91a7132df1f77bbae194e1071ac621f1edb
MFC after: 1 week

2 years agostress2: Added a timeout to the test
Peter Holm [Mon, 20 Jun 2022 12:36:57 +0000 (14:36 +0200)]
stress2: Added a timeout to the test

2 years agostress2: Fix process handling error
Peter Holm [Mon, 20 Jun 2022 12:35:59 +0000 (14:35 +0200)]
stress2: Fix process handling error

2 years agopf tests: basic 'tagged' test for Ethernet rules
Kristof Provost [Tue, 31 May 2022 12:55:15 +0000 (14:55 +0200)]
pf tests: basic 'tagged' test for Ethernet rules

Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D35364

2 years agopf tests: basic 'tagged' test for Ethernet rules
Kristof Provost [Tue, 31 May 2022 12:40:05 +0000 (14:40 +0200)]
pf tests: basic 'tagged' test for Ethernet rules

Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D35363

2 years agopf: support matching on tags for Ethernet rules
Kristof Provost [Tue, 31 May 2022 12:00:52 +0000 (14:00 +0200)]
pf: support matching on tags for Ethernet rules

Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D35362

2 years agoloader: GELI encrypted disk should still use device name disk
Toomas Soome [Mon, 20 Jun 2022 06:51:44 +0000 (09:51 +0300)]
loader: GELI encrypted disk should still use device name disk

geli_probe_and_attach() does pick geli_devsw structure for
encrypted disks, the implementation depends on device
name "disk" when device type is DEVT_DISK, but geli_devsw is
setting name field "gelidisk".

PR: 264282
Submitted by: yamagi@yamagi.org
Reported by: yamagi@yamagi.org
MFC after: 2 weeks

2 years agogetnetent(3): Add documentation for missing reentrant functions
Fernando Apesteguía [Wed, 26 May 2021 12:34:49 +0000 (14:34 +0200)]
getnetent(3): Add documentation for missing reentrant functions

Add gethostbyname_r, gethostbyname2_r and gethostbyaddr_r signatures and
descriptions.

PR: 249154
Reported by: asomers@
Approved by: manpages (imp@), Pau Amma
Differential Revision: https://reviews.freebsd.org/D30385

2 years agogetnetent(3): Add missing reentrant functions
Fernando Apesteguía [Fri, 21 May 2021 15:25:25 +0000 (17:25 +0200)]
getnetent(3): Add missing reentrant functions

Add documentation for gethostbyname_r, gethostbyname2_r and gethostbyaddr_r

Create proper MLINKs for the new functions.

PR: 249154
Reported by: asomers@
Approved by: manpages (0mp@), Pau Amma
Differential Revision:  https://reviews.freebsd.org/D30469

2 years agouserboot is missing vdisk_dev
Toomas Soome [Thu, 9 Jun 2022 06:56:19 +0000 (09:56 +0300)]
userboot is missing vdisk_dev

Add vdisk device support in userboot configuration.

MFC after: 1 week

2 years agotree.3: document RB_AUGMENT
Doug Moore [Sun, 19 Jun 2022 16:55:44 +0000 (11:55 -0500)]
tree.3: document RB_AUGMENT

Document the RB_AUGMENT macro, and provide an example of its use.
Reviewed by: alc, kib
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D35518

2 years agotest_diskread(): detect end of the disk
Toomas Soome [Wed, 1 Jun 2022 07:28:43 +0000 (10:28 +0300)]
test_diskread(): detect end of the disk

Detect the end of the disk condition. This may happpen when
disk image is truncated and the reads are addressing blocks past
image end.

MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D35432

2 years agoloader.efi: fix panic() after BS off
Toomas Soome [Wed, 8 Sep 2021 00:14:51 +0000 (03:14 +0300)]
loader.efi: fix panic() after BS off

panic() is using multiple services - attempting to read
keyboard, accessing time functions and finally, exiting the loader.

Protect all the accessed listed above. Note, when BS are off,
we really can not just exit the loader, we only can reboot.

MFC after: 1 week

2 years agonfscl: Clean up the code by removing #if(n)def APPLE
Rick Macklem [Sat, 18 Jun 2022 20:43:02 +0000 (13:43 -0700)]
nfscl: Clean up the code by removing #if(n)def APPLE

The definition of "APPLE" was used by the Mac OSX port.
For FreeBSD, this definition is never used, so remove
the references to it to clean up the code.

This commit should not result in a semantics change.

2 years agostruct kinfo_file changes needed for lsof to work using only usermode APIs`
Damjan Jovanovic [Fri, 17 Jun 2022 13:37:40 +0000 (16:37 +0300)]
struct kinfo_file changes needed for lsof to work using only usermode APIs`

Add kf_pipe_buffer_[in/out/size] fields to kf_pipe, and populate them.

Add a kf_kqueue struct to the kf_un union, to allow querying kqueue state,
and populate it.

Populate the kf_sock_rcv_sb_state and kf_sock_snd_sb_state fields in
kf_sock for INET/INET6 sockets, and populate all other fields for all
transport layer protocols, not just TCP.

Bump __FreeBSD_version.

Differential revision: https://reviews.freebsd.org/D34184
Reviewed by: jhb, kib, se
MFC after: 1 week