]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agobc: Correct mis-merge of contrib/bc on upgrade to version 3.2.6
Stefan Eßer [Fri, 5 Feb 2021 19:53:34 +0000 (20:53 +0100)]
bc: Correct mis-merge of contrib/bc on upgrade to version 3.2.6

Revert "bc: Vendor import of Gavin Howard's bc version 3.2.6"
This reverts commit 601ac82194693fcae9d7d2a7ec7d66ebaf3fd61e.

Vendor import of Gavin Howard's bc version 3.2.6
(cherry picked from commit 47a52dc4d48f259ab7d9f9ba6b65f4f2331a22dc)

The files README.md and .gitignore had been lost and are restored
by this commit.

A lot of files used for fuzzing had been moved to a new place and
still existed in their previous location. Delete the now obsolete
files from the old location.

Approved by:   re

3 years agoSet file mode during zfs_write
Antonio Russo [Mon, 8 Feb 2021 17:15:05 +0000 (10:15 -0700)]
Set file mode during zfs_write

Apply https://github.com/openzfs/zfs/pull/11576

Direct commit from upstream openzfs. Full commit message below:

Set file mode during zfs_write

3d40b65 refactored zfs_vnops.c, which shared much code verbatim between
Linux and BSD.  After a successful write, the suid/sgid bits are reset,
and the mode to be written is stored in newmode.  On Linux, this was
propagated to both the in-memory inode and znode, which is then updated
with sa_update.

3d40b65 accidentally removed the initialization of newmode, which
happened to occur on the same line as the inode update (which has been
moved out of the function).

The uninitialized newmode can be saved to disk, leading to a crash on
stat() of that file, in addition to a merely incorrect file mode.

Reviewed-by: Ryan Moeller <ryan@ixsystems.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Antonio Russo <aerusso@aerusso.net>
Closes #11474
Closes #11576

Approved by: re (gdb)
Obtained from: openzfs/zfs@f8ce8aed0
Sponsored by: iXsystems, Inc.

(cherry picked from commit e9d419a05357036ea2fd37218d853d2c713d55cc)
(cherry picked from commit 618dee602319166c14c6e12971425d175d4630ed)

3 years agoserf: Fix the default return value of the BIO control method.
John Baldwin [Wed, 3 Feb 2021 22:59:32 +0000 (14:59 -0800)]
serf: Fix the default return value of the BIO control method.

OpenSSL BIO classes provide an abstraction for dealing with I/O.
OpenSSL provides BIO classes for commonly used I/O primitives backed
by file descriptors, sockets, etc. as well as permitting consumers
of OpenSSL to define custom BIO classes.

One of the methods BIO classes implement is a control method invoked
by BIO_ctrl() for various ancilliary tasks somewhat analgous to
fcntl() and ioctl() on file descriptors.  According to the BIO_ctrl(3)
manual page, control methods should return 0 for unknown control
requests.

KTLS support in OpenSSL adds new control requests.  Two of those new
requests are queries to determine if KTLS is enabled for either
reading or writing.  These control reuquest return 1 if KTLS is
enabled and 0 if it is not.

serf includes two custom BIO classes for wrapping I/O requests from
files and from a buffer in memory.  These BIO classes both use a
custom control method.  However, this custom control method was
returning 1 for unknown or unsupported control requests instead of 0.
As a result, OpenSSL with KTLS believed that these BIOs were using
KTLS and were thus adding headers and doing encryption/decryption in
the BIO.  Correcting the return value removes this confusion.

PR: 253135
Reported by: Guido Falsi <mad@madpilot.net>
Approved by: re (gjb)
Sponsored by: Netflix

(cherry picked from commit cb7cc72c546e0f87598961c3860e17391f42866c)
(cherry picked from commit b122886de25a51e3587d94ab2988a6ccb1e6a4e7)

3 years agoFix ldd to work with more ELF files.
John Baldwin [Fri, 29 Jan 2021 18:53:50 +0000 (10:53 -0800)]
Fix ldd to work with more ELF files.

- Use libelf to parse ELF data structures and remove code duplication
  for ELF32.

- Don't require the OSABI field to be set to the FreeBSD OSABI for
  shared libraries.  Both AArch64 and RISC-V leave it set to "none"
  and instead depend on the ABI tag note.  For ldd, this means falling
  back to walking the notes in PT_NOTE segments to find the ABI tag
  note to determine if an ELF shared library without OSABI set in the
  header file is a FreeBSD shared library.

Approved by: re (gjb)

(cherry picked from commit 9d4104b214963bb3371ada05cae8006940121634)
(cherry picked from commit fa3b2ad265d311191c1c8337bf3aa356f28480cb)

3 years agortld: Fix null-pointer dereference
David Chisnall [Tue, 2 Feb 2021 14:06:33 +0000 (16:06 +0200)]
rtld: Fix null-pointer dereference

Approved by: re (gjb)

(cherry picked from commit 43d44842aef3972cc86ce673e84e31f372257b15)

3 years agopowerpc64le: readd COMPAT_FREEBSD11 and COMPAT_FREEBSD12
Piotr Kubaj [Sat, 6 Feb 2021 02:21:55 +0000 (03:21 +0100)]
powerpc64le: readd COMPAT_FREEBSD11 and COMPAT_FREEBSD12

lang/rust needs COMPAT_FREEBSD11 to build, even though powerpc64le itself is
supported only since 13.0.
I also corrected a comment, because if we ever have lib32 for powerpc64le,
it will be for powerpcle.

Reviewed by: bdragon (on IRC)
Approved by: gjb (re)

(cherry picked from commit 8b804ee616b4c8810015b69e37e31ef0c4161511)

3 years agoAlways clamp curve25519 keys prior to use.
Peter Grehan [Wed, 3 Feb 2021 09:05:09 +0000 (19:05 +1000)]
Always clamp curve25519 keys prior to use.

Approved by: re (gjb)

(cherry picked from commit 6136a10e355a7a837edecbccbed04c34b4bc32c9)

3 years agoMFC 093e72319089:
Hans Petter Selasky [Tue, 26 Jan 2021 15:59:42 +0000 (16:59 +0100)]
MFC 093e72319089:
Add missing decrement of active ratelimit connections.

Approved by: re (gjb)
Reviewed by: rrs@
Sponsored by: Mellanox Technologies // NVIDIA Networking

(cherry picked from commit 093e7231908908b651b91c68ac03fb697c3a8352)

3 years agoMFC 85d8d30f9f70:
Hans Petter Selasky [Tue, 26 Jan 2021 14:01:38 +0000 (15:01 +0100)]
MFC 85d8d30f9f70:
Don't allow allocating a new send tag on an INP which is being torn down.
This fixes a potential send tag leak.

Approved by: re (gjb)
Reviewed by: rrs@
Sponsored by: Mellanox Technologies // NVIDIA Networking

(cherry picked from commit 85d8d30f9f7046f5e89295352ded49135b25fbe3)

3 years agorelease: disable the 'reldoc' target after the ASCIIDoctor switch
Glen Barber [Fri, 5 Feb 2021 16:46:49 +0000 (11:46 -0500)]
release: disable the 'reldoc' target after the ASCIIDoctor switch

