freebsd.git
3 years agoReduce code duplication in machine/_types.h
Alex Richardson [Mon, 14 Jun 2021 10:18:51 +0000 (10:18 +0000)]
Reduce code duplication in machine/_types.h

Many of these typedefs are the same across all architectures or can
be set based on an architecture-independent compiler-provided macro
(e.g. __SIZEOF_SIZE_T__). These macros have been available since GCC 4.6
and Clang sometime before 3.0 (godbolt.org does not have any older clang
versions installed).

I originally considered using the compiler-provided `__FOO_TYPE__` directly.
However, in order to do so we have to check that those match the previous
typedef exactly (not just that they have the same size) since any change
would be an ABI break. For example, changing `long` to `long long` results
in different C++ name mangling. Additionally, Clang and GCC disagree on
the underlying type for some of (u)int*_fast_t types, so this change
only moves the definitions that are identical across all architectures
and does not touch those types.

This de-deduplication will allow us to have a smaller diff downstream in
CheriBSD: we only have to only change the (u)intptr_t definition in
sys/_types.h in CheriBSD instead of having to change machine/_types.h for
all CHERI-enabled architectures (currently RISC-V, AArch64 and MIPS).

Reviewed By: imp, kib
Differential Revision: https://reviews.freebsd.org/D29895

3 years agoAdd more GIC and GICv3 registers
Andrew Turner [Mon, 14 Jun 2021 12:48:53 +0000 (12:48 +0000)]
Add more GIC and GICv3 registers

These aren't used by either driver, however they will be needed by
bhyve on arm64 to emulate a GICv3 interrupt controller.

Sponsored by: Innovate UK

3 years agoUse the correct length when copying arm64 vfp registers
Andrew Turner [Mon, 14 Jun 2021 11:01:46 +0000 (11:01 +0000)]
Use the correct length when copying arm64 vfp registers

We passed the wrong length into memcpy in the arm64 get_fpcontext and
set_fpcontext. This caused us to copy two status registers we didn't
expect to copy.

These are safe as they exist in both the source and destination, although
in a different order, and we copy the correct values after the memcpy.

Obtained from: CheriBSD
Sponsored by: Innovate UK

3 years agoktls: Fix interaction with RATELIMIT
Andrew Gallatin [Mon, 14 Jun 2021 14:46:13 +0000 (10:46 -0400)]
ktls: Fix interaction with RATELIMIT

uipc_ktls.c was missing opt_ratelimit.h, so it was
never noticing that RATELIMIT was enabled.  Once it was
enabled, it failed to compile as  ktls_modify_txrtlmt()
had accrued a compilation error when it was not being
compiled in.

Sponsored by: Netflix

3 years agonetgraph/bridge: malloc without flags
Lutz Donnerhacke [Sun, 13 Jun 2021 22:00:35 +0000 (00:00 +0200)]
netgraph/bridge: malloc without flags

During tests an assert was triggered and pointed to missing flags in
the newlink function of ng_bridge(4).

Reported by: markj
Reviewed by: markj
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D30759

3 years agopf: store L4 headers in pf_pdesc
Kristof Provost [Fri, 4 Jun 2021 08:52:07 +0000 (10:52 +0200)]
pf: store L4 headers in pf_pdesc

Rather than pointers to the headers store full copies. This brings us
slightly closer to what OpenBSD does, and also makes more sense than
storing pointers to stack variable copies of the headers.

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

3 years agopf: don't hold a lock during copyout()
Kristof Provost [Mon, 14 Jun 2021 12:04:02 +0000 (14:04 +0200)]
pf: don't hold a lock during copyout()

copyout() can trigger page faults, so it may potentially sleep.

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

3 years agomake.conf: DOC_LANG and PRINTERDEVICE clarifications in man and example
Ceri Davies [Mon, 14 Jun 2021 08:53:34 +0000 (09:53 +0100)]
make.conf: DOC_LANG and PRINTERDEVICE clarifications in man and example

3 years agoarm: TI am335x ehrpwm fix bitmask
Oskar Holmlund [Mon, 14 Jun 2021 08:38:06 +0000 (10:38 +0200)]
arm: TI am335x ehrpwm fix bitmask

Bitfield HSPCLKDIV and CLKDIV are 3 bit wide.
Chapter 15.2.4.1 https://www.ti.com/lit/ug/spruh73q/spruh73q.pdf

Approved by: manu (mentor)
Reported by: Stefan Forsberg
Differential revision: https://reviews.freebsd.org/D30746

3 years agowpa: The ap library is not needed by wpa_supplicant or wpa_cli
Cy Schubert [Sat, 12 Jun 2021 23:51:51 +0000 (16:51 -0700)]
wpa: The ap library is not needed by wpa_supplicant or wpa_cli

The ap library is not needed by wpa_supplicant or wpa_cli. It is only
used by hostapd.

MFC after: 2 months

3 years agou3g: Add reference to gobi_loader port
Warner Losh [Mon, 14 Jun 2021 04:18:07 +0000 (22:18 -0600)]
u3g: Add reference to gobi_loader port

The gobi_loader port has been committed. Add a reference to it instead
of the upstream project since the port has changes needed to run on
FreeBSD that aren't yet part of upstream.

Sponsored by: Netflix

3 years agobhyve: enhance debug info for memory range clash
Robert Crowston [Sat, 10 Apr 2021 19:16:02 +0000 (20:16 +0100)]
bhyve: enhance debug info for memory range clash

