]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
2 years agoAdd an implementation of CHACHA20_POLY1305 to cryptosoft.
John Baldwin [Thu, 18 Feb 2021 17:22:18 +0000 (09:22 -0800)]
Add an implementation of CHACHA20_POLY1305 to cryptosoft.

This uses the chacha20 IETF and poly1305 implementations from
libsodium.  A seperate auth_hash is created for the auth side whose
Setkey method derives the poly1305 key from the AEAD key and nonce as
described in RFC 8439.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D27837

(cherry picked from commit dd2e1352b68aa33f7f6f8c19aaf88cf287013ae8)

2 years agoAdd an OCF algorithm for ChaCha20-Poly1305 AEAD.
John Baldwin [Thu, 18 Feb 2021 17:21:56 +0000 (09:21 -0800)]
Add an OCF algorithm for ChaCha20-Poly1305 AEAD.

Note that this algorithm implements the mode defined in RFC 8439.

Reviewed by: cem
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D27836

(cherry picked from commit fc8fc743d89388c0c5b97a491428fab2b36beac8)

2 years agocontrib/tzdata: correct DST in Fiji
Philip Paeps [Mon, 18 Oct 2021 06:19:42 +0000 (14:19 +0800)]
contrib/tzdata: correct DST in Fiji

Direct commit to stable/13.

Unfortunately, there is still no clear consensus on the tz mailing list
about some of the changes introduced by tzdata 2021b and later releases.
Pending consensus, only merge the recently announced DST transition date
for Fiji and corrections to commentary from tzdata 2021d.  This corrects
future timestamps in Fiji.

2 years agocxgbe/t4_tom: Use stale L2T entry and avoid busy-waiting for resolution.
Navdeep Parhar [Thu, 9 Sep 2021 03:46:42 +0000 (20:46 -0700)]
cxgbe/t4_tom: Use stale L2T entry and avoid busy-waiting for resolution.
Sponsored by: Chelsio Communications

(cherry picked from commit 53c17de2b472c5c4982d5a020268ad3098241498)

2 years agocxgbe(4): Fix the decode and display of the DBVFIFO region in meminfo.
Navdeep Parhar [Tue, 7 Sep 2021 23:28:11 +0000 (16:28 -0700)]
cxgbe(4): Fix the decode and display of the DBVFIFO region in meminfo.

Sponsored by: Chelsio Communications

(cherry picked from commit 92de737996660b70376a8b72b80037f89d876056)

2 years agocxgbe(4): Display HMA information in meminfo.
Navdeep Parhar [Tue, 7 Sep 2021 20:39:44 +0000 (13:39 -0700)]
cxgbe(4): Display HMA information in meminfo.

This should have been added with initial T6 support many years ago.

Sponsored by: Chelsio Communications

(cherry picked from commit 83a611e09238ead5a765c0ea2c02699fe8175756)

2 years agocxgbe(4): Initialize abs_id for ctrl and ofld queues.
Navdeep Parhar [Mon, 19 Jul 2021 22:47:07 +0000 (15:47 -0700)]
cxgbe(4): Initialize abs_id for ctrl and ofld queues.

Sponsored by: Chelsio Communications

(cherry picked from commit 76c890229628109e46f01c5037b773b59247a1f8)

2 years agocxgbetool(8): Update the register definitions used to decode regdump.
Navdeep Parhar [Wed, 14 Jul 2021 00:51:13 +0000 (17:51 -0700)]
cxgbetool(8): Update the register definitions used to decode regdump.

Obtained from: Chelsio Communications
Sponsored by: Chelsio Communications

(cherry picked from commit 35e62b00c3342cffee042093b72a52f3f19e5263)

2 years agocxgbe(4): Skip a few more T5/T6 registers during a regdump.
Navdeep Parhar [Tue, 13 Jul 2021 23:38:55 +0000 (16:38 -0700)]
cxgbe(4): Skip a few more T5/T6 registers during a regdump.

These registers have read side effects and a read at just the right
(wrong?) time can trash some internal hw state.

Obtained from: Chelsio Communications
Sponsored by: Chelsio Communications

(cherry picked from commit f13920b39b8b500a17fc276629d70828f9f2d4b1)

2 years agocxgbe(4): Update firmwares to 1.26.2.0.
Navdeep Parhar [Mon, 27 Sep 2021 23:45:56 +0000 (16:45 -0700)]
cxgbe(4): Update firmwares to 1.26.2.0.

The firmwares and the following changelog are from the "Chelsio Unified
Wire v3.15.0.0 for Linux."

Version : 1.26.2.0
Date    : 09/24/2021
====================

FIXES
-----

BASE:
- Added support for SFP+ RJ45 (0x1C).
- Fixing backward compatibility issue with older drivers when multiple
  speeds are passed to firmware.

OFLD:
- Do not touch tp_plen_max if driver is supplying tp_plen_max. This
  fixes a connection reset issue in iscsi.

ENHANCEMENTS
------------

BASE:
- Firmware header modified to add firmware binary signature.

Sponsored by: Chelsio Communications

(cherry picked from commit 45d6fbaec23eee457197a14517e715c947114d99)

2 years agocxgbe(4): Update firmwares to 1.26.0.0.
Navdeep Parhar [Thu, 24 Jun 2021 20:21:51 +0000 (13:21 -0700)]
cxgbe(4): Update firmwares to 1.26.0.0.

Changes since 1.25.6.0 are listed here.  This list comes from the
Release Notes for "Chelsio Unified Wire 3.14.0.4 for Linux" dated
2021-07-08.

Fixes
-----

BASE:
- Wait 5ms before and after the i2c command that clears the mod_select.
  This fixes incorrect port module type read from i2c.

Obtained from: Chelsio Communications
Sponsored by: Chelsio Communications

(cherry picked from commit 3c900106ea7aab69690945ad885b4df1095c1504)

2 years agocxgbe(4): Do not configure traffic classes automatically on attach.
Navdeep Parhar [Thu, 24 Jun 2021 20:05:57 +0000 (13:05 -0700)]
cxgbe(4): Do not configure traffic classes automatically on attach.

The driver used to configure all available classes with some default
parameters on attach and the rest of t4_sched.c was written with the
assumption that all traffic classes are always valid in the hardware.
But this resulted in a lot of informational messages being logged in the
firmware's circular log, crowding out other more useful messages.

This change leaves the tx scheduler alone during attach to reduce the
spam in the devlog.  The state of every class is now tracked separately
from its flags and there is support for an 'uninitialized' state.

Sponsored by: Chelsio Communications

(cherry picked from commit ec8004dd419d8c8acfc9025dd050f141c949d53a)

2 years agocxgbe(4): Get the number of usable traffic classes from the firmware.
Navdeep Parhar [Tue, 22 Jun 2021 05:07:56 +0000 (22:07 -0700)]
cxgbe(4): Get the number of usable traffic classes from the firmware.

Recent firmwares are able to utilize the traffic classes of tx channels
that were previously unused.  This effectively doubles the number of
traffic classes available per port for 2 port cards.  Stop using the raw
per-channel value in the driver and ask the firmware for the number of
usable traffic classes instead.

Sponsored by: Chelsio Communications

