]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agoMake sysctl user.local a tunable that can be written at run-time
Stefan Eßer [Sat, 31 Oct 2020 23:48:41 +0000 (23:48 +0000)]
Make sysctl user.local a tunable that can be written at run-time

This sysctl value had been provided as a read-only variable that is
compiled into the C library based on the value of _PATH_LOCALBASE in
paths.h.

After this change, the value is compiled into the kernel as an empty
string, which is translated to _PATH_LOCALBASE by the C library.

This empty string can be overridden at boot time or by a privileged
user at run time and will then be returned by sysctl.

When set to an empty string, the value returned by sysctl reverts to
_PATH_LOCALBASE.

This update does not change the behavior on any system that does
not modify the default value of user.localbase.

I consider this change as experimental and would prefer if the run-time
write permission was reconsidered and the sysctl variable defined with
CLFLAG_RDTUN instead to restrict it to be set at boot time.

MFC after: 1 month

3 years agoacpi_dock(4): Add ACPI_PNP_INFO
Vladimir Kondratyev [Sat, 31 Oct 2020 22:20:42 +0000 (22:20 +0000)]
acpi_dock(4): Add ACPI_PNP_INFO

MFC after: 2 weeks

3 years agoacpi_wmi(4): Add ACPI_PNP_INFO
Vladimir Kondratyev [Sat, 31 Oct 2020 22:19:39 +0000 (22:19 +0000)]
acpi_wmi(4): Add ACPI_PNP_INFO

MFC after: 2 weeks

3 years agoAdd plug and play information macroses for ACPI and I2C buses.
Vladimir Kondratyev [Sat, 31 Oct 2020 22:15:59 +0000 (22:15 +0000)]
Add plug and play information macroses for ACPI and I2C buses.

Matching table format is compatible with ACPI_ID_PROBE bus method.

Note that while ACPI_ID_PROBE matches against _HID and all _CIDs, current
acpi_pnpinfo_str() exports only _HID and first _CID.  That means second
and further _CIDs should be added to both acpi_pnpinfo_str() and
ACPICOMPAT_PNP_INFO if device matching against them is required.

Reviewed by: imp
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D26824

3 years agoFix 32-bit build after r367209
Brandon Bergren [Sat, 31 Oct 2020 22:14:37 +0000 (22:14 +0000)]
Fix 32-bit build after r367209

Fix build on systems with a 32-bit size_t.

Since it's being passed as a pointer, a 64-bit write to it will overflow.

MFC with: r367209

3 years agodevmatch(8): Respect mask field when matching strings of Z type.
Vladimir Kondratyev [Sat, 31 Oct 2020 22:04:13 +0000 (22:04 +0000)]
devmatch(8): Respect mask field when matching strings of Z type.

While here, add debug output for this action.

Reviewed by: imp
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D26823

3 years agoImplement the USB_GET_DEVICEINFO ioctl(2) for uhid(4).
Hans Petter Selasky [Sat, 31 Oct 2020 21:53:23 +0000 (21:53 +0000)]
Implement the USB_GET_DEVICEINFO ioctl(2) for uhid(4).

Submitted by: pedro martelletto <pedro@ambientworks.net>
MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agoFix 32-bit build after r367229.
Brandon Bergren [Sat, 31 Oct 2020 21:11:34 +0000 (21:11 +0000)]
Fix 32-bit build after r367229.

The use of atomic_sub_64() in zfs_zstd.c was breaking the 32-bit build on
platforms without native 64-bit atomics due to atomic_sub_64() not being
available, and no fallback being provided in _STANDALONE.

Provide a standalone stub to match atomic_add_64() using simple math.

While this is not actually atomic, it does not matter in libsa context,
since it always runs single-threaded and does not run under a scheduler.

Reviewed by: mjg (in email)

3 years agoacpi_video(4): Put display device in to D3 state on "Display off" event.
Vladimir Kondratyev [Sat, 31 Oct 2020 20:28:13 +0000 (20:28 +0000)]
acpi_video(4):  Put display device in to D3 state on "Display off" event.

As required by ACPI specs 6.3, appendix A.6, table B-8.

3 years agoacpi_video(4): Add evdev support for reporting of video events.
Vladimir Kondratyev [Sat, 31 Oct 2020 20:25:55 +0000 (20:25 +0000)]
acpi_video(4): Add evdev support for reporting of video events.

3 years agoacpi(9): Add EVENTHANDLERs for video and AC adapter events.
Vladimir Kondratyev [Sat, 31 Oct 2020 20:14:28 +0000 (20:14 +0000)]
acpi(9): Add EVENTHANDLERs for video and AC adapter events.

They are required for coming ACPI support in LinuxKPI.

Reviewed by: hselasky, manu (as part of D26603)

3 years agoacpi: Tweak _DSM method evaluation helpers.
Vladimir Kondratyev [Sat, 31 Oct 2020 19:47:34 +0000 (19:47 +0000)]
acpi: Tweak _DSM method evaluation helpers.

- Use ACPI style for _DSM evaluation helper parameter types.
- Constify UUID parameter.
- Increase size of returned DSM function bitmap by acpi_DSMQuery() up to 64
  items. Old limit of 8 functions is not sufficient for JEDEC JESD245 NVDIMMs.
- Add new acpi_EvaluateDSMTyped() helper which performs additional return
  value type check as compared with acpi_EvaluateDSM().
- Reimplement acpi_EvaluateDSM() on top of the acpi_EvaluateDSMTyped() call.

Reviewed by: scottph, manu
Differential Revision: https://reviews.freebsd.org/D26602

3 years agoig4(4): Add PCI IDs for Intel Comit Lake I2C controllers.
Vladimir Kondratyev [Sat, 31 Oct 2020 19:30:23 +0000 (19:30 +0000)]
ig4(4): Add PCI IDs for Intel Comit Lake I2C controllers.