Explain what the two clashing regions are.

Reivewed by: grehan, jhb
Differential Revision: https://reviews.freebsd.org/D29696
Pull Request: https://github.com/freebsd/freebsd-src/pull/463

3 years agotests/netgraph: Check for PR241954
Lutz Donnerhacke [Thu, 10 Jun 2021 09:54:31 +0000 (11:54 +0200)]
tests/netgraph: Check for PR241954

Add tests to check for renaming issues reported in PR241954 and solved
in D30110.

MFC: Together with D30629
Differential Revision: https://reviews.freebsd.org/D30713

3 years agotests/netgraph: Missed fixup after D30699
Lutz Donnerhacke [Thu, 10 Jun 2021 10:21:14 +0000 (12:21 +0200)]
tests/netgraph: Missed fixup after D30699

During D30699 the existing basic tests were missed.  Furthermore
debugging output was still in the code, which is removed now.

MFC: together with D30699
Differential Revision: https://reviews.freebsd.org/D30714

3 years agoMerge llvm-project 12.0.0 release
Dimitry Andric [Mon, 26 Apr 2021 11:23:24 +0000 (13:23 +0200)]
Merge llvm-project 12.0.0 release

This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-12.0.0-0-gd28af7c654d8, a.k.a. 12.0.0 release.

PR: 255570
MFC after: 6 weeks

3 years agoMerge llvm-project main llvmorg-12-init-17869-g8e464dd76bef
Dimitry Andric [Sun, 13 Jun 2021 19:31:46 +0000 (21:31 +0200)]
Merge llvm-project main llvmorg-12-init-17869-g8e464dd76bef

This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-12-init-17869-g8e464dd76bef, the last commit before the
upstream release/12.x branch was created.

PR: 255570
MFC after: 6 weeks

3 years agou3g: Document Panasonic CF-F9 GOBI support
Warner Losh [Sun, 13 Jun 2021 16:14:54 +0000 (10:14 -0600)]
u3g: Document Panasonic CF-F9 GOBI support

Document that the u3g driver supports the Panasonic CF-F9 GOBI. Note
that gobi_loader is needed and give URL for that. There is a separate
review for during a related version into a port at D22938, but it seems
stalled. I'll update the docs when it arrives in ports.

Sponsored by: Netflix

3 years agoUSB/U3G: Added Panasonic CF-F9 GOBI 3G modem to U3G module.
CeDeROM Tomasz CEDRO [Sun, 13 Jun 2021 16:08:42 +0000 (10:08 -0600)]
USB/U3G: Added Panasonic CF-F9 GOBI 3G modem to U3G module.

Add kernel support for the Panasonic GOBI 3g modem.

Note: GOBI modems require QDL firmware to be uploaded with gobi_loader:
https://github.com/cederom/gobi_loader.

Signed-off-by: CeDeROM Tomasz CEDRO <tomek@cedro.info>
Pull Request: https://github.com/freebsd/freebsd-src/pull/115
Reviewed by: imp (split off kernel bits from original)

3 years agosg: get rid of unused include.
Dmitry Chagin [Sun, 13 Jun 2021 08:30:49 +0000 (11:30 +0300)]
sg: get rid of unused include.

sg driver does not depends on the Linuxulator any more.

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

3 years agosyslogd: fix WITHOUT_INET builds
Artem Khramov [Sat, 12 Jun 2021 17:21:13 +0000 (20:21 +0300)]
syslogd: fix WITHOUT_INET builds

Since 2d82b47 syslogd can't be built with `WITHOUT_INET` or
`WITHOUT_INET6` build variables set, because `iovlist_truncate` is not
defined but used.

This change wraps the problematic `iovlist_truncate` call within ifdef
directive.  It's compiled out in this situation...

Pull Request: https://github.com/freebsd/freebsd-src/pull/475
Reviewed by: imp@ (commit message slightly tweaked)

3 years agoupdating: note recent removals
Warner Losh [Sun, 13 Jun 2021 04:21:28 +0000 (22:21 -0600)]
updating: note recent removals

3 years agozfs: change zstream -> zstreamdump link into a symlink
Martin Matuska [Sun, 13 Jun 2021 03:17:15 +0000 (05:17 +0200)]
zfs: change zstream -> zstreamdump link into a symlink

3 years agozfs: fix invalid entries in ObsoleteFiles.inc added in 3ff01b231
Martin Matuska [Sun, 13 Jun 2021 03:17:15 +0000 (05:17 +0200)]
zfs: fix invalid entries in ObsoleteFiles.inc added in 3ff01b231

3 years agozfs: merge openzfs/zfs@afa7b3484 (master) into main
Martin Matuska [Sun, 13 Jun 2021 02:03:58 +0000 (04:03 +0200)]
zfs: merge openzfs/zfs@afa7b3484 (master) into main

Notable upstream pull request merges:
  #12149: Multiple man-pages: Move to appropriate section
  #12158: Re-embed multilist_t storage
  #12191: Convert non-libzpool libraries to -fvisibility=hidden
  #12196: Unify manpage makefiles, move pages to better sexions, ...
  #12210: libzutil: import filtering optimisation
  #12212: Remove pool io kstats

Obtained from: OpenZFS
OpenZFS commit: afa7b3484556d3ae610a34582ce5ebd2c3e27bba

3 years agoRemove an(4) leftover from conf/NOTES
Mateusz Guzik [Sat, 12 Jun 2021 08:48:41 +0000 (08:48 +0000)]
Remove an(4) leftover from conf/NOTES