(cherry picked from commit 6beb67c7e0ad4c3f8277ed1122ef5efcde0a269c)

2 years agocxgbe/iw_cxgbe: Support for 512 SGL entries in one memory registration.
Navdeep Parhar [Tue, 1 Jun 2021 19:57:53 +0000 (12:57 -0700)]
cxgbe/iw_cxgbe: Support for 512 SGL entries in one memory registration.

Use the correct SGL limit within iw_cxgbe, firmwares >= 1.25.6.0 support
upto 512 entries per MR.

Obtained from: Chelsio Communications
Sponsored by: Chelsio Communications

(cherry picked from commit 211972cfb816f8da8b8a4c524b44dde4638c3288)

2 years agocxgbe(4): Check if the firmware supports 512 SGL per FR MR.
Navdeep Parhar [Tue, 1 Jun 2021 19:14:17 +0000 (12:14 -0700)]
cxgbe(4): Check if the firmware supports 512 SGL per FR MR.

Firmwares >= 1.25.6.0 support 512 SGL entries in a single memory
registration request.

Obtained from: Chelsio Communications
Sponsored by: Chelsio Communications

(cherry picked from commit db15dbf8801120241b7bfb6461341f2cb421ef8e)

2 years agocxgbe(4): Update firmwares to 1.25.6.0.
Navdeep Parhar [Tue, 25 May 2021 20:47:06 +0000 (13:47 -0700)]
cxgbe(4): Update firmwares to 1.25.6.0.

Changes since 1.25.0.0 are listed here.  This list comes from the
Release Notes for the "Chelsio Unified Wire v3.14.0.3 for Linux"
release dated 2021-05-21.

Fixes
-----

BASE:
- Fixed Back to back T6 100G-CR4 link coming up with NO FEC sometimes.
- [T5] Try to bring up link in 1G speed if link doesn't come up on 10G.
- Fixed a bug to not allow BaseR fec in 100G speed.
- Fixed linkup issues on BT adapter in 1G and 100M speed.
- Fixed an issue to allow driver to send VI_ENABLE multiple times (once
  with rx disable and then later rx enable).
- Fixed rate limiting not working on class number 16 to 30.
- Fixed backward compatibility issue in port type interpretation with vpd
  version 0x80.

ETH:
- Fixed a case when firmware failed to deliver NIC WR completion to host.
- No rate limit support for WR ETH_TX_PKTS2 due to performance reasons.

OFLD
- Fixed a connection hang in SO adapters when tp_plen_max (set by driver)
  is more than the window size.
- Added fw_filter_vnic_mode to firmware API file (t4fw_interface.h)
- Use correct rx channel in coprocessor crypto completion (CPL_FW6_PLD). This
  was causing out of order completion to host.

FOiSCSI
- Fixed a crash due to unaligned access of ipv6 address.
- Fixed a crash during lun reset.

Enhancements
------------

ETH:
- Rate limiting support added for encapsulated (vxlan, nvgre, geneve) NIC TCP
  packets.

OFLD:
- More than 128 SGLs supported in FW_RI_FR_NSMR_WR. Now, more than 16GB
  (upto 64GB) of PBLs can be written with single FW_RI_FR_NSMR_WR.

Obtained from: Chelsio Communications
Sponsored by: Chelsio Communications

(cherry picked from commit e0fa04e257c1af4c793a70a124ba41e592570c14)

2 years agocxgb(4): Report proper TSO limits.
Navdeep Parhar [Fri, 4 Jun 2021 20:30:28 +0000 (13:30 -0700)]
cxgb(4): Report proper TSO limits.

Sponsored by: Chelsio Communications

(cherry picked from commit f13d72fd0b743a1fd97dd31f4abf19e8814c420b)

2 years agocxgbe(4): Fix an incorrect assert.
Navdeep Parhar [Thu, 27 May 2021 02:18:42 +0000 (19:18 -0700)]
cxgbe(4): Fix an incorrect assert.

CTRL and OFLD tx queues do not have automatic tx credit flush enabled so
it is okay for the cidx not to be the same as the pidx when the queue is
destroyed.

Reported by: Jithesh Arakkan @ Chelsio
Sponsored by: Chelsio Communications

(cherry picked from commit 5ef87bf8b687575bee010967e23cd2c552b43ad9)

2 years agocxgbe(4): Empty the clib_db before trying to destroy it.
Navdeep Parhar [Fri, 4 Jun 2021 19:01:14 +0000 (12:01 -0700)]
cxgbe(4): Empty the clib_db before trying to destroy it.

This fixes a panic on driver unload.

Reported by: Jithesh Arakkan @ Chelsio
Sponsored by: Chelsio Communications

(cherry picked from commit bb877c0620347eb86f25f4382c42d58685c348d4)

2 years agocxgbe(4): Use correct argument in call to hashdestroy.
Navdeep Parhar [Thu, 27 May 2021 04:32:13 +0000 (21:32 -0700)]
cxgbe(4): Use correct argument in call to hashdestroy.

This fixes a panic on driver module unload.

Fixes: 24b98f288d11 cxgbe(4): Overhaul CLIP (Compressed Local IPv6) table management.
Sponsored by: Chelsio Communications

(cherry picked from commit 740d722def71905dd74a622acce1561701ccbec6)

2 years agocxgbetool(8): add a 'clip' subcommand to deal with the CLIP table.
Navdeep Parhar [Sun, 23 May 2021 23:28:31 +0000 (16:28 -0700)]
cxgbetool(8): add a 'clip' subcommand to deal with the CLIP table.

Sponsored by: Chelsio Communications

(cherry picked from commit ac02945f7e2b5ab84fe510fc052c35350e31220d)

2 years agocxgbe(4): Overhaul CLIP (Compressed Local IPv6) table management.
Navdeep Parhar [Sun, 23 May 2021 21:58:29 +0000 (14:58 -0700)]
cxgbe(4): Overhaul CLIP (Compressed Local IPv6) table management.

- Process the list of local IPs once instead of once per adapter.  Add
  addresses from all VNETs to the driver's list but leave hardware
  updates for later when the global VNET/IFADDR list locks have been
  released.

- Add address to the hardware table synchronously when a CLIP entry is
  requested for an address that's not already in there.

- Provide ioctls that allow userspace tools to manage addresses in the
  CLIP table.

- Add a knob (hw.cxgbe.clip_db_auto) that controls whether local IPs are
  automatically added to the CLIP table or not.

Sponsored by: Chelsio Communications

(cherry picked from commit 24b98f288d11750f2cdfbfe360be1c92a9c2ee1d)

2 years agocxgbe(4): Fix build warnings with NOINET kernels.
Navdeep Parhar [Sat, 22 May 2021 03:42:04 +0000 (20:42 -0700)]
cxgbe(4): Fix build warnings with NOINET kernels.

MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D26334

(cherry picked from commit ffbb373c5a95c37be693330a76a093fbcf546440)

2 years agocxgbe(4): Add support for NIC suspend/resume and live reset.
Navdeep Parhar [Wed, 28 Apr 2021 04:33:10 +0000 (21:33 -0700)]
cxgbe(4): Add support for NIC suspend/resume and live reset.