The 'reldoc' target includes release-related documentation on
installation medium.  Since the switch from XML to ASCIIDoctor,
the file locations have moved, and it will take some time to sort
out how this target should work now.

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

(cherry picked from commit 7b1d1a1658ffb69eff93afc713f9e88ed8b20eac)
(cherry picked from commit 606bf913f9a33a47005efcac84a430ffb7ec4778)

3 years agoamd64 GENERIC: compile in mlx5en(4)
Konstantin Belousov [Wed, 3 Feb 2021 12:19:12 +0000 (14:19 +0200)]
amd64 GENERIC: compile in mlx5en(4)

Approved by: re (gjb)

(cherry picked from commit 5832a3e398642f721381dc2bdc8e954ae43c17a7)

3 years agocpucontrol(8): Fix display.
Konstantin Belousov [Fri, 5 Feb 2021 01:00:27 +0000 (03:00 +0200)]
cpucontrol(8): Fix display.

Approved by: re (gjb)

(cherry picked from commit 856789c123d69de86684c5aa1ad8a53427dd47fc)

3 years agoRegenerate src.conf(5).
John Baldwin [Thu, 4 Feb 2021 21:47:26 +0000 (13:47 -0800)]
Regenerate src.conf(5).

Approved by: re (gjb)

(cherry picked from commit ab537343065a6925e62001165a4743a17e050118)

3 years agoDisable MK_OPENSSL_KTLS for stable/13.
John Baldwin [Thu, 4 Feb 2021 21:40:25 +0000 (13:40 -0800)]
Disable MK_OPENSSL_KTLS for stable/13.

Due to the pending release of 13.0 and the recent bug in serf exposed
by the KTLS changes, disable OpenSSL's KTLS by default.  This keeps
crypto/openssl in sync with main while lowering the risk of introducing
instability into 13.0.

Approved by: re (gjb)
Discussed with: gjb (re), jkim, emaste (secteam)

(cherry picked from commit 3cf25a7802a26ae3be9159c585fda6aea3d0dc08)

3 years agoOpenSSL: Regenerate manual pages.
Jung-uk Kim [Tue, 26 Jan 2021 22:26:51 +0000 (14:26 -0800)]
OpenSSL: Regenerate manual pages.

Approved by: re (gjb)

(cherry picked from commit bb8acd558e66bd4bae31602fcbe569863f47382c)
(cherry picked from commit 3e09120f7984c990530d6e6860941ffb1e281f8b)

3 years agoOpenSSL: Support for kernel TLS offload (KTLS)
John Baldwin [Sat, 16 Jan 2021 00:17:31 +0000 (16:17 -0800)]
OpenSSL: Support for kernel TLS offload (KTLS)

This merges upstream patches from OpenSSL's master branch to add
KTLS infrastructure for TLS 1.0-1.3 including both RX and TX
offload and SSL_sendfile support on both Linux and FreeBSD.

Note that TLS 1.3 only supports TX offload.

A new WITH/WITHOUT_OPENSSL_KTLS determines if OpenSSL is built with
KTLS support.  It defaults to enabled on amd64 and disabled on all
other architectures.

Approved by: re (gjb)
Sponsored by: Netflix

(cherry picked from commit aa906e2a4957db700d9e6cc60857e1afe1aecc85)
(cherry picked from commit c1c52cd57e8810ca294d02220dfa72607c9a5567)

3 years agoBump shared library versions after ncurses bump in 13.
John Baldwin [Tue, 2 Feb 2021 01:09:33 +0000 (17:09 -0800)]
Bump shared library versions after ncurses bump in 13.

A few shared libraries in the base system link against ncurses.  An
upgrade from a 12.x host to 13 results in ABI breakage for existing
binaries since the newer versions of these libraries link against the
newer ncurses while the binary itself links against the older ncurses.
For example, dialog4ports built on 12.x sometimes crashes on 13 since
it depends on libdialog which links against ncurses internally.

Approved by: re (gjb)

(cherry picked from commit 0b7f1af804f06a285717b490bef80e24648adcbe)
(cherry picked from commit 6e1fe6d26ea2939656c8286ccbd105a89d3349a3)

3 years agomrsas: unbreak i386 build
Alfredo Dal'Ava Junior [Fri, 5 Feb 2021 18:43:48 +0000 (15:43 -0300)]
mrsas: unbreak i386 build

Fix build regression introduced by
e34a057ca6ebdf8e30ec8b0dc21d18eb450bf36a

Approved by: re (gjb)
Reviewed by: jhibbits
Sponsored by: Eldorado Research Institute (eldorado.org.br)
Differential Revision: https://reviews.freebsd.org/D28494

(cherry picked from commit 59fffbcf46ba6369420e655ff9173571410c643d)
(cherry picked from commit 6bf9668d9d02bdf3e0dafc4ba1010ef6a9b12247)

3 years agoBranch releng/13.0
Glen Barber [Thu, 4 Feb 2021 23:58:51 +0000 (18:58 -0500)]
Branch releng/13.0

Update releng/13.0 to BETA1 in preparation for the first BETA
builds.

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

3 years agoMFC jail: Handle a parent jail when a child is added to it
Jamie Gritton [Fri, 29 Jan 2021 05:51:09 +0000 (21:51 -0800)]
MFC jail: Handle a parent jail when a child is added to it

It's possible when adding a jail that its dying parent comes back to
life.  Only allow that to happen when JAIL_DYING is specified.  And if
it does happen, call PR_METHOD_CREATE on it.

(cherry picked from commit c050ea803eaa1087313b86628b5d486c0e59e41b)

3 years agoMFC jail: fix dangling reference bug from 6754ae2572eb
Jamie Gritton [Fri, 22 Jan 2021 18:56:24 +0000 (10:56 -0800)]
MFC jail: fix dangling reference bug from 6754ae2572eb

The change to use refcounts for pr_uref was mishandled in
prison_proc_free, so killing a jail's last process could add
an extra reference, leaving it an unkillable zombie.

(cherry picked from commit 195cd6ae2481dd5ad555ed65c226b6f20908d66a)

3 years agoMFC jail: A jail could be removed without calling OSD methods
Jamie Gritton [Fri, 22 Jan 2021 18:50:10 +0000 (10:50 -0800)]
MFC jail: A jail could be removed without calling OSD methods

Fix a long-standing bug where setting nopersist on a process-less jail
would remove it without calling the the OSD PR_METHOD_REMOVE methods.

(cherry picked from commit 39c8ef90f6d035cd3c3ab40e051b1c0f419c76be)

3 years agoMFC 78c93a172114: Use process fib for inet/inet6 fib_algo sysctls.
Alexander V. Chernikov [Sun, 31 Jan 2021 10:48:47 +0000 (10:48 +0000)]
MFC 78c93a172114: Use process fib for inet/inet6 fib_algo sysctls.

This allows to set/query fib algo for non-default fibs.

3 years agoMFC 151ec796a230: Fix the design problem with delayed algorithm sync.
Alexander V. Chernikov [Sat, 30 Jan 2021 22:45:46 +0000 (22:45 +0000)]
MFC 151ec796a230: Fix the design problem with delayed algorithm sync.

