]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
18 months agobhyve: Remove some no-op code for setting RIP.
John Baldwin [Wed, 21 Dec 2022 18:32:24 +0000 (10:32 -0800)]
bhyve: Remove some no-op code for setting RIP.

fbsdrun_addcpu() read the current vCPU's RIP register from the kernel
via vm_get_register() to pass along through some layers to vm_loop()
which then set the register via vm_set_register().  However, this is
just always setting the value back to itself.

Reviewed by: corvink
Differential Revision: https://reviews.freebsd.org/D37643

18 months agobhyve: Simplify setting vCPU capabilities.
John Baldwin [Wed, 21 Dec 2022 18:31:16 +0000 (10:31 -0800)]
bhyve: Simplify setting vCPU capabilities.

- Enable VM_CAP_IPI_EXIT in fbsdrun_set_capabilities along with other
  capabilities enabled on all vCPUs.

- Don't call fbsdrun_set_capabilities a second time on the BSP in
  spinup_vcpu.

- To preserve previous behavior, don't unconditionally enable
  unrestricted guest mode on the BSP (this unbreaks single-vCPU guests
  on Nehalem systems, though supporting such setups is of dubious
  value).  Other places that enbale UG on the BSP are careful to check
  the result of the operation and fail if it is not available.

- Don't set any capabilities in spinup_ap().  These are now all
  redundant with earlier settings from spinup_vcpu().

- While here, axe a stale comment from fbsdrun_addcpu().  This
  function is now always called from the main thread for all vCPUs.

Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D37642

18 months agobhyve: Remove unused return value from spinup_ap.
John Baldwin [Wed, 21 Dec 2022 18:31:02 +0000 (10:31 -0800)]
bhyve: Remove unused return value from spinup_ap.

Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D37641

18 months agobhyve: Remove handler for VM_EXITCODE_SPINUP_AP.
John Baldwin [Wed, 21 Dec 2022 18:30:45 +0000 (10:30 -0800)]
bhyve: Remove handler for VM_EXITCODE_SPINUP_AP.

Since commit 0bda8d3e9f7a, bhyve always enables VM_EXITCODE_IPI exits
instead, so this handler is no longer used.

Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D37640

18 months agobsd-family-tree: macOS 13 added
Sergey A. Osokin [Wed, 21 Dec 2022 17:02:49 +0000 (12:02 -0500)]
bsd-family-tree: macOS 13 added

MFC after: 3 days

18 months agosmmu: fix FDT and !FDT builds.
Ruslan Bukin [Wed, 21 Dec 2022 15:45:13 +0000 (15:45 +0000)]
smmu: fix FDT and !FDT builds.

Reviewed by: andrew
Sponsored by: UKRI
Differential Revision: https://reviews.freebsd.org/D37762

18 months agosmmu: set guest address space range to 48-bit, which is a hardware
Ruslan Bukin [Tue, 20 Dec 2022 11:25:18 +0000 (11:25 +0000)]
smmu: set guest address space range to 48-bit, which is a hardware
limit in our configuration.

Reviewed by: andrew
Sponsored by: UKRI
Differential Revision: https://reviews.freebsd.org/D37756

18 months agoAttach Motorcomm YT8511 GbE PHY driver to the build.
Søren Schmidt [Wed, 21 Dec 2022 14:37:19 +0000 (14:37 +0000)]
Attach Motorcomm YT8511 GbE PHY driver to the build.

18 months agoConvert iflib(4) and iflib-based drivers to the DrvAPI
Justin Hibbits [Wed, 20 Oct 2021 20:49:00 +0000 (15:49 -0500)]
Convert iflib(4) and iflib-based drivers to the DrvAPI

Summary:
Convert iflib(4) and the following drivers:
* axgbe
* em
* ice
* ixl
* vmxnet

Sponsored by: Juniper Networks, Inc.
Reviewed by: kbowling, #iflib
Differential Revision: https://reviews.freebsd.org/D37768

18 months agoUse hwreset_array in the Rockchip tsadc driver
Andrew Turner [Fri, 11 Nov 2022 08:58:34 +0000 (08:58 +0000)]
Use hwreset_array in the Rockchip tsadc driver

The order of asserting/deasserting the resets doesn't matter so use
the new hwreset_array to manage them all.

Reviewed by: manu
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37358

18 months agoAdd support for an array of hwresets
Andrew Turner [Fri, 11 Nov 2022 08:55:59 +0000 (08:55 +0000)]
Add support for an array of hwresets

In some drivers we need to assert and deassert a group of hardware
resets in any order. To support this add a new hwreset_array that
manages all hwresets defined for a device.

Reviewed by: bz, manu, mmel
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37357

18 months agoFormat cleanups.
Kirk McKusick [Wed, 21 Dec 2022 02:30:36 +0000 (18:30 -0800)]
Format cleanups.

No functional change intended.

Differential Revision: https://reviews.freebsd.org/D33424

18 months agojail: Fix output of IPv[46] addresses of DDB `show prison`
Zhenlei Huang [Wed, 21 Dec 2022 01:53:28 +0000 (09:53 +0800)]
jail: Fix output of IPv[46] addresses of DDB `show prison`

Reviewed by: melifaro, jamie
Approved by: kp (mentor)
Fixes: eb8dcdeac22d jail: network epoch protection for IP address lists
Differential Revision: https://reviews.freebsd.org/D37732

18 months agonetlink: Use NET_EPOCH_[CALL|WAIT] macros
Zhenlei Huang [Wed, 21 Dec 2022 01:40:05 +0000 (09:40 +0800)]
netlink: Use NET_EPOCH_[CALL|WAIT] macros