MFC after: 2 weeks

3 years agozfs: zstd: track allocator statistics
Mateusz Guzik [Sat, 31 Oct 2020 19:07:32 +0000 (19:07 +0000)]
zfs: zstd: track allocator statistics

This applies:
commit c4ede65bdfca11b532403620bbf0d6e33f0c1c1d
Author: Mateusz Guzik <mjguzik@gmail.com>
Date:   Fri Oct 30 23:26:10 2020 +0100

    zstd: track allocator statistics

    Note that this only tracks sizes as requested by the caller.
    Actual allocated space will almost always be bigger (e.g., rounded up to
    the next power of 2 or page size). Additionally the allocated buffer may
    be holding other areas hostage. Nonetheless, this is a starting point
    for tracking memory usage in zstd.

from openzfs

3 years agoMention the more strict consistency checks performed by calendar(), which
Stefan Eßer [Sat, 31 Oct 2020 16:39:27 +0000 (16:39 +0000)]
Mention the more strict consistency checks performed by calendar(), which
can make the program abort with an error message on previously accepted
but malformed input files.

3 years agoreadelf: Add -z decompression support
Ed Maste [Sat, 31 Oct 2020 15:27:45 +0000 (15:27 +0000)]
readelf: Add -z decompression support

Compatible with GNU readelf, -z decompresses sections displayed by
-x or -p.

ELF Tool Chain ticket #555
https://sourceforge.net/p/elftoolchain/tickets/555/

Submitted by: Tiger Gao <tig@FreeBSDFoundation.org>
Reviewed by: markj
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision:    https://reviews.freebsd.org/D26909

3 years agoImprove calendar file parsing and consistency tests
Stefan Eßer [Sat, 31 Oct 2020 15:11:24 +0000 (15:11 +0000)]
Improve calendar file parsing and consistency tests

Add line number information to more warning and error messages.
Detect #else and #endif without corresponing #ifdef/#ifndef as error.
Detect missing #endif at end of file and print warning but continue.

Support for #undef has been added to reverse the effect of a prior #define.
It is no error if the argument value has not been defined before.