Currently, if the immutable algorithm like bsearch or radix_lockless
 receives rtable update notification, it schedules algorithm rebuild.
This rebuild is executed by the callout after ~50 milliseconds.

It is possible that a script adding an interface address and than route
 with the gateway bound to that address will fail. It can happen due
 to the fact that fib is not updated by the time the route addition
 request arrives.

Fix this by allowing synchronous algorithm rebuilds based on certain
 conditions. By default, these conditions assume:
1) less than net.route.algo.fib_sync_limit=100 routes
2) routes without gateway.

* Move algo instance build entirely under rib WLOCK.
 Rib lock is only used for control plane (except radix algo, but there
  are no rebuilds).
* Add rib_walk_ext_locked() function to allow RIB iteration with
 rib lock already held.
* Fix rare potential callout use-after-free for fds by binding fd
 callout to the relevant rib rmlock. In that case, callout_stop()
 under rib WLOCK guarantees no callout will be executed afterwards.

3 years agoMFC dd9163003cb1: Add rib_subscribe_locked() and rib_unsubsribe_locked()
Alexander V. Chernikov [Sat, 30 Jan 2021 21:52:44 +0000 (21:52 +0000)]
MFC dd9163003cb1: Add rib_subscribe_locked() and rib_unsubsribe_locked()
 to support subscriptions during RIB modifications.
Add new subscriptions to the beginning of the lists instead of
 the end. This fixes the situation when new subscription is created
 int the callback for the existing subscription, leading to the
 subscription notification handler pick it.

3 years agoMFC ab6d9aaed76e: Move business logic from rebuild_fd_callout() into rebuild_fd().
Alexander V. Chernikov [Sat, 30 Jan 2021 22:32:42 +0000 (22:32 +0000)]
MFC ab6d9aaed76e: Move business logic from rebuild_fd_callout() into rebuild_fd().

This simplifies code a bit and allows for future non-callout
 callers to request rebuild.

3 years agoMFC f8b7ebea4905: Improve fib_algo debug messages.
Alexander V. Chernikov [Sat, 30 Jan 2021 22:06:40 +0000 (22:06 +0000)]
MFC f8b7ebea4905: Improve fib_algo debug messages.

* Move per-prefix debug lines under LOG_DEBUG2
* Create fib instance counter to distingush log messages between
 instances
* Add more messages on rebuild reason.

MFC after: 3 days

3 years agoMFC 91f2c69ec206: Fix unused-function waring when compiling with FIB_ALGO.
Alexander V. Chernikov [Sat, 30 Jan 2021 23:24:26 +0000 (23:24 +0000)]
MFC 91f2c69ec206: Fix unused-function waring when compiling with FIB_ALGO.

3 years agoMFC cb984c62d705: Fix multipath support for rib_lookup_info().
Alexander V. Chernikov [Fri, 29 Jan 2021 23:10:52 +0000 (23:10 +0000)]
MFC cb984c62d705: Fix multipath support for rib_lookup_info().

The initial plan was to remove rib_lookup_info() before
 FreeBSD 13. As several customers are still remaining,
 fix rib_lookup_info() for the multipath use case.

3 years agoMFC 53729367d388: Fix subinterface vlan creation.
Alexander V. Chernikov [Tue, 26 Jan 2021 07:22:23 +0000 (07:22 +0000)]
MFC 53729367d388: Fix subinterface vlan creation.

D26436 introduced support for stacked vlans that changed the way vlans
 are configured.  In particular, this change broke setups that have
 same-number vlans as subinterfaces.

Vlan support was initially created assuming "vlanX" semantics. In this paradigm,
 automatic number assignment supported by cloning (ifconfig vlan create) was a
 natural fit.
When "ifaceX.Y" support was added, allowing to have the same vlan number on
 multiple devices, cloning code became more complex, as the is no
unified "vlan" namespace anymore. Such interfaces got the first spare
index from "vlan" cloner. This, in turn, led to the following problem:
 ifconfig ix0.333 create -> index 1
 ifconfig ix0.444 create -> index 2
 ifconfig vlan2 create -> allocation failure

This change fixes such allocations by using cloning indexes only for
 "vlanX" interfaces.

Reviewed by:            hselasky
Differential Revision:  https://reviews.freebsd.org/D27505

3 years agoMFC eb0b1b33: Enable multipath routing by default.
Alexander V. Chernikov [Wed, 3 Feb 2021 08:49:46 +0000 (08:49 +0000)]
MFC eb0b1b33: Enable multipath routing by default.

ROUTE_MPATH was added to the GENERIC kernel in r368648.

According to the plan in D27428, it was enabled with `net.route.multipath` sysctl set to 0.
Given enough time has passed, this change enables route multipath by default.

The goal is to ship FreeBSD 13 with multipath turned on.

Reviewed By: donner, olivier
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D28423

3 years agoloader.efi: There are systems without ConOut, also use ConOutDev
Toomas Soome [Thu, 4 Feb 2021 20:49:02 +0000 (22:49 +0200)]
loader.efi: There are systems without ConOut, also use ConOutDev

Conout does contian the default output device name.
ConOutDev does contain all possible output device names, so we can
use it as fallback, when there is no ConOut.

PR: 253253

(cherry picked from commit 2bd4ff2d8911009283e4e615ca4aad35a845f48b)

3 years agohsctrl: Fix manpage typo
Vladimir Kondratyev [Thu, 28 Jan 2021 21:35:11 +0000 (00:35 +0300)]
hsctrl: Fix manpage typo

Use hsctrl_load to load the module at boot time.

Submitted by: Shunchao Hu <ankohuu_outlook.com>
Reviewed by: wulf
Differential revision: https://reviews.freebsd.org/D28343

(cherry picked from commit 5c689e213614bff65e9789875f839aa05053126b)

3 years agohcons: Fix manpage typo
Vladimir Kondratyev [Sat, 23 Jan 2021 19:19:50 +0000 (22:19 +0300)]
hcons: Fix manpage typo

Submitted by: Shunchao Hu <ankohuu_outlook.com>
Reviewed by: wulf, gbe
Differential revision: https://reviews.freebsd.org/D28294

(cherry picked from commit 0d528e6354141dd097f8719e858b3ae3686d2062)

3 years agorelease: update workaround during transition to git
Glen Barber [Tue, 2 Feb 2021 17:19:36 +0000 (12:19 -0500)]
release: update workaround during transition to git

PR: 253181
Submitted by: Yasuhiro Kimura
Sponsored by: Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 70dfc101b6324b25ba353465f0d6c610399741fc)

3 years agoVMD support for new devices.
Doug Ambrisko [Thu, 28 Jan 2021 23:12:14 +0000 (15:12 -0800)]
VMD support for new devices.

Add support for some more Intel VMD controllers.  Some of the
newer controller have a sparce bus space that can be figured
out by probing the HW.  This gives the starting bus number.
When reading the PCI config. space behind the VMD controller,
the offset of the starting bus needs to be subtracted from
the bus being read.

Fixed a bug in which in which not all of the devices
directly attached to the VMD controller would be probed.
On my initial test HW, a switch was found at bus 0, slot 0
and function 0.  All of the NVME drives were behind that
switch.  Now scan for all slots and functions attached to
bus 0.  If a something was found then run attach after the
scan.  On detach also go through all slots and functions
on bus 0.