Reviewed by: melifaro, kp
Approved by: kp (mentor)
Differential Revision: https://reviews.freebsd.org/D37730

18 months agorouting: Use NET_EPOCH_[CALL|WAIT] macros
Zhenlei Huang [Wed, 21 Dec 2022 01:33:31 +0000 (09:33 +0800)]
routing: Use NET_EPOCH_[CALL|WAIT] macros

Reviewed by: melifaro, kp
Approved by: kp (mentor)
Differential Revision: https://reviews.freebsd.org/D37729

18 months agogeom_part: Fix potential integer overflow when checking size of the table
Zhenlei Huang [Wed, 21 Dec 2022 01:04:30 +0000 (09:04 +0800)]
geom_part: Fix potential integer overflow when checking size of the table

`hdr_entries` and `hdr_entsz` are both uint32_t as defined in UEFI spec.
Current spec does not have upper limit of the number of partition
entries and the size of partition entry, it is potential that malicious
or corrupted GPT header read from untrusted source contains large size of
entry number or size.

PR: 266548
Reviewed by: oshogbo, cem, imp, markj
Approved by: kp (mentor)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D36709

18 months ago.github: Switch to v3 of actions/checkout.
John Baldwin [Wed, 21 Dec 2022 00:27:17 +0000 (16:27 -0800)]
.github: Switch to v3 of actions/checkout.

GitHub is emitting a warning that v2 is deprecated due to using
Node.js 12.

Reported by: GitHub
Reviewed by: arichardson, emaste
Differential Revision: https://reviews.freebsd.org/D37769

18 months agoinet6: Fix LINT build
Justin Hibbits [Tue, 20 Dec 2022 20:08:34 +0000 (15:08 -0500)]
inet6: Fix LINT build

mli_delete_locked() is the only function that takes a const ifnet.
Since it's a static function there's no advantage to keeping it const.
Since `if_t` is not a const struct (currently) the compiler throws an
error passing the ifp around to ifnet functions.

Fixes: eb1da3e5258238e1c0555c6a006a341df0821d8e
Sponsored by: Juniper Networks, Inc.

18 months agoktls_tests: Ignore errors from close for receive error tests.
John Baldwin [Tue, 20 Dec 2022 19:38:28 +0000 (11:38 -0800)]
ktls_tests: Ignore errors from close for receive error tests.

For tests that send invalid data to a TLS socket to trigger read
errors the kernel may end up dropping the connection before close is
called at the conclusion of the test resulting in spurious ECONNRESET
errors from close.  Ignore any errors from close for these tests.

PR: 268390
Reported by: olivier, Michal Gulbicki <michalx.gulbicki@intel.com>
Reviewed by: markj
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D37717

18 months agoktls_tests: Ignore spurious errors from shutdown(2).
John Baldwin [Tue, 20 Dec 2022 19:38:07 +0000 (11:38 -0800)]
ktls_tests: Ignore spurious errors from shutdown(2).

For some of the "bad size" tests, the remote end can notice the error
and drop the connection before the test program returns from write to
call shutdown.  In that case, shutdown fails with ENOTCONN.  Permit
these ENOTCONN errors without failing the test.

Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D37693

18 months agoUpdate DrvAPI convert script for new KPIs
Justin Hibbits [Wed, 17 Aug 2022 20:13:58 +0000 (16:13 -0400)]
Update DrvAPI convert script for new KPIs

Bring the DrvAPI convert script forward from the initial commit to
account for the last 8 years of changes to the KPIs.

Sponsored by: Juniper Networks, Inc.

18 months agoDrvAPI: Extend driver KPI with more accessors
Justin Hibbits [Fri, 9 Dec 2022 20:54:51 +0000 (15:54 -0500)]
DrvAPI: Extend driver KPI with more accessors

Summary:
Add the following accessors to hide some more netstack details:
* if_get/setcapabilities2 and *bits analogue
* if_setdname
* if_getxname
* if_transmit - wrapper for call to ifp->if_transmit()
- This required changing the existing if_transmit to
if_transmit_default, since that's its purpose.
* if_getalloctype
* if_getindex
* if_foreach_addr_type - Like if_foreach_lladdr() but for any address
  family type.  Used by some drivers to iterate over all AF_INET
  addresses.
* if_init() - wrapper for ifp->if_init() call
* if_setinputfn
* if_setsndtagallocfn
* if_togglehwassist

Reviewers: #transport, #network, glebius, melifaro

Reviewed by: #network, melifaro
Sponsored by: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D37664

18 months agoipfw: Constify name argument for hash lookup
Justin Hibbits [Fri, 16 Dec 2022 18:16:52 +0000 (13:16 -0500)]
ipfw: Constify name argument for hash lookup

The name doesn't get modified, and it gets passed through to a hash
function that accepts only a const pointer.  Const it for correctness.

Sponsored by: Juniper Networks, Inc.

18 months agouart(4): Add support for AMT virtual serial port (C610/X99 series)
Stuart McLaren [Tue, 20 Dec 2022 14:58:32 +0000 (22:58 +0800)]
uart(4): Add support for AMT virtual serial port (C610/X99 series)

PR: 267053
MFC after: 3 days

18 months agostress2: Added link to problem found
Peter Holm [Tue, 20 Dec 2022 09:12:41 +0000 (10:12 +0100)]
stress2: Added link to problem found

18 months agostress2: Fix long run time
Peter Holm [Tue, 20 Dec 2022 09:12:01 +0000 (10:12 +0100)]
stress2: Fix long run time