Unbreaks LINT kernels.

3 years agoarm: ti am335x ehrpwm add support for flags (PWM_POLARITY_INVERTED)
Oskar Holmlund [Sat, 12 Jun 2021 08:54:31 +0000 (10:54 +0200)]
arm: ti am335x ehrpwm add support for flags (PWM_POLARITY_INVERTED)

Add support for invert the polarity of the PWM signal.
Cleanup and add comments in the initialization code.
Add and fix register defines.

Approved by: manu (mentor)
Differential revision: https://reviews.freebsd.org/D29547

3 years agoarm: ti am335x ehrpwm remove sysctl interface
Oskar Holmlund [Sat, 12 Jun 2021 08:24:55 +0000 (10:24 +0200)]
arm: ti am335x ehrpwm remove sysctl interface

To minimize the maintenance time of this driver when new features
are added the legacy sysctl interface has to go.

Approved by: manu (mentor)
Reviewed by: Dr. Rolf Jansen (freebsd-rj_obsigna.com)
Differential revision: https://reviews.freebsd.org/D29546

3 years agoUPDATING: Add entry for __FreeBSD_version bump to 1400022
Rick Macklem [Sat, 12 Jun 2021 01:59:36 +0000 (18:59 -0700)]
UPDATING: Add entry for __FreeBSD_version bump to 1400022

3 years agoparam.h: Bump __FreeBSD_version to 1400022
Rick Macklem [Sat, 12 Jun 2021 01:53:02 +0000 (18:53 -0700)]
param.h: Bump __FreeBSD_version to 1400022

Commit e1a907a25cfa changed the internal KAPI between the krpc
and nfsserver.  As such, both modules must be rebuilt from
sources.  Bump __FreeBSD_version to 1400022.

3 years agobhyve vtblk: Inform guests of disk resize events.
John Baldwin [Sat, 12 Jun 2021 00:59:46 +0000 (17:59 -0700)]
bhyve vtblk: Inform guests of disk resize events.

Register a resize callback with the blockif interface.  When the
callback fires, update the size of the disk and notify the guest via a
configuration change interrupt.

Reviewed by: grehan, markj
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D30506

3 years agobhyve: Split out a lower-level helper for VirtIO interrupts.
John Baldwin [Sat, 12 Jun 2021 00:59:35 +0000 (17:59 -0700)]
bhyve: Split out a lower-level helper for VirtIO interrupts.

This allows device models to assert VirtIO interrupts for reasons
other than publishing changes to a VirtIO ring such as configuration
changes.

Reviewed by: grehan, markj
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D30505

3 years agobhyve: Add support for handling disk resize events to block_if.
John Baldwin [Sat, 12 Jun 2021 00:59:25 +0000 (17:59 -0700)]
bhyve: Add support for handling disk resize events to block_if.

Allow clients of blockif to register a resize callback handler.  When
a callback is registered, register an EVFILT_VNODE kevent watching the
backing store for a change in the file's attributes.  If the size has
changed when the kevent fires, invoke the clients' callback.

Currently resize detection is limited to backing stores that support
EVFILT_VNODE kevents such as regular files.

Reviewed by: grehan, markj
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D30504

3 years agobhyve: Add support for EVFILT_VNODE mevents.
John Baldwin [Sat, 12 Jun 2021 00:59:13 +0000 (17:59 -0700)]
bhyve: Add support for EVFILT_VNODE mevents.

This allows registering an event to watch for changes to a file's
attributes.  This is a bit imperfect as it would be nice to have a way
to determine if an fd can use EVFILT_VNODE successfully.  mevent's
current structure does not permit that and a failure to register a
single kevent impacts several other kevents.

Reviewed by: grehan, markj
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D30503

3 years agobhyve: Register new kevents synchronously.
John Baldwin [Sat, 12 Jun 2021 00:58:54 +0000 (17:58 -0700)]
bhyve: Register new kevents synchronously.

Change mevent_add*() to synchronously add the new kevent.  This
permits reporting event registration failures to the caller and avoids
failing the registration of other, unrelated events queued up in the
same batch.

Reviewed by: grehan, markj
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D30502

3 years agoDo not hash unlinked inodes
Paul Zuchowski [Sat, 12 Jun 2021 00:00:33 +0000 (20:00 -0400)]
Do not hash unlinked inodes

In zfs_znode_alloc we always hash inodes.  If the
znode is unlinked, we do not need to hash it.  This
fixes the problem where zfs_suspend_fs is doing zrele
(iput) in an async fashion, and zfs_resume_fs unlinked
drain processing will try to hash an inode that could
still be hashed, resulting in a panic.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alan Somers <asomers@gmail.com>
Signed-off-by: Paul Zuchowski <pzuchowski@datto.com>
Closes #9741
Closes #11223
Closes #11648
Closes #12210

3 years agokrpc: Acquire ref count of CLIENT for backchannel use
Rick Macklem [Fri, 11 Jun 2021 23:57:14 +0000 (16:57 -0700)]
krpc: Acquire ref count of CLIENT for backchannel use

Michael Dexter <editor@callfortesting.org> reported
a crash in FreeNAS, where the first argument to
clnt_bck_svccall() was no longer valid.
This argument is a pointer to the callback CLIENT
structure, which is free'd when the associated
NFSv4 ClientID is free'd.

This appears to have occurred because a callback
reply was still in the socket receive queue when
the CLIENT structure was free'd.