Add suspend/resume callbacks to the driver and a live reset built around
them.  This commit covers the basic NIC and future commits will expand
this functionality to other stateful parts of the chip.  Suspend and
resume operate on the chip (the t?nex nexus device) and affect all its
ports.  It is not possible to suspend/resume or reset individual ports.
All these operations can be performed on a running NIC.  A reset will
look like a link bounce to the networking stack.

Here are some ways to exercise this functionality:

 /* Manual suspend and resume. */
 # devctl suspend t6nex0
 # devctl resume t6nex0

 /* Manual reset. */
 # devctl reset t6nex0

 /* Manual reset with driver sysctl. */
 # sysctl dev.t6nex.0.reset=1

 /* Automatic adapter reset on any fatal error. */
 # hw.cxgbe.reset_on_fatal_err=1

Suspend disables the adapter (DMA, interrupts, and the port PHYs) and
marks the hardware as unavailable to the driver.  All ifnets associated
with the adapter are still visible to the kernel but operations that
require hardware interaction will fail with ENXIO.  All ifnets report
link-down while the adapter is suspended.

Resume will reattach to the card, reconfigure it as before, and recreate
the queues servicing the existing ifnets.  The ifnets are able to send
and receive traffic as soon as the link comes back up.

Reset is roughly the same as a suspend and a resume with at least one of
these events in between: D0->D3Hot->D0, FLR, PCIe link retrain.

(cherry picked from commit 83b5cda106a2dc0c8ace1718485c2ef05c5aa62b)

2 years agocxgbe(4): Separate the sw- and hw-specific parts of resource allocations
Navdeep Parhar [Mon, 26 Apr 2021 21:03:06 +0000 (14:03 -0700)]
cxgbe(4): Separate the sw- and hw-specific parts of resource allocations

The driver uses both software resources (locks, callouts, memory for
descriptors and for bookkeeping, sysctls, etc.) and hardware resources
(VIs, DMA queues, TCAM entries, etc.) to operate the NIC.  This commit
splits the single *_ALLOCATED flag used to track all these resources
into separate *_SW_ALLOCATED and *_HW_ALLOCATED flags.

This is the simplified pseudocode that now applies to most queues (foo
can be ctrlq/txq/rxq/ofld_txq/ofld_rxq):

/* Idempotent */
alloc_foo
{
if (!SW_ALLOCATED)
init_iq/init_eq/init_fl no-fail sw init
alloc_iq_fl/alloc_eq/alloc_wrq may-fail sw alloc
add_foo_sysctls, etc. no-fail post-alloc items
if (!HW_ALLOCATED)
alloc_iq_fl_hwq/alloc_eq_hwq hw resource allocation
}

/* Idempotent */
free_foo
{
if (!HW_ALLOCATED)
free_iq_fl_hwq/free_eq_hwq release hw resources
if (!SW_ALLOCATED)
free_iq_fl/free_eq/free_wrq release sw resources
}

The routines that take the driver to FULL_INIT_DONE and VI_INIT_DONE and
back are now all idempotent.  The quiesce routines pay attention to the
HW_ALLOCATED flag and will not wait on the hardware for pidx/cidx
updates and other completions if this flag is not set.

Sponsored by: Chelsio Communications

(cherry picked from commit 43bbae19483fbde0a91e61acad8a6e71e334c8b8)

2 years agopf: Introduce pf_nvbool()
Kristof Provost [Wed, 13 Oct 2021 09:00:46 +0000 (11:00 +0200)]
pf: Introduce pf_nvbool()

Similar to the existing functions for strings and ints, this lets us
simplify some of the nvlist conversion code.

MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 776df104fa54bb581e1fb88ac44af4fa7fd4052b)

2 years agobhyve: Update usage and synopsis for the -k flag
Mateusz Piotrowski [Tue, 12 Oct 2021 19:49:43 +0000 (21:49 +0200)]
bhyve: Update usage and synopsis for the -k flag

Let's make it clear to users that -k is for configuration files.
Also, point to bhyve_config(5) in the paragraph describing the flag.

Reviewed by: jhb
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D32467

(cherry picked from commit f656df586ad1aa86a2b9f076a224f746d5308613)

2 years agonfscl: Fix another deadlock related to the NFSv4 clientID lock
Rick Macklem [Wed, 13 Oct 2021 00:21:01 +0000 (17:21 -0700)]
nfscl: Fix another deadlock related to the NFSv4 clientID lock

Without this patch, it is possible to hang the NFSv4 client,
when a rename/remove is being done on a file where the client
holds a delegation, if pNFS is being used.  For a delegation
to be returned, dirty data blocks must be flushed to the NFSv4
server.  When pNFS is in use, a shared lock on the clientID
must be acquired while doing a write to the DS(s).
However, if rename/remove is doing the delegation return
an exclusive lock will be acquired on the clientID, preventing
the write to the DS(s) from acquiring a shared lock on the clientID.

This patch stops rename/remove from doing a delegation return
if pNFS is enabled.  Since doing delegation return in the same
compound as rename/remove is only an optimization, not doing
so should not cause problems.

This problem was detected during a recent NFSv4 interoperability
testing event held by the IETF working group.

(cherry picked from commit b82168e657d378ff86ea18c4f03b98aac9ee9bb3)

2 years agonfscl: Fix a deadlock related to the NFSv4 clientID lock
Rick Macklem [Tue, 12 Oct 2021 04:58:24 +0000 (21:58 -0700)]
nfscl: Fix a deadlock related to the NFSv4 clientID lock

Without this patch, it is possible for a process doing an NFSv4
Open/create of a file to block to allow another process
to acquire the exclusive lock on the clientID when holding
a shared lock on the clientID.  As such, both processes
deadlock, with one wanting the exclusive lock, while the
other holds the shared lock.  This deadlock is unlikely to occur
unless delegations are in use on the NFSv4 mount.

This patch fixes the problem by not deferring to the process
waiting for the exclusive lock when a shared lock (reference cnt)
is already held by the process.

This problem was detected during a recent NFSv4 interoperability
testing event held by the IETF working group.

(cherry picked from commit 120b20bdf49630cf2a7dbc5f93b9e985e1f4f198)

2 years agoRevert "libc/locale: Fix races between localeconv(3) and setlocale(3)"
Mark Johnston [Wed, 20 Oct 2021 01:13:12 +0000 (21:13 -0400)]
Revert "libc/locale: Fix races between localeconv(3) and setlocale(3)"

This reverts commit f89204d6b99d11aa1f67722e8c1d33b0fc4d61d7.

I didn't intend to push this commit yet, pending discussion on PR
258360.

PR: 258360

2 years agomount: Check for !VDIR mount points before handling -o emptydir
Mark Johnston [Wed, 13 Oct 2021 00:11:02 +0000 (20:11 -0400)]
mount: Check for !VDIR mount points before handling -o emptydir

To implement -o emptydir, vfs_emptydir() checks that the passed
directory is empty.  This should be done after checking whether the
vnode is of type VDIR, though, or vfs_emptydir() may end up calling
VOP_READDIR on a non-directory.

Reported by: syzbot+4006732c69fb0f792b2c@syzkaller.appspotmail.com
Reviewed by: kib, imp
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 03d5820f738de130b2feb66833f18741b7f92a14)