Tested with device ID's: 0x201d & 0x9a0b

Tested by: nc@
MFC: 5c689e21361
PR: 252253

(cherry picked from commit 0c852bb9b9282b30fd047ac1de398358f33777f4)

3 years agox86: use compiler intrinsics for bswap*
Mateusz Guzik [Mon, 1 Feb 2021 03:00:13 +0000 (04:00 +0100)]
x86: use compiler intrinsics for bswap*

(cherry picked from commit e6ff6154d2034c13f3d0da73c1e00d69fdb36516)

3 years agoamd64: use compiler intrinsics for bsf* and bsr*
Mateusz Guzik [Sun, 31 Jan 2021 23:35:30 +0000 (00:35 +0100)]
amd64: use compiler intrinsics for bsf* and bsr*

(cherry picked from commit aae89f6f09576351cc3a9a54959649e60fdd849b)

3 years agocache: add delayed degenerate path handling
Mateusz Guzik [Sun, 31 Jan 2021 20:54:35 +0000 (21:54 +0100)]
cache: add delayed degenerate path handling

(cherry picked from commit 6f19dc2124a31aadf419743288d2ec1abd895563)

3 years agocache: move hash computation into the parsing loop
Mateusz Guzik [Sun, 31 Jan 2021 18:25:18 +0000 (19:25 +0100)]
cache: move hash computation into the parsing loop

(cherry picked from commit bbfb1edd70e15241d852d82eb7e1c1049a01b886)

3 years agoamd64: move memcmp checks upfront
Mateusz Guzik [Sun, 31 Jan 2021 15:46:18 +0000 (16:46 +0100)]
amd64: move memcmp checks upfront

This is a tradeoff which saves jumps for smaller sizes while making
the 8-16 range slower (roughly in line with the other cases).

Tested with glibc test suite.

For example size 3 (most common with vfs namecache) (ops/s):
before: 407086026
after: 461391995

The regressed range of 8-16 (with 8 as example):
before: 540850489
after: 461671032

(cherry picked from commit f1be262ec11c1c35e6485f432415b5b52adb505d)

3 years agoamd64: add a note about simd to libc memset, memmove and memcmp
Mateusz Guzik [Sun, 31 Jan 2021 15:50:34 +0000 (16:50 +0100)]
amd64: add a note about simd to libc memset, memmove and memcmp

(cherry picked from commit 0db6aef407f30c138982b8cde43189aad098b337)

3 years agocxgbe(4): Fixes to tx coalescing.
Navdeep Parhar [Mon, 1 Feb 2021 11:00:09 +0000 (03:00 -0800)]
cxgbe(4): Fixes to tx coalescing.

- The behavior implemented in r362905 resulted in delayed transmission
  of packets in some cases, causing performance issues.  Use a different
  heuristic to predict tx requests.

- Add a tunable/sysctl (hw.cxgbe.tx_coalesce) to disable tx coalescing
  entirely.  It can be changed at any time.  There is no change in
  default behavior.

(cherry picked from commit 3447df8bc5b342bd88d565641435284ff620ee2a)

3 years agozfs: update zfs_config.h to match OpenZFS gf11b09dec
Martin Matuska [Mon, 1 Feb 2021 21:08:19 +0000 (22:08 +0100)]
zfs: update zfs_config.h to match OpenZFS gf11b09dec

Update zfs_config.h to match latest merge in FreeBSD

The version string is declared as 2.0.0-FreeBSD_gf11b09dec to provide
more information about the loaded module:
- the OpenZFS version in base is 2.0
- we are using the in tree-module ("FreeBSD")
- the last merged OpenZFS git revision ("gf11b09dec")

With future merges the git revision tag should be updated.
As we are merging from OpenZFS master branch and already include features
like dRAID, referencing patchlevel releases (2.0.1, 2.0.2) is pointless.

Reviewed by: freqlabs
Differential Revision: https://reviews.freebsd.org/D28447

(cherry picked from commit 8fb966790e1c87276cc26932efee1b29c046cb8a)

3 years agowg(4): Add authors of the wg(4) driver to the manual page
Gordon Bergling [Wed, 3 Feb 2021 15:01:32 +0000 (16:01 +0100)]
wg(4): Add authors of the wg(4) driver to the manual page

Glen (@gjb) noticed that I am haven't mentioned the authors of the
WireGuard device driver in the manual page.

This is commit addressed this.

Reviewed by: gjb, brueffer
Differential Revision: https://reviews.freebsd.org/D28464

(cherry picked from commit c1b1354789bb15713944f9e6941266de4cb47772)

3 years agowg(4): Fix Copyright statement in man page
Gordon Bergling [Tue, 2 Feb 2021 19:16:52 +0000 (20:16 +0100)]
wg(4): Fix Copyright statement in man page

(cherry picked from commit 064e52c2d874abc83dd2af61644d14dc90e26ec3)

3 years agoAdd a wg(4) manual page
Gordon Bergling [Tue, 2 Feb 2021 19:13:53 +0000 (20:13 +0100)]
Add a wg(4) manual page

Reviewed by: brueffer, donner, debdrup, ygy
MFC after: 2 days
Differential Revision: https://reviews.freebsd.org/D27783

(cherry picked from commit e59d9cb412846cb5d2bc4c641d3cc44d243cd52d)

3 years agoriscv: add SBI system reset extension
Mitchell Horne [Wed, 27 Jan 2021 21:27:15 +0000 (17:27 -0400)]
riscv: add SBI system reset extension

(cherry picked from commit 9bae4ce661c59be88fec89b2531148e36dd1a23e)
(cherry picked from commit a6405133b7e14929f8e8e61cf30d7152b1410e59)

3 years agoipfw(8) crashes when ext6hdr option is omitted
Evgeniy Khramtsov [Mon, 1 Feb 2021 19:03:57 +0000 (20:03 +0100)]
ipfw(8) crashes when ext6hdr option is omitted

Verify that the option is passed, error out if it's not.
The problem can be trivially triggered with `ipfw add allow ext6hdr`.

PR: 253169
Reviewed by: kp@
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D28447

(cherry picked from commit 682c31db4ecfb8fc6cac0e8ad4945c03379ea3d1)

3 years agobridge: fix STP roles and protos strings
Jonah Caplan [Sat, 30 Jan 2021 13:54:09 +0000 (14:54 +0100)]
bridge: fix STP roles and protos strings

Add the missing commas that got lost in e5539fb618cc7.

PR: 252532
Reviewd by: kp@, donner@, freqlabs@
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D28425

(cherry picked from commit 88be0e11205e4a2dc77e29f7b4a2e82b8d7c9a5c)

3 years agosrc.conf.5: regenerate
Mitchell Horne [Thu, 4 Feb 2021 14:00:11 +0000 (10:00 -0400)]
src.conf.5: regenerate

Direct commit to stable/13.

3 years agosrc.opts.mk: set MK_ZFS conditional on MK_OPENSSL
Mitchell Horne [Sat, 30 Jan 2021 19:04:08 +0000 (15:04 -0400)]
src.opts.mk: set MK_ZFS conditional on MK_OPENSSL