This patch acquires a reference count on the CLIENT
that is not CLNT_RELEASE()'d until the socket structure
is destroyed. This should guarantee that the CLIENT
structure is still valid when clnt_bck_svccall() is called.
It also adds a check for closed or closing to
clnt_bck_svccall() so that it will not process the callback
RPC reply message after the ClientID is free'd.

Comments by: mav
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D30153

3 years agoan: Remove driver
Olivier Houchard [Fri, 11 Jun 2021 23:08:54 +0000 (01:08 +0200)]
an: Remove driver

Now that an(4) is gone, remove it from GENERIC kernel config files.

Reported by: flo

3 years agosrc.conf.5: Regen for svnlite removal.
John Baldwin [Fri, 11 Jun 2021 21:57:51 +0000 (14:57 -0700)]
src.conf.5: Regen for svnlite removal.

Reviewed by: bcr, imp, emaste
Differential Revision: https://reviews.freebsd.org/D30738

3 years agoRemove svnlite.
John Baldwin [Fri, 11 Jun 2021 21:56:41 +0000 (14:56 -0700)]
Remove svnlite.

Reviewed by: bcr, imp, emaste
Differential Revision: https://reviews.freebsd.org/D30737

3 years agoRemove 'make update'.
John Baldwin [Fri, 11 Jun 2021 21:56:28 +0000 (14:56 -0700)]
Remove 'make update'.

In the CVS days this used be a wrapper around either CVS or CVSup and
used to support updating src, doc, and ports checkouts.  With the move
to subversion this only supported updating src and was itself a
wrapper around 'svn update'.  With Git, users are probably better off
using appropriate Git commands directly to update without needing an
explicit make target as a wrapper.

Reviewed by: bcr, imp, emaste
Differential Revision: https://reviews.freebsd.org/D30736

3 years agoRemove an manpage
Warner Losh [Fri, 11 Jun 2021 20:40:13 +0000 (14:40 -0600)]
Remove an manpage

3 years agomtk: Add printing of CPU model
Warner Losh [Fri, 11 Jun 2021 20:13:31 +0000 (14:13 -0600)]
mtk: Add printing of CPU model

Add the line that's in other foo_machdep.c file where the CPU model is
reported.

This was part of github pull request 459, but in a different way. The
rest of that pull request was either committed or not relevant. I did it
in a more correct way.

Submitted by: Priit Trees
Sponsored by: Netflix

3 years agomtk: Initialize mask correctly.
Priit Trees [Fri, 11 Jun 2021 20:12:08 +0000 (14:12 -0600)]
mtk: Initialize mask correctly.

Initialization of mask is missing. Fixes a compile issue.

Reviewed by: imp@
Pull Request: https://github.com/freebsd/freebsd-src/pull/459

3 years agoChange "compiled" to "assembled"
Warner Losh [Fri, 11 Jun 2021 19:58:51 +0000 (13:58 -0600)]
Change "compiled" to "assembled"

Assembly files are assembled, not compiled.

Submitted by: github user gAlfonso-bit
Pull Request: https://github.com/freebsd/freebsd-src/pull/474

Sponsored by: Netflix

3 years agobsdinstall: Allow automation in jails
eoli3n [Mon, 7 Jun 2021 20:49:02 +0000 (22:49 +0200)]
bsdinstall: Allow automation in jails

Set SCRIPT=/path/to/script env var to be able to automate bsdinstall to
a jail.

Pull Request: https://github.com/freebsd/freebsd-src/pull/473
Reviewed by: allanjude

3 years agoancontrol: Remove an(4) utility
Emmanuel Vadot [Mon, 7 Jun 2021 16:48:57 +0000 (18:48 +0200)]
ancontrol: Remove an(4) utility

Last an(4) devices have been End Of Life and End Of Sale in 2007.
Time to remove this driver.

Differential Revision: https://reviews.freebsd.org/D30680
Reviewed by: imp (earlier version), emaste (earlier version)
Sponsored by: Diablotin Systems

3 years agoan: Remove driver
Emmanuel Vadot [Mon, 7 Jun 2021 16:48:00 +0000 (18:48 +0200)]
an: Remove driver

Last an(4) devices have been End Of Life and End Of Sale in 2007.
Time to remove this driver.

Differential Revision: https://reviews.freebsd.org/D30679
Reviewed by: imp (earlier version), emaste (earlier version)
Sponsored by: Diablotin Systems

3 years agoan: Deprecate the driver
Emmanuel Vadot [Mon, 7 Jun 2021 16:45:58 +0000 (18:45 +0200)]
an: Deprecate the driver

Last an(4) devices have been End Of Life and End Of Sale in 2007.
Time to remove this driver.

Differential Revision: https://reviews.freebsd.org/D30678
Reviewed by: imp (earlier version), adrian (earlier version)
MFC after: 3 days
Sponsored by: Diablotin Systems

3 years agoarm64: allwinner: Add i2s and codec support
Oleksandr Tymoshenko [Thu, 13 May 2021 19:10:38 +0000 (21:10 +0200)]
arm64: allwinner: Add i2s and codec support

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

3 years agoarm64: Add Soc audio framework
Oleksandr Tymoshenko [Thu, 13 May 2021 19:09:50 +0000 (21:09 +0200)]
arm64: Add Soc audio framework

This framework is initial implementation of the simple-audio-card compatible
audio driver framework. It provides glue for CPU/codec/aux device.

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