2 years agolibc/locale: Fix races between localeconv(3) and setlocale(3)
Mark Johnston [Fri, 17 Sep 2021 14:44:23 +0000 (10:44 -0400)]
libc/locale: Fix races between localeconv(3) and setlocale(3)

Each locale embeds a lazily initialized lconv which is populated by
localeconv(3) and localeconv_l(3).  When setlocale(3) updates the global
locale, the lconv needs to be (lazily) reinitialized.  To signal this,
we set flag variables in the locale structure.  There are two problems:

- The flags are set before the locale is fully updated, so a concurrent
  localeconv() call can observe partially initialized locale data.
- No barriers ensure that localeconv() observes a fully initialized
  locale if a flag is set.

So, move the flag update appropriately, and use acq/rel barriers to
provide some synchronization.  Note that this is inadequate in the face
of multiple concurrent calls to setlocale(3), but this is not expected
to work regardless.

Thanks to Henry Hu <henry.hu.sh@gmail.com> for providing a test case
demonstrating the race.

PR: 258360
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 7eb138a9e53636366e615bdf04062fedc044bcea)

2 years agortld direct exec: add -d option
Konstantin Belousov [Mon, 11 Oct 2021 22:26:54 +0000 (01:26 +0300)]
rtld direct exec: add -d option

(cherry picked from commit ba7f9c1b61329630af25e75cdaca261b389318c7)

2 years agosysdecode_enum.3: Fix a typo: SIGBTRAP -> SIGTRAP.
John Baldwin [Tue, 5 Oct 2021 21:55:18 +0000 (14:55 -0700)]
sysdecode_enum.3: Fix a typo: SIGBTRAP -> SIGTRAP.

Sponsored by: DARPA

(cherry picked from commit 680d70b59e0379ded0cc94e3772bc47be2163c7f)

2 years agoAdd EPOCH_TRACE to NOTES to get LINT coverage.
John Baldwin [Sat, 11 Sep 2021 20:05:44 +0000 (13:05 -0700)]
Add EPOCH_TRACE to NOTES to get LINT coverage.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit b9485d76e3ad4924032a23c82b8a30a0dce31918)

2 years agoDocument kern.log_wakeups_per_second.
John Baldwin [Wed, 4 Aug 2021 18:50:34 +0000 (11:50 -0700)]
Document kern.log_wakeups_per_second.

PR: 148680

(cherry picked from commit c51e4962a3cf2959d1f1cb9ab74ceab448583169)

2 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

(cherry picked from commit e290182bcf3895ca659dff111bca6a077c4708b1)

2 years agoconfig: Fix typo in comment.
John Baldwin [Mon, 1 Feb 2021 21:13:36 +0000 (13:13 -0800)]
config: Fix typo in comment.

(cherry picked from commit bcaa6aa15383cacf5f20179be919bb8dd45cc5f4)

2 years agonfscl: Add a check for "has acquired a delegation" to nfscl_removedeleg()
Rick Macklem [Mon, 27 Sep 2021 01:37:25 +0000 (18:37 -0700)]
nfscl: Add a check for "has acquired a delegation" to nfscl_removedeleg()

Commit 5e5ca4c8fc53 added a flag to a NFSv4 mount point that is set when
the first delegation is acquired from the NFSv4 server.

For a common case where delegations are not being issued by the
NFSv4 server, the nfscl_removedeleg() code acquires the mutex lock for
open/lock state, finds the delegation list empty, then just unlocks the
mutex and returns. This patch adds a check of the flag to avoid the
need to acquire the mutex for this common case.

This change appears to be performance neutral for a small number
of opens, but should reduce lock contention for a large number of opens
for the common case where server is not issuing delegations.

This commit should not affect the high level semantics of delegation
handling.

(cherry picked from commit 62c5be4ab4c8b8127185286e148638cb8cdf45f4)

2 years agoselsocket: handle sopoll() errors correctly
Brooks Davis [Tue, 19 Oct 2021 23:19:57 +0000 (00:19 +0100)]
selsocket: handle sopoll() errors correctly

Without this change, unmounting smbfs filesystems with an INVARIANTS
kernel would panic after 10e64782ed59727e8c9fe4a5c7e17f497903c8eb.

PR: 253079
Found by: markj
Reviewed by: markj, jhb
Obtained from: CheriBSD
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D32492

(cherry picked from commit 04c91ac48ad13ce0d1392cedbd69c2c0223d206f)

2 years agomakesyscalls.lua: add a CAPENABLED flag
Brooks Davis [Tue, 19 Oct 2021 23:19:56 +0000 (00:19 +0100)]
makesyscalls.lua: add a CAPENABLED flag

The CAPENABLED flag indicates that the syscall can be used in capsicum
capability mode.  It is intended to replace capabilities.conf.

Reviewed by: kevans, emaste
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D31349

(cherry picked from commit 6945df3fff57a9606f8c8a4e3865def3a0e915e7)

2 years agomakesyscalls.lua: Add a new syscall type: RESERVED
Brooks Davis [Tue, 19 Oct 2021 23:19:56 +0000 (00:19 +0100)]
makesyscalls.lua: Add a new syscall type: RESERVED

RESERVED syscall number are reserved for local/vendor use.  RESERVED is
identical to UNIMPL except that comments are ignored.

Reviewed by: kevans
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D27988

(cherry picked from commit 119fa6ee8a8056aab5e4ab1719d3c563cdb4a95a)

2 years agociss(4): Fix typo.
Alexander Motin [Sun, 19 Sep 2021 18:01:40 +0000 (14:01 -0400)]
ciss(4): Fix typo.

(cherry picked from commit 5f8cb13cfb0c91a4ec1a9648a3ae245b1dff36f6)

2 years agociss(4): Properly handle data underrun.
Alexander Motin [Sun, 19 Sep 2021 17:45:51 +0000 (13:45 -0400)]
ciss(4): Properly handle data underrun.

For SCSI data underrun is a part of normal life.  It should not be
reported as error.  This fixes MODE SENSE used by modern CAM.

MFC after: 1 month

(cherry picked from commit e8144a13e075ff13c1f162690c7f14dd3f0a4862)

2 years agocam(4): Limit search for disks in SES enclosure by single bus
Alexander Motin [Tue, 5 Oct 2021 19:01:16 +0000 (15:01 -0400)]
cam(4): Limit search for disks in SES enclosure by single bus

At least for SAS that we only support now disks are typically
connected to the same bus as the enclosure.  Limiting the search
scope makes it much faster on systems with multiple buses and
thousands of disks.

Reviewed by: imp
MFC after: 2 weeks
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D32305

(cherry picked from commit 730ea72c706ef8e025616772cfd86fd89ed3d42e)

2 years agocam(4): Improve XPT_DEV_MATCH
Alexander Motin [Tue, 5 Oct 2021 18:54:03 +0000 (14:54 -0400)]
cam(4): Improve XPT_DEV_MATCH

Remove *_MATCH_NONE enums, making no sense and so never used.  Make
*_MATCH_ANY enums 0 (no any match flags set), previously used by
*_MATCH_NONE.  Bump CAM_VERSION to 0x1a reflecting those changes and
add compat shims.