18 months agoGet clocks for Rockchip RK3568.
Søren Schmidt [Tue, 20 Dec 2022 08:53:58 +0000 (08:53 +0000)]
Get clocks for Rockchip RK3568.

18 months agoufs/ffs: detect endian mismatch between machine and filesystem
Alfredo Dal'Ava Junior [Sat, 17 Dec 2022 02:54:39 +0000 (23:54 -0300)]
ufs/ffs: detect endian mismatch between machine and filesystem

Mount on a LE machine a filesystem formatted for BE is not supported
currently. This adds a check for the superblock magic number using
swapped bytes to guess and warn the user that it may be a valid
superblock but endian is incompatible.

MFC after: 2 weeks
Reviewed by: mckusick
Obtained from: mckusick, alfredo
Differential Revision: https://reviews.freebsd.org/D37675

18 months agoAdd Rockchip RK3568 SoC
Søren Schmidt [Tue, 20 Dec 2022 03:01:41 +0000 (03:01 +0000)]
Add Rockchip RK3568 SoC

Attach its clock drivers and rk817 pmic driver to the build.

18 months agonvme: Clear the notify flag if the consumer rejects the controller.
Dag-Erling Smørgrav [Tue, 20 Dec 2022 01:50:30 +0000 (02:50 +0100)]
nvme: Clear the notify flag if the consumer rejects the controller.

While here, fix some type mismatch warnings.

Reviewed by: imp
Sponsored by: Netapp, Inc.
Sponsored by: Klara, Inc.
MFC after: 1 week

18 months agoAdd support for ARM System Control and Management Interface (SCMI) v3.1.
Ruslan Bukin [Mon, 19 Dec 2022 20:16:18 +0000 (20:16 +0000)]
Add support for ARM System Control and Management Interface (SCMI) v3.1.

The SCMI specification describes a set of standard interfaces for power,
performance and system management.

SCMI is extensible and provides interfaces to access functions which are
often implemented in firmwares in the System Control Processor (SCP).

This implements Shared Memory-based transfer, which is one of the ways on
how messages are exchanged between agents and the platform.

This includes a driver for ARM Message Handling Unit (MHU) Doorbell, which
is a mechanism that the caller can use to alert the callee of the presence
of a message.

The support implements clock management interface. For instance this allows
us to control HDMI pixel clock on ARM Morello Board.

Tested on ARM Morello Board.

Obtained from: CheriBSD
Differential Revision: https://reviews.freebsd.org/D37316
Reviewed by: manu
Sponsored by: UKRI

18 months agomount_nullfs.8: Bump .Dd for file mounts update.
Ceri Davies [Mon, 19 Dec 2022 18:58:39 +0000 (18:58 +0000)]
mount_nullfs.8: Bump .Dd for file mounts update.

18 months agoreadelf: match GNU readelf formatting
Ed Maste [Tue, 13 Dec 2022 20:07:46 +0000 (15:07 -0500)]
readelf: match GNU readelf formatting

GNU readelf emits a blank line before, and uses single quotes around the
symbol table name, in each "Symbol table 'name' contains ## entries"
header.

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

18 months agoDon't allow stacking of file mounts
Doug Rabson [Tue, 6 Dec 2022 13:24:55 +0000 (13:24 +0000)]
Don't allow stacking of file mounts

Reviewed by:    mjg, kib
Tested by:      pho

18 months agoAllow realpath to work for file mounts
Doug Rabson [Sun, 4 Dec 2022 15:53:07 +0000 (15:53 +0000)]
Allow realpath to work for file mounts

For file mounts, the directory vnode is not available from namei and this
prevents the use of vn_fullpath_hardlink. In this case, we can use the
vnode which was covered by the file mount with vn_fullpath.

This also disallows file mounts over files with link counts greater than
one to ensure a deterministic path to the mount point.

Reviewed by:    mjg, kib
Tested by:      pho

18 months agoAdd support for mounting single files in nullfs
Doug Rabson [Wed, 23 Nov 2022 14:51:13 +0000 (14:51 +0000)]
Add support for mounting single files in nullfs

The main use-case for this is to support mounting config files and
secrets into OCI containers. My current workaround copies the files into
the container which is messy and risks secrets leaking into container
images if the cleanup fails.

This adds a VFCF flag to indicate whether the filesystem supports file
mounts and allows fspath to be either a directory or a file if the flag
is set.

Test Plan:
$ sudo mkdir -p /mnt
$ sudo touch /mnt/foo
$ sudo mount -t nullfs /COPYRIGHT /mnt/foo

Reviewed by:    mjg, kib
Tested by:      pho

18 months agoAdd vn_path_to_global_path_hardlink
Doug Rabson [Fri, 2 Dec 2022 14:09:31 +0000 (14:09 +0000)]
Add vn_path_to_global_path_hardlink

This is similar to vn_path_to_global_path but allows for regular files
which may not be present in the cache.

Reviewed by:    mjg, kib
Tested by:      pho

18 months agoAdd support for mounting single files in nullfs
Doug Rabson [Mon, 7 Nov 2022 16:56:09 +0000 (16:56 +0000)]
Add support for mounting single files in nullfs

My main use-case for this is to support mounting config files and secrets
into OCI containers. My current workaround copies the files into the
container which is messy and risks secrets leaking into container images
if the cleanup fails.

Reviewed by: mjg, kib
Tested by: pho
Differential Revision: https://reviews.freebsd.org/D37478

18 months agoRevert "Enable setting the phy id."
Ganbold Tsagaankhuu [Mon, 19 Dec 2022 15:13:46 +0000 (15:13 +0000)]
Revert "Enable setting the phy id."

