]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
17 months agoRewrite to avoid Coverity false positive.
Kirk McKusick [Thu, 26 Jan 2023 00:57:26 +0000 (16:57 -0800)]
Rewrite to avoid Coverity false positive.

MFC after:    1 week
Reported by:  Coverity (CID 1502669)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37907

17 months agolindebugfs: Add `debugfs_create_file_size()`
Jean-Sébastien Pédron [Fri, 30 Dec 2022 09:57:49 +0000 (10:57 +0100)]
lindebugfs: Add `debugfs_create_file_size()`

This is the same as `debugfs_create_file()` but takes the initial size
of the file. In FreeBSD, the given size is ignored and
`debugfs_create_file()` is called.

Reviewed by: emaste, manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D37914

17 months agolinuxkpi: Define `PCI_STD_NUM_BARS` in <linux/pci.h>
Jean-Sébastien Pédron [Sun, 22 Jan 2023 13:46:14 +0000 (14:46 +0100)]
linuxkpi: Define `PCI_STD_NUM_BARS` in <linux/pci.h>

Reviewed by: emaste, manu
Approved by: emaste, manu
Differential Revision: https://reviews.freebsd.org/D38162

17 months agolinuxkpi: Define `pm_suspend_target_state` in <linux/suspend.h>
Jean-Sébastien Pédron [Fri, 20 Jan 2023 20:13:32 +0000 (21:13 +0100)]
linuxkpi: Define `pm_suspend_target_state` in <linux/suspend.h>

It is set to `PM_SUSPEND_ON`.

Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D38161

17 months agolinuxkpi: Add `msix_cap` to `struct pci_dev`
Jean-Sébastien Pédron [Fri, 20 Jan 2023 19:23:59 +0000 (20:23 +0100)]
linuxkpi: Add `msix_cap` to `struct pci_dev`

At the same time, define `PCI_MSIX_FLAGS`and `PCI_MSIX_FLAGS_ENABLE`.

Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D38160

17 months agolinuxkpi: Add `sysfs_emit_at()` in <linux/sysfs.h>
Jean-Sébastien Pédron [Fri, 20 Jan 2023 19:23:17 +0000 (20:23 +0100)]
linuxkpi: Add `sysfs_emit_at()` in <linux/sysfs.h>

Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D38159

17 months agolinuxkpi: Define `is_cow_mapping(flags)` as false
Jean-Sébastien Pédron [Fri, 20 Jan 2023 19:22:41 +0000 (20:22 +0100)]
linuxkpi: Define `is_cow_mapping(flags)` as false

Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D38158

17 months agolinuxkpi: Include <linux/vmalloc.h> from <linux/pagemap.h>
Jean-Sébastien Pédron [Fri, 20 Jan 2023 17:51:40 +0000 (18:51 +0100)]
linuxkpi: Include <linux/vmalloc.h> from <linux/pagemap.h>

I'm not sure this is correct, but it gives access to the definition of
`PAGE_KERNEL` in `ttm_tt.c` in the DRM drivers.

Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D38154

17 months agolinuxkpi: Add `seqcount_ww_mutex_t` in <linux/seqlock.h>
Jean-Sébastien Pédron [Fri, 20 Jan 2023 17:20:01 +0000 (18:20 +0100)]
linuxkpi: Add `seqcount_ww_mutex_t` in <linux/seqlock.h>

It is defined as a synonymous to `seqcount_mutex_t`.

Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D38152

17 months agolinuxkpi: Define `DEFINE_WD_CLASS(name)` in <linux/ww_mutex.h>
Jean-Sébastien Pédron [Fri, 20 Jan 2023 17:19:01 +0000 (18:19 +0100)]
linuxkpi: Define `DEFINE_WD_CLASS(name)` in <linux/ww_mutex.h>

It is defined as a synonymous to `DEFINE_WW_CLASS(name)`.

Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D38151

17 months agolinuxkpi: Adds more `SZ_*` macros
Jean-Sébastien Pédron [Fri, 20 Jan 2023 17:17:37 +0000 (18:17 +0100)]
linuxkpi: Adds more `SZ_*` macros

`SZ_2K` and `SZ_1G` were defined in irdma. They are removed from this
driver.

Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D38150

17 months agolinuxkpi: Define ENOKEY to 126.
Jean-Sébastien Pédron [Fri, 20 Jan 2023 17:14:25 +0000 (18:14 +0100)]
linuxkpi: Define ENOKEY to 126.

This is the same error code as Linux. This value is unused on FreeBSD.

Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D38149

17 months agolinuxkpi: Add `pci_device_is_present()`
Jean-Sébastien Pédron [Thu, 19 Jan 2023 17:46:37 +0000 (18:46 +0100)]
linuxkpi: Add `pci_device_is_present()`

This calls bus_child_present(9) internally.

Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D38148

17 months agolinuxkpi: Define `dev_dbg_ratelimited()`
Jean-Sébastien Pédron [Thu, 19 Jan 2023 00:15:03 +0000 (01:15 +0100)]
linuxkpi: Define `dev_dbg_ratelimited()`

Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D38145

17 months agovt(4): Return errors from `vt_{,de}allocate()`
Jean-Sébastien Pédron [Sat, 14 Jan 2023 18:22:56 +0000 (19:22 +0100)]
vt(4): Return errors from `vt_{,de}allocate()`

This is useful to the DRM drivers to let them know if a device is
effectively used by the console.

Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D38089

17 months agolinuxkpi: Fix `atomic_long_sub()` overflow
Jean-Sébastien Pédron [Sun, 15 Jan 2023 14:56:48 +0000 (15:56 +0100)]
linuxkpi: Fix `atomic_long_sub()` overflow

By (ab)using `atomic_long_add_return()`, `atomic_long_sub()` was making
the atomic long overflow. Indeed the underlying FreeBSD atomic is based
on an unsigned long.

Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D38090

17 months agolinuxkpi: Add `io_mapping_map_user()` and `remap_pfn_range()`
Jean-Sébastien Pédron [Sat, 14 Jan 2023 12:22:19 +0000 (13:22 +0100)]
linuxkpi: Add `io_mapping_map_user()` and `remap_pfn_range()`

The code comes from the i915 DRM driver.