When traversing through buses and devices do not descend if we can
already see that requested pattern does not match the bus or device.
It allows to save significant amount of time on system with thousands
of disks when doing limited searches.

Reviewed by: imp
MFC after: 2 weeks
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D32304

(cherry picked from commit 8f9be1eed11c27c66386c3d72cd6c6aef597fa0d)

2 years agoChange lowest address on subnet (host 0) not to broadcast by default.
Mike Karels [Sun, 5 Sep 2021 18:14:04 +0000 (13:14 -0500)]
Change lowest address on subnet (host 0) not to broadcast by default.

The address with a host part of all zeros was used as a broadcast long
ago, but the default has been all ones since 4.3BSD and RFC1122.  Until
now, we would broadcast the host zero address as well as the configured
address.  Change to not broadcasting that address by default, but add a
sysctl (net.inet.ip.broadcast_lowest) to re-enable it.  Note that the
correct way to use the zero address for broadcast would be to configure
it as the broadcast address for the network.

See https:/datatracker.ietf.org/doc/draft-schoen-intarea-lowest-address/
and the discussion in https://reviews.freebsd.org/D19316.  Note, Linux
now implements this.

Reviewed by: rgrimes, tuexen; melifaro (previous version)
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D31861

(cherry picked from commit fd0765933c3ccb059ad7456e657b2e8ed22f58b0)

2 years agoFix two typos in source code comments
Gordon Bergling [Sat, 16 Oct 2021 06:09:31 +0000 (08:09 +0200)]
Fix two typos in source code comments

- s/alocated/allocated/
- s/realocated/reallocated/

(cherry picked from commit 899a3b38f5172d70360396caeebb5b694638282e)

2 years agobpf(4): Fix a misnamed constant
Felix Johnson [Wed, 13 Oct 2021 23:00:41 +0000 (19:00 -0400)]
bpf(4): Fix a misnamed constant

rarpd.c was modified in r19859 to use REVARP_REQUEST instead of
ARPOP_REVREQUEST.

PR: 183333
Reported by: pluknet <pluknet@gmail.com>

(cherry picked from commit a524aaf68341d9f83a0ef7dc21ad54728ddaaa1e)

2 years agoacpi(4): Correct outdated sysctl
Felix Johnson [Wed, 13 Oct 2021 00:42:14 +0000 (20:42 -0400)]
acpi(4): Correct outdated sysctl

This changes the location of cx_supported sysctl to dev.cpu.N.

PR: 214370

(cherry picked from commit 6882064d0ced456c89d161da4bc43c5d97bab60b)

2 years agolibctf: Improve check for duplicate SOU definitions in ctf_add_type()
Mark Johnston [Mon, 4 Oct 2021 16:28:22 +0000 (12:28 -0400)]
libctf: Improve check for duplicate SOU definitions in ctf_add_type()

When copying a struct or union from one CTF container to another,
ctf_add_type() checks whether it matches an existing type in the
destination container.  It does so by looking for a type with the same
name and kind as the new type, and if one exists, it iterates over all
members of the source type and checks whether a member with matching
name and offset exists in the matched destination type.  This can
produce false positives, for example because member types are not
compared, but this is not expected to arise in practice.  If the match
fails, ctf_add_type() returns an error.

The procedure used for member comparison breaks down in the face of
anonymous struct and union members.  ctf_member_iter() visits each
member in the source definition and looks up the corresponding member in
the desination definition by name using ctf_member_info(), but this
function will descend into anonymous members and thus fail to match.
Fix the problem by introducing a custom comparison routine which does
not assume member names are unique.  This should also be faster for
types with many members; in the previous scheme, membcmp() would perform
a linear scan of the desination type's members to perform a lookup by
name.  The new routine steps through the members of both types in a
single loop.

PR: 258763
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 105fd928b0b5b35ab529e5f6914788dc49582901)

2 years agogeom_label: Add more validation for NTFS volume tasting
Mark Johnston [Mon, 4 Oct 2021 21:48:44 +0000 (17:48 -0400)]
geom_label: Add more validation for NTFS volume tasting

- Ensure that the computed MFT record size isn't negative or larger than
  maxphys before trying to read $Volume.
- Guard against truncated records in volume metadata.
- Ensure that the record length is large enough to contain the volume
  name.
- Verify that the (UTF-16-encoded) volume name's length is a multiple of
  two.

PR: 258833, 258914
Sponsored by: The FreeBSD Foundation

(cherry picked from commit f0a08fa9f532a58f5d7a4814d6eb7ddd49f368da)

2 years agounzip: Fix segmentation fault if a zip file contains buggy filename.
Yoshihiro Takahashi [Sun, 10 Oct 2021 11:49:19 +0000 (20:49 +0900)]
unzip: Fix segmentation fault if a zip file contains buggy filename.

PR:             259011
Reported by:    Robert Morris
Submitted by:   ak

(cherry picked from commit 2c614481fd5248c1685e713f67d40cf2d5fba494)

2 years agovfs: Permit unix sockets to be opened with O_PATH
Mark Johnston [Fri, 17 Sep 2021 16:34:21 +0000 (12:34 -0400)]
vfs: Permit unix sockets to be opened with O_PATH

As with FIFOs, a path descriptor for a unix socket cannot be used with
kevent().

In principle connectat(2) and bindat(2) could be modified to support an
AT_EMPTY_PATH-like mode which operates on the socket referenced by an
O_PATH fd referencing a unix socket.  That would eliminate the path
length limit imposed by sockaddr_un.

Update O_PATH tests.

Reviewed by: kib
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 2bd9826995ca6b23f8b088cfa035c0ad1c578ac3)

2 years agong_ppp(4): Fix a typo in a comment
Gordon Bergling [Thu, 14 Oct 2021 13:30:32 +0000 (15:30 +0200)]
ng_ppp(4): Fix a typo in a comment

- s/delcared/declared/

(cherry picked from commit 0a8159d8ca85383ec84076396c0a457c6d3e08f9)

2 years agoRestore PPS_SYNC in NOTES
Konstantin Belousov [Mon, 11 Oct 2021 22:02:35 +0000 (01:02 +0300)]
Restore PPS_SYNC in NOTES

(cherry picked from commit 4cc167a35217f9cee81a2f366e451fae42fd4a6c)

2 years agoEnable PPS_SYNC on amd64, arm64 and armv7
Konstantin Belousov [Sun, 10 Oct 2021 12:20:45 +0000 (15:20 +0300)]
Enable PPS_SYNC on amd64, arm64 and armv7

PR: 259036

(cherry picked from commit e81e77c5a055d1cbf6d6a6f0acbaf443267aa84f)

2 years agovmci: fix panic due to freeing unallocated resources
Mark Peek [Sat, 9 Oct 2021 21:21:16 +0000 (14:21 -0700)]
vmci: fix panic due to freeing unallocated resources

Summary:
An error mapping PCI resources results in a panic due to unallocated
resources being freed up. This change puts the appropriate checks in
place to prevent the panic.

PR: 252445
Reported by: Marek Zarychta <zarychtam@plan-b.pwste.edu.pl>
Tested by: marcus
MFC after: 1 week
Sponsored by: VMware

