]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
2 years agolibkern: remove bcopy
Mateusz Guzik [Tue, 24 Aug 2021 11:21:52 +0000 (11:21 +0000)]
libkern: remove bcopy

Unused since ba96f37758412151 ("Use __builtin for various mem* and b* (e.g. bzero)
routines.")

File name remains to reduce churn.

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

2 years agomips: retire ovbcopy
Mateusz Guzik [Tue, 24 Aug 2021 08:49:31 +0000 (08:49 +0000)]
mips: retire ovbcopy

ovbcopy is unused since 9f45b2da8fa08638 ("Define ovbcopy() as a macro
which expands to the equivalent bcopy() call")

bcopy is left in place because it is used by assembly primitives

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

2 years agoarm64: retire bcopy
Mateusz Guzik [Mon, 23 Aug 2021 19:21:48 +0000 (19:21 +0000)]
arm64: retire bcopy

Unused since ba96f37758412151 ("Use __builtin for various mem* and b* (e.g. bzero)
routines.")

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

2 years agoi386: retire bcopy
Mateusz Guzik [Mon, 23 Aug 2021 19:18:49 +0000 (19:18 +0000)]
i386: retire bcopy

Unused since ba96f37758412151 ("Use __builtin for various mem* and b* (e.g. bzero)
routines.")

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

2 years agoparam: Bump __FreeBSD_version to 1400031
Ka Ho Ng [Tue, 24 Aug 2021 09:13:00 +0000 (17:13 +0800)]
param: Bump __FreeBSD_version to 1400031

Commit 1eaa36523cb9 introduces backward compatible changes to
fspacectl(2), vn_deallocate(9) and VOP_DEALLOCATE(9).
rmsr.r_offset and *offset is updated to contain meaningful value upon
returning from the call.

Sponsored by: The FreeBSD Foundation

2 years agofspacectl(2): Clarifies the return values
Ka Ho Ng [Tue, 24 Aug 2021 09:04:02 +0000 (17:04 +0800)]
fspacectl(2): Clarifies the return values

rmacklem@ spotted two things in the system call:
- Upon returning from a successful operation, vop_stddeallocate can
  update rmsr.r_offset to a value greater than file size. This behavior,
  although being harmless, can be confusing.
- The EINVAL return value for rqsr.r_offset + rqsr.r_len > OFF_MAX is
  undocumented.

This commit has the following changes:
- vop_stddeallocate and shm_deallocate to bound the the affected area
  further by the file size.
- The EINVAL case for rqsr.r_offset + rqsr.r_len > OFF_MAX is
  documented.
- The fspacectl(2), vn_deallocate(9) and VOP_DEALLOCATE(9)'s return
  len is explicitly documented the be the value 0, and the return offset
  is restricted to be the smallest of off + len and current file size
  suggested by kib@. This semantic allows callers to interact better
  with potential file size growth after the call.

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

2 years agotruncate(1): Fix cross-build CI failure due to missing fspacectl
Ka Ho Ng [Tue, 24 Aug 2021 08:26:04 +0000 (16:26 +0800)]
truncate(1): Fix cross-build CI failure due to missing fspacectl

For other platforms, fspacectl(2) is absent. This commit masks out the
calls to fspacectl(2) and replace them with a ENODEV errno.

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

2 years agoaltq: Fix panics on rmc_restart()
Kristof Provost [Sat, 21 Aug 2021 11:42:27 +0000 (13:42 +0200)]
altq: Fix panics on rmc_restart()

rmc_restart() is called from a timer, but can trigger traffic. This
means the curvnet context will not be set.
Use the vnet associated with the interface we're currently processing to
set it. We also have to enter net_epoch here, for the same reason.

Reviewed by: mjg
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D31642

2 years agoRemove bzero declaration
Mateusz Guzik [Mon, 23 Aug 2021 16:20:53 +0000 (16:20 +0000)]
Remove bzero declaration

The kernel was migrated to memset in ba96f37758412151 ("Use __builtin
for various mem* and b* (e.g. bzero) routines.") and there are no
remaining architectures using the file.

malloc is augmented to prevent KMSAN from breaking.

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

2 years agomips: retire bzero
Mateusz Guzik [Mon, 23 Aug 2021 16:26:02 +0000 (16:26 +0000)]
mips: retire bzero

Unused since ba96f37758412151 ("Use __builtin for various mem* and b* (e.g. bzero)
routines.")

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

2 years agopowerpc: retire bzero
Mateusz Guzik [Mon, 23 Aug 2021 16:19:03 +0000 (16:19 +0000)]
powerpc: retire bzero

Unused since ba96f37758412151 ("Use __builtin for various mem* and b* (e.g. bzero)
routines.")

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

2 years agoriscv: retire bzero
Mateusz Guzik [Mon, 23 Aug 2021 16:16:32 +0000 (16:16 +0000)]
riscv: retire bzero

Unused since ba96f37758412151 ("Use __builtin for various mem* and b* (e.g. bzero)
routines.")

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

2 years agoi386: retire bzero
Mateusz Guzik [Mon, 23 Aug 2021 16:15:29 +0000 (16:15 +0000)]
i386: retire bzero

Unused since ba96f37758412151 ("Use __builtin for various mem* and b* (e.g. bzero)
routines.")

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

2 years agoi386: retire bcmp
Mateusz Guzik [Mon, 23 Aug 2021 16:27:17 +0000 (16:27 +0000)]
i386: retire bcmp

Unused since ba96f37758412151 ("Use __builtin for various mem* and b* (e.g. bzero)
routines.")

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

2 years agomips: retire bcmp
Mateusz Guzik [Mon, 23 Aug 2021 16:25:19 +0000 (16:25 +0000)]
mips: retire bcmp

Unused since ba96f37758412151 ("Use __builtin for various mem* and b* (e.g. bzero)
routines.")

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

2 years agoixgbe: Avoid sbuf_trim(9) in sysctl handler
Kevin Bowling [Mon, 23 Aug 2021 16:21:39 +0000 (09:21 -0700)]
ixgbe: Avoid sbuf_trim(9) in sysctl handler

This was an error, we cannot use sbuf_trim(9) in the
ixgbe_sbuf_fw_version function because it also gets called in
the context of sbuf_new_for_sysctl(9). sbuf(9) explains the interaction
with drain functions as used by sbuf_new_for_sysctl(9).

Reviewed by: imp
Fixes: 7660e4ea5cb7
MFC after: 1 day
Differential Revision: https://reviews.freebsd.org/D31633

2 years agoRemove libkern/bcmp.c
Mateusz Guzik [Mon, 23 Aug 2021 15:40:57 +0000 (15:40 +0000)]
Remove libkern/bcmp.c

The kernel was migrated to memcmp in ba96f37758412151 ("Use __builtin
for various mem* and b* (e.g. bzero) routines.") and there are no
remaining architectures using the file.

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

2 years agopowerpc: retire bcmp
Mateusz Guzik [Mon, 23 Aug 2021 15:35:28 +0000 (15:35 +0000)]
powerpc: retire bcmp

Unused since ba96f37758412151 ("Use __builtin for various mem* and b* (e.g. bzero)
routines.")

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

2 years agoriscv: retire bcmp
Mateusz Guzik [Mon, 23 Aug 2021 15:29:32 +0000 (15:29 +0000)]
riscv: retire bcmp

Unused since ba96f37758412151 ("Use __builtin for various mem* and b* (e.g. bzero)
routines.")

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

2 years agodiff: read whole files to determine if they are ASCII text
Piotr Pawel Stefaniak [Sun, 22 Aug 2021 19:57:13 +0000 (21:57 +0200)]
diff: read whole files to determine if they are ASCII text

Before this change, only the first BUFSIZE bytes were checked.

Reviewed by: bapt (previous version)
Differential Revision: https://reviews.freebsd.org/D31639

2 years agoAdd arm64 ifunc support in static binaries
Andrew Turner [Fri, 20 Aug 2021 08:22:48 +0000 (09:22 +0100)]
Add arm64 ifunc support in static binaries

Add support for the R_AARCH64_IRELATIVE relocation type in static
binaries on arm64. This is based on the powerpc code, updating it to
use the arm64 resolver ABI, and use the arm64 relocation type.

Tested by: brd
Reviewed by: kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D31641

2 years agocache: retire cache_fast_revlookup sysctl
Mateusz Guzik [Mon, 23 Aug 2021 13:29:42 +0000 (15:29 +0200)]
cache: retire cache_fast_revlookup sysctl

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

2 years agovfs: s/__unused/__diagused in crossmp_*
Mateusz Guzik [Mon, 23 Aug 2021 10:10:38 +0000 (12:10 +0200)]
vfs: s/__unused/__diagused in crossmp_*

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

2 years agoarm: retire bzero
Mateusz Guzik [Mon, 19 Jul 2021 13:46:20 +0000 (15:46 +0200)]
arm: retire bzero

Same as bcopy.

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

2 years agoarm: flip memclr to use memset
Mateusz Guzik [Mon, 19 Jul 2021 13:46:03 +0000 (15:46 +0200)]
arm: flip memclr to use memset

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

2 years agoarm64: retire bcmp
Mateusz Guzik [Mon, 23 Aug 2021 09:46:28 +0000 (11:46 +0200)]
arm64: retire bcmp

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

2 years agoarm64: retire bzero
Mateusz Guzik [Mon, 23 Aug 2021 09:46:01 +0000 (11:46 +0200)]
arm64: retire bzero

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

2 years agoarm64: add read_frequently, read_mostluy and exclusive_cache_line to linker script
Mateusz Guzik [Mon, 23 Aug 2021 09:44:23 +0000 (11:44 +0200)]
arm64: add read_frequently, read_mostluy and exclusive_cache_line to linker script

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

2 years agonfsstat(1): Fix a typo in an error message
Gordon Bergling [Mon, 23 Aug 2021 07:21:28 +0000 (09:21 +0200)]
nfsstat(1): Fix a typo in an error message

- s/priviledged/privileged/

MFC after: 1 week

2 years agodiff3: implement --strip-trailing-cr
Piotr Pawel Stefaniak [Sat, 21 Aug 2021 00:28:58 +0000 (02:28 +0200)]
diff3: implement --strip-trailing-cr

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

2 years agodiff3.1: update manual page to match code
Piotr Pawel Stefaniak [Fri, 20 Aug 2021 22:50:05 +0000 (00:50 +0200)]
diff3.1: update manual page to match code

2 years agodiff3: improve style
Piotr Pawel Stefaniak [Fri, 20 Aug 2021 21:50:20 +0000 (23:50 +0200)]
diff3: improve style

2 years agodiff3: sync with upstream
Piotr Pawel Stefaniak [Fri, 20 Aug 2021 21:35:24 +0000 (23:35 +0200)]
diff3: sync with upstream

 * replace realloc calls with reallocarray calls
 * fix merging of files that lack newlines

Obtained from: OpenBSD

2 years agoRegister /usr/tests/usr.bin/diff3
Piotr Pawel Stefaniak [Sun, 22 Aug 2021 10:08:39 +0000 (12:08 +0200)]
Register /usr/tests/usr.bin/diff3

I wasn't able to make check to run diff3 tests, but kevans figured out
that I was missing diff3 in mtree.

2 years agodiff: don't output carriage returns that were stripped on input
Piotr Pawel Stefaniak [Sun, 22 Aug 2021 16:05:59 +0000 (18:05 +0200)]
diff: don't output carriage returns that were stripped on input

--strip-trailing-cr worked as intended for comparison between files,
but the characters were still present in final output.

2 years agolibarchive: import changes from upstream
Martin Matuska [Mon, 23 Aug 2021 00:54:15 +0000 (02:54 +0200)]
libarchive: import changes from upstream

Libarchive 3.5.2

New features:
  PR #1502: Support for PWB and v7 binary cpio formats
  PR #1509: Support of deflate algorithm in symbolic link decompression
            for ZIP archives

Important bugfixes:
  IS #1044: fix extraction of hardlinks to symlinks
  PR #1480: Fix truncation of size values during 7zip archive
            extraction on 32bit architectures
  PR #1504: fix rar header skiming
  PR #1514: ZIP excessive disk read - fix location of central directory
  PR #1520: fix double-free in CAB reader
  PR #1521: Fixed leak of rar before ending with error
  PR #1530: Handle short writes from archive_write_callback
  PR #1532: 7zip: Use compression settings from file also for file header
  IS #1566: do not follow symlinks when processing the fixup list

MFC after: 2 weeks
Relnotes: yes

2 years agoUpdate vendor/libarchive/dist to libarchive/libarchive@1b2c437b9
Martin Matuska [Mon, 23 Aug 2021 00:24:04 +0000 (02:24 +0200)]
Update vendor/libarchive/dist to libarchive/libarchive@1b2c437b9

Libarchive 3.5.2

New features:
  PR #1502: Support for PWB and v7 binary cpio formats
  PR #1509: Support of deflate algorithm in symbolic link decompression
            for ZIP archives

Important bugfixes:
  IS #1044: fix extraction of hardlinks to symlinks
  PR #1480: Fix truncation of size values during 7zip archive
            extraction on 32bit architectures
  PR #1504: fix rar header skiming
  PR #1514: ZIP excessive disk read - fix location of central directory
  PR #1520: fix double-free in CAB reader
  PR #1521: Fixed leak of rar before ending with error
  PR #1530: Handle short writes from archive_write_callback
  PR #1532: 7zip: Use compression settings from file also for file header
  IS #1566: do not follow symlinks when processing the fixup list

Obtained from: libarchive
Libarchive commit: 1b2c437b99b361c7692538fa373e99955e9b93ae
Libarchive tag: v3.5.2

2 years agorouting: Allow using IPv6 next-hops for IPv4 routes (RFC 5549).
Zhenlei Huang [Sun, 22 Aug 2021 22:28:47 +0000 (22:28 +0000)]
routing: Allow using IPv6 next-hops for IPv4 routes (RFC 5549).

Implement kernel support for RFC 5549/8950.

* Relax control plane restrictions and allow specifying IPv6 gateways
 for IPv4 routes. This behavior is controlled by the
 net.route.rib_route_ipv6_nexthop sysctl (on by default).

* Always pass final destination in ro->ro_dst in ip_forward().

* Use ro->ro_dst to exract packet family inside if_output() routines.
 Consistently use RO_GET_FAMILY() macro to handle ro=NULL case.

* Pass extracted family to nd6_resolve() to get the LLE with proper encap.
 It leverages recent lltable changes committed in c541bd368f86.

Presence of the functionality can be checked using ipv4_rfc5549_support feature(3).
Example usage:
  route add -net 192.0.0.0/24 -inet6 fe80::5054:ff:fe14:e319%vtnet0

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

2 years agovm: use __func__ for the correct function name
Bjoern A. Zeeb [Sun, 22 Aug 2021 17:21:01 +0000 (17:21 +0000)]
vm: use __func__ for the correct function name

In fee2a2fa39834d8d5eaa981298fce9d2ed31546d the KASSERTs in
vm_page_unwire_noq() changed from "vm_page_unwire" to "vm_page_unref".
While the former no longer was part of that function the latter does
not exist as a function and is highly confusing when hit when using
tools to lookup the functions and not doing a full-text search.
Use %s __func__ for printing the function name, as that will do the
right thing as code moves around and functions get renamed.

Hit: while debugging a wired page leak with linuxkpi/iwlwifi
Sponsored by: The FreeBSD Foundation
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D31635

2 years agovfs: fix cache-relatecd LOR introduced in the previous change
Mateusz Guzik [Sun, 22 Aug 2021 16:17:42 +0000 (16:17 +0000)]
vfs: fix cache-relatecd LOR introduced in the previous change

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

2 years agoFix aio_readv(2), aio_writev(2) with SIGEV_THREAD.
Thomas Munro [Sun, 22 Aug 2021 11:34:07 +0000 (23:34 +1200)]
Fix aio_readv(2), aio_writev(2) with SIGEV_THREAD.

Add missing wrapper code to librt for these new functions so that
SIGEV_THREAD works.  Without machinery to convert it to SIGEV_THREAD_ID,
you got EINVAL.

Reviewed by:    asomers
MFC after:      2 weeks
Differential Revision:  https://reviews.freebsd.org/D31618

2 years agolio_listio(2): Allow LIO_READV and LIO_WRITEV.
Thomas Munro [Sun, 22 Aug 2021 09:48:59 +0000 (21:48 +1200)]
lio_listio(2):  Allow LIO_READV and LIO_WRITEV.

Allow multiple vector IOs to be started with one system call.
aio_readv() and aio_writev() already used these opcodes under the
covers.  This commit makes them available to user space.

Being non-standard extensions, they're only visible if __BSD_VISIBLE is
defined, like the functions.

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

2 years agonetmap: import changes from upstream
Vincenzo Maffione [Sun, 22 Aug 2021 09:31:05 +0000 (09:31 +0000)]
netmap: import changes from upstream

 - make sure rings are disabled during resets
 - introduce netmap_update_hostrings_mode(), with support
   for multiple host rings
 - always initialize ni_bufs_head in netmap_if
      ni_bufs_head was not properly initialized when no external buffers were
      requestedx and contained the ni_bufs_head from the last request. This
      was causing spurious buffer frees when alternating between apps that
      used external buffers and apps that did not use them.
 - check na validitity under lock on detach
 - netmap_mem: fix leak on error path
 - nm_dispatch: fix compilation on Raspberry Pi

MFC after: 2 weeks

2 years agolltable: fix crash introduced in c541bd368f86.
Alexander V. Chernikov [Sun, 22 Aug 2021 08:47:49 +0000 (08:47 +0000)]
lltable: fix crash introduced in c541bd368f86.

Reported by: cy
MFC after: 2 weeks

2 years agorpc(3): Correct a few common typos in source code comments
Gordon Bergling [Sun, 22 Aug 2021 06:16:09 +0000 (08:16 +0200)]
rpc(3): Correct a few common typos in source code comments

- s/therfore/therefor/
- s/activte/active/

Obtained from: NetBSD
MFC after: 3 days

2 years agoext2fs(5): Correct a typo in an error message
Gordon Bergling [Sun, 22 Aug 2021 05:58:22 +0000 (07:58 +0200)]
ext2fs(5): Correct a typo in an error message

- s/talbes/tables/

MFC after: 1 week

2 years agoApply clang fix for assertion failure compiling multimedia/minitube
Dimitry Andric [Sat, 21 Aug 2021 21:03:37 +0000 (23:03 +0200)]
Apply clang fix for assertion failure compiling multimedia/minitube

Merge commit 79f9cfbc21e0 from llvm git (by Yaxun (Sam) Liu):

  Do not merge LocalInstantiationScope for template specialization

  A lambda in a function template may be recursively instantiated. The recursive
  lambda will cause a lambda function instantiated multiple times, one inside another.
  The inner LocalInstantiationScope should not be marked as MergeWithParentScope
  since it already has references to locals properly substituted, otherwise it causes
  assertion due to the check for duplicate locals in merged LocalInstantiationScope.

  Reviewed by: Richard Smith

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

Reported by: yuri
PR: 257978
MFC after: 3 days

2 years agoloader: loader_lua can run command_more twice
Toomas Soome [Sat, 21 Aug 2021 18:17:18 +0000 (21:17 +0300)]
loader: loader_lua can run command_more twice

When we quit pager, the return value 1 is returned and command_more()
interprets it as error.

when lua loader gets error from command, it will try to
interpret it once more, so we get the same file shown once more.

There is no reason why we should return error from command_more().

MFC after: 1 week

2 years agobhyve: change a default address from ANY to localhost
Mariusz Zaborski [Thu, 19 Aug 2021 18:00:35 +0000 (20:00 +0200)]
bhyve: change a default address from ANY to localhost

Discussed with:     grehan, jhb

2 years agobyhve: add option to specify IP address for gdb
Mariusz Zaborski [Thu, 19 Aug 2021 17:52:12 +0000 (19:52 +0200)]
byhve: add option to specify IP address for gdb

Allow user to specify the IP address available for gdb debugger.

Reviewed by: jhb, grehan, rgrimes, bcr (man pages)
Differential Revision: https://reviews.freebsd.org/D29607

2 years agolltable: Add support for "child" LLEs holding encap for IPv4oIPv6 entries.
Alexander V. Chernikov [Sat, 21 Aug 2021 14:13:32 +0000 (14:13 +0000)]
lltable: Add support for "child" LLEs holding encap for IPv4oIPv6 entries.

Currently we use pre-calculated headers inside LLE entries as prepend data
 for `if_output` functions. Using these headers allows saving some
 CPU cycles/memory accesses on the fast path.

However, this approach makes adding L2 header for IPv4 traffic with IPv6
 nexthops more complex, as it is not possible to store multiple
 pre-calculated headers inside lle. Additionally, the solution space is
 limited by the fact that PCB caching saves LLEs in addition to the nexthop.

Thus, add support for creating special "child" LLEs for the purpose of holding
 custom family encaps and store mbufs pending resolution. To simplify handling
 of those LLEs, store them in a linked-list inside a "parent" (e.g. normal) LLE.
 Such LLEs are not visible when iterating LLE table. Their lifecycle is bound
 to the "parent" LLE - it is not possible to delete "child" when parent is alive.
 Furthermore, "child" LLEs are static (RTF_STATIC), avoding complex state
 machine used by the standard LLEs.

nd6_lookup() and nd6_resolve() now accepts an additional argument, family,
 allowing to return such child LLEs. This change uses `LLE_SF()` macro which
 packs family and flags in a single int field. This is done to simplify merging
 back to stable/. Once this code lands, most of the cases will be converted to
 use a dedicated `family` parameter.

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

2 years agoloader: FB console does leave garbage on screen while scrolling
Toomas Soome [Sat, 21 Aug 2021 11:25:36 +0000 (14:25 +0300)]
loader: FB console does leave garbage on screen while scrolling

Scrolling screen will leave "trail" of chars from first column.
Apparently caused by cursor location mismanagement.
Make sure we do not [attempt to] set cursor out of the screen.

MFC after: 1 week

2 years agotarg(4): Remove D_NEEDGIANT.
Alexander Motin [Sat, 21 Aug 2021 15:20:54 +0000 (11:20 -0400)]
targ(4): Remove D_NEEDGIANT.

I don't believe this code needs Giant, if ever needed.

MFC after: 1 month

2 years agocam(4): Fix quick unplug/replug for SCSI.
Alexander Motin [Sat, 21 Aug 2021 13:31:41 +0000 (09:31 -0400)]
cam(4): Fix quick unplug/replug for SCSI.

If some device is plugged back in after unplug before the probe periph
destroyed, it will just restart the probe process. But I've found that
PROBE_INQUIRY_CKSUM flag not cleared between the iterations may cause
AC_FOUND_DEVICE not reported on the second iteration, and because of
AC_LOST_DEVICE reported during the first iteration, the device end up
configured, but without any periphs attached.

We've found that enabled serial console and 102-disk JBOD cause enough
probe delays to easily trigger the issue for half of the disks.  This
change fixes it reliably on my tests.

MFC after: 2 weeks
Sponsored by: iXsystems, Inc.

2 years agotruncate(1): Update tests' golden output
Ka Ho Ng [Sat, 21 Aug 2021 09:03:14 +0000 (17:03 +0800)]
truncate(1): Update tests' golden output

After commit 5ee2c35751ef truncate(1)'s usage output was extended.
Update the golden output in test cases to match the changes made.

Sponsored by: The FreeBSD Foundation
Reviewed by: lwhsu
Differential Revision: https://reviews.freebsd.org/D31628

2 years agoixl(4): Fix reporting of unqualified transceivers
Krzysztof Galazka [Fri, 20 Aug 2021 21:12:28 +0000 (14:12 -0700)]
ixl(4): Fix reporting of unqualified transceivers

When link_active_on_if_down flag is disabled and link is brought down
with ifconfig, FW reports a false positive link event about an
unqualified transceiver. The condition used in the driver to filter out
those false positive events was incorrect and caused that unqualified
module event to also not be reported when the event was valid.

Change the condition to rely on IFF_UP flag instead of
link_active_on_if_down and bump driver version to 2.3.1-k.

Signed-off-by: Krzysztof Galazka <krzysztof.galazka@intel.com>
Signed-off-by: Eric Joyner <erj@FreeBSD.org>
Reviewed by: stallamr@netapp.com, erj@
Tested by: gowtham.kumar.ks@intel.com
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D30733

2 years agointel ethernet: Use ether_gen_addr(9)
Kevin Bowling [Fri, 20 Aug 2021 14:45:30 +0000 (07:45 -0700)]
intel ethernet: Use ether_gen_addr(9)

Use ether_gen_addr(9) for VF MAC generation

Reviewed by: Intel Networking (erj), kevans
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31616

2 years agoOnly trigger read-ahead if two adjacent blocks have been requested.
Maxim Sobolev [Fri, 20 Aug 2021 19:33:51 +0000 (12:33 -0700)]
Only trigger read-ahead if two adjacent blocks have been requested.

The change makes block caching algorithm to work better for remote
media on low-BW/high-delay links.

This cuts boot time over IP KVMs noticeably, since the initialization
stage reads bunch of small 4th (and now lua) files that are not in
the same cache stripe (usually), thus wasting lot of bandwidth and
increasing latency even further.

The original regression came in 2017 with revision 87ed2b7f5. We've
seen increase of time it takes for the loader to get to the kernel
loading from under a minute to 10-15 minutes in many cases.

Reviewed by: tsoome
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D31623

2 years agoUse interruptible wait for blocking recursive unmounts
Jason A. Harmening [Sun, 8 Aug 2021 05:31:02 +0000 (22:31 -0700)]
Use interruptible wait for blocking recursive unmounts

Now that we allow recursive unmount attempts to be abandoned upon
exceeding the retry limit, we should avoid leaving an unkillable
thread when a synchronous unmount request was issued against the
base filesystem.

Reviewed by: kib (earlier revision), mkusick
Differential Revision:  https://reviews.freebsd.org/D31450

2 years agoVFS: add retry limit and delay for failed recursive unmounts
Jason A. Harmening [Sun, 8 Aug 2021 05:29:46 +0000 (22:29 -0700)]
VFS: add retry limit and delay for failed recursive unmounts

A forcible unmount attempt may fail due to a transient condition, but
it may also fail due to some issue in the filesystem implementation
that will indefinitely prevent successful unmount.  In such a case,
the retry logic in the recursive unmount facility will cause the
deferred unmount taskqueue to execute constantly.

Avoid this scenario by imposing a retry limit, with a default value
of 10, beyond which the recursive unmount facility will emit a log
message and give up.  Additionally, introduce a grace period, with
a default value of 1s, between successive unmount retries on the
same mount.

Create a new sysctl node, vfs.deferred_unmount, to export the total
number of failed recursive unmount attempts since boot, and to allow
the retry limit and retry grace period to be tuned.

Reviewed by: kib (earlier revision), mkusick
Differential Revision:  https://reviews.freebsd.org/D31450

2 years agompr(4): Fix unmatched devq release.
Alexander Motin [Fri, 20 Aug 2021 18:37:55 +0000 (14:37 -0400)]
mpr(4): Fix unmatched devq release.

Before this change devq was frozen only if some command was sent to
the target after reset started, but release was called always.  This
change freezes the devq immediately, leaving mprsas_action_scsiio()
check only to cover race condition due to different lock devq use.

This should also avoid unnecessary requeue of the commands, creating
additional log noise and confusing some broken apps.

MFC after: 2 weeks
Sponsored by: iXsystems, Inc.

2 years agovfs: remove an unused variable from nameicap_tracker_add
Mateusz Guzik [Fri, 20 Aug 2021 17:49:00 +0000 (19:49 +0200)]
vfs: remove an unused variable from nameicap_tracker_add

Reported by cc --analyze

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

2 years agovfs: use vn_lock_pair to avoid establishing an ordering on mount
Mateusz Guzik [Wed, 18 Aug 2021 21:14:16 +0000 (23:14 +0200)]
vfs: use vn_lock_pair to avoid establishing an ordering on mount

This fixes some of the LORs seen on mount/unmount.

Complete fix will require taking care of unmount as well.

Reviewed by: kib
Tested by: pho (previous version)
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D31611

2 years agoAllow rc.d script to provide "status" method, even if it does not
Maxim Sobolev [Fri, 20 Aug 2021 16:43:04 +0000 (09:43 -0700)]
Allow rc.d script to provide "status" method, even if it does not
define procname or have a PID file. This might be useful for cases,
such as mounting local FS, when there is no running daemon
still some other persistent state in the system which status
can be checked.

It is still possible to have a status method before this by having
extra_commands="status", but it's not obvious and might give
an script writer some extra legwork to figure out how and why
the straight method is not working.

Reviewed by: cy
MFC after: 1 week
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D31614

2 years agoRemove unused function mana_reset_counters.
Wei Hu [Fri, 20 Aug 2021 15:00:02 +0000 (15:00 +0000)]
Remove unused function mana_reset_counters.

This fixes the build warning caused by this function.
Reported by: markj
Tested by: whu
MFC after: 2 weeks
Sponsored by: Microsoft

2 years agoFully revert f83f5d58394db57576bbed6dc7531997cabeb102 for the sys/dev/usb/serial
Hans Petter Selasky [Fri, 20 Aug 2021 15:59:29 +0000 (17:59 +0200)]
Fully revert f83f5d58394db57576bbed6dc7531997cabeb102 for the sys/dev/usb/serial
folder, only keeping the zero length packet API introduced in sys/dev/usb
after more reports of USB serial devices not supporting ZLPs.

Reported by: mav@
MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agompr(4): Handle mprsas_alloc_tm() errors on device removal.
Alexander Motin [Fri, 20 Aug 2021 13:46:51 +0000 (09:46 -0400)]
mpr(4): Handle mprsas_alloc_tm() errors on device removal.

SAS9305-16e with firmware 16.00.01.00 report HighPriorityCredit of
only 8, while for comparison some other combinations I have report
100 or even 128.  In case of large JBOD detach requirement to send
target reset command to each target same time overflows the limit,
and without adequate handling makes devices stuck in half-detached
state, preventing later re-attach.

To handle that in case of allocation error mark the target with new
MPRSAS_TARGET_TOREMOVE flag, and retry the removal attempt next time
something else free high priority command.  With this patch I can
successfully detach/attach 102 disk JBOD from/to the SAS9305-16e.

MFC after: 2 weeks
Sponsored by: iXsystems, Inc.

2 years agolibpfctl: Fix endianness issues
Kristof Provost [Fri, 20 Aug 2021 11:43:15 +0000 (13:43 +0200)]
libpfctl: Fix endianness issues

Several fields are supplied in big-endian format, so we need to convert
them before we display them.

MFC after: 3 days
Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agosctp: improve handling of illegal parameters of INIT-ACK chunks
Michael Tuexen [Fri, 20 Aug 2021 12:03:49 +0000 (14:03 +0200)]
sctp: improve handling of illegal parameters of INIT-ACK chunks

MFC after: 3 days

2 years agoMicrosoft Azure Network Adapter(MANA) VF support
Wei Hu [Fri, 20 Aug 2021 08:43:10 +0000 (08:43 +0000)]
Microsoft Azure Network Adapter(MANA) VF support

MANA is the new network adapter from Microsoft which will be available
in Azure public cloud. It provides SRIOV NIC as virtual function to
guest OS running on Hyper-V.

The code can be divided into two major parts. Gdma_main.c is the one to
bring up the hardware board and drives all underlying hardware queue
infrastructure. Mana_en.c contains all main ethernet driver code.
It has only tested and supported on amd64 architecture.

PR: 256336
Reviewed by: decui@microsoft.com
Tested by: whu
MFC after: 2 week
Relnotes: yes
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D31150

2 years agoufs_dirhash: Correct a typo in a comment
Gordon Bergling [Fri, 20 Aug 2021 07:59:18 +0000 (09:59 +0200)]
ufs_dirhash: Correct a typo in a comment

- s/memry/memory/

MFC after: 3 days

2 years agoPartial revert of f83f5d58394db57576bbed6dc7531997cabeb102 for uftdi(4).
Hans Petter Selasky [Fri, 20 Aug 2021 07:52:32 +0000 (09:52 +0200)]
Partial revert of f83f5d58394db57576bbed6dc7531997cabeb102 for uftdi(4).
Apparently devices with bcdDevice less than 0x0600, have problems receiving ZLPs.

Reported by: kevlo@
MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agols: prevent no-color build from complaining when COLORTERM is non-empty
Piotr Pawel Stefaniak [Wed, 18 Aug 2021 20:47:37 +0000 (22:47 +0200)]
ls: prevent no-color build from complaining when COLORTERM is non-empty

As 257886 reports, if ls(1) is built with WITHOUT_LS_COLORS="YES", it
issues a warning whenever COLORTERM is non-empty. The warning is not
useful, so I thought to remove it, but as Ed pointed out, we may want
to have a way to determine whether a particular copy of ls has been
compiled with color support or not.

Therefore move the warnx() call to the getopt loop in
a WITHOUT_LS_COLORS build to fire when the user asks for colored output.

PR: 257886
Reported by: Marko Turk
Reviewed by: kevans

2 years agocrunch: drop WARNS override
Kyle Evans [Thu, 19 Aug 2021 06:33:13 +0000 (01:33 -0500)]
crunch: drop WARNS override

crunchide and crunchgen now build fine with default WARNS

2 years agocrunchgen: fix remaining issues under WARNS=6
Kyle Evans [Thu, 19 Aug 2021 06:22:16 +0000 (01:22 -0500)]
crunchgen: fix remaining issues under WARNS=6

Entirely variables that should be static, save for one 'no previous
declaration' in mkskel.sh.

Reviewed by: arichardson, imp
Differential Revision: https://reviews.freebsd.org/D31610

2 years agocrunchide: static'ify remaining non-exported functions
Kyle Evans [Thu, 19 Aug 2021 06:29:02 +0000 (01:29 -0500)]
crunchide: static'ify remaining non-exported functions

Reviewed by: arichardson, imp
Differential Revision: https://reviews.freebsd.org/D31609

2 years agocrunchide: address complaints from WARNS=6
Kyle Evans [Thu, 19 Aug 2021 06:17:36 +0000 (01:17 -0500)]
crunchide: address complaints from WARNS=6

- One (1) constify
- One (1) argument is unused
- One (1) local shadows a global
- Various globals that should be static

Reviewed by: arichardson, imp
Differential Revision: https://reviews.freebsd.org/D31608

2 years agocrunchgen: sprinkle some const-poisoning around
Kyle Evans [Thu, 19 Aug 2021 06:13:13 +0000 (01:13 -0500)]
crunchgen: sprinkle some const-poisoning around

Reviewed by: arichardson, imp
Differential Revision: https://reviews.freebsd.org/D31607

2 years agolocaledef: unbreak WITHOUT_LOCALES
Bjoern A. Zeeb [Thu, 19 Aug 2021 17:27:04 +0000 (12:27 -0500)]
localedef: unbreak WITHOUT_LOCALES

After 0fa5403d493b ("pkgbase: move locales into their own package") we
need usr.bin/localedef as a bootstrap tool independent on where
WITHOUT_LOCALE was specified as we ALWAYS process C.UTF-8.

At the same time LOCALES= in the local Makefile is empty but
C.UTF-8 with WITHOUT_LOCALES. C.UTF-8 is excluded from FILES, and thus
after the replacement FILES= is set to only .LC_CTYPE which results in
a build failure not knowing how to build that. Tweak the substitution to
replace only non-empty words so that FILES remains harmlessly empty.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D31589

2 years agoDisable the accelerated arm64 sha25 in static libraries
Andrew Turner [Thu, 19 Aug 2021 16:48:30 +0000 (16:48 +0000)]
Disable the accelerated arm64 sha25 in static libraries

We don't have ifunc support in static arm64 binaries. Until we do
disable the accelerated sha256 code in a static libmd as it uses an
ifunc.

Reported by: brd
Sponsored by: The FreeBSD Foundation

2 years agoe1000: Update intel shared code
Kevin Bowling [Thu, 19 Aug 2021 14:59:34 +0000 (07:59 -0700)]
e1000: Update intel shared code

Sync the e1000 shared code with DPDK shared code
"cid-gigabit.2020.06.05.tar.gz released by ND"

Primary focus was on client platforms (ich8lan). More work remains here
but we need an Intel contact for client networking.

Reviewed by: grehan, Intel Networking (erj, earlier rev)
Obtained from: DPDK <http://git.dpdk.org/dpdk/tree/drivers/net/e1000/base>
MFC after: 1 week
Sponsored by: me
Differential Revision: https://reviews.freebsd.org/D31547

2 years agolibsa: cstyle cleanup of dosfs.c
Toomas Soome [Thu, 19 Aug 2021 14:33:24 +0000 (17:33 +0300)]
libsa: cstyle cleanup of dosfs.c

No functional changes intended.

MFC after: 1 week

2 years agodhclient: skip_to_semi() consumes semicolon already
Franco Fichtner [Thu, 19 Aug 2021 13:11:38 +0000 (09:11 -0400)]
dhclient: skip_to_semi() consumes semicolon already

When invalid statement is found the next statement is skipped even if it
is valid.

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

2 years agodhclient: remove patching of static values in BPF programs
Franco Fichtner [Thu, 19 Aug 2021 13:08:59 +0000 (09:08 -0400)]
dhclient: remove patching of static values in BPF programs

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

2 years agortsold: make it work on if_vlan interfaces
Luiz Otavio O Souza [Thu, 19 Aug 2021 09:48:04 +0000 (11:48 +0200)]
rtsold: make it work on if_vlan interfaces

Reviewed by: kp
Obtained from: pfsense
MFC after: 1 week

2 years agotruncate(1): Fix missing -d option manpage
Ka Ho Ng [Thu, 19 Aug 2021 10:45:25 +0000 (18:45 +0800)]
truncate(1): Fix missing -d option manpage

Mention that either one of the -r, -s and -d options must be specified.

Sponsored by: The FreeBSD Foundation

2 years agotruncate(1): Add hole-punching support
Ka Ho Ng [Thu, 19 Aug 2021 10:30:41 +0000 (18:30 +0800)]
truncate(1): Add hole-punching support

This commit adds hole-punching support to the truncate(1) utility. If
the option -d is specified, truncate(1) performs zeroing, and if
possible hole-punching in case the operation is supported by the
underlying file system of the specified files.

Sponsored by: The FreeBSD Foundation
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D31556

2 years agomd: Replace BIO_DELETE emulation with vn_deallocate(9)
Ka Ho Ng [Thu, 19 Aug 2021 10:30:13 +0000 (18:30 +0800)]
md: Replace BIO_DELETE emulation with vn_deallocate(9)

Both zero-filling and/or deallocation can be done with vn_deallocate(9).

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

2 years agopf: implement set-tos for IPv6
Samuel Robinette [Sun, 15 Aug 2021 18:26:41 +0000 (20:26 +0200)]
pf: implement set-tos for IPv6

Extend the existing set-tos keyword to also be able to set traffic class
on IPv6 traffic.
Add tests for this as well.

Reviewed by: kp
Differential Revision: https://reviews.freebsd.org/D31564

2 years agolagg: don't update link layer addresses on destroy
Luiz Otavio O Souza [Tue, 17 Aug 2021 14:23:50 +0000 (16:23 +0200)]
lagg: don't update link layer addresses on destroy

When the lagg is being destroyed it is not necessary update the
lladdr of all the lagg members every time we update the primary
interface.

Reviewed by: scottl
Obtained from: pfSense
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D31586

2 years agoipfw: use unsigned int for dummynet bandwidth
Luiz Otavio O Souza [Tue, 17 Aug 2021 07:54:40 +0000 (09:54 +0200)]
ipfw: use unsigned int for dummynet bandwidth

This allows the maximum value of 4294967295 (~4Gb/s) instead of previous
value of 2147483647 (~2Gb/s).

Reviewed by: np, scottl
Obtained from: pfSense
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D31582

2 years agosh: fix NO_HISTORY build
Piotr Pawel Stefaniak [Wed, 18 Aug 2021 20:40:39 +0000 (22:40 +0200)]
sh: fix NO_HISTORY build

Move code added in b315a7296d2a ("autocomplete commands") to
conditionally compiled part under #ifndef NO_HISTORY.

Reported by: bdrewery
Fixes: b315a7296d2a

2 years agosctp: improve handling of INIT chunks with invalid parameters
Michael Tuexen [Wed, 18 Aug 2021 22:31:35 +0000 (00:31 +0200)]
sctp: improve handling of INIT chunks with invalid parameters

MFC after: 3 days

2 years agogeli(8): Do not report error on resize to the same size.
Alexander Motin [Wed, 18 Aug 2021 21:11:03 +0000 (17:11 -0400)]
geli(8): Do not report error on resize to the same size.

Just validate the old metadata and exit.  Originally the check was
added to not thash the only copy of metadata, but we can achieve the
same just by skipping the writing/trashing.  The metadata validation
should protect user from wrongly specifying new size instead of old.

MFC after: 1 month
Sponsored by: iXsystems, Inc.

2 years agoiscsi: Teach the iSCSI stack about "large" received PDUs.
John Baldwin [Wed, 18 Aug 2021 17:56:28 +0000 (10:56 -0700)]
iscsi: Teach the iSCSI stack about "large" received PDUs.

When using iSCSI PDU offload (cxgbei) on T6 adapters, a burst of
received PDUs can be reported via a single message to the driver.

Previously the driver passed these multi-PDU bursts up to the iSCSI
stack up as a single "large" PDU by rewriting the buffer offset, data
segment length, and DataSN fields in the iSCSI header.  The DataSN
field in particular was rewritten so that each of the "large" PDUs
used consecutively increasing values.  While this worked, the forged
DataSN values did not match the ExpDataSN value in the subsequent SCSI
Response PDU.  The initiator does not currently verify this value, but
the forged DataSN values prevent adding a check.

To avoid this, allow a logical iSCSI PDU (struct icl_pdu) to describe
a burst of PDUs via a new 'ip_additional_pdus' field.  Normally this
field is set to zero when 'struct icl_pdu' represents a single PDU.
If logical PDU represents a burst of on-the-wire PDUs, then 'ip_npdus'
contains the count of additional on-the-wire PDUs.  The header of this
"large" PDU is still modified, but the DataSN field now contains the
DataSN value of the first on-the-wire PDU in the burst.

Reviewed by: mav
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D31577

2 years agouipc: avoid circular pr_{slow,fast}timos
Kyle Evans [Wed, 18 Aug 2021 17:31:45 +0000 (12:31 -0500)]
uipc: avoid circular pr_{slow,fast}timos

domain_init() gets reinvoked for each vnet on a system, so we must not
alter global state.  Practically speaking, we were creating circular
lists and tying up a softclock thread into an infinite loop.

The breakage here was most easily observed by simply creating a jail
in a new vnet and watching the system suddenly become erratic.

Reported by: markj
Fixes: e0a17c3f063f ("uipc: create dedicated lists for fast ...")
Pointy hat: kevans

2 years agovmm: Add credential to cdev object
Cyril Zhang [Wed, 18 Aug 2021 17:41:33 +0000 (13:41 -0400)]
vmm: Add credential to cdev object

Add a credential to the cdev object in sysctl_vmm_create(), then check
that we have the correct credentials in sysctl_vmm_destroy(). This
prevents a process in one jail from opening or destroying the /dev/vmm
file corresponding to a VM in a sibling jail.

Add regression tests.

Reviewed by: jhb, markj
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D31156

2 years agodhclient: support supersede statement for option 54
Fabian Kurtz [Wed, 18 Aug 2021 17:12:48 +0000 (10:12 -0700)]
dhclient: support supersede statement for option 54

PR: 217978
Reported by: Franco Fichtner <franco@opnsense.org>
Reviewed by: markj
Obtained from: OPNsense
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31503

2 years agogre: simplify RSS ifdefs
Franco Fichtner [Wed, 18 Aug 2021 17:05:29 +0000 (10:05 -0700)]
gre: simplify RSS ifdefs

Use the early break to avoid else definitions. When RSS gains a
runtime option previous constructs would duplicate and convolute
the existing code.

While here init flowid and skip magic numbers and late default
assignment.

Reviewed by: melifaro, kbowling
Obtained from: OPNsense
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31584

2 years agotruncate(1): main() return statement style fix
Ka Ho Ng [Wed, 18 Aug 2021 15:45:20 +0000 (23:45 +0800)]
truncate(1): main() return statement style fix

Sponsored by: The FreeBSD Foundation