3 years agotcp: remove debug output from RACK
Michael Tuexen [Fri, 11 Jun 2021 13:43:38 +0000 (15:43 +0200)]
tcp: remove debug output from RACK

Reported by: iron.udjin@gmail.com, Marek Zarychta
Reviewed by: rrs
PR: 256538
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D30723
Sponsored by: Netflix, Inc.

3 years agostyle: Relax 80 column rule
Warner Losh [Fri, 11 Jun 2021 16:37:36 +0000 (10:37 -0600)]
style: Relax 80 column rule

Note that the 80 column rule has been relaxed for some time when things
are clearer when a little longer. Add in that things that people grep
for, such as error messages, shouldn't be broken up which is the most
common reason people exceed 80 columns intentionally.

Reviewed by: jhb, domagoj.stolfa@gmail.com
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D30255

3 years agostyle: tweak tab after #define advice
Warner Losh [Fri, 11 Jun 2021 16:33:04 +0000 (10:33 -0600)]
style: tweak tab after #define advice

Once upon a time, #define<tab> was cultural thing. However, even when it
was promulgated, it was a minority usage. 20 years ago the split was
30k/69k (tab/space) and today the split is 80k/546k (tab/space). Update
guidance to allow either with the usual suggestion to be consistent
within a file.

Reviewed by: sef, allenjude, 0mp (prior rev), jhb
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D30254

3 years agoscripts/commitcheck.sh: fix false positive for signed commits
наб [Thu, 3 Jun 2021 17:40:09 +0000 (19:40 +0200)]
scripts/commitcheck.sh: fix false positive for signed commits

Reviewed-by: John Kennedy <john.kennedy@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #12105

3 years agoForbid basename(3) and dirname(3)
наб [Sat, 22 May 2021 15:19:14 +0000 (17:19 +0200)]
Forbid basename(3) and dirname(3)

There are at least two interpretations of basename(3),
in addition to both functions being allowed to /both/ return a static
buffer (unsuitable in multi-threaded environments) /and/ raze the input
(which encourages overallocations, at best)

Reviewed-by: John Kennedy <john.kennedy@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #12105

3 years agolibzutil: import: filter out unsuitable files earlier
наб [Sat, 22 May 2021 14:29:53 +0000 (16:29 +0200)]
libzutil: import: filter out unsuitable files earlier

Only accept the right type of file, if available, and reject too-small
files before opening them on Linux

Reviewed-by: John Kennedy <john.kennedy@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #12105

3 years agolinux/libzutil: zpool_open_func: don't dup name, extract untouchables
наб [Sat, 22 May 2021 14:26:40 +0000 (16:26 +0200)]
linux/libzutil: zpool_open_func: don't dup name, extract untouchables

Reviewed-by: John Kennedy <john.kennedy@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #12105

3 years agolibzutil: add zfs_{base,dir}name()
наб [Thu, 3 Jun 2021 15:17:09 +0000 (17:17 +0200)]
libzutil: add zfs_{base,dir}name()

Reviewed-by: John Kennedy <john.kennedy@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #12105

3 years agolinux/libzutil: use ARRAY_SIZE instead of constant for search paths
наб [Sat, 22 May 2021 14:23:59 +0000 (16:23 +0200)]
linux/libzutil: use ARRAY_SIZE instead of constant for search paths

Reviewed-by: John Kennedy <john.kennedy@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #12105

3 years agolibnv: optimize nvlist size calculation
Mariusz Zaborski [Fri, 11 Jun 2021 15:35:36 +0000 (17:35 +0200)]
libnv: optimize nvlist size calculation

If we had a multiple nvlist, during nvlist_pack, we calculated the size
of every nvlist separately. For example, if we had a nvlist with three
nodes each containing another (A contains B, and B contains C), we first
calculated the size of nvlist A (which contains B, C), then we calculate
the size of B (which contains C, notice that we already did the
calculation of B, when we calculate A), and finally C. This means that
this calculation was O(N!). This was done because each time we pack
nvlist, we have to put its size in the header
(the separate header for A, B, and C).

To not break the ABI and to reduce the complexity of nvlist_size,
instead of calculating the nvlist size when requested,
we track the size of each nvlist.

Reported by: pjd, kp
Tested by: kp

3 years agoAdded uncompress requirement
Rich Ercolani [Fri, 11 Jun 2021 15:38:23 +0000 (11:38 -0400)]
Added uncompress requirement

Having an old enough version of "file" and no "uncompress" program
installed can cause rpmbuild as root to crash and mangle rpmdb.

So let's add a build dependency for RPM-based systems.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Signed-off-by: Rich Ercolani <rincebrain@gmail.com>
Closes: #12071
Closes: #12168

3 years agotcp: Missing mfree in rack and bbr
Randall Stewart [Fri, 11 Jun 2021 15:38:08 +0000 (11:38 -0400)]
tcp: Missing mfree in rack and bbr

Recently (Nov) we added logic that protects against a peer negotiating a timestamp, and
then not including a timestamp. This involved in the input path doing a goto done_with_input
label. Now I suspect the code was cribbed from one in Rack that has to do with the SYN.
This had a bug, i.e. it should have a m_freem(m) before going to the label (bbr had this
missing m_freem() but rack did not). This then caused the missing m_freem to show
up in both BBR and Rack. Also looking at the code referencing m->m_pkthdr.lro_nsegs
later (after processing) is not a good idea, even though its only for logging. Best to
copy that off before any frees can take place.