Test Plan:
Along with user testing, also simulated error by inserting a ENXIO
return in vmci_map_bars().

Reviewed by: marcus
Subscribers: imp
Differential Revision: https://reviews.freebsd.org/D32016

(cherry picked from commit 0f14bcbe384091c729464cb770372aeb79061070)

2 years agotimecounter: Let kern.timecounter.stepwarnings be set as a tunable
Mark Johnston [Sat, 9 Oct 2021 16:34:06 +0000 (12:34 -0400)]
timecounter: Let kern.timecounter.stepwarnings be set as a tunable

(cherry picked from commit fa9da1f590caba94b98717c33633efcf719da151)

2 years agoriscv: move signal delivery code to exec_machdep.c
Konstantin Belousov [Mon, 4 Oct 2021 15:15:17 +0000 (18:15 +0300)]
riscv: move signal delivery code to exec_machdep.c

(cherry picked from commit aba66031f27cec0bf9f6c6bc5d857e03eaf97d4f)

2 years agoarm: move signal delivery code to exec_machdep.c
Konstantin Belousov [Mon, 4 Oct 2021 11:39:11 +0000 (14:39 +0300)]
arm: move signal delivery code to exec_machdep.c

(cherry picked from commit dfaf65023ef0d9f68da856f3795448596751a69d)

2 years agoarm64: move signal delivery code to exec_machdep.c
Konstantin Belousov [Mon, 4 Oct 2021 06:55:51 +0000 (09:55 +0300)]
arm64: move signal delivery code to exec_machdep.c

(cherry picked from commit b4ae6b166066a789641e4a579020ca6b10b40cfa)

2 years agoi386: move signal delivery code to exec_machdep.c
Konstantin Belousov [Mon, 4 Oct 2021 01:29:26 +0000 (04:29 +0300)]
i386: move signal delivery code to exec_machdep.c

(cherry picked from commit 4c5bf591522c5449d017b7ea496488c42f847963)

2 years agoO_PATH: allow vfs_extattr syscalls
Greg V [Sun, 10 Oct 2021 12:45:31 +0000 (15:45 +0300)]
O_PATH: allow vfs_extattr syscalls

(cherry picked from commit 98dae405de7f8b3506dd94dcd3e9f51d3fb15962)

2 years agoFix typo in comment
Konstantin Belousov [Thu, 14 Oct 2021 20:03:36 +0000 (23:03 +0300)]
Fix typo in comment

(cherry picked from commit 86929782cfab2664010a31979e9e3c0626721ebb)

2 years agoStyle
Konstantin Belousov [Thu, 14 Oct 2021 19:30:18 +0000 (22:30 +0300)]
Style

(cherry picked from commit 1adebca1fc9f6def501f7a5c2b2bde5fe9049477)

2 years agoarm, arm64, riscv: adjust top-level nexus comment
Mitchell Horne [Thu, 7 Oct 2021 18:02:02 +0000 (15:02 -0300)]
arm, arm64, riscv: adjust top-level nexus comment

These platforms don't manage resources for DMA request lines or I/O
ports, this is specific to x86. Remove the references from the comments.

Reviewed by: imp, jhb
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D32358

(cherry picked from commit 17f790f49f5879ae9888b99fdbf857010ec13f9c)

2 years agoriscv: fix VM_MAXUSER_ADDRESS checks in asm routines
Mitchell Horne [Thu, 7 Oct 2021 21:12:30 +0000 (18:12 -0300)]
riscv: fix VM_MAXUSER_ADDRESS checks in asm routines

There are two issues with the checks against VM_MAXUSER_ADDRESS. First,
the comparison should consider the values as unsigned, otherwise
addresses with the high bit set will fail to branch. Second, the value
of VM_MAXUSER_ADDRESS is, by convention, one larger than the maximum
mappable user address and invalid itself. Thus, use the bgeu instruction
for these comparisons.

Add a regression test case for copyin(9).

PR: 257193
Reported by: Robert Morris <rtm@lcs.mit.edu>
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D31209

(cherry picked from commit 8babb5582eed2250309084d76898798409a2aae0)

2 years agoriscv: handle page faults in the unmappable region
Mitchell Horne [Thu, 7 Oct 2021 21:05:38 +0000 (18:05 -0300)]
riscv: handle page faults in the unmappable region

When handling a kernel page fault, check explicitly that stval resides
in either the user or kernel address spaces, and make the page fault
fatal if not. Otherwise, a properly crafted address may appear to
pmap_fault() as a valid and present page in the kernel map, causing the
page fault to be retried continuously. This is mainly due to the fact
that the upper bits of virtual addresses are not validated by most of
the pmap code.

Faults of this nature should only occur due to some kind of bug in the
kernel, but it is best to handle them gracefully when they do.

Handle user page faults in the same way, sending a SIGSEGV immediately
when a malformed address is encountered.

Add an assertion to pmap_l1(), which should help catch other bugs of
this kind that make it this far.

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

(cherry picked from commit 4a9f2f8b07c2d1a1c12f4aabdccd36f56b20cfda)

2 years agolibpmc: add some AMD pmu counter aliases
Mitchell Horne [Thu, 30 Sep 2021 14:13:37 +0000 (11:13 -0300)]
libpmc: add some AMD pmu counter aliases

Make it mostly compatible with what's defined for Intel. Except where
noted, these are defined for all of amdzen(1|2|3).

Reviewed by: emaste
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D32162

(cherry picked from commit a20c10893eb17e281f119d1b9b39c175dbf4d7bd)

2 years agolibpmc: fix the 'cycles' event alias on x86
Mitchell Horne [Thu, 30 Sep 2021 14:11:36 +0000 (11:11 -0300)]
libpmc: fix the 'cycles' event alias on x86

Looking for "tsc-tsc" in the pmu tables will fail every time. Instead,
make this an alias for the static TSC event defined in pmc_events.h.
This fixes 'pmcstat -s cycles' on Intel and AMD.

Reviewed by: emaste
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D32197

(cherry picked from commit 937539e0a32ce1da46223664ca1cf3b252e02ece)

2 years agominidump: De-duplicate the progress bar
Mitchell Horne [Wed, 29 Sep 2021 17:44:27 +0000 (14:44 -0300)]
minidump: De-duplicate the progress bar

The implementation of the progress bar is simple, but duplicated for
most minidump implementations. Extract the common bits to kern_dump.c.
Ensure that the bar is reset with each subsequent dump; this was only
done on some platforms previously.

Reviewed by: markj
MFC after: 2 weeks
Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D31885

(cherry picked from commit ab4ed843a303ea3e585f8ed3f79873e46d3b3ae3)

2 years agominidump: De-duplicate is_dumpable()
Mitchell Horne [Wed, 29 Sep 2021 17:30:11 +0000 (14:30 -0300)]
minidump: De-duplicate is_dumpable()

The function is identical in each minidump implementation, so move it to
vm_phys.c. The only slight exception is powerpc where the function was
public, for use in moea64_scan_pmap().

Reviewed by: kib, markj, imp (earlier version)
MFC after: 2 weeks
Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D31884

(cherry picked from commit 31991a5a45857e88c29dec422e0b8d6f68f8877b)