PR: 252841
Reviewed by: kevans, freqlabs

(cherry picked from commit e5cc1c47484160969e0a7c13cdbc71081d7dd60e)

3 years agodu: tests: use dollar-single quotes where appropriate
Kyle Evans [Fri, 29 Jan 2021 03:01:12 +0000 (21:01 -0600)]
du: tests: use dollar-single quotes where appropriate

No need for "foo$(printf "\t")", $'\t' is both more readable and still
functional.

(cherry picked from commit bf59049c27ef86669a94ffd43f7216107b5c57ff)

3 years ago[POWERPC64BE] add mrsas driver to GENERIC64
Alfredo Dal'Ava Junior [Thu, 4 Feb 2021 01:02:28 +0000 (22:02 -0300)]
[POWERPC64BE] add mrsas driver to GENERIC64

Submitted by:   Andre Fernando da Silva <andre.silva@eldorado.org.br>
Reviewed by:    luporl, alfredo, kadesai (on email)
Sponsored by:   Eldorado Research Institute (eldorado.org.br)
Differential Revision:  https://reviews.freebsd.org/D26531

3 years ago[POWERPC64BE] mrsas: add big-endian support
Alfredo Dal'Ava Junior [Thu, 4 Feb 2021 00:52:19 +0000 (21:52 -0300)]
[POWERPC64BE] mrsas: add big-endian support

Add endiannes conversions in order to support big-endian platforms

Submitted by: Andre Fernando da Silva <andre.silva@eldorado.org.br>
Reviewed by: luporl, alfredo, kadesai (on email)
Sponsored by: Eldorado Research Institute (eldorado.org.br)
Differential Revision: https://reviews.freebsd.org/D26531

3 years agobuild: options: mention ports in the WITH_OPENLDAP description
Kyle Evans [Sat, 30 Jan 2021 06:09:10 +0000 (00:09 -0600)]
build: options: mention ports in the WITH_OPENLDAP description

There's a third party dependency on this option; currently,
net/openldap24-{,sasl-}client.  At least mention that an openldap from ports
is needed for this option.

PR: 252866

(cherry picked from commit 7587d9823a8257b9a2d5b2e58c707026061058c6)

3 years agokerberos5: fix the WITH_OPENLDAP build
Kyle Evans [Sat, 30 Jan 2021 06:07:17 +0000 (00:07 -0600)]
kerberos5: fix the WITH_OPENLDAP build

Restore WARNS to its former glory prior to the global WARNS change to fix
the build.

(cherry picked from commit e948d980f78dd2789060b46d3d03ba0d96b23b59)

3 years agoofed: fix the WITH_OFED_EXTRA build
Kyle Evans [Sat, 30 Jan 2021 05:48:28 +0000 (23:48 -0600)]
ofed: fix the WITH_OFED_EXTRA build

This option was not tested when WARNS was globally lifted in the src tree up
to 6.  Drop WARNS back down to unbreak the build; note that this is still
enabling more warnings than it had before the WARNS change, so the gcc build
may need to be independently evaluated at this level.

PR: 252865

(cherry picked from commit 9ca71db4959f674d75f7b4fd0f72bdc1e2e99abb)

3 years agoRevert "Reimplement strlen"
Mateusz Guzik [Wed, 3 Feb 2021 19:38:10 +0000 (19:38 +0000)]
Revert "Reimplement strlen"

This reverts commit 710e45c4b8539d028877769f1a4ec088c48fb5f1.

It breaks for some corner cases on big endian ppc64.
Given the stage of the release process it is best to revert for now.

Reported by: jhibbits

(cherry picked from commit 33f0540b13d949c7cc226a79927ddc2062ff98bf)

3 years agoqat: Add support for separate AAD and output buffers
Mark Johnston [Wed, 27 Jan 2021 20:30:58 +0000 (15:30 -0500)]
qat: Add support for separate AAD and output buffers

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

(cherry picked from commit bd674d8b1fa808dff1afdcb6afc70226077ee78a)

3 years agopf: Improve pf_rule input validation
Kristof Provost [Tue, 26 Jan 2021 07:56:51 +0000 (08:56 +0100)]
pf: Improve pf_rule input validation

Move the validation checks to pf_rule_to_krule() to reduce duplication.
This also makes the checks consistent across different ioctls.

Reported-by: syzbot+e9632d7ad17398f0bd8f@syzkaller.appspotmail.com
Reviewed by: tuexen@, donner@
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D28362

(cherry picked from commit 7a808c5ee3296fdb72d8e8bc6c7ad6f316a520ab)

3 years agostand/multiboot: adjust the protocol between loader and kernel
Roger Pau Monné [Wed, 27 Jan 2021 10:12:07 +0000 (11:12 +0100)]
stand/multiboot: adjust the protocol between loader and kernel

There's a currently ad-hoc protocol to hand off the FreeBSD kernel
payload between the loader and the kernel itself when Xen is in the
middle of the picture. Such protocol wasn't very resilient to changes
to the loader itself, because it relied on moving metadata around to
package it using a certain layout. This has proven to be fragile, so
replace it with a more robust version.

The new protocol requires using a xen_header structure that will be
used to pass data between the FreeBSD loader and the FreeBSD kernel
when booting in dom0 mode. At the moment the only data conveyed is the
offset of the start of the module metadata relative to the start of the
module itself.

This is a slightly disruptive change since it also requires a change
to the kernel which is contained in this patch. In order to update
with this change the kernel must be updated before updating the
loader, as described in the handbook. Note this is only required when
booting a FreeBSD/Xen dom0. This change doesn't affect the normal
FreeBSD boot protocol.

This fixes booting FreeBSD/Xen in dom0 mode after
3630506b9daec9167a89bc4525638ea45a00769e.

(cherry picked from commit b6d85a5f51e4147452b35d76478fb9e191b7734b)

3 years agobc: Vendor import of Gavin Howard's bc version 3.2.6
Stefan Eßer [Sun, 31 Jan 2021 19:56:48 +0000 (20:56 +0100)]
bc: Vendor import of Gavin Howard's bc version 3.2.6

(cherry picked from commit 47a52dc4d48f259ab7d9f9ba6b65f4f2331a22dc)

3 years agolualoader: position hyphens at the beginning of character classes
Kyle Evans [Sun, 31 Jan 2021 15:51:39 +0000 (09:51 -0600)]
lualoader: position hyphens at the beginning of character classes

According to the Lua 5.4 manual section 6.4.1 ("Patterns"), the interaction
between ranges and classes is not defined and hyphens must be specified at
either the beginning or the end of a set if they are not escaped.

Move all such occurrences to the beginning.

(cherry picked from commit b24872cf7b13314669ed2136c0262bb2eb007695)

3 years agostand: lua: enhance lfs.dir() to speed up kernels_autodetect
Kyle Evans [Sun, 24 Jan 2021 01:32:38 +0000 (19:32 -0600)]
stand: lua: enhance lfs.dir() to speed up kernels_autodetect

This eliminates a lot of stat() calls that happen when lualoader renders the
menu with the default settings, and greatly speeds up rendering on my
laptop.