This reverts commit 6692670f58f9069e59bc0c958fdaefb9bea5f726.

18 months agoautofs: whack an always-false branch
Mateusz Guzik [Mon, 19 Dec 2022 14:56:42 +0000 (14:56 +0000)]
autofs: whack an always-false branch

18 months agoEnable setting the phy id.
Søren Schmidt [Mon, 19 Dec 2022 12:56:51 +0000 (12:56 +0000)]
Enable setting the phy id.

It is needed for the RK356X combo phy.

18 months agovfs: retire the now unused SAVESTART flag
Mateusz Guzik [Wed, 14 Dec 2022 09:40:20 +0000 (09:40 +0000)]
vfs: retire the now unused SAVESTART flag

Bump __FreeBSD_version to 1400075

Tested by:      pho

18 months agovfs: stop using SAVESTART for rename
Mateusz Guzik [Wed, 14 Dec 2022 09:34:53 +0000 (09:34 +0000)]
vfs: stop using SAVESTART for rename

ni_startdir has never reached rename routines anyway

Reviewed by: mckusick
Tested by: pho
Differential Revision: https://reviews.freebsd.org/D34468

18 months agovfs: make relookup take an additional argument
Mateusz Guzik [Thu, 10 Nov 2022 01:45:13 +0000 (01:45 +0000)]
vfs: make relookup take an additional argument

instead of looking at SAVESTART

This is a step towards removing the flag.

Reviewed by: mckusick
Tested by: pho
Differential Revision: https://reviews.freebsd.org/D34468

18 months agonfs: stop using SAVESTART
Mateusz Guzik [Thu, 10 Nov 2022 02:15:04 +0000 (02:15 +0000)]
nfs: stop using SAVESTART

Only the name is wanted which is already always provided.

Reviewed by: rmacklem
Tested by: pho, rmacklem
Differential Revision: https://reviews.freebsd.org/D34470

18 months agovfs: retire NDFREE
Mateusz Guzik [Thu, 17 Nov 2022 16:59:20 +0000 (16:59 +0000)]
vfs: retire NDFREE

There are no consumers anymore. Interested parties can NDFREE_PNBUF
and vput or vrele relevant vnodes.

Tested by: pho

18 months agovfs: stop using NDFREE
Mateusz Guzik [Thu, 17 Nov 2022 16:58:28 +0000 (16:58 +0000)]
vfs: stop using NDFREE

It provides nothing but a branchfest and next to no consumers want it
anyway.

Tested by: pho

18 months agoxlocale(3): Link man pages
Jose Luis Duran [Mon, 19 Dec 2022 04:54:52 +0000 (05:54 +0100)]
xlocale(3): Link man pages

- provide various missing MLINKS for library functions
- update various SEE ALSO section to include the
  new linked manual pages
- add various definitions of new functions like isideogram_l(3)
- document COMPATIBILITY for some functions
- bump man page dates

Reviewed by: gbe, bcr
MFC after: 1 week
Pull Request: https://github.com/freebsd/freebsd-src/pull/621
Differential Revision: https://reviews.freebsd.org/D37203

18 months agokrpc: Allow mountd/nfsd to optionally run in a jail
Rick Macklem [Sun, 18 Dec 2022 20:40:48 +0000 (12:40 -0800)]
krpc: Allow mountd/nfsd to optionally run in a jail

This patch modifies the kernel RPC so that it will allow
mountd/nfsd to run inside of a vnet jail.  Running mountd/nfsd
inside a vnet jail will be enabled via a new kernel build
option called VNET_NFSD, which will be implemented in future
commits.

Although I suspect cr_prison can be set from the credentials
of the current thread unconditionally, I #ifdef'd the code
VNET_NFSD and only did this for the jailed case mainly to
document that it is only needed for use in a jail.

The TLS support code has not yet been modified to work in
a jail.  That is planned as future development after the
basic VNET_NFSD support is in the kernel.

This patch should not result in any semantics change until
VNET_NFSD is implemented and used in a kernel configuration.

MFC after: 4 months

18 months agoAdd initial clocks support for Rockchip RK3568 SoC.
Søren Schmidt [Sun, 18 Dec 2022 12:05:29 +0000 (12:05 +0000)]
Add initial clocks support for Rockchip RK3568 SoC.

Partially from: https://reviews.freebsd.org/D36027

This can be eventually improved or simplified or fixed if necessary.

Following devices work with proper drivers and with the necessary clocks:
Native networking via eqos driver
USB3 and USB2
PCIe support is working but a bit picky about what hardware it supports (but so is Linux)
SD & (e)MMC
With the EDK2 loader video also works

Supported hardwares are Quartz64, NanoPI R5S and Firefly Station P2, more to come as DTS files gets done.

18 months agoFix/add compat strings for Rockchip RK356x GRF.
Søren Schmidt [Sun, 18 Dec 2022 11:22:11 +0000 (11:22 +0000)]
Fix/add compat strings for Rockchip RK356x GRF.

18 months agogrep.1: Add an ENVIRONMENT section
Jose Luis Duran [Sun, 18 Dec 2022 07:22:24 +0000 (08:22 +0100)]
grep.1: Add an ENVIRONMENT section

Document the environment variables used by grep(1).

Reviewed by: pauamma, kevans
MFC after: 5 days
Differential Revision: https://reviews.freebsd.org/D37726

18 months agojail.8: Update the man page for allow.nfsd
Rick Macklem [Sat, 17 Dec 2022 21:54:33 +0000 (13:54 -0800)]
jail.8: Update the man page for allow.nfsd