2 years agologin.conf.5: Mark passwordtime as implemented
Felix Johnson [Wed, 6 Oct 2021 20:47:02 +0000 (22:47 +0200)]
login.conf.5: Mark passwordtime as implemented

login.conf.5 listed passwordtime in RESERVED CAPABILITIES, which is a
section for capabilities not implemented in the base system. However,
passwordtime has been implemented in the base for several years now.

PR: 246099
Reported by: avg
Reviewed by: 0mp
MFC after: 3 days

(cherry picked from commit e7f8f3b95e1ff76765f1d2f4412b95f6ff5abe25)

2 years agontp.conf.5: Fix typos
Elyes HAOUAS [Wed, 6 Oct 2021 05:38:06 +0000 (07:38 +0200)]
ntp.conf.5: Fix typos

"certian" --> "certain"
"compatability" --> "compatibility"
"noticable" --> "noticeable"
"limite" --> "limit"
"acutal" --> "actual"
"ba" --> "be"

MFC after: 1 week
Pull Request:   https://github.com/freebsd/freebsd-src/pull/550
Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr>
(cherry picked from commit da3278ded3b2647d26da26788bab8363e502a144)

2 years agomps/mpr(4): Move xpt_register_async() out of lock.
Alexander Motin [Tue, 14 Sep 2021 21:37:02 +0000 (17:37 -0400)]
mps/mpr(4): Move xpt_register_async() out of lock.

It fixes lock ordere reversal between SIM and device locks.  Also
remove registration for AC_FOUND_DEVICE, unused for a while now.

MFC after: 1 month

(cherry picked from commit 02d8194012a9a0e367a92c7f89567b808bf0e9a8)

2 years ago[fib_algo][dxr] Retire counters which are no longer used
Marko Zec [Sat, 9 Oct 2021 11:47:10 +0000 (13:47 +0200)]
[fib_algo][dxr] Retire counters which are no longer used

The number of chunks can still be tracked via vmstat -z|fgrep dxr.

MFC after: 3 days

2 years ago[fib_algo][dxr] Improve incremental updating strategy
Marko Zec [Sat, 9 Oct 2021 11:22:27 +0000 (13:22 +0200)]
[fib_algo][dxr] Improve incremental updating strategy

Tracking the number of unused holes in the trie and the range table
was a bad metric based on which full trie and / or range rebuilds
were triggered, which would happen in vain by far too frequently,
particularly with live BGP feeds.

Instead, track the total unused space inside the trie and range table
structures, and trigger rebuilds if the percentage of unused space
exceeds a sysctl-tunable threshold.

MFC after: 3 days
PR: 257965

2 years agoBump __FreeBSD_version to 1300517 for LinuxKPI changes
Vladimir Kondratyev [Tue, 12 Oct 2021 13:22:37 +0000 (16:22 +0300)]
Bump __FreeBSD_version to 1300517 for LinuxKPI changes

2 years agoLinuxKPI: Import linux_page.c and some dependent code from drm-kmod
Vladimir Kondratyev [Wed, 29 Sep 2021 20:15:37 +0000 (23:15 +0300)]
LinuxKPI: Import linux_page.c and some dependent code from drm-kmod

No functional changes intended

Reviewed by: hselasky, manu, markj
Differential revision:  https://reviews.freebsd.org/D32167

(cherry picked from commit c072f6e856bc0348bf6fdd468761041948823f73)

2 years agoLinuxKPI: Update pte_fn_t definition to match Linux 5.3
Vladimir Kondratyev [Wed, 29 Sep 2021 20:15:27 +0000 (23:15 +0300)]
LinuxKPI: Update pte_fn_t definition to match Linux 5.3

Reviewed by: emaste, hselasky, manu
Differential revision: https://reviews.freebsd.org/D32166

(cherry picked from commit 88531adbfbe25c6ae56cc7bbe76c825a3f5dc504)

2 years agoLinuxKPI: Implement backlight_enable and backlight_disable functions
Vladimir Kondratyev [Wed, 29 Sep 2021 20:15:12 +0000 (23:15 +0300)]
LinuxKPI: Implement backlight_enable and backlight_disable functions

For now, disable backlight if brightness level is set to 0.
In the future we may implement separate knob in backlight(8).

Required by drm-kmod v5.6

Reviewed by: hselasky, manu
Differential revision: https://reviews.freebsd.org/D32165

(cherry picked from commit b52e36384091c5f80b06b79f5889492eac074426)

2 years agoLinuxKPI: Add dummy pgprot_decrypted() implementation
Vladimir Kondratyev [Wed, 29 Sep 2021 20:14:58 +0000 (23:14 +0300)]
LinuxKPI: Add dummy pgprot_decrypted() implementation

to reduce number of #ifdefs in drm-kmod

Reviewed by: hselasky
Differential revision: https://reviews.freebsd.org/D32094

(cherry picked from commit 3d86f8f1d7d1a070dd2e81367a4196a272b3bd07)

2 years agoLinuxKPI: Cast offset_in_page() parameter to unsigned long
Vladimir Kondratyev [Wed, 29 Sep 2021 20:14:47 +0000 (23:14 +0300)]
LinuxKPI: Cast offset_in_page() parameter to unsigned long

to reduce number of patches in drm-kmod

Reviewed by: hselasky
Differential revision: https://reviews.freebsd.org/D32093

(cherry picked from commit 37eba5b77a5733ac711b119141619c89b8446471)

2 years agoLinuxKPI: Import linux/poison.h header
Vladimir Kondratyev [Wed, 29 Sep 2021 20:14:34 +0000 (23:14 +0300)]
LinuxKPI: Import linux/poison.h header

Required by drm-kmod 5.6

Reviewed by: hselasky, imp, manu
Obtained from: OpenBSD
Differential revision: https://reviews.freebsd.org/D32092

(cherry picked from commit 6efabdeede7f3aac4b133116a421f5a7a721e24c)

2 years agoLinuxKPI: Add helper functions to store integers to linux/xarray.h
Vladimir Kondratyev [Wed, 29 Sep 2021 20:14:23 +0000 (23:14 +0300)]
LinuxKPI: Add helper functions to store integers to linux/xarray.h

Required by drm-kmod.

Reviewed by: hselasky
Differential revision: https://reviews.freebsd.org/D32091

(cherry picked from commit b59ffedae8f3707bf0079b4fd0cbf8190eed0c5e)

2 years agoLinuxKPI: Allow cdev_pager prefault handler to steal pages
Vladimir Kondratyev [Wed, 29 Sep 2021 20:14:05 +0000 (23:14 +0300)]
LinuxKPI: Allow cdev_pager prefault handler to steal pages

from other vm_objects. This workarounds "Page already inserted" panic
in vm_page_insert routine triggered on attempt to mmap file created
with shmem_file_setup call. After introduction of "GTT mmap
interface v4" a.k.a. MMAP_OFFSET, vm_objects allocated by these calls
may try to own intersected sets of pages that leads to the assertion.

Reviewed by: kib
Differential revision: https://reviews.freebsd.org/D32090

(cherry picked from commit 62ff0566c93056e00b3c9c3f8d2ac1e7d8e0c098)