ftype is nil if loader/loader.efi hasn't been updated yet, falling back to
lfs.attributes() to test.

This is technically incompatible with lfs, but not in a particularly
terrible way.

(cherry picked from commit e25ee296c919d6567aa76058a7049eac974797fb)

3 years agoMFC: mips: fix early kernel panic when setting up interrupt counters
Oleksandr Tymoshenko [Mon, 1 Feb 2021 07:56:22 +0000 (23:56 -0800)]
MFC: mips: fix early kernel panic when setting up interrupt counters

Commit 248f0ca converted intrcnt and intrnames from u_long[]
and char[] to u_long* and char* respectively, but for non-INTRNG mips
these symbols were defined in .S file as a pre-allocated static arrays,
so the problem wasn't cought at compile time. Conversion from an array
to a pointer requires pointer initialization and it wasn't done
for MIPS, so whatever happenned to be in the begginning of intcnt[]
array was used as a pointer value.

Move intrcnt/intrnames to C code and allocate them dynamically
although with a fixed size at the moment.

Reviewed by: emaste
PR: 253051
Differential Revision: https://reviews.freebsd.org/D28424
MFC after: 1 day

(cherry picked from commit e0a0a3efcb09a10ad1de29aca622ea580b2663d2)

mips: fix NLM platforms breakage caused by e0a0a3ef

NetLogic platforms have their own implementation of cpu_init_interrupts.
Apply the same logic to it as to intr_machdep.c.

PR: 253051

(cherry picked from commit d6f9c5a6d2f87865f9714d2b8dfd1a9f3080c71e)

3 years agocxgb(4): Remove assumption of physically contiguous mbufs.
Alexander Motin [Sun, 31 Jan 2021 17:46:57 +0000 (12:46 -0500)]
cxgb(4): Remove assumption of physically contiguous mbufs.

Investigation of iSCSI target data corruption reports brought me to
discovery that cxgb(4) expects mbufs to be physically contiguous, that
is not true after I've started using m_extaddref() in software iSCSI
for large zero-copy transmissions.  In case of fragmented memory the
driver transmitted garbage from pages following the first one due to
simple use of pmap_kextract() for the first pointer instead of proper
bus_dmamap_load_mbuf_sg().  Seems like it was done as some optimization
many years ago, and at very least it is wrong in a world of IOMMUs.

This patch just removes that optimization, plus limits packet coalescing
for mbufs crossing page boundary, also depending on assumption of one
segment per packet.

Sponsored by: iXsystems, Inc.

(cherry picked from commit 9dc7c250b8bd2d5e669c7633e189a700a02c0571)

3 years agocache: fix trailing slash support in face of permission problems
Mateusz Guzik [Tue, 2 Feb 2021 18:06:56 +0000 (18:06 +0000)]
cache: fix trailing slash support in face of permission problems

Reported by: Johan Hendriks <joh.hendriks gmail.com>
Tested by: kevans

(cherry picked from commit 45456abc4ce71053d07cf03ca63bd1ce459fec55)

3 years agouserboot: provide stub gfx functions
Toomas Soome [Sat, 30 Jan 2021 19:16:20 +0000 (21:16 +0200)]
userboot: provide stub gfx functions

Make sure we have needed functions present, to avoi getting undefined
symbols error(s).

PR: 253088
Reported by: John Kennedy

(cherry picked b79f2bc6c5c7431fa1f7c02937ec97a64653ade1)

3 years agovt: panic while changing vt font
Toomas Soome [Sun, 24 Jan 2021 18:59:36 +0000 (20:59 +0200)]
vt: panic while changing vt font

Set refcount for loader provided font to 1 to prevent this font
from being released (so we can reset to default).

As we get started with no memory allocator, we set up static font data
for font passed by loader (if there is any). At this time, we also must
set refcount 1, and refcount will get incremented in cnprobe() callback.

At some point the memory allocator will be available, and we will set up
properly allocated font data, but we should not disturb the refcount.

PR: 252833
PR: 253147

(cherry picked and squashed 93ebd6307efeb95a29bc614edd0c67c2af850e98 and
1912d2b15e6d6f4a1d8c3886b03ab30d2f21f3fd)

3 years agoloader: create built in font from bold font face
Toomas Soome [Fri, 22 Jan 2021 11:06:58 +0000 (13:06 +0200)]
loader: create built in font from bold font face

We did replace full version of default font 8x16v with bold, also
use bold version for built in font.

(cherry picked from commit 6c789c55c4ba11014bfd1b59942c204615412ba6)

3 years agomarvell: ap806_clock: add missing frequency modes
Marcin Wojtas [Tue, 26 Jan 2021 10:49:35 +0000 (11:49 +0100)]
marvell: ap806_clock: add missing frequency modes

In the driver init routine the CPU clock frequency
value is obtained from a dedicated register. Until now
only part of the values were handled by the mv_ap806_clock
driver. Fix that by adding missing cases.

Submitted by: Zyta Szpak <zr@semihalf.com>
MFC after: 1 week
Obtained from: Semihalf
Sponsored by: Marvell

(cherry picked from commit a86b0839d7bf3fc06b1ae9c50e055b53c50a9d0b)

3 years ago__FreeBSD_version: update the references to the doc tree
Bjoern A. Zeeb [Fri, 29 Jan 2021 10:57:50 +0000 (10:57 +0000)]
__FreeBSD_version: update the references to the doc tree

Update the reference of which file to update in the doc tree when
bumping __FreeBSD_version.

(cherry picked from commit abd619045a54c73f41a95b3e038a5ba083391400)

3 years agoBump __FreeBSD_version for multiple LinuxKPI updates conflicting
Bjoern A. Zeeb [Tue, 2 Feb 2021 11:52:50 +0000 (11:52 +0000)]
Bump __FreeBSD_version for multiple LinuxKPI updates conflicting
with DRM.  Be sure to update your drm-kmod port to after the update.

Sponsored-by: The FreeBSD Foundation

3 years agoLinuxKPI: implement devres() framework parts and two examples
Bjoern A. Zeeb [Thu, 28 Jan 2021 16:32:43 +0000 (16:32 +0000)]
LinuxKPI: implement devres() framework parts and two examples

This code implements a version of the devres framework found
working for various iwlwifi use cases and also providing functions
for ttm_page_alloc_dma.c from DRM.

Part of the framework replicates the consumed KPI, while others
are internal helper functions.

In addition the simple devm_k*malloc() consumers were implemented
and kvasprintf() was enhanced to also work for the devm_kasprintf()
case.
Addmittingly lkpi_devm_kmalloc_release() could be avoided but for
the overall understanding of the code and possible memory tracing
it may still be helpful.

Further devsres consumer are implemented for iwlwifi but will follow
later as the main reason for this change is to sort out overlap with
DRM.

Sponsored-by: The FreeBSD Foundation
Obtained-from: bz_iwlwifi
MFC After: 3 days
Reviewed-by: hselasky, manu
Differential Revision: https://reviews.freebsd.org/D28189

(cherry picked from commit fa765ca73e553399ffbad382e579e4c2b4d0fc12)