Reviewed by: mtuexen
Sponsored by: Netflix Inc
Differential Revision: https://reviews.freebsd.org/D30727

3 years agoZTS: Add zfs_clone_livelist_dedup.ksh to Makefile.am
Brian Behlendorf [Fri, 11 Jun 2021 15:21:36 +0000 (08:21 -0700)]
ZTS: Add zfs_clone_livelist_dedup.ksh to Makefile.am

Commit 86b5f4c12 added a new zfs_clone_livelist_dedup.ksh test case
but didn't include it in the Makefile.am.  This results in the test
not being included in the dist tarball so it's never run by the CI.

Reviewed-by: John Kennedy <john.kennedy@delphix.com>
Reviewed-by: Serapheim Dimitropoulos <serapheim@delphix.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes: #12224

3 years agoImprove handling of USB device re-open in the LibUSB v1.x API.
Hans Petter Selasky [Fri, 11 Jun 2021 15:06:10 +0000 (17:06 +0200)]
Improve handling of USB device re-open in the LibUSB v1.x API.

Make sure the "device_is_gone" flag is cleared after every successful open,
so that the "device_is_gone" flag doesn't persist forever.

Found by: sergii.dmytruk@3mdeb.com
PR: 256296
MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agotcp: fix two bugs in new reno
Michael Tuexen [Fri, 11 Jun 2021 13:37:39 +0000 (15:37 +0200)]
tcp: fix two bugs in new reno

* Completely initialise the CC module specific data
* Use beta_ecn in case of an ECN event whenever ABE is enabled
  or it is requested by the stack.

Reviewed by: rscheff, rrs
MFC after: 3 days
Sponsored by: Netflix, Inc.

3 years agoAdd new USB ID to u3g(4).
Hans Petter Selasky [Fri, 11 Jun 2021 10:53:22 +0000 (12:53 +0200)]
Add new USB ID to u3g(4).

Submitted by: pierre-jean.gineste@nuabee.fr
PR: 231909
MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agotcp: fix compilation of IPv4-only builds
Michael Tuexen [Fri, 11 Jun 2021 07:50:46 +0000 (09:50 +0200)]
tcp: fix compilation of IPv4-only builds

PR: 256538
Reported by: iron.udjin@gmail.com
MFC after: 3 days
Sponsored by: Netflix, Inc.

3 years agospl: Fix gcc6 build
Warner Losh [Fri, 11 Jun 2021 03:28:52 +0000 (21:28 -0600)]
spl: Fix gcc6 build

-Wno-error= is only a clang flag, restrict its use to only clang.

Sponsored by: Netflix

3 years agotools: Remove obsolete svn information.
Warner Losh [Fri, 11 Jun 2021 00:50:46 +0000 (18:50 -0600)]
tools: Remove obsolete svn information.

Reviewed by: jhb@
Differential Revision: https://reviews.freebsd.org/D30720
Sponsored by: Netflix

3 years agotests/sys/netpfil: Move common tests out from behind MK_PF.
Brad Davis [Thu, 10 Jun 2021 23:01:53 +0000 (17:01 -0600)]
tests/sys/netpfil: Move common tests out from behind MK_PF.

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

3 years agozfs: unbreak build with clang 12
Martin Matuska [Thu, 10 Jun 2021 23:31:56 +0000 (01:31 +0200)]
zfs: unbreak build with clang 12

Change -Wno-error-atomic-alignment to -Wno-error=atomic-alignment
in the Makefile of libspl.

Reported by: Ed Maste <emaste@FreeBSD.org>
Fix by: Alexander Richardson <arichardson@FreeBSD.org>

3 years agolibalias: tidy up housekeeping
Lutz Donnerhacke [Sat, 15 May 2021 15:35:36 +0000 (17:35 +0200)]
libalias: tidy up housekeeping

Replace current expensive, but sparsly called housekeeping
by a single, repetive action.

This is part of a larger restructure of libalias in order to switch to
more efficient data structures.  The whole restructure process is
split into 15 reviews to ease reviewing.  All those steps will be
squashed into a single commit for MFC in order to hide the
intermediate states from production systems.

Reviewed by: hselasky
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D30277

3 years agoRe-embed multilist_t storage
Alexander Motin [Thu, 10 Jun 2021 16:42:31 +0000 (12:42 -0400)]
Re-embed multilist_t storage

This commit partially reverts changes to multilists in PR 7968
(multi-threaded spa-sync()) and adds some cache line alignments to
separate read-only multilists and heavily modified refcount's to different
cache lines.

Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Sponsored-by: iXsystems, Inc.
Closes #12158

3 years agodracut: 90zfs: respect zfs_force=1 on systemd systems
наб [Thu, 10 Jun 2021 16:26:37 +0000 (18:26 +0200)]
dracut: 90zfs: respect zfs_force=1 on systemd systems

On systemd systems provide an environment generator in order
to respect the zfs_force=1 kernel command line option.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Tony Nguyen <tony.nguyen@delphix.com>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #11403
Closes #12195