In Linux commits b739f125e4ebd73d10ed30a856574e13649119ed and
b12d691ea5e01db42ccf3b4207e57cb3ce7cfe91 (Linux 5.13), the i915 DRM
driver dropped specific implementations to use Linux generic functions.
Therefore I moved the FreeBSD code from that i915 driver to linuxkpi.

However, these commits were later reverted (also in Linux 5.13) so the
i915 driver doesn't use these functions. But perhaps it will help in the
future.

To sum up, the code comes from the i915 DRM driver but it doesn't use it
(i.e. it continues to use its internal implementation).

Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D38088

17 months agolinuxkpi: Add `sysfs_emit()`
Jean-Sébastien Pédron [Wed, 11 Jan 2023 23:23:33 +0000 (00:23 +0100)]
linuxkpi: Add `sysfs_emit()`

Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D38086

17 months agolinuxkpi: Add `complete` field to `struct dev_pm_ops`
Jean-Sébastien Pédron [Wed, 11 Jan 2023 22:23:57 +0000 (23:23 +0100)]
linuxkpi: Add `complete` field to `struct dev_pm_ops`

This change breaks the KBI.

Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D38085

17 months agolinuxkpi: Add `pm_suspend_via_firmware()`
Jean-Sébastien Pédron [Wed, 11 Jan 2023 22:23:35 +0000 (23:23 +0100)]
linuxkpi: Add `pm_suspend_via_firmware()`

Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D38084

17 months agolinuxkpi: Add `pm_runtime_suspended()`
Jean-Sébastien Pédron [Wed, 11 Jan 2023 22:23:14 +0000 (23:23 +0100)]
linuxkpi: Add `pm_runtime_suspended()`

Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D38083

17 months agolinuxkpi: Define `tasklet_unlock_spin_wait()` as `tasklet_unlock_wait()`
Jean-Sébastien Pédron [Wed, 11 Jan 2023 00:48:43 +0000 (01:48 +0100)]
linuxkpi: Define `tasklet_unlock_spin_wait()` as `tasklet_unlock_wait()`

Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D38080

17 months agolinuxkpi: Define `synchronize_hardirq()`
Jean-Sébastien Pédron [Wed, 11 Jan 2023 00:27:40 +0000 (01:27 +0100)]
linuxkpi: Define `synchronize_hardirq()`

It currently does the same as `synchronize_irq()`.

Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D38079

17 months agolindebugfs: Add missing `debugfs_create_u*()` and `debugfs_create_x*()`
Jean-Sébastien Pédron [Thu, 12 Jan 2023 23:41:32 +0000 (00:41 +0100)]
lindebugfs: Add missing `debugfs_create_u*()` and `debugfs_create_x*()`

The `debugfs_create_x*()` variants are the same as their
`debugfs_create_u*()` equivalent, but they work with lowercase
hexadecimal.

While here, fix a few style(9) issues.

Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D38087

17 months agolindebugfs: Add `debugfs_create_atomic_t()`
Jean-Sébastien Pédron [Fri, 30 Dec 2022 10:00:57 +0000 (11:00 +0100)]
lindebugfs: Add `debugfs_create_atomic_t()`

Reviewed by: jfree
Approved by: jfree
Differential Revision: https://reviews.freebsd.org/D37915

17 months agozfs: merge openzfs/zfs@9cd71c860 (master)
Martin Matuska [Wed, 25 Jan 2023 18:50:29 +0000 (19:50 +0100)]
zfs: merge openzfs/zfs@9cd71c860 (master)

Notable upstream pull request merges:
  #13805 Configure zed's diagnosis engine with vdev properties
  #14110 zfs list: Allow more fields in ZFS_ITER_SIMPLE mode
  #14121 Batch enqueue/dequeue for bqueue
  #14123 arc_read()/arc_access() refactoring and cleanup
  #14159 Bypass metaslab throttle for removal allocations
  #14243 Implement uncached prefetch
  #14251 Cache dbuf_hash() calculation
  #14253 Allow reciever to override encryption property in case of replication
  #14254 Restrict visibility of per-dataset kstats inside FreeBSD jails
  #14255 Zero end of embedded block buffer in dump_write_embedded()
  #14263 Cleanups identified by CodeQL and Coverity
  #14264 Miscellaneous fixes
  #14272 Change ZEVENT_POOL_GUID to ZEVENT_POOL to display pool names
  #14287 FreeBSD: Remove stray debug printf
  #14288 Colorize zfs diff output
  #14289 deadlock between spa_errlog_lock and dp_config_rwlock
  #14291 FreeBSD: Fix potential boot panic with bad label
  #14292 Add tunable to allow changing micro ZAP's max size
  #14293 Turn default_bs and default_ibs into ZFS_MODULE_PARAMs
  #14295 zed: add hotplug support for spare vdevs
  #14304 Activate filesystem features only in syncing context
  #14311 zpool: do guid-based comparison in is_vdev_cb()
  #14317 Pack zrlock_t by 8 bytes
  #14320 Update arc_summary and arcstat outputs
  #14328 FreeBSD: catch up to 1400077
  #14376 Use setproctitle to report progress of zfs send
  #14340 Remove some dead ARC code
  #14358 Wait for txg sync if the last DRR_FREEOBJECTS might result in a hole
  #14360 libzpool: fix ddi_strtoull to update nptr
  #14364 Fix unprotected zfs_znode_dmu_fini
  #14379 zfs_receive_one: Check for the more likely error first
  #14380 Cleanup of dead code suggested by Clang Static Analyzer
  #14397 Avoid passing an uninitialized index to dsl_prop_known_index
  #14404 Fix reading uninitialized variable in receive_read
  #14407 free_blocks(): Fix reports from 2016 PVS Studio FreeBSD report
  #14418 Introduce minimal ZIL block commit delay
  #14422 x86 assembly: fix .size placement and replace .align with .balign

Obtained from: OpenZFS
OpenZFS commit: 9cd71c8604d52def22ffaddc35755712f0fb9349

17 months agoipfw.8: there never was a "skip-action" action
Ceri Davies [Wed, 25 Jan 2023 18:15:18 +0000 (18:15 +0000)]
ipfw.8: there never was a "skip-action" action

It was renamed during review of D1776 but this entry slipped through.

PR: 243284
Reported by: pprocacci@gmail.com
Obtained from: Chad Jacob Milios <milios@ccsys.com>