3 years agoLinuxKPI: enhance PCI bits for DRM
Bjoern A. Zeeb [Thu, 28 Jan 2021 16:23:19 +0000 (16:23 +0000)]
LinuxKPI: enhance PCI bits for DRM

In pci_domain_nr() directly return the domain which got set in
lkpifill_pci_dev() in all cases.  This was missed between D27550
and 105a37cac76b971f7a94409fbdc4f508a7e97fa0 .

In order to implement pci_dev_put() harmonize further code
(which was started in the aforementioned commit) and add kobj
related bits (through the now common lkpifill_pci_dev() code)
to the DRM specific calls without adding the DRM allocated
pci devices to the pci_devices list.
Add a release for the lkpinew_pci_dev() (DRM) case so freeing
will work.
This allows the DRM created devices to use the normal kobj/refcount
logic and work with, e.g., pci_dev_put().
(For a slightly more detailed code walk see the review).

Sponsored-by: The FreeBSD Foundation
Obtained-from: bz_iwlwifi (partially)
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D28188

(cherry picked from commit 1fac2cb4d6e5cfa1b8ff689213011b0fe077ffa7)

3 years agoLinuxKPI: upstream a collection of drm-kmod conflicting changes
Bjoern A. Zeeb [Thu, 28 Jan 2021 16:15:12 +0000 (16:15 +0000)]
LinuxKPI: upstream a collection of drm-kmod conflicting changes

The upcoming in-kernel implementations for LinuxKPI based on work on
iwlwifi (and other wireless drivers) conflicts in a few places with
the drm-kmod graphics work outside the base system.

In order to transition smoothly extract the conflicting bits.
This included "unaligned" accessor functions, sg_pcopy_from_buffer(),
IS_*() macros (to be further restricted in the future), power management
bits (possibly no longer conflicting with DRM), and other minor changes.

Obtained-from:  bz_iwlwifi
Sponsored-by: The FreeBSD Foundation
MFC after: 3 days
Reviewed by: kib, hselasky, manu, bdragon (looked at earlier versions)
Differential Revision: https://reviews.freebsd.org/D26598

(cherry picked from commit 4abbf816bf06aa70200c5d1d976dd61c2752bdaf)

3 years agoLinuxKPI: add firmware loading support
Bjoern A. Zeeb [Thu, 28 Jan 2021 16:05:32 +0000 (16:05 +0000)]
LinuxKPI: add firmware loading support

Implement linux firmware KPI compat code.
This includes: request_firmware() request_firmware_nowait(),
request_firmware_direct(), firmware_request_nowarn(),
and release_firmware().

Given we will try to map requested names from natively ported
or full-linuxkpi-using drivers to a firmware(9) auto-loading
name format (.ko file name and image name matching),
we quieten firmware(9) and print success or failure (unless
the _nowarn() version was called) in the linuxkpi implementation.
At the moment we try up-to 4 different naming combinations,
with path stripped, original name, and requested name with '/'
or '.' replaced.

We do not currently defer loading in the "nowait" case.

Sponsored-by: The FreeBSD Foundation
Sponsored-by: Rubicon Communications, LLC ("Netgate")
(firmware(9) nowarn update from D27413)
MFC after: 3 days
Reviewed by: kib, manu (looked at older versions)
Differential Revision: https://reviews.freebsd.org/D27414

(cherry picked from commit a6c2507d1baedb183268e31bc6b6f659a9529904)
(cherry picked from commit 4a26380ba6dc487a7525d909ee29fbc710b558d1)

3 years agonewvers: tweak uname to be more useful
Warner Losh [Mon, 25 Jan 2021 19:53:31 +0000 (12:53 -0700)]
newvers: tweak uname to be more useful

The current uname is branch-cXXXX-gHASH

Three changes to make uname more useful.
1. Move from using git rev-list --count to git rev-lis --count --first-parent
   since that gives a better, incrementing number.
2. Report this count as 'nXXXXX' rather than 'cXXXXX' because c is part of
   a hash and we've changed the sematnics of XXXXX
3. Remove g to make HASH cut and pastable.

Durting review, #1 & #3 had the largest consensus. There was a diversity of
opinion on #2, but on the whole it was positive so I'll acknowledge the dissent,
but move forward with something seems to have support since the dissent was all
about what letter to use where I chose 'n'.

MFC After: 3 days
Reviewed by: rgrimes, emaste (earlier version)
Differential Revision: https://reviews.freebsd.org/D28338

(cherry picked from commit 8a51f14a7833fd14e1f125e63a0af9d260dcd287)

3 years agobsdinstall: riscv-specific tweaks
Mitchell Horne [Fri, 15 Jan 2021 16:34:54 +0000 (12:34 -0400)]
bsdinstall: riscv-specific tweaks

Make the installer more useful, by allowing it to create a bootable
installation. Also, enable the menu option for ZFS-on-root.

Like arm64, RISC-V boots by UEFI only, so arm64's partedit
implementation is renamed and shared among the two platforms.

Reviewed by: gjb

(cherry picked from commit 7b08a307e88bb1abe17d13d11288392a8e4739ce)

3 years agobsdinstall: create /efi/boot directory in ESP
Mitchell Horne [Fri, 15 Jan 2021 16:14:27 +0000 (12:14 -0400)]
bsdinstall: create /efi/boot directory in ESP

If the installer is creating a new ESP, then this directory will not
exist and the subsequent cp will fail silently. This is usually of no
consequence if /efi/freebsd/loader.efi is set up correctly.

Reviewed by: imp

(cherry picked from commit 676b7d077c2c5f548334cea7fccfbfb5d097c9df)

3 years agodiff: fix incorrectly displaying files as duplicates
Jamie Landeg-Jones [Mon, 25 Jan 2021 17:42:26 +0000 (18:42 +0100)]
diff: fix incorrectly displaying files as duplicates

When diff hits certain access errors, function diffreg() shows the error
message, and then returns to the calling function, which calls
print_status() with the return value.

However, in these cases, the return value isn't changed from the initial
default value of D_SAME.

Normally, print_status() with a value of D_SAME does nothing, so this
works out ok, however, if the "-s" flag is set, a message is displayed
showing identicality:

case D_SAME:
                if (sflag)
                        printf("Files %s%s and %s%s are identical\n",                                                                                                       path1, entry, path2, entry);
                break;

This then produces such results as:

% diff  -s /COPYRIGHT /var/run/rpcbind.sock
diff: /var/run/rpcbind.sock: Operation not supported
Files /COPYRIGHT and /var/run/rpcbind.sock are identical

% diff  -s /COPYRIGHT /etc/master.passwd
diff: /etc/master.passwd: Permission denied
Files /COPYRIGHT and /etc/master.passwd are identical

Create a D_ERROR status which is returned in such cases, and
print_status() then deals with that status seperately from D_SAME

PR: 252614
MFC after: 1 week

(cherry picked from commit fefb3c46a80fdde6f307e73a2b5b5aed806df1ce)

3 years agodiff: add a test case for failed -s option
Baptiste Daroussin [Mon, 25 Jan 2021 17:40:12 +0000 (18:40 +0100)]
diff: add a test case for failed -s option

(cherry picked from commit 13860e71eb501f498a2263f44ea9244f6830b61c)