3 years agoRemove pool io kstats (#12212)
Alexander Motin [Thu, 10 Jun 2021 15:27:33 +0000 (11:27 -0400)]
Remove pool io kstats (#12212)

This mostly reverts "3537 want pool io kstats" commit of 8 years ago.

From one side this code using pool-wide locks became pretty bad for
performance, creating significant lock contention in I/O pipeline.
From another, there are more efficient ways now to obtain detailed
statistics, while this statistics is illumos-specific and much less
usable on Linux and FreeBSD, reported only via procfs/sysctls.

This commit does not remove KSTAT_TYPE_IO implementation, that may
be removed later together with already unused KSTAT_TYPE_INTR and
KSTAT_TYPE_TIMER.

Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Sponsored-By: iXsystems, Inc.
Closes #12212

3 years agolinuxkpi: Add list_for_each_entry_lockless() macro
Neel Chauhan [Thu, 10 Jun 2021 15:14:20 +0000 (08:14 -0700)]
linuxkpi: Add list_for_each_entry_lockless() macro

This is needed by the drm-kmod 5.7 update.

Approved by: hselasky (src)
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D30708

3 years agommc(4), mmcsc(4): Remove missing Xref
Fernando Apesteguía [Thu, 10 Jun 2021 13:11:22 +0000 (15:11 +0200)]
mmc(4), mmcsc(4): Remove missing Xref

There is no evidence of at91_mci in the code whatsoever. Most of the at91
drivers where removed in 802baf0ba66c18ca52aeaf4a3e7b05e85d8e4d3b

PR: 218970
Reported by: reezer@reezer.org

Approved by: imp@
Differential Revision: https://reviews.freebsd.org/D29193

3 years agoports(7): Add install-missing-packages to target list
Fernando Apesteguía [Fri, 30 Apr 2021 10:39:04 +0000 (12:39 +0200)]
ports(7): Add install-missing-packages to target list

It is already used in the EXAMPLES section.

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

3 years agotcp: Mbuf leak while holding a socket buffer lock.
Randall Stewart [Thu, 10 Jun 2021 12:33:57 +0000 (08:33 -0400)]
tcp: Mbuf leak while holding a socket buffer lock.

When running at NF the current Rack and BBR changes with the recent
commits from Richard that cause the socket buffer lock to be held over
the ip_output() call and then finally culminating in a call to tcp_handle_wakeup()
we get a lot of leaked mbufs. I don't think that this leak is actually caused
by holding the lock or what Richard has done, but is exposing some other
bug that has probably been lying dormant for a long time. I will continue to
look (using his changes) at what is going on to try to root cause out the issue.

In the meantime I can't leave the leaks out for everyone else. So this commit
will revert all of Richards changes and move both Rack and BBR back to just
doing the old sorwakeup_locked() calls after messing with the so_rcv buffer.

We may want to look at adding back in Richards changes after I have pinpointed
the root cause of the mbuf leak and fixed it.

Reviewed by: mtuexen,rscheff
Sponsored by: Netflix Inc
Differential Revision: https://reviews.freebsd.org/D30704

3 years agopf: use M_WAITOK where possible
Kristof Provost [Wed, 9 Jun 2021 12:00:07 +0000 (14:00 +0200)]
pf: use M_WAITOK where possible

In the ioctl path use M_WAITOK allocations whereever possible. These are
less sensitive to memory pressure, and ioctl requests have no hard
deadlines.

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

3 years agolinux(4): Regen for ppoll_time64 system call.
Dmitry Chagin [Thu, 10 Jun 2021 12:19:12 +0000 (15:19 +0300)]
linux(4): Regen for ppoll_time64 system call.

MFC after: 2 weeks

3 years agolinux(4): Implement ppoll_time64 system call.
Dmitry Chagin [Thu, 10 Jun 2021 12:18:46 +0000 (15:18 +0300)]
linux(4): Implement ppoll_time64 system call.

MFC after: 2 weeks

3 years agoSplit kern_poll() on two counterparts.
Dmitry Chagin [Thu, 10 Jun 2021 12:11:25 +0000 (15:11 +0300)]
Split kern_poll() on two counterparts.

The kern_poll_kfds() operates on clear kernel data, kfds points to an
array in the kernel, while kern_poll() operates on user supplied pollfd.
Move nfds check to kern_poll_maxfds().

No functional changes, it's for future use in the Linux emulation layer.

Reviewd by: kib
Differential Revision: https://reviews.freebsd.org/D30690
MFC after: 2 weeks

3 years agolinux(4): Regen for pselect6_time64 system call.
Dmitry Chagin [Thu, 10 Jun 2021 12:04:37 +0000 (15:04 +0300)]
linux(4): Regen for pselect6_time64 system call.

MFC after: 2 weeks

3 years agolinux(4): Implement pselect6_time64 system call.
Dmitry Chagin [Thu, 10 Jun 2021 12:03:30 +0000 (15:03 +0300)]
linux(4): Implement pselect6_time64 system call.

MFC after: 2 weeks

3 years agolinux(4): Regen for rt_sigtimedwait_time64 system call.
Dmitry Chagin [Thu, 10 Jun 2021 11:52:43 +0000 (14:52 +0300)]
linux(4): Regen for rt_sigtimedwait_time64 system call.

MFC after: 2 weeks

3 years agolinux(4): Implement rt_sigtimedwait_time64 system call.
Dmitry Chagin [Thu, 10 Jun 2021 11:51:30 +0000 (14:51 +0300)]
linux(4): Implement rt_sigtimedwait_time64 system call.

It still does not work as intended, awaits D30675.

MFC after: 2 weeks

3 years agolinux(4): Regen for futex_time64 system call.
Dmitry Chagin [Thu, 10 Jun 2021 11:28:25 +0000 (14:28 +0300)]
linux(4): Regen for futex_time64 system call.

MFC after: 2 weeks

3 years agolinux(4): Implement futex_time64 system call.
Dmitry Chagin [Thu, 10 Jun 2021 11:27:06 +0000 (14:27 +0300)]
linux(4): Implement futex_time64 system call.

MFC after: 2 weeks

3 years agolinux(4): Prevent integer overflow in futex_requeue.
Dmitry Chagin [Thu, 10 Jun 2021 11:23:11 +0000 (14:23 +0300)]
linux(4): Prevent integer overflow in futex_requeue.

To prevent a signed integer overflow in futex_requeue add a sanity check
to catch negative values of nrwake or nrrequeue.

MFC after: 2 weeks

3 years agolinux(4): Regen for futex system call.
Dmitry Chagin [Thu, 10 Jun 2021 11:16:40 +0000 (14:16 +0300)]
linux(4): Regen for futex system call.

MFC after: 2 weeks

3 years agolinux(4): Change Linux futex syscall definition to match Linux actual one.
Dmitry Chagin [Thu, 10 Jun 2021 11:00:00 +0000 (14:00 +0300)]
linux(4): Change Linux futex syscall definition to match Linux actual one.

MFC after: 2 weeks

3 years agolibcasper: fix descriptors numbers
Mariusz Zaborski [Wed, 9 Jun 2021 21:46:51 +0000 (23:46 +0200)]
libcasper: fix descriptors numbers

Casper services expect that the first 3 descriptors (stdin/stdout/stderr)
will point to /dev/null. Which Casper will ensure later. The Casper
services are forked from the original process. If the initial process
closes one of those descriptors, Casper may reuse one of them for it on
purpose. If this is the case, then renumarate the descriptors used by
Casper to higher numbers. This is done already after the fork, so it
doesn't break the parent process.

PR: 225343
Reported by: Borja Marcos <borjam (at) sarenet.es>
Tested by: jkim@

3 years agostress2: Exclude new syzkaller tests
Peter Holm [Thu, 10 Jun 2021 02:30:12 +0000 (04:30 +0200)]
stress2: Exclude new syzkaller tests

3 years agoinsetad -> instead
Warner Losh [Thu, 10 Jun 2021 02:17:22 +0000 (20:17 -0600)]
insetad -> instead

3 years agoAdded error for writing to /dev/ on Linux
Rich Ercolani [Thu, 10 Jun 2021 00:57:57 +0000 (20:57 -0400)]
Added error for writing to /dev/ on Linux

Starting in Linux 5.10, trying to write to /dev/{null,zero} errors out.
Prefer to inform people when this happens rather than hoping they guess
what's wrong.

Reviewed-by: Antonio Russo <aerusso@aerusso.net>
Reviewed-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: John Kennedy <john.kennedy@delphix.com>
Signed-off-by: Rich Ercolani <rincebrain@gmail.com>
Closes:  #11991

3 years agomk: WITH_FOO=no now generates a warning
Warner Losh [Thu, 10 Jun 2021 00:10:12 +0000 (18:10 -0600)]
mk: WITH_FOO=no now generates a warning

Many people are used to gnu configure's behavior of changing
--with-foo=no to --without-foo. At the same time, several folks have
WITH_FOO=no in their config files to enable this ironic form of the
option because of an old meme from IRC, a mailing list or the forums (I
forget which). Add a warning to allow to alert people w/o breaking POLA.

Reviewed by: allanjude, bdrewery, manu
MFC After: 2 weeks
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D30684

3 years agolib{efi,avl,share,tpool,zfs_core,zfsbootenv,zutil}: -fvisibility=hidden
наб [Thu, 3 Jun 2021 21:50:07 +0000 (23:50 +0200)]
lib{efi,avl,share,tpool,zfs_core,zfsbootenv,zutil}: -fvisibility=hidden

No symbols affected in libavl
No symbols affected by libtpool, but pre-ANSI declarations got purged
No symbols affected by libzfs_core
No symbols affected by libzfs_bootenv

libefi got cleaned, gained efi_debug documentation in efi_partition.h,
and removes one undocumented and unused symbol from libzfs_core:
  D default_vtoc_map

libnvpair saw removal of these symbols:
  D nv_alloc_nosleep_def
  D nv_alloc_sleep
  D nv_alloc_sleep_def
  D nv_fixed_ops_def
  D nvlist_hashtable_init_size
  D nvpair_max_recursion

libshare saw removal of these symbols from libzfs:
  T libshare_nfs_init
  T libshare_smb_init
  T register_fstype
  B smb_shares

libzutil saw removal of these internal symbols from libzfs_core:
  T label_paths
  T slice_cache_compare
  T zpool_find_import_blkid
  T zpool_open_func
  T zutil_alloc
  T zutil_strdup

Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
Reviewed-by: John Kennedy <john.kennedy@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #12191

3 years agolibefi: remove efi_auto_sense()
наб [Thu, 3 Jun 2021 21:34:27 +0000 (23:34 +0200)]
libefi: remove efi_auto_sense()

It's present (but undocumented) in the illumos gate and used exclusively
by rmformat(1) (which I recommend as a nice blast from the past),
and also the math assumes 512B sectors and is therefore wrong

Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
Reviewed-by: John Kennedy <john.kennedy@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #12191

3 years agoLinuxKPI: add fault_flag_allow_retry_first
Greg V [Wed, 9 Jun 2021 23:09:16 +0000 (19:09 -0400)]
LinuxKPI: add fault_flag_allow_retry_first

Used by drm 5.7.

Reviewed by: bz, hselasky, nc
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D30673