Commit bba7a2e89602 added "allow.nfsd" to optionally allow
mountd/nfsd to be run inside a vnet prison when the kernel
is built with "options VNET_NFSD".

This patch updates the man page for this change.

This is a content change.

Reviewed by: jamie, bcr (manpages)
MFC after: 4 months
Differential Revision: https://reviews.freebsd.org/D37665

18 months agokern_jail.c: Allow mountd/nfsd to optionally run in a jail
Rick Macklem [Sat, 17 Dec 2022 21:43:49 +0000 (13:43 -0800)]
kern_jail.c: Allow mountd/nfsd to optionally run in a jail

This patch adds "allow.nfsd" to the jail code based on a
new kernel build option VNET_NFSD.  This will not work
until future patches fix nmount(2) to allow mountd to
run in a vnet prison and the NFS server code is patched
so that global variables are in a vnet.

The jail(8) man page will be patched in a future commit.

Reviewed by: jamie
MFC after: 4 months
Differential Revision: https://reviews.freebsd.org/D37637

18 months agoext2fs: fix potential memory leak in ext4_ext_grow_indepth()
Pedro F. Giffuni [Sat, 17 Dec 2022 18:19:51 +0000 (13:19 -0500)]
ext2fs: fix potential memory leak in ext4_ext_grow_indepth()

PR: 265071

18 months agotmpfs_getattr(): Only take vm_object lock on 32bit machines
Konstantin Belousov [Sat, 17 Dec 2022 11:03:32 +0000 (13:03 +0200)]
tmpfs_getattr(): Only take vm_object lock on 32bit machines

Torn reads are only possible for 32bit arches.

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

18 months agovm_page_grab_valid(): clear *mp in case of pager denying page allocation
Konstantin Belousov [Sat, 17 Dec 2022 00:12:14 +0000 (02:12 +0200)]
vm_page_grab_valid(): clear *mp in case of pager denying page allocation

Same as it is done in other error return cases.  Callers depend on error
case returning NULL, e.g. vm_imgact_hold_page().

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

18 months agobin/uuidgen: add support for v4 uuids
Tobias C. Berner [Wed, 14 Dec 2022 05:59:36 +0000 (06:59 +0100)]
bin/uuidgen: add support for v4 uuids

The version 4 UUID is meant for generating UUIDs from truly-random or
pseudo-random numbers. [1]

bin/uuidgen gained the new flag '-r' to create version 4 UUID.

[1] RFC 4122, https://www.rfc-editor.org/rfc/rfc4122#section-4.4

Reviewed by: pstef
Approved by: bapt
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D37695

18 months agovfs_mount.c: fix vfs_domount() for PRIV_VFS_MOUNT_EXPORTED
Rick Macklem [Fri, 16 Dec 2022 21:01:23 +0000 (13:01 -0800)]
vfs_mount.c: fix vfs_domount() for PRIV_VFS_MOUNT_EXPORTED

It appears that, prior to r158857 vfs_domount() checked
suser() when MNT_EXPORTED was specified.

r158857 appears to have broken this, since MNT_EXPORTED
was no longer set when mountd.c was converted to use nmount(2).
r164033 replaced the suser() check with
priv_check(td, PRIV_VFS_MOUNT_EXPORTED), which does the
same thing (ie. checks for effective uid == 0 assuming suses_enabled
is set).

This patch restores this check by setting MNT_EXPORTED when the
"export" mount option is specified to nmount().

I think this is reasonable since only mountd(8) should be setting
exports and I doubt any non-root mounted file system would
be setting its own exports.

Reviewed by: kib, markj
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D37718

18 months agowg: Re-add basic if_wg(4) tests.
John Baldwin [Fri, 16 Dec 2022 20:01:26 +0000 (12:01 -0800)]
wg: Re-add basic if_wg(4) tests.

These were originally added in commit
74ae3f3e33b810248da19004c58b3581cd367843 but have been updated to use
wg(8).

Reviewed by: kevans, markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37400

18 months agodebugnet: remove spurious message on boot
Franco Fichtner [Fri, 16 Dec 2022 15:27:18 +0000 (10:27 -0500)]
debugnet: remove spurious message on boot

In non-INVARIANTS kernels, hide the warning message printed by debugnet
when an interface MTU is configured or link state changes, and debugnet
cannot infer the number of mbuf clusters to reserve.  The warning isn't
really actionable and mostly serves to confuse users.

Reviewed by: vangyzen, markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D34393

18 months agomakefs: Add some validation of ZFS pool names
Mark Johnston [Fri, 16 Dec 2022 15:25:35 +0000 (10:25 -0500)]
makefs: Add some validation of ZFS pool names

Reported by: imp

18 months agodaily 440.status-mailq: avoid error from dma with submit queue
Mike Karels [Fri, 16 Dec 2022 15:13:31 +0000 (09:13 -0600)]
daily 440.status-mailq: avoid error from dma with submit queue

dma(8) supports mailq, but not mailq -Ac to print the submission
queue.  Don't try to print that queue from the daily script if
mailq -Ac returns an error.

Reviewed by: bapt
Differential Revision: https://reviews.freebsd.org/D37713

18 months agodaily 150.clean-hoststat: suppress error when using dma
Mike Karels [Fri, 16 Dec 2022 15:13:07 +0000 (09:13 -0600)]
daily 150.clean-hoststat: suppress error when using dma

dma(8) does not have hoststat or purgestat, so this script produces
an error from the daily script.  We could disable this script, but
that would mean yet another change to switch back to sendmail.  Check
for purgestat in mailer.conf before attempting either hoststat or
purgestat.