3 years agoDrop temporary compat in setproctitle
Mateusz Guzik [Sun, 31 Jan 2021 12:23:42 +0000 (13:23 +0100)]
Drop temporary compat in setproctitle

(cherry picked from commit 46f168bc665a1aee79d91bd102aef7d4754e7917)

3 years agocache: add trailing slash support
Mateusz Guzik [Tue, 26 Jan 2021 00:38:21 +0000 (01:38 +0100)]
cache: add trailing slash support

Tested by: pho

(cherry picked from commit e027e24bfac7dd311ddacaec73d6c42102069511)

3 years agocache: handle NOFOLLOW requests for symlinks
Mateusz Guzik [Tue, 26 Jan 2021 22:14:49 +0000 (23:14 +0100)]
cache: handle NOFOLLOW requests for symlinks

Tested by: pho

(cherry picked from commit 8cbd164a179c182e8fd4a71f366bc48fe840eafb)

3 years agoamd64: retire sse2_pagezero
Mateusz Guzik [Sat, 30 Jan 2021 00:17:15 +0000 (00:17 +0000)]
amd64: retire sse2_pagezero

All page zeroing is using temporal stores with rep movs*, the routine is
unused for several years.

Should a need arise for zeroing using non-temporal stores, a more
optimized variant can be implemented with a more descriptive name.

(cherry picked from commit d1de5698dfe6109308d4e5d6536a2ac93941d23a)

3 years agoamd64: add missing ALIGN_TEXT to loops in memset and memmove
Mateusz Guzik [Fri, 29 Jan 2021 15:09:14 +0000 (16:09 +0100)]
amd64: add missing ALIGN_TEXT to loops in memset and memmove

(cherry picked from commit 164c3b81848bc81dc200b12370999474225447a3)

3 years agoReimplement strlen
Mateusz Guzik [Fri, 29 Jan 2021 21:48:11 +0000 (22:48 +0100)]
Reimplement strlen

The previous code neglected to use primitives which can find the end
of the string without having to branch on every character.

While here augment the somewhat misleading commentary -- strlen as
implemented here leaves performance on the table, especially so for
userspace. Every arch should get a dedicated variant instead.

In the meantime this commit lessens the problem.

Tested with glibc test suite.

Naive test just calling strlen in a loop on Haswell (ops/s):

$(perl -e "print 'A' x 3"):
before: 211198039
after: 338626619

$(perl -e "print 'A' x 100"):
before: 83151997
after: 98285919

(cherry picked from commit 710e45c4b8539d028877769f1a4ec088c48fb5f1)

3 years agopoll: use fget_unlocked or fget_only_user when feasible
Mateusz Guzik [Thu, 28 Jan 2021 23:52:08 +0000 (00:52 +0100)]
poll: use fget_unlocked or fget_only_user when feasible

This follows select by eleminating the use of filedesc lock.
This is a win for single-threaded processes and a mixed bag for others
as at small concurrency it is faster to take the lock instead of
refing/unrefing each file descriptor.

Nonetheless, removal of shared lock usage is a step towards a
mtx-protected fd table.

(cherry picked from commit 45e1f8541428c19f63dba65d78a8d138e1bc6915)

3 years agoselect: employ fget_only_user
Mateusz Guzik [Thu, 28 Jan 2021 23:33:46 +0000 (00:33 +0100)]
select: employ fget_only_user

Since most select users are single-threaded this avoid a lot of work
in the common case.

For example select of 16 fds (ops/s):
before: 2114536
after: 2991010

(cherry picked from commit 6affe1b71238df7bbbca6e2059e5494d91e68d2d)

3 years agofd: add fget_only_user
Mateusz Guzik [Thu, 28 Jan 2021 23:27:44 +0000 (00:27 +0100)]
fd: add fget_only_user

This can be used by single-threaded processes which don't share a file
descriptor table to access their file objects without having to
reference them.

For example select consumers tend to match the requirement and have
several file descriptors to inspect.

(cherry picked from commit eaad8d1303da500ed691bd774742a4555a05e729)

3 years agocache: add missing MNT_NOSYMFOLLOW check to symlink traversal
Mateusz Guzik [Wed, 27 Jan 2021 14:59:53 +0000 (15:59 +0100)]
cache: add missing MNT_NOSYMFOLLOW check to symlink traversal

(cherry picked from commit 5c325977b1138828367f39a3f2034af24c3654f0)

3 years agocache: fallback when encountering a mount point during .. lookup
Mateusz Guzik [Wed, 27 Jan 2021 12:52:23 +0000 (13:52 +0100)]
cache: fallback when encountering a mount point during .. lookup

The current abort is overzealous.

(cherry picked from commit 5fc384d1810a3a0a0acefc67abe1daf6d6cd09e4)

3 years agoconf/kern.mk: save some work by using realpath instead of cd ; pwd
Mateusz Guzik [Wed, 27 Jan 2021 12:25:21 +0000 (13:25 +0100)]
conf/kern.mk: save some work by using realpath instead of cd ; pwd

I did not check if the entire ordeal can be avoided in the first place.

(cherry picked from commit bcb7f57aa22757dd0206e88894bc003a93d0c351)

3 years agocache: tidy up handling of foo/bar lookups where foo is not a directory
Mateusz Guzik [Tue, 26 Jan 2021 16:19:12 +0000 (17:19 +0100)]
cache: tidy up handling of foo/bar lookups where foo is not a directory

The code was performing an avoidable check for doomed state to account
for foo being a VDIR but turning VBAD. Now that dooming puts a vnode
in a permanent "modify" state this is no longer necessary as the final
status check will catch it.

(cherry picked from commit a098a831a162fcd55b0097c95e6840621d8c720a)

3 years agocache: stop referring to removing entries as invalidating them
Mateusz Guzik [Tue, 26 Jan 2021 20:31:16 +0000 (21:31 +0100)]
cache: stop referring to removing entries as invalidating them

Said use is a remnant from the old code and clashes with the NCF_INVALID
flag.

(cherry picked from commit a51eca7936db50a57d2324d945c3be715df749cd)

3 years agocache: convert cache_fplookup_parse to void now that it always succeeds
Mateusz Guzik [Tue, 26 Jan 2021 00:40:47 +0000 (01:40 +0100)]
cache: convert cache_fplookup_parse to void now that it always succeeds

(cherry picked from commit 6943671b481e571f2f1ffbe407a4d75241d1174e)

3 years agocache: change ->v_cache_dd synchronisation rules
Mateusz Guzik [Mon, 25 Jan 2021 20:49:09 +0000 (21:49 +0100)]
cache: change ->v_cache_dd synchronisation rules

Instead of resorting to seqc modification take advantage of immutability
of entries and check if the entry still matches after everything got
prepared.

(cherry picked from commit e7cf562a40fc093df054bd7fa6f34746069a984a)

3 years agocache: make ->v_cache_dd accesses atomic-clean for lockless usage
Mateusz Guzik [Mon, 25 Jan 2021 20:29:54 +0000 (21:29 +0100)]
cache: make ->v_cache_dd accesses atomic-clean for lockless usage

(cherry picked from commit 6f0842764946ed57382293cc3361b86955308084)