These changes may cause error aborts on malformed input files (e.g. with
spurious #else or #endif), but no such errors exist in the calendar files
in the FreeBSD base system and the calendar-data port and all tests pass.

More tests will be added in a follow-up commit to detect regressions that
might affect the newly added features.

This commit ends a series of updates that enhance the pre-processor and
make it behave much more like prior versions of the calendar progarm that
called cpp to pre-process the data files.

MFC after: 3 days
Relnotes: yes

3 years agoAdd file names and line numbers to debug messages
Stefan Eßer [Sat, 31 Oct 2020 13:55:10 +0000 (13:55 +0000)]
Add file names and line numbers to debug messages

MFC after: 3 days

3 years agoAdd file names and line numbers to calendar format error messages
Stefan Eßer [Sat, 31 Oct 2020 13:32:08 +0000 (13:32 +0000)]
Add file names and line numbers to calendar format error messages

Without file name and line number it is very cumbersum to identify the
locations of errors in calendar files.

MFC after: 3 days

3 years agoFix reversed condition after attempted style fix in r367196
Stefan Eßer [Sat, 31 Oct 2020 12:10:43 +0000 (12:10 +0000)]
Fix reversed condition after attempted style fix in r367196

Reported by: xtouqh@hotmail.com
MFC after: 3 days

3 years agoFix style, no functional change
Stefan Eßer [Sat, 31 Oct 2020 11:44:10 +0000 (11:44 +0000)]
Fix style, no functional change

Submitted by: kib
MFC after: 3 days

3 years agoAttempt to defuse a land mine before anyone else steps on it: The
Colin Percival [Sat, 31 Oct 2020 03:36:31 +0000 (03:36 +0000)]
Attempt to defuse a land mine before anyone else steps on it: The
freebsd-boot partition is not always the first one.

Following the instructions in UPDATING resulted in my overwriting
the efiboot0 partition on my laptop with ZFS boot blocks, which
had negative effects on the system's bootability.

Reviewed by: allanjude
Differential Revision: https://reviews.freebsd.org/D27002

3 years agolinux(4): Add missing clone(2) flags
Conrad Meyer [Sat, 31 Oct 2020 01:12:35 +0000 (01:12 +0000)]
linux(4): Add missing clone(2) flags

3 years agoIntegrate 4.4BSD-Lite2 changes to IOC_* definitions
Warner Losh [Fri, 30 Oct 2020 22:00:35 +0000 (22:00 +0000)]
Integrate 4.4BSD-Lite2 changes to IOC_* definitions

Bring in the long-overdue 4.4BSD-Lite2 rev 8.3 by cgd of
sys/ioccom.h. This uses UL suffix for the IOC_* constants so they
don't sign extend. Also bring in the handy diagram from NetBSD's
version of this file. This alters the 4.4BSD-Lite2 code slightly
in a way that's semantically the same but more compact.

This should stop the warnings from Chrome for bogus sign extension.

Reviewed by: kib@, jhb@
Differential Revision: https://reviews.freebsd.org/D26423

3 years agoUse a dynamic buffer for the copy of a node's new value.
John Baldwin [Fri, 30 Oct 2020 21:13:05 +0000 (21:13 +0000)]
Use a dynamic buffer for the copy of a node's new value.

This permits setting a node's value to a string longer than BUFSIZ.

Reported by: Sony Arpita Das @ Chelsio
Reviewed by: freqlabs
MFC after: 1 week
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D27027

3 years agoRemove IF_SND_TAG_TYPE_TLS_RATE_LIMIT conditionals.
John Baldwin [Fri, 30 Oct 2020 21:05:50 +0000 (21:05 +0000)]
Remove IF_SND_TAG_TYPE_TLS_RATE_LIMIT conditionals.

Support for TLS rate limit tags is now in the tree, so this macro is
always defined.

Reviewed by: hselasky
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D27020

3 years agomalloc: delegate M_EXEC handling to dedicacted routines
Mateusz Guzik [Fri, 30 Oct 2020 20:02:32 +0000 (20:02 +0000)]
malloc: delegate M_EXEC handling to dedicacted routines

It is almost never needed and adds an avoidable branch.

While here do minior clean ups in preparation for larger changes.

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

3 years agoAdd ossl(4) to cryptotest.
Jung-uk Kim [Fri, 30 Oct 2020 19:53:16 +0000 (19:53 +0000)]
Add ossl(4) to cryptotest.

3 years agoUpdate man-pages to describe the user.localbase variable added in r367179.
Stefan Eßer [Fri, 30 Oct 2020 19:37:53 +0000 (19:37 +0000)]
Update man-pages to describe the user.localbase variable added in r367179.

MFC after: 3 days

3 years agobectl(8): missing flag in the help message
Luca Pizzamiglio [Fri, 30 Oct 2020 19:37:34 +0000 (19:37 +0000)]
bectl(8): missing flag in the help message

Flag -o for destroy subcommand is missing in the help message,
but present in the man page. Fix it.

PR: 249325
Approved by: kevans
Differential Revision: https://reviews.freebsd.org/D26429

3 years agolinux(4): Quiesce warning about madvise(..., -1)
Conrad Meyer [Fri, 30 Oct 2020 19:02:59 +0000 (19:02 +0000)]
linux(4): Quiesce warning about madvise(..., -1)

This API misuse is intended to produce an error value to detect certain
bogus stub implementations of MADV_WIPEONFORK.  We don't need to log a
warning about it.

Example:
https://boringssl.googlesource.com/boringssl/+/ad5582985cc6b89d0e7caf0d9cc7e301de61cf66%5E%21/

Reviewed by: emaste, trasz
Differential Revision: https://reviews.freebsd.org/D27017

3 years agoUFS2: Fix DoS due to corrupted extattrfile
Conrad Meyer [Fri, 30 Oct 2020 19:00:42 +0000 (19:00 +0000)]
UFS2: Fix DoS due to corrupted extattrfile

Prior versions of FreeBSD (11.x) may have produced a corrupt extattr file.
(Specifically, r312416 accidentally fixed this defect by removing a strcpy.)
CURRENT FreeBSD supports disk images from those prior versions of FreeBSD.
Validate the internal structure as soon as we read it in from disk, to
prevent these extattr files from causing invariants violations and DoS.

Attempting to access the extattr portion of these files results in
EINTEGRITY.  At this time, the only way to repair files damaged in this way
is to copy the contents to another file and move it over the original.

PR: 244089
Reported by: Andrea Venturoli <ml AT netfence.it>
Reviewed by: kib
Discussed with: mckusick (earlier draft)
Security: no
Differential Revision: https://reviews.freebsd.org/D27010

3 years agoAdd help messages for camcontrol(8) MMCCAM functionality
Ilya Bakulin [Fri, 30 Oct 2020 18:55:08 +0000 (18:55 +0000)]
Add help messages for camcontrol(8) MMCCAM functionality

This adds the help messages for camcontrol(8) in-binary help.
Man page will follow in the separate change.

Reviewed by: bz
Approved by: imp (mentor)
Differential Revision: https://reviews.freebsd.org/D25963

3 years agoAdd read only sysctl variable user.localbase
Stefan Eßer [Fri, 30 Oct 2020 18:48:09 +0000 (18:48 +0000)]
Add read only sysctl variable user.localbase

The value is provided by the C library as for other sysctl variables in
the user tree. It is compiled in and returns the value of _PATH_LOCALBASE
defined in paths.h.

Reviewed by: imp, scottl
Differential Revision: https://reviews.freebsd.org/D27009

3 years agoarm64: set the correct partition type in make-memstick.sh
Mitchell Horne [Fri, 30 Oct 2020 18:22:46 +0000 (18:22 +0000)]
arm64: set the correct partition type in make-memstick.sh

We create a UFS root filesystem using makefs(8), and later pass it to
mkimg(1) when creating the final image. The correct partition type is
freebsd-ufs; the freebsd parition type is for partitions containing a
BSD disklabel.

Reviewed by: emaste
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D26987

3 years agoarm64: convert virtual machine images to GPT
Mitchell Horne [Fri, 30 Oct 2020 18:20:52 +0000 (18:20 +0000)]
arm64: convert virtual machine images to GPT

These images were switched to MBR in r281876 as a way to cope with a
hard-coded partition GUID in QEMU's default EFI firmware. Enough time
has passed that this is no longer a problem; QEMU versions >= 4.0
include a copy of edk2 EFI firmware that can detect the root filesystem
properly. Alternatively, sysutils/u-boot-qemu-arm64 can be used.

Switch back to building these images with a GPT partition table, and
re-enable the swap partition.

Reviewed by: gjb, emaste
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D26986

3 years agovmimage.subr: noisier failure for unsupported targets
Mitchell Horne [Fri, 30 Oct 2020 18:18:25 +0000 (18:18 +0000)]
vmimage.subr: noisier failure for unsupported targets

The return code of write_partition_layout() doesn't bubble up, so an
invocation of make vm-release for an incorrect/unsupported target will
appear to succeed while make vm-install will fail due to missing
files. This isn't a common point of failure, but is worth handling
properly.

Upgrade this case to print a message to stderr, and exit in place. This
is okay to do since at this point in the execution of mk-vmimage.sh,
cleanup() has already been run.

Reviewed by: gjb
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D26985

3 years agoSlight refactor in vmimage.subr
Mitchell Horne [Fri, 30 Oct 2020 18:16:10 +0000 (18:16 +0000)]
Slight refactor in vmimage.subr

De-duplicate the invocation of mkimg(1). No functional change.

Reviewed by: gjb
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D26984

3 years agoopencrypto: Annotate hmac_init_(i|o)pad() to make auth_hash const
Mark Johnston [Fri, 30 Oct 2020 17:05:36 +0000 (17:05 +0000)]
opencrypto: Annotate hmac_init_(i|o)pad() to make auth_hash const

This makes them friendlier to drivers that try to use const pointers
whenever possible in their internal structures.

Reviewed by: jhb
Sponsored by: Rubicon Communications, LLC (Netgate)
Differential Revision: https://reviews.freebsd.org/D26901

3 years agoPrint calendar entries in the order they occur
Stefan Eßer [Fri, 30 Oct 2020 15:43:52 +0000 (15:43 +0000)]
Print calendar entries in the order they occur

The calendar program used to output entries in reverse order, due to the
way an internal linked list was built up.

A regression test with 2 entries for the same day has been adapted to the
now non-reversed order.

MFC after: 3 days

3 years agoRevert debug output committed in r367166 by accident
Stefan Eßer [Fri, 30 Oct 2020 14:34:51 +0000 (14:34 +0000)]
Revert debug output committed in r367166 by accident

MFC after: 3 days

3 years agoFix length calculation in memmove
Stefan Eßer [Fri, 30 Oct 2020 14:32:13 +0000 (14:32 +0000)]
Fix length calculation in memmove

MFC after: 3 days

3 years agotmpfs: change tmpfs dirent zone into a malloc type
Mateusz Guzik [Fri, 30 Oct 2020 14:07:25 +0000 (14:07 +0000)]
tmpfs: change tmpfs dirent zone into a malloc type

It is 64 bytes.

3 years agovfs: change vnode poll to just a malloc type
Mateusz Guzik [Fri, 30 Oct 2020 14:02:56 +0000 (14:02 +0000)]
vfs: change vnode poll to just a malloc type

The size is 120, close fit for 128 and rarely used. The infrequent use
avoidably populates per-CPU caches and ends up with more memory.

3 years agonet: add ETHER_IS_IPV6_MULTICAST
Mitchell Horne [Fri, 30 Oct 2020 13:32:58 +0000 (13:32 +0000)]
net: add ETHER_IS_IPV6_MULTICAST

This can be used to detect if an ethernet address is specifically an
IPv6 multicast address, defined in accordance to RFC 2464.

ETHER_IS_MULTICAST is still preferred in the general case.

Reviewed by: ae
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D26611

3 years agocache: add cache_vop_mkdir and rename cache_rename to cache_vop_rename
Mateusz Guzik [Fri, 30 Oct 2020 10:46:35 +0000 (10:46 +0000)]
cache: add cache_vop_mkdir and rename cache_rename to cache_vop_rename

3 years agoRe-implement comment parsing missing in the internal pre-processor
Stefan Eßer [Fri, 30 Oct 2020 10:44:46 +0000 (10:44 +0000)]
Re-implement comment parsing missing in the internal pre-processor

The internal pre-processor ignored lines that did not parse a calendar
entries, but did not support multi-line comments in the way the external
cpp did.

The calendar files distributed with the base system (now in a port) do
use comments, though.

Implement comment processing for single-line (//) and multi-line comments
(/* */) with same semantics as in a standard C pre-processor.

All tests pass with this version, but there are no tests that specifically
verify comment processing.

Reported by: jhs@berklix.com (Julian H. Stacey)
MFC after: 3 days

3 years agofetch(1): Fix style
Fernando Apesteguía [Fri, 30 Oct 2020 09:48:41 +0000 (09:48 +0000)]
fetch(1): Fix style

Fix style problems introduced in r367141:

* s/Ql/Pa/ for file names
* Break line properly in macro
* Properly generate back slash character

Not bumping .Dd

Reported by: xtouqh@icloud.com, steffen@sdaoden.eu
Approved by: 0mp@
Differential Revision: https://reviews.freebsd.org/D26946

3 years agobeinstall.sh: Use bectl instead of beadm by default
Mateusz Piotrowski [Fri, 30 Oct 2020 09:40:55 +0000 (09:40 +0000)]
beinstall.sh: Use bectl instead of beadm by default

This patch also introduces an environment variable BE_UTILITY,
which can be used to specify the utility to use for managing
ZFS boot environments (which can be either bectl or beadm).

While here, fix some typos in the manual page and
remove beadm from section "SEE ALSO".

Reviewed by: bcr, kevans, rpokala
Approved by: will
Differential Revision: https://reviews.freebsd.org/D21111

3 years agoFix a couple of silly bugs in r367149.
John Baldwin [Fri, 30 Oct 2020 00:06:36 +0000 (00:06 +0000)]
Fix a couple of silly bugs in r367149.

- Assign the TLS rate limit value to the correct member of the
  rl_params for the nested rate limit tag.

- Remove a dead condition.

Pointy hat to: jhb

3 years agobhyve currently reports each of "smbios.system.maker" and
Olivier Cochard [Fri, 30 Oct 2020 00:03:59 +0000 (00:03 +0000)]
bhyve currently reports each of "smbios.system.maker" and
"smbios.system.family" as " ".
This presents challenges for both humans and tools when trying to parse output
that uses those results.
The new values reported are now:
smbios.system.family="Virtual Machine"
smbios.system.maker="FreeBSD"

PR: 250728
Approved by: grehan@FreeBSD.org
Sponsored by: Netflix

3 years agoAdd m_snd_tag_alloc() as a wrapper around if_snd_tag_alloc().
John Baldwin [Thu, 29 Oct 2020 23:28:39 +0000 (23:28 +0000)]
Add m_snd_tag_alloc() as a wrapper around if_snd_tag_alloc().

This gives a more uniform API for send tag life cycle management.

Reviewed by: gallatin, hselasky
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D27000

3 years agoConvert flags from int to bool. Some (compress) were already used in
Gleb Smirnoff [Thu, 29 Oct 2020 23:15:11 +0000 (23:15 +0000)]
Convert flags from int to bool.  Some (compress) were already used in
comparisons with bool values.  No functional changes.

3 years agoUse public interfaces to manage the nested rate limit send tag.
John Baldwin [Thu, 29 Oct 2020 22:22:27 +0000 (22:22 +0000)]
Use public interfaces to manage the nested rate limit send tag.

Each TLS send tag in mlx5 contains a nested rate limit send tag.
Previously, the driver was calling internal functions to manage the
nested tag.  Calling free methods directly instead of m_snd_tag_rele()
leaked send tag references and references on the ifp.  Changes to use
the ifp methods for the nested tag for other methods are more cosmetic
but do simplify the code.

Reviewed by: gallatin, hselasky
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D26996

3 years agoCall m_snd_tag_rele() to free send tags.
John Baldwin [Thu, 29 Oct 2020 22:18:56 +0000 (22:18 +0000)]
Call m_snd_tag_rele() to free send tags.

Send tags are refcounted and if_snd_tag_free() is called by
m_snd_tag_rele() when the last reference is dropped on a send tag.

Reviewed by: gallatin, hselasky
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D26995

3 years agoRemove an extra if_ref().
John Baldwin [Thu, 29 Oct 2020 22:16:59 +0000 (22:16 +0000)]
Remove an extra if_ref().

In r348254, if_snd_tag_alloc() routines were changed to bump the ifp
refcount via m_snd_tag_init().  This function wasn't in the tree at
the time and wasn't updated for the new semantics, so was still doing
a separate bump after if_snd_tag_alloc() returned.

Reviewed by: gallatin
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D26999

3 years agoStore the new send tag in the right place.
John Baldwin [Thu, 29 Oct 2020 22:14:34 +0000 (22:14 +0000)]
Store the new send tag in the right place.

r350501 added the 'st' parameter, but did not pass it down to
if_snd_tag_alloc().

Reviewed by: gallatin
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D26997

3 years agovfs: add NAMEI_DBG_HADSTARTDIR handling lost in rewrite
Mateusz Guzik [Thu, 29 Oct 2020 18:43:37 +0000 (18:43 +0000)]
vfs: add NAMEI_DBG_HADSTARTDIR handling lost in rewrite

Noted by: rpokala

3 years agofold(1): Add EXAMPLES section
Fernando Apesteguía [Thu, 29 Oct 2020 18:39:04 +0000 (18:39 +0000)]
fold(1): Add EXAMPLES section

A couple of examples covering -s and -w flags.

Approved by: manpages (bcr@)
Differential Revision: https://reviews.freebsd.org/D26948

3 years agofmt(1): Add EXAMPLES section
Fernando Apesteguía [Thu, 29 Oct 2020 18:37:20 +0000 (18:37 +0000)]
fmt(1): Add EXAMPLES section

Very small EXAMPLES section.

While here, remove reference to nroff(1).

Approved by: manpages (bcr@)
Differential Revision: https://reviews.freebsd.org/D26947

3 years agofetch(1): Add EXAMPLES section
Fernando Apesteguía [Thu, 29 Oct 2020 18:34:47 +0000 (18:34 +0000)]
fetch(1): Add EXAMPLES section

Add a few examples covering flags: 1, R, a, o, q, r, s, v

Approved by: manpages (bcr@)
Differential Revision: https://reviews.freebsd.org/D26946

3 years agoMake linprocfs(4) print a warning when there's not enough room to fill
Edward Tomasz Napierala [Thu, 29 Oct 2020 15:44:44 +0000 (15:44 +0000)]
Make linprocfs(4) print a warning when there's not enough room to fill
/proc/self/maps.

Submitted by: dchagin (earlier version)
Reviewed by: emaste (earlier version)
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20576

3 years agoOptimize set_syscall_retval for riscv by predicting the return
Edward Tomasz Napierala [Thu, 29 Oct 2020 15:36:20 +0000 (15:36 +0000)]
Optimize set_syscall_retval for riscv by predicting the return
value to be zero.

Reviewed by: mhorne, kp
MFC after: 2 weeks
Sponsored by: EPSRC
Differential Revision: https://reviews.freebsd.org/D26990

3 years agoMake it possible to mount nullfs(5) using plain mount(8)
Edward Tomasz Napierala [Thu, 29 Oct 2020 15:28:15 +0000 (15:28 +0000)]
Make it possible to mount nullfs(5) using plain mount(8)
instead of mount_nullfs(8).

Obviously you'd need to force mount(8) to not call
mount_nullfs(8) to make use of it.

Reviewed by: kib
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D26934

3 years agoWhitespace cleanup
Li-Wen Hsu [Thu, 29 Oct 2020 14:44:09 +0000 (14:44 +0000)]
Whitespace cleanup

MFC after: 3 days

3 years agoFix typo.
Edward Tomasz Napierala [Thu, 29 Oct 2020 14:42:51 +0000 (14:42 +0000)]
Fix typo.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

3 years agoRemove superfluous `this` in comment
Li-Wen Hsu [Thu, 29 Oct 2020 14:42:02 +0000 (14:42 +0000)]
Remove superfluous `this` in comment

PR: 250721
Submitted by: Hiroya EBINE <hebiyan@protonmail.com>
MFC after: 3 days

3 years agoAdd defines for Linux errno values and use them to make linux_errtbl[]
Edward Tomasz Napierala [Thu, 29 Oct 2020 14:23:52 +0000 (14:23 +0000)]
Add defines for Linux errno values and use them to make linux_errtbl[]
more readable.  While here, add linux_check_errtbl() function to make
sure we don't leave holes.

No objections: emaste (earlier version)
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D26972

3 years agoUpdate the due date of the quarterly status report
Li-Wen Hsu [Thu, 29 Oct 2020 14:21:25 +0000 (14:21 +0000)]
Update the due date of the quarterly status report

While here, move the date to keep 2 weeks ahead notificaion
and fix the part of speech.

Reviewed by: debdrup
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D26998

3 years agovfs: add NDREINIT to facilitate repeated namei calls
Mateusz Guzik [Thu, 29 Oct 2020 12:56:02 +0000 (12:56 +0000)]
vfs: add NDREINIT to facilitate repeated namei calls

struct nameidata mixes caller arguments, internal state and output, which
can be quite error prone.

Recent addition of valdiating ni_resflags uncovered a caller which could
repeatedly call namei, effectively operating on partially populated state.

Add bare minimium validation this does not happen. The real fix would
decouple aforementioned state.

Reported by: pho
Tested by: pho (different variant)

3 years agoSimplify test for closing delimiter of #include argument (no functional
Stefan Eßer [Thu, 29 Oct 2020 08:31:47 +0000 (08:31 +0000)]
Simplify test for closing delimiter of #include argument (no functional
change).

While here: Fix invalid parameters of a commented-out debug printf() found
when testing with this code enabled.

MFC after: 3 days

3 years agoFix calendar -a processing of files included in the user's home directory
Stefan Eßer [Thu, 29 Oct 2020 08:26:38 +0000 (08:26 +0000)]
Fix calendar -a processing of files included in the user's home directory

The existing code performed a chdir() into the home directory, but the
parser fell back to using the invoking user's home directory as the base
directory for the search for an include file.

Since use of the -a option is limited to UID==0, the directory searched
was typically ~root/.calendar, not the .calendar directory of the user
whose file is being processed.

PR: 205580
Reported by: greg.bal4@gmail.com (Greg Balfour)
MFC after: 3 days

3 years agoCI: switch to qemu42 package
Ed Maste [Thu, 29 Oct 2020 02:02:30 +0000 (02:02 +0000)]
CI: switch to qemu42 package

It appears that booting FreeBSD from qemu's synthesized FAT filesystem
broke somehow in a recent qemu-devel update.  qemu42 works so switch to
it for now.

3 years agoSupport hardware rate limiting (pacing) with TLS offload.
John Baldwin [Thu, 29 Oct 2020 00:23:16 +0000 (00:23 +0000)]
Support hardware rate limiting (pacing) with TLS offload.

- Add a new send tag type for a send tag that supports both rate
  limiting (packet pacing) and TLS offload (mostly similar to D22669
  but adds a separate structure when allocating the new tag type).

- When allocating a send tag for TLS offload, check to see if the
  connection already has a pacing rate.  If so, allocate a tag that
  supports both rate limiting and TLS offload rather than a plain TLS
  offload tag.

- When setting an initial rate on an existing ifnet KTLS connection,
  set the rate in the TCP control block inp and then reset the TLS
  send tag (via ktls_output_eagain) to reallocate a TLS + ratelimit
  send tag.  This allocates the TLS send tag asynchronously from a
  task queue, so the TLS rate limit tag alloc is always sleepable.

- When modifying a rate on a connection using KTLS, look for a TLS
  send tag.  If the send tag is only a plain TLS send tag, assume we
  failed to allocate a TLS ratelimit tag (either during the
  TCP_TXTLS_ENABLE socket option, or during the send tag reset
  triggered by ktls_output_eagain) and ignore the new rate.  If the
  send tag is a ratelimit TLS send tag, change the rate on the TLS tag
  and leave the inp tag alone.

- Lock the inp lock when setting sb_tls_info for a socket send buffer
  so that the routines in tcp_ratelimit can safely dereference the
  pointer without needing to grab the socket buffer lock.

- Add an IFCAP_TXTLS_RTLMT capability flag and associated
  administrative controls in ifconfig(8).  TLS rate limit tags are
  only allocated if this capability is enabled.  Note that TLS offload
  (whether unlimited or rate limited) always requires IFCAP_TXTLS[46].

Reviewed by: gallatin, hselasky
Relnotes: yes
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D26691

3 years agoSave the current TCP pacing rate in t_pacing_rate.
John Baldwin [Thu, 29 Oct 2020 00:03:19 +0000 (00:03 +0000)]
Save the current TCP pacing rate in t_pacing_rate.

Reviewed by: gallatin, gnn
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D26875

3 years agoDisable ssp raw test without ASAN
Brooks Davis [Wed, 28 Oct 2020 23:10:54 +0000 (23:10 +0000)]
Disable ssp raw test without ASAN

r366981 disabled ASAN when it might not be reliable (with an external
compiler), but this test is broken without ASAN so disable it completely
in that case.

PR: 250706
Reviewed by: emaste, lwhsu
Differential Revision: https://reviews.freebsd.org/D26982

3 years agoCheck for process group change in tty_wait_background().
Konstantin Belousov [Wed, 28 Oct 2020 22:12:47 +0000 (22:12 +0000)]
Check for process group change in tty_wait_background().

The calling process's process group can change between PROC_UNLOCK(p)
and PGRP_LOCK(pg) in tty_wait_background(), e.g. by a setpgid() call
from another process. If that happens, the signal is not sent to the
calling process, even if the prior checks determine that one should be
sent.  Re-check that the process group hasn't changed after acquiring
the pgrp lock, and if it has, redo the checks.

PR: 250701
Submitted by: Jakub Piecuch <j.piecuch96@gmail.com>
MFC after: 2 weeks

3 years agoloader: add aarch64 support for zstd
Warner Losh [Wed, 28 Oct 2020 21:18:04 +0000 (21:18 +0000)]
loader: add aarch64 support for zstd

We don't have NEON available in the boot loader, so we have to disable
it. OpenZFS included ZSTD which used the wrong symbol to bring in neon
support. Change to use the code that's been submitted upstream as a
pull request to both.

__ARM_NEON is the proper symbol, defined in ARM C Language Extensions
Release 2.1 (https://developer.arm.com/documentation/ihi0053/d/). Some
sources suggest __ARM_NEON__, but that's the obsolete spelling from
prior versions of the standard.

OpenZFS Pull Request: https://github.com/openzfs/zfs/pull/11055
ZSTD Pull Request: https://github.com/facebook/zstd/pull/2356

3 years agoNote that sys/systm.h is special too
Warner Losh [Wed, 28 Oct 2020 21:09:56 +0000 (21:09 +0000)]
Note that sys/systm.h is special too

If you need / want to includerd sys/systm.h, it has to be just after
param.h/types.h. Document this existing practice. Not all kernel files
include systm.h, but when you do, it should be done out of order.

Reviewed by: vangyzen, kib, emaste
Differential Review: https://reviews.freebsd.org/D26981

3 years agoiflib: fix typo bug introduced by r367093
Vincenzo Maffione [Wed, 28 Oct 2020 21:06:17 +0000 (21:06 +0000)]
iflib: fix typo bug introduced by r367093

Code was supposed to call callout_reset_sbt_on() rather than
callout_reset_sbt(). This resulted into passing a "cpu" value
to a "flag" argument. A recipe for subtle errors.

PR: 248652
Reported by: sg@efficientip.com
MFC with: r367093

3 years agoFix use-after-free in icmp6_notify_error().
Alexander V. Chernikov [Wed, 28 Oct 2020 20:22:20 +0000 (20:22 +0000)]
Fix use-after-free in icmp6_notify_error().

Reported by: Maxime Villard <max at m00nbsd.net>
Reviewed by: markj
MFC after: 3 days

3 years agoFix unintentional constant rename in r367109.
Alexander Motin [Wed, 28 Oct 2020 18:22:25 +0000 (18:22 +0000)]
Fix unintentional constant rename in r367109.

MFC after: 1 week

3 years agoUse proper variable for device path.
Alexander Motin [Wed, 28 Oct 2020 17:28:48 +0000 (17:28 +0000)]
Use proper variable for device path.

It seems *-passthru commands were broken from the day one, since the
device path is fetched into opt.dev variable and not left in argv[optind].
The other three wrong argv[optind] instances are just in error messages.

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

3 years agoUpdate the list of searched manual sections after r367013
Mateusz Piotrowski [Wed, 28 Oct 2020 16:54:37 +0000 (16:54 +0000)]
Update the list of searched manual sections after r367013

3 years agoPrint NVMe controller capabilities in verbose dmesg.
Alexander Motin [Wed, 28 Oct 2020 15:43:29 +0000 (15:43 +0000)]
Print NVMe controller capabilities in verbose dmesg.

Those values are not reported in controller identification, while sometimes
interesting for development and debugging.

MFC after: 1 week

3 years agoAdd support for nested conditionals
Stefan Eßer [Wed, 28 Oct 2020 14:48:58 +0000 (14:48 +0000)]
Add support for nested conditionals

The previous behavior was to support nested #ifdef and #ifndef, but to
return to unconditional parsing after the next #endif, independently of
the number of previously parsed conditions.

E.g. after "#ifdef A / #ifdef B / #endif" the following lines were
unconditially parsed again, independently of A and/or B being defined.

The new behavior is to count the level of false conditions and to only
restart parsing of calendar entries when the corresponding number of
#endif tokens have been seen.

In addition to the above, an #else directive has been added, to toggle
between parsing and ignoring of the following lines.

No validation of the correct use of the condition directives is made.
#endif without prior #define or #ifndef is ignored and #else toggles
between parsing and skipping of entries.

The MFC period has been set to 1 month to allow for a review of the
changes and for a discussion, whether these modifications should not
be merged at all.

No correct input file is parsed differently than before, but if calendar
data files are published that use these new features, those data files
will not parse correctly on prior versions of this program.

MFC after: 1 month

3 years agoAdd local variable to store the sysent pointer. Just a cleanup,
Edward Tomasz Napierala [Wed, 28 Oct 2020 14:43:38 +0000 (14:43 +0000)]
Add local variable to store the sysent pointer.  Just a cleanup,
no functional changes.

Reviewed by: kib (earlier version)
MFC after: 2 weeks
Sponsored by: EPSRC
Differential Revision: https://reviews.freebsd.org/D26977

3 years agoMake linux_errtbl a bit more readable by using named initializers.
Edward Tomasz Napierala [Wed, 28 Oct 2020 14:16:08 +0000 (14:16 +0000)]
Make linux_errtbl a bit more readable by using named initializers.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D26970

3 years agoDrop "All rights reserved" from all my stuff. This includes
Edward Tomasz Napierala [Wed, 28 Oct 2020 13:46:11 +0000 (13:46 +0000)]
Drop "All rights reserved" from all my stuff.  This includes
Foundation copyrights, approved by emaste@.  It does not include
files which carry other people's copyrights; if you're one
of those people, feel free to make similar change.

Reviewed by: emaste, imp, gbe (manpages)
Differential Revision: https://reviews.freebsd.org/D26980

3 years agoFix off-by-one error in processing of #ifdef lines
Stefan Eßer [Wed, 28 Oct 2020 13:30:24 +0000 (13:30 +0000)]
Fix off-by-one error in processing of #ifdef lines

The convention in this program is to parse the line immediately starting
after the token (e.g. #defineA and #ifdefA define respectively look-up "A"),
and this commit restores this behavior instead of skipping an assumed
white-space character following #ifdef.

Reported by: kevans
MFC after: 3 days

3 years agoFix parsing of #ifdef in calendar files
Stefan Eßer [Wed, 28 Oct 2020 13:06:39 +0000 (13:06 +0000)]
Fix parsing of #ifdef in calendar files

There was code to process an #ifndef tokens, but none for #ifdef.
The #ifdef token was mentioned as unsupported in the BUGS section,
but no reason was given and I do not see why it should stay omitted.

Misleading information in The BUGS section of the man-page regarding
the maximum number of #define and #include statements supported has
been removed. These limits might have applied to a prior version of
this program, but do not seem to apply to the current implementation.

I have not tried to test for the existence of the limits, but the
include file processing just recursively calls the parser (without
counting the recursion depth) and the stringlist functions do not
impose a limit on the number of entries.

Reported by: jhs@berklix.com
MFC after: 3 days

3 years agoSpeed up Cirrus CI by using CROSS_TOOLCHAIN
Alex Richardson [Wed, 28 Oct 2020 11:54:09 +0000 (11:54 +0000)]
Speed up Cirrus CI by using CROSS_TOOLCHAIN

Installing the llvm11 package instead of bootstrapping it from the source
tree reduces the build time by about 20 minutes.

The last freebsd/freebsd build that was tested (r366629) took 1h 21m 22s,
whereas my GitHub fork with this .cirrus.yml took 58m 6s.
We could probably further reduce time by using images that have LLVM
pre-installed: the pkg install step took 4 minutes 30s.

Since the bootstrap toolchain is still tested by Jenkins, this should not
reduce test coverage of the CI testing.

Reviewed By: emaste
Differential Revision: https://reviews.freebsd.org/D26747

3 years agoSignificantly reduce compile time for googletest internal tests
Alex Richardson [Wed, 28 Oct 2020 11:54:04 +0000 (11:54 +0000)]
Significantly reduce compile time for googletest internal tests

Clang's optimizer spends a really long time on these tests at -O2, so we now
use -O0 instead. This reduces the -j32 time for lib/googletest/test from 131s
to 29s. Using -O0 also reduces the disk usage from 144MB (at -O2) / 92MB (at
-O1) to 82MB.

Reviewed By: ngie, dim
Differential Revision: https://reviews.freebsd.org/D26751

3 years agoclang-format: Avoid breaking after the opening paren of function definitions
Alex Richardson [Wed, 28 Oct 2020 11:54:00 +0000 (11:54 +0000)]
clang-format: Avoid breaking after the opening paren of function definitions

This depends on https://reviews.llvm.org/D90246 to have any effect, but once
that has landed clang-format will no longer format code like this:

```
int
myfunction(
    int param1, int param2, int param2)
{
   ...
}
```

and instead create the following:

```
int
myfunction(int param1, int param2,
    int param2)
{
   ...
}
```

Reviewed By: emaste, cem
Differential Revision: https://reviews.freebsd.org/D26978

3 years agoclang-format: place sys/systm.h immediately after sys/param.h
Alex Richardson [Wed, 28 Oct 2020 11:53:55 +0000 (11:53 +0000)]
clang-format: place sys/systm.h immediately after sys/param.h

Should fix one of the objections to r366993.
See also https://reviews.freebsd.org/D26981.

Reviewed By: emaste
Differential Revision: https://reviews.freebsd.org/D26979

3 years agoCorrect USB HID item in examples
Mateusz Piotrowski [Wed, 28 Oct 2020 08:29:31 +0000 (08:29 +0000)]
Correct USB HID item in examples

It turns out that examples were incorrectly referring to Volume_Up
and Volume_Down, which are not defined at all.

PR: 250683
Reported by: corvid%openmailbox.org
MFC after: 2 weeks

3 years agoAdd new USB IDs.
Hans Petter Selasky [Wed, 28 Oct 2020 08:22:38 +0000 (08:22 +0000)]
Add new USB IDs.

Submitted by: aleksi.kaalinpaa@kapsi.fi
PR: 250675
MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agoAdd FreeBSD 12.2
Li-Wen Hsu [Wed, 28 Oct 2020 02:30:44 +0000 (02:30 +0000)]
Add FreeBSD 12.2

3 years agoMFV r367082:
Cy Schubert [Tue, 27 Oct 2020 23:03:15 +0000 (23:03 +0000)]
MFV r367082:

Update unbound 1.11.0 --> 1.12.0.

MFC after: 1 month.

3 years agoiflib: add per-tx-queue netmap timer
Vincenzo Maffione [Tue, 27 Oct 2020 21:53:33 +0000 (21:53 +0000)]
iflib: add per-tx-queue netmap timer

The way netmap TX is handled in iflib when TX interrupts are not
used (IFC_NETMAP_TX_IRQ not set) has some issues:
  - The netmap_tx_irq() function gets called by iflib_timer(), which
    gets scheduled with tick granularity (hz). This is not frequent
    enough for 10Gbps NICs and beyond (e.g., ixgbe or ixl). The end
    result is that the transmitting netmap application is not woken
    up fast enough to saturate the link with small packets.
  - The iflib_timer() functions also calls isc_txd_credits_update()
    to ask for more TX completion updates. However, this violates
    the netmap requirement that only txsync can access the TX queue
    for datapath operations. Only netmap_tx_irq() may be called out
    of the txsync context.

This change introduces per-tx-queue netmap timers, using microsecond
granularity to ensure that netmap_tx_irq() can be called often enough
to allow for maximum packet rate. The timer routine simply calls
netmap_tx_irq() to wake up the netmap application. The latter will
wake up and call txsync to collect TX completion updates.

This change brings back line rate speed with small packets for ixgbe.
For the time being, timer expiration is hardcoded to 90 microseconds,
in order to avoid introducing a new sysctl.
We may eventually implement an adaptive expiration period or use another
deferred work mechanism in place of timers.

Also, fix the timers usage to make sure that each queue is serviced
by a different CPU.

PR: 248652
Reported by: sg@efficientip.com
MFC after: 2 weeks