Reviewed by: pstef, bapt
Differential Revision: https://reviews.freebsd.org/D37712

18 months agodma mailer.conf: add comments, including pointer for sendmail
Mike Karels [Fri, 16 Dec 2022 15:12:39 +0000 (09:12 -0600)]
dma mailer.conf: add comments, including pointer for sendmail

Add comments analogous to those that are in the sendmail mailer.conf,
including a pointer to /usr/share/examples/sendmail/mailer.conf.

Reviewed by: bapt
Differential Revision: https://reviews.freebsd.org/D37711

18 months agoApply llvm fix for crash building julia on PowerPC64
Dimitry Andric [Fri, 16 Dec 2022 13:28:10 +0000 (14:28 +0100)]
Apply llvm fix for crash building julia on PowerPC64

Merge commit 6710b21d4698 from llvm git (by Kai Luo):

  [PowerPC] Allow llvm.ppc.cfence to accept pointer types

  In the context of atomic load, integer, pointer and float point types are allowed, thus we should allow llvm.ppc.cfence to accept any type mentioned.

  Fixes https://github.com/llvm/llvm-project/issues/55983.

  Reviewed By: shchenz, vchuravy

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

Requested by: jhibbits
MFC after: 3 days

18 months agonetlink: connect netlink tests to the build
Alexander V. Chernikov [Fri, 16 Dec 2022 12:02:17 +0000 (12:02 +0000)]
netlink: connect netlink tests to the build

Reviewed By: ngie
Differential Revision: https://reviews.freebsd.org/D37708

18 months agoktls: Close a race with setting so_error when dropping a connection.
John Baldwin [Thu, 15 Dec 2022 20:06:26 +0000 (12:06 -0800)]
ktls: Close a race with setting so_error when dropping a connection.

pr_abort calls tcp_usr_abort which calls tcp_drop with ECONNABORTED.
After pr_abort returns, the so_error is then set to a more specific
error.  However, a reader can observe and return the ECONNABORTED
error before so_error is set to the desired error value.  This is
resulting in spurious test failures of recently added tests for
invalid conditions such as invalid headers.

To fix, refactor the code to abort a connection to call tcp_drop
directly with the desired error value.  ktls_reset_send_tag already
calls tcp_drop directly when it aborts a connection due to an error.

Reviewed by: gallatin
Reported by: CI (jenkins), gallatin, olivier
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D37692

18 months agoktls_tests: Log more details when a test fails.
John Baldwin [Thu, 15 Dec 2022 20:06:09 +0000 (12:06 -0800)]
ktls_tests: Log more details when a test fails.

- Make use of ATF_REQUIRE_INTEQ to log the values of integers for
  unexpected mismatches.

- Use ATF_REQUIRE_MSG in a few more places to log values when a
  requirement fails.

- Consistently use ATF_REQUIRE_ERRNO when checking for an expected
  errno value.

Reviewed by: markj
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D37691

18 months agokdebug_secasv: Update for recent locking changes.
John Baldwin [Thu, 15 Dec 2022 19:27:39 +0000 (11:27 -0800)]
kdebug_secasv: Update for recent locking changes.

Reviewed by: kp
Fixes: 0361f165f219 ipsec: replace SECASVAR  mtx by rmlock
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D37690

18 months agoptrace.2: Fix warnings from igor.
John Baldwin [Thu, 15 Dec 2022 19:25:27 +0000 (11:25 -0800)]
ptrace.2: Fix warnings from igor.

Reviewed by: pauamma, imp
Differential Revision: https://reviews.freebsd.org/D37689

18 months agoatrtc: Correct name of tunable in man page
Michael Gmelin [Mon, 17 Oct 2022 10:09:42 +0000 (12:09 +0200)]
atrtc: Correct name of tunable in man page

Not reviewed, but I took the liberty to commit it
since it's so obvious.

Differential Revision: https://reviews.freebsd.org/D37018

18 months agoroute: allow RTM_CHANGE notifications in rt_routemsg().
Alexander V. Chernikov [Thu, 15 Dec 2022 10:39:06 +0000 (10:39 +0000)]
route: allow RTM_CHANGE notifications in rt_routemsg().

MFC after: 2 weeks

18 months agojail: fix a NULL pointer derefence in parsing ip6.addr settings.
Jamie Gritton [Thu, 15 Dec 2022 00:47:55 +0000 (16:47 -0800)]
jail: fix a NULL pointer derefence in parsing ip6.addr settings.

This is the counterpart to bd24e861b4ef, which did the same for ip4.
PR: 268377
Reported by: ahkithaama at proton.me

18 months agoUnbreak the build when MAC is not defined
Andrew Gallatin [Wed, 14 Dec 2022 22:33:30 +0000 (17:33 -0500)]
Unbreak the build when MAC is not defined

7a2c93b86ef7 removed the use of "error" when MAC was not
defined, resulting in an unused variable error.

Sponsored by: Netflix
Reviewed by: jhb

18 months agoOpps take out a stray left behind printf that was
Randall Stewart [Wed, 14 Dec 2022 21:11:39 +0000 (16:11 -0500)]
Opps take out a stray left behind printf that was
for debugging.. Sorry.

18 months agoRack cannot be loaded without cc_newreno compiled into the kernel.
Randall Stewart [Wed, 14 Dec 2022 20:37:48 +0000 (15:37 -0500)]
Rack cannot be loaded without cc_newreno compiled into the kernel.

Right now rack will fail to load due to its hack in accessing symbol names
in cc_newreno. This was fine when newreno was always compiled into the
kernel but now ... not so much. Instead lets fix up rack to use the socket
option queries to get the information it wants and set the parameters. We
also fix the CC parameter so they are always settable.

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