17 months agoFix cross-build from STABLE or older CURRENT.
Dag-Erling Smørgrav [Wed, 25 Jan 2023 17:03:10 +0000 (18:03 +0100)]
Fix cross-build from STABLE or older CURRENT.

Previously, zic and tzsetup were both listed as install tools and basic
bootstrap tools.  Actually, tzsetup is an install tool while zic is a
non-basic bootstrap tool.

Fixes: 783c318fd118
Sponsored by: Klara, Inc.
Reviewed by: jrtc27, emaste
Differential Revision: https://reviews.freebsd.org/D38195

17 months agozoneinfo: Always produce fat zoneinfo files.
Dag-Erling Smørgrav [Wed, 25 Jan 2023 17:03:05 +0000 (18:03 +0100)]
zoneinfo: Always produce fat zoneinfo files.

These aren't just needed for compatibility with i386 binaries (which need
the 32-bit section), but potentially also for compatibility with older
binaries on all platforms.

Sponsored by: Klara, Inc.
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D38194

17 months agow: Unlike err(3), xo_err(3) won't accept a null format string.
Dag-Erling Smørgrav [Wed, 25 Jan 2023 17:03:00 +0000 (18:03 +0100)]
w: Unlike err(3), xo_err(3) won't accept a null format string.

MFC after: 1 week
X-MFC-with: d90ff31ae5cd
Sponsored by: Klara, Inc.
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D38192

17 months agotzcode: Document zic's -D option.
Dag-Erling Smørgrav [Wed, 25 Jan 2023 17:02:55 +0000 (18:02 +0100)]
tzcode: Document zic's -D option.

Sponsored by: Klara, Inc.
Reviewed by: allanjude
Differential Revision: https://reviews.freebsd.org/D38141

17 months agopytest: delete interfaces from inside the jail.
Alexander V. Chernikov [Wed, 25 Jan 2023 16:32:52 +0000 (16:32 +0000)]
pytest: delete interfaces from inside the jail.

This change follows the approach used in 80fc25025ffc, to
 minimise the impact of the delayed interface migration.

MFC after: 2 weeks

17 months agozoneinfo: On amd64, include 32-bit data.
Dag-Erling Smørgrav [Wed, 25 Jan 2023 15:54:52 +0000 (16:54 +0100)]
zoneinfo: On amd64, include 32-bit data.

While there, drop the unnecessary posixrules option.

Sponsored by: Klara, Inc.
Reviewed by: imp, allanjude
Differential Revision: https://reviews.freebsd.org/D38142

17 months agostand/uboot: Remove -fPIC here
Warner Losh [Wed, 25 Jan 2023 15:03:08 +0000 (08:03 -0700)]
stand/uboot: Remove -fPIC here

When needed, -fPIC is added in defs.mk. While not in main, mips on
stable/13 can't tolerate it. Remove it here.