2 years agoLinuxKPI: stub anon_inode_getfile
Vladimir Kondratyev [Wed, 29 Sep 2021 20:13:53 +0000 (23:13 +0300)]
LinuxKPI: stub anon_inode_getfile

Although drm-kmod contains better implementation which is able to
allocate real entries on pseudofs, this feature has never been used.

Starting from drm-kmod v5.6 old implementation began to leak entries
on each drm device close(). Now just drop pseudofs support instead of
fixing it in drm-kmod and provide stub in base.

Reviewed by: hselasky, manu
Differential revision: https://reviews.freebsd.org/D32069

(cherry picked from commit bd6d55adb4131d7172e0485d30ceca4e5aa12ff5)

2 years agoLinuxKPI: Factor out vmf_insert_pfn_prot() routine
Vladimir Kondratyev [Wed, 29 Sep 2021 20:13:41 +0000 (23:13 +0300)]
LinuxKPI: Factor out vmf_insert_pfn_prot() routine

from GEM and TTM page fault handlers and move it in to base system. This
code is tightly integrated with LKPI mmap support to belong to drm-kmod.

As this routine requires associated vm_object to be locked, it got
additional _locked suffix.

Reviewed by: hselasky, markj
Differential revision: https://reviews.freebsd.org/D32068

(cherry picked from commit f6823dac8fa6e9fc2926a866e9a0c4d43e38e236)

2 years agoLinuxKPI: Invoke release handler when file is destroyed by fput()
Vladimir Kondratyev [Wed, 29 Sep 2021 20:13:27 +0000 (23:13 +0300)]
LinuxKPI: Invoke release handler when file is destroyed by fput()

Required by drm_kmod 5.6

Reviewed by: hselasky, manu
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D32067

(cherry picked from commit 7d92d4835850fdc5c1ec1fa7c5634826a61ad0a5)

2 years agoLinuxKPI: allocate current before taking shrinkers lock
Vladimir Kondratyev [Wed, 29 Sep 2021 20:12:58 +0000 (23:12 +0300)]
LinuxKPI: allocate current before taking shrinkers lock

This fixes following warnings when shrinkers are invoked first time:

uma_zalloc_debug: zone "lkpicurr" with the following non-sleepable
locks held: exclusive sleep mutex lkpi-shrinker (lkpi-shrinker)

uma_zalloc_debug: zone "lkpimm" with the following non-sleepable locks
held: exclusive sleep mutex lkpi-shrinker (lkpi-shrinker)

Reviewed by: hselasky, manu
Differential revision: https://reviews.freebsd.org/D32066

(cherry picked from commit 2fe9ea5d3ad69d880138d98b2ae8d2c4309eeafa)

2 years agoLinuxKPI: implement _IOC_TYPE and _IOC_NR macros in linux/ioctl.h
Vladimir Kondratyev [Wed, 29 Sep 2021 20:12:47 +0000 (23:12 +0300)]
LinuxKPI: implement _IOC_TYPE and _IOC_NR macros in linux/ioctl.h

They are used by drm-kmod

Reviewed by: emaste, hselasky, manu
Differential revision: https://reviews.freebsd.org/D31674

(cherry picked from commit b58c916f115d9d40f91397a1b406891f36c39fad)

2 years agoLinuxKPI: Remove FreeBSD struct resource from all LKPI headers
Vladimir Kondratyev [Wed, 29 Sep 2021 20:12:36 +0000 (23:12 +0300)]
LinuxKPI: Remove FreeBSD struct resource from all LKPI headers

except linux/pci.h to avoid conflicts with Linux version.
This allows to #define resource in drm-kmod globally and strip some #ifdef-s

Reviewed by: hselasky, manu
Differential revision: https://reviews.freebsd.org/D31673

(cherry picked from commit 66ea390652d2ede405b43c168157986bd2b52bb9)

2 years agoLinuxKPI: Implement get_file_rcu()
Vladimir Kondratyev [Wed, 29 Sep 2021 20:12:25 +0000 (23:12 +0300)]
LinuxKPI: Implement get_file_rcu()

get_file_rcu() grabs a file if the file->f_count is not zero.

Required by drm-kmod 5.6

Reviewed by: hselasky, manu (previous version)
Differential revision: https://reviews.freebsd.org/D31672

(cherry picked from commit a81b36c6d35d74177891860b789dd02b9d1c5851)

2 years agoe1000: print EEPROM/NVM/OROM versions
Kevin Bowling [Wed, 6 Oct 2021 23:25:03 +0000 (16:25 -0700)]
e1000: print EEPROM/NVM/OROM versions

This is useful for diagnosing problems. In particular, the errata
sheets identify the EEPROM version for many fixes.

Reviewed by: gallatin
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D32333

(cherry picked from commit 293663f4da9e8b8aeb106ce3b73a8ed2aa2a8a90)

2 years agoe1000: Lock nvm print sysctl
Kevin Bowling [Wed, 6 Oct 2021 23:20:26 +0000 (16:20 -0700)]
e1000: Lock nvm print sysctl

Otherwise results in KASSERT with debug kernels because we rely on the
iflib CTX lock to implement the software serialization to the NVM model

Reviewed by: gallatin
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D32333

(cherry picked from commit 9b3e252e59c6e63594fb20e3f65188dab9e1eeff)

2 years agolinuxkpi: Handle a NULL cache pointer in kmem_cache_destroy()
Mark Johnston [Wed, 6 Oct 2021 18:45:22 +0000 (14:45 -0400)]
linuxkpi: Handle a NULL cache pointer in kmem_cache_destroy()

This is compatible with Linux, and some driver error paths depend on it.

Reviewed by: bz, emaste
Sponsored by: The FreeBSD Foundation

(cherry picked from commit a76de17715ab689b0b53a1012e22d8a08470b6e4)

2 years agosyslogd: Fix bug that caused -N to drop SecureMode if specified after -s
jfranklin13 [Tue, 28 Sep 2021 14:49:15 +0000 (16:49 +0200)]
syslogd: Fix bug that caused -N to drop SecureMode if specified after -s

Pull Request: https://github.com/freebsd/freebsd-src/pull/541

(cherry picked from commit 9589362bc980290ff84fe61814e5716dea79e931)

2 years agoixgbe: Update shared code catchup
Kevin Bowling [Thu, 7 Oct 2021 01:43:27 +0000 (18:43 -0700)]
ixgbe: Update shared code catchup

Leftovers from DPDK sync

Reviewed by: grehan
Obtained from: DPDK
MFC after: 5 days
Differential Revision: https://reviews.freebsd.org/D31621

(cherry picked from commit 3f66b96d8658f8721e6b1c6f035611bec44675b9)

2 years agoOpenSSH: cherry-pick "need initgroups() before setresgid()"
Ed Maste [Tue, 12 Oct 2021 00:47:39 +0000 (20:47 -0400)]
OpenSSH: cherry-pick "need initgroups() before setresgid()"

From openssh-portable commits f3cbe43e28fe and bf944e3794ef, backported
to OpenSSH 7.9p1 on stable/13.

Reviewed by: delphij
Security: CVE-2021-41617
Differential Revision: https://reviews.freebsd.org/D32460

(cherry picked from commit 172fa4aa7577915bf5ace5783251821d3774dc05)