18 months agonetlink: improve interface handling
Alexander V. Chernikov [Wed, 14 Dec 2022 19:45:01 +0000 (19:45 +0000)]
netlink: improve interface handling

* Separate interface creation from interface modification code
* Support setting some interface attributes (ifdescr, mtu, up/down, promisc)
* Improve interaction with the cloners requiring to parse/write custom
 interface attributes
* Add bitmask-based way of checking if the attribute is present in the
message
* Don't use multipart RTM_GETLINK replies when searching for the
specific interface names
* Use ENODEV instead of ENOENT in case of failed RTM_GETLINK search
* Add python netlink test helpers
* Add some netlink interface tests

Differential Revision: https://reviews.freebsd.org/D37668

18 months agovm: reduce lock contention when processing vm batchqueues
Andrew Gallatin [Wed, 14 Dec 2022 19:34:07 +0000 (14:34 -0500)]
vm: reduce lock contention when processing vm batchqueues

Rather than waiting until the batchqueue is full to acquire the lock &
process the queue, we now start trying to acquire the lock using trylocks
when the batchqueue is 1/2 full. This removes almost all contention on the
vm pagequeue mutex for for our busy sendfile() based web workload.
It also greadly reduces the amount of time a network driver ithread
remains blocked on a mutex, and eliminates some packet drops under
heavy load.

So that the system does not loose the benefit of processing large
batchqueues, I've doubled the size of the batchqueues. This way, when
there is no contention, we process the same batch size as before.

This has been run for several months on a busy Netflix server, as well
as on my personal desktop.

Reviewed by: markj
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D37305

18 months agoallocate inpcb aligned to cachelines
Andrew Gallatin [Wed, 14 Dec 2022 19:19:35 +0000 (14:19 -0500)]
allocate inpcb aligned to cachelines

The inpcb struct is one of the most heavily utilized in the kernel
on a busy network server.  By aligning it to a cacheline
boundary, we can ensure that closely related fields in the inpcb
and tcbcb can be predictably located on the same cacheline.  rrs
has already done a lot of this work to put related fields on the
same line for the tcbcb.

In combination with a forthcoming patch to align the start of the tcpcb,
we see a roughly 3% reduction in CPU use on a busy web server serving
traffic over roughly 50,000 TCP connections.

Reviewed by: glebius, markj, tuexen
Differential Revision: https://reviews.freebsd.org/D37687
Sponsored by: Netflix

18 months agosockets: provide sousrsend() that does socket specific error handling
Gleb Smirnoff [Wed, 14 Dec 2022 18:02:44 +0000 (10:02 -0800)]
sockets: provide sousrsend() that does socket specific error handling

Sockets have special handling for EPIPE on a write, that was spread out
into several places.  Treating transient errors is also special - if
protocol is atomic, than we should ignore any changes to uio_resid, a
transient error means the write had completely failed (see d2b3a0ed31e).

- Provide sousrsend() that expects a valid uio, and leave sosend() for
  kernel consumers only.  Do all special error handling right here.
- In dofilewrite() don't do special handling of error for DTYPE_SOCKET.
- For send(2), write(2) and aio_write(2) call into sousrsend() and remove
  error handling for kern_sendit(), soo_write() and soaio_process_job().

PR: 265087
Reported by:            rz-rpi03 at h-ka.de
Reviewed by:            markj
Differential revision: https://reviews.freebsd.org/D35863

18 months agotcp: retire TCPDEBUG
Gleb Smirnoff [Wed, 14 Dec 2022 17:54:06 +0000 (09:54 -0800)]
tcp: retire TCPDEBUG

This subsystem is superseded by modern debugging facilities,
e.g. DTrace probes and TCP black box logging.

We intentionally leave SO_DEBUG in place, as many utilities may
set it on a socket.  Also the tcp::debug DTrace probes look at
this flag on a socket.

Reviewed by: gnn, tuexen
Discussed with: rscheff, rrs, jtl
Differential revision: https://reviews.freebsd.org/D37694

18 months agosys/conf: Remove an unneeded flag variable
Mark Johnston [Wed, 14 Dec 2022 14:32:17 +0000 (09:32 -0500)]
sys/conf: Remove an unneeded flag variable