MFC After: now (it's a build issue)
Sponsored by: Netflix

17 months agostand: Add testing for i386 as well to full-test.sh
Warner Losh [Wed, 25 Jan 2023 15:02:08 +0000 (08:02 -0700)]
stand: Add testing for i386 as well to full-test.sh

Sponsored by: Netflix

17 months agopytest: add an example test fetching test directory and ATF vars.
Alexander V. Chernikov [Wed, 25 Jan 2023 13:55:33 +0000 (13:55 +0000)]
pytest: add an example test fetching test directory and ATF vars.

MFC after: 2 weeks

17 months agostrfmon(3): Match the return type
Jose Luis Duran [Tue, 8 Nov 2022 20:16:49 +0000 (17:16 -0300)]
strfmon(3): Match the return type

Reviewed by: kib
MFC after: 1 week

17 months agostrfmon(3): Wording improvements
Jose Luis Duran [Tue, 8 Nov 2022 20:53:17 +0000 (17:53 -0300)]
strfmon(3): Wording improvements

Use the same terminology as the other `_l` xlocale(3) functions.

Reviewed by: kib
MFC after: 1 week

17 months agostrfmon(3): Add an EXAMPLES section
Jose Luis Duran [Tue, 8 Nov 2022 20:36:57 +0000 (17:36 -0300)]
strfmon(3): Add an EXAMPLES section

Reviewed by: kib
MFC after: 1 week

17 months agopci_vendors: update to 2023-01-18
Baptiste Daroussin [Wed, 25 Jan 2023 08:58:39 +0000 (09:58 +0100)]
pci_vendors: update to 2023-01-18

17 months agoarm64: Move device scmi to std.arm
Emmanuel Vadot [Wed, 25 Jan 2023 07:28:22 +0000 (08:28 +0100)]
arm64: Move device scmi to std.arm

The scmi driver in its current form requires the arm_doorbell
driver to communicate with the firmware.
The arm_doorbell is only found in ARM Juno reference board (and
apparently on Morello too).
If we want to use scmi on other platform (like some rockchip or imx
soc), the driver needs to be updated to support svc/shmem communication
with the firmware.
For now since it can be only used with arm_doorbell move the device to
std.arm otherwise kernel configs like ALLWINNER or ROCKCHIP fails to build.

Reviewed by: br, imp
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D37953

17 months agolibc: Update mktime(3) / timegm(3) tests.
Dag-Erling Smørgrav [Wed, 25 Jan 2023 06:21:23 +0000 (07:21 +0100)]
libc: Update mktime(3) / timegm(3) tests.

Sponsored by: Klara, Inc.
Reviewed by: ngie
Differential Revision: https://reviews.freebsd.org/D38177

17 months agow: Complete libxo transition.
Dag-Erling Smørgrav [Wed, 25 Jan 2023 06:21:13 +0000 (07:21 +0100)]
w: Complete libxo transition.

MFC after: 1 week
Sponsred by: Klara, Inc.
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D38172

17 months agolibcxx: add comment explaining why umtx is only used for 64bits
Konstantin Belousov [Tue, 24 Jan 2023 15:36:24 +0000 (17:36 +0200)]
libcxx: add comment explaining why umtx is only used for 64bits

Requested by: imp
Reviewed by: arichardson, emaste
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D38178

17 months agolibcxx: use __SIZEOF_LONG__ == 8 instead of __LP64__
Konstantin Belousov [Tue, 24 Jan 2023 10:03:45 +0000 (12:03 +0200)]
libcxx: use __SIZEOF_LONG__ == 8 instead of __LP64__

for CHERI.

Requested by: arichardson
Reviewed by: arichardson, emaste, imp
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D38178

17 months agoiflib: Add null check to iflib_stop()
Przemyslaw Lewandowski [Tue, 24 Jan 2023 23:41:15 +0000 (15:41 -0800)]
iflib: Add null check to iflib_stop()

Ever since gtaskqueue_drain() was added to iflib_stop(), a kernel panic
occurs when the ice(4) driver is in recovery mode. Queues are not
initialized in this mode, so gt_taskqueue is not initialized, and
gtaskqueue_drain() will panic.

Fix this by only doing a drain if an RX queue's gt_taskqueue is
initialized.

Signed-off-by: Eric Joyner <erj@FreeBSD.org>
Reviewed by: erj@
MFC after: 1 week
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D37892

17 months agoice_ddp: Update package to 1.3.30.0
Eric Joyner [Tue, 24 Jan 2023 22:01:57 +0000 (14:01 -0800)]
ice_ddp: Update package to 1.3.30.0

This updated DDP is intended to be used with the forthcoming ice(4)
driver update to 1.37.7-k. (But it will still work with the current
version.)

Co-authored-by: Piotr Kubaj <pkubaj@FreeBSD.org>
Signed-off-by: Eric Joyner <erj@FreeBSD.org>
MFC after: 1 week
Sponsored by: Intel Corporation

17 months agoMechanically convert ixgbe(4) to IfAPI
Justin Hibbits [Sat, 20 Aug 2022 02:02:03 +0000 (22:02 -0400)]
Mechanically convert ixgbe(4) to IfAPI

Reviewed by: erj
Sponsored by: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D37845

17 months agoMechanically convert dtsec(4) to IfAPI
Justin Hibbits [Wed, 17 Aug 2022 20:13:23 +0000 (16:13 -0400)]
Mechanically convert dtsec(4) to IfAPI

Sponsored by: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D37815

17 months agodebugnet: Add ifnet accessor to set debugnet methods
Justin Hibbits [Fri, 13 Jan 2023 16:30:58 +0000 (11:30 -0500)]
debugnet: Add ifnet accessor to set debugnet methods

As part of the effort to hide the internals of the ifnet struct, convert
the DEBUGNET_SET() macro to use an accessor instead of directly touching
the methods member.

Reviewed by: glebius (older version)
Sponsored by: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D38105

17 months agoifnet/API: Move struct ifnet definition to a <net/if_private.h>
Justin Hibbits [Fri, 13 Jan 2023 15:43:51 +0000 (10:43 -0500)]
ifnet/API: Move struct ifnet definition to a <net/if_private.h>

Hide the ifnet structure definition, no user serviceable parts inside,
it's a netstack implementation detail.  Include it temporarily in
<net/if_var.h> until all drivers are updated to use the accessors
exclusively.

Reviewed by: glebius
Sponsored by: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D38046

17 months agoifnet API: Change if_init() to take context argument
Justin Hibbits [Thu, 12 Jan 2023 18:33:30 +0000 (13:33 -0500)]
ifnet API: Change if_init() to take context argument

Some drivers, like iflib drivers, take a 'context' argument instead of a
ifnet argument, as a single interface may have multiple contexts.
Follow this scheme by passing the context argument down.  Most drivers
will likely pass 'ifp' as the context.

Reviewed by: glebius
Sponsored by: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D38102

17 months agoMechanically convert etherswitch drivers to IfAPI
Justin Hibbits [Mon, 30 May 2022 19:40:45 +0000 (14:40 -0500)]
Mechanically convert etherswitch drivers to IfAPI

Reviewed by: kd
Sponsored by: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D37813

17 months agoMechanically convert iavf(4) to IfAPI
Justin Hibbits [Fri, 19 Aug 2022 15:55:36 +0000 (11:55 -0400)]
Mechanically convert iavf(4) to IfAPI

Reviewed by: erj
Sponsored by: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D37858

17 months agoMechanically convert ixl(4) to IfAPI
Justin Hibbits [Fri, 19 Aug 2022 15:54:42 +0000 (11:54 -0400)]
Mechanically convert ixl(4) to IfAPI

Reviewed by: erj
Sponsored by: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D37857

17 months agoMechanically convert neta(4) to IfAPI
Justin Hibbits [Wed, 17 Aug 2022 20:34:32 +0000 (16:34 -0400)]
Mechanically convert neta(4) to IfAPI

Reviewed by: mw
Sponsored by: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D37825

17 months agoMechanically convert if_cpsw(4) to IfAPI
Justin Hibbits [Fri, 25 Feb 2022 18:00:25 +0000 (12:00 -0600)]
Mechanically convert if_cpsw(4) to IfAPI

Reviewed By: manu
Sponsored by: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D37789

17 months agoMechanically convert if_vtnet(4) to IfAPI
Justin Hibbits [Tue, 1 Mar 2022 17:02:48 +0000 (11:02 -0600)]
Mechanically convert if_vtnet(4) to IfAPI

Reviewed By: bryanv
Sponsored by: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D37799

17 months agoMechanically convert if_emac(4) to IfAPI
Justin Hibbits [Fri, 25 Feb 2022 17:58:14 +0000 (11:58 -0600)]
Mechanically convert if_emac(4) to IfAPI

Reviewed by: manu
Sponsored by: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D37788

17 months agoConvert xl(4) to IfAPI
Justin Hibbits [Tue, 26 Oct 2021 14:43:38 +0000 (09:43 -0500)]
Convert xl(4) to IfAPI

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

17 months agolinux 6.2 compat: zpl_set_acl arg2 is now struct dentry
Coleman Kane [Tue, 24 Jan 2023 19:20:50 +0000 (14:20 -0500)]
linux 6.2 compat:  zpl_set_acl arg2 is now struct dentry

Linux 6.2 changes the second argument of the set_acl operation to be a
"struct dentry *" rather than a "struct inode *". The inode* parameter
is still available as dentry->d_inode, so adjust the call to the _impl
function call to dereference and pass that pointer to it.

Also document that the get_acl -> get_inode_acl member name change from
commit 884a693 was an API change also introduced in Linux 6.2.

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Signed-off-by: Coleman Kane <ckane@colemankane.org>
Closes #14415

17 months agoIntroduce minimal ZIL block commit delay
Alexander Motin [Tue, 24 Jan 2023 17:20:32 +0000 (12:20 -0500)]
Introduce minimal ZIL block commit delay

Despite all optimizations, tests on actual hardware show that FreeBSD
kernel can't sleep for less then ~2us.  Similar tests on Linux show
~50us delay at least from nanosleep() (haven't tested inside kernel).
It means that on very fast log device ZIL may not be able to satisfy
zfs_commit_timeout_pct block commit timeout, increasing log latency
more than desired.

Handle that by introduction of zil_min_commit_timeout parameter,
specifying minimal timeout value where additional delays to aggregate
writes may be skipped.  Also skip delays if the LWB is more than 7/8
full, that often happens if I/O sizes are constant and match one of
LWB sizes.  Both things are applied only if there were no already
outstanding log blocks, that may indicate single-threaded workload,
that by definition can not benefit from the commit delays.

While there, add short time moving average to zl_last_lwb_latency to
make it more stable.

Tests of single-threaded 4KB writes to NVDIMM SLOG on FreeBSD show IOPS
increase by 9% instead of expected 5%.  For zfs_commit_timeout_pct of
1 there IOPS increase by 5.5% instead of expected 1%.

Reviewed-by: Allan Jude <allan@klarasystems.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Prakash Surya <prakash.surya@delphix.com>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Sponsored by: iXsystems, Inc.
Closes #14418

17 months agox86 asm: Replace .align with .balign
Attila Fülöp [Mon, 23 Jan 2023 19:25:21 +0000 (20:25 +0100)]
x86 asm: Replace .align with .balign

The .align directive used to align storage locations is
ambiguous. On some platforms and assemblers it takes a byte count,
on others the argument is interpreted as a shift value. The current
usage expects the first interpretation.

Replace it with the unambiguous .balign directive which always
expects a byte count, regardless of platform and assembler.

Reviewed-by: Jorgen Lundman <lundman@lundman.net>
Reviewed-by: Tino Reichardt <milky-zfs@mcmilk.de>
Reviewed-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Signed-off-by: Attila Fülöp <attila@fueloep.org>
Closes #14422

17 months agoIPC: blake3 x86 asm: fix placement of .size directives
Attila Fülöp [Mon, 23 Jan 2023 18:48:39 +0000 (19:48 +0100)]
IPC: blake3 x86 asm: fix placement of .size directives

The .size directive used by the SET_SIZE C macro uses the special
dot symbol to calculate the size of a function. The dot symbol
refers to the current address, so for the calculation to be
meaningful the SET_SIZE macro must be placed immediately after the
end of the function the size is calculated for.

Reviewed-by: Jorgen Lundman <lundman@lundman.net>
Reviewed-by: Tino Reichardt <milky-zfs@mcmilk.de>
Reviewed-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Signed-off-by: Attila Fülöp <attila@fueloep.org>
Closes #14422

17 months agoqat: Add Intel® 4xxx Series platform support
Michal Gulbicki [Tue, 24 Jan 2023 14:31:38 +0000 (09:31 -0500)]
qat: Add Intel® 4xxx Series platform support

Overview:
Intel(R) QuickAssist Technology (Intel(R) QAT) provides hardware
acceleration for offloading security, authentication and compression
services from the CPU, thus significantly increasing the performance and
efficiency of standard platform solutions.

This commit introduces:
- Intel® 4xxx Series platform support.
- QuickAssist kernel API implementation update for Generation 4 device.
  Enabled services: symmetric cryptography and data compression.
- Increased default number of crypto instances in static configuration
  for performance purposes.

OCF backend changes:
- changed GCM/CCM MAC validation policy to generate MAC by HW
  and validate by SW due to the QAT HW limitations.

Patch co-authored by: Krzysztof Zdziarski <krzysztofx.zdziarski@intel.com>
Patch co-authored by: Michal Jaraczewski <michalx.jaraczewski@intel.com>
Patch co-authored by: Michal Gulbicki <michalx.gulbicki@intel.com>
Patch co-authored by: Julian Grajkowski <julianx.grajkowski@intel.com>
Patch co-authored by: Piotr Kasierski <piotrx.kasierski@intel.com>
Patch co-authored by: Adam Czupryna <adamx.czupryna@intel.com>
Patch co-authored by: Konrad Zelazny <konradx.zelazny@intel.com>
Patch co-authored by: Katarzyna Rucinska <katarzynax.kargol@intel.com>
Patch co-authored by: Lukasz Kolodzinski <lukaszx.kolodzinski@intel.com>
Patch co-authored by: Zbigniew Jedlinski <zbigniewx.jedlinski@intel.com>

Sponsored by: Intel Corporation
Reviewed by: markj, jhb
Differential Revision: https://reviews.freebsd.org/D36254

17 months agomixer(3): Add HEADNAME to TAILQ_HEAD declarations in man page
Christos Margiolis [Tue, 24 Jan 2023 14:10:49 +0000 (09:10 -0500)]
mixer(3): Add HEADNAME to TAILQ_HEAD declarations in man page

Forgot to modify the man page in commit 249526dace5d6f.

Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D38118

17 months agodtrace: Improve a verifier error message
Domagoj Stolfa [Tue, 24 Jan 2023 14:09:27 +0000 (09:09 -0500)]
dtrace: Improve a verifier error message

Using '%r0' in efunc causes it to parse %r as a 'r' specifier.

This diff just adds a '%' in front of '%r0' in order to create the
correct output.

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

17 months agofind: Logic nit in man page.
Dag-Erling Smørgrav [Tue, 24 Jan 2023 08:53:35 +0000 (09:53 +0100)]
find: Logic nit in man page.

Arguments follow primaries, not the other way around.

MFC after: 1 week
Sponsored by: Klara, Inc.

Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D38173

17 months agodtrace: remove stray {
Kristof Provost [Tue, 24 Jan 2023 07:39:37 +0000 (08:39 +0100)]
dtrace: remove stray {

Fixes: da81cc6035f8283b6adda1ef466977e8c1c5389e
PR: 269128

17 months agopfctl: rule.label is a two-dimensional array
Kristof Provost [Tue, 24 Jan 2023 06:46:46 +0000 (07:46 +0100)]
pfctl: rule.label is a two-dimensional array

Fix checking for a non-empty first string.

PR: 269075
MFC after: 1 week
Reported by: nreilly@blackberry.com

17 months agodtrace: conditionally load the systrace_linux klds when loading dtrace.
Andrew Gallatin [Tue, 24 Jan 2023 01:27:17 +0000 (20:27 -0500)]
dtrace: conditionally load the systrace_linux klds when loading dtrace.

When dtrace starts, it tries to detect if the dtrace klds are loaded,
and if not, it loads them by loading the dtraceall kld. This module
depends on most dtrace modules, including systrace for the native
freebsd and freebsd32 ABIs. However, it does not depend on the
systrace_linux klds, as they in turn depend on the linux ABI klds, and
we don't want to load an ABI module that the user has not explicitly
requested. This can leave a naive user in a state where they think all
syscall providers have been loaded, yet linux ABI syscalls are
"invisible" to dtrace.

To fix this, check to see if the linux ABI modules are loaded. If they
are, then load their systrace klds.

Reviewed by: markj, (emaste & jhb, earlier versions)
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D37986

17 months agolibcxx: Implement atomic::wait/notify using _umtx_op(2) for 64bit arches
Konstantin Belousov [Fri, 20 Jan 2023 02:57:26 +0000 (04:57 +0200)]
libcxx: Implement atomic::wait/notify using _umtx_op(2) for 64bit arches

Only 64bit architectures can be supported this way, because libcxx
defines __cxx_contention_t to be int64_t for FreeBSD, and 32bit arches
do not have a kind of UMTX_OP_WAIT_INT64_PRIVATE operation.

LLVM review: https://reviews.llvm.org/D142134

Tested by: emaste
Reviewed by: dim, emaste, markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D38132

17 months agoUPDATING: fix typo
Warner Losh [Tue, 24 Jan 2023 00:08:12 +0000 (17:08 -0700)]
UPDATING: fix typo

I'd forgotten to fix this from the review, and a couple of people have
pointed it out after the commit.

Sponsored by: Netflix

17 months agoWait for txg sync if the last DRR_FREEOBJECTS might result in a hole
David Hedberg [Mon, 23 Jan 2023 21:19:43 +0000 (22:19 +0100)]
Wait for txg sync if the last DRR_FREEOBJECTS might result in a hole

If we receive a DRR_FREEOBJECTS as the first entry in an object range,
this might end up producing a hole if the freed objects were the
only existing objects in the block.

If the txg starts syncing before we've processed any following
DRR_OBJECT records, this leads to a possible race where the backing
arc_buf_t gets its psize set to 0 in the arc_write_ready() callback
while still being referenced from a dirty record in the open txg.

To prevent this, we insert a txg_wait_synced call if the first
record in the range was a DRR_FREEOBJECTS that actually
resulted in one or more freed objects.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: David Hedberg <david.hedberg@findity.com>
Sponsored by: Findity AB
Closes #11893
Closes #14358

17 months agoReject streams that set ->drr_payloadlen to unreasonably large values
Richard Yao [Mon, 23 Jan 2023 21:16:22 +0000 (16:16 -0500)]
Reject streams that set ->drr_payloadlen to unreasonably large values

In the zstream code, Coverity reported:

"The argument could be controlled by an attacker, who could invoke the
function with arbitrary values (for example, a very high or negative
buffer size)."

It did not report this in the kernel. This is likely because the
userspace code stored this in an int before passing it into the
allocator, while the kernel code stored it in a uint32_t.

However, this did reveal a potentially real problem. On 32-bit systems
and systems with only 4GB of physical memory or less in general, it is
possible to pass a large enough value that the system will hang. Even
worse, on Linux systems, the kernel memory allocator is not able to
support allocations up to the maximum 4GB allocation size that this
allows.

This had already been limited in userspace to 64MB by
`ZFS_SENDRECV_MAX_NVLIST`, but we need a hard limit in the kernel to
protect systems. After some discussion, we settle on 256MB as a hard
upper limit. Attempting to receive a stream that requires more memory
than that will result in E2BIG being returned to user space.

Reported-by: Coverity (CID-1529836)
Reported-by: Coverity (CID-1529837)
Reported-by: Coverity (CID-1529838)
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Closes #14285

17 months agoConfigure zed's diagnosis engine with vdev properties
rob-wing [Mon, 23 Jan 2023 21:14:25 +0000 (12:14 -0900)]
Configure zed's diagnosis engine with vdev properties

Introduce four new vdev properties:
    checksum_n
    checksum_t
    io_n
    io_t

These properties can be used for configuring the thresholds of zed's
diagnosis engine and are interpeted as <N> events in T <seconds>.

When this property is set to a non-default value on a top-level vdev,
those thresholds will also apply to its leaf vdevs. This behavior can be
overridden by explicitly setting the property on the leaf vdev.

Note that, these properties do not persist across vdev replacement. For
this reason, it is advisable to set the property on the top-level vdev
instead of the leaf vdev.

The default values for zed's diagnosis engine (10 events, 600 seconds)
remains unchanged.

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Reviewed-by: Allan Jude <allan@klarasystems.com>
Signed-off-by: Rob Wing <rob.wing@klarasystems.com>
Sponsored-by: Seagate Technology LLC
Closes #13805

17 months agofree_blocks(): Fix reports from 2016 PVS Studio FreeBSD report
Richard Yao [Mon, 23 Jan 2023 21:12:37 +0000 (16:12 -0500)]
free_blocks(): Fix reports from 2016 PVS Studio FreeBSD report

In 2016, the authors of PVS Studio ran it on the FreeBSD kernel, which
identified a number of bugs / cleanup opportunities in the FreeBSD ZFS kernel
code. A few of them persist to the present day:

https://reviews.freebsd.org/D5245

Note that the scan was done against
freebsd/freebsd-src@46763fd4ca8a37f836c9bf2333f9d687509278f3.

In particular, we have the following in free_blocks():

\sys\cddl\contrib\opensolaris\uts\common\fs\zfs\dnode_sync.c (174): error V547: Expression '__left >= __right' is always true. Unsigned type value is always >= 0.
\sys\cddl\contrib\opensolaris\uts\common\fs\zfs\dnode_sync.c (171): error V634: The priority of the '*' operation is higher than that of the '<<' operation. It's possible that parentheses should be used in the expression.
\sys\cddl\contrib\opensolaris\uts\common\fs\zfs\dnode_sync.c (175): error V547: Expression '__left >= __right' is always true. Unsigned type value is always >= 0.

A couple of assertions accidentally typecast the arguments they check to
unsigned in such a way that the result is always true. Also, parentheses
are missing around `1<<epbs` in `(db->db_blkid * 1<<epbs)`. This works
out to be okay due to multiplication not caring what order of operations
we use, but it is better to fix it to be `(db->db_blkid << epbs)`.

A few of the function local variables probably never should have been
32-bit in the first place, so we make them 64-bit. We also replace the
existing assertions with additional assertions to ensure that 64-bit
unsigned arithmetic is safe.

Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Closes #14407

17 months agoAdd git-blame ignore file
Ed Maste [Mon, 23 Jan 2023 20:27:25 +0000 (15:27 -0500)]
Add git-blame ignore file

.git-blame-ignore-revs lists commit hashes that should be skipped by
`git blame` e.g. non-functional whitespace or style cleanup.

The file is populated with a few sample entries.

Reviewed by: brooks, imp
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D36525

fixup ignore revs

17 months agonetmap: Try to count packet drops in emulated mode
Mark Johnston [Mon, 23 Jan 2023 19:42:41 +0000 (14:42 -0500)]
netmap: Try to count packet drops in emulated mode

Right now we have little visibility into packet drops within netmap.
Start trying to make packet loss issues more visible by counting queue
drops in the transmit path, and in the input path for interfaces running
in emulated mode, where we place received packets in a bounded software
queue that is processed by rxsync.

Reviewed by: vmaffione
MFC after: 1 week
Sponsored by: Zenarmor
Sponsored by: OPNsense
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D38064

17 months agonetmap: Correct a comment
Mark Johnston [Mon, 23 Jan 2023 19:42:19 +0000 (14:42 -0500)]
netmap: Correct a comment

Reviewed by: vmaffione
MFC after: 1 week
Sponsored by: Zenarmor
Sponsored by: OPNsense
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D38063

17 months agonetmap: Fix a queue length check in the generic port rx path
Mark Johnston [Mon, 23 Jan 2023 19:41:55 +0000 (14:41 -0500)]
netmap: Fix a queue length check in the generic port rx path

The check is ok by default, since the default value of
netmap_generic_ringsize is 1024.  But we should check against the
configured "ring" size.

Reviewed by: vmaffione
MFC after: 1 week
Sponsored by: Zenarmor
Sponsored by: OPNsense
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D38062

17 months agonetmap: Tell the compiler to avoid reloading ring indices
Mark Johnston [Mon, 23 Jan 2023 19:41:05 +0000 (14:41 -0500)]
netmap: Tell the compiler to avoid reloading ring indices

Per the removed comments these fields should be loaded only once, since
they can in principle be modified concurrently, though this would be a
violation of the userspace contract with netmap.

No functional change intended.

Reviewed by: vmaffione
MFC after: 1 week
Sponsored by: Zenarmor
Sponsored by: OPNsense
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D38061

17 months agovtblk: secondary fix for dumping
Mitchell Horne [Mon, 9 Jan 2023 17:14:19 +0000 (13:14 -0400)]
vtblk: secondary fix for dumping

The code paths while dumping do not got through busdma. As such,
safeguard against calling bus_dmamap_sync() with a NULL map. The x86
implementation tolerates this but others do not, resulting in a
NULL dereference panic when dumping to a vtblk device on arm64, riscv,
etc.

Fixes: 782105f7c898 ("vtblk: Use busdma")
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37990

17 months agoddb: have 'reset' command use normal reboot path
Mitchell Horne [Sat, 7 Jan 2023 18:09:28 +0000 (14:09 -0400)]
ddb: have 'reset' command use normal reboot path

This conditionally gives all registered shutdown handlers a chance to
perform the reboot, with cpu_reset() being the fallback. The '\s'
modifier can be used with the command to get the previous behaviour.

The motivation is that some platforms may not be able do anything
meaningful via cpu_reset(), due to a lack of standardized reset
mechanism and/or firmware shortcomings. However, they may have a
separate device driver attached that normally performs the reboot. Such
is the case for some versions of the Raspberry Pi, where reset via PSCI
fails, but the BCM2835 watchdog driver has a shutdown hook.

Reported by: bz
Reviewed by: markj (slightly earlier version)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D37981

17 months agokern_reboot: unconditionally call shutdown_reset()
Mitchell Horne [Mon, 23 Jan 2023 18:47:11 +0000 (14:47 -0400)]
kern_reboot: unconditionally call shutdown_reset()

Currently shutdown_reset() is registered as the final entry of the
shutdown_final event handler. However, if a panic occurs early in boot
before the event is registered (SI_SUB_INTRINSIC), we may end up
spinning in the subsequent infinite for loop and failing to reset
altogether. Instead we can simply call this function unconditionally.

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

17 months agoAdd kf_file_nlink field to kf_file and populate it
Jiajie Chen [Mon, 23 Jan 2023 16:36:59 +0000 (00:36 +0800)]
Add kf_file_nlink field to kf_file and populate it

This will allow user-space programs (e.g. lsof) to locate deleted files
whose nlink equals zero. Prior to this commit, programs has to use
stat(kf_path) to get nlink, but that will fail if the file is deleted.

[mjg: s/fail/file in the commit message]

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

17 months agoblacklistd: diff reduction against upstream
Ed Maste [Mon, 23 Jan 2023 16:19:46 +0000 (11:19 -0500)]
blacklistd: diff reduction against upstream

Add `conf_` prefix, maching https://github.com/zoulasc/blocklist

Sponsored by: The FreeBSD Foundation

17 months agogrowfs(7): conditionalize mention of adding dump device
Mike Karels [Mon, 23 Jan 2023 14:37:07 +0000 (08:37 -0600)]
growfs(7): conditionalize mention of adding dump device

The growfs_fstab script will add a new swap partition as a dump
device as well, but only if dumpdev is set to AUTO.

MFC after: 3 days
Reviewed by: pauamma
Differential Revision: https://reviews.freebsd.org/D38166

17 months agoMFV: xz 5.4.1.
Xin LI [Mon, 23 Jan 2023 00:49:43 +0000 (16:49 -0800)]
MFV: xz 5.4.1.

MFC after: 3 days

17 months agonetinet6: honor blackhole/unreach routes in the non-fastforwading code.
Alexander V. Chernikov [Sun, 22 Jan 2023 16:57:36 +0000 (16:57 +0000)]
netinet6: honor blackhole/unreach routes in the non-fastforwading code.

Currently, under the conditions specified below, IPv6 ingress packet
 processing can ignore blackhole/reject flag on the prefix. The packet
 will instead be looped locally till TTL expiration and a single ICMPv6
 unreachable message will be send to the source even in case of
 RTF_BLACKHOLE.
The following conditions needs hold to make the scenario happen:
* IPv6 forwarding is enabled
* Packet is not fast-forwarded
* Destination prefix has either RTF_BLACKHOLE or RTF_REJECT flag
Fix this behavior by checking for the blackhole/reject flags in
ip6_forward().

Reported by: Dmitriy Smirnov <fox@sage.su>
Reviewed by: ae
Differential Revision: https://reviews.freebsd.org/D38164
MFC after: 3 days

17 months agoVendor import of xz 5.4.1 (trimmed)
Xin LI [Sun, 22 Jan 2023 17:32:29 +0000 (09:32 -0800)]
Vendor import of xz 5.4.1 (trimmed)

17 months agostress2: Added a regression test
Peter Holm [Sun, 22 Jan 2023 09:35:28 +0000 (10:35 +0100)]
stress2: Added a regression test

17 months agoDocument another example for "binat".
Poul-Henning Kamp [Sun, 22 Jan 2023 09:31:18 +0000 (09:31 +0000)]
Document another example for "binat".

17 months agonetpfil tests: improve pfsync_defer.py
Kajetan Staszkiewicz [Fri, 20 Jan 2023 09:43:02 +0000 (10:43 +0100)]
netpfil tests: improve pfsync_defer.py

Return different exit code depending on which failure was encountered.
The pfsync test expect a very particular failure, not just any.

MFC after: 1 week
Sponsored by: InnoGames GmbH
Differential Revision: https://reviews.freebsd.org/D38123

17 months agonetpfil tests: improve pft_ping.py
Kajetan Staszkiewicz [Sat, 21 Jan 2023 02:44:52 +0000 (03:44 +0100)]
netpfil tests: improve pft_ping.py

Multiple improvements to pft_ping.py:

* Automatically use IPv6 when IPv6 addresses are used, --ip6 is not needed.
* Building of ping requests and parsing of ping replies is done layer by
  layer. This way most arguments are available both for IPv6 and IPv4,
  for ICMP and TCP.
* Use argument groups for improved readability.
* Change ToS and TTL argument name to TC and HL to reflect the modern
  IPv6 nomenclature. The argument still set related IPv4 header fields
  properly.
* Instead of sniffing for the very specific case of duplicated packets,
  allow for sniffing on multiple interfaces.
* Report which sniffer has failed by setting bits of error code.
* Raise meaningful exceptions when irrecoverable errors happen.
* Make IPv4 fragmentation flags configurable.
* Make IPv6 HL / IPv4 TTL configurable.
* Make TCP MSS configurable.
* Make TCP sequence number configurable.
* Make ICMP payload size configurable.
* Add debug output.
* Move command line argument parsing out of network functions.
* Make the code somehow PEP-8 compliant.

MFC after: 1 week
Sponsored by: InnoGames GmbH
Differential Revision: https://reviews.freebsd.org/D38122

17 months agonetpfil tests: improve sniffer.py
Kajetan Staszkiewicz [Fri, 20 Jan 2023 01:40:34 +0000 (02:40 +0100)]
netpfil tests: improve sniffer.py

Multiple improvements to sniffer.py:

* Remove ambiguity of configuring recvif, it must be now explicitly specified.
* Don't catch exceptions around creating the sniffer, let it properly
  fail and display the whole stack trace.
* Count correct packets so that duplicates can be found.

MFC after: 1 week
Sponsored by: InnoGames GmbH
Differential Revision: https://reviews.freebsd.org/D38120

17 months agovm: centralize VM_BATCHQUEUE_SIZE definition
Andrew Gallatin [Sat, 21 Jan 2023 19:26:25 +0000 (14:26 -0500)]
vm: centralize VM_BATCHQUEUE_SIZE definition

Remove the platform-specific definitions of VM_BATCHQUEUE_SIZE
for amd64 and powerpc64, and instead treat all 64-bit platforms
identically.  This has the effect of increasing the arm64
and riscv VM_BATCHQUEUE_SIZE to match that of other platforms.

Reviewed by: jhb, markj
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D37707

17 months agonetlink: fix OOB write when creating attribute bitmask.
Alexander V. Chernikov [Sat, 21 Jan 2023 18:03:47 +0000 (18:03 +0000)]
netlink: fix OOB write when creating attribute bitmask.

Fix wrong arithmetics by moving to the standard bitset(9) functions.

Reported by: markj, KASAN

17 months agonetlink: allow creating sockets with SOCK_DGRAM.
Alexander V. Chernikov [Sat, 21 Jan 2023 14:36:23 +0000 (14:36 +0000)]
netlink: allow creating sockets with SOCK_DGRAM.

Some existing applications setup Netlink socket with
SOCK_DGRAM instead of SOCK_RAW. Update the manpage to clarify
that the default way of creating the socket should be with
SOCK_RAW. Update the code to support both SOCK_RAW and SOCK_DGRAM.

Reviewed By: pauamma
Differential Revision: https://reviews.freebsd.org/D38075

17 months agoelf: EF_ARM_EABI_VERSION_UNKNOWN is no longer used, retire
Warner Losh [Sat, 21 Jan 2023 05:11:00 +0000 (22:11 -0700)]
elf: EF_ARM_EABI_VERSION_UNKNOWN is no longer used, retire

EF_ARM_EABI_VERSION_UNKNOWN was used when we could run either eabi or
oabi. That was armv[45] only, and went away when we migrated to eabi
many major releases ago. No standard defines this symbol, so retire it.

Pointed out by: jrtc27
Sponsored by: Netflix