After commit fac6dee9eb58 ("Remove tests for obsolete compilers in the
build system"), we always set -fdebug-prefix-map, so there's no point in
defining and testing _MAP_DEBUG_PREFIX.  No functional change intended.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

18 months agopf: Fix definitions of pf_pfil_*_hooked
Mark Johnston [Wed, 14 Dec 2022 14:29:59 +0000 (09:29 -0500)]
pf: Fix definitions of pf_pfil_*_hooked

This use of "volatile" in the vnet definitions doesn't have any effect.
VNET_DEFINE_STATE(volatile int, ...) should work, but let's avoid using
"volatile" altogether and convert to atomic_load/atomic_store.  Also
convert to bool while here.

Reviewed by: kp, mjg
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37684

18 months agoif_ovpn: fix LINT-NOIP build
Kristof Provost [Wed, 14 Dec 2022 09:53:03 +0000 (10:53 +0100)]
if_ovpn: fix LINT-NOIP build

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

18 months agopf tests: check that we clean up unused kifs
Kristof Provost [Wed, 30 Nov 2022 14:20:41 +0000 (15:20 +0100)]
pf tests: check that we clean up unused kifs

The previous commit fixed a memory leak, where we'd fail to clean up
removed groups (and interfaces).
Check that we now clean those up as expected.

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

18 months agopf: fix pfi_ifnet leak on interface removal
Nick Reilly [Wed, 30 Nov 2022 14:19:44 +0000 (15:19 +0100)]
pf: fix pfi_ifnet leak on interface removal

The detach of the interface and group were leaving pfi_ifnet memory
behind. Check if the kif still has references, and clean it up if it
doesn't

On interface detach, the group deletion was notified first and then a
change notification was sent. This would recreate the group in the kif
layer. Reorder the change to before the delete.

PR: 257218
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D37569

18 months agotcp: whack the stale declaration of rack_timer_stop
Mateusz Guzik [Wed, 14 Dec 2022 08:48:52 +0000 (08:48 +0000)]
tcp: whack the stale declaration of rack_timer_stop

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

18 months agoif_ovpn: cleanup offsetof() use
Kristof Provost [Mon, 5 Dec 2022 13:14:49 +0000 (14:14 +0100)]
if_ovpn: cleanup offsetof() use

Move the use of the `offsetof(struct ovpn_counters, fieldname) /
sizeof(uint64_t)` construct into a macro.
This removes a fair bit of code duplication and should make things a
little easier to read.

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

18 months agoif_ovpn: include peer counters in a OVPN_NOTIF_DEL_PEER message
Kristof Provost [Fri, 2 Dec 2022 15:59:38 +0000 (16:59 +0100)]
if_ovpn: include peer counters in a OVPN_NOTIF_DEL_PEER message

When we remove a peer userspace can no longer retrieve its counters. To
ensure that userspace can get a full count of the entire session we now
include the counters in the deletion message.

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

18 months agoif_ovpn: allow peer lookup by vpn4/vpn6 address
Kristof Provost [Tue, 29 Nov 2022 11:06:32 +0000 (12:06 +0100)]
if_ovpn: allow peer lookup by vpn4/vpn6 address

Introduce two more RB_TREEs so that we can look up peers by their peer
id (already present) or vpn4 or vpn6 address.
This removes the last linear scan of the peer list.

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

18 months agoif_ovpn: implement OVPN_GET_PEER_STATS
Kristof Provost [Sun, 27 Nov 2022 11:58:40 +0000 (12:58 +0100)]
if_ovpn: implement OVPN_GET_PEER_STATS

Allow userspace to retrieve per-peer traffic stats.

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

18 months agoif_ovpn: start tracking per-peer packets/bytes in/out
Kristof Provost [Sat, 26 Nov 2022 13:22:23 +0000 (14:22 +0100)]
if_ovpn: start tracking per-peer packets/bytes in/out

OpenVPN will introduce a mechanism to retrieve per-peer statistics.
Start tracking those so we can return them to userspace when queried.

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

18 months agoif_ovpn: remove OVPN_SEND_PKT
Kristof Provost [Sat, 26 Nov 2022 12:52:40 +0000 (13:52 +0100)]
if_ovpn: remove OVPN_SEND_PKT

OpenVPN userspace no longer uses the ioctl interface to send control
packets. It instead uses the socket directly.
The use of OVPN_SEND_PKT was never released, so we can remove this
without worrying about compatibility.

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

18 months agosizeof(7): miscellaneous edits
Konstantin Belousov [Tue, 13 Dec 2022 14:07:32 +0000 (16:07 +0200)]
sizeof(7): miscellaneous edits

Suggested by: pstef
Reviewed by: imp, pstef (previous version)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D37683

18 months agosizeof(7): remove "All rights reserved"
Jan Schaumann [Wed, 14 Dec 2022 04:58:23 +0000 (06:58 +0200)]
sizeof(7): remove "All rights reserved"

Requested by: pstef
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D37674

18 months agotcp: remove a 4.4BSD relic
Gleb Smirnoff [Wed, 14 Dec 2022 04:21:45 +0000 (20:21 -0800)]
tcp: remove a 4.4BSD relic

The actual code to modify this counter was disabled in 2c37256e5a59
and later removed in d0390e0570c.

18 months agoComplete retire cp(4)
Li-Wen Hsu [Wed, 14 Dec 2022 03:42:36 +0000 (11:42 +0800)]
Complete retire cp(4)

Sponsored by: The FreeBSD Foundation

18 months agoComplete retire cp(4)
Li-Wen Hsu [Wed, 14 Dec 2022 03:38:55 +0000 (11:38 +0800)]
Complete retire cp(4)

And fix the LINT build.

Sponsored by: The FreeBSD Foundation

Fixes: 895992bb66d214f34c76a2b9da1133d457b2dee1

18 months agotcp: fix counter leak for SYN_RCVD state when syncache_socket() fails
Gleb Smirnoff [Wed, 14 Dec 2022 03:31:05 +0000 (19:31 -0800)]
tcp: fix counter leak for SYN_RCVD state when syncache_socket() fails

The SYN_RCVD state count is tricky here due to default code path and TFO
being so different.  In the default case the count is incremented when a
syncache entry is added to the the database in syncache_insert().  Later
when connection transitions from syncache entry to a socket in
syncache_expand(), this counter is inherited by the tcpcb.  If socket or
tcpcb allocation failed in syncache_socket() failed the syncache_expand()
is responsible for decrement.  In the TFO case the syncache entry is not
inserted into database and count of SYN_RCVD is first incremented in the
syncache_tfo_expand() after successful socket allocation.  Thus, inside
syncache_socket() we can't tell whether we need to decrement in a case of
a failure or not.  The caller is responsible for this book keeping.

Fixes: 07285bb4c22c026a50f69149d5dae03169b15fe4
Differential revision: https://reviews.freebsd.org/D37610